diff --git a/.gitignore b/.gitignore
index e50e2d9..a7d022e9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -338,7 +338,6 @@
 /third_party/libphonenumber/libphonenumber_without_metadata.xml
 /third_party/libphonenumber/src
 /third_party/libsrtp
-/third_party/libvpx
 /third_party/libvpx_new/source/libvpx
 /third_party/libwebm/source
 /third_party/libyuv
@@ -444,4 +443,4 @@
 /win8/delegate_execute/delegate_execute_version_resources.xml
 /win8/metro_driver/metro_driver_version_resources.xml
 /x86-generic_out/
-/xcodebuild
\ No newline at end of file
+/xcodebuild
diff --git a/.gn b/.gn
index de2b38e..846d93b1 100644
--- a/.gn
+++ b/.gn
@@ -116,7 +116,6 @@
 # discouraged except for gypi_to_gn calls.
 exec_script_whitelist = [
   "//ash/BUILD.gn",
-  "//build/config/android/BUILD.gn",
   "//build/config/android/config.gni",
   "//build/config/android/internal_rules.gni",
   "//build/config/android/rules.gni",
@@ -126,6 +125,7 @@
   "//build/config/linux/BUILD.gn",
   "//build/config/linux/pkg_config.gni",
   "//build/config/mac/mac_sdk.gni",
+  "//build/config/posix/BUILD.gn",
   "//build/config/win/BUILD.gn",
   "//build/config/win/visual_studio_version.gni",
   "//build/gn_helpers.py",
diff --git a/AUTHORS b/AUTHORS
index 7614acb..4615d331 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -550,6 +550,7 @@
 Sunitha Srivatsa <srivats@amazon.com>
 Suyash Sengar <suyash.s@samsung.com>
 Sunil Ratnu <sunil.ratnu@samsung.com>
+Suvanjan Mukherjee <suvanjanmukherjee@gmail.com>
 Swati Jaiswal <swa.jaiswal@samsung.com>
 Sylvain Zimmer <sylvinus@gmail.com>
 Szymon Piechowicz <szymonpiechowicz@o2.pl>
diff --git a/BUILD.gn b/BUILD.gn
index e186437c..1ede840 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -149,6 +149,13 @@
       "//third_party/WebKit/Source/wtf:wtf_unittests",
       "//third_party/cacheinvalidation:cacheinvalidation_unittests",
       "//third_party/codesighs",
+
+      # TODO(use-new-edk):
+      #"//mojo/edk/system:mojo_system_unittests",
+      #"//mojo/edk/test:mojo_public_bindings_unittests",
+      #"//mojo/edk/test:mojo_public_environment_unittests",
+      #"//mojo/edk/test:mojo_public_system_unittests",
+      #"//mojo/edk/test:mojo_public_utility_unittests",
       "//third_party/mojo/src/mojo/edk/system:mojo_system_unittests",
       "//third_party/mojo/src/mojo/edk/test:mojo_public_bindings_unittests",
       "//third_party/mojo/src/mojo/edk/test:mojo_public_environment_unittests",
@@ -473,6 +480,9 @@
       "//sync/tools:sync_client",
       "//sync/tools:sync_listen_notifications",
       "//testing/gmock:gmock_main",
+
+      # TODO(use-new-edk):
+      #"//mojo/edk/test:mojo_public_system_perftests",
       "//third_party/mojo/src/mojo/edk/test:mojo_public_system_perftests",
       "//ui/keyboard:keyboard_unittests",
       "//ui/message_center:message_center_unittests",
@@ -483,15 +493,12 @@
       "//third_party/sqlite:sqlite_shell",
     ]
 
-    if (current_toolchain == host_toolchain) {
-      # Do not build the breakpad utilities in cross-compiles.
-      deps += [
-        "//breakpad:dump_syms",
-        "//breakpad:microdump_stackwalk",
-        "//breakpad:minidump_dump",
-        "//breakpad:minidump_stackwalk",
-      ]
-    }
+    deps += [
+      "//breakpad:dump_syms($host_toolchain)",
+      "//breakpad:microdump_stackwalk($host_toolchain)",
+      "//breakpad:minidump_dump($host_toolchain)",
+      "//breakpad:minidump_stackwalk($host_toolchain)",
+    ]
 
     if (!is_debug && !is_component_build) {
       deps += [ "//chrome/tools/service_discovery_sniffer" ]
@@ -727,6 +734,9 @@
       "//media/mojo/services:cdm_service",
       "//media/mojo:tests",
       "//mojo:tests",
+      # TODO(use-new-edk):
+      #"//mojo/edk/js/test:js_integration_tests",
+      #"//mojo/edk/js/tests:js_to_cpp_bindings_python",
       "//third_party/mojo/src/mojo/edk/js/test:js_integration_tests",
     ]
   }
@@ -848,6 +858,13 @@
       "//sql:sql_unittests",  # PASSES 2/25/2015
       "//sync:sync_unit_tests",  # PASSES 2/25/2015
       "//third_party/cacheinvalidation:cacheinvalidation_unittests",  # PASSES 2/25/2015
+
+      # TODO(use-new-edk):
+      #"//mojo/edk/system:mojo_system_unittests",  # PASSES 2/25/2015
+      #"//mojo/edk/test:mojo_public_bindings_unittests",  # PASSES 2/25/2015
+      #"//mojo/edk/test:mojo_public_environment_unittests",  # PASSES 2/25/2015
+      #"//mojo/edk/test:mojo_public_system_unittests",  # PASSES 2/25/2015
+      #"//mojo/edk/test:mojo_public_utility_unittests",
       "//third_party/mojo/src/mojo/edk/system:mojo_system_unittests",  # PASSES 2/25/2015
       "//third_party/mojo/src/mojo/edk/test:mojo_public_bindings_unittests",  # PASSES 2/25/2015
       "//third_party/mojo/src/mojo/edk/test:mojo_public_environment_unittests",  # PASSES 2/25/2015
@@ -920,6 +937,13 @@
       "//sql:sql_unittests",  # PASSES 4/17/2015
       "//sync:sync_unit_tests",  # PASSES 4/20/2015
       "//third_party/cacheinvalidation:cacheinvalidation_unittests",  # PASSES 4/20/2015
+
+      # TODO(use-new-edk):
+      #"//mojo/edk/system:mojo_system_unittests",  # Seems to hang?
+      #"//mojo/edk/test:mojo_public_bindings_unittests",  # FAILS
+      #"//mojo/edk/test:mojo_public_environment_unittests",  # PASSES 4/20/2015
+      #"//mojo/edk/test:mojo_public_system_unittests",  # PASSES 4/20/2015
+      #"//mojo/edk/test:mojo_public_utility_unittests",  # PASSES 4/20/2015
       "//third_party/mojo/src/mojo/edk/system:mojo_system_unittests",  # Seems to hang?
       "//third_party/mojo/src/mojo/edk/test:mojo_public_bindings_unittests",  # FAILS
       "//third_party/mojo/src/mojo/edk/test:mojo_public_environment_unittests",  # PASSES 4/20/2015
@@ -986,7 +1010,7 @@
         ]
       }
     } else {
-      deps += [ "//breakpad:minidump_stackwalk" ]
+      deps += [ "//breakpad:minidump_stackwalk($host_toolchain)" ]
     }
   }
 }
diff --git a/DEPS b/DEPS
index 9f2adb6..ff9ec7ae 100644
--- a/DEPS
+++ b/DEPS
@@ -33,10 +33,6 @@
   'googlecode_url': 'http://%s.googlecode.com/svn',
   'chromium_git': 'https://chromium.googlesource.com',
   # Three lines of non-changing comments so that
-  # the commit queue can handle CLs rolling libvpx
-  # and whatever else without interference from each other.
-  'libvpx_revision': 'b33794b9132c8c1722206d6676c37177ccbaef2e',
-  # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling sfntly
   # and whatever else without interference from each other.
   'sfntly_revision': '130f832eddf98467e6578b548cb74ce17d04a26d',
@@ -47,7 +43,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling V8
   # and whatever else without interference from each other.
-  'v8_revision': '487ef04e9d3d0daf63304891cc93d4b10dd4c85f',
+  'v8_revision': '5d866a56e5778c1094d343c93dfbbe323772562d',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling swarming_client
   # and whatever else without interference from each other.
@@ -55,7 +51,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling ANGLE
   # and whatever else without interference from each other.
-  'angle_revision': '9bf70365fbc05d5e4a3f12a182beec7c1f623f4e',
+  'angle_revision': '8bd4b6c52e8a97093ed6c603287658cb46c334fd',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling build tools
   # and whatever else without interference from each other.
@@ -63,7 +59,7 @@
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling PDFium
   # and whatever else without interference from each other.
-  'pdfium_revision': '20fc82efdc9c9e4caa6e72d05a83b9206e8c8f72',
+  'pdfium_revision': '3dedace9623fef6161a8666e53a4ab2b9be61e4c',
   # Three lines of non-changing comments so that
   # the commit queue can handle CLs rolling openmax_dl
   # and whatever else without interference from each other.
@@ -131,7 +127,7 @@
    Var('chromium_git') + '/external/colorama.git' + '@' + '799604a1041e9b3bc5d2789ecbd7e8db2e18e6b8',
 
   'src/third_party/crashpad/crashpad':
-   Var('chromium_git') + '/crashpad/crashpad.git' + '@' + '595803e1be18aa789ba561aa06db73cfc3c2e7a2',
+   Var('chromium_git') + '/crashpad/crashpad.git' + '@' + 'cd85c9f700f7efda7ffa36e0017806a2263f4d08',
 
   'src/third_party/icu':
    Var('chromium_git') + '/chromium/deps/icu.git' + '@' + '94e4b770ce2f6065d4261d29c32683a6099b9d93',
@@ -190,9 +186,6 @@
   'src/third_party/webdriver/pylib':
     Var('chromium_git') + '/external/selenium/py.git' + '@' + '5fd78261a75fe08d27ca4835fb6c5ce4b42275bd',
 
-  'src/third_party/libvpx':
-   Var('chromium_git') + '/chromium/deps/libvpx.git' + '@' +  Var('libvpx_revision'),
-
   'src/third_party/libvpx_new/source/libvpx':
    Var('chromium_git') + '/webm/libvpx.git' + '@' +  '7d28d12ef34f6cbb6b1e18f3b23b71392fd3ddf5',
 
@@ -200,7 +193,7 @@
    Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + '525a71ab8ee3b61da48138f7e1c406989d2879fc',
 
   'src/third_party/libjingle/source/talk':
-    Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + '947015d9d45075690239b9e3cbacd7979da10c95', # commit position 10133
+    Var('chromium_git') + '/external/webrtc/trunk/talk.git' + '@' + '302b7195a9044da3e539ca6929241d04f3e34bc4', # commit position 10148
 
   'src/third_party/usrsctp/usrsctplib':
     Var('chromium_git') + '/external/usrsctplib.git' + '@' + '36444a999739e9e408f8f587cb4c3ffeef2e50ac', # from svn revision 9215
@@ -224,7 +217,7 @@
    Var('chromium_git') + '/native_client/src/third_party/scons-2.0.1.git' + '@' + '1c1550e17fc26355d08627fbdec13d8291227067',
 
   'src/third_party/webrtc':
-    Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + 'c8a695fcf95cdeebac84d79b1e184c4c07133361', # commit position 10134
+    Var('chromium_git') + '/external/webrtc/trunk/webrtc.git' + '@' + '5dd7527392d8867c78b850ff2b40d582f1fb00f5', # commit position 10155
 
   'src/third_party/openmax_dl':
     Var('chromium_git') + '/external/webrtc/deps/third_party/openmax.git' + '@' +  Var('openmax_dl_revision'),
diff --git a/WATCHLISTS b/WATCHLISTS
index a8e7575..2c46608 100644
--- a/WATCHLISTS
+++ b/WATCHLISTS
@@ -92,7 +92,6 @@
                   'chrome/browser/ui/android/autofill/|'\
                   'chrome/browser/ui/autofill/|'\
                   'chrome/browser/ui/cocoa/autofill/|'\
-                  'chrome/browser/ui/gtk/autofill/|'\
                   'chrome/browser/ui/views/autofill/|'\
                   'chrome/browser/ui/webui/options/autofill_|'\
                   'chrome/renderer/autofill/|'\
@@ -325,7 +324,6 @@
                   'chrome/browser/ui/webui/.*downloads|' \
                   'chrome/browser/ui/views/download/|' \
                   'chrome/browser/ui/cocoa/download/|' \
-                  'chrome/browser/ui/gtk/download/'
     },
     'drive': {
       'filepath': 'chrome/browser/chromeos/drive/|' \
@@ -598,7 +596,6 @@
     'panels': {
       'filepath': 'chrome/browser/ui/panels'\
                   '|chrome/browser/ui/cocoa/panels'\
-                  '|chrome/browser/ui/gtk/panels'\
                   '|chrome/browser/ui/views/panels'
     },
     'password_manager': {
diff --git a/android_webview/browser/aw_permission_manager.cc b/android_webview/browser/aw_permission_manager.cc
index 6fe1e1e4..cd15346 100644
--- a/android_webview/browser/aw_permission_manager.cc
+++ b/android_webview/browser/aw_permission_manager.cc
@@ -10,7 +10,6 @@
 #include "base/callback.h"
 #include "base/containers/hash_tables.h"
 #include "base/logging.h"
-#include "base/memory/weak_ptr.h"
 #include "content/public/browser/permission_type.h"
 #include "content/public/browser/render_frame_host.h"
 #include "content/public/browser/render_process_host.h"
@@ -23,7 +22,7 @@
 
 class LastRequestResultCache {
  public:
-  LastRequestResultCache() : weak_factory_(this) {}
+  LastRequestResultCache() = default;
 
   void SetResult(PermissionType permission,
                  const GURL& requesting_origin,
@@ -114,10 +113,6 @@
     pmi_result_cache_.erase(key);
   }
 
-  base::WeakPtr<LastRequestResultCache> GetWeakPtr() {
-    return weak_factory_.GetWeakPtr();
-  }
-
  private:
   // Returns a concatenation of the origins to be used as the index.
   // Returns the empty string if either origin is invalid or empty.
@@ -133,44 +128,47 @@
   using StatusMap = base::hash_map<std::string, PermissionStatus>;
   StatusMap pmi_result_cache_;
 
-  base::WeakPtrFactory<LastRequestResultCache> weak_factory_;
-
   DISALLOW_COPY_AND_ASSIGN(LastRequestResultCache);
 };
 
-namespace {
-
-void CallbackPermisisonStatusWrapper(
-    const base::WeakPtr<LastRequestResultCache>& result_cache,
-    const base::Callback<void(PermissionStatus)>& callback,
-    PermissionType permission,
-    const GURL& requesting_origin,
-    const GURL& embedding_origin,
-    bool allowed) {
-  PermissionStatus status = allowed ? content::PERMISSION_STATUS_GRANTED
-                                    : content::PERMISSION_STATUS_DENIED;
-  if (result_cache.get()) {
-    result_cache->SetResult(permission, requesting_origin, embedding_origin,
-                            status);
+struct AwPermissionManager::PendingRequest {
+ public:
+  PendingRequest(PermissionType permission,
+                 GURL requesting_origin,
+                 GURL embedding_origin,
+                 content::RenderFrameHost* render_frame_host,
+                 const base::Callback<void(PermissionStatus)>& callback)
+    : permission(permission),
+      requesting_origin(requesting_origin),
+      embedding_origin(embedding_origin),
+      render_process_id(render_frame_host->GetProcess()->GetID()),
+      render_frame_id(render_frame_host->GetRoutingID()),
+      callback(callback) {
   }
 
-  callback.Run(status);
-}
+  ~PendingRequest() = default;
 
-}  // anonymous namespace
+  PermissionType permission;
+  GURL requesting_origin;
+  GURL embedding_origin;
+  int render_process_id;
+  int render_frame_id;
+  base::Callback<void(PermissionStatus)> callback;
+};
 
 AwPermissionManager::AwPermissionManager()
-    : content::PermissionManager(), result_cache_(new LastRequestResultCache) {
+  : content::PermissionManager(),
+    result_cache_(new LastRequestResultCache),
+    weak_ptr_factory_(this) {
 }
 
 AwPermissionManager::~AwPermissionManager() {
 }
 
-void AwPermissionManager::RequestPermission(
+int AwPermissionManager::RequestPermission(
     PermissionType permission,
     content::RenderFrameHost* render_frame_host,
-    int request_id,
-    const GURL& origin,
+    const GURL& requesting_origin,
     bool user_gesture,
     const base::Callback<void(PermissionStatus)>& callback) {
   int render_process_id = render_frame_host->GetProcess()->GetID();
@@ -182,31 +180,63 @@
     DVLOG(0) << "Dropping permission request for "
              << static_cast<int>(permission);
     callback.Run(content::PERMISSION_STATUS_DENIED);
-    return;
+    return kNoPendingOperation;
+  }
+
+  // Do not delegate any requests which are already pending.
+  bool should_delegate_request = true;
+  for (PendingRequestsMap::Iterator<PendingRequest> it(&pending_requests_);
+       !it.IsAtEnd(); it.Advance()) {
+    if (permission == it.GetCurrentValue()->permission) {
+      should_delegate_request = false;
+      break;
+    }
   }
 
   const GURL& embedding_origin =
       content::WebContents::FromRenderFrameHost(render_frame_host)
           ->GetLastCommittedURL().GetOrigin();
 
+  int request_id = kNoPendingOperation;
   switch (permission) {
     case PermissionType::GEOLOCATION:
-      delegate->RequestGeolocationPermission(
-          origin, base::Bind(&CallbackPermisisonStatusWrapper,
-                             result_cache_->GetWeakPtr(), callback, permission,
-                             origin, embedding_origin));
+      request_id = pending_requests_.Add(new PendingRequest(
+          permission, requesting_origin,
+          embedding_origin, render_frame_host,
+          callback));
+      if (should_delegate_request) {
+        delegate->RequestGeolocationPermission(
+            requesting_origin,
+            base::Bind(&OnRequestResponse,
+                       weak_ptr_factory_.GetWeakPtr(), request_id,
+                       callback));
+      }
       break;
     case PermissionType::PROTECTED_MEDIA_IDENTIFIER:
-      delegate->RequestProtectedMediaIdentifierPermission(
-          origin, base::Bind(&CallbackPermisisonStatusWrapper,
-                             result_cache_->GetWeakPtr(), callback, permission,
-                             origin, embedding_origin));
+      request_id = pending_requests_.Add(new PendingRequest(
+          permission, requesting_origin,
+          embedding_origin, render_frame_host,
+          callback));
+      if (should_delegate_request) {
+        delegate->RequestProtectedMediaIdentifierPermission(
+            requesting_origin,
+            base::Bind(&OnRequestResponse,
+                       weak_ptr_factory_.GetWeakPtr(), request_id,
+                       callback));
+      }
       break;
     case PermissionType::MIDI_SYSEX:
-      delegate->RequestMIDISysexPermission(
-          origin, base::Bind(&CallbackPermisisonStatusWrapper,
-                             result_cache_->GetWeakPtr(), callback, permission,
-                             origin, embedding_origin));
+      request_id = pending_requests_.Add(new PendingRequest(
+          permission, requesting_origin,
+          embedding_origin, render_frame_host,
+          callback));
+      if (should_delegate_request) {
+        delegate->RequestMIDISysexPermission(
+            requesting_origin,
+            base::Bind(&OnRequestResponse,
+                       weak_ptr_factory_.GetWeakPtr(), request_id,
+                       callback));
+      }
       break;
     case PermissionType::AUDIO_CAPTURE:
     case PermissionType::VIDEO_CAPTURE:
@@ -225,38 +255,84 @@
       callback.Run(content::PERMISSION_STATUS_DENIED);
       break;
   }
+  return request_id;
 }
 
-void AwPermissionManager::CancelPermissionRequest(
-    PermissionType permission,
-    content::RenderFrameHost* render_frame_host,
+// static
+void AwPermissionManager::OnRequestResponse(
+    const base::WeakPtr<AwPermissionManager>& manager,
     int request_id,
-    const GURL& origin) {
+    const base::Callback<void(PermissionStatus)>& callback,
+    bool allowed) {
+  PermissionStatus status = allowed ? content::PERMISSION_STATUS_GRANTED
+                                    : content::PERMISSION_STATUS_DENIED;
+  if (manager.get()) {
+    PendingRequest* pending_request =
+        manager->pending_requests_.Lookup(request_id);
+
+    for (PendingRequestsMap::Iterator<PendingRequest> it(
+            &manager->pending_requests_);
+         !it.IsAtEnd(); it.Advance()) {
+      if (pending_request->permission == it.GetCurrentValue()->permission &&
+          it.GetCurrentKey() != request_id) {
+        it.GetCurrentValue()->callback.Run(status);
+        manager->pending_requests_.Remove(it.GetCurrentKey());
+      }
+    }
+
+    manager->result_cache_->SetResult(
+        pending_request->permission,
+        pending_request->requesting_origin,
+        pending_request->embedding_origin,
+        status);
+    manager->pending_requests_.Remove(request_id);
+  }
+  callback.Run(status);
+}
+
+void AwPermissionManager::CancelPermissionRequest(int request_id) {
+  PendingRequest* pending_request = pending_requests_.Lookup(request_id);
+  if (!pending_request)
+    return;
+
+  content::RenderFrameHost* render_frame_host =
+      content::RenderFrameHost::FromID(pending_request->render_process_id,
+          pending_request->render_frame_id);
+  content::WebContents* web_contents =
+      content::WebContents::FromRenderFrameHost(render_frame_host);
+  DCHECK(web_contents);
+
   // The caller is canceling (presumably) the most recent request. Assuming the
   // request did not complete, the user did not respond to the requset.
   // Thus, assume we do not know the result.
-  const GURL& embedding_origin =
-      content::WebContents::FromRenderFrameHost(render_frame_host)
+  const GURL& embedding_origin = web_contents
           ->GetLastCommittedURL().GetOrigin();
-  result_cache_->ClearResult(permission, origin, embedding_origin);
+  result_cache_->ClearResult(
+      pending_request->permission,
+      pending_request->requesting_origin,
+      embedding_origin);
 
-  int render_process_id = render_frame_host->GetProcess()->GetID();
-  int render_frame_id = render_frame_host->GetRoutingID();
   AwBrowserPermissionRequestDelegate* delegate =
-      AwBrowserPermissionRequestDelegate::FromID(render_process_id,
-                                                 render_frame_id);
-  if (!delegate)
+      AwBrowserPermissionRequestDelegate::FromID(
+          pending_request->render_process_id,
+          pending_request->render_frame_id);
+  if (!delegate) {
+    pending_requests_.Remove(request_id);
     return;
+  }
 
-  switch (permission) {
+  switch (pending_request->permission) {
     case PermissionType::GEOLOCATION:
-      delegate->CancelGeolocationPermissionRequests(origin);
+      delegate->CancelGeolocationPermissionRequests(
+          pending_request->requesting_origin);
       break;
     case PermissionType::PROTECTED_MEDIA_IDENTIFIER:
-      delegate->CancelProtectedMediaIdentifierPermissionRequests(origin);
+      delegate->CancelProtectedMediaIdentifierPermissionRequests(
+          pending_request->requesting_origin);
       break;
     case PermissionType::MIDI_SYSEX:
-      delegate->CancelMIDISysexPermissionRequests(origin);
+      delegate->CancelMIDISysexPermissionRequests(
+          pending_request->requesting_origin);
       break;
     case PermissionType::NOTIFICATIONS:
     case PermissionType::PUSH_MESSAGING:
@@ -264,7 +340,7 @@
     case PermissionType::AUDIO_CAPTURE:
     case PermissionType::VIDEO_CAPTURE:
       NOTIMPLEMENTED() << "CancelPermission not implemented for "
-                       << static_cast<int>(permission);
+                       << static_cast<int>(pending_request->permission);
       break;
     case PermissionType::MIDI:
       // There is nothing to cancel so this is simply ignored.
@@ -273,6 +349,8 @@
       NOTREACHED() << "PermissionType::NUM was not expected here.";
       break;
   }
+
+  pending_requests_.Remove(request_id);
 }
 
 void AwPermissionManager::ResetPermission(PermissionType permission,
@@ -307,7 +385,7 @@
     const GURL& requesting_origin,
     const GURL& embedding_origin,
     const base::Callback<void(PermissionStatus)>& callback) {
-  return -1;
+  return kNoPendingOperation;
 }
 
 void AwPermissionManager::UnsubscribePermissionStatusChange(
diff --git a/android_webview/browser/aw_permission_manager.h b/android_webview/browser/aw_permission_manager.h
index 842170b0..ab507ce 100644
--- a/android_webview/browser/aw_permission_manager.h
+++ b/android_webview/browser/aw_permission_manager.h
@@ -6,8 +6,10 @@
 #define ANDROID_WEBVIEW_BROWSER_AW_PERMISSION_MANAGER_H_
 
 #include "base/callback_forward.h"
+#include "base/id_map.h"
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
 #include "content/public/browser/permission_manager.h"
 
 namespace android_webview {
@@ -20,17 +22,13 @@
   ~AwPermissionManager() override;
 
   // PermissionManager implementation.
-  void RequestPermission(
+  int RequestPermission(
       content::PermissionType permission,
       content::RenderFrameHost* render_frame_host,
-      int request_id,
       const GURL& requesting_origin,
       bool user_gesture,
       const base::Callback<void(content::PermissionStatus)>& callback) override;
-  void CancelPermissionRequest(content::PermissionType permission,
-                               content::RenderFrameHost* render_frame_host,
-                               int request_id,
-                               const GURL& requesting_origin) override;
+  void CancelPermissionRequest(int request_id) override;
   void ResetPermission(content::PermissionType permission,
                        const GURL& requesting_origin,
                        const GURL& embedding_origin) override;
@@ -49,8 +47,24 @@
   void UnsubscribePermissionStatusChange(int subscription_id) override;
 
  private:
+  struct PendingRequest;
+  using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
+
+  // The weak pointer to this is used to clean up any information which is
+  // stored in the pending request or result cache maps. However, the callback
+  // should be run regardless of whether the class is still alive so the method
+  // is static.
+  static void OnRequestResponse(
+      const base::WeakPtr<AwPermissionManager>& manager,
+      int request_id,
+      const base::Callback<void(content::PermissionStatus)>& callback,
+      bool allowed);
+
+  PendingRequestsMap pending_requests_;
   scoped_ptr<LastRequestResultCache> result_cache_;
 
+  base::WeakPtrFactory<AwPermissionManager> weak_ptr_factory_;
+
   DISALLOW_COPY_AND_ASSIGN(AwPermissionManager);
 };
 
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java
new file mode 100644
index 0000000..4684d89
--- /dev/null
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwPermissionManagerTest.java
@@ -0,0 +1,98 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.android_webview.test;
+
+import android.os.Build;
+import android.os.Handler;
+import android.os.Looper;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.android_webview.AwContents;
+import org.chromium.android_webview.permission.AwPermissionRequest;
+import org.chromium.android_webview.test.util.CommonResources;
+import org.chromium.base.test.util.Feature;
+import org.chromium.base.test.util.MinAndroidSdkLevel;
+import org.chromium.net.test.util.TestWebServer;
+
+import java.util.concurrent.Callable;
+
+/**
+ * Test AwPermissionManager.
+ */
+@MinAndroidSdkLevel(Build.VERSION_CODES.KITKAT)
+public class AwPermissionManagerTest extends AwTestBase {
+
+    private static final String REQUEST_DUPLICATE = "<html> <script>"
+            + "navigator.requestMIDIAccess({sysex: true}).then(function() {"
+            + "});"
+            + "navigator.requestMIDIAccess({sysex: true}).then(function() {"
+            + "  window.document.title = 'second-granted';"
+            + "});"
+            + "</script><body>"
+            + "</body></html>";
+
+    private TestWebServer mTestWebServer;
+    private String mPage;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mTestWebServer = TestWebServer.start();
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        mTestWebServer.shutdown();
+        mTestWebServer = null;
+        super.tearDown();
+    }
+
+    @Feature({"AndroidWebView"})
+    @SmallTest
+    public void testRequestMultiple() throws Throwable {
+        mPage = mTestWebServer.setResponse("/permissions", REQUEST_DUPLICATE,
+                CommonResources.getTextHtmlHeaders(true));
+
+        TestAwContentsClient contentsClient = new TestAwContentsClient() {
+            private boolean mCalled = false;
+
+            @Override
+            public void onPermissionRequest(final AwPermissionRequest awPermissionRequest) {
+                if (mCalled) {
+                    fail("Only one request was expected");
+                    return;
+                }
+                mCalled = true;
+
+                // Emulate a delayed response to the request by running four seconds in the future.
+                Handler handler = new Handler(Looper.myLooper());
+                handler.postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        awPermissionRequest.grant();
+                    }
+                }, 4000);
+            }
+        };
+
+        final AwTestContainerView testContainerView =
+                createAwTestContainerViewOnMainSync(contentsClient);
+        final AwContents awContents = testContainerView.getAwContents();
+        enableJavaScriptOnUiThread(awContents);
+        loadUrlAsync(awContents, mPage, null);
+        pollTitleAs("second-granted", awContents);
+    }
+
+    private void pollTitleAs(final String title, final AwContents awContents)
+            throws Exception {
+        poll(new Callable<Boolean>() {
+            @Override
+            public Boolean call() throws Exception {
+                return title.equals(getTitleOnUiThread(awContents));
+            }
+        });
+    }
+}
+
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java
index ccc036f..3509cadd4 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java
@@ -121,10 +121,9 @@
         assertEquals("\"supported\"", isKeySystemSupported("x-com.oem.test-keysystem"));
     }
 
-    // TODO(ddorwin): This should fail: http://crbug.com/531764.
     @Feature({"AndroidWebView"})
     @SmallTest
     public void testSupportPlatformKeySystemNoPrefix() throws Throwable {
-        assertEquals("\"supported\"", isKeySystemSupported("com.oem.test-keysystem"));
+        assertEquals("\"NotSupportedError\"", isKeySystemSupported("com.oem.test-keysystem"));
     }
 }
diff --git a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
index 8b5a615..1bbf97d1 100644
--- a/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
+++ b/android_webview/test/shell/src/org/chromium/android_webview/shell/AwShellApplication.java
@@ -4,7 +4,6 @@
 
 package org.chromium.android_webview.shell;
 
-import org.chromium.android_webview.AwBrowserProcess;
 import org.chromium.android_webview.R;
 import org.chromium.base.CommandLine;
 import org.chromium.base.annotations.SuppressFBWarnings;
@@ -15,6 +14,10 @@
  * The android_webview shell Application subclass.
  */
 public class AwShellApplication extends ContentApplication {
+    public AwShellApplication() {
+        super(false /* mShouldInitializeApplicationStatusTracking */);
+    }
+
     @Override
     public void onCreate() {
         super.onCreate();
diff --git a/ash/wm/maximize_mode/maximize_mode_controller.cc b/ash/wm/maximize_mode/maximize_mode_controller.cc
index 06713b69..50403ec 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller.cc
@@ -18,6 +18,7 @@
 #include "ui/base/accelerators/accelerator.h"
 #include "ui/events/event.h"
 #include "ui/events/keycodes/keyboard_codes.h"
+#include "ui/gfx/display.h"
 #include "ui/gfx/geometry/vector3d_f.h"
 
 #if defined(USE_X11)
@@ -114,6 +115,7 @@
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kAshEnableTouchView)) {
     chromeos::AccelerometerReader::GetInstance()->AddObserver(this);
+    shell->window_tree_host_manager()->AddObserver(this);
   }
   chromeos::DBusThreadManager::Get()->
       GetPowerManagerClient()->AddObserver(this);
@@ -126,6 +128,7 @@
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kAshEnableTouchView)) {
     chromeos::AccelerometerReader::GetInstance()->RemoveObserver(this);
+    Shell::GetInstance()->window_tree_host_manager()->RemoveObserver(this);
   }
   chromeos::DBusThreadManager::Get()->
       GetPowerManagerClient()->RemoveObserver(this);
@@ -185,6 +188,14 @@
   if (!update->has(chromeos::ACCELEROMETER_SOURCE_SCREEN))
     return;
 
+  if (!gfx::Display::HasInternalDisplay())
+    return;
+
+  if (!Shell::GetInstance()->display_manager()->IsActiveDisplayId(
+          gfx::Display::InternalDisplayId())) {
+    return;
+  }
+
   // Whether or not we enter maximize mode affects whether we handle screen
   // rotation, so determine whether to enter maximize mode first.
   if (!update->has(chromeos::ACCELEROMETER_SOURCE_ATTACHED_KEYBOARD)) {
@@ -322,6 +333,14 @@
   RecordTouchViewUsageInterval(TOUCH_VIEW_INTERVAL_ACTIVE);
 }
 
+void MaximizeModeController::OnDisplayConfigurationChanged() {
+  if (!gfx::Display::HasInternalDisplay() ||
+      !Shell::GetInstance()->display_manager()->IsActiveDisplayId(
+          gfx::Display::InternalDisplayId())) {
+    LeaveMaximizeMode();
+  }
+}
+
 void MaximizeModeController::RecordTouchViewUsageInterval(
     TouchViewIntervalType type) {
   if (!CanEnterMaximizeMode())
diff --git a/ash/wm/maximize_mode/maximize_mode_controller.h b/ash/wm/maximize_mode/maximize_mode_controller.h
index fc69b6d..3042ce50 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller.h
+++ b/ash/wm/maximize_mode/maximize_mode_controller.h
@@ -6,6 +6,7 @@
 #define ASH_WM_MAXIMIZE_MODE_MAXIMIZE_MODE_CONTROLLER_H_
 
 #include "ash/ash_export.h"
+#include "ash/display/window_tree_host_manager.h"
 #include "ash/shell_observer.h"
 #include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
@@ -50,7 +51,8 @@
     public chromeos::AccelerometerReader::Observer,
     public chromeos::PowerManagerClient::Observer,
 #endif  // OS_CHROMEOS
-    public ShellObserver {
+    public ShellObserver,
+    public WindowTreeHostManager::Observer {
  public:
   MaximizeModeController();
   ~MaximizeModeController() override;
@@ -81,6 +83,9 @@
   void OnMaximizeModeStarted() override;
   void OnMaximizeModeEnded() override;
 
+  // WindowTreeHostManager::Observer:
+  void OnDisplayConfigurationChanged() override;
+
 #if defined(OS_CHROMEOS)
   // chromeos::AccelerometerReader::Observer:
   void OnAccelerometerUpdated(
diff --git a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
index 0bc86347..fb6a389 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 #include <math.h>
+#include <vector>
 
 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
 
@@ -69,6 +70,8 @@
   ~MaximizeModeControllerTest() override {}
 
   void SetUp() override {
+    base::CommandLine::ForCurrentProcess()->AppendSwitch(
+        switches::kAshEnableTouchView);
     test::AshTestBase::SetUp();
     chromeos::AccelerometerReader::GetInstance()->RemoveObserver(
         maximize_mode_controller());
@@ -439,6 +442,30 @@
   EXPECT_EQ(w1->GetRootWindow(), w2->GetRootWindow());
 }
 
+// Test that the disabling of the internal display exits maximize mode, and that
+// while disabled we do not re-enter maximize mode.
+TEST_F(MaximizeModeControllerTest, NoMaximizeModeWithDisabledInternalDisplay) {
+  DisplayManager* display_manager = Shell::GetInstance()->display_manager();
+  UpdateDisplay("200x200, 200x200");
+  const int64 internal_display_id =
+      test::DisplayManagerTestApi().SetFirstDisplayAsInternalDisplay();
+  ASSERT_FALSE(IsMaximizeModeStarted());
+
+  OpenLidToAngle(270.0f);
+  EXPECT_TRUE(IsMaximizeModeStarted());
+
+  // Deactivate internal display to simulate Docked Mode.
+  std::vector<DisplayInfo> secondary_only;
+  secondary_only.push_back(
+      display_manager->GetDisplayInfo(display_manager->GetDisplayAt(1).id()));
+  display_manager->OnNativeDisplaysChanged(secondary_only);
+  ASSERT_FALSE(display_manager->IsActiveDisplayId(internal_display_id));
+  EXPECT_FALSE(IsMaximizeModeStarted());
+
+  OpenLidToAngle(270.0f);
+  EXPECT_FALSE(IsMaximizeModeStarted());
+}
+
 class MaximizeModeControllerSwitchesTest : public MaximizeModeControllerTest {
  public:
   MaximizeModeControllerSwitchesTest() {}
diff --git a/base/BUILD.gn b/base/BUILD.gn
index d85e792..2cb2f6dc 100644
--- a/base/BUILD.gn
+++ b/base/BUILD.gn
@@ -1303,6 +1303,7 @@
     "memory/scoped_ptr_unittest.cc",
     "memory/scoped_ptr_unittest.nc",
     "memory/scoped_vector_unittest.cc",
+    "memory/shared_memory_mac_unittest.cc",
     "memory/shared_memory_unittest.cc",
     "memory/singleton_unittest.cc",
     "memory/weak_ptr_unittest.cc",
diff --git a/base/android/java/src/org/chromium/base/BaseChromiumApplication.java b/base/android/java/src/org/chromium/base/BaseChromiumApplication.java
index 0542c80e08..1c1f826 100644
--- a/base/android/java/src/org/chromium/base/BaseChromiumApplication.java
+++ b/base/android/java/src/org/chromium/base/BaseChromiumApplication.java
@@ -16,6 +16,15 @@
 public class BaseChromiumApplication extends Application {
 
     private static final String TAG = "cr.base";
+    private final boolean mShouldInitializeApplicationStatusTracking;
+
+    public BaseChromiumApplication() {
+        this(true);
+    }
+
+    protected BaseChromiumApplication(boolean shouldInitializeApplicationStatusTracking) {
+        mShouldInitializeApplicationStatusTracking = shouldInitializeApplicationStatusTracking;
+    }
 
     /**
      * Interface to be implemented by listeners for window focus events.
@@ -35,6 +44,40 @@
     @Override
     public void onCreate() {
         super.onCreate();
+
+        if (mShouldInitializeApplicationStatusTracking) startTrackingApplicationStatus();
+    }
+
+    /**
+     * Registers a listener to receive window focus updates on activities in this application.
+     * @param listener Listener to receive window focus events.
+     */
+    public void registerWindowFocusChangedListener(WindowFocusChangedListener listener) {
+        mWindowFocusListeners.addObserver(listener);
+    }
+
+    /**
+     * Unregisters a listener from receiving window focus updates on activities in this application.
+     * @param listener Listener that doesn't want to receive window focus events.
+     */
+    public void unregisterWindowFocusChangedListener(WindowFocusChangedListener listener) {
+        mWindowFocusListeners.removeObserver(listener);
+    }
+
+    /** Initializes the {@link CommandLine}. */
+    public void initCommandLine() {}
+
+    /**
+     * This must only be called for contexts whose application is a subclass of
+     * {@link BaseChromiumApplication}.
+     */
+    @VisibleForTesting
+    public static void initCommandLine(Context context) {
+        ((BaseChromiumApplication) context.getApplicationContext()).initCommandLine();
+    }
+
+    /** Register hooks and listeners to start tracking the application status. */
+    private void startTrackingApplicationStatus() {
         ApplicationStatus.initialize(this);
         registerActivityLifecycleCallbacks(new ActivityLifecycleCallbacks() {
             @Override
@@ -82,32 +125,4 @@
             }
         });
     }
-
-    /**
-     * Registers a listener to receive window focus updates on activities in this application.
-     * @param listener Listener to receive window focus events.
-     */
-    public void registerWindowFocusChangedListener(WindowFocusChangedListener listener) {
-        mWindowFocusListeners.addObserver(listener);
-    }
-
-    /**
-     * Unregisters a listener from receiving window focus updates on activities in this application.
-     * @param listener Listener that doesn't want to receive window focus events.
-     */
-    public void unregisterWindowFocusChangedListener(WindowFocusChangedListener listener) {
-        mWindowFocusListeners.removeObserver(listener);
-    }
-
-    /** Initializes the {@link CommandLine}. */
-    public void initCommandLine() {}
-
-    /**
-     * This must only be called for contexts whose application is a subclass of
-     * {@link BaseChromiumApplication}.
-     */
-    @VisibleForTesting
-    public static void initCommandLine(Context context) {
-        ((BaseChromiumApplication) context.getApplicationContext()).initCommandLine();
-    }
 }
diff --git a/base/base.gyp b/base/base.gyp
index 0ff3893e..4b11485e0 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -531,6 +531,7 @@
         'memory/scoped_ptr_unittest.nc',
         'memory/scoped_vector_unittest.cc',
         'memory/shared_memory_unittest.cc',
+        'memory/shared_memory_mac_unittest.cc',
         'memory/singleton_unittest.cc',
         'memory/weak_ptr_unittest.cc',
         'memory/weak_ptr_unittest.nc',
@@ -1641,18 +1642,6 @@
     ['OS == "win"', {
       'targets': [
         {
-          'target_name': 'debug_message',
-          'type': 'executable',
-          'sources': [
-            'debug_message.cc',
-          ],
-          'msvs_settings': {
-            'VCLinkerTool': {
-              'SubSystem': '2',         # Set /SUBSYSTEM:WINDOWS
-            },
-          },
-        },
-        {
           # Target to manually rebuild pe_image_test.dll which is checked into
           # base/test/data/pe_image.
           'target_name': 'pe_image_test',
diff --git a/base/debug_message.cc b/base/debug_message.cc
deleted file mode 100644
index 10f441d..0000000
--- a/base/debug_message.cc
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <windows.h>
-
-// Display the command line. This program is designed to be called from
-// another process to display assertions. Since the other process has
-// complete control of our command line, we assume that it did *not*
-// add the program name as the first parameter. This allows us to just
-// show the command line directly as the message.
-int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
-                     LPSTR lpCmdLine, int nCmdShow) {
-  LPWSTR cmdline = GetCommandLineW();
-  MessageBox(NULL, cmdline, L"Kr\x00d8m", MB_TOPMOST);
-  return 0;
-}
diff --git a/base/logging.cc b/base/logging.cc
index b9d431f3..dc0b8b2 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -449,38 +449,8 @@
     return;
 
 #if defined(OS_WIN)
-  // For Windows programs, it's possible that the message loop is
-  // messed up on a fatal error, and creating a MessageBox will cause
-  // that message loop to be run. Instead, we try to spawn another
-  // process that displays its command line. We look for "Debug
-  // Message.exe" in the same directory as the application. If it
-  // exists, we use it, otherwise, we use a regular message box.
-  wchar_t prog_name[MAX_PATH];
-  GetModuleFileNameW(nullptr, prog_name, MAX_PATH);
-  wchar_t* backslash = wcsrchr(prog_name, '\\');
-  if (backslash)
-    backslash[1] = 0;
-  wcscat_s(prog_name, MAX_PATH, L"debug_message.exe");
-
-  std::wstring cmdline = base::UTF8ToWide(str);
-  if (cmdline.empty())
-    return;
-
-  STARTUPINFO startup_info;
-  memset(&startup_info, 0, sizeof(startup_info));
-  startup_info.cb = sizeof(startup_info);
-
-  PROCESS_INFORMATION process_info;
-  if (CreateProcessW(prog_name, &cmdline[0], nullptr, nullptr, false, 0,
-                     nullptr, nullptr, &startup_info, &process_info)) {
-    WaitForSingleObject(process_info.hProcess, INFINITE);
-    CloseHandle(process_info.hThread);
-    CloseHandle(process_info.hProcess);
-  } else {
-    // debug process broken, let's just do a message box
-    MessageBoxW(nullptr, &cmdline[0], L"Fatal error",
-                MB_OK | MB_ICONHAND | MB_TOPMOST);
-  }
+  MessageBoxW(nullptr, base::UTF8ToUTF16(str).c_str(), L"Fatal error",
+              MB_OK | MB_ICONHAND | MB_TOPMOST);
 #else
   // We intentionally don't implement a dialog on other platforms.
   // You can just look at stderr.
diff --git a/base/memory/discardable_shared_memory.cc b/base/memory/discardable_shared_memory.cc
index 0f85c1fe9..d0eaca1a 100644
--- a/base/memory/discardable_shared_memory.cc
+++ b/base/memory/discardable_shared_memory.cc
@@ -340,6 +340,15 @@
          !result.GetTimestamp().is_null();
 }
 
+bool DiscardableSharedMemory::IsMemoryLocked() const {
+  DCHECK(shared_memory_.memory());
+
+  SharedState result(subtle::NoBarrier_Load(
+      &SharedStateFromSharedMemory(shared_memory_)->value.i));
+
+  return result.GetLockState() == SharedState::LOCKED;
+}
+
 void DiscardableSharedMemory::Close() {
   shared_memory_.Close();
 }
diff --git a/base/memory/discardable_shared_memory.h b/base/memory/discardable_shared_memory.h
index 74bbe8e..5dca884 100644
--- a/base/memory/discardable_shared_memory.h
+++ b/base/memory/discardable_shared_memory.h
@@ -107,6 +107,9 @@
   // Returns true if memory is still resident.
   bool IsMemoryResident() const;
 
+  // Returns true if memory is locked.
+  bool IsMemoryLocked() const;
+
   // Closes the open discardable memory segment.
   // It is safe to call Close repeatedly.
   void Close();
diff --git a/base/memory/discardable_shared_memory_unittest.cc b/base/memory/discardable_shared_memory_unittest.cc
index 91b0b68..d5b71d3 100644
--- a/base/memory/discardable_shared_memory_unittest.cc
+++ b/base/memory/discardable_shared_memory_unittest.cc
@@ -33,6 +33,7 @@
   bool rv = memory.CreateAndMap(kDataSize);
   ASSERT_TRUE(rv);
   EXPECT_GE(memory.mapped_size(), kDataSize);
+  EXPECT_TRUE(memory.IsMemoryLocked());
 }
 
 TEST(DiscardableSharedMemoryTest, CreateFromHandle) {
@@ -50,6 +51,7 @@
   TestDiscardableSharedMemory memory2(shared_handle);
   rv = memory2.Map(kDataSize);
   ASSERT_TRUE(rv);
+  EXPECT_TRUE(memory2.IsMemoryLocked());
 }
 
 TEST(DiscardableSharedMemoryTest, LockAndUnlock) {
@@ -62,6 +64,7 @@
   // Memory is initially locked. Unlock it.
   memory1.SetNow(Time::FromDoubleT(1));
   memory1.Unlock(0, 0);
+  EXPECT_FALSE(memory1.IsMemoryLocked());
 
   // Lock and unlock memory.
   auto lock_rv = memory1.Lock(0, 0);
@@ -72,6 +75,7 @@
   // Lock again before duplicating and passing ownership to new instance.
   lock_rv = memory1.Lock(0, 0);
   EXPECT_EQ(DiscardableSharedMemory::SUCCESS, lock_rv);
+  EXPECT_TRUE(memory1.IsMemoryLocked());
 
   SharedMemoryHandle shared_handle;
   ASSERT_TRUE(
@@ -86,13 +90,18 @@
   memory2.SetNow(Time::FromDoubleT(3));
   memory2.Unlock(0, 0);
 
+  // Both memory instances should be unlocked now.
+  EXPECT_FALSE(memory2.IsMemoryLocked());
+  EXPECT_FALSE(memory1.IsMemoryLocked());
+
   // Lock second instance before passing ownership back to first instance.
   lock_rv = memory2.Lock(0, 0);
   EXPECT_EQ(DiscardableSharedMemory::SUCCESS, lock_rv);
 
-  // Memory should still be resident.
+  // Memory should still be resident and locked.
   rv = memory1.IsMemoryResident();
   EXPECT_TRUE(rv);
+  EXPECT_TRUE(memory1.IsMemoryLocked());
 
   // Unlock first instance.
   memory1.SetNow(Time::FromDoubleT(4));
diff --git a/base/memory/shared_memory.h b/base/memory/shared_memory.h
index 1049dd1..9de93d51 100644
--- a/base/memory/shared_memory.h
+++ b/base/memory/shared_memory.h
@@ -265,7 +265,9 @@
  private:
 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID)
   bool PrepareMapFile(ScopedFILE fp, ScopedFD readonly);
+#if !(defined(OS_MACOSX) && !defined(OS_IOS))
   bool FilePathForMemoryName(const std::string& mem_name, FilePath* path);
+#endif
 #endif  // defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID)
   enum ShareMode {
     SHARE_READONLY,
@@ -279,6 +281,15 @@
 #if defined(OS_WIN)
   std::wstring       name_;
   HANDLE             mapped_file_;
+#elif defined(OS_MACOSX) && !defined(OS_IOS)
+  // The OS primitive that backs the shared memory region.
+  SharedMemoryHandle shm_;
+
+  // The mechanism by which the memory is mapped. Only valid if |memory_| is not
+  // |nullptr|.
+  SharedMemoryHandle::Type mapped_memory_mechanism_;
+
+  int readonly_mapped_file_;
 #elif defined(OS_POSIX)
   int                mapped_file_;
   int                readonly_mapped_file_;
diff --git a/base/memory/shared_memory_handle.h b/base/memory/shared_memory_handle.h
index df26157..43950a2 100644
--- a/base/memory/shared_memory_handle.h
+++ b/base/memory/shared_memory_handle.h
@@ -11,10 +11,12 @@
 #include <windows.h>
 #include "base/process/process_handle.h"
 #elif defined(OS_MACOSX) && !defined(OS_IOS)
+#include <mach/mach.h>
 #include <sys/types.h>
 #include "base/base_export.h"
 #include "base/file_descriptor_posix.h"
 #include "base/macros.h"
+#include "base/process/process_handle.h"
 #elif defined(OS_POSIX)
 #include <sys/types.h>
 #include "base/file_descriptor_posix.h"
@@ -74,10 +76,9 @@
 class BASE_EXPORT SharedMemoryHandle {
  public:
   enum Type {
-    // Indicates that the SharedMemoryHandle is backed by a POSIX fd.
+    // The SharedMemoryHandle is backed by a POSIX fd.
     POSIX,
-    // Indicates that the SharedMemoryHandle is backed by the Mach primitive
-    // "memory object".
+    // The SharedMemoryHandle is backed by the Mach primitive "memory object".
     MACH,
   };
 
@@ -97,6 +98,16 @@
   explicit SharedMemoryHandle(const base::FileDescriptor& file_descriptor);
   SharedMemoryHandle(int fd, bool auto_close);
 
+  // Makes a Mach-based SharedMemoryHandle of the given size. On error,
+  // subsequent calls to IsValid() return false.
+  explicit SharedMemoryHandle(mach_vm_size_t size);
+
+  // Makes a Mach-based SharedMemoryHandle from |memory_object|, a named entry
+  // in the task with process id |pid|. The memory region has size |size|.
+  SharedMemoryHandle(mach_port_t memory_object,
+                     mach_vm_size_t size,
+                     base::ProcessId pid);
+
   // Standard copy constructor. The new instance shares the underlying OS
   // primitives.
   SharedMemoryHandle(const SharedMemoryHandle& handle);
@@ -115,7 +126,8 @@
   // Returns the type.
   Type GetType() const;
 
-  // Whether the underlying OS primitive is valid.
+  // Whether the underlying OS primitive is valid. Once the SharedMemoryHandle
+  // is backed by a valid OS primitive, it becomes immutable.
   bool IsValid() const;
 
   // Sets the POSIX fd backing the SharedMemoryHandle. Requires that the
@@ -127,9 +139,46 @@
   // uses of this method.
   const FileDescriptor GetFileDescriptor() const;
 
+  // Exposed so that the SharedMemoryHandle can be transported between
+  // processes.
+  mach_port_t GetMemoryObject() const;
+
+  // Returns false on a failure to determine the size. On success, populates the
+  // output variable |size|.
+  bool GetSize(size_t* size) const;
+
+  // The SharedMemoryHandle must be valid.
+  // Returns whether the SharedMemoryHandle was successfully mapped into memory.
+  // On success, |memory| is an output variable that contains the start of the
+  // mapped memory.
+  bool MapAt(off_t offset, size_t bytes, void** memory, bool read_only);
+
+  // Closes the underlying OS primitive.
+  void Close() const;
+
  private:
+  // Shared code between copy constructor and operator=.
+  void CopyRelevantData(const SharedMemoryHandle& handle);
+
   Type type_;
-  FileDescriptor file_descriptor_;
+
+  // Each instance of a SharedMemoryHandle is backed either by a POSIX fd or a
+  // mach port. |type_| determines the backing member.
+  union {
+    FileDescriptor file_descriptor_;
+
+    struct {
+      mach_port_t memory_object_;
+
+      // The size of the shared memory region when |type_| is MACH. Only
+      // relevant if |memory_object_| is not |MACH_PORT_NULL|.
+      mach_vm_size_t size_;
+
+      // The pid of the process in which |memory_object_| is usable. Only
+      // relevant if |memory_object_| is not |MACH_PORT_NULL|.
+      base::ProcessId pid_;
+    };
+  };
 };
 #endif
 
diff --git a/base/memory/shared_memory_handle_mac.cc b/base/memory/shared_memory_handle_mac.cc
index 6e18089..13af82d 100644
--- a/base/memory/shared_memory_handle_mac.cc
+++ b/base/memory/shared_memory_handle_mac.cc
@@ -4,6 +4,8 @@
 
 #include "base/memory/shared_memory_handle.h"
 
+#include <mach/mach_vm.h>
+#include <sys/mman.h>
 #include <unistd.h>
 
 #include "base/posix/eintr_wrapper.h"
@@ -15,20 +17,43 @@
               "Size of enum SharedMemoryHandle::Type exceeds size of type "
               "transmitted over wire.");
 
-SharedMemoryHandle::SharedMemoryHandle() : type_(POSIX), file_descriptor_() {
-}
+SharedMemoryHandle::SharedMemoryHandle() : type_(POSIX), file_descriptor_() {}
 
 SharedMemoryHandle::SharedMemoryHandle(
     const base::FileDescriptor& file_descriptor)
-    : type_(POSIX), file_descriptor_(file_descriptor) {
-}
+    : type_(POSIX), file_descriptor_(file_descriptor) {}
 
 SharedMemoryHandle::SharedMemoryHandle(int fd, bool auto_close)
-    : type_(POSIX), file_descriptor_(fd, auto_close) {
+    : type_(POSIX), file_descriptor_(fd, auto_close) {}
+
+SharedMemoryHandle::SharedMemoryHandle(mach_vm_size_t size) {
+  type_ = MACH;
+  mach_port_t named_right;
+  kern_return_t kr = mach_make_memory_entry_64(
+      mach_task_self(),
+      &size,
+      0,  // Address.
+      MAP_MEM_NAMED_CREATE | VM_PROT_READ | VM_PROT_WRITE,
+      &named_right,
+      MACH_PORT_NULL);  // Parent handle.
+  if (kr != KERN_SUCCESS) {
+    memory_object_ = MACH_PORT_NULL;
+    return;
+  }
+
+  memory_object_ = named_right;
+  size_ = size;
+  pid_ = GetCurrentProcId();
 }
 
+SharedMemoryHandle::SharedMemoryHandle(mach_port_t memory_object,
+                                       mach_vm_size_t size,
+                                       base::ProcessId pid)
+    : type_(MACH), memory_object_(memory_object), size_(size), pid_(pid) {}
+
 SharedMemoryHandle::SharedMemoryHandle(const SharedMemoryHandle& handle)
-    : type_(handle.type_), file_descriptor_(handle.file_descriptor_) {
+    : type_(handle.type_) {
+  CopyRelevantData(handle);
 }
 
 SharedMemoryHandle& SharedMemoryHandle::operator=(
@@ -37,16 +62,48 @@
     return *this;
 
   type_ = handle.type_;
-  file_descriptor_ = handle.file_descriptor_;
+  CopyRelevantData(handle);
   return *this;
 }
 
+SharedMemoryHandle SharedMemoryHandle::Duplicate() const {
+  switch (type_) {
+    case POSIX: {
+      if (!IsValid())
+        return SharedMemoryHandle();
+
+      int duped_fd = HANDLE_EINTR(dup(file_descriptor_.fd));
+      if (duped_fd < 0)
+        return SharedMemoryHandle();
+      return SharedMemoryHandle(duped_fd, true);
+    }
+    case MACH: {
+      if (!IsValid())
+        return SharedMemoryHandle(MACH_PORT_NULL, 0, 0);
+
+      // Increment the ref count.
+      kern_return_t kr = mach_port_mod_refs(mach_task_self(), memory_object_,
+                                            MACH_PORT_RIGHT_SEND, 1);
+      DCHECK_EQ(kr, KERN_SUCCESS);
+      return SharedMemoryHandle(*this);
+    }
+  }
+}
+
 bool SharedMemoryHandle::operator==(const SharedMemoryHandle& handle) const {
-  // Invalid handles are always equal, even if they have different types.
   if (!IsValid() && !handle.IsValid())
     return true;
 
-  return type_ == handle.type_ && file_descriptor_ == handle.file_descriptor_;
+  if (type_ != handle.type_)
+    return false;
+
+  switch (type_) {
+    case POSIX:
+      return file_descriptor_ == handle.file_descriptor_;
+    case MACH:
+      return memory_object_ == handle.memory_object_ && size_ == handle.size_ &&
+             pid_ == handle.pid_;
+  }
 }
 
 bool SharedMemoryHandle::operator!=(const SharedMemoryHandle& handle) const {
@@ -62,14 +119,15 @@
     case POSIX:
       return file_descriptor_.fd >= 0;
     case MACH:
-      return false;
+      return memory_object_ != MACH_PORT_NULL;
   }
 }
 
 void SharedMemoryHandle::SetFileHandle(int fd, bool auto_close) {
-  DCHECK_EQ(type_, POSIX);
+  DCHECK(!IsValid());
   file_descriptor_.fd = fd;
   file_descriptor_.auto_close = auto_close;
+  type_ = POSIX;
 }
 
 const FileDescriptor SharedMemoryHandle::GetFileDescriptor() const {
@@ -77,12 +135,87 @@
   return file_descriptor_;
 }
 
-SharedMemoryHandle SharedMemoryHandle::Duplicate() const {
-  DCHECK_EQ(type_, POSIX);
-  int duped_handle = HANDLE_EINTR(dup(file_descriptor_.fd));
-  if (duped_handle < 0)
-    return SharedMemoryHandle();
-  return SharedMemoryHandle(duped_handle, true);
+mach_port_t SharedMemoryHandle::GetMemoryObject() const {
+  DCHECK_EQ(type_, MACH);
+  return memory_object_;
+}
+
+bool SharedMemoryHandle::GetSize(size_t* size) const {
+  if (!IsValid())
+    return false;
+
+  switch (type_) {
+    case SharedMemoryHandle::POSIX:
+      struct stat st;
+      if (fstat(file_descriptor_.fd, &st) != 0)
+        return false;
+      if (st.st_size < 0)
+        return false;
+      *size = st.st_size;
+      return true;
+    case SharedMemoryHandle::MACH:
+      *size = size_;
+      return true;
+  }
+}
+
+bool SharedMemoryHandle::MapAt(off_t offset,
+                               size_t bytes,
+                               void** memory,
+                               bool read_only) {
+  DCHECK(IsValid());
+  switch (type_) {
+    case SharedMemoryHandle::POSIX:
+      *memory = mmap(nullptr, bytes, PROT_READ | (read_only ? 0 : PROT_WRITE),
+                     MAP_SHARED, file_descriptor_.fd, offset);
+
+      return *memory && *memory != reinterpret_cast<void*>(-1);
+    case SharedMemoryHandle::MACH:
+      DCHECK_EQ(pid_, GetCurrentProcId());
+      kern_return_t kr = mach_vm_map(
+          mach_task_self(),
+          reinterpret_cast<mach_vm_address_t*>(memory),    // Output parameter
+          bytes,
+          0,                                               // Alignment mask
+          VM_FLAGS_ANYWHERE,
+          memory_object_,
+          offset,
+          FALSE,                                           // Copy
+          VM_PROT_READ | (read_only ? 0 : VM_PROT_WRITE),  // Current protection
+          VM_PROT_READ | VM_PROT_WRITE,                    // Maximum protection
+          VM_INHERIT_NONE);
+      return kr == KERN_SUCCESS;
+  }
+}
+
+void SharedMemoryHandle::Close() const {
+  if (!IsValid())
+    return;
+
+  switch (type_) {
+    case POSIX:
+      if (IGNORE_EINTR(close(file_descriptor_.fd)) < 0)
+        DPLOG(ERROR) << "Error closing fd.";
+      break;
+    case MACH:
+      kern_return_t kr = mach_port_deallocate(mach_task_self(), memory_object_);
+      if (kr != KERN_SUCCESS)
+        DPLOG(ERROR) << "Error deallocating mach port: " << kr;
+      break;
+  }
+}
+
+void SharedMemoryHandle::CopyRelevantData(const SharedMemoryHandle& handle) {
+  switch (type_) {
+    case POSIX:
+      file_descriptor_ = handle.file_descriptor_;
+      break;
+    case MACH:
+      memory_object_ = handle.memory_object_;
+      size_ = handle.size_;
+      pid_ = handle.pid_;
+      break;
+  }
 }
 
 }  // namespace base
diff --git a/base/memory/shared_memory_mac.cc b/base/memory/shared_memory_mac.cc
index 9cec29f..084b725 100644
--- a/base/memory/shared_memory_mac.cc
+++ b/base/memory/shared_memory_mac.cc
@@ -5,6 +5,7 @@
 #include "base/memory/shared_memory.h"
 
 #include <fcntl.h>
+#include <mach/mach_vm.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -94,27 +95,26 @@
 }  // namespace
 
 SharedMemory::SharedMemory()
-    : mapped_file_(-1),
+    : mapped_memory_mechanism_(SharedMemoryHandle::POSIX),
       readonly_mapped_file_(-1),
       mapped_size_(0),
       memory_(NULL),
       read_only_(false),
-      requested_size_(0) {
-}
+      requested_size_(0) {}
 
 SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only)
-    : mapped_file_(GetFdFromSharedMemoryHandle(handle)),
+    : shm_(handle),
+      mapped_memory_mechanism_(SharedMemoryHandle::POSIX),
       readonly_mapped_file_(-1),
       mapped_size_(0),
       memory_(NULL),
       read_only_(read_only),
-      requested_size_(0) {
-}
+      requested_size_(0) {}
 
 SharedMemory::SharedMemory(const SharedMemoryHandle& handle,
                            bool read_only,
                            ProcessHandle process)
-    : mapped_file_(GetFdFromSharedMemoryHandle(handle)),
+    : mapped_memory_mechanism_(SharedMemoryHandle::POSIX),
       readonly_mapped_file_(-1),
       mapped_size_(0),
       memory_(NULL),
@@ -142,9 +142,7 @@
 
 // static
 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) {
-  DCHECK_GE(GetFdFromSharedMemoryHandle(handle), 0);
-  if (close(GetFdFromSharedMemoryHandle(handle)) < 0)
-    DPLOG(ERROR) << "close";
+  handle.Close();
 }
 
 // static
@@ -172,28 +170,18 @@
 bool SharedMemory::GetSizeFromSharedMemoryHandle(
     const SharedMemoryHandle& handle,
     size_t* size) {
-  struct stat st;
-  if (fstat(handle.GetFileDescriptor().fd, &st) != 0)
-    return false;
-  if (st.st_size < 0)
-    return false;
-  *size = st.st_size;
-  return true;
+  return handle.GetSize(size);
 }
 
 // Chromium mostly only uses the unique/private shmem as specified by
 // "name == L"". The exception is in the StatsTable.
-// TODO(jrg): there is no way to "clean up" all unused named shmem if
-// we restart from a crash.  (That isn't a new problem, but it is a problem.)
-// In case we want to delete it later, it may be useful to save the value
-// of mem_filename after FilePathForMemoryName().
 bool SharedMemory::Create(const SharedMemoryCreateOptions& options) {
   // TODO(erikchen): Remove ScopedTracker below once http://crbug.com/466437
   // is fixed.
   tracked_objects::ScopedTracker tracking_profile1(
       FROM_HERE_WITH_EXPLICIT_FUNCTION(
           "466437 SharedMemory::Create::Start"));
-  DCHECK_EQ(-1, mapped_file_);
+  DCHECK(!shm_.IsValid());
   if (options.size == 0) return false;
 
   if (options.size > static_cast<size_t>(std::numeric_limits<int>::max()))
@@ -232,59 +220,67 @@
 }
 
 bool SharedMemory::MapAt(off_t offset, size_t bytes) {
-  if (mapped_file_ == -1)
+  if (!shm_.IsValid())
     return false;
-
   if (bytes > static_cast<size_t>(std::numeric_limits<int>::max()))
     return false;
-
   if (memory_)
     return false;
 
-  memory_ = mmap(NULL, bytes, PROT_READ | (read_only_ ? 0 : PROT_WRITE),
-                 MAP_SHARED, mapped_file_, offset);
-
-  bool mmap_succeeded = memory_ && memory_ != reinterpret_cast<void*>(-1);
-  if (mmap_succeeded) {
+  bool success = shm_.MapAt(offset, bytes, &memory_, read_only_);
+  if (success) {
     mapped_size_ = bytes;
     DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(memory_) &
-        (SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
+                      (SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
+    mapped_memory_mechanism_ = shm_.GetType();
   } else {
     memory_ = NULL;
   }
 
-  return mmap_succeeded;
+  return success;
 }
 
 bool SharedMemory::Unmap() {
   if (memory_ == NULL)
     return false;
 
-  munmap(memory_, mapped_size_);
-  memory_ = NULL;
-  mapped_size_ = 0;
-  return true;
+  switch (mapped_memory_mechanism_) {
+    case SharedMemoryHandle::POSIX:
+      munmap(memory_, mapped_size_);
+      memory_ = NULL;
+      mapped_size_ = 0;
+      return true;
+    case SharedMemoryHandle::MACH:
+      mach_vm_deallocate(mach_task_self(),
+                         reinterpret_cast<mach_vm_address_t>(memory_),
+                         mapped_size_);
+      return true;
+  }
 }
 
 SharedMemoryHandle SharedMemory::handle() const {
-  return SharedMemoryHandle(mapped_file_, false);
+  switch (shm_.GetType()) {
+    case SharedMemoryHandle::POSIX:
+      return SharedMemoryHandle(shm_.GetFileDescriptor().fd, false);
+    case SharedMemoryHandle::MACH:
+      return shm_;
+  }
 }
 
 void SharedMemory::Close() {
-  if (mapped_file_ > 0) {
-    if (close(mapped_file_) < 0)
-      PLOG(ERROR) << "close";
-    mapped_file_ = -1;
-  }
-  if (readonly_mapped_file_ > 0) {
-    if (close(readonly_mapped_file_) < 0)
-      PLOG(ERROR) << "close";
-    readonly_mapped_file_ = -1;
+  shm_.Close();
+  shm_ = SharedMemoryHandle();
+  if (shm_.GetType() == SharedMemoryHandle::POSIX) {
+    if (readonly_mapped_file_ > 0) {
+      if (IGNORE_EINTR(close(readonly_mapped_file_)) < 0)
+        PLOG(ERROR) << "close";
+      readonly_mapped_file_ = -1;
+    }
   }
 }
 
 bool SharedMemory::PrepareMapFile(ScopedFILE fp, ScopedFD readonly_fd) {
-  DCHECK_EQ(-1, mapped_file_);
+  DCHECK(!shm_.IsValid());
   DCHECK_EQ(-1, readonly_mapped_file_);
   if (fp == NULL)
     return false;
@@ -307,8 +303,8 @@
     }
   }
 
-  mapped_file_ = HANDLE_EINTR(dup(fileno(fp.get())));
-  if (mapped_file_ == -1) {
+  int mapped_file = HANDLE_EINTR(dup(fileno(fp.get())));
+  if (mapped_file == -1) {
     if (errno == EMFILE) {
       LOG(WARNING) << "Shared memory creation failed; out of file descriptors";
       return false;
@@ -316,38 +312,21 @@
       NOTREACHED() << "Call to dup failed, errno=" << errno;
     }
   }
+  shm_ = SharedMemoryHandle(mapped_file, false);
   readonly_mapped_file_ = readonly_fd.release();
 
   return true;
 }
 
-// For the given shmem named |mem_name|, return a filename to mmap()
-// (and possibly create).  Modifies |filename|.  Return false on
-// error, or true of we are happy.
-bool SharedMemory::FilePathForMemoryName(const std::string& mem_name,
-                                         FilePath* path) {
-  // mem_name will be used for a filename; make sure it doesn't
-  // contain anything which will confuse us.
-  DCHECK_EQ(std::string::npos, mem_name.find('/'));
-  DCHECK_EQ(std::string::npos, mem_name.find('\0'));
-
-  FilePath temp_dir;
-  if (!GetShmemTempDir(false, &temp_dir))
-    return false;
-
-  std::string name_base = std::string(mac::BaseBundleID());
-  *path = temp_dir.AppendASCII(name_base + ".shmem." + mem_name);
-  return true;
-}
-
 bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
                                         SharedMemoryHandle* new_handle,
                                         bool close_self,
                                         ShareMode share_mode) {
+  DCHECK_NE(shm_.GetType(), SharedMemoryHandle::MACH);
   int handle_to_dup = -1;
   switch (share_mode) {
     case SHARE_CURRENT_MODE:
-      handle_to_dup = mapped_file_;
+      handle_to_dup = shm_.GetFileDescriptor().fd;
       break;
     case SHARE_READONLY:
       // We could imagine re-opening the file from /dev/fd, but that can't make
diff --git a/base/memory/shared_memory_mac_unittest.cc b/base/memory/shared_memory_mac_unittest.cc
new file mode 100644
index 0000000..5e03670
--- /dev/null
+++ b/base/memory/shared_memory_mac_unittest.cc
@@ -0,0 +1,323 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <mach/mach.h>
+#include <mach/mach_vm.h>
+#include <servers/bootstrap.h>
+
+#include "base/command_line.h"
+#include "base/mac/mach_logging.h"
+#include "base/mac/scoped_mach_port.h"
+#include "base/memory/shared_memory.h"
+#include "base/process/process_handle.h"
+#include "base/rand_util.h"
+#include "base/strings/stringprintf.h"
+#include "base/sys_info.h"
+#include "base/test/multiprocess_test.h"
+#include "base/test/test_timeouts.h"
+#include "testing/multiprocess_func_list.h"
+
+namespace base {
+
+namespace {
+
+static const std::string g_service_switch_name = "service_name";
+
+// Structs used to pass a mach port from client to server.
+struct MachSendPortMessage {
+  mach_msg_header_t header;
+  mach_msg_body_t body;
+  mach_msg_port_descriptor_t data;
+};
+struct MachReceivePortMessage {
+  mach_msg_header_t header;
+  mach_msg_body_t body;
+  mach_msg_port_descriptor_t data;
+  mach_msg_trailer_t trailer;
+};
+
+// Makes the current process into a Mach Server with the given |service_name|.
+mach_port_t BecomeMachServer(const char* service_name) {
+  mach_port_t port;
+  kern_return_t kr = bootstrap_check_in(bootstrap_port, service_name, &port);
+  MACH_CHECK(kr == KERN_SUCCESS, kr) << "BecomeMachServer";
+  return port;
+}
+
+// Returns the mach port for the Mach Server with the given |service_name|.
+mach_port_t LookupServer(const char* service_name) {
+  mach_port_t server_port;
+  kern_return_t kr =
+      bootstrap_look_up(bootstrap_port, service_name, &server_port);
+  MACH_CHECK(kr == KERN_SUCCESS, kr) << "LookupServer";
+  return server_port;
+}
+
+mach_port_t MakeReceivingPort() {
+  mach_port_t client_port;
+  kern_return_t kr =
+      mach_port_allocate(mach_task_self(),         // our task is acquiring
+                         MACH_PORT_RIGHT_RECEIVE,  // a new receive right
+                         &client_port);            // with this name
+  MACH_CHECK(kr == KERN_SUCCESS, kr) << "MakeReceivingPort";
+  return client_port;
+}
+
+// Blocks until a mach message is sent to |server_port|. This mach message
+// must contain a mach port. Returns that mach port.
+mach_port_t ReceiveMachPort(mach_port_t port_to_listen_on) {
+  MachReceivePortMessage recv_msg;
+  mach_msg_header_t* recv_hdr = &(recv_msg.header);
+  recv_hdr->msgh_local_port = port_to_listen_on;
+  recv_hdr->msgh_size = sizeof(recv_msg);
+  kern_return_t kr =
+      mach_msg(recv_hdr,               // message buffer
+               MACH_RCV_MSG,           // option indicating service
+               0,                      // send size
+               recv_hdr->msgh_size,    // size of header + body
+               port_to_listen_on,      // receive name
+               MACH_MSG_TIMEOUT_NONE,  // no timeout, wait forever
+               MACH_PORT_NULL);        // no notification port
+  MACH_CHECK(kr == KERN_SUCCESS, kr) << "ReceiveMachPort";
+  mach_port_t other_task_port = recv_msg.data.name;
+  return other_task_port;
+}
+
+// Passes a copy of the send right of |port_to_send| to |receiving_port|.
+void SendMachPort(mach_port_t receiving_port,
+                  mach_port_t port_to_send,
+                  int disposition) {
+  MachSendPortMessage send_msg;
+  mach_msg_header_t* send_hdr;
+  send_hdr = &(send_msg.header);
+  send_hdr->msgh_bits =
+      MACH_MSGH_BITS(MACH_MSG_TYPE_COPY_SEND, 0) | MACH_MSGH_BITS_COMPLEX;
+  send_hdr->msgh_size = sizeof(send_msg);
+  send_hdr->msgh_remote_port = receiving_port;
+  send_hdr->msgh_local_port = MACH_PORT_NULL;
+  send_hdr->msgh_reserved = 0;
+  send_msg.body.msgh_descriptor_count = 1;
+  send_msg.data.name = port_to_send;
+  send_msg.data.disposition = disposition;
+  send_msg.data.type = MACH_MSG_PORT_DESCRIPTOR;
+  int kr = mach_msg(send_hdr,               // message buffer
+                    MACH_SEND_MSG,          // option indicating send
+                    send_hdr->msgh_size,    // size of header + body
+                    0,                      // receive limit
+                    MACH_PORT_NULL,         // receive name
+                    MACH_MSG_TIMEOUT_NONE,  // no timeout, wait forever
+                    MACH_PORT_NULL);        // no notification port
+  MACH_CHECK(kr == KERN_SUCCESS, kr) << "SendMachPort";
+}
+
+std::string CreateRandomServiceName() {
+  return StringPrintf("SharedMemoryMacMultiProcessTest.%llu", RandUint64());
+}
+
+// Sets up the mach communication ports with the server. Returns a port to which
+// the server will send mach objects.
+mach_port_t CommonChildProcessSetUp() {
+  CommandLine cmd_line = *CommandLine::ForCurrentProcess();
+  std::string service_name =
+      cmd_line.GetSwitchValueASCII(g_service_switch_name);
+  mac::ScopedMachSendRight server_port(LookupServer(service_name.c_str()));
+  mach_port_t client_port = MakeReceivingPort();
+
+  // Send the port that this process is listening on to the server.
+  SendMachPort(server_port, client_port, MACH_MSG_TYPE_MAKE_SEND);
+  return client_port;
+}
+
+// The number of active names in the current task's port name space.
+mach_msg_type_number_t GetActiveNameCount() {
+  mach_port_name_array_t name_array;
+  mach_msg_type_number_t names_count;
+  mach_port_type_array_t type_array;
+  mach_msg_type_number_t types_count;
+  kern_return_t kr = mach_port_names(mach_task_self(), &name_array,
+                                     &names_count, &type_array, &types_count);
+  MACH_CHECK(kr == KERN_SUCCESS, kr) << "GetActiveNameCount";
+  return names_count;
+}
+
+}  // namespace
+
+class SharedMemoryMacMultiProcessTest : public MultiProcessTest {
+ public:
+  SharedMemoryMacMultiProcessTest() {}
+
+  CommandLine MakeCmdLine(const std::string& procname) override {
+    CommandLine command_line = MultiProcessTest::MakeCmdLine(procname);
+    // Pass the service name to the child process.
+    command_line.AppendSwitchASCII(g_service_switch_name, service_name_);
+    return command_line;
+  }
+
+  void SetUpChild(const std::string& name) {
+    // Make a random service name so that this test doesn't conflict with other
+    // similar tests.
+    service_name_ = CreateRandomServiceName();
+    server_port_.reset(BecomeMachServer(service_name_.c_str()));
+    child_process_ = SpawnChild(name);
+    client_port_.reset(ReceiveMachPort(server_port_));
+  }
+
+  static const int s_memory_size = 99999;
+
+ protected:
+  std::string service_name_;
+
+  // A port on which the main process listens for mach messages from the child
+  // process.
+  mac::ScopedMachReceiveRight server_port_;
+
+  // A port on which the child process listens for mach messages from the main
+  // process.
+  mac::ScopedMachSendRight client_port_;
+
+  base::Process child_process_;
+  DISALLOW_COPY_AND_ASSIGN(SharedMemoryMacMultiProcessTest);
+};
+
+// Tests that content written to shared memory in the server process can be read
+// by the child process.
+TEST_F(SharedMemoryMacMultiProcessTest, MachBasedSharedMemory) {
+  SetUpChild("MachBasedSharedMemoryClient");
+
+  SharedMemoryHandle shm(s_memory_size);
+  ASSERT_TRUE(shm.IsValid());
+  SharedMemory shared_memory(shm, false);
+  shared_memory.Map(s_memory_size);
+  memset(shared_memory.memory(), 'a', s_memory_size);
+
+  // Send the underlying memory object to the client process.
+  SendMachPort(client_port_, shm.GetMemoryObject(), MACH_MSG_TYPE_COPY_SEND);
+  int rv = -1;
+  ASSERT_TRUE(child_process_.WaitForExitWithTimeout(
+      TestTimeouts::action_timeout(), &rv));
+  EXPECT_EQ(0, rv);
+}
+
+MULTIPROCESS_TEST_MAIN(MachBasedSharedMemoryClient) {
+  mac::ScopedMachReceiveRight client_port(CommonChildProcessSetUp());
+  // The next mach port should be for a memory object.
+  mach_port_t memory_object = ReceiveMachPort(client_port);
+  SharedMemoryHandle shm(memory_object,
+                         SharedMemoryMacMultiProcessTest::s_memory_size,
+                         GetCurrentProcId());
+  SharedMemory shared_memory(shm, false);
+  shared_memory.Map(SharedMemoryMacMultiProcessTest::s_memory_size);
+  const char* start = static_cast<const char*>(shared_memory.memory());
+  for (int i = 0; i < SharedMemoryMacMultiProcessTest::s_memory_size; ++i) {
+    DCHECK_EQ(start[i], 'a');
+  }
+  return 0;
+}
+
+// Tests that mapping shared memory with an offset works correctly.
+TEST_F(SharedMemoryMacMultiProcessTest, MachBasedSharedMemoryWithOffset) {
+  SetUpChild("MachBasedSharedMemoryWithOffsetClient");
+
+  SharedMemoryHandle shm(s_memory_size);
+  ASSERT_TRUE(shm.IsValid());
+  SharedMemory shared_memory(shm, false);
+  shared_memory.Map(s_memory_size);
+
+  size_t page_size = SysInfo::VMAllocationGranularity();
+  char* start = static_cast<char*>(shared_memory.memory());
+  memset(start, 'a', page_size);
+  memset(start + page_size, 'b', page_size);
+  memset(start + 2 * page_size, 'c', page_size);
+
+  // Send the underlying memory object to the client process.
+  SendMachPort(client_port_, shm.GetMemoryObject(), MACH_MSG_TYPE_COPY_SEND);
+  int rv = -1;
+  ASSERT_TRUE(child_process_.WaitForExitWithTimeout(
+      TestTimeouts::action_timeout(), &rv));
+  EXPECT_EQ(0, rv);
+}
+
+MULTIPROCESS_TEST_MAIN(MachBasedSharedMemoryWithOffsetClient) {
+  mac::ScopedMachReceiveRight client_port(CommonChildProcessSetUp());
+  // The next mach port should be for a memory object.
+  mach_port_t memory_object = ReceiveMachPort(client_port);
+  SharedMemoryHandle shm(memory_object,
+                         SharedMemoryMacMultiProcessTest::s_memory_size,
+                         GetCurrentProcId());
+  SharedMemory shared_memory(shm, false);
+  size_t page_size = SysInfo::VMAllocationGranularity();
+  shared_memory.MapAt(page_size, 2 * page_size);
+  const char* start = static_cast<const char*>(shared_memory.memory());
+  for (size_t i = 0; i < page_size; ++i) {
+    DCHECK_EQ(start[i], 'b');
+  }
+  for (size_t i = page_size; i < 2 * page_size; ++i) {
+    DCHECK_EQ(start[i], 'c');
+  }
+  return 0;
+}
+
+// Tests that duplication and closing has the right effect on Mach reference
+// counts.
+TEST_F(SharedMemoryMacMultiProcessTest, MachDuplicateAndClose) {
+  mach_msg_type_number_t active_name_count = GetActiveNameCount();
+
+  // Making a new SharedMemoryHandle increments the name count.
+  SharedMemoryHandle shm(s_memory_size);
+  ASSERT_TRUE(shm.IsValid());
+  EXPECT_EQ(active_name_count + 1, GetActiveNameCount());
+
+  // Duplicating the SharedMemoryHandle increments the ref count, but doesn't
+  // make a new name.
+  shm.Duplicate();
+  EXPECT_EQ(active_name_count + 1, GetActiveNameCount());
+
+  // Closing the SharedMemoryHandle decrements the ref count. The first time has
+  // no effect.
+  shm.Close();
+  EXPECT_EQ(active_name_count + 1, GetActiveNameCount());
+
+  // Closing the SharedMemoryHandle decrements the ref count. The second time
+  // destroys the port.
+  shm.Close();
+  EXPECT_EQ(active_name_count, GetActiveNameCount());
+}
+
+// Tests that passing a SharedMemoryHandle to a SharedMemory object also passes
+// ownership, and that destroying the SharedMemory closes the SharedMemoryHandle
+// as well.
+TEST_F(SharedMemoryMacMultiProcessTest, MachSharedMemoryTakesOwnership) {
+  mach_msg_type_number_t active_name_count = GetActiveNameCount();
+
+  // Making a new SharedMemoryHandle increments the name count.
+  SharedMemoryHandle shm(s_memory_size);
+  ASSERT_TRUE(shm.IsValid());
+  EXPECT_EQ(active_name_count + 1, GetActiveNameCount());
+
+  // Name count doesn't change when mapping the memory.
+  scoped_ptr<SharedMemory> shared_memory(new SharedMemory(shm, false));
+  shared_memory->Map(s_memory_size);
+  EXPECT_EQ(active_name_count + 1, GetActiveNameCount());
+
+  // Destroying the SharedMemory object frees the resource.
+  shared_memory.reset();
+  EXPECT_EQ(active_name_count, GetActiveNameCount());
+}
+
+// Tests that the read-only flag works.
+TEST_F(SharedMemoryMacMultiProcessTest, MachReadOnly) {
+  SharedMemoryHandle shm(s_memory_size);
+  ASSERT_TRUE(shm.IsValid());
+  SharedMemory shared_memory(shm, false);
+  shared_memory.Map(s_memory_size);
+  memset(shared_memory.memory(), 'a', s_memory_size);
+
+  SharedMemoryHandle shm2 = shm.Duplicate();
+  ASSERT_TRUE(shm2.IsValid());
+  SharedMemory shared_memory2(shm, true);
+  shared_memory2.Map(s_memory_size);
+  ASSERT_DEATH(memset(shared_memory2.memory(), 'b', s_memory_size), "");
+}
+
+}  //  namespace base
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc
index 6a7c1d5..96344c6 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -147,7 +147,7 @@
 // static
 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) {
   DCHECK_GE(handle.fd, 0);
-  if (close(handle.fd) < 0)
+  if (IGNORE_EINTR(close(handle.fd)) < 0)
     DPLOG(ERROR) << "close";
 }
 
@@ -392,12 +392,12 @@
 
 void SharedMemory::Close() {
   if (mapped_file_ > 0) {
-    if (close(mapped_file_) < 0)
+    if (IGNORE_EINTR(close(mapped_file_)) < 0)
       PLOG(ERROR) << "close";
     mapped_file_ = -1;
   }
   if (readonly_mapped_file_ > 0) {
-    if (close(readonly_mapped_file_) < 0)
+    if (IGNORE_EINTR(close(readonly_mapped_file_)) < 0)
       PLOG(ERROR) << "close";
     readonly_mapped_file_ = -1;
   }
diff --git a/base/memory/shared_memory_unittest.cc b/base/memory/shared_memory_unittest.cc
index 291a55e3..86fb3ac 100644
--- a/base/memory/shared_memory_unittest.cc
+++ b/base/memory/shared_memory_unittest.cc
@@ -409,6 +409,7 @@
       contents,
       StringPiece(static_cast<const char*>(shared.memory()), contents.size()));
 
+  shared_handle = SharedMemoryHandle();
   ASSERT_TRUE(shmem.ShareToProcess(GetCurrentProcessHandle(), &shared_handle));
   SharedMemory readonly(shared_handle, /*readonly=*/true);
 
diff --git a/base/nix/xdg_util.cc b/base/nix/xdg_util.cc
index ef045617..f76c0cb 100644
--- a/base/nix/xdg_util.cc
+++ b/base/nix/xdg_util.cc
@@ -15,8 +15,8 @@
 
 namespace {
 
-// The KDE session version environment variable used in KDE 4.
-const char kKDE4SessionEnvVar[] = "KDE_SESSION_VERSION";
+// The KDE session version environment variable introduced in KDE 4.
+const char kKDESessionEnvVar[] = "KDE_SESSION_VERSION";
 
 }  // namespace
 
@@ -69,6 +69,12 @@
     } else if (xdg_current_desktop == "GNOME") {
       return DESKTOP_ENVIRONMENT_GNOME;
     } else if (xdg_current_desktop == "KDE") {
+      std::string kde_session;
+      if (env->GetVar(kKDESessionEnvVar, &kde_session)) {
+        if (kde_session == "5") {
+          return DESKTOP_ENVIRONMENT_KDE5;
+        }
+      }
       return DESKTOP_ENVIRONMENT_KDE4;
     }
   }
@@ -82,7 +88,7 @@
       return DESKTOP_ENVIRONMENT_KDE4;
     } else if (desktop_session == "kde") {
       // This may mean KDE4 on newer systems, so we have to check.
-      if (env->HasVar(kKDE4SessionEnvVar))
+      if (env->HasVar(kKDESessionEnvVar))
         return DESKTOP_ENVIRONMENT_KDE4;
       return DESKTOP_ENVIRONMENT_KDE3;
     } else if (desktop_session.find("xfce") != std::string::npos ||
@@ -96,7 +102,7 @@
   if (env->HasVar("GNOME_DESKTOP_SESSION_ID")) {
     return DESKTOP_ENVIRONMENT_GNOME;
   } else if (env->HasVar("KDE_FULL_SESSION")) {
-    if (env->HasVar(kKDE4SessionEnvVar))
+    if (env->HasVar(kKDESessionEnvVar))
       return DESKTOP_ENVIRONMENT_KDE4;
     return DESKTOP_ENVIRONMENT_KDE3;
   }
@@ -114,6 +120,8 @@
       return "KDE3";
     case DESKTOP_ENVIRONMENT_KDE4:
       return "KDE4";
+    case DESKTOP_ENVIRONMENT_KDE5:
+      return "KDE5";
     case DESKTOP_ENVIRONMENT_UNITY:
       return "UNITY";
     case DESKTOP_ENVIRONMENT_XFCE:
diff --git a/base/nix/xdg_util.h b/base/nix/xdg_util.h
index a8b7784..8812c61f 100644
--- a/base/nix/xdg_util.h
+++ b/base/nix/xdg_util.h
@@ -48,10 +48,11 @@
 enum DesktopEnvironment {
   DESKTOP_ENVIRONMENT_OTHER,
   DESKTOP_ENVIRONMENT_GNOME,
-  // KDE3 and KDE4 are sufficiently different that we count
-  // them as two different desktop environments here.
+  // KDE3, KDE4 and KDE5 are sufficiently different that we count
+  // them as different desktop environments here.
   DESKTOP_ENVIRONMENT_KDE3,
   DESKTOP_ENVIRONMENT_KDE4,
+  DESKTOP_ENVIRONMENT_KDE5,
   DESKTOP_ENVIRONMENT_UNITY,
   DESKTOP_ENVIRONMENT_XFCE,
 };
diff --git a/base/nix/xdg_util_unittest.cc b/base/nix/xdg_util_unittest.cc
index 136eb5d..a054355 100644
--- a/base/nix/xdg_util_unittest.cc
+++ b/base/nix/xdg_util_unittest.cc
@@ -35,8 +35,10 @@
 const char* const kXdgDesktopGNOME = "GNOME";
 const char* const kXdgDesktopKDE = "KDE";
 const char* const kXdgDesktopUnity = "Unity";
+const char* const kKDESessionKDE5 = "5";
 
 const char kDesktopSession[] = "DESKTOP_SESSION";
+const char kKDESession[] = "KDE_SESSION_VERSION";
 const char kXdgDesktop[] = "XDG_CURRENT_DESKTOP";
 
 }  // namespace
@@ -107,6 +109,17 @@
   EXPECT_EQ(DESKTOP_ENVIRONMENT_GNOME, GetDesktopEnvironment(&getter));
 }
 
+TEST(XDGUtilTest, GetXdgDesktopKDE5) {
+  MockEnvironment getter;
+  EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false));
+  EXPECT_CALL(getter, GetVar(StrEq(kXdgDesktop), _))
+      .WillOnce(DoAll(SetArgumentPointee<1>(kXdgDesktopKDE), Return(true)));
+  EXPECT_CALL(getter, GetVar(StrEq(kKDESession), _))
+        .WillOnce(DoAll(SetArgumentPointee<1>(kKDESessionKDE5), Return(true)));
+
+  EXPECT_EQ(DESKTOP_ENVIRONMENT_KDE5, GetDesktopEnvironment(&getter));
+}
+
 TEST(XDGUtilTest, GetXdgDesktopKDE4) {
   MockEnvironment getter;
   EXPECT_CALL(getter, GetVar(_, _)).WillRepeatedly(Return(false));
diff --git a/breakpad/BUILD.gn b/breakpad/BUILD.gn
index d952b63..a6d28aa 100644
--- a/breakpad/BUILD.gn
+++ b/breakpad/BUILD.gn
@@ -44,9 +44,9 @@
   include_dirs = [ "src" ]
 }
 
-# {micro,mini}dump_stackwalk and minidump_dump are tool-type executables that do
-# not build on iOS.
-if (current_toolchain == host_toolchain && !is_win) {
+# {micro,mini}dump_stackwalk and minidump_dump are tool-type executables
+# that do not build on Windows.
+if (!is_win && current_toolchain == host_toolchain) {
   # Contains the code shared by both {micro,mini}dump_stackwalk.
   static_library("stackwalk_common") {
     sources = [
diff --git a/build/all.gyp b/build/all.gyp
index 63da585..3c6b10d0 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -162,7 +162,7 @@
             '../gpu/skia_runner/skia_runner.gyp:*',
           ],
         }],
-        ['use_openssl==0 and (OS=="mac" or OS=="ios" or OS=="win")', {
+        ['use_openssl==0 and OS=="ios"', {
           'dependencies': [
             '../third_party/nss/nss.gyp:*',
            ],
diff --git a/build/android/devil/android/device_utils.py b/build/android/devil/android/device_utils.py
index 432677f..96de1f88 100644
--- a/build/android/devil/android/device_utils.py
+++ b/build/android/devil/android/device_utils.py
@@ -746,7 +746,7 @@
         with device_temp_file.DeviceTempFile(self.adb, suffix='.sh') as script:
           self._WriteFileWithPush(script.name, cmd)
           logging.info('Large shell command will be run from file: %s ...',
-                       cmd[:100])
+                       cmd[:self._MAX_ADB_COMMAND_LENGTH])
           return handle_check_return('sh %s' % script.name_quoted)
 
     def handle_large_output(cmd, large_output_mode):
@@ -1102,14 +1102,17 @@
         track_stale == False
     """
     try:
-      host_checksums = md5sum.CalculateHostMd5Sums([host_path])
-      interesting_device_paths = [device_path]
+      specific_device_paths = [device_path]
       if not track_stale and os.path.isdir(host_path):
-        interesting_device_paths = [
-            posixpath.join(device_path, os.path.relpath(p, host_path))
-            for p in host_checksums.keys()]
-      device_checksums = md5sum.CalculateDeviceMd5Sums(
-          interesting_device_paths, self)
+        specific_device_paths = []
+        for root, _, filenames in os.walk(host_path):
+          relative_dir = root[len(host_path) + 1:]
+          specific_device_paths.extend(
+              posixpath.join(device_path, relative_dir, f) for f in filenames)
+
+      host_checksums, device_checksums = reraiser_thread.RunAsync((
+          lambda: md5sum.CalculateHostMd5Sums([host_path]),
+          lambda: md5sum.CalculateDeviceMd5Sums(specific_device_paths, self)))
     except EnvironmentError as e:
       logging.warning('Error calculating md5: %s', e)
       return ([(host_path, device_path)], [], [])
diff --git a/build/android/gyp/javac.py b/build/android/gyp/javac.py
index eb17acc..65b36a5 100755
--- a/build/android/gyp/javac.py
+++ b/build/android/gyp/javac.py
@@ -12,6 +12,7 @@
 import textwrap
 
 from util import build_utils
+from util import md5_check
 
 import jar
 
@@ -122,10 +123,47 @@
   def extract_predicate(path):
     if not path.endswith('.class'):
       return False
-    path_without_suffix = re.sub(r'(?:\$[^/]+)?\.class$', '', path)
-    return not any(path_without_suffix in p for p in java_files)
+    path_without_suffix = re.sub(r'(?:\$|\.)[^/]+class$', '', path)
+    partial_java_path = path_without_suffix + '.java'
+    return not any(p.endswith(partial_java_path) for p in java_files)
 
   build_utils.ExtractAll(jar_path, path=dest_dir, predicate=extract_predicate)
+  for path in build_utils.FindInDirectory(dest_dir, '*.class'):
+    shutil.copystat(jar_path, path)
+
+
+def _ConvertToJMakeArgs(javac_cmd, pdb_path):
+  new_args = ['bin/jmake', '-pdb', pdb_path]
+  if javac_cmd[0] != 'javac':
+    new_args.extend(('-jcexec', new_args[0]))
+  if md5_check.PRINT_EXPLANATIONS:
+    new_args.append('-Xtiming')
+
+  do_not_prefix = ('-classpath', '-bootclasspath')
+  skip_next = False
+  for arg in javac_cmd[1:]:
+    if not skip_next and arg not in do_not_prefix:
+      arg = '-C' + arg
+    new_args.append(arg)
+    skip_next = arg in do_not_prefix
+
+  return new_args
+
+
+def _FilterJMakeOutput(stdout):
+  if md5_check.PRINT_EXPLANATIONS:
+    return stdout
+  return re.sub(r'\b(Jmake version|Writing project database).*?\n', '', stdout)
+
+
+def _FixTempPathsInIncrementalMetadata(pdb_path, temp_dir):
+  # The .pdb records absolute paths. Fix up paths within /tmp (srcjars).
+  if os.path.exists(pdb_path):
+    # Although its a binary file, search/replace still seems to work fine.
+    with open(pdb_path) as fileobj:
+      pdb_data = fileobj.read()
+    with open(pdb_path, 'w') as fileobj:
+      fileobj.write(re.sub(r'/tmp/[^/]*', temp_dir, pdb_data))
 
 
 def _OnStaleMd5(changes, options, javac_cmd, java_files, classpath_inputs,
@@ -140,35 +178,58 @@
     os.makedirs(classes_dir)
 
     changed_paths = None
+    # jmake can handle deleted files, but it's a rare case and it would
+    # complicate this script's logic.
     if options.incremental and changes.AddedOrModifiedOnly():
       changed_paths = set(changes.IterChangedPaths())
       # Do a full compile if classpath has changed.
+      # jmake doesn't seem to do this on its own... Might be that ijars mess up
+      # its change-detection logic.
       if any(p in changed_paths for p in classpath_inputs):
         changed_paths = None
-      else:
-        java_files = [p for p in java_files if p in changed_paths]
-        srcjars = [p for p in srcjars if p in changed_paths]
+
+    if options.incremental:
+      # jmake is a compiler wrapper that figures out the minimal set of .java
+      # files that need to be rebuilt given a set of .java files that have
+      # changed.
+      # jmake determines what files are stale based on timestamps between .java
+      # and .class files. Since we use .jars, .srcjars, and md5 checks,
+      # timestamp info isn't accurate for this purpose. Rather than use jmake's
+      # programatic interface (like we eventually should), we ensure that all
+      # .class files are newer than their .java files, and convey to jmake which
+      # sources are stale by having their .class files be missing entirely
+      # (by not extracting them).
+      pdb_path = options.jar_path + '.pdb'
+      javac_cmd = _ConvertToJMakeArgs(javac_cmd, pdb_path)
+      if srcjars:
+        _FixTempPathsInIncrementalMetadata(pdb_path, temp_dir)
 
     if srcjars:
       java_dir = os.path.join(temp_dir, 'java')
       os.makedirs(java_dir)
       for srcjar in options.java_srcjars:
-        extract_predicate = None
         if changed_paths:
-          changed_subpaths = set(changes.IterChangedSubpaths(srcjar))
-          extract_predicate = lambda p: p in changed_subpaths
-        build_utils.ExtractAll(srcjar, path=java_dir, pattern='*.java',
-                               predicate=extract_predicate)
+          changed_paths.update(changes.IterChangedSubpaths(srcjar))
+        build_utils.ExtractAll(srcjar, path=java_dir, pattern='*.java')
       jar_srcs = build_utils.FindInDirectory(java_dir, '*.java')
-      java_files.extend(_FilterJavaFiles(jar_srcs, options.javac_includes))
+      jar_srcs = _FilterJavaFiles(jar_srcs, options.javac_includes)
+      java_files.extend(jar_srcs)
+      if changed_paths:
+        # Set the mtime of all sources to 0 since we use the absense of .class
+        # files to tell jmake which files are stale.
+        for path in jar_srcs:
+          os.utime(path, (0, 0))
 
     if java_files:
       if changed_paths:
-        # When no files have been removed and the output jar already
-        # exists, reuse .class files from the existing jar.
-        _ExtractClassFiles(options.jar_path, classes_dir, java_files)
-        _ExtractClassFiles(excluded_jar_path, classes_dir, java_files)
-        # Add the extracted files to the classpath.
+        changed_java_files = [p for p in java_files if p in changed_paths]
+        if os.path.exists(options.jar_path):
+          _ExtractClassFiles(options.jar_path, classes_dir, changed_java_files)
+        if os.path.exists(excluded_jar_path):
+          _ExtractClassFiles(excluded_jar_path, classes_dir, changed_java_files)
+        # Add the extracted files to the classpath. This is required because
+        # when compiling only a subset of files, classes that haven't changed
+        # need to be findable.
         classpath_idx = javac_cmd.index('-classpath')
         javac_cmd[classpath_idx + 1] += ':' + classes_dir
 
@@ -179,6 +240,7 @@
       build_utils.CheckOutput(
           cmd,
           print_stdout=options.chromium_code,
+          stdout_filter=_FilterJMakeOutput,
           stderr_filter=ColorJavacOutput)
 
     if options.main_class or options.manifest_entry:
@@ -360,6 +422,8 @@
       options.jar_path,
       options.jar_path.replace('.jar', '.excluded.jar'),
   ]
+  if options.incremental:
+    output_paths.append(options.jar_path + '.pdb')
 
   # An escape hatch to be able to check if incremental compiles are causing
   # problems.
diff --git a/build/android/gyp/util/md5_check.py b/build/android/gyp/util/md5_check.py
index 3020944..2ddc3ac 100644
--- a/build/android/gyp/util/md5_check.py
+++ b/build/android/gyp/util/md5_check.py
@@ -12,7 +12,7 @@
 
 
 # When set and a difference is detected, a diff of what changed is printed.
-_PRINT_MD5_DIFFS = int(os.environ.get('PRINT_MD5_DIFFS', 0))
+PRINT_EXPLANATIONS = int(os.environ.get('PRINT_BUILD_EXPLANATIONS', 0))
 
 # An escape hatch that causes all targets to be rebuilt.
 _FORCE_REBUILD = int(os.environ.get('FORCE_REBUILD', 0))
@@ -77,7 +77,7 @@
   if not changes.HasChanges():
     return
 
-  if _PRINT_MD5_DIFFS:
+  if PRINT_EXPLANATIONS:
     print '=' * 80
     print 'Target is stale: %s' % record_path
     print changes.DescribeDifference()
diff --git a/build/android/pylib/perf/test_runner.py b/build/android/pylib/perf/test_runner.py
index 32c4f81..26e17add 100644
--- a/build/android/pylib/perf/test_runner.py
+++ b/build/android/pylib/perf/test_runner.py
@@ -52,6 +52,7 @@
 import logging
 import os
 import pickle
+import re
 import shutil
 import sys
 import tempfile
@@ -68,6 +69,34 @@
 from pylib.base import base_test_runner
 
 
+# Regex for the master branch commit position.
+_GIT_CR_POS_RE = re.compile(r'^Cr-Commit-Position: refs/heads/master@{#(\d+)}$')
+
+
+def _GetChromiumRevision():
+  """Get the git hash and commit position of the chromium master branch.
+
+  See: https://chromium.googlesource.com/chromium/tools/build/+/master/scripts/slave/runtest.py#212
+
+  Returns:
+    A dictionary with 'revision' and 'commit_pos' keys.
+  """
+  status, output = cmd_helper.GetCmdStatusAndOutput(
+      ['git', 'log', '-n', '1', '--pretty=format:%H%n%B', 'HEAD'],
+      constants.DIR_SOURCE_ROOT)
+  revision = None
+  commit_pos = None
+  if not status:
+    lines = output.splitlines()
+    revision = lines[0]
+    for line in reversed(lines):
+      m = _GIT_CR_POS_RE.match(line.strip())
+      if m:
+        commit_pos = int(m.group(1))
+        break
+  return {'revision': revision, 'commit_pos': commit_pos}
+
+
 def GetPersistedResult(test_name):
   file_name = os.path.join(constants.PERF_OUTPUT_DIR, test_name)
   if not os.path.exists(file_name):
@@ -253,6 +282,15 @@
                     ' the test.')
       return ''
 
+  def _WriteBuildBotJson(self):
+    """Write metadata about the buildbot environment to the output dir."""
+    data = {
+      'chromium': _GetChromiumRevision(),
+      'environment': dict(os.environ)}
+    logging.info('BuildBot environment: %s', data)
+    with open(os.path.join(self._output_dir, 'buildbot.json'), 'w') as f:
+      json.dump(data, f, sort_keys=True, indent=2, separators=(',', ': '))
+
   def _ArchiveOutputDir(self):
     """Archive all files in the output dir, and return as compressed bytes."""
     with io.BytesIO() as archive:
@@ -297,6 +335,7 @@
     if (self._options.collect_chartjson_data
         or test_config.get('archive_output_dir')):
       self._output_dir = tempfile.mkdtemp()
+      self._WriteBuildBotJson()
       cmd = cmd + ' --output-dir=%s' % self._output_dir
 
     logging.info(
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index 2ff1f8c4..643ded8 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -125,12 +125,9 @@
   is_clang = current_os == "mac" || current_os == "ios" ||
              current_os == "linux" || current_os == "chromeos"
 
-  if (current_os == "chromeos") {
-    # Allows the target toolchain to be injected as arguments. This is needed
-    # to support the CrOS build system which supports per-build-configuration
-    # toolchains.
-    cros_use_custom_toolchain = false
-  }
+  # Allows the path to a custom target toolchain to be injected as a single
+  # argument, and set as the default toolchain.
+  custom_toolchain = ""
 
   # DON'T ADD MORE FLAGS HERE. Read the comment above.
 }
@@ -362,7 +359,6 @@
   _native_compiler_configs += [
     "//build/config/win:lean_and_mean",
     "//build/config/win:nominmax",
-    "//build/config/win:sdk",
     "//build/config/win:unicode",
     "//build/config/win:winver",
   ]
@@ -378,16 +374,6 @@
   ]
 }
 
-if (is_linux) {
-  _native_compiler_configs += [ "//build/config/linux:sdk" ]
-} else if (is_mac) {
-  _native_compiler_configs += [ "//build/config/mac:sdk" ]
-} else if (is_ios) {
-  _native_compiler_configs += [ "//build/config/ios:sdk" ]
-} else if (is_android) {
-  _native_compiler_configs += [ "//build/config/android:sdk" ]
-}
-
 if (is_android) {
   _native_compiler_configs +=
       [ "//build/config/android:default_cygprofile_instrumentation" ]
@@ -495,6 +481,7 @@
 # doing cross-compiles. When not cross-compiling, this will be the same as the
 # default toolchain.
 
+_default_toolchain = ""
 if (is_win) {
   # On windows we use the same toolchain for host and target by default.
   if (is_clang) {
@@ -504,11 +491,11 @@
   }
 
   if (current_os == "win") {
-    set_default_toolchain("$host_toolchain")
+    _default_toolchain = host_toolchain
   } else if (current_cpu == "x64") {  # WinRT x64
-    set_default_toolchain("//build/toolchain/win:winrt_x64")
+    _default_toolchain = "//build/toolchain/win:winrt_x64"
   } else if (current_cpu == "x86") {  # WinRT x86
-    set_default_toolchain("//build/toolchain/win:winrt_x86")
+    _default_toolchain = "//build/toolchain/win:winrt_x86"
   }
 } else if (is_android) {
   if (host_os == "linux") {
@@ -524,27 +511,24 @@
     assert(false, "Unknown host for android cross compile")
   }
   if (is_clang) {
-    set_default_toolchain("//build/toolchain/android:clang_$current_cpu")
+    _default_toolchain = "//build/toolchain/android:clang_$current_cpu"
   } else {
-    set_default_toolchain("//build/toolchain/android:$current_cpu")
+    _default_toolchain = "//build/toolchain/android:$current_cpu"
   }
 } else if (is_linux) {
   if (is_clang) {
     host_toolchain = "//build/toolchain/linux:clang_$host_cpu"
-    set_default_toolchain("//build/toolchain/linux:clang_$current_cpu")
+    _default_toolchain = "//build/toolchain/linux:clang_$current_cpu"
   } else {
     host_toolchain = "//build/toolchain/linux:$host_cpu"
-    set_default_toolchain("//build/toolchain/linux:$current_cpu")
-  }
-  if (is_chromeos && cros_use_custom_toolchain) {
-    set_default_toolchain("//build/toolchain/cros:target")
+    _default_toolchain = "//build/toolchain/linux:$current_cpu"
   }
 } else if (is_mac) {
   host_toolchain = "//build/toolchain/mac:clang_x64"
-  set_default_toolchain(host_toolchain)
+  _default_toolchain = host_toolchain
 } else if (is_ios) {
   host_toolchain = "//build/toolchain/mac:clang_x64"
-  set_default_toolchain("//build/toolchain/mac:ios_clang_arm")
+  _default_toolchain = "//build/toolchain/mac:ios_clang_arm"
 } else if (is_nacl) {
   # TODO(GYP): This will need to change when we get NaCl working
   # on multiple platforms, but this whole block of code (how we define
@@ -553,6 +537,14 @@
   host_toolchain = "//build/toolchain/linux:clang_x64"
 }
 
+# If a custom toolchain has been set in the args, set it as default. Otherwise,
+# set the default toolchain for the platform (if any).
+if (custom_toolchain != "") {
+  set_default_toolchain(custom_toolchain)
+} else if (_default_toolchain != "") {
+  set_default_toolchain(_default_toolchain)
+}
+
 # ==============================================================================
 # COMPONENT SETUP
 # ==============================================================================
diff --git a/build/config/android/BUILD.gn b/build/config/android/BUILD.gn
index 0503bef..c743f390 100644
--- a/build/config/android/BUILD.gn
+++ b/build/config/android/BUILD.gn
@@ -146,19 +146,19 @@
   defines = [ "__GNU_SOURCE=1" ]  # Necessary for clone().
   ldflags = [ "-nostdlib" ]
   lib_dirs = [ "$android_libcpp_root/libs/$android_app_abi" ]
-  libs = [
+
+  # The libc++ runtime library (must come first).
+  if (is_component_build) {
+    libs = [ "c++_shared" ]
+  } else {
+    libs = [ "c++_static" ]
+  }
+  libs += [
     "c",
     "dl",
     "m",
   ]
 
-  # The libc++ runtime library.
-  if (is_component_build) {
-    libs += [ "c++_shared" ]
-  } else {
-    libs += [ "c++_static" ]
-  }
-
   if (is_clang) {
     # Work around incompatibilities between bionic and clang headers.
     defines += [
@@ -195,23 +195,6 @@
   }
 }
 
-config("sdk") {
-  if (sysroot != "") {
-    cflags = [ "--sysroot=" + sysroot ]
-    asmflags = [ "--sysroot=" + sysroot ]
-    ldflags = [ "--sysroot=" + sysroot ]
-
-    # Need to get some linker flags out of the sysroot.
-    sysroot_ld_path = rebase_path("//build/config/linux/sysroot_ld_path.py")
-    ldflags += [ exec_script(sysroot_ld_path,
-                             [
-                               rebase_path("//build/linux/sysroot_ld_path.sh"),
-                               sysroot,
-                             ],
-                             "value") ]
-  }
-}
-
 config("executable_config") {
   cflags = [ "-fPIE" ]
   asmflags = [ "-fPIE" ]
diff --git a/build/config/android/config.gni b/build/config/android/config.gni
index 7abf51a..7ca1b70 100644
--- a/build/config/android/config.gni
+++ b/build/config/android/config.gni
@@ -71,10 +71,16 @@
     disable_incremental_isolated_processes = false
 
     # Speed up incremental compiles by compiling only changed files.
-    incremental_javac = false
+    enable_incremental_javac = false
 
     # Speed up dexing using dx --incremental.
-    incremental_dx = true
+    enable_incremental_dx = is_debug
+
+    # Neither of these should ever be used for release builds since they are
+    # somewhat experimental and dx --incremental is known to not produce
+    # byte-for-byte identical output.
+    assert(!(enable_incremental_dx && !is_debug))
+    assert(!(enable_incremental_javac && !is_debug))
 
     # Adds intrumentation to each function. Writes a file with the order that
     # functions are called at startup.
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index 0a8f64df..f9cdaf2d 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -199,7 +199,7 @@
       rebased_output,
     ]
 
-    if (incremental_dx) {
+    if (enable_incremental_dx) {
       args += [ "--incremental" ]
     }
 
@@ -1048,6 +1048,11 @@
     _enable_errorprone = invoker.enable_errorprone
   }
 
+  _enable_incremental_javac = enable_incremental_javac
+  if (defined(invoker.enable_incremental_javac)) {
+    _enable_incremental_javac = invoker.enable_incremental_javac
+  }
+
   _manifest_entries = []
   if (defined(invoker.manifest_entries)) {
     _manifest_entries = invoker.manifest_entries
@@ -1107,8 +1112,10 @@
       "--java-srcjars=@FileArg($_rebased_build_config:javac:srcjars)",
       "--jar-excluded-classes=$_jar_excluded_patterns",
     ]
-    if (incremental_javac) {
+    if (_enable_incremental_javac) {
       args += [ "--incremental" ]
+      deps += [ "//third_party/jmake" ]
+      outputs += [ "${_intermediate_jar_path}.pdb" ]
     }
     if (_supports_android) {
       deps += [ "//build/android:android_ijar" ]
@@ -1276,6 +1283,7 @@
                            [
                              "dist_jar_path",
                              "enable_errorprone",
+                             "enable_incremental_javac",
                              "jar_excluded_patterns",
                              "manifest_entries",
                              "proguard_config",
diff --git a/build/config/android/rules.gni b/build/config/android/rules.gni
index dee61162..16796b6 100644
--- a/build/config/android/rules.gni
+++ b/build/config/android/rules.gni
@@ -817,6 +817,7 @@
 #     android_library target, for example.
 #   chromium_code: If true, extra analysis warning/errors will be enabled.
 #   enable_errorprone: If true, enables the errorprone compiler.
+#   enable_incremental_javac: Overrides the global enable_incremental_javac.
 #   main_class: When specified, a wrapper script is created within
 #     $target_out_dir/bin to launch the binary with the given class as the
 #     entrypoint.
@@ -905,6 +906,7 @@
 #
 #   chromium_code: If true, extra analysis warning/errors will be enabled.
 #   enable_errorprone: If true, enables the errorprone compiler.
+#   enable_incremental_javac: Overrides the global enable_incremental_javac.
 #
 #   jar_excluded_patterns: List of patterns of .class files to exclude from the
 #     final jar.
@@ -996,6 +998,7 @@
 #
 #   chromium_code: If true, extra analysis warning/errors will be enabled.
 #   enable_errorprone: If true, enables the errorprone compiler.
+#   enable_incremental_javac: Overrides the global enable_incremental_javac.
 #
 #   jar_excluded_patterns: List of patterns of .class files to exclude from the
 #     final jar.
@@ -1799,7 +1802,9 @@
     if (defined(invoker.deps)) {
       deps += invoker.deps
     }
-    data_deps = [ "//tools/android/md5sum" ]
+    data_deps = [
+      "//tools/android/md5sum",
+    ]
     if (host_os == "linux") {
       data_deps += [ "//tools/android/forwarder2" ]
     }
diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn
index ef8fbd4..8cf8367 100644
--- a/build/config/compiler/BUILD.gn
+++ b/build/config/compiler/BUILD.gn
@@ -493,237 +493,251 @@
   # smaller.
   if (is_win) {
     configs += [ "//build/config/win:runtime_library" ]
+  } else if (is_linux) {
+    configs += [ "//build/config/linux:runtime_library" ]
+  } else if (is_ios) {
+    configs += [ "//build/config/ios:runtime_library" ]
+  } else if (is_mac) {
+    configs += [ "//build/config/mac:runtime_library" ]
   } else if (is_android) {
     configs += [ "//build/config/android:runtime_library" ]
   }
 
+  if (is_posix) {
+    configs += [ "//build/config/posix:runtime_library" ]
+  }
+
   if (is_component_build) {
     defines += [ "COMPONENT_BUILD" ]
   }
 }
 
-# default_warning_flags collects all warning flags that are used by default.
-# This is in a variable instead of a config so that it can be used in
-# both chromium_code and no_chromium_code.  This way these flags are guaranteed
-# to appear on the compile command line after -Wall.
+# default_warnings ------------------------------------------------------------
+#
+# Collects all warning flags that are used by default.  This is used as a
+# subconfig of both chromium_code and no_chromium_code.  This way these
+# flags are guaranteed to appear on the compile command line after -Wall.
+config("default_warnings") {
+  cflags = []
+  cflags_cc = []
 
-default_warning_flags = []
-default_warning_flags_cc = []
-if (is_win) {
-  default_warning_flags += [
-    # Treat warnings as errors.
-    "/WX",
+  if (is_win) {
+    cflags += [
+      # Treat warnings as errors.
+      "/WX",
 
-    # Warnings permanently disabled:
+      # Warnings permanently disabled:
 
-    # C4127: conditional expression is constant
-    # This warning can in theory catch dead code and other problems, but
-    # triggers in far too many desirable cases where the conditional
-    # expression is either set by macros or corresponds some legitimate
-    # compile-time constant expression (due to constant template args,
-    # conditionals comparing the sizes of different types, etc.).  Some of
-    # these can be worked around, but it's not worth it.
-    "/wd4127",
+      # C4127: conditional expression is constant
+      # This warning can in theory catch dead code and other problems, but
+      # triggers in far too many desirable cases where the conditional
+      # expression is either set by macros or corresponds some legitimate
+      # compile-time constant expression (due to constant template args,
+      # conditionals comparing the sizes of different types, etc.).  Some of
+      # these can be worked around, but it's not worth it.
+      "/wd4127",
 
-    # C4251: 'identifier' : class 'type' needs to have dll-interface to be
-    #        used by clients of class 'type2'
-    # This is necessary for the shared library build.
-    "/wd4251",
+      # C4251: 'identifier' : class 'type' needs to have dll-interface to be
+      #        used by clients of class 'type2'
+      # This is necessary for the shared library build.
+      "/wd4251",
 
-    # C4351: new behavior: elements of array 'array' will be default
-    #        initialized
-    # This is a silly "warning" that basically just alerts you that the
-    # compiler is going to actually follow the language spec like it's
-    # supposed to, instead of not following it like old buggy versions did.
-    # There's absolutely no reason to turn this on.
-    "/wd4351",
+      # C4351: new behavior: elements of array 'array' will be default
+      #        initialized
+      # This is a silly "warning" that basically just alerts you that the
+      # compiler is going to actually follow the language spec like it's
+      # supposed to, instead of not following it like old buggy versions did.
+      # There's absolutely no reason to turn this on.
+      "/wd4351",
 
-    # C4355: 'this': used in base member initializer list
-    # It's commonly useful to pass |this| to objects in a class' initializer
-    # list.  While this warning can catch real bugs, most of the time the
-    # constructors in question don't attempt to call methods on the passed-in
-    # pointer (until later), and annotating every legit usage of this is
-    # simply more hassle than the warning is worth.
-    "/wd4355",
+      # C4355: 'this': used in base member initializer list
+      # It's commonly useful to pass |this| to objects in a class' initializer
+      # list.  While this warning can catch real bugs, most of the time the
+      # constructors in question don't attempt to call methods on the passed-in
+      # pointer (until later), and annotating every legit usage of this is
+      # simply more hassle than the warning is worth.
+      "/wd4355",
 
-    # C4503: 'identifier': decorated name length exceeded, name was
-    #        truncated
-    # This only means that some long error messages might have truncated
-    # identifiers in the presence of lots of templates.  It has no effect on
-    # program correctness and there's no real reason to waste time trying to
-    # prevent it.
-    "/wd4503",
+      # C4503: 'identifier': decorated name length exceeded, name was
+      #        truncated
+      # This only means that some long error messages might have truncated
+      # identifiers in the presence of lots of templates.  It has no effect on
+      # program correctness and there's no real reason to waste time trying to
+      # prevent it.
+      "/wd4503",
 
-    # Warning C4589 says: "Constructor of abstract class ignores
-    # initializer for virtual base class." Disable this warning because it
-    # is flaky in VS 2015 RTM. It triggers on compiler generated
-    # copy-constructors in some cases.
-    "/wd4589",
+      # Warning C4589 says: "Constructor of abstract class ignores
+      # initializer for virtual base class." Disable this warning because it
+      # is flaky in VS 2015 RTM. It triggers on compiler generated
+      # copy-constructors in some cases.
+      "/wd4589",
 
-    # C4611: interaction between 'function' and C++ object destruction is
-    #        non-portable
-    # This warning is unavoidable when using e.g. setjmp/longjmp.  MSDN
-    # suggests using exceptions instead of setjmp/longjmp for C++, but
-    # Chromium code compiles without exception support.  We therefore have to
-    # use setjmp/longjmp for e.g. JPEG decode error handling, which means we
-    # have to turn off this warning (and be careful about how object
-    # destruction happens in such cases).
-    "/wd4611",
+      # C4611: interaction between 'function' and C++ object destruction is
+      #        non-portable
+      # This warning is unavoidable when using e.g. setjmp/longjmp.  MSDN
+      # suggests using exceptions instead of setjmp/longjmp for C++, but
+      # Chromium code compiles without exception support.  We therefore have to
+      # use setjmp/longjmp for e.g. JPEG decode error handling, which means we
+      # have to turn off this warning (and be careful about how object
+      # destruction happens in such cases).
+      "/wd4611",
 
-    # Warnings to evaluate and possibly fix/reenable later:
+      # Warnings to evaluate and possibly fix/reenable later:
 
-    "/wd4100",  # Unreferenced formal function parameter.
-    "/wd4121",  # Alignment of a member was sensitive to packing.
-    "/wd4244",  # Conversion: possible loss of data.
-    "/wd4481",  # Nonstandard extension: override specifier.
-    "/wd4505",  # Unreferenced local function has been removed.
-    "/wd4510",  # Default constructor could not be generated.
-    "/wd4512",  # Assignment operator could not be generated.
-    "/wd4610",  # Class can never be instantiated, constructor required.
-    "/wd4995",  # 'X': name was marked as #pragma deprecated
-    "/wd4996",  # Deprecated function warning.
-  ]
-
-  # VS xtree header file needs to be patched or 4702 (unreachable code
-  # warning) is reported if _HAS_EXCEPTIONS=0. Disable the warning if xtree is
-  # not patched.
-  if (!msvs_xtree_patched &&
-      exec_script("../../win_is_xtree_patched.py", [], "value") == 0) {
-    default_warning_flags += [ "/wd4702" ]  # Unreachable code.
-  }
-
-  # Building with Clang on Windows is a work in progress and very
-  # experimental. See crbug.com/82385.
-  # Keep this in sync with the similar block in build/common.gypi
-  if (is_clang) {
-    default_warning_flags += [
-      # TODO(hans): Make this list shorter eventually, http://crbug.com/504657
-      "-Qunused-arguments",  # http://crbug.com/504658
-      "-Wno-microsoft-enum-value",  # http://crbug.com/505296
-      "-Wno-unknown-pragmas",  # http://crbug.com/505314
-      "-Wno-unused-value",  # http://crbug.com/505318
+      "/wd4100",  # Unreferenced formal function parameter.
+      "/wd4121",  # Alignment of a member was sensitive to packing.
+      "/wd4244",  # Conversion: possible loss of data.
+      "/wd4481",  # Nonstandard extension: override specifier.
+      "/wd4505",  # Unreferenced local function has been removed.
+      "/wd4510",  # Default constructor could not be generated.
+      "/wd4512",  # Assignment operator could not be generated.
+      "/wd4610",  # Class can never be instantiated, constructor required.
+      "/wd4995",  # 'X': name was marked as #pragma deprecated
+      "/wd4996",  # Deprecated function warning.
     ]
-  }
-} else {
-  # Common GCC warning setup.
-  default_warning_flags += [
-    # Enables.
-    "-Wendif-labels",  # Weird old-style text after an #endif.
-    "-Werror",  # Warnings as errors.
 
-    # Disables.
-    "-Wno-missing-field-initializers",  # "struct foo f = {0};"
-    "-Wno-unused-parameter",  # Unused function parameters.
-  ]
-
-  if (is_mac) {
-    default_warning_flags += [ "-Wnewline-eof" ]
-    if (!is_nacl) {
-      # When compiling Objective-C, warns if a method is used whose
-      # availability is newer than the deployment target. This is not
-      # required when compiling Chrome for iOS.
-      default_warning_flags += [ "-Wpartial-availability" ]
+    # VS xtree header file needs to be patched or 4702 (unreachable code
+    # warning) is reported if _HAS_EXCEPTIONS=0. Disable the warning if xtree is
+    # not patched.
+    if (!msvs_xtree_patched &&
+        exec_script("../../win_is_xtree_patched.py", [], "value") == 0) {
+      cflags += [ "/wd4702" ]  # Unreachable code.
     }
-  }
 
-  if (gcc_version >= 48) {
-    default_warning_flags_cc += [
-      # See comment for -Wno-c++11-narrowing.
-      "-Wno-narrowing",
-    ]
-    if (!is_clang) {
-      default_warning_flags_cc += [
-        # TODO(thakis): Remove, http://crbug.com/263960
-        "-Wno-literal-suffix",
+    # Building with Clang on Windows is a work in progress and very
+    # experimental. See crbug.com/82385.
+    # Keep this in sync with the similar block in build/common.gypi
+    if (is_clang) {
+      cflags += [
+        # TODO(hans): Make this list shorter eventually, http://crbug.com/504657
+        "-Qunused-arguments",  # http://crbug.com/504658
+        "-Wno-microsoft-enum-value",  # http://crbug.com/505296
+        "-Wno-unknown-pragmas",  # http://crbug.com/505314
+        "-Wno-unused-value",  # http://crbug.com/505318
       ]
     }
-  }
+  } else {
+    # Common GCC warning setup.
+    cflags += [
+      # Enables.
+      "-Wendif-labels",  # Weird old-style text after an #endif.
+      "-Werror",  # Warnings as errors.
 
-  # Suppress warnings about ABI changes on ARM (Clang doesn't give this
-  # warning).
-  if (current_cpu == "arm" && !is_clang) {
-    default_warning_flags += [ "-Wno-psabi" ]
-  }
-
-  if (is_android) {
-    # Disable any additional warnings enabled by the Android build system but
-    # which chromium does not build cleanly with (when treating warning as
-    # errors).
-    default_warning_flags += [
-      "-Wno-extra",
-      "-Wno-ignored-qualifiers",
-      "-Wno-type-limits",
+      # Disables.
+      "-Wno-missing-field-initializers",  # "struct foo f = {0};"
+      "-Wno-unused-parameter",  # Unused function parameters.
     ]
-    default_warning_flags_cc += [
-      # Disabling c++0x-compat should be handled in WebKit, but
-      # this currently doesn't work because gcc_version is not set
-      # correctly when building with the Android build system.
-      # TODO(torne): Fix this in WebKit.
-      "-Wno-error=c++0x-compat",
 
-      # Other things unrelated to -Wextra:
-      "-Wno-non-virtual-dtor",
-      "-Wno-sign-promo",
-    ]
+    if (is_mac) {
+      cflags += [ "-Wnewline-eof" ]
+      if (!is_nacl) {
+        # When compiling Objective-C, warns if a method is used whose
+        # availability is newer than the deployment target. This is not
+        # required when compiling Chrome for iOS.
+        cflags += [ "-Wpartial-availability" ]
+      }
+    }
+
+    if (gcc_version >= 48) {
+      cflags_cc += [
+        # See comment for -Wno-c++11-narrowing.
+        "-Wno-narrowing",
+      ]
+      if (!is_clang) {
+        cflags_cc += [
+          # TODO(thakis): Remove, http://crbug.com/263960
+          "-Wno-literal-suffix",
+        ]
+      }
+    }
+
+    # Suppress warnings about ABI changes on ARM (Clang doesn't give this
+    # warning).
+    if (current_cpu == "arm" && !is_clang) {
+      cflags += [ "-Wno-psabi" ]
+    }
+
+    if (is_android) {
+      # Disable any additional warnings enabled by the Android build system but
+      # which chromium does not build cleanly with (when treating warning as
+      # errors).
+      cflags += [
+        "-Wno-extra",
+        "-Wno-ignored-qualifiers",
+        "-Wno-type-limits",
+      ]
+      cflags_cc += [
+        # Disabling c++0x-compat should be handled in WebKit, but
+        # this currently doesn't work because gcc_version is not set
+        # correctly when building with the Android build system.
+        # TODO(torne): Fix this in WebKit.
+        "-Wno-error=c++0x-compat",
+
+        # Other things unrelated to -Wextra:
+        "-Wno-non-virtual-dtor",
+        "-Wno-sign-promo",
+      ]
+    }
+
+    if (gcc_version >= 48) {
+      # Don't warn about the "typedef 'foo' locally defined but not used"
+      # for gcc 4.8.
+      # TODO: remove this flag once all builds work. See crbug.com/227506
+      cflags += [ "-Wno-unused-local-typedefs" ]
+    }
   }
 
-  if (gcc_version >= 48) {
-    # Don't warn about the "typedef 'foo' locally defined but not used"
-    # for gcc 4.8.
-    # TODO: remove this flag once all builds work. See crbug.com/227506
-    default_warning_flags += [ "-Wno-unused-local-typedefs" ]
-  }
-}
-if (is_clang) {
-  default_warning_flags += [
-    # This warns on using ints as initializers for floats in
-    # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
-    # which happens in several places in chrome code. Not sure if
-    # this is worth fixing.
-    "-Wno-c++11-narrowing",
+  if (is_clang) {
+    cflags += [
+      # This warns on using ints as initializers for floats in
+      # initializer lists (e.g. |int a = f(); CGSize s = { a, a };|),
+      # which happens in several places in chrome code. Not sure if
+      # this is worth fixing.
+      "-Wno-c++11-narrowing",
 
-    # Don't die on dtoa code that uses a char as an array index.
-    # This is required solely for base/third_party/dmg_fp/dtoa.cc.
-    # TODO(brettw) move this to that project then!
-    "-Wno-char-subscripts",
+      # Don't die on dtoa code that uses a char as an array index.
+      # This is required solely for base/third_party/dmg_fp/dtoa.cc.
+      # TODO(brettw) move this to that project then!
+      "-Wno-char-subscripts",
 
-    # Warns on switches on enums that cover all enum values but
-    # also contain a default: branch. Chrome is full of that.
-    "-Wno-covered-switch-default",
+      # Warns on switches on enums that cover all enum values but
+      # also contain a default: branch. Chrome is full of that.
+      "-Wno-covered-switch-default",
 
-    # Clang considers the `register` keyword as deprecated, but e.g.
-    # code generated by flex (used in angle) contains that keyword.
-    # http://crbug.com/255186
-    "-Wno-deprecated-register",
+      # Clang considers the `register` keyword as deprecated, but e.g.
+      # code generated by flex (used in angle) contains that keyword.
+      # http://crbug.com/255186
+      "-Wno-deprecated-register",
 
-    # TODO(thakis): This used to be implied by -Wno-unused-function,
-    # which we no longer use. Check if it makes sense to remove
-    # this as well. http://crbug.com/316352
-    "-Wno-unneeded-internal-declaration",
+      # TODO(thakis): This used to be implied by -Wno-unused-function,
+      # which we no longer use. Check if it makes sense to remove
+      # this as well. http://crbug.com/316352
+      "-Wno-unneeded-internal-declaration",
 
-    # TODO(hans): Get this cleaned up, http://crbug.com/428099
-    "-Wno-inconsistent-missing-override",
-  ]
-
-  if (is_posix && !is_mac && !is_ios) {
-    default_warning_flags += [
-      # TODO(thakis): Remove, http://crbug.com/263960
-      "-Wno-reserved-user-defined-literal",
+      # TODO(hans): Get this cleaned up, http://crbug.com/428099
+      "-Wno-inconsistent-missing-override",
     ]
-  }
 
-  # NaCl's Clang compiler and Chrome's hermetic Clang compiler will almost
-  # always have different versions. Certain flags may not be recognized by
-  # one version or the other.
-  if (!is_nacl) {
-    # Flags NaCl does not recognize.
-    default_warning_flags += [
-      # TODO(thakis): Enable this, crbug.com/507717
-      "-Wno-shift-negative-value",
+    if (is_posix && !is_mac && !is_ios) {
+      cflags += [
+        # TODO(thakis): Remove, http://crbug.com/263960
+        "-Wno-reserved-user-defined-literal",
+      ]
+    }
 
-      # TODO(thakis): Consider enabling this?
-      "-Wno-bitfield-width",
-    ]
+    # NaCl's Clang compiler and Chrome's hermetic Clang compiler will almost
+    # always have different versions. Certain flags may not be recognized by
+    # one version or the other.
+    if (!is_nacl) {
+      # Flags NaCl (Clang 3.7) does not recognize.
+      cflags += [
+        # TODO(thakis): Enable this, crbug.com/507717
+        "-Wno-shift-negative-value",
+
+        # TODO(thakis): Consider enabling this?
+        "-Wno-bitfield-width",
+      ]
+    }
   }
 }
 
@@ -766,8 +780,8 @@
       defines += [ "_FORTIFY_SOURCE=2" ]
     }
   }
-  cflags += default_warning_flags
-  cflags_cc = default_warning_flags_cc
+
+  configs = [ ":default_warnings" ]
 }
 
 config("no_chromium_code") {
@@ -820,8 +834,7 @@
     ]
   }
 
-  cflags += default_warning_flags
-  cflags_cc += default_warning_flags_cc
+  configs = [ ":default_warnings" ]
 }
 
 # rtti ------------------------------------------------------------------------
diff --git a/build/config/gcc/gcc_version.gni b/build/config/gcc/gcc_version.gni
index 6741e45..eed1bc8 100644
--- a/build/config/gcc/gcc_version.gni
+++ b/build/config/gcc/gcc_version.gni
@@ -2,25 +2,33 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-if (is_android) {
-  gcc_version = 49
-} else if (current_toolchain == "//build/toolchain/cros:target" ||
-           current_toolchain == "//build/toolchain/linux:mipsel") {
-  gcc_version = exec_script("../../compiler_version.py",
-                            [
-                              "target",
-                              "compiler",
-                            ],
-                            "value")
-} else if (current_toolchain == "//build/toolchain/linux:x64" ||
-           current_toolchain == "//build/toolchain/linux:x86") {
-  # These are both the same and just use the default gcc on the system.
-  gcc_version = exec_script("../../compiler_version.py",
-                            [
-                              "host",
-                              "compiler",
-                            ],
-                            "value")
-} else {
-  gcc_version = 0
+declare_args() {
+  # This allows the gcc_version to be overriden when using a custom toolchain.
+  # If the gcc_version is {X}.{Y}, set this value as XY.
+  gcc_version = -1
+}
+
+if (gcc_version == -1) {
+  if (is_android) {
+    gcc_version = 49
+  } else if (current_toolchain == "//build/toolchain/cros:target" ||
+             current_toolchain == "//build/toolchain/linux:mipsel") {
+    gcc_version = exec_script("../../compiler_version.py",
+                              [
+                                "target",
+                                "compiler",
+                              ],
+                              "value")
+  } else if (current_toolchain == "//build/toolchain/linux:x64" ||
+             current_toolchain == "//build/toolchain/linux:x86") {
+    # These are both the same and just use the default gcc on the system.
+    gcc_version = exec_script("../../compiler_version.py",
+                              [
+                                "host",
+                                "compiler",
+                              ],
+                              "value")
+  } else {
+    gcc_version = 0
+  }
 }
diff --git a/build/config/ios/BUILD.gn b/build/config/ios/BUILD.gn
index d69f423..07e8a86 100644
--- a/build/config/ios/BUILD.gn
+++ b/build/config/ios/BUILD.gn
@@ -5,7 +5,11 @@
 import("//build/config/sysroot.gni")
 import("//build/config/ios/ios_sdk.gni")
 
-config("sdk") {
+# This is included by reference in the //build/config/compiler:runtime_library
+# config that is applied to all targets. It is here to separate out the logic
+# that is iOS-only. Please see that target for advice on what should go in
+# :runtime_library vs. :compiler.
+config("runtime_library") {
   common_flags = [
     "-isysroot",
     sysroot,
diff --git a/build/config/linux/BUILD.gn b/build/config/linux/BUILD.gn
index 45d1dd5..e39155c 100644
--- a/build/config/linux/BUILD.gn
+++ b/build/config/linux/BUILD.gn
@@ -7,21 +7,11 @@
 import("//build/config/sysroot.gni")
 import("//build/config/ui.gni")
 
-config("sdk") {
-  if (sysroot != "") {
-    cflags = [ "--sysroot=" + sysroot ]
-    ldflags = [ "--sysroot=" + sysroot ]
-
-    # Need to get some linker flags out of the sysroot.
-    ldflags += [ exec_script("sysroot_ld_path.py",
-                             [
-                               rebase_path("//build/linux/sysroot_ld_path.sh",
-                                           root_build_dir),
-                               sysroot,
-                             ],
-                             "value") ]
-  }
-
+# This is included by reference in the //build/config/compiler:runtime_library
+# config that is applied to all targets. It is here to separate out the logic
+# that is Linux-only. Please see that target for advice on what should go in
+# :runtime_library vs. :compiler.
+config("runtime_library") {
   # Set here because OS_CHROMEOS cannot be autodetected in build_config.h like
   # OS_LINUX and the like.
   if (is_chromeos) {
diff --git a/build/config/mac/BUILD.gn b/build/config/mac/BUILD.gn
index 7653b966..16dc52e 100644
--- a/build/config/mac/BUILD.gn
+++ b/build/config/mac/BUILD.gn
@@ -5,7 +5,11 @@
 import("//build/config/sysroot.gni")
 import("//build/config/mac/mac_sdk.gni")
 
-config("sdk") {
+# This is included by reference in the //build/config/compiler:runtime_library
+# config that is applied to all targets. It is here to separate out the logic
+# that is Mac-only. Please see that target for advice on what should go in
+# :runtime_library vs. :compiler.
+config("runtime_library") {
   common_flags = [
     "-isysroot",
     sysroot,
diff --git a/build/config/posix/BUILD.gn b/build/config/posix/BUILD.gn
new file mode 100644
index 0000000..6f65443
--- /dev/null
+++ b/build/config/posix/BUILD.gn
@@ -0,0 +1,29 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/sysroot.gni")
+
+assert(is_posix)
+
+# This is included by reference in the //build/config/compiler:runtime_library
+# config that is applied to all targets. It is here to separate out the logic
+# that is Posix-only. Please see that target for advice on what should go in
+# :runtime_library vs. :compiler.
+config("runtime_library") {
+  if (!is_mac && sysroot != "") {
+    # Pass the sysroot to all C compiler variants, the assembler, and linker.
+    cflags = [ "--sysroot=" + sysroot ]
+    asmflags = cflags
+    ldflags = cflags
+
+    # Need to get some linker flags out of the sysroot.
+    ldflags += [ exec_script("sysroot_ld_path.py",
+                             [
+                               rebase_path("//build/linux/sysroot_ld_path.sh",
+                                           root_build_dir),
+                               sysroot,
+                             ],
+                             "value") ]
+  }
+}
diff --git a/build/config/linux/sysroot_ld_path.py b/build/config/posix/sysroot_ld_path.py
similarity index 100%
rename from build/config/linux/sysroot_ld_path.py
rename to build/config/posix/sysroot_ld_path.py
diff --git a/build/config/sanitizers/sanitizers.gni b/build/config/sanitizers/sanitizers.gni
index 84348da..fb9703e 100644
--- a/build/config/sanitizers/sanitizers.gni
+++ b/build/config/sanitizers/sanitizers.gni
@@ -19,11 +19,6 @@
   # undefined behaviour.
   is_ubsan = false
 
-  # Use libc++ (buildtools/third_party/libc++ and
-  # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
-  # This is intended to be used for instrumented builds.
-  use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan
-
   # Track where uninitialized memory originates from. From fastest to slowest:
   # 0 - no tracking, 1 - track only the initial allocation site, 2 - track the
   # chain of stores leading from allocation site to use site.
@@ -48,6 +43,16 @@
   use_cfi_diag = false
 }
 
+# Args that are in turn dependent on other args must be in a separate
+# declare_args block. User overrides are only applied at the end of a
+# declare_args block.
+declare_args() {
+  # Use libc++ (buildtools/third_party/libc++ and
+  # buildtools/third_party/libc++abi) instead of stdlibc++ as standard library.
+  # This is intended to be used for instrumented builds.
+  use_custom_libcxx = (is_asan && is_linux) || is_tsan || is_msan || is_ubsan
+}
+
 # TODO(GYP) bug 527515: is_ubsan, is_ubsan_vptr
 using_sanitizer = is_asan || is_lsan || is_tsan || is_msan || is_ubsan
 
diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index d1f670e9..daa07741 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -84,6 +84,7 @@
 config("runtime_library") {
   cflags = []
 
+  # Defines that set up the CRT.
   defines = [
     "__STD_C",
     "_CRT_RAND_S",
@@ -92,6 +93,20 @@
     "_SCL_SECURE_NO_DEPRECATE",
   ]
 
+  # Defines that set up the Windows SDK.
+  defines += [
+    "_ATL_NO_OPENGL",
+    "_WINDOWS",
+    "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
+    "NTDDI_VERSION=0x06030000",
+    "PSAPI_VERSION=1",
+    "WIN32",
+    "_SECURE_ATL",
+
+    # This is required for ATL to use XP-safe versions of its functions.
+    "_USING_V110_SDK71_",
+  ]
+
   if (is_component_build) {
     # Component mode: dynamic CRT. Since the library is shared, it requires
     # exceptions or will give errors about things not matching, so keep
@@ -120,25 +135,6 @@
   }
 }
 
-# Compiler setup for the Windows SDK. Applied to all targets.
-config("sdk") {
-  # The include path is the stuff returned by the script.
-  #include_dirs = msvc_config[0]  TODO(brettw) make this work.
-
-  defines = [
-    "_ATL_NO_OPENGL",
-    "_WINDOWS",
-    "CERT_CHAIN_PARA_HAS_EXTRA_FIELDS",
-    "NTDDI_VERSION=0x06030000",
-    "PSAPI_VERSION=1",
-    "WIN32",
-    "_SECURE_ATL",
-
-    # This is required for ATL to use XP-safe versions of its functions.
-    "_USING_V110_SDK71_",
-  ]
-}
-
 # Sets the default Windows build version. This is separated because some
 # targets need to manually override it for their compiles.
 config("winver") {
diff --git a/build/gn_migration.gypi b/build/gn_migration.gypi
index ad910b0..03fc48bc 100644
--- a/build/gn_migration.gypi
+++ b/build/gn_migration.gypi
@@ -468,12 +468,16 @@
           'dependencies': [
             '../base/base.gyp:pe_image_test',
             '../chrome/chrome.gyp:crash_service',
+            '../chrome/chrome.gyp:installer_util_unittests',
+            '../chrome/chrome.gyp:setup',
             '../chrome/chrome.gyp:setup_unittests',
+            '../chrome/installer/mini_installer.gyp:mini_installer',
             '../chrome_elf/chrome_elf.gyp:chrome_elf_unittests',
             '../chrome_elf/chrome_elf.gyp:dll_hash_main',
             '../components/components.gyp:wifi_test',
             '../net/net.gyp:quic_client',
             '../net/net.gyp:quic_server',
+            '../rlz/rlz.gyp:rlz',
             '../sandbox/sandbox.gyp:pocdll',
             '../sandbox/sandbox.gyp:sandbox_poc',
             '../sandbox/sandbox.gyp:sbox_integration_tests',
@@ -651,16 +655,20 @@
         ['OS=="win"', {
           'dependencies': [
             # TODO(GYP): All of these targets still need to be converted.
-            '../base/base.gyp:debug_message',
             '../chrome/chrome.gyp:app_shim',
             '../chrome/chrome.gyp:gcapi_dll',
             '../chrome/chrome.gyp:gcapi_test',
-            '../chrome/chrome.gyp:installer_util_unittests',
             '../chrome/chrome.gyp:pack_policy_templates',
+
+            # This is a safe browsing utility only necessary for developers.
+            # For now, we can skip this and anybody that needs this can add it
+            # to the GN build.
             '../chrome/chrome.gyp:sb_sigutil',
-            '../chrome/chrome.gyp:setup',
-            '../chrome/installer/mini_installer.gyp:mini_installer',
+
+            # This project is up in the air. Don't need to convert it unless
+            # we decide we need for something. Owner: scottmg.
             '../chrome/tools/crash_service/caps/caps.gyp:caps',
+
             '../cloud_print/gcp20/prototype/gcp20_device.gyp:gcp20_device',
             '../cloud_print/gcp20/prototype/gcp20_device.gyp:gcp20_device_unittests',
             '../cloud_print/service/win/service.gyp:cloud_print_service',
@@ -678,7 +686,6 @@
             '../remoting/remoting.gyp:remoting_breakpad_tester',
             '../remoting/remoting.gyp:remoting_console',
             '../remoting/remoting.gyp:remoting_desktop',
-            '../rlz/rlz.gyp:rlz',
             '../tools/win/static_initializers/static_initializers.gyp:static_initializers',
           ],
         }],
diff --git a/build/ios/grit_whitelist.txt b/build/ios/grit_whitelist.txt
index 4a02c93a..0d680dd0 100644
--- a/build/ios/grit_whitelist.txt
+++ b/build/ios/grit_whitelist.txt
@@ -26,9 +26,6 @@
 IDR_INFOBAR_RESTORE_SESSION
 IDR_INFOBAR_SAVE_PASSWORD
 IDR_INFOBAR_WARNING
-IDR_NET_ERROR_HTML
-IDR_NET_EXPORT_HTML
-IDR_NET_EXPORT_JS
 IDR_NET_INTERNALS_INDEX_HTML
 IDR_NET_INTERNALS_INDEX_JS
 IDR_OMAHA_HTML
@@ -664,8 +661,6 @@
 IDS_NACL_DEBUG_MASK_CHOICE_EXCLUDE_UTILS_PNACL
 IDS_NACL_DEBUG_MASK_CHOICE_INCLUDE_DEBUG
 IDS_NETWORK_PREDICTION_ENABLED_DESCRIPTION
-IDS_NET_EXPORT_NO_EMAIL_ACCOUNTS_ALERT_MESSAGE
-IDS_NET_EXPORT_NO_EMAIL_ACCOUNTS_ALERT_TITLE
 IDS_NEW_INCOGNITO_WINDOW_MAC
 IDS_NEW_NUMBERED_PROFILE_NAME
 IDS_NEW_TAB_CHROME_WELCOME_PAGE_TITLE
diff --git a/cc/cc.gyp b/cc/cc.gyp
index e1d0f4b9f..642ec75 100644
--- a/cc/cc.gyp
+++ b/cc/cc.gyp
@@ -548,8 +548,8 @@
         'trees/property_tree_builder.h',
         'trees/proxy.cc',
         'trees/proxy.h',
-        'trees/proxy_impl.h'
-        'trees/proxy_main.h'
+        'trees/proxy_impl.h',
+        'trees/proxy_main.h',
         'trees/scoped_abort_remaining_swap_promises.h',
         'trees/single_thread_proxy.cc',
         'trees/single_thread_proxy.h',
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc
index 58facc4..f9815183 100644
--- a/cc/output/direct_renderer.cc
+++ b/cc/output/direct_renderer.cc
@@ -222,6 +222,20 @@
 
   BeginDrawingFrame(&frame);
 
+  if (output_surface_->IsDisplayedAsOverlayPlane()) {
+    // Create the overlay candidate for the output surface, and mark it as
+    // always
+    // handled.
+    OverlayCandidate output_surface_plane;
+    output_surface_plane.display_rect =
+        gfx::RectF(root_render_pass->output_rect);
+    output_surface_plane.quad_rect_in_target_space =
+        root_render_pass->output_rect;
+    output_surface_plane.use_output_surface_for_resource = true;
+    output_surface_plane.overlay_handled = true;
+    frame.overlay_list.push_back(output_surface_plane);
+  }
+
   // If we have any copy requests, we can't remove any quads for overlays,
   // otherwise the framebuffer will be missing the overlay contents.
   if (root_render_pass->copy_requests.empty()) {
diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc
index 11a4b450..536ab50 100644
--- a/cc/output/gl_renderer.cc
+++ b/cc/output/gl_renderer.cc
@@ -3515,10 +3515,6 @@
   ResourceProvider::ResourceIdArray resources;
   OverlayCandidateList& overlays = frame->overlay_list;
   for (const OverlayCandidate& overlay : overlays) {
-    // Skip primary plane.
-    if (overlay.plane_z_order == 0)
-      continue;
-
     unsigned texture_id = 0;
     if (overlay.use_output_surface_for_resource) {
       texture_id = output_surface_->GetOverlayTextureId();
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index bd6eeb9f..dd025f23 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -2124,7 +2124,7 @@
     }
 
     void CheckOverlaySupport(OverlayCandidateList* surfaces) override {
-      ASSERT_EQ(2U, surfaces->size());
+      ASSERT_EQ(1U, surfaces->size());
       OverlayCandidate& candidate = surfaces->back();
       candidate.overlay_handled = true;
     }
diff --git a/cc/output/output_surface.cc b/cc/output/output_surface.cc
index c1a1ec2..38b1346 100644
--- a/cc/output/output_surface.cc
+++ b/cc/output/output_surface.cc
@@ -299,6 +299,10 @@
   return nullptr;
 }
 
+bool OutputSurface::IsDisplayedAsOverlayPlane() const {
+  return false;
+}
+
 unsigned OutputSurface::GetOverlayTextureId() const {
   return 0;
 }
diff --git a/cc/output/output_surface.h b/cc/output/output_surface.h
index 66d1c79..bb6a59e 100644
--- a/cc/output/output_surface.h
+++ b/cc/output/output_surface.h
@@ -151,6 +151,9 @@
   // Get the class capable of informing cc of hardware overlay capability.
   virtual OverlayCandidateValidator* GetOverlayCandidateValidator() const;
 
+  // Returns true if a main image overlay plane should be scheduled.
+  virtual bool IsDisplayedAsOverlayPlane() const;
+
   // Get the texture for the main image's overlay.
   virtual unsigned GetOverlayTextureId() const;
 
diff --git a/cc/output/overlay_strategy_common.cc b/cc/output/overlay_strategy_common.cc
index 4fd67c32..d142ba54 100644
--- a/cc/output/overlay_strategy_common.cc
+++ b/cc/output/overlay_strategy_common.cc
@@ -24,12 +24,6 @@
   RenderPass* root_render_pass = render_passes_in_draw_order->back();
   DCHECK(root_render_pass);
 
-  // Add our primary surface.
-  OverlayCandidate main_image;
-  main_image.display_rect = gfx::RectF(root_render_pass->output_rect);
-  DCHECK(candidate_list->empty());
-  candidate_list->push_back(main_image);
-
   bool created_overlay = false;
   QuadList& quad_list = root_render_pass->quad_list;
   for (auto it = quad_list.begin(); it != quad_list.end();) {
@@ -54,11 +48,6 @@
     }
   }
 
-  if (!created_overlay) {
-    DCHECK_EQ(1u, candidate_list->size());
-    candidate_list->clear();
-  }
-
   return created_overlay;
 }
 
diff --git a/cc/output/overlay_unittest.cc b/cc/output/overlay_unittest.cc
index 854c267..155707b 100644
--- a/cc/output/overlay_unittest.cc
+++ b/cc/output/overlay_unittest.cc
@@ -67,9 +67,13 @@
         new OverlayStrategyCommon(this, new OverlayStrategyUnderlay)));
   }
   void CheckOverlaySupport(OverlayCandidateList* surfaces) override {
-    ASSERT_EQ(2U, surfaces->size());
+    // We may have 1 or 2 surfaces depending on whether this ran through the
+    // full renderer and picked up the output surface, or not.
+    ASSERT_LE(1U, surfaces->size());
+    ASSERT_GE(2U, surfaces->size());
 
     OverlayCandidate& candidate = surfaces->back();
+    EXPECT_TRUE(!candidate.use_output_surface_for_resource);
     if (candidate.display_rect.width() == 64) {
       EXPECT_EQ(gfx::RectF(kOverlayBottomRightRect), candidate.display_rect);
     } else {
@@ -149,6 +153,7 @@
       : OutputSurface(context_provider) {
     surface_size_ = kDisplaySize;
     device_scale_factor_ = 1;
+    is_displayed_as_overlay_plane_ = true;
   }
 
   void SetScaleFactor(float scale_factor) {
@@ -166,8 +171,17 @@
     return overlay_candidate_validator_.get();
   }
 
+  bool IsDisplayedAsOverlayPlane() const override {
+    return is_displayed_as_overlay_plane_;
+  }
+  unsigned GetOverlayTextureId() const override { return 10000; }
+  void set_is_displayed_as_overlay_plane(bool value) {
+    is_displayed_as_overlay_plane_ = value;
+  }
+
  private:
   scoped_ptr<OverlayCandidateValidator> overlay_candidate_validator_;
+  bool is_displayed_as_overlay_plane_;
 };
 
 void OverlayOutputSurface::SwapBuffers(CompositorFrame* frame) {
@@ -406,7 +420,7 @@
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
 
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
+  ASSERT_EQ(1U, candidate_list.size());
 
   RenderPass* main_pass = pass_list.back();
   // Check that the quad is gone.
@@ -448,10 +462,10 @@
 
   // Ensure that the display and uv rects have cropping applied to them.
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
-  EXPECT_EQ(candidate_id, candidate_list[1].resource_id);
-  EXPECT_EQ(gfx::RectF(0.f, 32.f, 64.f, 64.f), candidate_list[1].display_rect);
-  EXPECT_EQ(gfx::RectF(0.f, 0.25f, 0.5f, 0.5f), candidate_list[1].uv_rect);
+  ASSERT_EQ(1U, candidate_list.size());
+  EXPECT_EQ(candidate_id, candidate_list[0].resource_id);
+  EXPECT_EQ(gfx::RectF(0.f, 32.f, 64.f, 64.f), candidate_list[0].display_rect);
+  EXPECT_EQ(gfx::RectF(0.f, 0.25f, 0.5f, 0.5f), candidate_list[0].uv_rect);
 }
 
 TEST_F(SandwichTest, SuccessfulTwoOverlays) {
@@ -476,10 +490,10 @@
 
   // Both candidates should become overlays.
   EXPECT_EQ(1u, pass_list.size());
-  EXPECT_EQ(3u, candidate_list.size());
-  EXPECT_EQ(gfx::RectF(kOverlayTopLeftRect), candidate_list[1].display_rect);
+  EXPECT_EQ(2u, candidate_list.size());
+  EXPECT_EQ(gfx::RectF(kOverlayTopLeftRect), candidate_list[0].display_rect);
   EXPECT_EQ(gfx::RectF(kOverlayBottomRightRect),
-            candidate_list[2].display_rect);
+            candidate_list[1].display_rect);
 
   // The overlay quads should be gone.
   const QuadList& quad_list = pass_list.back()->quad_list;
@@ -509,8 +523,8 @@
 
   // Only one of the candidates should become an overlay.
   EXPECT_EQ(1u, pass_list.size());
-  EXPECT_EQ(2u, candidate_list.size());
-  EXPECT_EQ(gfx::RectF(kOverlayTopLeftRect), candidate_list[1].display_rect);
+  EXPECT_EQ(1u, candidate_list.size());
+  EXPECT_EQ(gfx::RectF(kOverlayTopLeftRect), candidate_list[0].display_rect);
 
   // One of the overlay quads should be gone.
   const QuadList& quad_list = pass_list.back()->quad_list;
@@ -542,7 +556,7 @@
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
 
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(3U, candidate_list.size());
+  ASSERT_EQ(2U, candidate_list.size());
 
   RenderPass* main_pass = pass_list.back();
   // Check that the quad is gone.
@@ -553,13 +567,12 @@
     EXPECT_NE(DrawQuad::TEXTURE_CONTENT, it->material);
   }
 
-  EXPECT_FALSE(candidate_list[0].use_output_surface_for_resource);
-  EXPECT_EQ(candidate_id, candidate_list[1].resource_id);
-  EXPECT_EQ(gfx::RectF(32.f, 32.f, 32.f, 32.f), candidate_list[1].display_rect);
-  EXPECT_TRUE(candidate_list[2].use_output_surface_for_resource);
-  EXPECT_EQ(gfx::RectF(32.f, 32.f, 16.f, 16.f), candidate_list[2].display_rect);
+  EXPECT_EQ(candidate_id, candidate_list[0].resource_id);
+  EXPECT_EQ(gfx::RectF(32.f, 32.f, 32.f, 32.f), candidate_list[0].display_rect);
+  EXPECT_TRUE(candidate_list[1].use_output_surface_for_resource);
+  EXPECT_EQ(gfx::RectF(32.f, 32.f, 16.f, 16.f), candidate_list[1].display_rect);
   EXPECT_EQ(gfx::RectF(32.f / 256.f, 32.f / 256.f, 16.f / 256.f, 16.f / 256.f),
-            candidate_list[2].uv_rect);
+            candidate_list[1].uv_rect);
 }
 
 TEST_F(SandwichTest, MultiQuadOverlay) {
@@ -597,7 +610,7 @@
   EXPECT_EQ(4U, main_pass->quad_list.size());
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(4U, candidate_list.size());
+  ASSERT_EQ(3U, candidate_list.size());
 
   // Check that the candidate quad is gone and that we now have two transparent
   // quads for the same region that was covered on the overlay.
@@ -617,14 +630,13 @@
   DCHECK(covered_region == transparent_quad_region);
 
   // Check that overlays cover the same region that the quads covered.
-  EXPECT_FALSE(candidate_list[0].use_output_surface_for_resource);
-  EXPECT_EQ(candidate_id, candidate_list[1].resource_id);
-  EXPECT_EQ(gfx::RectF(64.f, 64.f), candidate_list[1].display_rect);
+  EXPECT_EQ(candidate_id, candidate_list[0].resource_id);
+  EXPECT_EQ(gfx::RectF(64.f, 64.f), candidate_list[0].display_rect);
+  EXPECT_TRUE(candidate_list[1].use_output_surface_for_resource);
   EXPECT_TRUE(candidate_list[2].use_output_surface_for_resource);
-  EXPECT_TRUE(candidate_list[3].use_output_surface_for_resource);
   Region overlay_region;
+  overlay_region.Union(gfx::ToEnclosingRect(candidate_list[1].display_rect));
   overlay_region.Union(gfx::ToEnclosingRect(candidate_list[2].display_rect));
-  overlay_region.Union(gfx::ToEnclosingRect(candidate_list[3].display_rect));
   DCHECK(covered_region == overlay_region);
 }
 
@@ -650,7 +662,7 @@
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
 
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
+  ASSERT_EQ(1U, candidate_list.size());
 
   RenderPass* main_pass = pass_list.back();
   // Check that the quad is gone.
@@ -734,7 +746,7 @@
   // Check for potential candidates.
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 
   // This should be the same.
   ASSERT_EQ(2U, pass_list.size());
@@ -847,7 +859,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(SingleOverlayOnTopTest, AllowVerticalFlip) {
@@ -865,7 +877,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
+  ASSERT_EQ(1U, candidate_list.size());
   EXPECT_EQ(gfx::OVERLAY_TRANSFORM_FLIP_VERTICAL,
             candidate_list.back().transform);
 }
@@ -885,7 +897,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
+  ASSERT_EQ(1U, candidate_list.size());
   EXPECT_EQ(gfx::OVERLAY_TRANSFORM_FLIP_HORIZONTAL,
             candidate_list.back().transform);
 }
@@ -904,7 +916,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(SingleOverlayOnTopTest, Allow90DegreeRotation) {
@@ -921,7 +933,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
+  ASSERT_EQ(1U, candidate_list.size());
   EXPECT_EQ(gfx::OVERLAY_TRANSFORM_ROTATE_90, candidate_list.back().transform);
 }
 
@@ -939,7 +951,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
+  ASSERT_EQ(1U, candidate_list.size());
   EXPECT_EQ(gfx::OVERLAY_TRANSFORM_ROTATE_180, candidate_list.back().transform);
 }
 
@@ -957,7 +969,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
+  ASSERT_EQ(1U, candidate_list.size());
   EXPECT_EQ(gfx::OVERLAY_TRANSFORM_ROTATE_270, candidate_list.back().transform);
 }
 
@@ -980,7 +992,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   EXPECT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(SingleOverlayOnTopTest, AllowTransparentOnTop) {
@@ -1003,7 +1015,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   EXPECT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(SingleOverlayOnTopTest, AllowTransparentColorOnTop) {
@@ -1024,7 +1036,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   EXPECT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(SingleOverlayOnTopTest, RejectOpaqueColorOnTop) {
@@ -1096,7 +1108,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(SingleOverlayOnTopTest, AllowVideoBothMirrorTransform) {
@@ -1110,7 +1122,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(SingleOverlayOnTopTest, AllowVideoNormalTransform) {
@@ -1124,7 +1136,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(SingleOverlayOnTopTest, AllowVideoYMirrorTransform) {
@@ -1138,7 +1150,7 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   ASSERT_EQ(1U, pass_list.size());
-  EXPECT_EQ(2U, candidate_list.size());
+  EXPECT_EQ(1U, candidate_list.size());
 }
 
 TEST_F(UnderlayTest, OverlayLayerUnderMainLayer) {
@@ -1155,9 +1167,8 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   EXPECT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
-  EXPECT_EQ(0, candidate_list[0].plane_z_order);
-  EXPECT_EQ(-1, candidate_list[1].plane_z_order);
+  ASSERT_EQ(1U, candidate_list.size());
+  EXPECT_EQ(-1, candidate_list[0].plane_z_order);
   EXPECT_EQ(2U, pass_list[0]->quad_list.size());
   // The overlay quad should have changed to a SOLID_COLOR quad.
   EXPECT_EQ(pass_list[0]->quad_list.back()->material, DrawQuad::SOLID_COLOR);
@@ -1178,9 +1189,8 @@
   OverlayCandidateList candidate_list;
   overlay_processor_->ProcessForOverlays(&pass_list, &candidate_list);
   EXPECT_EQ(1U, pass_list.size());
-  ASSERT_EQ(2U, candidate_list.size());
-  EXPECT_EQ(0, candidate_list[0].plane_z_order);
-  EXPECT_EQ(-1, candidate_list[1].plane_z_order);
+  ASSERT_EQ(1U, candidate_list.size());
+  EXPECT_EQ(-1, candidate_list[0].plane_z_order);
   // The overlay quad should have changed to a SOLID_COLOR quad.
   EXPECT_EQ(pass_list[0]->quad_list.front()->material, DrawQuad::SOLID_COLOR);
 }
@@ -1353,11 +1363,13 @@
   // so only draw 2 quads.
   EXPECT_CALL(*renderer_, DoDrawQuad(_, _, _)).Times(2);
   EXPECT_CALL(scheduler_,
-              Schedule(1,
-                       gfx::OVERLAY_TRANSFORM_NONE,
-                       _,
-                       kOverlayRect,
-                       BoundingRect(kUVTopLeft, kUVBottomRight))).Times(1);
+              Schedule(0, gfx::OVERLAY_TRANSFORM_NONE, _,
+                       gfx::Rect(kDisplaySize), gfx::RectF(0, 0, 1, 1)))
+      .Times(1);
+  EXPECT_CALL(scheduler_,
+              Schedule(1, gfx::OVERLAY_TRANSFORM_NONE, _, kOverlayRect,
+                       BoundingRect(kUVTopLeft, kUVBottomRight)))
+      .Times(1);
   renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false);
 
   SwapBuffers();
@@ -1390,8 +1402,13 @@
   // Expect to be replaced with transparent hole quad and placed in underlay.
   EXPECT_CALL(*renderer_, DoDrawQuad(_, _, _)).Times(3);
   EXPECT_CALL(scheduler_,
+              Schedule(0, gfx::OVERLAY_TRANSFORM_NONE, _,
+                       gfx::Rect(kDisplaySize), gfx::RectF(0, 0, 1, 1)))
+      .Times(1);
+  EXPECT_CALL(scheduler_,
               Schedule(-1, gfx::OVERLAY_TRANSFORM_NONE, _, kOverlayRect,
-                       BoundingRect(kUVTopLeft, kUVBottomRight))).Times(1);
+                       BoundingRect(kUVTopLeft, kUVBottomRight)))
+      .Times(1);
   renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false);
 
   SwapBuffers();
@@ -1420,13 +1437,12 @@
   RenderPassList pass_list;
   pass_list.push_back(pass.Pass());
 
-  // Should see no overlays.
+  // Should not see the primary surface's overlay.
+  output_surface_->set_is_displayed_as_overlay_plane(false);
   EXPECT_CALL(*renderer_, DoDrawQuad(_, _, _)).Times(3);
   EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(0);
   renderer_->DrawFrame(&pass_list, 1.f, viewport_rect, viewport_rect, false);
-
   SwapBuffers();
-
   Mock::VerifyAndClearExpectations(renderer_.get());
   Mock::VerifyAndClearExpectations(&scheduler_);
 }
@@ -1446,6 +1462,7 @@
   DirectRenderer::DrawingFrame frame1;
   frame1.render_passes_in_draw_order = &pass_list;
   frame1.overlay_list.resize(2);
+  frame1.overlay_list.front().use_output_surface_for_resource = true;
   OverlayCandidate& overlay1 = frame1.overlay_list.back();
   overlay1.resource_id = resource1;
   overlay1.plane_z_order = 1;
@@ -1453,19 +1470,21 @@
   DirectRenderer::DrawingFrame frame2;
   frame2.render_passes_in_draw_order = &pass_list;
   frame2.overlay_list.resize(2);
+  frame2.overlay_list.front().use_output_surface_for_resource = true;
   OverlayCandidate& overlay2 = frame2.overlay_list.back();
   overlay2.resource_id = resource2;
   overlay2.plane_z_order = 1;
 
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame1);
+  printf("About to finish, %d %d\n", resource1, resource2);
   renderer_->FinishDrawingFrame(&frame1);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
   EXPECT_FALSE(resource_provider_->InUseByConsumer(resource2));
   SwapBuffers();
   Mock::VerifyAndClearExpectations(&scheduler_);
 
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame2);
   renderer_->FinishDrawingFrame(&frame2);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
@@ -1474,7 +1493,7 @@
   EXPECT_FALSE(resource_provider_->InUseByConsumer(resource1));
   Mock::VerifyAndClearExpectations(&scheduler_);
 
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame1);
   renderer_->FinishDrawingFrame(&frame1);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
@@ -1498,14 +1517,14 @@
 
   // Use the same buffer twice.
   renderer_->set_expect_overlays(true);
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame1);
   renderer_->FinishDrawingFrame(&frame1);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
   SwapBuffers();
   Mock::VerifyAndClearExpectations(&scheduler_);
 
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame1);
   renderer_->FinishDrawingFrame(&frame1);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
@@ -1540,6 +1559,7 @@
   DirectRenderer::DrawingFrame frame1;
   frame1.render_passes_in_draw_order = &pass_list;
   frame1.overlay_list.resize(2);
+  frame1.overlay_list.front().use_output_surface_for_resource = true;
   OverlayCandidate& overlay1 = frame1.overlay_list.back();
   overlay1.resource_id = resource1;
   overlay1.plane_z_order = 1;
@@ -1547,6 +1567,7 @@
   DirectRenderer::DrawingFrame frame2;
   frame2.render_passes_in_draw_order = &pass_list;
   frame2.overlay_list.resize(2);
+  frame2.overlay_list.front().use_output_surface_for_resource = true;
   OverlayCandidate& overlay2 = frame2.overlay_list.back();
   overlay2.resource_id = resource2;
   overlay2.plane_z_order = 1;
@@ -1554,11 +1575,12 @@
   DirectRenderer::DrawingFrame frame3;
   frame3.render_passes_in_draw_order = &pass_list;
   frame3.overlay_list.resize(2);
+  frame3.overlay_list.front().use_output_surface_for_resource = true;
   OverlayCandidate& overlay3 = frame3.overlay_list.back();
   overlay3.resource_id = resource3;
   overlay3.plane_z_order = 1;
 
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame1);
   renderer_->FinishDrawingFrame(&frame1);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
@@ -1566,7 +1588,7 @@
   SwapBuffers();
   Mock::VerifyAndClearExpectations(&scheduler_);
 
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame2);
   renderer_->FinishDrawingFrame(&frame2);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
@@ -1576,7 +1598,7 @@
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource2));
   Mock::VerifyAndClearExpectations(&scheduler_);
 
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame3);
   renderer_->FinishDrawingFrame(&frame3);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
@@ -1606,14 +1628,14 @@
 
   // Use the same buffer twice.
   renderer_->set_expect_overlays(true);
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame1);
   renderer_->FinishDrawingFrame(&frame1);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
   SwapBuffers();
   Mock::VerifyAndClearExpectations(&scheduler_);
 
-  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(1);
+  EXPECT_CALL(scheduler_, Schedule(_, _, _, _, _)).Times(2);
   renderer_->BeginDrawingFrame(&frame1);
   renderer_->FinishDrawingFrame(&frame1);
   EXPECT_TRUE(resource_provider_->InUseByConsumer(resource1));
diff --git a/chrome/VERSION b/chrome/VERSION
index 2849d91..79035af 100644
--- a/chrome/VERSION
+++ b/chrome/VERSION
@@ -1,4 +1,4 @@
-MAJOR=47
+MAJOR=48
 MINOR=0
-BUILD=2526
+BUILD=2527
 PATCH=0
diff --git a/chrome/android/java/res/drawable-v21/text_cursor_lowend.xml b/chrome/android/java/res/drawable-v21/text_cursor_lowend.xml
new file mode 100644
index 0000000..757379f
--- /dev/null
+++ b/chrome/android/java/res/drawable-v21/text_cursor_lowend.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+     Copyright 2015 The Chromium Authors. All rights reserved.
+     Use of this source code is governed by a BSD-style license that can be
+     found in the LICENSE file.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android" >
+    <size android:width="2dp" />
+    <solid android:color="?android:attr/colorControlActivated" />
+</shape>
\ No newline at end of file
diff --git a/chrome/android/java/res/values-v21/styles.xml b/chrome/android/java/res/values-v21/styles.xml
index b2aae9a..fd41a09 100644
--- a/chrome/android/java/res/values-v21/styles.xml
+++ b/chrome/android/java/res/values-v21/styles.xml
@@ -91,5 +91,9 @@
         <item name="android:listPopupWindowStyle">@style/ListPopupWindow.LowEnd</item>
         <item name="android:spinnerStyle">@style/Spinner.LowEnd</item>
         <item name="android:autoCompleteTextViewStyle">@style/AutoCompleteTextView.LowEnd</item>
+
+        <!-- Without HW acceleration the default text cursor looks weird (top
+             half is way brighter than the bottom), so we use our own. -->
+        <item name="android:textCursorDrawable">@drawable/text_cursor_lowend</item>
     </style>
 </resources>
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
index 91956e10..a2bd6d5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeActivity.java
@@ -88,6 +88,7 @@
 import org.chromium.chrome.browser.infobar.InfoBarContainer;
 import org.chromium.chrome.browser.init.AsyncInitializationActivity;
 import org.chromium.chrome.browser.metrics.LaunchMetrics;
+import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.metrics.UmaSessionStats;
 import org.chromium.chrome.browser.net.spdyproxy.DataReductionProxySettings;
 import org.chromium.chrome.browser.nfc.BeamController;
@@ -1405,6 +1406,7 @@
             currentTab.loadUrl(
                     new LoadUrlParams(UrlConstants.HISTORY_URL, PageTransition.AUTO_TOPLEVEL));
             RecordUserAction.record("MobileMenuHistory");
+            StartupMetrics.getInstance().recordOpenedHistory();
         } else if (id == R.id.share_menu_id || id == R.id.direct_share_menu_id) {
             onShareMenuItemSelected(currentTab, getWindowAndroid(),
                     id == R.id.direct_share_menu_id, getCurrentTabModel().isIncognito());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
index 70be34d..b8d40d8 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeTabbedActivity.java
@@ -56,6 +56,7 @@
 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor;
 import org.chromium.chrome.browser.firstrun.FirstRunStatus;
 import org.chromium.chrome.browser.metrics.LaunchMetrics;
+import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.metrics.UmaUtils;
 import org.chromium.chrome.browser.ntp.NativePageAssassin;
 import org.chromium.chrome.browser.omaha.OmahaClient;
@@ -297,6 +298,7 @@
     public void onResumeWithNative() {
         super.onResumeWithNative();
         CookiesFetcher.restoreCookies(this);
+        StartupMetrics.getInstance().recordHistogram(false);
     }
 
     @Override
@@ -315,6 +317,13 @@
         } catch (IllegalArgumentException e) {
             // This may happen when onStop get called very early in UI test.
         }
+        StartupMetrics.getInstance().recordHistogram(true);
+    }
+
+    @Override
+    public void onStart() {
+        super.onStart();
+        StartupMetrics.getInstance().updateIntent(getIntent());
     }
 
     @Override
@@ -922,6 +931,7 @@
                 getCompositorViewHolder().hideKeyboard(new Runnable() {
                     @Override
                     public void run() {
+                        StartupMetrics.getInstance().recordOpenedBookmarks();
                         if (!EnhancedBookmarkUtils.showEnhancedBookmarkIfEnabled(
                                 ChromeTabbedActivity.this)) {
                             currentTab.loadUrl(new LoadUrlParams(
@@ -1265,6 +1275,7 @@
         if (mFindToolbarManager != null) mFindToolbarManager.hideToolbar();
         if (getAssistStatusHandler() != null) getAssistStatusHandler().updateAssistState();
         ApiCompatibilityUtils.setStatusBarColor(getWindow(), Color.BLACK);
+        StartupMetrics.getInstance().recordOpenedTabSwitcher();
     }
 
     @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
index a92b482..4338bdd 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/IntentHandler.java
@@ -107,7 +107,7 @@
     /**
      * The scheme for referrer coming from an application.
      */
-    private static final String ANDROID_APP_REFERRER_SCHEME = "android-app://";
+    public static final String ANDROID_APP_REFERRER_SCHEME = "android-app://";
 
     /**
      * A referrer id used for Chrome to Chrome referrer passing.
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java b/chrome/android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java
index ffbb7fa..f40736a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/childaccounts/ChildAccountService.java
@@ -5,18 +5,12 @@
 package org.chromium.chrome.browser.childaccounts;
 
 import android.accounts.Account;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
-import android.accounts.AuthenticatorException;
-import android.accounts.OperationCanceledException;
 import android.content.Context;
 
-import org.chromium.base.Log;
 import org.chromium.base.ThreadUtils;
+import org.chromium.sync.signin.AccountManagerDelegate.Callback;
 import org.chromium.sync.signin.AccountManagerHelper;
 
-import java.io.IOException;
-
 /**
  * This class serves as a simple interface for querying the child account information.
  * It has two methods namely, checkHasChildAccount(...) which is asynchronous and queries the
@@ -29,55 +23,30 @@
  * side and also takes responsibility for monitoring changes and taking a suitable action.
  */
 public class ChildAccountService {
-    private static final String TAG = "ChildAccountService";
-
     private ChildAccountService() {
         // Only for static usage.
     }
 
     /**
-     * A callback to return the result of {@link #checkHasChildAccount}.
-     */
-    public static interface HasChildAccountCallback {
-
-        /**
-         * @param hasChildAccount Whether there is exactly one child account on the device.
-         */
-        public void onChildAccountChecked(boolean hasChildAccount);
-
-    }
-
-    /**
      * Checks for the presence of child accounts on the device.
      *
      * @param callback A callback which will be called with the result.
      */
-    public static void checkHasChildAccount(
-            Context context, final HasChildAccountCallback callback) {
+    public static void checkHasChildAccount(Context context, final Callback<Boolean> callback) {
         ThreadUtils.assertOnUiThread();
         if (!nativeIsChildAccountDetectionEnabled()) {
-            callback.onChildAccountChecked(false);
+            callback.gotResult(false);
             return;
         }
-        AccountManagerHelper helper = AccountManagerHelper.get(context);
-        Account[] accounts = helper.getGoogleAccounts();
-        if (accounts.length != 1) {
-            callback.onChildAccountChecked(false);
-            return;
-        }
-        helper.checkChildAccount(accounts[0], new AccountManagerCallback<Boolean>() {
+        final AccountManagerHelper helper = AccountManagerHelper.get(context);
+        helper.getGoogleAccounts(new Callback<Account[]>() {
             @Override
-            public void run(AccountManagerFuture<Boolean> future) {
-                assert future.isDone();
-                boolean hasFeatures = false;
-                try {
-                    hasFeatures = future.getResult();
-                } catch (AuthenticatorException | IOException e) {
-                    Log.e(TAG, "Error while checking features: ", e);
-                } catch (OperationCanceledException e) {
-                    Log.e(TAG, "Checking features was cancelled. This should not happen.");
+            public void gotResult(Account[] accounts) {
+                if (accounts.length != 1) {
+                    callback.gotResult(false);
+                } else {
+                    helper.checkChildAccount(accounts[0], callback);
                 }
-                callback.onChildAccountChecked(hasFeatures);
             }
         });
     }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java
index e9cef746..5cb32a2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/document/ChromeLauncherActivity.java
@@ -43,6 +43,7 @@
 import org.chromium.chrome.browser.firstrun.FirstRunFlowSequencer;
 import org.chromium.chrome.browser.metrics.LaunchHistogram;
 import org.chromium.chrome.browser.metrics.LaunchMetrics;
+import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.multiwindow.MultiWindowUtils;
 import org.chromium.chrome.browser.notifications.NotificationUIManager;
 import org.chromium.chrome.browser.partnercustomizations.HomepageManager;
@@ -306,6 +307,7 @@
         }
 
         maybePrefetchDnsInBackground();
+        StartupMetrics.getInstance().updateIntent(getIntent());
 
         boolean hasUserGesture =
                 IntentWithGesturesHandler.getInstance().getUserGestureAndClear(getIntent());
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
index a9f69c35..01e9a69d 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/document/DocumentActivity.java
@@ -34,6 +34,7 @@
 import org.chromium.chrome.browser.enhancedbookmarks.EnhancedBookmarkUtils;
 import org.chromium.chrome.browser.firstrun.FirstRunSignInProcessor;
 import org.chromium.chrome.browser.firstrun.FirstRunStatus;
+import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.metrics.UmaUtils;
 import org.chromium.chrome.browser.ntp.NewTabPage;
 import org.chromium.chrome.browser.preferences.ChromePreferenceManager;
@@ -319,6 +320,12 @@
         ChromeLauncherActivity.sendExceptionCount();
     }
 
+    @Override
+    public void onStopWithNative() {
+        super.onStopWithNative();
+        StartupMetrics.getInstance().recordHistogram(true);
+    }
+
     private void handleDocumentUma() {
         if (mRecordedStartupUma) {
             DocumentUma.recordStartedBy(
@@ -372,6 +379,7 @@
             }
             mDocumentTab.show(TabSelectionType.FROM_USER);
         }
+        StartupMetrics.getInstance().recordHistogram(false);
     }
 
     @Override
@@ -704,6 +712,7 @@
                 }
             }, MENU_EXIT_ANIMATION_WAIT_MS);
         } else if (id == R.id.all_bookmarks_menu_id) {
+            StartupMetrics.getInstance().recordOpenedBookmarks();
             if (!EnhancedBookmarkUtils.showEnhancedBookmarkIfEnabled(this)) {
                 NewTabPage.launchBookmarksDialog(this, mDocumentTab, getTabModelSelector());
             }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java
index df9cf2d..be0ab7c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/dom_distiller/ReaderModeManager.java
@@ -261,6 +261,14 @@
             }
 
             @Override
+            public void didFailLoad(boolean isProvisionalLoad, boolean isMainFrame, int errorCode,
+                        String description, String failingUrl, boolean wasIgnoredByHandler) {
+                if (!isMainFrame) return;
+                if (DomDistillerUrlUtils.isDistilledPage(mTab.getUrl())) return;
+                updateStatusBasedOnReaderModeCriteria(true);
+            }
+
+            @Override
             public void didStartProvisionalLoadForFrame(long frameId, long parentFrameId,
                     boolean isMainFrame, String validatedUrl, boolean isErrorPage,
                     boolean isIframeSrcdoc) {
@@ -273,13 +281,6 @@
             }
 
             @Override
-            public void documentLoadedInFrame(long frameId, boolean isMainFrame) {
-                if (!isMainFrame) return;
-                if (DomDistillerUrlUtils.isDistilledPage(mTab.getUrl())) return;
-                updateStatusBasedOnReaderModeCriteria(false);
-            }
-
-            @Override
             public void didNavigateMainFrame(String url, String baseUrl,
                     boolean isNavigationToDifferentPage, boolean isNavigationInPage,
                     int statusCode) {
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
index 52e05fa6..8c3a49e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/ChromeDownloadDelegate.java
@@ -5,16 +5,21 @@
 package org.chromium.chrome.browser.download;
 
 import android.Manifest.permission;
+import android.app.Activity;
 import android.content.Context;
+import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.AsyncTask;
 import android.os.Environment;
+import android.support.v7.app.AlertDialog;
 import android.text.TextUtils;
 import android.util.Pair;
+import android.view.View;
 import android.webkit.MimeTypeMap;
 import android.webkit.URLUtil;
+import android.widget.TextView;
 
 import org.chromium.base.Log;
 import org.chromium.base.ThreadUtils;
@@ -27,6 +32,7 @@
 import org.chromium.chrome.browser.tab.Tab;
 import org.chromium.chrome.browser.tabmodel.TabModelSelector;
 import org.chromium.content.browser.ContentViewDownloadDelegate;
+import org.chromium.content.browser.DownloadController;
 import org.chromium.content.browser.DownloadInfo;
 import org.chromium.content_public.browser.WebContents;
 import org.chromium.ui.base.WindowAndroid;
@@ -312,6 +318,54 @@
         confirmDangerousDownload(downloadInfo);
     }
 
+    @Override
+    public void requestFileAccess(final long callbackId) {
+        final String storagePermission = android.Manifest.permission.WRITE_EXTERNAL_STORAGE;
+        final Activity activity = mTab.getWindowAndroid().getActivity().get();
+
+        if (activity == null) {
+            DownloadController.getInstance().onRequestFileAccessResult(callbackId, false);
+        } else if (mTab.getWindowAndroid().canRequestPermission(storagePermission)) {
+            View view = activity.getLayoutInflater().inflate(
+                    R.layout.update_permissions_dialog, null);
+            TextView dialogText = (TextView) view.findViewById(R.id.text);
+            dialogText.setText(R.string.missing_storage_permission_download_education_text);
+
+            final PermissionCallback permissionCallback = new PermissionCallback() {
+                @Override
+                public void onRequestPermissionsResult(String[] permissions, int[] grantResults) {
+                    DownloadController.getInstance().onRequestFileAccessResult(
+                            callbackId, grantResults[0] == PackageManager.PERMISSION_GRANTED);
+                }
+            };
+
+            AlertDialog.Builder builder =
+                    new AlertDialog.Builder(activity, R.style.AlertDialogTheme)
+                    .setView(view)
+                    .setPositiveButton(R.string.infobar_update_permissions_button_text,
+                            new DialogInterface.OnClickListener() {
+                                @Override
+                                public void onClick(DialogInterface dialog, int id) {
+                                    mTab.getWindowAndroid().requestPermissions(
+                                            new String[] {storagePermission}, permissionCallback);
+                                }
+                            })
+                     .setOnCancelListener(new DialogInterface.OnCancelListener() {
+                             @Override
+                             public void onCancel(DialogInterface dialog) {
+                                 DownloadController.getInstance().onRequestFileAccessResult(
+                                         callbackId, false);
+                             }
+                     });
+            builder.create().show();
+        } else if (!mTab.getWindowAndroid().isPermissionRevokedByPolicy(storagePermission)) {
+            nativeLaunchPermissionUpdateInfoBar(mTab, storagePermission, callbackId);
+        } else {
+            // TODO(tedchoc): Show toast.
+            DownloadController.getInstance().onRequestFileAccessResult(callbackId, false);
+        }
+    }
+
     /**
      * Return a pair of directory name and its full path. Note that we create the directory if
      * it does not already exist.
@@ -592,4 +646,6 @@
     private static native void nativeLaunchDownloadOverwriteInfoBar(ChromeDownloadDelegate delegate,
             Tab tab, DownloadInfo downloadInfo, String fileName, String dirName,
             String dirFullPath);
+    private static native void nativeLaunchPermissionUpdateInfoBar(
+            Tab tab, String permission, long callbackId);
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
index 6158937..56eb1b9 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
@@ -26,6 +26,7 @@
 import org.chromium.base.VisibleForTesting;
 import org.chromium.base.annotations.SuppressFBWarnings;
 import org.chromium.chrome.R;
+import org.chromium.chrome.browser.IntentHandler;
 import org.chromium.chrome.browser.externalnav.ExternalNavigationDelegateImpl;
 import org.chromium.content.browser.DownloadController;
 import org.chromium.content.browser.DownloadInfo;
@@ -894,6 +895,10 @@
         launchIntent.setDataAndType(uri, manager.getMimeTypeForDownloadedFile(downloadId));
         launchIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                 | Intent.FLAG_GRANT_READ_URI_PERMISSION);
+        Uri referrer = new Uri.Builder().scheme(
+                IntentHandler.ANDROID_APP_REFERRER_SCHEME).authority(
+                        context.getPackageName()).build();
+        launchIntent.putExtra(Intent.EXTRA_REFERRER, referrer);
         return launchIntent;
     }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfoBarDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfoBarDelegate.java
index 2dc7f58..b8c55c3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfoBarDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/infobar/PermissionUpdateInfoBarDelegate.java
@@ -13,14 +13,10 @@
 import org.chromium.base.ApplicationStatus;
 import org.chromium.base.ApplicationStatus.ActivityStateListener;
 import org.chromium.base.annotations.CalledByNative;
-import org.chromium.chrome.browser.preferences.PrefServiceBridge;
 import org.chromium.content.browser.ContentViewCore;
 import org.chromium.content_public.browser.WebContents;
 import org.chromium.ui.base.WindowAndroid;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * Handles requesting the android runtime permissions for the permission update infobar.
  */
@@ -33,21 +29,14 @@
 
     @CalledByNative
     private static PermissionUpdateInfoBarDelegate create(
-            long nativePtr, WebContents webContents, int[] contentSettings) {
-        return new PermissionUpdateInfoBarDelegate(nativePtr, webContents, contentSettings);
+            long nativePtr, WebContents webContents, String[] permissions) {
+        return new PermissionUpdateInfoBarDelegate(nativePtr, webContents, permissions);
     }
 
     private PermissionUpdateInfoBarDelegate(
-            long nativePtr, WebContents webContents, int[] contentSettings) {
+            long nativePtr, WebContents webContents, String[] permissions) {
         mNativePtr = nativePtr;
-
-        List<String> permissions = new ArrayList<String>();
-        for (int i = 0; i < contentSettings.length; i++) {
-            String androidPermission =
-                    PrefServiceBridge.getAndroidPermissionForContentSetting(contentSettings[i]);
-            if (androidPermission != null) permissions.add(androidPermission);
-        }
-        mAndroidPermisisons = permissions.toArray(new String[permissions.size()]);
+        mAndroidPermisisons = permissions;
         mWindowAndroid = ContentViewCore.fromWebContents(webContents).getWindowAndroid();
     }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java
index a92395e..9a3636c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/AsyncInitializationActivity.java
@@ -228,6 +228,7 @@
     protected void onNewIntent(Intent intent) {
         if (intent == null) return;
         mNativeInitializationController.onNewIntent(intent);
+        setIntent(intent);
     }
 
     @Override
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
index 8797414..b281916b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/ChromeMediaRouter.java
@@ -7,6 +7,7 @@
 import android.content.Context;
 import android.support.v7.media.MediaRouter;
 
+import org.chromium.base.SysUtils;
 import org.chromium.base.VisibleForTesting;
 import org.chromium.base.annotations.CalledByNative;
 import org.chromium.base.annotations.JNINamespace;
@@ -54,6 +55,9 @@
             return MediaRouter.getInstance(applicationContext);
         } catch (NoSuchMethodError e) {
             return null;
+        } catch (NoClassDefFoundError e) {
+            // TODO(mlamouri): happens with Robolectric.
+            return null;
         }
     }
 
@@ -129,14 +133,19 @@
 
     /**
      * Starts background monitoring for available media sinks compatible with the given
-     * |sourceUrn|
+     * |sourceUrn| if the device is in a state that allows it.
      * @param sourceId a URL to use for filtering of the available media sinks
+     * @return whether the monitoring started (ie. was allowed).
      */
     @CalledByNative
-    public void startObservingMediaSinks(String sourceId) {
+    public boolean startObservingMediaSinks(String sourceId) {
+        if (SysUtils.isLowEndDevice()) return false;
+
         for (MediaRouteProvider provider : mRouteProviders) {
             provider.startObservingMediaSinks(sourceId);
         }
+
+        return true;
     }
 
     /**
@@ -266,4 +275,4 @@
     native void nativeOnMessageSentResult(
             long nativeMediaRouterAndroid, boolean success, int callbackId);
     native void nativeOnMessage(long nativeMediaRouterAndroid, String mediaRouteId, String message);
-}
\ No newline at end of file
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProvider.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProvider.java
index e87a009..ca6f61c3 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProvider.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/CastMediaRouteProvider.java
@@ -5,7 +5,10 @@
 package org.chromium.chrome.browser.media.router.cast;
 
 import android.content.Context;
+import android.os.Handler;
+import android.support.v7.media.MediaRouteSelector;
 import android.support.v7.media.MediaRouter;
+import android.support.v7.media.MediaRouter.RouteInfo;
 
 import org.chromium.chrome.browser.media.router.ChromeMediaRouter;
 import org.chromium.chrome.browser.media.router.DiscoveryDelegate;
@@ -14,6 +17,8 @@
 import org.chromium.chrome.browser.media.router.RouteController;
 import org.chromium.chrome.browser.media.router.RouteDelegate;
 
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -25,6 +30,7 @@
  */
 public class CastMediaRouteProvider
         implements MediaRouteProvider, DiscoveryDelegate, RouteDelegate {
+
     private final Context mApplicationContext;
     private final MediaRouter mAndroidMediaRouter;
     private final MediaRouteManager mManager;
@@ -35,10 +41,33 @@
     private final Map<String, String> mClientIdsToRouteIds = new HashMap<String, String>();
 
     private CreateRouteRequest mPendingCreateRouteRequest;
+    private Handler mHandler = new Handler();
+
+    private static class OnSinksReceivedRunnable implements Runnable {
+
+        private final WeakReference<MediaRouteManager> mRouteManager;
+        private final MediaRouteProvider mRouteProvider;
+        private final String mSourceId;
+        private final List<MediaSink> mSinks;
+
+        OnSinksReceivedRunnable(MediaRouteManager manager, MediaRouteProvider routeProvider,
+                String sourceId, List<MediaSink> sinks) {
+            mRouteManager = new WeakReference<MediaRouteManager>(manager);
+            mRouteProvider = routeProvider;
+            mSourceId = sourceId;
+            mSinks = sinks;
+        }
+
+        @Override
+        public void run() {
+            MediaRouteManager manager = mRouteManager.get();
+            if (manager != null) manager.onSinksReceived(mSourceId, mRouteProvider, mSinks);
+        }
+    };
 
     @Override
     public void onSinksReceived(String sourceId, List<MediaSink> sinks) {
-        mManager.onSinksReceived(sourceId, this, sinks);
+        mHandler.post(new OnSinksReceivedRunnable(mManager, this, sourceId, sinks));
     }
 
     @Override
@@ -108,9 +137,17 @@
             return;
         }
 
-        callback = new DiscoveryCallback(sourceId, this);
+        MediaRouteSelector routeSelector = source.buildRouteSelector();
+        List<MediaSink> knownSinks = new ArrayList<MediaSink>();
+        for (RouteInfo route : mAndroidMediaRouter.getRoutes()) {
+            if (route.matchesSelector(routeSelector)) {
+                knownSinks.add(MediaSink.fromRoute(route));
+            }
+        }
+
+        callback = new DiscoveryCallback(sourceId, knownSinks, this);
         mAndroidMediaRouter.addCallback(
-                source.buildRouteSelector(),
+                routeSelector,
                 callback,
                 MediaRouter.CALLBACK_FLAG_REQUEST_DISCOVERY);
         mDiscoveryCallbacks.put(applicationId, callback);
@@ -192,5 +229,4 @@
         mAndroidMediaRouter = androidMediaRouter;
         mManager = manager;
     }
-
 }
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/DiscoveryCallback.java b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/DiscoveryCallback.java
index 887a8bd..42c26f7 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/DiscoveryCallback.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/router/cast/DiscoveryCallback.java
@@ -24,10 +24,14 @@
     private Set<String> mSourceUrns = new HashSet<String>();
     private List<MediaSink> mSinks = new ArrayList<MediaSink>();
 
-    public DiscoveryCallback(String sourceUrn, DiscoveryDelegate delegate) {
+    public DiscoveryCallback(String sourceUrn, List<MediaSink> knownSinks,
+            DiscoveryDelegate delegate) {
         assert delegate != null;
         assert sourceUrn != null && !sourceUrn.isEmpty();
+
+        mSinks.addAll(knownSinks);
         mDiscoveryDelegate = delegate;
+
         addSourceUrn(sourceUrn);
     }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/metrics/StartupMetrics.java b/chrome/android/java/src/org/chromium/chrome/browser/metrics/StartupMetrics.java
new file mode 100644
index 0000000..23ea0eaa
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/metrics/StartupMetrics.java
@@ -0,0 +1,123 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.metrics;
+
+import android.content.Intent;
+import android.os.Handler;
+
+import org.chromium.base.metrics.RecordHistogram;
+
+/**
+ * Keeps track of actions taken on startup.
+ */
+public class StartupMetrics {
+    // Actions we keep track of. Do not change indices, add new actions at the end only
+    // and update MAX_INDEX.
+    private static final int NO_ACTIVITY = 0;
+    private static final int OPENED_NTP = 1;
+    private static final int FOCUSED_OMNIBOX = 2;
+    private static final int OPENED_BOOKMARKS = 3;
+    private static final int OPENED_RECENTS = 4;
+    private static final int OPENED_HISTORY = 5;
+    private static final int OPENED_TAB_SWITCHER = 6;
+    private static final int MAX_INDEX = 7;
+
+    // Keeps track of the actions invoked in the first RECORDING_THRESHOLD_NS.
+    private int mFirstActionTaken = NO_ACTIVITY;
+
+    private boolean mIsMainIntent;
+    private long mSessionStartTimestamp;
+    private Handler mHandler;
+    private boolean mRecordedHistogram;
+
+    private static StartupMetrics sInstance;
+
+    // Record only the first 10s.
+    private static final long RECORDING_THRESHOLD_NS = 10000000000L;
+
+    public static StartupMetrics getInstance() {
+        if (sInstance == null) {
+            sInstance = new StartupMetrics();
+        }
+        return sInstance;
+    }
+
+    // Singleton
+    private StartupMetrics() {
+        mSessionStartTimestamp = System.nanoTime();
+        mHandler = new Handler();
+    }
+
+    /**
+     * Starts collecting metrics for the latest intent sent to DocumentActivity or
+     * ChromeTabbedActivity. This happens on every intent coming from launcher/external app
+     * for DocumentActivity and every time we get onStart() in ChromeTabbedActivity mode.
+     */
+    public void updateIntent(Intent intent) {
+        mIsMainIntent = intent != null && Intent.ACTION_MAIN.equals(intent.getAction());
+        mFirstActionTaken = NO_ACTIVITY;
+        mSessionStartTimestamp = System.nanoTime();
+        mRecordedHistogram = false;
+    }
+
+    private boolean isShortlyAfterChromeStarted() {
+        return (System.nanoTime() - mSessionStartTimestamp) <= RECORDING_THRESHOLD_NS;
+    }
+
+    private void setFirstAction(int type) {
+        if (!isShortlyAfterChromeStarted() || mFirstActionTaken != NO_ACTIVITY) return;
+        mFirstActionTaken = type;
+    }
+
+    /** Records that the new tab page has been opened. */
+    public void recordOpenedNTP() {
+        setFirstAction(OPENED_NTP);
+    }
+
+    /** Records that the omnibox has been focused. */
+    public void recordFocusedOmnibox() {
+        setFirstAction(FOCUSED_OMNIBOX);
+    }
+
+    /** Records that the bookmarks page has been opened. */
+    public void recordOpenedBookmarks() {
+        setFirstAction(OPENED_BOOKMARKS);
+    }
+
+    /** Records that the recents page has been opened. */
+    public void recordOpenedRecents() {
+        setFirstAction(OPENED_RECENTS);
+    }
+
+    /** Records that the history page has been opened. */
+    public void recordOpenedHistory() {
+        setFirstAction(OPENED_HISTORY);
+    }
+
+    /** Records that the tab switcher has been accessed. */
+    public void recordOpenedTabSwitcher() {
+        setFirstAction(OPENED_TAB_SWITCHER);
+    }
+
+    /** Records the startup data in a histogram. Should only be called after native is loaded. */
+    public void recordHistogram(boolean onStop) {
+        if (mRecordedHistogram) return;
+        if (!isShortlyAfterChromeStarted() || mFirstActionTaken != NO_ACTIVITY || onStop) {
+            String histogramName = mIsMainIntent ? "MobileStartup.MainIntentAction" :
+                    "MobileStartup.NonMainIntentAction";
+            RecordHistogram.recordEnumeratedHistogram(histogramName, mFirstActionTaken, MAX_INDEX);
+            mRecordedHistogram = true;
+        } else {
+            // Call back later to record the histogram after 10s have elapsed.
+            mHandler.postDelayed(new Runnable() {
+                @Override
+                public void run() {
+                    recordHistogram(false);
+                }
+            } , (RECORDING_THRESHOLD_NS - (System.nanoTime() - mSessionStartTimestamp)) / 1000000);
+        }
+    }
+
+}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
index 141a894..88b3656 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/NewTabPage.java
@@ -34,6 +34,7 @@
 import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback;
 import org.chromium.chrome.browser.favicon.LargeIconBridge;
 import org.chromium.chrome.browser.favicon.LargeIconBridge.LargeIconCallback;
+import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.ntp.BookmarksPage.BookmarkSelectedListener;
 import org.chromium.chrome.browser.ntp.LogoBridge.Logo;
 import org.chromium.chrome.browser.ntp.LogoBridge.LogoObserver;
@@ -397,6 +398,7 @@
             RecordHistogram.recordTimesHistogram(
                     "Tab.NewTabOnload", loadTimeMs, TimeUnit.MILLISECONDS);
             mIsLoaded = true;
+            StartupMetrics.getInstance().recordOpenedNTP();
 
             if (mIsDestroyed) return;
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java
index f679a0b5..a1dfe016 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsManager.java
@@ -14,6 +14,7 @@
 import org.chromium.chrome.browser.favicon.FaviconHelper.FaviconImageCallback;
 import org.chromium.chrome.browser.firstrun.ProfileDataCache;
 import org.chromium.chrome.browser.invalidation.InvalidationController;
+import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSession;
 import org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSessionCallback;
 import org.chromium.chrome.browser.ntp.ForeignSessionHelper.ForeignSessionTab;
@@ -229,6 +230,7 @@
      */
     public void openHistoryPage() {
         mTab.loadUrl(new LoadUrlParams(UrlConstants.HISTORY_URL));
+        StartupMetrics.getInstance().recordOpenedHistory();
     }
 
     /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsPage.java b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsPage.java
index c5ea8122..e0df36aa 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsPage.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ntp/RecentTabsPage.java
@@ -22,6 +22,7 @@
 import org.chromium.chrome.browser.NativePage;
 import org.chromium.chrome.browser.UrlConstants;
 import org.chromium.chrome.browser.compositor.layouts.content.InvalidationAwareThumbnailProvider;
+import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.util.ViewUtils;
 
 import java.util.concurrent.TimeUnit;
@@ -118,6 +119,7 @@
         mInForeground = inForeground;
         if (mInForeground) {
             mForegroundTimeMs = SystemClock.elapsedRealtime();
+            StartupMetrics.getInstance().recordOpenedRecents();
         } else {
             RecordHistogram.recordLongTimesHistogram("NewTabPage.RecentTabsPage.TimeVisibleAndroid",
                     SystemClock.elapsedRealtime() - mForegroundTimeMs, TimeUnit.MILLISECONDS);
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
index 73b3a5e..6bc1e22 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/omnibox/UrlBar.java
@@ -35,6 +35,7 @@
 import org.chromium.base.VisibleForTesting;
 import org.chromium.chrome.R;
 import org.chromium.chrome.browser.UrlUtilities;
+import org.chromium.chrome.browser.metrics.StartupMetrics;
 import org.chromium.chrome.browser.omnibox.LocationBarLayout.OmniboxLivenessListener;
 import org.chromium.chrome.browser.tab.ChromeTab;
 import org.chromium.chrome.browser.widget.VerticallyFixedEditText;
@@ -360,6 +361,8 @@
             mFirstFocusTimeMs = SystemClock.elapsedRealtime();
             if (mOmniboxLivenessListener != null) mOmniboxLivenessListener.onOmniboxFocused();
         }
+
+        if (focused) StartupMetrics.getInstance().recordFocusedOmnibox();
     }
 
     /**
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/precache/FailureReason.java b/chrome/android/java/src/org/chromium/chrome/browser/precache/FailureReason.java
index 1ce2f2ca..df2ee85 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/precache/FailureReason.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/precache/FailureReason.java
@@ -26,8 +26,7 @@
     /** DeviceState#isWifiAvailable() returns false. */
     NO_WIFI(5),
 
-    /** DeviceState#isInteractive() returns true. */
-    SCREEN_ON(6),
+    // Deprecated: SCREEN_ON(6).
 
     /** PrecacheServiceLauncher#timeSinceLastPrecacheMs() is too recent. */
     NOT_ENOUGH_TIME_SINCE_LAST_PRECACHE(7),
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java b/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java
index b1cc381..e245d85 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheService.java
@@ -63,9 +63,8 @@
     private final BroadcastReceiver mDeviceStateReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            if (sIsPrecaching && (mDeviceState.isInteractive(context)
-                    || !mDeviceState.isPowerConnected(context)
-                    || !mDeviceState.isWifiAvailable(context))) {
+            if (sIsPrecaching && (!mDeviceState.isPowerConnected(context)
+                                         || !mDeviceState.isWifiAvailable(context))) {
                 cancelPrecaching();
             }
         }
@@ -195,7 +194,6 @@
         IntentFilter filter = new IntentFilter();
         filter.addAction(Intent.ACTION_POWER_DISCONNECTED);
         filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
-        filter.addAction(Intent.ACTION_SCREEN_ON);
         registerReceiver(mDeviceStateReceiver, filter);
     }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java b/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java
index e698dcd..5895d0c 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncher.java
@@ -146,7 +146,6 @@
         reasons.addAll(mPrecacheLauncher.failureReasons());
         if (!mDeviceState.isPowerConnected(context)) reasons.add(FailureReason.NO_POWER);
         if (!mDeviceState.isWifiAvailable(context)) reasons.add(FailureReason.NO_WIFI);
-        if (mDeviceState.isInteractive(context)) reasons.add(FailureReason.SCREEN_ON);
         if (timeSinceLastPrecacheMs(context) < WAIT_UNTIL_NEXT_PRECACHE_MS) {
             reasons.add(FailureReason.NOT_ENOUGH_TIME_SINCE_LAST_PRECACHE);
         }
@@ -183,50 +182,38 @@
     public void onReceive(Context context, Intent intent) {
         resetLastPrecacheMsIfDeviceRebooted(context);
 
+        // TODO(twifkak): Make these triggering conditions (power, screen, wifi, time) controllable
+        // via variation parameters. Also change the cancel conditions in PrecacheService.
         boolean isPowerConnected = mDeviceState.isPowerConnected(context);
         boolean isWifiAvailable = mDeviceState.isWifiAvailable(context);
-        boolean isInteractive = mDeviceState.isInteractive(context);
-        boolean areConditionsGoodForPrecaching =
-                isPowerConnected && isWifiAvailable && !isInteractive;
+        boolean areConditionsGoodForPrecaching = isPowerConnected && isWifiAvailable;
         boolean hasEnoughTimePassedSinceLastPrecache =
                 timeSinceLastPrecacheMs(context) >= WAIT_UNTIL_NEXT_PRECACHE_MS;
 
-
         // Do nothing if precaching is disabled.
         if (!isPrecachingEnabled(context.getApplicationContext())) {
             recordFailureReasons(context);
             return;
         }
 
-        // Only start precaching when an alarm action is received. This is to prevent situations
-        // such as power being connected, precaching starting, then precaching being immediately
-        // canceled because the screen turns on in response to power being connected.
-        if (ACTION_ALARM.equals(intent.getAction())
-                && areConditionsGoodForPrecaching
-                && hasEnoughTimePassedSinceLastPrecache) {
-            recordFailureReasons(context); // Record success.
-            acquireWakeLockAndStartService(context);
-        } else {
-            if (isPowerConnected && isWifiAvailable) {
+        if (areConditionsGoodForPrecaching) {
+            if (hasEnoughTimePassedSinceLastPrecache) {
+                recordFailureReasons(context); // Record success.
+                acquireWakeLockAndStartService(context);
+            } else {
+                // If we're just waiting for for enough time to pass after Wi-Fi or power has been
+                // connected, then set an alarm for the next time to check the device state.
                 // Don't call record failure reasons when setting an alarm to retry. These cases are
                 // uninteresting.
-
-                // If we're just waiting for non-interactivity (e.g., the screen to be off), or for
-                // enough time to pass after Wi-Fi or power has been connected, then set an alarm
-                // for the next time to check the device state. We can't receive SCREEN_ON/OFF
-                // intents as is done for detecting changes in power and connectivity, because
-                // SCREEN_ON/OFF intents are only delivered to BroadcastReceivers that are
-                // registered dynamically in code, but the PrecacheServiceLauncher is registered in
-                // the Android manifest.
                 setAlarm(context,
                         Math.max(INTERACTIVE_STATE_POLLING_PERIOD_MS,
                                 WAIT_UNTIL_NEXT_PRECACHE_MS - timeSinceLastPrecacheMs(context)));
-            } else {
-                recordFailureReasons(context);
-                // If the device doesn't have connected power or doesn't have Wi-Fi, then there's no
-                // point in setting an alarm.
-                cancelAlarm(context);
             }
+        } else {
+            recordFailureReasons(context);
+            // If the device doesn't have connected power or doesn't have Wi-Fi, then there's no
+            // point in setting an alarm.
+            cancelAlarm(context);
         }
     }
 
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/services/AndroidEduAndChildAccountHelper.java b/chrome/android/java/src/org/chromium/chrome/browser/services/AndroidEduAndChildAccountHelper.java
index ef6db47..87b20a0 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/services/AndroidEduAndChildAccountHelper.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/services/AndroidEduAndChildAccountHelper.java
@@ -9,6 +9,7 @@
 import org.chromium.base.Log;
 import org.chromium.chrome.browser.ChromeApplication;
 import org.chromium.chrome.browser.childaccounts.ChildAccountService;
+import org.chromium.sync.signin.AccountManagerDelegate.Callback;
 
 /**
  * A helper for Android EDU and child account checks.
@@ -16,7 +17,7 @@
  * new AndroidEduAndChildAccountHelper() { override onParametersReady() }.start(appContext).
  */
 public abstract class AndroidEduAndChildAccountHelper
-        implements ChildAccountService.HasChildAccountCallback, AndroidEduOwnerCheckCallback {
+        implements Callback<Boolean>, AndroidEduOwnerCheckCallback {
     private Boolean mIsAndroidEduDevice;
     private Boolean mHasChildAccount;
     // Abbreviated to < 20 chars.
@@ -62,9 +63,9 @@
         checkDone();
     }
 
-    // ChildAccountManager.HasChildAccountCallback:
+    // AccountManagerDelegate.Callback<Boolean>:
     @Override
-    public void onChildAccountChecked(boolean hasChildAccount) {
+    public void gotResult(Boolean hasChildAccount) {
         Log.d(TAG, "onChildAccountChecked");
         mHasChildAccount = hasChildAccount;
         checkDone();
diff --git a/chrome/android/java/strings/android_chrome_strings.grd b/chrome/android/java/strings/android_chrome_strings.grd
index d98595db..3ef4a8c2 100644
--- a/chrome/android/java/strings/android_chrome_strings.grd
+++ b/chrome/android/java/strings/android_chrome_strings.grd
@@ -1190,7 +1190,7 @@
         Web View
       </message>
 
-      <!-- Runtime permission infobar strings -->
+      <!-- Runtime permission strings -->
       <message name="IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to the camera capabilities, but Chrome is missing the Android camera permission.">
         Chrome needs camera access to share it with this site.
       </message>
@@ -1203,6 +1203,9 @@
       <message name="IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT" desc="Text shown in an infobar when a website has requested access to the multiple restricted capabilities (e.g. location, camera, microphone), but Chrome is missing the corresponding Android permissions.">
         Chrome needs permissions access to share them with this site.
       </message>
+      <message name="IDS_MISSING_STORAGE_PERMISSION_DOWNLOAD_EDUCATION_TEXT" desc="Text shown educating the user that Chrome is missing the Android storage permission, which is required to download files.">
+        Chrome needs storage access to download files.
+      </message>
 
       <!-- Runtime permission geolocation disclosure strings -->
       <message name="IDS_OMNIBOX_GEOLOCATION_DISCLOSURE" desc="Text shown when a user focuses the Chrome omnibox to inform them that their location will be shared with the search provider to get better local search results.">
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncherTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncherTest.java
index 81f0d28..80d6c46 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncherTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheServiceLauncherTest.java
@@ -115,7 +115,7 @@
         setPrecachingEnabled(false);
         mPrecacheLauncher.setFailureReasons(EnumSet.of(FailureReason.NATIVE_SHOULD_RUN_IS_FALSE));
         mLauncher.setDeviceState(new MockDeviceState(0 /* stickyBatteryStatus */,
-                true /* powerIsConnected */, false /* interactive */, true /* wifiIsAvailable */));
+                true /* powerIsConnected */, true /* wifiIsAvailable */));
         mLauncher.setElapsedRealtime(PrecacheServiceLauncher.WAIT_UNTIL_NEXT_PRECACHE_MS);
 
         mLauncher.onReceive(mContext, new Intent(PrecacheServiceLauncher.ACTION_ALARM));
@@ -130,7 +130,7 @@
     @SmallTest
     @Feature({"Precache"})
     public void testGoodConditions() {
-        mLauncher.setDeviceState(new MockDeviceState(0, true, false, true));
+        mLauncher.setDeviceState(new MockDeviceState(0, true, true));
 
         mLauncher.onReceive(mContext, new Intent(PrecacheServiceLauncher.ACTION_ALARM));
 
@@ -143,7 +143,7 @@
     @SmallTest
     @Feature({"Precache"})
     public void testNotEnoughTimeButGoodConditionsOtherwise() {
-        mLauncher.setDeviceState(new MockDeviceState(0, true, false, true));
+        mLauncher.setDeviceState(new MockDeviceState(0, true, true));
         setLastPrecacheMs(0L);
 
         mLauncher.onReceive(mContext, new Intent(PrecacheServiceLauncher.ACTION_ALARM));
@@ -158,7 +158,7 @@
     @SmallTest
     @Feature({"Precache"})
     public void testEnoughTimeButNoPower() {
-        mLauncher.setDeviceState(new MockDeviceState(0, false, false, true));
+        mLauncher.setDeviceState(new MockDeviceState(0, false, true));
         mLauncher.setElapsedRealtime(PrecacheServiceLauncher.WAIT_UNTIL_NEXT_PRECACHE_MS);
 
         mLauncher.onReceive(mContext, new Intent(PrecacheServiceLauncher.ACTION_ALARM));
@@ -177,7 +177,7 @@
                         FailureReason.SYNC_NOT_INITIALIZED,
                         FailureReason.PRERENDER_PRIVACY_PREFERENCE_NOT_ENABLED,
                         FailureReason.NATIVE_SHOULD_RUN_IS_FALSE));
-        mLauncher.setDeviceState(new MockDeviceState(0, false, true, false));
+        mLauncher.setDeviceState(new MockDeviceState(0, false, false));
         setLastPrecacheMs(0L);
         PrecacheService.setIsPrecaching(true);
 
@@ -193,7 +193,7 @@
     @Feature({"Precache"})
     public void testStateIsResetAfterReboot() {
         // 1. Precache is successfully run at time X.
-        mLauncher.setDeviceState(new MockDeviceState(0, true, false, true));
+        mLauncher.setDeviceState(new MockDeviceState(0, true, true));
         mLauncher.setElapsedRealtime(PrecacheServiceLauncher.WAIT_UNTIL_NEXT_PRECACHE_MS);
         mLauncher.onReceive(mContext, new Intent(PrecacheServiceLauncher.ACTION_ALARM));
 
@@ -204,7 +204,7 @@
         mLauncher.mStartPrecacheCalled = false;
 
         // 2. The device loses power and reboots.
-        mLauncher.setDeviceState(new MockDeviceState(0, false /* power */, false, true));
+        mLauncher.setDeviceState(new MockDeviceState(0, false /* power */, true));
         mLauncher.setElapsedRealtime(0);
 
         // 3. Some intent is triggered, which allows the reciever to notice the reboot and reset
@@ -216,7 +216,7 @@
         mLauncher.mCancelAlarmCalled = false;
 
         // 4. Precache is successfully run at time X+1.
-        mLauncher.setDeviceState(new MockDeviceState(0, true, false, true));
+        mLauncher.setDeviceState(new MockDeviceState(0, true, true));
         mLauncher.setElapsedRealtime(PrecacheServiceLauncher.WAIT_UNTIL_NEXT_PRECACHE_MS + 1);
 
         mLauncher.onReceive(mContext, new Intent(PrecacheServiceLauncher.ACTION_ALARM));
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheServiceTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheServiceTest.java
index 1e4ab384..239a835 100644
--- a/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheServiceTest.java
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/precache/PrecacheServiceTest.java
@@ -56,10 +56,10 @@
         getService().setPrecacheLauncher(mPrecacheLauncher);
     }
 
-    private void startAndChangeDeviceState(MockPrecacheService service, boolean powerIsConnected,
-            boolean isInteractive, boolean wifiIsAvailable) {
+    private void startAndChangeDeviceState(
+            MockPrecacheService service, boolean powerIsConnected, boolean wifiIsAvailable) {
         AdvancedMockContext context = new AdvancedMockContext();
-        getService().setDeviceState(new MockDeviceState(0, true, false, true));
+        getService().setDeviceState(new MockDeviceState(0, true, true));
         assertFalse("Precaching should not be in progress initially", service.isPrecaching());
         ThreadUtils.runOnUiThreadBlocking(new Runnable() {
             @Override
@@ -70,8 +70,7 @@
             }
         });
         assertTrue("Precaching should be in progress after start", service.isPrecaching());
-        getService().setDeviceState(
-                new MockDeviceState(0, powerIsConnected, isInteractive, wifiIsAvailable));
+        getService().setDeviceState(new MockDeviceState(0, powerIsConnected, wifiIsAvailable));
         service.getDeviceStateReceiver().onReceive(context, new Intent());
     }
 
@@ -80,28 +79,18 @@
     @Feature({"Precache"})
     public void testPrecacheWhenPowerDisconnects() {
         setupService();
-        startAndChangeDeviceState(getService(), false, false, true);
+        startAndChangeDeviceState(getService(), false, true);
         assertFalse("Precaching should not be in progress when power is disconnected",
                 getService().isPrecaching());
 
     }
 
-    /** Tests that the device becoming interactive stops a precache. */
-    @SmallTest
-    @Feature({"Precache"})
-    public void testPrecacheWhenDeviceBecomesInteractive() {
-        setupService();
-        startAndChangeDeviceState(getService(), true, true, true);
-        assertFalse("Precaching should not be in progress when the device is interactive",
-                getService().isPrecaching());
-    }
-
     /** Tests that going off of Wi-Fi stops a precache. */
     @SmallTest
     @Feature({"Precache"})
     public void testPrecacheWhenNoLongerWifi() {
         setupService();
-        startAndChangeDeviceState(getService(), true, true, true);
+        startAndChangeDeviceState(getService(), true, false);
         assertFalse("Precaching should not be in progress when the network is not Wi-Fi",
                 getService().isPrecaching());
     }
@@ -111,7 +100,7 @@
     @Feature({"Precache"})
     public void testPrecacheWhenPrerequisitesStillMet() {
         setupService();
-        startAndChangeDeviceState(getService(), true, false, true);
+        startAndChangeDeviceState(getService(), true, true);
         assertTrue("Precaching should be in progress", getService().isPrecaching());
     }
 
@@ -123,7 +112,7 @@
     @Feature({"Precache"})
     public void testPrecacheCompleted() {
         setupService();
-        startAndChangeDeviceState(getService(), true, false, true);
+        startAndChangeDeviceState(getService(), true, true);
         assertTrue("Precaching should be in progress", getService().isPrecaching());
         mPrecacheLauncher.onPrecacheCompleted(true);
         assertFalse("Precaching should not be in progress after completion",
diff --git a/chrome/android/junit/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterTest.java b/chrome/android/junit/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterTest.java
new file mode 100644
index 0000000..5f623e8
--- /dev/null
+++ b/chrome/android/junit/src/org/chromium/chrome/browser/media/router/ChromeMediaRouterTest.java
@@ -0,0 +1,67 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.media.router;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.app.ActivityManager;
+import android.os.Build;
+
+import org.chromium.base.test.util.Feature;
+import org.chromium.testing.local.LocalRobolectricTestRunner;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.Robolectric;
+import org.robolectric.annotation.Config;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+import org.robolectric.shadows.ShadowActivityManager;
+
+/**
+ * Robolectric tests for ChromeMediaRouter.
+ */
+@RunWith(LocalRobolectricTestRunner.class)
+@Config(manifest = Config.NONE,
+        shadows = { ChromeMediaRouterTest.FakeActivityManager.class })
+public class ChromeMediaRouterTest {
+
+    private static boolean sIsLowRamDevice;
+    private ChromeMediaRouter mChromeMediaRouter;
+
+    /**
+     * Robolectric's ShadowActivityManager implementation in order to extend
+     * isLowRamDevice and be able to instrument the tests.
+     */
+    @Implements(ActivityManager.class)
+    public static class FakeActivityManager extends ShadowActivityManager {
+        @Implementation
+        public boolean isLowRamDevice() {
+            return sIsLowRamDevice;
+        }
+    }
+
+    @Before
+    public void setUp() {
+        sIsLowRamDevice = false;
+        mChromeMediaRouter = new ChromeMediaRouter(0, Robolectric.application);
+    }
+
+    @Test
+    @Feature({"MediaRouter"})
+    public void testNotLowRamDevice() {
+        sIsLowRamDevice = false;
+        assertTrue(mChromeMediaRouter.startObservingMediaSinks(""));
+    }
+
+    @Test
+    @Feature({"MediaRouter"})
+    public void testIsLowRamDevice() {
+        sIsLowRamDevice = true;
+        assertEquals(Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR2,
+                     mChromeMediaRouter.startObservingMediaSinks(""));
+    }
+}
diff --git a/chrome/app/chrome_command_ids.h b/chrome/app/chrome_command_ids.h
index 176bc62..204ac22 100644
--- a/chrome/app/chrome_command_ids.h
+++ b/chrome/app/chrome_command_ids.h
@@ -328,7 +328,6 @@
 // Search items.
 #define IDC_CONTENT_CONTEXT_GOTOURL 50180
 #define IDC_CONTENT_CONTEXT_SEARCHWEBFOR 50181
-#define IDC_CONTENT_CONTEXT_ADDSEARCHENGINE 50182
 
 // Context menu items in the bookmark bar
 #define IDC_BOOKMARK_BAR_OPEN_ALL 51000
diff --git a/chrome/app/chromium_strings.grd b/chrome/app/chromium_strings.grd
index 1198850c..b4796a7 100644
--- a/chrome/app/chromium_strings.grd
+++ b/chrome/app/chromium_strings.grd
@@ -1210,7 +1210,7 @@
         </message>
       </if>
 
-      <!-- Runtime permission infobar strings -->
+      <!-- Runtime permission strings -->
       <if expr="is_android">
         <message name="IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to the camera capabilities, but Chrome is missing the Android camera permission.">
           Chromium needs camera access to share it with this site.
@@ -1224,6 +1224,9 @@
         <message name="IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT" desc="Text shown in an infobar when a website has requested access to the multiple restricted capabilities (e.g. location, camera, microphone), but Chrome is missing the corresponding Android permissions.">
           Chromium needs permissions access to share them with this site.
         </message>
+        <message name="IDS_MISSING_STORAGE_PERMISSION_DOWNLOAD_EDUCATION_TEXT" desc="Text shown educating the user that Chrome is missing the Android storage permission, which is required to download files.">
+          Chromium needs storage access to download files.
+        </message>
       </if>
 
       <!-- OOBE -->
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index c1127029..ccee420 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -852,9 +852,6 @@
           <message name="IDS_CONTENT_CONTEXT_GOTOURL" desc="The name of the Go to 'url' command in the content area context menu">
             &amp;Go to <ph name="URL">$1<ex>http://www.google.com/</ex></ph>
           </message>
-          <message name="IDS_CONTENT_CONTEXT_ADDSEARCHENGINE" desc="The name of the Add as Search Engine command in the content area context menu">
-            Add as search en&amp;gine...
-          </message>
           <message name="IDS_CONTENT_CONTEXT_FORCESAVEPASSWORD" desc="The name of the Save Password command in the content area context menu">
             Save password
           </message>
@@ -1072,9 +1069,6 @@
           <message name="IDS_CONTENT_CONTEXT_GOTOURL" desc="In Title Case: The name of the Go to url for 'string' command in the content area context menu">
             &amp;Go to <ph name="URL">$1<ex>http://www.google.com/</ex></ph>
           </message>
-          <message name="IDS_CONTENT_CONTEXT_ADDSEARCHENGINE" desc="In Title Case: The name of the Add as Search Engine command in the content area context menu">
-            Add As Search En&amp;gine...
-          </message>
           <message name="IDS_CONTENT_CONTEXT_FORCESAVEPASSWORD" desc="In Title Case: The name of the Save Password command in the content area context menu">
             Save Password
           </message>
@@ -6031,6 +6025,32 @@
       <message name="IDS_FLAGS_ENABLE_STALE_WHILE_REVALIDATE_NAME" desc="Name of the flag to enable the stale-while-revalidate cache directive.">
         Enable the stale-while-revalidate cache directive
       </message>
+      <message name="IDS_FLAGS_ENABLE_NAVIGATION_TRACING" desc="Name of the flag to enable navigation tracing">
+        Enable navigation tracing
+      </message>
+      <message name="IDS_FLAGS_ENABLE_NAVIGATION_TRACING_DESCRIPTION" desc="Description of the flag to enable navigation tracing">
+        This is to be used in conjunction with the trace-upload-url flag.
+        WARNING: When enabled, Chrome will record performance data for every navigation and upload it to the URL specified by the trace-upload-url flag. The trace may include personally identifiable information (PII) such as the titles and URLs of websites you visit.
+      </message>
+      <message name="IDS_FLAGS_TRACE_UPLOAD_URL" desc="Name of the flag to set the trace upload url">
+        Trace label for navigation tracing
+      </message>
+      <message name="IDS_FLAGS_TRACE_UPLOAD_URL_DESCRIPTION" desc="Description of the flag to set the trace upload url">
+        This is to be used in conjunction with the enable-navigation-tracing flag.
+        Please select the label that best describes the recorded traces. This will choose the destination the traces are uploaded to. If you are not sure, select other. If left empty, no traces will be uploaded.
+      </message>
+      <message name="IDS_TRACE_UPLOAD_URL_CHOICE_OTHER">
+        Other
+      </message>
+      <message name="IDS_TRACE_UPLOAD_URL_CHOICE_EMLOADING">
+        emloading
+      </message>
+      <message name="IDS_TRACE_UPLOAD_URL_CHOICE_QA">
+        QA
+      </message>
+      <message name="IDS_TRACE_UPLOAD_URL_CHOICE_TESTING">
+        Testing
+      </message>
       <message name="IDS_FLAGS_ENABLE_STALE_WHILE_REVALIDATE_DESCRIPTION" desc="Description for the flag to enable the stale-while-revalidate cache directive.">
         Enable the experimental implementation of the Cache-Control: stale-while-revalidate directive. This permits servers to specify that some resources may be revalidated in the background to improve latency.
       </message>
@@ -7085,6 +7105,9 @@
         <message name="IDS_ABOUT_BOX_ERROR_UPDATE_CHECK_FAILED" desc="The error message for the specific case when we cannot create the Google Update component">
           Update check failed to start (error code <ph name="ERROR">$1<ex>0x80000005</ex></ph>).
         </message>
+        <message name="IDS_ABOUT_BOX_EXTERNAL_UPDATE_IS_RUNNING" desc="The external updater is running independently.">
+          The updater is currently running. Refresh in a minute to check again.
+        </message>
         <message name="IDS_ABOUT_BOX_GOOGLE_UPDATE_ERROR" desc="An error message from Google Update with details.">
           <ph name="ERROR">$1<ex>An error message from Google Update.</ex></ph> (error code <ph name="ERROR_CODE">$2<ex>7: 0x80000005</ex></ph>).
         </message>
@@ -8188,6 +8211,21 @@
       <message name="IDS_SRT_BUBBLE_TEXT" desc="Text for the Chrome Cleanup Tool bubble view full description.">
           Is Chrome crashing, showing unusual startup pages, toolbars, or unexpected ads you can't get rid of, or otherwise changing your browsing experience? You may be able to fix the problem by running the Chrome Cleanup Tool.
       </message>
+      <message name="IDS_SRT_BUBBLE_TEXT_WITH_UWS_NAME" desc="Text for the Chrome Cleanup Tool bubble view stating that a single piece of Unwanted Software was found.">
+          Chrome found an unwanted program (<ph name="UWS_NAME">$1<ex>SoftwareName</ex></ph>) installed on your computer. You may be able to remove it by running the Chrome Cleanup Tool.
+      </message>
+      <message name="IDS_SRT_BUBBLE_TEXT_WITH_UWS_NAMES" desc="Text for the Chrome Cleanup Tool bubble view stating that two or more pieces of Unwanted Software were found.">
+          Chrome found <ph name="NUMBER_OF_UWS_GREATER_THAN_ONE">$1<ex>3</ex></ph> unwanted programs (<ph name="IDS_SRT_BUBBLE_TEXT_2_UWS_NAMES">$1<ex>Software1 and Software2</ex></ph>) installed on your computer. You may be able to remove these programs by running the Chrome Cleanup Tool.
+      </message>
+      <message name="IDS_SRT_BUBBLE_TEXT_2_UWS_NAMES" desc="Text to put within IDS_SRT_BUBBLE_TEXT_WITH_UWS_NAME when there are 2 UwS found, e.g., Software1 and Software2.">
+          <ph name="UWS_NAME">$1<ex>SoftwareName</ex></ph> and <ph name="UWS_NAME">$2<ex>Software2</ex></ph>
+      </message>
+      <message name="IDS_SRT_BUBBLE_TEXT_1_MORE_UWS_NAME" desc="Text to replace IDS_SRT_BUBBLE_TEXT_2_UWS_NAMES above when there are 3 found unwanted software, e.g., Software1, Software2, and one more.">
+          <ph name="UWS_NAME">$1<ex>Software1</ex></ph>, <ph name="UWS_NAME">$2<ex>Software2</ex></ph>, and one more
+      </message>
+      <message name="IDS_SRT_BUBBLE_TEXT_MORE_UWS_NAMES" desc="Text to replace IDS_SRT_BUBBLE_TEXT_2_UWS_NAMES above when there are more than 2 found unwanted software, e.g., Software1, Software2, and 3 others.">
+          <ph name="UWS_NAME">$1<ex>Software1</ex></ph>, <ph name="UWS_NAME">$2<ex>Software2</ex></ph>, and <ph name="NUMBER_OF_UWS_GREATER_THAN_ONE">$1<ex>3</ex></ph> others
+      </message>
       <if expr="use_titlecase">
         <message name="IDS_SRT_MENU_ITEM" desc="In Title Case: Text for the Chrome menu option to be shown when unusual behavior was detected.">
           Unusual Behavior Detected
@@ -12495,7 +12533,7 @@
       <!-- Translate Bubble -->
       <if expr="toolkit_views or is_macosx">
         <message name="IDS_TRANSLATE_BUBBLE_BEFORE_TRANSLATE" desc="Text to show for the translate bubble label when that page is in specified language and ask if should translate.">
-          Do you want to translate this page?
+          Would you like to translate this page?
         </message>
         <message name="IDS_TRANSLATE_BUBBLE_ADVANCED" desc="Text to show for the translate bubble link label to jump to the advanced panel.">
           Options
@@ -14215,16 +14253,6 @@
         </message>
       </if>
 
-      <!-- iOS Net-Export strings -->
-      <if expr="is_ios">
-        <message name="IDS_NET_EXPORT_NO_EMAIL_ACCOUNTS_ALERT_MESSAGE" desc="The message of the alert informing a user with no email accounts that he or she needs to configure an email account to send net-export data. [Length: 70em]">
-          To send net-export data, please configure your email account in the Settings app.
-        </message>
-        <message name="IDS_NET_EXPORT_NO_EMAIL_ACCOUNTS_ALERT_TITLE" desc="The title of the alert informing a user with no email accounts that he or she needs to configure an email account to send net-export data. [Length: 20em]">
-          No Email Accounts
-        </message>
-      </if>
-
       <!-- Pepper 3D and WebGL (client 3D APIs) infobar strings -->
       <message name="IDS_3D_APIS_BLOCKED_TEXT" desc="Infobar message when 3D graphics APIs are blocked because the graphics processor was reset recently. NOTE that 'rats' here is being used like 'darn'.">
         Rats! <ph name="API_NAME">$1<ex>WebGL</ex></ph> hit a snag.
@@ -15243,10 +15271,10 @@
         Use Android Midi API for WebMIDI (effective only with Android M+ devices).
       </message>
       <message name="IDS_FLAGS_THEME_COLOR_IN_TABBED_MODE_NAME" desc="Name for the flag to enable theme-color in tabbed mode of Chrome.">
-        Enable theme-color in tabbed mode.
+        Enable <ph name="META_TAG_NAME">theme-color<ex>theme-color</ex></ph> in tabbed mode.
       </message>
       <message name="IDS_FLAGS_THEME_COLOR_IN_TABBED_MODE_DESCRIPTION" desc="Description for the flag to enable theme-color in tabbed mode of Chrome.">
-        Allows websites to set the color of the omnibox in tabbed mode ("Merge Apps and Tabs" off) via theme-color meta tag.
+        Allows websites to set the color of the omnibox in tabbed mode ("Merge Apps and Tabs" off) via <ph name="META_TAG_NAME">theme-color<ex>theme-color</ex></ph> meta tag.
       </message>
    </if>
 
diff --git a/chrome/app/google_chrome_strings.grd b/chrome/app/google_chrome_strings.grd
index 254553e..a7bdc22 100644
--- a/chrome/app/google_chrome_strings.grd
+++ b/chrome/app/google_chrome_strings.grd
@@ -1212,7 +1212,7 @@
         </message>
       </if>
 
-      <!-- Runtime permission infobar strings -->
+      <!-- Runtime permission strings -->
       <if expr="is_android">
         <message name="IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT" desc="Text shown in an infobar when a website has requested access to the camera capabilities, but Chrome is missing the Android camera permission.">
           Chrome needs camera access to share it with this site.
@@ -1226,6 +1226,9 @@
         <message name="IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT" desc="Text shown in an infobar when a website has requested access to the multiple restricted capabilities (e.g. location, camera, microphone), but Chrome is missing the corresponding Android permissions.">
           Chrome needs permissions access to share them with this site.
         </message>
+        <message name="IDS_MISSING_STORAGE_PERMISSION_DOWNLOAD_EDUCATION_TEXT" desc="Text shown educating the user that Chrome is missing the Android storage permission, which is required to download files.">
+          Chrome needs storage access to download files.
+        </message>
       </if>
 
       <!-- OOBE -->
diff --git a/chrome/app/nibs/BookmarkAllTabs.xib b/chrome/app/nibs/BookmarkAllTabs.xib
index 2e9e822..bddf1c1 100644
--- a/chrome/app/nibs/BookmarkAllTabs.xib
+++ b/chrome/app/nibs/BookmarkAllTabs.xib
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F1077" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13F1112" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment version="1060" identifier="macosx"/>
         <development version="5100" identifier="xcode"/>
@@ -139,7 +139,6 @@
                                             </textFieldCell>
                                             <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                             <connections>
-                                                <binding destination="74" name="editable" keyPath="arrangedObjects.newFolder" id="81"/>
                                                 <binding destination="74" name="value" keyPath="arrangedObjects.folderName" id="82"/>
                                             </connections>
                                         </tableColumn>
@@ -147,6 +146,7 @@
                                     <connections>
                                         <binding destination="74" name="content" keyPath="arrangedObjects" id="84"/>
                                         <binding destination="-2" name="selectionIndexPaths" keyPath="tableSelectionPaths" previousBinding="84" id="85"/>
+                                        <outlet property="delegate" destination="-2" id="eRE-W5-9Lw"/>
                                     </connections>
                                 </outlineView>
                             </subviews>
@@ -156,7 +156,7 @@
                             <rect key="frame" x="1" y="131" width="423" height="15"/>
                             <autoresizingMask key="autoresizingMask"/>
                         </scroller>
-                        <scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="37" horizontal="NO" id="71">
+                        <scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="71">
                             <rect key="frame" x="424" y="1" width="15" height="130"/>
                             <autoresizingMask key="autoresizingMask"/>
                         </scroller>
diff --git a/chrome/app/theme/default_100_percent/common/password_generation_key.png b/chrome/app/theme/default_100_percent/legacy/password_generation_key.png
similarity index 100%
rename from chrome/app/theme/default_100_percent/common/password_generation_key.png
rename to chrome/app/theme/default_100_percent/legacy/password_generation_key.png
Binary files differ
diff --git a/chrome/app/theme/default_200_percent/common/password_generation_key.png b/chrome/app/theme/default_200_percent/legacy/password_generation_key.png
similarity index 100%
rename from chrome/app/theme/default_200_percent/common/password_generation_key.png
rename to chrome/app/theme/default_200_percent/legacy/password_generation_key.png
Binary files differ
diff --git a/chrome/app/theme/theme_resources.grd b/chrome/app/theme/theme_resources.grd
index d3c8b85..69f0b79 100644
--- a/chrome/app/theme/theme_resources.grd
+++ b/chrome/app/theme/theme_resources.grd
@@ -307,7 +307,9 @@
       </if>
       <structure type="chrome_scaled_image" name="IDR_FROZEN_TAB_ICON" file="common/frozen_tab.png" />
       <structure type="chrome_scaled_image" name="IDR_FULLSCREEN_MENU_BUTTON" file="common/fullscreen_menu_button.png" />
-      <structure type="chrome_scaled_image" name="IDR_GENERATE_PASSWORD_KEY" file="common/password_generation_key.png" />
+      <if expr="is_macosx">
+        <structure type="chrome_scaled_image" name="IDR_GENERATE_PASSWORD_KEY" file="legacy/password_generation_key.png" />
+      </if>
       <structure type="chrome_scaled_image" name="IDR_HELP_MENU" file="common/help_16.png" />
       <structure type="chrome_scaled_image" name="IDR_HISTORY_FAVICON" file="common/favicon_history.png" />
       <if expr="toolkit_views or is_macosx or is_ios">
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index 6b5a1374..9fa3cf05 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -302,6 +302,7 @@
       "//components/web_cache/browser",
       "//components/web_modal",
       "//content/app/resources",
+      "//device/devices_app/usb/public/interfaces",
       "//media",
       "//media/midi",
       "//mojo/application/public/cpp",
@@ -602,7 +603,12 @@
     sources += rebase_path(gypi_values.chrome_browser_notifications_sources,
                            ".",
                            "//chrome")
-    if (!is_android) {
+    if (is_android) {
+      sources +=
+          rebase_path(gypi_values.chrome_browser_notifications_android_sources,
+                      ".",
+                      "//chrome")
+    } else {
       sources += rebase_path(
               gypi_values.chrome_browser_notifications_non_android_sources,
               ".",
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index d2b85e7f..cf4b3570 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -120,7 +120,7 @@
   "+courgette",
   "+device/bluetooth",
   "+device/core",
-  "+device/devices_app/public",
+  "+device/devices_app/usb",
   "+device/hid",
   "+device/usb",
   "+device/media_transfer_protocol",
diff --git a/chrome/browser/PRESUBMIT.py b/chrome/browser/PRESUBMIT.py
index 143ff1c0..839bed06 100644
--- a/chrome/browser/PRESUBMIT.py
+++ b/chrome/browser/PRESUBMIT.py
@@ -55,7 +55,9 @@
     def _html_css_js_resource(p):
       return p.endswith(('.html', '.css', '.js')) and p.startswith(search_dirs)
 
-    BLACKLIST = ['chrome/browser/resources/pdf/index.html',
+    BLACKLIST = ['chrome/browser/resources/md_downloads/crisper.js',
+                 'chrome/browser/resources/md_downloads/vulcanized.html',
+                 'chrome/browser/resources/pdf/index.html',
                  'chrome/browser/resources/pdf/index.js']
     def is_resource(maybe_resource):
       return (maybe_resource.LocalPath() not in BLACKLIST and
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 1f3e2c7..2fe6524 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -37,6 +37,7 @@
 #include "components/proximity_auth/switches.h"
 #include "components/search/search_switches.h"
 #include "components/sync_driver/sync_driver_switches.h"
+#include "components/tracing/tracing_switches.h"
 #include "components/version_info/version_info.h"
 #include "content/public/browser/user_metrics.h"
 #include "media/base/media_switches.h"
@@ -200,6 +201,18 @@
     "direction" }
 };
 
+const Experiment::Choice kTraceUploadURL[] = {
+  { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, "", "" },
+  { IDS_TRACE_UPLOAD_URL_CHOICE_OTHER, switches::kTraceUploadURL,
+    "https://performance-insights.appspot.com/upload?tags=flags,Other"},
+  { IDS_TRACE_UPLOAD_URL_CHOICE_EMLOADING, switches::kTraceUploadURL,
+    "https://performance-insights.appspot.com/upload?tags=flags,emloading" },
+  { IDS_TRACE_UPLOAD_URL_CHOICE_QA, switches::kTraceUploadURL,
+    "https://performance-insights.appspot.com/upload?tags=flags,QA" },
+  { IDS_TRACE_UPLOAD_URL_CHOICE_TESTING, switches::kTraceUploadURL,
+    "https://performance-insights.appspot.com/upload?tags=flags,TestingTeam" }
+};
+
 #if !defined(DISABLE_NACL)
 const Experiment::Choice kNaClDebugMaskChoices[] = {
   // Secure shell can be used on ChromeOS for forwarding the TCP port opened by
@@ -1148,6 +1161,16 @@
      IDS_FLAGS_TOUCH_SELECTION_STRATEGY_DESCRIPTION,
      kOsAndroid,  // TODO(mfomitchev): Add CrOS/Win/Linux support soon.
      MULTI_VALUE_TYPE(kTouchTextSelectionStrategyChoices)},
+    {"enable-navigation-tracing",
+     IDS_FLAGS_ENABLE_NAVIGATION_TRACING,
+     IDS_FLAGS_ENABLE_NAVIGATION_TRACING_DESCRIPTION,
+     kOsAll,
+     SINGLE_VALUE_TYPE(switches::kEnableNavigationTracing)},
+    {"trace-upload-url",
+     IDS_FLAGS_TRACE_UPLOAD_URL,
+     IDS_FLAGS_TRACE_UPLOAD_URL_DESCRIPTION,
+     kOsAll,
+     MULTI_VALUE_TYPE(kTraceUploadURL)},
     {"enable-suggestions-service",
      IDS_FLAGS_ENABLE_SUGGESTIONS_SERVICE_NAME,
      IDS_FLAGS_ENABLE_SUGGESTIONS_SERVICE_DESCRIPTION,
diff --git a/chrome/browser/android/download/chrome_download_delegate.cc b/chrome/browser/android/download/chrome_download_delegate.cc
index 0bfa6410a..5fa5db17 100644
--- a/chrome/browser/android/download/chrome_download_delegate.cc
+++ b/chrome/browser/android/download/chrome_download_delegate.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/android/download/chrome_download_delegate.h"
 
 #include <jni.h>
+#include <string>
 
 #include "base/android/jni_android.h"
 #include "base/android/jni_string.h"
@@ -17,11 +18,15 @@
 #include "chrome/browser/android/tab_android.h"
 #include "chrome/browser/download/download_extensions.h"
 #include "chrome/browser/infobars/infobar_service.h"
+#include "chrome/browser/permissions/permission_update_infobar_delegate_android.h"
+#include "chrome/grit/chromium_strings.h"
 #include "chrome/grit/generated_resources.h"
 #include "content/public/browser/android/download_controller_android.h"
 #include "jni/ChromeDownloadDelegate_jni.h"
 #include "ui/base/l10n/l10n_util.h"
 
+using content::DownloadControllerAndroid;
+
 // Gets the download warning text for the given file name.
 static ScopedJavaLocalRef<jstring> GetDownloadWarningText(
     JNIEnv* env,
@@ -49,7 +54,7 @@
                                        jint download_id,
                                        jboolean accept) {
   TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab);
-  content::DownloadControllerAndroid::Get()->DangerousDownloadValidated(
+  DownloadControllerAndroid::Get()->DangerousDownloadValidated(
       tab_android->web_contents(), download_id, accept);
 }
 
@@ -88,6 +93,33 @@
       dir_name, dir_full_path, delegate, download_info);
 }
 
+static void LaunchPermissionUpdateInfoBar(
+    JNIEnv* env,
+    const JavaParamRef<jclass>& clazz,
+    const JavaParamRef<jobject>& tab,
+    const JavaParamRef<jstring>& jpermission,
+    jlong callback_id) {
+  TabAndroid* tab_android = TabAndroid::GetNativeTab(env, tab);
+
+  std::string permission =
+      base::android::ConvertJavaStringToUTF8(env, jpermission);
+
+  // Convert java long long int to c++ pointer, take ownership.
+  scoped_ptr<DownloadControllerAndroid::AcquireFileAccessPermissionCallback> cb(
+      reinterpret_cast<
+          DownloadControllerAndroid::AcquireFileAccessPermissionCallback*>(
+              callback_id));
+
+  std::vector<std::string> permissions;
+  permissions.push_back(permission);
+
+  PermissionUpdateInfoBarDelegate::Create(
+      tab_android->web_contents(),
+      permissions,
+      IDS_MISSING_STORAGE_PERMISSION_DOWNLOAD_EDUCATION_TEXT,
+      *cb);
+}
+
 bool RegisterChromeDownloadDelegate(JNIEnv* env) {
   return RegisterNativesImpl(env);
 }
diff --git a/chrome/browser/autocomplete/history_quick_provider_unittest.cc b/chrome/browser/autocomplete/history_quick_provider_unittest.cc
index acdf836..dd9d84023 100644
--- a/chrome/browser/autocomplete/history_quick_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_quick_provider_unittest.cc
@@ -51,6 +51,8 @@
 
 using content::BrowserThread;
 
+namespace {
+
 struct TestURLInfo {
   std::string url;
   std::string title;
@@ -150,6 +152,36 @@
   runner.Run();
 }
 
+// Post history_backend->GetURL() to the history thread and stop the originating
+// thread's message loop when done.
+class GetURLTask : public history::HistoryDBTask {
+ public:
+  GetURLTask(const GURL& url, bool* result_storage)
+      : result_storage_(result_storage),
+        url_(url) {
+  }
+
+  bool RunOnDBThread(history::HistoryBackend* backend,
+                     history::HistoryDatabase* db) override {
+    *result_storage_ = backend->GetURL(url_, NULL);
+    return true;
+  }
+
+  void DoneRunOnMainThread() override {
+    base::MessageLoop::current()->Quit();
+  }
+
+ private:
+  ~GetURLTask() override {}
+
+  bool* result_storage_;
+  const GURL url_;
+
+  DISALLOW_COPY_AND_ASSIGN(GetURLTask);
+};
+
+}  // namespace
+
 class HistoryQuickProviderTest : public testing::Test {
  public:
   HistoryQuickProviderTest()
@@ -208,10 +240,19 @@
                          base::string16 expected_fill_into_edit,
                          base::string16 autocompletion);
 
+  // TODO(shess): From history_service.h in reference to history_backend:
+  // > This class has most of the implementation and runs on the 'thread_'.
+  // > You MUST communicate with this class ONLY through the thread_'s
+  // > message_loop().
+  // Direct use of this object in tests is almost certainly not thread-safe.
   history::HistoryBackend* history_backend() {
     return history_service_->history_backend_.get();
   }
 
+  // Call history_backend()->GetURL(url, NULL) on the history thread, returning
+  // the result.
+  bool GetURLProxy(const GURL& url);
+
   base::MessageLoopForUI message_loop_;
   content::TestBrowserThread ui_thread_;
   content::TestBrowserThread file_thread_;
@@ -394,6 +435,18 @@
   EXPECT_EQ(expected_fill_into_edit, ac_matches_[0].fill_into_edit);
 }
 
+bool HistoryQuickProviderTest::GetURLProxy(const GURL& url) {
+  base::CancelableTaskTracker task_tracker;
+  bool result = false;
+  history_service_->ScheduleDBTask(
+      scoped_ptr<history::HistoryDBTask>(new GetURLTask(url, &result)),
+      &task_tracker);
+  // Run the message loop until GetURLTask::DoneRunOnMainThread stops it.  If
+  // the test hangs, DoneRunOnMainThread isn't being invoked correctly.
+  base::MessageLoop::current()->Run();
+  return result;
+}
+
 TEST_F(HistoryQuickProviderTest, SimpleSingleMatch) {
   std::vector<std::string> expected_urls;
   expected_urls.push_back("http://slashdot.org/favorite_page.html");
@@ -616,7 +669,7 @@
           ASCIIToUTF16("slashdot.org/favorite_page.html"),
                   ASCIIToUTF16(".org/favorite_page.html"));
   EXPECT_EQ(1U, ac_matches_.size());
-  EXPECT_TRUE(history_backend()->GetURL(test_url, NULL));
+  EXPECT_TRUE(GetURLProxy(test_url));
   provider_->DeleteMatch(ac_matches_[0]);
 
   // Check that the underlying URL is deleted from the history DB (this implies
@@ -626,7 +679,7 @@
   // To ensure that the deletion has been propagated everywhere before we start
   // verifying post-deletion states, first wait until we see the notification.
   WaitForURLsDeletedNotification(history_service_);
-  EXPECT_FALSE(history_backend()->GetURL(test_url, NULL));
+  EXPECT_FALSE(GetURLProxy(test_url));
 
   // Just to be on the safe side, explicitly verify that we have deleted enough
   // data so that we will not be serving the same result again.
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index 7001e103..fecf890 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -283,8 +283,7 @@
                  "BrowserProcessImpl::StartTearDown:ProfileManager");
     // The desktop User Manager needs to be closed before the guest profile
     // can be destroyed.
-    if (switches::IsNewAvatarMenu())
-      UserManager::Hide();
+    UserManager::Hide();
     profile_manager_.reset();
   }
 
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index e512282..a594e707 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -27,6 +27,7 @@
       <if expr="not is_android">
         <structure name="IDR_DOWNLOADS_DOWNLOADS_HTML" file="resources\downloads\downloads.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" />
         <structure name="IDR_MD_DOWNLOADS_DOWNLOADS_HTML" file="resources\md_downloads\downloads.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" />
+        <structure name="IDR_MD_DOWNLOADS_VULCANIZED_HTML" file="resources\md_downloads\vulcanized.html" flattenhtml="true" allowexternalscript="true" type="chrome_html" />
       </if>
       <if expr="enable_extensions">
         <structure name="IDR_EXTENSIONS_HTML" file="resources\extensions\extensions.html" flattenhtml="true" type="chrome_html" />
@@ -124,8 +125,13 @@
         <include name="IDR_DOWNLOADS_MANAGER_JS" file="resources\downloads\manager.js" type="BINDATA" />
         <include name="IDR_DOWNLOADS_THROTTLED_ICON_LOADER_HTML" file="resources\md_downloads\throttled_icon_loader.html" type="BINDATA" />
         <include name="IDR_DOWNLOADS_THROTTLED_ICON_LOADER_JS" file="resources\md_downloads\throttled_icon_loader.js" type="BINDATA" />
+        <include name="IDR_MD_DOWNLOADS_1X_INCOGNITO_MARKER_PNG" file="resources\md_downloads\1x\incognito_marker.png" type="BINDATA" />
+        <include name="IDR_MD_DOWNLOADS_2X_INCOGNITO_MARKER_PNG" file="resources\md_downloads\2x\incognito_marker.png" type="BINDATA" />
+        <include name="IDR_MD_DOWNLOADS_1X_NO_DOWNLOADS_PNG" file="resources\md_downloads\1x\no_downloads.png" type="BINDATA" />
+        <include name="IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG" file="resources\md_downloads\2x\no_downloads.png" type="BINDATA" />
         <include name="IDR_MD_DOWNLOADS_ACTION_SERVICE_HTML" file="resources\md_downloads\action_service.html" type="BINDATA" />
         <include name="IDR_MD_DOWNLOADS_ACTION_SERVICE_JS" file="resources\md_downloads\action_service.js" type="BINDATA" />
+        <include name="IDR_MD_DOWNLOADS_CRISPER_JS" file="resources\md_downloads\crisper.js" flattenhtml="true" type="BINDATA" />
         <include name="IDR_MD_DOWNLOADS_FOCUS_ROW_HTML" file="resources\md_downloads\focus_row.html" type="BINDATA" />
         <include name="IDR_MD_DOWNLOADS_FOCUS_ROW_JS" file="resources\md_downloads\focus_row.js" type="BINDATA" />
         <include name="IDR_MD_DOWNLOADS_ITEM_CSS" file="resources\md_downloads\item.css" type="BINDATA" flattenhtml="true" />
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index 2a68357b4..881d481 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -142,6 +142,7 @@
   return shutdown_ms_file.AppendASCII(kShutdownMsFile);
 }
 
+#if !defined(OS_ANDROID)
 bool ShutdownPreThreadsStop() {
 #if defined(OS_CHROMEOS)
   chromeos::BootTimesRecorder::Get()->AddLogoutTimeMarker(
@@ -249,7 +250,7 @@
 
 #if defined(OS_WIN)
     upgrade_util::RelaunchChromeWithMode(*new_cl.get(), g_relaunch_mode);
-#elif defined(OS_POSIX) && !defined(OS_ANDROID)
+#elif defined(OS_POSIX)
     upgrade_util::RelaunchChromeBrowser(*new_cl.get());
 #endif  // defined(OS_WIN)
 
@@ -274,6 +275,7 @@
   chrome::NotifyAndTerminate(false);
 #endif
 }
+#endif  // !defined(OS_ANDROID)
 
 void ReadLastShutdownFile(ShutdownType type,
                           int num_procs,
diff --git a/chrome/browser/browser_shutdown.h b/chrome/browser/browser_shutdown.h
index f53de3796..1d10200 100644
--- a/chrome/browser/browser_shutdown.h
+++ b/chrome/browser/browser_shutdown.h
@@ -29,6 +29,7 @@
 // Get the current shutdown type.
 ShutdownType GetShutdownType();
 
+#if !defined(OS_ANDROID)
 // Performs the shutdown tasks that need to be done before
 // BrowserProcess and the various threads go away.
 //
@@ -41,6 +42,7 @@
 // The provided parameter indicates whether a preference to restart
 // the session was present.
 void ShutdownPostThreadsStop(bool restart_last_session);
+#endif
 
 // Called at startup to create a histogram from our previous shutdown time.
 void ReadLastShutdownInfo();
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 13127ba..ba4ce89 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -383,12 +383,6 @@
   base::FilePath profile_path =
       GetStartupProfilePath(user_data_dir, parsed_command_line);
 
-  // Without NewAvatarMenu, replace guest with any existing profile.
-  if (!switches::IsNewAvatarMenu() &&
-      profile_path == ProfileManager::GetGuestProfilePath()) {
-    profile_path = g_browser_process->profile_manager()->GetProfileInfoCache().
-        GetPathOfProfileAtIndex(0);
-  }
   profile = g_browser_process->profile_manager()->GetProfile(
       profile_path);
 
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc
index e0a26c80..71adb835 100644
--- a/chrome/browser/chrome_content_browser_client.cc
+++ b/chrome/browser/chrome_content_browser_client.cc
@@ -85,6 +85,7 @@
 #include "chrome/browser/ui/tab_contents/chrome_web_contents_view_delegate.h"
 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
 #include "chrome/browser/ui/webui/log_web_ui_url.h"
+#include "chrome/browser/usb/web_usb_permission_provider.h"
 #include "chrome/common/channel_info.h"
 #include "chrome/common/chrome_constants.h"
 #include "chrome/common/chrome_paths.h"
@@ -138,8 +139,7 @@
 #include "content/public/common/service_registry.h"
 #include "content/public/common/url_utils.h"
 #include "content/public/common/web_preferences.h"
-#include "device/devices_app/public/cpp/constants.h"
-#include "device/devices_app/public/cpp/devices_app_factory.h"
+#include "device/devices_app/usb/device_manager_impl.h"
 #include "gin/v8_initializer.h"
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "net/base/mime_util.h"
@@ -267,10 +267,6 @@
 #include "chrome/browser/media/router/presentation_service_delegate_impl.h"
 #endif
 
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
-#include "chrome/browser/usb/web_usb_permission_provider.h"
-#endif
-
 using base::FileDescriptor;
 using blink::WebWindowFeatures;
 using content::AccessTokenStore;
@@ -629,6 +625,18 @@
 }
 #endif  // defined(ENABLE_EXTENSIONS)
 
+void CreateUsbDeviceManager(
+    RenderFrameHost* render_frame_host,
+    mojo::InterfaceRequest<device::usb::DeviceManager> request) {
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
+  device::usb::PermissionProviderPtr permission_provider;
+  WebUSBPermissionProvider::Create(render_frame_host,
+                                   mojo::GetProxy(&permission_provider));
+  device::usb::DeviceManagerImpl::Create(permission_provider.Pass(),
+                                         request.Pass());
+#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)
+}
+
 }  // namespace
 
 ChromeContentBrowserClient::ChromeContentBrowserClient()
@@ -2550,19 +2558,12 @@
       base::Bind(&chromeos::attestation::PlatformVerificationImpl::Create,
                  render_frame_host));
 #endif
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
-  registry->AddService(
-      base::Bind(&WebUSBPermissionProvider::Create, render_frame_host));
-#endif
 }
 
-void ChromeContentBrowserClient::RegisterInProcessMojoApplications(
-    StaticMojoApplicationMap* apps) {
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
-  apps->insert(std::make_pair(GURL(device::kDevicesMojoAppUrl),
-                              base::Bind(&device::DevicesAppFactory::CreateApp,
-                                         base::ThreadTaskRunnerHandle::Get())));
-#endif
+void ChromeContentBrowserClient::RegisterRenderFrameMojoServices(
+    content::ServiceRegistry* registry,
+    content::RenderFrameHost* render_frame_host) {
+  registry->AddService(base::Bind(&CreateUsbDeviceManager, render_frame_host));
 }
 
 void ChromeContentBrowserClient::OpenURL(
diff --git a/chrome/browser/chrome_content_browser_client.h b/chrome/browser/chrome_content_browser_client.h
index e53cd22..2d5ee03 100644
--- a/chrome/browser/chrome_content_browser_client.h
+++ b/chrome/browser/chrome_content_browser_client.h
@@ -275,8 +275,9 @@
   void RegisterFrameMojoShellServices(
       content::ServiceRegistry* registry,
       content::RenderFrameHost* render_frame_host) override;
-  void RegisterInProcessMojoApplications(
-      StaticMojoApplicationMap* apps) override;
+  void RegisterRenderFrameMojoServices(
+      content::ServiceRegistry* registry,
+      content::RenderFrameHost* render_frame_host) override;
   void OpenURL(content::BrowserContext* browser_context,
                const content::OpenURLParams& params,
                const base::Callback<void(content::WebContents*)>& callback)
diff --git a/chrome/browser/chrome_quota_permission_context.cc b/chrome/browser/chrome_quota_permission_context.cc
index 10f76f8..86e8368 100644
--- a/chrome/browser/chrome_quota_permission_context.cc
+++ b/chrome/browser/chrome_quota_permission_context.cc
@@ -9,16 +9,12 @@
 #include "base/bind.h"
 #include "base/prefs/pref_service.h"
 #include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/tab_contents/tab_util.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "chrome/browser/ui/website_settings/permission_bubble_request.h"
 #include "chrome/common/pref_names.h"
 #include "chrome/grit/generated_resources.h"
 #include "chrome/grit/locale_settings.h"
-#include "components/infobars/core/confirm_infobar_delegate.h"
-#include "components/infobars/core/infobar.h"
 #include "components/url_formatter/elide_url.h"
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/navigation_details.h"
@@ -28,6 +24,14 @@
 #include "ui/base/l10n/l10n_util.h"
 #include "url/gurl.h"
 
+#if defined(OS_ANDROID)
+#include "chrome/browser/infobars/infobar_service.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "components/infobars/core/infobar.h"
+#else
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
+#endif
+
 namespace {
 
 // If the site requested larger quota than this threshold, show a different
@@ -139,7 +143,7 @@
   delete this;
 }
 
-
+#if defined(OS_ANDROID)
 // RequestQuotaInfoBarDelegate ------------------------------------------------
 
 class RequestQuotaInfoBarDelegate : public ConfirmInfoBarDelegate {
@@ -236,6 +240,7 @@
       content::QuotaPermissionContext::QUOTA_PERMISSION_RESPONSE_CANCELLED);
   return true;
 }
+#endif
 
 }  // namespace
 
@@ -275,34 +280,35 @@
     return;
   }
 
+#if defined(OS_ANDROID)
   InfoBarService* infobar_service =
       InfoBarService::FromWebContents(web_contents);
-  if (!infobar_service) {
-    // The tab has no infobar service.
-    LOG(WARNING) << "Attempt to request quota from a background page: "
-                 << render_process_id << "," << params.render_view_id;
-    DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED);
+  if (infobar_service) {
+    RequestQuotaInfoBarDelegate::Create(
+        infobar_service, this, params.origin_url, params.requested_size,
+        Profile::FromBrowserContext(web_contents->GetBrowserContext())->
+            GetPrefs()->GetString(prefs::kAcceptLanguages),
+        callback);
     return;
   }
-
-  if (PermissionBubbleManager::Enabled()) {
-    PermissionBubbleManager* bubble_manager =
-        PermissionBubbleManager::FromWebContents(web_contents);
-    if (bubble_manager) {
-      bubble_manager->AddRequest(new QuotaPermissionRequest(this,
-              params.origin_url, params.requested_size, params.user_gesture,
-              Profile::FromBrowserContext(web_contents->GetBrowserContext())->
-                  GetPrefs()->GetString(prefs::kAcceptLanguages),
-              callback));
-    }
+#else
+  PermissionBubbleManager* bubble_manager =
+      PermissionBubbleManager::FromWebContents(web_contents);
+  if (bubble_manager) {
+    bubble_manager->AddRequest(new QuotaPermissionRequest(
+        this, params.origin_url, params.requested_size, params.user_gesture,
+        Profile::FromBrowserContext(web_contents->GetBrowserContext())
+            ->GetPrefs()
+            ->GetString(prefs::kAcceptLanguages),
+        callback));
     return;
   }
+#endif
 
-  RequestQuotaInfoBarDelegate::Create(
-      infobar_service, this, params.origin_url, params.requested_size,
-      Profile::FromBrowserContext(web_contents->GetBrowserContext())->
-          GetPrefs()->GetString(prefs::kAcceptLanguages),
-      callback);
+  // The tab has no UI service for presenting the permissions request.
+  LOG(WARNING) << "Attempt to request quota from a background page: "
+               << render_process_id << "," << params.render_view_id;
+  DispatchCallbackOnIOThread(callback, QUOTA_PERMISSION_RESPONSE_CANCELLED);
 }
 
 void ChromeQuotaPermissionContext::DispatchCallbackOnIOThread(
diff --git a/chrome/browser/chromeos/file_manager/gallery_browsertest.cc b/chrome/browser/chromeos/file_manager/gallery_browsertest.cc
index 92f2002..d1336fa0 100644
--- a/chrome/browser/chromeos/file_manager/gallery_browsertest.cc
+++ b/chrome/browser/chromeos/file_manager/gallery_browsertest.cc
@@ -349,4 +349,36 @@
   StartTest();
 }
 
+IN_PROC_BROWSER_TEST_F(GalleryBrowserTestInGuestMode,
+                       SlideshowTraversalOnDownloads) {
+  set_test_case_name("slideshowTraversalOnDownloads");
+  StartTest();
+}
+
+IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, SlideshowTraversalOnDownloads) {
+  set_test_case_name("slideshowTraversalOnDownloads");
+  StartTest();
+}
+
+IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, SlideshowTraversalOnDrive) {
+  set_test_case_name("slideshowTraversalOnDrive");
+  StartTest();
+}
+
+IN_PROC_BROWSER_TEST_F(GalleryBrowserTestInGuestMode,
+                       StopStartSlideshowOnDownloads) {
+  set_test_case_name("stopStartSlideshowOnDownloads");
+  StartTest();
+}
+
+IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, StopStartSlideshowOnDownloads) {
+  set_test_case_name("stopStartSlideshowOnDownloads");
+  StartTest();
+}
+
+IN_PROC_BROWSER_TEST_F(GalleryBrowserTest, StopStartSlideshowOnDrive) {
+  set_test_case_name("stopStartSlideshowOnDrive");
+  StartTest();
+}
+
 }  // namespace file_manager
diff --git a/chrome/browser/component_updater/sw_reporter_installer_win.cc b/chrome/browser/component_updater/sw_reporter_installer_win.cc
index ca930d8..cd9f794 100644
--- a/chrome/browser/component_updater/sw_reporter_installer_win.cc
+++ b/chrome/browser/component_updater/sw_reporter_installer_win.cc
@@ -18,9 +18,7 @@
 #include "base/metrics/sparse_histogram.h"
 #include "base/path_service.h"
 #include "base/prefs/pref_registry_simple.h"
-#include "base/strings/string_number_conversions.h"
 #include "base/strings/string_tokenizer.h"
-#include "base/strings/utf_string_conversions.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/threading/worker_pool.h"
 #include "base/time/time.h"
@@ -33,7 +31,6 @@
 #include "components/component_updater/default_component_installer.h"
 #include "components/component_updater/pref_names.h"
 #include "components/pref_registry/pref_registry_syncable.h"
-#include "components/rappor/rappor_service.h"
 #include "components/update_client/update_client.h"
 #include "components/update_client/utils.h"
 #include "content/public/browser/browser_thread.h"
@@ -63,20 +60,13 @@
     FILE_PATH_LITERAL("software_reporter_tool.exe");
 
 // Where to fetch the reporter's list of found uws in the registry.
-const wchar_t kSoftwareRemovalToolRegistryKey[] =
-    L"Software\\Google\\Software Removal Tool";
 const wchar_t kCleanerSuffixRegistryKey[] = L"Cleaner";
 const wchar_t kEndTimeValueName[] = L"EndTime";
 const wchar_t kExitCodeValueName[] = L"ExitCode";
-const wchar_t kFoundUwsValueName[] = L"FoundUws";
 const wchar_t kStartTimeValueName[] = L"StartTime";
 const wchar_t kUploadResultsValueName[] = L"UploadResults";
 const wchar_t kVersionValueName[] = L"Version";
 
-const char kFoundUwsMetricName[] = "SoftwareReporter.FoundUwS";
-const char kFoundUwsReadErrorMetricName[] =
-    "SoftwareReporter.FoundUwSReadError";
-
 void SRTHasCompleted(SRTCompleted value) {
   UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.Cleaner.HasCompleted", value,
                             SRT_COMPLETED_MAX);
@@ -140,40 +130,6 @@
   UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.LastUploadResult", last_result);
 }
 
-// Reports UwS found by the software reporter tool via UMA and RAPPOR.
-void ReportFoundUwS() {
-  base::win::RegKey reporter_key(HKEY_CURRENT_USER,
-                                 kSoftwareRemovalToolRegistryKey,
-                                 KEY_QUERY_VALUE | KEY_SET_VALUE);
-  std::vector<base::string16> found_uws_strings;
-  if (reporter_key.Valid() &&
-      reporter_key.ReadValues(kFoundUwsValueName, &found_uws_strings) ==
-          ERROR_SUCCESS) {
-    rappor::RapporService* rappor_service = g_browser_process->rappor_service();
-
-    bool parse_error = false;
-    for (const base::string16& uws_string : found_uws_strings) {
-      // All UwS ids are expected to be integers.
-      uint32_t uws_id = 0;
-      if (base::StringToUint(uws_string, &uws_id)) {
-        UMA_HISTOGRAM_SPARSE_SLOWLY(kFoundUwsMetricName, uws_id);
-        if (rappor_service) {
-          rappor_service->RecordSample(kFoundUwsMetricName,
-                                       rappor::COARSE_RAPPOR_TYPE,
-                                       base::UTF16ToUTF8(uws_string));
-        }
-      } else {
-        parse_error = true;
-      }
-    }
-
-    // Clean up the old value.
-    reporter_key.DeleteValue(kFoundUwsValueName);
-
-    UMA_HISTOGRAM_BOOLEAN(kFoundUwsReadErrorMetricName, parse_error);
-  }
-}
-
 class SwReporterInstallerTraits : public ComponentInstallerTraits {
  public:
   SwReporterInstallerTraits() {}
@@ -238,7 +194,8 @@
     return;
 
   // Check if we have information from Cleaner and record UMA statistics.
-  base::string16 cleaner_key_name(kSoftwareRemovalToolRegistryKey);
+  base::string16 cleaner_key_name(
+      safe_browsing::kSoftwareRemovalToolRegistryKey);
   cleaner_key_name.append(1, L'\\').append(kCleanerSuffixRegistryKey);
   base::win::RegKey cleaner_key(
       HKEY_CURRENT_USER, cleaner_key_name.c_str(), KEY_ALL_ACCESS);
@@ -305,7 +262,6 @@
       }
     }
   }
-  ReportFoundUwS();
 
   // Install the component.
   scoped_ptr<ComponentInstallerTraits> traits(new SwReporterInstallerTraits());
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry.cc b/chrome/browser/custom_handlers/protocol_handler_registry.cc
index 43b1b20..ff85af0 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry.cc
@@ -11,7 +11,6 @@
 #include "base/logging.h"
 #include "base/prefs/pref_service.h"
 #include "chrome/browser/chrome_notification_types.h"
-#include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h"
 #include "chrome/browser/profiles/profile_io_data.h"
 #include "chrome/common/custom_handlers/protocol_handler.h"
 #include "chrome/common/pref_names.h"
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc
deleted file mode 100644
index e830526..0000000
--- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h"
-
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
-#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/common/url_constants.h"
-#include "chrome/grit/generated_resources.h"
-#include "components/infobars/core/infobar.h"
-#include "content/public/browser/user_metrics.h"
-#include "content/public/browser/web_contents.h"
-#include "grit/components_strings.h"
-#include "ui/base/l10n/l10n_util.h"
-
-// static
-void RegisterProtocolHandlerInfoBarDelegate::Create(
-    InfoBarService* infobar_service,
-    ProtocolHandlerRegistry* registry,
-    const ProtocolHandler& handler) {
-  content::RecordAction(
-      base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Shown"));
-
-  scoped_ptr<infobars::InfoBar> infobar(
-      infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>(
-          new RegisterProtocolHandlerInfoBarDelegate(registry, handler))));
-
-  for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
-    infobars::InfoBar* existing_infobar = infobar_service->infobar_at(i);
-    RegisterProtocolHandlerInfoBarDelegate* existing_delegate =
-        existing_infobar->delegate()->
-            AsRegisterProtocolHandlerInfoBarDelegate();
-    if ((existing_delegate != NULL) &&
-        existing_delegate->handler_.IsEquivalent(handler)) {
-      infobar_service->ReplaceInfoBar(existing_infobar, infobar.Pass());
-      return;
-    }
-  }
-
-  infobar_service->AddInfoBar(infobar.Pass());
-}
-
-RegisterProtocolHandlerInfoBarDelegate::RegisterProtocolHandlerInfoBarDelegate(
-    ProtocolHandlerRegistry* registry,
-    const ProtocolHandler& handler)
-    : ConfirmInfoBarDelegate(),
-      registry_(registry),
-      handler_(handler) {
-}
-
-RegisterProtocolHandlerInfoBarDelegate::
-    ~RegisterProtocolHandlerInfoBarDelegate() {
-}
-
-infobars::InfoBarDelegate::Type
-RegisterProtocolHandlerInfoBarDelegate::GetInfoBarType() const {
-  return PAGE_ACTION_TYPE;
-}
-
-infobars::InfoBarDelegate::InfoBarAutomationType
-RegisterProtocolHandlerInfoBarDelegate::GetInfoBarAutomationType() const {
-  return RPH_INFOBAR;
-}
-
-RegisterProtocolHandlerInfoBarDelegate*
-    RegisterProtocolHandlerInfoBarDelegate::
-        AsRegisterProtocolHandlerInfoBarDelegate() {
-  return this;
-}
-
-base::string16 RegisterProtocolHandlerInfoBarDelegate::GetMessageText() const {
-  ProtocolHandler old_handler = registry_->GetHandlerFor(handler_.protocol());
-  return old_handler.IsEmpty() ?
-      l10n_util::GetStringFUTF16(
-          IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM,
-          base::UTF8ToUTF16(handler_.url().host()),
-          GetProtocolName(handler_)) :
-      l10n_util::GetStringFUTF16(
-          IDS_REGISTER_PROTOCOL_HANDLER_CONFIRM_REPLACE,
-          base::UTF8ToUTF16(handler_.url().host()),
-          GetProtocolName(handler_),
-          base::UTF8ToUTF16(old_handler.url().host()));
-}
-
-base::string16 RegisterProtocolHandlerInfoBarDelegate::GetButtonLabel(
-    InfoBarButton button) const {
-  return (button == BUTTON_OK) ?
-      l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_ACCEPT) :
-      l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_DENY);
-}
-
-bool RegisterProtocolHandlerInfoBarDelegate::OKButtonTriggersUACPrompt() const {
-  return ShellIntegration::IsElevationNeededForSettingDefaultProtocolClient();
-}
-
-bool RegisterProtocolHandlerInfoBarDelegate::Accept() {
-  content::RecordAction(
-      base::UserMetricsAction("RegisterProtocolHandler.Infobar_Accept"));
-  registry_->OnAcceptRegisterProtocolHandler(handler_);
-  return true;
-}
-
-bool RegisterProtocolHandlerInfoBarDelegate::Cancel() {
-  content::RecordAction(
-      base::UserMetricsAction("RegisterProtocolHandler.InfoBar_Deny"));
-  registry_->OnIgnoreRegisterProtocolHandler(handler_);
-  return true;
-}
-
-base::string16 RegisterProtocolHandlerInfoBarDelegate::GetLinkText() const {
-  return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
-}
-
-GURL RegisterProtocolHandlerInfoBarDelegate::GetLinkURL() const {
-  return GURL(chrome::kLearnMoreRegisterProtocolHandlerURL);
-}
-
-bool RegisterProtocolHandlerInfoBarDelegate::LinkClicked(
-    WindowOpenDisposition disposition) {
-  content::RecordAction(
-      base::UserMetricsAction("RegisterProtocolHandler.InfoBar_LearnMore"));
-  return ConfirmInfoBarDelegate::LinkClicked(disposition);
-}
-
-base::string16 RegisterProtocolHandlerInfoBarDelegate::GetProtocolName(
-    const ProtocolHandler& handler) const {
-  if (handler.protocol() == "mailto")
-    return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_MAILTO_NAME);
-  if (handler.protocol() == "webcal")
-    return l10n_util::GetStringUTF16(IDS_REGISTER_PROTOCOL_HANDLER_WEBCAL_NAME);
-  return base::UTF8ToUTF16(handler.protocol());
-}
diff --git a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h b/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h
deleted file mode 100644
index d64ab3e..0000000
--- a/chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_
-#define CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_
-
-#include "base/strings/string16.h"
-#include "chrome/common/custom_handlers/protocol_handler.h"
-#include "components/infobars/core/confirm_infobar_delegate.h"
-
-class InfoBarService;
-class ProtocolHandlerRegistry;
-
-// An InfoBar delegate that enables the user to allow or deny storing credit
-// card information gathered from a form submission.
-class RegisterProtocolHandlerInfoBarDelegate : public ConfirmInfoBarDelegate {
- public:
-  // Creates a new register protocol handler infobar and delegate.  Searches
-  // |infobar_service| for an existing infobar for the same |handler|; replaces
-  // it with the new infobar if found, otherwise adds the new infobar to
-  // |infobar_service|.
-  static void Create(InfoBarService* infobar_service,
-                     ProtocolHandlerRegistry* registry,
-                     const ProtocolHandler& handler);
-
- private:
-  RegisterProtocolHandlerInfoBarDelegate(ProtocolHandlerRegistry* registry,
-                                         const ProtocolHandler& handler);
-  ~RegisterProtocolHandlerInfoBarDelegate() override;
-
-  // ConfirmInfoBarDelegate:
-  Type GetInfoBarType() const override;
-  InfoBarAutomationType GetInfoBarAutomationType() const override;
-  RegisterProtocolHandlerInfoBarDelegate*
-      AsRegisterProtocolHandlerInfoBarDelegate() override;
-  base::string16 GetMessageText() const override;
-  base::string16 GetButtonLabel(InfoBarButton button) const override;
-  bool OKButtonTriggersUACPrompt() const override;
-  bool Accept() override;
-  bool Cancel() override;
-  base::string16 GetLinkText() const override;
-  GURL GetLinkURL() const override;
-  bool LinkClicked(WindowOpenDisposition disposition) override;
-
-  // Returns a user-friendly name for the protocol of this protocol handler.
-  base::string16 GetProtocolName(const ProtocolHandler& handler) const;
-
-  ProtocolHandlerRegistry* registry_;
-  ProtocolHandler handler_;
-
-  DISALLOW_COPY_AND_ASSIGN(RegisterProtocolHandlerInfoBarDelegate);
-};
-
-#endif  // CHROME_BROWSER_CUSTOM_HANDLERS_REGISTER_PROTOCOL_HANDLER_INFOBAR_DELEGATE_H_
diff --git a/chrome/browser/download/download_browsertest.cc b/chrome/browser/download/download_browsertest.cc
index f04c13f..9abd16f 100644
--- a/chrome/browser/download/download_browsertest.cc
+++ b/chrome/browser/download/download_browsertest.cc
@@ -2808,10 +2808,6 @@
     return;
 #endif
 
-  // Enable permision bubbles.
-  base::CommandLine::ForCurrentProcess()->AppendSwitch(
-      switches::kEnablePermissionsBubbles);
-
   // Create a downloads observer.
   scoped_ptr<content::DownloadTestObserver> downloads_observer(
         CreateWaiter(browser(), 2));
diff --git a/chrome/browser/download/download_request_limiter.cc b/chrome/browser/download/download_request_limiter.cc
index 32fb118..2daf485 100644
--- a/chrome/browser/download/download_request_limiter.cc
+++ b/chrome/browser/download/download_request_limiter.cc
@@ -8,11 +8,9 @@
 #include "base/stl_util.h"
 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
-#include "chrome/browser/download/download_permission_request.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/profiles/profile.h"
 #include "chrome/browser/tab_contents/tab_util.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "content/public/browser/browser_context.h"
 #include "content/public/browser/browser_thread.h"
@@ -28,6 +26,9 @@
 
 #if defined(OS_ANDROID)
 #include "chrome/browser/download/download_request_infobar_delegate.h"
+#else
+#include "chrome/browser/download/download_permission_request.h"
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #endif
 
 using content::BrowserThread;
@@ -98,11 +99,12 @@
     return;
   }
 
-  bool promptable = (InfoBarService::FromWebContents(web_contents()) != NULL);
-  if (PermissionBubbleManager::Enabled()) {
-    promptable =
-        (PermissionBubbleManager::FromWebContents(web_contents()) != NULL);
-  }
+#if defined(OS_ANDROID)
+  bool promptable = InfoBarService::FromWebContents(web_contents()) != nullptr;
+#else
+  bool promptable =
+      PermissionBubbleManager::FromWebContents(web_contents()) != nullptr;
+#endif
 
   // See PromptUserForDownload(): if there's no InfoBarService, then
   // DOWNLOADS_NOT_ALLOWED is functionally equivalent to PROMPT_BEFORE_DOWNLOAD.
diff --git a/chrome/browser/download/download_request_limiter_unittest.cc b/chrome/browser/download/download_request_limiter_unittest.cc
index 7b963a5b0..3931a9dd 100644
--- a/chrome/browser/download/download_request_limiter_unittest.cc
+++ b/chrome/browser/download/download_request_limiter_unittest.cc
@@ -7,8 +7,6 @@
 #include "base/bind.h"
 #include "base/command_line.h"
 #include "base/run_loop.h"
-#include "chrome/browser/download/download_permission_request.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_profile.h"
@@ -22,12 +20,16 @@
 #if defined(OS_ANDROID)
 #include "chrome/browser/download/download_request_infobar_delegate.h"
 #include "chrome/browser/infobars/infobar_service.h"
+#else
+#include "chrome/browser/download/download_permission_request.h"
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #endif
 
 using content::WebContents;
 
 class DownloadRequestLimiterTest;
 
+#if !defined(OS_ANDROID)
 class FakePermissionBubbleView : public PermissionBubbleView {
  public:
   class Factory : public base::RefCounted<FakePermissionBubbleView::Factory> {
@@ -73,6 +75,7 @@
   DownloadRequestLimiterTest* test_;
   Delegate* delegate_;
 };
+#endif
 
 class DownloadRequestLimiterTest : public ChromeRenderViewHostTestHarness {
  public:
@@ -86,15 +89,15 @@
     ChromeRenderViewHostTestHarness::SetUp();
     profile_.reset(new TestingProfile());
 
-    if (PermissionBubbleManager::Enabled()) {
-      PermissionBubbleManager::CreateForWebContents(web_contents());
-      scoped_refptr<FakePermissionBubbleView::Factory> factory =
-          new FakePermissionBubbleView::Factory(this);
-      PermissionBubbleManager::FromWebContents(web_contents())->view_factory_ =
-          base::Bind(&FakePermissionBubbleView::Factory::Create, factory);
-      PermissionBubbleManager::FromWebContents(web_contents())
-          ->DisplayPendingRequests();
-    }
+#if !defined(OS_ANDROID)
+    PermissionBubbleManager::CreateForWebContents(web_contents());
+    scoped_refptr<FakePermissionBubbleView::Factory> factory =
+        new FakePermissionBubbleView::Factory(this);
+    PermissionBubbleManager::FromWebContents(web_contents())->view_factory_ =
+        base::Bind(&FakePermissionBubbleView::Factory::Create, factory);
+    PermissionBubbleManager::FromWebContents(web_contents())
+        ->DisplayPendingRequests();
+#endif
 
     testing_action_ = ACCEPT;
     ask_allow_count_ = cancel_count_ = continue_count_ = 0;
@@ -236,6 +239,7 @@
   scoped_ptr<TestingProfile> profile_;
 };
 
+#if !defined(OS_ANDROID)
 void FakePermissionBubbleView::Show(
     const std::vector<PermissionBubbleRequest*>& requests,
     const std::vector<bool>& accept_state) {
@@ -251,6 +255,7 @@
     delegate_->Closing();
   }
 }
+#endif
 
 TEST_F(DownloadRequestLimiterTest, DownloadRequestLimiter_Allow) {
   BubbleManagerDocumentLoadCompleted();
diff --git a/chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc b/chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc
index 2ccd614..f83a6f6 100644
--- a/chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc
+++ b/chrome/browser/extensions/api/tab_capture/offscreen_presentation.cc
@@ -138,25 +138,17 @@
   return FromWebContents(extension_web_contents);
 }
 
-OffscreenPresentation* OffscreenPresentationsOwner::FindOrStartPresentation(
+OffscreenPresentation* OffscreenPresentationsOwner::StartPresentation(
     const GURL& start_url,
     const std::string& presentation_id,
     const gfx::Size& initial_size) {
-  OffscreenPresentation* presentation =
-      FindPresentation(start_url, presentation_id);
-  if (presentation) {
-    DVLOG(1) << "Returning already-running OffscreenPresentation for start_url="
-             << presentation->start_url();
-    return presentation;
-  }
-
   if (presentations_.size() >= kMaxPresentationsPerExtension)
     return nullptr;  // Maximum number of presentations reached.
 
-  presentation = new OffscreenPresentation(this, start_url, presentation_id);
-  presentations_.push_back(presentation);
-  presentation->Start(initial_size);
-  return presentation;
+  presentations_.push_back(
+      new OffscreenPresentation(this, start_url, presentation_id));
+  presentations_.back()->Start(initial_size);
+  return presentations_.back();
 }
 
 void OffscreenPresentationsOwner::ClosePresentation(
@@ -167,16 +159,6 @@
     presentations_.erase(it);
 }
 
-OffscreenPresentation* OffscreenPresentationsOwner::FindPresentation(
-    const GURL& start_url, const std::string& presentation_id) const {
-  for (OffscreenPresentation* presentation : presentations_) {
-    if (presentation->start_url() == start_url &&
-        presentation->presentation_id() == presentation_id)
-      return presentation;
-  }
-  return nullptr;
-}
-
 OffscreenPresentation::OffscreenPresentation(OffscreenPresentationsOwner* owner,
                                              const GURL& start_url,
                                              const std::string& id)
@@ -219,6 +201,13 @@
   // automatically unmuted, but will be captured into the MediaStream.
   presentation_web_contents_->SetAudioMuted(true);
 
+  // TODO(imcheng): If |presentation_id_| is not empty, register it with the
+  // PresentationRouter.  http://crbug.com/513859
+  if (!presentation_id_.empty()) {
+    NOTIMPLEMENTED()
+        << "Register with PresentationRouter, id=" << presentation_id_;
+  }
+
   // Navigate to the initial URL of the presentation.
   content::NavigationController::LoadURLParams load_params(start_url_);
   load_params.should_replace_current_entry = true;
@@ -381,14 +370,12 @@
   // WebContents.
   content::BrowserContext* const extension_browser_context =
       owner_->extension_web_contents()->GetBrowserContext();
-  std::string extension_id;
-  for (const ExtensionHost* host :
-           ProcessManager::Get(extension_browser_context)->background_hosts()) {
-    if (host->host_contents() == owner_->extension_web_contents()) {
-      extension_id = host->extension_id();
-      break;
-    }
-  }
+  const extensions::Extension* const extension =
+      ProcessManager::Get(extension_browser_context)->
+          GetExtensionForWebContents(owner_->extension_web_contents());
+  const std::string extension_id = extension ? extension->id() : "";
+  LOG_IF(DFATAL, extension_id.empty())
+      << "Extension that started this OffscreenPresentation was not found.";
 
   // If verified, allow any tab capture audio/video devices that were requested.
   extensions::TabCaptureRegistry* const tab_capture_registry =
diff --git a/chrome/browser/extensions/api/tab_capture/offscreen_presentation.h b/chrome/browser/extensions/api/tab_capture/offscreen_presentation.h
index 03ca5c22..6efa294 100644
--- a/chrome/browser/extensions/api/tab_capture/offscreen_presentation.h
+++ b/chrome/browser/extensions/api/tab_capture/offscreen_presentation.h
@@ -20,6 +20,9 @@
 
 namespace extensions {
 
+// TODO(miu): This file and classes should be renamed, as this implementation
+// has expanded in scope to be used for all off-screen tabs.
+
 class OffscreenPresentation;  // Forward declaration.  See below.
 
 // Creates, owns, and manages all OffscreenPresentation instances created by the
@@ -31,7 +34,7 @@
 // Usage:
 //
 //   OffscreenPresentationsOwner::Get(extension_contents)
-//       ->FindOrStartPresentation(start_url, presentation_id, size);
+//       ->StartPresentation(start_url, presentation_id, size);
 //
 // This class operates exclusively on the UI thread and so is not thread-safe.
 class OffscreenPresentationsOwner
@@ -44,12 +47,14 @@
   static OffscreenPresentationsOwner* Get(
       content::WebContents* extension_web_contents);
 
-  // Find a presentation, keyed by |start_url| and |presentation_id|.  If found,
-  // return it.  Otherwise, instantiate a new one and return that.  If too many
-  // presentations have already been started, this method returns nullptr.
-  OffscreenPresentation* FindOrStartPresentation(
+  // Instantiate a new off-screen tab, navigate it to |start_url|, and register
+  // it with the presentation router using |presentation_id| (if a non-empty
+  // string).  The new tab's main frame will start out with the given
+  // |initial_size| in DIP coordinates.  If too many off-screen tabs have
+  // already been started, this method returns nullptr.
+  OffscreenPresentation* StartPresentation(
       const GURL& start_url,
-      const std::string& presentation_id,
+      const std::string& optional_presentation_id,
       const gfx::Size& initial_size);
 
  protected:
@@ -68,11 +73,6 @@
 
   explicit OffscreenPresentationsOwner(content::WebContents* contents);
 
-  // Returns the OffscreenPresentation that matches the given |start_url| and
-  // |presentation_id|, or nullptr if not found.
-  OffscreenPresentation* FindPresentation(
-      const GURL& start_url, const std::string& presentation_id) const;
-
   content::WebContents* const extension_web_contents_;
   ScopedVector<OffscreenPresentation> presentations_;
 
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
index 5760530..2e76e2a 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.cc
@@ -6,6 +6,7 @@
 
 #include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h"
 
+#include <algorithm>
 #include <set>
 #include <string>
 #include <vector>
@@ -13,6 +14,7 @@
 #include "base/command_line.h"
 #include "base/strings/stringprintf.h"
 #include "base/values.h"
+#include "chrome/browser/extensions/api/tab_capture/offscreen_presentation.h"
 #include "chrome/browser/extensions/api/tab_capture/tab_capture_registry.h"
 #include "chrome/browser/extensions/extension_renderer_state.h"
 #include "chrome/browser/profiles/profile.h"
@@ -20,8 +22,10 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_finder.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_switches.h"
 #include "content/public/browser/render_frame_host.h"
 #include "content/public/browser/render_process_host.h"
+#include "content/public/browser/web_contents.h"
 #include "extensions/common/features/feature.h"
 #include "extensions/common/features/feature_provider.h"
 #include "extensions/common/features/simple_feature.h"
@@ -43,7 +47,17 @@
     "Extension has not been invoked for the current page (see activeTab "
     "permission). Chrome pages cannot be captured.";
 
-// Keys/values for media stream constraints.
+const char kNotWhitelistedForOffscreenTabApi[] =
+    "Extension is not whitelisted for use of the unstable, in-development "
+    "chrome.tabCapture.captureOffscreenTab API.";
+const char kInvalidStartUrl[] =
+    "Invalid/Missing/Malformatted starting URL for off-screen tab.";
+const char kTooManyOffscreenTabs[] =
+    "Extension has already started too many off-screen tabs.";
+const char kCapturingSameOffscreenTab[] =
+    "Cannot capture the same off-screen tab more than once.";
+
+// Keys/values passed to renderer-side JS bindings.
 const char kMediaStreamSource[] = "chromeMediaSource";
 const char kMediaStreamSourceId[] = "chromeMediaSourceId";
 const char kMediaStreamSourceTab[] = "tab";
@@ -52,6 +66,70 @@
 // throttling mode in the capture pipeline.
 const char kEnableAutoThrottlingKey[] = "enableAutoThrottling";
 
+bool OptionsSpecifyAudioOrVideo(const TabCapture::CaptureOptions& options) {
+  return (options.audio && *options.audio) || (options.video && *options.video);
+}
+
+bool IsAcceptableOffscreenTabUrl(const GURL& url) {
+  return url.is_valid() && (url.SchemeIsHTTPOrHTTPS() || url.SchemeIs("data"));
+}
+
+// Add Chrome-specific source identifiers to the MediaStreamConstraints objects
+// in |options| to provide references to the |target_contents| to be captured.
+void AddMediaStreamSourceConstraints(content::WebContents* target_contents,
+                                     TabCapture::CaptureOptions* options) {
+  DCHECK(options);
+  DCHECK(target_contents);
+
+  MediaStreamConstraint* constraints_to_modify[2] = { nullptr, nullptr };
+
+  if (options->audio && *options->audio) {
+    if (!options->audio_constraints)
+      options->audio_constraints.reset(new MediaStreamConstraint);
+    constraints_to_modify[0] = options->audio_constraints.get();
+  }
+
+  bool enable_auto_throttling = false;
+  if (options->video && *options->video) {
+    if (options->video_constraints) {
+      // Check for the Tab Capture-specific video constraint for enabling
+      // automatic resolution/rate throttling mode in the capture pipeline.  See
+      // implementation comments for content::WebContentsVideoCaptureDevice.
+      base::DictionaryValue& props =
+          options->video_constraints->mandatory.additional_properties;
+      if (!props.GetBooleanWithoutPathExpansion(
+              kEnableAutoThrottlingKey, &enable_auto_throttling)) {
+        enable_auto_throttling = false;
+      }
+      // Remove the key from the properties to avoid an "unrecognized
+      // constraint" error in the renderer.
+      props.RemoveWithoutPathExpansion(kEnableAutoThrottlingKey, nullptr);
+    } else {
+      options->video_constraints.reset(new MediaStreamConstraint);
+    }
+    constraints_to_modify[1] = options->video_constraints.get();
+  }
+
+  // Format the device ID that references the target tab.
+  content::RenderFrameHost* const main_frame = target_contents->GetMainFrame();
+  // TODO(miu): We should instead use a "randomly generated device ID" scheme,
+  // like that employed by the desktop capture API.  http://crbug.com/163100
+  const std::string device_id = base::StringPrintf(
+      "web-contents-media-stream://%i:%i%s",
+      main_frame->GetProcess()->GetID(),
+      main_frame->GetRoutingID(),
+      enable_auto_throttling ? "?throttling=auto" : "");
+
+  // Append chrome specific tab constraints.
+  for (MediaStreamConstraint* msc : constraints_to_modify) {
+    if (!msc)
+      continue;
+    base::DictionaryValue* constraint = &msc->mandatory.additional_properties;
+    constraint->SetString(kMediaStreamSource, kMediaStreamSourceTab);
+    constraint->SetString(kMediaStreamSourceId, device_id);
+  }
+}
+
 }  // namespace
 
 // Whitelisted extensions that do not check for a browser action grant because
@@ -78,7 +156,7 @@
 bool TabCaptureCaptureFunction::RunSync() {
   scoped_ptr<api::tab_capture::Capture::Params> params =
       TabCapture::Capture::Params::Create(*args_);
-  EXTENSION_FUNCTION_VALIDATE(params.get());
+  EXTENSION_FUNCTION_VALIDATE(params);
 
   // Figure out the active WebContents and retrieve the needed ids.
   Browser* target_browser = chrome::FindAnyBrowser(
@@ -112,76 +190,30 @@
     return false;
   }
 
-  // Create a constraints vector. We will modify all the constraints in this
-  // vector to append our chrome specific constraints.
-  std::vector<MediaStreamConstraint*> constraints;
-  bool has_audio = params->options.audio.get() && *params->options.audio.get();
-  bool has_video = params->options.video.get() && *params->options.video.get();
-
-  if (!has_audio && !has_video) {
+  if (!OptionsSpecifyAudioOrVideo(params->options)) {
     error_ = kNoAudioOrVideo;
     return false;
   }
 
-  if (has_audio) {
-    if (!params->options.audio_constraints.get())
-      params->options.audio_constraints.reset(new MediaStreamConstraint);
-
-    constraints.push_back(params->options.audio_constraints.get());
-  }
-
-  bool enable_auto_throttling = false;
-  if (has_video) {
-    if (params->options.video_constraints.get()) {
-      // Check for the Tab Capture-specific video constraint for enabling
-      // automatic resolution/rate throttling mode in the capture pipeline.  See
-      // implementation comments for content::WebContentsVideoCaptureDevice.
-      base::DictionaryValue& props =
-          params->options.video_constraints->mandatory.additional_properties;
-      if (!props.GetBooleanWithoutPathExpansion(
-              kEnableAutoThrottlingKey, &enable_auto_throttling)) {
-        enable_auto_throttling = false;
-      }
-      // Remove the key from the properties to avoid an "unrecognized
-      // constraint" error in the renderer.
-      props.RemoveWithoutPathExpansion(kEnableAutoThrottlingKey, nullptr);
-    } else {
-      params->options.video_constraints.reset(new MediaStreamConstraint);
-    }
-
-    constraints.push_back(params->options.video_constraints.get());
-  }
-
-  // Device id we use for Tab Capture.
-  content::RenderFrameHost* const main_frame = target_contents->GetMainFrame();
-  // TODO(miu): We should instead use a "randomly generated device ID" scheme,
-  // like that employed by the desktop capture API.  http://crbug.com/163100
-  const std::string device_id = base::StringPrintf(
-      "web-contents-media-stream://%i:%i%s",
-      main_frame->GetProcess()->GetID(),
-      main_frame->GetRoutingID(),
-      enable_auto_throttling ? "?throttling=auto" : "");
-
-  // Append chrome specific tab constraints.
-  for (std::vector<MediaStreamConstraint*>::iterator it = constraints.begin();
-       it != constraints.end(); ++it) {
-    base::DictionaryValue* constraint = &(*it)->mandatory.additional_properties;
-    constraint->SetString(kMediaStreamSource, kMediaStreamSourceTab);
-    constraint->SetString(kMediaStreamSourceId, device_id);
-  }
-
   TabCaptureRegistry* registry = TabCaptureRegistry::Get(GetProfile());
-  if (!registry->AddRequest(target_contents, extension_id)) {
+  if (!registry->AddRequest(target_contents, extension_id, false)) {
+    // TODO(miu): Allow multiple consumers of single tab capture.
+    // http://crbug.com/535336
     error_ = kCapturingSameTab;
     return false;
   }
+  AddMediaStreamSourceConstraints(target_contents, &params->options);
 
-  // Copy the result from our modified input parameters. This will be
-  // intercepted by custom bindings which will build and send the special
-  // WebRTC user media request.
+  // At this point, everything is set up in the browser process.  It's now up to
+  // the custom JS bindings in the extension's render process to request a
+  // MediaStream using navigator.webkitGetUserMedia().  The result dictionary,
+  // passed to SetResult() here, contains the extra "hidden options" that will
+  // allow the Chrome platform implementation for getUserMedia() to start the
+  // virtual audio/video capture devices and set up all the data flows.  The
+  // custom JS bindings can be found here:
+  // chrome/renderer/resources/extensions/tab_capture_custom_bindings.js
   base::DictionaryValue* result = new base::DictionaryValue();
   result->MergeDictionary(params->options.ToValue().get());
-
   SetResult(result);
   return true;
 }
@@ -195,4 +227,120 @@
   return true;
 }
 
+bool TabCaptureCaptureOffscreenTabFunction::RunSync() {
+  scoped_ptr<TabCapture::CaptureOffscreenTab::Params> params =
+      TabCapture::CaptureOffscreenTab::Params::Create(*args_);
+  EXTENSION_FUNCTION_VALIDATE(params);
+
+  // Make sure the extension is whitelisted for using this API, regardless of
+  // Chrome channel.
+  //
+  // TODO(miu): Use _api_features.json and extensions::Feature library instead.
+  // http://crbug.com/537732
+  const bool is_whitelisted_extension =
+      base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+          switches::kWhitelistedExtensionID) == extension()->id() ||
+      SimpleFeature::IsIdInArray(extension()->id(), kChromecastExtensionIds,
+                                 arraysize(kChromecastExtensionIds)) ||
+      SimpleFeature::IsIdInArray(extension()->id(), kMediaRouterExtensionIds,
+                                 arraysize(kMediaRouterExtensionIds));
+  if (!is_whitelisted_extension) {
+    error_ = kNotWhitelistedForOffscreenTabApi;
+    return false;
+  }
+
+  const GURL start_url(params->start_url);
+  if (!IsAcceptableOffscreenTabUrl(start_url)) {
+    SetError(kInvalidStartUrl);
+    return false;
+  }
+
+  if (!OptionsSpecifyAudioOrVideo(params->options)) {
+    SetError(kNoAudioOrVideo);
+    return false;
+  }
+
+  content::WebContents* const extension_web_contents = GetSenderWebContents();
+  EXTENSION_FUNCTION_VALIDATE(extension_web_contents);
+  OffscreenPresentation* const offscreen_tab =
+      OffscreenPresentationsOwner::Get(extension_web_contents)
+          ->StartPresentation(
+              start_url,
+              (is_whitelisted_extension && params->options.presentation_id) ?
+                  *params->options.presentation_id : std::string(),
+              DetermineInitialSize(params->options));
+  if (!offscreen_tab) {
+    SetError(kTooManyOffscreenTabs);
+    return false;
+  }
+
+  if (!TabCaptureRegistry::Get(browser_context())->AddRequest(
+          offscreen_tab->web_contents(), extension()->id(), true)) {
+    // TODO(miu): Allow multiple consumers of single tab capture.
+    // http://crbug.com/535336
+    SetError(kCapturingSameOffscreenTab);
+    return false;
+  }
+  AddMediaStreamSourceConstraints(offscreen_tab->web_contents(),
+                                  &params->options);
+
+  // At this point, everything is set up in the browser process.  It's now up to
+  // the custom JS bindings in the extension's render process to complete the
+  // request.  See the comment at end of TabCaptureCaptureFunction::RunSync()
+  // for more details.
+  base::DictionaryValue* const result = new base::DictionaryValue();
+  result->MergeDictionary(params->options.ToValue().get());
+  SetResult(result);
+  return true;
+}
+
+// static
+gfx::Size TabCaptureCaptureOffscreenTabFunction::DetermineInitialSize(
+    const TabCapture::CaptureOptions& options) {
+  static const int kDefaultWidth = 1280;
+  static const int kDefaultHeight = 720;
+
+  if (!options.video_constraints)
+    return gfx::Size(kDefaultWidth, kDefaultHeight);
+
+  gfx::Size min_size;
+  int width = -1;
+  int height = -1;
+  const base::DictionaryValue& mandatory_properties =
+      options.video_constraints->mandatory.additional_properties;
+  if (mandatory_properties.GetInteger("maxWidth", &width) && width >= 0 &&
+      mandatory_properties.GetInteger("maxHeight", &height) && height >= 0) {
+    return gfx::Size(width, height);
+  }
+  if (mandatory_properties.GetInteger("minWidth", &width) && width >= 0 &&
+      mandatory_properties.GetInteger("minHeight", &height) && height >= 0) {
+    min_size.SetSize(width, height);
+  }
+
+  // Use optional size constraints if no mandatory ones were provided.
+  if (options.video_constraints->optional) {
+    const base::DictionaryValue& optional_properties =
+        options.video_constraints->optional->additional_properties;
+    if (optional_properties.GetInteger("maxWidth", &width) && width >= 0 &&
+        optional_properties.GetInteger("maxHeight", &height) && height >= 0) {
+      if (min_size.IsEmpty()) {
+        return gfx::Size(width, height);
+      } else {
+        return gfx::Size(std::max(width, min_size.width()),
+                         std::max(height, min_size.height()));
+      }
+    }
+    if (min_size.IsEmpty() &&
+        optional_properties.GetInteger("minWidth", &width) && width >= 0 &&
+        optional_properties.GetInteger("minHeight", &height) && height >= 0) {
+      min_size.SetSize(width, height);
+    }
+  }
+
+  // No maximum size was provided, so just return the default size bounded by
+  // the minimum size.
+  return gfx::Size(std::max(kDefaultWidth, min_size.width()),
+                   std::max(kDefaultHeight, min_size.height()));
+}
+
 }  // namespace extensions
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_api.h b/chrome/browser/extensions/api/tab_capture/tab_capture_api.h
index baba0ee8..7e60470 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_api.h
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_api.h
@@ -21,11 +21,11 @@
  public:
   DECLARE_EXTENSION_FUNCTION("tabCapture.capture", TABCAPTURE_CAPTURE)
 
- protected:
-  ~TabCaptureCaptureFunction() override {}
+ private:
+  ~TabCaptureCaptureFunction() final {}
 
   // ExtensionFunction:
-  bool RunSync() override;
+  bool RunSync() final;
 };
 
 class TabCaptureGetCapturedTabsFunction : public ChromeSyncExtensionFunction {
@@ -33,11 +33,28 @@
   DECLARE_EXTENSION_FUNCTION("tabCapture.getCapturedTabs",
                              TABCAPTURE_GETCAPTUREDTABS)
 
- protected:
-  ~TabCaptureGetCapturedTabsFunction() override {}
+ private:
+  ~TabCaptureGetCapturedTabsFunction() final {}
 
   // ExtensionFunction:
-  bool RunSync() override;
+  bool RunSync() final;
+};
+
+class TabCaptureCaptureOffscreenTabFunction : public SyncExtensionFunction {
+ public:
+  DECLARE_EXTENSION_FUNCTION("tabCapture.captureOffscreenTab",
+                             TABCAPTURE_CAPTUREOFFSCREENTAB)
+
+  // Examines the min/max width/height constraints in the |options| to determine
+  // a suitable initial off-screen tab size.
+  static gfx::Size DetermineInitialSize(
+      const extensions::api::tab_capture::CaptureOptions& options);
+
+ private:
+  ~TabCaptureCaptureOffscreenTabFunction() final {}
+
+  // ExtensionFunction:
+  bool RunSync() final;
 };
 
 }  // namespace extensions
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
index e618eeac..786554d 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
@@ -9,6 +9,7 @@
 #include "base/strings/stringprintf.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/time/time.h"
+#include "chrome/browser/extensions/api/tab_capture/tab_capture_api.h"
 #include "chrome/browser/extensions/extension_apitest.h"
 #include "chrome/browser/extensions/tab_helper.h"
 #include "chrome/browser/profiles/profile.h"
@@ -89,12 +90,89 @@
   }
 };
 
+// Tests the logic that examines the constraints to determine the starting
+// off-screen tab size.
+TEST(TabCaptureCaptureOffscreenTabTest, DetermineInitialSize) {
+  using extensions::api::tab_capture::CaptureOptions;
+  using extensions::api::tab_capture::MediaStreamConstraint;
+
+  // Empty options --> 1280x720
+  CaptureOptions options;
+  EXPECT_EQ(gfx::Size(1280, 720),
+            TabCaptureCaptureOffscreenTabFunction::DetermineInitialSize(
+                options));
+
+  // Use specified mandatory maximum size.
+  options.video_constraints.reset(new MediaStreamConstraint());
+  base::DictionaryValue* properties =
+      &options.video_constraints->mandatory.additional_properties;
+  properties->SetInteger("maxWidth", 123);
+  properties->SetInteger("maxHeight", 456);
+  EXPECT_EQ(gfx::Size(123, 456),
+            TabCaptureCaptureOffscreenTabFunction::DetermineInitialSize(
+                options));
+
+  // Use default size if larger than mandatory minimum size.  Else, use
+  // mandatory minimum size.
+  options.video_constraints.reset(new MediaStreamConstraint());
+  properties = &options.video_constraints->mandatory.additional_properties;
+  properties->SetInteger("minWidth", 123);
+  properties->SetInteger("minHeight", 456);
+  EXPECT_EQ(gfx::Size(1280, 720),
+            TabCaptureCaptureOffscreenTabFunction::DetermineInitialSize(
+                options));
+  properties->SetInteger("minWidth", 2560);
+  properties->SetInteger("minHeight", 1440);
+  EXPECT_EQ(gfx::Size(2560, 1440),
+            TabCaptureCaptureOffscreenTabFunction::DetermineInitialSize(
+                options));
+
+  // Use specified optional maximum size, if no mandatory size was specified.
+  options.video_constraints.reset(new MediaStreamConstraint());
+  options.video_constraints->optional.reset(
+      new MediaStreamConstraint::Optional());
+  properties = &options.video_constraints->optional->additional_properties;
+  properties->SetInteger("maxWidth", 456);
+  properties->SetInteger("maxHeight", 123);
+  EXPECT_EQ(gfx::Size(456, 123),
+            TabCaptureCaptureOffscreenTabFunction::DetermineInitialSize(
+                options));
+  // ...unless a mandatory minimum size was specified:
+  options.video_constraints->mandatory.additional_properties.SetInteger(
+      "minWidth", 500);
+  options.video_constraints->mandatory.additional_properties.SetInteger(
+      "minHeight", 600);
+  EXPECT_EQ(gfx::Size(500, 600),
+            TabCaptureCaptureOffscreenTabFunction::DetermineInitialSize(
+                options));
+
+  // Use default size if larger than optional minimum size.  Else, use optional
+  // minimum size.
+  options.video_constraints.reset(new MediaStreamConstraint());
+  options.video_constraints->optional.reset(
+      new MediaStreamConstraint::Optional());
+  properties = &options.video_constraints->optional->additional_properties;
+  properties->SetInteger("minWidth", 9999);
+  properties->SetInteger("minHeight", 8888);
+  EXPECT_EQ(gfx::Size(9999, 8888),
+            TabCaptureCaptureOffscreenTabFunction::DetermineInitialSize(
+                options));
+}
+
 // Tests API behaviors, including info queries, and constraints violations.
 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, ApiTests) {
   AddExtensionToCommandLineWhitelist();
   ASSERT_TRUE(RunExtensionSubtest("tab_capture", "api_tests.html")) << message_;
 }
 
+// Tests that there is a maximum limitation to the number of simultaneous
+// off-screen tabs.
+IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MaxOffscreenTabs) {
+  AddExtensionToCommandLineWhitelist();
+  ASSERT_TRUE(RunExtensionSubtest("tab_capture", "max_offscreen_tabs.html"))
+      << message_;
+}
+
 // Tests that tab capture video frames can be received in a VIDEO element.
 IN_PROC_BROWSER_TEST_F(TabCaptureApiPixelTest, EndToEndWithoutRemoting) {
   if (IsTooIntensiveForThisPlatform()) {
@@ -122,6 +200,29 @@
       << message_;
 }
 
+// Tests that tab capture video frames can be received in a VIDEO element from
+// an off-screen tab.
+IN_PROC_BROWSER_TEST_F(TabCaptureApiPixelTest, OffscreenTabEndToEnd) {
+  if (IsTooIntensiveForThisPlatform()) {
+    LOG(WARNING) << "Skipping this CPU-intensive test on this platform/build.";
+    return;
+  }
+  AddExtensionToCommandLineWhitelist();
+  ASSERT_TRUE(RunExtensionSubtest("tab_capture", "offscreen_end_to_end.html"))
+      << message_;
+}
+
+// Tests that off-screen tabs can't do evil things (e.g., access local files).
+IN_PROC_BROWSER_TEST_F(TabCaptureApiPixelTest, OffscreenTabEvilTests) {
+  if (IsTooIntensiveForThisPlatform()) {
+    LOG(WARNING) << "Skipping this CPU-intensive test on this platform/build.";
+    return;
+  }
+  AddExtensionToCommandLineWhitelist();
+  ASSERT_TRUE(RunExtensionSubtest("tab_capture", "offscreen_evil_tests.html"))
+      << message_;
+}
+
 // http://crbug.com/177163
 #if defined(OS_WIN) && !defined(NDEBUG)
 #define MAYBE_GetUserMediaTest DISABLED_GetUserMediaTest
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
index 866f6cea..d67a1be 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.cc
@@ -30,9 +30,11 @@
  public:
   LiveRequest(content::WebContents* target_contents,
               const std::string& extension_id,
+              bool is_anonymous,
               TabCaptureRegistry* registry)
       : content::WebContentsObserver(target_contents),
         extension_id_(extension_id),
+        is_anonymous_(is_anonymous),
         registry_(registry),
         capture_state_(tab_capture::TAB_CAPTURE_STATE_NONE),
         is_verified_(false),
@@ -51,6 +53,9 @@
   const std::string& extension_id() const {
     return extension_id_;
   }
+  bool is_anonymous() const {
+    return is_anonymous_;
+  }
   TabCaptureState capture_state() const {
     return capture_state_;
   }
@@ -120,6 +125,7 @@
 
  private:
   const std::string extension_id_;
+  const bool is_anonymous_;
   TabCaptureRegistry* const registry_;
   TabCaptureState capture_state_;
   bool is_verified_;
@@ -164,13 +170,13 @@
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   DCHECK(list_of_capture_info);
   list_of_capture_info->Clear();
-  for (ScopedVector<LiveRequest>::const_iterator it = requests_.begin();
-       it != requests_.end(); ++it) {
-    if ((*it)->is_verified() && (*it)->extension_id() == extension_id) {
-      tab_capture::CaptureInfo info;
-      (*it)->GetCaptureInfo(&info);
-      list_of_capture_info->Append(info.ToValue().release());
-    }
+  for (const LiveRequest* request : requests_) {
+    if (request->is_anonymous() || !request->is_verified() ||
+        request->extension_id() != extension_id)
+      continue;
+    tab_capture::CaptureInfo info;
+    request->GetCaptureInfo(&info);
+    list_of_capture_info->Append(info.ToValue().release());
   }
 }
 
@@ -190,7 +196,8 @@
 }
 
 bool TabCaptureRegistry::AddRequest(content::WebContents* target_contents,
-                                    const std::string& extension_id) {
+                                    const std::string& extension_id,
+                                    bool is_anonymous) {
   LiveRequest* const request = FindRequest(target_contents);
 
   // Currently, we do not allow multiple active captures for same tab.
@@ -204,7 +211,8 @@
     }
   }
 
-  requests_.push_back(new LiveRequest(target_contents, extension_id, this));
+  requests_.push_back(
+      new LiveRequest(target_contents, extension_id, is_anonymous, this));
   return true;
 }
 
@@ -305,6 +313,9 @@
 
 void TabCaptureRegistry::DispatchStatusChangeEvent(
     const LiveRequest* request) const {
+  if (request->is_anonymous())
+    return;
+
   EventRouter* router = EventRouter::Get(browser_context_);
   if (!router)
     return;
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h
index 60d5f2b..b953f25 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_registry.h
@@ -49,9 +49,16 @@
   // Add a tab capture request to the registry when a stream is requested
   // through the API.  |target_contents| refers to the WebContents associated
   // with the tab to be captured.  |extension_id| refers to the Extension
-  // initiating the request.
+  // initiating the request.  |is_anonymous| is true if GetCapturedTabs() should
+  // not list the captured tab, and no status change events should be dispatched
+  // for it.
+  //
+  // TODO(miu): This is broken in that it's possible for a later WebContents
+  // instance to have the same pointer value as a previously-destroyed one.  To
+  // be fixed while working on http://crbug.com/163100.
   bool AddRequest(content::WebContents* target_contents,
-                  const std::string& extension_id);
+                  const std::string& extension_id,
+                  bool is_anonymous);
 
   // Called by MediaStreamDevicesController to verify the request before
   // creating the stream.  |render_process_id| and |render_frame_id| are used to
diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
index 054fb30..e33acba 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -23,8 +23,6 @@
 #include "chrome/browser/geolocation/geolocation_permission_context_factory.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/permissions/permission_request_id.h"
-#include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "chrome/browser/ui/website_settings/permission_bubble_request.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
@@ -50,6 +48,9 @@
 #include "base/prefs/pref_service.h"
 #include "chrome/browser/android/mock_location_settings.h"
 #include "chrome/browser/geolocation/geolocation_permission_context_android.h"
+#else
+#include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h"
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #endif
 
 #if defined(ENABLE_EXTENSIONS)
@@ -142,14 +143,15 @@
   void AddNewTab(const GURL& url);
   void CheckTabContentsState(const GURL& requesting_frame,
                              ContentSetting expected_content_setting);
+#if !defined(OS_ANDROID)
   size_t GetBubblesQueueSize(PermissionBubbleManager* manager);
   void AcceptBubble(PermissionBubbleManager* manager);
   void DenyBubble(PermissionBubbleManager* manager);
   void CloseBubble(PermissionBubbleManager* manager);
+#endif
   void BubbleManagerDocumentLoadCompleted();
   void BubbleManagerDocumentLoadCompleted(content::WebContents* web_contents);
   ContentSetting GetGeolocationContentSetting(GURL frame_0, GURL frame_1);
-  bool BubbleEnabled() const;
   size_t GetNumberOfPrompts();
   void AcceptPrompt();
   base::string16 GetPromptText();
@@ -237,14 +239,15 @@
 #if defined(ENABLE_EXTENSIONS)
   extensions::SetViewType(new_tab, extensions::VIEW_TYPE_TAB_CONTENTS);
 #endif
+#if defined(OS_ANDROID)
   InfoBarService::CreateForWebContents(new_tab);
-  if (BubbleEnabled()) {
-    PermissionBubbleManager::CreateForWebContents(new_tab);
-    PermissionBubbleManager* permission_bubble_manager =
-        PermissionBubbleManager::FromWebContents(new_tab);
-    MockPermissionBubbleView::SetFactory(permission_bubble_manager, false);
-    permission_bubble_manager->DisplayPendingRequests();
-  }
+#else
+  PermissionBubbleManager::CreateForWebContents(new_tab);
+  PermissionBubbleManager* permission_bubble_manager =
+      PermissionBubbleManager::FromWebContents(new_tab);
+  MockPermissionBubbleView::SetFactory(permission_bubble_manager, false);
+  permission_bubble_manager->DisplayPendingRequests();
+#endif
 
   extra_tabs_.push_back(new_tab);
 }
@@ -282,14 +285,13 @@
       ->SetLocationSettingsForTesting(
           scoped_ptr<LocationSettings>(new MockLocationSettings()));
   MockLocationSettings::SetLocationStatus(true, true);
+#else
+  PermissionBubbleManager::CreateForWebContents(web_contents());
+  PermissionBubbleManager* permission_bubble_manager =
+      PermissionBubbleManager::FromWebContents(web_contents());
+  MockPermissionBubbleView::SetFactory(permission_bubble_manager, false);
+  permission_bubble_manager->DisplayPendingRequests();
 #endif
-  if (BubbleEnabled()) {
-    PermissionBubbleManager::CreateForWebContents(web_contents());
-    PermissionBubbleManager* permission_bubble_manager =
-        PermissionBubbleManager::FromWebContents(web_contents());
-    MockPermissionBubbleView::SetFactory(permission_bubble_manager, false);
-    permission_bubble_manager->DisplayPendingRequests();
-  }
 }
 
 void GeolocationPermissionContextTests::TearDown() {
@@ -297,6 +299,7 @@
   ChromeRenderViewHostTestHarness::TearDown();
 }
 
+#if !defined(OS_ANDROID)
 size_t GeolocationPermissionContextTests::GetBubblesQueueSize(
     PermissionBubbleManager* manager) {
   return manager->requests_.size();
@@ -316,6 +319,7 @@
     PermissionBubbleManager* manager) {
   manager->Closing();
 }
+#endif
 
 void GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted() {
   GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted(
@@ -324,8 +328,10 @@
 
 void GeolocationPermissionContextTests::BubbleManagerDocumentLoadCompleted(
     content::WebContents* web_contents) {
+#if !defined(OS_ANDROID)
   PermissionBubbleManager::FromWebContents(web_contents)->
       DocumentOnLoadCompletedInMainFrame();
+#endif
 }
 
 ContentSetting GeolocationPermissionContextTests::GetGeolocationContentSetting(
@@ -337,50 +343,57 @@
                           std::string());
 }
 
-bool GeolocationPermissionContextTests::BubbleEnabled() const {
-  return PermissionBubbleManager::Enabled();
-}
-
 size_t GeolocationPermissionContextTests::GetNumberOfPrompts() {
-  if (BubbleEnabled()) {
-    PermissionBubbleManager* manager =
-        PermissionBubbleManager::FromWebContents(web_contents());
-    return GetBubblesQueueSize(manager);
-  } else {
-    return infobar_service()->infobar_count();
-  }
+#if !defined(OS_ANDROID)
+  PermissionBubbleManager* manager =
+      PermissionBubbleManager::FromWebContents(web_contents());
+  return GetBubblesQueueSize(manager);
+#else
+  return infobar_service()->infobar_count();
+#endif
 }
 
 void GeolocationPermissionContextTests::AcceptPrompt() {
-  if (BubbleEnabled()) {
-    PermissionBubbleManager* manager =
-        PermissionBubbleManager::FromWebContents(web_contents());
-    AcceptBubble(manager);
-  } else {
-    infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
-    ConfirmInfoBarDelegate* infobar_delegate =
-        infobar->delegate()->AsConfirmInfoBarDelegate();
-    infobar_delegate->Accept();
-  }
+#if !defined(OS_ANDROID)
+  PermissionBubbleManager* manager =
+      PermissionBubbleManager::FromWebContents(web_contents());
+  AcceptBubble(manager);
+#else
+  infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
+  ConfirmInfoBarDelegate* infobar_delegate =
+      infobar->delegate()->AsConfirmInfoBarDelegate();
+  infobar_delegate->Accept();
+#endif
 }
 
 base::string16 GeolocationPermissionContextTests::GetPromptText() {
-  if (BubbleEnabled()) {
-    PermissionBubbleManager* manager =
-        PermissionBubbleManager::FromWebContents(web_contents());
-    return manager->requests_.front()->GetMessageText();
-  }
+#if !defined(OS_ANDROID)
+  PermissionBubbleManager* manager =
+      PermissionBubbleManager::FromWebContents(web_contents());
+  return manager->requests_.front()->GetMessageText();
+#else
   infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
   ConfirmInfoBarDelegate* infobar_delegate =
       infobar->delegate()->AsConfirmInfoBarDelegate();
   return infobar_delegate->GetMessageText();
+#endif
 }
 
 // Tests ----------------------------------------------------------------------
 
-TEST_F(GeolocationPermissionContextTests, SinglePermissionInfobar) {
-  if (BubbleEnabled()) return;
+TEST_F(GeolocationPermissionContextTests, SinglePermissionBubble) {
+  GURL requesting_frame("http://www.example.com/geolocation");
+  NavigateAndCommit(requesting_frame);
+  BubbleManagerDocumentLoadCompleted();
 
+  EXPECT_EQ(0U, GetNumberOfPrompts());
+  RequestGeolocationPermission(
+      web_contents(), RequestID(0), requesting_frame, true);
+  ASSERT_EQ(1U, GetNumberOfPrompts());
+}
+
+#if defined(OS_ANDROID)
+TEST_F(GeolocationPermissionContextTests, SinglePermissionInfobar) {
   GURL requesting_frame("http://www.example.com/geolocation");
   NavigateAndCommit(requesting_frame);
   EXPECT_EQ(0U, infobar_service()->infobar_count());
@@ -397,20 +410,6 @@
   EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar));
 }
 
-TEST_F(GeolocationPermissionContextTests, SinglePermissionBubble) {
-  if (!BubbleEnabled()) return;
-
-  GURL requesting_frame("http://www.example.com/geolocation");
-  NavigateAndCommit(requesting_frame);
-  BubbleManagerDocumentLoadCompleted();
-
-  EXPECT_EQ(0U, GetNumberOfPrompts());
-  RequestGeolocationPermission(
-      web_contents(), RequestID(0), requesting_frame, true);
-  ASSERT_EQ(1U, GetNumberOfPrompts());
-}
-
-#if defined(OS_ANDROID)
 // Infobar-only tests; Android doesn't support permission bubbles.
 TEST_F(GeolocationPermissionContextTests, GeolocationEnabledDisabled) {
   GURL requesting_frame("http://www.example.com/geolocation");
@@ -472,7 +471,7 @@
       GetGeolocationContentSetting(requesting_frame_1, requesting_frame_1));
 
   NavigateAndCommit(requesting_frame_0);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   // Check that no permission requests have happened yet.
   EXPECT_EQ(0U, GetNumberOfPrompts());
@@ -491,13 +490,13 @@
   CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
   CheckPermissionMessageSent(0, true);
 
-  if (!BubbleEnabled()) {
-    infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0);
-    infobar_service()->RemoveInfoBar(infobar_0);
-    EXPECT_EQ(1U, closed_infobar_tracker_.size());
-    EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_0));
-    closed_infobar_tracker_.Clear();
-  }
+#if defined(OS_ANDROID)
+  infobars::InfoBar* infobar_0 = infobar_service()->infobar_at(0);
+  infobar_service()->RemoveInfoBar(infobar_0);
+  EXPECT_EQ(1U, closed_infobar_tracker_.size());
+  EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_0));
+  closed_infobar_tracker_.Clear();
+#endif
 
   // Now we should have a new infobar for the second frame.
   ASSERT_EQ(1U, GetNumberOfPrompts());
@@ -507,14 +506,14 @@
   EXPECT_NE(text_0, text_1);
 
   // Cancel (block) this frame.
-  if (BubbleEnabled()) {
-    PermissionBubbleManager* manager =
-        PermissionBubbleManager::FromWebContents(web_contents());
-    DenyBubble(manager);
-  } else {
-    infobars::InfoBar* infobar_1 = infobar_service()->infobar_at(0);
-    infobar_1->delegate()->AsConfirmInfoBarDelegate()->Cancel();
-  }
+#if !defined(OS_ANDROID)
+  PermissionBubbleManager* manager =
+      PermissionBubbleManager::FromWebContents(web_contents());
+  DenyBubble(manager);
+#else
+  infobars::InfoBar* infobar_1 = infobar_service()->infobar_at(0);
+  infobar_1->delegate()->AsConfirmInfoBarDelegate()->Cancel();
+#endif
   CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_BLOCK);
   CheckPermissionMessageSent(1, false);
 
@@ -533,17 +532,22 @@
 
   // Navigate to the first url.
   NavigateAndCommit(url_a);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   // Check permission is requested.
   ASSERT_EQ(0U, GetNumberOfPrompts());
-  RequestGeolocationPermission(
-      web_contents(), RequestID(0), url_a, BubbleEnabled());
+#if defined(OS_ANDROID)
+  const bool user_gesture = false;
+#else
+  const bool user_gesture = true;
+#endif
+  RequestGeolocationPermission(web_contents(), RequestID(0), url_a,
+                               user_gesture);
   ASSERT_EQ(1U, GetNumberOfPrompts());
 
   // Change the hash, we'll still be on the same page.
   NavigateAndCommit(url_b);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   // Accept.
   AcceptPrompt();
@@ -552,22 +556,25 @@
   CheckPermissionMessageSent(0, true);
 
   // Cleanup.
-  if (!BubbleEnabled()) {
-    infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
-    infobar_service()->RemoveInfoBar(infobar);
-    EXPECT_EQ(1U, closed_infobar_tracker_.size());
-    EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar));
-  }
+#if defined(OS_ANDROID)
+  infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
+  infobar_service()->RemoveInfoBar(infobar);
+  EXPECT_EQ(1U, closed_infobar_tracker_.size());
+  EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar));
+#endif
 }
 
-TEST_F(GeolocationPermissionContextTests, PermissionForFileScheme) {
-  // TODO(felt): The bubble is rejecting file:// permission requests.
-  // Fix and enable this test. crbug.com/444047
-  if (BubbleEnabled()) return;
-
+// TODO(felt): The bubble is rejecting file:// permission requests.
+// Fix and enable this test. crbug.com/444047
+#if defined(OS_ANDROID)
+#define MAYBE_PermissionForFileScheme PermissionForFileScheme
+#else
+#define MAYBE_PermissionForFileScheme DISABLED_PermissionForFileScheme
+#endif
+TEST_F(GeolocationPermissionContextTests, MAYBE_PermissionForFileScheme) {
   GURL requesting_frame("file://example/geolocation.html");
   NavigateAndCommit(requesting_frame);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   // Check permission is requested.
   ASSERT_EQ(0U, GetNumberOfPrompts());
@@ -595,7 +602,7 @@
       CONTENT_SETTING_ASK, GetGeolocationContentSetting(frame_1, frame_0));
 
   NavigateAndCommit(frame_0);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   ASSERT_EQ(0U, GetNumberOfPrompts());
 
@@ -611,14 +618,14 @@
   ASSERT_FALSE(text_0.empty());
 
   // Simulate the frame going away; the request should be removed.
-  if (BubbleEnabled()) {
-    PermissionBubbleManager* manager =
-        PermissionBubbleManager::FromWebContents(web_contents());
-    CloseBubble(manager);
-  } else {
-    geolocation_permission_context_->CancelPermissionRequest(web_contents(),
-        RequestID(0));
-  }
+#if !defined(OS_ANDROID)
+  PermissionBubbleManager* manager =
+      PermissionBubbleManager::FromWebContents(web_contents());
+  CloseBubble(manager);
+#else
+  geolocation_permission_context_->CancelPermissionRequest(web_contents(),
+                                                           RequestID(0));
+#endif
 
   // Check that the next pending request is created correctly.
   base::string16 text_1 = GetPromptText();
@@ -641,7 +648,7 @@
   GURL invalid_embedder("about:blank");
   GURL requesting_frame;
   NavigateAndCommit(invalid_embedder);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   // Nothing should be displayed.
   EXPECT_EQ(0U, GetNumberOfPrompts());
@@ -657,17 +664,17 @@
   NavigateAndCommit(url_a);  // Tab A0
   AddNewTab(url_b);          // Tab B (extra_tabs_[0])
   AddNewTab(url_a);          // Tab A1 (extra_tabs_[1])
-  if (BubbleEnabled()) {
-    BubbleManagerDocumentLoadCompleted();
-    BubbleManagerDocumentLoadCompleted(extra_tabs_[0]);
-    BubbleManagerDocumentLoadCompleted(extra_tabs_[1]);
-  }
+  BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted(extra_tabs_[0]);
+  BubbleManagerDocumentLoadCompleted(extra_tabs_[1]);
+#if !defined(OS_ANDROID)
   PermissionBubbleManager* manager_a0 =
       PermissionBubbleManager::FromWebContents(web_contents());
   PermissionBubbleManager* manager_b =
       PermissionBubbleManager::FromWebContents(extra_tabs_[0]);
   PermissionBubbleManager* manager_a1 =
       PermissionBubbleManager::FromWebContents(extra_tabs_[1]);
+#endif
 
   // Request permission in all three tabs.
   RequestGeolocationPermission(
@@ -677,41 +684,39 @@
   RequestGeolocationPermission(
       extra_tabs_[1], RequestIDForTab(1, 0), url_a, true);
   ASSERT_EQ(1U, GetNumberOfPrompts());  // For A0.
-  if (BubbleEnabled()) {
-    ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
-    ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
-  } else {
-    ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
-    ASSERT_EQ(1U, infobar_service_for_tab(1)->infobar_count());
-  }
+#if !defined(OS_ANDROID)
+  ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
+  ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
+#else
+  ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
+  ASSERT_EQ(1U, infobar_service_for_tab(1)->infobar_count());
+#endif
 
   // Accept the permission in tab A0.
-  if (BubbleEnabled()) {
-    AcceptBubble(manager_a0);
-  } else {
-    infobars::InfoBar* infobar_a0 = infobar_service()->infobar_at(0);
-    ConfirmInfoBarDelegate* infobar_delegate_a0 =
-        infobar_a0->delegate()->AsConfirmInfoBarDelegate();
-    ASSERT_TRUE(infobar_delegate_a0);
-    infobar_delegate_a0->Accept();
-    infobar_service()->RemoveInfoBar(infobar_a0);
-    EXPECT_EQ(2U, closed_infobar_tracker_.size());
-    EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_a0));
-  }
+#if !defined(OS_ANDROID)
+  AcceptBubble(manager_a0);
+#else
+  infobars::InfoBar* infobar_a0 = infobar_service()->infobar_at(0);
+  ConfirmInfoBarDelegate* infobar_delegate_a0 =
+      infobar_a0->delegate()->AsConfirmInfoBarDelegate();
+  ASSERT_TRUE(infobar_delegate_a0);
+  infobar_delegate_a0->Accept();
+  infobar_service()->RemoveInfoBar(infobar_a0);
+  EXPECT_EQ(2U, closed_infobar_tracker_.size());
+  EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_a0));
+#endif
   CheckPermissionMessageSent(0, true);
   // Because they're the same origin, this will cause tab A1's infobar to
   // disappear. It does not cause the bubble to disappear: crbug.com/443013.
   // TODO(felt): Update this test when the bubble's behavior is changed.
-  if (BubbleEnabled())
-    ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
-  else
-    CheckPermissionMessageSentForTab(1, 0, true);
-
   // Either way, tab B should still have a pending permission request.
-  if (BubbleEnabled())
-    ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
-  else
-    ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
+#if !defined(OS_ANDROID)
+  ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
+  ASSERT_EQ(1U, GetBubblesQueueSize(manager_b));
+#else
+  CheckPermissionMessageSentForTab(1, 0, true);
+  ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
+#endif
 }
 
 TEST_F(GeolocationPermissionContextTests, QueuedOriginMultipleTabs) {
@@ -719,14 +724,14 @@
   GURL url_b("http://www.example-2.com/geolocation");
   NavigateAndCommit(url_a);  // Tab A0.
   AddNewTab(url_a);          // Tab A1.
-  if (BubbleEnabled()) {
-    BubbleManagerDocumentLoadCompleted();
-    BubbleManagerDocumentLoadCompleted(extra_tabs_[0]);
-  }
+#if !defined(OS_ANDROID)
+  BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted(extra_tabs_[0]);
   PermissionBubbleManager* manager_a0 =
       PermissionBubbleManager::FromWebContents(web_contents());
   PermissionBubbleManager* manager_a1 =
       PermissionBubbleManager::FromWebContents(extra_tabs_[0]);
+#endif
 
   // Request permission in both tabs; the extra tab will have two permission
   // requests from two origins.
@@ -736,56 +741,57 @@
       extra_tabs_[0], RequestIDForTab(0, 0), url_a, true);
   RequestGeolocationPermission(
       extra_tabs_[0], RequestIDForTab(0, 1), url_b, true);
-  if (BubbleEnabled()) {
-    ASSERT_EQ(1U, GetBubblesQueueSize(manager_a0));
-    ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
-  } else {
-    ASSERT_EQ(1U, infobar_service()->infobar_count());
-    ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
-  }
+#if !defined(OS_ANDROID)
+  ASSERT_EQ(1U, GetBubblesQueueSize(manager_a0));
+  ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
+#else
+  ASSERT_EQ(1U, infobar_service()->infobar_count());
+  ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
+#endif
 
   // Accept the first request in tab A1.
-  if (BubbleEnabled()) {
-    AcceptBubble(manager_a1);
-  } else {
-    infobars::InfoBar* infobar_a1 = infobar_service_for_tab(0)->infobar_at(0);
-    ConfirmInfoBarDelegate* infobar_delegate_a1 =
-        infobar_a1->delegate()->AsConfirmInfoBarDelegate();
-    ASSERT_TRUE(infobar_delegate_a1);
-    infobar_delegate_a1->Accept();
-    infobar_service_for_tab(0)->RemoveInfoBar(infobar_a1);
-    EXPECT_EQ(2U, closed_infobar_tracker_.size());
-    EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_a1));
-  }
+#if !defined(OS_ANDROID)
+  AcceptBubble(manager_a1);
+#else
+  infobars::InfoBar* infobar_a1 = infobar_service_for_tab(0)->infobar_at(0);
+  ConfirmInfoBarDelegate* infobar_delegate_a1 =
+      infobar_a1->delegate()->AsConfirmInfoBarDelegate();
+  ASSERT_TRUE(infobar_delegate_a1);
+  infobar_delegate_a1->Accept();
+  infobar_service_for_tab(0)->RemoveInfoBar(infobar_a1);
+  EXPECT_EQ(2U, closed_infobar_tracker_.size());
+  EXPECT_TRUE(closed_infobar_tracker_.Contains(infobar_a1));
+#endif
   CheckPermissionMessageSentForTab(0, 0, true);
 
   // Because they're the same origin, this will cause tab A0's infobar to
   // disappear. It does not cause the bubble to disappear: crbug.com/443013.
   // TODO(felt): Update this test when the bubble's behavior is changed.
-  if (BubbleEnabled()) {
-    EXPECT_EQ(1U, GetBubblesQueueSize(manager_a0));
-  } else {
-    EXPECT_EQ(0U, infobar_service()->infobar_count());
-    CheckPermissionMessageSent(0, true);
-  }
+#if !defined(OS_ANDROID)
+  EXPECT_EQ(1U, GetBubblesQueueSize(manager_a0));
+#else
+  EXPECT_EQ(0U, infobar_service()->infobar_count());
+  CheckPermissionMessageSent(0, true);
+#endif
 
   // The second request should now be visible in tab A1.
-  if (BubbleEnabled())
-    ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
-  else
-    ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
+#if !defined(OS_ANDROID)
+  ASSERT_EQ(1U, GetBubblesQueueSize(manager_a1));
+#else
+  ASSERT_EQ(1U, infobar_service_for_tab(0)->infobar_count());
+#endif
 
   // Accept the second request and check that it's gone.
-  if (BubbleEnabled()) {
-    AcceptBubble(manager_a1);
-    EXPECT_EQ(0U, GetBubblesQueueSize(manager_a1));
-  } else {
-    infobars::InfoBar* infobar_1 = infobar_service_for_tab(0)->infobar_at(0);
-    ConfirmInfoBarDelegate* infobar_delegate_1 =
-        infobar_1->delegate()->AsConfirmInfoBarDelegate();
-    ASSERT_TRUE(infobar_delegate_1);
-    infobar_delegate_1->Accept();
-  }
+#if !defined(OS_ANDROID)
+  AcceptBubble(manager_a1);
+  EXPECT_EQ(0U, GetBubblesQueueSize(manager_a1));
+#else
+  infobars::InfoBar* infobar_1 = infobar_service_for_tab(0)->infobar_at(0);
+  ConfirmInfoBarDelegate* infobar_delegate_1 =
+      infobar_1->delegate()->AsConfirmInfoBarDelegate();
+  ASSERT_TRUE(infobar_delegate_1);
+  infobar_delegate_1->Accept();
+#endif
 }
 
 TEST_F(GeolocationPermissionContextTests, TabDestroyed) {
@@ -799,7 +805,7 @@
       GetGeolocationContentSetting(requesting_frame_1, requesting_frame_0));
 
   NavigateAndCommit(requesting_frame_0);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   // Request permission for two frames.
   RequestGeolocationPermission(
@@ -811,12 +817,12 @@
   ASSERT_EQ(1U, GetNumberOfPrompts());
 
   // Delete the tab contents.
-  if (!BubbleEnabled()) {
-    infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
-    DeleteContents();
-    ASSERT_EQ(1U, closed_infobar_tracker_.size());
-    ASSERT_TRUE(closed_infobar_tracker_.Contains(infobar));
-  }
+#if defined(OS_ANDROID)
+  infobars::InfoBar* infobar = infobar_service()->infobar_at(0);
+  DeleteContents();
+  ASSERT_EQ(1U, closed_infobar_tracker_.size());
+  ASSERT_TRUE(closed_infobar_tracker_.Contains(infobar));
+#endif
 
   // The content settings should not have changed.
   EXPECT_EQ(
@@ -830,7 +836,7 @@
 TEST_F(GeolocationPermissionContextTests, LastUsageAudited) {
   GURL requesting_frame("http://www.example.com/geolocation");
   NavigateAndCommit(requesting_frame);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   base::SimpleTestClock* test_clock = new base::SimpleTestClock;
   test_clock->SetNow(base::Time::UnixEpoch() +
@@ -894,7 +900,7 @@
             0);
 
   NavigateAndCommit(requesting_frame_0);
-  if (BubbleEnabled()) BubbleManagerDocumentLoadCompleted();
+  BubbleManagerDocumentLoadCompleted();
 
   EXPECT_EQ(0U, GetNumberOfPrompts());
 
@@ -909,8 +915,9 @@
 
   // Accept the first frame.
   AcceptPrompt();
-  if (!BubbleEnabled())
-    infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
+#if defined(OS_ANDROID)
+  infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
+#endif
   CheckTabContentsState(requesting_frame_0, CONTENT_SETTING_ALLOW);
   CheckPermissionMessageSent(0, true);
 
@@ -933,8 +940,9 @@
   AcceptPrompt();
   CheckTabContentsState(requesting_frame_1, CONTENT_SETTING_ALLOW);
   CheckPermissionMessageSent(1, true);
-  if (!BubbleEnabled())
-    infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
+#if defined(OS_ANDROID)
+  infobar_service()->RemoveInfoBar(infobar_service()->infobar_at(0));
+#endif
 
   // Verify that the times are different.
   EXPECT_EQ(map->GetLastUsage(requesting_frame_0.GetOrigin(),
diff --git a/chrome/browser/google/google_update_win.cc b/chrome/browser/google/google_update_win.cc
index 3eae6880..d2f766f 100644
--- a/chrome/browser/google/google_update_win.cc
+++ b/chrome/browser/google/google_update_win.cc
@@ -58,9 +58,13 @@
 // value was chosen unscientificaly during an informal discussion.
 const int64_t kGoogleUpdatePollIntervalMs = 250;
 
+const int kGoogleAllowedRetries = 1;
+const int kGoogleRetryIntervalSeconds = 5;
+
 // Constants from Google Update.
 const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY = 0x80040813;
 const HRESULT GOOPDATE_E_APP_UPDATE_DISABLED_BY_POLICY_MANUAL = 0x8004081f;
+const HRESULT GOOPDATE_E_APP_USING_EXTERNAL_UPDATER = 0xA043081D;
 const HRESULT GOOPDATEINSTALL_E_INSTALLER_FAILED = 0x80040902;
 
 // Check if the currently running instance can be updated by Google Update.
@@ -282,6 +286,9 @@
   // The task runner on which the update checks runs.
   scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
 
+  // Number of remaining retries allowed when errors occur.
+  int allowed_retries_;
+
   // The caller's task runner, on which methods of |delegate_| will be invoked.
   scoped_refptr<base::SingleThreadTaskRunner> result_runner_;
 
@@ -350,6 +357,7 @@
     const base::WeakPtr<UpdateCheckDelegate>& delegate)
     : task_runner_(task_runner),
       result_runner_(base::ThreadTaskRunnerHandle::Get()),
+      allowed_retries_(kGoogleAllowedRetries),
       locale_(locale),
       install_update_if_possible_(install_update_if_possible),
       elevation_window_(elevation_window),
@@ -670,6 +678,19 @@
                    base::string16());
   } else if (IsErrorState(state, state_value, &error_code, &hresult,
                           &installer_exit_code, &error_string)) {
+    // Some errors can be transient.  Retry them after a short delay.
+    if (hresult == GOOPDATE_E_APP_USING_EXTERNAL_UPDATER) {
+      if (allowed_retries_ > 0) {
+        --allowed_retries_;
+        app_bundle_.Release();
+        google_update_.Release();
+        task_runner_->PostDelayedTask(
+            FROM_HERE, base::Bind(&UpdateCheckDriver::BeginUpdateCheck,
+                                  base::Unretained(this)),
+            base::TimeDelta::FromSeconds(kGoogleRetryIntervalSeconds));
+        return;
+      }
+    }
     OnUpgradeError(error_code, hresult, installer_exit_code, error_string);
   } else if (IsFinalState(state, state_value, &upgrade_status, &new_version)) {
     status_ = upgrade_status;
@@ -722,6 +743,14 @@
   error_code_ = error_code;
   hresult_ = hresult;
   installer_exit_code_ = installer_exit_code;
+
+  // Some specific result codes have dedicated messages.
+  if (hresult == GOOPDATE_E_APP_USING_EXTERNAL_UPDATER) {
+    html_error_message_ = l10n_util::GetStringUTF16(
+        IDS_ABOUT_BOX_EXTERNAL_UPDATE_IS_RUNNING);
+    return;
+  }
+
   base::string16 html_error_msg =
       base::StringPrintf(L"%d: <a href='%ls0x%X' target=_blank>0x%X</a>",
                          error_code_, base::UTF8ToUTF16(
diff --git a/chrome/browser/mac/DEPS b/chrome/browser/mac/DEPS
new file mode 100644
index 0000000..93ee7f1
--- /dev/null
+++ b/chrome/browser/mac/DEPS
@@ -0,0 +1,3 @@
+include_rules = [
+  "+third_party/crashpad",
+]
diff --git a/chrome/browser/mac/install_from_dmg.mm b/chrome/browser/mac/install_from_dmg.mm
index 60f1938..1f163f7 100644
--- a/chrome/browser/mac/install_from_dmg.mm
+++ b/chrome/browser/mac/install_from_dmg.mm
@@ -15,6 +15,7 @@
 #include <string.h>
 #include <sys/mount.h>
 #include <sys/param.h>
+#include <unistd.h>
 
 #include "base/auto_reset.h"
 #include "base/basictypes.h"
@@ -38,6 +39,7 @@
 #include "chrome/common/chrome_constants.h"
 #include "chrome/grit/chromium_strings.h"
 #include "chrome/grit/generated_resources.h"
+#include "third_party/crashpad/crashpad/client/crashpad_client.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/l10n/l10n_util_mac.h"
 
@@ -648,9 +650,25 @@
                                                       CFRunLoopGetCurrent(),
                                                       kCFRunLoopCommonModes);
 
-  if (!SynchronousDADiskUnmount(disk, kDADiskUnmountOptionWhole)) {
-    LOG(ERROR) << "SynchronousDADiskUnmount";
-    return;
+  // Stop talking to Crashpad. This relauncher process inherited the
+  // crashpad_handler of its parent, which resides on the disk image. As long as
+  // it's running, the filesystem that contains it can't be unmounted. Since the
+  // relauncher is expected to be the only thing that's talking to that Crashpad
+  // instance, severing ties here should cause it to exit, provided it's not
+  // busy doing anything else (like uploading a crash report).
+  //
+  // This means that crash coverage is lost from this point on, which is sad.
+  crashpad::CrashpadClient::UseSystemDefaultHandler();
+
+  // Retry the unmount in a loop to give crashpad_handler a chance to exit.
+  int tries = 15;
+  while (!SynchronousDADiskUnmount(disk, kDADiskUnmountOptionWhole)) {
+    if (--tries > 0) {
+      sleep(1);
+    } else {
+      LOG(ERROR) << "SynchronousDADiskUnmount";
+      return;
+    }
   }
 
   if (!SynchronousDADiskEject(disk, kDADiskEjectOptionDefault)) {
diff --git a/chrome/browser/media/android/router/media_router_android.cc b/chrome/browser/media/android/router/media_router_android.cc
index 758d6251f..dd7a527 100644
--- a/chrome/browser/media/android/router/media_router_android.cc
+++ b/chrome/browser/media/android/router/media_router_android.cc
@@ -188,7 +188,7 @@
   CloseRoute(route_id);
 }
 
-void MediaRouterAndroid::RegisterMediaSinksObserver(
+bool MediaRouterAndroid::RegisterMediaSinksObserver(
     MediaSinksObserver* observer) {
   const std::string& source_id = observer->source().id();
   base::ObserverList<MediaSinksObserver>* observer_list =
@@ -204,7 +204,7 @@
   JNIEnv* env = base::android::AttachCurrentThread();
   ScopedJavaLocalRef<jstring> jsource_id =
       base::android::ConvertUTF8ToJavaString(env, source_id);
-  Java_ChromeMediaRouter_startObservingMediaSinks(
+  return Java_ChromeMediaRouter_startObservingMediaSinks(
       env, java_media_router_.obj(), jsource_id.obj());
 }
 
diff --git a/chrome/browser/media/android/router/media_router_android.h b/chrome/browser/media/android/router/media_router_android.h
index 00f1674..242e0023 100644
--- a/chrome/browser/media/android/router/media_router_android.h
+++ b/chrome/browser/media/android/router/media_router_android.h
@@ -91,7 +91,7 @@
   explicit MediaRouterAndroid(content::BrowserContext*);
 
   // MediaRouter implementation.
-  void RegisterMediaSinksObserver(MediaSinksObserver* observer) override;
+  bool RegisterMediaSinksObserver(MediaSinksObserver* observer) override;
   void UnregisterMediaSinksObserver(MediaSinksObserver* observer) override;
   void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override;
   void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override;
diff --git a/chrome/browser/media/encrypted_media_istypesupported_browsertest.cc b/chrome/browser/media/encrypted_media_istypesupported_browsertest.cc
index d13c521..f8a7461 100644
--- a/chrome/browser/media/encrypted_media_istypesupported_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_istypesupported_browsertest.cc
@@ -10,6 +10,8 @@
 #include "base/files/file_path.h"
 #include "base/path_service.h"
 #include "base/strings/utf_string_conversions.h"
+#include "base/threading/platform_thread.h"
+#include "base/time/time.h"
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/common/chrome_paths.h"
@@ -27,19 +29,50 @@
 #error This file needs to be updated to run on Android.
 #endif
 
+namespace chrome {
+
+namespace {
+
+const char kClearKey[] = "org.w3.clearkey";
+const char kExternalClearKey[] = "org.chromium.externalclearkey";
+const char kWidevine[] = "com.widevine.alpha";
+
+const char kAudioWebMMimeType[] = "audio/webm";
+const char kVideoWebMMimeType[] = "video/webm";
+const char kAudioMP4MimeType[] = "audio/mp4";
+const char kVideoMP4MimeType[] = "video/mp4";
+
+// These are the expected titles set by checkKeySystemWithMediaMimeType()
+// in test_key_system_instantiation.html. Other titles are possible, but
+// they are unexpected and will be logged with the failure.
+// "Unsupported keySystem" and "None of the requested configurations were
+// supported." are actually error messages generated by
+// navigator.requestMediaKeySystemAccess(), and will have to change if that
+// code is modified.
+const char kSuccessResult[] = "success";
+const char kUnsupportedResult[] = "Unsupported keySystem";
+const char kNoMatchResult[] =
+    "None of the requested configurations were supported.";
+
+#define EXPECT_SUCCESS(test) EXPECT_EQ(kSuccessResult, test)
+#define EXPECT_UNKNOWN_KEYSYSTEM(test) EXPECT_EQ(kUnsupportedResult, test)
+#define EXPECT_NO_MATCH(test) EXPECT_EQ(kNoMatchResult, test)
+
 #if defined(USE_PROPRIETARY_CODECS)
-#define EXPECT_PROPRIETARY EXPECT_TRUE
+#define EXPECT_PROPRIETARY EXPECT_SUCCESS
 #else
-#define EXPECT_PROPRIETARY EXPECT_FALSE
+#define EXPECT_PROPRIETARY EXPECT_NO_MATCH
 #endif
 
 // Expectations for External Clear Key.
 #if defined(ENABLE_PEPPER_CDMS)
-#define EXPECT_ECK EXPECT_TRUE
-#define EXPECT_ECKPROPRIETARY EXPECT_PROPRIETARY
+#define EXPECT_ECK EXPECT_SUCCESS
+#define EXPECT_ECK_PROPRIETARY EXPECT_PROPRIETARY
+#define EXPECT_ECK_NO_MATCH EXPECT_NO_MATCH
 #else
-#define EXPECT_ECK EXPECT_FALSE
-#define EXPECT_ECKPROPRIETARY EXPECT_FALSE
+#define EXPECT_ECK EXPECT_UNKNOWN_KEYSYSTEM
+#define EXPECT_ECK_PROPRIETARY EXPECT_UNKNOWN_KEYSYSTEM
+#define EXPECT_ECK_NO_MATCH EXPECT_UNKNOWN_KEYSYSTEM
 #endif  // defined(ENABLE_PEPPER_CDMS)
 
 // Expectations for Widevine.
@@ -48,156 +81,57 @@
 // TODO(ddorwin): Enable these tests after we have the ability to use the CUS
 // in these tests. See http://crbug.com/356833.
 #if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT)
-#define EXPECT_WV EXPECT_TRUE
-#define EXPECT_WVMP4 EXPECT_TRUE
-#define EXPECT_WVAAC EXPECT_TRUE
-#define EXPECT_WVAVC1 EXPECT_TRUE
-#define EXPECT_WVAVC1AAC EXPECT_TRUE
+#define EXPECT_WV_SUCCESS EXPECT_SUCCESS
+#define EXPECT_WV_PROPRIETARY EXPECT_PROPRIETARY
+#define EXPECT_WV_NO_MATCH EXPECT_NO_MATCH
 #else  // defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT)
-#define EXPECT_WV EXPECT_FALSE
-#define EXPECT_WVMP4 EXPECT_FALSE
-#define EXPECT_WVAAC EXPECT_FALSE
-#define EXPECT_WVAVC1 EXPECT_FALSE
-#define EXPECT_WVAVC1AAC EXPECT_FALSE
+#define EXPECT_WV_SUCCESS EXPECT_UNKNOWN_KEYSYSTEM
+#define EXPECT_WV_PROPRIETARY EXPECT_UNKNOWN_KEYSYSTEM
+#define EXPECT_WV_NO_MATCH EXPECT_UNKNOWN_KEYSYSTEM
 #endif  // defined(WIDEVINE_CDM_AVAILABLE) &&
         // !defined(WIDEVINE_CDM_IS_COMPONENT)
 
-namespace chrome {
+};  // namespace
 
-const char kPrefixedClearKey[] = "webkit-org.w3.clearkey";
-const char kPrefixedClearKeyParent[] = "webkit-org.w3";
-// TODO(ddorwin): Duplicate prefixed tests for unprefixed.
-const char kUnprefixedClearKey[] = "org.w3.clearkey";
-const char kExternalClearKey[] = "org.chromium.externalclearkey";
-const char kWidevineAlpha[] = "com.widevine.alpha";
-const char kWidevine[] = "com.widevine";
-const char kWidevineAlphaHr[] = "com.widevine.alpha.hr";
-const char kWidevineAlphaHrNonCompositing[] =
-    "com.widevine.alpha.hrnoncompositing";
-
-// TODO(xhwang): Simplify this test! See http://crbug.com/367158
-
+// TODO(jrummell): Rename these tests and this file. http://crbug.com/367158.
 class EncryptedMediaIsTypeSupportedTest : public InProcessBrowserTest {
  protected:
-  EncryptedMediaIsTypeSupportedTest()
-      : is_test_page_loaded_(false), is_pepper_cdm_registered_(false) {
-    vp8_codec_.push_back("vp8");
+  EncryptedMediaIsTypeSupportedTest() : is_pepper_cdm_registered_(false) {
+    audio_webm_codecs_.push_back("opus");
+    audio_webm_codecs_.push_back("vorbis");
 
-    vp80_codec_.push_back("vp8.0");
+    video_webm_codecs_.push_back("vp8");
+    video_webm_codecs_.push_back("vp8.0");
+    video_webm_codecs_.push_back("vp9");
+    video_webm_codecs_.push_back("vp9.0");
 
-    vp9_codec_.push_back("vp9");
+    audio_mp4_codecs_.push_back("mp4a.40.2");
 
-    vp90_codec_.push_back("vp9.0");
+    video_mp4_codecs_.push_back("avc1.4D400C");
+    video_mp4_codecs_.push_back("avc3.64001F");
 
-    opus_codec_.push_back("opus");
+    // Extended codecs are used, so make sure generic ones fail. These will be
+    // tested against all initDataTypes as they should always fail to be
+    // supported.
+    invalid_codecs_.push_back("avc1");
+    invalid_codecs_.push_back("avc1.");
+    invalid_codecs_.push_back("avc3");
 
-    vorbis_codec_.push_back("vorbis");
-
-    vp8_and_opus_codecs_.push_back("vp8");
-    vp8_and_opus_codecs_.push_back("opus");
-
-    vp9_and_opus_codecs_.push_back("vp9");
-    vp9_and_opus_codecs_.push_back("opus");
-
-    vp8_and_vorbis_codecs_.push_back("vp8");
-    vp8_and_vorbis_codecs_.push_back("vorbis");
-
-    vp9_and_vorbis_codecs_.push_back("vp9");
-    vp9_and_vorbis_codecs_.push_back("vorbis");
-
-    avc1_codec_.push_back("avc1");
-
-    avc1_extended_codec_.push_back("avc1.4D400C");
-
-    avc1_dot_codec_.push_back("avc1.");
-
-    avc2_codec_.push_back("avc2");
-
-    avc3_codec_.push_back("avc3");
-
-    avc3_extended_codec_.push_back("avc3.64001F");
-
-    aac_codec_.push_back("mp4a.40.2");
-
-    mp4a_invalid_no_extension_.push_back("mp4a");
-
-    avc1_and_aac_codecs_.push_back("avc1");
-    avc1_and_aac_codecs_.push_back("mp4a.40.2");
-
-    avc3_and_aac_codecs_.push_back("avc3");
-    avc3_and_aac_codecs_.push_back("mp4a.40.2");
-
-    avc1_extended_and_aac_codecs_.push_back("avc1.4D400C");
-    avc1_extended_and_aac_codecs_.push_back("mp4a.40.2");
-
-    avc3_extended_and_aac_codecs_.push_back("avc3.64001F");
-    avc3_extended_and_aac_codecs_.push_back("mp4a.40.2");
-
-    unknown_codec_.push_back("foo");
-
-    mixed_codecs_.push_back("vorbis");
-    mixed_codecs_.push_back("avc1");
-
-    vp8_invalid_extension_codec_.push_back("vp8.1");
-  }
-
-  void SetUpCommandLine(base::CommandLine* command_line) override {
-    // TODO(jrummell): Switch tests to unprefixed EME: http://crbug.com/367158.
-    command_line->AppendSwitch(switches::kEnablePrefixedEncryptedMedia);
+    // Other invalid codecs.
+    invalid_codecs_.push_back("vp8.1");
+    invalid_codecs_.push_back("mp4a");
+    invalid_codecs_.push_back("avc2");
+    invalid_codecs_.push_back("foo");
   }
 
   typedef std::vector<std::string> CodecVector;
 
   const CodecVector& no_codecs() const { return no_codecs_; }
-  const CodecVector& vp8_codec() const { return vp8_codec_; }
-  const CodecVector& vp80_codec() const { return vp80_codec_; }
-  const CodecVector& vp9_codec() const { return vp9_codec_; }
-  const CodecVector& vp90_codec() const { return vp90_codec_; }
-  const CodecVector& opus_codec() const { return opus_codec_; }
-  const CodecVector& vorbis_codec() const { return vorbis_codec_; }
-  const CodecVector& vp8_and_opus_codecs() const {
-    return vp8_and_opus_codecs_;
-  }
-  const CodecVector& vp9_and_opus_codecs() const {
-    return vp9_and_opus_codecs_;
-  }
-  const CodecVector& vp8_and_vorbis_codecs() const {
-    return vp8_and_vorbis_codecs_;
-  }
-  const CodecVector& vp9_and_vorbis_codecs() const {
-    return vp9_and_vorbis_codecs_;
-  }
-  const CodecVector& avc1_codec() const { return avc1_codec_; }
-  const CodecVector& avc1_extended_codec() const {
-    return avc1_extended_codec_;
-  }
-  const CodecVector& avc1_dot_codec() const { return avc1_dot_codec_; }
-  const CodecVector& avc2_codec() const { return avc2_codec_; }
-  const CodecVector& avc3_codec() const { return avc3_codec_; }
-  const CodecVector& avc3_extended_codec() const {
-    return avc3_extended_codec_;
-  }
-  const CodecVector& aac_codec() const { return aac_codec_; }
-  const CodecVector& mp4a_invalid_no_extension() const {
-    return mp4a_invalid_no_extension_;
-  }
-  const CodecVector& avc1_and_aac_codecs() const {
-    return avc1_and_aac_codecs_;
-  }
-  const CodecVector& avc3_and_aac_codecs() const {
-    return avc3_and_aac_codecs_;
-  }
-  const CodecVector& avc1_extended_and_aac_codecs() const {
-    return avc1_extended_and_aac_codecs_;
-  }
-  const CodecVector& avc3_extended_and_aac_codecs() const {
-    return avc3_extended_and_aac_codecs_;
-  }
-  const CodecVector& unknown_codec() const { return unknown_codec_; }
-  const CodecVector& mixed_codecs() const { return mixed_codecs_; }
-  const CodecVector& vp8_invalid_extension_codec() const {
-    return vp8_invalid_extension_codec_;
-  }
+  const CodecVector& audio_webm_codecs() const { return audio_webm_codecs_; }
+  const CodecVector& video_webm_codecs() const { return video_webm_codecs_; }
+  const CodecVector& audio_mp4_codecs() const { return audio_mp4_codecs_; }
+  const CodecVector& video_mp4_codecs() const { return video_mp4_codecs_; }
+  const CodecVector& invalid_codecs() const { return invalid_codecs_; }
 
   // Update the command line to load |adapter_name| for
   // |pepper_type_for_key_system|.
@@ -225,107 +159,108 @@
                                      pepper_plugin);
   }
 
-  void LoadTestPage() {
-    // Load the test page needed. IsConcreteSupportedKeySystem() needs some
-    // JavaScript and a video loaded in order to work.
-    if (!is_test_page_loaded_) {
-      scoped_ptr<net::SpawnedTestServer> http_test_server(
-          new net::SpawnedTestServer(net::SpawnedTestServer::TYPE_HTTP,
-                                     net::SpawnedTestServer::kLocalhost,
-                                     media::GetTestDataPath()));
-      CHECK(http_test_server->Start());
-      GURL gurl = http_test_server->GetURL(
-          "files/test_key_system_instantiation.html");
-      ui_test_utils::NavigateToURL(browser(), gurl);
-      is_test_page_loaded_ = true;
+  void SetUpOnMainThread() override {
+    InProcessBrowserTest::SetUpOnMainThread();
+
+    // Load the test page needed so that checkKeySystemWithMediaMimeType()
+    // is available.
+    scoped_ptr<net::SpawnedTestServer> http_test_server(
+        new net::SpawnedTestServer(net::SpawnedTestServer::TYPE_HTTP,
+                                   net::SpawnedTestServer::kLocalhost,
+                                   media::GetTestDataPath()));
+    CHECK(http_test_server->Start());
+    GURL gurl =
+        http_test_server->GetURL("files/test_key_system_instantiation.html");
+    ui_test_utils::NavigateToURL(browser(), gurl);
+  }
+
+  // Create a valid JavaScript string for the content type. Format is
+  // |type|; codecs="|codec|", where codecs= is omitted if there is no codec.
+  static std::string MakeQuotedContentType(std::string type,
+                                           std::string codec) {
+    std::string contentType(type);
+    if (!codec.empty()) {
+      contentType.append("; codecs=\"");
+      contentType.append(codec);
+      contentType.append("\"");
     }
+    return "'" + contentType + "'";
   }
 
-  bool IsConcreteSupportedKeySystem(const std::string& key) {
-    std::string command(
-        "window.domAutomationController.send(testKeySystemInstantiation('");
-    command.append(key);
-    command.append("'));");
-
-    // testKeySystemInstantiation() is a JavaScript function which needs to
-    // be loaded.
-    LoadTestPage();
-
-    std::string result;
-    EXPECT_TRUE(content::ExecuteScriptAndExtractString(
-        browser()->tab_strip_model()->GetActiveWebContents(),
-        command,
-        &result));
-    CHECK(result == "success" || result == "NotSupportedError") << result;
-    return (result == "success");
+  static std::string ExecuteCommand(content::WebContents* contents,
+                                    const std::string& command) {
+    content::TitleWatcher title_watcher(contents,
+                                        base::ASCIIToUTF16(kSuccessResult));
+    title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16(kUnsupportedResult));
+    title_watcher.AlsoWaitForTitle(base::ASCIIToUTF16(kNoMatchResult));
+    EXPECT_TRUE(content::ExecuteScript(contents, command));
+    base::string16 result = title_watcher.WaitAndGetTitle();
+    return base::UTF16ToASCII(result);
   }
 
-  bool IsSupportedKeySystemWithMediaMimeType(const std::string& type,
-                                             const CodecVector& codecs,
-                                             const std::string& keySystem) {
-    std::string command("document.createElement('video').canPlayType(");
-    if (type.empty()) {
-      // Simple case, pass "null" as first argument.
-      command.append("null");
-      DCHECK(codecs.empty());
+  std::string IsSupportedKeySystemWithMediaMimeType(
+      const std::string& type,
+      const CodecVector& codecs,
+      const std::string& keySystem) {
+    // Choose the appropriate initDataType for the subtype.
+    size_t pos = type.find('/');
+    DCHECK(pos > 0);
+    std::string subType(type.substr(pos + 1));
+    std::string initDataType;
+    if (subType == "mp4") {
+      initDataType = "cenc";
     } else {
-      command.append("'");
-      command.append(type);
-      if (!codecs.empty()) {
-        command.append("; codecs=\"");
-        for (CodecVector::const_iterator it = codecs.begin();
-             it != codecs.end();
-             ++it) {
-          command.append(*it);
-          command.append(",");
-        }
-        command.replace(command.length() - 1, 1, "\"");
-      }
-      command.append("'");
+      DCHECK(subType == "webm");
+      initDataType = "webm";
     }
-    command.append(",'");
-    command.append(keySystem);
-    command.append("')");
 
-    std::string result;
-    EXPECT_TRUE(content::ExecuteScriptAndExtractString(
-        browser()->tab_strip_model()->GetActiveWebContents(),
-        "window.domAutomationController.send(" + command + ");",
-        &result));
-    return (result == "maybe" || result == "probably");
+    bool isAudio = type.compare(0, 5, "audio") == 0;
+    DCHECK(isAudio || type.compare(0, 5, "video") == 0);
+
+    // Create the contentType string based on |codecs|.
+    std::string contentTypeList("[");
+    if (codecs.empty()) {
+      contentTypeList.append(MakeQuotedContentType(type, std::string()));
+    } else {
+      for (auto codec : codecs) {
+        contentTypeList.append(MakeQuotedContentType(type, codec));
+        contentTypeList.append(",");
+      }
+      // Remove trailing comma.
+      contentTypeList.erase(contentTypeList.length() - 1);
+    }
+    contentTypeList.append("]");
+
+    std::string command("checkKeySystemWithMediaMimeType('");
+    command.append(keySystem);
+    command.append("','");
+    command.append(initDataType);
+    command.append("',");
+    command.append(isAudio ? contentTypeList : "null");
+    command.append(",");
+    command.append(!isAudio ? contentTypeList : "null");
+    command.append(")");
+
+    return ExecuteCommand(browser()->tab_strip_model()->GetActiveWebContents(),
+                          command);
   }
 
  private:
   const CodecVector no_codecs_;
-  CodecVector vp8_codec_;
-  CodecVector vp80_codec_;
-  CodecVector vp9_codec_;
-  CodecVector vp90_codec_;
-  CodecVector opus_codec_;
-  CodecVector vorbis_codec_;
-  CodecVector vp8_and_opus_codecs_;
-  CodecVector vp9_and_opus_codecs_;
-  CodecVector vp8_and_vorbis_codecs_;
-  CodecVector vp9_and_vorbis_codecs_;
-  CodecVector avc1_codec_;
-  CodecVector avc1_extended_codec_;
-  CodecVector avc1_dot_codec_;
-  CodecVector avc2_codec_;
-  CodecVector avc3_codec_;
-  CodecVector avc3_extended_codec_;
-  CodecVector aac_codec_;
-  CodecVector mp4a_invalid_no_extension_;
-  CodecVector avc1_and_aac_codecs_;
-  CodecVector avc3_and_aac_codecs_;
-  CodecVector avc1_extended_and_aac_codecs_;
-  CodecVector avc3_extended_and_aac_codecs_;
-  CodecVector unknown_codec_;
-  CodecVector mixed_codecs_;
-  CodecVector vp8_invalid_extension_codec_;
-  bool is_test_page_loaded_;
+  CodecVector audio_webm_codecs_;
+  CodecVector video_webm_codecs_;
+  CodecVector audio_mp4_codecs_;
+  CodecVector video_mp4_codecs_;
+  CodecVector invalid_codecs_;
+
   bool is_pepper_cdm_registered_;
 };
 
+// For ClearKey, nothing additional is required.
+class EncryptedMediaIsTypeSupportedClearKeyTest
+    : public EncryptedMediaIsTypeSupportedTest {
+};
+
 // For ExternalClearKey tests, ensure that the ClearKey adapter is loaded.
 class EncryptedMediaIsTypeSupportedExternalClearKeyTest
     : public EncryptedMediaIsTypeSupportedTest {
@@ -385,228 +320,120 @@
 };
 #endif  // defined(ENABLE_PEPPER_CDMS)
 
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest, ClearKey_Basic) {
-  EXPECT_TRUE(IsConcreteSupportedKeySystem(kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kPrefixedClearKey));
-
-  // Not yet out from behind the vendor prefix.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kUnprefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kUnprefixedClearKey));
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedClearKeyTest, Basic) {
+  EXPECT_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kClearKey));
+  EXPECT_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, no_codecs(), kClearKey));
+  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, no_codecs(), kClearKey));
+  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, no_codecs(), kClearKey));
 }
 
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest, ClearKey_Parent) {
-  // The parent should be supported but is not. See http://crbug.com/164303.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kPrefixedClearKeyParent));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kPrefixedClearKeyParent));
-}
-
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest,
-                       ClearKey_IsSupportedKeySystem_InvalidVariants) {
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedClearKeyTest,
+                       InvalidKeySystems) {
   // Case sensitive.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("webkit-org.w3.ClEaRkEy"));
-  // This should fail, but currently canPlayType() converts it to lowercase.
-  // See http://crbug.com/286036.
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "webkit-org.w3.ClEaRkEy"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.w3.ClEaRkEy"));
+
+  // Prefixed Clear Key key system.
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "webkit-org.w3.clearkey"));
 
   // TLDs are not allowed.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("webkit-org."));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "webkit-org."));
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("webkit-org"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "webkit-org"));
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("org."));
-  EXPECT_FALSE(
-      IsSupportedKeySystemWithMediaMimeType("video/webm", no_codecs(), "org."));
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("org"));
-  EXPECT_FALSE(
-      IsSupportedKeySystemWithMediaMimeType("video/webm", no_codecs(), "org"));
-
-  // Extra period.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("webkit-org.w3."));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "webkit-org.w3."));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org."));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.w3."));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.w3"));
 
   // Incomplete.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("webkit-org.w3.clearke"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "webkit-org.w3.clearke"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.w3.clearke"));
 
   // Extra character.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("webkit-org.w3.clearkeyz"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "webkit-org.w3.clearkeyz"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.w3.clearkeyz"));
 
   // There are no child key systems for Clear Key.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("webkit-org.w3.clearkey.foo"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "webkit-org.w3.clearkey.foo"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.w3.clearkey.foo"));
 }
 
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest,
-                       IsSupportedKeySystemWithMediaMimeType_ClearKey_NoType) {
-  // These two should be true. See http://crbug.com/164303.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), kPrefixedClearKeyParent));
-
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), "webkit-org.w3.foo"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), "webkit-org.w3.clearkey.foo"));
-}
-
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest,
-                       IsSupportedKeySystemWithMediaMimeType_ClearKey_WebM) {
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedClearKeyTest, Video_WebM) {
   // Valid video types.
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kPrefixedClearKey));
-  // The parent should be supported but is not. See http://crbug.com/164303.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kPrefixedClearKeyParent));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_codec(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp80_codec(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_and_opus_codecs(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_and_vorbis_codecs(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_codec(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp90_codec(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_and_opus_codecs(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", opus_codec(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_and_vorbis_codecs(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vorbis_codec(), kPrefixedClearKey));
+  EXPECT_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, video_webm_codecs(), kClearKey));
 
-  // Non-Webm codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", avc1_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", avc3_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", unknown_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", mixed_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_invalid_extension_codec(), kPrefixedClearKey));
+  // Non-video WebM codecs.
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, audio_webm_codecs(), kClearKey));
 
-  // Valid audio types.
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", no_codecs(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", opus_codec(), kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vorbis_codec(), kPrefixedClearKey));
-
-  // Non-audio codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_and_opus_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_and_vorbis_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_and_opus_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_and_vorbis_codecs(), kPrefixedClearKey));
-
-  // Non-Webm codec.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", aac_codec(), kPrefixedClearKey));
+  // Invalid or non-Webm video codecs.
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, invalid_codecs(), kClearKey));
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, audio_mp4_codecs(), kClearKey));
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, video_mp4_codecs(), kClearKey));
 }
 
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest,
-                       IsSupportedKeySystemWithMediaMimeType_ClearKey_MP4) {
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedClearKeyTest, Audio_WebM) {
+  // Valid audio types.
+  EXPECT_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, audio_webm_codecs(), kClearKey));
+
+  // Non-audio WebM codecs.
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, video_webm_codecs(), kClearKey));
+
+  // Invalid or Non-Webm codecs.
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, invalid_codecs(), kClearKey));
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, audio_mp4_codecs(), kClearKey));
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, video_mp4_codecs(), kClearKey));
+}
+
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedClearKeyTest, Video_MP4) {
   // Valid video types.
   EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", no_codecs(), kPrefixedClearKey));
-  // The parent should be supported but is not. See http://crbug.com/164303.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", no_codecs(), kPrefixedClearKeyParent));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_codec(), kPrefixedClearKey));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_codec(), kPrefixedClearKey));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_and_aac_codecs(), kPrefixedClearKey));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_and_aac_codecs(), kPrefixedClearKey));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", aac_codec(), kPrefixedClearKey));
+      kVideoMP4MimeType, video_mp4_codecs(), kClearKey));
 
-  // Extended codecs.
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_extended_codec(), kPrefixedClearKey));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_extended_codec(), kPrefixedClearKey));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_extended_and_aac_codecs(), kPrefixedClearKey));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_extended_and_aac_codecs(), kPrefixedClearKey));
+  // Non-video MP4 codecs.
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, audio_mp4_codecs(), kClearKey));
 
-  // Invalid codec format: profile parameter must be present after the period.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_dot_codec(), kPrefixedClearKey));
+  // Invalid or non-MP4 codecs.
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, invalid_codecs(), kClearKey));
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, audio_webm_codecs(), kClearKey));
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, video_webm_codecs(), kClearKey));
+}
 
-  // Invalid or Non-MP4 codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc2_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", mp4a_invalid_no_extension(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", vp8_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", unknown_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", mixed_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", vp8_invalid_extension_codec(), kPrefixedClearKey));
-
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedClearKeyTest, Audio_MP4) {
   // Valid audio types.
   EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", no_codecs(), kPrefixedClearKey));
-  EXPECT_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", aac_codec(), kPrefixedClearKey));
+      kAudioMP4MimeType, audio_mp4_codecs(), kClearKey));
 
-  // Non-audio codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_extended_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_extended_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_and_aac_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_and_aac_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_extended_and_aac_codecs(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_extended_and_aac_codecs(), kPrefixedClearKey));
+  // Non-audio MP4 codecs.
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, video_mp4_codecs(), kClearKey));
 
-  // Invalid or Non-MP4 codec.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", opus_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", vorbis_codec(), kPrefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", mp4a_invalid_no_extension(), kPrefixedClearKey));
+  // Invalid or non-MP4 codec.
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, invalid_codecs(), kClearKey));
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, audio_webm_codecs(), kClearKey));
+  EXPECT_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, video_webm_codecs(), kClearKey));
 }
 
 //
@@ -615,224 +442,120 @@
 
 // When defined(ENABLE_PEPPER_CDMS), this also tests the Pepper CDM check.
 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest,
-                       ExternalClearKey_Basic) {
-  EXPECT_ECK(IsConcreteSupportedKeySystem(kExternalClearKey));
+                       Basic) {
   EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kExternalClearKey));
+      kVideoWebMMimeType, no_codecs(), kExternalClearKey));
+  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, no_codecs(), kExternalClearKey));
+  EXPECT_ECK_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, no_codecs(), kExternalClearKey));
+  EXPECT_ECK_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, no_codecs(), kExternalClearKey));
 }
 
 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest,
-                       ExternalClearKey_Parent) {
-  const char* const kExternalClearKeyParent = "org.chromium";
-
-  // The parent should be supported but is not. See http://crbug.com/164303.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternalClearKeyParent));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kExternalClearKeyParent));
-}
-
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest,
-                       ExternalClearKey_IsSupportedKeySystem_InvalidVariants) {
+                       InvalidKeySystems) {
   // Case sensitive.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("org.chromium.ExTeRnAlClEaRkEy"));
-  // This should fail, but currently canPlayType() converts it to lowercase.
-  // See http://crbug.com/286036.
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "org.chromium.ExTeRnAlClEaRkEy"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.chromium.ExTeRnAlClEaRkEy"));
 
   // TLDs are not allowed.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("org."));
-  EXPECT_FALSE(
-      IsSupportedKeySystemWithMediaMimeType("video/webm", no_codecs(), "org."));
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("org"));
-  EXPECT_FALSE(
-      IsSupportedKeySystemWithMediaMimeType("video/webm", no_codecs(), "org"));
-
-  // Extra period.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("org.chromium."));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "org.chromium."));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org."));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.chromium"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.chromium."));
 
   // Incomplete.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("org.chromium.externalclearke"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "org.chromium.externalclearke"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.chromium.externalclearke"));
 
   // Extra character.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("org.chromium.externalclearkeyz"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "org.chromium.externalclearkeyz"));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.chromium.externalclearkeyz"));
 
-  // There are no child key systems for Clear Key.
-  EXPECT_FALSE(
-      IsConcreteSupportedKeySystem("org.chromium.externalclearkey.foo"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "org.chromium.externalclearkey.foo"));
+  // There are no child key systems for External Clear Key.
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), "org.chromium.externalclearkey.foo"));
 }
 
-IN_PROC_BROWSER_TEST_F(
-    EncryptedMediaIsTypeSupportedExternalClearKeyTest,
-    IsSupportedKeySystemWithMediaMimeType_ExternalClearKey_NoType) {
-  // These two should be true. See http://crbug.com/164303.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), "org.chromium"));
-
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), "org.chromium.foo"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), "org.chromium.externalclearkey.foo"));
-}
-
-IN_PROC_BROWSER_TEST_F(
-    EncryptedMediaIsTypeSupportedExternalClearKeyTest,
-    IsSupportedKeySystemWithMediaMimeType_ExternalClearKey_WebM) {
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest,
+                       Video_WebM) {
   // Valid video types.
   EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kExternalClearKey));
-  // The parent should be supported but is not. See http://crbug.com/164303.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "org.chromium"));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_codec(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp80_codec(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_and_opus_codecs(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_and_vorbis_codecs(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_codec(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp90_codec(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_and_opus_codecs(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", opus_codec(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_and_vorbis_codecs(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vorbis_codec(), kExternalClearKey));
+      kVideoWebMMimeType, video_webm_codecs(), kExternalClearKey));
 
-  // Non-Webm codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", avc1_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", avc3_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", unknown_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", mixed_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_invalid_extension_codec(), kExternalClearKey));
+  // Non-video WebM codecs.
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, audio_webm_codecs(), kExternalClearKey));
 
-  // Valid audio types.
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", no_codecs(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", opus_codec(), kExternalClearKey));
-  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vorbis_codec(), kExternalClearKey));
-
-  // Non-audio codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_and_opus_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_and_vorbis_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_and_opus_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_and_vorbis_codecs(), kExternalClearKey));
-
-  // Non-Webm codec.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", aac_codec(), kExternalClearKey));
+  // Invalid or non-Webm codecs.
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, invalid_codecs(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, audio_mp4_codecs(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, video_mp4_codecs(), kExternalClearKey));
 }
 
-IN_PROC_BROWSER_TEST_F(
-    EncryptedMediaIsTypeSupportedExternalClearKeyTest,
-    IsSupportedKeySystemWithMediaMimeType_ExternalClearKey_MP4) {
-  // Valid video types.
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", no_codecs(), kExternalClearKey));
-  // The parent should be supported but is not. See http://crbug.com/164303.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", no_codecs(), "org.chromium"));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_codec(), kExternalClearKey));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_codec(), kExternalClearKey));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_and_aac_codecs(), kExternalClearKey));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_and_aac_codecs(), kExternalClearKey));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", aac_codec(), kExternalClearKey));
-
-  // Extended codecs.
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_extended_codec(), kExternalClearKey));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_extended_codec(), kExternalClearKey));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_extended_and_aac_codecs(), kExternalClearKey));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_extended_and_aac_codecs(), kExternalClearKey));
-
-  // Invalid codec format: profile parameter must be present after the period.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_dot_codec(), kExternalClearKey));
-
-  // Invalid or Non-MP4 codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc2_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", mp4a_invalid_no_extension(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", vp8_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", unknown_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", mixed_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", vp8_invalid_extension_codec(), kExternalClearKey));
-
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest,
+                       Audio_WebM) {
   // Valid audio types.
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", no_codecs(), kExternalClearKey));
-  EXPECT_ECKPROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", aac_codec(), kExternalClearKey));
+  EXPECT_ECK(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, audio_webm_codecs(), kExternalClearKey));
 
-  // Non-audio codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_extended_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_extended_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_and_aac_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_and_aac_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_extended_and_aac_codecs(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_extended_and_aac_codecs(), kExternalClearKey));
+  // Non-audio WebM codecs.
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, video_webm_codecs(), kExternalClearKey));
+
+  // Invalid or non-Webm codecs.
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, invalid_codecs(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, audio_mp4_codecs(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, video_mp4_codecs(), kExternalClearKey));
+}
+
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest,
+                       Video_MP4) {
+  // Valid video types.
+  EXPECT_ECK_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, video_mp4_codecs(), kExternalClearKey));
+
+  // Non-video MP4 codecs.
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, audio_mp4_codecs(), kExternalClearKey));
+
+  // Invalid or non-MP4 codecs.
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, invalid_codecs(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, audio_webm_codecs(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, video_webm_codecs(), kExternalClearKey));
+}
+
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedExternalClearKeyTest,
+                       Audio_MP4) {
+  // Valid audio types.
+  EXPECT_ECK_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, audio_mp4_codecs(), kExternalClearKey));
+
+  // Non-audio MP4 codecs.
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, video_mp4_codecs(), kExternalClearKey));
 
   // Invalid or Non-MP4 codec.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", opus_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", vorbis_codec(), kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", mp4a_invalid_no_extension(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, invalid_codecs(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, audio_webm_codecs(), kExternalClearKey));
+  EXPECT_ECK_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, video_webm_codecs(), kExternalClearKey));
 }
 
 //
@@ -840,282 +563,87 @@
 //
 
 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
-                       Widevine_Basic) {
-  EXPECT_WV(IsConcreteSupportedKeySystem(kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kWidevineAlpha));
+                       Basic) {
+  EXPECT_WV_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kWidevine));
+  EXPECT_WV_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, no_codecs(), kWidevine));
+  EXPECT_WV_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, no_codecs(), kWidevine));
+  EXPECT_WV_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, no_codecs(), kWidevine));
 }
 
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
-                       Widevine_Parent) {
-  // The parent system is not a concrete system but is supported.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kWidevine));
-}
-
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
-                       Widevine_IsSupportedKeySystem_InvalidVariants) {
-  // Case sensitive.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("com.widevine.AlPhA"));
-  // This should fail, but currently canPlayType() converts it to lowercase.
-  // See http://crbug.com/286036.
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "com.widevine.AlPhA"));
-
-  // TLDs are not allowed.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("com."));
-  EXPECT_FALSE(
-      IsSupportedKeySystemWithMediaMimeType("video/webm", no_codecs(), "com."));
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("com"));
-  EXPECT_FALSE(
-      IsSupportedKeySystemWithMediaMimeType("video/webm", no_codecs(), "com"));
-
-  // Extra period.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("com.widevine."));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "com.widevine."));
-
-  // Incomplete.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("com.widevine.alph"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "com.widevine.alph"));
-
-  // Extra character.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("com.widevine.alphab"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "com.widevine.alphab"));
-
-  // There are no child key systems for Widevine Alpha.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem("com.widevine.alpha.foo"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), "com.widevine.alpha.foo"));
-}
-
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
-                       IsSupportedKeySystemWithMediaMimeType_Widevine_NoType) {
-  // These two should be true. See http://crbug.com/164303.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), kWidevine));
-
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), "com.widevine.foo"));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      std::string(), no_codecs(), "com.widevine.alpha.foo"));
-}
-
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
-                       IsSupportedKeySystemWithMediaMimeType_Widevine_WebM) {
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest, Video_WebM) {
   // Valid video types.
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_codec(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp80_codec(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_and_opus_codecs(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_and_vorbis_codecs(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_codec(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp90_codec(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_and_opus_codecs(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", opus_codec(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_and_vorbis_codecs(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vorbis_codec(), kWidevineAlpha));
+  EXPECT_WV_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, video_webm_codecs(), kWidevine));
 
-  // Valid video types - parent key system.
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_codec(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp80_codec(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_and_opus_codecs(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_and_vorbis_codecs(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_codec(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp90_codec(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_and_opus_codecs(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", opus_codec(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp9_and_vorbis_codecs(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vorbis_codec(), kWidevine));
+  // Non-video WebM codecs.
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, audio_webm_codecs(), kWidevine));
 
-  // Non-Webm codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", avc1_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", avc3_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", unknown_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", mixed_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", vp8_invalid_extension_codec(), kWidevineAlpha));
-
-  // Valid audio types.
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", no_codecs(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", opus_codec(), kWidevineAlpha));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vorbis_codec(), kWidevineAlpha));
-
-  // Valid audio types - parent key system.
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", no_codecs(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", opus_codec(), kWidevine));
-  EXPECT_WV(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vorbis_codec(), kWidevine));
-
-  // Non-audio codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_and_opus_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp8_and_vorbis_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_and_opus_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", vp9_and_vorbis_codecs(), kWidevineAlpha));
-
-  // Non-Webm codec.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/webm", aac_codec(), kWidevineAlpha));
+  // Invalid or non-Webm codecs.
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, invalid_codecs(), kWidevine));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, audio_mp4_codecs(), kWidevine));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, video_mp4_codecs(), kWidevine));
 }
 
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
-                       IsSupportedKeySystemWithMediaMimeType_Widevine_MP4) {
-  // Valid video types.
-  EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", no_codecs(), kWidevineAlpha));
-  EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_codec(), kWidevineAlpha));
-  EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_and_aac_codecs(), kWidevineAlpha));
-  EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_codec(), kWidevineAlpha));
-  EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_and_aac_codecs(), kWidevineAlpha));
-  EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", aac_codec(), kWidevineAlpha));
-
-  // Valid video types - parent key system.
-  EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", no_codecs(), kWidevine));
-  EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_codec(), kWidevine));
-  EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_codec(), kWidevine));
-  EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_and_aac_codecs(), kWidevine));
-  EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_and_aac_codecs(), kWidevine));
-  EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", aac_codec(), kWidevine));
-
-  // Extended codecs.
-  EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_extended_codec(), kWidevineAlpha));
-  EXPECT_WVAVC1(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_extended_codec(), kWidevineAlpha));
-  EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_extended_and_aac_codecs(), kWidevineAlpha));
-  EXPECT_WVAVC1AAC(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc3_extended_and_aac_codecs(), kWidevineAlpha));
-
-  // Invalid codec format: profile paramter must be present after the period.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc1_dot_codec(), kWidevineAlpha));
-
-  // Invalid or Non-MP4 codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", avc2_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", mp4a_invalid_no_extension(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", vp8_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", unknown_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", mixed_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/mp4", vp8_invalid_extension_codec(), kWidevineAlpha));
-
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest, Audio_WebM) {
   // Valid audio types.
-  EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", no_codecs(), kWidevineAlpha));
-  EXPECT_WVAAC(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", aac_codec(), kWidevineAlpha));
+  EXPECT_WV_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, audio_webm_codecs(), kWidevine));
 
-  // Valid audio types - parent key system.
-  EXPECT_WVMP4(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", no_codecs(), kWidevine));
-  EXPECT_WVAAC(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", aac_codec(), kWidevine));
+  // Non-audio WebM codecs.
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, video_webm_codecs(), kWidevine));
 
-  // Non-audio codecs.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_extended_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_extended_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_and_aac_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_and_aac_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc1_extended_and_aac_codecs(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", avc3_extended_and_aac_codecs(), kWidevineAlpha));
+  // Invalid or non-Webm codecs.
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, invalid_codecs(), kWidevine));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, audio_mp4_codecs(), kWidevine));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioWebMMimeType, video_mp4_codecs(), kWidevine));
+}
+
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest, Video_MP4) {
+  // Valid video types.
+  EXPECT_WV_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, video_mp4_codecs(), kWidevine));
+
+  // Non-video MP4 codecs.
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, audio_mp4_codecs(), kWidevine));
+
+  // Invalid or non-MP4 codecs.
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, invalid_codecs(), kWidevine));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, audio_webm_codecs(), kWidevine));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kVideoMP4MimeType, video_webm_codecs(), kWidevine));
+}
+
+IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest, Audio_MP4) {
+  // Valid audio types.
+  EXPECT_WV_PROPRIETARY(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, audio_mp4_codecs(), kWidevine));
+
+  // Non-audio MP4 codecs.
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, video_mp4_codecs(), kWidevine));
 
   // Invalid or Non-MP4 codec.
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", opus_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", vorbis_codec(), kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "audio/mp4", mp4a_invalid_no_extension(), kWidevineAlpha));
-}
-
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
-                       Widevine_HR_Basic) {
-  // HR support cannot be detected in tests, so this is expected to fail
-  // everywhere.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlphaHr));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kWidevineAlphaHr));
-}
-
-IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedWidevineTest,
-                       Widevine_HR_NonCompositing_Basic) {
-  // HR non-compositing support cannot be detected in tests, so this is expected
-  // to fail everywhere.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlphaHrNonCompositing));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kWidevineAlphaHrNonCompositing));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, invalid_codecs(), kWidevine));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, audio_webm_codecs(), kWidevine));
+  EXPECT_WV_NO_MATCH(IsSupportedKeySystemWithMediaMimeType(
+      kAudioMP4MimeType, video_webm_codecs(), kWidevine));
 }
 
 #if defined(ENABLE_PEPPER_CDMS)
@@ -1124,27 +652,19 @@
 // be registered with KeySystems.
 IN_PROC_BROWSER_TEST_F(EncryptedMediaIsTypeSupportedTest,
                        PepperCDMsNotRegistered) {
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kExternalClearKey));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kExternalClearKey));
 
   // This will fail in all builds unless widevine is available but not a
   // component, in which case it is registered internally
 #if !defined(WIDEVINE_CDM_AVAILABLE) || defined(WIDEVINE_CDM_IS_COMPONENT)
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kWidevineAlpha));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kWidevine));
 #endif
 
   // Clear Key should still be registered.
-  EXPECT_TRUE(IsConcreteSupportedKeySystem(kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kPrefixedClearKey));
-
-  // Not yet out from behind the vendor prefix.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kUnprefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kUnprefixedClearKey));
+  EXPECT_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kClearKey));
 }
 
 // Since this test fixture does not register the CDMs on the command line, the
@@ -1153,31 +673,26 @@
 IN_PROC_BROWSER_TEST_F(
     EncryptedMediaIsTypeSupportedClearKeyCDMRegisteredWithWrongPathTest,
     PepperCDMsRegisteredButAdapterNotPresent) {
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kExternalClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kExternalClearKey));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kExternalClearKey));
 
   // Clear Key should still be registered.
-  EXPECT_TRUE(IsConcreteSupportedKeySystem(kPrefixedClearKey));
-  EXPECT_TRUE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kPrefixedClearKey));
-
-  // Not yet out from behind the vendor prefix.
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kUnprefixedClearKey));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kUnprefixedClearKey));
+  EXPECT_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kClearKey));
 }
 
 // This will fail in all builds unless Widevine is available but not a
 // component, in which case it is registered internally.
-// TODO(xhwang): Define EXPECT_WV and run this test in all cases.
 #if !defined(WIDEVINE_CDM_AVAILABLE) || defined(WIDEVINE_CDM_IS_COMPONENT)
 IN_PROC_BROWSER_TEST_F(
     EncryptedMediaIsTypeSupportedWidevineCDMRegisteredWithWrongPathTest,
     PepperCDMsRegisteredButAdapterNotPresent) {
-  EXPECT_FALSE(IsConcreteSupportedKeySystem(kWidevineAlpha));
-  EXPECT_FALSE(IsSupportedKeySystemWithMediaMimeType(
-      "video/webm", no_codecs(), kWidevineAlpha));
+  EXPECT_UNKNOWN_KEYSYSTEM(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kWidevine));
+
+  // Clear Key should still be registered.
+  EXPECT_SUCCESS(IsSupportedKeySystemWithMediaMimeType(
+      kVideoWebMMimeType, no_codecs(), kClearKey));
 }
 #endif  // !defined(WIDEVINE_CDM_AVAILABLE) || defined(WIDEVINE_CDM_IS_COMPONENT)
 #endif  // defined(ENABLE_PEPPER_CDMS)
diff --git a/chrome/browser/media/media_stream_device_permission_context_unittest.cc b/chrome/browser/media/media_stream_device_permission_context_unittest.cc
index 3fd89276..4a942f64 100644
--- a/chrome/browser/media/media_stream_device_permission_context_unittest.cc
+++ b/chrome/browser/media/media_stream_device_permission_context_unittest.cc
@@ -7,9 +7,7 @@
 #include "base/bind.h"
 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
 #include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/permissions/permission_queue_controller.h"
 #include "chrome/browser/permissions/permission_request_id.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_profile.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
@@ -20,6 +18,10 @@
 #include "content/public/test/web_contents_tester.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+#if !defined(OS_ANDROID)
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
+#endif
+
 namespace {
 class TestPermissionContext : public MediaStreamDevicePermissionContext {
  public:
@@ -90,8 +92,11 @@
   // ChromeRenderViewHostTestHarness:
   void SetUp() override {
     ChromeRenderViewHostTestHarness::SetUp();
+#if defined(OS_ANDROID)
     InfoBarService::CreateForWebContents(web_contents());
+#else
     PermissionBubbleManager::CreateForWebContents(web_contents());
+#endif
   }
 
   DISALLOW_COPY_AND_ASSIGN(MediaStreamDevicePermissionContextTests);
diff --git a/chrome/browser/media/midi_permission_context_unittest.cc b/chrome/browser/media/midi_permission_context_unittest.cc
index 3256130e..4919f752 100644
--- a/chrome/browser/media/midi_permission_context_unittest.cc
+++ b/chrome/browser/media/midi_permission_context_unittest.cc
@@ -6,10 +6,7 @@
 
 #include "base/bind.h"
 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
-#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/permissions/permission_queue_controller.h"
 #include "chrome/browser/permissions/permission_request_id.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_profile.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
@@ -20,6 +17,12 @@
 #include "content/public/test/web_contents_tester.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+#if defined(OS_ANDROID)
+#include "chrome/browser/infobars/infobar_service.h"
+#else
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
+#endif
+
 namespace {
 
 class TestPermissionContext : public MidiPermissionContext {
@@ -32,10 +35,6 @@
 
   ~TestPermissionContext() override {}
 
-  PermissionQueueController* GetInfoBarController() {
-    return GetQueueController();
-  }
-
   bool permission_granted() {
     return permission_granted_;
   }
@@ -76,8 +75,11 @@
   // ChromeRenderViewHostTestHarness:
   void SetUp() override {
     ChromeRenderViewHostTestHarness::SetUp();
+#if defined(OS_ANDROID)
     InfoBarService::CreateForWebContents(web_contents());
+#else
     PermissionBubbleManager::CreateForWebContents(web_contents());
+#endif
   }
 
   DISALLOW_COPY_AND_ASSIGN(MidiPermissionContextTests);
diff --git a/chrome/browser/media/permission_bubble_media_access_handler.cc b/chrome/browser/media/permission_bubble_media_access_handler.cc
index ca24c45..a8c21b9 100644
--- a/chrome/browser/media/permission_bubble_media_access_handler.cc
+++ b/chrome/browser/media/permission_bubble_media_access_handler.cc
@@ -7,9 +7,8 @@
 #include "base/metrics/field_trial.h"
 #include "chrome/browser/media/media_permission.h"
 #include "chrome/browser/media/media_stream_device_permissions.h"
-#include "chrome/browser/media/media_stream_infobar_delegate.h"
+#include "chrome/browser/media/media_stream_devices_controller.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "chrome/common/pref_names.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "content/public/browser/browser_thread.h"
@@ -22,8 +21,13 @@
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
+#include "chrome/browser/media/media_stream_infobar_delegate.h"
 #include "chrome/browser/permissions/permission_update_infobar_delegate_android.h"
+#else
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
+#endif  // OS_ANDROID
 
+#if defined(OS_ANDROID)
 namespace {
 // Callback for the permission update infobar when the site and Chrome
 // permissions are mismatched on Android.
@@ -154,16 +158,14 @@
     return;
   }
 
-  if (PermissionBubbleManager::Enabled()) {
-    PermissionBubbleManager* bubble_manager =
-        PermissionBubbleManager::FromWebContents(web_contents);
-    if (bubble_manager)
-      bubble_manager->AddRequest(controller.release());
-  } else {
-    // TODO(gbillock): delete this block and the MediaStreamInfoBarDelegate
-    // when we've transitioned to bubbles. (https://crbug/337458)
-    MediaStreamInfoBarDelegate::Create(web_contents, controller.Pass());
-  }
+#if defined(OS_ANDROID)
+  MediaStreamInfoBarDelegate::Create(web_contents, controller.Pass());
+#else
+  PermissionBubbleManager* bubble_manager =
+      PermissionBubbleManager::FromWebContents(web_contents);
+  if (bubble_manager)
+    bubble_manager->AddRequest(controller.release());
+#endif
 }
 
 void PermissionBubbleMediaAccessHandler::UpdateMediaRequestState(
diff --git a/chrome/browser/media/router/media_router.h b/chrome/browser/media/router/media_router.h
index 0a335654..cbf5404 100644
--- a/chrome/browser/media/router/media_router.h
+++ b/chrome/browser/media/router/media_router.h
@@ -133,7 +133,9 @@
   // in undefined behavior.
   // If the MRPM Host is not available, the registration request will fail
   // immediately.
-  virtual void RegisterMediaSinksObserver(MediaSinksObserver* observer) = 0;
+  // The implementation can reject the request to observe in which case it will
+  // notify the caller by returning |false|.
+  virtual bool RegisterMediaSinksObserver(MediaSinksObserver* observer) = 0;
 
   // Removes a previously added MediaSinksObserver. |observer| will stop
   // receiving further updates.
diff --git a/chrome/browser/media/router/media_router_mojo_impl.cc b/chrome/browser/media/router/media_router_mojo_impl.cc
index cfdd2b8d3..a630e617 100644
--- a/chrome/browser/media/router/media_router_mojo_impl.cc
+++ b/chrome/browser/media/router/media_router_mojo_impl.cc
@@ -275,7 +275,7 @@
                         base::Unretained(this), route_id));
 }
 
-void MediaRouterMojoImpl::RegisterMediaSinksObserver(
+bool MediaRouterMojoImpl::RegisterMediaSinksObserver(
     MediaSinksObserver* observer) {
   DCHECK(thread_checker_.CalledOnValidThread());
 
@@ -297,6 +297,7 @@
   observer_list->AddObserver(observer);
   RunOrDefer(base::Bind(&MediaRouterMojoImpl::DoStartObservingMediaSinks,
                         base::Unretained(this), source_id));
+  return true;
 }
 
 void MediaRouterMojoImpl::UnregisterMediaSinksObserver(
diff --git a/chrome/browser/media/router/media_router_mojo_impl.h b/chrome/browser/media/router/media_router_mojo_impl.h
index a344e83..3560c905 100644
--- a/chrome/browser/media/router/media_router_mojo_impl.h
+++ b/chrome/browser/media/router/media_router_mojo_impl.h
@@ -128,7 +128,7 @@
   void ExecutePendingRequests();
 
   // MediaRouter implementation.
-  void RegisterMediaSinksObserver(MediaSinksObserver* observer) override;
+  bool RegisterMediaSinksObserver(MediaSinksObserver* observer) override;
   void UnregisterMediaSinksObserver(MediaSinksObserver* observer) override;
   void RegisterMediaRoutesObserver(MediaRoutesObserver* observer) override;
   void UnregisterMediaRoutesObserver(MediaRoutesObserver* observer) override;
diff --git a/chrome/browser/media/router/media_router_mojo_impl_unittest.cc b/chrome/browser/media/router/media_router_mojo_impl_unittest.cc
index e24e60dd..64be2663 100644
--- a/chrome/browser/media/router/media_router_mojo_impl_unittest.cc
+++ b/chrome/browser/media/router/media_router_mojo_impl_unittest.cc
@@ -336,7 +336,7 @@
   MediaSinksObserver* captured_observer;
   EXPECT_CALL(mock_router, RegisterMediaSinksObserver(_))
       .Times(3)
-      .WillRepeatedly(SaveArg<0>(&captured_observer));
+      .WillRepeatedly(DoAll(SaveArg<0>(&captured_observer), Return(true)));
 
   MockMediaSinksObserver sinks_observer(&mock_router, media_source);
   EXPECT_EQ(&sinks_observer, captured_observer);
diff --git a/chrome/browser/media/router/media_sinks_observer.cc b/chrome/browser/media/router/media_sinks_observer.cc
index 7a08d54..ea57e38 100644
--- a/chrome/browser/media/router/media_sinks_observer.cc
+++ b/chrome/browser/media/router/media_sinks_observer.cc
@@ -13,7 +13,7 @@
                                        const MediaSource& source)
     : source_(source), router_(router) {
   DCHECK(router_);
-  router_->RegisterMediaSinksObserver(this);
+  is_active_ = router_->RegisterMediaSinksObserver(this);
 }
 
 MediaSinksObserver::~MediaSinksObserver() {
diff --git a/chrome/browser/media/router/media_sinks_observer.h b/chrome/browser/media/router/media_sinks_observer.h
index 36037edbe..95c137c 100644
--- a/chrome/browser/media/router/media_sinks_observer.h
+++ b/chrome/browser/media/router/media_sinks_observer.h
@@ -35,9 +35,12 @@
 
   const MediaSource& source() const { return source_; }
 
+  bool is_active() const { return is_active_; }
+
  private:
   const MediaSource source_;
   MediaRouter* router_;
+  bool is_active_;
 
   DISALLOW_COPY_AND_ASSIGN(MediaSinksObserver);
 };
diff --git a/chrome/browser/media/router/mock_media_router.h b/chrome/browser/media/router/mock_media_router.h
index 14aeb44c..6c1a9e9 100644
--- a/chrome/browser/media/router/mock_media_router.h
+++ b/chrome/browser/media/router/mock_media_router.h
@@ -56,7 +56,7 @@
                void(const MediaRoute::Id& route_id));
   MOCK_METHOD1(RegisterIssuesObserver, void(IssuesObserver* observer));
   MOCK_METHOD1(UnregisterIssuesObserver, void(IssuesObserver* observer));
-  MOCK_METHOD1(RegisterMediaSinksObserver, void(MediaSinksObserver* observer));
+  MOCK_METHOD1(RegisterMediaSinksObserver, bool(MediaSinksObserver* observer));
   MOCK_METHOD1(UnregisterMediaSinksObserver,
                void(MediaSinksObserver* observer));
   MOCK_METHOD1(RegisterMediaRoutesObserver,
diff --git a/chrome/browser/media/router/mock_screen_availability_listener.h b/chrome/browser/media/router/mock_screen_availability_listener.h
index 81c3212d..719fe867 100644
--- a/chrome/browser/media/router/mock_screen_availability_listener.h
+++ b/chrome/browser/media/router/mock_screen_availability_listener.h
@@ -20,6 +20,8 @@
 
   MOCK_METHOD1(OnScreenAvailabilityChanged, void(bool available));
 
+  MOCK_METHOD0(OnScreenAvailabilityNotSupported, void());
+
  private:
   std::string availability_url_;
 };
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl.cc b/chrome/browser/media/router/presentation_service_delegate_impl.cc
index e03063d8..e201044 100644
--- a/chrome/browser/media/router/presentation_service_delegate_impl.cc
+++ b/chrome/browser/media/router/presentation_service_delegate_impl.cc
@@ -178,12 +178,19 @@
 
 bool PresentationFrame::SetScreenAvailabilityListener(
     content::PresentationScreenAvailabilityListener* listener) {
-  if (sinks_observer_ && sinks_observer_->listener() == listener) {
+  if (sinks_observer_ && sinks_observer_->listener() == listener)
     return false;
-  }
+
   MediaSource source(GetMediaSourceFromListener(listener));
   sinks_observer_.reset(
       new PresentationMediaSinksObserver(router_, listener, source));
+
+  if (!sinks_observer_->is_active()) {
+    sinks_observer_.reset();
+    listener->OnScreenAvailabilityNotSupported();
+    return false;
+  }
+
   return true;
 }
 
diff --git a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
index 2534510..056f05d 100644
--- a/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
+++ b/chrome/browser/media/router/presentation_service_delegate_impl_unittest.cc
@@ -60,6 +60,8 @@
 };
 
 TEST_F(PresentationServiceDelegateImplTest, AddScreenAvailabilityListener) {
+  ON_CALL(router_, RegisterMediaSinksObserver(_)).WillByDefault(Return(true));
+
   std::string presentation_url1("http://url1");
   std::string presentation_url2("http://url2");
   MediaSource source1 = MediaSourceForPresentationUrl(presentation_url1);
@@ -94,6 +96,8 @@
 }
 
 TEST_F(PresentationServiceDelegateImplTest, AddSameListenerTwice) {
+  ON_CALL(router_, RegisterMediaSinksObserver(_)).WillByDefault(Return(true));
+
   std::string presentation_url1("http://url1");
   MediaSource source1(MediaSourceForPresentationUrl(presentation_url1));
   MockScreenAvailabilityListener listener1(presentation_url1);
@@ -182,6 +186,8 @@
 }
 
 TEST_F(PresentationServiceDelegateImplTest, Reset) {
+  ON_CALL(router_, RegisterMediaSinksObserver(_)).WillByDefault(Return(true));
+
   std::string presentation_url1("http://url1");
   MediaSource source = MediaSourceForPresentationUrl(presentation_url1);
   MockScreenAvailabilityListener listener1(presentation_url1);
@@ -216,4 +222,17 @@
   manager.reset();
 }
 
+TEST_F(PresentationServiceDelegateImplTest, SinksObserverCantRegister) {
+  ON_CALL(router_, RegisterMediaSinksObserver(_)).WillByDefault(Return(false));
+
+  const std::string presentation_url("http://url1");
+  MockScreenAvailabilityListener listener(presentation_url);
+  const int render_process_id = 10;
+  const int render_frame_id = 1;
+
+  EXPECT_CALL(router_, RegisterMediaSinksObserver(_)).Times(1);
+  EXPECT_FALSE(delegate_impl_->AddScreenAvailabilityListener(
+      render_process_id, render_frame_id, &listener));
+}
+
 }  // namespace media_router
diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc
index df1f1cc..726c41b 100644
--- a/chrome/browser/memory/tab_manager.cc
+++ b/chrome/browser/memory/tab_manager.cc
@@ -67,6 +67,10 @@
 // machine was suspended and correct our timing statistics.
 const int kSuspendThresholdSeconds = kAdjustmentIntervalSeconds * 4;
 
+// The time during which a tab is protected from discarding after it stops being
+// audible.
+const int kAudioProtectionTimeSeconds = 60;
+
 // Returns a unique ID for a WebContents. Do not cast back to a pointer, as
 // the WebContents could be deleted if the user closed the tab.
 int64 IdFromWebContents(WebContents* web_contents) {
@@ -101,10 +105,15 @@
 #if defined(OS_CHROMEOS)
   delegate_.reset(new TabManagerDelegate);
 #endif
+  BrowserList::AddObserver(this);
 }
 
 TabManager::~TabManager() {
   Stop();
+  for (chrome::BrowserIterator iterator; !iterator.done(); iterator.Next())
+    iterator->tab_strip_model()->RemoveObserver(this);
+
+  BrowserList::RemoveObserver(this);
 }
 
 void TabManager::Start(bool discard_once) {
@@ -225,6 +234,20 @@
   OomMemoryDetails::Log(title, callback);
 }
 
+void TabManager::TabChangedAt(content::WebContents* contents,
+                              int index,
+                              TabChangeType change_type) {
+  if (change_type != TabChangeType::ALL)
+    return;
+
+  bool old_state = TabDiscardState::IsRecentlyAudible(contents);
+  bool current_state = contents->WasRecentlyAudible();
+  if (old_state != current_state) {
+    TabDiscardState::SetRecentlyAudible(contents, current_state);
+    TabDiscardState::SetLastAudioChangeTime(contents, TimeTicks::Now());
+  }
+}
+
 ///////////////////////////////////////////////////////////////////////////////
 // TabManager, private:
 
@@ -355,7 +378,7 @@
         stats.is_app = is_browser_for_app;
         stats.is_internal_page =
             IsInternalPage(contents->GetLastCommittedURL());
-        stats.is_playing_audio = contents->WasRecentlyAudible();
+        stats.is_playing_audio = IsAudioTab(contents);
         stats.is_pinned = model->IsTabPinned(i);
         stats.is_selected = browser_active && model->IsTabSelected(i);
         stats.is_discarded = TabDiscardState::IsDiscarded(contents);
@@ -424,9 +447,10 @@
   if (web_contents->GetPageImportanceSignals().had_form_interaction)
     return false;
 
-  // Do not discard tabs that are playing audio as it's too distruptive to the
-  // user experience.
-  if (web_contents->WasRecentlyAudible())
+  // We do not discard tabs that are playing audio as it's too distruptive to
+  // the user experience. Note that we also protect tabs that have recently
+  // stopped playing audio by at least |kAudioProtectionTimeSeconds| seconds.
+  if (IsAudioTab(web_contents))
     return false;
 
   // Do not discard a previously discarded tab if that's the desired behavior.
@@ -451,6 +475,22 @@
   // consider to call PurgeBrowserMemory() before CRITICAL is reached.
 }
 
+void TabManager::OnBrowserAdded(Browser* browser) {
+  browser->tab_strip_model()->AddObserver(this);
+}
+
+void TabManager::OnBrowserRemoved(Browser* browser) {
+  browser->tab_strip_model()->RemoveObserver(this);
+}
+
+bool TabManager::IsAudioTab(WebContents* contents) const {
+  if (contents->WasRecentlyAudible())
+    return true;
+  auto delta =
+      TimeTicks::Now() - TabDiscardState::LastAudioChangeTime(contents);
+  return delta < TimeDelta::FromSeconds(kAudioProtectionTimeSeconds);
+}
+
 // static
 bool TabManager::CompareTabStats(TabStats first, TabStats second) {
   // Being currently selected is most important to protect.
diff --git a/chrome/browser/memory/tab_manager.h b/chrome/browser/memory/tab_manager.h
index 3868577..aced917 100644
--- a/chrome/browser/memory/tab_manager.h
+++ b/chrome/browser/memory/tab_manager.h
@@ -15,6 +15,8 @@
 #include "base/strings/string16.h"
 #include "base/timer/timer.h"
 #include "chrome/browser/memory/tab_stats.h"
+#include "chrome/browser/ui/browser_list_observer.h"
+#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
 
 class BrowserList;
 class GURL;
@@ -42,10 +44,11 @@
 // Note that the browser tests are only active for platforms that use
 // TabManager (CrOS only for now) and need to be adjusted accordingly if
 // support for new platforms is added.
-class TabManager {
+class TabManager : public chrome::BrowserListObserver,
+                   public TabStripModelObserver {
  public:
   TabManager();
-  ~TabManager();
+  ~TabManager() override;
 
   // Number of discard events since Chrome started.
   int discard_count() const { return discard_count_; }
@@ -124,6 +127,19 @@
   void OnMemoryPressure(
       base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level);
 
+  // chrome::BrowserListObserver overrides.
+  void OnBrowserAdded(Browser* browser) override;
+  void OnBrowserRemoved(Browser* browser) override;
+
+  // TabStripModelObserver overrides.
+  void TabChangedAt(content::WebContents* contents,
+                    int index,
+                    TabChangeType change_type) override;
+
+  // Returns true if the tab is currently playing audio or has played audio
+  // recently.
+  bool IsAudioTab(content::WebContents* contents) const;
+
   // Returns true if |first| is considered less desirable to be killed than
   // |second|.
   static bool CompareTabStats(TabStats first, TabStats second);
diff --git a/chrome/browser/memory/tab_manager_unittest.cc b/chrome/browser/memory/tab_manager_unittest.cc
index c123470..484cf39 100644
--- a/chrome/browser/memory/tab_manager_unittest.cc
+++ b/chrome/browser/memory/tab_manager_unittest.cc
@@ -34,6 +34,9 @@
 };
 }  // namespace
 
+// TODO(georgesak): Add tests for protection to tabs with form input and
+// playing audio;
+
 // Tests the sorting comparator so that we know it's producing the
 // desired order.
 TEST_F(TabManagerTest, Comparator) {
diff --git a/chrome/browser/notifications/platform_notification_service_browsertest.cc b/chrome/browser/notifications/platform_notification_service_browsertest.cc
index 6c6b6a3..5497866 100644
--- a/chrome/browser/notifications/platform_notification_service_browsertest.cc
+++ b/chrome/browser/notifications/platform_notification_service_browsertest.cc
@@ -348,13 +348,10 @@
             notification.origin_url().spec());
 }
 
+// TODO(felt): This DCHECKs when bubbles are enabled, when the file_url is
+// persisted. crbug.com/502057
 IN_PROC_BROWSER_TEST_F(PlatformNotificationServiceBrowserTest,
-                       CheckFilePermissionNotGranted) {
-  // TODO(felt): This DCHECKs when bubbles are enabled, when the file_url is
-  // persisted. crbug.com/502057
-  if (PermissionBubbleManager::Enabled())
-    return;
-
+                       DISABLED_CheckFilePermissionNotGranted) {
   // This case should succeed because a normal page URL is used.
   std::string script_result;
 
diff --git a/chrome/browser/notifications/platform_notification_service_impl.cc b/chrome/browser/notifications/platform_notification_service_impl.cc
index 5db2c74a..cc5d2ae 100644
--- a/chrome/browser/notifications/platform_notification_service_impl.cc
+++ b/chrome/browser/notifications/platform_notification_service_impl.cc
@@ -6,6 +6,7 @@
 
 #include "base/command_line.h"
 #include "base/metrics/histogram_macros.h"
+#include "base/metrics/user_metrics_action.h"
 #include "base/prefs/pref_service.h"
 #include "base/strings/utf_string_conversions.h"
 #include "chrome/browser/browser_process.h"
@@ -31,6 +32,7 @@
 #include "content/public/browser/notification_event_dispatcher.h"
 #include "content/public/browser/platform_notification_context.h"
 #include "content/public/browser/storage_partition.h"
+#include "content/public/browser/user_metrics.h"
 #include "content/public/common/platform_notification_data.h"
 #include "ui/base/l10n/l10n_util.h"
 #include "ui/base/resource/resource_bundle.h"
@@ -99,6 +101,9 @@
     const GURL& origin,
     int action_index) const {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
+  content::RecordAction(
+      base::UserMetricsAction("Notifications.Persistent.Clicked"));
+
   content::NotificationEventDispatcher::GetInstance()
       ->DispatchNotificationClickEvent(
             browser_context,
@@ -113,6 +118,9 @@
     int64_t persistent_notification_id,
     const GURL& origin) const {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
+  content::RecordAction(
+      base::UserMetricsAction("Notifications.Persistent.Closed"));
+
   PlatformNotificationContext* context =
       BrowserContext::GetStoragePartitionForSite(browser_context, origin)
           ->GetPlatformNotificationContext();
@@ -279,6 +287,8 @@
   persistent_notifications_[persistent_notification_id] = notification.id();
 
   GetNotificationUIManager()->Add(notification, profile);
+  content::RecordAction(
+      base::UserMetricsAction("Notifications.Persistent.Shown"));
 
   HostContentSettingsMapFactory::GetForProfile(profile)->UpdateLastUsage(
       origin, origin, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
diff --git a/chrome/browser/password_manager/password_manager_setting_migrator_service.cc b/chrome/browser/password_manager/password_manager_setting_migrator_service.cc
index 10797ec..7aa4717 100644
--- a/chrome/browser/password_manager/password_manager_setting_migrator_service.cc
+++ b/chrome/browser/password_manager/password_manager_setting_migrator_service.cc
@@ -61,6 +61,32 @@
       prefs, password_manager::prefs::kPasswordManagerSavingEnabled);
 }
 
+void TrackInitialAndFinalValues(PrefService* prefs,
+                                bool initial_new_pref_value,
+                                bool initial_legacy_pref_value) {
+  bool final_new_pref_value =
+      prefs->GetBoolean(password_manager::prefs::kCredentialsEnableService);
+  bool final_legacy_pref_value =
+      prefs->GetBoolean(password_manager::prefs::kPasswordManagerSavingEnabled);
+  const int kMaxInitValue = 0x10;
+  int value_to_log = 0;
+  const int kInitialNewValueMask = 0x8;
+  const int kInitialLegacyValueMask = 0x4;
+  const int kFinalNewValueMask = 0x2;
+  const int kFinalLegacyValueMask = 0x1;
+  if (initial_new_pref_value)
+    value_to_log |= kInitialNewValueMask;
+  if (initial_legacy_pref_value)
+    value_to_log |= kInitialLegacyValueMask;
+  if (final_new_pref_value)
+    value_to_log |= kFinalNewValueMask;
+  if (final_legacy_pref_value)
+    value_to_log |= kFinalLegacyValueMask;
+  UMA_HISTOGRAM_ENUMERATION(
+      "PasswordManager.SettingsReconciliation.InitialAndFinalValues",
+      value_to_log, kMaxInitValue);
+}
+
 }  // namespace
 
 // static
@@ -132,8 +158,11 @@
   }
   if (ProfileSyncServiceFactory::HasProfileSyncService(profile_))
     sync_service_ = ProfileSyncServiceFactory::GetForProfile(profile_);
-  if (!CanSyncStart())
+  if (!CanSyncStart()) {
     MigrateOffState(profile_->GetPrefs());
+    TrackInitialAndFinalValues(profile_->GetPrefs(), initial_new_pref_value_,
+                               initial_legacy_pref_value_);
+  }
   InitObservers();
 }
 
@@ -235,6 +264,6 @@
       UpdatePreferencesValues(prefs, false);
     }
   }
-  // TODO(melandory) Add histogram which will log combination of initial and
-  // final values for the both preferences.
+  TrackInitialAndFinalValues(prefs, initial_new_pref_value_,
+                             initial_legacy_pref_value_);
 }
diff --git a/chrome/browser/password_manager/password_manager_setting_migrator_service_unittest.cc b/chrome/browser/password_manager/password_manager_setting_migrator_service_unittest.cc
index 961218c..16bb177 100644
--- a/chrome/browser/password_manager/password_manager_setting_migrator_service_unittest.cc
+++ b/chrome/browser/password_manager/password_manager_setting_migrator_service_unittest.cc
@@ -36,6 +36,9 @@
 const char kInitialValuesHistogramName[] =
     "PasswordManager.SettingsReconciliation.InitialValues";
 
+const char kInitialAndFinalValuesHistogramName[] =
+    "PasswordManager.SettingsReconciliation.InitialAndFinalValues";
+
 enum BooleanPrefState {
   OFF,
   ON,
@@ -52,6 +55,28 @@
   NUM_INITIAL_VALUES,
 };
 
+// Enum used for histogram tracking of the combined initial values and final
+// values for the legacy and new preferences.
+enum PasswordManagerPreferencesInitialAndFinalValues {
+  I00F00,
+  I00F01,
+  I00F10,
+  I00F11,
+  I01F00,
+  I01F01,
+  I01F10,
+  I01F11,
+  I10F00,
+  I10F01,
+  I10F10,
+  I10F11,
+  I11F00,
+  I11F01,
+  I11F10,
+  I11F11,
+  NUM_INITIAL_AND_FINAL_VALUES,
+};
+
 syncer::SyncData CreatePrefSyncData(const std::string& name, bool value) {
   base::FundamentalValue bool_value(value);
   std::string serialized;
@@ -214,31 +239,32 @@
     BooleanPrefState old_pref_sync_value;
     bool result_value;
     PasswordManagerPreferencesInitialValues histogram_initial_value;
+    PasswordManagerPreferencesInitialAndFinalValues histogram_initial_and_final;
   } kTestingTable[] = {
-      {EMPTY, EMPTY, EMPTY, EMPTY, true, N1L1},
-      {EMPTY, EMPTY, EMPTY, OFF, false, N1L1},
-      {EMPTY, EMPTY, EMPTY, ON, true, N1L1},
-      {EMPTY, EMPTY, OFF, EMPTY, false, N1L1},
-      {EMPTY, EMPTY, ON, EMPTY, true, N1L1},
-      {OFF, OFF, EMPTY, EMPTY, false, N0L0},
-      {OFF, OFF, OFF, OFF, false, N0L0},
-      {OFF, OFF, OFF, ON, true, N0L0},
-      {OFF, OFF, ON, OFF, true, N0L0},
-      {OFF, ON, OFF, ON, false, N0L1},
-      {OFF, ON, ON, OFF, false, N0L1},
-      {OFF, ON, ON, ON, true, N0L1},
-      {ON, OFF, EMPTY, EMPTY, false, N1L0},
-      {ON, OFF, OFF, ON, false, N1L0},
-      {ON, OFF, ON, OFF, false, N1L0},
-      {ON, OFF, ON, ON, true, N1L0},
-      {ON, ON, EMPTY, OFF, false, N1L1},
-      {ON, ON, EMPTY, ON, true, N1L1},
-      {ON, ON, OFF, EMPTY, false, N1L1},
-      {ON, ON, OFF, OFF, false, N1L1},
-      {ON, ON, OFF, ON, false, N1L1},
-      {ON, ON, ON, EMPTY, true, N1L1},
-      {ON, ON, ON, OFF, false, N1L1},
-      {ON, ON, ON, ON, true, N1L1},
+      {EMPTY, EMPTY, EMPTY, EMPTY, true, N1L1, I11F11},
+      {EMPTY, EMPTY, EMPTY, OFF, false, N1L1, I11F00},
+      {EMPTY, EMPTY, EMPTY, ON, true, N1L1, I11F11},
+      {EMPTY, EMPTY, OFF, EMPTY, false, N1L1, I11F00},
+      {EMPTY, EMPTY, ON, EMPTY, true, N1L1, I11F11},
+      {OFF, OFF, EMPTY, EMPTY, false, N0L0, I00F00},
+      {OFF, OFF, OFF, OFF, false, N0L0, I00F00},
+      {OFF, OFF, OFF, ON, true, N0L0, I00F11},
+      {OFF, OFF, ON, OFF, true, N0L0, I00F11},
+      {OFF, ON, OFF, ON, false, N0L1, I01F00},
+      {OFF, ON, ON, OFF, false, N0L1, I01F00},
+      {OFF, ON, ON, ON, true, N0L1, I01F11},
+      {ON, OFF, EMPTY, EMPTY, false, N1L0, I10F00},
+      {ON, OFF, OFF, ON, false, N1L0, I10F00},
+      {ON, OFF, ON, OFF, false, N1L0, I10F00},
+      {ON, OFF, ON, ON, true, N1L0, I10F11},
+      {ON, ON, EMPTY, OFF, false, N1L1, I11F00},
+      {ON, ON, EMPTY, ON, true, N1L1, I11F11},
+      {ON, ON, OFF, EMPTY, false, N1L1, I11F00},
+      {ON, ON, OFF, OFF, false, N1L1, I11F00},
+      {ON, ON, OFF, ON, false, N1L1, I11F00},
+      {ON, ON, ON, EMPTY, true, N1L1, I11F11},
+      {ON, ON, ON, OFF, false, N1L1, I11F00},
+      {ON, ON, ON, ON, true, N1L1, I11F11},
   };
 
   for (const auto& test_case : kTestingTable) {
@@ -267,6 +293,9 @@
     EXPECT_THAT(tester.GetAllSamples(kInitialValuesHistogramName),
                 testing::ElementsAre(
                     base::Bucket(test_case.histogram_initial_value, 1)));
+    EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName),
+                testing::ElementsAre(
+                    base::Bucket(test_case.histogram_initial_and_final, 1)));
   }
 }
 
@@ -331,6 +360,8 @@
     EXPECT_THAT(tester.GetAllSamples(kInitialValuesHistogramName),
                 testing::ElementsAre(
                     base::Bucket(test_case.histogram_initial_value, 1)));
+    EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName),
+                testing::IsEmpty());
   }
 }
 
@@ -341,8 +372,11 @@
   prefs->SetBoolean(prefs::kPasswordManagerSavingEnabled, false);
   ON_CALL(*profile_sync_service(), CanSyncStart())
       .WillByDefault(testing::Return(false));
+  base::HistogramTester tester;
   NotifyProfileAdded();
   ExpectValuesForBothPrefValues(false, false);
+  EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName),
+              testing::ElementsAre(base::Bucket(I10F00, 1)));
 }
 
 TEST_F(PasswordManagerSettingMigratorServiceTest,
@@ -353,8 +387,11 @@
   ASSERT_EQ(prefs->GetBoolean(prefs::kCredentialsEnableService), true);
   ON_CALL(*profile_sync_service(), CanSyncStart())
       .WillByDefault(testing::Return(false));
+  base::HistogramTester tester;
   NotifyProfileAdded();
   ExpectValuesForBothPrefValues(true, true);
+  EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName),
+              testing::ElementsAre(base::Bucket(I11F11, 1)));
 }
 
 TEST_F(PasswordManagerSettingMigratorServiceTest,
@@ -364,8 +401,11 @@
   ASSERT_EQ(prefs->GetBoolean(prefs::kCredentialsEnableService), true);
   ON_CALL(*profile_sync_service(), CanSyncStart())
       .WillByDefault(testing::Return(false));
+  base::HistogramTester tester;
   NotifyProfileAdded();
   ExpectValuesForBothPrefValues(true, true);
+  EXPECT_THAT(tester.GetAllSamples(kInitialAndFinalValuesHistogramName),
+              testing::ElementsAre(base::Bucket(I11F11, 1)));
 }
 
 }  // namespace password_manager
diff --git a/chrome/browser/password_manager/password_store_factory.cc b/chrome/browser/password_manager/password_store_factory.cc
index bcd664c..887df78 100644
--- a/chrome/browser/password_manager/password_store_factory.cc
+++ b/chrome/browser/password_manager/password_store_factory.cc
@@ -292,7 +292,8 @@
   LocalProfileId id = GetLocalProfileId(prefs);
 
   scoped_ptr<PasswordStoreX::NativeBackend> backend;
-  if (used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4) {
+  if (used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
+      used_desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE5) {
     // KDE3 didn't use DBus, which our KWallet store uses.
     VLOG(1) << "Trying KWallet for password storage.";
     backend.reset(new NativeBackendKWallet(id));
@@ -387,7 +388,8 @@
     const std::string& command_line_flag,
     LinuxBackendUsed used_backend) {
   LinuxBackendUsage usage = OTHER_PLAINTEXT;
-  if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4) {
+  if (desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
+      desktop_env == base::nix::DESKTOP_ENVIRONMENT_KDE5) {
     if (command_line_flag == "kwallet") {
       usage = used_backend == KWALLET ? KDE_KWALLETFLAG_KWALLET
                                       : KDE_KWALLETFLAG_PLAINTEXT;
diff --git a/chrome/browser/permissions/permission_bubble_request_impl.cc b/chrome/browser/permissions/permission_bubble_request_impl.cc
index 6e2e480..9ff47699 100644
--- a/chrome/browser/permissions/permission_bubble_request_impl.cc
+++ b/chrome/browser/permissions/permission_bubble_request_impl.cc
@@ -75,7 +75,7 @@
     case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
       icon_id = IDR_ALLOWED_MIDI_SYSEX;
       break;
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS)
     case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
       icon_id = IDR_INFOBAR_PROTECTED_MEDIA_IDENTIFIER;
       break;
@@ -104,7 +104,7 @@
     case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
       message_id = IDS_PUSH_MESSAGES_PERMISSION_QUESTION;
       break;
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS)
     case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
       message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_INFOBAR_QUESTION;
       break;
@@ -135,7 +135,7 @@
     case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
       message_id = IDS_PUSH_MESSAGES_BUBBLE_FRAGMENT;
       break;
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
+#if defined(OS_CHROMEOS)
     case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
       message_id = IDS_PROTECTED_MEDIA_IDENTIFIER_PERMISSION_FRAGMENT;
       break;
diff --git a/chrome/browser/permissions/permission_context_base.cc b/chrome/browser/permissions/permission_context_base.cc
index f329b2bb..e544ed6c 100644
--- a/chrome/browser/permissions/permission_context_base.cc
+++ b/chrome/browser/permissions/permission_context_base.cc
@@ -7,12 +7,9 @@
 #include "base/logging.h"
 #include "base/prefs/pref_service.h"
 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
-#include "chrome/browser/permissions/permission_bubble_request_impl.h"
 #include "chrome/browser/permissions/permission_context_uma_util.h"
-#include "chrome/browser/permissions/permission_queue_controller.h"
 #include "chrome/browser/permissions/permission_request_id.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "chrome/common/pref_names.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "components/content_settings/core/browser/website_settings_registry.h"
@@ -20,14 +17,23 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/origin_util.h"
 
+#if defined(OS_ANDROID)
+#include "chrome/browser/permissions/permission_queue_controller.h"
+#else
+#include "chrome/browser/permissions/permission_bubble_request_impl.h"
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
+#endif
+
 PermissionContextBase::PermissionContextBase(
     Profile* profile,
     const ContentSettingsType permission_type)
     : profile_(profile),
       permission_type_(permission_type),
       weak_factory_(this) {
+#if defined(OS_ANDROID)
   permission_queue_controller_.reset(
       new PermissionQueueController(profile_, permission_type_));
+#endif
 }
 
 PermissionContextBase::~PermissionContextBase() {
@@ -79,18 +85,16 @@
     const PermissionRequestID& id) {
   DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
 
-  if (PermissionBubbleManager::Enabled()) {
-    PermissionBubbleRequest* cancelling =
-        pending_bubbles_.get(id.ToString());
-    if (cancelling != NULL && web_contents != NULL &&
-        PermissionBubbleManager::FromWebContents(web_contents) != NULL) {
-      PermissionBubbleManager::FromWebContents(web_contents)->
-          CancelRequest(cancelling);
-    }
-    return;
-  }
-
+#if defined(OS_ANDROID)
   GetQueueController()->CancelInfoBarRequest(id);
+#else
+  PermissionBubbleRequest* cancelling = pending_bubbles_.get(id.ToString());
+  if (cancelling != NULL && web_contents != NULL &&
+      PermissionBubbleManager::FromWebContents(web_contents) != NULL) {
+    PermissionBubbleManager::FromWebContents(web_contents)
+        ->CancelRequest(cancelling);
+  }
+#endif
 }
 
 void PermissionContextBase::DecidePermission(
@@ -140,30 +144,26 @@
   PermissionContextUmaUtil::PermissionRequested(
       permission_type_, requesting_origin, embedding_origin, profile_);
 
-  if (PermissionBubbleManager::Enabled()) {
-    PermissionBubbleManager* bubble_manager =
-        PermissionBubbleManager::FromWebContents(web_contents);
-    DCHECK(bubble_manager);
-    scoped_ptr<PermissionBubbleRequest> request_ptr(
-        new PermissionBubbleRequestImpl(
-            requesting_origin, user_gesture, permission_type_,
-            profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
-            base::Bind(&PermissionContextBase::PermissionDecided,
-                       weak_factory_.GetWeakPtr(), id, requesting_origin,
-                       embedding_origin, callback),
-            base::Bind(&PermissionContextBase::CleanUpBubble,
-                       weak_factory_.GetWeakPtr(), id)));
-    PermissionBubbleRequest* request = request_ptr.get();
+#if !defined(OS_ANDROID)
+  PermissionBubbleManager* bubble_manager =
+      PermissionBubbleManager::FromWebContents(web_contents);
+  DCHECK(bubble_manager);
+  scoped_ptr<PermissionBubbleRequest> request_ptr(
+      new PermissionBubbleRequestImpl(
+          requesting_origin, user_gesture, permission_type_,
+          profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
+          base::Bind(&PermissionContextBase::PermissionDecided,
+                     weak_factory_.GetWeakPtr(), id, requesting_origin,
+                     embedding_origin, callback),
+          base::Bind(&PermissionContextBase::CleanUpBubble,
+                     weak_factory_.GetWeakPtr(), id)));
+  PermissionBubbleRequest* request = request_ptr.get();
 
-    bool inserted = pending_bubbles_.add(
-        id.ToString(), request_ptr.Pass()).second;
-    DCHECK(inserted) << "Duplicate id " << id.ToString();
-    bubble_manager->AddRequest(request);
-    return;
-  }
-
-  // TODO(gbillock): Delete this and the infobar delegate when
-  // we're using only bubbles. crbug.com/337458
+  bool inserted =
+      pending_bubbles_.add(id.ToString(), request_ptr.Pass()).second;
+  DCHECK(inserted) << "Duplicate id " << id.ToString();
+  bubble_manager->AddRequest(request);
+#else
   GetQueueController()->CreateInfoBarRequest(
       id, requesting_origin, embedding_origin,
       base::Bind(&PermissionContextBase::PermissionDecided,
@@ -172,6 +172,7 @@
                  // the queue controller takes care of persisting the
                  // permission
                  false));
+#endif
 }
 
 void PermissionContextBase::PermissionDecided(
@@ -181,32 +182,34 @@
     const BrowserPermissionCallback& callback,
     bool persist,
     ContentSetting content_setting) {
-  // Infobar persistance and its related UMA is tracked on the infobar
+#if !defined(OS_ANDROID)
+  // Infobar persistence and its related UMA is tracked on the infobar
   // controller directly.
-  if (PermissionBubbleManager::Enabled()) {
-    if (persist) {
-      DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
-             content_setting == CONTENT_SETTING_BLOCK);
-      if (content_setting == CONTENT_SETTING_ALLOW)
-        PermissionContextUmaUtil::PermissionGranted(permission_type_,
-                                                    requesting_origin);
-      else
-        PermissionContextUmaUtil::PermissionDenied(permission_type_,
-                                                   requesting_origin);
-    } else {
-      DCHECK_EQ(content_setting, CONTENT_SETTING_DEFAULT);
-      PermissionContextUmaUtil::PermissionDismissed(permission_type_,
-                                                    requesting_origin);
-    }
+  if (persist) {
+    DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
+           content_setting == CONTENT_SETTING_BLOCK);
+    if (content_setting == CONTENT_SETTING_ALLOW)
+      PermissionContextUmaUtil::PermissionGranted(permission_type_,
+                                                  requesting_origin);
+    else
+      PermissionContextUmaUtil::PermissionDenied(permission_type_,
+                                                 requesting_origin);
+  } else {
+    DCHECK_EQ(content_setting, CONTENT_SETTING_DEFAULT);
+    PermissionContextUmaUtil::PermissionDismissed(permission_type_,
+                                                  requesting_origin);
   }
+#endif
 
   NotifyPermissionSet(id, requesting_origin, embedding_origin, callback,
                       persist, content_setting);
 }
 
+#if defined(OS_ANDROID)
 PermissionQueueController* PermissionContextBase::GetQueueController() {
   return permission_queue_controller_.get();
 }
+#endif
 
 Profile* PermissionContextBase::profile() const {
   return profile_;
diff --git a/chrome/browser/permissions/permission_context_base.h b/chrome/browser/permissions/permission_context_base.h
index 440880b95..6c084e17 100644
--- a/chrome/browser/permissions/permission_context_base.h
+++ b/chrome/browser/permissions/permission_context_base.h
@@ -15,7 +15,9 @@
 #include "components/keyed_service/core/keyed_service.h"
 #include "url/gurl.h"
 
+#if defined(OS_ANDROID)
 class PermissionQueueController;
+#endif
 class PermissionRequestID;
 class Profile;
 
@@ -111,8 +113,10 @@
                                 const GURL& requesting_origin,
                                 bool allowed) {}
 
+#if defined(OS_ANDROID)
   // Return an instance of the infobar queue controller, creating it if needed.
   PermissionQueueController* GetQueueController();
+#endif
 
   // Returns the profile associated with this permission context.
   Profile* profile() const;
@@ -133,7 +137,9 @@
 
   Profile* profile_;
   const ContentSettingsType permission_type_;
+#if defined(OS_ANDROID)
   scoped_ptr<PermissionQueueController> permission_queue_controller_;
+#endif
   base::ScopedPtrHashMap<std::string, scoped_ptr<PermissionBubbleRequest>>
       pending_bubbles_;
 
diff --git a/chrome/browser/permissions/permission_context_base_unittest.cc b/chrome/browser/permissions/permission_context_base_unittest.cc
index 3e672099..031a90c 100644
--- a/chrome/browser/permissions/permission_context_base_unittest.cc
+++ b/chrome/browser/permissions/permission_context_base_unittest.cc
@@ -8,9 +8,7 @@
 #include "base/command_line.h"
 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
 #include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/permissions/permission_queue_controller.h"
 #include "chrome/browser/permissions/permission_request_id.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
 #include "chrome/common/chrome_switches.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_profile.h"
@@ -23,6 +21,12 @@
 #include "content/public/test/web_contents_tester.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+#if defined(OS_ANDROID)
+#include "chrome/browser/permissions/permission_queue_controller.h"
+#else
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
+#endif
+
 class TestPermissionContext : public PermissionContextBase {
  public:
   TestPermissionContext(Profile* profile,
@@ -34,9 +38,11 @@
 
   ~TestPermissionContext() override {}
 
+#if defined(OS_ANDROID)
   PermissionQueueController* GetInfoBarController() {
     return GetQueueController();
   }
+#endif
 
   bool permission_granted() {
     return permission_granted_;
@@ -81,18 +87,17 @@
                            const PermissionRequestID& id,
                            const GURL& url,
                            bool accept) {
-    if (!PermissionBubbleManager::Enabled()) {
-      context->GetInfoBarController()->OnPermissionSet(
-          id, url, url, accept, accept);
-      return;
-    }
-
+#if defined(OS_ANDROID)
+    context->GetInfoBarController()->OnPermissionSet(id, url, url, accept,
+                                                     accept);
+#else
     PermissionBubbleManager* manager =
         PermissionBubbleManager::FromWebContents(web_contents());
     if (accept)
       manager->Accept();
     else
       manager->Closing();
+#endif
   }
 
   void TestAskAndGrant_TestContent() {
@@ -231,8 +236,11 @@
   // ChromeRenderViewHostTestHarness:
   void SetUp() override {
     ChromeRenderViewHostTestHarness::SetUp();
+#if defined(OS_ANDROID)
     InfoBarService::CreateForWebContents(web_contents());
+#else
     PermissionBubbleManager::CreateForWebContents(web_contents());
+#endif
   }
 
   DISALLOW_COPY_AND_ASSIGN(PermissionContextBaseTests);
diff --git a/chrome/browser/permissions/permission_manager.cc b/chrome/browser/permissions/permission_manager.cc
index 6aa0728d..26ed924 100644
--- a/chrome/browser/permissions/permission_manager.cc
+++ b/chrome/browser/permissions/permission_manager.cc
@@ -10,13 +10,17 @@
 #include "chrome/browser/permissions/permission_context_base.h"
 #include "chrome/browser/permissions/permission_request_id.h"
 #include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
+#include "chrome/browser/tab_contents/tab_util.h"
 #include "components/content_settings/core/browser/host_content_settings_map.h"
 #include "content/public/browser/permission_type.h"
 #include "content/public/browser/render_frame_host.h"
 #include "content/public/browser/render_process_host.h"
 #include "content/public/browser/web_contents.h"
 
+#if !defined(OS_ANDROID)
+#include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
+#endif
+
 using content::PermissionStatus;
 using content::PermissionType;
 
@@ -79,14 +83,6 @@
   return CONTENT_SETTINGS_TYPE_DEFAULT;
 }
 
-// Helper method that wraps a callback a void(PermissionStatus)
-// callback into a void(ContentSetting) callback.
-void PermissionStatusCallbackWrapper(
-    const base::Callback<void(PermissionStatus)>& callback,
-    ContentSetting content_setting) {
-  callback.Run(ContentSettingToPermissionStatus(content_setting));
-}
-
 // Returns whether the permission has a constant PermissionStatus value (i.e.
 // always approved or always denied)
 // The PermissionTypes for which true is returned should be exactly those which
@@ -122,6 +118,19 @@
 
 }  // anonymous namespace
 
+struct PermissionManager::PendingRequest {
+  PendingRequest(PermissionType permission,
+                 content::RenderFrameHost* render_frame_host)
+    : permission(permission),
+      render_process_id(render_frame_host->GetProcess()->GetID()),
+      render_frame_id(render_frame_host->GetRoutingID()) {
+  }
+
+  PermissionType permission;
+  int render_process_id;
+  int render_frame_id;
+};
+
 struct PermissionManager::Subscription {
   PermissionType permission;
   GURL requesting_origin;
@@ -131,7 +140,8 @@
 };
 
 PermissionManager::PermissionManager(Profile* profile)
-    : profile_(profile) {
+    : profile_(profile),
+      weak_ptr_factory_(this) {
 }
 
 PermissionManager::~PermissionManager() {
@@ -140,22 +150,21 @@
         ->RemoveObserver(this);
 }
 
-void PermissionManager::RequestPermission(
+int PermissionManager::RequestPermission(
     PermissionType permission,
     content::RenderFrameHost* render_frame_host,
-    int request_id,
     const GURL& requesting_origin,
     bool user_gesture,
     const base::Callback<void(PermissionStatus)>& callback) {
   if (IsConstantPermission(permission)) {
     callback.Run(GetPermissionStatusForConstantPermission(permission));
-    return;
+    return kNoPendingOperation;
   }
 
   PermissionContextBase* context = PermissionContext::Get(profile_, permission);
   if (!context) {
     callback.Run(content::PERMISSION_STATUS_DENIED);
-    return;
+    return kNoPendingOperation;
   }
 
   content::WebContents* web_contents =
@@ -164,41 +173,56 @@
     callback.Run(
         GetPermissionStatus(permission, requesting_origin,
                             web_contents->GetLastCommittedURL().GetOrigin()));
-    return;
+    return kNoPendingOperation;
   }
 
-  int render_process_id = render_frame_host->GetProcess()->GetID();
-  int render_frame_id = render_frame_host->GetRoutingID();
-  const PermissionRequestID request(render_process_id,
-                                    render_frame_id,
+  PendingRequest* pending_request = new PendingRequest(
+      permission, render_frame_host);
+  int request_id = pending_requests_.Add(pending_request);
+  const PermissionRequestID request(pending_request->render_process_id,
+                                    pending_request->render_frame_id,
                                     request_id);
 
   context->RequestPermission(
       web_contents, request, requesting_origin, user_gesture,
-      base::Bind(&PermissionStatusCallbackWrapper, callback));
+      base::Bind(&PermissionManager::OnPermissionRequestResponse,
+                 weak_ptr_factory_.GetWeakPtr(),
+                 request_id,
+                 callback));
+  return request_id;
 }
 
-void PermissionManager::CancelPermissionRequest(
-    PermissionType permission,
-    content::RenderFrameHost* render_frame_host,
+void PermissionManager::OnPermissionRequestResponse(
     int request_id,
-    const GURL& requesting_origin) {
-  PermissionContextBase* context = PermissionContext::Get(profile_, permission);
+    const base::Callback<void(PermissionStatus)>& callback,
+    ContentSetting content_setting) {
+  pending_requests_.Remove(request_id);
+  callback.Run(ContentSettingToPermissionStatus(content_setting));
+}
+
+void PermissionManager::CancelPermissionRequest(int request_id) {
+  PendingRequest* pending_request = pending_requests_.Lookup(request_id);
+  if (!pending_request)
+    return;
+
+  PermissionContextBase* context = PermissionContext::Get(
+      profile_, pending_request->permission);
   if (!context)
     return;
 
-  content::WebContents* web_contents =
-      content::WebContents::FromRenderFrameHost(render_frame_host);
-  if (IsPermissionBubbleManagerMissing(web_contents))
+  content::WebContents* web_contents = tab_util::GetWebContentsByFrameID(
+      pending_request->render_process_id, pending_request->render_frame_id);
+  DCHECK(web_contents);
+  if (IsPermissionBubbleManagerMissing(web_contents)) {
+    pending_requests_.Remove(request_id);
     return;
+  }
 
-  int render_process_id = render_frame_host->GetProcess()->GetID();
-  int render_frame_id = render_frame_host->GetRoutingID();
-  const PermissionRequestID request(render_process_id,
-                                    render_frame_id,
+  const PermissionRequestID request(pending_request->render_process_id,
+                                    pending_request->render_frame_id,
                                     request_id);
-
   context->CancelPermissionRequest(web_contents, request);
+  pending_requests_.Remove(request_id);
 }
 
 void PermissionManager::ResetPermission(PermissionType permission,
@@ -278,11 +302,12 @@
 
 bool PermissionManager::IsPermissionBubbleManagerMissing(
     content::WebContents* web_contents) {
+#if defined(OS_ANDROID)
   // Can't be missing if it isn't needed to begin with.
-  if (!PermissionBubbleManager::Enabled())
-    return false;
-
+  return false;
+#else
   return PermissionBubbleManager::FromWebContents(web_contents) == nullptr;
+#endif
 }
 
 void PermissionManager::OnContentSettingChanged(
diff --git a/chrome/browser/permissions/permission_manager.h b/chrome/browser/permissions/permission_manager.h
index 3426535..118bd3f9 100644
--- a/chrome/browser/permissions/permission_manager.h
+++ b/chrome/browser/permissions/permission_manager.h
@@ -8,7 +8,9 @@
 #include "base/callback_forward.h"
 #include "base/id_map.h"
 #include "base/macros.h"
+#include "base/memory/weak_ptr.h"
 #include "components/content_settings/core/browser/content_settings_observer.h"
+#include "components/content_settings/core/common/content_settings.h"
 #include "components/keyed_service/core/keyed_service.h"
 #include "content/public/browser/permission_manager.h"
 
@@ -28,17 +30,13 @@
   ~PermissionManager() override;
 
   // content::PermissionManager implementation.
-  void RequestPermission(
+  int RequestPermission(
       content::PermissionType permission,
       content::RenderFrameHost* render_frame_host,
-      int request_id,
       const GURL& requesting_origin,
       bool user_gesture,
       const base::Callback<void(content::PermissionStatus)>& callback) override;
-  void CancelPermissionRequest(content::PermissionType permission,
-                               content::RenderFrameHost* render_frame_host,
-                               int request_id,
-                               const GURL& requesting_origin) override;
+  void CancelPermissionRequest(int request_id) override;
   void ResetPermission(content::PermissionType permission,
                        const GURL& requesting_origin,
                        const GURL& embedding_origin) override;
@@ -57,9 +55,17 @@
   void UnsubscribePermissionStatusChange(int subscription_id) override;
 
  private:
+  struct PendingRequest;
+  using PendingRequestsMap = IDMap<PendingRequest, IDMapOwnPointer>;
+
   struct Subscription;
   using SubscriptionsMap = IDMap<Subscription, IDMapOwnPointer>;
 
+  void OnPermissionRequestResponse(
+      int request_id,
+      const base::Callback<void(content::PermissionStatus)>& callback,
+      ContentSetting content_setting);
+
   // Not all WebContents are able to display permission requests. If the PBM
   // is required but missing for |web_contents|, don't pass along the request.
   bool IsPermissionBubbleManagerMissing(content::WebContents* web_contents);
@@ -71,8 +77,11 @@
                                std::string resource_identifier) override;
 
   Profile* profile_;
+  PendingRequestsMap pending_requests_;
   SubscriptionsMap subscriptions_;
 
+  base::WeakPtrFactory<PermissionManager> weak_ptr_factory_;
+
   DISALLOW_COPY_AND_ASSIGN(PermissionManager);
 };
 
diff --git a/chrome/browser/permissions/permission_queue_controller.cc b/chrome/browser/permissions/permission_queue_controller.cc
index 269e7b20b..ea3d8d0 100644
--- a/chrome/browser/permissions/permission_queue_controller.cc
+++ b/chrome/browser/permissions/permission_queue_controller.cc
@@ -10,6 +10,7 @@
 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/media/midi_permission_infobar_delegate.h"
+#include "chrome/browser/media/protected_media_identifier_infobar_delegate.h"
 #include "chrome/browser/notifications/notification_permission_infobar_delegate.h"
 #include "chrome/browser/permissions/permission_context_uma_util.h"
 #include "chrome/browser/permissions/permission_request_id.h"
@@ -27,10 +28,6 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/common/url_constants.h"
 
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
-#include "chrome/browser/media/protected_media_identifier_infobar_delegate.h"
-#endif
-
 namespace {
 
 InfoBarService* GetInfoBarService(const PermissionRequestID& id) {
@@ -143,13 +140,11 @@
           GetInfoBarService(id_), requesting_frame_,
           display_languages, type_, callback);
       break;
-#if defined(OS_ANDROID) || defined(OS_CHROMEOS)
     case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
       infobar_ = ProtectedMediaIdentifierInfoBarDelegate::Create(
           GetInfoBarService(id_), requesting_frame_,
           display_languages, callback);
       break;
-#endif
     case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE:
       infobar_ = DurableStoragePermissionInfoBarDelegate::Create(
           GetInfoBarService(id_), requesting_frame_,
diff --git a/chrome/browser/permissions/permission_queue_controller.h b/chrome/browser/permissions/permission_queue_controller.h
index cbc5273..1ec3b1e 100644
--- a/chrome/browser/permissions/permission_queue_controller.h
+++ b/chrome/browser/permissions/permission_queue_controller.h
@@ -17,7 +17,7 @@
 class Profile;
 
 // This class controls an infobar queue per profile, and it's used by
-// GeolocationPermissionContext, and so on.
+// GeolocationPermissionContext, and so on. It is only used on Android.
 // An alternate approach would be to have this queue per tab, and use
 // notifications to broadcast when permission is set / listen to notification to
 // cancel pending requests. This may be specially useful if there are other
diff --git a/chrome/browser/permissions/permission_update_infobar_delegate_android.cc b/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
index 3edeaaf..14cb86e 100644
--- a/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
+++ b/chrome/browser/permissions/permission_update_infobar_delegate_android.cc
@@ -4,8 +4,6 @@
 
 #include "chrome/browser/permissions/permission_update_infobar_delegate_android.h"
 
-#include <string>
-
 #include "base/android/jni_array.h"
 #include "base/callback_helpers.h"
 #include "base/memory/scoped_ptr.h"
@@ -30,6 +28,51 @@
       << "Caller should check ShouldShowPermissionInfobar before creating the "
       << "infobar.";
 
+  content::ContentViewCore* cvc =
+      content::ContentViewCore::FromWebContents(web_contents);
+  ui::WindowAndroid* window_android = cvc->GetWindowAndroid();
+
+  std::vector<std::string> permissions;
+  int message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT;
+
+  for (ContentSettingsType content_settings_type : content_settings_types) {
+    std::string android_permission =
+        PrefServiceBridge::GetAndroidPermissionForContentSetting(
+            content_settings_type);
+
+    if (!android_permission.empty() &&
+        !window_android->HasPermission(android_permission)) {
+      permissions.push_back(android_permission);
+
+      switch (content_settings_type) {
+        case CONTENT_SETTINGS_TYPE_GEOLOCATION:
+          message_id = IDS_INFOBAR_MISSING_LOCATION_PERMISSION_TEXT;
+          break;
+        case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
+          message_id = IDS_INFOBAR_MISSING_MICROPHONE_PERMISSION_TEXT;
+          break;
+        case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
+          message_id = IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT;
+          break;
+        default:
+          NOTREACHED();
+          message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT;
+      }
+    }
+  }
+  if (permissions.size() > 1)
+    message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT;
+
+  return PermissionUpdateInfoBarDelegate::Create(
+      web_contents, permissions, message_id, callback);
+}
+
+// static
+infobars::InfoBar* PermissionUpdateInfoBarDelegate::Create(
+    content::WebContents* web_contents,
+    const std::vector<std::string>& android_permissions,
+    int permission_msg_id,
+    const PermissionUpdatedCallback& callback) {
   InfoBarService* infobar_service =
       InfoBarService::FromWebContents(web_contents);
   if (!infobar_service) {
@@ -39,7 +82,7 @@
 
   return infobar_service->AddInfoBar(infobar_service->CreateConfirmInfoBar(
       scoped_ptr<ConfirmInfoBarDelegate>(new PermissionUpdateInfoBarDelegate(
-          web_contents, content_settings_types, callback))));
+          web_contents, android_permissions, permission_msg_id, callback))));
 }
 
 // static
@@ -83,25 +126,19 @@
 
 PermissionUpdateInfoBarDelegate::PermissionUpdateInfoBarDelegate(
     content::WebContents* web_contents,
-    const std::vector<ContentSettingsType>& content_settings_types,
+    const std::vector<std::string>& android_permissions,
+    int permission_msg_id,
     const PermissionUpdatedCallback& callback)
     : ConfirmInfoBarDelegate(),
-      content_settings_types_(content_settings_types),
+      android_permissions_(android_permissions),
+      permission_msg_id_(permission_msg_id),
       callback_(callback) {
-  std::vector<int> content_settings_type_values;
-  for (ContentSettingsType type : content_settings_types)
-    content_settings_type_values.push_back(type);
-
   JNIEnv* env = base::android::AttachCurrentThread();
   java_delegate_.Reset(Java_PermissionUpdateInfoBarDelegate_create(
       env,
       reinterpret_cast<intptr_t>(this),
       web_contents->GetJavaWebContents().obj(),
-      base::android::ToJavaIntArray(env, content_settings_type_values).obj()));
-
-  content::ContentViewCore* cvc =
-        content::ContentViewCore::FromWebContents(web_contents);
-  window_android_ = cvc->GetWindowAndroid();
+      base::android::ToJavaArrayOfStrings(env, android_permissions_).obj()));
 }
 
 PermissionUpdateInfoBarDelegate::~PermissionUpdateInfoBarDelegate() {
@@ -117,41 +154,7 @@
 }
 
 base::string16 PermissionUpdateInfoBarDelegate::GetMessageText() const {
-  int missing_permission_count = 0;
-  int message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT;
-
-  for (ContentSettingsType content_settings_type : content_settings_types_) {
-    std::string android_permission =
-        PrefServiceBridge::GetAndroidPermissionForContentSetting(
-            content_settings_type);
-
-    if (!android_permission.empty() &&
-        !window_android_->HasPermission(android_permission)) {
-      missing_permission_count++;
-
-      switch (content_settings_type) {
-        case CONTENT_SETTINGS_TYPE_GEOLOCATION:
-          message_id = IDS_INFOBAR_MISSING_LOCATION_PERMISSION_TEXT;
-          break;
-        case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
-          message_id = IDS_INFOBAR_MISSING_MICROPHONE_PERMISSION_TEXT;
-          break;
-        case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
-          message_id = IDS_INFOBAR_MISSING_CAMERA_PERMISSION_TEXT;
-          break;
-        default:
-          NOTREACHED();
-          message_id = IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT;
-      }
-    }
-
-    if (missing_permission_count > 1) {
-      return l10n_util::GetStringUTF16(
-          IDS_INFOBAR_MISSING_MULTIPLE_PERMISSIONS_TEXT);
-    }
-  }
-
-  return l10n_util::GetStringUTF16(message_id);
+  return l10n_util::GetStringUTF16(permission_msg_id_);
 }
 
 int PermissionUpdateInfoBarDelegate::GetButtons() const {
diff --git a/chrome/browser/permissions/permission_update_infobar_delegate_android.h b/chrome/browser/permissions/permission_update_infobar_delegate_android.h
index 1500e7971..e590914c 100644
--- a/chrome/browser/permissions/permission_update_infobar_delegate_android.h
+++ b/chrome/browser/permissions/permission_update_infobar_delegate_android.h
@@ -6,6 +6,7 @@
 #define CHROME_BROWSER_PERMISSIONS_PERMISSION_UPDATE_INFOBAR_DELEGATE_ANDROID_H_
 
 #include <jni.h>
+#include <string>
 #include <vector>
 
 #include "base/android/scoped_java_ref.h"
@@ -18,24 +19,29 @@
 class WebContents;
 }
 
-namespace ui {
-class WindowAndroid;
-}
-
 // An infobar delegate to be used for requesting missing Android runtime
 // permissions for previously allowed ContentSettingsTypes.
 class PermissionUpdateInfoBarDelegate : public ConfirmInfoBarDelegate {
  public:
   using PermissionUpdatedCallback = base::Callback<void(bool)>;
 
-  // Creates an infobar to resolve conflicts in Android runtime permissions
-  // and adds the infobar to |infobar_service|.  Returns the infobar if it was
-  // successfully added.
+  // Creates an infobar to resolve conflicts in Android runtime permissions.
+  // The necessary runtime permissions are generated based on the list of
+  // ContentSettingsTypes passed in. Returns the infobar if it was successfully
+  // added.
   static infobars::InfoBar* Create(
       content::WebContents* web_contents,
       const std::vector<ContentSettingsType>& content_settings_types,
       const PermissionUpdatedCallback& callback);
 
+  // Creates an infobar to resolve conflicts in Android runtime permissions.
+  // Returns the infobar if it was successfully added.
+  static infobars::InfoBar* Create(
+      content::WebContents* web_contents,
+      const std::vector<std::string>& android_permissions,
+      int permission_msg_id,
+      const PermissionUpdatedCallback& callback);
+
   // Return whether the runtime permissions currently granted to Chrome by
   // Android are compatible with ContentSettingTypes previously granted to a
   // site by the user.
@@ -51,7 +57,8 @@
  private:
   PermissionUpdateInfoBarDelegate(
       content::WebContents* web_contents,
-      const std::vector<ContentSettingsType>& content_settings_types,
+      const std::vector<std::string>& android_permissions,
+      int permission_msg_id,
       const PermissionUpdatedCallback& callback);
   ~PermissionUpdateInfoBarDelegate() override;
 
@@ -69,9 +76,9 @@
   void InfoBarDismissed() override;
 
   base::android::ScopedJavaGlobalRef<jobject> java_delegate_;
-  std::vector<ContentSettingsType> content_settings_types_;
+  std::vector<std::string> android_permissions_;
+  int permission_msg_id_;
   PermissionUpdatedCallback callback_;
-  ui::WindowAndroid* window_android_;
 
   DISALLOW_COPY_AND_ASSIGN(PermissionUpdateInfoBarDelegate);
 };
diff --git a/chrome/browser/printing/printer_manager_dialog_linux.cc b/chrome/browser/printing/printer_manager_dialog_linux.cc
index a568b99..5a0a003 100644
--- a/chrome/browser/printing/printer_manager_dialog_linux.cc
+++ b/chrome/browser/printing/printer_manager_dialog_linux.cc
@@ -34,6 +34,7 @@
     case base::nix::DESKTOP_ENVIRONMENT_GNOME:
     case base::nix::DESKTOP_ENVIRONMENT_KDE3:
     case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+    case base::nix::DESKTOP_ENVIRONMENT_KDE5:
     case base::nix::DESKTOP_ENVIRONMENT_UNITY:
     case base::nix::DESKTOP_ENVIRONMENT_XFCE:
       command = kGNOMEPrinterConfigCommand;
diff --git a/chrome/browser/profiles/avatar_menu.cc b/chrome/browser/profiles/avatar_menu.cc
index 6b7fee6..2b5a5924 100644
--- a/chrome/browser/profiles/avatar_menu.cc
+++ b/chrome/browser/profiles/avatar_menu.cc
@@ -39,14 +39,6 @@
 
 using content::BrowserThread;
 
-namespace {
-
-// Constants for the show profile switcher experiment
-const char kShowProfileSwitcherFieldTrialName[] = "ShowProfileSwitcher";
-const char kAlwaysShowSwitcherGroupName[] = "AlwaysShow";
-
-}  // namespace
-
 AvatarMenu::AvatarMenu(ProfileInfoInterface* profile_cache,
                        AvatarMenuObserver* observer,
                        Browser* browser)
@@ -97,27 +89,15 @@
 
 // static
 bool AvatarMenu::ShouldShowAvatarMenu() {
-  if (base::FieldTrialList::FindFullName(kShowProfileSwitcherFieldTrialName) ==
-      kAlwaysShowSwitcherGroupName) {
-    // We should only be in this group when multi-profiles is enabled.
-    DCHECK(profiles::IsMultipleProfilesEnabled());
-    return true;
-  }
-
   // TODO: Eliminate this ifdef. Add a delegate interface for the menu which
   // would also help remove the Browser dependency in AvatarMenuActions
   // implementations.
-  if (profiles::IsMultipleProfilesEnabled()) {
 #if defined(OS_CHROMEOS)
-    // On ChromeOS the menu will not be shown.
-    return false;
-#else
-    return switches::IsNewAvatarMenu() ||
-           (g_browser_process->profile_manager() &&
-            g_browser_process->profile_manager()->GetNumberOfProfiles() > 1);
-#endif
-  }
+  // On ChromeOS the menu will not be shown.
   return false;
+#else
+  return true;
+#endif
 }
 
 bool AvatarMenu::CompareItems(const Item* item1, const Item* item2) {
@@ -132,15 +112,16 @@
          index == GetActiveProfileIndex());
   const Item& item = GetItemAt(index);
 
-  if (switches::IsNewAvatarMenu()) {
-    // Don't open a browser window for signed-out profiles.
-    if (item.signin_required) {
-      UserManager::Show(item.profile_path,
-                        profiles::USER_MANAGER_NO_TUTORIAL,
-                        profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
-      return;
-    }
+#if !defined(OS_CHROMEOS)
+  // ChromeOS doesn't have the User Manager, it can't open it.
+  // Don't open a browser window for signed-out profiles.
+  if (item.signin_required) {
+    UserManager::Show(item.profile_path,
+                      profiles::USER_MANAGER_NO_TUTORIAL,
+                      profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION);
+    return;
   }
+#endif
 
   base::FilePath path =
       profile_info_->GetPathOfProfileAtIndex(item.profile_index);
diff --git a/chrome/browser/profiles/profile_info_cache.cc b/chrome/browser/profiles/profile_info_cache.cc
index 652c0f1..f7e8b2b 100644
--- a/chrome/browser/profiles/profile_info_cache.cc
+++ b/chrome/browser/profiles/profile_info_cache.cc
@@ -184,7 +184,7 @@
 
   // If needed, start downloading the high-res avatars and migrate any legacy
   // profile names.
-  if (switches::IsNewAvatarMenu() && !disable_avatar_download_for_testing_)
+  if (!disable_avatar_download_for_testing_)
     MigrateLegacyProfileNamesAndDownloadAvatars();
 }
 
@@ -225,7 +225,7 @@
 
   sorted_keys_.insert(FindPositionForProfile(key, name), key);
 
-  if (switches::IsNewAvatarMenu() && !disable_avatar_download_for_testing_)
+  if (!disable_avatar_download_for_testing_)
     DownloadHighResAvatarIfNeeded(icon_index, profile_path);
 
   FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
@@ -331,12 +331,13 @@
       return *image;
   }
 
-  // Use the high resolution version of the avatar if it exists.
-  if (switches::IsNewAvatarMenu()) {
-    const gfx::Image* image = GetHighResAvatarOfProfileAtIndex(index);
-    if (image)
-      return *image;
-  }
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
+  // Use the high resolution version of the avatar if it exists. Mobile and
+  // ChromeOS don't need the high resolution version so no need to fetch it.
+  const gfx::Image* image = GetHighResAvatarOfProfileAtIndex(index);
+  if (image)
+    return *image;
+#endif
 
   int resource_id = profiles::GetDefaultAvatarIconResourceIDAtIndex(
       GetAvatarIconIndexOfProfileAtIndex(index));
@@ -585,7 +586,7 @@
 
   base::FilePath profile_path = GetPathOfProfileAtIndex(index);
 
-  if (switches::IsNewAvatarMenu() && !disable_avatar_download_for_testing_)
+  if (!disable_avatar_download_for_testing_)
     DownloadHighResAvatarIfNeeded(icon_index, profile_path);
 
   FOR_EACH_OBSERVER(ProfileInfoCacheObserver,
@@ -864,10 +865,11 @@
     size_t icon_index) const {
   base::string16 name;
   for (int name_index = 1; ; ++name_index) {
-    if (switches::IsNewAvatarMenu()) {
-      name = l10n_util::GetStringFUTF16Int(IDS_NEW_NUMBERED_PROFILE_NAME,
-                                           name_index);
-    } else if (icon_index < profiles::GetGenericAvatarIconCount()) {
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
+    name = l10n_util::GetStringFUTF16Int(IDS_NEW_NUMBERED_PROFILE_NAME,
+                                         name_index);
+#else
+   if (icon_index < profiles::GetGenericAvatarIconCount()) {
       name = l10n_util::GetStringFUTF16Int(IDS_NUMBERED_PROFILE_NAME,
                                            name_index);
     } else {
@@ -876,6 +878,7 @@
       if (name_index > 1)
         name.append(base::UTF8ToUTF16(base::IntToString(name_index)));
     }
+#endif
 
     // Loop through previously named profiles to ensure we're not duplicating.
     bool name_found = false;
@@ -1027,10 +1030,10 @@
     bool allow_generic_icon,
     bool must_be_unique,
     size_t* out_icon_index) const {
-  // Always allow all icons for new profiles if using the
-  // --new-avatar-menu flag.
-  if (switches::IsNewAvatarMenu())
-    allow_generic_icon = true;
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
+  // Always allow the generic icon when displaying the new avatar menu.
+  allow_generic_icon = true;
+#endif
   size_t start = allow_generic_icon ? 0 : profiles::GetGenericAvatarIconCount();
   size_t end = profiles::GetDefaultAvatarIconCount();
   size_t count = end - start;
@@ -1200,8 +1203,6 @@
 }
 
 void ProfileInfoCache::MigrateLegacyProfileNamesAndDownloadAvatars() {
-  DCHECK(switches::IsNewAvatarMenu());
-
   // Only do this on desktop platforms.
 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
   // Migrate any legacy profile names ("First user", "Default Profile") to
diff --git a/chrome/browser/profiles/profile_info_cache_unittest.cc b/chrome/browser/profiles/profile_info_cache_unittest.cc
index 5aa7fde..cd1f8689 100644
--- a/chrome/browser/profiles/profile_info_cache_unittest.cc
+++ b/chrome/browser/profiles/profile_info_cache_unittest.cc
@@ -551,9 +551,6 @@
 // High res avatar downloading is only supported on desktop.
 #if !defined(OS_ANDROID) && !defined(OS_IOS) && !defined(OS_CHROMEOS)
 TEST_F(ProfileInfoCacheTest, DownloadHighResAvatarTest) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   // The TestingProfileManager's ProfileInfoCache doesn't download avatars.
   ProfileInfoCache profile_info_cache(g_browser_process->local_state(),
       testing_profile_manager_.profile_manager()->user_data_dir());
@@ -617,9 +614,6 @@
 }
 
 TEST_F(ProfileInfoCacheTest, NothingToDownloadHighResAvatarTest) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   // The TestingProfileManager's ProfileInfoCache doesn't download avatars.
   ProfileInfoCache profile_info_cache(
       g_browser_process->local_state(),
@@ -642,8 +636,6 @@
 }
 
 TEST_F(ProfileInfoCacheTest, MigrateLegacyProfileNamesWithNewAvatarMenu) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
   EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles());
 
   base::FilePath path_1 = GetProfilePath("path_1");
@@ -693,11 +685,9 @@
 }
 #endif
 
+#if defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_IOS)
 TEST_F(ProfileInfoCacheTest,
        DontMigrateLegacyProfileNamesWithoutNewAvatarMenu) {
-  switches::DisableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   EXPECT_EQ(0U, GetCache()->GetNumberOfProfiles());
 
   base::string16 name_1 = ASCIIToUTF16("Default Profile");
@@ -734,3 +724,4 @@
   EXPECT_EQ(name_4, GetCache()->GetNameOfProfileAtIndex(
       GetCache()->GetIndexOfProfileWithPath(path_4)));
 }
+#endif
diff --git a/chrome/browser/profiles/profile_list_desktop_unittest.cc b/chrome/browser/profiles/profile_list_desktop_unittest.cc
index 553f875..3ca1569 100644
--- a/chrome/browser/profiles/profile_list_desktop_unittest.cc
+++ b/chrome/browser/profiles/profile_list_desktop_unittest.cc
@@ -282,37 +282,6 @@
 #endif
 }
 
-TEST_F(ProfileListDesktopTest, DontShowOldAvatarMenuForSingleProfile) {
-  switches::DisableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
-  manager()->CreateTestingProfile("Test 1");
-
-  EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu());
-
-  // If multiprofile mode is enabled, there are no other cases when we wouldn't
-  // show the menu.
-  if (profiles::IsMultipleProfilesEnabled())
-    return;
-
-  manager()->CreateTestingProfile("Test 2");
-
-  EXPECT_FALSE(AvatarMenu::ShouldShowAvatarMenu());
-}
-
-TEST_F(ProfileListDesktopTest, AlwaysShowNewAvatarMenu) {
-  // If multiprofile mode is not enabled then the menu is never shown.
-  if (!profiles::IsMultipleProfilesEnabled())
-    return;
-
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
-  manager()->CreateTestingProfile("Test 1");
-
-  EXPECT_TRUE(AvatarMenu::ShouldShowAvatarMenu());
-}
-
 TEST_F(ProfileListDesktopTest, ShowAvatarMenu) {
   // If multiprofile mode is not enabled then the menu is never shown.
   if (!profiles::IsMultipleProfilesEnabled())
diff --git a/chrome/browser/profiles/profile_manager.cc b/chrome/browser/profiles/profile_manager.cc
index 40f9bd7..8ee2db5a 100644
--- a/chrome/browser/profiles/profile_manager.cc
+++ b/chrome/browser/profiles/profile_manager.cc
@@ -184,9 +184,11 @@
     UMA_HISTOGRAM_COUNTS_10000("Profile.AppCount", enabled_app_count);
 }
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
 void QueueProfileDirectoryForDeletion(const base::FilePath& path) {
   ProfilesToDelete().push_back(path);
 }
+#endif
 
 bool IsProfileMarkedForDeletion(const base::FilePath& profile_path) {
   return std::find(ProfilesToDelete().begin(), ProfilesToDelete().end(),
@@ -654,6 +656,7 @@
   return profile_shortcut_manager_.get();
 }
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
 void ProfileManager::ScheduleProfileForDeletion(
     const base::FilePath& profile_dir,
     const CreateCallback& callback) {
@@ -688,15 +691,15 @@
 
   base::FilePath new_path;
   if (last_non_supervised_profile_path.empty()) {
-    // If we are using --new-avatar-menu, then assign the default
-    // placeholder avatar and name. Otherwise, use random ones.
-    bool is_new_avatar_menu = switches::IsNewAvatarMenu();
+    base::string16 new_avatar_url = base::string16();
+    base::string16 new_profile_name = base::string16();
+
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
     int avatar_index = profiles::GetPlaceholderAvatarIndex();
-    base::string16 new_avatar_url = is_new_avatar_menu ?
-        base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl(avatar_index)) :
-        base::string16();
-    base::string16 new_profile_name = is_new_avatar_menu ?
-        cache.ChooseNameForNewProfile(avatar_index) : base::string16();
+    new_avatar_url =
+        base::UTF8ToUTF16(profiles::GetDefaultAvatarIconUrl(avatar_index));
+    new_profile_name = cache.ChooseNameForNewProfile(avatar_index);
+#endif
 
     new_path = GenerateNextProfileDirectoryPath();
     CreateProfileAsync(new_path,
@@ -737,6 +740,7 @@
 
   FinishDeletingProfile(profile_dir, last_non_supervised_profile_path);
 }
+#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)
 
 void ProfileManager::AutoloadProfiles() {
   // If running in the background is disabled for the browser, do not autoload
@@ -823,12 +827,13 @@
           cache.GetSupervisedUserIdOfProfileAtIndex(profile_cache_index);
     } else if (profile->GetPath() ==
                profiles::GetDefaultProfileDir(cache.GetUserDataDir())) {
-      // The --new-avatar-menu flag no longer uses the "First User" name.
-      bool is_new_avatar_menu = switches::IsNewAvatarMenu();
       avatar_index = profiles::GetPlaceholderAvatarIndex();
-      profile_name = is_new_avatar_menu ?
-          base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index)) :
-          l10n_util::GetStringUTF8(IDS_DEFAULT_PROFILE_NAME);
+#if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
+      profile_name =
+          base::UTF16ToUTF8(cache.ChooseNameForNewProfile(avatar_index));
+#else
+      profile_name = l10n_util::GetStringUTF8(IDS_DEFAULT_PROFILE_NAME);
+#endif
     } else {
       avatar_index = cache.ChooseAvatarIconIndexForNewProfile();
       profile_name =
@@ -1222,6 +1227,7 @@
   return profile;
 }
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
 void ProfileManager::FinishDeletingProfile(
     const base::FilePath& profile_dir,
     const base::FilePath& new_active_profile_dir) {
@@ -1283,6 +1289,7 @@
   cache.DeleteProfileFromCache(profile_dir);
   ProfileMetrics::UpdateReportedProfilesStatistics(this);
 }
+#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)
 
 ProfileManager::ProfileInfo* ProfileManager::RegisterProfile(
     Profile* profile,
@@ -1463,7 +1470,6 @@
 
   profile_manager_->UpdateLastUser(last_active);
 }
-#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)
 
 void ProfileManager::OnNewActiveProfileLoaded(
     const base::FilePath& profile_to_delete_path,
@@ -1490,6 +1496,7 @@
   if (!original_callback.is_null())
     original_callback.Run(loaded_profile, status);
 }
+#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)
 
 ProfileManagerWithoutInit::ProfileManagerWithoutInit(
     const base::FilePath& user_data_dir) : ProfileManager(user_data_dir) {
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index 14158eb..16d048c 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -166,11 +166,13 @@
   // profile specfic desktop shortcuts.
   ProfileShortcutManager* profile_shortcut_manager();
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
   // Schedules the profile at the given path to be deleted on shutdown. If we're
   // deleting the last profile, a new one will be created in its place, and in
   // that case the callback will be called when profile creation is complete.
   void ScheduleProfileForDeletion(const base::FilePath& profile_dir,
                                   const CreateCallback& callback);
+#endif
 
   // Autoloads profiles if they are running background apps.
   void AutoloadProfiles();
@@ -265,10 +267,12 @@
   // creation and adds it to the set managed by this ProfileManager.
   Profile* CreateAndInitializeProfile(const base::FilePath& profile_dir);
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
   // Schedules the profile at the given path to be deleted on shutdown,
   // and marks the new profile as active.
   void FinishDeletingProfile(const base::FilePath& profile_dir,
                              const base::FilePath& new_active_profile_dir);
+#endif
 
   // Registers profile with given info. Returns pointer to created ProfileInfo
   // entry.
@@ -318,7 +322,6 @@
     ProfileManager* profile_manager_;
     DISALLOW_COPY_AND_ASSIGN(BrowserListObserver);
   };
-#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)
 
   // If the |loaded_profile| has been loaded successfully (according to
   // |status|) and isn't already scheduled for deletion, then finishes adding
@@ -331,6 +334,7 @@
       const CreateCallback& original_callback,
       Profile* loaded_profile,
       Profile::CreateStatus status);
+#endif  // !defined(OS_ANDROID) && !defined(OS_IOS)
 
   // Object to cache various information about profiles. Contains information
   // about every profile which has been created for this instance of Chrome,
diff --git a/chrome/browser/profiles/profile_manager_unittest.cc b/chrome/browser/profiles/profile_manager_unittest.cc
index 78e3273a..50037f95 100644
--- a/chrome/browser/profiles/profile_manager_unittest.cc
+++ b/chrome/browser/profiles/profile_manager_unittest.cc
@@ -1054,10 +1054,6 @@
   if (!profiles::IsMultipleProfilesEnabled())
     return;
 
-  // The command line is reset at the end of every test by the test suite.
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   ProfileManager* profile_manager = g_browser_process->profile_manager();
   ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
   EXPECT_EQ(0u, cache.GetNumberOfProfiles());
@@ -1093,10 +1089,6 @@
   if (!profiles::IsMultipleProfilesEnabled())
     return;
 
-  // The command line is reset at the end of every test by the test suite.
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   ProfileManager* profile_manager = g_browser_process->profile_manager();
   ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
   EXPECT_EQ(0u, cache.GetNumberOfProfiles());
@@ -1140,10 +1132,6 @@
   if (!profiles::IsMultipleProfilesEnabled())
     return;
 
-  // The command line is reset at the end of every test by the test suite.
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   ProfileManager* profile_manager = g_browser_process->profile_manager();
   ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
   EXPECT_EQ(0u, cache.GetNumberOfProfiles());
@@ -1195,10 +1183,6 @@
   if (!profiles::IsMultipleProfilesEnabled())
     return;
 
-  // The command line is reset at the end of every test by the test suite.
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   ProfileManager* profile_manager = g_browser_process->profile_manager();
   ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
   EXPECT_EQ(0u, cache.GetNumberOfProfiles());
diff --git a/chrome/browser/profiles/profile_metrics.cc b/chrome/browser/profiles/profile_metrics.cc
index 4c2fd61..a0143d5 100644
--- a/chrome/browser/profiles/profile_metrics.cc
+++ b/chrome/browser/profiles/profile_metrics.cc
@@ -26,7 +26,9 @@
 
 const int kMaximumDaysOfDisuse = 4 * 7;  // Should be integral number of weeks.
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
 size_t number_of_profile_switches_ = 0;
+#endif
 
 // Enum for tracking the state of profiles being switched to.
 enum ProfileOpenState {
@@ -38,21 +40,20 @@
   PROFILE_UNOPENED
 };
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
 ProfileOpenState GetProfileOpenState(
     ProfileManager* manager,
     const base::FilePath& path) {
   Profile* profile_switched_to = manager->GetProfileByPath(path);
-
-  if (!profile_switched_to) {
+  if (!profile_switched_to)
     return PROFILE_UNOPENED;
-  }
 
-  if (chrome::GetTotalBrowserCountForProfile(profile_switched_to) > 0) {
+  if (chrome::GetTotalBrowserCountForProfile(profile_switched_to) > 0)
     return PROFILE_OPENED;
-  }
 
   return PROFILE_OPENED_NO_BROWSER;
 }
+#endif
 
 ProfileMetrics::ProfileType GetProfileType(
     const base::FilePath& profile_path) {
@@ -190,10 +191,12 @@
 #endif
 }
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
 void ProfileMetrics::LogNumberOfProfileSwitches() {
   UMA_HISTOGRAM_COUNTS_100("Profile.NumberOfSwitches",
                            number_of_profile_switches_);
 }
+#endif
 
 // The OS_MACOSX implementation of this function is in profile_metrics_mac.mm.
 #if defined(OS_WIN)
@@ -353,6 +356,7 @@
                             NUM_PROFILE_OPEN_METRICS);
 }
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
 void ProfileMetrics::LogProfileSwitch(
     ProfileOpen metric,
     ProfileManager* manager,
@@ -389,6 +393,7 @@
   // as opening of profile related UI elements.
   LogProfileOpenMethod(metric);
 }
+#endif
 
 void ProfileMetrics::LogProfileSwitchGaia(ProfileGaia metric) {
   if (metric == GAIA_OPT_IN)
diff --git a/chrome/browser/profiles/profile_metrics.h b/chrome/browser/profiles/profile_metrics.h
index 776c93f4..d9c4975a 100644
--- a/chrome/browser/profiles/profile_metrics.h
+++ b/chrome/browser/profiles/profile_metrics.h
@@ -214,7 +214,10 @@
   static bool CountProfileInformation(ProfileManager* manager,
                                       ProfileCounts* counts);
 
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
   static void LogNumberOfProfileSwitches();
+#endif
+
 #if defined(OS_WIN) || defined(OS_MACOSX)
   // Update OS level tracking of profile counts.
   static void UpdateReportedOSProfileStatistics(size_t active, size_t signedin);
@@ -225,9 +228,11 @@
   static void LogProfileAvatarSelection(size_t icon_index);
   static void LogProfileDeleteUser(ProfileDelete metric);
   static void LogProfileOpenMethod(ProfileOpen metric);
+#if !defined(OS_ANDROID) && !defined(OS_IOS)
   static void LogProfileSwitch(ProfileOpen metric,
                                ProfileManager* manager,
                                const base::FilePath& profile_path);
+#endif
   static void LogProfileSwitchGaia(ProfileGaia metric);
   static void LogProfileSyncInfo(ProfileSync metric);
   static void LogProfileAuthResult(ProfileAuth metric);
diff --git a/chrome/browser/profiles/profile_window.cc b/chrome/browser/profiles/profile_window.cc
index a5ae4aa2..9885761 100644
--- a/chrome/browser/profiles/profile_window.cc
+++ b/chrome/browser/profiles/profile_window.cc
@@ -44,13 +44,13 @@
 #include "extensions/browser/extension_system.h"
 #endif  // defined(ENABLE_EXTENSIONS)
 
-#if !defined(OS_IOS)
+#if !defined(OS_ANDROID)
 #include "chrome/browser/ui/browser_finder.h"
 #include "chrome/browser/ui/browser_list.h"
 #include "chrome/browser/ui/browser_list_observer.h"
 #include "chrome/browser/ui/browser_window.h"
 #include "chrome/browser/ui/startup/startup_browser_creator.h"
-#endif  // !defined (OS_IOS)
+#endif  // !defined (OS_ANDROID)
 
 using base::UserMetricsAction;
 using content::BrowserThread;
@@ -262,9 +262,6 @@
     chrome::startup::IsFirstRun is_first_run,
     chrome::HostDesktopType desktop_type,
     bool always_create) {
-#if defined(OS_IOS)
-  NOTREACHED();
-#else
   DCHECK(profile);
 
   if (!always_create) {
@@ -280,9 +277,9 @@
   StartupBrowserCreator browser_creator;
   browser_creator.LaunchBrowser(
       command_line, profile, base::FilePath(), process_startup, is_first_run);
-#endif  // defined(OS_IOS)
 }
 
+#if !defined(OS_ANDROID)
 void SwitchToProfile(const base::FilePath& path,
                      chrome::HostDesktopType desktop_type,
                      bool always_create,
@@ -320,6 +317,7 @@
       base::string16(),
       std::string());
 }
+#endif
 
 bool HasProfileSwitchTargets(Profile* profile) {
   size_t min_profiles = profile->IsGuestSession() ? 1 : 2;
diff --git a/chrome/browser/profiles/profile_window.h b/chrome/browser/profiles/profile_window.h
index 783dc7bc..5c32eb2 100644
--- a/chrome/browser/profiles/profile_window.h
+++ b/chrome/browser/profiles/profile_window.h
@@ -65,6 +65,7 @@
 // even if a window for that profile already exists. When the browser is
 // opened, |callback| will be run if it isn't null.
 
+#if !defined(OS_ANDROID)
 void SwitchToProfile(const base::FilePath& path,
                      chrome::HostDesktopType desktop_type,
                      bool always_create,
@@ -74,6 +75,7 @@
 // Opens a Browser for the guest profile and runs |callback| if it isn't null.
 void SwitchToGuestProfile(chrome::HostDesktopType desktop_type,
                           ProfileManager::CreateCallback callback);
+#endif
 
 // Returns true if |profile| has potential profile switch targets, ie there's at
 // least one other profile available to switch to, not counting guest. This is
diff --git a/chrome/browser/profiles/profile_window_browsertest.cc b/chrome/browser/profiles/profile_window_browsertest.cc
index 1868752e..16fc0fc 100644
--- a/chrome/browser/profiles/profile_window_browsertest.cc
+++ b/chrome/browser/profiles/profile_window_browsertest.cc
@@ -87,12 +87,6 @@
   ProfileWindowBrowserTest() {}
   ~ProfileWindowBrowserTest() override {}
 
-  void SetUpCommandLine(base::CommandLine* command_line) override {
-    InProcessBrowserTest::SetUpCommandLine(command_line);
-    switches::EnableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
-  }
-
   Browser* OpenGuestBrowser();
   void CloseBrowser(Browser* browser);
 
diff --git a/chrome/browser/push_messaging/push_messaging_browsertest.cc b/chrome/browser/push_messaging/push_messaging_browsertest.cc
index 6016ea1..3e9cf2bf 100644
--- a/chrome/browser/push_messaging/push_messaging_browsertest.cc
+++ b/chrome/browser/push_messaging/push_messaging_browsertest.cc
@@ -1103,7 +1103,7 @@
   TryToSubscribeSuccessfully("1-0" /* expected_push_subscription_id */);
 
   std::string first_public_key;
-  ASSERT_TRUE(RunScript("GetP256dh()", &first_public_key));
+  ASSERT_TRUE(RunScript("getCurve25519dh()", &first_public_key));
   EXPECT_GE(first_public_key.size(), 32u);
 
   std::string script_result;
@@ -1114,7 +1114,7 @@
   TryToSubscribeSuccessfully("1-1" /* expected_push_subscription_id */);
 
   std::string second_public_key;
-  ASSERT_TRUE(RunScript("GetP256dh()", &second_public_key));
+  ASSERT_TRUE(RunScript("getCurve25519dh()", &second_public_key));
   EXPECT_GE(second_public_key.size(), 32u);
 
   EXPECT_NE(first_public_key, second_public_key);
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.cc b/chrome/browser/push_messaging/push_messaging_service_impl.cc
index d3f2b69a..03147dd0 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.cc
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.cc
@@ -390,11 +390,9 @@
   }
 
   // Push does not allow permission requests from iframes.
-  int request_id = -1;
-
   profile_->GetPermissionManager()->RequestPermission(
       content::PermissionType::PUSH_MESSAGING, web_contents->GetMainFrame(),
-      request_id, requesting_origin, true /* user_gesture */,
+      requesting_origin, true /* user_gesture */,
       base::Bind(&PushMessagingServiceImpl::DidRequestPermission,
                  weak_factory_.GetWeakPtr(), app_identifier, sender_id,
                  callback));
@@ -455,16 +453,16 @@
 void PushMessagingServiceImpl::SubscribeEnd(
     const content::PushMessagingService::RegisterCallback& callback,
     const std::string& subscription_id,
-    const std::vector<uint8_t>& p256dh,
+    const std::vector<uint8_t>& curve25519dh,
     content::PushRegistrationStatus status) {
-  callback.Run(subscription_id, p256dh, status);
+  callback.Run(subscription_id, curve25519dh, status);
 }
 
 void PushMessagingServiceImpl::SubscribeEndWithError(
     const content::PushMessagingService::RegisterCallback& callback,
     content::PushRegistrationStatus status) {
   SubscribeEnd(callback, std::string() /* subscription_id */,
-               std::vector<uint8_t>() /* p256dh */, status);
+               std::vector<uint8_t>() /* curve25519dh */, status);
 }
 
 void PushMessagingServiceImpl::DidSubscribe(
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h
index f0b75fd..4958f90 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.h
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.h
@@ -137,7 +137,7 @@
   void SubscribeEnd(
       const content::PushMessagingService::RegisterCallback& callback,
       const std::string& subscription_id,
-      const std::vector<uint8_t>& p256dh,
+      const std::vector<uint8_t>& curve25519dh,
       content::PushRegistrationStatus status);
 
   void SubscribeEndWithError(
diff --git a/chrome/browser/renderer_context_menu/render_view_context_menu.cc b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
index 12d8b73..58c3860 100644
--- a/chrome/browser/renderer_context_menu/render_view_context_menu.cc
+++ b/chrome/browser/renderer_context_menu/render_view_context_menu.cc
@@ -52,7 +52,6 @@
 #include "chrome/browser/ui/browser_commands.h"
 #include "chrome/browser/ui/browser_finder.h"
 #include "chrome/browser/ui/chrome_pages.h"
-#include "chrome/browser/ui/search_engines/search_engine_tab_helper.h"
 #include "chrome/browser/ui/tab_contents/core_tab_helper.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/common/chrome_constants.h"
@@ -225,7 +224,6 @@
     {45, -1, IDC_CONTENT_CONTEXT_GOTOURL},
     {46, -1, IDC_CONTENT_CONTEXT_LANGUAGE_SETTINGS},
     {47, -1, IDC_CONTENT_CONTEXT_PROTOCOL_HANDLER_SETTINGS},
-    {48, -1, IDC_CONTENT_CONTEXT_ADDSEARCHENGINE},
     {52, -1, IDC_CONTENT_CONTEXT_OPENLINKWITH},
     {53, -1, IDC_CHECK_SPELLING_WHILE_TYPING},
     {54, -1, IDC_SPELLCHECK_MENU},
@@ -1175,8 +1173,13 @@
     case IDC_CONTENT_CONTEXT_TRANSLATE: {
       ChromeTranslateClient* chrome_translate_client =
           ChromeTranslateClient::FromWebContents(embedder_web_contents_);
-      if (!chrome_translate_client)
+      // If no |chrome_translate_client| attached with this WebContents or we're
+      // viewing in a MimeHandlerViewGuest translate will be disabled.
+      if (!chrome_translate_client ||
+          !!extensions::MimeHandlerViewGuest::FromWebContents(
+              source_web_contents_)) {
         return false;
+      }
       std::string original_lang =
           chrome_translate_client->GetLanguageState().original_language();
       std::string target_lang = g_browser_process->GetApplicationLocale();
@@ -1385,9 +1388,6 @@
       return true;
 #endif
 
-    case IDC_CONTENT_CONTEXT_ADDSEARCHENGINE:
-      return !params_.keyword_url.is_empty();
-
     case IDC_SPELLCHECK_MENU:
       return true;
 
@@ -1862,34 +1862,6 @@
       break;
     }
 
-    case IDC_CONTENT_CONTEXT_ADDSEARCHENGINE: {
-      // Make sure the model is loaded.
-      TemplateURLService* model =
-          TemplateURLServiceFactory::GetForProfile(GetProfile());
-      if (!model)
-        return;
-      model->Load();
-
-      SearchEngineTabHelper* search_engine_tab_helper =
-          SearchEngineTabHelper::FromWebContents(source_web_contents_);
-      if (search_engine_tab_helper &&
-          search_engine_tab_helper->delegate()) {
-        base::string16 keyword(TemplateURL::GenerateKeyword(
-            params_.page_url,
-            GetProfile()->GetPrefs()->GetString(prefs::kAcceptLanguages)));
-        TemplateURLData data;
-        data.SetShortName(keyword);
-        data.SetKeyword(keyword);
-        data.SetURL(params_.keyword_url.spec());
-        data.favicon_url =
-            TemplateURL::GenerateFaviconURL(params_.page_url.GetOrigin());
-        // Takes ownership of the TemplateURL.
-        search_engine_tab_helper->delegate()->ConfirmAddSearchProvider(
-            new TemplateURL(data), GetProfile());
-      }
-      break;
-    }
-
     case IDC_CONTENT_CONTEXT_FORCESAVEPASSWORD:
       ChromePasswordManagerClient::FromWebContents(source_web_contents_)->
           ForceSavePassword();
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
index 70d4c926..aaf20bdd 100644
--- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
+++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/background.js
@@ -62,7 +62,7 @@
    * @type {ChromeVoxMode}
    * @private
    */
-  this.mode_ = ChromeVoxMode.CLASSIC;
+  this.mode_ = ChromeVoxMode.COMPAT;
 
   /** @type {!ClassicCompatibility} @private */
   this.compat_ = new ClassicCompatibility();
@@ -483,19 +483,24 @@
 
     var node = evt.target;
 
+
+    // Discard focus events on embeddedObject nodes.
+    if (node.role == RoleType.embeddedObject)
+      return;
+
     // It almost never makes sense to place focus directly on a rootWebArea.
     if (node.role == RoleType.rootWebArea) {
-      // Try to find a focusable descendant.
-      node = AutomationUtil.findNodePost(node,
-                                         Dir.FORWARD,
-                                         AutomationPredicate.focused) || node;
+      // Discard focus events for root web areas when focus was previously
+      // placed on a descendant.
+      if (this.currentRange_.start.node.root == node)
+        return;
 
-      // Fall back to the first leaf node in the document.
-      if (node.role == RoleType.rootWebArea) {
-        node = AutomationUtil.findNodePost(node,
-                                           Dir.FORWARD,
-                                           AutomationPredicate.leaf);
-      }
+      // Discard focused root nodes without focused state set.
+      if (!node.state.focused)
+        return;
+
+      // Try to find a focusable descendant.
+      node = node.find({state: {focused: true}}) || node;
     }
 
     if (evt.target.role == RoleType.textField)
@@ -558,6 +563,9 @@
     if (!evt.target.state.focused)
       return;
 
+    if (evt.target.role != RoleType.textField)
+      return;
+
     if (!this.currentRange_) {
       this.onEventDefault(evt);
       this.currentRange_ = cursors.Range.fromNode(evt.target);
@@ -713,10 +721,12 @@
     if (mode === ChromeVoxMode.NEXT ||
         mode === ChromeVoxMode.COMPAT ||
         mode === ChromeVoxMode.FORCE_NEXT) {
-      if (!chrome.commands.onCommand.hasListener(this.onGotCommand))
+      if (chrome.commands &&
+          !chrome.commands.onCommand.hasListener(this.onGotCommand))
         chrome.commands.onCommand.addListener(this.onGotCommand);
     } else {
-      if (chrome.commands.onCommand.hasListener(this.onGotCommand))
+      if (chrome.commands &&
+          chrome.commands.onCommand.hasListener(this.onGotCommand))
         chrome.commands.onCommand.removeListener(this.onGotCommand);
     }
 
diff --git a/chrome/browser/resources/chromeos/login/header_bar.js b/chrome/browser/resources/chromeos/login/header_bar.js
index 44a5e1c..5a747c8 100644
--- a/chrome/browser/resources/chromeos/login/header_bar.js
+++ b/chrome/browser/resources/chromeos/login/header_bar.js
@@ -332,15 +332,15 @@
           (this.signinUIState_ == SIGNIN_UI_STATE.ERROR);
 
       $('add-user-button').hidden =
-          gaiaIsActive ||
-          enrollmentIsActive ||
+          !accountPickerIsActive ||
           isMultiProfilesUI ||
           isLockScreen ||
-          supervisedUserCreationDialogIsActive ||
           errorScreenIsActive;
       $('more-settings-header-bar-item').hidden =
           !this.showCreateSupervised_ ||
           gaiaIsActive ||
+          isLockScreen ||
+          errorScreenIsActive ||
           supervisedUserCreationDialogIsActive;
       $('cancel-add-user-button').hidden =
           !this.allowCancel_ ||
@@ -354,6 +354,7 @@
           supervisedUserCreationDialogIsActive;
       $('guest-user-header-bar-item').hidden =
           !this.showGuest_ ||
+          isLockScreen ||
           supervisedUserCreationDialogIsActive ||
           wrongHWIDWarningIsActive ||
           isSamlPasswordConfirm ||
diff --git a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js
index a7db608..ba1424d5 100644
--- a/chrome/browser/resources/chromeos/login/screen_gaia_signin.js
+++ b/chrome/browser/resources/chromeos/login/screen_gaia_signin.js
@@ -36,7 +36,6 @@
   return {
     EXTERNAL_API: [
       'loadAuthExtension',
-      'updateAuthExtension',
       'doReload',
       'monitorOfflineIdle',
       'onWebviewError',
@@ -490,7 +489,7 @@
       this.classList.toggle('full-width', false);
       this.samlPasswordConfirmAttempt_ = 0;
 
-      this.updateAuthExtension(data);
+      this.updateAuthExtension_(data);
 
       var params = {};
       for (var i in cr.login.GaiaAuthHost.SUPPORTED_PARAMS) {
@@ -549,7 +548,7 @@
      * @param {Object} data New extension parameters bag.
      * @private
      */
-    updateAuthExtension: function(data) {
+    updateAuthExtension_: function(data) {
       if (this.isNewGaiaFlow) {
         $('login-header-bar').showCreateSupervisedButton =
             data.supervisedUsersEnabled && data.supervisedUsersCanCreate;
diff --git a/chrome/browser/resources/history/history.js b/chrome/browser/resources/history/history.js
index 40a3361..3ea486d 100644
--- a/chrome/browser/resources/history/history.js
+++ b/chrome/browser/resources/history/history.js
@@ -1966,6 +1966,16 @@
     window.addEventListener(
         'resize', historyView.updateClearBrowsingDataButton_);
 
+<if expr="is_ios">
+    // Trigger window resize event when search field is focused to force update
+    // of the clear browsing button, which should disappear when search field
+    // is active. The window is not resized when the virtual keyboard is shown
+    // on iOS.
+    searchField.addEventListener('focus', function() {
+      cr.dispatchSimpleEvent(window, 'resize');
+    });
+</if>  /* is_ios */
+
     // When the search field loses focus, add a delay before updating the
     // visibility, otherwise the button will flash on the screen before the
     // keyboard animates away.
diff --git a/chrome/browser/resources/md_downloads/crisper.js b/chrome/browser/resources/md_downloads/crisper.js
new file mode 100644
index 0000000..2f7e3258
--- /dev/null
+++ b/chrome/browser/resources/md_downloads/crisper.js
@@ -0,0 +1,15644 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer = {dom: 'shadow'};
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * The global object.
+ * @type {!Object}
+ * @const
+ */
+var global = this;
+
+/** Platform, package, object property, and Event support. **/
+var cr = function() {
+  'use strict';
+
+  /**
+   * Builds an object structure for the provided namespace path,
+   * ensuring that names that already exist are not overwritten. For
+   * example:
+   * "a.b.c" -> a = {};a.b={};a.b.c={};
+   * @param {string} name Name of the object that this file defines.
+   * @param {*=} opt_object The object to expose at the end of the path.
+   * @param {Object=} opt_objectToExportTo The object to add the path to;
+   *     default is {@code global}.
+   * @private
+   */
+  function exportPath(name, opt_object, opt_objectToExportTo) {
+    var parts = name.split('.');
+    var cur = opt_objectToExportTo || global;
+
+    for (var part; parts.length && (part = parts.shift());) {
+      if (!parts.length && opt_object !== undefined) {
+        // last part and we have an object; use it
+        cur[part] = opt_object;
+      } else if (part in cur) {
+        cur = cur[part];
+      } else {
+        cur = cur[part] = {};
+      }
+    }
+    return cur;
+  };
+
+  /**
+   * Fires a property change event on the target.
+   * @param {EventTarget} target The target to dispatch the event on.
+   * @param {string} propertyName The name of the property that changed.
+   * @param {*} newValue The new value for the property.
+   * @param {*} oldValue The old value for the property.
+   */
+  function dispatchPropertyChange(target, propertyName, newValue, oldValue) {
+    var e = new Event(propertyName + 'Change');
+    e.propertyName = propertyName;
+    e.newValue = newValue;
+    e.oldValue = oldValue;
+    target.dispatchEvent(e);
+  }
+
+  /**
+   * Converts a camelCase javascript property name to a hyphenated-lower-case
+   * attribute name.
+   * @param {string} jsName The javascript camelCase property name.
+   * @return {string} The equivalent hyphenated-lower-case attribute name.
+   */
+  function getAttributeName(jsName) {
+    return jsName.replace(/([A-Z])/g, '-$1').toLowerCase();
+  }
+
+  /**
+   * The kind of property to define in {@code defineProperty}.
+   * @enum {string}
+   * @const
+   */
+  var PropertyKind = {
+    /**
+     * Plain old JS property where the backing data is stored as a "private"
+     * field on the object.
+     * Use for properties of any type. Type will not be checked.
+     */
+    JS: 'js',
+
+    /**
+     * The property backing data is stored as an attribute on an element.
+     * Use only for properties of type {string}.
+     */
+    ATTR: 'attr',
+
+    /**
+     * The property backing data is stored as an attribute on an element. If the
+     * element has the attribute then the value is true.
+     * Use only for properties of type {boolean}.
+     */
+    BOOL_ATTR: 'boolAttr'
+  };
+
+  /**
+   * Helper function for defineProperty that returns the getter to use for the
+   * property.
+   * @param {string} name The name of the property.
+   * @param {PropertyKind} kind The kind of the property.
+   * @return {function():*} The getter for the property.
+   */
+  function getGetter(name, kind) {
+    switch (kind) {
+      case PropertyKind.JS:
+        var privateName = name + '_';
+        return function() {
+          return this[privateName];
+        };
+      case PropertyKind.ATTR:
+        var attributeName = getAttributeName(name);
+        return function() {
+          return this.getAttribute(attributeName);
+        };
+      case PropertyKind.BOOL_ATTR:
+        var attributeName = getAttributeName(name);
+        return function() {
+          return this.hasAttribute(attributeName);
+        };
+    }
+
+    // TODO(dbeam): replace with assertNotReached() in assert.js when I can coax
+    // the browser/unit tests to preprocess this file through grit.
+    throw 'not reached';
+  }
+
+  /**
+   * Helper function for defineProperty that returns the setter of the right
+   * kind.
+   * @param {string} name The name of the property we are defining the setter
+   *     for.
+   * @param {PropertyKind} kind The kind of property we are getting the
+   *     setter for.
+   * @param {function(*, *):void=} opt_setHook A function to run after the
+   *     property is set, but before the propertyChange event is fired.
+   * @return {function(*):void} The function to use as a setter.
+   */
+  function getSetter(name, kind, opt_setHook) {
+    switch (kind) {
+      case PropertyKind.JS:
+        var privateName = name + '_';
+        return function(value) {
+          var oldValue = this[name];
+          if (value !== oldValue) {
+            this[privateName] = value;
+            if (opt_setHook)
+              opt_setHook.call(this, value, oldValue);
+            dispatchPropertyChange(this, name, value, oldValue);
+          }
+        };
+
+      case PropertyKind.ATTR:
+        var attributeName = getAttributeName(name);
+        return function(value) {
+          var oldValue = this[name];
+          if (value !== oldValue) {
+            if (value == undefined)
+              this.removeAttribute(attributeName);
+            else
+              this.setAttribute(attributeName, value);
+            if (opt_setHook)
+              opt_setHook.call(this, value, oldValue);
+            dispatchPropertyChange(this, name, value, oldValue);
+          }
+        };
+
+      case PropertyKind.BOOL_ATTR:
+        var attributeName = getAttributeName(name);
+        return function(value) {
+          var oldValue = this[name];
+          if (value !== oldValue) {
+            if (value)
+              this.setAttribute(attributeName, name);
+            else
+              this.removeAttribute(attributeName);
+            if (opt_setHook)
+              opt_setHook.call(this, value, oldValue);
+            dispatchPropertyChange(this, name, value, oldValue);
+          }
+        };
+    }
+
+    // TODO(dbeam): replace with assertNotReached() in assert.js when I can coax
+    // the browser/unit tests to preprocess this file through grit.
+    throw 'not reached';
+  }
+
+  /**
+   * Defines a property on an object. When the setter changes the value a
+   * property change event with the type {@code name + 'Change'} is fired.
+   * @param {!Object} obj The object to define the property for.
+   * @param {string} name The name of the property.
+   * @param {PropertyKind=} opt_kind What kind of underlying storage to use.
+   * @param {function(*, *):void=} opt_setHook A function to run after the
+   *     property is set, but before the propertyChange event is fired.
+   */
+  function defineProperty(obj, name, opt_kind, opt_setHook) {
+    if (typeof obj == 'function')
+      obj = obj.prototype;
+
+    var kind = /** @type {PropertyKind} */ (opt_kind || PropertyKind.JS);
+
+    if (!obj.__lookupGetter__(name))
+      obj.__defineGetter__(name, getGetter(name, kind));
+
+    if (!obj.__lookupSetter__(name))
+      obj.__defineSetter__(name, getSetter(name, kind, opt_setHook));
+  }
+
+  /**
+   * Counter for use with createUid
+   */
+  var uidCounter = 1;
+
+  /**
+   * @return {number} A new unique ID.
+   */
+  function createUid() {
+    return uidCounter++;
+  }
+
+  /**
+   * Returns a unique ID for the item. This mutates the item so it needs to be
+   * an object
+   * @param {!Object} item The item to get the unique ID for.
+   * @return {number} The unique ID for the item.
+   */
+  function getUid(item) {
+    if (item.hasOwnProperty('uid'))
+      return item.uid;
+    return item.uid = createUid();
+  }
+
+  /**
+   * Dispatches a simple event on an event target.
+   * @param {!EventTarget} target The event target to dispatch the event on.
+   * @param {string} type The type of the event.
+   * @param {boolean=} opt_bubbles Whether the event bubbles or not.
+   * @param {boolean=} opt_cancelable Whether the default action of the event
+   *     can be prevented. Default is true.
+   * @return {boolean} If any of the listeners called {@code preventDefault}
+   *     during the dispatch this will return false.
+   */
+  function dispatchSimpleEvent(target, type, opt_bubbles, opt_cancelable) {
+    var e = new Event(type, {
+      bubbles: opt_bubbles,
+      cancelable: opt_cancelable === undefined || opt_cancelable
+    });
+    return target.dispatchEvent(e);
+  }
+
+  /**
+   * Calls |fun| and adds all the fields of the returned object to the object
+   * named by |name|. For example, cr.define('cr.ui', function() {
+   *   function List() {
+   *     ...
+   *   }
+   *   function ListItem() {
+   *     ...
+   *   }
+   *   return {
+   *     List: List,
+   *     ListItem: ListItem,
+   *   };
+   * });
+   * defines the functions cr.ui.List and cr.ui.ListItem.
+   * @param {string} name The name of the object that we are adding fields to.
+   * @param {!Function} fun The function that will return an object containing
+   *     the names and values of the new fields.
+   */
+  function define(name, fun) {
+    var obj = exportPath(name);
+    var exports = fun();
+    for (var propertyName in exports) {
+      // Maybe we should check the prototype chain here? The current usage
+      // pattern is always using an object literal so we only care about own
+      // properties.
+      var propertyDescriptor = Object.getOwnPropertyDescriptor(exports,
+                                                               propertyName);
+      if (propertyDescriptor)
+        Object.defineProperty(obj, propertyName, propertyDescriptor);
+    }
+  }
+
+  /**
+   * Adds a {@code getInstance} static method that always return the same
+   * instance object.
+   * @param {!Function} ctor The constructor for the class to add the static
+   *     method to.
+   */
+  function addSingletonGetter(ctor) {
+    ctor.getInstance = function() {
+      return ctor.instance_ || (ctor.instance_ = new ctor());
+    };
+  }
+
+  /**
+   * Forwards public APIs to private implementations.
+   * @param {Function} ctor Constructor that have private implementations in its
+   *     prototype.
+   * @param {Array<string>} methods List of public method names that have their
+   *     underscored counterparts in constructor's prototype.
+   * @param {string=} opt_target Selector for target node.
+   */
+  function makePublic(ctor, methods, opt_target) {
+    methods.forEach(function(method) {
+      ctor[method] = function() {
+        var target = opt_target ? document.getElementById(opt_target) :
+                     ctor.getInstance();
+        return target[method + '_'].apply(target, arguments);
+      };
+    });
+  }
+
+  /**
+   * The mapping used by the sendWithCallback mechanism to tie the callback
+   * supplied to an invocation of sendWithCallback with the WebUI response
+   * sent by the browser in response to the chrome.send call. The mapping is
+   * from ID to callback function; the ID is generated by sendWithCallback and
+   * is unique across all invocations of said method.
+   * @type {!Object<Function>}
+   */
+  var chromeSendCallbackMap = Object.create(null);
+
+  /**
+   * The named method the WebUI handler calls directly in response to a
+   * chrome.send call that expects a callback. The handler requires no knowledge
+   * of the specific name of this method, as the name is passed to the handler
+   * as the first argument in the arguments list of chrome.send. The handler
+   * must pass the ID, also sent via the chrome.send arguments list, as the
+   * first argument of the JS invocation; additionally, the handler may
+   * supply any number of other arguments that will be forwarded to the
+   * callback.
+   * @param {string} id The unique ID identifying the callback method this
+   *    response is tied to.
+   */
+  function webUIResponse(id) {
+    chromeSendCallbackMap[id].apply(
+        null, Array.prototype.slice.call(arguments, 1));
+    delete chromeSendCallbackMap[id];
+  }
+
+  /**
+   * A variation of chrome.send which allows the client to receive a direct
+   * callback without requiring the handler to have specific knowledge of any
+   * JS internal method names or state. The callback will be removed from the
+   * mapping once it has fired.
+   * @param {string} methodName The name of the WebUI handler API.
+   * @param {Array|undefined} args Arguments for the method call sent to the
+   *     WebUI handler. Pass undefined if no args should be sent to the handler.
+   * @param {Function} callback A callback function which is called (indirectly)
+   *     by the WebUI handler.
+   */
+  function sendWithCallback(methodName, args, callback) {
+    var id = methodName + createUid();
+    chromeSendCallbackMap[id] = callback;
+    chrome.send(methodName, ['cr.webUIResponse', id].concat(args || []));
+  }
+
+  /**
+   * A registry of callbacks keyed by event name. Used by addWebUIListener to
+   * register listeners.
+   * @type {!Object<Array<Function>>}
+   */
+  var webUIListenerMap = Object.create(null);
+
+  /**
+   * The named method the WebUI handler calls directly when an event occurs.
+   * The WebUI handler must supply the name of the event as the first argument
+   * of the JS invocation; additionally, the handler may supply any number of
+   * other arguments that will be forwarded to the listener callbacks.
+   * @param {string} event The name of the event that has occurred.
+   */
+  function webUIListenerCallback(event) {
+    var listenerCallbacks = webUIListenerMap[event];
+    for (var i = 0; i < listenerCallbacks.length; i++) {
+      var callback = listenerCallbacks[i];
+      callback.apply(null, Array.prototype.slice.call(arguments, 1));
+    }
+  }
+
+  /**
+   * Registers a listener for an event fired from WebUI handlers. Any number of
+   * listeners may register for a single event.
+   * @param {string} event The event to listen to.
+   * @param {Function} callback The callback run when the event is fired.
+   */
+  function addWebUIListener(event, callback) {
+    if (event in webUIListenerMap)
+      webUIListenerMap[event].push(callback);
+    else
+      webUIListenerMap[event] = [callback];
+  }
+
+  return {
+    addSingletonGetter: addSingletonGetter,
+    createUid: createUid,
+    define: define,
+    defineProperty: defineProperty,
+    dispatchPropertyChange: dispatchPropertyChange,
+    dispatchSimpleEvent: dispatchSimpleEvent,
+    exportPath: exportPath,
+    getUid: getUid,
+    makePublic: makePublic,
+    webUIResponse: webUIResponse,
+    sendWithCallback: sendWithCallback,
+    webUIListenerCallback: webUIListenerCallback,
+    addWebUIListener: addWebUIListener,
+    PropertyKind: PropertyKind,
+
+    get doc() {
+      return document;
+    },
+
+    /** Whether we are using a Mac or not. */
+    get isMac() {
+      return /Mac/.test(navigator.platform);
+    },
+
+    /** Whether this is on the Windows platform or not. */
+    get isWindows() {
+      return /Win/.test(navigator.platform);
+    },
+
+    /** Whether this is on chromeOS or not. */
+    get isChromeOS() {
+      return /CrOS/.test(navigator.userAgent);
+    },
+
+    /** Whether this is on vanilla Linux (not chromeOS). */
+    get isLinux() {
+      return /Linux/.test(navigator.userAgent);
+    },
+  };
+}();
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('cr.ui', function() {
+
+  /**
+   * Decorates elements as an instance of a class.
+   * @param {string|!Element} source The way to find the element(s) to decorate.
+   *     If this is a string then {@code querySeletorAll} is used to find the
+   *     elements to decorate.
+   * @param {!Function} constr The constructor to decorate with. The constr
+   *     needs to have a {@code decorate} function.
+   */
+  function decorate(source, constr) {
+    var elements;
+    if (typeof source == 'string')
+      elements = cr.doc.querySelectorAll(source);
+    else
+      elements = [source];
+
+    for (var i = 0, el; el = elements[i]; i++) {
+      if (!(el instanceof constr))
+        constr.decorate(el);
+    }
+  }
+
+  /**
+   * Helper function for creating new element for define.
+   */
+  function createElementHelper(tagName, opt_bag) {
+    // Allow passing in ownerDocument to create in a different document.
+    var doc;
+    if (opt_bag && opt_bag.ownerDocument)
+      doc = opt_bag.ownerDocument;
+    else
+      doc = cr.doc;
+    return doc.createElement(tagName);
+  }
+
+  /**
+   * Creates the constructor for a UI element class.
+   *
+   * Usage:
+   * <pre>
+   * var List = cr.ui.define('list');
+   * List.prototype = {
+   *   __proto__: HTMLUListElement.prototype,
+   *   decorate: function() {
+   *     ...
+   *   },
+   *   ...
+   * };
+   * </pre>
+   *
+   * @param {string|Function} tagNameOrFunction The tagName or
+   *     function to use for newly created elements. If this is a function it
+   *     needs to return a new element when called.
+   * @return {function(Object=):Element} The constructor function which takes
+   *     an optional property bag. The function also has a static
+   *     {@code decorate} method added to it.
+   */
+  function define(tagNameOrFunction) {
+    var createFunction, tagName;
+    if (typeof tagNameOrFunction == 'function') {
+      createFunction = tagNameOrFunction;
+      tagName = '';
+    } else {
+      createFunction = createElementHelper;
+      tagName = tagNameOrFunction;
+    }
+
+    /**
+     * Creates a new UI element constructor.
+     * @param {Object=} opt_propertyBag Optional bag of properties to set on the
+     *     object after created. The property {@code ownerDocument} is special
+     *     cased and it allows you to create the element in a different
+     *     document than the default.
+     * @constructor
+     */
+    function f(opt_propertyBag) {
+      var el = createFunction(tagName, opt_propertyBag);
+      f.decorate(el);
+      for (var propertyName in opt_propertyBag) {
+        el[propertyName] = opt_propertyBag[propertyName];
+      }
+      return el;
+    }
+
+    /**
+     * Decorates an element as a UI element class.
+     * @param {!Element} el The element to decorate.
+     */
+    f.decorate = function(el) {
+      el.__proto__ = f.prototype;
+      el.decorate();
+    };
+
+    return f;
+  }
+
+  /**
+   * Input elements do not grow and shrink with their content. This is a simple
+   * (and not very efficient) way of handling shrinking to content with support
+   * for min width and limited by the width of the parent element.
+   * @param {!HTMLElement} el The element to limit the width for.
+   * @param {!HTMLElement} parentEl The parent element that should limit the
+   *     size.
+   * @param {number} min The minimum width.
+   * @param {number=} opt_scale Optional scale factor to apply to the width.
+   */
+  function limitInputWidth(el, parentEl, min, opt_scale) {
+    // Needs a size larger than borders
+    el.style.width = '10px';
+    var doc = el.ownerDocument;
+    var win = doc.defaultView;
+    var computedStyle = win.getComputedStyle(el);
+    var parentComputedStyle = win.getComputedStyle(parentEl);
+    var rtl = computedStyle.direction == 'rtl';
+
+    // To get the max width we get the width of the treeItem minus the position
+    // of the input.
+    var inputRect = el.getBoundingClientRect();  // box-sizing
+    var parentRect = parentEl.getBoundingClientRect();
+    var startPos = rtl ? parentRect.right - inputRect.right :
+        inputRect.left - parentRect.left;
+
+    // Add up border and padding of the input.
+    var inner = parseInt(computedStyle.borderLeftWidth, 10) +
+        parseInt(computedStyle.paddingLeft, 10) +
+        parseInt(computedStyle.paddingRight, 10) +
+        parseInt(computedStyle.borderRightWidth, 10);
+
+    // We also need to subtract the padding of parent to prevent it to overflow.
+    var parentPadding = rtl ? parseInt(parentComputedStyle.paddingLeft, 10) :
+        parseInt(parentComputedStyle.paddingRight, 10);
+
+    var max = parentEl.clientWidth - startPos - inner - parentPadding;
+    if (opt_scale)
+      max *= opt_scale;
+
+    function limit() {
+      if (el.scrollWidth > max) {
+        el.style.width = max + 'px';
+      } else {
+        el.style.width = 0;
+        var sw = el.scrollWidth;
+        if (sw < min) {
+          el.style.width = min + 'px';
+        } else {
+          el.style.width = sw + 'px';
+        }
+      }
+    }
+
+    el.addEventListener('input', limit);
+    limit();
+  }
+
+  /**
+   * Takes a number and spits out a value CSS will be happy with. To avoid
+   * subpixel layout issues, the value is rounded to the nearest integral value.
+   * @param {number} pixels The number of pixels.
+   * @return {string} e.g. '16px'.
+   */
+  function toCssPx(pixels) {
+    if (!window.isFinite(pixels))
+      console.error('Pixel value is not a number: ' + pixels);
+    return Math.round(pixels) + 'px';
+  }
+
+  /**
+   * Users complain they occasionaly use doubleclicks instead of clicks
+   * (http://crbug.com/140364). To fix it we freeze click handling for
+   * the doubleclick time interval.
+   * @param {MouseEvent} e Initial click event.
+   */
+  function swallowDoubleClick(e) {
+    var doc = e.target.ownerDocument;
+    var counter = Math.min(1, e.detail);
+    function swallow(e) {
+      e.stopPropagation();
+      e.preventDefault();
+    }
+    function onclick(e) {
+      if (e.detail > counter) {
+        counter = e.detail;
+        // Swallow the click since it's a click inside the doubleclick timeout.
+        swallow(e);
+      } else {
+        // Stop tracking clicks and let regular handling.
+        doc.removeEventListener('dblclick', swallow, true);
+        doc.removeEventListener('click', onclick, true);
+      }
+    }
+    // The following 'click' event (if e.type == 'mouseup') mustn't be taken
+    // into account (it mustn't stop tracking clicks). Start event listening
+    // after zero timeout.
+    setTimeout(function() {
+      doc.addEventListener('click', onclick, true);
+      doc.addEventListener('dblclick', swallow, true);
+    }, 0);
+  }
+
+  return {
+    decorate: decorate,
+    define: define,
+    limitInputWidth: limitInputWidth,
+    toCssPx: toCssPx,
+    swallowDoubleClick: swallowDoubleClick
+  };
+});
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview A command is an abstraction of an action a user can do in the
+ * UI.
+ *
+ * When the focus changes in the document for each command a canExecute event
+ * is dispatched on the active element. By listening to this event you can
+ * enable and disable the command by setting the event.canExecute property.
+ *
+ * When a command is executed a command event is dispatched on the active
+ * element. Note that you should stop the propagation after you have handled the
+ * command if there might be other command listeners higher up in the DOM tree.
+ */
+
+cr.define('cr.ui', function() {
+
+  /**
+   * This is used to identify keyboard shortcuts.
+   * @param {string} shortcut The text used to describe the keys for this
+   *     keyboard shortcut.
+   * @constructor
+   */
+  function KeyboardShortcut(shortcut) {
+    var mods = {};
+    var ident = '';
+    shortcut.split('-').forEach(function(part) {
+      var partLc = part.toLowerCase();
+      switch (partLc) {
+        case 'alt':
+        case 'ctrl':
+        case 'meta':
+        case 'shift':
+          mods[partLc + 'Key'] = true;
+          break;
+        default:
+          if (ident)
+            throw Error('Invalid shortcut');
+          ident = part;
+      }
+    });
+
+    this.ident_ = ident;
+    this.mods_ = mods;
+  }
+
+  KeyboardShortcut.prototype = {
+    /**
+     * Whether the keyboard shortcut object matches a keyboard event.
+     * @param {!Event} e The keyboard event object.
+     * @return {boolean} Whether we found a match or not.
+     */
+    matchesEvent: function(e) {
+      if (e.keyIdentifier == this.ident_) {
+        // All keyboard modifiers needs to match.
+        var mods = this.mods_;
+        return ['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].every(function(k) {
+          return e[k] == !!mods[k];
+        });
+      }
+      return false;
+    }
+  };
+
+  /**
+   * Creates a new command element.
+   * @constructor
+   * @extends {HTMLElement}
+   */
+  var Command = cr.ui.define('command');
+
+  Command.prototype = {
+    __proto__: HTMLElement.prototype,
+
+    /**
+     * Initializes the command.
+     */
+    decorate: function() {
+      CommandManager.init(assert(this.ownerDocument));
+
+      if (this.hasAttribute('shortcut'))
+        this.shortcut = this.getAttribute('shortcut');
+    },
+
+    /**
+     * Executes the command by dispatching a command event on the given element.
+     * If |element| isn't given, the active element is used instead.
+     * If the command is {@code disabled} this does nothing.
+     * @param {HTMLElement=} opt_element Optional element to dispatch event on.
+     */
+    execute: function(opt_element) {
+      if (this.disabled)
+        return;
+      var doc = this.ownerDocument;
+      if (doc.activeElement) {
+        var e = new Event('command', {bubbles: true});
+        e.command = this;
+
+        (opt_element || doc.activeElement).dispatchEvent(e);
+      }
+    },
+
+    /**
+     * Call this when there have been changes that might change whether the
+     * command can be executed or not.
+     * @param {Node=} opt_node Node for which to actuate command state.
+     */
+    canExecuteChange: function(opt_node) {
+      dispatchCanExecuteEvent(this,
+                              opt_node || this.ownerDocument.activeElement);
+    },
+
+    /**
+     * The keyboard shortcut that triggers the command. This is a string
+     * consisting of a keyIdentifier (as reported by WebKit in keydown) as
+     * well as optional key modifiers joinded with a '-'.
+     *
+     * Multiple keyboard shortcuts can be provided by separating them by
+     * whitespace.
+     *
+     * For example:
+     *   "F1"
+     *   "U+0008-Meta" for Apple command backspace.
+     *   "U+0041-Ctrl" for Control A
+     *   "U+007F U+0008-Meta" for Delete and Command Backspace
+     *
+     * @type {string}
+     */
+    shortcut_: '',
+    get shortcut() {
+      return this.shortcut_;
+    },
+    set shortcut(shortcut) {
+      var oldShortcut = this.shortcut_;
+      if (shortcut !== oldShortcut) {
+        this.keyboardShortcuts_ = shortcut.split(/\s+/).map(function(shortcut) {
+          return new KeyboardShortcut(shortcut);
+        });
+
+        // Set this after the keyboardShortcuts_ since that might throw.
+        this.shortcut_ = shortcut;
+        cr.dispatchPropertyChange(this, 'shortcut', this.shortcut_,
+                                  oldShortcut);
+      }
+    },
+
+    /**
+     * Whether the event object matches the shortcut for this command.
+     * @param {!Event} e The key event object.
+     * @return {boolean} Whether it matched or not.
+     */
+    matchesEvent: function(e) {
+      if (!this.keyboardShortcuts_)
+        return false;
+
+      return this.keyboardShortcuts_.some(function(keyboardShortcut) {
+        return keyboardShortcut.matchesEvent(e);
+      });
+    },
+  };
+
+  /**
+   * The label of the command.
+   */
+  cr.defineProperty(Command, 'label', cr.PropertyKind.ATTR);
+
+  /**
+   * Whether the command is disabled or not.
+   */
+  cr.defineProperty(Command, 'disabled', cr.PropertyKind.BOOL_ATTR);
+
+  /**
+   * Whether the command is hidden or not.
+   */
+  cr.defineProperty(Command, 'hidden', cr.PropertyKind.BOOL_ATTR);
+
+  /**
+   * Whether the command is checked or not.
+   */
+  cr.defineProperty(Command, 'checked', cr.PropertyKind.BOOL_ATTR);
+
+  /**
+   * The flag that prevents the shortcut text from being displayed on menu.
+   *
+   * If false, the keyboard shortcut text (eg. "Ctrl+X" for the cut command)
+   * is displayed in menu when the command is assosiated with a menu item.
+   * Otherwise, no text is displayed.
+   */
+  cr.defineProperty(Command, 'hideShortcutText', cr.PropertyKind.BOOL_ATTR);
+
+  /**
+   * Dispatches a canExecute event on the target.
+   * @param {!cr.ui.Command} command The command that we are testing for.
+   * @param {EventTarget} target The target element to dispatch the event on.
+   */
+  function dispatchCanExecuteEvent(command, target) {
+    var e = new CanExecuteEvent(command);
+    target.dispatchEvent(e);
+    command.disabled = !e.canExecute;
+  }
+
+  /**
+   * The command managers for different documents.
+   */
+  var commandManagers = {};
+
+  /**
+   * Keeps track of the focused element and updates the commands when the focus
+   * changes.
+   * @param {!Document} doc The document that we are managing the commands for.
+   * @constructor
+   */
+  function CommandManager(doc) {
+    doc.addEventListener('focus', this.handleFocus_.bind(this), true);
+    // Make sure we add the listener to the bubbling phase so that elements can
+    // prevent the command.
+    doc.addEventListener('keydown', this.handleKeyDown_.bind(this), false);
+  }
+
+  /**
+   * Initializes a command manager for the document as needed.
+   * @param {!Document} doc The document to manage the commands for.
+   */
+  CommandManager.init = function(doc) {
+    var uid = cr.getUid(doc);
+    if (!(uid in commandManagers)) {
+      commandManagers[uid] = new CommandManager(doc);
+    }
+  };
+
+  CommandManager.prototype = {
+
+    /**
+     * Handles focus changes on the document.
+     * @param {Event} e The focus event object.
+     * @private
+     * @suppress {checkTypes}
+     * TODO(vitalyp): remove the suppression.
+     */
+    handleFocus_: function(e) {
+      var target = e.target;
+
+      // Ignore focus on a menu button or command item.
+      if (target.menu || target.command)
+        return;
+
+      var commands = Array.prototype.slice.call(
+          target.ownerDocument.querySelectorAll('command'));
+
+      commands.forEach(function(command) {
+        dispatchCanExecuteEvent(command, target);
+      });
+    },
+
+    /**
+     * Handles the keydown event and routes it to the right command.
+     * @param {!Event} e The keydown event.
+     */
+    handleKeyDown_: function(e) {
+      var target = e.target;
+      var commands = Array.prototype.slice.call(
+          target.ownerDocument.querySelectorAll('command'));
+
+      for (var i = 0, command; command = commands[i]; i++) {
+        if (command.matchesEvent(e)) {
+          // When invoking a command via a shortcut, we have to manually check
+          // if it can be executed, since focus might not have been changed
+          // what would have updated the command's state.
+          command.canExecuteChange();
+
+          if (!command.disabled) {
+            e.preventDefault();
+            // We do not want any other element to handle this.
+            e.stopPropagation();
+            command.execute();
+            return;
+          }
+        }
+      }
+    }
+  };
+
+  /**
+   * The event type used for canExecute events.
+   * @param {!cr.ui.Command} command The command that we are evaluating.
+   * @extends {Event}
+   * @constructor
+   * @class
+   */
+  function CanExecuteEvent(command) {
+    var e = new Event('canExecute', {bubbles: true, cancelable: true});
+    e.__proto__ = CanExecuteEvent.prototype;
+    e.command = command;
+    return e;
+  }
+
+  CanExecuteEvent.prototype = {
+    __proto__: Event.prototype,
+
+    /**
+     * The current command
+     * @type {cr.ui.Command}
+     */
+    command: null,
+
+    /**
+     * Whether the target can execute the command. Setting this also stops the
+     * propagation and prevents the default. Callers can tell if an event has
+     * been handled via |this.defaultPrevented|.
+     * @type {boolean}
+     */
+    canExecute_: false,
+    get canExecute() {
+      return this.canExecute_;
+    },
+    set canExecute(canExecute) {
+      this.canExecute_ = !!canExecute;
+      this.stopPropagation();
+      this.preventDefault();
+    }
+  };
+
+  // Export
+  return {
+    Command: Command,
+    CanExecuteEvent: CanExecuteEvent
+  };
+});
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview Assertion support.
+ */
+
+/**
+ * Verify |condition| is truthy and return |condition| if so.
+ * @template T
+ * @param {T} condition A condition to check for truthiness.  Note that this
+ *     may be used to test whether a value is defined or not, and we don't want
+ *     to force a cast to Boolean.
+ * @param {string=} opt_message A message to show on failure.
+ * @return {T} A non-null |condition|.
+ */
+function assert(condition, opt_message) {
+  'use strict';
+  if (!condition) {
+    var msg = 'Assertion failed';
+    if (opt_message)
+      msg = msg + ': ' + opt_message;
+    throw new Error(msg);
+  }
+  return condition;
+}
+
+/**
+ * Call this from places in the code that should never be reached.
+ *
+ * For example, handling all the values of enum with a switch() like this:
+ *
+ *   function getValueFromEnum(enum) {
+ *     switch (enum) {
+ *       case ENUM_FIRST_OF_TWO:
+ *         return first
+ *       case ENUM_LAST_OF_TWO:
+ *         return last;
+ *     }
+ *     assertNotReached();
+ *     return document;
+ *   }
+ *
+ * This code should only be hit in the case of serious programmer error or
+ * unexpected input.
+ *
+ * @param {string=} opt_message A message to show when this is hit.
+ */
+function assertNotReached(opt_message) {
+  throw new Error(opt_message || 'Unreachable code hit');
+}
+
+/**
+ * @param {*} value The value to check.
+ * @param {function(new: T, ...)} type A user-defined constructor.
+ * @param {string=} opt_message A message to show when this is hit.
+ * @return {T}
+ * @template T
+ */
+function assertInstanceof(value, type, opt_message) {
+  if (!(value instanceof type)) {
+    throw new Error(opt_message ||
+                    value + ' is not a[n] ' + (type.name || typeof type));
+  }
+  return value;
+};
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview EventTracker is a simple class that manages the addition and
+ * removal of DOM event listeners. In particular, it keeps track of all
+ * listeners that have been added and makes it easy to remove some or all of
+ * them without requiring all the information again. This is particularly handy
+ * when the listener is a generated function such as a lambda or the result of
+ * calling Function.bind.
+ */
+
+/**
+ * The type of the internal tracking entry. TODO(dbeam): move this back to
+ * EventTracker.Entry when https://github.com/google/closure-compiler/issues/544
+ * is fixed.
+ * @typedef {{target: !EventTarget,
+ *            eventType: string,
+ *            listener: Function,
+ *            capture: boolean}}
+ */
+var EventTrackerEntry;
+
+/**
+ * Create an EventTracker to track a set of events.
+ * EventTracker instances are typically tied 1:1 with other objects or
+ * DOM elements whose listeners should be removed when the object is disposed
+ * or the corresponding elements are removed from the DOM.
+ * @constructor
+ */
+function EventTracker() {
+  /**
+   * @type {Array<EventTrackerEntry>}
+   * @private
+   */
+  this.listeners_ = [];
+}
+
+EventTracker.prototype = {
+  /**
+   * Add an event listener - replacement for EventTarget.addEventListener.
+   * @param {!EventTarget} target The DOM target to add a listener to.
+   * @param {string} eventType The type of event to subscribe to.
+   * @param {EventListener|Function} listener The listener to add.
+   * @param {boolean=} opt_capture Whether to invoke during the capture phase.
+   */
+  add: function(target, eventType, listener, opt_capture) {
+    var capture = !!opt_capture;
+    var h = {
+      target: target,
+      eventType: eventType,
+      listener: listener,
+      capture: capture,
+    };
+    this.listeners_.push(h);
+    target.addEventListener(eventType, listener, capture);
+  },
+
+  /**
+   * Remove any specified event listeners added with this EventTracker.
+   * @param {!EventTarget} target The DOM target to remove a listener from.
+   * @param {?string} eventType The type of event to remove.
+   */
+  remove: function(target, eventType) {
+    this.listeners_ = this.listeners_.filter(function(h) {
+      if (h.target == target && (!eventType || (h.eventType == eventType))) {
+        EventTracker.removeEventListener_(h);
+        return false;
+      }
+      return true;
+    });
+  },
+
+  /**
+   * Remove all event listeners added with this EventTracker.
+   */
+  removeAll: function() {
+    this.listeners_.forEach(EventTracker.removeEventListener_);
+    this.listeners_ = [];
+  }
+};
+
+/**
+ * Remove a single event listener given it's tracking entry. It's up to the
+ * caller to ensure the entry is removed from listeners_.
+ * @param {EventTrackerEntry} h The entry describing the listener to remove.
+ * @private
+ */
+EventTracker.removeEventListener_ = function(h) {
+  h.target.removeEventListener(h.eventType, h.listener, h.capture);
+};
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('cr.ui', function() {
+  /**
+   * A class to manage grid of focusable elements in a 2D grid. For example,
+   * given this grid:
+   *
+   *   focusable  [focused]  focusable  (row: 0, col: 1)
+   *   focusable  focusable  focusable
+   *   focusable  focusable  focusable
+   *
+   * Pressing the down arrow would result in the focus moving down 1 row and
+   * keeping the same column:
+   *
+   *   focusable  focusable  focusable
+   *   focusable  [focused]  focusable  (row: 1, col: 1)
+   *   focusable  focusable  focusable
+   *
+   * And pressing right or tab at this point would move the focus to:
+   *
+   *   focusable  focusable  focusable
+   *   focusable  focusable  [focused]  (row: 1, col: 2)
+   *   focusable  focusable  focusable
+   *
+   * @constructor
+   * @implements {cr.ui.FocusRow.Delegate}
+   */
+  function FocusGrid() {
+    /** @type {!Array<!cr.ui.FocusRow>} */
+    this.rows = [];
+  }
+
+  FocusGrid.prototype = {
+    /** @private {boolean} */
+    ignoreFocusChange_: false,
+
+    /** @override */
+    onFocus: function(row, e) {
+      if (this.ignoreFocusChange_)
+        this.ignoreFocusChange_ = false;
+      else
+        this.lastFocused_ = e.currentTarget;
+
+      this.rows.forEach(function(r) { r.makeActive(r == row); });
+    },
+
+    /** @override */
+    onKeydown: function(row, e) {
+      var rowIndex = this.rows.indexOf(row);
+      assert(rowIndex >= 0);
+
+      var newRow = -1;
+
+      if (e.keyIdentifier == 'Up')
+        newRow = rowIndex - 1;
+      else if (e.keyIdentifier == 'Down')
+        newRow = rowIndex + 1;
+      else if (e.keyIdentifier == 'PageUp')
+        newRow = 0;
+      else if (e.keyIdentifier == 'PageDown')
+        newRow = this.rows.length - 1;
+
+      var rowToFocus = this.rows[newRow];
+      if (rowToFocus) {
+        this.ignoreFocusChange_ = true;
+        rowToFocus.getEquivalentElement(this.lastFocused_).focus();
+        e.preventDefault();
+        return true;
+      }
+
+      return false;
+    },
+
+    /**
+     * Unregisters event handlers and removes all |this.rows|.
+     */
+    destroy: function() {
+      this.rows.forEach(function(row) { row.destroy(); });
+      this.rows.length = 0;
+    },
+
+    /**
+     * @param {Node} target A target item to find in this grid.
+     * @return {number} The row index. -1 if not found.
+     */
+    getRowIndexForTarget: function(target) {
+      for (var i = 0; i < this.rows.length; ++i) {
+        if (this.rows[i].getElements().indexOf(target) >= 0)
+          return i;
+      }
+      return -1;
+    },
+
+    /**
+     * @param {Element} root An element to search for.
+     * @return {?cr.ui.FocusRow} The row with root of |root| or null.
+     */
+    getRowForRoot: function(root) {
+      for (var i = 0; i < this.rows.length; ++i) {
+        if (this.rows[i].root == root)
+          return this.rows[i];
+      }
+      return null;
+    },
+
+    /**
+     * Adds |row| to the end of this list.
+     * @param {!cr.ui.FocusRow} row The row that needs to be added to this grid.
+     */
+    addRow: function(row) {
+      this.addRowBefore(row, null);
+    },
+
+    /**
+     * Adds |row| before |nextRow|. If |nextRow| is not in the list or it's
+     * null, |row| is added to the end.
+     * @param {!cr.ui.FocusRow} row The row that needs to be added to this grid.
+     * @param {cr.ui.FocusRow} nextRow The row that should follow |row|.
+     */
+    addRowBefore: function(row, nextRow) {
+      row.delegate = row.delegate || this;
+
+      var nextRowIndex = this.rows.indexOf(nextRow);
+      if (nextRowIndex == -1)
+        this.rows.push(row);
+      else
+        this.rows.splice(nextRowIndex, 0, row);
+    },
+
+    /**
+     * Removes a row from the focus row. No-op if row is not in the grid.
+     * @param {cr.ui.FocusRow} row The row that needs to be removed.
+     */
+    removeRow: function(row) {
+      var nextRowIndex = this.rows.indexOf(row);
+      if (nextRowIndex > -1)
+        this.rows.splice(nextRowIndex, 1);
+    },
+
+    /**
+     * Makes sure that at least one row is active. Should be called once, after
+     * adding all rows to FocusGrid.
+     */
+    ensureRowActive: function() {
+      if (this.rows.length == 0)
+        return;
+
+      for (var i = 0; i < this.rows.length; ++i) {
+        if (this.rows[i].isActive())
+          return;
+      }
+
+      this.rows[0].makeActive(true);
+    },
+  };
+
+  return {
+    FocusGrid: FocusGrid,
+  };
+});
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// <include src="../../../../ui/webui/resources/js/assert.js">
+
+/**
+ * Alias for document.getElementById.
+ * @param {string} id The ID of the element to find.
+ * @return {HTMLElement} The found element or null if not found.
+ */
+function $(id) {
+  return document.getElementById(id);
+}
+
+/**
+ * Add an accessible message to the page that will be announced to
+ * users who have spoken feedback on, but will be invisible to all
+ * other users. It's removed right away so it doesn't clutter the DOM.
+ * @param {string} msg The text to be pronounced.
+ */
+function announceAccessibleMessage(msg) {
+  var element = document.createElement('div');
+  element.setAttribute('aria-live', 'polite');
+  element.style.position = 'relative';
+  element.style.left = '-9999px';
+  element.style.height = '0px';
+  element.innerText = msg;
+  document.body.appendChild(element);
+  window.setTimeout(function() {
+    document.body.removeChild(element);
+  }, 0);
+}
+
+/**
+ * Calls chrome.send with a callback and restores the original afterwards.
+ * @param {string} name The name of the message to send.
+ * @param {!Array} params The parameters to send.
+ * @param {string} callbackName The name of the function that the backend calls.
+ * @param {!Function} callback The function to call.
+ */
+function chromeSend(name, params, callbackName, callback) {
+  var old = global[callbackName];
+  global[callbackName] = function() {
+    // restore
+    global[callbackName] = old;
+
+    var args = Array.prototype.slice.call(arguments);
+    return callback.apply(global, args);
+  };
+  chrome.send(name, params);
+}
+
+/**
+ * Returns the scale factors supported by this platform for webui
+ * resources.
+ * @return {Array} The supported scale factors.
+ */
+function getSupportedScaleFactors() {
+  var supportedScaleFactors = [];
+  if (cr.isMac || cr.isChromeOS || cr.isWindows || cr.isLinux) {
+    // All desktop platforms support zooming which also updates the
+    // renderer's device scale factors (a.k.a devicePixelRatio), and
+    // these platforms has high DPI assets for 2.0x. Use 1x and 2x in
+    // image-set on these platforms so that the renderer can pick the
+    // closest image for the current device scale factor.
+    supportedScaleFactors.push(1);
+    supportedScaleFactors.push(2);
+  } else {
+    // For other platforms that use fixed device scale factor, use
+    // the window's device pixel ratio.
+    // TODO(oshima): Investigate if Android/iOS need to use image-set.
+    supportedScaleFactors.push(window.devicePixelRatio);
+  }
+  return supportedScaleFactors;
+}
+
+/**
+ * Generates a CSS url string.
+ * @param {string} s The URL to generate the CSS url for.
+ * @return {string} The CSS url string.
+ */
+function url(s) {
+  // http://www.w3.org/TR/css3-values/#uris
+  // Parentheses, commas, whitespace characters, single quotes (') and double
+  // quotes (") appearing in a URI must be escaped with a backslash
+  var s2 = s.replace(/(\(|\)|\,|\s|\'|\"|\\)/g, '\\$1');
+  // WebKit has a bug when it comes to URLs that end with \
+  // https://bugs.webkit.org/show_bug.cgi?id=28885
+  if (/\\\\$/.test(s2)) {
+    // Add a space to work around the WebKit bug.
+    s2 += ' ';
+  }
+  return 'url("' + s2 + '")';
+}
+
+/**
+ * Returns the URL of the image, or an image set of URLs for the profile avatar.
+ * Default avatars have resources available for multiple scalefactors, whereas
+ * the GAIA profile image only comes in one size.
+ *
+ * @param {string} path The path of the image.
+ * @return {string} The url, or an image set of URLs of the avatar image.
+ */
+function getProfileAvatarIcon(path) {
+  var chromeThemePath = 'chrome://theme';
+  var isDefaultAvatar =
+      (path.slice(0, chromeThemePath.length) == chromeThemePath);
+  return isDefaultAvatar ? imageset(path + '@scalefactorx'): url(path);
+}
+
+/**
+ * Generates a CSS -webkit-image-set for a chrome:// url.
+ * An entry in the image set is added for each of getSupportedScaleFactors().
+ * The scale-factor-specific url is generated by replacing the first instance of
+ * 'scalefactor' in |path| with the numeric scale factor.
+ * @param {string} path The URL to generate an image set for.
+ *     'scalefactor' should be a substring of |path|.
+ * @return {string} The CSS -webkit-image-set.
+ */
+function imageset(path) {
+  var supportedScaleFactors = getSupportedScaleFactors();
+
+  var replaceStartIndex = path.indexOf('scalefactor');
+  if (replaceStartIndex < 0)
+    return url(path);
+
+  var s = '';
+  for (var i = 0; i < supportedScaleFactors.length; ++i) {
+    var scaleFactor = supportedScaleFactors[i];
+    var pathWithScaleFactor = path.substr(0, replaceStartIndex) + scaleFactor +
+        path.substr(replaceStartIndex + 'scalefactor'.length);
+
+    s += url(pathWithScaleFactor) + ' ' + scaleFactor + 'x';
+
+    if (i != supportedScaleFactors.length - 1)
+      s += ', ';
+  }
+  return '-webkit-image-set(' + s + ')';
+}
+
+/**
+ * Parses query parameters from Location.
+ * @param {Location} location The URL to generate the CSS url for.
+ * @return {Object} Dictionary containing name value pairs for URL
+ */
+function parseQueryParams(location) {
+  var params = {};
+  var query = unescape(location.search.substring(1));
+  var vars = query.split('&');
+  for (var i = 0; i < vars.length; i++) {
+    var pair = vars[i].split('=');
+    params[pair[0]] = pair[1];
+  }
+  return params;
+}
+
+/**
+ * Creates a new URL by appending or replacing the given query key and value.
+ * Not supporting URL with username and password.
+ * @param {Location} location The original URL.
+ * @param {string} key The query parameter name.
+ * @param {string} value The query parameter value.
+ * @return {string} The constructed new URL.
+ */
+function setQueryParam(location, key, value) {
+  var query = parseQueryParams(location);
+  query[encodeURIComponent(key)] = encodeURIComponent(value);
+
+  var newQuery = '';
+  for (var q in query) {
+    newQuery += (newQuery ? '&' : '?') + q + '=' + query[q];
+  }
+
+  return location.origin + location.pathname + newQuery + location.hash;
+}
+
+/**
+ * @param {Node} el A node to search for ancestors with |className|.
+ * @param {string} className A class to search for.
+ * @return {Element} A node with class of |className| or null if none is found.
+ */
+function findAncestorByClass(el, className) {
+  return /** @type {Element} */(findAncestor(el, function(el) {
+    return el.classList && el.classList.contains(className);
+  }));
+}
+
+/**
+ * Return the first ancestor for which the {@code predicate} returns true.
+ * @param {Node} node The node to check.
+ * @param {function(Node):boolean} predicate The function that tests the
+ *     nodes.
+ * @return {Node} The found ancestor or null if not found.
+ */
+function findAncestor(node, predicate) {
+  var last = false;
+  while (node != null && !(last = predicate(node))) {
+    node = node.parentNode;
+  }
+  return last ? node : null;
+}
+
+function swapDomNodes(a, b) {
+  var afterA = a.nextSibling;
+  if (afterA == b) {
+    swapDomNodes(b, a);
+    return;
+  }
+  var aParent = a.parentNode;
+  b.parentNode.replaceChild(a, b);
+  aParent.insertBefore(b, afterA);
+}
+
+/**
+ * Disables text selection and dragging, with optional whitelist callbacks.
+ * @param {function(Event):boolean=} opt_allowSelectStart Unless this function
+ *    is defined and returns true, the onselectionstart event will be
+ *    surpressed.
+ * @param {function(Event):boolean=} opt_allowDragStart Unless this function
+ *    is defined and returns true, the ondragstart event will be surpressed.
+ */
+function disableTextSelectAndDrag(opt_allowSelectStart, opt_allowDragStart) {
+  // Disable text selection.
+  document.onselectstart = function(e) {
+    if (!(opt_allowSelectStart && opt_allowSelectStart.call(this, e)))
+      e.preventDefault();
+  };
+
+  // Disable dragging.
+  document.ondragstart = function(e) {
+    if (!(opt_allowDragStart && opt_allowDragStart.call(this, e)))
+      e.preventDefault();
+  };
+}
+
+/**
+ * TODO(dbeam): DO NOT USE. THIS IS DEPRECATED. Use an action-link instead.
+ * Call this to stop clicks on <a href="#"> links from scrolling to the top of
+ * the page (and possibly showing a # in the link).
+ */
+function preventDefaultOnPoundLinkClicks() {
+  document.addEventListener('click', function(e) {
+    var anchor = findAncestor(/** @type {Node} */(e.target), function(el) {
+      return el.tagName == 'A';
+    });
+    // Use getAttribute() to prevent URL normalization.
+    if (anchor && anchor.getAttribute('href') == '#')
+      e.preventDefault();
+  });
+}
+
+/**
+ * Check the directionality of the page.
+ * @return {boolean} True if Chrome is running an RTL UI.
+ */
+function isRTL() {
+  return document.documentElement.dir == 'rtl';
+}
+
+/**
+ * Get an element that's known to exist by its ID. We use this instead of just
+ * calling getElementById and not checking the result because this lets us
+ * satisfy the JSCompiler type system.
+ * @param {string} id The identifier name.
+ * @return {!HTMLElement} the Element.
+ */
+function getRequiredElement(id) {
+  return assertInstanceof($(id), HTMLElement,
+                          'Missing required element: ' + id);
+}
+
+/**
+ * Query an element that's known to exist by a selector. We use this instead of
+ * just calling querySelector and not checking the result because this lets us
+ * satisfy the JSCompiler type system.
+ * @param {string} selectors CSS selectors to query the element.
+ * @param {(!Document|!DocumentFragment|!Element)=} opt_context An optional
+ *     context object for querySelector.
+ * @return {!HTMLElement} the Element.
+ */
+function queryRequiredElement(selectors, opt_context) {
+  var element = (opt_context || document).querySelector(selectors);
+  return assertInstanceof(element, HTMLElement,
+                          'Missing required element: ' + selectors);
+}
+
+// Handle click on a link. If the link points to a chrome: or file: url, then
+// call into the browser to do the navigation.
+document.addEventListener('click', function(e) {
+  if (e.defaultPrevented)
+    return;
+
+  var el = e.target;
+  if (el.nodeType == Node.ELEMENT_NODE &&
+      el.webkitMatchesSelector('A, A *')) {
+    while (el.tagName != 'A') {
+      el = el.parentElement;
+    }
+
+    if ((el.protocol == 'file:' || el.protocol == 'about:') &&
+        (e.button == 0 || e.button == 1)) {
+      chrome.send('navigateToUrl', [
+        el.href,
+        el.target,
+        e.button,
+        e.altKey,
+        e.ctrlKey,
+        e.metaKey,
+        e.shiftKey
+      ]);
+      e.preventDefault();
+    }
+  }
+});
+
+/**
+ * Creates a new URL which is the old URL with a GET param of key=value.
+ * @param {string} url The base URL. There is not sanity checking on the URL so
+ *     it must be passed in a proper format.
+ * @param {string} key The key of the param.
+ * @param {string} value The value of the param.
+ * @return {string} The new URL.
+ */
+function appendParam(url, key, value) {
+  var param = encodeURIComponent(key) + '=' + encodeURIComponent(value);
+
+  if (url.indexOf('?') == -1)
+    return url + '?' + param;
+  return url + '&' + param;
+}
+
+/**
+ * Creates a CSS -webkit-image-set for a favicon request.
+ * @param {string} url The url for the favicon.
+ * @param {number=} opt_size Optional preferred size of the favicon.
+ * @param {string=} opt_type Optional type of favicon to request. Valid values
+ *     are 'favicon' and 'touch-icon'. Default is 'favicon'.
+ * @return {string} -webkit-image-set for the favicon.
+ */
+function getFaviconImageSet(url, opt_size, opt_type) {
+  var size = opt_size || 16;
+  var type = opt_type || 'favicon';
+  return imageset(
+      'chrome://' + type + '/size/' + size + '@scalefactorx/' + url);
+}
+
+/**
+ * Creates a new URL for a favicon request for the current device pixel ratio.
+ * The URL must be updated when the user moves the browser to a screen with a
+ * different device pixel ratio. Use getFaviconImageSet() for the updating to
+ * occur automatically.
+ * @param {string} url The url for the favicon.
+ * @param {number=} opt_size Optional preferred size of the favicon.
+ * @param {string=} opt_type Optional type of favicon to request. Valid values
+ *     are 'favicon' and 'touch-icon'. Default is 'favicon'.
+ * @return {string} Updated URL for the favicon.
+ */
+function getFaviconUrlForCurrentDevicePixelRatio(url, opt_size, opt_type) {
+  var size = opt_size || 16;
+  var type = opt_type || 'favicon';
+  return 'chrome://' + type + '/size/' + size + '@' +
+      window.devicePixelRatio + 'x/' + url;
+}
+
+/**
+ * Creates an element of a specified type with a specified class name.
+ * @param {string} type The node type.
+ * @param {string} className The class name to use.
+ * @return {Element} The created element.
+ */
+function createElementWithClassName(type, className) {
+  var elm = document.createElement(type);
+  elm.className = className;
+  return elm;
+}
+
+/**
+ * webkitTransitionEnd does not always fire (e.g. when animation is aborted
+ * or when no paint happens during the animation). This function sets up
+ * a timer and emulate the event if it is not fired when the timer expires.
+ * @param {!HTMLElement} el The element to watch for webkitTransitionEnd.
+ * @param {number} timeOut The maximum wait time in milliseconds for the
+ *     webkitTransitionEnd to happen.
+ */
+function ensureTransitionEndEvent(el, timeOut) {
+  var fired = false;
+  el.addEventListener('webkitTransitionEnd', function f(e) {
+    el.removeEventListener('webkitTransitionEnd', f);
+    fired = true;
+  });
+  window.setTimeout(function() {
+    if (!fired)
+      cr.dispatchSimpleEvent(el, 'webkitTransitionEnd', true);
+  }, timeOut);
+}
+
+/**
+ * Alias for document.scrollTop getter.
+ * @param {!HTMLDocument} doc The document node where information will be
+ *     queried from.
+ * @return {number} The Y document scroll offset.
+ */
+function scrollTopForDocument(doc) {
+  return doc.documentElement.scrollTop || doc.body.scrollTop;
+}
+
+/**
+ * Alias for document.scrollTop setter.
+ * @param {!HTMLDocument} doc The document node where information will be
+ *     queried from.
+ * @param {number} value The target Y scroll offset.
+ */
+function setScrollTopForDocument(doc, value) {
+  doc.documentElement.scrollTop = doc.body.scrollTop = value;
+}
+
+/**
+ * Alias for document.scrollLeft getter.
+ * @param {!HTMLDocument} doc The document node where information will be
+ *     queried from.
+ * @return {number} The X document scroll offset.
+ */
+function scrollLeftForDocument(doc) {
+  return doc.documentElement.scrollLeft || doc.body.scrollLeft;
+}
+
+/**
+ * Alias for document.scrollLeft setter.
+ * @param {!HTMLDocument} doc The document node where information will be
+ *     queried from.
+ * @param {number} value The target X scroll offset.
+ */
+function setScrollLeftForDocument(doc, value) {
+  doc.documentElement.scrollLeft = doc.body.scrollLeft = value;
+}
+
+/**
+ * Replaces '&', '<', '>', '"', and ''' characters with their HTML encoding.
+ * @param {string} original The original string.
+ * @return {string} The string with all the characters mentioned above replaced.
+ */
+function HTMLEscape(original) {
+  return original.replace(/&/g, '&amp;')
+                 .replace(/</g, '&lt;')
+                 .replace(/>/g, '&gt;')
+                 .replace(/"/g, '&quot;')
+                 .replace(/'/g, '&#39;');
+}
+
+/**
+ * Shortens the provided string (if necessary) to a string of length at most
+ * |maxLength|.
+ * @param {string} original The original string.
+ * @param {number} maxLength The maximum length allowed for the string.
+ * @return {string} The original string if its length does not exceed
+ *     |maxLength|. Otherwise the first |maxLength| - 1 characters with '...'
+ *     appended.
+ */
+function elide(original, maxLength) {
+  if (original.length <= maxLength)
+    return original;
+  return original.substring(0, maxLength - 1) + '\u2026';
+};
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('downloads', function() {
+  /**
+   * @param {string} chromeSendName
+   * @return {function(string):void} A chrome.send() callback with curried name.
+   */
+  function chromeSendWithId(chromeSendName) {
+    return function(id) { chrome.send(chromeSendName, [id]); };
+  }
+
+  /** @constructor */
+  function ActionService() {}
+
+  ActionService.prototype = {
+    /** @param {string} id ID of the download to cancel. */
+    cancel: chromeSendWithId('cancel'),
+
+    /** Instructs the browser to clear all finished downloads. */
+    clearAll: function() {
+      if (loadTimeData.getBoolean('allowDeletingHistory')) {
+        chrome.send('clearAll');
+        this.search('');
+      }
+    },
+
+    /** @param {string} id ID of the dangerous download to discard. */
+    discardDangerous: chromeSendWithId('discardDangerous'),
+
+    /** @param {string} url URL of a file to download. */
+    download: function(url) {
+      var a = document.createElement('a');
+      a.href = url;
+      a.setAttribute('download', '');
+      a.click();
+    },
+
+    /** @param {string} id ID of the download that the user started dragging. */
+    drag: chromeSendWithId('drag'),
+
+    /**
+     * @return {boolean} Whether the user is currently searching for downloads
+     *     (i.e. has a non-empty search term).
+     */
+    isSearching: function() {
+      return this.searchText_.length > 0;
+    },
+
+    /** Opens the current local destination for downloads. */
+    openDownloadsFolder: chrome.send.bind(chrome, 'openDownloadsFolder'),
+
+    /**
+     * @param {string} id ID of the download to run locally on the user's box.
+     */
+    openFile: chromeSendWithId('openFile'),
+
+    /** @param {string} id ID the of the progressing download to pause. */
+    pause: chromeSendWithId('pause'),
+
+    /** @param {string} id ID of the finished download to remove. */
+    remove: chromeSendWithId('remove'),
+
+    /** @param {string} id ID of the paused download to resume. */
+    resume: chromeSendWithId('resume'),
+
+    /**
+     * @param {string} id ID of the dangerous download to save despite
+     *     warnings.
+     */
+    saveDangerous: chromeSendWithId('saveDangerous'),
+
+    /** @param {string} searchText What to search for. */
+    search: function(searchText) {
+      if (this.searchText_ == searchText)
+        return;
+
+      this.searchText_ = searchText;
+
+      // Split quoted terms (e.g., 'The "lazy" dog' => ['The', 'lazy', 'dog']).
+      function trim(s) { return s.trim(); }
+      chrome.send('getDownloads', searchText.split(/"([^"]*)"/).map(trim));
+    },
+
+    /**
+     * Shows the local folder a finished download resides in.
+     * @param {string} id ID of the download to show.
+     */
+    show: chromeSendWithId('show'),
+
+    /** Undo download removal. */
+    undo: chrome.send.bind(chrome, 'undo'),
+  };
+
+  cr.addSingletonGetter(ActionService);
+
+  return {ActionService: ActionService};
+});
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('downloads', function() {
+  /**
+   * Explains why a download is in DANGEROUS state.
+   * @enum {string}
+   */
+  var DangerType = {
+    NOT_DANGEROUS: 'NOT_DANGEROUS',
+    DANGEROUS_FILE: 'DANGEROUS_FILE',
+    DANGEROUS_URL: 'DANGEROUS_URL',
+    DANGEROUS_CONTENT: 'DANGEROUS_CONTENT',
+    UNCOMMON_CONTENT: 'UNCOMMON_CONTENT',
+    DANGEROUS_HOST: 'DANGEROUS_HOST',
+    POTENTIALLY_UNWANTED: 'POTENTIALLY_UNWANTED',
+  };
+
+  /**
+   * The states a download can be in. These correspond to states defined in
+   * DownloadsDOMHandler::CreateDownloadItemValue
+   * @enum {string}
+   */
+  var States = {
+    IN_PROGRESS: 'IN_PROGRESS',
+    CANCELLED: 'CANCELLED',
+    COMPLETE: 'COMPLETE',
+    PAUSED: 'PAUSED',
+    DANGEROUS: 'DANGEROUS',
+    INTERRUPTED: 'INTERRUPTED',
+  };
+
+  return {
+    DangerType: DangerType,
+    States: States,
+  };
+});
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('cr.ui', function() {
+  /**
+   * A class to manage focus between given horizontally arranged elements.
+   *
+   * Pressing left cycles backward and pressing right cycles forward in item
+   * order. Pressing Home goes to the beginning of the list and End goes to the
+   * end of the list.
+   *
+   * If an item in this row is focused, it'll stay active (accessible via tab).
+   * If no items in this row are focused, the row can stay active until focus
+   * changes to a node inside |this.boundary_|. If |boundary| isn't specified,
+   * any focus change deactivates the row.
+   *
+   * @param {!Element} root The root of this focus row. Focus classes are
+   *     applied to |root| and all added elements must live within |root|.
+   * @param {?Node} boundary Focus events are ignored outside of this node.
+   * @param {cr.ui.FocusRow.Delegate=} opt_delegate An optional event delegate.
+   * @constructor
+   */
+  function FocusRow(root, boundary, opt_delegate) {
+    /** @type {!Element} */
+    this.root = root;
+
+    /** @private {!Node} */
+    this.boundary_ = boundary || document;
+
+    /** @type {cr.ui.FocusRow.Delegate|undefined} */
+    this.delegate = opt_delegate;
+
+    /** @protected {!EventTracker} */
+    this.eventTracker = new EventTracker;
+  }
+
+  /** @interface */
+  FocusRow.Delegate = function() {};
+
+  FocusRow.Delegate.prototype = {
+    /**
+     * Called when a key is pressed while on a FocusRow's item. If true is
+     * returned, further processing is skipped.
+     * @param {!cr.ui.FocusRow} row The row that detected a keydown.
+     * @param {!Event} e
+     * @return {boolean} Whether the event was handled.
+     */
+    onKeydown: assertNotReached,
+
+    /**
+     * @param {!cr.ui.FocusRow} row
+     * @param {!Event} e
+     */
+    onFocus: assertNotReached,
+  };
+
+  /** @const {string} */
+  FocusRow.ACTIVE_CLASS = 'focus-row-active';
+
+  /**
+   * Whether it's possible that |element| can be focused.
+   * @param {Element} element
+   * @return {boolean} Whether the item is focusable.
+   */
+  FocusRow.isFocusable = function(element) {
+    if (!element || element.disabled)
+      return false;
+
+    // We don't check that element.tabIndex >= 0 here because inactive rows set
+    // a tabIndex of -1.
+
+    function isVisible(element) {
+      assertInstanceof(element, Element);
+
+      var style = window.getComputedStyle(element);
+      if (style.visibility == 'hidden' || style.display == 'none')
+        return false;
+
+      var parent = element.parentNode;
+      if (!parent)
+        return false;
+
+      if (parent == element.ownerDocument || parent instanceof DocumentFragment)
+        return true;
+
+      return isVisible(parent);
+    }
+
+    return isVisible(element);
+  };
+
+  FocusRow.prototype = {
+    /**
+     * Register a new type of focusable element (or add to an existing one).
+     *
+     * Example: an (X) button might be 'delete' or 'close'.
+     *
+     * When FocusRow is used within a FocusGrid, these types are used to
+     * determine equivalent controls when Up/Down are pressed to change rows.
+     *
+     * Another example: mutually exclusive controls that hide eachother on
+     * activation (i.e. Play/Pause) could use the same type (i.e. 'play-pause')
+     * to indicate they're equivalent.
+     *
+     * @param {string} type The type of element to track focus of.
+     * @param {string} query The selector of the element from this row's root.
+     * @return {boolean} Whether a new item was added.
+     */
+    addItem: function(type, query) {
+      assert(type);
+
+      var element = this.root.querySelector(query);
+      if (!element)
+        return false;
+
+      element.setAttribute('focus-type', type);
+      element.tabIndex = this.isActive() ? 0 : -1;
+
+      this.eventTracker.add(element, 'blur', this.onBlur_.bind(this));
+      this.eventTracker.add(element, 'focus', this.onFocus_.bind(this));
+      this.eventTracker.add(element, 'keydown', this.onKeydown_.bind(this));
+      this.eventTracker.add(element, 'mousedown',
+                             this.onMousedown_.bind(this));
+      return true;
+    },
+
+    /** Dereferences nodes and removes event handlers. */
+    destroy: function() {
+      this.eventTracker.removeAll();
+    },
+
+    /**
+     * @param {Element} sampleElement An element for to find an equivalent for.
+     * @return {!Element} An equivalent element to focus for |sampleElement|.
+     * @protected
+     */
+    getCustomEquivalent: function(sampleElement) {
+      return assert(this.getFirstFocusable());
+    },
+
+    /**
+     * @return {!Array<!Element>} All registered elements (regardless of
+     *     focusability).
+     */
+    getElements: function() {
+      var elements = this.root.querySelectorAll('[focus-type]');
+      return Array.prototype.slice.call(elements);
+    },
+
+    /**
+     * Find the element that best matches |sampleElement|.
+     * @param {!Element} sampleElement An element from a row of the same type
+     *     which previously held focus.
+     * @return {!Element} The element that best matches sampleElement.
+     */
+    getEquivalentElement: function(sampleElement) {
+      if (this.getFocusableElements().indexOf(sampleElement) >= 0)
+        return sampleElement;
+
+      var sampleFocusType = this.getTypeForElement(sampleElement);
+      if (sampleFocusType) {
+        var sameType = this.getFirstFocusable(sampleFocusType);
+        if (sameType)
+          return sameType;
+      }
+
+      return this.getCustomEquivalent(sampleElement);
+    },
+
+    /**
+     * @param {string=} opt_type An optional type to search for.
+     * @return {?Element} The first focusable element with |type|.
+     */
+    getFirstFocusable: function(opt_type) {
+      var filter = opt_type ? '="' + opt_type + '"' : '';
+      var elements = this.root.querySelectorAll('[focus-type' + filter + ']');
+      for (var i = 0; i < elements.length; ++i) {
+        if (cr.ui.FocusRow.isFocusable(elements[i]))
+          return elements[i];
+      }
+      return null;
+    },
+
+    /** @return {!Array<!Element>} Registered, focusable elements. */
+    getFocusableElements: function() {
+      return this.getElements().filter(cr.ui.FocusRow.isFocusable);
+    },
+
+    /**
+     * @param {!Element} element An element to determine a focus type for.
+     * @return {string} The focus type for |element| or '' if none.
+     */
+    getTypeForElement: function(element) {
+      return element.getAttribute('focus-type') || '';
+    },
+
+    /** @return {boolean} Whether this row is currently active. */
+    isActive: function() {
+      return this.root.classList.contains(FocusRow.ACTIVE_CLASS);
+    },
+
+    /**
+     * Enables/disables the tabIndex of the focusable elements in the FocusRow.
+     * tabIndex can be set properly.
+     * @param {boolean} active True if tab is allowed for this row.
+     */
+    makeActive: function(active) {
+      if (active == this.isActive())
+        return;
+
+      this.getElements().forEach(function(element) {
+        element.tabIndex = active ? 0 : -1;
+      });
+
+      this.root.classList.toggle(FocusRow.ACTIVE_CLASS, active);
+    },
+
+    /**
+     * @param {!Event} e
+     * @private
+     */
+    onBlur_: function(e) {
+      if (!this.boundary_.contains(/** @type {Node} */(e.relatedTarget)))
+        return;
+
+      if (this.getFocusableElements().indexOf(e.currentTarget) >= 0)
+        this.makeActive(false);
+    },
+
+    /**
+     * @param {!Event} e
+     * @private
+     */
+    onFocus_: function(e) {
+      if (this.delegate)
+        this.delegate.onFocus(this, e);
+    },
+
+    /**
+     * @param {!Event} e A mousedown event.
+     * @private
+     */
+    onMousedown_: function(e) {
+      // Only accept left mouse clicks.
+      if (e.button)
+        return;
+
+      // Allow the element under the mouse cursor to be focusable.
+      if (!e.currentTarget.disabled)
+        e.currentTarget.tabIndex = 0;
+    },
+
+    /**
+     * @param {Event} e The keydown event.
+     * @private
+     */
+    onKeydown_: function(e) {
+      var elements = this.getFocusableElements();
+      var elementIndex = elements.indexOf(e.currentTarget);
+      assert(elementIndex >= 0);
+
+      if (this.delegate && this.delegate.onKeydown(this, e))
+        return;
+
+      if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey)
+        return;
+
+      var index = -1;
+
+      if (e.keyIdentifier == 'Left')
+        index = elementIndex + (isRTL() ? 1 : -1);
+      else if (e.keyIdentifier == 'Right')
+        index = elementIndex + (isRTL() ? -1 : 1);
+      else if (e.keyIdentifier == 'Home')
+        index = 0;
+      else if (e.keyIdentifier == 'End')
+        index = elements.length - 1;
+
+      var elementToFocus = elements[index];
+      if (elementToFocus) {
+        this.getEquivalentElement(elementToFocus).focus();
+        e.preventDefault();
+      }
+    },
+  };
+
+  return {
+    FocusRow: FocusRow,
+  };
+});
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('downloads', function() {
+  /**
+   * @param {!Element} root
+   * @param {?Node} boundary
+   * @constructor
+   * @extends {cr.ui.FocusRow}
+   */
+  function FocusRow(root, boundary) {
+    cr.ui.FocusRow.call(this, root, boundary);
+    this.addItems();
+  }
+
+  FocusRow.prototype = {
+    __proto__: cr.ui.FocusRow.prototype,
+
+    addItems: function() {
+      this.destroy();
+
+      this.addItem('name-file-link',
+          'content.is-active:not(.show-progress):not(.dangerous) #name');
+      assert(this.addItem('name-file-link', '#file-link'));
+      assert(this.addItem('url', '#url'));
+      this.addItem('show-retry', '#show');
+      this.addItem('show-retry', '#retry');
+      this.addItem('pause-resume', '#pause');
+      this.addItem('pause-resume', '#resume');
+      this.addItem('cancel', '#cancel');
+      this.addItem('controlled-by', '#controlled-by a');
+      this.addItem('danger-remove-discard', '#discard');
+      this.addItem('restore-save', '#save');
+      this.addItem('danger-remove-discard', '#danger-remove');
+      this.addItem('restore-save', '#restore');
+      assert(this.addItem('remove', '#remove'));
+
+      // TODO(dbeam): it would be nice to do this asynchronously (so if multiple
+      // templates get rendered we only re-add once), but Manager#updateItem_()
+      // relies on the DOM being re-rendered synchronously.
+      this.eventTracker.add(this.root, 'dom-change', this.addItems.bind(this));
+    },
+  };
+
+  return {FocusRow: FocusRow};
+});
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Action links are elements that are used to perform an in-page navigation or
+// action (e.g. showing a dialog).
+//
+// They look like normal anchor (<a>) tags as their text color is blue. However,
+// they're subtly different as they're not initially underlined (giving users a
+// clue that underlined links navigate while action links don't).
+//
+// Action links look very similar to normal links when hovered (hand cursor,
+// underlined). This gives the user an idea that clicking this link will do
+// something similar to navigation but in the same page.
+//
+// They can be created in JavaScript like this:
+//
+//   var link = document.createElement('a', 'action-link');  // Note second arg.
+//
+// or with a constructor like this:
+//
+//   var link = new ActionLink();
+//
+// They can be used easily from HTML as well, like so:
+//
+//   <a is="action-link">Click me!</a>
+//
+// NOTE: <action-link> and document.createElement('action-link') don't work.
+
+/**
+ * @constructor
+ * @extends {HTMLAnchorElement}
+ */
+var ActionLink = document.registerElement('action-link', {
+  prototype: {
+    __proto__: HTMLAnchorElement.prototype,
+
+    /** @this {ActionLink} */
+    createdCallback: function() {
+      // Action links can start disabled (e.g. <a is="action-link" disabled>).
+      this.tabIndex = this.disabled ? -1 : 0;
+
+      if (!this.hasAttribute('role'))
+        this.setAttribute('role', 'link');
+
+      this.addEventListener('keydown', function(e) {
+        if (!this.disabled && e.keyIdentifier == 'Enter') {
+          // Schedule a click asynchronously because other 'keydown' handlers
+          // may still run later (e.g. document.addEventListener('keydown')).
+          // Specifically options dialogs break when this timeout isn't here.
+          // NOTE: this affects the "trusted" state of the ensuing click. I
+          // haven't found anything that breaks because of this (yet).
+          window.setTimeout(this.click.bind(this), 0);
+        }
+      });
+
+      function preventDefault(e) {
+        e.preventDefault();
+      }
+
+      function removePreventDefault() {
+        document.removeEventListener('selectstart', preventDefault);
+        document.removeEventListener('mouseup', removePreventDefault);
+      }
+
+      this.addEventListener('mousedown', function() {
+        // This handlers strives to match the behavior of <a href="...">.
+
+        // While the mouse is down, prevent text selection from dragging.
+        document.addEventListener('selectstart', preventDefault);
+        document.addEventListener('mouseup', removePreventDefault);
+
+        // If focus started via mouse press, don't show an outline.
+        if (document.activeElement != this)
+          this.classList.add('no-outline');
+      });
+
+      this.addEventListener('blur', function() {
+        this.classList.remove('no-outline');
+      });
+    },
+
+    /** @type {boolean} */
+    set disabled(disabled) {
+      if (disabled)
+        HTMLAnchorElement.prototype.setAttribute.call(this, 'disabled', '');
+      else
+        HTMLAnchorElement.prototype.removeAttribute.call(this, 'disabled');
+      this.tabIndex = disabled ? -1 : 0;
+    },
+    get disabled() {
+      return this.hasAttribute('disabled');
+    },
+
+    /** @override */
+    setAttribute: function(attr, val) {
+      if (attr.toLowerCase() == 'disabled')
+        this.disabled = true;
+      else
+        HTMLAnchorElement.prototype.setAttribute.apply(this, arguments);
+    },
+
+    /** @override */
+    removeAttribute: function(attr) {
+      if (attr.toLowerCase() == 'disabled')
+        this.disabled = false;
+      else
+        HTMLAnchorElement.prototype.removeAttribute.apply(this, arguments);
+    },
+  },
+
+  extends: 'a',
+});
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @typedef {{img: HTMLImageElement, url: string}} */
+var LoadIconRequest;
+
+cr.define('downloads', function() {
+  /**
+   * @param {number} maxAllowed The maximum number of simultaneous downloads
+   *     allowed.
+   * @constructor
+   */
+  function ThrottledIconLoader(maxAllowed) {
+    assert(maxAllowed > 0);
+
+    /** @private {number} */
+    this.maxAllowed_ = maxAllowed;
+
+    /** @private {!Array<!LoadIconRequest>} */
+    this.requests_ = [];
+  }
+
+  ThrottledIconLoader.prototype = {
+    /** @private {number} */
+    loading_: 0,
+
+    /**
+     * Load the provided |url| into |img.src| after appending ?scale=.
+     * @param {!HTMLImageElement} img An <img> to show the loaded image in.
+     * @param {string} url A remote image URL to load.
+     */
+    loadScaledIcon: function(img, url) {
+      var scaledUrl = url + '?scale=' + window.devicePixelRatio + 'x';
+      if (img.src == scaledUrl)
+        return;
+
+      this.requests_.push({img: img, url: scaledUrl});
+      this.loadNextIcon_();
+    },
+
+    /** @private */
+    loadNextIcon_: function() {
+      if (this.loading_ > this.maxAllowed_ || !this.requests_.length)
+        return;
+
+      var request = this.requests_.shift();
+      var img = request.img;
+
+      img.onabort = img.onerror = img.onload = function() {
+        this.loading_--;
+        this.loadNextIcon_();
+      }.bind(this);
+
+      this.loading_++;
+      img.src = request.url;
+    },
+  };
+
+  return {ThrottledIconLoader: ThrottledIconLoader};
+});
+// Copyright 2014 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+//     You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//     See the License for the specific language governing permissions and
+// limitations under the License.
+
+!function(a,b){b["true"]=a;var c={},d={},e={},f=null;!function(a){function b(a){if("number"==typeof a)return a;var b={};for(var c in a)b[c]=a[c];return b}function c(){this._delay=0,this._endDelay=0,this._fill="none",this._iterationStart=0,this._iterations=1,this._duration=0,this._playbackRate=1,this._direction="normal",this._easing="linear"}function d(b,d){var e=new c;return d&&(e.fill="both",e.duration="auto"),"number"!=typeof b||isNaN(b)?void 0!==b&&Object.getOwnPropertyNames(b).forEach(function(c){if("auto"!=b[c]){if(("number"==typeof e[c]||"duration"==c)&&("number"!=typeof b[c]||isNaN(b[c])))return;if("fill"==c&&-1==s.indexOf(b[c]))return;if("direction"==c&&-1==t.indexOf(b[c]))return;if("playbackRate"==c&&1!==b[c]&&a.isDeprecated("AnimationEffectTiming.playbackRate","2014-11-28","Use Animation.playbackRate instead."))return;e[c]=b[c]}}):e.duration=b,e}function e(a){return"number"==typeof a&&(a=isNaN(a)?{duration:0}:{duration:a}),a}function f(b,c){b=a.numericTimingToObject(b);var e=d(b,c);return e._easing=i(e.easing),e}function g(a,b,c,d){return 0>a||a>1||0>c||c>1?B:function(e){function f(a,b,c){return 3*a*(1-c)*(1-c)*c+3*b*(1-c)*c*c+c*c*c}if(0==e||1==e)return e;for(var g=0,h=1;;){var i=(g+h)/2,j=f(a,c,i);if(Math.abs(e-j)<.001)return f(b,d,i);e>j?g=i:h=i}}}function h(a,b){return function(c){if(c>=1)return 1;var d=1/a;return c+=b*d,c-c%d}}function i(a){var b=z.exec(a);if(b)return g.apply(this,b.slice(1).map(Number));var c=A.exec(a);if(c)return h(Number(c[1]),{start:u,middle:v,end:w}[c[2]]);var d=x[a];return d?d:B}function j(a){return Math.abs(k(a)/a.playbackRate)}function k(a){return a.duration*a.iterations}function l(a,b,c){return null==b?C:b<c.delay?D:b>=c.delay+a?E:F}function m(a,b,c,d,e){switch(d){case D:return"backwards"==b||"both"==b?0:null;case F:return c-e;case E:return"forwards"==b||"both"==b?a:null;case C:return null}}function n(a,b,c,d){return(d.playbackRate<0?b-a:b)*d.playbackRate+c}function o(a,b,c,d,e){return 1/0===c||c===-1/0||c-d==b&&e.iterations&&(e.iterations+e.iterationStart)%1==0?a:c%a}function p(a,b,c,d){return 0===c?0:b==a?d.iterationStart+d.iterations-1:Math.floor(c/a)}function q(a,b,c,d){var e=a%2>=1,f="normal"==d.direction||d.direction==(e?"alternate-reverse":"alternate"),g=f?c:b-c,h=g/b;return b*d.easing(h)}function r(a,b,c){var d=l(a,b,c),e=m(a,c.fill,b,d,c.delay);if(null===e)return null;if(0===a)return d===D?0:1;var f=c.iterationStart*c.duration,g=n(a,e,f,c),h=o(c.duration,k(c),g,f,c),i=p(c.duration,h,g,c);return q(i,c.duration,h,c)/c.duration}var s="backwards|forwards|both|none".split("|"),t="reverse|alternate|alternate-reverse".split("|");c.prototype={_setMember:function(b,c){this["_"+b]=c,this._effect&&(this._effect._timingInput[b]=c,this._effect._timing=a.normalizeTimingInput(a.normalizeTimingInput(this._effect._timingInput)),this._effect.activeDuration=a.calculateActiveDuration(this._effect._timing),this._effect._animation&&this._effect._animation._rebuildUnderlyingAnimation())},get playbackRate(){return this._playbackRate},set delay(a){this._setMember("delay",a)},get delay(){return this._delay},set endDelay(a){this._setMember("endDelay",a)},get endDelay(){return this._endDelay},set fill(a){this._setMember("fill",a)},get fill(){return this._fill},set iterationStart(a){this._setMember("iterationStart",a)},get iterationStart(){return this._iterationStart},set duration(a){this._setMember("duration",a)},get duration(){return this._duration},set direction(a){this._setMember("direction",a)},get direction(){return this._direction},set easing(a){this._setMember("easing",a)},get easing(){return this._easing},set iterations(a){this._setMember("iterations",a)},get iterations(){return this._iterations}};var u=1,v=.5,w=0,x={ease:g(.25,.1,.25,1),"ease-in":g(.42,0,1,1),"ease-out":g(0,0,.58,1),"ease-in-out":g(.42,0,.58,1),"step-start":h(1,u),"step-middle":h(1,v),"step-end":h(1,w)},y="\\s*(-?\\d+\\.?\\d*|-?\\.\\d+)\\s*",z=new RegExp("cubic-bezier\\("+y+","+y+","+y+","+y+"\\)"),A=/steps\(\s*(\d+)\s*,\s*(start|middle|end)\s*\)/,B=function(a){return a},C=0,D=1,E=2,F=3;a.cloneTimingInput=b,a.makeTiming=d,a.numericTimingToObject=e,a.normalizeTimingInput=f,a.calculateActiveDuration=j,a.calculateTimeFraction=r,a.calculatePhase=l,a.toTimingFunction=i}(c,f),function(a){function b(a,b){return a in h?h[a][b]||b:b}function c(a,c,d){var g=e[a];if(g){f.style[a]=c;for(var h in g){var i=g[h],j=f.style[i];d[i]=b(i,j)}}else d[a]=b(a,c)}function d(b){function d(){var a=e.length;null==e[a-1].offset&&(e[a-1].offset=1),a>1&&null==e[0].offset&&(e[0].offset=0);for(var b=0,c=e[0].offset,d=1;a>d;d++){var f=e[d].offset;if(null!=f){for(var g=1;d-b>g;g++)e[b+g].offset=c+(f-c)*g/(d-b);b=d,c=f}}}if(!Array.isArray(b)&&null!==b)throw new TypeError("Keyframes must be null or an array of keyframes");if(null==b)return[];for(var e=b.map(function(b){var d={};for(var e in b){var f=b[e];if("offset"==e){if(null!=f&&(f=Number(f),!isFinite(f)))throw new TypeError("keyframe offsets must be numbers.")}else{if("composite"==e)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"add compositing is not supported"};f="easing"==e?a.toTimingFunction(f):""+f}c(e,f,d)}return void 0==d.offset&&(d.offset=null),void 0==d.easing&&(d.easing=a.toTimingFunction("linear")),d}),f=!0,g=-1/0,h=0;h<e.length;h++){var i=e[h].offset;if(null!=i){if(g>i)throw{code:DOMException.INVALID_MODIFICATION_ERR,name:"InvalidModificationError",message:"Keyframes are not loosely sorted by offset. Sort or specify offsets."};g=i}else f=!1}return e=e.filter(function(a){return a.offset>=0&&a.offset<=1}),f||d(),e}var e={background:["backgroundImage","backgroundPosition","backgroundSize","backgroundRepeat","backgroundAttachment","backgroundOrigin","backgroundClip","backgroundColor"],border:["borderTopColor","borderTopStyle","borderTopWidth","borderRightColor","borderRightStyle","borderRightWidth","borderBottomColor","borderBottomStyle","borderBottomWidth","borderLeftColor","borderLeftStyle","borderLeftWidth"],borderBottom:["borderBottomWidth","borderBottomStyle","borderBottomColor"],borderColor:["borderTopColor","borderRightColor","borderBottomColor","borderLeftColor"],borderLeft:["borderLeftWidth","borderLeftStyle","borderLeftColor"],borderRadius:["borderTopLeftRadius","borderTopRightRadius","borderBottomRightRadius","borderBottomLeftRadius"],borderRight:["borderRightWidth","borderRightStyle","borderRightColor"],borderTop:["borderTopWidth","borderTopStyle","borderTopColor"],borderWidth:["borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth"],flex:["flexGrow","flexShrink","flexBasis"],font:["fontFamily","fontSize","fontStyle","fontVariant","fontWeight","lineHeight"],margin:["marginTop","marginRight","marginBottom","marginLeft"],outline:["outlineColor","outlineStyle","outlineWidth"],padding:["paddingTop","paddingRight","paddingBottom","paddingLeft"]},f=document.createElementNS("http://www.w3.org/1999/xhtml","div"),g={thin:"1px",medium:"3px",thick:"5px"},h={borderBottomWidth:g,borderLeftWidth:g,borderRightWidth:g,borderTopWidth:g,fontSize:{"xx-small":"60%","x-small":"75%",small:"89%",medium:"100%",large:"120%","x-large":"150%","xx-large":"200%"},fontWeight:{normal:"400",bold:"700"},outlineWidth:g,textShadow:{none:"0px 0px 0px transparent"},boxShadow:{none:"0px 0px 0px 0px transparent"}};a.normalizeKeyframes=d}(c,f),function(a){var b={};a.isDeprecated=function(a,c,d,e){var f=e?"are":"is",g=new Date,h=new Date(c);return h.setMonth(h.getMonth()+3),h>g?(a in b||console.warn("Web Animations: "+a+" "+f+" deprecated and will stop working on "+h.toDateString()+". "+d),b[a]=!0,!1):!0},a.deprecated=function(b,c,d,e){var f=e?"are":"is";if(a.isDeprecated(b,c,d,e))throw new Error(b+" "+f+" no longer supported. "+d)}}(c),function(){if(document.documentElement.animate){var a=document.documentElement.animate([],0),b=!0;if(a&&(b=!1,"play|currentTime|pause|reverse|playbackRate|cancel|finish|startTime|playState".split("|").forEach(function(c){void 0===a[c]&&(b=!0)})),!b)return}!function(a,b){function c(a){for(var b={},c=0;c<a.length;c++)for(var d in a[c])if("offset"!=d&&"easing"!=d&&"composite"!=d){var e={offset:a[c].offset,easing:a[c].easing,value:a[c][d]};b[d]=b[d]||[],b[d].push(e)}for(var f in b){var g=b[f];if(0!=g[0].offset||1!=g[g.length-1].offset)throw{type:DOMException.NOT_SUPPORTED_ERR,name:"NotSupportedError",message:"Partial keyframes are not supported"}}return b}function d(a){var c=[];for(var d in a)for(var e=a[d],f=0;f<e.length-1;f++){var g=e[f].offset,h=e[f+1].offset,i=e[f].value,j=e[f+1].value;g==h&&(1==h?i=j:j=i),c.push({startTime:g,endTime:h,easing:e[f].easing,property:d,interpolation:b.propertyInterpolation(d,i,j)})}return c.sort(function(a,b){return a.startTime-b.startTime}),c}b.convertEffectInput=function(e){var f=a.normalizeKeyframes(e),g=c(f),h=d(g);return function(a,c){if(null!=c)h.filter(function(a){return 0>=c&&0==a.startTime||c>=1&&1==a.endTime||c>=a.startTime&&c<=a.endTime}).forEach(function(d){var e=c-d.startTime,f=d.endTime-d.startTime,g=0==f?0:d.easing(e/f);b.apply(a,d.property,d.interpolation(g))});else for(var d in g)"offset"!=d&&"easing"!=d&&"composite"!=d&&b.clear(a,d)}}}(c,d,f),function(a){function b(a,b,c){e[c]=e[c]||[],e[c].push([a,b])}function c(a,c,d){for(var e=0;e<d.length;e++){var f=d[e];b(a,c,f),/-/.test(f)&&b(a,c,f.replace(/-(.)/g,function(a,b){return b.toUpperCase()}))}}function d(b,c,d){if("initial"==c||"initial"==d){var g=b.replace(/-(.)/g,function(a,b){return b.toUpperCase()});"initial"==c&&(c=f[g]),"initial"==d&&(d=f[g])}for(var h=c==d?[]:e[b],i=0;h&&i<h.length;i++){var j=h[i][0](c),k=h[i][0](d);if(void 0!==j&&void 0!==k){var l=h[i][1](j,k);if(l){var m=a.Interpolation.apply(null,l);return function(a){return 0==a?c:1==a?d:m(a)}}}}return a.Interpolation(!1,!0,function(a){return a?d:c})}var e={};a.addPropertiesHandler=c;var f={backgroundColor:"transparent",backgroundPosition:"0% 0%",borderBottomColor:"currentColor",borderBottomLeftRadius:"0px",borderBottomRightRadius:"0px",borderBottomWidth:"3px",borderLeftColor:"currentColor",borderLeftWidth:"3px",borderRightColor:"currentColor",borderRightWidth:"3px",borderSpacing:"2px",borderTopColor:"currentColor",borderTopLeftRadius:"0px",borderTopRightRadius:"0px",borderTopWidth:"3px",bottom:"auto",clip:"rect(0px, 0px, 0px, 0px)",color:"black",fontSize:"100%",fontWeight:"400",height:"auto",left:"auto",letterSpacing:"normal",lineHeight:"120%",marginBottom:"0px",marginLeft:"0px",marginRight:"0px",marginTop:"0px",maxHeight:"none",maxWidth:"none",minHeight:"0px",minWidth:"0px",opacity:"1.0",outlineColor:"invert",outlineOffset:"0px",outlineWidth:"3px",paddingBottom:"0px",paddingLeft:"0px",paddingRight:"0px",paddingTop:"0px",right:"auto",textIndent:"0px",textShadow:"0px 0px 0px transparent",top:"auto",transform:"",verticalAlign:"0px",visibility:"visible",width:"auto",wordSpacing:"normal",zIndex:"auto"};a.propertyInterpolation=d}(d,f),function(a,b){function c(b){var c=a.calculateActiveDuration(b),d=function(d){return a.calculateTimeFraction(c,d,b)};return d._totalDuration=b.delay+c+b.endDelay,d._isCurrent=function(d){var e=a.calculatePhase(c,d,b);return e===PhaseActive||e===PhaseBefore},d}b.KeyframeEffect=function(d,e,f){var g,h=c(a.normalizeTimingInput(f)),i=b.convertEffectInput(e),j=function(){i(d,g)};return j._update=function(a){return g=h(a),null!==g},j._clear=function(){i(d,null)},j._hasSameTarget=function(a){return d===a},j._isCurrent=h._isCurrent,j._totalDuration=h._totalDuration,j},b.NullEffect=function(a){var b=function(){a&&(a(),a=null)};return b._update=function(){return null},b._totalDuration=0,b._isCurrent=function(){return!1},b._hasSameTarget=function(){return!1},b}}(c,d,f),function(a){a.apply=function(b,c,d){b.style[a.propertyName(c)]=d},a.clear=function(b,c){b.style[a.propertyName(c)]=""}}(d,f),function(a){window.Element.prototype.animate=function(b,c){return a.timeline._play(a.KeyframeEffect(this,b,c))}}(d),function(a){function b(a,c,d){if("number"==typeof a&&"number"==typeof c)return a*(1-d)+c*d;if("boolean"==typeof a&&"boolean"==typeof c)return.5>d?a:c;if(a.length==c.length){for(var e=[],f=0;f<a.length;f++)e.push(b(a[f],c[f],d));return e}throw"Mismatched interpolation arguments "+a+":"+c}a.Interpolation=function(a,c,d){return function(e){return d(b(a,c,e))}}}(d,f),function(a,b){a.sequenceNumber=0;var c=function(a,b,c){this.target=a,this.currentTime=b,this.timelineTime=c,this.type="finish",this.bubbles=!1,this.cancelable=!1,this.currentTarget=a,this.defaultPrevented=!1,this.eventPhase=Event.AT_TARGET,this.timeStamp=Date.now()};b.Animation=function(b){this._sequenceNumber=a.sequenceNumber++,this._currentTime=0,this._startTime=null,this._paused=!1,this._playbackRate=1,this._inTimeline=!0,this._finishedFlag=!1,this.onfinish=null,this._finishHandlers=[],this._effect=b,this._inEffect=this._effect._update(0),this._idle=!0,this._currentTimePending=!1},b.Animation.prototype={_ensureAlive:function(){this._inEffect=this._effect._update(this.playbackRate<0&&0===this.currentTime?-1:this.currentTime),this._inTimeline||!this._inEffect&&this._finishedFlag||(this._inTimeline=!0,b.timeline._animations.push(this))},_tickCurrentTime:function(a,b){a!=this._currentTime&&(this._currentTime=a,this._isFinished&&!b&&(this._currentTime=this._playbackRate>0?this._totalDuration:0),this._ensureAlive())},get currentTime(){return this._idle||this._currentTimePending?null:this._currentTime},set currentTime(a){a=+a,isNaN(a)||(b.restart(),this._paused||null==this._startTime||(this._startTime=this._timeline.currentTime-a/this._playbackRate),this._currentTimePending=!1,this._currentTime!=a&&(this._tickCurrentTime(a,!0),b.invalidateEffects()))},get startTime(){return this._startTime},set startTime(a){a=+a,isNaN(a)||this._paused||this._idle||(this._startTime=a,this._tickCurrentTime((this._timeline.currentTime-this._startTime)*this.playbackRate),b.invalidateEffects())},get playbackRate(){return this._playbackRate},set playbackRate(a){if(a!=this._playbackRate){var b=this.currentTime;this._playbackRate=a,this._startTime=null,"paused"!=this.playState&&"idle"!=this.playState&&this.play(),null!=b&&(this.currentTime=b)}},get _isFinished(){return!this._idle&&(this._playbackRate>0&&this._currentTime>=this._totalDuration||this._playbackRate<0&&this._currentTime<=0)},get _totalDuration(){return this._effect._totalDuration},get playState(){return this._idle?"idle":null==this._startTime&&!this._paused&&0!=this.playbackRate||this._currentTimePending?"pending":this._paused?"paused":this._isFinished?"finished":"running"},play:function(){this._paused=!1,(this._isFinished||this._idle)&&(this._currentTime=this._playbackRate>0?0:this._totalDuration,this._startTime=null,b.invalidateEffects()),this._finishedFlag=!1,b.restart(),this._idle=!1,this._ensureAlive()},pause:function(){this._isFinished||this._paused||this._idle||(this._currentTimePending=!0),this._startTime=null,this._paused=!0},finish:function(){this._idle||(this.currentTime=this._playbackRate>0?this._totalDuration:0,this._startTime=this._totalDuration-this.currentTime,this._currentTimePending=!1)},cancel:function(){this._inEffect&&(this._inEffect=!1,this._idle=!0,this.currentTime=0,this._startTime=null,this._effect._update(null),b.invalidateEffects(),b.restart())},reverse:function(){this.playbackRate*=-1,this.play()},addEventListener:function(a,b){"function"==typeof b&&"finish"==a&&this._finishHandlers.push(b)},removeEventListener:function(a,b){if("finish"==a){var c=this._finishHandlers.indexOf(b);c>=0&&this._finishHandlers.splice(c,1)}},_fireEvents:function(a){var b=this._isFinished;if((b||this._idle)&&!this._finishedFlag){var d=new c(this,this._currentTime,a),e=this._finishHandlers.concat(this.onfinish?[this.onfinish]:[]);setTimeout(function(){e.forEach(function(a){a.call(d.target,d)})},0)}this._finishedFlag=b},_tick:function(a){return this._idle||this._paused||(null==this._startTime?this.startTime=a-this._currentTime/this.playbackRate:this._isFinished||this._tickCurrentTime((a-this._startTime)*this.playbackRate)),this._currentTimePending=!1,this._fireEvents(a),!this._idle&&(this._inEffect||!this._finishedFlag)}}}(c,d,f),function(a,b){function c(a){var b=i;i=[],a<s.currentTime&&(a=s.currentTime),g(a),b.forEach(function(b){b[1](a)}),o&&g(a),f(),l=void 0}function d(a,b){return a._sequenceNumber-b._sequenceNumber}function e(){this._animations=[],this.currentTime=window.performance&&performance.now?performance.now():0}function f(){p.forEach(function(a){a()}),p.length=0}function g(a){n=!1;var c=b.timeline;c.currentTime=a,c._animations.sort(d),m=!1;var e=c._animations;c._animations=[];var f=[],g=[];e=e.filter(function(b){return b._inTimeline=b._tick(a),b._inEffect?g.push(b._effect):f.push(b._effect),b._isFinished||b._paused||b._idle||(m=!0),b._inTimeline}),p.push.apply(p,f),p.push.apply(p,g),c._animations.push.apply(c._animations,e),o=!1,m&&requestAnimationFrame(function(){})}var h=window.requestAnimationFrame,i=[],j=0;window.requestAnimationFrame=function(a){var b=j++;return 0==i.length&&h(c),i.push([b,a]),b},window.cancelAnimationFrame=function(a){i.forEach(function(b){b[0]==a&&(b[1]=function(){})})},e.prototype={_play:function(c){c._timing=a.normalizeTimingInput(c.timing);var d=new b.Animation(c);return d._idle=!1,d._timeline=this,this._animations.push(d),b.restart(),b.invalidateEffects(),d}};var k,l=void 0,k=function(){return void 0==l&&(l=performance.now()),l},m=!1,n=!1;b.restart=function(){return m||(m=!0,requestAnimationFrame(function(){}),n=!0),n};var o=!1;b.invalidateEffects=function(){o=!0};var p=[],q=1e3/60,r=window.getComputedStyle;Object.defineProperty(window,"getComputedStyle",{configurable:!0,enumerable:!0,value:function(){if(o){var a=k();a-s.currentTime>0&&(s.currentTime+=q*(Math.floor((a-s.currentTime)/q)+1)),g(s.currentTime)}return f(),r.apply(this,arguments)}});var s=new e;b.timeline=s}(c,d,f),function(a){function b(a,b){var c=a.exec(b);return c?(c=a.ignoreCase?c[0].toLowerCase():c[0],[c,b.substr(c.length)]):void 0}function c(a,b){b=b.replace(/^\s*/,"");var c=a(b);return c?[c[0],c[1].replace(/^\s*/,"")]:void 0}function d(a,d,e){a=c.bind(null,a);for(var f=[];;){var g=a(e);if(!g)return[f,e];if(f.push(g[0]),e=g[1],g=b(d,e),!g||""==g[1])return[f,e];e=g[1]}}function e(a,b){for(var c=0,d=0;d<b.length&&(!/\s|,/.test(b[d])||0!=c);d++)if("("==b[d])c++;else if(")"==b[d]&&(c--,0==c&&d++,0>=c))break;var e=a(b.substr(0,d));return void 0==e?void 0:[e,b.substr(d)]}function f(a,b){for(var c=a,d=b;c&&d;)c>d?c%=d:d%=c;return c=a*b/(c+d)}function g(a){return function(b){var c=a(b);return c&&(c[0]=void 0),c}}function h(a,b){return function(c){var d=a(c);return d?d:[b,c]}}function i(b,c){for(var d=[],e=0;e<b.length;e++){var f=a.consumeTrimmed(b[e],c);if(!f||""==f[0])return;void 0!==f[0]&&d.push(f[0]),c=f[1]}return""==c?d:void 0}function j(a,b,c,d,e){for(var g=[],h=[],i=[],j=f(d.length,e.length),k=0;j>k;k++){var l=b(d[k%d.length],e[k%e.length]);if(!l)return;g.push(l[0]),h.push(l[1]),i.push(l[2])}return[g,h,function(b){var d=b.map(function(a,b){return i[b](a)}).join(c);return a?a(d):d}]}function k(a,b,c){for(var d=[],e=[],f=[],g=0,h=0;h<c.length;h++)if("function"==typeof c[h]){var i=c[h](a[g],b[g++]);d.push(i[0]),e.push(i[1]),f.push(i[2])}else!function(a){d.push(!1),e.push(!1),f.push(function(){return c[a]})}(h);return[d,e,function(a){for(var b="",c=0;c<a.length;c++)b+=f[c](a[c]);return b}]}a.consumeToken=b,a.consumeTrimmed=c,a.consumeRepeated=d,a.consumeParenthesised=e,a.ignore=g,a.optional=h,a.consumeList=i,a.mergeNestedRepeated=j.bind(null,null),a.mergeWrappedNestedRepeated=j,a.mergeList=k}(d),function(a){function b(b){function c(b){var c=a.consumeToken(/^inset/i,b);if(c)return d.inset=!0,c;var c=a.consumeLengthOrPercent(b);if(c)return d.lengths.push(c[0]),c;var c=a.consumeColor(b);return c?(d.color=c[0],c):void 0}var d={inset:!1,lengths:[],color:null},e=a.consumeRepeated(c,/^/,b);return e&&e[0].length?[d,e[1]]:void 0}function c(c){var d=a.consumeRepeated(b,/^,/,c);return d&&""==d[1]?d[0]:void 0}function d(b,c){for(;b.lengths.length<Math.max(b.lengths.length,c.lengths.length);)b.lengths.push({px:0});for(;c.lengths.length<Math.max(b.lengths.length,c.lengths.length);)c.lengths.push({px:0});if(b.inset==c.inset&&!!b.color==!!c.color){for(var d,e=[],f=[[],0],g=[[],0],h=0;h<b.lengths.length;h++){var i=a.mergeDimensions(b.lengths[h],c.lengths[h],2==h);f[0].push(i[0]),g[0].push(i[1]),e.push(i[2])}if(b.color&&c.color){var j=a.mergeColors(b.color,c.color);f[1]=j[0],g[1]=j[1],d=j[2]}return[f,g,function(a){for(var c=b.inset?"inset ":" ",f=0;f<e.length;f++)c+=e[f](a[0][f])+" ";return d&&(c+=d(a[1])),c}]}}function e(b,c,d,e){function f(a){return{inset:a,color:[0,0,0,0],lengths:[{px:0},{px:0},{px:0},{px:0}]}}for(var g=[],h=[],i=0;i<d.length||i<e.length;i++){var j=d[i]||f(e[i].inset),k=e[i]||f(d[i].inset);g.push(j),h.push(k)}return a.mergeNestedRepeated(b,c,g,h)}var f=e.bind(null,d,", ");a.addPropertiesHandler(c,f,["box-shadow","text-shadow"])}(d),function(a){function b(a){return a.toFixed(3).replace(".000","")}function c(a,b,c){return Math.min(b,Math.max(a,c))}function d(a){return/^\s*[-+]?(\d*\.)?\d+\s*$/.test(a)?Number(a):void 0}function e(a,c){return[a,c,b]}function f(a,b){return 0!=a?h(0,1/0)(a,b):void 0}function g(a,b){return[a,b,function(a){return Math.round(c(1,1/0,a))}]}function h(a,d){return function(e,f){return[e,f,function(e){return b(c(a,d,e))}]}}function i(a,b){return[a,b,Math.round]}a.clamp=c,a.addPropertiesHandler(d,h(0,1/0),["border-image-width","line-height"]),a.addPropertiesHandler(d,h(0,1),["opacity","shape-image-threshold"]),a.addPropertiesHandler(d,f,["flex-grow","flex-shrink"]),a.addPropertiesHandler(d,g,["orphans","widows"]),a.addPropertiesHandler(d,i,["z-index"]),a.parseNumber=d,a.mergeNumbers=e,a.numberToString=b}(d,f),function(a){function b(a,b){return"visible"==a||"visible"==b?[0,1,function(c){return 0>=c?a:c>=1?b:"visible"}]:void 0}a.addPropertiesHandler(String,b,["visibility"])}(d),function(a){function b(a){a=a.trim(),e.fillStyle="#000",e.fillStyle=a;var b=e.fillStyle;if(e.fillStyle="#fff",e.fillStyle=a,b==e.fillStyle){e.fillRect(0,0,1,1);var c=e.getImageData(0,0,1,1).data;e.clearRect(0,0,1,1);var d=c[3]/255;return[c[0]*d,c[1]*d,c[2]*d,d]}}function c(b,c){return[b,c,function(b){function c(a){return Math.max(0,Math.min(255,a))}if(b[3])for(var d=0;3>d;d++)b[d]=Math.round(c(b[d]/b[3]));return b[3]=a.numberToString(a.clamp(0,1,b[3])),"rgba("+b.join(",")+")"}]}var d=document.createElementNS("http://www.w3.org/1999/xhtml","canvas");d.width=d.height=1;var e=d.getContext("2d");a.addPropertiesHandler(b,c,["background-color","border-bottom-color","border-left-color","border-right-color","border-top-color","color","outline-color","text-decoration-color"]),a.consumeColor=a.consumeParenthesised.bind(null,b),a.mergeColors=c}(d,f),function(a,b){function c(a,b){if(b=b.trim().toLowerCase(),"0"==b&&"px".search(a)>=0)return{px:0};if(/^[^(]*$|^calc/.test(b)){b=b.replace(/calc\(/g,"(");var c={};b=b.replace(a,function(a){return c[a]=null,"U"+a});for(var d="U("+a.source+")",e=b.replace(/[-+]?(\d*\.)?\d+/g,"N").replace(new RegExp("N"+d,"g"),"D").replace(/\s[+-]\s/g,"O").replace(/\s/g,""),f=[/N\*(D)/g,/(N|D)[*/]N/g,/(N|D)O\1/g,/\((N|D)\)/g],g=0;g<f.length;)f[g].test(e)?(e=e.replace(f[g],"$1"),g=0):g++;if("D"==e){for(var h in c){var i=eval(b.replace(new RegExp("U"+h,"g"),"").replace(new RegExp(d,"g"),"*0"));if(!isFinite(i))return;c[h]=i}return c}}}function d(a,b){return e(a,b,!0)}function e(b,c,d){var e,f=[];for(e in b)f.push(e);for(e in c)f.indexOf(e)<0&&f.push(e);return b=f.map(function(a){return b[a]||0}),c=f.map(function(a){return c[a]||0}),[b,c,function(b){var c=b.map(function(c,e){return 1==b.length&&d&&(c=Math.max(c,0)),a.numberToString(c)+f[e]}).join(" + ");return b.length>1?"calc("+c+")":c}]}var f="px|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc",g=c.bind(null,new RegExp(f,"g")),h=c.bind(null,new RegExp(f+"|%","g")),i=c.bind(null,/deg|rad|grad|turn/g);a.parseLength=g,a.parseLengthOrPercent=h,a.consumeLengthOrPercent=a.consumeParenthesised.bind(null,h),a.parseAngle=i,a.mergeDimensions=e;var j=a.consumeParenthesised.bind(null,g),k=a.consumeRepeated.bind(void 0,j,/^/),l=a.consumeRepeated.bind(void 0,k,/^,/);a.consumeSizePairList=l;var m=function(a){var b=l(a);return b&&""==b[1]?b[0]:void 0},n=a.mergeNestedRepeated.bind(void 0,d," "),o=a.mergeNestedRepeated.bind(void 0,n,",");a.mergeNonNegativeSizePair=n,a.addPropertiesHandler(m,o,["background-size"]),a.addPropertiesHandler(h,d,["border-bottom-width","border-image-width","border-left-width","border-right-width","border-top-width","flex-basis","font-size","height","line-height","max-height","max-width","outline-width","width"]),a.addPropertiesHandler(h,e,["border-bottom-left-radius","border-bottom-right-radius","border-top-left-radius","border-top-right-radius","bottom","left","letter-spacing","margin-bottom","margin-left","margin-right","margin-top","min-height","min-width","outline-offset","padding-bottom","padding-left","padding-right","padding-top","perspective","right","shape-margin","text-indent","top","vertical-align","word-spacing"])}(d,f),function(a){function b(b){return a.consumeLengthOrPercent(b)||a.consumeToken(/^auto/,b)}function c(c){var d=a.consumeList([a.ignore(a.consumeToken.bind(null,/^rect/)),a.ignore(a.consumeToken.bind(null,/^\(/)),a.consumeRepeated.bind(null,b,/^,/),a.ignore(a.consumeToken.bind(null,/^\)/))],c);return d&&4==d[0].length?d[0]:void 0}function d(b,c){return"auto"==b||"auto"==c?[!0,!1,function(d){var e=d?b:c;if("auto"==e)return"auto";var f=a.mergeDimensions(e,e);return f[2](f[0])}]:a.mergeDimensions(b,c)}function e(a){return"rect("+a+")"}var f=a.mergeWrappedNestedRepeated.bind(null,e,d,", ");a.parseBox=c,a.mergeBoxes=f,a.addPropertiesHandler(c,f,["clip"])}(d,f),function(a){function b(a){return function(b){var c=0;return a.map(function(a){return a===j?b[c++]:a})}}function c(a){return a}function d(b){if(b=b.toLowerCase().trim(),"none"==b)return[];for(var c,d=/\s*(\w+)\(([^)]*)\)/g,e=[],f=0;c=d.exec(b);){if(c.index!=f)return;f=c.index+c[0].length;var g=c[1],h=m[g];if(!h)return;var i=c[2].split(","),j=h[0];if(j.length<i.length)return;for(var n=[],o=0;o<j.length;o++){var p,q=i[o],r=j[o];if(p=q?{A:function(b){return"0"==b.trim()?l:a.parseAngle(b)},N:a.parseNumber,T:a.parseLengthOrPercent,L:a.parseLength}[r.toUpperCase()](q):{a:l,n:n[0],t:k}[r],void 0===p)return;n.push(p)}if(e.push({t:g,d:n}),d.lastIndex==b.length)return e}}function e(a){return a.toFixed(6).replace(".000000","")}function f(b,c){if(b.decompositionPair!==c){b.decompositionPair=c;var d=a.makeMatrixDecomposition(b)}if(c.decompositionPair!==b){c.decompositionPair=b;var f=a.makeMatrixDecomposition(c)}return null==d[0]||null==f[0]?[[!1],[!0],function(a){return a?c[0].d:b[0].d}]:(d[0].push(0),f[0].push(1),[d,f,function(b){var c=a.quat(d[0][3],f[0][3],b[5]),g=a.composeMatrix(b[0],b[1],b[2],c,b[4]),h=g.map(e).join(",");return h}])}function g(a){return a.replace(/[xy]/,"")}function h(a){return a.replace(/(x|y|z|3d)?$/,"3d")}function i(b,c){var d=a.makeMatrixDecomposition&&!0,e=!1;if(!b.length||!c.length){b.length||(e=!0,b=c,c=[]);for(var i=0;i<b.length;i++){var j=b[i].t,k=b[i].d,l="scale"==j.substr(0,5)?1:0;c.push({t:j,d:k.map(function(a){if("number"==typeof a)return l;var b={};for(var c in a)b[c]=l;return b})})}}var n=function(a,b){return"perspective"==a&&"perspective"==b||("matrix"==a||"matrix3d"==a)&&("matrix"==b||"matrix3d"==b)},o=[],p=[],q=[];if(b.length!=c.length){if(!d)return;var r=f(b,c);o=[r[0]],p=[r[1]],q=[["matrix",[r[2]]]]}else for(var i=0;i<b.length;i++){var j,s=b[i].t,t=c[i].t,u=b[i].d,v=c[i].d,w=m[s],x=m[t];if(n(s,t)){if(!d)return;var r=f([b[i]],[c[i]]);o.push(r[0]),p.push(r[1]),q.push(["matrix",[r[2]]])}else{if(s==t)j=s;else if(w[2]&&x[2]&&g(s)==g(t))j=g(s),u=w[2](u),v=x[2](v);else{if(!w[1]||!x[1]||h(s)!=h(t)){if(!d)return;var r=f(b,c);o=[r[0]],p=[r[1]],q=[["matrix",[r[2]]]];break}j=h(s),u=w[1](u),v=x[1](v)}for(var y=[],z=[],A=[],B=0;B<u.length;B++){var C="number"==typeof u[B]?a.mergeNumbers:a.mergeDimensions,r=C(u[B],v[B]);y[B]=r[0],z[B]=r[1],A.push(r[2])}o.push(y),p.push(z),q.push([j,A])}}if(e){var D=o;o=p,p=D}return[o,p,function(a){return a.map(function(a,b){var c=a.map(function(a,c){return q[b][1][c](a)}).join(",");return"matrix"==q[b][0]&&16==c.split(",").length&&(q[b][0]="matrix3d"),q[b][0]+"("+c+")"}).join(" ")}]}var j=null,k={px:0},l={deg:0},m={matrix:["NNNNNN",[j,j,0,0,j,j,0,0,0,0,1,0,j,j,0,1],c],matrix3d:["NNNNNNNNNNNNNNNN",c],rotate:["A"],rotatex:["A"],rotatey:["A"],rotatez:["A"],rotate3d:["NNNA"],perspective:["L"],scale:["Nn",b([j,j,1]),c],scalex:["N",b([j,1,1]),b([j,1])],scaley:["N",b([1,j,1]),b([1,j])],scalez:["N",b([1,1,j])],scale3d:["NNN",c],skew:["Aa",null,c],skewx:["A",null,b([j,l])],skewy:["A",null,b([l,j])],translate:["Tt",b([j,j,k]),c],translatex:["T",b([j,k,k]),b([j,k])],translatey:["T",b([k,j,k]),b([k,j])],translatez:["L",b([k,k,j])],translate3d:["TTL",c]};a.addPropertiesHandler(d,i,["transform"])}(d,f),function(a){function b(a,b){b.concat([a]).forEach(function(b){b in document.documentElement.style&&(c[a]=b)})}var c={};b("transform",["webkitTransform","msTransform"]),b("transformOrigin",["webkitTransformOrigin"]),b("perspective",["webkitPerspective"]),b("perspectiveOrigin",["webkitPerspectiveOrigin"]),a.propertyName=function(a){return c[a]||a}}(d,f)}(),!function(a,b){function c(a){var b=window.document.timeline;b.currentTime=a,b._discardAnimations(),0==b._animations.length?e=!1:requestAnimationFrame(c)}var d=window.requestAnimationFrame;window.requestAnimationFrame=function(a){return d(function(b){window.document.timeline._updateAnimationsPromises(),a(b),window.document.timeline._updateAnimationsPromises()})},b.AnimationTimeline=function(){this._animations=[],this.currentTime=void 0},b.AnimationTimeline.prototype={getAnimations:function(){return this._discardAnimations(),this._animations.slice()},_updateAnimationsPromises:function(){b.animationsWithPromises=b.animationsWithPromises.filter(function(a){return a._updatePromises()})},_discardAnimations:function(){this._updateAnimationsPromises(),this._animations=this._animations.filter(function(a){return"finished"!=a.playState&&"idle"!=a.playState})},_play:function(a){var c=new b.Animation(a,this);return this._animations.push(c),b.restartWebAnimationsNextTick(),c._updatePromises(),c._animation.play(),c._updatePromises(),c},play:function(a){return a&&a.remove(),this._play(a)}};var e=!1;b.restartWebAnimationsNextTick=function(){e||(e=!0,requestAnimationFrame(c))};var f=new b.AnimationTimeline;b.timeline=f;try{Object.defineProperty(window.document,"timeline",{configurable:!0,get:function(){return f}})}catch(g){}try{window.document.timeline=f}catch(g){}}(c,e,f),function(a,b){b.animationsWithPromises=[],b.Animation=function(b,c){if(this.effect=b,b&&(b._animation=this),!c)throw new Error("Animation with null timeline is not supported");this._timeline=c,this._sequenceNumber=a.sequenceNumber++,this._holdTime=0,this._paused=!1,this._isGroup=!1,this._animation=null,this._childAnimations=[],this._callback=null,this._oldPlayState="idle",this._rebuildUnderlyingAnimation(),this._animation.cancel(),this._updatePromises()},b.Animation.prototype={_updatePromises:function(){var a=this._oldPlayState,b=this.playState;return this._readyPromise&&b!==a&&("idle"==b?(this._rejectReadyPromise(),this._readyPromise=void 0):"pending"==a?this._resolveReadyPromise():"pending"==b&&(this._readyPromise=void 0)),this._finishedPromise&&b!==a&&("idle"==b?(this._rejectFinishedPromise(),this._finishedPromise=void 0):"finished"==b?this._resolveFinishedPromise():"finished"==a&&(this._finishedPromise=void 0)),this._oldPlayState=this.playState,this._readyPromise||this._finishedPromise},_rebuildUnderlyingAnimation:function(){this._updatePromises();var a,c,d,e,f=this._animation?!0:!1;f&&(a=this.playbackRate,c=this._paused,d=this.startTime,e=this.currentTime,this._animation.cancel(),this._animation._wrapper=null,this._animation=null),(!this.effect||this.effect instanceof window.KeyframeEffect)&&(this._animation=b.newUnderlyingAnimationForKeyframeEffect(this.effect),b.bindAnimationForKeyframeEffect(this)),(this.effect instanceof window.SequenceEffect||this.effect instanceof window.GroupEffect)&&(this._animation=b.newUnderlyingAnimationForGroup(this.effect),b.bindAnimationForGroup(this)),this.effect&&this.effect._onsample&&b.bindAnimationForCustomEffect(this),f&&(1!=a&&(this.playbackRate=a),null!==d?this.startTime=d:null!==e?this.currentTime=e:null!==this._holdTime&&(this.currentTime=this._holdTime),c&&this.pause()),this._updatePromises()
+},_updateChildren:function(){if(this.effect&&"idle"!=this.playState){var a=this.effect._timing.delay;this._childAnimations.forEach(function(c){this._arrangeChildren(c,a),this.effect instanceof window.SequenceEffect&&(a+=b.groupChildDuration(c.effect))}.bind(this))}},_setExternalAnimation:function(a){if(this.effect&&this._isGroup)for(var b=0;b<this.effect.children.length;b++)this.effect.children[b]._animation=a,this._childAnimations[b]._setExternalAnimation(a)},_constructChildAnimations:function(){if(this.effect&&this._isGroup){var a=this.effect._timing.delay;this._removeChildAnimations(),this.effect.children.forEach(function(c){var d=window.document.timeline._play(c);this._childAnimations.push(d),d.playbackRate=this.playbackRate,this._paused&&d.pause(),c._animation=this.effect._animation,this._arrangeChildren(d,a),this.effect instanceof window.SequenceEffect&&(a+=b.groupChildDuration(c))}.bind(this))}},_arrangeChildren:function(a,b){null===this.startTime?a.currentTime=this.currentTime-b/this.playbackRate:a.startTime!==this.startTime+b/this.playbackRate&&(a.startTime=this.startTime+b/this.playbackRate)},get timeline(){return this._timeline},get playState(){return this._animation?this._animation.playState:"idle"},get finished(){return window.Promise?(this._finishedPromise||(-1==b.animationsWithPromises.indexOf(this)&&b.animationsWithPromises.push(this),this._finishedPromise=new Promise(function(a,b){this._resolveFinishedPromise=function(){a(this)},this._rejectFinishedPromise=function(){b({type:DOMException.ABORT_ERR,name:"AbortError"})}}.bind(this)),"finished"==this.playState&&this._resolveFinishedPromise()),this._finishedPromise):(console.warn("Animation Promises require JavaScript Promise constructor"),null)},get ready(){return window.Promise?(this._readyPromise||(-1==b.animationsWithPromises.indexOf(this)&&b.animationsWithPromises.push(this),this._readyPromise=new Promise(function(a,b){this._resolveReadyPromise=function(){a(this)},this._rejectReadyPromise=function(){b({type:DOMException.ABORT_ERR,name:"AbortError"})}}.bind(this)),"pending"!==this.playState&&this._resolveReadyPromise()),this._readyPromise):(console.warn("Animation Promises require JavaScript Promise constructor"),null)},get onfinish(){return this._onfinish},set onfinish(a){"function"==typeof a?(this._onfinish=a,this._animation.onfinish=function(b){b.target=this,a.call(this,b)}.bind(this)):(this._animation.onfinish=a,this.onfinish=this._animation.onfinish)},get currentTime(){this._updatePromises();var a=this._animation.currentTime;return this._updatePromises(),a},set currentTime(a){this._updatePromises(),this._animation.currentTime=isFinite(a)?a:Math.sign(a)*Number.MAX_VALUE,this._register(),this._forEachChild(function(b,c){b.currentTime=a-c}),this._updatePromises()},get startTime(){return this._animation.startTime},set startTime(a){this._updatePromises(),this._animation.startTime=isFinite(a)?a:Math.sign(a)*Number.MAX_VALUE,this._register(),this._forEachChild(function(b,c){b.startTime=a+c}),this._updatePromises()},get playbackRate(){return this._animation.playbackRate},set playbackRate(a){this._updatePromises();var b=this.currentTime;this._animation.playbackRate=a,this._forEachChild(function(b){b.playbackRate=a}),"paused"!=this.playState&&"idle"!=this.playState&&this.play(),null!==b&&(this.currentTime=b),this._updatePromises()},play:function(){this._updatePromises(),this._paused=!1,this._animation.play(),-1==this._timeline._animations.indexOf(this)&&this._timeline._animations.push(this),this._register(),b.awaitStartTime(this),this._forEachChild(function(a){var b=a.currentTime;a.play(),a.currentTime=b}),this._updatePromises()},pause:function(){this._updatePromises(),this.currentTime&&(this._holdTime=this.currentTime),this._animation.pause(),this._register(),this._forEachChild(function(a){a.pause()}),this._paused=!0,this._updatePromises()},finish:function(){this._updatePromises(),this._animation.finish(),this._register(),this._updatePromises()},cancel:function(){this._updatePromises(),this._animation.cancel(),this._register(),this._removeChildAnimations(),this._updatePromises()},reverse:function(){this._updatePromises();var a=this.currentTime;this._animation.reverse(),this._forEachChild(function(a){a.reverse()}),null!==a&&(this.currentTime=a),this._updatePromises()},addEventListener:function(a,b){var c=b;"function"==typeof b&&(c=function(a){a.target=this,b.call(this,a)}.bind(this),b._wrapper=c),this._animation.addEventListener(a,c)},removeEventListener:function(a,b){this._animation.removeEventListener(a,b&&b._wrapper||b)},_removeChildAnimations:function(){for(;this._childAnimations.length;)this._childAnimations.pop().cancel()},_forEachChild:function(b){var c=0;if(this.effect.children&&this._childAnimations.length<this.effect.children.length&&this._constructChildAnimations(),this._childAnimations.forEach(function(a){b.call(this,a,c),this.effect instanceof window.SequenceEffect&&(c+=a.effect.activeDuration)}.bind(this)),"pending"!=this.playState){var d=this.effect._timing,e=this.currentTime;null!==e&&(e=a.calculateTimeFraction(a.calculateActiveDuration(d),e,d)),(null==e||isNaN(e))&&this._removeChildAnimations()}}},window.Animation=b.Animation}(c,e,f),function(a,b){function c(b){this._frames=a.normalizeKeyframes(b)}function d(){for(var a=!1;h.length;){var b=h.shift();b._updateChildren(),a=!0}return a}var e=function(a){if(a._animation=void 0,a instanceof window.SequenceEffect||a instanceof window.GroupEffect)for(var b=0;b<a.children.length;b++)e(a.children[b])};b.removeMulti=function(a){for(var b=[],c=0;c<a.length;c++){var d=a[c];d._parent?(-1==b.indexOf(d._parent)&&b.push(d._parent),d._parent.children.splice(d._parent.children.indexOf(d),1),d._parent=null,e(d)):d._animation&&d._animation.effect==d&&(d._animation.cancel(),d._animation.effect=new KeyframeEffect(null,[]),d._animation._callback&&(d._animation._callback._animation=null),d._animation._rebuildUnderlyingAnimation(),e(d))}for(c=0;c<b.length;c++)b[c]._rebuild()},b.KeyframeEffect=function(b,d,e){return this.target=b,this._parent=null,e=a.numericTimingToObject(e),this._timingInput=a.cloneTimingInput(e),this._timing=a.normalizeTimingInput(e),this.timing=a.makeTiming(e,!1,this),this.timing._effect=this,"function"==typeof d?(a.deprecated("Custom KeyframeEffect","2015-06-22","Use KeyframeEffect.onsample instead."),this._normalizedKeyframes=d):this._normalizedKeyframes=new c(d),this._keyframes=d,this.activeDuration=a.calculateActiveDuration(this._timing),this},b.KeyframeEffect.prototype={getFrames:function(){return"function"==typeof this._normalizedKeyframes?this._normalizedKeyframes:this._normalizedKeyframes._frames},set onsample(a){if("function"==typeof this.getFrames())throw new Error("Setting onsample on custom effect KeyframeEffect is not supported.");this._onsample=a,this._animation&&this._animation._rebuildUnderlyingAnimation()},get parent(){return this._parent},clone:function(){if("function"==typeof this.getFrames())throw new Error("Cloning custom effects is not supported.");var b=new KeyframeEffect(this.target,[],a.cloneTimingInput(this._timingInput));return b._normalizedKeyframes=this._normalizedKeyframes,b._keyframes=this._keyframes,b},remove:function(){b.removeMulti([this])}};var f=Element.prototype.animate;Element.prototype.animate=function(a,c){return b.timeline._play(new b.KeyframeEffect(this,a,c))};var g=document.createElementNS("http://www.w3.org/1999/xhtml","div");b.newUnderlyingAnimationForKeyframeEffect=function(a){if(a){var b=a.target||g,c=a._keyframes;"function"==typeof c&&(c=[]);var d=a._timingInput}else var b=g,c=[],d=0;return f.apply(b,[c,d])},b.bindAnimationForKeyframeEffect=function(a){a.effect&&"function"==typeof a.effect._normalizedKeyframes&&b.bindAnimationForCustomEffect(a)};var h=[];b.awaitStartTime=function(a){null===a.startTime&&a._isGroup&&(0==h.length&&requestAnimationFrame(d),h.push(a))};var i=window.getComputedStyle;Object.defineProperty(window,"getComputedStyle",{configurable:!0,enumerable:!0,value:function(){window.document.timeline._updateAnimationsPromises();var a=i.apply(this,arguments);return d()&&(a=i.apply(this,arguments)),window.document.timeline._updateAnimationsPromises(),a}}),window.KeyframeEffect=b.KeyframeEffect,window.Element.prototype.getAnimations=function(){return document.timeline.getAnimations().filter(function(a){return null!==a.effect&&a.effect.target==this}.bind(this))}}(c,e,f),function(a,b){function c(a){a._registered||(a._registered=!0,f.push(a),g||(g=!0,requestAnimationFrame(d)))}function d(){var a=f;f=[],a.sort(function(a,b){return a._sequenceNumber-b._sequenceNumber}),a=a.filter(function(a){a();var b=a._animation?a._animation.playState:"idle";return"running"!=b&&"pending"!=b&&(a._registered=!1),a._registered}),f.push.apply(f,a),f.length?(g=!0,requestAnimationFrame(d)):g=!1}var e=(document.createElementNS("http://www.w3.org/1999/xhtml","div"),0);b.bindAnimationForCustomEffect=function(b){var d,f=b.effect.target,g="function"==typeof b.effect.getFrames();d=g?b.effect.getFrames():b.effect._onsample;var h=b.effect.timing,i=null;h=a.normalizeTimingInput(h);var j=function(){var c=j._animation?j._animation.currentTime:null;null!==c&&(c=a.calculateTimeFraction(a.calculateActiveDuration(h),c,h),isNaN(c)&&(c=null)),c!==i&&(g?d(c,f,b.effect):d(c,b.effect,b.effect._animation)),i=c};j._animation=b,j._registered=!1,j._sequenceNumber=e++,b._callback=j,c(j)};var f=[],g=!1;b.Animation.prototype._register=function(){this._callback&&c(this._callback)}}(c,e,f),function(a,b){function c(a){return a._timing.delay+a.activeDuration+a._timing.endDelay}function d(b,c){this._parent=null,this.children=b||[],this._reparent(this.children),c=a.numericTimingToObject(c),this._timingInput=a.cloneTimingInput(c),this._timing=a.normalizeTimingInput(c,!0),this.timing=a.makeTiming(c,!0,this),this.timing._effect=this,"auto"===this._timing.duration&&(this._timing.duration=this.activeDuration)}window.SequenceEffect=function(){d.apply(this,arguments)},window.GroupEffect=function(){d.apply(this,arguments)},d.prototype={_isAncestor:function(a){for(var b=this;null!==b;){if(b==a)return!0;b=b._parent}return!1},_rebuild:function(){for(var a=this;a;)"auto"===a.timing.duration&&(a._timing.duration=a.activeDuration),a=a._parent;this._animation&&this._animation._rebuildUnderlyingAnimation()},_reparent:function(a){b.removeMulti(a);for(var c=0;c<a.length;c++)a[c]._parent=this},_putChild:function(a,b){for(var c=b?"Cannot append an ancestor or self":"Cannot prepend an ancestor or self",d=0;d<a.length;d++)if(this._isAncestor(a[d]))throw{type:DOMException.HIERARCHY_REQUEST_ERR,name:"HierarchyRequestError",message:c};for(var d=0;d<a.length;d++)b?this.children.push(a[d]):this.children.unshift(a[d]);this._reparent(a),this._rebuild()},append:function(){this._putChild(arguments,!0)},prepend:function(){this._putChild(arguments,!1)},get parent(){return this._parent},get firstChild(){return this.children.length?this.children[0]:null},get lastChild(){return this.children.length?this.children[this.children.length-1]:null},clone:function(){for(var b=a.cloneTimingInput(this._timingInput),c=[],d=0;d<this.children.length;d++)c.push(this.children[d].clone());return this instanceof GroupEffect?new GroupEffect(c,b):new SequenceEffect(c,b)},remove:function(){b.removeMulti([this])}},window.SequenceEffect.prototype=Object.create(d.prototype),Object.defineProperty(window.SequenceEffect.prototype,"activeDuration",{get:function(){var a=0;return this.children.forEach(function(b){a+=c(b)}),Math.max(a,0)}}),window.GroupEffect.prototype=Object.create(d.prototype),Object.defineProperty(window.GroupEffect.prototype,"activeDuration",{get:function(){var a=0;return this.children.forEach(function(b){a=Math.max(a,c(b))}),a}}),b.newUnderlyingAnimationForGroup=function(c){var d,e=null,f=function(b){var c=d._wrapper;return c&&"pending"!=c.playState&&c.effect?null==b?void c._removeChildAnimations():0==b&&c.playbackRate<0&&(e||(e=a.normalizeTimingInput(c.effect.timing)),b=a.calculateTimeFraction(a.calculateActiveDuration(e),-1,e),isNaN(b)||null==b)?(c._forEachChild(function(a){a.currentTime=-1}),void c._removeChildAnimations()):void 0:void 0},g=new KeyframeEffect(null,[],c._timing);return g.onsample=f,d=b.timeline._play(g)},b.bindAnimationForGroup=function(a){a._animation._wrapper=a,a._isGroup=!0,b.awaitStartTime(a),a._constructChildAnimations(),a._setExternalAnimation(a)},b.groupChildDuration=c}(c,e,f)}({},function(){return this}());
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// <include src="../../../../ui/webui/resources/js/i18n_template_no_process.js">
+
+i18nTemplate.process(document, loadTimeData);
+(function () {
+function resolve() {
+document.body.removeAttribute('unresolved');
+}
+if (window.WebComponents) {
+addEventListener('WebComponentsReady', resolve);
+} else {
+if (document.readyState === 'interactive' || document.readyState === 'complete') {
+resolve();
+} else {
+addEventListener('DOMContentLoaded', resolve);
+}
+}
+}());
+window.Polymer = {
+Settings: function () {
+var user = window.Polymer || {};
+location.search.slice(1).split('&').forEach(function (o) {
+o = o.split('=');
+o[0] && (user[o[0]] = o[1] || true);
+});
+var wantShadow = user.dom === 'shadow';
+var hasShadow = Boolean(Element.prototype.createShadowRoot);
+var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
+var useShadow = wantShadow && hasShadow;
+var hasNativeImports = Boolean('import' in document.createElement('link'));
+var useNativeImports = hasNativeImports;
+var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
+return {
+wantShadow: wantShadow,
+hasShadow: hasShadow,
+nativeShadow: nativeShadow,
+useShadow: useShadow,
+useNativeShadow: useShadow && nativeShadow,
+useNativeImports: useNativeImports,
+useNativeCustomElements: useNativeCustomElements
+};
+}()
+};
+(function () {
+var userPolymer = window.Polymer;
+window.Polymer = function (prototype) {
+if (typeof prototype === 'function') {
+prototype = prototype.prototype;
+}
+if (!prototype) {
+prototype = {};
+}
+var factory = desugar(prototype);
+prototype = factory.prototype;
+var options = { prototype: prototype };
+if (prototype.extends) {
+options.extends = prototype.extends;
+}
+Polymer.telemetry._registrate(prototype);
+document.registerElement(prototype.is, options);
+return factory;
+};
+var desugar = function (prototype) {
+var base = Polymer.Base;
+if (prototype.extends) {
+base = Polymer.Base._getExtendedPrototype(prototype.extends);
+}
+prototype = Polymer.Base.chainObject(prototype, base);
+prototype.registerCallback();
+return prototype.constructor;
+};
+window.Polymer = Polymer;
+if (userPolymer) {
+for (var i in userPolymer) {
+Polymer[i] = userPolymer[i];
+}
+}
+Polymer.Class = desugar;
+}());
+Polymer.telemetry = {
+registrations: [],
+_regLog: function (prototype) {
+console.log('[' + prototype.is + ']: registered');
+},
+_registrate: function (prototype) {
+this.registrations.push(prototype);
+Polymer.log && this._regLog(prototype);
+},
+dumpRegistrations: function () {
+this.registrations.forEach(this._regLog);
+}
+};
+Object.defineProperty(window, 'currentImport', {
+enumerable: true,
+configurable: true,
+get: function () {
+return (document._currentScript || document.currentScript).ownerDocument;
+}
+});
+Polymer.RenderStatus = {
+_ready: false,
+_callbacks: [],
+whenReady: function (cb) {
+if (this._ready) {
+cb();
+} else {
+this._callbacks.push(cb);
+}
+},
+_makeReady: function () {
+this._ready = true;
+this._callbacks.forEach(function (cb) {
+cb();
+});
+this._callbacks = [];
+},
+_catchFirstRender: function () {
+requestAnimationFrame(function () {
+Polymer.RenderStatus._makeReady();
+});
+}
+};
+if (window.HTMLImports) {
+HTMLImports.whenReady(function () {
+Polymer.RenderStatus._catchFirstRender();
+});
+} else {
+Polymer.RenderStatus._catchFirstRender();
+}
+Polymer.ImportStatus = Polymer.RenderStatus;
+Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady;
+Polymer.Base = {
+__isPolymerInstance__: true,
+_addFeature: function (feature) {
+this.extend(this, feature);
+},
+registerCallback: function () {
+this._desugarBehaviors();
+this._doBehavior('beforeRegister');
+this._registerFeatures();
+this._doBehavior('registered');
+},
+createdCallback: function () {
+Polymer.telemetry.instanceCount++;
+this.root = this;
+this._doBehavior('created');
+this._initFeatures();
+},
+attachedCallback: function () {
+Polymer.RenderStatus.whenReady(function () {
+this.isAttached = true;
+this._doBehavior('attached');
+}.bind(this));
+},
+detachedCallback: function () {
+this.isAttached = false;
+this._doBehavior('detached');
+},
+attributeChangedCallback: function (name) {
+this._attributeChangedImpl(name);
+this._doBehavior('attributeChanged', arguments);
+},
+_attributeChangedImpl: function (name) {
+this._setAttributeToProperty(this, name);
+},
+extend: function (prototype, api) {
+if (prototype && api) {
+Object.getOwnPropertyNames(api).forEach(function (n) {
+this.copyOwnProperty(n, api, prototype);
+}, this);
+}
+return prototype || api;
+},
+mixin: function (target, source) {
+for (var i in source) {
+target[i] = source[i];
+}
+return target;
+},
+copyOwnProperty: function (name, source, target) {
+var pd = Object.getOwnPropertyDescriptor(source, name);
+if (pd) {
+Object.defineProperty(target, name, pd);
+}
+},
+_log: console.log.apply.bind(console.log, console),
+_warn: console.warn.apply.bind(console.warn, console),
+_error: console.error.apply.bind(console.error, console),
+_logf: function () {
+return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
+}
+};
+Polymer.Base._logPrefix = function () {
+var color = window.chrome || /firefox/i.test(navigator.userAgent);
+return color ? [
+'%c[%s::%s]:',
+'font-weight: bold; background-color:#EEEE00;'
+] : ['[%s::%s]:'];
+}();
+Polymer.Base.chainObject = function (object, inherited) {
+if (object && inherited && object !== inherited) {
+if (!Object.__proto__) {
+object = Polymer.Base.extend(Object.create(inherited), object);
+}
+object.__proto__ = inherited;
+}
+return object;
+};
+Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
+if (window.CustomElements) {
+Polymer.instanceof = CustomElements.instanceof;
+} else {
+Polymer.instanceof = function (obj, ctor) {
+return obj instanceof ctor;
+};
+}
+Polymer.isInstance = function (obj) {
+return Boolean(obj && obj.__isPolymerInstance__);
+};
+Polymer.telemetry.instanceCount = 0;
+(function () {
+var modules = {};
+var lcModules = {};
+var findModule = function (id) {
+return modules[id] || lcModules[id.toLowerCase()];
+};
+var DomModule = function () {
+return document.createElement('dom-module');
+};
+DomModule.prototype = Object.create(HTMLElement.prototype);
+Polymer.Base.extend(DomModule.prototype, {
+constructor: DomModule,
+createdCallback: function () {
+this.register();
+},
+register: function (id) {
+var id = id || this.id || this.getAttribute('name') || this.getAttribute('is');
+if (id) {
+this.id = id;
+modules[id] = this;
+lcModules[id.toLowerCase()] = this;
+}
+},
+import: function (id, selector) {
+if (id) {
+var m = findModule(id);
+if (!m) {
+forceDocumentUpgrade();
+m = findModule(id);
+}
+if (m && selector) {
+m = m.querySelector(selector);
+}
+return m;
+}
+}
+});
+var cePolyfill = window.CustomElements && !CustomElements.useNative;
+document.registerElement('dom-module', DomModule);
+function forceDocumentUpgrade() {
+if (cePolyfill) {
+var script = document._currentScript || document.currentScript;
+var doc = script && script.ownerDocument;
+if (doc) {
+CustomElements.upgradeAll(doc);
+}
+}
+}
+}());
+Polymer.Base._addFeature({
+_prepIs: function () {
+if (!this.is) {
+var module = (document._currentScript || document.currentScript).parentNode;
+if (module.localName === 'dom-module') {
+var id = module.id || module.getAttribute('name') || module.getAttribute('is');
+this.is = id;
+}
+}
+if (this.is) {
+this.is = this.is.toLowerCase();
+}
+}
+});
+Polymer.Base._addFeature({
+behaviors: [],
+_desugarBehaviors: function () {
+if (this.behaviors.length) {
+this.behaviors = this._desugarSomeBehaviors(this.behaviors);
+}
+},
+_desugarSomeBehaviors: function (behaviors) {
+behaviors = this._flattenBehaviorsList(behaviors);
+for (var i = behaviors.length - 1; i >= 0; i--) {
+this._mixinBehavior(behaviors[i]);
+}
+return behaviors;
+},
+_flattenBehaviorsList: function (behaviors) {
+var flat = [];
+behaviors.forEach(function (b) {
+if (b instanceof Array) {
+flat = flat.concat(this._flattenBehaviorsList(b));
+} else if (b) {
+flat.push(b);
+} else {
+this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
+}
+}, this);
+return flat;
+},
+_mixinBehavior: function (b) {
+Object.getOwnPropertyNames(b).forEach(function (n) {
+switch (n) {
+case 'hostAttributes':
+case 'registered':
+case 'properties':
+case 'observers':
+case 'listeners':
+case 'created':
+case 'attached':
+case 'detached':
+case 'attributeChanged':
+case 'configure':
+case 'ready':
+break;
+default:
+if (!this.hasOwnProperty(n)) {
+this.copyOwnProperty(n, b, this);
+}
+break;
+}
+}, this);
+},
+_prepBehaviors: function () {
+this._prepFlattenedBehaviors(this.behaviors);
+},
+_prepFlattenedBehaviors: function (behaviors) {
+for (var i = 0, l = behaviors.length; i < l; i++) {
+this._prepBehavior(behaviors[i]);
+}
+this._prepBehavior(this);
+},
+_doBehavior: function (name, args) {
+this.behaviors.forEach(function (b) {
+this._invokeBehavior(b, name, args);
+}, this);
+this._invokeBehavior(this, name, args);
+},
+_invokeBehavior: function (b, name, args) {
+var fn = b[name];
+if (fn) {
+fn.apply(this, args || Polymer.nar);
+}
+},
+_marshalBehaviors: function () {
+this.behaviors.forEach(function (b) {
+this._marshalBehavior(b);
+}, this);
+this._marshalBehavior(this);
+}
+});
+Polymer.Base._addFeature({
+_getExtendedPrototype: function (tag) {
+return this._getExtendedNativePrototype(tag);
+},
+_nativePrototypes: {},
+_getExtendedNativePrototype: function (tag) {
+var p = this._nativePrototypes[tag];
+if (!p) {
+var np = this.getNativePrototype(tag);
+p = this.extend(Object.create(np), Polymer.Base);
+this._nativePrototypes[tag] = p;
+}
+return p;
+},
+getNativePrototype: function (tag) {
+return Object.getPrototypeOf(document.createElement(tag));
+}
+});
+Polymer.Base._addFeature({
+_prepConstructor: function () {
+this._factoryArgs = this.extends ? [
+this.extends,
+this.is
+] : [this.is];
+var ctor = function () {
+return this._factory(arguments);
+};
+if (this.hasOwnProperty('extends')) {
+ctor.extends = this.extends;
+}
+Object.defineProperty(this, 'constructor', {
+value: ctor,
+writable: true,
+configurable: true
+});
+ctor.prototype = this;
+},
+_factory: function (args) {
+var elt = document.createElement.apply(document, this._factoryArgs);
+if (this.factoryImpl) {
+this.factoryImpl.apply(elt, args);
+}
+return elt;
+}
+});
+Polymer.nob = Object.create(null);
+Polymer.Base._addFeature({
+properties: {},
+getPropertyInfo: function (property) {
+var info = this._getPropertyInfo(property, this.properties);
+if (!info) {
+this.behaviors.some(function (b) {
+return info = this._getPropertyInfo(property, b.properties);
+}, this);
+}
+return info || Polymer.nob;
+},
+_getPropertyInfo: function (property, properties) {
+var p = properties && properties[property];
+if (typeof p === 'function') {
+p = properties[property] = { type: p };
+}
+if (p) {
+p.defined = true;
+}
+return p;
+}
+});
+Polymer.CaseMap = {
+_caseMap: {},
+dashToCamelCase: function (dash) {
+var mapped = Polymer.CaseMap._caseMap[dash];
+if (mapped) {
+return mapped;
+}
+if (dash.indexOf('-') < 0) {
+return Polymer.CaseMap._caseMap[dash] = dash;
+}
+return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
+return m[1].toUpperCase();
+});
+},
+camelToDashCase: function (camel) {
+var mapped = Polymer.CaseMap._caseMap[camel];
+if (mapped) {
+return mapped;
+}
+return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
+return g[0] + '-' + g[1].toLowerCase();
+});
+}
+};
+Polymer.Base._addFeature({
+_prepAttributes: function () {
+this._aggregatedAttributes = {};
+},
+_addHostAttributes: function (attributes) {
+if (attributes) {
+this.mixin(this._aggregatedAttributes, attributes);
+}
+},
+_marshalHostAttributes: function () {
+this._applyAttributes(this, this._aggregatedAttributes);
+},
+_applyAttributes: function (node, attr$) {
+for (var n in attr$) {
+if (!this.hasAttribute(n) && n !== 'class') {
+this.serializeValueToAttribute(attr$[n], n, this);
+}
+}
+},
+_marshalAttributes: function () {
+this._takeAttributesToModel(this);
+},
+_takeAttributesToModel: function (model) {
+for (var i = 0, l = this.attributes.length; i < l; i++) {
+this._setAttributeToProperty(model, this.attributes[i].name);
+}
+},
+_setAttributeToProperty: function (model, attrName) {
+if (!this._serializing) {
+var propName = Polymer.CaseMap.dashToCamelCase(attrName);
+var info = this.getPropertyInfo(propName);
+if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
+var val = this.getAttribute(attrName);
+model[propName] = this.deserialize(val, info.type);
+}
+}
+},
+_serializing: false,
+reflectPropertyToAttribute: function (name) {
+this._serializing = true;
+this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
+this._serializing = false;
+},
+serializeValueToAttribute: function (value, attribute, node) {
+var str = this.serialize(value);
+(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
+},
+deserialize: function (value, type) {
+switch (type) {
+case Number:
+value = Number(value);
+break;
+case Boolean:
+value = value !== null;
+break;
+case Object:
+try {
+value = JSON.parse(value);
+} catch (x) {
+}
+break;
+case Array:
+try {
+value = JSON.parse(value);
+} catch (x) {
+value = null;
+console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
+}
+break;
+case Date:
+value = new Date(value);
+break;
+case String:
+default:
+break;
+}
+return value;
+},
+serialize: function (value) {
+switch (typeof value) {
+case 'boolean':
+return value ? '' : undefined;
+case 'object':
+if (value instanceof Date) {
+return value;
+} else if (value) {
+try {
+return JSON.stringify(value);
+} catch (x) {
+return '';
+}
+}
+default:
+return value != null ? value : undefined;
+}
+}
+});
+Polymer.Base._addFeature({
+_setupDebouncers: function () {
+this._debouncers = {};
+},
+debounce: function (jobName, callback, wait) {
+return this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
+},
+isDebouncerActive: function (jobName) {
+var debouncer = this._debouncers[jobName];
+return debouncer && debouncer.finish;
+},
+flushDebouncer: function (jobName) {
+var debouncer = this._debouncers[jobName];
+if (debouncer) {
+debouncer.complete();
+}
+},
+cancelDebouncer: function (jobName) {
+var debouncer = this._debouncers[jobName];
+if (debouncer) {
+debouncer.stop();
+}
+}
+});
+Polymer.version = '1.1.4';
+Polymer.Base._addFeature({
+_registerFeatures: function () {
+this._prepIs();
+this._prepAttributes();
+this._prepBehaviors();
+this._prepConstructor();
+},
+_prepBehavior: function (b) {
+this._addHostAttributes(b.hostAttributes);
+},
+_marshalBehavior: function (b) {
+},
+_initFeatures: function () {
+this._marshalHostAttributes();
+this._setupDebouncers();
+this._marshalBehaviors();
+}
+});
+Polymer.Base._addFeature({
+_prepTemplate: function () {
+this._template = this._template || Polymer.DomModule.import(this.is, 'template');
+if (this._template && this._template.hasAttribute('is')) {
+this._warn(this._logf('_prepTemplate', 'top-level Polymer template ' + 'must not be a type-extension, found', this._template, 'Move inside simple <template>.'));
+}
+if (this._template && !this._template.content && HTMLTemplateElement.bootstrap) {
+HTMLTemplateElement.decorate(this._template);
+HTMLTemplateElement.bootstrap(this._template.content);
+}
+},
+_stampTemplate: function () {
+if (this._template) {
+this.root = this.instanceTemplate(this._template);
+}
+},
+instanceTemplate: function (template) {
+var dom = document.importNode(template._content || template.content, true);
+return dom;
+}
+});
+(function () {
+var baseAttachedCallback = Polymer.Base.attachedCallback;
+Polymer.Base._addFeature({
+_hostStack: [],
+ready: function () {
+},
+_pushHost: function (host) {
+this.dataHost = host = host || Polymer.Base._hostStack[Polymer.Base._hostStack.length - 1];
+if (host && host._clients) {
+host._clients.push(this);
+}
+this._beginHost();
+},
+_beginHost: function () {
+Polymer.Base._hostStack.push(this);
+if (!this._clients) {
+this._clients = [];
+}
+},
+_popHost: function () {
+Polymer.Base._hostStack.pop();
+},
+_tryReady: function () {
+if (this._canReady()) {
+this._ready();
+}
+},
+_canReady: function () {
+return !this.dataHost || this.dataHost._clientsReadied;
+},
+_ready: function () {
+this._beforeClientsReady();
+this._setupRoot();
+this._readyClients();
+this._afterClientsReady();
+this._readySelf();
+},
+_readyClients: function () {
+this._beginDistribute();
+var c$ = this._clients;
+for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
+c._ready();
+}
+this._finishDistribute();
+this._clientsReadied = true;
+this._clients = null;
+},
+_readySelf: function () {
+this._doBehavior('ready');
+this._readied = true;
+if (this._attachedPending) {
+this._attachedPending = false;
+this.attachedCallback();
+}
+},
+_beforeClientsReady: function () {
+},
+_afterClientsReady: function () {
+},
+_beforeAttached: function () {
+},
+attachedCallback: function () {
+if (this._readied) {
+this._beforeAttached();
+baseAttachedCallback.call(this);
+} else {
+this._attachedPending = true;
+}
+}
+});
+}());
+Polymer.ArraySplice = function () {
+function newSplice(index, removed, addedCount) {
+return {
+index: index,
+removed: removed,
+addedCount: addedCount
+};
+}
+var EDIT_LEAVE = 0;
+var EDIT_UPDATE = 1;
+var EDIT_ADD = 2;
+var EDIT_DELETE = 3;
+function ArraySplice() {
+}
+ArraySplice.prototype = {
+calcEditDistances: function (current, currentStart, currentEnd, old, oldStart, oldEnd) {
+var rowCount = oldEnd - oldStart + 1;
+var columnCount = currentEnd - currentStart + 1;
+var distances = new Array(rowCount);
+for (var i = 0; i < rowCount; i++) {
+distances[i] = new Array(columnCount);
+distances[i][0] = i;
+}
+for (var j = 0; j < columnCount; j++)
+distances[0][j] = j;
+for (var i = 1; i < rowCount; i++) {
+for (var j = 1; j < columnCount; j++) {
+if (this.equals(current[currentStart + j - 1], old[oldStart + i - 1]))
+distances[i][j] = distances[i - 1][j - 1];
+else {
+var north = distances[i - 1][j] + 1;
+var west = distances[i][j - 1] + 1;
+distances[i][j] = north < west ? north : west;
+}
+}
+}
+return distances;
+},
+spliceOperationsFromEditDistances: function (distances) {
+var i = distances.length - 1;
+var j = distances[0].length - 1;
+var current = distances[i][j];
+var edits = [];
+while (i > 0 || j > 0) {
+if (i == 0) {
+edits.push(EDIT_ADD);
+j--;
+continue;
+}
+if (j == 0) {
+edits.push(EDIT_DELETE);
+i--;
+continue;
+}
+var northWest = distances[i - 1][j - 1];
+var west = distances[i - 1][j];
+var north = distances[i][j - 1];
+var min;
+if (west < north)
+min = west < northWest ? west : northWest;
+else
+min = north < northWest ? north : northWest;
+if (min == northWest) {
+if (northWest == current) {
+edits.push(EDIT_LEAVE);
+} else {
+edits.push(EDIT_UPDATE);
+current = northWest;
+}
+i--;
+j--;
+} else if (min == west) {
+edits.push(EDIT_DELETE);
+i--;
+current = west;
+} else {
+edits.push(EDIT_ADD);
+j--;
+current = north;
+}
+}
+edits.reverse();
+return edits;
+},
+calcSplices: function (current, currentStart, currentEnd, old, oldStart, oldEnd) {
+var prefixCount = 0;
+var suffixCount = 0;
+var minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);
+if (currentStart == 0 && oldStart == 0)
+prefixCount = this.sharedPrefix(current, old, minLength);
+if (currentEnd == current.length && oldEnd == old.length)
+suffixCount = this.sharedSuffix(current, old, minLength - prefixCount);
+currentStart += prefixCount;
+oldStart += prefixCount;
+currentEnd -= suffixCount;
+oldEnd -= suffixCount;
+if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)
+return [];
+if (currentStart == currentEnd) {
+var splice = newSplice(currentStart, [], 0);
+while (oldStart < oldEnd)
+splice.removed.push(old[oldStart++]);
+return [splice];
+} else if (oldStart == oldEnd)
+return [newSplice(currentStart, [], currentEnd - currentStart)];
+var ops = this.spliceOperationsFromEditDistances(this.calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd));
+var splice = undefined;
+var splices = [];
+var index = currentStart;
+var oldIndex = oldStart;
+for (var i = 0; i < ops.length; i++) {
+switch (ops[i]) {
+case EDIT_LEAVE:
+if (splice) {
+splices.push(splice);
+splice = undefined;
+}
+index++;
+oldIndex++;
+break;
+case EDIT_UPDATE:
+if (!splice)
+splice = newSplice(index, [], 0);
+splice.addedCount++;
+index++;
+splice.removed.push(old[oldIndex]);
+oldIndex++;
+break;
+case EDIT_ADD:
+if (!splice)
+splice = newSplice(index, [], 0);
+splice.addedCount++;
+index++;
+break;
+case EDIT_DELETE:
+if (!splice)
+splice = newSplice(index, [], 0);
+splice.removed.push(old[oldIndex]);
+oldIndex++;
+break;
+}
+}
+if (splice) {
+splices.push(splice);
+}
+return splices;
+},
+sharedPrefix: function (current, old, searchLength) {
+for (var i = 0; i < searchLength; i++)
+if (!this.equals(current[i], old[i]))
+return i;
+return searchLength;
+},
+sharedSuffix: function (current, old, searchLength) {
+var index1 = current.length;
+var index2 = old.length;
+var count = 0;
+while (count < searchLength && this.equals(current[--index1], old[--index2]))
+count++;
+return count;
+},
+calculateSplices: function (current, previous) {
+return this.calcSplices(current, 0, current.length, previous, 0, previous.length);
+},
+equals: function (currentValue, previousValue) {
+return currentValue === previousValue;
+}
+};
+return new ArraySplice();
+}();
+Polymer.EventApi = function () {
+var Settings = Polymer.Settings;
+var EventApi = function (event) {
+this.event = event;
+};
+if (Settings.useShadow) {
+EventApi.prototype = {
+get rootTarget() {
+return this.event.path[0];
+},
+get localTarget() {
+return this.event.target;
+},
+get path() {
+return this.event.path;
+}
+};
+} else {
+EventApi.prototype = {
+get rootTarget() {
+return this.event.target;
+},
+get localTarget() {
+var current = this.event.currentTarget;
+var currentRoot = current && Polymer.dom(current).getOwnerRoot();
+var p$ = this.path;
+for (var i = 0; i < p$.length; i++) {
+if (Polymer.dom(p$[i]).getOwnerRoot() === currentRoot) {
+return p$[i];
+}
+}
+},
+get path() {
+if (!this.event._path) {
+var path = [];
+var o = this.rootTarget;
+while (o) {
+path.push(o);
+o = Polymer.dom(o).parentNode || o.host;
+}
+path.push(window);
+this.event._path = path;
+}
+return this.event._path;
+}
+};
+}
+var factory = function (event) {
+if (!event.__eventApi) {
+event.__eventApi = new EventApi(event);
+}
+return event.__eventApi;
+};
+return { factory: factory };
+}();
+Polymer.domInnerHTML = function () {
+var escapeAttrRegExp = /[&\u00A0"]/g;
+var escapeDataRegExp = /[&\u00A0<>]/g;
+function escapeReplace(c) {
+switch (c) {
+case '&':
+return '&amp;';
+case '<':
+return '&lt;';
+case '>':
+return '&gt;';
+case '"':
+return '&quot;';
+case '\xA0':
+return '&nbsp;';
+}
+}
+function escapeAttr(s) {
+return s.replace(escapeAttrRegExp, escapeReplace);
+}
+function escapeData(s) {
+return s.replace(escapeDataRegExp, escapeReplace);
+}
+function makeSet(arr) {
+var set = {};
+for (var i = 0; i < arr.length; i++) {
+set[arr[i]] = true;
+}
+return set;
+}
+var voidElements = makeSet([
+'area',
+'base',
+'br',
+'col',
+'command',
+'embed',
+'hr',
+'img',
+'input',
+'keygen',
+'link',
+'meta',
+'param',
+'source',
+'track',
+'wbr'
+]);
+var plaintextParents = makeSet([
+'style',
+'script',
+'xmp',
+'iframe',
+'noembed',
+'noframes',
+'plaintext',
+'noscript'
+]);
+function getOuterHTML(node, parentNode, composed) {
+switch (node.nodeType) {
+case Node.ELEMENT_NODE:
+var tagName = node.localName;
+var s = '<' + tagName;
+var attrs = node.attributes;
+for (var i = 0, attr; attr = attrs[i]; i++) {
+s += ' ' + attr.name + '="' + escapeAttr(attr.value) + '"';
+}
+s += '>';
+if (voidElements[tagName]) {
+return s;
+}
+return s + getInnerHTML(node, composed) + '</' + tagName + '>';
+case Node.TEXT_NODE:
+var data = node.data;
+if (parentNode && plaintextParents[parentNode.localName]) {
+return data;
+}
+return escapeData(data);
+case Node.COMMENT_NODE:
+return '<!--' + node.data + '-->';
+default:
+console.error(node);
+throw new Error('not implemented');
+}
+}
+function getInnerHTML(node, composed) {
+if (node instanceof HTMLTemplateElement)
+node = node.content;
+var s = '';
+var c$ = Polymer.dom(node).childNodes;
+c$ = composed ? node._composedChildren : c$;
+for (var i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) {
+s += getOuterHTML(child, node, composed);
+}
+return s;
+}
+return { getInnerHTML: getInnerHTML };
+}();
+Polymer.DomApi = function () {
+'use strict';
+var Settings = Polymer.Settings;
+var getInnerHTML = Polymer.domInnerHTML.getInnerHTML;
+var nativeInsertBefore = Element.prototype.insertBefore;
+var nativeRemoveChild = Element.prototype.removeChild;
+var nativeAppendChild = Element.prototype.appendChild;
+var nativeCloneNode = Element.prototype.cloneNode;
+var nativeImportNode = Document.prototype.importNode;
+var DomApi = function (node) {
+this.node = node;
+if (this.patch) {
+this.patch();
+}
+};
+if (window.wrap && Settings.useShadow && !Settings.useNativeShadow) {
+DomApi = function (node) {
+this.node = wrap(node);
+if (this.patch) {
+this.patch();
+}
+};
+}
+DomApi.prototype = {
+flush: function () {
+Polymer.dom.flush();
+},
+_lazyDistribute: function (host) {
+if (host.shadyRoot && host.shadyRoot._distributionClean) {
+host.shadyRoot._distributionClean = false;
+Polymer.dom.addDebouncer(host.debounce('_distribute', host._distributeContent));
+}
+},
+appendChild: function (node) {
+return this._addNode(node);
+},
+insertBefore: function (node, ref_node) {
+return this._addNode(node, ref_node);
+},
+_addNode: function (node, ref_node) {
+this._removeNodeFromHost(node, true);
+var addedInsertionPoint;
+var root = this.getOwnerRoot();
+if (root) {
+addedInsertionPoint = this._maybeAddInsertionPoint(node, this.node);
+}
+if (this._nodeHasLogicalChildren(this.node)) {
+if (ref_node) {
+var children = this.childNodes;
+var index = children.indexOf(ref_node);
+if (index < 0) {
+throw Error('The ref_node to be inserted before is not a child ' + 'of this node');
+}
+}
+this._addLogicalInfo(node, this.node, index);
+}
+this._addNodeToHost(node);
+if (!this._maybeDistribute(node, this.node) && !this._tryRemoveUndistributedNode(node)) {
+if (ref_node) {
+ref_node = ref_node.localName === CONTENT ? this._firstComposedNode(ref_node) : ref_node;
+}
+var container = this.node._isShadyRoot ? this.node.host : this.node;
+addToComposedParent(container, node, ref_node);
+if (ref_node) {
+nativeInsertBefore.call(container, node, ref_node);
+} else {
+nativeAppendChild.call(container, node);
+}
+}
+if (addedInsertionPoint) {
+this._updateInsertionPoints(root.host);
+}
+return node;
+},
+removeChild: function (node) {
+if (factory(node).parentNode !== this.node) {
+console.warn('The node to be removed is not a child of this node', node);
+}
+this._removeNodeFromHost(node);
+if (!this._maybeDistribute(node, this.node)) {
+var container = this.node._isShadyRoot ? this.node.host : this.node;
+if (container === node.parentNode) {
+removeFromComposedParent(container, node);
+nativeRemoveChild.call(container, node);
+}
+}
+return node;
+},
+replaceChild: function (node, ref_node) {
+this.insertBefore(node, ref_node);
+this.removeChild(ref_node);
+return node;
+},
+_hasCachedOwnerRoot: function (node) {
+return Boolean(node._ownerShadyRoot !== undefined);
+},
+getOwnerRoot: function () {
+return this._ownerShadyRootForNode(this.node);
+},
+_ownerShadyRootForNode: function (node) {
+if (!node) {
+return;
+}
+if (node._ownerShadyRoot === undefined) {
+var root;
+if (node._isShadyRoot) {
+root = node;
+} else {
+var parent = Polymer.dom(node).parentNode;
+if (parent) {
+root = parent._isShadyRoot ? parent : this._ownerShadyRootForNode(parent);
+} else {
+root = null;
+}
+}
+node._ownerShadyRoot = root;
+}
+return node._ownerShadyRoot;
+},
+_maybeDistribute: function (node, parent) {
+var fragContent = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && !node.__noContent && Polymer.dom(node).querySelector(CONTENT);
+var wrappedContent = fragContent && Polymer.dom(fragContent).parentNode.nodeType !== Node.DOCUMENT_FRAGMENT_NODE;
+var hasContent = fragContent || node.localName === CONTENT;
+if (hasContent) {
+var root = this._ownerShadyRootForNode(parent);
+if (root) {
+var host = root.host;
+this._lazyDistribute(host);
+}
+}
+var parentNeedsDist = this._parentNeedsDistribution(parent);
+if (parentNeedsDist) {
+this._lazyDistribute(parent);
+}
+return parentNeedsDist || hasContent && !wrappedContent;
+},
+_maybeAddInsertionPoint: function (node, parent) {
+var added;
+if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && !node.__noContent) {
+var c$ = factory(node).querySelectorAll(CONTENT);
+for (var i = 0, n, np, na; i < c$.length && (n = c$[i]); i++) {
+np = factory(n).parentNode;
+if (np === node) {
+np = parent;
+}
+na = this._maybeAddInsertionPoint(n, np);
+added = added || na;
+}
+} else if (node.localName === CONTENT) {
+saveLightChildrenIfNeeded(parent);
+saveLightChildrenIfNeeded(node);
+added = true;
+}
+return added;
+},
+_tryRemoveUndistributedNode: function (node) {
+if (this.node.shadyRoot) {
+var parent = getComposedParent(node);
+if (parent) {
+nativeRemoveChild.call(parent, node);
+}
+return true;
+}
+},
+_updateInsertionPoints: function (host) {
+var i$ = host.shadyRoot._insertionPoints = factory(host.shadyRoot).querySelectorAll(CONTENT);
+for (var i = 0, c; i < i$.length; i++) {
+c = i$[i];
+saveLightChildrenIfNeeded(c);
+saveLightChildrenIfNeeded(factory(c).parentNode);
+}
+},
+_nodeHasLogicalChildren: function (node) {
+return Boolean(node._lightChildren !== undefined);
+},
+_parentNeedsDistribution: function (parent) {
+return parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot);
+},
+_removeNodeFromHost: function (node, ensureComposedRemoval) {
+var hostNeedsDist;
+var root;
+var parent = node._lightParent;
+if (parent) {
+factory(node)._distributeParent();
+root = this._ownerShadyRootForNode(node);
+if (root) {
+root.host._elementRemove(node);
+hostNeedsDist = this._removeDistributedChildren(root, node);
+}
+this._removeLogicalInfo(node, node._lightParent);
+}
+this._removeOwnerShadyRoot(node);
+if (root && hostNeedsDist) {
+this._updateInsertionPoints(root.host);
+this._lazyDistribute(root.host);
+} else if (ensureComposedRemoval) {
+removeFromComposedParent(getComposedParent(node), node);
+}
+},
+_removeDistributedChildren: function (root, container) {
+var hostNeedsDist;
+var ip$ = root._insertionPoints;
+for (var i = 0; i < ip$.length; i++) {
+var content = ip$[i];
+if (this._contains(container, content)) {
+var dc$ = factory(content).getDistributedNodes();
+for (var j = 0; j < dc$.length; j++) {
+hostNeedsDist = true;
+var node = dc$[j];
+var parent = node.parentNode;
+if (parent) {
+removeFromComposedParent(parent, node);
+nativeRemoveChild.call(parent, node);
+}
+}
+}
+}
+return hostNeedsDist;
+},
+_contains: function (container, node) {
+while (node) {
+if (node == container) {
+return true;
+}
+node = factory(node).parentNode;
+}
+},
+_addNodeToHost: function (node) {
+var root = this.getOwnerRoot();
+if (root) {
+root.host._elementAdd(node);
+}
+},
+_addLogicalInfo: function (node, container, index) {
+var children = factory(container).childNodes;
+index = index === undefined ? children.length : index;
+if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
+var c$ = Array.prototype.slice.call(node.childNodes);
+for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
+children.splice(index++, 0, n);
+n._lightParent = container;
+}
+} else {
+children.splice(index, 0, node);
+node._lightParent = container;
+}
+},
+_removeLogicalInfo: function (node, container) {
+var children = factory(container).childNodes;
+var index = children.indexOf(node);
+if (index < 0 || container !== node._lightParent) {
+throw Error('The node to be removed is not a child of this node');
+}
+children.splice(index, 1);
+node._lightParent = null;
+},
+_removeOwnerShadyRoot: function (node) {
+if (this._hasCachedOwnerRoot(node)) {
+var c$ = factory(node).childNodes;
+for (var i = 0, l = c$.length, n; i < l && (n = c$[i]); i++) {
+this._removeOwnerShadyRoot(n);
+}
+}
+node._ownerShadyRoot = undefined;
+},
+_firstComposedNode: function (content) {
+var n$ = factory(content).getDistributedNodes();
+for (var i = 0, l = n$.length, n, p$; i < l && (n = n$[i]); i++) {
+p$ = factory(n).getDestinationInsertionPoints();
+if (p$[p$.length - 1] === content) {
+return n;
+}
+}
+},
+querySelector: function (selector) {
+return this.querySelectorAll(selector)[0];
+},
+querySelectorAll: function (selector) {
+return this._query(function (n) {
+return matchesSelector.call(n, selector);
+}, this.node);
+},
+_query: function (matcher, node) {
+node = node || this.node;
+var list = [];
+this._queryElements(factory(node).childNodes, matcher, list);
+return list;
+},
+_queryElements: function (elements, matcher, list) {
+for (var i = 0, l = elements.length, c; i < l && (c = elements[i]); i++) {
+if (c.nodeType === Node.ELEMENT_NODE) {
+this._queryElement(c, matcher, list);
+}
+}
+},
+_queryElement: function (node, matcher, list) {
+if (matcher(node)) {
+list.push(node);
+}
+this._queryElements(factory(node).childNodes, matcher, list);
+},
+getDestinationInsertionPoints: function () {
+return this.node._destinationInsertionPoints || [];
+},
+getDistributedNodes: function () {
+return this.node._distributedNodes || [];
+},
+queryDistributedElements: function (selector) {
+var c$ = this.childNodes;
+var list = [];
+this._distributedFilter(selector, c$, list);
+for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
+if (c.localName === CONTENT) {
+this._distributedFilter(selector, factory(c).getDistributedNodes(), list);
+}
+}
+return list;
+},
+_distributedFilter: function (selector, list, results) {
+results = results || [];
+for (var i = 0, l = list.length, d; i < l && (d = list[i]); i++) {
+if (d.nodeType === Node.ELEMENT_NODE && d.localName !== CONTENT && matchesSelector.call(d, selector)) {
+results.push(d);
+}
+}
+return results;
+},
+_clear: function () {
+while (this.childNodes.length) {
+this.removeChild(this.childNodes[0]);
+}
+},
+setAttribute: function (name, value) {
+this.node.setAttribute(name, value);
+this._distributeParent();
+},
+removeAttribute: function (name) {
+this.node.removeAttribute(name);
+this._distributeParent();
+},
+_distributeParent: function () {
+if (this._parentNeedsDistribution(this.parentNode)) {
+this._lazyDistribute(this.parentNode);
+}
+},
+cloneNode: function (deep) {
+var n = nativeCloneNode.call(this.node, false);
+if (deep) {
+var c$ = this.childNodes;
+var d = factory(n);
+for (var i = 0, nc; i < c$.length; i++) {
+nc = factory(c$[i]).cloneNode(true);
+d.appendChild(nc);
+}
+}
+return n;
+},
+importNode: function (externalNode, deep) {
+var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
+var n = nativeImportNode.call(doc, externalNode, false);
+if (deep) {
+var c$ = factory(externalNode).childNodes;
+var d = factory(n);
+for (var i = 0, nc; i < c$.length; i++) {
+nc = factory(doc).importNode(c$[i], true);
+d.appendChild(nc);
+}
+}
+return n;
+}
+};
+Object.defineProperty(DomApi.prototype, 'classList', {
+get: function () {
+if (!this._classList) {
+this._classList = new DomApi.ClassList(this);
+}
+return this._classList;
+},
+configurable: true
+});
+DomApi.ClassList = function (host) {
+this.domApi = host;
+this.node = host.node;
+};
+DomApi.ClassList.prototype = {
+add: function () {
+this.node.classList.add.apply(this.node.classList, arguments);
+this.domApi._distributeParent();
+},
+remove: function () {
+this.node.classList.remove.apply(this.node.classList, arguments);
+this.domApi._distributeParent();
+},
+toggle: function () {
+this.node.classList.toggle.apply(this.node.classList, arguments);
+this.domApi._distributeParent();
+},
+contains: function () {
+return this.node.classList.contains.apply(this.node.classList, arguments);
+}
+};
+if (!Settings.useShadow) {
+Object.defineProperties(DomApi.prototype, {
+childNodes: {
+get: function () {
+var c$ = getLightChildren(this.node);
+return Array.isArray(c$) ? c$ : Array.prototype.slice.call(c$);
+},
+configurable: true
+},
+children: {
+get: function () {
+return Array.prototype.filter.call(this.childNodes, function (n) {
+return n.nodeType === Node.ELEMENT_NODE;
+});
+},
+configurable: true
+},
+parentNode: {
+get: function () {
+return this.node._lightParent || getComposedParent(this.node);
+},
+configurable: true
+},
+firstChild: {
+get: function () {
+return this.childNodes[0];
+},
+configurable: true
+},
+lastChild: {
+get: function () {
+var c$ = this.childNodes;
+return c$[c$.length - 1];
+},
+configurable: true
+},
+nextSibling: {
+get: function () {
+var c$ = this.parentNode && factory(this.parentNode).childNodes;
+if (c$) {
+return c$[Array.prototype.indexOf.call(c$, this.node) + 1];
+}
+},
+configurable: true
+},
+previousSibling: {
+get: function () {
+var c$ = this.parentNode && factory(this.parentNode).childNodes;
+if (c$) {
+return c$[Array.prototype.indexOf.call(c$, this.node) - 1];
+}
+},
+configurable: true
+},
+firstElementChild: {
+get: function () {
+return this.children[0];
+},
+configurable: true
+},
+lastElementChild: {
+get: function () {
+var c$ = this.children;
+return c$[c$.length - 1];
+},
+configurable: true
+},
+nextElementSibling: {
+get: function () {
+var c$ = this.parentNode && factory(this.parentNode).children;
+if (c$) {
+return c$[Array.prototype.indexOf.call(c$, this.node) + 1];
+}
+},
+configurable: true
+},
+previousElementSibling: {
+get: function () {
+var c$ = this.parentNode && factory(this.parentNode).children;
+if (c$) {
+return c$[Array.prototype.indexOf.call(c$, this.node) - 1];
+}
+},
+configurable: true
+},
+textContent: {
+get: function () {
+var nt = this.node.nodeType;
+if (nt === Node.TEXT_NODE || nt === Node.COMMENT_NODE) {
+return this.node.textContent;
+} else {
+var tc = [];
+for (var i = 0, cn = this.childNodes, c; c = cn[i]; i++) {
+if (c.nodeType !== Node.COMMENT_NODE) {
+tc.push(c.textContent);
+}
+}
+return tc.join('');
+}
+},
+set: function (text) {
+var nt = this.node.nodeType;
+if (nt === Node.TEXT_NODE || nt === Node.COMMENT_NODE) {
+this.node.textContent = text;
+} else {
+this._clear();
+if (text) {
+this.appendChild(document.createTextNode(text));
+}
+}
+},
+configurable: true
+},
+innerHTML: {
+get: function () {
+var nt = this.node.nodeType;
+if (nt === Node.TEXT_NODE || nt === Node.COMMENT_NODE) {
+return null;
+} else {
+return getInnerHTML(this.node);
+}
+},
+set: function (text) {
+var nt = this.node.nodeType;
+if (nt !== Node.TEXT_NODE || nt !== Node.COMMENT_NODE) {
+this._clear();
+var d = document.createElement('div');
+d.innerHTML = text;
+var c$ = Array.prototype.slice.call(d.childNodes);
+for (var i = 0; i < c$.length; i++) {
+this.appendChild(c$[i]);
+}
+}
+},
+configurable: true
+}
+});
+DomApi.prototype._getComposedInnerHTML = function () {
+return getInnerHTML(this.node, true);
+};
+} else {
+var forwardMethods = [
+'cloneNode',
+'appendChild',
+'insertBefore',
+'removeChild',
+'replaceChild'
+];
+forwardMethods.forEach(function (name) {
+DomApi.prototype[name] = function () {
+return this.node[name].apply(this.node, arguments);
+};
+});
+DomApi.prototype.querySelectorAll = function (selector) {
+return Array.prototype.slice.call(this.node.querySelectorAll(selector));
+};
+DomApi.prototype.getOwnerRoot = function () {
+var n = this.node;
+while (n) {
+if (n.nodeType === Node.DOCUMENT_FRAGMENT_NODE && n.host) {
+return n;
+}
+n = n.parentNode;
+}
+};
+DomApi.prototype.importNode = function (externalNode, deep) {
+var doc = this.node instanceof Document ? this.node : this.node.ownerDocument;
+return doc.importNode(externalNode, deep);
+};
+DomApi.prototype.getDestinationInsertionPoints = function () {
+var n$ = this.node.getDestinationInsertionPoints && this.node.getDestinationInsertionPoints();
+return n$ ? Array.prototype.slice.call(n$) : [];
+};
+DomApi.prototype.getDistributedNodes = function () {
+var n$ = this.node.getDistributedNodes && this.node.getDistributedNodes();
+return n$ ? Array.prototype.slice.call(n$) : [];
+};
+DomApi.prototype._distributeParent = function () {
+};
+Object.defineProperties(DomApi.prototype, {
+childNodes: {
+get: function () {
+return Array.prototype.slice.call(this.node.childNodes);
+},
+configurable: true
+},
+children: {
+get: function () {
+return Array.prototype.slice.call(this.node.children);
+},
+configurable: true
+},
+textContent: {
+get: function () {
+return this.node.textContent;
+},
+set: function (value) {
+return this.node.textContent = value;
+},
+configurable: true
+},
+innerHTML: {
+get: function () {
+return this.node.innerHTML;
+},
+set: function (value) {
+return this.node.innerHTML = value;
+},
+configurable: true
+}
+});
+var forwardProperties = [
+'parentNode',
+'firstChild',
+'lastChild',
+'nextSibling',
+'previousSibling',
+'firstElementChild',
+'lastElementChild',
+'nextElementSibling',
+'previousElementSibling'
+];
+forwardProperties.forEach(function (name) {
+Object.defineProperty(DomApi.prototype, name, {
+get: function () {
+return this.node[name];
+},
+configurable: true
+});
+});
+}
+var CONTENT = 'content';
+var factory = function (node, patch) {
+node = node || document;
+if (!node.__domApi) {
+node.__domApi = new DomApi(node, patch);
+}
+return node.__domApi;
+};
+Polymer.dom = function (obj, patch) {
+if (obj instanceof Event) {
+return Polymer.EventApi.factory(obj);
+} else {
+return factory(obj, patch);
+}
+};
+Polymer.Base.extend(Polymer.dom, {
+_flushGuard: 0,
+_FLUSH_MAX: 100,
+_needsTakeRecords: !Polymer.Settings.useNativeCustomElements,
+_debouncers: [],
+_finishDebouncer: null,
+flush: function () {
+for (var i = 0; i < this._debouncers.length; i++) {
+this._debouncers[i].complete();
+}
+if (this._finishDebouncer) {
+this._finishDebouncer.complete();
+}
+this._flushPolyfills();
+if (this._debouncers.length && this._flushGuard < this._FLUSH_MAX) {
+this._flushGuard++;
+this.flush();
+} else {
+if (this._flushGuard >= this._FLUSH_MAX) {
+console.warn('Polymer.dom.flush aborted. Flush may not be complete.');
+}
+this._flushGuard = 0;
+}
+},
+_flushPolyfills: function () {
+if (this._needsTakeRecords) {
+CustomElements.takeRecords();
+}
+},
+addDebouncer: function (debouncer) {
+this._debouncers.push(debouncer);
+this._finishDebouncer = Polymer.Debounce(this._finishDebouncer, this._finishFlush);
+},
+_finishFlush: function () {
+Polymer.dom._debouncers = [];
+}
+});
+function getLightChildren(node) {
+var children = node._lightChildren;
+return children ? children : node.childNodes;
+}
+function getComposedChildren(node) {
+if (!node._composedChildren) {
+node._composedChildren = Array.prototype.slice.call(node.childNodes);
+}
+return node._composedChildren;
+}
+function addToComposedParent(parent, node, ref_node) {
+var children = getComposedChildren(parent);
+var i = ref_node ? children.indexOf(ref_node) : -1;
+if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
+var fragChildren = getComposedChildren(node);
+for (var j = 0; j < fragChildren.length; j++) {
+addNodeToComposedChildren(fragChildren[j], parent, children, i + j);
+}
+node._composedChildren = null;
+} else {
+addNodeToComposedChildren(node, parent, children, i);
+}
+}
+function getComposedParent(node) {
+return node.__patched ? node._composedParent : node.parentNode;
+}
+function addNodeToComposedChildren(node, parent, children, i) {
+node._composedParent = parent;
+children.splice(i >= 0 ? i : children.length, 0, node);
+}
+function removeFromComposedParent(parent, node) {
+node._composedParent = null;
+if (parent) {
+var children = getComposedChildren(parent);
+var i = children.indexOf(node);
+if (i >= 0) {
+children.splice(i, 1);
+}
+}
+}
+function saveLightChildrenIfNeeded(node) {
+if (!node._lightChildren) {
+var c$ = Array.prototype.slice.call(node.childNodes);
+for (var i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) {
+child._lightParent = child._lightParent || node;
+}
+node._lightChildren = c$;
+}
+}
+function hasInsertionPoint(root) {
+return Boolean(root && root._insertionPoints.length);
+}
+var p = Element.prototype;
+var matchesSelector = p.matches || p.matchesSelector || p.mozMatchesSelector || p.msMatchesSelector || p.oMatchesSelector || p.webkitMatchesSelector;
+return {
+getLightChildren: getLightChildren,
+getComposedParent: getComposedParent,
+getComposedChildren: getComposedChildren,
+removeFromComposedParent: removeFromComposedParent,
+saveLightChildrenIfNeeded: saveLightChildrenIfNeeded,
+matchesSelector: matchesSelector,
+hasInsertionPoint: hasInsertionPoint,
+ctor: DomApi,
+factory: factory
+};
+}();
+(function () {
+Polymer.Base._addFeature({
+_prepShady: function () {
+this._useContent = this._useContent || Boolean(this._template);
+},
+_poolContent: function () {
+if (this._useContent) {
+saveLightChildrenIfNeeded(this);
+}
+},
+_setupRoot: function () {
+if (this._useContent) {
+this._createLocalRoot();
+if (!this.dataHost) {
+upgradeLightChildren(this._lightChildren);
+}
+}
+},
+_createLocalRoot: function () {
+this.shadyRoot = this.root;
+this.shadyRoot._distributionClean = false;
+this.shadyRoot._isShadyRoot = true;
+this.shadyRoot._dirtyRoots = [];
+var i$ = this.shadyRoot._insertionPoints = !this._notes || this._notes._hasContent ? this.shadyRoot.querySelectorAll('content') : [];
+saveLightChildrenIfNeeded(this.shadyRoot);
+for (var i = 0, c; i < i$.length; i++) {
+c = i$[i];
+saveLightChildrenIfNeeded(c);
+saveLightChildrenIfNeeded(c.parentNode);
+}
+this.shadyRoot.host = this;
+},
+get domHost() {
+var root = Polymer.dom(this).getOwnerRoot();
+return root && root.host;
+},
+distributeContent: function (updateInsertionPoints) {
+if (this.shadyRoot) {
+var dom = Polymer.dom(this);
+if (updateInsertionPoints) {
+dom._updateInsertionPoints(this);
+}
+var host = getTopDistributingHost(this);
+dom._lazyDistribute(host);
+}
+},
+_distributeContent: function () {
+if (this._useContent && !this.shadyRoot._distributionClean) {
+this._beginDistribute();
+this._distributeDirtyRoots();
+this._finishDistribute();
+}
+},
+_beginDistribute: function () {
+if (this._useContent && hasInsertionPoint(this.shadyRoot)) {
+this._resetDistribution();
+this._distributePool(this.shadyRoot, this._collectPool());
+}
+},
+_distributeDirtyRoots: function () {
+var c$ = this.shadyRoot._dirtyRoots;
+for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
+c._distributeContent();
+}
+this.shadyRoot._dirtyRoots = [];
+},
+_finishDistribute: function () {
+if (this._useContent) {
+this.shadyRoot._distributionClean = true;
+if (hasInsertionPoint(this.shadyRoot)) {
+this._composeTree();
+} else {
+if (!this.shadyRoot._hasDistributed) {
+this.textContent = '';
+this._composedChildren = null;
+this.appendChild(this.shadyRoot);
+} else {
+var children = this._composeNode(this);
+this._updateChildNodes(this, children);
+}
+}
+this.shadyRoot._hasDistributed = true;
+}
+},
+elementMatches: function (selector, node) {
+node = node || this;
+return matchesSelector.call(node, selector);
+},
+_resetDistribution: function () {
+var children = getLightChildren(this);
+for (var i = 0; i < children.length; i++) {
+var child = children[i];
+if (child._destinationInsertionPoints) {
+child._destinationInsertionPoints = undefined;
+}
+if (isInsertionPoint(child)) {
+clearDistributedDestinationInsertionPoints(child);
+}
+}
+var root = this.shadyRoot;
+var p$ = root._insertionPoints;
+for (var j = 0; j < p$.length; j++) {
+p$[j]._distributedNodes = [];
+}
+},
+_collectPool: function () {
+var pool = [];
+var children = getLightChildren(this);
+for (var i = 0; i < children.length; i++) {
+var child = children[i];
+if (isInsertionPoint(child)) {
+pool.push.apply(pool, child._distributedNodes);
+} else {
+pool.push(child);
+}
+}
+return pool;
+},
+_distributePool: function (node, pool) {
+var p$ = node._insertionPoints;
+for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) {
+this._distributeInsertionPoint(p, pool);
+maybeRedistributeParent(p, this);
+}
+},
+_distributeInsertionPoint: function (content, pool) {
+var anyDistributed = false;
+for (var i = 0, l = pool.length, node; i < l; i++) {
+node = pool[i];
+if (!node) {
+continue;
+}
+if (this._matchesContentSelect(node, content)) {
+distributeNodeInto(node, content);
+pool[i] = undefined;
+anyDistributed = true;
+}
+}
+if (!anyDistributed) {
+var children = getLightChildren(content);
+for (var j = 0; j < children.length; j++) {
+distributeNodeInto(children[j], content);
+}
+}
+},
+_composeTree: function () {
+this._updateChildNodes(this, this._composeNode(this));
+var p$ = this.shadyRoot._insertionPoints;
+for (var i = 0, l = p$.length, p, parent; i < l && (p = p$[i]); i++) {
+parent = p._lightParent || p.parentNode;
+if (!parent._useContent && parent !== this && parent !== this.shadyRoot) {
+this._updateChildNodes(parent, this._composeNode(parent));
+}
+}
+},
+_composeNode: function (node) {
+var children = [];
+var c$ = getLightChildren(node.shadyRoot || node);
+for (var i = 0; i < c$.length; i++) {
+var child = c$[i];
+if (isInsertionPoint(child)) {
+var distributedNodes = child._distributedNodes;
+for (var j = 0; j < distributedNodes.length; j++) {
+var distributedNode = distributedNodes[j];
+if (isFinalDestination(child, distributedNode)) {
+children.push(distributedNode);
+}
+}
+} else {
+children.push(child);
+}
+}
+return children;
+},
+_updateChildNodes: function (container, children) {
+var composed = getComposedChildren(container);
+var splices = Polymer.ArraySplice.calculateSplices(children, composed);
+for (var i = 0, d = 0, s; i < splices.length && (s = splices[i]); i++) {
+for (var j = 0, n; j < s.removed.length && (n = s.removed[j]); j++) {
+if (getComposedParent(n) === container) {
+remove(n);
+}
+composed.splice(s.index + d, 1);
+}
+d -= s.addedCount;
+}
+for (var i = 0, s, next; i < splices.length && (s = splices[i]); i++) {
+next = composed[s.index];
+for (var j = s.index, n; j < s.index + s.addedCount; j++) {
+n = children[j];
+insertBefore(container, n, next);
+composed.splice(j, 0, n);
+}
+}
+ensureComposedParent(container, children);
+},
+_matchesContentSelect: function (node, contentElement) {
+var select = contentElement.getAttribute('select');
+if (!select) {
+return true;
+}
+select = select.trim();
+if (!select) {
+return true;
+}
+if (!(node instanceof Element)) {
+return false;
+}
+var validSelectors = /^(:not\()?[*.#[a-zA-Z_|]/;
+if (!validSelectors.test(select)) {
+return false;
+}
+return this.elementMatches(select, node);
+},
+_elementAdd: function () {
+},
+_elementRemove: function () {
+}
+});
+var saveLightChildrenIfNeeded = Polymer.DomApi.saveLightChildrenIfNeeded;
+var getLightChildren = Polymer.DomApi.getLightChildren;
+var matchesSelector = Polymer.DomApi.matchesSelector;
+var hasInsertionPoint = Polymer.DomApi.hasInsertionPoint;
+var getComposedChildren = Polymer.DomApi.getComposedChildren;
+var getComposedParent = Polymer.DomApi.getComposedParent;
+var removeFromComposedParent = Polymer.DomApi.removeFromComposedParent;
+function distributeNodeInto(child, insertionPoint) {
+insertionPoint._distributedNodes.push(child);
+var points = child._destinationInsertionPoints;
+if (!points) {
+child._destinationInsertionPoints = [insertionPoint];
+} else {
+points.push(insertionPoint);
+}
+}
+function clearDistributedDestinationInsertionPoints(content) {
+var e$ = content._distributedNodes;
+if (e$) {
+for (var i = 0; i < e$.length; i++) {
+var d = e$[i]._destinationInsertionPoints;
+if (d) {
+d.splice(d.indexOf(content) + 1, d.length);
+}
+}
+}
+}
+function maybeRedistributeParent(content, host) {
+var parent = content._lightParent;
+if (parent && parent.shadyRoot && hasInsertionPoint(parent.shadyRoot) && parent.shadyRoot._distributionClean) {
+parent.shadyRoot._distributionClean = false;
+host.shadyRoot._dirtyRoots.push(parent);
+}
+}
+function isFinalDestination(insertionPoint, node) {
+var points = node._destinationInsertionPoints;
+return points && points[points.length - 1] === insertionPoint;
+}
+function isInsertionPoint(node) {
+return node.localName == 'content';
+}
+var nativeInsertBefore = Element.prototype.insertBefore;
+var nativeRemoveChild = Element.prototype.removeChild;
+function insertBefore(parentNode, newChild, refChild) {
+var newChildParent = getComposedParent(newChild);
+if (newChildParent !== parentNode) {
+removeFromComposedParent(newChildParent, newChild);
+}
+remove(newChild);
+nativeInsertBefore.call(parentNode, newChild, refChild || null);
+newChild._composedParent = parentNode;
+}
+function remove(node) {
+var parentNode = getComposedParent(node);
+if (parentNode) {
+node._composedParent = null;
+nativeRemoveChild.call(parentNode, node);
+}
+}
+function ensureComposedParent(parent, children) {
+for (var i = 0, n; i < children.length; i++) {
+children[i]._composedParent = parent;
+}
+}
+function getTopDistributingHost(host) {
+while (host && hostNeedsRedistribution(host)) {
+host = host.domHost;
+}
+return host;
+}
+function hostNeedsRedistribution(host) {
+var c$ = Polymer.dom(host).children;
+for (var i = 0, c; i < c$.length; i++) {
+c = c$[i];
+if (c.localName === 'content') {
+return host.domHost;
+}
+}
+}
+var needsUpgrade = window.CustomElements && !CustomElements.useNative;
+function upgradeLightChildren(children) {
+if (needsUpgrade && children) {
+for (var i = 0; i < children.length; i++) {
+CustomElements.upgrade(children[i]);
+}
+}
+}
+}());
+if (Polymer.Settings.useShadow) {
+Polymer.Base._addFeature({
+_poolContent: function () {
+},
+_beginDistribute: function () {
+},
+distributeContent: function () {
+},
+_distributeContent: function () {
+},
+_finishDistribute: function () {
+},
+_createLocalRoot: function () {
+this.createShadowRoot();
+this.shadowRoot.appendChild(this.root);
+this.root = this.shadowRoot;
+}
+});
+}
+Polymer.DomModule = document.createElement('dom-module');
+Polymer.Base._addFeature({
+_registerFeatures: function () {
+this._prepIs();
+this._prepAttributes();
+this._prepBehaviors();
+this._prepConstructor();
+this._prepTemplate();
+this._prepShady();
+},
+_prepBehavior: function (b) {
+this._addHostAttributes(b.hostAttributes);
+},
+_initFeatures: function () {
+this._poolContent();
+this._pushHost();
+this._stampTemplate();
+this._popHost();
+this._marshalHostAttributes();
+this._setupDebouncers();
+this._marshalBehaviors();
+this._tryReady();
+},
+_marshalBehavior: function (b) {
+}
+});
+Polymer.nar = [];
+Polymer.Annotations = {
+parseAnnotations: function (template) {
+var list = [];
+var content = template._content || template.content;
+this._parseNodeAnnotations(content, list);
+return list;
+},
+_parseNodeAnnotations: function (node, list) {
+return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list);
+},
+_testEscape: function (value) {
+var escape = value.slice(0, 2);
+if (escape === '{{' || escape === '[[') {
+return escape;
+}
+},
+_parseTextNodeAnnotation: function (node, list) {
+var v = node.textContent;
+var escape = this._testEscape(v);
+if (escape) {
+node.textContent = ' ';
+var annote = {
+bindings: [{
+kind: 'text',
+mode: escape[0],
+value: v.slice(2, -2).trim()
+}]
+};
+list.push(annote);
+return annote;
+}
+},
+_parseElementAnnotations: function (element, list) {
+var annote = {
+bindings: [],
+events: []
+};
+if (element.localName === 'content') {
+list._hasContent = true;
+}
+this._parseChildNodesAnnotations(element, annote, list);
+if (element.attributes) {
+this._parseNodeAttributeAnnotations(element, annote, list);
+if (this.prepElement) {
+this.prepElement(element);
+}
+}
+if (annote.bindings.length || annote.events.length || annote.id) {
+list.push(annote);
+}
+return annote;
+},
+_parseChildNodesAnnotations: function (root, annote, list, callback) {
+if (root.firstChild) {
+for (var i = 0, node = root.firstChild; node; node = node.nextSibling, i++) {
+if (node.localName === 'template' && !node.hasAttribute('preserve-content')) {
+this._parseTemplate(node, i, list, annote);
+}
+if (node.nodeType === Node.TEXT_NODE) {
+var n = node.nextSibling;
+while (n && n.nodeType === Node.TEXT_NODE) {
+node.textContent += n.textContent;
+root.removeChild(n);
+n = n.nextSibling;
+}
+}
+var childAnnotation = this._parseNodeAnnotations(node, list, callback);
+if (childAnnotation) {
+childAnnotation.parent = annote;
+childAnnotation.index = i;
+}
+}
+}
+},
+_parseTemplate: function (node, index, list, parent) {
+var content = document.createDocumentFragment();
+content._notes = this.parseAnnotations(node);
+content.appendChild(node.content);
+list.push({
+bindings: Polymer.nar,
+events: Polymer.nar,
+templateContent: content,
+parent: parent,
+index: index
+});
+},
+_parseNodeAttributeAnnotations: function (node, annotation) {
+for (var i = node.attributes.length - 1, a; a = node.attributes[i]; i--) {
+var n = a.name, v = a.value;
+if (n === 'id' && !this._testEscape(v)) {
+annotation.id = v;
+} else if (n.slice(0, 3) === 'on-') {
+node.removeAttribute(n);
+annotation.events.push({
+name: n.slice(3),
+value: v
+});
+} else {
+var b = this._parseNodeAttributeAnnotation(node, n, v);
+if (b) {
+annotation.bindings.push(b);
+}
+}
+}
+},
+_parseNodeAttributeAnnotation: function (node, n, v) {
+var escape = this._testEscape(v);
+if (escape) {
+var customEvent;
+var name = n;
+var mode = escape[0];
+v = v.slice(2, -2).trim();
+var not = false;
+if (v[0] == '!') {
+v = v.substring(1);
+not = true;
+}
+var kind = 'property';
+if (n[n.length - 1] == '$') {
+name = n.slice(0, -1);
+kind = 'attribute';
+}
+var notifyEvent, colon;
+if (mode == '{' && (colon = v.indexOf('::')) > 0) {
+notifyEvent = v.substring(colon + 2);
+v = v.substring(0, colon);
+customEvent = true;
+}
+if (node.localName == 'input' && n == 'value') {
+node.setAttribute(n, '');
+}
+node.removeAttribute(n);
+if (kind === 'property') {
+name = Polymer.CaseMap.dashToCamelCase(name);
+}
+return {
+kind: kind,
+mode: mode,
+name: name,
+value: v,
+negate: not,
+event: notifyEvent,
+customEvent: customEvent
+};
+}
+},
+_localSubTree: function (node, host) {
+return node === host ? node.childNodes : node._lightChildren || node.childNodes;
+},
+findAnnotatedNode: function (root, annote) {
+var parent = annote.parent && Polymer.Annotations.findAnnotatedNode(root, annote.parent);
+return !parent ? root : Polymer.Annotations._localSubTree(parent, root)[annote.index];
+}
+};
+(function () {
+function resolveCss(cssText, ownerDocument) {
+return cssText.replace(CSS_URL_RX, function (m, pre, url, post) {
+return pre + '\'' + resolve(url.replace(/["']/g, ''), ownerDocument) + '\'' + post;
+});
+}
+function resolveAttrs(element, ownerDocument) {
+for (var name in URL_ATTRS) {
+var a$ = URL_ATTRS[name];
+for (var i = 0, l = a$.length, a, at, v; i < l && (a = a$[i]); i++) {
+if (name === '*' || element.localName === name) {
+at = element.attributes[a];
+v = at && at.value;
+if (v && v.search(BINDING_RX) < 0) {
+at.value = a === 'style' ? resolveCss(v, ownerDocument) : resolve(v, ownerDocument);
+}
+}
+}
+}
+}
+function resolve(url, ownerDocument) {
+if (url && url[0] === '#') {
+return url;
+}
+var resolver = getUrlResolver(ownerDocument);
+resolver.href = url;
+return resolver.href || url;
+}
+var tempDoc;
+var tempDocBase;
+function resolveUrl(url, baseUri) {
+if (!tempDoc) {
+tempDoc = document.implementation.createHTMLDocument('temp');
+tempDocBase = tempDoc.createElement('base');
+tempDoc.head.appendChild(tempDocBase);
+}
+tempDocBase.href = baseUri;
+return resolve(url, tempDoc);
+}
+function getUrlResolver(ownerDocument) {
+return ownerDocument.__urlResolver || (ownerDocument.__urlResolver = ownerDocument.createElement('a'));
+}
+var CSS_URL_RX = /(url\()([^)]*)(\))/g;
+var URL_ATTRS = {
+'*': [
+'href',
+'src',
+'style',
+'url'
+],
+form: ['action']
+};
+var BINDING_RX = /\{\{|\[\[/;
+Polymer.ResolveUrl = {
+resolveCss: resolveCss,
+resolveAttrs: resolveAttrs,
+resolveUrl: resolveUrl
+};
+}());
+Polymer.Base._addFeature({
+_prepAnnotations: function () {
+if (!this._template) {
+this._notes = [];
+} else {
+Polymer.Annotations.prepElement = this._prepElement.bind(this);
+if (this._template._content && this._template._content._notes) {
+this._notes = this._template._content._notes;
+} else {
+this._notes = Polymer.Annotations.parseAnnotations(this._template);
+}
+this._processAnnotations(this._notes);
+Polymer.Annotations.prepElement = null;
+}
+},
+_processAnnotations: function (notes) {
+for (var i = 0; i < notes.length; i++) {
+var note = notes[i];
+for (var j = 0; j < note.bindings.length; j++) {
+var b = note.bindings[j];
+b.signature = this._parseMethod(b.value);
+if (!b.signature) {
+b.model = this._modelForPath(b.value);
+}
+}
+if (note.templateContent) {
+this._processAnnotations(note.templateContent._notes);
+var pp = note.templateContent._parentProps = this._discoverTemplateParentProps(note.templateContent._notes);
+var bindings = [];
+for (var prop in pp) {
+bindings.push({
+index: note.index,
+kind: 'property',
+mode: '{',
+name: '_parent_' + prop,
+model: prop,
+value: prop
+});
+}
+note.bindings = note.bindings.concat(bindings);
+}
+}
+},
+_discoverTemplateParentProps: function (notes) {
+var pp = {};
+notes.forEach(function (n) {
+n.bindings.forEach(function (b) {
+if (b.signature) {
+var args = b.signature.args;
+for (var k = 0; k < args.length; k++) {
+pp[args[k].model] = true;
+}
+} else {
+pp[b.model] = true;
+}
+});
+if (n.templateContent) {
+var tpp = n.templateContent._parentProps;
+Polymer.Base.mixin(pp, tpp);
+}
+});
+return pp;
+},
+_prepElement: function (element) {
+Polymer.ResolveUrl.resolveAttrs(element, this._template.ownerDocument);
+},
+_findAnnotatedNode: Polymer.Annotations.findAnnotatedNode,
+_marshalAnnotationReferences: function () {
+if (this._template) {
+this._marshalIdNodes();
+this._marshalAnnotatedNodes();
+this._marshalAnnotatedListeners();
+}
+},
+_configureAnnotationReferences: function () {
+this._configureTemplateContent();
+},
+_configureTemplateContent: function () {
+this._notes.forEach(function (note, i) {
+if (note.templateContent) {
+this._nodes[i]._content = note.templateContent;
+}
+}, this);
+},
+_marshalIdNodes: function () {
+this.$ = {};
+this._notes.forEach(function (a) {
+if (a.id) {
+this.$[a.id] = this._findAnnotatedNode(this.root, a);
+}
+}, this);
+},
+_marshalAnnotatedNodes: function () {
+if (this._nodes) {
+this._nodes = this._nodes.map(function (a) {
+return this._findAnnotatedNode(this.root, a);
+}, this);
+}
+},
+_marshalAnnotatedListeners: function () {
+this._notes.forEach(function (a) {
+if (a.events && a.events.length) {
+var node = this._findAnnotatedNode(this.root, a);
+a.events.forEach(function (e) {
+this.listen(node, e.name, e.value);
+}, this);
+}
+}, this);
+}
+});
+Polymer.Base._addFeature({
+listeners: {},
+_listenListeners: function (listeners) {
+var node, name, key;
+for (key in listeners) {
+if (key.indexOf('.') < 0) {
+node = this;
+name = key;
+} else {
+name = key.split('.');
+node = this.$[name[0]];
+name = name[1];
+}
+this.listen(node, name, listeners[key]);
+}
+},
+listen: function (node, eventName, methodName) {
+this._listen(node, eventName, this._createEventHandler(node, eventName, methodName));
+},
+_boundListenerKey: function (eventName, methodName) {
+return eventName + ':' + methodName;
+},
+_recordEventHandler: function (host, eventName, target, methodName, handler) {
+var hbl = host.__boundListeners;
+if (!hbl) {
+hbl = host.__boundListeners = new WeakMap();
+}
+var bl = hbl.get(target);
+if (!bl) {
+bl = {};
+hbl.set(target, bl);
+}
+var key = this._boundListenerKey(eventName, methodName);
+bl[key] = handler;
+},
+_recallEventHandler: function (host, eventName, target, methodName) {
+var hbl = host.__boundListeners;
+if (!hbl) {
+return;
+}
+var bl = hbl.get(target);
+if (!bl) {
+return;
+}
+var key = this._boundListenerKey(eventName, methodName);
+return bl[key];
+},
+_createEventHandler: function (node, eventName, methodName) {
+var host = this;
+var handler = function (e) {
+if (host[methodName]) {
+host[methodName](e, e.detail);
+} else {
+host._warn(host._logf('_createEventHandler', 'listener method `' + methodName + '` not defined'));
+}
+};
+this._recordEventHandler(host, eventName, node, methodName, handler);
+return handler;
+},
+unlisten: function (node, eventName, methodName) {
+var handler = this._recallEventHandler(this, eventName, node, methodName);
+if (handler) {
+this._unlisten(node, eventName, handler);
+}
+},
+_listen: function (node, eventName, handler) {
+node.addEventListener(eventName, handler);
+},
+_unlisten: function (node, eventName, handler) {
+node.removeEventListener(eventName, handler);
+}
+});
+(function () {
+'use strict';
+var HAS_NATIVE_TA = typeof document.head.style.touchAction === 'string';
+var GESTURE_KEY = '__polymerGestures';
+var HANDLED_OBJ = '__polymerGesturesHandled';
+var TOUCH_ACTION = '__polymerGesturesTouchAction';
+var TAP_DISTANCE = 25;
+var TRACK_DISTANCE = 5;
+var TRACK_LENGTH = 2;
+var MOUSE_TIMEOUT = 2500;
+var MOUSE_EVENTS = [
+'mousedown',
+'mousemove',
+'mouseup',
+'click'
+];
+var MOUSE_WHICH_TO_BUTTONS = [
+0,
+1,
+4,
+2
+];
+var MOUSE_HAS_BUTTONS = function () {
+try {
+return new MouseEvent('test', { buttons: 1 }).buttons === 1;
+} catch (e) {
+return false;
+}
+}();
+var IS_TOUCH_ONLY = navigator.userAgent.match(/iP(?:[oa]d|hone)|Android/);
+var mouseCanceller = function (mouseEvent) {
+mouseEvent[HANDLED_OBJ] = { skip: true };
+if (mouseEvent.type === 'click') {
+var path = Polymer.dom(mouseEvent).path;
+for (var i = 0; i < path.length; i++) {
+if (path[i] === POINTERSTATE.mouse.target) {
+return;
+}
+}
+mouseEvent.preventDefault();
+mouseEvent.stopPropagation();
+}
+};
+function setupTeardownMouseCanceller(setup) {
+for (var i = 0, en; i < MOUSE_EVENTS.length; i++) {
+en = MOUSE_EVENTS[i];
+if (setup) {
+document.addEventListener(en, mouseCanceller, true);
+} else {
+document.removeEventListener(en, mouseCanceller, true);
+}
+}
+}
+function ignoreMouse() {
+if (IS_TOUCH_ONLY) {
+return;
+}
+if (!POINTERSTATE.mouse.mouseIgnoreJob) {
+setupTeardownMouseCanceller(true);
+}
+var unset = function () {
+setupTeardownMouseCanceller();
+POINTERSTATE.mouse.target = null;
+POINTERSTATE.mouse.mouseIgnoreJob = null;
+};
+POINTERSTATE.mouse.mouseIgnoreJob = Polymer.Debounce(POINTERSTATE.mouse.mouseIgnoreJob, unset, MOUSE_TIMEOUT);
+}
+function hasLeftMouseButton(ev) {
+var type = ev.type;
+if (MOUSE_EVENTS.indexOf(type) === -1) {
+return false;
+}
+if (type === 'mousemove') {
+var buttons = ev.buttons === undefined ? 1 : ev.buttons;
+if (ev instanceof window.MouseEvent && !MOUSE_HAS_BUTTONS) {
+buttons = MOUSE_WHICH_TO_BUTTONS[ev.which] || 0;
+}
+return Boolean(buttons & 1);
+} else {
+var button = ev.button === undefined ? 0 : ev.button;
+return button === 0;
+}
+}
+function isSyntheticClick(ev) {
+if (ev.type === 'click') {
+if (ev.detail === 0) {
+return true;
+}
+var t = Gestures.findOriginalTarget(ev);
+var bcr = t.getBoundingClientRect();
+var x = ev.pageX, y = ev.pageY;
+return !(x >= bcr.left && x <= bcr.right && (y >= bcr.top && y <= bcr.bottom));
+}
+return false;
+}
+var POINTERSTATE = {
+mouse: {
+target: null,
+mouseIgnoreJob: null
+},
+touch: {
+x: 0,
+y: 0,
+id: -1,
+scrollDecided: false
+}
+};
+function firstTouchAction(ev) {
+var path = Polymer.dom(ev).path;
+var ta = 'auto';
+for (var i = 0, n; i < path.length; i++) {
+n = path[i];
+if (n[TOUCH_ACTION]) {
+ta = n[TOUCH_ACTION];
+break;
+}
+}
+return ta;
+}
+function trackDocument(stateObj, movefn, upfn) {
+stateObj.movefn = movefn;
+stateObj.upfn = upfn;
+document.addEventListener('mousemove', movefn);
+document.addEventListener('mouseup', upfn);
+}
+function untrackDocument(stateObj) {
+document.removeEventListener('mousemove', stateObj.movefn);
+document.removeEventListener('mouseup', stateObj.upfn);
+}
+var Gestures = {
+gestures: {},
+recognizers: [],
+deepTargetFind: function (x, y) {
+var node = document.elementFromPoint(x, y);
+var next = node;
+while (next && next.shadowRoot) {
+next = next.shadowRoot.elementFromPoint(x, y);
+if (next) {
+node = next;
+}
+}
+return node;
+},
+findOriginalTarget: function (ev) {
+if (ev.path) {
+return ev.path[0];
+}
+return ev.target;
+},
+handleNative: function (ev) {
+var handled;
+var type = ev.type;
+var node = ev.currentTarget;
+var gobj = node[GESTURE_KEY];
+var gs = gobj[type];
+if (!gs) {
+return;
+}
+if (!ev[HANDLED_OBJ]) {
+ev[HANDLED_OBJ] = {};
+if (type.slice(0, 5) === 'touch') {
+var t = ev.changedTouches[0];
+if (type === 'touchstart') {
+if (ev.touches.length === 1) {
+POINTERSTATE.touch.id = t.identifier;
+}
+}
+if (POINTERSTATE.touch.id !== t.identifier) {
+return;
+}
+if (!HAS_NATIVE_TA) {
+if (type === 'touchstart' || type === 'touchmove') {
+Gestures.handleTouchAction(ev);
+}
+}
+if (type === 'touchend') {
+POINTERSTATE.mouse.target = Polymer.dom(ev).rootTarget;
+ignoreMouse(true);
+}
+}
+}
+handled = ev[HANDLED_OBJ];
+if (handled.skip) {
+return;
+}
+var recognizers = Gestures.recognizers;
+for (var i = 0, r; i < recognizers.length; i++) {
+r = recognizers[i];
+if (gs[r.name] && !handled[r.name]) {
+if (r.flow && r.flow.start.indexOf(ev.type) > -1) {
+if (r.reset) {
+r.reset();
+}
+}
+}
+}
+for (var i = 0, r; i < recognizers.length; i++) {
+r = recognizers[i];
+if (gs[r.name] && !handled[r.name]) {
+handled[r.name] = true;
+r[type](ev);
+}
+}
+},
+handleTouchAction: function (ev) {
+var t = ev.changedTouches[0];
+var type = ev.type;
+if (type === 'touchstart') {
+POINTERSTATE.touch.x = t.clientX;
+POINTERSTATE.touch.y = t.clientY;
+POINTERSTATE.touch.scrollDecided = false;
+} else if (type === 'touchmove') {
+if (POINTERSTATE.touch.scrollDecided) {
+return;
+}
+POINTERSTATE.touch.scrollDecided = true;
+var ta = firstTouchAction(ev);
+var prevent = false;
+var dx = Math.abs(POINTERSTATE.touch.x - t.clientX);
+var dy = Math.abs(POINTERSTATE.touch.y - t.clientY);
+if (!ev.cancelable) {
+} else if (ta === 'none') {
+prevent = true;
+} else if (ta === 'pan-x') {
+prevent = dy > dx;
+} else if (ta === 'pan-y') {
+prevent = dx > dy;
+}
+if (prevent) {
+ev.preventDefault();
+} else {
+Gestures.prevent('track');
+}
+}
+},
+add: function (node, evType, handler) {
+var recognizer = this.gestures[evType];
+var deps = recognizer.deps;
+var name = recognizer.name;
+var gobj = node[GESTURE_KEY];
+if (!gobj) {
+node[GESTURE_KEY] = gobj = {};
+}
+for (var i = 0, dep, gd; i < deps.length; i++) {
+dep = deps[i];
+if (IS_TOUCH_ONLY && MOUSE_EVENTS.indexOf(dep) > -1) {
+continue;
+}
+gd = gobj[dep];
+if (!gd) {
+gobj[dep] = gd = { _count: 0 };
+}
+if (gd._count === 0) {
+node.addEventListener(dep, this.handleNative);
+}
+gd[name] = (gd[name] || 0) + 1;
+gd._count = (gd._count || 0) + 1;
+}
+node.addEventListener(evType, handler);
+if (recognizer.touchAction) {
+this.setTouchAction(node, recognizer.touchAction);
+}
+},
+remove: function (node, evType, handler) {
+var recognizer = this.gestures[evType];
+var deps = recognizer.deps;
+var name = recognizer.name;
+var gobj = node[GESTURE_KEY];
+if (gobj) {
+for (var i = 0, dep, gd; i < deps.length; i++) {
+dep = deps[i];
+gd = gobj[dep];
+if (gd && gd[name]) {
+gd[name] = (gd[name] || 1) - 1;
+gd._count = (gd._count || 1) - 1;
+if (gd._count === 0) {
+node.removeEventListener(dep, this.handleNative);
+}
+}
+}
+}
+node.removeEventListener(evType, handler);
+},
+register: function (recog) {
+this.recognizers.push(recog);
+for (var i = 0; i < recog.emits.length; i++) {
+this.gestures[recog.emits[i]] = recog;
+}
+},
+findRecognizerByEvent: function (evName) {
+for (var i = 0, r; i < this.recognizers.length; i++) {
+r = this.recognizers[i];
+for (var j = 0, n; j < r.emits.length; j++) {
+n = r.emits[j];
+if (n === evName) {
+return r;
+}
+}
+}
+return null;
+},
+setTouchAction: function (node, value) {
+if (HAS_NATIVE_TA) {
+node.style.touchAction = value;
+}
+node[TOUCH_ACTION] = value;
+},
+fire: function (target, type, detail) {
+var ev = Polymer.Base.fire(type, detail, {
+node: target,
+bubbles: true,
+cancelable: true
+});
+if (ev.defaultPrevented) {
+var se = detail.sourceEvent;
+if (se && se.preventDefault) {
+se.preventDefault();
+}
+}
+},
+prevent: function (evName) {
+var recognizer = this.findRecognizerByEvent(evName);
+if (recognizer.info) {
+recognizer.info.prevent = true;
+}
+}
+};
+Gestures.register({
+name: 'downup',
+deps: [
+'mousedown',
+'touchstart',
+'touchend'
+],
+flow: {
+start: [
+'mousedown',
+'touchstart'
+],
+end: [
+'mouseup',
+'touchend'
+]
+},
+emits: [
+'down',
+'up'
+],
+info: {
+movefn: function () {
+},
+upfn: function () {
+}
+},
+reset: function () {
+untrackDocument(this.info);
+},
+mousedown: function (e) {
+if (!hasLeftMouseButton(e)) {
+return;
+}
+var t = Gestures.findOriginalTarget(e);
+var self = this;
+var movefn = function movefn(e) {
+if (!hasLeftMouseButton(e)) {
+self.fire('up', t, e);
+untrackDocument(self.info);
+}
+};
+var upfn = function upfn(e) {
+if (hasLeftMouseButton(e)) {
+self.fire('up', t, e);
+}
+untrackDocument(self.info);
+};
+trackDocument(this.info, movefn, upfn);
+this.fire('down', t, e);
+},
+touchstart: function (e) {
+this.fire('down', Gestures.findOriginalTarget(e), e.changedTouches[0]);
+},
+touchend: function (e) {
+this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0]);
+},
+fire: function (type, target, event) {
+var self = this;
+Gestures.fire(target, type, {
+x: event.clientX,
+y: event.clientY,
+sourceEvent: event,
+prevent: Gestures.prevent.bind(Gestures)
+});
+}
+});
+Gestures.register({
+name: 'track',
+touchAction: 'none',
+deps: [
+'mousedown',
+'touchstart',
+'touchmove',
+'touchend'
+],
+flow: {
+start: [
+'mousedown',
+'touchstart'
+],
+end: [
+'mouseup',
+'touchend'
+]
+},
+emits: ['track'],
+info: {
+x: 0,
+y: 0,
+state: 'start',
+started: false,
+moves: [],
+addMove: function (move) {
+if (this.moves.length > TRACK_LENGTH) {
+this.moves.shift();
+}
+this.moves.push(move);
+},
+movefn: function () {
+},
+upfn: function () {
+},
+prevent: false
+},
+reset: function () {
+this.info.state = 'start';
+this.info.started = false;
+this.info.moves = [];
+this.info.x = 0;
+this.info.y = 0;
+this.info.prevent = false;
+untrackDocument(this.info);
+},
+hasMovedEnough: function (x, y) {
+if (this.info.prevent) {
+return false;
+}
+if (this.info.started) {
+return true;
+}
+var dx = Math.abs(this.info.x - x);
+var dy = Math.abs(this.info.y - y);
+return dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE;
+},
+mousedown: function (e) {
+if (!hasLeftMouseButton(e)) {
+return;
+}
+var t = Gestures.findOriginalTarget(e);
+var self = this;
+var movefn = function movefn(e) {
+var x = e.clientX, y = e.clientY;
+if (self.hasMovedEnough(x, y)) {
+self.info.state = self.info.started ? e.type === 'mouseup' ? 'end' : 'track' : 'start';
+self.info.addMove({
+x: x,
+y: y
+});
+if (!hasLeftMouseButton(e)) {
+self.info.state = 'end';
+untrackDocument(self.info);
+}
+self.fire(t, e);
+self.info.started = true;
+}
+};
+var upfn = function upfn(e) {
+if (self.info.started) {
+Gestures.prevent('tap');
+movefn(e);
+}
+untrackDocument(self.info);
+};
+trackDocument(this.info, movefn, upfn);
+this.info.x = e.clientX;
+this.info.y = e.clientY;
+},
+touchstart: function (e) {
+var ct = e.changedTouches[0];
+this.info.x = ct.clientX;
+this.info.y = ct.clientY;
+},
+touchmove: function (e) {
+var t = Gestures.findOriginalTarget(e);
+var ct = e.changedTouches[0];
+var x = ct.clientX, y = ct.clientY;
+if (this.hasMovedEnough(x, y)) {
+this.info.addMove({
+x: x,
+y: y
+});
+this.fire(t, ct);
+this.info.state = 'track';
+this.info.started = true;
+}
+},
+touchend: function (e) {
+var t = Gestures.findOriginalTarget(e);
+var ct = e.changedTouches[0];
+if (this.info.started) {
+Gestures.prevent('tap');
+this.info.state = 'end';
+this.info.addMove({
+x: ct.clientX,
+y: ct.clientY
+});
+this.fire(t, ct);
+}
+},
+fire: function (target, touch) {
+var secondlast = this.info.moves[this.info.moves.length - 2];
+var lastmove = this.info.moves[this.info.moves.length - 1];
+var dx = lastmove.x - this.info.x;
+var dy = lastmove.y - this.info.y;
+var ddx, ddy = 0;
+if (secondlast) {
+ddx = lastmove.x - secondlast.x;
+ddy = lastmove.y - secondlast.y;
+}
+return Gestures.fire(target, 'track', {
+state: this.info.state,
+x: touch.clientX,
+y: touch.clientY,
+dx: dx,
+dy: dy,
+ddx: ddx,
+ddy: ddy,
+sourceEvent: touch,
+hover: function () {
+return Gestures.deepTargetFind(touch.clientX, touch.clientY);
+}
+});
+}
+});
+Gestures.register({
+name: 'tap',
+deps: [
+'mousedown',
+'click',
+'touchstart',
+'touchend'
+],
+flow: {
+start: [
+'mousedown',
+'touchstart'
+],
+end: [
+'click',
+'touchend'
+]
+},
+emits: ['tap'],
+info: {
+x: NaN,
+y: NaN,
+prevent: false
+},
+reset: function () {
+this.info.x = NaN;
+this.info.y = NaN;
+this.info.prevent = false;
+},
+save: function (e) {
+this.info.x = e.clientX;
+this.info.y = e.clientY;
+},
+mousedown: function (e) {
+if (hasLeftMouseButton(e)) {
+this.save(e);
+}
+},
+click: function (e) {
+if (hasLeftMouseButton(e)) {
+this.forward(e);
+}
+},
+touchstart: function (e) {
+this.save(e.changedTouches[0]);
+},
+touchend: function (e) {
+this.forward(e.changedTouches[0]);
+},
+forward: function (e) {
+var dx = Math.abs(e.clientX - this.info.x);
+var dy = Math.abs(e.clientY - this.info.y);
+var t = Gestures.findOriginalTarget(e);
+if (isNaN(dx) || isNaN(dy) || dx <= TAP_DISTANCE && dy <= TAP_DISTANCE || isSyntheticClick(e)) {
+if (!this.info.prevent) {
+Gestures.fire(t, 'tap', {
+x: e.clientX,
+y: e.clientY,
+sourceEvent: e
+});
+}
+}
+}
+});
+var DIRECTION_MAP = {
+x: 'pan-x',
+y: 'pan-y',
+none: 'none',
+all: 'auto'
+};
+Polymer.Base._addFeature({
+_listen: function (node, eventName, handler) {
+if (Gestures.gestures[eventName]) {
+Gestures.add(node, eventName, handler);
+} else {
+node.addEventListener(eventName, handler);
+}
+},
+_unlisten: function (node, eventName, handler) {
+if (Gestures.gestures[eventName]) {
+Gestures.remove(node, eventName, handler);
+} else {
+node.removeEventListener(eventName, handler);
+}
+},
+setScrollDirection: function (direction, node) {
+node = node || this;
+Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto');
+}
+});
+Polymer.Gestures = Gestures;
+}());
+Polymer.Async = {
+_currVal: 0,
+_lastVal: 0,
+_callbacks: [],
+_twiddleContent: 0,
+_twiddle: document.createTextNode(''),
+run: function (callback, waitTime) {
+if (waitTime > 0) {
+return ~setTimeout(callback, waitTime);
+} else {
+this._twiddle.textContent = this._twiddleContent++;
+this._callbacks.push(callback);
+return this._currVal++;
+}
+},
+cancel: function (handle) {
+if (handle < 0) {
+clearTimeout(~handle);
+} else {
+var idx = handle - this._lastVal;
+if (idx >= 0) {
+if (!this._callbacks[idx]) {
+throw 'invalid async handle: ' + handle;
+}
+this._callbacks[idx] = null;
+}
+}
+},
+_atEndOfMicrotask: function () {
+var len = this._callbacks.length;
+for (var i = 0; i < len; i++) {
+var cb = this._callbacks[i];
+if (cb) {
+try {
+cb();
+} catch (e) {
+i++;
+this._callbacks.splice(0, i);
+this._lastVal += i;
+this._twiddle.textContent = this._twiddleContent++;
+throw e;
+}
+}
+}
+this._callbacks.splice(0, len);
+this._lastVal += len;
+}
+};
+new (window.MutationObserver || JsMutationObserver)(Polymer.Async._atEndOfMicrotask.bind(Polymer.Async)).observe(Polymer.Async._twiddle, { characterData: true });
+Polymer.Debounce = function () {
+var Async = Polymer.Async;
+var Debouncer = function (context) {
+this.context = context;
+this.boundComplete = this.complete.bind(this);
+};
+Debouncer.prototype = {
+go: function (callback, wait) {
+var h;
+this.finish = function () {
+Async.cancel(h);
+};
+h = Async.run(this.boundComplete, wait);
+this.callback = callback;
+},
+stop: function () {
+if (this.finish) {
+this.finish();
+this.finish = null;
+}
+},
+complete: function () {
+if (this.finish) {
+this.stop();
+this.callback.call(this.context);
+}
+}
+};
+function debounce(debouncer, callback, wait) {
+if (debouncer) {
+debouncer.stop();
+} else {
+debouncer = new Debouncer(this);
+}
+debouncer.go(callback, wait);
+return debouncer;
+}
+return debounce;
+}();
+Polymer.Base._addFeature({
+$$: function (slctr) {
+return Polymer.dom(this.root).querySelector(slctr);
+},
+toggleClass: function (name, bool, node) {
+node = node || this;
+if (arguments.length == 1) {
+bool = !node.classList.contains(name);
+}
+if (bool) {
+Polymer.dom(node).classList.add(name);
+} else {
+Polymer.dom(node).classList.remove(name);
+}
+},
+toggleAttribute: function (name, bool, node) {
+node = node || this;
+if (arguments.length == 1) {
+bool = !node.hasAttribute(name);
+}
+if (bool) {
+Polymer.dom(node).setAttribute(name, '');
+} else {
+Polymer.dom(node).removeAttribute(name);
+}
+},
+classFollows: function (name, toElement, fromElement) {
+if (fromElement) {
+Polymer.dom(fromElement).classList.remove(name);
+}
+if (toElement) {
+Polymer.dom(toElement).classList.add(name);
+}
+},
+attributeFollows: function (name, toElement, fromElement) {
+if (fromElement) {
+Polymer.dom(fromElement).removeAttribute(name);
+}
+if (toElement) {
+Polymer.dom(toElement).setAttribute(name, '');
+}
+},
+getContentChildNodes: function (slctr) {
+var content = Polymer.dom(this.root).querySelector(slctr || 'content');
+return content ? Polymer.dom(content).getDistributedNodes() : [];
+},
+getContentChildren: function (slctr) {
+return this.getContentChildNodes(slctr).filter(function (n) {
+return n.nodeType === Node.ELEMENT_NODE;
+});
+},
+fire: function (type, detail, options) {
+options = options || Polymer.nob;
+var node = options.node || this;
+var detail = detail === null || detail === undefined ? Polymer.nob : detail;
+var bubbles = options.bubbles === undefined ? true : options.bubbles;
+var cancelable = Boolean(options.cancelable);
+var event = new CustomEvent(type, {
+bubbles: Boolean(bubbles),
+cancelable: cancelable,
+detail: detail
+});
+node.dispatchEvent(event);
+return event;
+},
+async: function (callback, waitTime) {
+return Polymer.Async.run(callback.bind(this), waitTime);
+},
+cancelAsync: function (handle) {
+Polymer.Async.cancel(handle);
+},
+arrayDelete: function (path, item) {
+var index;
+if (Array.isArray(path)) {
+index = path.indexOf(item);
+if (index >= 0) {
+return path.splice(index, 1);
+}
+} else {
+var arr = this.get(path);
+index = arr.indexOf(item);
+if (index >= 0) {
+return this.splice(path, index, 1);
+}
+}
+},
+transform: function (transform, node) {
+node = node || this;
+node.style.webkitTransform = transform;
+node.style.transform = transform;
+},
+translate3d: function (x, y, z, node) {
+node = node || this;
+this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node);
+},
+importHref: function (href, onload, onerror) {
+var l = document.createElement('link');
+l.rel = 'import';
+l.href = href;
+if (onload) {
+l.onload = onload.bind(this);
+}
+if (onerror) {
+l.onerror = onerror.bind(this);
+}
+document.head.appendChild(l);
+return l;
+},
+create: function (tag, props) {
+var elt = document.createElement(tag);
+if (props) {
+for (var n in props) {
+elt[n] = props[n];
+}
+}
+return elt;
+}
+});
+Polymer.Bind = {
+prepareModel: function (model) {
+model._propertyEffects = {};
+model._bindListeners = [];
+Polymer.Base.mixin(model, this._modelApi);
+},
+_modelApi: {
+_notifyChange: function (property) {
+var eventName = Polymer.CaseMap.camelToDashCase(property) + '-changed';
+Polymer.Base.fire(eventName, { value: this[property] }, {
+bubbles: false,
+node: this
+});
+},
+_propertySetter: function (property, value, effects, fromAbove) {
+var old = this.__data__[property];
+if (old !== value && (old === old || value === value)) {
+this.__data__[property] = value;
+if (typeof value == 'object') {
+this._clearPath(property);
+}
+if (this._propertyChanged) {
+this._propertyChanged(property, value, old);
+}
+if (effects) {
+this._effectEffects(property, value, effects, old, fromAbove);
+}
+}
+return old;
+},
+__setProperty: function (property, value, quiet, node) {
+node = node || this;
+var effects = node._propertyEffects && node._propertyEffects[property];
+if (effects) {
+node._propertySetter(property, value, effects, quiet);
+} else {
+node[property] = value;
+}
+},
+_effectEffects: function (property, value, effects, old, fromAbove) {
+effects.forEach(function (fx) {
+var fn = Polymer.Bind['_' + fx.kind + 'Effect'];
+if (fn) {
+fn.call(this, property, value, fx.effect, old, fromAbove);
+}
+}, this);
+},
+_clearPath: function (path) {
+for (var prop in this.__data__) {
+if (prop.indexOf(path + '.') === 0) {
+this.__data__[prop] = undefined;
+}
+}
+}
+},
+ensurePropertyEffects: function (model, property) {
+var fx = model._propertyEffects[property];
+if (!fx) {
+fx = model._propertyEffects[property] = [];
+}
+return fx;
+},
+addPropertyEffect: function (model, property, kind, effect) {
+var fx = this.ensurePropertyEffects(model, property);
+fx.push({
+kind: kind,
+effect: effect
+});
+},
+createBindings: function (model) {
+var fx$ = model._propertyEffects;
+if (fx$) {
+for (var n in fx$) {
+var fx = fx$[n];
+fx.sort(this._sortPropertyEffects);
+this._createAccessors(model, n, fx);
+}
+}
+},
+_sortPropertyEffects: function () {
+var EFFECT_ORDER = {
+'compute': 0,
+'annotation': 1,
+'computedAnnotation': 2,
+'reflect': 3,
+'notify': 4,
+'observer': 5,
+'complexObserver': 6,
+'function': 7
+};
+return function (a, b) {
+return EFFECT_ORDER[a.kind] - EFFECT_ORDER[b.kind];
+};
+}(),
+_createAccessors: function (model, property, effects) {
+var defun = {
+get: function () {
+return this.__data__[property];
+}
+};
+var setter = function (value) {
+this._propertySetter(property, value, effects);
+};
+var info = model.getPropertyInfo && model.getPropertyInfo(property);
+if (info && info.readOnly) {
+if (!info.computed) {
+model['_set' + this.upper(property)] = setter;
+}
+} else {
+defun.set = setter;
+}
+Object.defineProperty(model, property, defun);
+},
+upper: function (name) {
+return name[0].toUpperCase() + name.substring(1);
+},
+_addAnnotatedListener: function (model, index, property, path, event) {
+var fn = this._notedListenerFactory(property, path, this._isStructured(path), this._isEventBogus);
+var eventName = event || Polymer.CaseMap.camelToDashCase(property) + '-changed';
+model._bindListeners.push({
+index: index,
+property: property,
+path: path,
+changedFn: fn,
+event: eventName
+});
+},
+_isStructured: function (path) {
+return path.indexOf('.') > 0;
+},
+_isEventBogus: function (e, target) {
+return e.path && e.path[0] !== target;
+},
+_notedListenerFactory: function (property, path, isStructured, bogusTest) {
+return function (e, target) {
+if (!bogusTest(e, target)) {
+if (e.detail && e.detail.path) {
+this.notifyPath(this._fixPath(path, property, e.detail.path), e.detail.value);
+} else {
+var value = target[property];
+if (!isStructured) {
+this[path] = target[property];
+} else {
+if (this.__data__[path] != value) {
+this.set(path, value);
+}
+}
+}
+}
+};
+},
+prepareInstance: function (inst) {
+inst.__data__ = Object.create(null);
+},
+setupBindListeners: function (inst) {
+inst._bindListeners.forEach(function (info) {
+var node = inst._nodes[info.index];
+node.addEventListener(info.event, inst._notifyListener.bind(inst, info.changedFn));
+});
+}
+};
+Polymer.Base.extend(Polymer.Bind, {
+_shouldAddListener: function (effect) {
+return effect.name && effect.mode === '{' && !effect.negate && effect.kind != 'attribute';
+},
+_annotationEffect: function (source, value, effect) {
+if (source != effect.value) {
+value = this.get(effect.value);
+this.__data__[effect.value] = value;
+}
+var calc = effect.negate ? !value : value;
+if (!effect.customEvent || this._nodes[effect.index][effect.name] !== calc) {
+return this._applyEffectValue(calc, effect);
+}
+},
+_reflectEffect: function (source) {
+this.reflectPropertyToAttribute(source);
+},
+_notifyEffect: function (source, value, effect, old, fromAbove) {
+if (!fromAbove) {
+this._notifyChange(source);
+}
+},
+_functionEffect: function (source, value, fn, old, fromAbove) {
+fn.call(this, source, value, old, fromAbove);
+},
+_observerEffect: function (source, value, effect, old) {
+var fn = this[effect.method];
+if (fn) {
+fn.call(this, value, old);
+} else {
+this._warn(this._logf('_observerEffect', 'observer method `' + effect.method + '` not defined'));
+}
+},
+_complexObserverEffect: function (source, value, effect) {
+var fn = this[effect.method];
+if (fn) {
+var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
+if (args) {
+fn.apply(this, args);
+}
+} else {
+this._warn(this._logf('_complexObserverEffect', 'observer method `' + effect.method + '` not defined'));
+}
+},
+_computeEffect: function (source, value, effect) {
+var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
+if (args) {
+var fn = this[effect.method];
+if (fn) {
+this.__setProperty(effect.property, fn.apply(this, args));
+} else {
+this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '` not defined'));
+}
+}
+},
+_annotatedComputationEffect: function (source, value, effect) {
+var computedHost = this._rootDataHost || this;
+var fn = computedHost[effect.method];
+if (fn) {
+var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
+if (args) {
+var computedvalue = fn.apply(computedHost, args);
+if (effect.negate) {
+computedvalue = !computedvalue;
+}
+this._applyEffectValue(computedvalue, effect);
+}
+} else {
+computedHost._warn(computedHost._logf('_annotatedComputationEffect', 'compute method `' + effect.method + '` not defined'));
+}
+},
+_marshalArgs: function (model, effect, path, value) {
+var values = [];
+var args = effect.args;
+for (var i = 0, l = args.length; i < l; i++) {
+var arg = args[i];
+var name = arg.name;
+var v;
+if (arg.literal) {
+v = arg.value;
+} else if (arg.structured) {
+v = Polymer.Base.get(name, model);
+} else {
+v = model[name];
+}
+if (args.length > 1 && v === undefined) {
+return;
+}
+if (arg.wildcard) {
+var baseChanged = name.indexOf(path + '.') === 0;
+var matches = effect.trigger.name.indexOf(name) === 0 && !baseChanged;
+values[i] = {
+path: matches ? path : name,
+value: matches ? value : v,
+base: v
+};
+} else {
+values[i] = v;
+}
+}
+return values;
+}
+});
+Polymer.Base._addFeature({
+_addPropertyEffect: function (property, kind, effect) {
+Polymer.Bind.addPropertyEffect(this, property, kind, effect);
+},
+_prepEffects: function () {
+Polymer.Bind.prepareModel(this);
+this._addAnnotationEffects(this._notes);
+},
+_prepBindings: function () {
+Polymer.Bind.createBindings(this);
+},
+_addPropertyEffects: function (properties) {
+if (properties) {
+for (var p in properties) {
+var prop = properties[p];
+if (prop.observer) {
+this._addObserverEffect(p, prop.observer);
+}
+if (prop.computed) {
+prop.readOnly = true;
+this._addComputedEffect(p, prop.computed);
+}
+if (prop.notify) {
+this._addPropertyEffect(p, 'notify');
+}
+if (prop.reflectToAttribute) {
+this._addPropertyEffect(p, 'reflect');
+}
+if (prop.readOnly) {
+Polymer.Bind.ensurePropertyEffects(this, p);
+}
+}
+}
+},
+_addComputedEffect: function (name, expression) {
+var sig = this._parseMethod(expression);
+sig.args.forEach(function (arg) {
+this._addPropertyEffect(arg.model, 'compute', {
+method: sig.method,
+args: sig.args,
+trigger: arg,
+property: name
+});
+}, this);
+},
+_addObserverEffect: function (property, observer) {
+this._addPropertyEffect(property, 'observer', {
+method: observer,
+property: property
+});
+},
+_addComplexObserverEffects: function (observers) {
+if (observers) {
+observers.forEach(function (observer) {
+this._addComplexObserverEffect(observer);
+}, this);
+}
+},
+_addComplexObserverEffect: function (observer) {
+var sig = this._parseMethod(observer);
+sig.args.forEach(function (arg) {
+this._addPropertyEffect(arg.model, 'complexObserver', {
+method: sig.method,
+args: sig.args,
+trigger: arg
+});
+}, this);
+},
+_addAnnotationEffects: function (notes) {
+this._nodes = [];
+notes.forEach(function (note) {
+var index = this._nodes.push(note) - 1;
+note.bindings.forEach(function (binding) {
+this._addAnnotationEffect(binding, index);
+}, this);
+}, this);
+},
+_addAnnotationEffect: function (note, index) {
+if (Polymer.Bind._shouldAddListener(note)) {
+Polymer.Bind._addAnnotatedListener(this, index, note.name, note.value, note.event);
+}
+if (note.signature) {
+this._addAnnotatedComputationEffect(note, index);
+} else {
+note.index = index;
+this._addPropertyEffect(note.model, 'annotation', note);
+}
+},
+_addAnnotatedComputationEffect: function (note, index) {
+var sig = note.signature;
+if (sig.static) {
+this.__addAnnotatedComputationEffect('__static__', index, note, sig, null);
+} else {
+sig.args.forEach(function (arg) {
+if (!arg.literal) {
+this.__addAnnotatedComputationEffect(arg.model, index, note, sig, arg);
+}
+}, this);
+}
+},
+__addAnnotatedComputationEffect: function (property, index, note, sig, trigger) {
+this._addPropertyEffect(property, 'annotatedComputation', {
+index: index,
+kind: note.kind,
+property: note.name,
+negate: note.negate,
+method: sig.method,
+args: sig.args,
+trigger: trigger
+});
+},
+_parseMethod: function (expression) {
+var m = expression.match(/([^\s]+)\((.*)\)/);
+if (m) {
+var sig = {
+method: m[1],
+static: true
+};
+if (m[2].trim()) {
+var args = m[2].replace(/\\,/g, '&comma;').split(',');
+return this._parseArgs(args, sig);
+} else {
+sig.args = Polymer.nar;
+return sig;
+}
+}
+},
+_parseArgs: function (argList, sig) {
+sig.args = argList.map(function (rawArg) {
+var arg = this._parseArg(rawArg);
+if (!arg.literal) {
+sig.static = false;
+}
+return arg;
+}, this);
+return sig;
+},
+_parseArg: function (rawArg) {
+var arg = rawArg.trim().replace(/&comma;/g, ',').replace(/\\(.)/g, '$1');
+var a = {
+name: arg,
+model: this._modelForPath(arg)
+};
+var fc = arg[0];
+if (fc === '-') {
+fc = arg[1];
+}
+if (fc >= '0' && fc <= '9') {
+fc = '#';
+}
+switch (fc) {
+case '\'':
+case '"':
+a.value = arg.slice(1, -1);
+a.literal = true;
+break;
+case '#':
+a.value = Number(arg);
+a.literal = true;
+break;
+}
+if (!a.literal) {
+a.structured = arg.indexOf('.') > 0;
+if (a.structured) {
+a.wildcard = arg.slice(-2) == '.*';
+if (a.wildcard) {
+a.name = arg.slice(0, -2);
+}
+}
+}
+return a;
+},
+_marshalInstanceEffects: function () {
+Polymer.Bind.prepareInstance(this);
+Polymer.Bind.setupBindListeners(this);
+},
+_applyEffectValue: function (value, info) {
+var node = this._nodes[info.index];
+var property = info.property || info.name || 'textContent';
+if (info.kind == 'attribute') {
+this.serializeValueToAttribute(value, property, node);
+} else {
+if (property === 'className') {
+value = this._scopeElementClass(node, value);
+}
+if (property === 'textContent' || node.localName == 'input' && property == 'value') {
+value = value == undefined ? '' : value;
+}
+return node[property] = value;
+}
+},
+_executeStaticEffects: function () {
+if (this._propertyEffects.__static__) {
+this._effectEffects('__static__', null, this._propertyEffects.__static__);
+}
+}
+});
+Polymer.Base._addFeature({
+_setupConfigure: function (initialConfig) {
+this._config = {};
+for (var i in initialConfig) {
+if (initialConfig[i] !== undefined) {
+this._config[i] = initialConfig[i];
+}
+}
+this._handlers = [];
+},
+_marshalAttributes: function () {
+this._takeAttributesToModel(this._config);
+},
+_attributeChangedImpl: function (name) {
+var model = this._clientsReadied ? this : this._config;
+this._setAttributeToProperty(model, name);
+},
+_configValue: function (name, value) {
+this._config[name] = value;
+},
+_beforeClientsReady: function () {
+this._configure();
+},
+_configure: function () {
+this._configureAnnotationReferences();
+this._aboveConfig = this.mixin({}, this._config);
+var config = {};
+this.behaviors.forEach(function (b) {
+this._configureProperties(b.properties, config);
+}, this);
+this._configureProperties(this.properties, config);
+this._mixinConfigure(config, this._aboveConfig);
+this._config = config;
+this._distributeConfig(this._config);
+},
+_configureProperties: function (properties, config) {
+for (var i in properties) {
+var c = properties[i];
+if (c.value !== undefined) {
+var value = c.value;
+if (typeof value == 'function') {
+value = value.call(this, this._config);
+}
+config[i] = value;
+}
+}
+},
+_mixinConfigure: function (a, b) {
+for (var prop in b) {
+if (!this.getPropertyInfo(prop).readOnly) {
+a[prop] = b[prop];
+}
+}
+},
+_distributeConfig: function (config) {
+var fx$ = this._propertyEffects;
+if (fx$) {
+for (var p in config) {
+var fx = fx$[p];
+if (fx) {
+for (var i = 0, l = fx.length, x; i < l && (x = fx[i]); i++) {
+if (x.kind === 'annotation') {
+var node = this._nodes[x.effect.index];
+if (node._configValue) {
+var value = p === x.effect.value ? config[p] : this.get(x.effect.value, config);
+node._configValue(x.effect.name, value);
+}
+}
+}
+}
+}
+}
+},
+_afterClientsReady: function () {
+this._executeStaticEffects();
+this._applyConfig(this._config, this._aboveConfig);
+this._flushHandlers();
+},
+_applyConfig: function (config, aboveConfig) {
+for (var n in config) {
+if (this[n] === undefined) {
+this.__setProperty(n, config[n], n in aboveConfig);
+}
+}
+},
+_notifyListener: function (fn, e) {
+if (!this._clientsReadied) {
+this._queueHandler([
+fn,
+e,
+e.target
+]);
+} else {
+return fn.call(this, e, e.target);
+}
+},
+_queueHandler: function (args) {
+this._handlers.push(args);
+},
+_flushHandlers: function () {
+var h$ = this._handlers;
+for (var i = 0, l = h$.length, h; i < l && (h = h$[i]); i++) {
+h[0].call(this, h[1], h[2]);
+}
+this._handlers = [];
+}
+});
+(function () {
+'use strict';
+Polymer.Base._addFeature({
+notifyPath: function (path, value, fromAbove) {
+var old = this._propertySetter(path, value);
+if (old !== value && (old === old || value === value)) {
+this._pathEffector(path, value);
+if (!fromAbove) {
+this._notifyPath(path, value);
+}
+return true;
+}
+},
+_getPathParts: function (path) {
+if (Array.isArray(path)) {
+var parts = [];
+for (var i = 0; i < path.length; i++) {
+var args = path[i].toString().split('.');
+for (var j = 0; j < args.length; j++) {
+parts.push(args[j]);
+}
+}
+return parts;
+} else {
+return path.toString().split('.');
+}
+},
+set: function (path, value, root) {
+var prop = root || this;
+var parts = this._getPathParts(path);
+var array;
+var last = parts[parts.length - 1];
+if (parts.length > 1) {
+for (var i = 0; i < parts.length - 1; i++) {
+var part = parts[i];
+prop = prop[part];
+if (array && parseInt(part) == part) {
+parts[i] = Polymer.Collection.get(array).getKey(prop);
+}
+if (!prop) {
+return;
+}
+array = Array.isArray(prop) ? prop : null;
+}
+if (array && parseInt(last) == last) {
+var coll = Polymer.Collection.get(array);
+var old = prop[last];
+var key = coll.getKey(old);
+parts[i] = key;
+coll.setItem(key, value);
+}
+prop[last] = value;
+if (!root) {
+this.notifyPath(parts.join('.'), value);
+}
+} else {
+prop[path] = value;
+}
+},
+get: function (path, root) {
+var prop = root || this;
+var parts = this._getPathParts(path);
+var last = parts.pop();
+while (parts.length) {
+prop = prop[parts.shift()];
+if (!prop) {
+return;
+}
+}
+return prop[last];
+},
+_pathEffector: function (path, value) {
+var model = this._modelForPath(path);
+var fx$ = this._propertyEffects[model];
+if (fx$) {
+fx$.forEach(function (fx) {
+var fxFn = this['_' + fx.kind + 'PathEffect'];
+if (fxFn) {
+fxFn.call(this, path, value, fx.effect);
+}
+}, this);
+}
+if (this._boundPaths) {
+this._notifyBoundPaths(path, value);
+}
+},
+_annotationPathEffect: function (path, value, effect) {
+if (effect.value === path || effect.value.indexOf(path + '.') === 0) {
+Polymer.Bind._annotationEffect.call(this, path, value, effect);
+} else if (path.indexOf(effect.value + '.') === 0 && !effect.negate) {
+var node = this._nodes[effect.index];
+if (node && node.notifyPath) {
+var p = this._fixPath(effect.name, effect.value, path);
+node.notifyPath(p, value, true);
+}
+}
+},
+_complexObserverPathEffect: function (path, value, effect) {
+if (this._pathMatchesEffect(path, effect)) {
+Polymer.Bind._complexObserverEffect.call(this, path, value, effect);
+}
+},
+_computePathEffect: function (path, value, effect) {
+if (this._pathMatchesEffect(path, effect)) {
+Polymer.Bind._computeEffect.call(this, path, value, effect);
+}
+},
+_annotatedComputationPathEffect: function (path, value, effect) {
+if (this._pathMatchesEffect(path, effect)) {
+Polymer.Bind._annotatedComputationEffect.call(this, path, value, effect);
+}
+},
+_pathMatchesEffect: function (path, effect) {
+var effectArg = effect.trigger.name;
+return effectArg == path || effectArg.indexOf(path + '.') === 0 || effect.trigger.wildcard && path.indexOf(effectArg) === 0;
+},
+linkPaths: function (to, from) {
+this._boundPaths = this._boundPaths || {};
+if (from) {
+this._boundPaths[to] = from;
+} else {
+this.unlinkPaths(to);
+}
+},
+unlinkPaths: function (path) {
+if (this._boundPaths) {
+delete this._boundPaths[path];
+}
+},
+_notifyBoundPaths: function (path, value) {
+for (var a in this._boundPaths) {
+var b = this._boundPaths[a];
+if (path.indexOf(a + '.') == 0) {
+this.notifyPath(this._fixPath(b, a, path), value);
+} else if (path.indexOf(b + '.') == 0) {
+this.notifyPath(this._fixPath(a, b, path), value);
+}
+}
+},
+_fixPath: function (property, root, path) {
+return property + path.slice(root.length);
+},
+_notifyPath: function (path, value) {
+var rootName = this._modelForPath(path);
+var dashCaseName = Polymer.CaseMap.camelToDashCase(rootName);
+var eventName = dashCaseName + this._EVENT_CHANGED;
+this.fire(eventName, {
+path: path,
+value: value
+}, { bubbles: false });
+},
+_modelForPath: function (path) {
+var dot = path.indexOf('.');
+return dot < 0 ? path : path.slice(0, dot);
+},
+_EVENT_CHANGED: '-changed',
+_notifySplice: function (array, path, index, added, removed) {
+var splices = [{
+index: index,
+addedCount: added,
+removed: removed,
+object: array,
+type: 'splice'
+}];
+var change = {
+keySplices: Polymer.Collection.applySplices(array, splices),
+indexSplices: splices
+};
+this.set(path + '.splices', change);
+if (added != removed.length) {
+this.notifyPath(path + '.length', array.length);
+}
+change.keySplices = null;
+change.indexSplices = null;
+},
+push: function (path) {
+var array = this.get(path);
+var args = Array.prototype.slice.call(arguments, 1);
+var len = array.length;
+var ret = array.push.apply(array, args);
+if (args.length) {
+this._notifySplice(array, path, len, args.length, []);
+}
+return ret;
+},
+pop: function (path) {
+var array = this.get(path);
+var hadLength = Boolean(array.length);
+var args = Array.prototype.slice.call(arguments, 1);
+var ret = array.pop.apply(array, args);
+if (hadLength) {
+this._notifySplice(array, path, array.length, 0, [ret]);
+}
+return ret;
+},
+splice: function (path, start, deleteCount) {
+var array = this.get(path);
+if (start < 0) {
+start = array.length - Math.floor(-start);
+} else {
+start = Math.floor(start);
+}
+if (!start) {
+start = 0;
+}
+var args = Array.prototype.slice.call(arguments, 1);
+var ret = array.splice.apply(array, args);
+var addedCount = Math.max(args.length - 2, 0);
+if (addedCount || ret.length) {
+this._notifySplice(array, path, start, addedCount, ret);
+}
+return ret;
+},
+shift: function (path) {
+var array = this.get(path);
+var hadLength = Boolean(array.length);
+var args = Array.prototype.slice.call(arguments, 1);
+var ret = array.shift.apply(array, args);
+if (hadLength) {
+this._notifySplice(array, path, 0, 0, [ret]);
+}
+return ret;
+},
+unshift: function (path) {
+var array = this.get(path);
+var args = Array.prototype.slice.call(arguments, 1);
+var ret = array.unshift.apply(array, args);
+if (args.length) {
+this._notifySplice(array, path, 0, args.length, []);
+}
+return ret;
+}
+});
+}());
+Polymer.Base._addFeature({
+resolveUrl: function (url) {
+var module = Polymer.DomModule.import(this.is);
+var root = '';
+if (module) {
+var assetPath = module.getAttribute('assetpath') || '';
+root = Polymer.ResolveUrl.resolveUrl(assetPath, module.ownerDocument.baseURI);
+}
+return Polymer.ResolveUrl.resolveUrl(url, root);
+}
+});
+Polymer.CssParse = function () {
+var api = {
+parse: function (text) {
+text = this._clean(text);
+return this._parseCss(this._lex(text), text);
+},
+_clean: function (cssText) {
+return cssText.replace(this._rx.comments, '').replace(this._rx.port, '');
+},
+_lex: function (text) {
+var root = {
+start: 0,
+end: text.length
+};
+var n = root;
+for (var i = 0, s = 0, l = text.length; i < l; i++) {
+switch (text[i]) {
+case this.OPEN_BRACE:
+if (!n.rules) {
+n.rules = [];
+}
+var p = n;
+var previous = p.rules[p.rules.length - 1];
+n = {
+start: i + 1,
+parent: p,
+previous: previous
+};
+p.rules.push(n);
+break;
+case this.CLOSE_BRACE:
+n.end = i + 1;
+n = n.parent || root;
+break;
+}
+}
+return root;
+},
+_parseCss: function (node, text) {
+var t = text.substring(node.start, node.end - 1);
+node.parsedCssText = node.cssText = t.trim();
+if (node.parent) {
+var ss = node.previous ? node.previous.end : node.parent.start;
+t = text.substring(ss, node.start - 1);
+t = t.substring(t.lastIndexOf(';') + 1);
+var s = node.parsedSelector = node.selector = t.trim();
+node.atRule = s.indexOf(this.AT_START) === 0;
+if (node.atRule) {
+if (s.indexOf(this.MEDIA_START) === 0) {
+node.type = this.types.MEDIA_RULE;
+} else if (s.match(this._rx.keyframesRule)) {
+node.type = this.types.KEYFRAMES_RULE;
+}
+} else {
+if (s.indexOf(this.VAR_START) === 0) {
+node.type = this.types.MIXIN_RULE;
+} else {
+node.type = this.types.STYLE_RULE;
+}
+}
+}
+var r$ = node.rules;
+if (r$) {
+for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
+this._parseCss(r, text);
+}
+}
+return node;
+},
+stringify: function (node, preserveProperties, text) {
+text = text || '';
+var cssText = '';
+if (node.cssText || node.rules) {
+var r$ = node.rules;
+if (r$ && (preserveProperties || !this._hasMixinRules(r$))) {
+for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
+cssText = this.stringify(r, preserveProperties, cssText);
+}
+} else {
+cssText = preserveProperties ? node.cssText : this.removeCustomProps(node.cssText);
+cssText = cssText.trim();
+if (cssText) {
+cssText = '  ' + cssText + '\n';
+}
+}
+}
+if (cssText) {
+if (node.selector) {
+text += node.selector + ' ' + this.OPEN_BRACE + '\n';
+}
+text += cssText;
+if (node.selector) {
+text += this.CLOSE_BRACE + '\n\n';
+}
+}
+return text;
+},
+_hasMixinRules: function (rules) {
+return rules[0].selector.indexOf(this.VAR_START) >= 0;
+},
+removeCustomProps: function (cssText) {
+return cssText;
+},
+removeCustomPropAssignment: function (cssText) {
+return cssText.replace(this._rx.customProp, '').replace(this._rx.mixinProp, '');
+},
+removeCustomPropApply: function (cssText) {
+return cssText.replace(this._rx.mixinApply, '').replace(this._rx.varApply, '');
+},
+types: {
+STYLE_RULE: 1,
+KEYFRAMES_RULE: 7,
+MEDIA_RULE: 4,
+MIXIN_RULE: 1000
+},
+OPEN_BRACE: '{',
+CLOSE_BRACE: '}',
+_rx: {
+comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
+port: /@import[^;]*;/gim,
+customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?(?:[;\n]|$)/gim,
+mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim,
+mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim,
+varApply: /[^;:]*?:[^;]*var[^;]*(?:[;\n]|$)?/gim,
+keyframesRule: /^@[^\s]*keyframes/
+},
+VAR_START: '--',
+MEDIA_START: '@media',
+AT_START: '@'
+};
+return api;
+}();
+Polymer.StyleUtil = function () {
+return {
+MODULE_STYLES_SELECTOR: 'style, link[rel=import][type~=css], template',
+INCLUDE_ATTR: 'include',
+toCssText: function (rules, callback, preserveProperties) {
+if (typeof rules === 'string') {
+rules = this.parser.parse(rules);
+}
+if (callback) {
+this.forEachStyleRule(rules, callback);
+}
+return this.parser.stringify(rules, preserveProperties);
+},
+forRulesInStyles: function (styles, callback) {
+if (styles) {
+for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
+this.forEachStyleRule(this.rulesForStyle(s), callback);
+}
+}
+},
+rulesForStyle: function (style) {
+if (!style.__cssRules && style.textContent) {
+style.__cssRules = this.parser.parse(style.textContent);
+}
+return style.__cssRules;
+},
+clearStyleRules: function (style) {
+style.__cssRules = null;
+},
+forEachStyleRule: function (node, callback) {
+if (!node) {
+return;
+}
+var s = node.parsedSelector;
+var skipRules = false;
+if (node.type === this.ruleTypes.STYLE_RULE) {
+callback(node);
+} else if (node.type === this.ruleTypes.KEYFRAMES_RULE || node.type === this.ruleTypes.MIXIN_RULE) {
+skipRules = true;
+}
+var r$ = node.rules;
+if (r$ && !skipRules) {
+for (var i = 0, l = r$.length, r; i < l && (r = r$[i]); i++) {
+this.forEachStyleRule(r, callback);
+}
+}
+},
+applyCss: function (cssText, moniker, target, afterNode) {
+var style = document.createElement('style');
+if (moniker) {
+style.setAttribute('scope', moniker);
+}
+style.textContent = cssText;
+target = target || document.head;
+if (!afterNode) {
+var n$ = target.querySelectorAll('style[scope]');
+afterNode = n$[n$.length - 1];
+}
+target.insertBefore(style, afterNode && afterNode.nextSibling || target.firstChild);
+return style;
+},
+cssFromModules: function (moduleIds, warnIfNotFound) {
+var modules = moduleIds.trim().split(' ');
+var cssText = '';
+for (var i = 0; i < modules.length; i++) {
+cssText += this.cssFromModule(modules[i], warnIfNotFound);
+}
+return cssText;
+},
+cssFromModule: function (moduleId, warnIfNotFound) {
+var m = Polymer.DomModule.import(moduleId);
+if (m && !m._cssText) {
+m._cssText = this._cssFromElement(m);
+}
+if (!m && warnIfNotFound) {
+console.warn('Could not find style data in module named', moduleId);
+}
+return m && m._cssText || '';
+},
+_cssFromElement: function (element) {
+var cssText = '';
+var content = element.content || element;
+var e$ = Array.prototype.slice.call(content.querySelectorAll(this.MODULE_STYLES_SELECTOR));
+for (var i = 0, e; i < e$.length; i++) {
+e = e$[i];
+if (e.localName === 'template') {
+cssText += this._cssFromElement(e);
+} else {
+if (e.localName === 'style') {
+var include = e.getAttribute(this.INCLUDE_ATTR);
+if (include) {
+cssText += this.cssFromModules(include, true);
+}
+e = e.__appliedElement || e;
+e.parentNode.removeChild(e);
+cssText += this.resolveCss(e.textContent, element.ownerDocument);
+} else if (e.import && e.import.body) {
+cssText += this.resolveCss(e.import.body.textContent, e.import);
+}
+}
+}
+return cssText;
+},
+resolveCss: Polymer.ResolveUrl.resolveCss,
+parser: Polymer.CssParse,
+ruleTypes: Polymer.CssParse.types
+};
+}();
+Polymer.StyleTransformer = function () {
+var nativeShadow = Polymer.Settings.useNativeShadow;
+var styleUtil = Polymer.StyleUtil;
+var api = {
+dom: function (node, scope, useAttr, shouldRemoveScope) {
+this._transformDom(node, scope || '', useAttr, shouldRemoveScope);
+},
+_transformDom: function (node, selector, useAttr, shouldRemoveScope) {
+if (node.setAttribute) {
+this.element(node, selector, useAttr, shouldRemoveScope);
+}
+var c$ = Polymer.dom(node).childNodes;
+for (var i = 0; i < c$.length; i++) {
+this._transformDom(c$[i], selector, useAttr, shouldRemoveScope);
+}
+},
+element: function (element, scope, useAttr, shouldRemoveScope) {
+if (useAttr) {
+if (shouldRemoveScope) {
+element.removeAttribute(SCOPE_NAME);
+} else {
+element.setAttribute(SCOPE_NAME, scope);
+}
+} else {
+if (scope) {
+if (element.classList) {
+if (shouldRemoveScope) {
+element.classList.remove(SCOPE_NAME);
+element.classList.remove(scope);
+} else {
+element.classList.add(SCOPE_NAME);
+element.classList.add(scope);
+}
+} else if (element.getAttribute) {
+var c = element.getAttribute(CLASS);
+if (shouldRemoveScope) {
+if (c) {
+element.setAttribute(CLASS, c.replace(SCOPE_NAME, '').replace(scope, ''));
+}
+} else {
+element.setAttribute(CLASS, c + (c ? ' ' : '') + SCOPE_NAME + ' ' + scope);
+}
+}
+}
+}
+},
+elementStyles: function (element, callback) {
+var styles = element._styles;
+var cssText = '';
+for (var i = 0, l = styles.length, s, text; i < l && (s = styles[i]); i++) {
+var rules = styleUtil.rulesForStyle(s);
+cssText += nativeShadow ? styleUtil.toCssText(rules, callback) : this.css(rules, element.is, element.extends, callback, element._scopeCssViaAttr) + '\n\n';
+}
+return cssText.trim();
+},
+css: function (rules, scope, ext, callback, useAttr) {
+var hostScope = this._calcHostScope(scope, ext);
+scope = this._calcElementScope(scope, useAttr);
+var self = this;
+return styleUtil.toCssText(rules, function (rule) {
+if (!rule.isScoped) {
+self.rule(rule, scope, hostScope);
+rule.isScoped = true;
+}
+if (callback) {
+callback(rule, scope, hostScope);
+}
+});
+},
+_calcElementScope: function (scope, useAttr) {
+if (scope) {
+return useAttr ? CSS_ATTR_PREFIX + scope + CSS_ATTR_SUFFIX : CSS_CLASS_PREFIX + scope;
+} else {
+return '';
+}
+},
+_calcHostScope: function (scope, ext) {
+return ext ? '[is=' + scope + ']' : scope;
+},
+rule: function (rule, scope, hostScope) {
+this._transformRule(rule, this._transformComplexSelector, scope, hostScope);
+},
+_transformRule: function (rule, transformer, scope, hostScope) {
+var p$ = rule.selector.split(COMPLEX_SELECTOR_SEP);
+for (var i = 0, l = p$.length, p; i < l && (p = p$[i]); i++) {
+p$[i] = transformer.call(this, p, scope, hostScope);
+}
+rule.selector = rule.transformedSelector = p$.join(COMPLEX_SELECTOR_SEP);
+},
+_transformComplexSelector: function (selector, scope, hostScope) {
+var stop = false;
+var hostContext = false;
+var self = this;
+selector = selector.replace(SIMPLE_SELECTOR_SEP, function (m, c, s) {
+if (!stop) {
+var info = self._transformCompoundSelector(s, c, scope, hostScope);
+stop = stop || info.stop;
+hostContext = hostContext || info.hostContext;
+c = info.combinator;
+s = info.value;
+} else {
+s = s.replace(SCOPE_JUMP, ' ');
+}
+return c + s;
+});
+if (hostContext) {
+selector = selector.replace(HOST_CONTEXT_PAREN, function (m, pre, paren, post) {
+return pre + paren + ' ' + hostScope + post + COMPLEX_SELECTOR_SEP + ' ' + pre + hostScope + paren + post;
+});
+}
+return selector;
+},
+_transformCompoundSelector: function (selector, combinator, scope, hostScope) {
+var jumpIndex = selector.search(SCOPE_JUMP);
+var hostContext = false;
+if (selector.indexOf(HOST_CONTEXT) >= 0) {
+hostContext = true;
+} else if (selector.indexOf(HOST) >= 0) {
+selector = selector.replace(HOST_PAREN, function (m, host, paren) {
+return hostScope + paren;
+});
+selector = selector.replace(HOST, hostScope);
+} else if (jumpIndex !== 0) {
+selector = scope ? this._transformSimpleSelector(selector, scope) : selector;
+}
+if (selector.indexOf(CONTENT) >= 0) {
+combinator = '';
+}
+var stop;
+if (jumpIndex >= 0) {
+selector = selector.replace(SCOPE_JUMP, ' ');
+stop = true;
+}
+return {
+value: selector,
+combinator: combinator,
+stop: stop,
+hostContext: hostContext
+};
+},
+_transformSimpleSelector: function (selector, scope) {
+var p$ = selector.split(PSEUDO_PREFIX);
+p$[0] += scope;
+return p$.join(PSEUDO_PREFIX);
+},
+documentRule: function (rule) {
+rule.selector = rule.parsedSelector;
+this.normalizeRootSelector(rule);
+if (!nativeShadow) {
+this._transformRule(rule, this._transformDocumentSelector);
+}
+},
+normalizeRootSelector: function (rule) {
+if (rule.selector === ROOT) {
+rule.selector = 'body';
+}
+},
+_transformDocumentSelector: function (selector) {
+return selector.match(SCOPE_JUMP) ? this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) : this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR);
+},
+SCOPE_NAME: 'style-scope'
+};
+var SCOPE_NAME = api.SCOPE_NAME;
+var SCOPE_DOC_SELECTOR = ':not([' + SCOPE_NAME + '])' + ':not(.' + SCOPE_NAME + ')';
+var COMPLEX_SELECTOR_SEP = ',';
+var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)([^\s>+~]+)/g;
+var HOST = ':host';
+var ROOT = ':root';
+var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
+var HOST_CONTEXT = ':host-context';
+var HOST_CONTEXT_PAREN = /(.*)(?:\:host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
+var CONTENT = '::content';
+var SCOPE_JUMP = /\:\:content|\:\:shadow|\/deep\//;
+var CSS_CLASS_PREFIX = '.';
+var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~=';
+var CSS_ATTR_SUFFIX = ']';
+var PSEUDO_PREFIX = ':';
+var CLASS = 'class';
+return api;
+}();
+Polymer.StyleExtends = function () {
+var styleUtil = Polymer.StyleUtil;
+return {
+hasExtends: function (cssText) {
+return Boolean(cssText.match(this.rx.EXTEND));
+},
+transform: function (style) {
+var rules = styleUtil.rulesForStyle(style);
+var self = this;
+styleUtil.forEachStyleRule(rules, function (rule) {
+var map = self._mapRule(rule);
+if (rule.parent) {
+var m;
+while (m = self.rx.EXTEND.exec(rule.cssText)) {
+var extend = m[1];
+var extendor = self._findExtendor(extend, rule);
+if (extendor) {
+self._extendRule(rule, extendor);
+}
+}
+}
+rule.cssText = rule.cssText.replace(self.rx.EXTEND, '');
+});
+return styleUtil.toCssText(rules, function (rule) {
+if (rule.selector.match(self.rx.STRIP)) {
+rule.cssText = '';
+}
+}, true);
+},
+_mapRule: function (rule) {
+if (rule.parent) {
+var map = rule.parent.map || (rule.parent.map = {});
+var parts = rule.selector.split(',');
+for (var i = 0, p; i < parts.length; i++) {
+p = parts[i];
+map[p.trim()] = rule;
+}
+return map;
+}
+},
+_findExtendor: function (extend, rule) {
+return rule.parent && rule.parent.map && rule.parent.map[extend] || this._findExtendor(extend, rule.parent);
+},
+_extendRule: function (target, source) {
+if (target.parent !== source.parent) {
+this._cloneAndAddRuleToParent(source, target.parent);
+}
+target.extends = target.extends || (target.extends = []);
+target.extends.push(source);
+source.selector = source.selector.replace(this.rx.STRIP, '');
+source.selector = (source.selector && source.selector + ',\n') + target.selector;
+if (source.extends) {
+source.extends.forEach(function (e) {
+this._extendRule(target, e);
+}, this);
+}
+},
+_cloneAndAddRuleToParent: function (rule, parent) {
+rule = Object.create(rule);
+rule.parent = parent;
+if (rule.extends) {
+rule.extends = rule.extends.slice();
+}
+parent.rules.push(rule);
+},
+rx: {
+EXTEND: /@extends\(([^)]*)\)\s*?;/gim,
+STRIP: /%[^,]*$/
+}
+};
+}();
+(function () {
+var prepElement = Polymer.Base._prepElement;
+var nativeShadow = Polymer.Settings.useNativeShadow;
+var styleUtil = Polymer.StyleUtil;
+var styleTransformer = Polymer.StyleTransformer;
+var styleExtends = Polymer.StyleExtends;
+Polymer.Base._addFeature({
+_prepElement: function (element) {
+if (this._encapsulateStyle) {
+styleTransformer.element(element, this.is, this._scopeCssViaAttr);
+}
+prepElement.call(this, element);
+},
+_prepStyles: function () {
+if (this._encapsulateStyle === undefined) {
+this._encapsulateStyle = !nativeShadow && Boolean(this._template);
+}
+this._styles = this._collectStyles();
+var cssText = styleTransformer.elementStyles(this);
+if (cssText && this._template) {
+var style = styleUtil.applyCss(cssText, this.is, nativeShadow ? this._template.content : null);
+if (!nativeShadow) {
+this._scopeStyle = style;
+}
+}
+},
+_collectStyles: function () {
+var styles = [];
+var cssText = '', m$ = this.styleModules;
+if (m$) {
+for (var i = 0, l = m$.length, m; i < l && (m = m$[i]); i++) {
+cssText += styleUtil.cssFromModule(m);
+}
+}
+cssText += styleUtil.cssFromModule(this.is);
+if (cssText) {
+var style = document.createElement('style');
+style.textContent = cssText;
+if (styleExtends.hasExtends(style.textContent)) {
+cssText = styleExtends.transform(style);
+}
+styles.push(style);
+}
+return styles;
+},
+_elementAdd: function (node) {
+if (this._encapsulateStyle) {
+if (node.__styleScoped) {
+node.__styleScoped = false;
+} else {
+styleTransformer.dom(node, this.is, this._scopeCssViaAttr);
+}
+}
+},
+_elementRemove: function (node) {
+if (this._encapsulateStyle) {
+styleTransformer.dom(node, this.is, this._scopeCssViaAttr, true);
+}
+},
+scopeSubtree: function (container, shouldObserve) {
+if (nativeShadow) {
+return;
+}
+var self = this;
+var scopify = function (node) {
+if (node.nodeType === Node.ELEMENT_NODE) {
+node.className = self._scopeElementClass(node, node.className);
+var n$ = node.querySelectorAll('*');
+Array.prototype.forEach.call(n$, function (n) {
+n.className = self._scopeElementClass(n, n.className);
+});
+}
+};
+scopify(container);
+if (shouldObserve) {
+var mo = new MutationObserver(function (mxns) {
+mxns.forEach(function (m) {
+if (m.addedNodes) {
+for (var i = 0; i < m.addedNodes.length; i++) {
+scopify(m.addedNodes[i]);
+}
+}
+});
+});
+mo.observe(container, {
+childList: true,
+subtree: true
+});
+return mo;
+}
+}
+});
+}());
+Polymer.StyleProperties = function () {
+'use strict';
+var nativeShadow = Polymer.Settings.useNativeShadow;
+var matchesSelector = Polymer.DomApi.matchesSelector;
+var styleUtil = Polymer.StyleUtil;
+var styleTransformer = Polymer.StyleTransformer;
+return {
+decorateStyles: function (styles) {
+var self = this, props = {};
+styleUtil.forRulesInStyles(styles, function (rule) {
+self.decorateRule(rule);
+self.collectPropertiesInCssText(rule.propertyInfo.cssText, props);
+});
+var names = [];
+for (var i in props) {
+names.push(i);
+}
+return names;
+},
+decorateRule: function (rule) {
+if (rule.propertyInfo) {
+return rule.propertyInfo;
+}
+var info = {}, properties = {};
+var hasProperties = this.collectProperties(rule, properties);
+if (hasProperties) {
+info.properties = properties;
+rule.rules = null;
+}
+info.cssText = this.collectCssText(rule);
+rule.propertyInfo = info;
+return info;
+},
+collectProperties: function (rule, properties) {
+var info = rule.propertyInfo;
+if (info) {
+if (info.properties) {
+Polymer.Base.mixin(properties, info.properties);
+return true;
+}
+} else {
+var m, rx = this.rx.VAR_ASSIGN;
+var cssText = rule.parsedCssText;
+var any;
+while (m = rx.exec(cssText)) {
+properties[m[1]] = (m[2] || m[3]).trim();
+any = true;
+}
+return any;
+}
+},
+collectCssText: function (rule) {
+var customCssText = '';
+var cssText = rule.parsedCssText;
+cssText = cssText.replace(this.rx.BRACKETED, '').replace(this.rx.VAR_ASSIGN, '');
+var parts = cssText.split(';');
+for (var i = 0, p; i < parts.length; i++) {
+p = parts[i];
+if (p.match(this.rx.MIXIN_MATCH) || p.match(this.rx.VAR_MATCH)) {
+customCssText += p + ';\n';
+}
+}
+return customCssText;
+},
+collectPropertiesInCssText: function (cssText, props) {
+var m;
+while (m = this.rx.VAR_CAPTURE.exec(cssText)) {
+props[m[1]] = true;
+var def = m[2];
+if (def && def.match(this.rx.IS_VAR)) {
+props[def] = true;
+}
+}
+},
+reify: function (props) {
+var names = Object.getOwnPropertyNames(props);
+for (var i = 0, n; i < names.length; i++) {
+n = names[i];
+props[n] = this.valueForProperty(props[n], props);
+}
+},
+valueForProperty: function (property, props) {
+if (property) {
+if (property.indexOf(';') >= 0) {
+property = this.valueForProperties(property, props);
+} else {
+var self = this;
+var fn = function (all, prefix, value, fallback) {
+var propertyValue = self.valueForProperty(props[value], props) || (props[fallback] ? self.valueForProperty(props[fallback], props) : fallback);
+return prefix + (propertyValue || '');
+};
+property = property.replace(this.rx.VAR_MATCH, fn);
+}
+}
+return property && property.trim() || '';
+},
+valueForProperties: function (property, props) {
+var parts = property.split(';');
+for (var i = 0, p, m; i < parts.length; i++) {
+if (p = parts[i]) {
+m = p.match(this.rx.MIXIN_MATCH);
+if (m) {
+p = this.valueForProperty(props[m[1]], props);
+} else {
+var pp = p.split(':');
+if (pp[1]) {
+pp[1] = pp[1].trim();
+pp[1] = this.valueForProperty(pp[1], props) || pp[1];
+}
+p = pp.join(':');
+}
+parts[i] = p && p.lastIndexOf(';') === p.length - 1 ? p.slice(0, -1) : p || '';
+}
+}
+return parts.join(';');
+},
+applyProperties: function (rule, props) {
+var output = '';
+if (!rule.propertyInfo) {
+this.decorateRule(rule);
+}
+if (rule.propertyInfo.cssText) {
+output = this.valueForProperties(rule.propertyInfo.cssText, props);
+}
+rule.cssText = output;
+},
+propertyDataFromStyles: function (styles, element) {
+var props = {}, self = this;
+var o = [], i = 0;
+styleUtil.forRulesInStyles(styles, function (rule) {
+if (!rule.propertyInfo) {
+self.decorateRule(rule);
+}
+if (element && rule.propertyInfo.properties && matchesSelector.call(element, rule.transformedSelector || rule.parsedSelector)) {
+self.collectProperties(rule, props);
+addToBitMask(i, o);
+}
+i++;
+});
+return {
+properties: props,
+key: o
+};
+},
+scopePropertiesFromStyles: function (styles) {
+if (!styles._scopeStyleProperties) {
+styles._scopeStyleProperties = this.selectedPropertiesFromStyles(styles, this.SCOPE_SELECTORS);
+}
+return styles._scopeStyleProperties;
+},
+hostPropertiesFromStyles: function (styles) {
+if (!styles._hostStyleProperties) {
+styles._hostStyleProperties = this.selectedPropertiesFromStyles(styles, this.HOST_SELECTORS);
+}
+return styles._hostStyleProperties;
+},
+selectedPropertiesFromStyles: function (styles, selectors) {
+var props = {}, self = this;
+styleUtil.forRulesInStyles(styles, function (rule) {
+if (!rule.propertyInfo) {
+self.decorateRule(rule);
+}
+for (var i = 0; i < selectors.length; i++) {
+if (rule.parsedSelector === selectors[i]) {
+self.collectProperties(rule, props);
+return;
+}
+}
+});
+return props;
+},
+transformStyles: function (element, properties, scopeSelector) {
+var self = this;
+var hostSelector = styleTransformer._calcHostScope(element.is, element.extends);
+var rxHostSelector = element.extends ? '\\' + hostSelector.slice(0, -1) + '\\]' : hostSelector;
+var hostRx = new RegExp(this.rx.HOST_PREFIX + rxHostSelector + this.rx.HOST_SUFFIX);
+return styleTransformer.elementStyles(element, function (rule) {
+self.applyProperties(rule, properties);
+if (rule.cssText && !nativeShadow) {
+self._scopeSelector(rule, hostRx, hostSelector, element._scopeCssViaAttr, scopeSelector);
+}
+});
+},
+_scopeSelector: function (rule, hostRx, hostSelector, viaAttr, scopeId) {
+rule.transformedSelector = rule.transformedSelector || rule.selector;
+var selector = rule.transformedSelector;
+var scope = viaAttr ? '[' + styleTransformer.SCOPE_NAME + '~=' + scopeId + ']' : '.' + scopeId;
+var parts = selector.split(',');
+for (var i = 0, l = parts.length, p; i < l && (p = parts[i]); i++) {
+parts[i] = p.match(hostRx) ? p.replace(hostSelector, hostSelector + scope) : scope + ' ' + p;
+}
+rule.selector = parts.join(',');
+},
+applyElementScopeSelector: function (element, selector, old, viaAttr) {
+var c = viaAttr ? element.getAttribute(styleTransformer.SCOPE_NAME) : element.className;
+var v = old ? c.replace(old, selector) : (c ? c + ' ' : '') + this.XSCOPE_NAME + ' ' + selector;
+if (c !== v) {
+if (viaAttr) {
+element.setAttribute(styleTransformer.SCOPE_NAME, v);
+} else {
+element.className = v;
+}
+}
+},
+applyElementStyle: function (element, properties, selector, style) {
+var cssText = style ? style.textContent || '' : this.transformStyles(element, properties, selector);
+var s = element._customStyle;
+if (s && !nativeShadow && s !== style) {
+s._useCount--;
+if (s._useCount <= 0 && s.parentNode) {
+s.parentNode.removeChild(s);
+}
+}
+if (nativeShadow || (!style || !style.parentNode)) {
+if (nativeShadow && element._customStyle) {
+element._customStyle.textContent = cssText;
+style = element._customStyle;
+} else if (cssText) {
+style = styleUtil.applyCss(cssText, selector, nativeShadow ? element.root : null, element._scopeStyle);
+}
+}
+if (style) {
+style._useCount = style._useCount || 0;
+if (element._customStyle != style) {
+style._useCount++;
+}
+element._customStyle = style;
+}
+return style;
+},
+mixinCustomStyle: function (props, customStyle) {
+var v;
+for (var i in customStyle) {
+v = customStyle[i];
+if (v || v === 0) {
+props[i] = v;
+}
+}
+},
+rx: {
+VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*(?:([^;{]*)|{([^}]*)})(?:(?=[;\n])|$)/gi,
+MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/i,
+VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gi,
+VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gi,
+IS_VAR: /^--/,
+BRACKETED: /\{[^}]*\}/g,
+HOST_PREFIX: '(?:^|[^.#[:])',
+HOST_SUFFIX: '($|[.:[\\s>+~])'
+},
+HOST_SELECTORS: [':host'],
+SCOPE_SELECTORS: [':root'],
+XSCOPE_NAME: 'x-scope'
+};
+function addToBitMask(n, bits) {
+var o = parseInt(n / 32);
+var v = 1 << n % 32;
+bits[o] = (bits[o] || 0) | v;
+}
+}();
+(function () {
+Polymer.StyleCache = function () {
+this.cache = {};
+};
+Polymer.StyleCache.prototype = {
+MAX: 100,
+store: function (is, data, keyValues, keyStyles) {
+data.keyValues = keyValues;
+data.styles = keyStyles;
+var s$ = this.cache[is] = this.cache[is] || [];
+s$.push(data);
+if (s$.length > this.MAX) {
+s$.shift();
+}
+},
+retrieve: function (is, keyValues, keyStyles) {
+var cache = this.cache[is];
+if (cache) {
+for (var i = cache.length - 1, data; i >= 0; i--) {
+data = cache[i];
+if (keyStyles === data.styles && this._objectsEqual(keyValues, data.keyValues)) {
+return data;
+}
+}
+}
+},
+clear: function () {
+this.cache = {};
+},
+_objectsEqual: function (target, source) {
+var t, s;
+for (var i in target) {
+t = target[i], s = source[i];
+if (!(typeof t === 'object' && t ? this._objectsStrictlyEqual(t, s) : t === s)) {
+return false;
+}
+}
+if (Array.isArray(target)) {
+return target.length === source.length;
+}
+return true;
+},
+_objectsStrictlyEqual: function (target, source) {
+return this._objectsEqual(target, source) && this._objectsEqual(source, target);
+}
+};
+}());
+Polymer.StyleDefaults = function () {
+var styleProperties = Polymer.StyleProperties;
+var styleUtil = Polymer.StyleUtil;
+var StyleCache = Polymer.StyleCache;
+var api = {
+_styles: [],
+_properties: null,
+customStyle: {},
+_styleCache: new StyleCache(),
+addStyle: function (style) {
+this._styles.push(style);
+this._properties = null;
+},
+get _styleProperties() {
+if (!this._properties) {
+styleProperties.decorateStyles(this._styles);
+this._styles._scopeStyleProperties = null;
+this._properties = styleProperties.scopePropertiesFromStyles(this._styles);
+styleProperties.mixinCustomStyle(this._properties, this.customStyle);
+styleProperties.reify(this._properties);
+}
+return this._properties;
+},
+_needsStyleProperties: function () {
+},
+_computeStyleProperties: function () {
+return this._styleProperties;
+},
+updateStyles: function (properties) {
+this._properties = null;
+if (properties) {
+Polymer.Base.mixin(this.customStyle, properties);
+}
+this._styleCache.clear();
+for (var i = 0, s; i < this._styles.length; i++) {
+s = this._styles[i];
+s = s.__importElement || s;
+s._apply();
+}
+}
+};
+return api;
+}();
+(function () {
+'use strict';
+var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute;
+var propertyUtils = Polymer.StyleProperties;
+var styleTransformer = Polymer.StyleTransformer;
+var styleUtil = Polymer.StyleUtil;
+var styleDefaults = Polymer.StyleDefaults;
+var nativeShadow = Polymer.Settings.useNativeShadow;
+Polymer.Base._addFeature({
+_prepStyleProperties: function () {
+this._ownStylePropertyNames = this._styles ? propertyUtils.decorateStyles(this._styles) : [];
+},
+customStyle: {},
+_setupStyleProperties: function () {
+this.customStyle = {};
+},
+_needsStyleProperties: function () {
+return Boolean(this._ownStylePropertyNames && this._ownStylePropertyNames.length);
+},
+_beforeAttached: function () {
+if (!this._scopeSelector && this._needsStyleProperties()) {
+this._updateStyleProperties();
+}
+},
+_findStyleHost: function () {
+var e = this, root;
+while (root = Polymer.dom(e).getOwnerRoot()) {
+if (Polymer.isInstance(root.host)) {
+return root.host;
+}
+e = root.host;
+}
+return styleDefaults;
+},
+_updateStyleProperties: function () {
+var info, scope = this._findStyleHost();
+if (!scope._styleCache) {
+scope._styleCache = new Polymer.StyleCache();
+}
+var scopeData = propertyUtils.propertyDataFromStyles(scope._styles, this);
+scopeData.key.customStyle = this.customStyle;
+info = scope._styleCache.retrieve(this.is, scopeData.key, this._styles);
+var scopeCached = Boolean(info);
+if (scopeCached) {
+this._styleProperties = info._styleProperties;
+} else {
+this._computeStyleProperties(scopeData.properties);
+}
+this._computeOwnStyleProperties();
+if (!scopeCached) {
+info = styleCache.retrieve(this.is, this._ownStyleProperties, this._styles);
+}
+var globalCached = Boolean(info) && !scopeCached;
+var style = this._applyStyleProperties(info);
+if (!scopeCached) {
+style = style && nativeShadow ? style.cloneNode(true) : style;
+info = {
+style: style,
+_scopeSelector: this._scopeSelector,
+_styleProperties: this._styleProperties
+};
+scopeData.key.customStyle = {};
+this.mixin(scopeData.key.customStyle, this.customStyle);
+scope._styleCache.store(this.is, info, scopeData.key, this._styles);
+if (!globalCached) {
+styleCache.store(this.is, Object.create(info), this._ownStyleProperties, this._styles);
+}
+}
+},
+_computeStyleProperties: function (scopeProps) {
+var scope = this._findStyleHost();
+if (!scope._styleProperties) {
+scope._computeStyleProperties();
+}
+var props = Object.create(scope._styleProperties);
+this.mixin(props, propertyUtils.hostPropertiesFromStyles(this._styles));
+scopeProps = scopeProps || propertyUtils.propertyDataFromStyles(scope._styles, this).properties;
+this.mixin(props, scopeProps);
+this.mixin(props, propertyUtils.scopePropertiesFromStyles(this._styles));
+propertyUtils.mixinCustomStyle(props, this.customStyle);
+propertyUtils.reify(props);
+this._styleProperties = props;
+},
+_computeOwnStyleProperties: function () {
+var props = {};
+for (var i = 0, n; i < this._ownStylePropertyNames.length; i++) {
+n = this._ownStylePropertyNames[i];
+props[n] = this._styleProperties[n];
+}
+this._ownStyleProperties = props;
+},
+_scopeCount: 0,
+_applyStyleProperties: function (info) {
+var oldScopeSelector = this._scopeSelector;
+this._scopeSelector = info ? info._scopeSelector : this.is + '-' + this.__proto__._scopeCount++;
+var style = propertyUtils.applyElementStyle(this, this._styleProperties, this._scopeSelector, info && info.style);
+if (!nativeShadow) {
+propertyUtils.applyElementScopeSelector(this, this._scopeSelector, oldScopeSelector, this._scopeCssViaAttr);
+}
+return style;
+},
+serializeValueToAttribute: function (value, attribute, node) {
+node = node || this;
+if (attribute === 'class' && !nativeShadow) {
+var host = node === this ? this.domHost || this.dataHost : this;
+if (host) {
+value = host._scopeElementClass(node, value);
+}
+}
+node = Polymer.dom(node);
+serializeValueToAttribute.call(this, value, attribute, node);
+},
+_scopeElementClass: function (element, selector) {
+if (!nativeShadow && !this._scopeCssViaAttr) {
+selector += (selector ? ' ' : '') + SCOPE_NAME + ' ' + this.is + (element._scopeSelector ? ' ' + XSCOPE_NAME + ' ' + element._scopeSelector : '');
+}
+return selector;
+},
+updateStyles: function (properties) {
+if (this.isAttached) {
+if (properties) {
+this.mixin(this.customStyle, properties);
+}
+if (this._needsStyleProperties()) {
+this._updateStyleProperties();
+} else {
+this._styleProperties = null;
+}
+if (this._styleCache) {
+this._styleCache.clear();
+}
+this._updateRootStyles();
+}
+},
+_updateRootStyles: function (root) {
+root = root || this.root;
+var c$ = Polymer.dom(root)._query(function (e) {
+return e.shadyRoot || e.shadowRoot;
+});
+for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
+if (c.updateStyles) {
+c.updateStyles();
+}
+}
+}
+});
+Polymer.updateStyles = function (properties) {
+styleDefaults.updateStyles(properties);
+Polymer.Base._updateRootStyles(document);
+};
+var styleCache = new Polymer.StyleCache();
+Polymer.customStyleCache = styleCache;
+var SCOPE_NAME = styleTransformer.SCOPE_NAME;
+var XSCOPE_NAME = propertyUtils.XSCOPE_NAME;
+}());
+Polymer.Base._addFeature({
+_registerFeatures: function () {
+this._prepIs();
+this._prepAttributes();
+this._prepConstructor();
+this._prepTemplate();
+this._prepStyles();
+this._prepStyleProperties();
+this._prepAnnotations();
+this._prepEffects();
+this._prepBehaviors();
+this._prepBindings();
+this._prepShady();
+},
+_prepBehavior: function (b) {
+this._addPropertyEffects(b.properties);
+this._addComplexObserverEffects(b.observers);
+this._addHostAttributes(b.hostAttributes);
+},
+_initFeatures: function () {
+this._poolContent();
+this._setupConfigure();
+this._setupStyleProperties();
+this._pushHost();
+this._stampTemplate();
+this._popHost();
+this._marshalAnnotationReferences();
+this._setupDebouncers();
+this._marshalInstanceEffects();
+this._marshalHostAttributes();
+this._marshalBehaviors();
+this._marshalAttributes();
+this._tryReady();
+},
+_marshalBehavior: function (b) {
+this._listenListeners(b.listeners);
+}
+});
+(function () {
+var nativeShadow = Polymer.Settings.useNativeShadow;
+var propertyUtils = Polymer.StyleProperties;
+var styleUtil = Polymer.StyleUtil;
+var cssParse = Polymer.CssParse;
+var styleDefaults = Polymer.StyleDefaults;
+var styleTransformer = Polymer.StyleTransformer;
+Polymer({
+is: 'custom-style',
+extends: 'style',
+properties: { include: String },
+ready: function () {
+this._tryApply();
+},
+attached: function () {
+this._tryApply();
+},
+_tryApply: function () {
+if (!this._appliesToDocument) {
+if (this.parentNode && this.parentNode.localName !== 'dom-module') {
+this._appliesToDocument = true;
+var e = this.__appliedElement || this;
+styleDefaults.addStyle(e);
+if (e.textContent || this.include) {
+this._apply();
+} else {
+var observer = new MutationObserver(function () {
+observer.disconnect();
+this._apply();
+}.bind(this));
+observer.observe(e, { childList: true });
+}
+}
+}
+},
+_apply: function () {
+var e = this.__appliedElement || this;
+if (this.include) {
+e.textContent = styleUtil.cssFromModules(this.include, true) + e.textContent;
+}
+if (e.textContent) {
+styleUtil.forEachStyleRule(styleUtil.rulesForStyle(e), function (rule) {
+styleTransformer.documentRule(rule);
+});
+this._applyCustomProperties(e);
+}
+},
+_applyCustomProperties: function (element) {
+this._computeStyleProperties();
+var props = this._styleProperties;
+var rules = styleUtil.rulesForStyle(element);
+element.textContent = styleUtil.toCssText(rules, function (rule) {
+var css = rule.cssText = rule.parsedCssText;
+if (rule.propertyInfo && rule.propertyInfo.cssText) {
+css = cssParse.removeCustomPropAssignment(css);
+rule.cssText = propertyUtils.valueForProperties(css, props);
+}
+});
+}
+});
+}());
+Polymer.Templatizer = {
+properties: { __hideTemplateChildren__: { observer: '_showHideChildren' } },
+_instanceProps: Polymer.nob,
+_parentPropPrefix: '_parent_',
+templatize: function (template) {
+if (!template._content) {
+template._content = template.content;
+}
+if (template._content._ctor) {
+this.ctor = template._content._ctor;
+this._prepParentProperties(this.ctor.prototype, template);
+return;
+}
+var archetype = Object.create(Polymer.Base);
+this._customPrepAnnotations(archetype, template);
+archetype._prepEffects();
+this._customPrepEffects(archetype);
+archetype._prepBehaviors();
+archetype._prepBindings();
+this._prepParentProperties(archetype, template);
+archetype._notifyPath = this._notifyPathImpl;
+archetype._scopeElementClass = this._scopeElementClassImpl;
+archetype.listen = this._listenImpl;
+archetype._showHideChildren = this._showHideChildrenImpl;
+var _constructor = this._constructorImpl;
+var ctor = function TemplateInstance(model, host) {
+_constructor.call(this, model, host);
+};
+ctor.prototype = archetype;
+archetype.constructor = ctor;
+template._content._ctor = ctor;
+this.ctor = ctor;
+},
+_getRootDataHost: function () {
+return this.dataHost && this.dataHost._rootDataHost || this.dataHost;
+},
+_showHideChildrenImpl: function (hide) {
+var c = this._children;
+for (var i = 0; i < c.length; i++) {
+var n = c[i];
+if (Boolean(hide) != Boolean(n.__hideTemplateChildren__)) {
+if (n.nodeType === Node.TEXT_NODE) {
+if (hide) {
+n.__polymerTextContent__ = n.textContent;
+n.textContent = '';
+} else {
+n.textContent = n.__polymerTextContent__;
+}
+} else if (n.style) {
+if (hide) {
+n.__polymerDisplay__ = n.style.display;
+n.style.display = 'none';
+} else {
+n.style.display = n.__polymerDisplay__;
+}
+}
+}
+n.__hideTemplateChildren__ = hide;
+}
+},
+_debounceTemplate: function (fn) {
+Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn));
+},
+_flushTemplates: function (debouncerExpired) {
+Polymer.dom.flush();
+},
+_customPrepEffects: function (archetype) {
+var parentProps = archetype._parentProps;
+for (var prop in parentProps) {
+archetype._addPropertyEffect(prop, 'function', this._createHostPropEffector(prop));
+}
+for (var prop in this._instanceProps) {
+archetype._addPropertyEffect(prop, 'function', this._createInstancePropEffector(prop));
+}
+},
+_customPrepAnnotations: function (archetype, template) {
+archetype._template = template;
+var c = template._content;
+if (!c._notes) {
+var rootDataHost = archetype._rootDataHost;
+if (rootDataHost) {
+Polymer.Annotations.prepElement = rootDataHost._prepElement.bind(rootDataHost);
+}
+c._notes = Polymer.Annotations.parseAnnotations(template);
+Polymer.Annotations.prepElement = null;
+this._processAnnotations(c._notes);
+}
+archetype._notes = c._notes;
+archetype._parentProps = c._parentProps;
+},
+_prepParentProperties: function (archetype, template) {
+var parentProps = this._parentProps = archetype._parentProps;
+if (this._forwardParentProp && parentProps) {
+var proto = archetype._parentPropProto;
+var prop;
+if (!proto) {
+for (prop in this._instanceProps) {
+delete parentProps[prop];
+}
+proto = archetype._parentPropProto = Object.create(null);
+if (template != this) {
+Polymer.Bind.prepareModel(proto);
+}
+for (prop in parentProps) {
+var parentProp = this._parentPropPrefix + prop;
+var effects = [
+{
+kind: 'function',
+effect: this._createForwardPropEffector(prop)
+},
+{ kind: 'notify' }
+];
+Polymer.Bind._createAccessors(proto, parentProp, effects);
+}
+}
+if (template != this) {
+Polymer.Bind.prepareInstance(template);
+template._forwardParentProp = this._forwardParentProp.bind(this);
+}
+this._extendTemplate(template, proto);
+}
+},
+_createForwardPropEffector: function (prop) {
+return function (source, value) {
+this._forwardParentProp(prop, value);
+};
+},
+_createHostPropEffector: function (prop) {
+var prefix = this._parentPropPrefix;
+return function (source, value) {
+this.dataHost[prefix + prop] = value;
+};
+},
+_createInstancePropEffector: function (prop) {
+return function (source, value, old, fromAbove) {
+if (!fromAbove) {
+this.dataHost._forwardInstanceProp(this, prop, value);
+}
+};
+},
+_extendTemplate: function (template, proto) {
+Object.getOwnPropertyNames(proto).forEach(function (n) {
+var val = template[n];
+var pd = Object.getOwnPropertyDescriptor(proto, n);
+Object.defineProperty(template, n, pd);
+if (val !== undefined) {
+template._propertySetter(n, val);
+}
+});
+},
+_showHideChildren: function (hidden) {
+},
+_forwardInstancePath: function (inst, path, value) {
+},
+_forwardInstanceProp: function (inst, prop, value) {
+},
+_notifyPathImpl: function (path, value) {
+var dataHost = this.dataHost;
+var dot = path.indexOf('.');
+var root = dot < 0 ? path : path.slice(0, dot);
+dataHost._forwardInstancePath.call(dataHost, this, path, value);
+if (root in dataHost._parentProps) {
+dataHost.notifyPath(dataHost._parentPropPrefix + path, value);
+}
+},
+_pathEffector: function (path, value, fromAbove) {
+if (this._forwardParentPath) {
+if (path.indexOf(this._parentPropPrefix) === 0) {
+this._forwardParentPath(path.substring(8), value);
+}
+}
+Polymer.Base._pathEffector.apply(this, arguments);
+},
+_constructorImpl: function (model, host) {
+this._rootDataHost = host._getRootDataHost();
+this._setupConfigure(model);
+this._pushHost(host);
+this.root = this.instanceTemplate(this._template);
+this.root.__noContent = !this._notes._hasContent;
+this.root.__styleScoped = true;
+this._popHost();
+this._marshalAnnotatedNodes();
+this._marshalInstanceEffects();
+this._marshalAnnotatedListeners();
+var children = [];
+for (var n = this.root.firstChild; n; n = n.nextSibling) {
+children.push(n);
+n._templateInstance = this;
+}
+this._children = children;
+if (host.__hideTemplateChildren__) {
+this._showHideChildren(true);
+}
+this._tryReady();
+},
+_listenImpl: function (node, eventName, methodName) {
+var model = this;
+var host = this._rootDataHost;
+var handler = host._createEventHandler(node, eventName, methodName);
+var decorated = function (e) {
+e.model = model;
+handler(e);
+};
+host._listen(node, eventName, decorated);
+},
+_scopeElementClassImpl: function (node, value) {
+var host = this._rootDataHost;
+if (host) {
+return host._scopeElementClass(node, value);
+}
+},
+stamp: function (model) {
+model = model || {};
+if (this._parentProps) {
+for (var prop in this._parentProps) {
+model[prop] = this[this._parentPropPrefix + prop];
+}
+}
+return new this.ctor(model, this);
+},
+modelForElement: function (el) {
+var model;
+while (el) {
+if (model = el._templateInstance) {
+if (model.dataHost != this) {
+el = model.dataHost;
+} else {
+return model;
+}
+} else {
+el = el.parentNode;
+}
+}
+}
+};
+Polymer({
+is: 'dom-template',
+extends: 'template',
+behaviors: [Polymer.Templatizer],
+ready: function () {
+this.templatize(this);
+}
+});
+Polymer._collections = new WeakMap();
+Polymer.Collection = function (userArray) {
+Polymer._collections.set(userArray, this);
+this.userArray = userArray;
+this.store = userArray.slice();
+this.initMap();
+};
+Polymer.Collection.prototype = {
+constructor: Polymer.Collection,
+initMap: function () {
+var omap = this.omap = new WeakMap();
+var pmap = this.pmap = {};
+var s = this.store;
+for (var i = 0; i < s.length; i++) {
+var item = s[i];
+if (item && typeof item == 'object') {
+omap.set(item, i);
+} else {
+pmap[item] = i;
+}
+}
+},
+add: function (item) {
+var key = this.store.push(item) - 1;
+if (item && typeof item == 'object') {
+this.omap.set(item, key);
+} else {
+this.pmap[item] = key;
+}
+return key;
+},
+removeKey: function (key) {
+this._removeFromMap(this.store[key]);
+delete this.store[key];
+},
+_removeFromMap: function (item) {
+if (item && typeof item == 'object') {
+this.omap.delete(item);
+} else {
+delete this.pmap[item];
+}
+},
+remove: function (item) {
+var key = this.getKey(item);
+this.removeKey(key);
+return key;
+},
+getKey: function (item) {
+if (item && typeof item == 'object') {
+return this.omap.get(item);
+} else {
+return this.pmap[item];
+}
+},
+getKeys: function () {
+return Object.keys(this.store);
+},
+setItem: function (key, item) {
+var old = this.store[key];
+if (old) {
+this._removeFromMap(old);
+}
+if (item && typeof item == 'object') {
+this.omap.set(item, key);
+} else {
+this.pmap[item] = key;
+}
+this.store[key] = item;
+},
+getItem: function (key) {
+return this.store[key];
+},
+getItems: function () {
+var items = [], store = this.store;
+for (var key in store) {
+items.push(store[key]);
+}
+return items;
+},
+_applySplices: function (splices) {
+var keyMap = {}, key, i;
+splices.forEach(function (s) {
+s.addedKeys = [];
+for (i = 0; i < s.removed.length; i++) {
+key = this.getKey(s.removed[i]);
+keyMap[key] = keyMap[key] ? null : -1;
+}
+for (i = 0; i < s.addedCount; i++) {
+var item = this.userArray[s.index + i];
+key = this.getKey(item);
+key = key === undefined ? this.add(item) : key;
+keyMap[key] = keyMap[key] ? null : 1;
+s.addedKeys.push(key);
+}
+}, this);
+var removed = [];
+var added = [];
+for (var key in keyMap) {
+if (keyMap[key] < 0) {
+this.removeKey(key);
+removed.push(key);
+}
+if (keyMap[key] > 0) {
+added.push(key);
+}
+}
+return [{
+removed: removed,
+added: added
+}];
+}
+};
+Polymer.Collection.get = function (userArray) {
+return Polymer._collections.get(userArray) || new Polymer.Collection(userArray);
+};
+Polymer.Collection.applySplices = function (userArray, splices) {
+var coll = Polymer._collections.get(userArray);
+return coll ? coll._applySplices(splices) : null;
+};
+Polymer({
+is: 'dom-repeat',
+extends: 'template',
+properties: {
+items: { type: Array },
+as: {
+type: String,
+value: 'item'
+},
+indexAs: {
+type: String,
+value: 'index'
+},
+sort: {
+type: Function,
+observer: '_sortChanged'
+},
+filter: {
+type: Function,
+observer: '_filterChanged'
+},
+observe: {
+type: String,
+observer: '_observeChanged'
+},
+delay: Number
+},
+behaviors: [Polymer.Templatizer],
+observers: ['_itemsChanged(items.*)'],
+created: function () {
+this._instances = [];
+},
+detached: function () {
+for (var i = 0; i < this._instances.length; i++) {
+this._detachRow(i);
+}
+},
+attached: function () {
+var parentNode = Polymer.dom(this).parentNode;
+for (var i = 0; i < this._instances.length; i++) {
+Polymer.dom(parentNode).insertBefore(this._instances[i].root, this);
+}
+},
+ready: function () {
+this._instanceProps = { __key__: true };
+this._instanceProps[this.as] = true;
+this._instanceProps[this.indexAs] = true;
+if (!this.ctor) {
+this.templatize(this);
+}
+},
+_sortChanged: function () {
+var dataHost = this._getRootDataHost();
+var sort = this.sort;
+this._sortFn = sort && (typeof sort == 'function' ? sort : function () {
+return dataHost[sort].apply(dataHost, arguments);
+});
+this._needFullRefresh = true;
+if (this.items) {
+this._debounceTemplate(this._render);
+}
+},
+_filterChanged: function () {
+var dataHost = this._getRootDataHost();
+var filter = this.filter;
+this._filterFn = filter && (typeof filter == 'function' ? filter : function () {
+return dataHost[filter].apply(dataHost, arguments);
+});
+this._needFullRefresh = true;
+if (this.items) {
+this._debounceTemplate(this._render);
+}
+},
+_observeChanged: function () {
+this._observePaths = this.observe && this.observe.replace('.*', '.').split(' ');
+},
+_itemsChanged: function (change) {
+if (change.path == 'items') {
+if (Array.isArray(this.items)) {
+this.collection = Polymer.Collection.get(this.items);
+} else if (!this.items) {
+this.collection = null;
+} else {
+this._error(this._logf('dom-repeat', 'expected array for `items`,' + ' found', this.items));
+}
+this._keySplices = [];
+this._indexSplices = [];
+this._needFullRefresh = true;
+this._debounceTemplate(this._render);
+} else if (change.path == 'items.splices') {
+this._keySplices = this._keySplices.concat(change.value.keySplices);
+this._indexSplices = this._indexSplices.concat(change.value.indexSplices);
+this._debounceTemplate(this._render);
+} else {
+var subpath = change.path.slice(6);
+this._forwardItemPath(subpath, change.value);
+this._checkObservedPaths(subpath);
+}
+},
+_checkObservedPaths: function (path) {
+if (this._observePaths) {
+path = path.substring(path.indexOf('.') + 1);
+var paths = this._observePaths;
+for (var i = 0; i < paths.length; i++) {
+if (path.indexOf(paths[i]) === 0) {
+this._needFullRefresh = true;
+if (this.delay) {
+this.debounce('render', this._render, this.delay);
+} else {
+this._debounceTemplate(this._render);
+}
+return;
+}
+}
+}
+},
+render: function () {
+this._needFullRefresh = true;
+this._debounceTemplate(this._render);
+this._flushTemplates();
+},
+_render: function () {
+var c = this.collection;
+if (this._needFullRefresh) {
+this._applyFullRefresh();
+this._needFullRefresh = false;
+} else {
+if (this._sortFn) {
+this._applySplicesUserSort(this._keySplices);
+} else {
+if (this._filterFn) {
+this._applyFullRefresh();
+} else {
+this._applySplicesArrayOrder(this._indexSplices);
+}
+}
+}
+this._keySplices = [];
+this._indexSplices = [];
+var keyToIdx = this._keyToInstIdx = {};
+for (var i = 0; i < this._instances.length; i++) {
+var inst = this._instances[i];
+keyToIdx[inst.__key__] = i;
+inst.__setProperty(this.indexAs, i, true);
+}
+this.fire('dom-change');
+},
+_applyFullRefresh: function () {
+var c = this.collection;
+var keys;
+if (this._sortFn) {
+keys = c ? c.getKeys() : [];
+} else {
+keys = [];
+var items = this.items;
+if (items) {
+for (var i = 0; i < items.length; i++) {
+keys.push(c.getKey(items[i]));
+}
+}
+}
+if (this._filterFn) {
+keys = keys.filter(function (a) {
+return this._filterFn(c.getItem(a));
+}, this);
+}
+if (this._sortFn) {
+keys.sort(function (a, b) {
+return this._sortFn(c.getItem(a), c.getItem(b));
+}.bind(this));
+}
+for (var i = 0; i < keys.length; i++) {
+var key = keys[i];
+var inst = this._instances[i];
+if (inst) {
+inst.__setProperty('__key__', key, true);
+inst.__setProperty(this.as, c.getItem(key), true);
+} else {
+this._instances.push(this._insertRow(i, key));
+}
+}
+for (; i < this._instances.length; i++) {
+this._detachRow(i);
+}
+this._instances.splice(keys.length, this._instances.length - keys.length);
+},
+_keySort: function (a, b) {
+return this.collection.getKey(a) - this.collection.getKey(b);
+},
+_numericSort: function (a, b) {
+return a - b;
+},
+_applySplicesUserSort: function (splices) {
+var c = this.collection;
+var instances = this._instances;
+var keyMap = {};
+var pool = [];
+var sortFn = this._sortFn || this._keySort.bind(this);
+splices.forEach(function (s) {
+for (var i = 0; i < s.removed.length; i++) {
+var key = s.removed[i];
+keyMap[key] = keyMap[key] ? null : -1;
+}
+for (var i = 0; i < s.added.length; i++) {
+var key = s.added[i];
+keyMap[key] = keyMap[key] ? null : 1;
+}
+}, this);
+var removedIdxs = [];
+var addedKeys = [];
+for (var key in keyMap) {
+if (keyMap[key] === -1) {
+removedIdxs.push(this._keyToInstIdx[key]);
+}
+if (keyMap[key] === 1) {
+addedKeys.push(key);
+}
+}
+if (removedIdxs.length) {
+removedIdxs.sort(this._numericSort);
+for (var i = removedIdxs.length - 1; i >= 0; i--) {
+var idx = removedIdxs[i];
+if (idx !== undefined) {
+pool.push(this._detachRow(idx));
+instances.splice(idx, 1);
+}
+}
+}
+if (addedKeys.length) {
+if (this._filterFn) {
+addedKeys = addedKeys.filter(function (a) {
+return this._filterFn(c.getItem(a));
+}, this);
+}
+addedKeys.sort(function (a, b) {
+return this._sortFn(c.getItem(a), c.getItem(b));
+}.bind(this));
+var start = 0;
+for (var i = 0; i < addedKeys.length; i++) {
+start = this._insertRowUserSort(start, addedKeys[i], pool);
+}
+}
+},
+_insertRowUserSort: function (start, key, pool) {
+var c = this.collection;
+var item = c.getItem(key);
+var end = this._instances.length - 1;
+var idx = -1;
+var sortFn = this._sortFn || this._keySort.bind(this);
+while (start <= end) {
+var mid = start + end >> 1;
+var midKey = this._instances[mid].__key__;
+var cmp = sortFn(c.getItem(midKey), item);
+if (cmp < 0) {
+start = mid + 1;
+} else if (cmp > 0) {
+end = mid - 1;
+} else {
+idx = mid;
+break;
+}
+}
+if (idx < 0) {
+idx = end + 1;
+}
+this._instances.splice(idx, 0, this._insertRow(idx, key, pool));
+return idx;
+},
+_applySplicesArrayOrder: function (splices) {
+var pool = [];
+var c = this.collection;
+splices.forEach(function (s) {
+for (var i = 0; i < s.removed.length; i++) {
+var inst = this._detachRow(s.index + i);
+if (!inst.isPlaceholder) {
+pool.push(inst);
+}
+}
+this._instances.splice(s.index, s.removed.length);
+for (var i = 0; i < s.addedKeys.length; i++) {
+var inst = {
+isPlaceholder: true,
+key: s.addedKeys[i]
+};
+this._instances.splice(s.index + i, 0, inst);
+}
+}, this);
+for (var i = this._instances.length - 1; i >= 0; i--) {
+var inst = this._instances[i];
+if (inst.isPlaceholder) {
+this._instances[i] = this._insertRow(i, inst.key, pool, true);
+}
+}
+},
+_detachRow: function (idx) {
+var inst = this._instances[idx];
+if (!inst.isPlaceholder) {
+var parentNode = Polymer.dom(this).parentNode;
+for (var i = 0; i < inst._children.length; i++) {
+var el = inst._children[i];
+Polymer.dom(inst.root).appendChild(el);
+}
+}
+return inst;
+},
+_insertRow: function (idx, key, pool, replace) {
+var inst;
+if (inst = pool && pool.pop()) {
+inst.__setProperty(this.as, this.collection.getItem(key), true);
+inst.__setProperty('__key__', key, true);
+} else {
+inst = this._generateRow(idx, key);
+}
+var beforeRow = this._instances[replace ? idx + 1 : idx];
+var beforeNode = beforeRow ? beforeRow._children[0] : this;
+var parentNode = Polymer.dom(this).parentNode;
+Polymer.dom(parentNode).insertBefore(inst.root, beforeNode);
+return inst;
+},
+_generateRow: function (idx, key) {
+var model = { __key__: key };
+model[this.as] = this.collection.getItem(key);
+model[this.indexAs] = idx;
+var inst = this.stamp(model);
+return inst;
+},
+_showHideChildren: function (hidden) {
+for (var i = 0; i < this._instances.length; i++) {
+this._instances[i]._showHideChildren(hidden);
+}
+},
+_forwardInstanceProp: function (inst, prop, value) {
+if (prop == this.as) {
+var idx;
+if (this._sortFn || this._filterFn) {
+idx = this.items.indexOf(this.collection.getItem(inst.__key__));
+} else {
+idx = inst[this.indexAs];
+}
+this.set('items.' + idx, value);
+}
+},
+_forwardInstancePath: function (inst, path, value) {
+if (path.indexOf(this.as + '.') === 0) {
+this.notifyPath('items.' + inst.__key__ + '.' + path.slice(this.as.length + 1), value);
+}
+},
+_forwardParentProp: function (prop, value) {
+this._instances.forEach(function (inst) {
+inst.__setProperty(prop, value, true);
+}, this);
+},
+_forwardParentPath: function (path, value) {
+this._instances.forEach(function (inst) {
+inst.notifyPath(path, value, true);
+}, this);
+},
+_forwardItemPath: function (path, value) {
+if (this._keyToInstIdx) {
+var dot = path.indexOf('.');
+var key = path.substring(0, dot < 0 ? path.length : dot);
+var idx = this._keyToInstIdx[key];
+var inst = this._instances[idx];
+if (inst) {
+if (dot >= 0) {
+path = this.as + '.' + path.substring(dot + 1);
+inst.notifyPath(path, value, true);
+} else {
+inst.__setProperty(this.as, value, true);
+}
+}
+}
+},
+itemForElement: function (el) {
+var instance = this.modelForElement(el);
+return instance && instance[this.as];
+},
+keyForElement: function (el) {
+var instance = this.modelForElement(el);
+return instance && instance.__key__;
+},
+indexForElement: function (el) {
+var instance = this.modelForElement(el);
+return instance && instance[this.indexAs];
+}
+});
+Polymer({
+is: 'array-selector',
+properties: {
+items: {
+type: Array,
+observer: 'clearSelection'
+},
+multi: {
+type: Boolean,
+value: false,
+observer: 'clearSelection'
+},
+selected: {
+type: Object,
+notify: true
+},
+selectedItem: {
+type: Object,
+notify: true
+},
+toggle: {
+type: Boolean,
+value: false
+}
+},
+clearSelection: function () {
+if (Array.isArray(this.selected)) {
+for (var i = 0; i < this.selected.length; i++) {
+this.unlinkPaths('selected.' + i);
+}
+} else {
+this.unlinkPaths('selected');
+}
+if (this.multi) {
+if (!this.selected || this.selected.length) {
+this.selected = [];
+this._selectedColl = Polymer.Collection.get(this.selected);
+}
+} else {
+this.selected = null;
+this._selectedColl = null;
+}
+this.selectedItem = null;
+},
+isSelected: function (item) {
+if (this.multi) {
+return this._selectedColl.getKey(item) !== undefined;
+} else {
+return this.selected == item;
+}
+},
+deselect: function (item) {
+if (this.multi) {
+if (this.isSelected(item)) {
+var skey = this._selectedColl.getKey(item);
+this.arrayDelete('selected', item);
+this.unlinkPaths('selected.' + skey);
+}
+} else {
+this.selected = null;
+this.selectedItem = null;
+this.unlinkPaths('selected');
+this.unlinkPaths('selectedItem');
+}
+},
+select: function (item) {
+var icol = Polymer.Collection.get(this.items);
+var key = icol.getKey(item);
+if (this.multi) {
+if (this.isSelected(item)) {
+if (this.toggle) {
+this.deselect(item);
+}
+} else {
+this.push('selected', item);
+skey = this._selectedColl.getKey(item);
+this.linkPaths('selected.' + skey, 'items.' + key);
+}
+} else {
+if (this.toggle && item == this.selected) {
+this.deselect();
+} else {
+this.selected = item;
+this.selectedItem = item;
+this.linkPaths('selected', 'items.' + key);
+this.linkPaths('selectedItem', 'items.' + key);
+}
+}
+}
+});
+Polymer({
+is: 'dom-if',
+extends: 'template',
+properties: {
+'if': {
+type: Boolean,
+value: false,
+observer: '_queueRender'
+},
+restamp: {
+type: Boolean,
+value: false,
+observer: '_queueRender'
+}
+},
+behaviors: [Polymer.Templatizer],
+_queueRender: function () {
+this._debounceTemplate(this._render);
+},
+detached: function () {
+this._teardownInstance();
+},
+attached: function () {
+if (this.if && this.ctor) {
+this.async(this._ensureInstance);
+}
+},
+render: function () {
+this._flushTemplates();
+},
+_render: function () {
+if (this.if) {
+if (!this.ctor) {
+this.templatize(this);
+}
+this._ensureInstance();
+this._showHideChildren();
+} else if (this.restamp) {
+this._teardownInstance();
+}
+if (!this.restamp && this._instance) {
+this._showHideChildren();
+}
+if (this.if != this._lastIf) {
+this.fire('dom-change');
+this._lastIf = this.if;
+}
+},
+_ensureInstance: function () {
+if (!this._instance) {
+this._instance = this.stamp();
+var root = this._instance.root;
+var parent = Polymer.dom(Polymer.dom(this).parentNode);
+parent.insertBefore(root, this);
+}
+},
+_teardownInstance: function () {
+if (this._instance) {
+var c = this._instance._children;
+if (c) {
+var parent = Polymer.dom(Polymer.dom(c[0]).parentNode);
+c.forEach(function (n) {
+parent.removeChild(n);
+});
+}
+this._instance = null;
+}
+},
+_showHideChildren: function () {
+var hidden = this.__hideTemplateChildren__ || !this.if;
+if (this._instance) {
+this._instance._showHideChildren(hidden);
+}
+},
+_forwardParentProp: function (prop, value) {
+if (this._instance) {
+this._instance[prop] = value;
+}
+},
+_forwardParentPath: function (path, value) {
+if (this._instance) {
+this._instance.notifyPath(path, value, true);
+}
+}
+});
+Polymer({
+is: 'dom-bind',
+extends: 'template',
+created: function () {
+Polymer.RenderStatus.whenReady(this._markImportsReady.bind(this));
+},
+_ensureReady: function () {
+if (!this._readied) {
+this._readySelf();
+}
+},
+_markImportsReady: function () {
+this._importsReady = true;
+this._ensureReady();
+},
+_registerFeatures: function () {
+this._prepConstructor();
+},
+_insertChildren: function () {
+var parentDom = Polymer.dom(Polymer.dom(this).parentNode);
+parentDom.insertBefore(this.root, this);
+},
+_removeChildren: function () {
+if (this._children) {
+for (var i = 0; i < this._children.length; i++) {
+this.root.appendChild(this._children[i]);
+}
+}
+},
+_initFeatures: function () {
+},
+_scopeElementClass: function (element, selector) {
+if (this.dataHost) {
+return this.dataHost._scopeElementClass(element, selector);
+} else {
+return selector;
+}
+},
+_prepConfigure: function () {
+var config = {};
+for (var prop in this._propertyEffects) {
+config[prop] = this[prop];
+}
+this._setupConfigure = this._setupConfigure.bind(this, config);
+},
+attached: function () {
+if (this._importsReady) {
+this.render();
+}
+},
+detached: function () {
+this._removeChildren();
+},
+render: function () {
+this._ensureReady();
+if (!this._children) {
+this._template = this;
+this._prepAnnotations();
+this._prepEffects();
+this._prepBehaviors();
+this._prepConfigure();
+this._prepBindings();
+Polymer.Base._initFeatures.call(this);
+this._children = Array.prototype.slice.call(this.root.childNodes);
+}
+this._insertChildren();
+this.fire('dom-change');
+}
+});
+(function() {
+
+    'use strict';
+
+    var SHADOW_WHEN_SCROLLING = 1;
+    var SHADOW_ALWAYS = 2;
+
+
+    var MODE_CONFIGS = {
+
+      outerScroll: {
+        'scroll': true
+      },
+
+      shadowMode: {
+        'standard': SHADOW_ALWAYS,
+        'waterfall': SHADOW_WHEN_SCROLLING,
+        'waterfall-tall': SHADOW_WHEN_SCROLLING
+      },
+
+      tallMode: {
+        'waterfall-tall': true
+      }
+    };
+
+    Polymer({
+
+      is: 'paper-header-panel',
+
+      /**
+       * Fired when the content has been scrolled.  `event.detail.target` returns
+       * the scrollable element which you can use to access scroll info such as
+       * `scrollTop`.
+       *
+       *     <paper-header-panel on-content-scroll="scrollHandler">
+       *       ...
+       *     </paper-header-panel>
+       *
+       *
+       *     scrollHandler: function(event) {
+       *       var scroller = event.detail.target;
+       *       console.log(scroller.scrollTop);
+       *     }
+       *
+       * @event content-scroll
+       */
+
+      properties: {
+
+        /**
+         * Controls header and scrolling behavior. Options are
+         * `standard`, `seamed`, `waterfall`, `waterfall-tall`, `scroll` and
+         * `cover`. Default is `standard`.
+         *
+         * `standard`: The header is a step above the panel. The header will consume the
+         * panel at the point of entry, preventing it from passing through to the
+         * opposite side.
+         *
+         * `seamed`: The header is presented as seamed with the panel.
+         *
+         * `waterfall`: Similar to standard mode, but header is initially presented as
+         * seamed with panel, but then separates to form the step.
+         *
+         * `waterfall-tall`: The header is initially taller (`tall` class is added to
+         * the header).  As the user scrolls, the header separates (forming an edge)
+         * while condensing (`tall` class is removed from the header).
+         *
+         * `scroll`: The header keeps its seam with the panel, and is pushed off screen.
+         *
+         * `cover`: The panel covers the whole `paper-header-panel` including the
+         * header. This allows user to style the panel in such a way that the panel is
+         * partially covering the header.
+         *
+         *     <paper-header-panel mode="cover">
+         *       <paper-toolbar class="tall">
+         *         <core-icon-button icon="menu"></core-icon-button>
+         *       </paper-toolbar>
+         *       <div class="content"></div>
+         *     </paper-header-panel>
+         */
+        mode: {
+          type: String,
+          value: 'standard',
+          observer: '_modeChanged',
+          reflectToAttribute: true
+        },
+
+        /**
+         * If true, the drop-shadow is always shown no matter what mode is set to.
+         */
+        shadow: {
+          type: Boolean,
+          value: false
+        },
+
+        /**
+         * The class used in waterfall-tall mode.  Change this if the header
+         * accepts a different class for toggling height, e.g. "medium-tall"
+         */
+        tallClass: {
+          type: String,
+          value: 'tall'
+        },
+
+        /**
+         * If true, the scroller is at the top
+         */
+        atTop: {
+          type: Boolean,
+          value: true,
+          readOnly: true
+        }
+      },
+
+      observers: [
+        '_computeDropShadowHidden(atTop, mode, shadow)'
+      ],
+
+      ready: function() {
+        this.scrollHandler = this._scroll.bind(this);
+        this._addListener();
+
+        // Run `scroll` logic once to initialze class names, etc.
+        this._keepScrollingState();
+      },
+
+      detached: function() {
+        this._removeListener();
+      },
+
+      /**
+       * Returns the header element
+       *
+       * @property header
+       * @type Object
+       */
+      get header() {
+        return Polymer.dom(this.$.headerContent).getDistributedNodes()[0];
+      },
+
+      /**
+       * Returns the scrollable element.
+       *
+       * @property scroller
+       * @type Object
+       */
+      get scroller() {
+        return this._getScrollerForMode(this.mode);
+      },
+
+      /**
+       * Returns true if the scroller has a visible shadow.
+       *
+       * @property visibleShadow
+       * @type Boolean
+       */
+      get visibleShadow() {
+        return this.$.dropShadow.classList.contains('has-shadow');
+      },
+
+      _computeDropShadowHidden: function(atTop, mode, shadow) {
+
+        var shadowMode = MODE_CONFIGS.shadowMode[mode];
+
+        if (this.shadow) {
+          this.toggleClass('has-shadow', true, this.$.dropShadow);
+
+        } else if (shadowMode === SHADOW_ALWAYS) {
+          this.toggleClass('has-shadow', true, this.$.dropShadow);
+
+        } else if (shadowMode === SHADOW_WHEN_SCROLLING && !atTop) {
+          this.toggleClass('has-shadow', true, this.$.dropShadow);
+
+        } else {
+          this.toggleClass('has-shadow', false, this.$.dropShadow);
+
+        }
+      },
+
+      _computeMainContainerClass: function(mode) {
+        // TODO:  It will be useful to have a utility for classes
+        // e.g. Polymer.Utils.classes({ foo: true });
+
+        var classes = {};
+
+        classes['flex'] = mode !== 'cover';
+
+        return Object.keys(classes).filter(
+          function(className) {
+            return classes[className];
+          }).join(' ');
+      },
+
+      _addListener: function() {
+        this.scroller.addEventListener('scroll', this.scrollHandler, false);
+      },
+
+      _removeListener: function() {
+        this.scroller.removeEventListener('scroll', this.scrollHandler);
+      },
+
+      _modeChanged: function(newMode, oldMode) {
+        var configs = MODE_CONFIGS;
+        var header = this.header;
+        var animateDuration = 200;
+
+        if (header) {
+          // in tallMode it may add tallClass to the header; so do the cleanup
+          // when mode is changed from tallMode to not tallMode
+          if (configs.tallMode[oldMode] && !configs.tallMode[newMode]) {
+            header.classList.remove(this.tallClass);
+            this.async(function() {
+              header.classList.remove('animate');
+            }, animateDuration);
+          } else {
+            header.classList.toggle('animate', configs.tallMode[newMode]);
+          }
+        }
+        this._keepScrollingState();
+      },
+
+      _keepScrollingState: function() {
+        var main = this.scroller;
+        var header = this.header;
+
+        this._setAtTop(main.scrollTop === 0);
+
+        if (header && this.tallClass && MODE_CONFIGS.tallMode[this.mode]) {
+          this.toggleClass(this.tallClass, this.atTop ||
+              header.classList.contains(this.tallClass) &&
+              main.scrollHeight < this.offsetHeight, header);
+        }
+      },
+
+      _scroll: function() {
+        this._keepScrollingState();
+        this.fire('content-scroll', {target: this.scroller}, {bubbles: false});
+      },
+
+      _getScrollerForMode: function(mode) {
+        return MODE_CONFIGS.outerScroll[mode] ?
+            this : this.$.mainContainer;
+      }
+
+    });
+
+  })();
+Polymer({
+    is: 'paper-material',
+
+    properties: {
+
+      /**
+       * The z-depth of this element, from 0-5. Setting to 0 will remove the
+       * shadow, and each increasing number greater than 0 will be "deeper"
+       * than the last.
+       *
+       * @attribute elevation
+       * @type number
+       * @default 1
+       */
+      elevation: {
+        type: Number,
+        reflectToAttribute: true,
+        value: 1
+      },
+
+      /**
+       * Set this to true to animate the shadow when setting a new
+       * `elevation` value.
+       *
+       * @attribute animated
+       * @type boolean
+       * @default false
+       */
+      animated: {
+        type: Boolean,
+        reflectToAttribute: true,
+        value: false
+      }
+    }
+  });
+(function() {
+    'use strict';
+
+    /**
+     * Chrome uses an older version of DOM Level 3 Keyboard Events
+     *
+     * Most keys are labeled as text, but some are Unicode codepoints.
+     * Values taken from: http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/keyset.html#KeySet-Set
+     */
+    var KEY_IDENTIFIER = {
+      'U+0009': 'tab',
+      'U+001B': 'esc',
+      'U+0020': 'space',
+      'U+002A': '*',
+      'U+0030': '0',
+      'U+0031': '1',
+      'U+0032': '2',
+      'U+0033': '3',
+      'U+0034': '4',
+      'U+0035': '5',
+      'U+0036': '6',
+      'U+0037': '7',
+      'U+0038': '8',
+      'U+0039': '9',
+      'U+0041': 'a',
+      'U+0042': 'b',
+      'U+0043': 'c',
+      'U+0044': 'd',
+      'U+0045': 'e',
+      'U+0046': 'f',
+      'U+0047': 'g',
+      'U+0048': 'h',
+      'U+0049': 'i',
+      'U+004A': 'j',
+      'U+004B': 'k',
+      'U+004C': 'l',
+      'U+004D': 'm',
+      'U+004E': 'n',
+      'U+004F': 'o',
+      'U+0050': 'p',
+      'U+0051': 'q',
+      'U+0052': 'r',
+      'U+0053': 's',
+      'U+0054': 't',
+      'U+0055': 'u',
+      'U+0056': 'v',
+      'U+0057': 'w',
+      'U+0058': 'x',
+      'U+0059': 'y',
+      'U+005A': 'z',
+      'U+007F': 'del'
+    };
+
+    /**
+     * Special table for KeyboardEvent.keyCode.
+     * KeyboardEvent.keyIdentifier is better, and KeyBoardEvent.key is even better
+     * than that.
+     *
+     * Values from: https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent.keyCode#Value_of_keyCode
+     */
+    var KEY_CODE = {
+      9: 'tab',
+      13: 'enter',
+      27: 'esc',
+      33: 'pageup',
+      34: 'pagedown',
+      35: 'end',
+      36: 'home',
+      32: 'space',
+      37: 'left',
+      38: 'up',
+      39: 'right',
+      40: 'down',
+      46: 'del',
+      106: '*'
+    };
+
+    /**
+     * MODIFIER_KEYS maps the short name for modifier keys used in a key
+     * combo string to the property name that references those same keys
+     * in a KeyboardEvent instance.
+     */
+    var MODIFIER_KEYS = {
+      'shift': 'shiftKey',
+      'ctrl': 'ctrlKey',
+      'alt': 'altKey',
+      'meta': 'metaKey'
+    };
+
+    /**
+     * KeyboardEvent.key is mostly represented by printable character made by
+     * the keyboard, with unprintable keys labeled nicely.
+     *
+     * However, on OS X, Alt+char can make a Unicode character that follows an
+     * Apple-specific mapping. In this case, we
+     * fall back to .keyCode.
+     */
+    var KEY_CHAR = /[a-z0-9*]/;
+
+    /**
+     * Matches a keyIdentifier string.
+     */
+    var IDENT_CHAR = /U\+/;
+
+    /**
+     * Matches arrow keys in Gecko 27.0+
+     */
+    var ARROW_KEY = /^arrow/;
+
+    /**
+     * Matches space keys everywhere (notably including IE10's exceptional name
+     * `spacebar`).
+     */
+    var SPACE_KEY = /^space(bar)?/;
+
+    function transformKey(key) {
+      var validKey = '';
+      if (key) {
+        var lKey = key.toLowerCase();
+        if (lKey.length == 1) {
+          if (KEY_CHAR.test(lKey)) {
+            validKey = lKey;
+          }
+        } else if (ARROW_KEY.test(lKey)) {
+          validKey = lKey.replace('arrow', '');
+        } else if (SPACE_KEY.test(lKey)) {
+          validKey = 'space';
+        } else if (lKey == 'multiply') {
+          // numpad '*' can map to Multiply on IE/Windows
+          validKey = '*';
+        } else {
+          validKey = lKey;
+        }
+      }
+      return validKey;
+    }
+
+    function transformKeyIdentifier(keyIdent) {
+      var validKey = '';
+      if (keyIdent) {
+        if (IDENT_CHAR.test(keyIdent)) {
+          validKey = KEY_IDENTIFIER[keyIdent];
+        } else {
+          validKey = keyIdent.toLowerCase();
+        }
+      }
+      return validKey;
+    }
+
+    function transformKeyCode(keyCode) {
+      var validKey = '';
+      if (Number(keyCode)) {
+        if (keyCode >= 65 && keyCode <= 90) {
+          // ascii a-z
+          // lowercase is 32 offset from uppercase
+          validKey = String.fromCharCode(32 + keyCode);
+        } else if (keyCode >= 112 && keyCode <= 123) {
+          // function keys f1-f12
+          validKey = 'f' + (keyCode - 112);
+        } else if (keyCode >= 48 && keyCode <= 57) {
+          // top 0-9 keys
+          validKey = String(48 - keyCode);
+        } else if (keyCode >= 96 && keyCode <= 105) {
+          // num pad 0-9
+          validKey = String(96 - keyCode);
+        } else {
+          validKey = KEY_CODE[keyCode];
+        }
+      }
+      return validKey;
+    }
+
+    function normalizedKeyForEvent(keyEvent) {
+      // fall back from .key, to .keyIdentifier, to .keyCode, and then to
+      // .detail.key to support artificial keyboard events
+      return transformKey(keyEvent.key) ||
+        transformKeyIdentifier(keyEvent.keyIdentifier) ||
+        transformKeyCode(keyEvent.keyCode) ||
+        transformKey(keyEvent.detail.key) || '';
+    }
+
+    function keyComboMatchesEvent(keyCombo, keyEvent) {
+      return normalizedKeyForEvent(keyEvent) === keyCombo.key &&
+        !!keyEvent.shiftKey === !!keyCombo.shiftKey &&
+        !!keyEvent.ctrlKey === !!keyCombo.ctrlKey &&
+        !!keyEvent.altKey === !!keyCombo.altKey &&
+        !!keyEvent.metaKey === !!keyCombo.metaKey;
+    }
+
+    function parseKeyComboString(keyComboString) {
+      return keyComboString.split('+').reduce(function(parsedKeyCombo, keyComboPart) {
+        var eventParts = keyComboPart.split(':');
+        var keyName = eventParts[0];
+        var event = eventParts[1];
+
+        if (keyName in MODIFIER_KEYS) {
+          parsedKeyCombo[MODIFIER_KEYS[keyName]] = true;
+        } else {
+          parsedKeyCombo.key = keyName;
+          parsedKeyCombo.event = event || 'keydown';
+        }
+
+        return parsedKeyCombo;
+      }, {
+        combo: keyComboString.split(':').shift()
+      });
+    }
+
+    function parseEventString(eventString) {
+      return eventString.split(' ').map(function(keyComboString) {
+        return parseKeyComboString(keyComboString);
+      });
+    }
+
+
+    /**
+     * `Polymer.IronA11yKeysBehavior` provides a normalized interface for processing
+     * keyboard commands that pertain to [WAI-ARIA best practices](http://www.w3.org/TR/wai-aria-practices/#kbd_general_binding).
+     * The element takes care of browser differences with respect to Keyboard events
+     * and uses an expressive syntax to filter key presses.
+     *
+     * Use the `keyBindings` prototype property to express what combination of keys
+     * will trigger the event to fire.
+     *
+     * Use the `key-event-target` attribute to set up event handlers on a specific
+     * node.
+     * The `keys-pressed` event will fire when one of the key combinations set with the
+     * `keys` property is pressed.
+     *
+     * @demo demo/index.html
+     * @polymerBehavior
+     */
+    Polymer.IronA11yKeysBehavior = {
+      properties: {
+        /**
+         * The HTMLElement that will be firing relevant KeyboardEvents.
+         */
+        keyEventTarget: {
+          type: Object,
+          value: function() {
+            return this;
+          }
+        },
+
+        _boundKeyHandlers: {
+          type: Array,
+          value: function() {
+            return [];
+          }
+        },
+
+        // We use this due to a limitation in IE10 where instances will have
+        // own properties of everything on the "prototype".
+        _imperativeKeyBindings: {
+          type: Object,
+          value: function() {
+            return {};
+          }
+        }
+      },
+
+      observers: [
+        '_resetKeyEventListeners(keyEventTarget, _boundKeyHandlers)'
+      ],
+
+      keyBindings: {},
+
+      registered: function() {
+        this._prepKeyBindings();
+      },
+
+      attached: function() {
+        this._listenKeyEventListeners();
+      },
+
+      detached: function() {
+        this._unlistenKeyEventListeners();
+      },
+
+      /**
+       * Can be used to imperatively add a key binding to the implementing
+       * element. This is the imperative equivalent of declaring a keybinding
+       * in the `keyBindings` prototype property.
+       */
+      addOwnKeyBinding: function(eventString, handlerName) {
+        this._imperativeKeyBindings[eventString] = handlerName;
+        this._prepKeyBindings();
+        this._resetKeyEventListeners();
+      },
+
+      /**
+       * When called, will remove all imperatively-added key bindings.
+       */
+      removeOwnKeyBindings: function() {
+        this._imperativeKeyBindings = {};
+        this._prepKeyBindings();
+        this._resetKeyEventListeners();
+      },
+
+      keyboardEventMatchesKeys: function(event, eventString) {
+        var keyCombos = parseEventString(eventString);
+        var index;
+
+        for (index = 0; index < keyCombos.length; ++index) {
+          if (keyComboMatchesEvent(keyCombos[index], event)) {
+            return true;
+          }
+        }
+
+        return false;
+      },
+
+      _collectKeyBindings: function() {
+        var keyBindings = this.behaviors.map(function(behavior) {
+          return behavior.keyBindings;
+        });
+
+        if (keyBindings.indexOf(this.keyBindings) === -1) {
+          keyBindings.push(this.keyBindings);
+        }
+
+        return keyBindings;
+      },
+
+      _prepKeyBindings: function() {
+        this._keyBindings = {};
+
+        this._collectKeyBindings().forEach(function(keyBindings) {
+          for (var eventString in keyBindings) {
+            this._addKeyBinding(eventString, keyBindings[eventString]);
+          }
+        }, this);
+
+        for (var eventString in this._imperativeKeyBindings) {
+          this._addKeyBinding(eventString, this._imperativeKeyBindings[eventString]);
+        }
+      },
+
+      _addKeyBinding: function(eventString, handlerName) {
+        parseEventString(eventString).forEach(function(keyCombo) {
+          this._keyBindings[keyCombo.event] =
+            this._keyBindings[keyCombo.event] || [];
+
+          this._keyBindings[keyCombo.event].push([
+            keyCombo,
+            handlerName
+          ]);
+        }, this);
+      },
+
+      _resetKeyEventListeners: function() {
+        this._unlistenKeyEventListeners();
+
+        if (this.isAttached) {
+          this._listenKeyEventListeners();
+        }
+      },
+
+      _listenKeyEventListeners: function() {
+        Object.keys(this._keyBindings).forEach(function(eventName) {
+          var keyBindings = this._keyBindings[eventName];
+          var boundKeyHandler = this._onKeyBindingEvent.bind(this, keyBindings);
+
+          this._boundKeyHandlers.push([this.keyEventTarget, eventName, boundKeyHandler]);
+
+          this.keyEventTarget.addEventListener(eventName, boundKeyHandler);
+        }, this);
+      },
+
+      _unlistenKeyEventListeners: function() {
+        var keyHandlerTuple;
+        var keyEventTarget;
+        var eventName;
+        var boundKeyHandler;
+
+        while (this._boundKeyHandlers.length) {
+          // My kingdom for block-scope binding and destructuring assignment..
+          keyHandlerTuple = this._boundKeyHandlers.pop();
+          keyEventTarget = keyHandlerTuple[0];
+          eventName = keyHandlerTuple[1];
+          boundKeyHandler = keyHandlerTuple[2];
+
+          keyEventTarget.removeEventListener(eventName, boundKeyHandler);
+        }
+      },
+
+      _onKeyBindingEvent: function(keyBindings, event) {
+        keyBindings.forEach(function(keyBinding) {
+          var keyCombo = keyBinding[0];
+          var handlerName = keyBinding[1];
+
+          if (!event.defaultPrevented && keyComboMatchesEvent(keyCombo, event)) {
+            this._triggerKeyHandler(keyCombo, handlerName, event);
+          }
+        }, this);
+      },
+
+      _triggerKeyHandler: function(keyCombo, handlerName, keyboardEvent) {
+        var detail = Object.create(keyCombo);
+        detail.keyboardEvent = keyboardEvent;
+
+        this[handlerName].call(this, new CustomEvent(keyCombo.event, {
+          detail: detail
+        }));
+      }
+    };
+  })();
+(function() {
+    var Utility = {
+      distance: function(x1, y1, x2, y2) {
+        var xDelta = (x1 - x2);
+        var yDelta = (y1 - y2);
+
+        return Math.sqrt(xDelta * xDelta + yDelta * yDelta);
+      },
+
+      now: window.performance && window.performance.now ?
+          window.performance.now.bind(window.performance) : Date.now
+    };
+
+    /**
+     * @param {HTMLElement} element
+     * @constructor
+     */
+    function ElementMetrics(element) {
+      this.element = element;
+      this.width = this.boundingRect.width;
+      this.height = this.boundingRect.height;
+
+      this.size = Math.max(this.width, this.height);
+    }
+
+    ElementMetrics.prototype = {
+      get boundingRect () {
+        return this.element.getBoundingClientRect();
+      },
+
+      furthestCornerDistanceFrom: function(x, y) {
+        var topLeft = Utility.distance(x, y, 0, 0);
+        var topRight = Utility.distance(x, y, this.width, 0);
+        var bottomLeft = Utility.distance(x, y, 0, this.height);
+        var bottomRight = Utility.distance(x, y, this.width, this.height);
+
+        return Math.max(topLeft, topRight, bottomLeft, bottomRight);
+      }
+    };
+
+    /**
+     * @param {HTMLElement} element
+     * @constructor
+     */
+    function Ripple(element) {
+      this.element = element;
+      this.color = window.getComputedStyle(element).color;
+
+      this.wave = document.createElement('div');
+      this.waveContainer = document.createElement('div');
+      this.wave.style.backgroundColor = this.color;
+      this.wave.classList.add('wave');
+      this.waveContainer.classList.add('wave-container');
+      Polymer.dom(this.waveContainer).appendChild(this.wave);
+
+      this.resetInteractionState();
+    }
+
+    Ripple.MAX_RADIUS = 300;
+
+    Ripple.prototype = {
+      get recenters() {
+        return this.element.recenters;
+      },
+
+      get center() {
+        return this.element.center;
+      },
+
+      get mouseDownElapsed() {
+        var elapsed;
+
+        if (!this.mouseDownStart) {
+          return 0;
+        }
+
+        elapsed = Utility.now() - this.mouseDownStart;
+
+        if (this.mouseUpStart) {
+          elapsed -= this.mouseUpElapsed;
+        }
+
+        return elapsed;
+      },
+
+      get mouseUpElapsed() {
+        return this.mouseUpStart ?
+          Utility.now () - this.mouseUpStart : 0;
+      },
+
+      get mouseDownElapsedSeconds() {
+        return this.mouseDownElapsed / 1000;
+      },
+
+      get mouseUpElapsedSeconds() {
+        return this.mouseUpElapsed / 1000;
+      },
+
+      get mouseInteractionSeconds() {
+        return this.mouseDownElapsedSeconds + this.mouseUpElapsedSeconds;
+      },
+
+      get initialOpacity() {
+        return this.element.initialOpacity;
+      },
+
+      get opacityDecayVelocity() {
+        return this.element.opacityDecayVelocity;
+      },
+
+      get radius() {
+        var width2 = this.containerMetrics.width * this.containerMetrics.width;
+        var height2 = this.containerMetrics.height * this.containerMetrics.height;
+        var waveRadius = Math.min(
+          Math.sqrt(width2 + height2),
+          Ripple.MAX_RADIUS
+        ) * 1.1 + 5;
+
+        var duration = 1.1 - 0.2 * (waveRadius / Ripple.MAX_RADIUS);
+        var timeNow = this.mouseInteractionSeconds / duration;
+        var size = waveRadius * (1 - Math.pow(80, -timeNow));
+
+        return Math.abs(size);
+      },
+
+      get opacity() {
+        if (!this.mouseUpStart) {
+          return this.initialOpacity;
+        }
+
+        return Math.max(
+          0,
+          this.initialOpacity - this.mouseUpElapsedSeconds * this.opacityDecayVelocity
+        );
+      },
+
+      get outerOpacity() {
+        // Linear increase in background opacity, capped at the opacity
+        // of the wavefront (waveOpacity).
+        var outerOpacity = this.mouseUpElapsedSeconds * 0.3;
+        var waveOpacity = this.opacity;
+
+        return Math.max(
+          0,
+          Math.min(outerOpacity, waveOpacity)
+        );
+      },
+
+      get isOpacityFullyDecayed() {
+        return this.opacity < 0.01 &&
+          this.radius >= Math.min(this.maxRadius, Ripple.MAX_RADIUS);
+      },
+
+      get isRestingAtMaxRadius() {
+        return this.opacity >= this.initialOpacity &&
+          this.radius >= Math.min(this.maxRadius, Ripple.MAX_RADIUS);
+      },
+
+      get isAnimationComplete() {
+        return this.mouseUpStart ?
+          this.isOpacityFullyDecayed : this.isRestingAtMaxRadius;
+      },
+
+      get translationFraction() {
+        return Math.min(
+          1,
+          this.radius / this.containerMetrics.size * 2 / Math.sqrt(2)
+        );
+      },
+
+      get xNow() {
+        if (this.xEnd) {
+          return this.xStart + this.translationFraction * (this.xEnd - this.xStart);
+        }
+
+        return this.xStart;
+      },
+
+      get yNow() {
+        if (this.yEnd) {
+          return this.yStart + this.translationFraction * (this.yEnd - this.yStart);
+        }
+
+        return this.yStart;
+      },
+
+      get isMouseDown() {
+        return this.mouseDownStart && !this.mouseUpStart;
+      },
+
+      resetInteractionState: function() {
+        this.maxRadius = 0;
+        this.mouseDownStart = 0;
+        this.mouseUpStart = 0;
+
+        this.xStart = 0;
+        this.yStart = 0;
+        this.xEnd = 0;
+        this.yEnd = 0;
+        this.slideDistance = 0;
+
+        this.containerMetrics = new ElementMetrics(this.element);
+      },
+
+      draw: function() {
+        var scale;
+        var translateString;
+        var dx;
+        var dy;
+
+        this.wave.style.opacity = this.opacity;
+
+        scale = this.radius / (this.containerMetrics.size / 2);
+        dx = this.xNow - (this.containerMetrics.width / 2);
+        dy = this.yNow - (this.containerMetrics.height / 2);
+
+
+        // 2d transform for safari because of border-radius and overflow:hidden clipping bug.
+        // https://bugs.webkit.org/show_bug.cgi?id=98538
+        this.waveContainer.style.webkitTransform = 'translate(' + dx + 'px, ' + dy + 'px)';
+        this.waveContainer.style.transform = 'translate3d(' + dx + 'px, ' + dy + 'px, 0)';
+        this.wave.style.webkitTransform = 'scale(' + scale + ',' + scale + ')';
+        this.wave.style.transform = 'scale3d(' + scale + ',' + scale + ',1)';
+      },
+
+      /** @param {Event=} event */
+      downAction: function(event) {
+        var xCenter = this.containerMetrics.width / 2;
+        var yCenter = this.containerMetrics.height / 2;
+
+        this.resetInteractionState();
+        this.mouseDownStart = Utility.now();
+
+        if (this.center) {
+          this.xStart = xCenter;
+          this.yStart = yCenter;
+          this.slideDistance = Utility.distance(
+            this.xStart, this.yStart, this.xEnd, this.yEnd
+          );
+        } else {
+          this.xStart = event ?
+              event.detail.x - this.containerMetrics.boundingRect.left :
+              this.containerMetrics.width / 2;
+          this.yStart = event ?
+              event.detail.y - this.containerMetrics.boundingRect.top :
+              this.containerMetrics.height / 2;
+        }
+
+        if (this.recenters) {
+          this.xEnd = xCenter;
+          this.yEnd = yCenter;
+          this.slideDistance = Utility.distance(
+            this.xStart, this.yStart, this.xEnd, this.yEnd
+          );
+        }
+
+        this.maxRadius = this.containerMetrics.furthestCornerDistanceFrom(
+          this.xStart,
+          this.yStart
+        );
+
+        this.waveContainer.style.top =
+          (this.containerMetrics.height - this.containerMetrics.size) / 2 + 'px';
+        this.waveContainer.style.left =
+          (this.containerMetrics.width - this.containerMetrics.size) / 2 + 'px';
+
+        this.waveContainer.style.width = this.containerMetrics.size + 'px';
+        this.waveContainer.style.height = this.containerMetrics.size + 'px';
+      },
+
+      /** @param {Event=} event */
+      upAction: function(event) {
+        if (!this.isMouseDown) {
+          return;
+        }
+
+        this.mouseUpStart = Utility.now();
+      },
+
+      remove: function() {
+        Polymer.dom(this.waveContainer.parentNode).removeChild(
+          this.waveContainer
+        );
+      }
+    };
+
+    Polymer({
+      is: 'paper-ripple',
+
+      behaviors: [
+        Polymer.IronA11yKeysBehavior
+      ],
+
+      properties: {
+        /**
+         * The initial opacity set on the wave.
+         *
+         * @attribute initialOpacity
+         * @type number
+         * @default 0.25
+         */
+        initialOpacity: {
+          type: Number,
+          value: 0.25
+        },
+
+        /**
+         * How fast (opacity per second) the wave fades out.
+         *
+         * @attribute opacityDecayVelocity
+         * @type number
+         * @default 0.8
+         */
+        opacityDecayVelocity: {
+          type: Number,
+          value: 0.8
+        },
+
+        /**
+         * If true, ripples will exhibit a gravitational pull towards
+         * the center of their container as they fade away.
+         *
+         * @attribute recenters
+         * @type boolean
+         * @default false
+         */
+        recenters: {
+          type: Boolean,
+          value: false
+        },
+
+        /**
+         * If true, ripples will center inside its container
+         *
+         * @attribute recenters
+         * @type boolean
+         * @default false
+         */
+        center: {
+          type: Boolean,
+          value: false
+        },
+
+        /**
+         * A list of the visual ripples.
+         *
+         * @attribute ripples
+         * @type Array
+         * @default []
+         */
+        ripples: {
+          type: Array,
+          value: function() {
+            return [];
+          }
+        },
+
+        /**
+         * True when there are visible ripples animating within the
+         * element.
+         */
+        animating: {
+          type: Boolean,
+          readOnly: true,
+          reflectToAttribute: true,
+          value: false
+        },
+
+        /**
+         * If true, the ripple will remain in the "down" state until `holdDown`
+         * is set to false again.
+         */
+        holdDown: {
+          type: Boolean,
+          value: false,
+          observer: '_holdDownChanged'
+        },
+
+        _animating: {
+          type: Boolean
+        },
+
+        _boundAnimate: {
+          type: Function,
+          value: function() {
+            return this.animate.bind(this);
+          }
+        }
+      },
+
+      get target () {
+        var ownerRoot = Polymer.dom(this).getOwnerRoot();
+        var target;
+
+        if (this.parentNode.nodeType == 11) { // DOCUMENT_FRAGMENT_NODE
+          target = ownerRoot.host;
+        } else {
+          target = this.parentNode;
+        }
+
+        return target;
+      },
+
+      keyBindings: {
+        'enter:keydown': '_onEnterKeydown',
+        'space:keydown': '_onSpaceKeydown',
+        'space:keyup': '_onSpaceKeyup'
+      },
+
+      attached: function() {
+        this.listen(this.target, 'up', 'upAction');
+        this.listen(this.target, 'down', 'downAction');
+
+        if (!this.target.hasAttribute('noink')) {
+          this.keyEventTarget = this.target;
+        }
+      },
+
+      get shouldKeepAnimating () {
+        for (var index = 0; index < this.ripples.length; ++index) {
+          if (!this.ripples[index].isAnimationComplete) {
+            return true;
+          }
+        }
+
+        return false;
+      },
+
+      simulatedRipple: function() {
+        this.downAction(null);
+
+        // Please see polymer/polymer#1305
+        this.async(function() {
+          this.upAction();
+        }, 1);
+      },
+
+      /** @param {Event=} event */
+      downAction: function(event) {
+        if (this.holdDown && this.ripples.length > 0) {
+          return;
+        }
+
+        var ripple = this.addRipple();
+
+        ripple.downAction(event);
+
+        if (!this._animating) {
+          this.animate();
+        }
+      },
+
+      /** @param {Event=} event */
+      upAction: function(event) {
+        if (this.holdDown) {
+          return;
+        }
+
+        this.ripples.forEach(function(ripple) {
+          ripple.upAction(event);
+        });
+
+        this.animate();
+      },
+
+      onAnimationComplete: function() {
+        this._animating = false;
+        this.$.background.style.backgroundColor = null;
+        this.fire('transitionend');
+      },
+
+      addRipple: function() {
+        var ripple = new Ripple(this);
+
+        Polymer.dom(this.$.waves).appendChild(ripple.waveContainer);
+        this.$.background.style.backgroundColor = ripple.color;
+        this.ripples.push(ripple);
+
+        this._setAnimating(true);
+
+        return ripple;
+      },
+
+      removeRipple: function(ripple) {
+        var rippleIndex = this.ripples.indexOf(ripple);
+
+        if (rippleIndex < 0) {
+          return;
+        }
+
+        this.ripples.splice(rippleIndex, 1);
+
+        ripple.remove();
+
+        if (!this.ripples.length) {
+          this._setAnimating(false);
+        }
+      },
+
+      animate: function() {
+        var index;
+        var ripple;
+
+        this._animating = true;
+
+        for (index = 0; index < this.ripples.length; ++index) {
+          ripple = this.ripples[index];
+
+          ripple.draw();
+
+          this.$.background.style.opacity = ripple.outerOpacity;
+
+          if (ripple.isOpacityFullyDecayed && !ripple.isRestingAtMaxRadius) {
+            this.removeRipple(ripple);
+          }
+        }
+
+        if (!this.shouldKeepAnimating && this.ripples.length === 0) {
+          this.onAnimationComplete();
+        } else {
+          window.requestAnimationFrame(this._boundAnimate);
+        }
+      },
+
+      _onEnterKeydown: function() {
+        this.downAction();
+        this.async(this.upAction, 1);
+      },
+
+      _onSpaceKeydown: function() {
+        this.downAction();
+      },
+
+      _onSpaceKeyup: function() {
+        this.upAction();
+      },
+
+      _holdDownChanged: function(holdDown) {
+        if (holdDown) {
+          this.downAction();
+        } else {
+          this.upAction();
+        }
+      }
+    });
+  })();
+/**
+   * @demo demo/index.html
+   * @polymerBehavior
+   */
+  Polymer.IronControlState = {
+
+    properties: {
+
+      /**
+       * If true, the element currently has focus.
+       */
+      focused: {
+        type: Boolean,
+        value: false,
+        notify: true,
+        readOnly: true,
+        reflectToAttribute: true
+      },
+
+      /**
+       * If true, the user cannot interact with this element.
+       */
+      disabled: {
+        type: Boolean,
+        value: false,
+        notify: true,
+        observer: '_disabledChanged',
+        reflectToAttribute: true
+      },
+
+      _oldTabIndex: {
+        type: Number
+      },
+
+      _boundFocusBlurHandler: {
+        type: Function,
+        value: function() {
+          return this._focusBlurHandler.bind(this);
+        }
+      }
+
+    },
+
+    observers: [
+      '_changedControlState(focused, disabled)'
+    ],
+
+    ready: function() {
+      this.addEventListener('focus', this._boundFocusBlurHandler, true);
+      this.addEventListener('blur', this._boundFocusBlurHandler, true);
+    },
+
+    _focusBlurHandler: function(event) {
+      // NOTE(cdata):  if we are in ShadowDOM land, `event.target` will
+      // eventually become `this` due to retargeting; if we are not in
+      // ShadowDOM land, `event.target` will eventually become `this` due
+      // to the second conditional which fires a synthetic event (that is also
+      // handled). In either case, we can disregard `event.path`.
+
+      if (event.target === this) {
+        var focused = event.type === 'focus';
+        this._setFocused(focused);
+      } else if (!this.shadowRoot) {
+        this.fire(event.type, {sourceEvent: event}, {
+          node: this,
+          bubbles: event.bubbles,
+          cancelable: event.cancelable
+        });
+      }
+    },
+
+    _disabledChanged: function(disabled, old) {
+      this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
+      this.style.pointerEvents = disabled ? 'none' : '';
+      if (disabled) {
+        this._oldTabIndex = this.tabIndex;
+        this.focused = false;
+        this.tabIndex = -1;
+      } else if (this._oldTabIndex !== undefined) {
+        this.tabIndex = this._oldTabIndex;
+      }
+    },
+
+    _changedControlState: function() {
+      // _controlStateChanged is abstract, follow-on behaviors may implement it
+      if (this._controlStateChanged) {
+        this._controlStateChanged();
+      }
+    }
+
+  };
+/**
+   * @demo demo/index.html
+   * @polymerBehavior Polymer.IronButtonState
+   */
+  Polymer.IronButtonStateImpl = {
+
+    properties: {
+
+      /**
+       * If true, the user is currently holding down the button.
+       */
+      pressed: {
+        type: Boolean,
+        readOnly: true,
+        value: false,
+        reflectToAttribute: true,
+        observer: '_pressedChanged'
+      },
+
+      /**
+       * If true, the button toggles the active state with each tap or press
+       * of the spacebar.
+       */
+      toggles: {
+        type: Boolean,
+        value: false,
+        reflectToAttribute: true
+      },
+
+      /**
+       * If true, the button is a toggle and is currently in the active state.
+       */
+      active: {
+        type: Boolean,
+        value: false,
+        notify: true,
+        reflectToAttribute: true
+      },
+
+      /**
+       * True if the element is currently being pressed by a "pointer," which
+       * is loosely defined as mouse or touch input (but specifically excluding
+       * keyboard input).
+       */
+      pointerDown: {
+        type: Boolean,
+        readOnly: true,
+        value: false
+      },
+
+      /**
+       * True if the input device that caused the element to receive focus
+       * was a keyboard.
+       */
+      receivedFocusFromKeyboard: {
+        type: Boolean,
+        readOnly: true
+      },
+
+      /**
+       * The aria attribute to be set if the button is a toggle and in the
+       * active state.
+       */
+      ariaActiveAttribute: {
+        type: String,
+        value: 'aria-pressed',
+        observer: '_ariaActiveAttributeChanged'
+      }
+    },
+
+    listeners: {
+      down: '_downHandler',
+      up: '_upHandler',
+      tap: '_tapHandler'
+    },
+
+    observers: [
+      '_detectKeyboardFocus(focused)',
+      '_activeChanged(active, ariaActiveAttribute)'
+    ],
+
+    keyBindings: {
+      'enter:keydown': '_asyncClick',
+      'space:keydown': '_spaceKeyDownHandler',
+      'space:keyup': '_spaceKeyUpHandler',
+    },
+
+    _mouseEventRe: /^mouse/,
+
+    _tapHandler: function() {
+      if (this.toggles) {
+       // a tap is needed to toggle the active state
+        this._userActivate(!this.active);
+      } else {
+        this.active = false;
+      }
+    },
+
+    _detectKeyboardFocus: function(focused) {
+      this._setReceivedFocusFromKeyboard(!this.pointerDown && focused);
+    },
+
+    // to emulate native checkbox, (de-)activations from a user interaction fire
+    // 'change' events
+    _userActivate: function(active) {
+      if (this.active !== active) {
+        this.active = active;
+        this.fire('change');
+      }
+    },
+
+    _eventSourceIsPrimaryInput: function(event) {
+      event = event.detail.sourceEvent || event;
+
+      // Always true for non-mouse events....
+      if (!this._mouseEventRe.test(event.type)) {
+        return true;
+      }
+
+      // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons
+      if ('buttons' in event) {
+        return event.buttons === 1;
+      }
+
+      // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/which
+      if (typeof event.which === 'number') {
+        return event.which < 2;
+      }
+
+      // http://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
+      return event.button < 1;
+    },
+
+    _downHandler: function(event) {
+      if (!this._eventSourceIsPrimaryInput(event)) {
+        return;
+      }
+
+      this._setPointerDown(true);
+      this._setPressed(true);
+      this._setReceivedFocusFromKeyboard(false);
+    },
+
+    _upHandler: function() {
+      this._setPointerDown(false);
+      this._setPressed(false);
+    },
+
+    _spaceKeyDownHandler: function(event) {
+      var keyboardEvent = event.detail.keyboardEvent;
+      keyboardEvent.preventDefault();
+      keyboardEvent.stopImmediatePropagation();
+      this._setPressed(true);
+    },
+
+    _spaceKeyUpHandler: function() {
+      if (this.pressed) {
+        this._asyncClick();
+      }
+      this._setPressed(false);
+    },
+
+    // trigger click asynchronously, the asynchrony is useful to allow one
+    // event handler to unwind before triggering another event
+    _asyncClick: function() {
+      this.async(function() {
+        this.click();
+      }, 1);
+    },
+
+    // any of these changes are considered a change to button state
+
+    _pressedChanged: function(pressed) {
+      this._changedButtonState();
+    },
+
+    _ariaActiveAttributeChanged: function(value, oldValue) {
+      if (oldValue && oldValue != value && this.hasAttribute(oldValue)) {
+        this.removeAttribute(oldValue);
+      }
+    },
+
+    _activeChanged: function(active, ariaActiveAttribute) {
+      if (this.toggles) {
+        this.setAttribute(this.ariaActiveAttribute,
+                          active ? 'true' : 'false');
+      } else {
+        this.removeAttribute(this.ariaActiveAttribute);
+      }
+      this._changedButtonState();
+    },
+
+    _controlStateChanged: function() {
+      if (this.disabled) {
+        this._setPressed(false);
+      } else {
+        this._changedButtonState();
+      }
+    },
+
+    // provide hook for follow-on behaviors to react to button-state
+
+    _changedButtonState: function() {
+      if (this._buttonStateChanged) {
+        this._buttonStateChanged(); // abstract
+      }
+    }
+
+  };
+
+  /** @polymerBehavior */
+  Polymer.IronButtonState = [
+    Polymer.IronA11yKeysBehavior,
+    Polymer.IronButtonStateImpl
+  ];
+/** @polymerBehavior */
+  Polymer.PaperButtonBehaviorImpl = {
+
+    properties: {
+
+      _elevation: {
+        type: Number
+      }
+
+    },
+
+    observers: [
+      '_calculateElevation(focused, disabled, active, pressed, receivedFocusFromKeyboard)'
+    ],
+
+    hostAttributes: {
+      role: 'button',
+      tabindex: '0'
+    },
+
+    _calculateElevation: function() {
+      var e = 1;
+      if (this.disabled) {
+        e = 0;
+      } else if (this.active || this.pressed) {
+        e = 4;
+      } else if (this.receivedFocusFromKeyboard) {
+        e = 3;
+      }
+      this._elevation = e;
+    }
+  };
+
+  /** @polymerBehavior */
+  Polymer.PaperButtonBehavior = [
+    Polymer.IronButtonState,
+    Polymer.IronControlState,
+    Polymer.PaperButtonBehaviorImpl
+  ];
+Polymer({
+    is: 'paper-button',
+
+    behaviors: [
+      Polymer.PaperButtonBehavior
+    ],
+
+    properties: {
+      /**
+       * If true, the button should be styled with a shadow.
+       */
+      raised: {
+        type: Boolean,
+        reflectToAttribute: true,
+        value: false,
+        observer: '_calculateElevation'
+      }
+    },
+
+    _calculateElevation: function() {
+      if (!this.raised) {
+        this._elevation = 0;
+      } else {
+        Polymer.PaperButtonBehaviorImpl._calculateElevation.apply(this);
+      }
+    },
+
+    _computeContentClass: function(receivedFocusFromKeyboard) {
+      var className = 'content ';
+      if (receivedFocusFromKeyboard) {
+        className += ' keyboard-focus';
+      }
+      return className;
+    }
+  });
+/** 
+ * `iron-range-behavior` provides the behavior for something with a minimum to maximum range.
+ *
+ * @demo demo/index.html
+ * @polymerBehavior 
+ */
+ Polymer.IronRangeBehavior = {
+
+  properties: {
+
+    /**
+     * The number that represents the current value.
+     */
+    value: {
+      type: Number,
+      value: 0,
+      notify: true,
+      reflectToAttribute: true
+    },
+
+    /**
+     * The number that indicates the minimum value of the range.
+     */
+    min: {
+      type: Number,
+      value: 0,
+      notify: true
+    },
+
+    /**
+     * The number that indicates the maximum value of the range.
+     */
+    max: {
+      type: Number,
+      value: 100,
+      notify: true
+    },
+
+    /**
+     * Specifies the value granularity of the range's value.
+     */
+    step: {
+      type: Number,
+      value: 1,
+      notify: true
+    },
+
+    /**
+     * Returns the ratio of the value.
+     */
+    ratio: {
+      type: Number,
+      value: 0,
+      readOnly: true,
+      notify: true
+    },
+  },
+
+  observers: [
+    '_update(value, min, max, step)'
+  ],
+
+  _calcRatio: function(value) {
+    return (this._clampValue(value) - this.min) / (this.max - this.min);
+  },
+
+  _clampValue: function(value) {
+    return Math.min(this.max, Math.max(this.min, this._calcStep(value)));
+  },
+
+  _calcStep: function(value) {
+   /**
+    * if we calculate the step using
+    * `Math.round(value / step) * step` we may hit a precision point issue 
+    * eg. 0.1 * 0.2 =  0.020000000000000004
+    * http://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html
+    *
+    * as a work around we can divide by the reciprocal of `step`
+    */
+    // polymer/issues/2493
+    value = parseFloat(value);
+    return this.step ? (Math.round((value + this.min) / this.step) / (1 / this.step)) - this.min : value;
+  },
+
+  _validateValue: function() {
+    var v = this._clampValue(this.value);
+    this.value = this.oldValue = isNaN(v) ? this.oldValue : v;
+    return this.value !== v;
+  },
+
+  _update: function() {
+    this._validateValue();
+    this._setRatio(this._calcRatio(this.value) * 100);
+  }
+
+};
+Polymer({
+
+    is: 'paper-progress',
+
+    behaviors: [
+      Polymer.IronRangeBehavior
+    ],
+
+    properties: {
+
+      /**
+       * The number that represents the current secondary progress.
+       */
+      secondaryProgress: {
+        type: Number,
+        value: 0
+      },
+
+      /**
+       * The secondary ratio
+       */
+      secondaryRatio: {
+        type: Number,
+        value: 0,
+        readOnly: true
+      },
+
+      /**
+       * Use an indeterminate progress indicator.
+       */
+      indeterminate: {
+        type: Boolean,
+        value: false,
+        observer: '_toggleIndeterminate'
+      },
+
+      /**
+       * True if the progress is disabled.
+       */
+      disabled: {
+        type: Boolean,
+        value: false,
+        reflectToAttribute: true,
+        observer: '_disabledChanged'
+      }
+    },
+
+    observers: [
+      '_progressChanged(secondaryProgress, value, min, max)'
+    ],
+
+    hostAttributes: {
+      role: 'progressbar'
+    },
+
+    _toggleIndeterminate: function(indeterminate) {
+      // If we use attribute/class binding, the animation sometimes doesn't translate properly
+      // on Safari 7.1. So instead, we toggle the class here in the update method.
+      this.toggleClass('indeterminate', indeterminate, this.$.primaryProgress);
+    },
+
+    _transformProgress: function(progress, ratio) {
+      var transform = 'scaleX(' + (ratio / 100) + ')';
+      progress.style.transform = progress.style.webkitTransform = transform;
+    },
+
+    _mainRatioChanged: function(ratio) {
+      this._transformProgress(this.$.primaryProgress, ratio);
+    },
+
+    _progressChanged: function(secondaryProgress, value, min, max) {
+      secondaryProgress = this._clampValue(secondaryProgress);
+      value = this._clampValue(value);
+
+      var secondaryRatio = this._calcRatio(secondaryProgress) * 100;
+      var mainRatio = this._calcRatio(value) * 100;
+
+      this._setSecondaryRatio(secondaryRatio);
+      this._transformProgress(this.$.secondaryProgress, secondaryRatio);
+      this._transformProgress(this.$.primaryProgress, mainRatio);
+
+      this.secondaryProgress = secondaryProgress;
+
+      this.setAttribute('aria-valuenow', value);
+      this.setAttribute('aria-valuemin', min);
+      this.setAttribute('aria-valuemax', max);
+    },
+
+    _disabledChanged: function(disabled) {
+      this.setAttribute('aria-disabled', disabled ? 'true' : 'false');
+    },
+
+    _hideSecondaryProgress: function(secondaryRatio) {
+      return secondaryRatio === 0;
+    }
+
+  });
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('downloads', function() {
+  var Item = Polymer({
+    is: 'downloads-item',
+
+    /**
+     * @param {!downloads.ThrottledIconLoader} iconLoader
+     */
+    factoryImpl: function(iconLoader) {
+      /** @private {!downloads.ThrottledIconLoader} */
+      this.iconLoader_ = iconLoader;
+    },
+
+    properties: {
+      data: {
+        type: Object,
+      },
+
+      hideDate: {
+        type: Boolean,
+        value: true,
+      },
+
+      readyPromise: {
+        type: Object,
+        value: function() {
+          return new Promise(function(resolve, reject) {
+            this.resolveReadyPromise_ = resolve;
+          }.bind(this));
+        },
+      },
+
+      completelyOnDisk_: {
+        computed: 'computeCompletelyOnDisk_(' +
+            'data.state, data.file_externally_removed)',
+        type: Boolean,
+        value: true,
+      },
+
+      controlledBy_: {
+        computed: 'computeControlledBy_(data.by_ext_id, data.by_ext_name)',
+        type: String,
+        value: '',
+      },
+
+      i18n_: {
+        readOnly: true,
+        type: Object,
+        value: function() {
+          return {
+            cancel: loadTimeData.getString('controlCancel'),
+            discard: loadTimeData.getString('dangerDiscard'),
+            pause: loadTimeData.getString('controlPause'),
+            remove: loadTimeData.getString('controlRemoveFromList'),
+            resume: loadTimeData.getString('controlResume'),
+            restore: loadTimeData.getString('dangerRestore'),
+            retry: loadTimeData.getString('controlRetry'),
+            save: loadTimeData.getString('dangerSave'),
+          };
+        },
+      },
+
+      isActive_: {
+        computed: 'computeIsActive_(' +
+            'data.state, data.file_externally_removed)',
+        type: Boolean,
+        value: true,
+      },
+
+      isDangerous_: {
+        computed: 'computeIsDangerous_(data.state)',
+        type: Boolean,
+        value: false,
+      },
+
+      isInProgress_: {
+        computed: 'computeIsInProgress_(data.state)',
+        type: Boolean,
+        value: false,
+      },
+
+      showCancel_: {
+        computed: 'computeShowCancel_(data.state)',
+        type: Boolean,
+        value: false,
+      },
+
+      showProgress_: {
+        computed: 'computeShowProgress_(showCancel_, data.percent)',
+        type: Boolean,
+        value: false,
+      },
+
+      isMalware_: {
+        computed: 'computeIsMalware_(isDangerous_, data.danger_type)',
+        type: Boolean,
+        value: false,
+      },
+    },
+
+    observers: [
+      // TODO(dbeam): this gets called way more when I observe data.by_ext_id
+      // and data.by_ext_name directly. Why?
+      'observeControlledBy_(controlledBy_)',
+    ],
+
+    ready: function() {
+      this.content = this.$.content;
+      this.resolveReadyPromise_();
+    },
+
+    /** @param {!downloads.Data} data */
+    update: function(data) {
+      this.data = data;
+
+      if (!this.isDangerous_) {
+        var icon = 'chrome://fileicon/' + encodeURIComponent(data.file_path);
+        this.iconLoader_.loadScaledIcon(this.$['file-icon'], icon);
+      }
+    },
+
+    /** @private */
+    computeClass_: function() {
+      var classes = [];
+
+      if (this.isActive_)
+        classes.push('is-active');
+
+      if (this.isDangerous_)
+        classes.push('dangerous');
+
+      if (this.showProgress_)
+        classes.push('show-progress');
+
+      return classes.join(' ');
+    },
+
+    /** @private */
+    computeCompletelyOnDisk_: function() {
+      return this.data.state == downloads.States.COMPLETE &&
+             !this.data.file_externally_removed;
+    },
+
+    /** @private */
+    computeControlledBy_: function() {
+      if (!this.data.by_ext_id || !this.data.by_ext_name)
+        return '';
+
+      var url = 'chrome://extensions#' + this.data.by_ext_id;
+      var name = this.data.by_ext_name;
+      return loadTimeData.getStringF('controlledByUrl', url, name);
+    },
+
+    /** @private */
+    computeDate_: function() {
+      if (this.hideDate)
+        return '';
+      return assert(this.data.since_string || this.data.date_string);
+    },
+
+    /** @private */
+    computeDescription_: function() {
+      var data = this.data;
+
+      switch (data.state) {
+        case downloads.States.DANGEROUS:
+          var fileName = data.file_name;
+          switch (data.danger_type) {
+            case downloads.DangerType.DANGEROUS_FILE:
+              return loadTimeData.getStringF('dangerFileDesc', fileName);
+            case downloads.DangerType.DANGEROUS_URL:
+              return loadTimeData.getString('dangerUrlDesc');
+            case downloads.DangerType.DANGEROUS_CONTENT:  // Fall through.
+            case downloads.DangerType.DANGEROUS_HOST:
+              return loadTimeData.getStringF('dangerContentDesc', fileName);
+            case downloads.DangerType.UNCOMMON_CONTENT:
+              return loadTimeData.getStringF('dangerUncommonDesc', fileName);
+            case downloads.DangerType.POTENTIALLY_UNWANTED:
+              return loadTimeData.getStringF('dangerSettingsDesc', fileName);
+          }
+          break;
+
+        case downloads.States.IN_PROGRESS:
+        case downloads.States.PAUSED:  // Fallthrough.
+          return data.progress_status_text;
+      }
+
+      return '';
+    },
+
+    /** @private */
+    computeIsActive_: function() {
+      return this.data.state != downloads.States.CANCELLED &&
+             this.data.state != downloads.States.INTERRUPTED &&
+             !this.data.file_externally_removed;
+    },
+
+    /** @private */
+    computeIsDangerous_: function() {
+      return this.data.state == downloads.States.DANGEROUS;
+    },
+
+    /** @private */
+    computeIsInProgress_: function() {
+      return this.data.state == downloads.States.IN_PROGRESS;
+    },
+
+    /** @private */
+    computeIsMalware_: function() {
+      return this.isDangerous_ &&
+          (this.data.danger_type == downloads.DangerType.DANGEROUS_CONTENT ||
+           this.data.danger_type == downloads.DangerType.DANGEROUS_HOST ||
+           this.data.danger_type == downloads.DangerType.DANGEROUS_URL ||
+           this.data.danger_type == downloads.DangerType.POTENTIALLY_UNWANTED);
+    },
+
+    /** @private */
+    computeRemoveStyle_: function() {
+      var canDelete = loadTimeData.getBoolean('allowDeletingHistory');
+      var hideRemove = this.isDangerous_ || this.showCancel_ || !canDelete;
+      return hideRemove ? 'visibility: hidden' : '';
+    },
+
+    /** @private */
+    computeShowCancel_: function() {
+      return this.data.state == downloads.States.IN_PROGRESS ||
+             this.data.state == downloads.States.PAUSED;
+    },
+
+    /** @private */
+    computeShowProgress_: function() {
+      return this.showCancel_ && this.data.percent >= -1;
+    },
+
+    /** @private */
+    computeTag_: function() {
+      switch (this.data.state) {
+        case downloads.States.CANCELLED:
+          return loadTimeData.getString('statusCancelled');
+
+        case downloads.States.INTERRUPTED:
+          return this.data.last_reason_text;
+
+        case downloads.States.COMPLETE:
+          return this.data.file_externally_removed ?
+              loadTimeData.getString('statusRemoved') : '';
+      }
+
+      return '';
+    },
+
+    /** @private */
+    isIndeterminate_: function() {
+      return this.data.percent == -1;
+    },
+
+    /** @private */
+    observeControlledBy_: function() {
+      this.$['controlled-by'].innerHTML = this.controlledBy_;
+    },
+
+    /** @private */
+    onCancelClick_: function() {
+      downloads.ActionService.getInstance().cancel(this.data.id);
+    },
+
+    /** @private */
+    onDiscardDangerous_: function() {
+      downloads.ActionService.getInstance().discardDangerous(this.data.id);
+    },
+
+    /**
+     * @private
+     * @param {Event} e
+     */
+    onDragStart_: function(e) {
+      e.preventDefault();
+      downloads.ActionService.getInstance().drag(this.data.id);
+    },
+
+    /**
+     * @param {Event} e
+     * @private
+     */
+    onFileLinkClick_: function(e) {
+      e.preventDefault();
+      downloads.ActionService.getInstance().openFile(this.data.id);
+    },
+
+    /** @private */
+    onPauseClick_: function() {
+      downloads.ActionService.getInstance().pause(this.data.id);
+    },
+
+    /** @private */
+    onRemoveClick_: function() {
+      downloads.ActionService.getInstance().remove(this.data.id);
+    },
+
+    /** @private */
+    onResumeClick_: function() {
+      downloads.ActionService.getInstance().resume(this.data.id);
+    },
+
+    /** @private */
+    onRetryClick_: function() {
+      downloads.ActionService.getInstance().download(this.data.url);
+    },
+
+    /** @private */
+    onSaveDangerous_: function() {
+      downloads.ActionService.getInstance().saveDangerous(this.data.id);
+    },
+
+    /** @private */
+    onShowClick_: function() {
+      downloads.ActionService.getInstance().show(this.data.id);
+    },
+  });
+
+  return {Item: Item};
+});
+(function() {
+
+    // monostate data
+    var metaDatas = {};
+    var metaArrays = {};
+
+    Polymer.IronMeta = Polymer({
+
+      is: 'iron-meta',
+
+      properties: {
+
+        /**
+         * The type of meta-data.  All meta-data of the same type is stored
+         * together.
+         */
+        type: {
+          type: String,
+          value: 'default',
+          observer: '_typeChanged'
+        },
+
+        /**
+         * The key used to store `value` under the `type` namespace.
+         */
+        key: {
+          type: String,
+          observer: '_keyChanged'
+        },
+
+        /**
+         * The meta-data to store or retrieve.
+         */
+        value: {
+          type: Object,
+          notify: true,
+          observer: '_valueChanged'
+        },
+
+        /**
+         * If true, `value` is set to the iron-meta instance itself.
+         */
+         self: {
+          type: Boolean,
+          observer: '_selfChanged'
+        },
+
+        /**
+         * Array of all meta-data values for the given type.
+         */
+        list: {
+          type: Array,
+          notify: true
+        }
+
+      },
+
+      /**
+       * Only runs if someone invokes the factory/constructor directly
+       * e.g. `new Polymer.IronMeta()`
+       */
+      factoryImpl: function(config) {
+        if (config) {
+          for (var n in config) {
+            switch(n) {
+              case 'type':
+              case 'key':
+              case 'value':
+                this[n] = config[n];
+                break;
+            }
+          }
+        }
+      },
+
+      created: function() {
+        // TODO(sjmiles): good for debugging?
+        this._metaDatas = metaDatas;
+        this._metaArrays = metaArrays;
+      },
+
+      _keyChanged: function(key, old) {
+        this._resetRegistration(old);
+      },
+
+      _valueChanged: function(value) {
+        this._resetRegistration(this.key);
+      },
+
+      _selfChanged: function(self) {
+        if (self) {
+          this.value = this;
+        }
+      },
+
+      _typeChanged: function(type) {
+        this._unregisterKey(this.key);
+        if (!metaDatas[type]) {
+          metaDatas[type] = {};
+        }
+        this._metaData = metaDatas[type];
+        if (!metaArrays[type]) {
+          metaArrays[type] = [];
+        }
+        this.list = metaArrays[type];
+        this._registerKeyValue(this.key, this.value);
+      },
+
+      /**
+       * Retrieves meta data value by key.
+       *
+       * @method byKey
+       * @param {string} key The key of the meta-data to be returned.
+       * @return {*}
+       */
+      byKey: function(key) {
+        return this._metaData && this._metaData[key];
+      },
+
+      _resetRegistration: function(oldKey) {
+        this._unregisterKey(oldKey);
+        this._registerKeyValue(this.key, this.value);
+      },
+
+      _unregisterKey: function(key) {
+        this._unregister(key, this._metaData, this.list);
+      },
+
+      _registerKeyValue: function(key, value) {
+        this._register(key, value, this._metaData, this.list);
+      },
+
+      _register: function(key, value, data, list) {
+        if (key && data && value !== undefined) {
+          data[key] = value;
+          list.push(value);
+        }
+      },
+
+      _unregister: function(key, data, list) {
+        if (key && data) {
+          if (key in data) {
+            var value = data[key];
+            delete data[key];
+            this.arrayDelete(list, value);
+          }
+        }
+      }
+
+    });
+
+    /**
+    `iron-meta-query` can be used to access infomation stored in `iron-meta`.
+
+    Examples:
+
+    If I create an instance like this:
+
+        <iron-meta key="info" value="foo/bar"></iron-meta>
+
+    Note that value="foo/bar" is the metadata I've defined. I could define more
+    attributes or use child nodes to define additional metadata.
+
+    Now I can access that element (and it's metadata) from any `iron-meta-query` instance:
+
+         var value = new Polymer.IronMetaQuery({key: 'info'}).value;
+
+    @group Polymer Iron Elements
+    @element iron-meta-query
+    */
+    Polymer.IronMetaQuery = Polymer({
+
+      is: 'iron-meta-query',
+
+      properties: {
+
+        /**
+         * The type of meta-data.  All meta-data of the same type is stored
+         * together.
+         */
+        type: {
+          type: String,
+          value: 'default',
+          observer: '_typeChanged'
+        },
+
+        /**
+         * Specifies a key to use for retrieving `value` from the `type`
+         * namespace.
+         */
+        key: {
+          type: String,
+          observer: '_keyChanged'
+        },
+
+        /**
+         * The meta-data to store or retrieve.
+         */
+        value: {
+          type: Object,
+          notify: true,
+          readOnly: true
+        },
+
+        /**
+         * Array of all meta-data values for the given type.
+         */
+        list: {
+          type: Array,
+          notify: true
+        }
+
+      },
+
+      /**
+       * Actually a factory method, not a true constructor. Only runs if
+       * someone invokes it directly (via `new Polymer.IronMeta()`);
+       */
+      factoryImpl: function(config) {
+        if (config) {
+          for (var n in config) {
+            switch(n) {
+              case 'type':
+              case 'key':
+                this[n] = config[n];
+                break;
+            }
+          }
+        }
+      },
+
+      created: function() {
+        // TODO(sjmiles): good for debugging?
+        this._metaDatas = metaDatas;
+        this._metaArrays = metaArrays;
+      },
+
+      _keyChanged: function(key) {
+        this._setValue(this._metaData && this._metaData[key]);
+      },
+
+      _typeChanged: function(type) {
+        this._metaData = metaDatas[type];
+        this.list = metaArrays[type];
+        if (this.key) {
+          this._keyChanged(this.key);
+        }
+      },
+
+      /**
+       * Retrieves meta data value by key.
+       * @param {string} key The key of the meta-data to be returned.
+       * @return {*}
+       */
+      byKey: function(key) {
+        return this._metaData && this._metaData[key];
+      }
+
+    });
+
+  })();
+Polymer({
+
+      is: 'iron-icon',
+
+      properties: {
+
+        /**
+         * The name of the icon to use. The name should be of the form:
+         * `iconset_name:icon_name`.
+         */
+        icon: {
+          type: String,
+          observer: '_iconChanged'
+        },
+
+        /**
+         * The name of the theme to used, if one is specified by the
+         * iconset.
+         */
+        theme: {
+          type: String,
+          observer: '_updateIcon'
+        },
+
+        /**
+         * If using iron-icon without an iconset, you can set the src to be
+         * the URL of an individual icon image file. Note that this will take
+         * precedence over a given icon attribute.
+         */
+        src: {
+          type: String,
+          observer: '_srcChanged'
+        },
+
+        /**
+         * @type {!Polymer.IronMeta}
+         */
+        _meta: {
+          value: Polymer.Base.create('iron-meta', {type: 'iconset'})
+        }
+
+      },
+
+      _DEFAULT_ICONSET: 'icons',
+
+      _iconChanged: function(icon) {
+        var parts = (icon || '').split(':');
+        this._iconName = parts.pop();
+        this._iconsetName = parts.pop() || this._DEFAULT_ICONSET;
+        this._updateIcon();
+      },
+
+      _srcChanged: function(src) {
+        this._updateIcon();
+      },
+
+      _usesIconset: function() {
+        return this.icon || !this.src;
+      },
+
+      /** @suppress {visibility} */
+      _updateIcon: function() {
+        if (this._usesIconset()) {
+          if (this._iconsetName) {
+            this._iconset = /** @type {?Polymer.Iconset} */ (
+              this._meta.byKey(this._iconsetName));
+            if (this._iconset) {
+              this._iconset.applyIcon(this, this._iconName, this.theme);
+              this.unlisten(window, 'iron-iconset-added', '_updateIcon');
+            } else {
+              this.listen(window, 'iron-iconset-added', '_updateIcon');
+            }
+          }
+        } else {
+          if (!this._img) {
+            this._img = document.createElement('img');
+            this._img.style.width = '100%';
+            this._img.style.height = '100%';
+            this._img.draggable = false;
+          }
+          this._img.src = this.src;
+          Polymer.dom(this.root).appendChild(this._img);
+        }
+      }
+
+    });
+/**
+   * The `iron-iconset-svg` element allows users to define their own icon sets
+   * that contain svg icons. The svg icon elements should be children of the
+   * `iron-iconset-svg` element. Multiple icons should be given distinct id's.
+   *
+   * Using svg elements to create icons has a few advantages over traditional
+   * bitmap graphics like jpg or png. Icons that use svg are vector based so they
+   * are resolution independent and should look good on any device. They are
+   * stylable via css. Icons can be themed, colorized, and even animated.
+   *
+   * Example:
+   *
+   *     <iron-iconset-svg name="my-svg-icons" size="24">
+   *       <svg>
+   *         <defs>
+   *           <g id="shape">
+   *             <rect x="50" y="50" width="50" height="50" />
+   *             <circle cx="50" cy="50" r="50" />
+   *           </g>
+   *         </defs>
+   *       </svg>
+   *     </iron-iconset-svg>
+   *
+   * This will automatically register the icon set "my-svg-icons" to the iconset
+   * database.  To use these icons from within another element, make a
+   * `iron-iconset` element and call the `byId` method
+   * to retrieve a given iconset. To apply a particular icon inside an
+   * element use the `applyIcon` method. For example:
+   *
+   *     iconset.applyIcon(iconNode, 'car');
+   *
+   * @element iron-iconset-svg
+   * @demo demo/index.html
+   */
+  Polymer({
+
+    is: 'iron-iconset-svg',
+
+    properties: {
+
+      /**
+       * The name of the iconset.
+       *
+       * @attribute name
+       * @type string
+       */
+      name: {
+        type: String,
+        observer: '_nameChanged'
+      },
+
+      /**
+       * The size of an individual icon. Note that icons must be square.
+       *
+       * @attribute iconSize
+       * @type number
+       * @default 24
+       */
+      size: {
+        type: Number,
+        value: 24
+      }
+
+    },
+
+    /**
+     * Construct an array of all icon names in this iconset.
+     *
+     * @return {!Array} Array of icon names.
+     */
+    getIconNames: function() {
+      this._icons = this._createIconMap();
+      return Object.keys(this._icons).map(function(n) {
+        return this.name + ':' + n;
+      }, this);
+    },
+
+    /**
+     * Applies an icon to the given element.
+     *
+     * An svg icon is prepended to the element's shadowRoot if it exists,
+     * otherwise to the element itself.
+     *
+     * @method applyIcon
+     * @param {Element} element Element to which the icon is applied.
+     * @param {string} iconName Name of the icon to apply.
+     * @return {Element} The svg element which renders the icon.
+     */
+    applyIcon: function(element, iconName) {
+      // insert svg element into shadow root, if it exists
+      element = element.root || element;
+      // Remove old svg element
+      this.removeIcon(element);
+      // install new svg element
+      var svg = this._cloneIcon(iconName);
+      if (svg) {
+        var pde = Polymer.dom(element);
+        pde.insertBefore(svg, pde.childNodes[0]);
+        return element._svgIcon = svg;
+      }
+      return null;
+    },
+
+    /**
+     * Remove an icon from the given element by undoing the changes effected
+     * by `applyIcon`.
+     *
+     * @param {Element} element The element from which the icon is removed.
+     */
+    removeIcon: function(element) {
+      // Remove old svg element
+      if (element._svgIcon) {
+        Polymer.dom(element).removeChild(element._svgIcon);
+        element._svgIcon = null;
+      }
+    },
+
+    /**
+     *
+     * When name is changed, register iconset metadata
+     *
+     */
+    _nameChanged: function() {
+      new Polymer.IronMeta({type: 'iconset', key: this.name, value: this});
+      this.async(function() {
+        this.fire('iron-iconset-added', this, {node: window});
+      });
+    },
+
+    /**
+     * Create a map of child SVG elements by id.
+     *
+     * @return {!Object} Map of id's to SVG elements.
+     */
+    _createIconMap: function() {
+      // Objects chained to Object.prototype (`{}`) have members. Specifically,
+      // on FF there is a `watch` method that confuses the icon map, so we
+      // need to use a null-based object here.
+      var icons = Object.create(null);
+      Polymer.dom(this).querySelectorAll('[id]')
+        .forEach(function(icon) {
+          icons[icon.id] = icon;
+        });
+      return icons;
+    },
+
+    /**
+     * Produce installable clone of the SVG element matching `id` in this
+     * iconset, or `undefined` if there is no matching element.
+     *
+     * @return {Element} Returns an installable clone of the SVG element
+     * matching `id`.
+     */
+    _cloneIcon: function(id) {
+      // create the icon map on-demand, since the iconset itself has no discrete
+      // signal to know when it's children are fully parsed
+      this._icons = this._icons || this._createIconMap();
+      return this._prepareSvgClone(this._icons[id], this.size);
+    },
+
+    /**
+     * @param {Element} sourceSvg
+     * @param {number} size
+     * @return {Element}
+     */
+    _prepareSvgClone: function(sourceSvg, size) {
+      if (sourceSvg) {
+        var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
+        svg.setAttribute('viewBox', ['0', '0', size, size].join(' '));
+        svg.setAttribute('preserveAspectRatio', 'xMidYMid meet');
+        // TODO(dfreedm): `pointer-events: none` works around https://crbug.com/370136
+        // TODO(sjmiles): inline style may not be ideal, but avoids requiring a shadow-root
+        svg.style.cssText = 'pointer-events: none; display: block; width: 100%; height: 100%;';
+        svg.appendChild(sourceSvg.cloneNode(true)).removeAttribute('id');
+        return svg;
+      }
+      return null;
+    }
+
+  });
+Polymer({
+      is: 'paper-item',
+
+      hostAttributes: {
+        role: 'listitem',
+        tabindex: '0'
+      },
+
+      behaviors: [
+        Polymer.IronControlState,
+        Polymer.IronButtonState
+      ]
+    });
+/**
+   * @param {!Function} selectCallback
+   * @constructor
+   */
+  Polymer.IronSelection = function(selectCallback) {
+    this.selection = [];
+    this.selectCallback = selectCallback;
+  };
+
+  Polymer.IronSelection.prototype = {
+
+    /**
+     * Retrieves the selected item(s).
+     *
+     * @method get
+     * @returns Returns the selected item(s). If the multi property is true,
+     * `get` will return an array, otherwise it will return
+     * the selected item or undefined if there is no selection.
+     */
+    get: function() {
+      return this.multi ? this.selection.slice() : this.selection[0];
+    },
+
+    /**
+     * Clears all the selection except the ones indicated.
+     *
+     * @method clear
+     * @param {Array} excludes items to be excluded.
+     */
+    clear: function(excludes) {
+      this.selection.slice().forEach(function(item) {
+        if (!excludes || excludes.indexOf(item) < 0) {
+          this.setItemSelected(item, false);
+        }
+      }, this);
+    },
+
+    /**
+     * Indicates if a given item is selected.
+     *
+     * @method isSelected
+     * @param {*} item The item whose selection state should be checked.
+     * @returns Returns true if `item` is selected.
+     */
+    isSelected: function(item) {
+      return this.selection.indexOf(item) >= 0;
+    },
+
+    /**
+     * Sets the selection state for a given item to either selected or deselected.
+     *
+     * @method setItemSelected
+     * @param {*} item The item to select.
+     * @param {boolean} isSelected True for selected, false for deselected.
+     */
+    setItemSelected: function(item, isSelected) {
+      if (item != null) {
+        if (isSelected) {
+          this.selection.push(item);
+        } else {
+          var i = this.selection.indexOf(item);
+          if (i >= 0) {
+            this.selection.splice(i, 1);
+          }
+        }
+        if (this.selectCallback) {
+          this.selectCallback(item, isSelected);
+        }
+      }
+    },
+
+    /**
+     * Sets the selection state for a given item. If the `multi` property
+     * is true, then the selected state of `item` will be toggled; otherwise
+     * the `item` will be selected.
+     *
+     * @method select
+     * @param {*} item The item to select.
+     */
+    select: function(item) {
+      if (this.multi) {
+        this.toggle(item);
+      } else if (this.get() !== item) {
+        this.setItemSelected(this.get(), false);
+        this.setItemSelected(item, true);
+      }
+    },
+
+    /**
+     * Toggles the selection state for `item`.
+     *
+     * @method toggle
+     * @param {*} item The item to toggle.
+     */
+    toggle: function(item) {
+      this.setItemSelected(item, !this.isSelected(item));
+    }
+
+  };
+/** @polymerBehavior */
+  Polymer.IronSelectableBehavior = {
+
+      /**
+       * Fired when iron-selector is activated (selected or deselected).
+       * It is fired before the selected items are changed.
+       * Cancel the event to abort selection.
+       *
+       * @event iron-activate
+       */
+
+      /**
+       * Fired when an item is selected
+       *
+       * @event iron-select
+       */
+
+      /**
+       * Fired when an item is deselected
+       *
+       * @event iron-deselect
+       */
+
+      /**
+       * Fired when the list of selectable items changes (e.g., items are
+       * added or removed). The detail of the event is a list of mutation
+       * records that describe what changed.
+       *
+       * @event iron-items-changed
+       */
+
+    properties: {
+
+      /**
+       * If you want to use the attribute value of an element for `selected` instead of the index,
+       * set this to the name of the attribute.
+       */
+      attrForSelected: {
+        type: String,
+        value: null
+      },
+
+      /**
+       * Gets or sets the selected element. The default is to use the index of the item.
+       */
+      selected: {
+        type: String,
+        notify: true
+      },
+
+      /**
+       * Returns the currently selected item.
+       */
+      selectedItem: {
+        type: Object,
+        readOnly: true,
+        notify: true
+      },
+
+      /**
+       * The event that fires from items when they are selected. Selectable
+       * will listen for this event from items and update the selection state.
+       * Set to empty string to listen to no events.
+       */
+      activateEvent: {
+        type: String,
+        value: 'tap',
+        observer: '_activateEventChanged'
+      },
+
+      /**
+       * This is a CSS selector string.  If this is set, only items that match the CSS selector
+       * are selectable.
+       */
+      selectable: String,
+
+      /**
+       * The class to set on elements when selected.
+       */
+      selectedClass: {
+        type: String,
+        value: 'iron-selected'
+      },
+
+      /**
+       * The attribute to set on elements when selected.
+       */
+      selectedAttribute: {
+        type: String,
+        value: null
+      },
+
+      /**
+       * The set of excluded elements where the key is the `localName`
+       * of the element that will be ignored from the item list.
+       *
+       * @type {object}
+       * @default {template: 1}
+       */
+      excludedLocalNames: {
+        type: Object,
+        value: function() {
+          return {
+            'template': 1
+          };
+        }
+      }
+    },
+
+    observers: [
+      '_updateSelected(attrForSelected, selected)'
+    ],
+
+    created: function() {
+      this._bindFilterItem = this._filterItem.bind(this);
+      this._selection = new Polymer.IronSelection(this._applySelection.bind(this));
+    },
+
+    attached: function() {
+      this._observer = this._observeItems(this);
+      this._contentObserver = this._observeContent(this);
+      if (!this.selectedItem && this.selected) {
+        this._updateSelected(this.attrForSelected,this.selected)
+      }
+    },
+
+    detached: function() {
+      if (this._observer) {
+        this._observer.disconnect();
+      }
+      if (this._contentObserver) {
+        this._contentObserver.disconnect();
+      }
+      this._removeListener(this.activateEvent);
+    },
+
+    /**
+     * Returns an array of selectable items.
+     *
+     * @property items
+     * @type Array
+     */
+    get items() {
+      var nodes = Polymer.dom(this).queryDistributedElements(this.selectable || '*');
+      return Array.prototype.filter.call(nodes, this._bindFilterItem);
+    },
+
+    /**
+     * Returns the index of the given item.
+     *
+     * @method indexOf
+     * @param {Object} item
+     * @returns Returns the index of the item
+     */
+    indexOf: function(item) {
+      return this.items.indexOf(item);
+    },
+
+    /**
+     * Selects the given value.
+     *
+     * @method select
+     * @param {string} value the value to select.
+     */
+    select: function(value) {
+      this.selected = value;
+    },
+
+    /**
+     * Selects the previous item.
+     *
+     * @method selectPrevious
+     */
+    selectPrevious: function() {
+      var length = this.items.length;
+      var index = (Number(this._valueToIndex(this.selected)) - 1 + length) % length;
+      this.selected = this._indexToValue(index);
+    },
+
+    /**
+     * Selects the next item.
+     *
+     * @method selectNext
+     */
+    selectNext: function() {
+      var index = (Number(this._valueToIndex(this.selected)) + 1) % this.items.length;
+      this.selected = this._indexToValue(index);
+    },
+
+    _addListener: function(eventName) {
+      this.listen(this, eventName, '_activateHandler');
+    },
+
+    _removeListener: function(eventName) {
+      this.unlisten(this, eventName, '_activateHandler');
+    },
+
+    _activateEventChanged: function(eventName, old) {
+      this._removeListener(old);
+      this._addListener(eventName);
+    },
+
+    _updateSelected: function() {
+      this._selectSelected(this.selected);
+    },
+
+    _selectSelected: function(selected) {
+      this._selection.select(this._valueToItem(this.selected));
+    },
+
+    _filterItem: function(node) {
+      return !this.excludedLocalNames[node.localName];
+    },
+
+    _valueToItem: function(value) {
+      return (value == null) ? null : this.items[this._valueToIndex(value)];
+    },
+
+    _valueToIndex: function(value) {
+      if (this.attrForSelected) {
+        for (var i = 0, item; item = this.items[i]; i++) {
+          if (this._valueForItem(item) == value) {
+            return i;
+          }
+        }
+      } else {
+        return Number(value);
+      }
+    },
+
+    _indexToValue: function(index) {
+      if (this.attrForSelected) {
+        var item = this.items[index];
+        if (item) {
+          return this._valueForItem(item);
+        }
+      } else {
+        return index;
+      }
+    },
+
+    _valueForItem: function(item) {
+      return item[this.attrForSelected] || item.getAttribute(this.attrForSelected);
+    },
+
+    _applySelection: function(item, isSelected) {
+      if (this.selectedClass) {
+        this.toggleClass(this.selectedClass, isSelected, item);
+      }
+      if (this.selectedAttribute) {
+        this.toggleAttribute(this.selectedAttribute, isSelected, item);
+      }
+      this._selectionChange();
+      this.fire('iron-' + (isSelected ? 'select' : 'deselect'), {item: item});
+    },
+
+    _selectionChange: function() {
+      this._setSelectedItem(this._selection.get());
+    },
+
+    // observe content changes under the given node.
+    _observeContent: function(node) {
+      var content = node.querySelector('content');
+      if (content && content.parentElement === node) {
+        return this._observeItems(node.domHost);
+      }
+    },
+
+    // observe items change under the given node.
+    _observeItems: function(node) {
+      // TODO(cdata): Update this when we get distributed children changed.
+      var observer = new MutationObserver(function(mutations) {
+        // Let other interested parties know about the change so that
+        // we don't have to recreate mutation observers everywher.
+        this.fire('iron-items-changed', mutations, {
+          bubbles: false,
+          cancelable: false
+        });
+
+        if (this.selected != null) {
+          this._updateSelected();
+        }
+      }.bind(this));
+      observer.observe(node, {
+        childList: true,
+        subtree: true
+      });
+      return observer;
+    },
+
+    _activateHandler: function(e) {
+      var t = e.target;
+      var items = this.items;
+      while (t && t != this) {
+        var i = items.indexOf(t);
+        if (i >= 0) {
+          var value = this._indexToValue(i);
+          this._itemActivate(value, t);
+          return;
+        }
+        t = t.parentNode;
+      }
+    },
+
+    _itemActivate: function(value, item) {
+      if (!this.fire('iron-activate',
+          {selected: value, item: item}, {cancelable: true}).defaultPrevented) {
+        this.select(value);
+      }
+    }
+
+  };
+/** @polymerBehavior Polymer.IronMultiSelectableBehavior */
+  Polymer.IronMultiSelectableBehaviorImpl = {
+    properties: {
+
+      /**
+       * If true, multiple selections are allowed.
+       */
+      multi: {
+        type: Boolean,
+        value: false,
+        observer: 'multiChanged'
+      },
+
+      /**
+       * Gets or sets the selected elements. This is used instead of `selected` when `multi`
+       * is true.
+       */
+      selectedValues: {
+        type: Array,
+        notify: true
+      },
+
+      /**
+       * Returns an array of currently selected items.
+       */
+      selectedItems: {
+        type: Array,
+        readOnly: true,
+        notify: true
+      },
+
+    },
+
+    observers: [
+      '_updateSelected(attrForSelected, selectedValues)'
+    ],
+
+    /**
+     * Selects the given value. If the `multi` property is true, then the selected state of the
+     * `value` will be toggled; otherwise the `value` will be selected.
+     *
+     * @method select
+     * @param {string} value the value to select.
+     */
+    select: function(value) {
+      if (this.multi) {
+        if (this.selectedValues) {
+          this._toggleSelected(value);
+        } else {
+          this.selectedValues = [value];
+        }
+      } else {
+        this.selected = value;
+      }
+    },
+
+    multiChanged: function(multi) {
+      this._selection.multi = multi;
+    },
+
+    _updateSelected: function() {
+      if (this.multi) {
+        this._selectMulti(this.selectedValues);
+      } else {
+        this._selectSelected(this.selected);
+      }
+    },
+
+    _selectMulti: function(values) {
+      this._selection.clear();
+      if (values) {
+        for (var i = 0; i < values.length; i++) {
+          this._selection.setItemSelected(this._valueToItem(values[i]), true);
+        }
+      }
+    },
+
+    _selectionChange: function() {
+      var s = this._selection.get();
+      if (this.multi) {
+        this._setSelectedItems(s);
+      } else {
+        this._setSelectedItems([s]);
+        this._setSelectedItem(s);
+      }
+    },
+
+    _toggleSelected: function(value) {
+      var i = this.selectedValues.indexOf(value);
+      var unselected = i < 0;
+      if (unselected) {
+        this.push('selectedValues',value);
+      } else {
+        this.splice('selectedValues',i,1);
+      }
+      this._selection.setItemSelected(this._valueToItem(value), unselected);
+    }
+  };
+
+  /** @polymerBehavior */
+  Polymer.IronMultiSelectableBehavior = [
+    Polymer.IronSelectableBehavior,
+    Polymer.IronMultiSelectableBehaviorImpl
+  ];
+/**
+   * `Polymer.IronMenuBehavior` implements accessible menu behavior.
+   *
+   * @demo demo/index.html
+   * @polymerBehavior Polymer.IronMenuBehavior
+   */
+  Polymer.IronMenuBehaviorImpl = {
+
+    properties: {
+
+      /**
+       * Returns the currently focused item.
+       * @type {?Object}
+       */
+      focusedItem: {
+        observer: '_focusedItemChanged',
+        readOnly: true,
+        type: Object
+      },
+
+      /**
+       * The attribute to use on menu items to look up the item title. Typing the first
+       * letter of an item when the menu is open focuses that item. If unset, `textContent`
+       * will be used.
+       */
+      attrForItemTitle: {
+        type: String
+      }
+    },
+
+    hostAttributes: {
+      'role': 'menu',
+      'tabindex': '0'
+    },
+
+    observers: [
+      '_updateMultiselectable(multi)'
+    ],
+
+    listeners: {
+      'focus': '_onFocus',
+      'keydown': '_onKeydown',
+      'iron-items-changed': '_onIronItemsChanged'
+    },
+
+    keyBindings: {
+      'up': '_onUpKey',
+      'down': '_onDownKey',
+      'esc': '_onEscKey',
+      'shift+tab:keydown': '_onShiftTabDown'
+    },
+
+    attached: function() {
+      this._resetTabindices();
+    },
+
+    /**
+     * Selects the given value. If the `multi` property is true, then the selected state of the
+     * `value` will be toggled; otherwise the `value` will be selected.
+     *
+     * @param {string} value the value to select.
+     */
+    select: function(value) {
+      if (this._defaultFocusAsync) {
+        this.cancelAsync(this._defaultFocusAsync);
+        this._defaultFocusAsync = null;
+      }
+      var item = this._valueToItem(value);
+      if (item && item.hasAttribute('disabled')) return;
+      this._setFocusedItem(item);
+      Polymer.IronMultiSelectableBehaviorImpl.select.apply(this, arguments);
+    },
+
+    /**
+     * Resets all tabindex attributes to the appropriate value based on the
+     * current selection state. The appropriate value is `0` (focusable) for
+     * the default selected item, and `-1` (not keyboard focusable) for all
+     * other items.
+     */
+    _resetTabindices: function() {
+      var selectedItem = this.multi ? (this.selectedItems && this.selectedItems[0]) : this.selectedItem;
+
+      this.items.forEach(function(item) {
+        item.setAttribute('tabindex', item === selectedItem ? '0' : '-1');
+      }, this);
+    },
+
+    /**
+     * Sets appropriate ARIA based on whether or not the menu is meant to be
+     * multi-selectable.
+     *
+     * @param {boolean} multi True if the menu should be multi-selectable.
+     */
+    _updateMultiselectable: function(multi) {
+      if (multi) {
+        this.setAttribute('aria-multiselectable', 'true');
+      } else {
+        this.removeAttribute('aria-multiselectable');
+      }
+    },
+
+    /**
+     * Given a KeyboardEvent, this method will focus the appropriate item in the
+     * menu (if there is a relevant item, and it is possible to focus it).
+     *
+     * @param {KeyboardEvent} event A KeyboardEvent.
+     */
+    _focusWithKeyboardEvent: function(event) {
+      for (var i = 0, item; item = this.items[i]; i++) {
+        var attr = this.attrForItemTitle || 'textContent';
+        var title = item[attr] || item.getAttribute(attr);
+        if (title && title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.keyCode).toLowerCase()) {
+          this._setFocusedItem(item);
+          break;
+        }
+      }
+    },
+
+    /**
+     * Focuses the previous item (relative to the currently focused item) in the
+     * menu.
+     */
+    _focusPrevious: function() {
+      var length = this.items.length;
+      var index = (Number(this.indexOf(this.focusedItem)) - 1 + length) % length;
+      this._setFocusedItem(this.items[index]);
+    },
+
+    /**
+     * Focuses the next item (relative to the currently focused item) in the
+     * menu.
+     */
+    _focusNext: function() {
+      var index = (Number(this.indexOf(this.focusedItem)) + 1) % this.items.length;
+      this._setFocusedItem(this.items[index]);
+    },
+
+    /**
+     * Mutates items in the menu based on provided selection details, so that
+     * all items correctly reflect selection state.
+     *
+     * @param {Element} item An item in the menu.
+     * @param {boolean} isSelected True if the item should be shown in a
+     * selected state, otherwise false.
+     */
+    _applySelection: function(item, isSelected) {
+      if (isSelected) {
+        item.setAttribute('aria-selected', 'true');
+      } else {
+        item.removeAttribute('aria-selected');
+      }
+
+      Polymer.IronSelectableBehavior._applySelection.apply(this, arguments);
+    },
+
+    /**
+     * Discretely updates tabindex values among menu items as the focused item
+     * changes.
+     *
+     * @param {Element} focusedItem The element that is currently focused.
+     * @param {?Element} old The last element that was considered focused, if
+     * applicable.
+     */
+    _focusedItemChanged: function(focusedItem, old) {
+      old && old.setAttribute('tabindex', '-1');
+      if (focusedItem) {
+        focusedItem.setAttribute('tabindex', '0');
+        focusedItem.focus();
+      }
+    },
+
+    /**
+     * A handler that responds to mutation changes related to the list of items
+     * in the menu.
+     *
+     * @param {CustomEvent} event An event containing mutation records as its
+     * detail.
+     */
+    _onIronItemsChanged: function(event) {
+      var mutations = event.detail;
+      var mutation;
+      var index;
+
+      for (index = 0; index < mutations.length; ++index) {
+        mutation = mutations[index];
+
+        if (mutation.addedNodes.length) {
+          this._resetTabindices();
+          break;
+        }
+      }
+    },
+
+    /**
+     * Handler that is called when a shift+tab keypress is detected by the menu.
+     *
+     * @param {CustomEvent} event A key combination event.
+     */
+    _onShiftTabDown: function(event) {
+      var oldTabIndex;
+
+      Polymer.IronMenuBehaviorImpl._shiftTabPressed = true;
+
+      oldTabIndex = this.getAttribute('tabindex');
+
+      this.setAttribute('tabindex', '-1');
+
+      this.async(function() {
+        this.setAttribute('tabindex', oldTabIndex);
+        Polymer.IronMenuBehaviorImpl._shiftTabPressed = false;
+      // NOTE(cdata): polymer/polymer#1305
+      }, 1);
+    },
+
+    /**
+     * Handler that is called when the menu receives focus.
+     *
+     * @param {FocusEvent} event A focus event.
+     */
+    _onFocus: function(event) {
+      if (Polymer.IronMenuBehaviorImpl._shiftTabPressed) {
+        return;
+      }
+      // do not focus the menu itself
+      this.blur();
+      // clear the cached focus item
+      this._setFocusedItem(null);
+      this._defaultFocusAsync = this.async(function() {
+        // focus the selected item when the menu receives focus, or the first item
+        // if no item is selected
+        var selectedItem = this.multi ? (this.selectedItems && this.selectedItems[0]) : this.selectedItem;
+        if (selectedItem) {
+          this._setFocusedItem(selectedItem);
+        } else {
+          this._setFocusedItem(this.items[0]);
+        }
+      // async 100ms to wait for `select` to get called from `_itemActivate`
+      }, 100);
+    },
+
+    /**
+     * Handler that is called when the up key is pressed.
+     *
+     * @param {CustomEvent} event A key combination event.
+     */
+    _onUpKey: function(event) {
+      // up and down arrows moves the focus
+      this._focusPrevious();
+    },
+
+    /**
+     * Handler that is called when the down key is pressed.
+     *
+     * @param {CustomEvent} event A key combination event.
+     */
+    _onDownKey: function(event) {
+      this._focusNext();
+    },
+
+    /**
+     * Handler that is called when the esc key is pressed.
+     *
+     * @param {CustomEvent} event A key combination event.
+     */
+    _onEscKey: function(event) {
+      // esc blurs the control
+      this.focusedItem.blur();
+    },
+
+    /**
+     * Handler that is called when a keydown event is detected.
+     *
+     * @param {KeyboardEvent} event A keyboard event.
+     */
+    _onKeydown: function(event) {
+      if (this.keyboardEventMatchesKeys(event, 'up down esc')) {
+        return;
+      }
+
+      // all other keys focus the menu item starting with that character
+      this._focusWithKeyboardEvent(event);
+    }
+  };
+
+  Polymer.IronMenuBehaviorImpl._shiftTabPressed = false;
+
+  /** @polymerBehavior Polymer.IronMenuBehavior */
+  Polymer.IronMenuBehavior = [
+    Polymer.IronMultiSelectableBehavior,
+    Polymer.IronA11yKeysBehavior,
+    Polymer.IronMenuBehaviorImpl
+  ];
+(function() {
+
+  Polymer({
+
+    is: 'paper-menu',
+
+    behaviors: [
+      Polymer.IronMenuBehavior
+    ]
+
+  });
+
+})();
+/**
+   * `IronResizableBehavior` is a behavior that can be used in Polymer elements to
+   * coordinate the flow of resize events between "resizers" (elements that control the
+   * size or hidden state of their children) and "resizables" (elements that need to be
+   * notified when they are resized or un-hidden by their parents in order to take
+   * action on their new measurements).
+   * Elements that perform measurement should add the `IronResizableBehavior` behavior to
+   * their element definition and listen for the `iron-resize` event on themselves.
+   * This event will be fired when they become showing after having been hidden,
+   * when they are resized explicitly by another resizable, or when the window has been
+   * resized.
+   * Note, the `iron-resize` event is non-bubbling.
+   *
+   * @polymerBehavior Polymer.IronResizableBehavior
+   * @demo demo/index.html
+   **/
+  Polymer.IronResizableBehavior = {
+    properties: {
+      /**
+       * The closest ancestor element that implements `IronResizableBehavior`.
+       */
+      _parentResizable: {
+        type: Object,
+        observer: '_parentResizableChanged'
+      },
+
+      /**
+       * True if this element is currently notifying its descedant elements of
+       * resize.
+       */
+      _notifyingDescendant: {
+        type: Boolean,
+        value: false
+      }
+    },
+
+    listeners: {
+      'iron-request-resize-notifications': '_onIronRequestResizeNotifications'
+    },
+
+    created: function() {
+      // We don't really need property effects on these, and also we want them
+      // to be created before the `_parentResizable` observer fires:
+      this._interestedResizables = [];
+      this._boundNotifyResize = this.notifyResize.bind(this);
+    },
+
+    attached: function() {
+      this.fire('iron-request-resize-notifications', null, {
+        node: this,
+        bubbles: true,
+        cancelable: true
+      });
+
+      if (!this._parentResizable) {
+        window.addEventListener('resize', this._boundNotifyResize);
+        this.notifyResize();
+      }
+    },
+
+    detached: function() {
+      if (this._parentResizable) {
+        this._parentResizable.stopResizeNotificationsFor(this);
+      } else {
+        window.removeEventListener('resize', this._boundNotifyResize);
+      }
+
+      this._parentResizable = null;
+    },
+
+    /**
+     * Can be called to manually notify a resizable and its descendant
+     * resizables of a resize change.
+     */
+    notifyResize: function() {
+      if (!this.isAttached) {
+        return;
+      }
+
+      this._interestedResizables.forEach(function(resizable) {
+        if (this.resizerShouldNotify(resizable)) {
+          this._notifyDescendant(resizable);
+        }
+      }, this);
+
+      this._fireResize();
+    },
+
+    /**
+     * Used to assign the closest resizable ancestor to this resizable
+     * if the ancestor detects a request for notifications.
+     */
+    assignParentResizable: function(parentResizable) {
+      this._parentResizable = parentResizable;
+    },
+
+    /**
+     * Used to remove a resizable descendant from the list of descendants
+     * that should be notified of a resize change.
+     */
+    stopResizeNotificationsFor: function(target) {
+      var index = this._interestedResizables.indexOf(target);
+
+      if (index > -1) {
+        this._interestedResizables.splice(index, 1);
+        this.unlisten(target, 'iron-resize', '_onDescendantIronResize');
+      }
+    },
+
+    /**
+     * This method can be overridden to filter nested elements that should or
+     * should not be notified by the current element. Return true if an element
+     * should be notified, or false if it should not be notified.
+     *
+     * @param {HTMLElement} element A candidate descendant element that
+     * implements `IronResizableBehavior`.
+     * @return {boolean} True if the `element` should be notified of resize.
+     */
+    resizerShouldNotify: function(element) { return true; },
+
+    _onDescendantIronResize: function(event) {
+      if (this._notifyingDescendant) {
+        event.stopPropagation();
+        return;
+      }
+
+      // NOTE(cdata): In ShadowDOM, event retargetting makes echoing of the
+      // otherwise non-bubbling event "just work." We do it manually here for
+      // the case where Polymer is not using shadow roots for whatever reason:
+      if (!Polymer.Settings.useShadow) {
+        this._fireResize();
+      }
+    },
+
+    _fireResize: function() {
+      this.fire('iron-resize', null, {
+        node: this,
+        bubbles: false
+      });
+    },
+
+    _onIronRequestResizeNotifications: function(event) {
+      var target = event.path ? event.path[0] : event.target;
+
+      if (target === this) {
+        return;
+      }
+
+      if (this._interestedResizables.indexOf(target) === -1) {
+        this._interestedResizables.push(target);
+        this.listen(target, 'iron-resize', '_onDescendantIronResize');
+      }
+
+      target.assignParentResizable(this);
+      this._notifyDescendant(target);
+
+      event.stopPropagation();
+    },
+
+    _parentResizableChanged: function(parentResizable) {
+      if (parentResizable) {
+        window.removeEventListener('resize', this._boundNotifyResize);
+      }
+    },
+
+    _notifyDescendant: function(descendant) {
+      // NOTE(cdata): In IE10, attached is fired on children first, so it's
+      // important not to notify them if the parent is not attached yet (or
+      // else they will get redundantly notified when the parent attaches).
+      if (!this.isAttached) {
+        return;
+      }
+
+      this._notifyingDescendant = true;
+      descendant.notifyResize();
+      this._notifyingDescendant = false;
+    }
+  };
+/**
+Polymer.IronFitBehavior fits an element in another element using `max-height` and `max-width`, and
+optionally centers it in the window or another element.
+
+The element will only be sized and/or positioned if it has not already been sized and/or positioned
+by CSS.
+
+CSS properties               | Action
+-----------------------------|-------------------------------------------
+`position` set               | Element is not centered horizontally or vertically
+`top` or `bottom` set        | Element is not vertically centered
+`left` or `right` set        | Element is not horizontally centered
+`max-height` or `height` set | Element respects `max-height` or `height`
+`max-width` or `width` set   | Element respects `max-width` or `width`
+
+@demo demo/index.html
+@polymerBehavior
+*/
+
+  Polymer.IronFitBehavior = {
+
+    properties: {
+
+      /**
+       * The element that will receive a `max-height`/`width`. By default it is the same as `this`,
+       * but it can be set to a child element. This is useful, for example, for implementing a
+       * scrolling region inside the element.
+       * @type {!Element}
+       */
+      sizingTarget: {
+        type: Object,
+        value: function() {
+          return this;
+        }
+      },
+
+      /**
+       * The element to fit `this` into.
+       */
+      fitInto: {
+        type: Object,
+        value: window
+      },
+
+      /**
+       * Set to true to auto-fit on attach.
+       */
+      autoFitOnAttach: {
+        type: Boolean,
+        value: false
+      },
+
+      /** @type {?Object} */
+      _fitInfo: {
+        type: Object
+      }
+
+    },
+
+    get _fitWidth() {
+      var fitWidth;
+      if (this.fitInto === window) {
+        fitWidth = this.fitInto.innerWidth;
+      } else {
+        fitWidth = this.fitInto.getBoundingClientRect().width;
+      }
+      return fitWidth;
+    },
+
+    get _fitHeight() {
+      var fitHeight;
+      if (this.fitInto === window) {
+        fitHeight = this.fitInto.innerHeight;
+      } else {
+        fitHeight = this.fitInto.getBoundingClientRect().height;
+      }
+      return fitHeight;
+    },
+
+    get _fitLeft() {
+      var fitLeft;
+      if (this.fitInto === window) {
+        fitLeft = 0;
+      } else {
+        fitLeft = this.fitInto.getBoundingClientRect().left;
+      }
+      return fitLeft;
+    },
+
+    get _fitTop() {
+      var fitTop;
+      if (this.fitInto === window) {
+        fitTop = 0;
+      } else {
+        fitTop = this.fitInto.getBoundingClientRect().top;
+      }
+      return fitTop;
+    },
+
+    attached: function() {
+      if (this.autoFitOnAttach) {
+        if (window.getComputedStyle(this).display === 'none') {
+          setTimeout(function() {
+            this.fit();
+          }.bind(this));
+        } else {
+          this.fit();
+        }
+      }
+    },
+
+    /**
+     * Fits and optionally centers the element into the window, or `fitInfo` if specified.
+     */
+    fit: function() {
+      this._discoverInfo();
+      this.constrain();
+      this.center();
+    },
+
+    /**
+     * Memoize information needed to position and size the target element.
+     */
+    _discoverInfo: function() {
+      if (this._fitInfo) {
+        return;
+      }
+      var target = window.getComputedStyle(this);
+      var sizer = window.getComputedStyle(this.sizingTarget);
+      this._fitInfo = {
+        inlineStyle: {
+          top: this.style.top || '',
+          left: this.style.left || ''
+        },
+        positionedBy: {
+          vertically: target.top !== 'auto' ? 'top' : (target.bottom !== 'auto' ?
+            'bottom' : null),
+          horizontally: target.left !== 'auto' ? 'left' : (target.right !== 'auto' ?
+            'right' : null),
+          css: target.position
+        },
+        sizedBy: {
+          height: sizer.maxHeight !== 'none',
+          width: sizer.maxWidth !== 'none'
+        },
+        margin: {
+          top: parseInt(target.marginTop, 10) || 0,
+          right: parseInt(target.marginRight, 10) || 0,
+          bottom: parseInt(target.marginBottom, 10) || 0,
+          left: parseInt(target.marginLeft, 10) || 0
+        }
+      };
+    },
+
+    /**
+     * Resets the target element's position and size constraints, and clear
+     * the memoized data.
+     */
+    resetFit: function() {
+      if (!this._fitInfo || !this._fitInfo.sizedBy.height) {
+        this.sizingTarget.style.maxHeight = '';
+        this.style.top = this._fitInfo ? this._fitInfo.inlineStyle.top : '';
+      }
+      if (!this._fitInfo || !this._fitInfo.sizedBy.width) {
+        this.sizingTarget.style.maxWidth = '';
+        this.style.left = this._fitInfo ? this._fitInfo.inlineStyle.left : '';
+      }
+      if (this._fitInfo) {
+        this.style.position = this._fitInfo.positionedBy.css;
+      }
+      this._fitInfo = null;
+    },
+
+    /**
+     * Equivalent to calling `resetFit()` and `fit()`. Useful to call this after the element,
+     * the window, or the `fitInfo` element has been resized.
+     */
+    refit: function() {
+      this.resetFit();
+      this.fit();
+    },
+
+    /**
+     * Constrains the size of the element to the window or `fitInfo` by setting `max-height`
+     * and/or `max-width`.
+     */
+    constrain: function() {
+      var info = this._fitInfo;
+      // position at (0px, 0px) if not already positioned, so we can measure the natural size.
+      if (!this._fitInfo.positionedBy.vertically) {
+        this.style.top = '0px';
+      }
+      if (!this._fitInfo.positionedBy.horizontally) {
+        this.style.left = '0px';
+      }
+      // need border-box for margin/padding
+      this.sizingTarget.style.boxSizing = 'border-box';
+      // constrain the width and height if not already set
+      var rect = this.getBoundingClientRect();
+      if (!info.sizedBy.height) {
+        this._sizeDimension(rect, info.positionedBy.vertically, 'top', 'bottom', 'Height');
+      }
+      if (!info.sizedBy.width) {
+        this._sizeDimension(rect, info.positionedBy.horizontally, 'left', 'right', 'Width');
+      }
+    },
+
+    _sizeDimension: function(rect, positionedBy, start, end, extent) {
+      var info = this._fitInfo;
+      var max = extent === 'Width' ? this._fitWidth : this._fitHeight;
+      var flip = (positionedBy === end);
+      var offset = flip ? max - rect[end] : rect[start];
+      var margin = info.margin[flip ? start : end];
+      var offsetExtent = 'offset' + extent;
+      var sizingOffset = this[offsetExtent] - this.sizingTarget[offsetExtent];
+      this.sizingTarget.style['max' + extent] = (max - margin - offset - sizingOffset) + 'px';
+    },
+
+    /**
+     * Centers horizontally and vertically if not already positioned. This also sets
+     * `position:fixed`.
+     */
+    center: function() {
+      if (!this._fitInfo.positionedBy.vertically || !this._fitInfo.positionedBy.horizontally) {
+        // need position:fixed to center
+        this.style.position = 'fixed';
+      }
+      if (!this._fitInfo.positionedBy.vertically) {
+        var top = (this._fitHeight - this.offsetHeight) / 2 + this._fitTop;
+        top -= this._fitInfo.margin.top;
+        this.style.top = top + 'px';
+      }
+      if (!this._fitInfo.positionedBy.horizontally) {
+        var left = (this._fitWidth - this.offsetWidth) / 2 + this._fitLeft;
+        left -= this._fitInfo.margin.left;
+        this.style.left = left + 'px';
+      }
+    }
+
+  };
+Polymer.IronOverlayManager = (function() {
+
+    var overlays = [];
+    var DEFAULT_Z = 10;
+    var backdrops = [];
+
+    // track overlays for z-index and focus managemant
+    function addOverlay(overlay) {
+      var z0 = currentOverlayZ();
+      overlays.push(overlay);
+      var z1 = currentOverlayZ();
+      if (z1 <= z0) {
+        applyOverlayZ(overlay, z0);
+      }
+    }
+
+    function removeOverlay(overlay) {
+      var i = overlays.indexOf(overlay);
+      if (i >= 0) {
+        overlays.splice(i, 1);
+        setZ(overlay, '');
+      }
+    }
+
+    function applyOverlayZ(overlay, aboveZ) {
+      setZ(overlay, aboveZ + 2);
+    }
+
+    function setZ(element, z) {
+      element.style.zIndex = z;
+    }
+
+    function currentOverlay() {
+      var i = overlays.length - 1;
+      while (overlays[i] && !overlays[i].opened) {
+        --i;
+      }
+      return overlays[i];
+    }
+
+    function currentOverlayZ() {
+      var z;
+      var current = currentOverlay();
+      if (current) {
+        var z1 = window.getComputedStyle(current).zIndex;
+        if (!isNaN(z1)) {
+          z = Number(z1);
+        }
+      }
+      return z || DEFAULT_Z;
+    }
+
+    function focusOverlay() {
+      var current = currentOverlay();
+      // We have to be careful to focus the next overlay _after_ any current
+      // transitions are complete (due to the state being toggled prior to the
+      // transition). Otherwise, we risk infinite recursion when a transitioning
+      // (closed) overlay becomes the current overlay.
+      //
+      // NOTE: We make the assumption that any overlay that completes a transition
+      // will call into focusOverlay to kick the process back off. Currently:
+      // transitionend -> _applyFocus -> focusOverlay.
+      if (current && !current.transitioning) {
+        current._applyFocus();
+      }
+    }
+
+    function trackBackdrop(element) {
+      // backdrops contains the overlays with a backdrop that are currently
+      // visible
+      if (element.opened) {
+        backdrops.push(element);
+      } else {
+        var index = backdrops.indexOf(element);
+        if (index >= 0) {
+          backdrops.splice(index, 1);
+        }
+      }
+    }
+
+    function getBackdrops() {
+      return backdrops;
+    }
+
+    return {
+      addOverlay: addOverlay,
+      removeOverlay: removeOverlay,
+      currentOverlay: currentOverlay,
+      currentOverlayZ: currentOverlayZ,
+      focusOverlay: focusOverlay,
+      trackBackdrop: trackBackdrop,
+      getBackdrops: getBackdrops
+    };
+
+  })();
+(function() {
+
+  Polymer({
+
+    is: 'iron-overlay-backdrop',
+
+    properties: {
+
+      /**
+       * Returns true if the backdrop is opened.
+       */
+      opened: {
+        readOnly: true,
+        reflectToAttribute: true,
+        type: Boolean,
+        value: false
+      },
+
+      _manager: {
+        type: Object,
+        value: Polymer.IronOverlayManager
+      }
+
+    },
+
+    /**
+     * Appends the backdrop to document body and sets its `z-index` to be below the latest overlay.
+     */
+    prepare: function() {
+      if (!this.parentNode) {
+        Polymer.dom(document.body).appendChild(this);
+        this.style.zIndex = this._manager.currentOverlayZ() - 1;
+      }
+    },
+
+    /**
+     * Shows the backdrop if needed.
+     */
+    open: function() {
+      // only need to make the backdrop visible if this is called by the first overlay with a backdrop
+      if (this._manager.getBackdrops().length < 2) {
+        this._setOpened(true);
+      }
+    },
+
+    /**
+     * Hides the backdrop if needed.
+     */
+    close: function() {
+      // only need to make the backdrop invisible if this is called by the last overlay with a backdrop
+      if (this._manager.getBackdrops().length < 2) {
+        this._setOpened(false);
+      }
+    },
+
+    /**
+     * Removes the backdrop from document body if needed.
+     */
+    complete: function() {
+      // only remove the backdrop if there are no more overlays with backdrops
+      if (this._manager.getBackdrops().length === 0 && this.parentNode) {
+        Polymer.dom(this.parentNode).removeChild(this);
+      }
+    }
+
+  });
+
+})();
+/**
+Use `Polymer.IronOverlayBehavior` to implement an element that can be hidden or shown, and displays
+on top of other content. It includes an optional backdrop, and can be used to implement a variety
+of UI controls including dialogs and drop downs. Multiple overlays may be displayed at once.
+
+### Closing and canceling
+
+A dialog may be hidden by closing or canceling. The difference between close and cancel is user
+intent. Closing generally implies that the user acknowledged the content on the overlay. By default,
+it will cancel whenever the user taps outside it or presses the escape key. This behavior is
+configurable with the `no-cancel-on-esc-key` and the `no-cancel-on-outside-click` properties.
+`close()` should be called explicitly by the implementer when the user interacts with a control
+in the overlay element.
+
+### Positioning
+
+By default the element is sized and positioned to fit and centered inside the window. You can
+position and size it manually using CSS. See `Polymer.IronFitBehavior`.
+
+### Backdrop
+
+Set the `with-backdrop` attribute to display a backdrop behind the overlay. The backdrop is
+appended to `<body>` and is of type `<iron-overlay-backdrop>`. See its doc page for styling
+options.
+
+### Limitations
+
+The element is styled to appear on top of other content by setting its `z-index` property. You
+must ensure no element has a stacking context with a higher `z-index` than its parent stacking
+context. You should place this element as a child of `<body>` whenever possible.
+
+@demo demo/index.html
+@polymerBehavior Polymer.IronOverlayBehavior
+*/
+
+  Polymer.IronOverlayBehaviorImpl = {
+
+    properties: {
+
+      /**
+       * True if the overlay is currently displayed.
+       */
+      opened: {
+        observer: '_openedChanged',
+        type: Boolean,
+        value: false,
+        notify: true
+      },
+
+      /**
+       * True if the overlay was canceled when it was last closed.
+       */
+      canceled: {
+        observer: '_canceledChanged',
+        readOnly: true,
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * Set to true to display a backdrop behind the overlay.
+       */
+      withBackdrop: {
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * Set to true to disable auto-focusing the overlay or child nodes with
+       * the `autofocus` attribute` when the overlay is opened.
+       */
+      noAutoFocus: {
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * Set to true to disable canceling the overlay with the ESC key.
+       */
+      noCancelOnEscKey: {
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * Set to true to disable canceling the overlay by clicking outside it.
+       */
+      noCancelOnOutsideClick: {
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * Returns the reason this dialog was last closed.
+       */
+      closingReason: {
+        // was a getter before, but needs to be a property so other
+        // behaviors can override this.
+        type: Object
+      },
+
+      _manager: {
+        type: Object,
+        value: Polymer.IronOverlayManager
+      },
+
+      _boundOnCaptureClick: {
+        type: Function,
+        value: function() {
+          return this._onCaptureClick.bind(this);
+        }
+      },
+
+      _boundOnCaptureKeydown: {
+        type: Function,
+        value: function() {
+          return this._onCaptureKeydown.bind(this);
+        }
+      }
+
+    },
+
+    listeners: {
+      'tap': '_onClick',
+      'iron-resize': '_onIronResize'
+    },
+
+    /**
+     * The backdrop element.
+     * @type Node
+     */
+    get backdropElement() {
+      return this._backdrop;
+    },
+
+    get _focusNode() {
+      return Polymer.dom(this).querySelector('[autofocus]') || this;
+    },
+
+    registered: function() {
+      this._backdrop = document.createElement('iron-overlay-backdrop');
+    },
+
+    ready: function() {
+      this._ensureSetup();
+      if (this._callOpenedWhenReady) {
+        this._openedChanged();
+      }
+    },
+
+    detached: function() {
+      this.opened = false;
+      this._completeBackdrop();
+      this._manager.removeOverlay(this);
+    },
+
+    /**
+     * Toggle the opened state of the overlay.
+     */
+    toggle: function() {
+      this.opened = !this.opened;
+    },
+
+    /**
+     * Open the overlay.
+     */
+    open: function() {
+      this.opened = true;
+      this.closingReason = {canceled: false};
+    },
+
+    /**
+     * Close the overlay.
+     */
+    close: function() {
+      this.opened = false;
+      this._setCanceled(false);
+    },
+
+    /**
+     * Cancels the overlay.
+     */
+    cancel: function() {
+      this.opened = false;
+      this._setCanceled(true);
+    },
+
+    _ensureSetup: function() {
+      if (this._overlaySetup) {
+        return;
+      }
+      this._overlaySetup = true;
+      this.style.outline = 'none';
+      this.style.display = 'none';
+    },
+
+    _openedChanged: function() {
+      if (this.opened) {
+        this.removeAttribute('aria-hidden');
+      } else {
+        this.setAttribute('aria-hidden', 'true');
+      }
+
+      // wait to call after ready only if we're initially open
+      if (!this._overlaySetup) {
+        this._callOpenedWhenReady = this.opened;
+        return;
+      }
+      if (this._openChangedAsync) {
+        this.cancelAsync(this._openChangedAsync);
+      }
+
+      this._toggleListeners();
+
+      if (this.opened) {
+        this._prepareRenderOpened();
+      }
+
+      // async here to allow overlay layer to become visible.
+      this._openChangedAsync = this.async(function() {
+        // overlay becomes visible here
+        this.style.display = '';
+        // force layout to ensure transitions will go
+        /** @suppress {suspiciousCode} */ this.offsetWidth;
+        if (this.opened) {
+          this._renderOpened();
+        } else {
+          this._renderClosed();
+        }
+        this._openChangedAsync = null;
+      });
+
+    },
+
+    _canceledChanged: function() {
+      this.closingReason = this.closingReason || {};
+      this.closingReason.canceled = this.canceled;
+    },
+
+    _toggleListener: function(enable, node, event, boundListener, capture) {
+      if (enable) {
+        // enable document-wide tap recognizer
+        if (event === 'tap') {
+          Polymer.Gestures.add(document, 'tap', null);
+        }
+        node.addEventListener(event, boundListener, capture);
+      } else {
+        // disable document-wide tap recognizer
+        if (event === 'tap') {
+          Polymer.Gestures.remove(document, 'tap', null);
+        }
+        node.removeEventListener(event, boundListener, capture);
+      }
+    },
+
+    _toggleListeners: function() {
+      if (this._toggleListenersAsync) {
+        this.cancelAsync(this._toggleListenersAsync);
+      }
+      // async so we don't auto-close immediately via a click.
+      this._toggleListenersAsync = this.async(function() {
+        this._toggleListener(this.opened, document, 'tap', this._boundOnCaptureClick, true);
+        this._toggleListener(this.opened, document, 'keydown', this._boundOnCaptureKeydown, true);
+        this._toggleListenersAsync = null;
+      }, 1);
+    },
+
+    // tasks which must occur before opening; e.g. making the element visible
+    _prepareRenderOpened: function() {
+      this._manager.addOverlay(this);
+
+      if (this.withBackdrop) {
+        this.backdropElement.prepare();
+        this._manager.trackBackdrop(this);
+      }
+
+      this._preparePositioning();
+      this.fit();
+      this._finishPositioning();
+    },
+
+    // tasks which cause the overlay to actually open; typically play an
+    // animation
+    _renderOpened: function() {
+      if (this.withBackdrop) {
+        this.backdropElement.open();
+      }
+      this._finishRenderOpened();
+    },
+
+    _renderClosed: function() {
+      if (this.withBackdrop) {
+        this.backdropElement.close();
+      }
+      this._finishRenderClosed();
+    },
+
+    _onTransitionend: function(event) {
+      // make sure this is our transition event.
+      if (event && event.target !== this) {
+        return;
+      }
+      if (this.opened) {
+        this._finishRenderOpened();
+      } else {
+        this._finishRenderClosed();
+      }
+    },
+
+    _finishRenderOpened: function() {
+      // focus the child node with [autofocus]
+      if (!this.noAutoFocus) {
+        this._focusNode.focus();
+      }
+
+      this.fire('iron-overlay-opened');
+
+      this._squelchNextResize = true;
+      this.async(this.notifyResize);
+    },
+
+    _finishRenderClosed: function() {
+      // hide the overlay and remove the backdrop
+      this.resetFit();
+      this.style.display = 'none';
+      this._completeBackdrop();
+      this._manager.removeOverlay(this);
+
+      this._focusNode.blur();
+      // focus the next overlay, if there is one
+      this._manager.focusOverlay();
+
+      this.fire('iron-overlay-closed', this.closingReason);
+
+      this._squelchNextResize = true;
+      this.async(this.notifyResize);
+    },
+
+    _completeBackdrop: function() {
+      if (this.withBackdrop) {
+        this._manager.trackBackdrop(this);
+        this.backdropElement.complete();
+      }
+    },
+
+    _preparePositioning: function() {
+      this.style.transition = this.style.webkitTransition = 'none';
+      this.style.transform = this.style.webkitTransform = 'none';
+      this.style.display = '';
+    },
+
+    _finishPositioning: function() {
+      this.style.display = 'none';
+      this.style.transform = this.style.webkitTransform = '';
+      // force layout to avoid application of transform
+      /** @suppress {suspiciousCode} */ this.offsetWidth;
+      this.style.transition = this.style.webkitTransition = '';
+    },
+
+    _applyFocus: function() {
+      if (this.opened) {
+        if (!this.noAutoFocus) {
+          this._focusNode.focus();
+        }
+      } else {
+        this._focusNode.blur();
+        this._manager.focusOverlay();
+      }
+    },
+
+    _onCaptureClick: function(event) {
+      // attempt to close asynchronously and prevent the close of a tap event is immediately heard
+      // on target. This is because in shadow dom due to event retargetting event.target is not
+      // useful.
+      if (!this.noCancelOnOutsideClick && (this._manager.currentOverlay() == this)) {
+        this._cancelJob = this.async(function() {
+          this.cancel();
+        }, 10);
+      }
+    },
+
+    _onClick: function(event) {
+      if (this._cancelJob) {
+        this.cancelAsync(this._cancelJob);
+        this._cancelJob = null;
+      }
+    },
+
+    _onCaptureKeydown: function(event) {
+      var ESC = 27;
+      if (!this.noCancelOnEscKey && (event.keyCode === ESC)) {
+        this.cancel();
+        event.stopPropagation();
+      }
+    },
+
+    _onIronResize: function() {
+      if (this._squelchNextResize) {
+        this._squelchNextResize = false;
+        return;
+      }
+      if (this.opened) {
+        this.refit();
+      }
+    }
+
+/**
+ * Fired after the `iron-overlay` opens.
+ * @event iron-overlay-opened
+ */
+
+/**
+ * Fired after the `iron-overlay` closes.
+ * @event iron-overlay-closed
+ * @param {{canceled: (boolean|undefined)}} set to the `closingReason` attribute
+ */
+  };
+
+  /** @polymerBehavior */
+  Polymer.IronOverlayBehavior = [Polymer.IronFitBehavior, Polymer.IronResizableBehavior, Polymer.IronOverlayBehaviorImpl];
+/**
+   * Use `Polymer.NeonAnimationBehavior` to implement an animation.
+   * @polymerBehavior
+   */
+  Polymer.NeonAnimationBehavior = {
+
+    properties: {
+
+      /**
+       * Defines the animation timing.
+       */
+      animationTiming: {
+        type: Object,
+        value: function() {
+          return {
+            duration: 500,
+            easing: 'cubic-bezier(0.4, 0, 0.2, 1)',
+            fill: 'both'
+          }
+        }
+      }
+
+    },
+
+    registered: function() {
+      new Polymer.IronMeta({type: 'animation', key: this.is, value: this.constructor});
+    },
+
+    /**
+     * Do any animation configuration here.
+     */
+    // configure: function(config) {
+    // },
+
+    /**
+     * Returns the animation timing by mixing in properties from `config` to the defaults defined
+     * by the animation.
+     */
+    timingFromConfig: function(config) {
+      if (config.timing) {
+        for (var property in config.timing) {
+          this.animationTiming[property] = config.timing[property];
+        }
+      }
+      return this.animationTiming;
+    },
+
+    /**
+     * Sets `transform` and `transformOrigin` properties along with the prefixed versions.
+     */
+    setPrefixedProperty: function(node, property, value) {
+      var map = {
+        'transform': ['webkitTransform'],
+        'transformOrigin': ['mozTransformOrigin', 'webkitTransformOrigin']
+      };
+      var prefixes = map[property];
+      for (var prefix, index = 0; prefix = prefixes[index]; index++) {
+        node.style[prefix] = value;
+      }
+      node.style[property] = value;
+    },
+
+    /**
+     * Called when the animation finishes.
+     */
+    complete: function() {}
+
+  };
+Polymer({
+
+    is: 'opaque-animation',
+
+    behaviors: [
+      Polymer.NeonAnimationBehavior
+    ],
+
+    configure: function(config) {
+      var node = config.node;
+      node.style.opacity = '0';
+      this._effect = new KeyframeEffect(node, [
+        {'opacity': '1'},
+        {'opacity': '1'}
+      ], this.timingFromConfig(config));
+      return this._effect;
+    },
+
+    complete: function(config) {
+      config.node.style.opacity = '';
+    }
+
+  });
+/**
+   * `Polymer.NeonAnimatableBehavior` is implemented by elements containing animations for use with
+   * elements implementing `Polymer.NeonAnimationRunnerBehavior`.
+   * @polymerBehavior
+   */
+  Polymer.NeonAnimatableBehavior = {
+
+    properties: {
+
+      /**
+       * Animation configuration. See README for more info.
+       */
+      animationConfig: {
+        type: Object
+      },
+
+      /**
+       * Convenience property for setting an 'entry' animation. Do not set `animationConfig.entry`
+       * manually if using this. The animated node is set to `this` if using this property.
+       */
+      entryAnimation: {
+        observer: '_entryAnimationChanged',
+        type: String
+      },
+
+      /**
+       * Convenience property for setting an 'exit' animation. Do not set `animationConfig.exit`
+       * manually if using this. The animated node is set to `this` if using this property.
+       */
+      exitAnimation: {
+        observer: '_exitAnimationChanged',
+        type: String
+      }
+
+    },
+
+    _entryAnimationChanged: function() {
+      this.animationConfig = this.animationConfig || {};
+      if (this.entryAnimation !== 'fade-in-animation') {
+        // insert polyfill hack
+        this.animationConfig['entry'] = [{
+          name: 'opaque-animation',
+          node: this
+        }, {
+          name: this.entryAnimation,
+          node: this
+        }];
+      } else {
+        this.animationConfig['entry'] = [{
+          name: this.entryAnimation,
+          node: this
+        }];
+      }
+    },
+
+    _exitAnimationChanged: function() {
+      this.animationConfig = this.animationConfig || {};
+      this.animationConfig['exit'] = [{
+        name: this.exitAnimation,
+        node: this
+      }];
+    },
+
+    _copyProperties: function(config1, config2) {
+      // shallowly copy properties from config2 to config1
+      for (var property in config2) {
+        config1[property] = config2[property];
+      }
+    },
+
+    _cloneConfig: function(config) {
+      var clone = {
+        isClone: true
+      };
+      this._copyProperties(clone, config);
+      return clone;
+    },
+
+    _getAnimationConfigRecursive: function(type, map, allConfigs) {
+      if (!this.animationConfig) {
+        return;
+      }
+
+      // type is optional
+      var thisConfig;
+      if (type) {
+        thisConfig = this.animationConfig[type];
+      } else {
+        thisConfig = this.animationConfig;
+      }
+
+      if (!Array.isArray(thisConfig)) {
+        thisConfig = [thisConfig];
+      }
+
+      // iterate animations and recurse to process configurations from child nodes
+      if (thisConfig) {
+        for (var config, index = 0; config = thisConfig[index]; index++) {
+          if (config.animatable) {
+            config.animatable._getAnimationConfigRecursive(config.type || type, map, allConfigs);
+          } else {
+            if (config.id) {
+              var cachedConfig = map[config.id];
+              if (cachedConfig) {
+                // merge configurations with the same id, making a clone lazily
+                if (!cachedConfig.isClone) {
+                  map[config.id] = this._cloneConfig(cachedConfig)
+                  cachedConfig = map[config.id];
+                }
+                this._copyProperties(cachedConfig, config);
+              } else {
+                // put any configs with an id into a map
+                map[config.id] = config;
+              }
+            } else {
+              allConfigs.push(config);
+            }
+          }
+        }
+      }
+    },
+
+    /**
+     * An element implementing `Polymer.NeonAnimationRunnerBehavior` calls this method to configure
+     * an animation with an optional type. Elements implementing `Polymer.NeonAnimatableBehavior`
+     * should define the property `animationConfig`, which is either a configuration object
+     * or a map of animation type to array of configuration objects.
+     */
+    getAnimationConfig: function(type) {
+      var map = [];
+      var allConfigs = [];
+      this._getAnimationConfigRecursive(type, map, allConfigs);
+      // append the configurations saved in the map to the array
+      for (var key in map) {
+        allConfigs.push(map[key]);
+      }
+      return allConfigs;
+    }
+
+  };
+/**
+   * `Polymer.NeonAnimationRunnerBehavior` adds a method to run animations.
+   *
+   * @polymerBehavior Polymer.NeonAnimationRunnerBehavior
+   */
+  Polymer.NeonAnimationRunnerBehaviorImpl = {
+
+    properties: {
+
+      _animationMeta: {
+        type: Object,
+        value: function() {
+          return new Polymer.IronMeta({type: 'animation'});
+        }
+      },
+
+      /** @type {?Object} */
+      _player: {
+        type: Object
+      }
+
+    },
+
+    _configureAnimationEffects: function(allConfigs) {
+      var allAnimations = [];
+      if (allConfigs.length > 0) {
+        for (var config, index = 0; config = allConfigs[index]; index++) {
+          var animationConstructor = this._animationMeta.byKey(config.name);
+          if (animationConstructor) {
+            var animation = animationConstructor && new animationConstructor();
+            var effect = animation.configure(config);
+            if (effect) {
+              allAnimations.push({
+                animation: animation,
+                config: config,
+                effect: effect
+              });
+            }
+          } else {
+            console.warn(this.is + ':', config.name, 'not found!');
+          }
+        }
+      }
+      return allAnimations;
+    },
+
+    _runAnimationEffects: function(allEffects) {
+      return document.timeline.play(new GroupEffect(allEffects));
+    },
+
+    _completeAnimations: function(allAnimations) {
+      for (var animation, index = 0; animation = allAnimations[index]; index++) {
+        animation.animation.complete(animation.config);
+      }
+    },
+
+    /**
+     * Plays an animation with an optional `type`.
+     * @param {string=} type
+     * @param {!Object=} cookie
+     */
+    playAnimation: function(type, cookie) {
+      var allConfigs = this.getAnimationConfig(type);
+      if (!allConfigs) {
+        return;
+      }
+      var allAnimations = this._configureAnimationEffects(allConfigs);
+      var allEffects = allAnimations.map(function(animation) {
+        return animation.effect;
+      });
+
+      if (allEffects.length > 0) {
+        this._player = this._runAnimationEffects(allEffects);
+        this._player.onfinish = function() {
+          this._completeAnimations(allAnimations);
+
+          if (this._player) {
+            this._player.cancel();
+            this._player = null;
+          }
+
+          this.fire('neon-animation-finish', cookie, {bubbles: false});
+        }.bind(this);
+
+      } else {
+        this.fire('neon-animation-finish', cookie, {bubbles: false});
+      }
+    },
+
+    /**
+     * Cancels the currently running animation.
+     */
+    cancelAnimation: function() {
+      if (this._player) {
+        this._player.cancel();
+      }
+    }
+  };
+
+  /** @polymerBehavior Polymer.NeonAnimationRunnerBehavior */
+  Polymer.NeonAnimationRunnerBehavior = [
+    Polymer.NeonAnimatableBehavior,
+    Polymer.NeonAnimationRunnerBehaviorImpl
+  ];
+(function() {
+    'use strict';
+
+    /**
+     * The IronDropdownScrollManager is intended to provide a central source
+     * of authority and control over which elements in a document are currently
+     * allowed to scroll.
+     */
+
+    Polymer.IronDropdownScrollManager = {
+
+      /**
+       * The current element that defines the DOM boundaries of the
+       * scroll lock. This is always the most recently locking element.
+       */
+      get currentLockingElement() {
+        return this._lockingElements[this._lockingElements.length - 1];
+      },
+
+
+      /**
+       * Returns true if the provided element is "scroll locked," which is to
+       * say that it cannot be scrolled via pointer or keyboard interactions.
+       *
+       * @param {HTMLElement} element An HTML element instance which may or may
+       * not be scroll locked.
+       */
+      elementIsScrollLocked: function(element) {
+        var currentLockingElement = this.currentLockingElement;
+        var scrollLocked;
+
+        if (this._hasCachedLockedElement(element)) {
+          return true;
+        }
+
+        if (this._hasCachedUnlockedElement(element)) {
+          return false;
+        }
+
+        scrollLocked = !!currentLockingElement &&
+          currentLockingElement !== element &&
+          !this._composedTreeContains(currentLockingElement, element);
+
+        if (scrollLocked) {
+          this._lockedElementCache.push(element);
+        } else {
+          this._unlockedElementCache.push(element);
+        }
+
+        return scrollLocked;
+      },
+
+      /**
+       * Push an element onto the current scroll lock stack. The most recently
+       * pushed element and its children will be considered scrollable. All
+       * other elements will not be scrollable.
+       *
+       * Scroll locking is implemented as a stack so that cases such as
+       * dropdowns within dropdowns are handled well.
+       *
+       * @param {HTMLElement} element The element that should lock scroll.
+       */
+      pushScrollLock: function(element) {
+        if (this._lockingElements.length === 0) {
+          this._lockScrollInteractions();
+        }
+
+        this._lockingElements.push(element);
+
+        this._lockedElementCache = [];
+        this._unlockedElementCache = [];
+      },
+
+      /**
+       * Remove an element from the scroll lock stack. The element being
+       * removed does not need to be the most recently pushed element. However,
+       * the scroll lock constraints only change when the most recently pushed
+       * element is removed.
+       *
+       * @param {HTMLElement} element The element to remove from the scroll
+       * lock stack.
+       */
+      removeScrollLock: function(element) {
+        var index = this._lockingElements.indexOf(element);
+
+        if (index === -1) {
+          return;
+        }
+
+        this._lockingElements.splice(index, 1);
+
+        this._lockedElementCache = [];
+        this._unlockedElementCache = [];
+
+        if (this._lockingElements.length === 0) {
+          this._unlockScrollInteractions();
+        }
+      },
+
+      _lockingElements: [],
+
+      _lockedElementCache: null,
+
+      _unlockedElementCache: null,
+
+      _originalBodyStyles: {},
+
+      _isScrollingKeypress: function(event) {
+        return Polymer.IronA11yKeysBehavior.keyboardEventMatchesKeys(
+          event, 'pageup pagedown home end up left down right');
+      },
+
+      _hasCachedLockedElement: function(element) {
+        return this._lockedElementCache.indexOf(element) > -1;
+      },
+
+      _hasCachedUnlockedElement: function(element) {
+        return this._unlockedElementCache.indexOf(element) > -1;
+      },
+
+      _composedTreeContains: function(element, child) {
+        // NOTE(cdata): This method iterates over content elements and their
+        // corresponding distributed nodes to implement a contains-like method
+        // that pierces through the composed tree of the ShadowDOM. Results of
+        // this operation are cached (elsewhere) on a per-scroll-lock basis, to
+        // guard against potentially expensive lookups happening repeatedly as
+        // a user scrolls / touchmoves.
+        var contentElements;
+        var distributedNodes;
+        var contentIndex;
+        var nodeIndex;
+
+        if (element.contains(child)) {
+          return true;
+        }
+
+        contentElements = Polymer.dom(element).querySelectorAll('content');
+
+        for (contentIndex = 0; contentIndex < contentElements.length; ++contentIndex) {
+
+          distributedNodes = Polymer.dom(contentElements[contentIndex]).getDistributedNodes();
+
+          for (nodeIndex = 0; nodeIndex < distributedNodes.length; ++nodeIndex) {
+
+            if (this._composedTreeContains(distributedNodes[nodeIndex], child)) {
+              return true;
+            }
+          }
+        }
+
+        return false;
+      },
+
+      _scrollInteractionHandler: function(event) {
+        if (Polymer
+              .IronDropdownScrollManager
+              .elementIsScrollLocked(event.target)) {
+          if (event.type === 'keydown' &&
+              !Polymer.IronDropdownScrollManager._isScrollingKeypress(event)) {
+            return;
+          }
+
+          event.preventDefault();
+        }
+      },
+
+      _lockScrollInteractions: function() {
+        // Memoize body inline styles:
+        this._originalBodyStyles.overflow = document.body.style.overflow;
+        this._originalBodyStyles.overflowX = document.body.style.overflowX;
+        this._originalBodyStyles.overflowY = document.body.style.overflowY;
+
+        // Disable overflow scrolling on body:
+        // TODO(cdata): It is technically not sufficient to hide overflow on
+        // body alone. A better solution might be to traverse all ancestors of
+        // the current scroll locking element and hide overflow on them. This
+        // becomes expensive, though, as it would have to be redone every time
+        // a new scroll locking element is added.
+        document.body.style.overflow = 'hidden';
+        document.body.style.overflowX = 'hidden';
+        document.body.style.overflowY = 'hidden';
+
+        // Modern `wheel` event for mouse wheel scrolling:
+        window.addEventListener('wheel', this._scrollInteractionHandler, true);
+        // Older, non-standard `mousewheel` event for some FF:
+        window.addEventListener('mousewheel', this._scrollInteractionHandler, true);
+        // IE:
+        window.addEventListener('DOMMouseScroll', this._scrollInteractionHandler, true);
+        // Mobile devices can scroll on touch move:
+        window.addEventListener('touchmove', this._scrollInteractionHandler, true);
+        // Capture keydown to prevent scrolling keys (pageup, pagedown etc.)
+        document.addEventListener('keydown', this._scrollInteractionHandler, true);
+      },
+
+      _unlockScrollInteractions: function() {
+        document.body.style.overflow = this._originalBodyStyles.overflow;
+        document.body.style.overflowX = this._originalBodyStyles.overflowX;
+        document.body.style.overflowY = this._originalBodyStyles.overflowY;
+
+        window.removeEventListener('wheel', this._scrollInteractionHandler, true);
+        window.removeEventListener('mousewheel', this._scrollInteractionHandler, true);
+        window.removeEventListener('DOMMouseScroll', this._scrollInteractionHandler, true);
+        window.removeEventListener('touchmove', this._scrollInteractionHandler, true);
+        document.removeEventListener('keydown', this._scrollInteractionHandler, true);
+      }
+    };
+  })();
+(function() {
+      'use strict';
+
+      Polymer({
+        is: 'iron-dropdown',
+
+        behaviors: [
+          Polymer.IronControlState,
+          Polymer.IronA11yKeysBehavior,
+          Polymer.IronOverlayBehavior,
+          Polymer.NeonAnimationRunnerBehavior
+        ],
+
+        properties: {
+          /**
+           * The orientation against which to align the dropdown content
+           * horizontally relative to the dropdown trigger.
+           */
+          horizontalAlign: {
+            type: String,
+            value: 'left',
+            reflectToAttribute: true
+          },
+
+          /**
+           * The orientation against which to align the dropdown content
+           * vertically relative to the dropdown trigger.
+           */
+          verticalAlign: {
+            type: String,
+            value: 'top',
+            reflectToAttribute: true
+          },
+
+          /**
+           * A pixel value that will be added to the position calculated for the
+           * given `horizontalAlign`. Use a negative value to offset to the
+           * left, or a positive value to offset to the right.
+           */
+          horizontalOffset: {
+            type: Number,
+            value: 0,
+            notify: true
+          },
+
+          /**
+           * A pixel value that will be added to the position calculated for the
+           * given `verticalAlign`. Use a negative value to offset towards the
+           * top, or a positive value to offset towards the bottom.
+           */
+          verticalOffset: {
+            type: Number,
+            value: 0,
+            notify: true
+          },
+
+          /**
+           * The element that should be used to position the dropdown when
+           * it is opened.
+           */
+          positionTarget: {
+            type: Object,
+            observer: '_positionTargetChanged'
+          },
+
+          /**
+           * An animation config. If provided, this will be used to animate the
+           * opening of the dropdown.
+           */
+          openAnimationConfig: {
+            type: Object
+          },
+
+          /**
+           * An animation config. If provided, this will be used to animate the
+           * closing of the dropdown.
+           */
+          closeAnimationConfig: {
+            type: Object
+          },
+
+          /**
+           * If provided, this will be the element that will be focused when
+           * the dropdown opens.
+           */
+          focusTarget: {
+            type: Object
+          },
+
+          /**
+           * Set to true to disable animations when opening and closing the
+           * dropdown.
+           */
+          noAnimations: {
+            type: Boolean,
+            value: false
+          },
+
+          /**
+           * By default, the dropdown will constrain scrolling on the page
+           * to itself when opened.
+           * Set to true in order to prevent scroll from being constrained
+           * to the dropdown when it opens.
+           */
+          allowOutsideScroll: {
+            type: Boolean,
+            value: false
+          },
+
+          /**
+           * We memoize the positionTarget bounding rectangle so that we can
+           * limit the number of times it is queried per resize / relayout.
+           * @type {?Object}
+           */
+          _positionRectMemo: {
+            type: Object
+          }
+        },
+
+        listeners: {
+          'neon-animation-finish': '_onNeonAnimationFinish'
+        },
+
+        observers: [
+          '_updateOverlayPosition(verticalAlign, horizontalAlign, verticalOffset, horizontalOffset)'
+        ],
+
+        attached: function() {
+          if (this.positionTarget === undefined) {
+            this.positionTarget = this._defaultPositionTarget;
+          }
+        },
+
+        /**
+         * The element that is contained by the dropdown, if any.
+         */
+        get containedElement() {
+          return Polymer.dom(this.$.content).getDistributedNodes()[0];
+        },
+
+        /**
+         * The element that should be focused when the dropdown opens.
+         */
+        get _focusTarget() {
+          return this.focusTarget || this.containedElement;
+        },
+
+        /**
+         * The element that should be used to position the dropdown when
+         * it opens, if no position target is configured.
+         */
+        get _defaultPositionTarget() {
+          var parent = Polymer.dom(this).parentNode;
+
+          if (parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
+            parent = parent.host;
+          }
+
+          return parent;
+        },
+
+        /**
+         * The bounding rect of the position target.
+         */
+        get _positionRect() {
+          if (!this._positionRectMemo && this.positionTarget) {
+            this._positionRectMemo = this.positionTarget.getBoundingClientRect();
+          }
+
+          return this._positionRectMemo;
+        },
+
+        /**
+         * The horizontal offset value used to position the dropdown.
+         */
+        get _horizontalAlignTargetValue() {
+          var target;
+
+          if (this.horizontalAlign === 'right') {
+            target = document.documentElement.clientWidth - this._positionRect.right;
+          } else {
+            target = this._positionRect.left;
+          }
+
+          target += this.horizontalOffset;
+
+          return Math.max(target, 0);
+        },
+
+        /**
+         * The vertical offset value used to position the dropdown.
+         */
+        get _verticalAlignTargetValue() {
+          var target;
+
+          if (this.verticalAlign === 'bottom') {
+            target = document.documentElement.clientHeight - this._positionRect.bottom;
+          } else {
+            target = this._positionRect.top;
+          }
+
+          target += this.verticalOffset;
+
+          return Math.max(target, 0);
+        },
+
+        /**
+         * Called when the value of `opened` changes.
+         *
+         * @param {boolean} opened True if the dropdown is opened.
+         */
+        _openedChanged: function(opened) {
+          if (opened && this.disabled) {
+            this.cancel();
+          } else {
+            this.cancelAnimation();
+            this._prepareDropdown();
+            Polymer.IronOverlayBehaviorImpl._openedChanged.apply(this, arguments);
+          }
+
+          if (this.opened) {
+            this._focusContent();
+          }
+        },
+
+        /**
+         * Overridden from `IronOverlayBehavior`.
+         */
+        _renderOpened: function() {
+          if (!this.allowOutsideScroll) {
+            Polymer.IronDropdownScrollManager.pushScrollLock(this);
+          }
+
+          if (!this.noAnimations && this.animationConfig && this.animationConfig.open) {
+            this.$.contentWrapper.classList.add('animating');
+            this.playAnimation('open');
+          } else {
+            Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this, arguments);
+          }
+        },
+
+        /**
+         * Overridden from `IronOverlayBehavior`.
+         */
+        _renderClosed: function() {
+          Polymer.IronDropdownScrollManager.removeScrollLock(this);
+          if (!this.noAnimations && this.animationConfig && this.animationConfig.close) {
+            this.$.contentWrapper.classList.add('animating');
+            this.playAnimation('close');
+          } else {
+            Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this, arguments);
+          }
+        },
+
+        /**
+         * Called when animation finishes on the dropdown (when opening or
+         * closing). Responsible for "completing" the process of opening or
+         * closing the dropdown by positioning it or setting its display to
+         * none.
+         */
+        _onNeonAnimationFinish: function() {
+          this.$.contentWrapper.classList.remove('animating');
+          if (this.opened) {
+            Polymer.IronOverlayBehaviorImpl._renderOpened.apply(this);
+          } else {
+            Polymer.IronOverlayBehaviorImpl._renderClosed.apply(this);
+          }
+        },
+
+        /**
+         * Called when an `iron-resize` event fires.
+         */
+        _onIronResize: function() {
+          var containedElement = this.containedElement;
+          var scrollTop;
+          var scrollLeft;
+
+          if (containedElement) {
+            scrollTop = containedElement.scrollTop;
+            scrollLeft = containedElement.scrollLeft;
+          }
+
+          if (this.opened) {
+            this._updateOverlayPosition();
+          }
+
+          Polymer.IronOverlayBehaviorImpl._onIronResize.apply(this, arguments);
+
+          if (containedElement) {
+            containedElement.scrollTop = scrollTop;
+            containedElement.scrollLeft = scrollLeft;
+          }
+        },
+
+        /**
+         * Called when the `positionTarget` property changes.
+         */
+        _positionTargetChanged: function() {
+          this._updateOverlayPosition();
+        },
+
+        /**
+         * Constructs the final animation config from different properties used
+         * to configure specific parts of the opening and closing animations.
+         */
+        _updateAnimationConfig: function() {
+          var animationConfig = {};
+          var animations = [];
+
+          if (this.openAnimationConfig) {
+            // NOTE(cdata): When making `display:none` elements visible in Safari,
+            // the element will paint once in a fully visible state, causing the
+            // dropdown to flash before it fades in. We prepend an
+            // `opaque-animation` to fix this problem:
+            animationConfig.open = [{
+              name: 'opaque-animation',
+            }].concat(this.openAnimationConfig);
+            animations = animations.concat(animationConfig.open);
+          }
+
+          if (this.closeAnimationConfig) {
+            animationConfig.close = this.closeAnimationConfig;
+            animations = animations.concat(animationConfig.close);
+          }
+
+          animations.forEach(function(animation) {
+            animation.node = this.containedElement;
+          }, this);
+
+          this.animationConfig = animationConfig;
+        },
+
+        /**
+         * Prepares the dropdown for opening by updating measured layout
+         * values.
+         */
+        _prepareDropdown: function() {
+          this.sizingTarget = this.containedElement || this.sizingTarget;
+          this._updateAnimationConfig();
+          this._updateOverlayPosition();
+        },
+
+        /**
+         * Updates the overlay position based on configured horizontal
+         * and vertical alignment, and re-memoizes these values for the sake
+         * of behavior in `IronFitBehavior`.
+         */
+        _updateOverlayPosition: function() {
+          this._positionRectMemo = null;
+
+          if (!this.positionTarget) {
+            return;
+          }
+
+          this.style[this.horizontalAlign] =
+            this._horizontalAlignTargetValue + 'px';
+
+          this.style[this.verticalAlign] =
+            this._verticalAlignTargetValue + 'px';
+
+          // NOTE(cdata): We re-memoize inline styles here, otherwise
+          // calling `refit` from `IronFitBehavior` will reset inline styles
+          // to whatever they were when the dropdown first opened.
+          if (this._fitInfo) {
+            this._fitInfo.inlineStyle[this.horizontalAlign] =
+              this.style[this.horizontalAlign];
+
+            this._fitInfo.inlineStyle[this.verticalAlign] =
+              this.style[this.verticalAlign];
+          }
+        },
+
+        /**
+         * Focuses the configured focus target.
+         */
+        _focusContent: function() {
+          // NOTE(cdata): This is async so that it can attempt the focus after
+          // `display: none` is removed from the element.
+          this.async(function() {
+            if (this._focusTarget) {
+              this._focusTarget.focus();
+            }
+          });
+        }
+      });
+    })();
+Polymer({
+
+    is: 'fade-in-animation',
+
+    behaviors: [
+      Polymer.NeonAnimationBehavior
+    ],
+
+    configure: function(config) {
+      var node = config.node;
+      this._effect = new KeyframeEffect(node, [
+        {'opacity': '0'},
+        {'opacity': '1'}
+      ], this.timingFromConfig(config));
+      return this._effect;
+    }
+
+  });
+Polymer({
+
+    is: 'fade-out-animation',
+
+    behaviors: [
+      Polymer.NeonAnimationBehavior
+    ],
+
+    configure: function(config) {
+      var node = config.node;
+      this._effect = new KeyframeEffect(node, [
+        {'opacity': '1'},
+        {'opacity': '0'}
+      ], this.timingFromConfig(config));
+      return this._effect;
+    }
+
+  });
+Polymer({
+    is: 'paper-menu-grow-height-animation',
+
+    behaviors: [
+      Polymer.NeonAnimationBehavior
+    ],
+
+    configure: function(config) {
+      var node = config.node;
+      var rect = node.getBoundingClientRect();
+      var height = rect.height;
+
+      this._effect = new KeyframeEffect(node, [{
+        height: (height / 2) + 'px'
+      }, {
+        height: height + 'px'
+      }], this.timingFromConfig(config));
+
+      return this._effect;
+    }
+  });
+
+  Polymer({
+    is: 'paper-menu-grow-width-animation',
+
+    behaviors: [
+      Polymer.NeonAnimationBehavior
+    ],
+
+    configure: function(config) {
+      var node = config.node;
+      var rect = node.getBoundingClientRect();
+      var width = rect.width;
+
+      this._effect = new KeyframeEffect(node, [{
+        width: (width / 2) + 'px'
+      }, {
+        width: width + 'px'
+      }], this.timingFromConfig(config));
+
+      return this._effect;
+    }
+  });
+
+  Polymer({
+    is: 'paper-menu-shrink-width-animation',
+
+    behaviors: [
+      Polymer.NeonAnimationBehavior
+    ],
+
+    configure: function(config) {
+      var node = config.node;
+      var rect = node.getBoundingClientRect();
+      var width = rect.width;
+
+      this._effect = new KeyframeEffect(node, [{
+        width: width + 'px'
+      }, {
+        width: width - (width / 20) + 'px'
+      }], this.timingFromConfig(config));
+
+      return this._effect;
+    }
+  });
+
+  Polymer({
+    is: 'paper-menu-shrink-height-animation',
+
+    behaviors: [
+      Polymer.NeonAnimationBehavior
+    ],
+
+    configure: function(config) {
+      var node = config.node;
+      var rect = node.getBoundingClientRect();
+      var height = rect.height;
+      var top = rect.top;
+
+      this.setPrefixedProperty(node, 'transformOrigin', '0 0');
+
+      this._effect = new KeyframeEffect(node, [{
+        height: height + 'px',
+        transform: 'translateY(0)'
+      }, {
+        height: height / 2 + 'px',
+        transform: 'translateY(-20px)'
+      }], this.timingFromConfig(config));
+
+      return this._effect;
+    }
+  });
+(function() {
+    'use strict';
+
+    var PaperMenuButton = Polymer({
+      is: 'paper-menu-button',
+
+      /**
+       * Fired when the dropdown opens.
+       *
+       * @event paper-dropdown-open
+       */
+
+      /**
+       * Fired when the dropdown closes.
+       *
+       * @event paper-dropdown-close
+       */
+
+      behaviors: [
+        Polymer.IronA11yKeysBehavior,
+        Polymer.IronControlState
+      ],
+
+      properties: {
+
+        /**
+         * True if the content is currently displayed.
+         */
+        opened: {
+          type: Boolean,
+          value: false,
+          notify: true,
+          observer: '_openedChanged'
+        },
+
+        /**
+         * The orientation against which to align the menu dropdown
+         * horizontally relative to the dropdown trigger.
+         */
+        horizontalAlign: {
+          type: String,
+          value: 'left',
+          reflectToAttribute: true
+        },
+
+        /**
+         * The orientation against which to align the menu dropdown
+         * vertically relative to the dropdown trigger.
+         */
+        verticalAlign: {
+          type: String,
+          value: 'top',
+          reflectToAttribute: true
+        },
+
+        /**
+         * A pixel value that will be added to the position calculated for the
+         * given `horizontalAlign`. Use a negative value to offset to the
+         * left, or a positive value to offset to the right.
+         */
+        horizontalOffset: {
+          type: Number,
+          value: 0,
+          notify: true
+        },
+
+        /**
+         * A pixel value that will be added to the position calculated for the
+         * given `verticalAlign`. Use a negative value to offset towards the
+         * top, or a positive value to offset towards the bottom.
+         */
+        verticalOffset: {
+          type: Number,
+          value: 0,
+          notify: true
+        },
+
+        /**
+         * Set to true to disable animations when opening and closing the
+         * dropdown.
+         */
+        noAnimations: {
+          type: Boolean,
+          value: false
+        },
+
+        /**
+         * Set to true to disable automatically closing the dropdown after
+         * a selection has been made.
+         */
+        ignoreSelect: {
+          type: Boolean,
+          value: false
+        },
+
+        /**
+         * An animation config. If provided, this will be used to animate the
+         * opening of the dropdown.
+         */
+        openAnimationConfig: {
+          type: Object,
+          value: function() {
+            return [{
+              name: 'fade-in-animation',
+              timing: {
+                delay: 100,
+                duration: 200
+              }
+            }, {
+              name: 'paper-menu-grow-width-animation',
+              timing: {
+                delay: 100,
+                duration: 150,
+                easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
+              }
+            }, {
+              name: 'paper-menu-grow-height-animation',
+              timing: {
+                delay: 100,
+                duration: 275,
+                easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
+              }
+            }];
+          }
+        },
+
+        /**
+         * An animation config. If provided, this will be used to animate the
+         * closing of the dropdown.
+         */
+        closeAnimationConfig: {
+          type: Object,
+          value: function() {
+            return [{
+              name: 'fade-out-animation',
+              timing: {
+                duration: 150
+              }
+            }, {
+              name: 'paper-menu-shrink-width-animation',
+              timing: {
+                delay: 100,
+                duration: 50,
+                easing: PaperMenuButton.ANIMATION_CUBIC_BEZIER
+              }
+            }, {
+              name: 'paper-menu-shrink-height-animation',
+              timing: {
+                duration: 200,
+                easing: 'ease-in'
+              }
+            }];
+          }
+        },
+
+        /**
+         * This is the element intended to be bound as the focus target
+         * for the `iron-dropdown` contained by `paper-menu-button`.
+         */
+        _dropdownContent: {
+          type: Object
+        }
+      },
+
+      hostAttributes: {
+        role: 'group',
+        'aria-haspopup': 'true'
+      },
+
+      listeners: {
+        'iron-select': '_onIronSelect'
+      },
+
+      /**
+       * The content element that is contained by the menu button, if any.
+       */
+      get contentElement() {
+        return Polymer.dom(this.$.content).getDistributedNodes()[0];
+      },
+
+      /**
+       * Make the dropdown content appear as an overlay positioned relative
+       * to the dropdown trigger.
+       */
+      open: function() {
+        if (this.disabled) {
+          return;
+        }
+
+        this.$.dropdown.open();
+      },
+
+      /**
+       * Hide the dropdown content.
+       */
+      close: function() {
+        this.$.dropdown.close();
+      },
+
+      /**
+       * When an `iron-select` event is received, the dropdown should
+       * automatically close on the assumption that a value has been chosen.
+       *
+       * @param {CustomEvent} event A CustomEvent instance with type
+       * set to `"iron-select"`.
+       */
+      _onIronSelect: function(event) {
+        if (!this.ignoreSelect) {
+          this.close();
+        }
+      },
+
+      /**
+       * When the dropdown opens, the `paper-menu-button` fires `paper-open`.
+       * When the dropdown closes, the `paper-menu-button` fires `paper-close`.
+       *
+       * @param {boolean} opened True if the dropdown is opened, otherwise false.
+       * @param {boolean} oldOpened The previous value of `opened`.
+       */
+      _openedChanged: function(opened, oldOpened) {
+        if (opened) {
+          // TODO(cdata): Update this when we can measure changes in distributed
+          // children in an idiomatic way.
+          // We poke this property in case the element has changed. This will
+          // cause the focus target for the `iron-dropdown` to be updated as
+          // necessary:
+          this._dropdownContent = this.contentElement;
+          this.fire('paper-dropdown-open');
+        } else if (oldOpened != null) {
+          this.fire('paper-dropdown-close');
+        }
+      },
+
+      /**
+       * If the dropdown is open when disabled becomes true, close the
+       * dropdown.
+       *
+       * @param {boolean} disabled True if disabled, otherwise false.
+       */
+      _disabledChanged: function(disabled) {
+        Polymer.IronControlState._disabledChanged.apply(this, arguments);
+        if (disabled && this.opened) {
+          this.close();
+        }
+      }
+    });
+
+    PaperMenuButton.ANIMATION_CUBIC_BEZIER = 'cubic-bezier(.3,.95,.5,1)';
+    PaperMenuButton.MAX_ANIMATION_TIME_MS = 400;
+
+    Polymer.PaperMenuButton = PaperMenuButton;
+  })();
+/**
+   * `Polymer.PaperInkyFocusBehavior` implements a ripple when the element has keyboard focus.
+   *
+   * @polymerBehavior Polymer.PaperInkyFocusBehavior
+   */
+  Polymer.PaperInkyFocusBehaviorImpl = {
+
+    observers: [
+      '_focusedChanged(receivedFocusFromKeyboard)'
+    ],
+
+    _focusedChanged: function(receivedFocusFromKeyboard) {
+      if (!this.$.ink) {
+        return;
+      }
+
+      this.$.ink.holdDown = receivedFocusFromKeyboard;
+    }
+
+  };
+
+  /** @polymerBehavior Polymer.PaperInkyFocusBehavior */
+  Polymer.PaperInkyFocusBehavior = [
+    Polymer.IronButtonState,
+    Polymer.IronControlState,
+    Polymer.PaperInkyFocusBehaviorImpl
+  ];
+Polymer({
+    is: 'paper-icon-button',
+
+    hostAttributes: {
+      role: 'button',
+      tabindex: '0'
+    },
+
+    behaviors: [
+      Polymer.PaperInkyFocusBehavior
+    ],
+
+    properties: {
+      /**
+       * The URL of an image for the icon. If the src property is specified,
+       * the icon property should not be.
+       */
+      src: {
+        type: String
+      },
+
+      /**
+       * Specifies the icon name or index in the set of icons available in
+       * the icon's icon set. If the icon property is specified,
+       * the src property should not be.
+       */
+      icon: {
+        type: String
+      },
+
+      /**
+       * Specifies the alternate text for the button, for accessibility.
+       */
+      alt: {
+        type: String,
+        observer: "_altChanged"
+      }
+    },
+
+    _altChanged: function(newValue, oldValue) {
+      var label = this.getAttribute('aria-label');
+
+      // Don't stomp over a user-set aria-label.
+      if (!label || oldValue == label) {
+        this.setAttribute('aria-label', newValue);
+      }
+    }
+  });
+/**
+   * Use `Polymer.IronValidatableBehavior` to implement an element that validates user input.
+   *
+   * ### Accessibility
+   *
+   * Changing the `invalid` property, either manually or by calling `validate()` will update the
+   * `aria-invalid` attribute.
+   *
+   * @demo demo/index.html
+   * @polymerBehavior
+   */
+  Polymer.IronValidatableBehavior = {
+
+    properties: {
+
+      /**
+       * Namespace for this validator.
+       */
+      validatorType: {
+        type: String,
+        value: 'validator'
+      },
+
+      /**
+       * Name of the validator to use.
+       */
+      validator: {
+        type: String
+      },
+
+      /**
+       * True if the last call to `validate` is invalid.
+       */
+      invalid: {
+        notify: true,
+        reflectToAttribute: true,
+        type: Boolean,
+        value: false
+      },
+
+      _validatorMeta: {
+        type: Object
+      }
+
+    },
+
+    observers: [
+      '_invalidChanged(invalid)'
+    ],
+
+    get _validator() {
+      return this._validatorMeta && this._validatorMeta.byKey(this.validator);
+    },
+
+    ready: function() {
+      this._validatorMeta = new Polymer.IronMeta({type: this.validatorType});
+    },
+
+    _invalidChanged: function() {
+      if (this.invalid) {
+        this.setAttribute('aria-invalid', 'true');
+      } else {
+        this.removeAttribute('aria-invalid');
+      }
+    },
+
+    /**
+     * @return {boolean} True if the validator `validator` exists.
+     */
+    hasValidator: function() {
+      return this._validator != null;
+    },
+
+    /**
+     * Returns true if the `value` is valid, and updates `invalid`. If you want
+     * your element to have custom validation logic, do not override this method;
+     * override `_getValidity(value)` instead.
+
+     * @param {Object} value The value to be validated. By default, it is passed
+     * to the validator's `validate()` function, if a validator is set.
+     * @return {boolean} True if `value` is valid.
+     */
+    validate: function(value) {
+      this.invalid = !this._getValidity(value);
+      return !this.invalid;
+    },
+
+    /**
+     * Returns true if `value` is valid.  By default, it is passed
+     * to the validator's `validate()` function, if a validator is set. You
+     * should override this method if you want to implement custom validity
+     * logic for your element.
+     *
+     * @param {Object} value The value to be validated.
+     * @return {boolean} True if `value` is valid.
+     */
+
+    _getValidity: function(value) {
+      if (this.hasValidator()) {
+        return this._validator.validate(value);
+      }
+      return true;
+    }
+  };
+/*
+`<iron-input>` adds two-way binding and custom validators using `Polymer.IronValidatorBehavior`
+to `<input>`.
+
+### Two-way binding
+
+By default you can only get notified of changes to an `input`'s `value` due to user input:
+
+    <input value="{{myValue::input}}">
+
+`iron-input` adds the `bind-value` property that mirrors the `value` property, and can be used
+for two-way data binding. `bind-value` will notify if it is changed either by user input or by script.
+
+    <input is="iron-input" bind-value="{{myValue}}">
+
+### Custom validators
+
+You can use custom validators that implement `Polymer.IronValidatorBehavior` with `<iron-input>`.
+
+    <input is="iron-input" validator="my-custom-validator">
+
+### Stopping invalid input
+
+It may be desirable to only allow users to enter certain characters. You can use the
+`prevent-invalid-input` and `allowed-pattern` attributes together to accomplish this. This feature
+is separate from validation, and `allowed-pattern` does not affect how the input is validated.
+
+    <!-- only allow characters that match [0-9] -->
+    <input is="iron-input" prevent-invalid-input allowed-pattern="[0-9]">
+
+@hero hero.svg
+@demo demo/index.html
+*/
+
+  Polymer({
+
+    is: 'iron-input',
+
+    extends: 'input',
+
+    behaviors: [
+      Polymer.IronValidatableBehavior
+    ],
+
+    properties: {
+
+      /**
+       * Use this property instead of `value` for two-way data binding.
+       */
+      bindValue: {
+        observer: '_bindValueChanged',
+        type: String
+      },
+
+      /**
+       * Set to true to prevent the user from entering invalid input. The new input characters are
+       * matched with `allowedPattern` if it is set, otherwise it will use the `pattern` attribute if
+       * set, or the `type` attribute (only supported for `type=number`).
+       */
+      preventInvalidInput: {
+        type: Boolean
+      },
+
+      /**
+       * Regular expression to match valid input characters.
+       */
+      allowedPattern: {
+        type: String
+      },
+
+      _previousValidInput: {
+        type: String,
+        value: ''
+      },
+
+      _patternAlreadyChecked: {
+        type: Boolean,
+        value: false
+      }
+
+    },
+
+    listeners: {
+      'input': '_onInput',
+      'keypress': '_onKeypress'
+    },
+
+    get _patternRegExp() {
+      var pattern;
+      if (this.allowedPattern) {
+        pattern = new RegExp(this.allowedPattern);
+      } else if (this.pattern) {
+        pattern = new RegExp(this.pattern);
+      } else {
+        switch (this.type) {
+          case 'number':
+            pattern = /[0-9.,e-]/;
+            break;
+        }
+      }
+      return pattern;
+    },
+
+    ready: function() {
+      this.bindValue = this.value;
+    },
+
+    /**
+     * @suppress {checkTypes}
+     */
+    _bindValueChanged: function() {
+      if (this.value !== this.bindValue) {
+        this.value = !(this.bindValue || this.bindValue === 0) ? '' : this.bindValue;
+      }
+      // manually notify because we don't want to notify until after setting value
+      this.fire('bind-value-changed', {value: this.bindValue});
+    },
+
+    _onInput: function() {
+      // Need to validate each of the characters pasted if they haven't
+      // been validated inside `_onKeypress` already.
+      if (this.preventInvalidInput && !this._patternAlreadyChecked) {
+        var valid = this._checkPatternValidity();
+        if (!valid) {
+          this.value = this._previousValidInput;
+        }
+      }
+
+      this.bindValue = this.value;
+      this._previousValidInput = this.value;
+      this._patternAlreadyChecked = false;
+    },
+
+    _isPrintable: function(event) {
+      // What a control/printable character is varies wildly based on the browser.
+      // - most control characters (arrows, backspace) do not send a `keypress` event
+      //   in Chrome, but the *do* on Firefox
+      // - in Firefox, when they do send a `keypress` event, control chars have
+      //   a charCode = 0, keyCode = xx (for ex. 40 for down arrow)
+      // - printable characters always send a keypress event.
+      // - in Firefox, printable chars always have a keyCode = 0. In Chrome, the keyCode
+      //   always matches the charCode.
+      // None of this makes any sense.
+
+      // For these keys, ASCII code == browser keycode.
+      var anyNonPrintable =
+        (event.keyCode == 8)   ||  // backspace
+        (event.keyCode == 9)   ||  // tab
+        (event.keyCode == 13)  ||  // enter
+        (event.keyCode == 27);     // escape
+
+      // For these keys, make sure it's a browser keycode and not an ASCII code.
+      var mozNonPrintable =
+        (event.keyCode == 19)  ||  // pause
+        (event.keyCode == 20)  ||  // caps lock
+        (event.keyCode == 45)  ||  // insert
+        (event.keyCode == 46)  ||  // delete
+        (event.keyCode == 144) ||  // num lock
+        (event.keyCode == 145) ||  // scroll lock
+        (event.keyCode > 32 && event.keyCode < 41)   || // page up/down, end, home, arrows
+        (event.keyCode > 111 && event.keyCode < 124); // fn keys
+
+      return !anyNonPrintable && !(event.charCode == 0 && mozNonPrintable);
+    },
+
+    _onKeypress: function(event) {
+      if (!this.preventInvalidInput && this.type !== 'number') {
+        return;
+      }
+      var regexp = this._patternRegExp;
+      if (!regexp) {
+        return;
+      }
+
+      // Handle special keys and backspace
+      if (event.metaKey || event.ctrlKey || event.altKey)
+        return;
+
+      // Check the pattern either here or in `_onInput`, but not in both.
+      this._patternAlreadyChecked = true;
+
+      var thisChar = String.fromCharCode(event.charCode);
+      if (this._isPrintable(event) && !regexp.test(thisChar)) {
+        event.preventDefault();
+      }
+    },
+
+    _checkPatternValidity: function() {
+      var regexp = this._patternRegExp;
+      if (!regexp) {
+        return true;
+      }
+      for (var i = 0; i < this.value.length; i++) {
+        if (!regexp.test(this.value[i])) {
+          return false;
+        }
+      }
+      return true;
+    },
+
+    /**
+     * Returns true if `value` is valid. The validator provided in `validator` will be used first,
+     * then any constraints.
+     * @return {boolean} True if the value is valid.
+     */
+    validate: function() {
+      // Empty, non-required input is valid.
+      if (!this.required && this.value == '') {
+        this.invalid = false;
+        return true;
+      }
+
+      var valid;
+      if (this.hasValidator()) {
+        valid = Polymer.IronValidatableBehavior.validate.call(this, this.value);
+      } else {
+        this.invalid = !this.validity.valid;
+        valid = this.validity.valid;
+      }
+      this.fire('iron-input-validate');
+      return valid;
+    }
+
+  });
+
+  /*
+  The `iron-input-validate` event is fired whenever `validate()` is called.
+  @event iron-input-validate
+  */
+Polymer({
+    is: 'paper-input-container',
+
+    properties: {
+      /**
+       * Set to true to disable the floating label. The label disappears when the input value is
+       * not null.
+       */
+      noLabelFloat: {
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * Set to true to always float the floating label.
+       */
+      alwaysFloatLabel: {
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * The attribute to listen for value changes on.
+       */
+      attrForValue: {
+        type: String,
+        value: 'bind-value'
+      },
+
+      /**
+       * Set to true to auto-validate the input value when it changes.
+       */
+      autoValidate: {
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * True if the input is invalid. This property is set automatically when the input value
+       * changes if auto-validating, or when the `iron-input-validate` event is heard from a child.
+       */
+      invalid: {
+        observer: '_invalidChanged',
+        type: Boolean,
+        value: false
+      },
+
+      /**
+       * True if the input has focus.
+       */
+      focused: {
+        readOnly: true,
+        type: Boolean,
+        value: false,
+        notify: true
+      },
+
+      _addons: {
+        type: Array
+        // do not set a default value here intentionally - it will be initialized lazily when a
+        // distributed child is attached, which may occur before configuration for this element
+        // in polyfill.
+      },
+
+      _inputHasContent: {
+        type: Boolean,
+        value: false
+      },
+
+      _inputSelector: {
+        type: String,
+        value: 'input,textarea,.paper-input-input'
+      },
+
+      _boundOnFocus: {
+        type: Function,
+        value: function() {
+          return this._onFocus.bind(this);
+        }
+      },
+
+      _boundOnBlur: {
+        type: Function,
+        value: function() {
+          return this._onBlur.bind(this);
+        }
+      },
+
+      _boundOnInput: {
+        type: Function,
+        value: function() {
+          return this._onInput.bind(this);
+        }
+      },
+
+      _boundValueChanged: {
+        type: Function,
+        value: function() {
+          return this._onValueChanged.bind(this);
+        }
+      }
+    },
+
+    listeners: {
+      'addon-attached': '_onAddonAttached',
+      'iron-input-validate': '_onIronInputValidate'
+    },
+
+    get _valueChangedEvent() {
+      return this.attrForValue + '-changed';
+    },
+
+    get _propertyForValue() {
+      return Polymer.CaseMap.dashToCamelCase(this.attrForValue);
+    },
+
+    get _inputElement() {
+      return Polymer.dom(this).querySelector(this._inputSelector);
+    },
+
+    get _inputElementValue() {
+      return this._inputElement[this._propertyForValue] || this._inputElement.value;
+    },
+
+    ready: function() {
+      if (!this._addons) {
+        this._addons = [];
+      }
+      this.addEventListener('focus', this._boundOnFocus, true);
+      this.addEventListener('blur', this._boundOnBlur, true);
+      if (this.attrForValue) {
+        this._inputElement.addEventListener(this._valueChangedEvent, this._boundValueChanged);
+      } else {
+        this.addEventListener('input', this._onInput);
+      }
+    },
+
+    attached: function() {
+      // Only validate when attached if the input already has a value.
+      if (this._inputElementValue != '') {
+        this._handleValueAndAutoValidate(this._inputElement);
+      } else {
+        this._handleValue(this._inputElement);
+      }
+    },
+
+    _onAddonAttached: function(event) {
+      if (!this._addons) {
+        this._addons = [];
+      }
+      var target = event.target;
+      if (this._addons.indexOf(target) === -1) {
+        this._addons.push(target);
+        if (this.isAttached) {
+          this._handleValue(this._inputElement);
+        }
+      }
+    },
+
+    _onFocus: function() {
+      this._setFocused(true);
+    },
+
+    _onBlur: function() {
+      this._setFocused(false);
+      this._handleValueAndAutoValidate(this._inputElement);
+    },
+
+    _onInput: function(event) {
+      this._handleValueAndAutoValidate(event.target);
+    },
+
+    _onValueChanged: function(event) {
+      this._handleValueAndAutoValidate(event.target);
+    },
+
+    _handleValue: function(inputElement) {
+      var value = this._inputElementValue;
+
+      // type="number" hack needed because this.value is empty until it's valid
+      if (value || value === 0 || (inputElement.type === 'number' && !inputElement.checkValidity())) {
+        this._inputHasContent = true;
+      } else {
+        this._inputHasContent = false;
+      }
+
+      this.updateAddons({
+        inputElement: inputElement,
+        value: value,
+        invalid: this.invalid
+      });
+    },
+
+    _handleValueAndAutoValidate: function(inputElement) {
+      if (this.autoValidate) {
+        var valid;
+        if (inputElement.validate) {
+          valid = inputElement.validate(this._inputElementValue);
+        } else {
+          valid = inputElement.checkValidity();
+        }
+        this.invalid = !valid;
+      }
+
+      // Call this last to notify the add-ons.
+      this._handleValue(inputElement);
+    },
+
+    _onIronInputValidate: function(event) {
+      this.invalid = this._inputElement.invalid;
+    },
+
+    _invalidChanged: function() {
+      if (this._addons) {
+        this.updateAddons({invalid: this.invalid});
+      }
+    },
+
+    /**
+     * Call this to update the state of add-ons.
+     * @param {Object} state Add-on state.
+     */
+    updateAddons: function(state) {
+      for (var addon, index = 0; addon = this._addons[index]; index++) {
+        addon.update(state);
+      }
+    },
+
+    _computeInputContentClass: function(noLabelFloat, alwaysFloatLabel, focused, invalid, _inputHasContent) {
+      var cls = 'input-content';
+      if (!noLabelFloat) {
+        var label = this.querySelector('label');
+
+        if (alwaysFloatLabel || _inputHasContent) {
+          cls += ' label-is-floating';
+          if (invalid) {
+            cls += ' is-invalid';
+          } else if (focused) {
+            cls += " label-is-highlighted";
+          }
+          // The label might have a horizontal offset if a prefix element exists
+          // which needs to be undone when displayed as a floating label.
+          if (Polymer.dom(this.$.prefix).getDistributedNodes().length > 0 &&
+              label && label.offsetParent) {
+            label.style.left = -label.offsetParent.offsetLeft + 'px';
+          }
+        } else {
+          // When the label is not floating, it should overlap the input element.
+          if (label) {
+            label.style.left = 0;
+          }
+        }
+      } else {
+        if (_inputHasContent) {
+          cls += ' label-is-hidden';
+        }
+      }
+      return cls;
+    },
+
+    _computeUnderlineClass: function(focused, invalid) {
+      var cls = 'underline';
+      if (invalid) {
+        cls += ' is-invalid';
+      } else if (focused) {
+        cls += ' is-highlighted'
+      }
+      return cls;
+    },
+
+    _computeAddOnContentClass: function(focused, invalid) {
+      var cls = 'add-on-content';
+      if (invalid) {
+        cls += ' is-invalid';
+      } else if (focused) {
+        cls += ' is-highlighted'
+      }
+      return cls;
+    }
+  });
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/** @interface */
+var SearchFieldDelegate = function() {};
+
+SearchFieldDelegate.prototype = {
+  /**
+   * @param {string} value
+   */
+  onSearchTermSearch: assertNotReached,
+};
+
+var SearchField = Polymer({
+  is: 'cr-search-field',
+
+  properties: {
+    label: {
+      type: String,
+      value: '',
+    },
+
+    clearLabel: {
+      type: String,
+      value: '',
+    },
+
+    showingSearch_: {
+      type: Boolean,
+      value: false,
+    },
+  },
+
+  /** @param {SearchFieldDelegate} delegate */
+  setDelegate: function(delegate) {
+    this.delegate_ = delegate;
+  },
+
+  /**
+   * Returns the value of the search field.
+   * @return {string}
+   */
+  getValue: function() {
+    var searchInput = this.$$('#search-input');
+    return searchInput ? searchInput.value : '';
+  },
+
+  /** @private */
+  onSearchTermSearch_: function() {
+    if (this.delegate_)
+      this.delegate_.onSearchTermSearch(this.getValue());
+  },
+
+  /** @private */
+  onSearchTermKeydown_: function(e) {
+    assert(this.showingSearch_);
+    if (e.keyIdentifier == 'U+001B')  // Escape.
+      this.toggleShowingSearch_();
+  },
+
+  /** @private */
+  toggleShowingSearch_: function() {
+    this.showingSearch_ = !this.showingSearch_;
+    this.async(function() {
+      var searchInput = this.$$('#search-input');
+      if (this.showingSearch_) {
+        searchInput.focus();
+      } else {
+        searchInput.value = '';
+        this.onSearchTermSearch_();
+      }
+    });
+  },
+});
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('downloads', function() {
+  var Toolbar = Polymer({
+    is: 'downloads-toolbar',
+
+    attached: function() {
+      /** @private {!SearchFieldDelegate} */
+      this.searchFieldDelegate_ = new ToolbarSearchFieldDelegate(this);
+      this.$['search-input'].setDelegate(this.searchFieldDelegate_);
+    },
+
+    properties: {
+      downloadsShowing: {
+        reflectToAttribute: true,
+        type: Boolean,
+        value: false,
+        observer: 'onDownloadsShowingChange_',
+      },
+    },
+
+    /** @return {boolean} Whether removal can be undone. */
+    canUndo: function() {
+      return this.$['search-input'] != this.shadowRoot.activeElement;
+    },
+
+    /** @return {boolean} Whether "Clear all" should be allowed. */
+    canClearAll: function() {
+      return !this.$['search-input'].getValue() && this.downloadsShowing;
+    },
+
+    /** @private */
+    onClearAllClick_: function() {
+      assert(this.canClearAll());
+      downloads.ActionService.getInstance().clearAll();
+    },
+
+    /** @private */
+    onDownloadsShowingChange_: function() {
+      this.updateClearAll_();
+    },
+
+    /** @param {string} searchTerm */
+    onSearchTermSearch: function(searchTerm) {
+      downloads.ActionService.getInstance().search(searchTerm);
+      this.updateClearAll_();
+    },
+
+    /** @private */
+    onOpenDownloadsFolderClick_: function() {
+      downloads.ActionService.getInstance().openDownloadsFolder();
+    },
+
+    /** @private */
+    updateClearAll_: function() {
+      this.$$('#actions .clear-all').hidden = !this.canClearAll();
+      this.$$('paper-menu .clear-all').hidden = !this.canClearAll();
+    },
+  });
+
+  /**
+   * @constructor
+   * @implements {SearchFieldDelegate}
+   */
+  // TODO(devlin): This is a bit excessive, and it would be better to just have
+  // Toolbar implement SearchFieldDelegate. But for now, we don't know how to
+  // make that happen with closure compiler.
+  function ToolbarSearchFieldDelegate(toolbar) {
+    this.toolbar_ = toolbar;
+  }
+
+  ToolbarSearchFieldDelegate.prototype = {
+    /** @override */
+    onSearchTermSearch: function(searchTerm) {
+      this.toolbar_.onSearchTermSearch(searchTerm);
+    }
+  };
+
+  return {Toolbar: Toolbar};
+});
+
+// TODO(dbeam): https://github.com/PolymerElements/iron-dropdown/pull/16/files
+/** @suppress {checkTypes} */
+(function() {
+Polymer.IronDropdownScrollManager.pushScrollLock = function() {};
+})();
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('downloads', function() {
+  var Manager = Polymer({
+    is: 'downloads-manager',
+
+    properties: {
+      hasDownloads_: {
+        type: Boolean,
+        value: false,
+      },
+    },
+
+    /**
+     * @return {number} A guess at how many items could be visible at once.
+     * @private
+     */
+    guesstimateNumberOfVisibleItems_: function() {
+      var toolbarHeight = this.$.toolbar.offsetHeight;
+      return Math.floor((window.innerHeight - toolbarHeight) / 46) + 1;
+    },
+
+    /**
+     * @param {Event} e
+     * @private
+     */
+    onCanExecute_: function(e) {
+      e = /** @type {cr.ui.CanExecuteEvent} */(e);
+      switch (e.command.id) {
+        case 'undo-command':
+          e.canExecute = this.$.toolbar.canUndo();
+          break;
+        case 'clear-all-command':
+          e.canExecute = this.$.toolbar.canClearAll();
+          break;
+      }
+    },
+
+    /**
+     * @param {Event} e
+     * @private
+     */
+    onCommand_: function(e) {
+      if (e.command.id == 'clear-all-command')
+        downloads.ActionService.getInstance().clearAll();
+      else if (e.command.id == 'undo-command')
+        downloads.ActionService.getInstance().undo();
+    },
+
+    /** @private */
+    onLoad_: function() {
+      cr.ui.decorate('command', cr.ui.Command);
+      document.addEventListener('canExecute', this.onCanExecute_.bind(this));
+      document.addEventListener('command', this.onCommand_.bind(this));
+
+      // Shows all downloads.
+      downloads.ActionService.getInstance().search('');
+    },
+
+    /** @private */
+    rebuildFocusGrid_: function() {
+      var activeElement = this.shadowRoot.activeElement;
+
+      var activeItem;
+      if (activeElement && activeElement.tagName == 'downloads-item')
+        activeItem = activeElement;
+
+      var activeControl = activeItem && activeItem.shadowRoot.activeElement;
+
+      /** @private {!cr.ui.FocusGrid} */
+      this.focusGrid_ = this.focusGrid_ || new cr.ui.FocusGrid;
+      this.focusGrid_.destroy();
+
+      var boundary = this.$['downloads-list'];
+
+      this.items_.forEach(function(item) {
+        var focusRow = new downloads.FocusRow(item.content, boundary);
+        this.focusGrid_.addRow(focusRow);
+
+        if (item == activeItem && !cr.ui.FocusRow.isFocusable(activeControl))
+          focusRow.getEquivalentElement(activeControl).focus();
+      }, this);
+
+      this.focusGrid_.ensureRowActive();
+    },
+
+    /**
+     * @return {number} The number of downloads shown on the page.
+     * @private
+     */
+    size_: function() {
+      return this.items_.length;
+    },
+
+    /**
+     * Called when all items need to be updated.
+     * @param {!Array<!downloads.Data>} list A list of new download data.
+     * @private
+     */
+    updateAll_: function(list) {
+      var oldIdMap = this.idMap_ || {};
+
+      /** @private {!Object<!downloads.Item>} */
+      this.idMap_ = {};
+
+      /** @private {!Array<!downloads.Item>} */
+      this.items_ = [];
+
+      if (!this.iconLoader_) {
+        var guesstimate = Math.max(this.guesstimateNumberOfVisibleItems_(), 1);
+        /** @private {downloads.ThrottledIconLoader} */
+        this.iconLoader_ = new downloads.ThrottledIconLoader(guesstimate);
+      }
+
+      for (var i = 0; i < list.length; ++i) {
+        var data = list[i];
+        var id = data.id;
+
+        // Re-use old items when possible (saves work, preserves focus).
+        var item = oldIdMap[id] || new downloads.Item(this.iconLoader_);
+
+        this.idMap_[id] = item;  // Associated by ID for fast lookup.
+        this.items_.push(item);  // Add to sorted list for order.
+
+        // Render |item| but don't actually add to the DOM yet. |this.items_|
+        // must be fully created to be able to find the right spot to insert.
+        item.update(data);
+
+        // Collapse redundant dates.
+        var prev = list[i - 1];
+        item.hideDate = !!prev && prev.date_string == data.date_string;
+
+        delete oldIdMap[id];
+      }
+
+      // Remove stale, previously rendered items from the DOM.
+      for (var id in oldIdMap) {
+        if (oldIdMap[id].parentNode)
+          oldIdMap[id].parentNode.removeChild(oldIdMap[id]);
+        delete oldIdMap[id];
+      }
+
+      for (var i = 0; i < this.items_.length; ++i) {
+        var item = this.items_[i];
+        if (item.parentNode)  // Already in the DOM; skip.
+          continue;
+
+        var before = null;
+        // Find the next rendered item after this one, and insert before it.
+        for (var j = i + 1; !before && j < this.items_.length; ++j) {
+          if (this.items_[j].parentNode)
+            before = this.items_[j];
+        }
+        // If |before| is null, |item| will just get added at the end.
+        this.$['downloads-list'].insertBefore(item, before);
+      }
+
+      var hasDownloads = this.size_() > 0;
+      if (!hasDownloads) {
+        var isSearching = downloads.ActionService.getInstance().isSearching();
+        var messageToShow = isSearching ? 'noSearchResults' : 'noDownloads';
+        this.$['no-downloads'].querySelector('span').textContent =
+            loadTimeData.getString(messageToShow);
+      }
+      this.hasDownloads_ = hasDownloads;
+
+      if (loadTimeData.getBoolean('allowDeletingHistory'))
+        this.$.toolbar.downloadsShowing = this.hasDownloads_;
+
+      this.$.panel.classList.remove('loading');
+
+      var allReady = this.items_.map(function(i) { return i.readyPromise; });
+      Promise.all(allReady).then(this.rebuildFocusGrid_.bind(this));
+    },
+
+    /**
+     * @param {!downloads.Data} data
+     * @private
+     */
+    updateItem_: function(data) {
+      var item = this.idMap_[data.id];
+
+      var activeControl = this.shadowRoot.activeElement == item ?
+          item.shadowRoot.activeElement : null;
+
+      item.update(data);
+
+      this.async(function() {
+        if (activeControl && !cr.ui.FocusRow.isFocusable(activeControl)) {
+          var focusRow = this.focusGrid_.getRowForRoot(item.content);
+          focusRow.getEquivalentElement(activeControl).focus();
+        }
+      }.bind(this));
+    },
+  });
+
+  Manager.size = function() {
+    return document.querySelector('downloads-manager').size_();
+  };
+
+  Manager.updateAll = function(list) {
+    document.querySelector('downloads-manager').updateAll_(list);
+  };
+
+  Manager.updateItem = function(item) {
+    document.querySelector('downloads-manager').updateItem_(item);
+  };
+
+  Manager.onLoad = function() {
+    document.querySelector('downloads-manager').onLoad_();
+  };
+
+  return {Manager: Manager};
+});
+
+window.addEventListener('load', downloads.Manager.onLoad);
\ No newline at end of file
diff --git a/chrome/browser/resources/md_downloads/item.css b/chrome/browser/resources/md_downloads/item.css
index 5d0e863..3c5b17d 100644
--- a/chrome/browser/resources/md_downloads/item.css
+++ b/chrome/browser/resources/md_downloads/item.css
@@ -23,6 +23,7 @@
   flex: none;
   margin: 0 auto;
   min-height: 103px;
+  position: relative;
   width: var(--downloads-item-width);
 }
 
@@ -78,7 +79,7 @@
 }
 
 #warning {
-  -webkit-mask-image: url(../../../../ui/webui/resources/images/warning.svg);
+  -webkit-mask-image: url(chrome://resources/images/warning.svg);
   -webkit-mask-repeat: no-repeat;
   -webkit-mask-size: 100%;
   background: rgb(255, 193, 7);
@@ -193,8 +194,9 @@
 
 #incognito {
   bottom: 20px;
-  content: -webkit-image-set(url(1x/incognito_marker.png) 1x,
-                             url(2x/incognito_marker.png) 2x);
+  content: -webkit-image-set(
+      url(chrome://downloads/1x/incognito_marker.png) 1x,
+      url(chrome://downloads/2x/incognito_marker.png) 2x);
   position: absolute;
   right: 10px;
 }
diff --git a/chrome/browser/resources/md_downloads/item.html b/chrome/browser/resources/md_downloads/item.html
index f051cfd..1d6dfa3 100644
--- a/chrome/browser/resources/md_downloads/item.html
+++ b/chrome/browser/resources/md_downloads/item.html
@@ -12,7 +12,7 @@
 <dom-module id="downloads-item">
   <template>
     <template is="dom-if" if="[[!hideDate]]">
-      <h3 id="date">[[computeDate_(data_.since_string, data_.date_string)]]</h3>
+      <h3 id="date">[[computeDate_(data.since_string, data.date_string)]]</h3>
     </template>
 
     <div id="content" on-dragstart="onDragStart_"
@@ -25,29 +25,29 @@
       <div id="details">
         <div id="title-area"><!--
           Can't have any line breaks.
-          --><a is="action-link" id="file-link" href="[[data_.url]]"
+          --><a is="action-link" id="file-link" href="[[data.url]]"
               on-click="onFileLinkClick_"
-              hidden="[[!completelyOnDisk_]]">[[data_.file_name]]</a><!--
+              hidden="[[!completelyOnDisk_]]">[[data.file_name]]</a><!--
           Before #name.
           --><span id="name"
-              hidden="[[completelyOnDisk_]]">[[data_.file_name]]</span>
-          <span id="tag">[[computeTag_(data_.state, data_.last_reason_text, data_.file_externally_removed)]]</span>
+              hidden="[[completelyOnDisk_]]">[[data.file_name]]</span>
+          <span id="tag">[[computeTag_(data.state, data.last_reason_text, data.file_externally_removed)]]</span>
         </div>
 
-        <a id="url" target="_blank" href="[[data_.url]]">[[data_.url]]</a>
+        <a id="url" target="_blank" href="[[data.url]]">[[data.url]]</a>
 
-        <div id="description">[[computeDescription_(data_.state, data_.danger_type, data_.file_name, data_.progress_status_text)]]</div>
+        <div id="description">[[computeDescription_(data.state, data.danger_type, data.file_name, data.progress_status_text)]]</div>
 
         <template is="dom-if" if="[[showProgress_]]">
           <paper-progress id="progress"
-              indeterminate="[[isIndeterminate_(data_.percent)]]"
-              value="[[data_.percent]]"></paper-progress>
+              indeterminate="[[isIndeterminate_(data.percent)]]"
+              value="[[data.percent]]"></paper-progress>
         </template>
 
         <div id="safe" class="controls" hidden="[[isDangerous_]]">
           <a is="action-link" id="show" i18n-content="controlShowInFolder"
               on-click="onShowClick_" hidden="[[!completelyOnDisk_]]"></a>
-          <template is="dom-if" if="[[data_.retry]]">
+          <template is="dom-if" if="[[data.retry]]">
             <paper-button id="retry"
                 on-click="onRetryClick_">[[i18n_.retry]]</paper-button>
           </template>
@@ -55,7 +55,7 @@
             <paper-button id="pause"
                 on-click="onPauseClick_">[[i18n_.pause]]</paper-button>
           </template>
-          <template is="dom-if" if="[[data_.resume]]">
+          <template is="dom-if" if="[[data.resume]]">
             <paper-button id="resume"
                 on-click="onResumeClick_">[[i18n_.resume]]</paper-button>
           </template>
@@ -95,7 +95,7 @@
       </div>
 
       <div id="incognito" i18n-values="title:inIncognito"
-          hidden="[[!data_.otr]]"></div>
+          hidden="[[!data.otr]]"></div>
     </div>
 
   </template>
diff --git a/chrome/browser/resources/md_downloads/item.js b/chrome/browser/resources/md_downloads/item.js
index 6871a7e..a750e61 100644
--- a/chrome/browser/resources/md_downloads/item.js
+++ b/chrome/browser/resources/md_downloads/item.js
@@ -15,6 +15,10 @@
     },
 
     properties: {
+      data: {
+        type: Object,
+      },
+
       hideDate: {
         type: Boolean,
         value: true,
@@ -31,13 +35,13 @@
 
       completelyOnDisk_: {
         computed: 'computeCompletelyOnDisk_(' +
-            'data_.state, data_.file_externally_removed)',
+            'data.state, data.file_externally_removed)',
         type: Boolean,
         value: true,
       },
 
       controlledBy_: {
-        computed: 'computeControlledBy_(data_.by_ext_id, data_.by_ext_name)',
+        computed: 'computeControlledBy_(data.by_ext_id, data.by_ext_name)',
         type: String,
         value: '',
       },
@@ -61,49 +65,45 @@
 
       isActive_: {
         computed: 'computeIsActive_(' +
-            'data_.state, data_.file_externally_removed)',
+            'data.state, data.file_externally_removed)',
         type: Boolean,
         value: true,
       },
 
       isDangerous_: {
-        computed: 'computeIsDangerous_(data_.state)',
+        computed: 'computeIsDangerous_(data.state)',
         type: Boolean,
         value: false,
       },
 
       isInProgress_: {
-        computed: 'computeIsInProgress_(data_.state)',
+        computed: 'computeIsInProgress_(data.state)',
         type: Boolean,
         value: false,
       },
 
       showCancel_: {
-        computed: 'computeShowCancel_(data_.state)',
+        computed: 'computeShowCancel_(data.state)',
         type: Boolean,
         value: false,
       },
 
       showProgress_: {
-        computed: 'computeShowProgress_(showCancel_, data_.percent)',
+        computed: 'computeShowProgress_(showCancel_, data.percent)',
         type: Boolean,
         value: false,
       },
 
       isMalware_: {
-        computed: 'computeIsMalware_(isDangerous_, data_.danger_type)',
+        computed: 'computeIsMalware_(isDangerous_, data.danger_type)',
         type: Boolean,
         value: false,
       },
-
-      data_: {
-        type: Object,
-      },
     },
 
     observers: [
-      // TODO(dbeam): this gets called way more when I observe data_.by_ext_id
-      // and data_.by_ext_name directly. Why?
+      // TODO(dbeam): this gets called way more when I observe data.by_ext_id
+      // and data.by_ext_name directly. Why?
       'observeControlledBy_(controlledBy_)',
     ],
 
@@ -114,7 +114,7 @@
 
     /** @param {!downloads.Data} data */
     update: function(data) {
-      this.data_ = data;
+      this.data = data;
 
       if (!this.isDangerous_) {
         var icon = 'chrome://fileicon/' + encodeURIComponent(data.file_path);
@@ -140,17 +140,17 @@
 
     /** @private */
     computeCompletelyOnDisk_: function() {
-      return this.data_.state == downloads.States.COMPLETE &&
-             !this.data_.file_externally_removed;
+      return this.data.state == downloads.States.COMPLETE &&
+             !this.data.file_externally_removed;
     },
 
     /** @private */
     computeControlledBy_: function() {
-      if (!this.data_.by_ext_id || !this.data_.by_ext_name)
+      if (!this.data.by_ext_id || !this.data.by_ext_name)
         return '';
 
-      var url = 'chrome://extensions#' + this.data_.by_ext_id;
-      var name = this.data_.by_ext_name;
+      var url = 'chrome://extensions#' + this.data.by_ext_id;
+      var name = this.data.by_ext_name;
       return loadTimeData.getStringF('controlledByUrl', url, name);
     },
 
@@ -158,12 +158,12 @@
     computeDate_: function() {
       if (this.hideDate)
         return '';
-      return assert(this.data_.since_string || this.data_.date_string);
+      return assert(this.data.since_string || this.data.date_string);
     },
 
     /** @private */
     computeDescription_: function() {
-      var data = this.data_;
+      var data = this.data;
 
       switch (data.state) {
         case downloads.States.DANGEROUS:
@@ -193,28 +193,28 @@
 
     /** @private */
     computeIsActive_: function() {
-      return this.data_.state != downloads.States.CANCELLED &&
-             this.data_.state != downloads.States.INTERRUPTED &&
-             !this.data_.file_externally_removed;
+      return this.data.state != downloads.States.CANCELLED &&
+             this.data.state != downloads.States.INTERRUPTED &&
+             !this.data.file_externally_removed;
     },
 
     /** @private */
     computeIsDangerous_: function() {
-      return this.data_.state == downloads.States.DANGEROUS;
+      return this.data.state == downloads.States.DANGEROUS;
     },
 
     /** @private */
     computeIsInProgress_: function() {
-      return this.data_.state == downloads.States.IN_PROGRESS;
+      return this.data.state == downloads.States.IN_PROGRESS;
     },
 
     /** @private */
     computeIsMalware_: function() {
       return this.isDangerous_ &&
-          (this.data_.danger_type == downloads.DangerType.DANGEROUS_CONTENT ||
-           this.data_.danger_type == downloads.DangerType.DANGEROUS_HOST ||
-           this.data_.danger_type == downloads.DangerType.DANGEROUS_URL ||
-           this.data_.danger_type == downloads.DangerType.POTENTIALLY_UNWANTED);
+          (this.data.danger_type == downloads.DangerType.DANGEROUS_CONTENT ||
+           this.data.danger_type == downloads.DangerType.DANGEROUS_HOST ||
+           this.data.danger_type == downloads.DangerType.DANGEROUS_URL ||
+           this.data.danger_type == downloads.DangerType.POTENTIALLY_UNWANTED);
     },
 
     /** @private */
@@ -226,26 +226,26 @@
 
     /** @private */
     computeShowCancel_: function() {
-      return this.data_.state == downloads.States.IN_PROGRESS ||
-             this.data_.state == downloads.States.PAUSED;
+      return this.data.state == downloads.States.IN_PROGRESS ||
+             this.data.state == downloads.States.PAUSED;
     },
 
     /** @private */
     computeShowProgress_: function() {
-      return this.showCancel_ && this.data_.percent >= -1;
+      return this.showCancel_ && this.data.percent >= -1;
     },
 
     /** @private */
     computeTag_: function() {
-      switch (this.data_.state) {
+      switch (this.data.state) {
         case downloads.States.CANCELLED:
           return loadTimeData.getString('statusCancelled');
 
         case downloads.States.INTERRUPTED:
-          return this.data_.last_reason_text;
+          return this.data.last_reason_text;
 
         case downloads.States.COMPLETE:
-          return this.data_.file_externally_removed ?
+          return this.data.file_externally_removed ?
               loadTimeData.getString('statusRemoved') : '';
       }
 
@@ -254,7 +254,7 @@
 
     /** @private */
     isIndeterminate_: function() {
-      return this.data_.percent == -1;
+      return this.data.percent == -1;
     },
 
     /** @private */
@@ -264,12 +264,12 @@
 
     /** @private */
     onCancelClick_: function() {
-      downloads.ActionService.getInstance().cancel(this.data_.id);
+      downloads.ActionService.getInstance().cancel(this.data.id);
     },
 
     /** @private */
     onDiscardDangerous_: function() {
-      downloads.ActionService.getInstance().discardDangerous(this.data_.id);
+      downloads.ActionService.getInstance().discardDangerous(this.data.id);
     },
 
     /**
@@ -278,7 +278,7 @@
      */
     onDragStart_: function(e) {
       e.preventDefault();
-      downloads.ActionService.getInstance().drag(this.data_.id);
+      downloads.ActionService.getInstance().drag(this.data.id);
     },
 
     /**
@@ -287,37 +287,37 @@
      */
     onFileLinkClick_: function(e) {
       e.preventDefault();
-      downloads.ActionService.getInstance().openFile(this.data_.id);
+      downloads.ActionService.getInstance().openFile(this.data.id);
     },
 
     /** @private */
     onPauseClick_: function() {
-      downloads.ActionService.getInstance().pause(this.data_.id);
+      downloads.ActionService.getInstance().pause(this.data.id);
     },
 
     /** @private */
     onRemoveClick_: function() {
-      downloads.ActionService.getInstance().remove(this.data_.id);
+      downloads.ActionService.getInstance().remove(this.data.id);
     },
 
     /** @private */
     onResumeClick_: function() {
-      downloads.ActionService.getInstance().resume(this.data_.id);
+      downloads.ActionService.getInstance().resume(this.data.id);
     },
 
     /** @private */
     onRetryClick_: function() {
-      downloads.ActionService.getInstance().download(this.data_.url);
+      downloads.ActionService.getInstance().download(this.data.url);
     },
 
     /** @private */
     onSaveDangerous_: function() {
-      downloads.ActionService.getInstance().saveDangerous(this.data_.id);
+      downloads.ActionService.getInstance().saveDangerous(this.data.id);
     },
 
     /** @private */
     onShowClick_: function() {
-      downloads.ActionService.getInstance().show(this.data_.id);
+      downloads.ActionService.getInstance().show(this.data.id);
     },
   });
 
diff --git a/chrome/browser/resources/md_downloads/manager.css b/chrome/browser/resources/md_downloads/manager.css
index 33bc8aa..c7f50d1 100644
--- a/chrome/browser/resources/md_downloads/manager.css
+++ b/chrome/browser/resources/md_downloads/manager.css
@@ -45,9 +45,9 @@
 }
 
 #no-downloads .illustration {
-  background: -webkit-image-set(url(1x/no_downloads.png) 1x,
-                                url(2x/no_downloads.png) 2x)
-      no-repeat center center;
+  background: -webkit-image-set(
+      url(chrome://downloads/1x/no_downloads.png) 1x,
+      url(chrome://downloads/2x/no_downloads.png) 2x) no-repeat center center;
   height: 144px;  /* Matches natural image height. */
   margin-bottom: 32px;
 }
diff --git a/chrome/browser/resources/md_downloads/vulcanize.py b/chrome/browser/resources/md_downloads/vulcanize.py
new file mode 100755
index 0000000..ab324856
--- /dev/null
+++ b/chrome/browser/resources/md_downloads/vulcanize.py
@@ -0,0 +1,76 @@
+#!/usr/bin/env python
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import subprocess
+import sys
+import tempfile
+
+
+_HERE_PATH = os.path.join(os.path.dirname(__file__))
+
+_HTML_IN_PATH = os.path.join(_HERE_PATH, 'downloads.html')
+_HTML_OUT_PATH = os.path.join(_HERE_PATH, 'vulcanized.html')
+_JS_OUT_PATH = os.path.join(_HERE_PATH, 'crisper.js')
+
+_SRC_PATH = os.path.normpath(os.path.join(_HERE_PATH, '..', '..', '..', '..'))
+
+_RESOURCES_PATH = os.path.join(_SRC_PATH, 'ui', 'webui', 'resources')
+
+_CR_ELEMENTS_PATH = os.path.join(_RESOURCES_PATH, 'cr_elements')
+_CSS_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'css')
+_HTML_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'html')
+_JS_RESOURCES_PATH = os.path.join(_RESOURCES_PATH, 'js')
+
+_POLYMER_PATH = os.path.join(
+    _SRC_PATH, 'third_party', 'polymer', 'v1_0', 'components-chromium')
+_WEB_ANIMATIONS_PATH = os.path.join(
+    _SRC_PATH, 'third_party', 'web-animations-js', 'sources')
+
+_VULCANIZE_ARGS = [
+  '--exclude', 'crisper.js',
+  '--exclude', 'load_time_data.js',
+  '--exclude', 'strings.js',
+  '--exclude', 'text_defaults.css',
+  '--inline-css',
+  '--inline-scripts',
+  '--redirect', 'chrome://downloads/|%s' % _HERE_PATH,
+  '--redirect', 'chrome://resources/cr_elements/|%s' % _CR_ELEMENTS_PATH,
+  '--redirect', 'chrome://resources/css/|%s' % _CSS_RESOURCES_PATH,
+  '--redirect', 'chrome://resources/html/|%s' % _HTML_RESOURCES_PATH,
+  '--redirect', 'chrome://resources/js/|%s' % _JS_RESOURCES_PATH,
+  '--redirect', 'chrome://resources/polymer/v1_0/web-animations-js/|%s' % _WEB_ANIMATIONS_PATH,
+  '--redirect', 'chrome://resources/polymer/v1_0/|%s' % _POLYMER_PATH,
+  '--strip-comments',
+]
+
+def main():
+  def _run_cmd(cmd_parts, stdout=None):
+    cmd = "'" + "' '".join(cmd_parts) + "'"
+    process = subprocess.Popen(
+        cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+    stdout, stderr = process.communicate()
+
+    if stderr:
+      print >> sys.stderr, '%s failed: %s' % (cmd, stderr)
+      raise
+
+    return stdout
+
+  output = _run_cmd(['vulcanize'] + _VULCANIZE_ARGS + [_HTML_IN_PATH])
+
+  with tempfile.NamedTemporaryFile(mode='wt+', delete=False) as tmp:
+    tmp.write(output.replace(
+        '<include src="', '<include src="../../../../ui/webui/resources/js/'))
+
+  try:
+    _run_cmd(['crisper', '--source', tmp.name, '--html', _HTML_OUT_PATH,
+                                               '--js', _JS_OUT_PATH])
+  finally:
+    os.remove(tmp.name)
+
+
+if __name__ == '__main__':
+  main()
diff --git a/chrome/browser/resources/md_downloads/vulcanize_readme.md b/chrome/browser/resources/md_downloads/vulcanize_readme.md
new file mode 100644
index 0000000..858d6f06
--- /dev/null
+++ b/chrome/browser/resources/md_downloads/vulcanize_readme.md
@@ -0,0 +1,44 @@
+# Vulcanizing Material Design downloads
+
+`vulcanize` is an npm module used to combine resources.  In order to make the
+Material Design downloads page sufficiently fast, we run vulcanize on the source
+files to combine them and reduce blocking load/parse time.
+
+## Required software
+
+Vulcanization currently requires:
+- node.js: v0.10.25 (can be found with `node --version`)
+- npm: 1.3.10 (can be found with `npm --version`)
+- vulcanize: 1.12.3 (can be found with `vulcanize --version`)
+- crisper: 1.0.7 (can be found with `npm info crisper`)
+
+## Installing required software
+
+For instructions on installing node and npm, see
+[here](https://docs.npmjs.com/getting-started/installing-node).
+
+Once you've installed npm, you can get `crisper` and `vulcanize` via:
+
+```bash
+$ sudo npm install -g crisper vulcanize
+```
+
+## Combining resources with vulcanize
+
+To combine all the CSS/HTML/JS for the downloads page to make it production
+fast, you can run the commands:
+
+```bash
+$ chrome/browser/resources/md_downloads/vulcanize.py  # from src/
+```
+
+This should overwrite the following files:
+
+- chrome/browser/resources/md_downloads/
+ - vulcanized.html (all <link rel=import> and stylesheets inlined)
+ - crisper.js (all JavaScript, extracted from vulcanized.html)
+
+## Testing downloads without vulcanizing
+
+If you're locally working on the downloads page, you can simply load this URL to
+bypass the vulcanized version: `chrome://downloads/dev.html`
diff --git a/chrome/browser/resources/md_downloads/vulcanized.html b/chrome/browser/resources/md_downloads/vulcanized.html
new file mode 100644
index 0000000..20b005f7f
--- /dev/null
+++ b/chrome/browser/resources/md_downloads/vulcanized.html
@@ -0,0 +1,3494 @@
+<!DOCTYPE html><html i18n-values="dir:textdirection;lang:language"><head><!--
+@license
+Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+--><!--
+@license
+Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+--><!--
+@license
+Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
+The complete set of authors may be found at http://polymer.github.io/AUTHORS
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
+-->
+  <meta charset="utf-8">
+  <title i18n-content="title"></title>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+@font-face {
+  font-family: 'Roboto';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Roboto'), local('Roboto-Regular'),
+      url("chrome://resources/roboto/roboto-regular-latin.woff2") format('woff2');
+  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC,
+      U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
+}
+
+@font-face {
+  font-family: 'Roboto';
+  font-style: normal;
+  font-weight: 500;
+  src: local('Roboto Medium'), local('Roboto-Medium'),
+      url("chrome://resources/roboto/roboto-medium-latin.woff2") format('woff2');
+  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC,
+      U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
+}
+
+</style>
+  <link rel="stylesheet" href="chrome://resources/css/text_defaults.css">
+  <script src="chrome://resources/js/load_time_data.js"></script>
+<style>
+  /* IE 10 support for HTML5 hidden attr */
+  [hidden] {
+    display: none !important;
+  }
+</style>
+
+<style is="custom-style">
+  :root {
+
+    --layout: {
+      display: -ms-flexbox;
+      display: -webkit-flex;
+      display: flex;
+    };
+
+    --layout-inline: {
+      display: -ms-inline-flexbox;
+      display: -webkit-inline-flex;
+      display: inline-flex;
+    };
+
+    --layout-horizontal: {
+      /* @apply(--layout); */
+      display: -ms-flexbox;
+      display: -webkit-flex;
+      display: flex;
+
+      -ms-flex-direction: row;
+      -webkit-flex-direction: row;
+      flex-direction: row;
+    };
+
+    --layout-horizontal-reverse: {
+      -ms-flex-direction: row-reverse;
+      -webkit-flex-direction: row-reverse;
+      flex-direction: row-reverse;
+    };
+
+    --layout-vertical: {
+      /* @apply(--layout); */
+      display: -ms-flexbox;
+      display: -webkit-flex;
+      display: flex;
+
+      -ms-flex-direction: column;
+      -webkit-flex-direction: column;
+      flex-direction: column;
+    };
+
+    --layout-vertical-reverse: {
+      -ms-flex-direction: column-reverse;
+      -webkit-flex-direction: column-reverse;
+      flex-direction: column-reverse;
+    };
+
+    --layout-wrap: {
+      -ms-flex-wrap: wrap;
+      -webkit-flex-wrap: wrap;
+      flex-wrap: wrap;
+    };
+
+    --layout-wrap-reverse: {
+      -ms-flex-wrap: wrap-reverse;
+      -webkit-flex-wrap: wrap-reverse;
+      flex-wrap: wrap-reverse;
+    };
+
+    --layout-flex-auto: {
+      -ms-flex: 1 1 auto;
+      -webkit-flex: 1 1 auto;
+      flex: 1 1 auto;
+    };
+
+    --layout-flex-none: {
+      -ms-flex: none;
+      -webkit-flex: none;
+      flex: none;
+    };
+
+    --layout-flex: {
+      -ms-flex: 1 1 0.000000001px;
+      -webkit-flex: 1;
+      flex: 1;
+      -webkit-flex-basis: 0.000000001px;
+      flex-basis: 0.000000001px;
+    };
+
+    --layout-flex-2: {
+      -ms-flex: 2;
+      -webkit-flex: 2;
+      flex: 2;
+    };
+
+    --layout-flex-3: {
+      -ms-flex: 3;
+      -webkit-flex: 3;
+      flex: 3;
+    };
+
+    --layout-flex-4: {
+      -ms-flex: 4;
+      -webkit-flex: 4;
+      flex: 4;
+    };
+
+    --layout-flex-5: {
+      -ms-flex: 5;
+      -webkit-flex: 5;
+      flex: 5;
+    };
+
+    --layout-flex-6: {
+      -ms-flex: 6;
+      -webkit-flex: 6;
+      flex: 6;
+    };
+
+    --layout-flex-7: {
+      -ms-flex: 7;
+      -webkit-flex: 7;
+      flex: 7;
+    };
+
+    --layout-flex-8: {
+      -ms-flex: 8;
+      -webkit-flex: 8;
+      flex: 8;
+    };
+
+    --layout-flex-9: {
+      -ms-flex: 9;
+      -webkit-flex: 9;
+      flex: 9;
+    };
+
+    --layout-flex-10: {
+      -ms-flex: 10;
+      -webkit-flex: 10;
+      flex: 10;
+    };
+
+    --layout-flex-11: {
+      -ms-flex: 11;
+      -webkit-flex: 11;
+      flex: 11;
+    };
+
+    --layout-flex-12: {
+      -ms-flex: 12;
+      -webkit-flex: 12;
+      flex: 12;
+    };
+
+    /* alignment in cross axis */
+
+    --layout-start: {
+      -ms-flex-align: start;
+      -webkit-align-items: flex-start;
+      align-items: flex-start;
+    };
+
+    --layout-center: {
+      -ms-flex-align: center;
+      -webkit-align-items: center;
+      align-items: center;
+    };
+
+    --layout-end: {
+      -ms-flex-align: end;
+      -webkit-align-items: flex-end;
+      align-items: flex-end;
+    };
+
+    /* alignment in main axis */
+
+    --layout-start-justified: {
+      -ms-flex-pack: start;
+      -webkit-justify-content: flex-start;
+      justify-content: flex-start;
+    };
+
+    --layout-center-justified: {
+      -ms-flex-pack: center;
+      -webkit-justify-content: center;
+      justify-content: center;
+    };
+
+    --layout-end-justified: {
+      -ms-flex-pack: end;
+      -webkit-justify-content: flex-end;
+      justify-content: flex-end;
+    };
+
+    --layout-around-justified: {
+      -ms-flex-pack: around;
+      -webkit-justify-content: space-around;
+      justify-content: space-around;
+    };
+
+    --layout-justified: {
+      -ms-flex-pack: justify;
+      -webkit-justify-content: space-between;
+      justify-content: space-between;
+    };
+
+    --layout-center-center: {
+      /* @apply(--layout-center --layout-center-justified); */
+      -ms-flex-align: center;
+      -webkit-align-items: center;
+      align-items: center;
+      -ms-flex-pack: center;
+      -webkit-justify-content: center;
+      justify-content: center;
+    };
+
+    /* self alignment */
+
+    --layout-self-start: {
+      -ms-align-self: flex-start;
+      -webkit-align-self: flex-start;
+      align-self: flex-start;
+    };
+
+    --layout-self-center: {
+      -ms-align-self: center;
+      -webkit-align-self: center;
+      align-self: center;
+    };
+
+    --layout-self-end: {
+      -ms-align-self: flex-end;
+      -webkit-align-self: flex-end;
+      align-self: flex-end;
+    };
+
+    --layout-self-stretch: {
+      -ms-align-self: stretch;
+      -webkit-align-self: stretch;
+      align-self: stretch;
+    };
+
+    /*******************************
+              Other Layout
+    *******************************/
+
+    --layout-block: {
+      display: block;
+    };
+
+    --layout-invisible: {
+      visibility: hidden !important;
+    };
+
+    --layout-relative: {
+      position: relative;
+    };
+
+    --layout-fit: {
+      position: absolute;
+      top: 0;
+      right: 0;
+      bottom: 0;
+      left: 0;
+    };
+
+    --layout-scroll: {
+      -webkit-overflow-scrolling: touch;
+      overflow: auto;
+    };
+
+    /* fixed position */
+
+    --layout-fixed-top: {
+      position: fixed;
+      top: 0;
+      left: 0;
+      right: 0;
+    };
+
+    --layout-fixed-right: {
+      position: fixed;
+      top: 0;
+      right: 0;
+      bottom: 0;
+    };
+
+    --layout-fixed-bottom: {
+      position: fixed;
+      right: 0;
+      bottom: 0;
+      left: 0;
+    };
+
+    --layout-fixed-left: {
+      position: fixed;
+      top: 0;
+      bottom: 0;
+      left: 0;
+    };
+
+  }
+
+</style>
+
+
+<style is="custom-style">
+
+  :root {
+
+    --shadow-transition: {
+      transition: box-shadow 0.28s cubic-bezier(0.4, 0, 0.2, 1);
+    };
+
+    --shadow-none: {
+      box-shadow: none;
+    };
+
+    /* from http://codepen.io/shyndman/pen/c5394ddf2e8b2a5c9185904b57421cdb */
+
+    --shadow-elevation-2dp: {
+      box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
+                  0 1px 5px 0 rgba(0, 0, 0, 0.12),
+                  0 3px 1px -2px rgba(0, 0, 0, 0.2);
+    };
+
+    --shadow-elevation-3dp: {
+      box-shadow: 0 3px 4px 0 rgba(0, 0, 0, 0.14),
+                  0 1px 8px 0 rgba(0, 0, 0, 0.12),
+                  0 3px 3px -2px rgba(0, 0, 0, 0.4);
+    };
+
+    --shadow-elevation-4dp: {
+      box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14),
+                  0 1px 10px 0 rgba(0, 0, 0, 0.12),
+                  0 2px 4px -1px rgba(0, 0, 0, 0.4);
+    };
+
+    --shadow-elevation-6dp: {
+      box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14),
+                  0 1px 18px 0 rgba(0, 0, 0, 0.12),
+                  0 3px 5px -1px rgba(0, 0, 0, 0.4);
+    };
+
+    --shadow-elevation-8dp: {
+      box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14),
+                  0 3px 14px 2px rgba(0, 0, 0, 0.12),
+                  0 5px 5px -3px rgba(0, 0, 0, 0.4);
+    };
+
+    --shadow-elevation-16dp: {
+      box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14),
+                  0  6px 30px 5px rgba(0, 0, 0, 0.12),
+                  0  8px 10px -5px rgba(0, 0, 0, 0.4);
+    };
+
+  }
+
+</style>
+
+
+
+
+
+
+<style is="custom-style">
+
+  :root {
+
+    /* Material Design color palette for Google products */
+
+    --google-red-100: #f4c7c3;
+    --google-red-300: #e67c73;
+    --google-red-500: #db4437;
+    --google-red-700: #c53929;
+
+    --google-blue-100: #c6dafc;
+    --google-blue-300: #7baaf7;
+    --google-blue-500: #4285f4;
+    --google-blue-700: #3367d6;
+
+    --google-green-100: #b7e1cd;
+    --google-green-300: #57bb8a;
+    --google-green-500: #0f9d58;
+    --google-green-700: #0b8043;
+
+    --google-yellow-100: #fce8b2;
+    --google-yellow-300: #f7cb4d;
+    --google-yellow-500: #f4b400;
+    --google-yellow-700: #f09300;
+
+    --google-grey-100: #f5f5f5;
+    --google-grey-300: #e0e0e0;
+    --google-grey-500: #9e9e9e;
+    --google-grey-700: #616161;
+    
+    /* Material Design color palette from online spec document */
+
+    --paper-red-50: #ffebee;
+    --paper-red-100: #ffcdd2;
+    --paper-red-200: #ef9a9a;
+    --paper-red-300: #e57373;
+    --paper-red-400: #ef5350;
+    --paper-red-500: #f44336;
+    --paper-red-600: #e53935;
+    --paper-red-700: #d32f2f;
+    --paper-red-800: #c62828;
+    --paper-red-900: #b71c1c;
+    --paper-red-a100: #ff8a80;
+    --paper-red-a200: #ff5252;
+    --paper-red-a400: #ff1744;
+    --paper-red-a700: #d50000;
+ 
+    --paper-pink-50: #fce4ec;
+    --paper-pink-100: #f8bbd0;
+    --paper-pink-200: #f48fb1;
+    --paper-pink-300: #f06292;
+    --paper-pink-400: #ec407a;
+    --paper-pink-500: #e91e63;
+    --paper-pink-600: #d81b60;
+    --paper-pink-700: #c2185b;
+    --paper-pink-800: #ad1457;
+    --paper-pink-900: #880e4f;
+    --paper-pink-a100: #ff80ab;
+    --paper-pink-a200: #ff4081;
+    --paper-pink-a400: #f50057;
+    --paper-pink-a700: #c51162;
+ 
+    --paper-purple-50: #f3e5f5;
+    --paper-purple-100: #e1bee7;
+    --paper-purple-200: #ce93d8;
+    --paper-purple-300: #ba68c8;
+    --paper-purple-400: #ab47bc;
+    --paper-purple-500: #9c27b0;
+    --paper-purple-600: #8e24aa;
+    --paper-purple-700: #7b1fa2;
+    --paper-purple-800: #6a1b9a;
+    --paper-purple-900: #4a148c;
+    --paper-purple-a100: #ea80fc;
+    --paper-purple-a200: #e040fb;
+    --paper-purple-a400: #d500f9;
+    --paper-purple-a700: #aa00ff;
+ 
+    --paper-deep-purple-50: #ede7f6;
+    --paper-deep-purple-100: #d1c4e9;
+    --paper-deep-purple-200: #b39ddb;
+    --paper-deep-purple-300: #9575cd;
+    --paper-deep-purple-400: #7e57c2;
+    --paper-deep-purple-500: #673ab7;
+    --paper-deep-purple-600: #5e35b1;
+    --paper-deep-purple-700: #512da8;
+    --paper-deep-purple-800: #4527a0;
+    --paper-deep-purple-900: #311b92;
+    --paper-deep-purple-a100: #b388ff;
+    --paper-deep-purple-a200: #7c4dff;
+    --paper-deep-purple-a400: #651fff;
+    --paper-deep-purple-a700: #6200ea;
+ 
+    --paper-indigo-50: #e8eaf6;
+    --paper-indigo-100: #c5cae9;
+    --paper-indigo-200: #9fa8da;
+    --paper-indigo-300: #7986cb;
+    --paper-indigo-400: #5c6bc0;
+    --paper-indigo-500: #3f51b5;
+    --paper-indigo-600: #3949ab;
+    --paper-indigo-700: #303f9f;
+    --paper-indigo-800: #283593;
+    --paper-indigo-900: #1a237e;
+    --paper-indigo-a100: #8c9eff;
+    --paper-indigo-a200: #536dfe;
+    --paper-indigo-a400: #3d5afe;
+    --paper-indigo-a700: #304ffe;
+ 
+    --paper-blue-50: #e3f2fd;
+    --paper-blue-100: #bbdefb;
+    --paper-blue-200: #90caf9;
+    --paper-blue-300: #64b5f6;
+    --paper-blue-400: #42a5f5;
+    --paper-blue-500: #2196f3;
+    --paper-blue-600: #1e88e5;
+    --paper-blue-700: #1976d2;
+    --paper-blue-800: #1565c0;
+    --paper-blue-900: #0d47a1;
+    --paper-blue-a100: #82b1ff;
+    --paper-blue-a200: #448aff;
+    --paper-blue-a400: #2979ff;
+    --paper-blue-a700: #2962ff;
+ 
+    --paper-light-blue-50: #e1f5fe;
+    --paper-light-blue-100: #b3e5fc;
+    --paper-light-blue-200: #81d4fa;
+    --paper-light-blue-300: #4fc3f7;
+    --paper-light-blue-400: #29b6f6;
+    --paper-light-blue-500: #03a9f4;
+    --paper-light-blue-600: #039be5;
+    --paper-light-blue-700: #0288d1;
+    --paper-light-blue-800: #0277bd;
+    --paper-light-blue-900: #01579b;
+    --paper-light-blue-a100: #80d8ff;
+    --paper-light-blue-a200: #40c4ff;
+    --paper-light-blue-a400: #00b0ff;
+    --paper-light-blue-a700: #0091ea;
+ 
+    --paper-cyan-50: #e0f7fa;
+    --paper-cyan-100: #b2ebf2;
+    --paper-cyan-200: #80deea;
+    --paper-cyan-300: #4dd0e1;
+    --paper-cyan-400: #26c6da;
+    --paper-cyan-500: #00bcd4;
+    --paper-cyan-600: #00acc1;
+    --paper-cyan-700: #0097a7;
+    --paper-cyan-800: #00838f;
+    --paper-cyan-900: #006064;
+    --paper-cyan-a100: #84ffff;
+    --paper-cyan-a200: #18ffff;
+    --paper-cyan-a400: #00e5ff;
+    --paper-cyan-a700: #00b8d4;
+ 
+    --paper-teal-50: #e0f2f1;
+    --paper-teal-100: #b2dfdb;
+    --paper-teal-200: #80cbc4;
+    --paper-teal-300: #4db6ac;
+    --paper-teal-400: #26a69a;
+    --paper-teal-500: #009688;
+    --paper-teal-600: #00897b;
+    --paper-teal-700: #00796b;
+    --paper-teal-800: #00695c;
+    --paper-teal-900: #004d40;
+    --paper-teal-a100: #a7ffeb;
+    --paper-teal-a200: #64ffda;
+    --paper-teal-a400: #1de9b6;
+    --paper-teal-a700: #00bfa5;
+ 
+    --paper-green-50: #e8f5e9;
+    --paper-green-100: #c8e6c9;
+    --paper-green-200: #a5d6a7;
+    --paper-green-300: #81c784;
+    --paper-green-400: #66bb6a;
+    --paper-green-500: #4caf50;
+    --paper-green-600: #43a047;
+    --paper-green-700: #388e3c;
+    --paper-green-800: #2e7d32;
+    --paper-green-900: #1b5e20;
+    --paper-green-a100: #b9f6ca;
+    --paper-green-a200: #69f0ae;
+    --paper-green-a400: #00e676;
+    --paper-green-a700: #00c853;
+ 
+    --paper-light-green-50: #f1f8e9;
+    --paper-light-green-100: #dcedc8;
+    --paper-light-green-200: #c5e1a5;
+    --paper-light-green-300: #aed581;
+    --paper-light-green-400: #9ccc65;
+    --paper-light-green-500: #8bc34a;
+    --paper-light-green-600: #7cb342;
+    --paper-light-green-700: #689f38;
+    --paper-light-green-800: #558b2f;
+    --paper-light-green-900: #33691e;
+    --paper-light-green-a100: #ccff90;
+    --paper-light-green-a200: #b2ff59;
+    --paper-light-green-a400: #76ff03;
+    --paper-light-green-a700: #64dd17;
+ 
+    --paper-lime-50: #f9fbe7;
+    --paper-lime-100: #f0f4c3;
+    --paper-lime-200: #e6ee9c;
+    --paper-lime-300: #dce775;
+    --paper-lime-400: #d4e157;
+    --paper-lime-500: #cddc39;
+    --paper-lime-600: #c0ca33;
+    --paper-lime-700: #afb42b;
+    --paper-lime-800: #9e9d24;
+    --paper-lime-900: #827717;
+    --paper-lime-a100: #f4ff81;
+    --paper-lime-a200: #eeff41;
+    --paper-lime-a400: #c6ff00;
+    --paper-lime-a700: #aeea00;
+ 
+    --paper-yellow-50: #fffde7;
+    --paper-yellow-100: #fff9c4;
+    --paper-yellow-200: #fff59d;
+    --paper-yellow-300: #fff176;
+    --paper-yellow-400: #ffee58;
+    --paper-yellow-500: #ffeb3b;
+    --paper-yellow-600: #fdd835;
+    --paper-yellow-700: #fbc02d;
+    --paper-yellow-800: #f9a825;
+    --paper-yellow-900: #f57f17;
+    --paper-yellow-a100: #ffff8d;
+    --paper-yellow-a200: #ffff00;
+    --paper-yellow-a400: #ffea00;
+    --paper-yellow-a700: #ffd600;
+ 
+    --paper-amber-50: #fff8e1;
+    --paper-amber-100: #ffecb3;
+    --paper-amber-200: #ffe082;
+    --paper-amber-300: #ffd54f;
+    --paper-amber-400: #ffca28;
+    --paper-amber-500: #ffc107;
+    --paper-amber-600: #ffb300;
+    --paper-amber-700: #ffa000;
+    --paper-amber-800: #ff8f00;
+    --paper-amber-900: #ff6f00;
+    --paper-amber-a100: #ffe57f;
+    --paper-amber-a200: #ffd740;
+    --paper-amber-a400: #ffc400;
+    --paper-amber-a700: #ffab00;
+ 
+    --paper-orange-50: #fff3e0;
+    --paper-orange-100: #ffe0b2;
+    --paper-orange-200: #ffcc80;
+    --paper-orange-300: #ffb74d;
+    --paper-orange-400: #ffa726;
+    --paper-orange-500: #ff9800;
+    --paper-orange-600: #fb8c00;
+    --paper-orange-700: #f57c00;
+    --paper-orange-800: #ef6c00;
+    --paper-orange-900: #e65100;
+    --paper-orange-a100: #ffd180;
+    --paper-orange-a200: #ffab40;
+    --paper-orange-a400: #ff9100;
+    --paper-orange-a700: #ff6500;
+ 
+    --paper-deep-orange-50: #fbe9e7;
+    --paper-deep-orange-100: #ffccbc;
+    --paper-deep-orange-200: #ffab91;
+    --paper-deep-orange-300: #ff8a65;
+    --paper-deep-orange-400: #ff7043;
+    --paper-deep-orange-500: #ff5722;
+    --paper-deep-orange-600: #f4511e;
+    --paper-deep-orange-700: #e64a19;
+    --paper-deep-orange-800: #d84315;
+    --paper-deep-orange-900: #bf360c;
+    --paper-deep-orange-a100: #ff9e80;
+    --paper-deep-orange-a200: #ff6e40;
+    --paper-deep-orange-a400: #ff3d00;
+    --paper-deep-orange-a700: #dd2c00;
+ 
+    --paper-brown-50: #efebe9;
+    --paper-brown-100: #d7ccc8;
+    --paper-brown-200: #bcaaa4;
+    --paper-brown-300: #a1887f;
+    --paper-brown-400: #8d6e63;
+    --paper-brown-500: #795548;
+    --paper-brown-600: #6d4c41;
+    --paper-brown-700: #5d4037;
+    --paper-brown-800: #4e342e;
+    --paper-brown-900: #3e2723;
+ 
+    --paper-grey-50: #fafafa;
+    --paper-grey-100: #f5f5f5;
+    --paper-grey-200: #eeeeee;
+    --paper-grey-300: #e0e0e0;
+    --paper-grey-400: #bdbdbd;
+    --paper-grey-500: #9e9e9e;
+    --paper-grey-600: #757575;
+    --paper-grey-700: #616161;
+    --paper-grey-800: #424242;
+    --paper-grey-900: #212121;
+ 
+    --paper-blue-grey-50: #eceff1;
+    --paper-blue-grey-100: #cfd8dc;
+    --paper-blue-grey-200: #b0bec5;
+    --paper-blue-grey-300: #90a4ae;
+    --paper-blue-grey-400: #78909c;
+    --paper-blue-grey-500: #607d8b;
+    --paper-blue-grey-600: #546e7a;
+    --paper-blue-grey-700: #455a64;
+    --paper-blue-grey-800: #37474f;
+    --paper-blue-grey-900: #263238;
+
+    /* opacity for dark text on a light background */
+    --dark-divider-opacity: 0.12;
+    --dark-disabled-opacity: 0.26; /* or hint text */
+    --dark-secondary-opacity: 0.54; /* or icon */
+    --dark-primary-opacity: 0.87;
+
+    /* opacity for light text on a dark background */
+    --light-divider-opacity: 0.12;
+    --light-disabled-opacity: 0.3; /* or hint text */
+    --light-secondary-opacity: 0.7; /* or icon */
+    --light-primary-opacity: 1.0;
+
+  }
+
+</style>
+
+
+<style>
+
+  /*******************************
+            Flex Layout
+  *******************************/
+
+  html /deep/ .layout.horizontal,
+  html /deep/ .layout.horizontal-reverse,
+  html /deep/ .layout.vertical,
+  html /deep/ .layout.vertical-reverse {
+    display: -ms-flexbox;
+    display: -webkit-flex;
+    display: flex;
+  }
+
+  html /deep/ .layout.inline {
+    display: -ms-inline-flexbox;
+    display: -webkit-inline-flex;
+    display: inline-flex;
+  }
+
+  html /deep/ .layout.horizontal {
+    -ms-flex-direction: row;
+    -webkit-flex-direction: row;
+    flex-direction: row;
+  }
+
+  html /deep/ .layout.horizontal-reverse {
+    -ms-flex-direction: row-reverse;
+    -webkit-flex-direction: row-reverse;
+    flex-direction: row-reverse;
+  }
+
+  html /deep/ .layout.vertical {
+    -ms-flex-direction: column;
+    -webkit-flex-direction: column;
+    flex-direction: column;
+  }
+
+  html /deep/ .layout.vertical-reverse {
+    -ms-flex-direction: column-reverse;
+    -webkit-flex-direction: column-reverse;
+    flex-direction: column-reverse;
+  }
+
+  html /deep/ .layout.wrap {
+    -ms-flex-wrap: wrap;
+    -webkit-flex-wrap: wrap;
+    flex-wrap: wrap;
+  }
+
+  html /deep/ .layout.wrap-reverse {
+    -ms-flex-wrap: wrap-reverse;
+    -webkit-flex-wrap: wrap-reverse;
+    flex-wrap: wrap-reverse;
+  }
+
+  html /deep/ .flex-auto {
+    -ms-flex: 1 1 auto;
+    -webkit-flex: 1 1 auto;
+    flex: 1 1 auto;
+  }
+
+  html /deep/ .flex-none {
+    -ms-flex: none;
+    -webkit-flex: none;
+    flex: none;
+  }
+
+  html /deep/ .flex,
+  html /deep/ .flex-1 {
+    -ms-flex: 1;
+    -webkit-flex: 1;
+    flex: 1;
+  }
+
+  html /deep/ .flex-2 {
+    -ms-flex: 2;
+    -webkit-flex: 2;
+    flex: 2;
+  }
+
+  html /deep/ .flex-3 {
+    -ms-flex: 3;
+    -webkit-flex: 3;
+    flex: 3;
+  }
+
+  html /deep/ .flex-4 {
+    -ms-flex: 4;
+    -webkit-flex: 4;
+    flex: 4;
+  }
+
+  html /deep/ .flex-5 {
+    -ms-flex: 5;
+    -webkit-flex: 5;
+    flex: 5;
+  }
+
+  html /deep/ .flex-6 {
+    -ms-flex: 6;
+    -webkit-flex: 6;
+    flex: 6;
+  }
+
+  html /deep/ .flex-7 {
+    -ms-flex: 7;
+    -webkit-flex: 7;
+    flex: 7;
+  }
+
+  html /deep/ .flex-8 {
+    -ms-flex: 8;
+    -webkit-flex: 8;
+    flex: 8;
+  }
+
+  html /deep/ .flex-9 {
+    -ms-flex: 9;
+    -webkit-flex: 9;
+    flex: 9;
+  }
+
+  html /deep/ .flex-10 {
+    -ms-flex: 10;
+    -webkit-flex: 10;
+    flex: 10;
+  }
+
+  html /deep/ .flex-11 {
+    -ms-flex: 11;
+    -webkit-flex: 11;
+    flex: 11;
+  }
+
+  html /deep/ .flex-12 {
+    -ms-flex: 12;
+    -webkit-flex: 12;
+    flex: 12;
+  }
+
+  /* alignment in cross axis */
+
+  html /deep/ .layout.start {
+    -ms-flex-align: start;
+    -webkit-align-items: flex-start;
+    align-items: flex-start;
+  }
+
+  html /deep/ .layout.center,
+  html /deep/ .layout.center-center {
+    -ms-flex-align: center;
+    -webkit-align-items: center;
+    align-items: center;
+  }
+
+  html /deep/ .layout.end {
+    -ms-flex-align: end;
+    -webkit-align-items: flex-end;
+    align-items: flex-end;
+  }
+
+  /* alignment in main axis */
+
+  html /deep/ .layout.start-justified {
+    -ms-flex-pack: start;
+    -webkit-justify-content: flex-start;
+    justify-content: flex-start;
+  }
+
+  html /deep/ .layout.center-justified,
+  html /deep/ .layout.center-center {
+    -ms-flex-pack: center;
+    -webkit-justify-content: center;
+    justify-content: center;
+  }
+
+  html /deep/ .layout.end-justified {
+    -ms-flex-pack: end;
+    -webkit-justify-content: flex-end;
+    justify-content: flex-end;
+  }
+
+  html /deep/ .layout.around-justified {
+    -ms-flex-pack: around;
+    -webkit-justify-content: space-around;
+    justify-content: space-around;
+  }
+
+  html /deep/ .layout.justified {
+    -ms-flex-pack: justify;
+    -webkit-justify-content: space-between;
+    justify-content: space-between;
+  }
+
+  /* self alignment */
+
+  html /deep/ .self-start {
+    -ms-align-self: flex-start;
+    -webkit-align-self: flex-start;
+    align-self: flex-start;
+  }
+
+  html /deep/ .self-center {
+    -ms-align-self: center;
+    -webkit-align-self: center;
+    align-self: center;
+  }
+
+  html /deep/ .self-end {
+    -ms-align-self: flex-end;
+    -webkit-align-self: flex-end;
+    align-self: flex-end;
+  }
+
+  html /deep/ .self-stretch {
+    -ms-align-self: stretch;
+    -webkit-align-self: stretch;
+    align-self: stretch;
+  }
+
+  /*******************************
+            Other Layout
+  *******************************/
+
+  html /deep/ .block {
+    display: block;
+  }
+
+  /* IE 10 support for HTML5 hidden attr */
+  html /deep/ [hidden] {
+    display: none !important;
+  }
+
+  html /deep/ .invisible {
+    visibility: hidden !important;
+  }
+
+  html /deep/ .relative {
+    position: relative;
+  }
+
+  html /deep/ .fit {
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+  }
+
+  body.fullbleed {
+    margin: 0;
+    height: 100vh;
+  }
+
+  html /deep/ .scroll {
+    -webkit-overflow-scrolling: touch;
+    overflow: auto;
+  }
+
+  .fixed-bottom,
+  .fixed-left,
+  .fixed-right,
+  .fixed-top {
+    position: fixed;
+  }
+
+  html /deep/ .fixed-top {
+    top: 0;
+    left: 0;
+    right: 0;
+  }
+
+  html /deep/ .fixed-right {
+    top: 0;
+    right: 0;
+    botttom: 0;
+  }
+
+  html /deep/ .fixed-bottom {
+    right: 0;
+    bottom: 0;
+    left: 0;
+  }
+
+  html /deep/ .fixed-left {
+    top: 0;
+    botttom: 0;
+    left: 0;
+  }
+
+</style>
+<style>
+
+  /*******************************
+            Flex Layout
+  *******************************/
+
+  .layout.horizontal,
+  .layout.horizontal-reverse,
+  .layout.vertical,
+  .layout.vertical-reverse {
+    display: -ms-flexbox;
+    display: -webkit-flex;
+    display: flex;
+  }
+
+  .layout.inline {
+    display: -ms-inline-flexbox;
+    display: -webkit-inline-flex;
+    display: inline-flex;
+  }
+
+  .layout.horizontal {
+    -ms-flex-direction: row;
+    -webkit-flex-direction: row;
+    flex-direction: row;
+  }
+
+  .layout.horizontal-reverse {
+    -ms-flex-direction: row-reverse;
+    -webkit-flex-direction: row-reverse;
+    flex-direction: row-reverse;
+  }
+
+  .layout.vertical {
+    -ms-flex-direction: column;
+    -webkit-flex-direction: column;
+    flex-direction: column;
+  }
+
+  .layout.vertical-reverse {
+    -ms-flex-direction: column-reverse;
+    -webkit-flex-direction: column-reverse;
+    flex-direction: column-reverse;
+  }
+
+  .layout.wrap {
+    -ms-flex-wrap: wrap;
+    -webkit-flex-wrap: wrap;
+    flex-wrap: wrap;
+  }
+
+  .layout.wrap-reverse {
+    -ms-flex-wrap: wrap-reverse;
+    -webkit-flex-wrap: wrap-reverse;
+    flex-wrap: wrap-reverse;
+  }
+
+  .flex-auto {
+    -ms-flex: 1 1 auto;
+    -webkit-flex: 1 1 auto;
+    flex: 1 1 auto;
+  }
+
+  .flex-none {
+    -ms-flex: none;
+    -webkit-flex: none;
+    flex: none;
+  }
+
+  .flex,
+  .flex-1 {
+    -ms-flex: 1;
+    -webkit-flex: 1;
+    flex: 1;
+  }
+
+  .flex-2 {
+    -ms-flex: 2;
+    -webkit-flex: 2;
+    flex: 2;
+  }
+
+  .flex-3 {
+    -ms-flex: 3;
+    -webkit-flex: 3;
+    flex: 3;
+  }
+
+  .flex-4 {
+    -ms-flex: 4;
+    -webkit-flex: 4;
+    flex: 4;
+  }
+
+  .flex-5 {
+    -ms-flex: 5;
+    -webkit-flex: 5;
+    flex: 5;
+  }
+
+  .flex-6 {
+    -ms-flex: 6;
+    -webkit-flex: 6;
+    flex: 6;
+  }
+
+  .flex-7 {
+    -ms-flex: 7;
+    -webkit-flex: 7;
+    flex: 7;
+  }
+
+  .flex-8 {
+    -ms-flex: 8;
+    -webkit-flex: 8;
+    flex: 8;
+  }
+
+  .flex-9 {
+    -ms-flex: 9;
+    -webkit-flex: 9;
+    flex: 9;
+  }
+
+  .flex-10 {
+    -ms-flex: 10;
+    -webkit-flex: 10;
+    flex: 10;
+  }
+
+  .flex-11 {
+    -ms-flex: 11;
+    -webkit-flex: 11;
+    flex: 11;
+  }
+
+  .flex-12 {
+    -ms-flex: 12;
+    -webkit-flex: 12;
+    flex: 12;
+  }
+
+  /* alignment in cross axis */
+
+  .layout.start {
+    -ms-flex-align: start;
+    -webkit-align-items: flex-start;
+    align-items: flex-start;
+  }
+
+  .layout.center,
+  .layout.center-center {
+    -ms-flex-align: center;
+    -webkit-align-items: center;
+    align-items: center;
+  }
+
+  .layout.end {
+    -ms-flex-align: end;
+    -webkit-align-items: flex-end;
+    align-items: flex-end;
+  }
+
+  /* alignment in main axis */
+
+  .layout.start-justified {
+    -ms-flex-pack: start;
+    -webkit-justify-content: flex-start;
+    justify-content: flex-start;
+  }
+
+  .layout.center-justified,
+  .layout.center-center {
+    -ms-flex-pack: center;
+    -webkit-justify-content: center;
+    justify-content: center;
+  }
+
+  .layout.end-justified {
+    -ms-flex-pack: end;
+    -webkit-justify-content: flex-end;
+    justify-content: flex-end;
+  }
+
+  .layout.around-justified {
+    -ms-flex-pack: around;
+    -webkit-justify-content: space-around;
+    justify-content: space-around;
+  }
+
+  .layout.justified {
+    -ms-flex-pack: justify;
+    -webkit-justify-content: space-between;
+    justify-content: space-between;
+  }
+
+  /* self alignment */
+
+  .self-start {
+    -ms-align-self: flex-start;
+    -webkit-align-self: flex-start;
+    align-self: flex-start;
+  }
+
+  .self-center {
+    -ms-align-self: center;
+    -webkit-align-self: center;
+    align-self: center;
+  }
+
+  .self-end {
+    -ms-align-self: flex-end;
+    -webkit-align-self: flex-end;
+    align-self: flex-end;
+  }
+
+  .self-stretch {
+    -ms-align-self: stretch;
+    -webkit-align-self: stretch;
+    align-self: stretch;
+  }
+
+  /*******************************
+            Other Layout
+  *******************************/
+
+  .block {
+    display: block;
+  }
+
+  /* IE 10 support for HTML5 hidden attr */
+  [hidden] {
+    display: none !important;
+  }
+
+  .invisible {
+    visibility: hidden !important;
+  }
+
+  .relative {
+    position: relative;
+  }
+
+  .fit {
+    position: absolute;
+    top: 0;
+    right: 0;
+    bottom: 0;
+    left: 0;
+  }
+
+  body.fullbleed {
+    margin: 0;
+    height: 100vh;
+  }
+
+  .scroll {
+    -webkit-overflow-scrolling: touch;
+    overflow: auto;
+  }
+
+  /* fixed position */
+
+  .fixed-bottom,
+  .fixed-left,
+  .fixed-right,
+  .fixed-top {
+    position: fixed;
+  }
+
+  .fixed-top {
+    top: 0;
+    left: 0;
+    right: 0;
+  }
+
+  .fixed-right {
+    top: 0;
+    right: 0;
+    bottom: 0;
+  }
+
+  .fixed-bottom {
+    right: 0;
+    bottom: 0;
+    left: 0;
+  }
+
+  .fixed-left {
+    top: 0;
+    bottom: 0;
+    left: 0;
+  }
+
+</style>
+<style is="custom-style">
+
+  :root {
+
+    --dark-primary-color: #303f9f;
+
+    --default-primary-color: #3f51b5;
+
+    --light-primary-color: #c5cae9;
+
+    --text-primary-color: #ffffff;
+
+    --accent-color: #ff4081;
+
+    --primary-background-color: #ffffff;
+
+    --primary-text-color: #212121;
+
+    --secondary-text-color: #757575;
+
+    --disabled-text-color: #bdbdbd;
+
+    --divider-color: #e0e0e0;
+
+  }
+
+</style>
+<style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+@font-face {
+  font-family: 'Roboto';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Roboto'), local('Roboto-Regular'),
+      url("chrome://resources/roboto/roboto-regular-latin.woff2") format('woff2');
+  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC,
+      U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
+}
+
+@font-face {
+  font-family: 'Roboto';
+  font-style: normal;
+  font-weight: 500;
+  src: local('Roboto Medium'), local('Roboto-Medium'),
+      url("chrome://resources/roboto/roboto-medium-latin.woff2") format('woff2');
+  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC,
+      U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
+}
+
+</style>
+<style is="custom-style">
+
+  :root {
+
+    /* Shared Styles */
+
+    /*
+    Unfortunately, we can't use nested rules
+    See https://github.com/Polymer/polymer/issues/1399
+    */
+    --paper-font-common-base: {
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+    };
+
+    --paper-font-common-code: {
+      font-family: 'Roboto Mono', 'Consolas', 'Menlo', monospace;
+      -webkit-font-smoothing: antialiased;
+    };
+
+    --paper-font-common-expensive-kerning: {
+      text-rendering: optimizeLegibility;
+    };
+
+    --paper-font-common-nowrap: {
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
+    };
+
+    /* Material Font Styles */
+
+    --paper-font-display4: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+      /* @apply(--paper-font-common-nowrap); */
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
+
+      font-size: 112px;
+      font-weight: 300;
+      letter-spacing: -.044em;
+      line-height: 120px;
+    };
+
+    --paper-font-display3: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+      /* @apply(--paper-font-common-nowrap); */
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
+
+      font-size: 56px;
+      font-weight: 400;
+      letter-spacing: -.026em;
+      line-height: 60px;
+    };
+
+    --paper-font-display2: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+
+      font-size: 45px;
+      font-weight: 400;
+      letter-spacing: -.018em;
+      line-height: 48px;
+    };
+
+    --paper-font-display1: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+
+      font-size: 34px;
+      font-weight: 400;
+      letter-spacing: -.01em;
+      line-height: 40px;
+    };
+
+    --paper-font-headline: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+
+      font-size: 24px;
+      font-weight: 400;
+      letter-spacing: -.012em;
+      line-height: 32px;
+    };
+
+    --paper-font-title: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+      /* @apply(--paper-font-common-nowrap); */
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
+
+      font-size: 20px;
+      font-weight: 500;
+      line-height: 28px;
+    };
+
+    --paper-font-subhead: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+
+      font-size: 16px;
+      font-weight: 400;
+      line-height: 24px;
+    };
+
+    --paper-font-body2: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+
+      font-size: 14px;
+      font-weight: 500;
+      line-height: 24px;
+    };
+
+    --paper-font-body1: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+
+      font-size: 14px;
+      font-weight: 400;
+      line-height: 20px;
+    };
+
+    --paper-font-caption: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-nowrap); */
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
+
+      font-size: 12px;
+      font-weight: 400;
+      letter-spacing: 0.011em;
+      line-height: 20px;
+    };
+
+    --paper-font-menu: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+      /* @apply(--paper-font-common-nowrap); */
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
+
+      font-size: 13px;
+      font-weight: 500;
+      line-height: 24px;
+    };
+
+    --paper-font-button: {
+      /* @apply(--paper-font-common-base) */
+      font-family: 'Roboto', 'Noto', sans-serif;
+      -webkit-font-smoothing: antialiased;
+      /* @apply(--paper-font-common-expensive-kerning); */
+      text-rendering: optimizeLegibility;
+      /* @apply(--paper-font-common-nowrap); */
+      white-space: nowrap;
+      overflow: hidden;
+      text-overflow: ellipsis;
+
+      font-size: 14px;
+      font-weight: 500;
+      letter-spacing: 0.018em;
+      line-height: 24px;
+      text-transform: uppercase;
+    };
+
+    --paper-font-code2: {
+      /* @apply(--paper-font-common-code); */
+      font-family: 'Roboto Mono', 'Consolas', 'Menlo', monospace;
+      -webkit-font-smoothing: antialiased;
+
+      font-size: 14px;
+      font-weight: 700;
+      line-height: 20px;
+    };
+
+    --paper-font-code1: {
+      /* @apply(--paper-font-common-code); */
+      font-family: 'Roboto Mono', 'Consolas', 'Menlo', monospace;
+      -webkit-font-smoothing: antialiased;
+
+      font-size: 14px;
+      font-weight: 500;
+      line-height: 20px;
+    };
+
+  }
+
+</style>
+
+
+
+
+
+
+<style>
+    html {
+      background: #f2f2f2;
+    }
+
+    html,
+    body {
+      height: 100%;
+    }
+
+    body {
+      display: flex;
+      font-family: Roboto;
+      font-size: 81.25%;
+      margin: 0;
+    }
+  </style>
+<script src="chrome://downloads/strings.js"></script>
+</head>
+<body><div hidden="" by-vulcanize=""><dom-module id="paper-header-panel" assetpath="chrome://resources/polymer/v1_0/paper-header-panel/">
+
+  <style>
+/**
+@license
+Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
+The complete set of authors may be found at http://polymer.github.io/AUTHORS
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
+*/
+
+:host {
+  --paper-header-panel-shadow: {
+    height: 6px;
+    bottom: -6px;
+    box-shadow: inset 0px 5px 6px -3px rgba(0, 0, 0, 0.4);
+  };
+
+  @apply(--layout-vertical);
+
+  position: relative;
+  height: 100%;
+}
+
+#mainContainer {
+  @apply(--layout-flex);
+
+  position: relative;
+  overflow-y: auto;
+  overflow-x: hidden;
+  -webkit-overflow-scrolling: touch;
+}
+
+#mainPanel {
+  @apply(--layout-vertical);
+  @apply(--layout-flex);
+
+  position: relative;
+}
+
+/*
+ * mode: scroll
+ */
+:host([mode=scroll]) #mainContainer {
+  @apply(--paper-header-panel-scroll-container);
+
+  overflow: visible;
+}
+
+:host([mode=scroll]) {
+  overflow-y: auto;
+  overflow-x: hidden;
+  -webkit-overflow-scrolling: touch;
+}
+
+/*
+ * mode: cover
+ */
+:host([mode=cover]) #mainContainer {
+  @apply(--paper-header-panel-cover-container);
+
+  position: absolute;
+  top: 0;
+  right: 0;
+  bottom: 0;
+  left: 0;
+}
+
+:host([mode=cover]) #mainPanel {
+  position: static;
+}
+
+/*
+ * mode: standard
+ */
+:host([mode=standard]) #mainContainer {
+  @apply(--paper-header-panel-standard-container);
+}
+
+/*
+ * mode: seamed
+ */
+:host([mode=seamed]) #mainContainer {
+  @apply(--paper-header-panel-seamed-container);
+}
+
+
+/*
+ * mode: waterfall
+ */
+:host([mode=waterfall]) #mainContainer {
+  @apply(--paper-header-panel-waterfall-container);
+}
+
+/*
+ * mode: waterfall-tall
+ */
+:host([mode=waterfall-tall]) #mainContainer {
+  @apply(--paper-header-panel-waterfall-tall-container);
+}
+
+#dropShadow {
+  @apply(--paper-header-panel-shadow);
+
+  position: absolute;
+  top: 0;
+  left: 0;
+  right: 0;
+  height: 6px;
+  pointer-events: none;
+
+  -webkit-transition: opacity 0.5s;
+  transition: opacity 0.5s;
+
+  opacity: 0;
+}
+
+#dropShadow.has-shadow {
+  opacity: 1;
+}
+
+</style>
+
+  <template>
+    <content id="headerContent" select="paper-toolbar, .paper-header"></content>
+
+    <div id="mainPanel">
+      <div id="mainContainer" class$="[[_computeMainContainerClass(mode)]]">
+        <content id="mainContent" select="*"></content>
+      </div>
+      <div id="dropShadow"></div>
+    </div>
+  </template>
+
+</dom-module>
+
+<dom-module id="paper-material" assetpath="chrome://resources/polymer/v1_0/paper-material/">
+  <style>
+    :host {
+      display: block;
+      position: relative;
+    }
+
+    :host([animated]) {
+      @apply(--shadow-transition);
+    }
+
+    :host([elevation="1"]) {
+      @apply(--shadow-elevation-2dp);
+    }
+
+    :host([elevation="2"]) {
+      @apply(--shadow-elevation-4dp);
+    }
+
+    :host([elevation="3"]) {
+      @apply(--shadow-elevation-6dp);
+    }
+
+    :host([elevation="4"]) {
+      @apply(--shadow-elevation-8dp);
+    }
+
+    :host([elevation="5"]) {
+      @apply(--shadow-elevation-16dp);
+    }
+  </style>
+  <template>
+    <content></content>
+  </template>
+</dom-module>
+<dom-module id="paper-ripple" assetpath="chrome://resources/polymer/v1_0/paper-ripple/">
+
+  
+  
+  <template>
+    <style>
+      :host {
+        display: block;
+        position: absolute;
+        border-radius: inherit;
+        overflow: hidden;
+        top: 0;
+        left: 0;
+        right: 0;
+        bottom: 0;
+      }
+  
+      :host([animating]) {
+        /* This resolves a rendering issue in Chrome (as of 40) where the
+           ripple is not properly clipped by its parent (which may have
+           rounded corners). See: http://jsbin.com/temexa/4
+  
+           Note: We only apply this style conditionally. Otherwise, the browser
+           will create a new compositing layer for every ripple element on the
+           page, and that would be bad. */
+        -webkit-transform: translate(0, 0);
+        transform: translate3d(0, 0, 0);
+      }
+  
+      :host([noink]) {
+        pointer-events: none;
+      }
+  
+      #background,
+      #waves,
+      .wave-container,
+      .wave {
+        pointer-events: none;
+        position: absolute;
+        top: 0;
+        left: 0;
+        width: 100%;
+        height: 100%;
+      }
+  
+      #background,
+      .wave {
+        opacity: 0;
+      }
+  
+      #waves,
+      .wave {
+        overflow: hidden;
+      }
+  
+      .wave-container,
+      .wave {
+        border-radius: 50%;
+      }
+  
+      :host(.circle) #background,
+      :host(.circle) #waves {
+        border-radius: 50%;
+      }
+  
+      :host(.circle) .wave-container {
+        overflow: hidden;
+      }
+    </style>
+    
+    <div id="background"></div>
+    <div id="waves"></div>
+  </template>
+</dom-module>
+<dom-module id="paper-button" assetpath="chrome://resources/polymer/v1_0/paper-button/">
+  <template>
+
+    <style>
+      :host {
+        display: inline-block;
+        position: relative;
+        box-sizing: border-box;
+        min-width: 5.14em;
+        margin: 0 0.29em;
+        background: transparent;
+        text-align: center;
+        font: inherit;
+        text-transform: uppercase;
+        outline-width: 0;
+        border-radius: 3px;
+        -moz-user-select: none;
+        -ms-user-select: none;
+        -webkit-user-select: none;
+        user-select: none;
+        cursor: pointer;
+        z-index: 0;
+        padding: 0.7em 0.57em;
+
+        @apply(--paper-button);
+      }
+
+      :host([raised]) .keyboard-focus {
+        font-weight: bold;
+        @apply(--paper-button-raised-keyboard-focus);
+      }
+
+      :host(:not([raised])) .keyboard-focus {
+        font-weight: bold;
+        @apply(--paper-button-flat-keyboard-focus);
+      }
+
+      :host([disabled]) {
+        background: #eaeaea;
+        color: #a8a8a8;
+        cursor: auto;
+        pointer-events: none;
+
+        @apply(--paper-button-disabled);
+      }
+
+      :host([noink]) paper-ripple {
+        display: none;
+      }
+
+      paper-ripple {
+        color: var(--paper-button-ink-color);
+      }
+
+      paper-material {
+        border-radius: inherit;
+        @apply(--layout-fit);
+      }
+
+      .content > ::content * {
+        text-transform: inherit;
+      }
+    </style>
+
+    <paper-ripple></paper-ripple>
+
+    <paper-material elevation="[[_elevation]]" animated=""></paper-material>
+
+    <div class$="[[_computeContentClass(receivedFocusFromKeyboard)]]">
+      <content></content>
+    </div>
+
+  </template>
+</dom-module>
+
+<dom-module id="paper-progress" assetpath="chrome://resources/polymer/v1_0/paper-progress/">
+  <style>
+    :host {
+      display: block;
+      width: 200px;
+      position: relative;
+      overflow: hidden;
+    }
+
+    #progressContainer {
+      position: relative;
+    }
+
+    #progressContainer,
+    /* the stripe for the indeterminate animation*/
+    .indeterminate:after {
+      height: var(--paper-progress-height, 4px);
+    }
+
+    #primaryProgress,
+    #secondaryProgress,
+    .indeterminate:after {
+      @apply(--layout-fit);
+    }
+
+    #progressContainer,
+    .indeterminate:after {
+      background-color: var(--paper-progress-container-color, --google-grey-300);
+    }
+
+    :host(.transiting) #primaryProgress,
+    :host(.transiting) #secondaryProgress {
+      -webkit-transition-property: -webkit-transform;
+      transition-property: transform;
+
+      /* Duration */
+      -webkit-transition-duration: var(--paper-progress-transition-duration, 0.08s);
+      transition-duration: var(--paper-progress-transition-duration, 0.08s);
+
+      /* Timing function */
+      -webkit-transition-timing-function: var(--paper-progress-transition-timing-function, ease);
+      transition-timing-function: var(--paper-progress-transition-timing-function, ease);
+
+      /* Delay */
+      -webkit-transition-delay: var(--paper-progress-transition-delay, 0s);
+      transition-delay: var(--paper-progress-transition-delay, 0s);
+    }
+
+    #primaryProgress,
+    #secondaryProgress {
+      @apply(--layout-fit);
+      -webkit-transform-origin: left center;
+      transform-origin: left center;
+      -webkit-transform: scaleX(0);
+      transform: scaleX(0);
+      will-change: transform;
+    }
+
+    #primaryProgress {
+      background-color: var(--paper-progress-active-color, --google-green-500);
+    }
+
+    #secondaryProgress {
+      position: relative;
+      background-color: var(--paper-progress-secondary-color, --google-green-100);
+    }
+
+    :host([disabled]) #primaryProgress {
+      background-color: var(--paper-progress-disabled-active-color, --google-grey-500);
+    }
+
+    :host([disabled]) #secondaryProgress {
+      background-color: var(--paper-progress-disabled-active-color, --google-grey-300);
+    }
+
+    :host(:not([disabled])) #primaryProgress.indeterminate {
+      -webkit-transform-origin: right center;
+      transform-origin: right center;
+      -webkit-animation: indeterminate-bar 2s linear infinite;
+      animation: indeterminate-bar 2s linear infinite;
+    }
+
+    :host(:not([disabled])) #primaryProgress.indeterminate:after {
+      content: "";
+      -webkit-transform-origin: center center;
+      transform-origin: center center;
+
+      -webkit-animation: indeterminate-splitter 2s linear infinite;
+      animation: indeterminate-splitter 2s linear infinite;
+    }
+
+    @-webkit-keyframes indeterminate-bar {
+      0% {
+        -webkit-transform: scaleX(1) translateX(-100%);
+      }
+      50% {
+        -webkit-transform: scaleX(1) translateX(0%);
+      }
+      75% {
+        -webkit-transform: scaleX(1) translateX(0%);
+        -webkit-animation-timing-function: cubic-bezier(.28,.62,.37,.91);
+      }
+      100% {
+        -webkit-transform: scaleX(0) translateX(0%);
+      }
+    }
+
+    @-webkit-keyframes indeterminate-splitter {
+      0% {
+        -webkit-transform: scaleX(.75) translateX(-125%);
+      }
+      30% {
+        -webkit-transform: scaleX(.75) translateX(-125%);
+        -webkit-animation-timing-function: cubic-bezier(.42,0,.6,.8);
+      }
+      90% {
+        -webkit-transform: scaleX(.75) translateX(125%);
+      }
+      100% {
+        -webkit-transform: scaleX(.75) translateX(125%);
+      }
+    }
+
+    @keyframes indeterminate-bar {
+      0% {
+        transform: scaleX(1) translateX(-100%);
+      }
+      50% {
+        transform: scaleX(1) translateX(0%);
+      }
+      75% {
+        transform: scaleX(1) translateX(0%);
+        animation-timing-function: cubic-bezier(.28,.62,.37,.91);
+      }
+      100% {
+        transform: scaleX(0) translateX(0%);
+      }
+    }
+
+    @keyframes indeterminate-splitter {
+      0% {
+        transform: scaleX(.75) translateX(-125%);
+      }
+      30% {
+        transform: scaleX(.75) translateX(-125%);
+        animation-timing-function: cubic-bezier(.42,0,.6,.8);
+      }
+      90% {
+        transform: scaleX(.75) translateX(125%);
+      }
+      100% {
+        transform: scaleX(.75) translateX(125%);
+      }
+    }
+  </style>
+  <template>
+    <div id="progressContainer">
+      <div id="secondaryProgress" hidden$="[[_hideSecondaryProgress(secondaryRatio)]]"></div>
+      <div id="primaryProgress"></div>
+    </div>
+  </template>
+</dom-module>
+
+<dom-module id="downloads-item" assetpath="chrome://downloads/">
+  <template>
+    <template is="dom-if" if="[[!hideDate]]">
+      <h3 id="date">[[computeDate_(data.since_string, data.date_string)]]</h3>
+    </template>
+
+    <div id="content" on-dragstart="onDragStart_" class$="[[computeClass_(isActive_, isDangerous_, showProgress_)]]">
+      <div id="file-icon-wrapper" class="icon-wrapper">
+        <img class="icon" id="file-icon" alt="" hidden="[[isDangerous_]]">
+        <div class="icon" id="warning" hidden="[[!isDangerous_]]"></div>
+      </div>
+
+      <div id="details">
+        <div id="title-area"><a is="action-link" id="file-link" href="[[data.url]]" on-click="onFileLinkClick_" hidden="[[!completelyOnDisk_]]">[[data.file_name]]</a><span id="name" hidden="[[completelyOnDisk_]]">[[data.file_name]]</span>
+          <span id="tag">[[computeTag_(data.state, data.last_reason_text, data.file_externally_removed)]]</span>
+        </div>
+
+        <a id="url" target="_blank" href="[[data.url]]">[[data.url]]</a>
+
+        <div id="description">[[computeDescription_(data.state, data.danger_type, data.file_name, data.progress_status_text)]]</div>
+
+        <template is="dom-if" if="[[showProgress_]]">
+          <paper-progress id="progress" indeterminate="[[isIndeterminate_(data.percent)]]" value="[[data.percent]]"></paper-progress>
+        </template>
+
+        <div id="safe" class="controls" hidden="[[isDangerous_]]">
+          <a is="action-link" id="show" i18n-content="controlShowInFolder" on-click="onShowClick_" hidden="[[!completelyOnDisk_]]"></a>
+          <template is="dom-if" if="[[data.retry]]">
+            <paper-button id="retry" on-click="onRetryClick_">[[i18n_.retry]]</paper-button>
+          </template>
+          <template is="dom-if" if="[[isInProgress_]]">
+            <paper-button id="pause" on-click="onPauseClick_">[[i18n_.pause]]</paper-button>
+          </template>
+          <template is="dom-if" if="[[data.resume]]">
+            <paper-button id="resume" on-click="onResumeClick_">[[i18n_.resume]]</paper-button>
+          </template>
+          <template is="dom-if" if="[[showCancel_]]">
+            <paper-button id="cancel" on-click="onCancelClick_">[[i18n_.cancel]]</paper-button>
+          </template>
+          <span id="controlled-by"></span>
+        </div>
+
+        <template is="dom-if" if="[[isDangerous_]]">
+          <div id="dangerous" class="controls">
+            
+            <template is="dom-if" if="[[!isMalware_]]">
+              <paper-button id="discard" on-click="onDiscardDangerous_" class="discard">[[i18n_.discard]]</paper-button>
+              <paper-button id="save" on-click="onSaveDangerous_" class="keep">[[i18n_.save]]</paper-button>
+            </template>
+
+            
+            <template is="dom-if" if="[[isMalware_]]">
+              <paper-button id="danger-remove" on-click="onDiscardDangerous_" class="discard">[[i18n_.remove]]</paper-button>
+              <paper-button id="restore" on-click="onSaveDangerous_" class="keep">[[i18n_.restore]</paper-button>
+            </template>
+          </div>
+        </template>
+      </div>
+
+      <div id="remove-wrapper" class="icon-wrapper">
+        <paper-icon-button id="remove" icon="clear" i18n-values="title:controlRemoveFromList" style$="[[computeRemoveStyle_(isDangerous_, showCancel_)]]" on-click="onRemoveClick_"></paper-icon-button>
+      </div>
+
+      <div id="incognito" i18n-values="title:inIncognito" hidden="[[!data.otr]]"></div>
+    </div>
+
+  </template>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+[is='action-link'] {
+  cursor: pointer;
+  display: inline-block;
+  text-decoration: none;
+}
+
+[is='action-link']:hover {
+  text-decoration: underline;
+}
+
+[is='action-link']:active {
+  color: rgb(5, 37, 119);
+  text-decoration: underline;
+}
+
+[is='action-link'][disabled] {
+  color: #999;
+  cursor: default;
+  pointer-events: none;
+  text-decoration: none;
+}
+
+[is='action-link'].no-outline {
+  outline: none;
+}
+
+</style>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+* {
+  --downloads-item-width: 622px;
+}
+
+paper-button {
+  font-weight: 500;
+  margin: 0;
+  min-width: auto;
+}
+
+</style>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+:host {
+  display: flex;
+  flex-direction: column;
+  margin: 12px 0;
+}
+
+#date {
+  color: #7c7c7c;
+  font-size: 100%;
+  font-weight: 500;
+  margin: 18px auto 16px;  /* This top margin + :host top margin = 30px. */
+  width: var(--downloads-item-width);
+}
+
+#content {
+  background: white;
+  border-radius: 2px;
+  display: flex;
+  flex: none;
+  margin: 0 auto;
+  min-height: 103px;
+  position: relative;
+  width: var(--downloads-item-width);
+}
+
+#content.is-active {
+  box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .05), 0 1px 4px 0 rgba(0, 0, 0, .08),
+              0 3px 1px -2px rgba(0, 0, 0, .2);
+}
+
+#content:not(.is-active) {
+  opacity: .6;
+}
+
+#details {
+  -webkit-border-start: 1px #d8d8d8 solid;
+  -webkit-padding-end: 16px;
+  -webkit-padding-start: 24px;
+  display: flex;
+  flex: 1;
+  flex-direction: column;
+  padding-bottom: 12px;
+  padding-top: 16px;
+}
+
+#content:not(.is-active) #details {
+  color: #bababa;
+}
+
+#content:not(.is-active) #name {
+  text-decoration: line-through;
+}
+
+.icon-wrapper {
+  align-self: center;
+  flex: none;
+  justify-content: center;
+  margin: 0 24px;
+}
+
+.icon {
+  height: 32px;
+  width: 32px;
+}
+
+#content:-webkit-any(.show-progress, .dangerous) #file-icon-wrapper {
+  /* TODO(dbeam): animate from top-aligned to centered when items finish? */
+  align-self: flex-start;
+  padding-top: 16px;
+}
+
+#content:not(.is-active) .icon {
+  -webkit-filter: grayscale(100%);
+  opacity: .5;
+}
+
+#warning {
+  -webkit-mask-image: url("chrome://resources/images/warning.svg");
+  -webkit-mask-repeat: no-repeat;
+  -webkit-mask-size: 100%;
+  background: rgb(255, 193, 7);
+}
+
+#name,
+#file-link,
+#url {
+  max-width: 100%;
+}
+
+#name,
+#file-link {
+  font-weight: 500;
+  word-break: break-all;
+}
+
+#name {
+  -webkit-margin-end: 12px;  /* Only really affects #tag. */
+}
+
+.is-active :-webkit-any(#name, #file-link, #pause, #resume, #show) {
+  color: rgb(51, 103, 214);
+}
+
+#tag {
+  color: #5a5a5a;
+  font-weight: 500;
+}
+
+#url {
+  color: inherit;
+  margin-top: 6px;
+  overflow: hidden;
+  text-decoration: none;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+}
+
+.is-active #url {
+  color: #969696;
+}
+
+#progress,
+#description:not(:empty),
+.controls {
+  margin-top: 16px;
+}
+
+.is-active #description {
+  color: #616161;
+}
+
+.dangerous #description {
+  color: rgb(239, 108, 0);
+}
+
+#progress {
+  --paper-progress-active-color: rgb(54, 126, 237);
+  --paper-progress-container-color: rgb(223, 222, 223);
+  width: auto;
+}
+
+.controls {
+  -webkit-margin-start: -.57em;
+}
+
+#cancel,
+#retry,
+.keep,
+.discard {
+  color: #5a5a5a;
+}
+
+#show {
+  margin: .7em .57em;
+}
+
+#controlled-by {
+  -webkit-margin-start: 8px;
+}
+
+#controlled-by,
+#controlled-by a {
+  color: #5a5a5a;
+}
+
+.is-active #controlled-by {
+  color: #333;
+}
+
+.is-active #controlled-by a {
+  color: rgb(51, 103, 214);
+}
+
+#remove-wrapper {
+  align-self: flex-start;
+  margin: 0;
+}
+
+#remove {
+  --iron-icon-height: 16px;
+  --iron-icon-width: 16px;
+  --layout-inline: {
+    /* HACK(dbeam): we probably shouldn't be overriding Polymer like this. */
+  };
+  color: #969696;
+  height: 16px;
+  padding: 8px;
+  width: 16px;
+}
+
+#incognito {
+  bottom: 20px;
+  content: -webkit-image-set(
+      url("chrome://downloads/1x/incognito_marker.png") 1x,
+      url("chrome://downloads/2x/incognito_marker.png") 2x);
+  position: absolute;
+  right: 10px;
+}
+
+</style>
+  </dom-module>
+<dom-module id="iron-icon" assetpath="chrome://resources/polymer/v1_0/iron-icon/">
+
+  <style>
+    :host {
+      @apply(--layout-inline);
+      @apply(--layout-center-center);
+      position: relative;
+
+      vertical-align: middle;
+
+      fill: currentcolor;
+
+      width: var(--iron-icon-width, 24px);
+      height: var(--iron-icon-height, 24px);
+    }
+  </style>
+
+  <template>
+  </template>
+
+  </dom-module>
+<iron-iconset-svg name="icons" size="24">
+<svg><defs>
+<g id="3d-rotation"><path d="M7.52 21.48C4.25 19.94 1.91 16.76 1.55 13H.05C.56 19.16 5.71 24 12 24l.66-.03-3.81-3.81-1.33 1.32zm.89-6.52c-.19 0-.37-.03-.52-.08-.16-.06-.29-.13-.4-.24-.11-.1-.2-.22-.26-.37-.06-.14-.09-.3-.09-.47h-1.3c0 .36.07.68.21.95.14.27.33.5.56.69.24.18.51.32.82.41.3.1.62.15.96.15.37 0 .72-.05 1.03-.15.32-.1.6-.25.83-.44s.42-.43.55-.72c.13-.29.2-.61.2-.97 0-.19-.02-.38-.07-.56-.05-.18-.12-.35-.23-.51-.1-.16-.24-.3-.4-.43-.17-.13-.37-.23-.61-.31.2-.09.37-.2.52-.33.15-.13.27-.27.37-.42.1-.15.17-.3.22-.46.05-.16.07-.32.07-.48 0-.36-.06-.68-.18-.96-.12-.28-.29-.51-.51-.69-.2-.19-.47-.33-.77-.43C9.1 8.05 8.76 8 8.39 8c-.36 0-.69.05-1 .16-.3.11-.57.26-.79.45-.21.19-.38.41-.51.67-.12.26-.18.54-.18.85h1.3c0-.17.03-.32.09-.45s.14-.25.25-.34c.11-.09.23-.17.38-.22.15-.05.3-.08.48-.08.4 0 .7.1.89.31.19.2.29.49.29.86 0 .18-.03.34-.08.49-.05.15-.14.27-.25.37-.11.1-.25.18-.41.24-.16.06-.36.09-.58.09H7.5v1.03h.77c.22 0 .42.02.6.07s.33.13.45.23c.12.11.22.24.29.4.07.16.1.35.1.57 0 .41-.12.72-.35.93-.23.23-.55.33-.95.33zm8.55-5.92c-.32-.33-.7-.59-1.14-.77-.43-.18-.92-.27-1.46-.27H12v8h2.3c.55 0 1.06-.09 1.51-.27.45-.18.84-.43 1.16-.76.32-.33.57-.73.74-1.19.17-.47.26-.99.26-1.57v-.4c0-.58-.09-1.1-.26-1.57-.18-.47-.43-.87-.75-1.2zm-.39 3.16c0 .42-.05.79-.14 1.13-.1.33-.24.62-.43.85-.19.23-.43.41-.71.53-.29.12-.62.18-.99.18h-.91V9.12h.97c.72 0 1.27.23 1.64.69.38.46.57 1.12.57 1.99v.4zM12 0l-.66.03 3.81 3.81 1.33-1.33c3.27 1.55 5.61 4.72 5.96 8.48h1.5C23.44 4.84 18.29 0 12 0z"></path></g>
+<g id="accessibility"><path d="M12 2c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm9 7h-6v13h-2v-6h-2v6H9V9H3V7h18v2z"></path></g>
+<g id="account-balance"><path d="M4 10v7h3v-7H4zm6 0v7h3v-7h-3zM2 22h19v-3H2v3zm14-12v7h3v-7h-3zm-4.5-9L2 6v2h19V6l-9.5-5z"></path></g>
+<g id="account-balance-wallet"><path d="M21 18v1c0 1.1-.9 2-2 2H5c-1.11 0-2-.9-2-2V5c0-1.1.89-2 2-2h14c1.1 0 2 .9 2 2v1h-9c-1.11 0-2 .9-2 2v8c0 1.1.89 2 2 2h9zm-9-2h10V8H12v8zm4-2.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path></g>
+<g id="account-box"><path d="M3 5v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2zm12 4c0 1.66-1.34 3-3 3s-3-1.34-3-3 1.34-3 3-3 3 1.34 3 3zm-9 8c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1H6v-1z"></path></g>
+<g id="account-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"></path></g>
+<g id="add"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"></path></g>
+<g id="add-alert"><path d="M10.01 21.01c0 1.1.89 1.99 1.99 1.99s1.99-.89 1.99-1.99h-3.98zm8.87-4.19V11c0-3.25-2.25-5.97-5.29-6.69v-.72C13.59 2.71 12.88 2 12 2s-1.59.71-1.59 1.59v.72C7.37 5.03 5.12 7.75 5.12 11v5.82L3 18.94V20h18v-1.06l-2.12-2.12zM16 13.01h-3v3h-2v-3H8V11h3V8h2v3h3v2.01z"></path></g>
+<g id="add-box"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"></path></g>
+<g id="add-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11h-4v4h-2v-4H7v-2h4V7h2v4h4v2z"></path></g>
+<g id="add-circle-outline"><path d="M13 7h-2v4H7v2h4v4h2v-4h4v-2h-4V7zm-1-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
+<g id="add-shopping-cart"><path d="M11 9h2V6h3V4h-3V1h-2v3H8v2h3v3zm-4 9c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zm10 0c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2zm-9.83-3.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.86-7.01L19.42 4h-.01l-1.1 2-2.76 5H8.53l-.13-.27L6.16 6l-.95-2-.94-2H1v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.13 0-.25-.11-.25-.25z"></path></g>
+<g id="alarm"><path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12.5 8H11v6l4.75 2.85.75-1.23-4-2.37V8zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"></path></g>
+<g id="alarm-add"><path d="M7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm1-11h-2v3H8v2h3v3h2v-3h3v-2h-3V9z"></path></g>
+<g id="alarm-off"><path d="M12 6c3.87 0 7 3.13 7 7 0 .84-.16 1.65-.43 2.4l1.52 1.52c.58-1.19.91-2.51.91-3.92 0-4.97-4.03-9-9-9-1.41 0-2.73.33-3.92.91L9.6 6.43C10.35 6.16 11.16 6 12 6zm10-.28l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM2.92 2.29L1.65 3.57 2.98 4.9l-1.11.93 1.42 1.42 1.11-.94.8.8C3.83 8.69 3 10.75 3 13c0 4.97 4.02 9 9 9 2.25 0 4.31-.83 5.89-2.2l2.2 2.2 1.27-1.27L3.89 3.27l-.97-.98zm13.55 16.1C15.26 19.39 13.7 20 12 20c-3.87 0-7-3.13-7-7 0-1.7.61-3.26 1.61-4.47l9.86 9.86zM8.02 3.28L6.6 1.86l-.86.71 1.42 1.42.86-.71z"></path></g>
+<g id="alarm-on"><path d="M22 5.72l-4.6-3.86-1.29 1.53 4.6 3.86L22 5.72zM7.88 3.39L6.6 1.86 2 5.71l1.29 1.53 4.59-3.85zM12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9c4.97 0 9-4.03 9-9s-4.03-9-9-9zm0 16c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7zm-1.46-5.47L8.41 12.4l-1.06 1.06 3.18 3.18 6-6-1.06-1.06-4.93 4.95z"></path></g>
+<g id="android"><path d="M6 18c0 .55.45 1 1 1h1v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h2v3.5c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5V19h1c.55 0 1-.45 1-1V8H6v10zM3.5 8C2.67 8 2 8.67 2 9.5v7c0 .83.67 1.5 1.5 1.5S5 17.33 5 16.5v-7C5 8.67 4.33 8 3.5 8zm17 0c-.83 0-1.5.67-1.5 1.5v7c0 .83.67 1.5 1.5 1.5s1.5-.67 1.5-1.5v-7c0-.83-.67-1.5-1.5-1.5zm-4.97-5.84l1.3-1.3c.2-.2.2-.51 0-.71-.2-.2-.51-.2-.71 0l-1.48 1.48C13.85 1.23 12.95 1 12 1c-.96 0-1.86.23-2.66.63L7.85.15c-.2-.2-.51-.2-.71 0-.2.2-.2.51 0 .71l1.31 1.31C6.97 3.26 6 5.01 6 7h12c0-1.99-.97-3.75-2.47-4.84zM10 5H9V4h1v1zm5 0h-1V4h1v1z"></path></g>
+<g id="announcement"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 9h-2V5h2v6zm0 4h-2v-2h2v2z"></path></g>
+<g id="apps"><path d="M4 8h4V4H4v4zm6 12h4v-4h-4v4zm-6 0h4v-4H4v4zm0-6h4v-4H4v4zm6 0h4v-4h-4v4zm6-10v4h4V4h-4zm-6 4h4V4h-4v4zm6 6h4v-4h-4v4zm0 6h4v-4h-4v4z"></path></g>
+<g id="archive"><path d="M20.54 5.23l-1.39-1.68C18.88 3.21 18.47 3 18 3H6c-.47 0-.88.21-1.16.55L3.46 5.23C3.17 5.57 3 6.02 3 6.5V19c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V6.5c0-.48-.17-.93-.46-1.27zM12 17.5L6.5 12H10v-2h4v2h3.5L12 17.5zM5.12 5l.81-1h12l.94 1H5.12z"></path></g>
+<g id="arrow-back"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path></g>
+<g id="arrow-drop-down"><path d="M7 10l5 5 5-5z"></path></g>
+<g id="arrow-drop-down-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 12l-4-4h8l-4 4z"></path></g>
+<g id="arrow-drop-up"><path d="M7 14l5-5 5 5z"></path></g>
+<g id="arrow-forward"><path d="M12 4l-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"></path></g>
+<g id="aspect-ratio"><path d="M19 12h-2v3h-3v2h5v-5zM7 9h3V7H5v5h2V9zm14-6H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z"></path></g>
+<g id="assessment"><path d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z"></path></g>
+<g id="assignment"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm2 14H7v-2h7v2zm3-4H7v-2h10v2zm0-4H7V7h10v2z"></path></g>
+<g id="assignment-ind"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm0 4c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm6 12H6v-1.4c0-2 4-3.1 6-3.1s6 1.1 6 3.1V19z"></path></g>
+<g id="assignment-late"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-6 15h-2v-2h2v2zm0-4h-2V8h2v6zm-1-9c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1z"></path></g>
+<g id="assignment-return"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm4 12h-4v3l-5-5 5-5v3h4v4z"></path></g>
+<g id="assignment-returned"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm0 15l-5-5h3V9h4v4h3l-5 5z"></path></g>
+<g id="assignment-turned-in"><path d="M19 3h-4.18C14.4 1.84 13.3 1 12 1c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm-2 14l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"></path></g>
+<g id="attachment"><path d="M7.5 18C4.46 18 2 15.54 2 12.5S4.46 7 7.5 7H18c2.21 0 4 1.79 4 4s-1.79 4-4 4H9.5C8.12 15 7 13.88 7 12.5S8.12 10 9.5 10H17v1.5H9.5c-.55 0-1 .45-1 1s.45 1 1 1H18c1.38 0 2.5-1.12 2.5-2.5S19.38 8.5 18 8.5H7.5c-2.21 0-4 1.79-4 4s1.79 4 4 4H17V18H7.5z"></path></g>
+<g id="autorenew"><path d="M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6zm6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26z"></path></g>
+<g id="backspace"><path d="M22 3H7c-.69 0-1.23.35-1.59.88L0 12l5.41 8.11c.36.53.9.89 1.59.89h15c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-3 12.59L17.59 17 14 13.41 10.41 17 9 15.59 12.59 12 9 8.41 10.41 7 14 10.59 17.59 7 19 8.41 15.41 12 19 15.59z"></path></g>
+<g id="backup"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path></g>
+<g id="block"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z"></path></g>
+<g id="book"><path d="M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4z"></path></g>
+<g id="bookmark"><path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2z"></path></g>
+<g id="bookmark-border"><path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15l-5-2.18L7 18V5h10v13z"></path></g>
+<g id="bug-report"><path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5c-.49 0-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"></path></g>
+<g id="build"><path d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"></path></g>
+<g id="cached"><path d="M19 8l-4 4h3c0 3.31-2.69 6-6 6-1.01 0-1.97-.25-2.8-.7l-1.46 1.46C8.97 19.54 10.43 20 12 20c4.42 0 8-3.58 8-8h3l-4-4zM6 12c0-3.31 2.69-6 6-6 1.01 0 1.97.25 2.8.7l1.46-1.46C15.03 4.46 13.57 4 12 4c-4.42 0-8 3.58-8 8H1l4 4 4-4H6z"></path></g>
+<g id="camera-enhance"><path d="M9 3L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2h-3.17L15 3H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zM12 17l1.25-2.75L16 13l-2.75-1.25L12 9l-1.25 2.75L8 13l2.75 1.25z"></path></g>
+<g id="cancel"><path d="M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z"></path></g>
+<g id="card-giftcard"><path d="M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm11 15H4v-2h16v2zm0-5H4V8h5.08L7 10.83 8.62 12 11 8.76l1-1.36 1 1.36L15.38 12 17 10.83 14.92 8H20v6z"></path></g>
+<g id="card-membership"><path d="M20 2H4c-1.11 0-2 .89-2 2v11c0 1.11.89 2 2 2h4v5l4-2 4 2v-5h4c1.11 0 2-.89 2-2V4c0-1.11-.89-2-2-2zm0 13H4v-2h16v2zm0-5H4V4h16v6z"></path></g>
+<g id="card-travel"><path d="M20 6h-3V4c0-1.11-.89-2-2-2H9c-1.11 0-2 .89-2 2v2H4c-1.11 0-2 .89-2 2v11c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zM9 4h6v2H9V4zm11 15H4v-2h16v2zm0-5H4V8h3v2h2V8h6v2h2V8h3v6z"></path></g>
+<g id="change-history"><path d="M12 7.77L18.39 18H5.61L12 7.77M12 4L2 20h20L12 4z"></path></g>
+<g id="check"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"></path></g>
+<g id="check-box"><path d="M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path></g>
+<g id="check-box-outline-blank"><path d="M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path></g>
+<g id="check-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path></g>
+<g id="chevron-left"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"></path></g>
+<g id="chevron-right"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"></path></g>
+<g id="chrome-reader-mode"><path d="M13 12h7v1.5h-7zm0-2.5h7V11h-7zm0 5h7V16h-7zM21 4H3c-1.1 0-2 .9-2 2v13c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 15h-9V6h9v13z"></path></g>
+<g id="class"><path d="M18 2H6c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM6 4h5v8l-2.5-1.5L6 12V4z"></path></g>
+<g id="clear"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></g>
+<g id="close"><path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"></path></g>
+<g id="cloud"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96z"></path></g>
+<g id="cloud-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm4.5 14H8c-1.66 0-3-1.34-3-3s1.34-3 3-3l.14.01C8.58 8.28 10.13 7 12 7c2.21 0 4 1.79 4 4h.5c1.38 0 2.5 1.12 2.5 2.5S17.88 16 16.5 16z"></path></g>
+<g id="cloud-done"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM10 17l-3.5-3.5 1.41-1.41L10 14.17 15.18 9l1.41 1.41L10 17z"></path></g>
+<g id="cloud-download"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM17 13l-5 5-5-5h3V9h4v4h3z"></path></g>
+<g id="cloud-off"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4c-1.48 0-2.85.43-4.01 1.17l1.46 1.46C10.21 6.23 11.08 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3 0 1.13-.64 2.11-1.56 2.62l1.45 1.45C23.16 18.16 24 16.68 24 15c0-2.64-2.05-4.78-4.65-4.96zM3 5.27l2.75 2.74C2.56 8.15 0 10.77 0 14c0 3.31 2.69 6 6 6h11.73l2 2L21 20.73 4.27 4 3 5.27zM7.73 10l8 8H6c-2.21 0-4-1.79-4-4s1.79-4 4-4h1.73z"></path></g>
+<g id="cloud-queue"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM19 18H6c-2.21 0-4-1.79-4-4s1.79-4 4-4h.71C7.37 7.69 9.48 6 12 6c3.04 0 5.5 2.46 5.5 5.5v.5H19c1.66 0 3 1.34 3 3s-1.34 3-3 3z"></path></g>
+<g id="cloud-upload"><path d="M19.35 10.04C18.67 6.59 15.64 4 12 4 9.11 4 6.6 5.64 5.35 8.04 2.34 8.36 0 10.91 0 14c0 3.31 2.69 6 6 6h13c2.76 0 5-2.24 5-5 0-2.64-2.05-4.78-4.65-4.96zM14 13v4h-4v-4H7l5-5 5 5h-3z"></path></g>
+<g id="code"><path d="M9.4 16.6L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4zm5.2 0l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4z"></path></g>
+<g id="content-copy"><path d="M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12V1zm3 4H8c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h11c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm0 16H8V7h11v14z"></path></g>
+<g id="content-cut"><path d="M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3z"></path></g>
+<g id="content-paste"><path d="M19 2h-4.18C14.4.84 13.3 0 12 0c-1.3 0-2.4.84-2.82 2H5c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 0c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm7 18H5V4h2v3h10V4h2v16z"></path></g>
+<g id="create"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></g>
+<g id="credit-card"><path d="M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"></path></g>
+<g id="dashboard"><path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"></path></g>
+<g id="delete"><path d="M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12zM19 4h-3.5l-1-1h-5l-1 1H5v2h14V4z"></path></g>
+<g id="description"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"></path></g>
+<g id="dns"><path d="M20 13H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zM7 19c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zM20 3H4c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h16c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1zM7 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></g>
+<g id="done"><path d="M9 16.2L4.8 12l-1.4 1.4L9 19 21 7l-1.4-1.4L9 16.2z"></path></g>
+<g id="done-all"><path d="M18 7l-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41L6 19l1.41-1.41L1.83 12 .41 13.41z"></path></g>
+<g id="drafts"><path d="M21.99 8c0-.72-.37-1.35-.94-1.7L12 1 2.95 6.3C2.38 6.65 2 7.28 2 8v10c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2l-.01-10zM12 13L3.74 7.84 12 3l8.26 4.84L12 13z"></path></g>
+<g id="eject"><path d="M5 17h14v2H5zm7-12L5.33 15h13.34z"></path></g>
+<g id="error"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"></path></g>
+<g id="error-outline"><path d="M11 15h2v2h-2zm0-8h2v6h-2zm.99-5C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></g>
+<g id="event"><path d="M17 12h-5v5h5v-5zM16 1v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-1V1h-2zm3 18H5V8h14v11z"></path></g>
+<g id="event-seat"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M4 18v3h3v-3h10v3h3v-6H4zm15-8h3v3h-3zM2 10h3v3H2zm15 3H7V5c0-1.1.9-2 2-2h6c1.1 0 2 .9 2 2v8z" clip-path="url(#b)"></path></g>
+<g id="exit-to-app"><path d="M10.09 15.59L11.5 17l5-5-5-5-1.41 1.41L12.67 11H3v2h9.67l-2.58 2.59zM19 3H5c-1.11 0-2 .9-2 2v4h2V5h14v14H5v-4H3v4c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"></path></g>
+<g id="expand-less"><path d="M12 8l-6 6 1.41 1.41L12 10.83l4.59 4.58L18 14z"></path></g>
+<g id="expand-more"><path d="M16.59 8.59L12 13.17 7.41 8.59 6 10l6 6 6-6z"></path></g>
+<g id="explore"><path d="M12 10.9c-.61 0-1.1.49-1.1 1.1s.49 1.1 1.1 1.1c.61 0 1.1-.49 1.1-1.1s-.49-1.1-1.1-1.1zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm2.19 12.19L6 18l3.81-8.19L18 6l-3.81 8.19z"></path></g>
+<g id="extension"><path d="M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7 1.49 0 2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"></path></g>
+<g id="face"><path d="M9 11.75c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zm6 0c-.69 0-1.25.56-1.25 1.25s.56 1.25 1.25 1.25 1.25-.56 1.25-1.25-.56-1.25-1.25-1.25zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8 0-.29.02-.58.05-.86 2.36-1.05 4.23-2.98 5.21-5.37C11.07 8.33 14.05 10 17.42 10c.78 0 1.53-.09 2.25-.26.21.71.33 1.47.33 2.26 0 4.41-3.59 8-8 8z"></path></g>
+<g id="favorite"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"></path></g>
+<g id="favorite-border"><path d="M16.5 3c-1.74 0-3.41.81-4.5 2.09C10.91 3.81 9.24 3 7.5 3 4.42 3 2 5.42 2 8.5c0 3.78 3.4 6.86 8.55 11.54L12 21.35l1.45-1.32C18.6 15.36 22 12.28 22 8.5 22 5.42 19.58 3 16.5 3zm-4.4 15.55l-.1.1-.1-.1C7.14 14.24 4 11.39 4 8.5 4 6.5 5.5 5 7.5 5c1.54 0 3.04.99 3.57 2.36h1.87C13.46 5.99 14.96 5 16.5 5c2 0 3.5 1.5 3.5 3.5 0 2.89-3.14 5.74-7.9 10.05z"></path></g>
+<g id="feedback"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-7 12h-2v-2h2v2zm0-4h-2V6h2v4z"></path></g>
+<g id="file-download"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"></path></g>
+<g id="file-upload"><path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z"></path></g>
+<g id="filter-list"><path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"></path></g>
+<g id="find-in-page"><path d="M20 19.59V8l-6-6H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c.45 0 .85-.15 1.19-.4l-4.43-4.43c-.8.52-1.74.83-2.76.83-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5c0 1.02-.31 1.96-.83 2.75L20 19.59zM9 13c0 1.66 1.34 3 3 3s3-1.34 3-3-1.34-3-3-3-3 1.34-3 3z"></path></g>
+<g id="find-replace"><path d="M11 6c1.38 0 2.63.56 3.54 1.46L12 10h6V4l-2.05 2.05C14.68 4.78 12.93 4 11 4c-3.53 0-6.43 2.61-6.92 6H6.1c.46-2.28 2.48-4 4.9-4zm5.64 9.14c.66-.9 1.12-1.97 1.28-3.14H15.9c-.46 2.28-2.48 4-4.9 4-1.38 0-2.63-.56-3.54-1.46L10 12H4v6l2.05-2.05C7.32 17.22 9.07 18 11 18c1.55 0 2.98-.51 4.14-1.36L20 21.49 21.49 20l-4.85-4.86z"></path></g>
+<g id="flag"><path d="M14.4 6L14 4H5v17h2v-7h5.6l.4 2h7V6z"></path></g>
+<g id="flight-land"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><defs><path id="c" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><clipPath id="d" clip-path="url(#b)"><use xlink:href="#c" overflow="visible"></use></clipPath><path d="M2.5 19h19v2h-19zm7.18-5.73l4.35 1.16 5.31 1.42c.8.21 1.62-.26 1.84-1.06.21-.8-.26-1.62-1.06-1.84l-5.31-1.42-2.76-9.02L10.12 2v8.28L5.15 8.95l-.93-2.32-1.45-.39v5.17l1.6.43 5.31 1.43z" clip-path="url(#d)"></path></g>
+<g id="flight-takeoff"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M2.5 19h19v2h-19zm19.57-9.36c-.21-.8-1.04-1.28-1.84-1.06L14.92 10l-6.9-6.43-1.93.51 4.14 7.17-4.97 1.33-1.97-1.54-1.45.39 1.82 3.16.77 1.33 1.6-.43 5.31-1.42 4.35-1.16L21 11.49c.81-.23 1.28-1.05 1.07-1.85z" clip-path="url(#b)"></path></g>
+<g id="flip-to-back"><path d="M9 7H7v2h2V7zm0 4H7v2h2v-2zm0-8c-1.11 0-2 .9-2 2h2V3zm4 12h-2v2h2v-2zm6-12v2h2c0-1.1-.9-2-2-2zm-6 0h-2v2h2V3zM9 17v-2H7c0 1.1.89 2 2 2zm10-4h2v-2h-2v2zm0-4h2V7h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zM5 7H3v12c0 1.1.89 2 2 2h12v-2H5V7zm10-2h2V3h-2v2zm0 12h2v-2h-2v2z"></path></g>
+<g id="flip-to-front"><path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm2 4v-2H3c0 1.1.89 2 2 2zM3 9h2V7H3v2zm12 12h2v-2h-2v2zm4-18H9c-1.11 0-2 .9-2 2v10c0 1.1.89 2 2 2h10c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12H9V5h10v10zm-8 6h2v-2h-2v2zm-4 0h2v-2H7v2z"></path></g>
+<g id="folder"><path d="M10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"></path></g>
+<g id="folder-open"><path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"></path></g>
+<g id="folder-shared"><path d="M20 6h-8l-2-2H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm-5 3c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2zm4 8h-8v-1c0-1.33 2.67-2 4-2s4 .67 4 2v1z"></path></g>
+<g id="font-download"><path d="M9.93 13.5h4.14L12 7.98zM20 2H4c-1.1 0-2 .9-2 2v16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm-4.05 16.5l-1.14-3H9.17l-1.12 3H5.96l5.11-13h1.86l5.11 13h-2.09z"></path></g>
+<g id="forward"><path d="M12 8V4l8 8-8 8v-4H4V8z"></path></g>
+<g id="fullscreen"><path d="M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z"></path></g>
+<g id="fullscreen-exit"><path d="M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z"></path></g>
+<g id="gesture"><path d="M4.59 6.89c.7-.71 1.4-1.35 1.71-1.22.5.2 0 1.03-.3 1.52-.25.42-2.86 3.89-2.86 6.31 0 1.28.48 2.34 1.34 2.98.75.56 1.74.73 2.64.46 1.07-.31 1.95-1.4 3.06-2.77 1.21-1.49 2.83-3.44 4.08-3.44 1.63 0 1.65 1.01 1.76 1.79-3.78.64-5.38 3.67-5.38 5.37 0 1.7 1.44 3.09 3.21 3.09 1.63 0 4.29-1.33 4.69-6.1H21v-2.5h-2.47c-.15-1.65-1.09-4.2-4.03-4.2-2.25 0-4.18 1.91-4.94 2.84-.58.73-2.06 2.48-2.29 2.72-.25.3-.68.84-1.11.84-.45 0-.72-.83-.36-1.92.35-1.09 1.4-2.86 1.85-3.52.78-1.14 1.3-1.92 1.3-3.28C8.95 3.69 7.31 3 6.44 3 5.12 3 3.97 4 3.72 4.25c-.36.36-.66.66-.88.93l1.75 1.71zm9.29 11.66c-.31 0-.74-.26-.74-.72 0-.6.73-2.2 2.87-2.76-.3 2.69-1.43 3.48-2.13 3.48z"></path></g>
+<g id="get-app"><path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z"></path></g>
+<g id="gif"><defs><path id="a" d="M24 24H0V0h24v24z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path d="M11.5 9H13v6h-1.5zM9 9H6c-.6 0-1 .5-1 1v4c0 .5.4 1 1 1h3c.6 0 1-.5 1-1v-2H8.5v1.5h-2v-3H10V10c0-.5-.4-1-1-1zm10 1.5V9h-4.5v6H16v-2h2v-1.5h-2v-1z" clip-path="url(#b)"></path></g>
+<g id="grade"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"></path></g>
+<g id="group-work"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM8 17.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5zM9.5 8c0-1.38 1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5S9.5 9.38 9.5 8zm6.5 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></g>
+<g id="help"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 17h-2v-2h2v2zm2.07-7.75l-.9.92C13.45 12.9 13 13.5 13 15h-2v-.5c0-1.1.45-2.1 1.17-2.83l1.24-1.26c.37-.36.59-.86.59-1.41 0-1.1-.9-2-2-2s-2 .9-2 2H8c0-2.21 1.79-4 4-4s4 1.79 4 4c0 .88-.36 1.68-.93 2.25z"></path></g>
+<g id="help-outline"><path d="M11 18h2v-2h-2v2zm1-16C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zm0-14c-2.21 0-4 1.79-4 4h2c0-1.1.9-2 2-2s2 .9 2 2c0 2-3 1.75-3 5h2c0-2.25 3-2.5 3-5 0-2.21-1.79-4-4-4z"></path></g>
+<g id="highlight-off"><path d="M14.59 8L12 10.59 9.41 8 8 9.41 10.59 12 8 14.59 9.41 16 12 13.41 14.59 16 16 14.59 13.41 12 16 9.41 14.59 8zM12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
+<g id="history"><path opacity=".9" d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"></path></g>
+<g id="home"><path d="M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"></path></g>
+<g id="hourglass-empty"><path d="M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6zm10 14.5V20H8v-3.5l4-4 4 4zm-4-5l-4-4V4h8v3.5l-4 4z"></path></g>
+<g id="hourglass-full"><path d="M6 2v6h.01L6 8.01 10 12l-4 4 .01.01H6V22h12v-5.99h-.01L18 16l-4-4 4-3.99-.01-.01H18V2H6z"></path></g>
+<g id="http"><path d="M4.5 11h-2V9H1v6h1.5v-2.5h2V15H6V9H4.5v2zm2.5-.5h1.5V15H10v-4.5h1.5V9H7v1.5zm5.5 0H14V15h1.5v-4.5H17V9h-4.5v1.5zm9-1.5H18v6h1.5v-2h2c.8 0 1.5-.7 1.5-1.5v-1c0-.8-.7-1.5-1.5-1.5zm0 2.5h-2v-1h2v1z"></path></g>
+<g id="https"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"></path></g>
+<g id="inbox"><path d="M19 3H4.99c-1.1 0-1.98.9-1.98 2L3 19c0 1.1.89 2 1.99 2H19c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 12h-4c0 1.66-1.34 3-3 3s-3-1.34-3-3H4.99V5H19v10zm-3-5h-2V7h-4v3H8l4 4 4-4z"></path></g>
+<g id="indeterminate-check-box"><defs><path id="a" d="M0 0h24v24H0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path clip-path="url(#b)" d="M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"></path></g>
+<g id="info"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"></path></g>
+<g id="info-outline"><path d="M11 17h2v-6h-2v6zm1-15C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8zM11 9h2V7h-2v2z"></path></g>
+<g id="input"><path d="M21 3.01H3c-1.1 0-2 .9-2 2V9h2V4.99h18v14.03H3V15H1v4.01c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98v-14c0-1.11-.9-2-2-2zM11 16l4-4-4-4v3H1v2h10v3z"></path></g>
+<g id="invert-colors"><path d="M17.66 7.93L12 2.27 6.34 7.93c-3.12 3.12-3.12 8.19 0 11.31C7.9 20.8 9.95 21.58 12 21.58c2.05 0 4.1-.78 5.66-2.34 3.12-3.12 3.12-8.19 0-11.31zM12 19.59c-1.6 0-3.11-.62-4.24-1.76C6.62 16.69 6 15.19 6 13.59s.62-3.11 1.76-4.24L12 5.1v14.49z"></path></g>
+<g id="label"><path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16z"></path></g>
+<g id="label-outline"><path d="M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12l-4.37-6.16zM16 17H5V7h11l3.55 5L16 17z"></path></g>
+<g id="language"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm6.93 6h-2.95c-.32-1.25-.78-2.45-1.38-3.56 1.84.63 3.37 1.91 4.33 3.56zM12 4.04c.83 1.2 1.48 2.53 1.91 3.96h-3.82c.43-1.43 1.08-2.76 1.91-3.96zM4.26 14C4.1 13.36 4 12.69 4 12s.1-1.36.26-2h3.38c-.08.66-.14 1.32-.14 2 0 .68.06 1.34.14 2H4.26zm.82 2h2.95c.32 1.25.78 2.45 1.38 3.56-1.84-.63-3.37-1.9-4.33-3.56zm2.95-8H5.08c.96-1.66 2.49-2.93 4.33-3.56C8.81 5.55 8.35 6.75 8.03 8zM12 19.96c-.83-1.2-1.48-2.53-1.91-3.96h3.82c-.43 1.43-1.08 2.76-1.91 3.96zM14.34 14H9.66c-.09-.66-.16-1.32-.16-2 0-.68.07-1.35.16-2h4.68c.09.65.16 1.32.16 2 0 .68-.07 1.34-.16 2zm.25 5.56c.6-1.11 1.06-2.31 1.38-3.56h2.95c-.96 1.65-2.49 2.93-4.33 3.56zM16.36 14c.08-.66.14-1.32.14-2 0-.68-.06-1.34-.14-2h3.38c.16.64.26 1.31.26 2s-.1 1.36-.26 2h-3.38z"></path></g>
+<g id="launch"><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path></g>
+<g id="link"><path d="M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z"></path></g>
+<g id="list"><path d="M3 13h2v-2H3v2zm0 4h2v-2H3v2zm0-8h2V7H3v2zm4 4h14v-2H7v2zm0 4h14v-2H7v2zM7 7v2h14V7H7z"></path></g>
+<g id="lock"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"></path></g>
+<g id="lock-open"><path d="M12 17c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm6-9h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6h1.9c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm0 12H6V10h12v10z"></path></g>
+<g id="lock-outline"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6-5.1c1.71 0 3.1 1.39 3.1 3.1v2H9V6h-.1c0-1.71 1.39-3.1 3.1-3.1zM18 20H6V10h12v10zm-6-3c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2z"></path></g>
+<g id="loyalty"><path d="M21.41 11.58l-9-9C12.05 2.22 11.55 2 11 2H4c-1.1 0-2 .9-2 2v7c0 .55.22 1.05.59 1.42l9 9c.36.36.86.58 1.41.58.55 0 1.05-.22 1.41-.59l7-7c.37-.36.59-.86.59-1.41 0-.55-.23-1.06-.59-1.42zM5.5 7C4.67 7 4 6.33 4 5.5S4.67 4 5.5 4 7 4.67 7 5.5 6.33 7 5.5 7zm11.77 8.27L13 19.54l-4.27-4.27C8.28 14.81 8 14.19 8 13.5c0-1.38 1.12-2.5 2.5-2.5.69 0 1.32.28 1.77.74l.73.72.73-.73c.45-.45 1.08-.73 1.77-.73 1.38 0 2.5 1.12 2.5 2.5 0 .69-.28 1.32-.73 1.77z"></path></g>
+<g id="mail"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"></path></g>
+<g id="markunread"><path d="M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z"></path></g>
+<g id="markunread-mailbox"><path d="M20 6H10v6H8V4h6V0H6v6H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2z"></path></g>
+<g id="menu"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"></path></g>
+<g id="more-horiz"><path d="M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></g>
+<g id="more-vert"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"></path></g>
+<g id="note-add"><path d="M14 2H6c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6zm2 14h-3v3h-2v-3H8v-2h3v-3h2v3h3v2zm-3-7V3.5L18.5 9H13z"></path></g>
+<g id="offline-pin"><defs><path id="a" d="M0 0h24v24H0V0z"></path></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"></use></clipPath><path clip-path="url(#b)" d="M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10 10-4.5 10-10S17.5 2 12 2zm5 16H7v-2h10v2zm-6.7-4L7 10.7l1.4-1.4 1.9 1.9 5.3-5.3L17 7.3 10.3 14z"></path></g>
+<g id="open-in-browser"><path d="M19 4H5c-1.11 0-2 .9-2 2v12c0 1.1.89 2 2 2h4v-2H5V8h14v10h-4v2h4c1.1 0 2-.9 2-2V6c0-1.1-.89-2-2-2zm-7 6l-4 4h3v6h2v-6h3l-4-4z"></path></g>
+<g id="open-in-new"><path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path></g>
+<g id="open-with"><path d="M10 9h4V6h3l-5-5-5 5h3v3zm-1 1H6V7l-5 5 5 5v-3h3v-4zm14 2l-5-5v3h-3v4h3v3l5-5zm-9 3h-4v3H7l5 5 5-5h-3v-3z"></path></g>
+<g id="pageview"><path d="M11.5 9C10.12 9 9 10.12 9 11.5s1.12 2.5 2.5 2.5 2.5-1.12 2.5-2.5S12.88 9 11.5 9zM20 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-3.21 14.21l-2.91-2.91c-.69.44-1.51.7-2.39.7C9.01 16 7 13.99 7 11.5S9.01 7 11.5 7 16 9.01 16 11.5c0 .88-.26 1.69-.7 2.39l2.91 2.9-1.42 1.42z"></path></g>
+<g id="payment"><path d="M20 4H4c-1.11 0-1.99.89-1.99 2L2 18c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6c0-1.11-.89-2-2-2zm0 14H4v-6h16v6zm0-10H4V6h16v2z"></path></g>
+<g id="perm-camera-mic"><path d="M20 5h-3.17L15 3H9L7.17 5H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h7v-2.09c-2.83-.48-5-2.94-5-5.91h2c0 2.21 1.79 4 4 4s4-1.79 4-4h2c0 2.97-2.17 5.43-5 5.91V21h7c1.1 0 2-.9 2-2V7c0-1.1-.9-2-2-2zm-6 8c0 1.1-.9 2-2 2s-2-.9-2-2V9c0-1.1.9-2 2-2s2 .9 2 2v4z"></path></g>
+<g id="perm-contact-calendar"><path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-7 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm6 12H6v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1v1z"></path></g>
+<g id="perm-data-setting"><path d="M18.99 11.5c.34 0 .67.03 1 .07L20 0 0 20h11.56c-.04-.33-.07-.66-.07-1 0-4.14 3.36-7.5 7.5-7.5zm3.71 7.99c.02-.16.04-.32.04-.49 0-.17-.01-.33-.04-.49l1.06-.83c.09-.08.12-.21.06-.32l-1-1.73c-.06-.11-.19-.15-.31-.11l-1.24.5c-.26-.2-.54-.37-.85-.49l-.19-1.32c-.01-.12-.12-.21-.24-.21h-2c-.12 0-.23.09-.25.21l-.19 1.32c-.3.13-.59.29-.85.49l-1.24-.5c-.11-.04-.24 0-.31.11l-1 1.73c-.06.11-.04.24.06.32l1.06.83c-.02.16-.03.32-.03.49 0 .17.01.33.03.49l-1.06.83c-.09.08-.12.21-.06.32l1 1.73c.06.11.19.15.31.11l1.24-.5c.26.2.54.37.85.49l.19 1.32c.02.12.12.21.25.21h2c.12 0 .23-.09.25-.21l.19-1.32c.3-.13.59-.29.84-.49l1.25.5c.11.04.24 0 .31-.11l1-1.73c.06-.11.03-.24-.06-.32l-1.07-.83zm-3.71 1.01c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5z"></path></g>
+<g id="perm-device-information"><path d="M13 7h-2v2h2V7zm0 4h-2v6h2v-6zm4-9.99L7 1c-1.1 0-2 .9-2 2v18c0 1.1.9 2 2 2h10c1.1 0 2-.9 2-2V3c0-1.1-.9-1.99-2-1.99zM17 19H7V5h10v14z"></path></g>
+<g id="perm-identity"><path d="M12 5.9c1.16 0 2.1.94 2.1 2.1s-.94 2.1-2.1 2.1S9.9 9.16 9.9 8s.94-2.1 2.1-2.1m0 9c2.97 0 6.1 1.46 6.1 2.1v1.1H5.9V17c0-.64 3.13-2.1 6.1-2.1M12 4C9.79 4 8 5.79 8 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4z"></path></g>
+<g id="perm-media"><path d="M2 6H0v5h.01L0 20c0 1.1.9 2 2 2h18v-2H2V6zm20-2h-8l-2-2H6c-1.1 0-1.99.9-1.99 2L4 16c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM7 15l4.5-6 3.5 4.51 2.5-3.01L21 15H7z"></path></g>
+<g id="perm-phone-msg"><path d="M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.58l2.2-2.21c.28-.27.36-.66.25-1.01C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM12 3v10l3-3h6V3h-9z"></path></g>
+<g id="perm-scan-wifi"><path d="M12 3C6.95 3 3.15 4.85 0 7.23L12 22 24 7.25C20.85 4.87 17.05 3 12 3zm1 13h-2v-6h2v6zm-2-8V6h2v2h-2z"></path></g>
+<g id="picture-in-picture"><path d="M19 7h-8v6h8V7zm2-4H3c-1.1 0-2 .9-2 2v14c0 1.1.9 1.98 2 1.98h18c1.1 0 2-.88 2-1.98V5c0-1.1-.9-2-2-2zm0 16.01H3V4.98h18v14.03z"></path></g>
+<g id="play-for-work"><path fill="#010101" d="M11 5v5.59H7.5l4.5 4.5 4.5-4.5H13V5h-2zm-5 9c0 3.31 2.69 6 6 6s6-2.69 6-6h-2c0 2.21-1.79 4-4 4s-4-1.79-4-4H6z"></path></g>
+<g id="polymer"><path d="M19 4h-4L7.11 16.63 4.5 12 9 4H5L.5 12 5 20h4l7.89-12.63L19.5 12 15 20h4l4.5-8z"></path></g>
+<g id="power-settings-new"><path d="M13 3h-2v10h2V3zm4.83 2.17l-1.42 1.42C17.99 7.86 19 9.81 19 12c0 3.87-3.13 7-7 7s-7-3.13-7-7c0-2.19 1.01-4.14 2.58-5.42L6.17 5.17C4.23 6.82 3 9.26 3 12c0 4.97 4.03 9 9 9s9-4.03 9-9c0-2.74-1.23-5.18-3.17-6.83z"></path></g>
+<g id="print"><path d="M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"></path></g>
+<g id="query-builder"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zM12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"></path></g>
+<g id="question-answer"><path d="M21 6h-2v9H6v2c0 .55.45 1 1 1h11l4 4V7c0-.55-.45-1-1-1zm-4 6V3c0-.55-.45-1-1-1H3c-.55 0-1 .45-1 1v14l4-4h10c.55 0 1-.45 1-1z"></path></g>
+<g id="radio-button-checked"><path d="M12 7c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5zm0-5C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></g>
+<g id="radio-button-unchecked"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z"></path></g>
+<g id="receipt"><path d="M18 17H6v-2h12v2zm0-4H6v-2h12v2zm0-4H6V7h12v2zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2v20z"></path></g>
+<g id="redeem"><path d="M20 6h-2.18c.11-.31.18-.65.18-1 0-1.66-1.34-3-3-3-1.05 0-1.96.54-2.5 1.35l-.5.67-.5-.68C10.96 2.54 10.05 2 9 2 7.34 2 6 3.34 6 5c0 .35.07.69.18 1H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-5-2c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zM9 4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm11 15H4v-2h16v2zm0-5H4V8h5.08L7 10.83 8.62 12 11 8.76l1-1.36 1 1.36L15.38 12 17 10.83 14.92 8H20v6z"></path></g>
+<g id="redo"><path d="M18.4 10.6C16.55 8.99 14.15 8 11.5 8c-4.65 0-8.58 3.03-9.96 7.22L3.9 16c1.05-3.19 4.05-5.5 7.6-5.5 1.95 0 3.73.72 5.12 1.88L13 16h9V7l-3.6 3.6z"></path></g>
+<g id="refresh"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"></path></g>
+<g id="remove"><path d="M19 13H5v-2h14v2z"></path></g>
+<g id="remove-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm5 11H7v-2h10v2z"></path></g>
+<g id="remove-circle-outline"><path d="M7 11v2h10v-2H7zm5-9C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 18c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8z"></path></g>
+<g id="reorder"><path d="M3 15h18v-2H3v2zm0 4h18v-2H3v2zm0-8h18V9H3v2zm0-6v2h18V5H3z"></path></g>
+<g id="reply"><path d="M10 9V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z"></path></g>
+<g id="reply-all"><path d="M7 8V5l-7 7 7 7v-3l-4-4 4-4zm6 1V5l-7 7 7 7v-4.1c5 0 8.5 1.6 11 5.1-1-5-4-10-11-11z"></path></g>
+<g id="report"><path d="M15.73 3H8.27L3 8.27v7.46L8.27 21h7.46L21 15.73V8.27L15.73 3zM12 17.3c-.72 0-1.3-.58-1.3-1.3 0-.72.58-1.3 1.3-1.3.72 0 1.3.58 1.3 1.3 0 .72-.58 1.3-1.3 1.3zm1-4.3h-2V7h2v6z"></path></g>
+<g id="report-problem"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></g>
+<g id="restore"><path d="M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"></path></g>
+<g id="room"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></g>
+<g id="save"><path d="M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"></path></g>
+<g id="schedule"><path fill-opacity=".9" d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8zM12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z"></path></g>
+<g id="search"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path></g>
+<g id="select-all"><path d="M3 5h2V3c-1.1 0-2 .9-2 2zm0 8h2v-2H3v2zm4 8h2v-2H7v2zM3 9h2V7H3v2zm10-6h-2v2h2V3zm6 0v2h2c0-1.1-.9-2-2-2zM5 21v-2H3c0 1.1.9 2 2 2zm-2-4h2v-2H3v2zM9 3H7v2h2V3zm2 18h2v-2h-2v2zm8-8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2zm0-12h2V7h-2v2zm0 8h2v-2h-2v2zm-4 4h2v-2h-2v2zm0-16h2V3h-2v2zM7 17h10V7H7v10zm2-8h6v6H9V9z"></path></g>
+<g id="send"><path d="M2.01 21L23 12 2.01 3 2 10l15 2-15 2z"></path></g>
+<g id="settings"><path d="M19.43 12.98c.04-.32.07-.64.07-.98s-.03-.66-.07-.98l2.11-1.65c.19-.15.24-.42.12-.64l-2-3.46c-.12-.22-.39-.3-.61-.22l-2.49 1c-.52-.4-1.08-.73-1.69-.98l-.38-2.65C14.46 2.18 14.25 2 14 2h-4c-.25 0-.46.18-.49.42l-.38 2.65c-.61.25-1.17.59-1.69.98l-2.49-1c-.23-.09-.49 0-.61.22l-2 3.46c-.13.22-.07.49.12.64l2.11 1.65c-.04.32-.07.65-.07.98s.03.66.07.98l-2.11 1.65c-.19.15-.24.42-.12.64l2 3.46c.12.22.39.3.61.22l2.49-1c.52.4 1.08.73 1.69.98l.38 2.65c.03.24.24.42.49.42h4c.25 0 .46-.18.49-.42l.38-2.65c.61-.25 1.17-.59 1.69-.98l2.49 1c.23.09.49 0 .61-.22l2-3.46c.12-.22.07-.49-.12-.64l-2.11-1.65zM12 15.5c-1.93 0-3.5-1.57-3.5-3.5s1.57-3.5 3.5-3.5 3.5 1.57 3.5 3.5-1.57 3.5-3.5 3.5z"></path></g>
+<g id="settings-applications"><path d="M12 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm7-7H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-1.75 9c0 .23-.02.46-.05.68l1.48 1.16c.13.11.17.3.08.45l-1.4 2.42c-.09.15-.27.21-.43.15l-1.74-.7c-.36.28-.76.51-1.18.69l-.26 1.85c-.03.17-.18.3-.35.3h-2.8c-.17 0-.32-.13-.35-.29l-.26-1.85c-.43-.18-.82-.41-1.18-.69l-1.74.7c-.16.06-.34 0-.43-.15l-1.4-2.42c-.09-.15-.05-.34.08-.45l1.48-1.16c-.03-.23-.05-.46-.05-.69 0-.23.02-.46.05-.68l-1.48-1.16c-.13-.11-.17-.3-.08-.45l1.4-2.42c.09-.15.27-.21.43-.15l1.74.7c.36-.28.76-.51 1.18-.69l.26-1.85c.03-.17.18-.3.35-.3h2.8c.17 0 .32.13.35.29l.26 1.85c.43.18.82.41 1.18.69l1.74-.7c.16-.06.34 0 .43.15l1.4 2.42c.09.15.05.34-.08.45l-1.48 1.16c.03.23.05.46.05.69z"></path></g>
+<g id="settings-backup-restore"><path d="M14 12c0-1.1-.9-2-2-2s-2 .9-2 2 .9 2 2 2 2-.9 2-2zm-2-9c-4.97 0-9 4.03-9 9H0l4 4 4-4H5c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.51 0-2.91-.49-4.06-1.3l-1.42 1.44C8.04 20.3 9.94 21 12 21c4.97 0 9-4.03 9-9s-4.03-9-9-9z"></path></g>
+<g id="settings-bluetooth"><path d="M11 24h2v-2h-2v2zm-4 0h2v-2H7v2zm8 0h2v-2h-2v2zm2.71-18.29L12 0h-1v7.59L6.41 3 5 4.41 10.59 10 5 15.59 6.41 17 11 12.41V20h1l5.71-5.71-4.3-4.29 4.3-4.29zM13 3.83l1.88 1.88L13 7.59V3.83zm1.88 10.46L13 16.17v-3.76l1.88 1.88z"></path></g>
+<g id="settings-brightness"><path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02zM8 16h2.5l1.5 1.5 1.5-1.5H16v-2.5l1.5-1.5-1.5-1.5V8h-2.5L12 6.5 10.5 8H8v2.5L6.5 12 8 13.5V16zm4-7c1.66 0 3 1.34 3 3s-1.34 3-3 3V9z"></path></g>
+<g id="settings-cell"><path d="M7 24h2v-2H7v2zm4 0h2v-2h-2v2zm4 0h2v-2h-2v2zM16 .01L8 0C6.9 0 6 .9 6 2v16c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V2c0-1.1-.9-1.99-2-1.99zM16 16H8V4h8v12z"></path></g>
+<g id="settings-ethernet"><path d="M7.77 6.76L6.23 5.48.82 12l5.41 6.52 1.54-1.28L3.42 12l4.35-5.24zM7 13h2v-2H7v2zm10-2h-2v2h2v-2zm-6 2h2v-2h-2v2zm6.77-7.52l-1.54 1.28L20.58 12l-4.35 5.24 1.54 1.28L23.18 12l-5.41-6.52z"></path></g>
+<g id="settings-input-antenna"><path d="M12 5c-3.87 0-7 3.13-7 7h2c0-2.76 2.24-5 5-5s5 2.24 5 5h2c0-3.87-3.13-7-7-7zm1 9.29c.88-.39 1.5-1.26 1.5-2.29 0-1.38-1.12-2.5-2.5-2.5S9.5 10.62 9.5 12c0 1.02.62 1.9 1.5 2.29v3.3L7.59 21 9 22.41l3-3 3 3L16.41 21 13 17.59v-3.3zM12 1C5.93 1 1 5.93 1 12h2c0-4.97 4.03-9 9-9s9 4.03 9 9h2c0-6.07-4.93-11-11-11z"></path></g>
+<g id="settings-input-component"><path d="M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4H1v6h6V6H5V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2H9v2zm-8 0c0 1.3.84 2.4 2 2.82V23h2v-4.18C6.16 18.4 7 17.3 7 16v-2H1v2zM21 6V2c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6V6h-2zm-8-4c0-.55-.45-1-1-1s-1 .45-1 1v4H9v6h6V6h-2V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2z"></path></g>
+<g id="settings-input-composite"><path d="M5 2c0-.55-.45-1-1-1s-1 .45-1 1v4H1v6h6V6H5V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2H9v2zm-8 0c0 1.3.84 2.4 2 2.82V23h2v-4.18C6.16 18.4 7 17.3 7 16v-2H1v2zM21 6V2c0-.55-.45-1-1-1s-1 .45-1 1v4h-2v6h6V6h-2zm-8-4c0-.55-.45-1-1-1s-1 .45-1 1v4H9v6h6V6h-2V2zm4 14c0 1.3.84 2.4 2 2.82V23h2v-4.18c1.16-.41 2-1.51 2-2.82v-2h-6v2z"></path></g>
+<g id="settings-input-hdmi"><path d="M18 7V4c0-1.1-.9-2-2-2H8c-1.1 0-2 .9-2 2v3H5v6l3 6v3h8v-3l3-6V7h-1zM8 4h8v3h-2V5h-1v2h-2V5h-1v2H8V4z"></path></g>
+<g id="settings-input-svideo"><path d="M8 11.5c0-.83-.67-1.5-1.5-1.5S5 10.67 5 11.5 5.67 13 6.5 13 8 12.33 8 11.5zm7-5c0-.83-.67-1.5-1.5-1.5h-3C9.67 5 9 5.67 9 6.5S9.67 8 10.5 8h3c.83 0 1.5-.67 1.5-1.5zM8.5 15c-.83 0-1.5.67-1.5 1.5S7.67 18 8.5 18s1.5-.67 1.5-1.5S9.33 15 8.5 15zM12 1C5.93 1 1 5.93 1 12s4.93 11 11 11 11-4.93 11-11S18.07 1 12 1zm0 20c-4.96 0-9-4.04-9-9s4.04-9 9-9 9 4.04 9 9-4.04 9-9 9zm5.5-11c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5zm-2 5c-.83 0-1.5.67-1.5 1.5s.67 1.5 1.5 1.5 1.5-.67 1.5-1.5-.67-1.5-1.5-1.5z"></path></g>
+<g id="settings-overscan"><path d="M12.01 5.5L10 8h4l-1.99-2.5zM18 10v4l2.5-1.99L18 10zM6 10l-2.5 2.01L6 14v-4zm8 6h-4l2.01 2.5L14 16zm7-13H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16.01H3V4.99h18v14.02z"></path></g>
+<g id="settings-phone"><path d="M13 9h-2v2h2V9zm4 0h-2v2h2V9zm3 6.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.58l2.2-2.21c.28-.27.36-.66.25-1.01C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1zM19 9v2h2V9h-2z"></path></g>
+<g id="settings-power"><path d="M7 24h2v-2H7v2zm4 0h2v-2h-2v2zm2-22h-2v10h2V2zm3.56 2.44l-1.45 1.45C16.84 6.94 18 8.83 18 11c0 3.31-2.69 6-6 6s-6-2.69-6-6c0-2.17 1.16-4.06 2.88-5.12L7.44 4.44C5.36 5.88 4 8.28 4 11c0 4.42 3.58 8 8 8s8-3.58 8-8c0-2.72-1.36-5.12-3.44-6.56zM15 24h2v-2h-2v2z"></path></g>
+<g id="settings-remote"><path d="M15 9H9c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h6c.55 0 1-.45 1-1V10c0-.55-.45-1-1-1zm-3 6c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zM7.05 6.05l1.41 1.41C9.37 6.56 10.62 6 12 6s2.63.56 3.54 1.46l1.41-1.41C15.68 4.78 13.93 4 12 4s-3.68.78-4.95 2.05zM12 0C8.96 0 6.21 1.23 4.22 3.22l1.41 1.41C7.26 3.01 9.51 2 12 2s4.74 1.01 6.36 2.64l1.41-1.41C17.79 1.23 15.04 0 12 0z"></path></g>
+<g id="settings-voice"><path d="M7 24h2v-2H7v2zm5-11c1.66 0 2.99-1.34 2.99-3L15 4c0-1.66-1.34-3-3-3S9 2.34 9 4v6c0 1.66 1.34 3 3 3zm-1 11h2v-2h-2v2zm4 0h2v-2h-2v2zm4-14h-1.7c0 3-2.54 5.1-5.3 5.1S6.7 13 6.7 10H5c0 3.41 2.72 6.23 6 6.72V20h2v-3.28c3.28-.49 6-3.31 6-6.72z"></path></g>
+<g id="shop"><path d="M16 6V4c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H2v13c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V6h-6zm-6-2h4v2h-4V4zM9 18V9l7.5 4L9 18z"></path></g>
+<g id="shop-two"><path d="M3 9H1v11c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2H3V9zm15-4V3c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H5v11c0 1.11.89 2 2 2h14c1.11 0 2-.89 2-2V5h-5zm-6-2h4v2h-4V3zm0 12V8l5.5 3-5.5 4z"></path></g>
+<g id="shopping-basket"><path d="M17.21 9l-4.38-6.56c-.19-.28-.51-.42-.83-.42-.32 0-.64.14-.83.43L6.79 9H2c-.55 0-1 .45-1 1 0 .09.01.18.04.27l2.54 9.27c.23.84 1 1.46 1.92 1.46h13c.92 0 1.69-.62 1.93-1.46l2.54-9.27L23 10c0-.55-.45-1-1-1h-4.79zM9 9l3-4.4L15 9H9zm3 8c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2z"></path></g>
+<g id="shopping-cart"><path d="M7 18c-1.1 0-1.99.9-1.99 2S5.9 22 7 22s2-.9 2-2-.9-2-2-2zM1 2v2h2l3.6 7.59-1.35 2.45c-.16.28-.25.61-.25.96 0 1.1.9 2 2 2h12v-2H7.42c-.14 0-.25-.11-.25-.25l.03-.12.9-1.63h7.45c.75 0 1.41-.41 1.75-1.03l3.58-6.49c.08-.14.12-.31.12-.48 0-.55-.45-1-1-1H5.21l-.94-2H1zm16 16c-1.1 0-1.99.9-1.99 2s.89 2 1.99 2 2-.9 2-2-.9-2-2-2z"></path></g>
+<g id="sort"><path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"></path></g>
+<g id="speaker-notes"><path d="M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zM8 14H6v-2h2v2zm0-3H6V9h2v2zm0-3H6V6h2v2zm7 6h-5v-2h5v2zm3-3h-8V9h8v2zm0-3h-8V6h8v2z"></path></g>
+<g id="spellcheck"><path d="M12.45 16h2.09L9.43 3H7.57L2.46 16h2.09l1.12-3h5.64l1.14 3zm-6.02-5L8.5 5.48 10.57 11H6.43zm15.16.59l-8.09 8.09L9.83 16l-1.41 1.41 5.09 5.09L23 13l-1.41-1.41z"></path></g>
+<g id="star"><path d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"></path></g>
+<g id="star-border"><path d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"></path></g>
+<g id="star-half"><path d="M22 9.74l-7.19-.62L12 2.5 9.19 9.13 2 9.74l5.46 4.73-1.64 7.03L12 17.77l6.18 3.73-1.63-7.03L22 9.74zM12 15.9V6.6l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.9z"></path></g>
+<g id="stars"><path d="M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zm4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23L16.23 18z"></path></g>
+<g id="store"><path d="M20 4H4v2h16V4zm1 10v-2l-1-5H4l-1 5v2h1v6h10v-6h4v6h2v-6h1zm-9 4H6v-4h6v4z"></path></g>
+<g id="subject"><path d="M14 17H4v2h10v-2zm6-8H4v2h16V9zM4 15h16v-2H4v2zM4 5v2h16V5H4z"></path></g>
+<g id="supervisor-account"><path d="M16.5 12c1.38 0 2.49-1.12 2.49-2.5S17.88 7 16.5 7C15.12 7 14 8.12 14 9.5s1.12 2.5 2.5 2.5zM9 11c1.66 0 2.99-1.34 2.99-3S10.66 5 9 5C7.34 5 6 6.34 6 8s1.34 3 3 3zm7.5 3c-1.83 0-5.5.92-5.5 2.75V19h11v-2.25c0-1.83-3.67-2.75-5.5-2.75zM9 13c-2.33 0-7 1.17-7 3.5V19h7v-2.25c0-.85.33-2.34 2.37-3.47C10.5 13.1 9.66 13 9 13z"></path></g>
+<g id="swap-horiz"><path d="M6.99 11L3 15l3.99 4v-3H14v-2H6.99v-3zM21 9l-3.99-4v3H10v2h7.01v3L21 9z"></path></g>
+<g id="swap-vert"><path d="M16 17.01V10h-2v7.01h-3L15 21l4-3.99h-3zM9 3L5 6.99h3V14h2V6.99h3L9 3z"></path></g>
+<g id="swap-vertical-circle"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM6.5 9L10 5.5 13.5 9H11v4H9V9H6.5zm11 6L14 18.5 10.5 15H13v-4h2v4h2.5z"></path></g>
+<g id="system-update-alt"><path d="M12 16.5l4-4h-3v-9h-2v9H8l4 4zm9-13h-6v1.99h6v14.03H3V5.49h6V3.5H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2v-14c0-1.1-.9-2-2-2z"></path></g>
+<g id="tab"><path d="M21 3H3c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H3V5h10v4h8v10z"></path></g>
+<g id="tab-unselected"><path d="M1 9h2V7H1v2zm0 4h2v-2H1v2zm0-8h2V3c-1.1 0-2 .9-2 2zm8 16h2v-2H9v2zm-8-4h2v-2H1v2zm2 4v-2H1c0 1.1.9 2 2 2zM21 3h-8v6h10V5c0-1.1-.9-2-2-2zm0 14h2v-2h-2v2zM9 5h2V3H9v2zM5 21h2v-2H5v2zM5 5h2V3H5v2zm16 16c1.1 0 2-.9 2-2h-2v2zm0-8h2v-2h-2v2zm-8 8h2v-2h-2v2zm4 0h2v-2h-2v2z"></path></g>
+<g id="text-format"><path d="M5 17v2h14v-2H5zm4.5-4.2h5l.9 2.2h2.1L12.75 4h-1.5L6.5 15h2.1l.9-2.2zM12 5.98L13.87 11h-3.74L12 5.98z"></path></g>
+<g id="theaters"><path d="M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3h-2zM8 17H6v-2h2v2zm0-4H6v-2h2v2zm0-4H6V7h2v2zm10 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V7h2v2z"></path></g>
+<g id="thumb-down"><path d="M15 3H6c-.83 0-1.54.5-1.84 1.22l-3.02 7.05c-.09.23-.14.47-.14.73v1.91l.01.01L1 14c0 1.1.9 2 2 2h6.31l-.95 4.57-.03.32c0 .41.17.79.44 1.06L9.83 23l6.59-6.59c.36-.36.58-.86.58-1.41V5c0-1.1-.9-2-2-2zm4 0v12h4V3h-4z"></path></g>
+<g id="thumb-up"><path d="M1 21h4V9H1v12zm22-11c0-1.1-.9-2-2-2h-6.31l.95-4.57.03-.32c0-.41-.17-.79-.44-1.06L14.17 1 7.59 7.59C7.22 7.95 7 8.45 7 9v10c0 1.1.9 2 2 2h9c.83 0 1.54-.5 1.84-1.22l3.02-7.05c.09-.23.14-.47.14-.73v-1.91l-.01-.01L23 10z"></path></g>
+<g id="thumbs-up-down"><path d="M12 6c0-.55-.45-1-1-1H5.82l.66-3.18.02-.23c0-.31-.13-.59-.33-.8L5.38 0 .44 4.94C.17 5.21 0 5.59 0 6v6.5c0 .83.67 1.5 1.5 1.5h6.75c.62 0 1.15-.38 1.38-.91l2.26-5.29c.07-.17.11-.36.11-.55V6zm10.5 4h-6.75c-.62 0-1.15.38-1.38.91l-2.26 5.29c-.07.17-.11.36-.11.55V18c0 .55.45 1 1 1h5.18l-.66 3.18-.02.24c0 .31.13.59.33.8l.79.78 4.94-4.94c.27-.27.44-.65.44-1.06v-6.5c0-.83-.67-1.5-1.5-1.5z"></path></g>
+<g id="toc"><path d="M3 9h14V7H3v2zm0 4h14v-2H3v2zm0 4h14v-2H3v2zm16 0h2v-2h-2v2zm0-10v2h2V7h-2zm0 6h2v-2h-2v2z"></path></g>
+<g id="today"><path d="M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM7 10h5v5H7z"></path></g>
+<g id="toll"><path d="M15 4c-4.42 0-8 3.58-8 8s3.58 8 8 8 8-3.58 8-8-3.58-8-8-8zm0 14c-3.31 0-6-2.69-6-6s2.69-6 6-6 6 2.69 6 6-2.69 6-6 6zM3 12c0-2.61 1.67-4.83 4-5.65V4.26C3.55 5.15 1 8.27 1 12s2.55 6.85 6 7.74v-2.09c-2.33-.82-4-3.04-4-5.65z"></path></g>
+<g id="track-changes"><path fill="#231F20" d="M19.07 4.93l-1.41 1.41C19.1 7.79 20 9.79 20 12c0 4.42-3.58 8-8 8s-8-3.58-8-8c0-4.08 3.05-7.44 7-7.93v2.02C8.16 6.57 6 9.03 6 12c0 3.31 2.69 6 6 6s6-2.69 6-6c0-1.66-.67-3.16-1.76-4.24l-1.41 1.41C15.55 9.9 16 10.9 16 12c0 2.21-1.79 4-4 4s-4-1.79-4-4c0-1.86 1.28-3.41 3-3.86v2.14c-.6.35-1 .98-1 1.72 0 1.1.9 2 2 2s2-.9 2-2c0-.74-.4-1.38-1-1.72V2h-1C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10c0-2.76-1.12-5.26-2.93-7.07z"></path></g>
+<g id="translate"><path d="M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"></path></g>
+<g id="trending-down"><path d="M16 18l2.29-2.29-4.88-4.88-4 4L2 7.41 3.41 6l6 6 4-4 6.3 6.29L22 12v6z"></path></g>
+<g id="trending-flat"><path d="M22 12l-4-4v3H3v2h15v3z"></path></g>
+<g id="trending-up"><path d="M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"></path></g>
+<g id="turned-in"><path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2z"></path></g>
+<g id="turned-in-not"><path d="M17 3H7c-1.1 0-1.99.9-1.99 2L5 21l7-3 7 3V5c0-1.1-.9-2-2-2zm0 15l-5-2.18L7 18V5h10v13z"></path></g>
+<g id="undo"><path d="M12.5 8c-2.65 0-5.05.99-6.9 2.6L2 7v9h9l-3.62-3.62c1.39-1.16 3.16-1.88 5.12-1.88 3.54 0 6.55 2.31 7.6 5.5l2.37-.78C21.08 11.03 17.15 8 12.5 8z"></path></g>
+<g id="unfold-less"><path d="M7.41 18.59L8.83 20 12 16.83 15.17 20l1.41-1.41L12 14l-4.59 4.59zm9.18-13.18L15.17 4 12 7.17 8.83 4 7.41 5.41 12 10l4.59-4.59z"></path></g>
+<g id="unfold-more"><path d="M12 5.83L15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9 12 5.83zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15 12 18.17z"></path></g>
+<g id="verified-user"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-2 16l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"></path></g>
+<g id="view-agenda"><path d="M20 13H3c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1v-6c0-.55-.45-1-1-1zm0-10H3c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1V4c0-.55-.45-1-1-1z"></path></g>
+<g id="view-array"><path d="M4 18h3V5H4v13zM18 5v13h3V5h-3zM8 18h9V5H8v13z"></path></g>
+<g id="view-carousel"><path d="M7 19h10V4H7v15zm-5-2h4V6H2v11zM18 6v11h4V6h-4z"></path></g>
+<g id="view-column"><path d="M10 18h5V5h-5v13zm-6 0h5V5H4v13zM16 5v13h5V5h-5z"></path></g>
+<g id="view-day"><path d="M2 21h19v-3H2v3zM20 8H3c-.55 0-1 .45-1 1v6c0 .55.45 1 1 1h17c.55 0 1-.45 1-1V9c0-.55-.45-1-1-1zM2 3v3h19V3H2z"></path></g>
+<g id="view-headline"><path d="M4 15h16v-2H4v2zm0 4h16v-2H4v2zm0-8h16V9H4v2zm0-6v2h16V5H4z"></path></g>
+<g id="view-list"><path d="M4 14h4v-4H4v4zm0 5h4v-4H4v4zM4 9h4V5H4v4zm5 5h12v-4H9v4zm0 5h12v-4H9v4zM9 5v4h12V5H9z"></path></g>
+<g id="view-module"><path d="M4 11h5V5H4v6zm0 7h5v-6H4v6zm6 0h5v-6h-5v6zm6 0h5v-6h-5v6zm-6-7h5V5h-5v6zm6-6v6h5V5h-5z"></path></g>
+<g id="view-quilt"><path d="M10 18h5v-6h-5v6zm-6 0h5V5H4v13zm12 0h5v-6h-5v6zM10 5v6h11V5H10z"></path></g>
+<g id="view-stream"><path d="M4 18h17v-6H4v6zM4 5v6h17V5H4z"></path></g>
+<g id="view-week"><path d="M6 5H3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zm14 0h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1zm-7 0h-3c-.55 0-1 .45-1 1v12c0 .55.45 1 1 1h3c.55 0 1-.45 1-1V6c0-.55-.45-1-1-1z"></path></g>
+<g id="visibility"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"></path></g>
+<g id="visibility-off"><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"></path></g>
+<g id="warning"><path d="M1 21h22L12 2 1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z"></path></g>
+<g id="work"><path d="M20 6h-4V4c0-1.11-.89-2-2-2h-4c-1.11 0-2 .89-2 2v2H4c-1.11 0-1.99.89-1.99 2L2 19c0 1.11.89 2 2 2h16c1.11 0 2-.89 2-2V8c0-1.11-.89-2-2-2zm-6 0h-4V4h4v2z"></path></g>
+<g id="youtube-searched-for"><path d="M17.01 14h-.8l-.27-.27c.98-1.14 1.57-2.61 1.57-4.23 0-3.59-2.91-6.5-6.5-6.5s-6.5 3-6.5 6.5H2l3.84 4 4.16-4H6.51C6.51 7 8.53 5 11.01 5s4.5 2.01 4.5 4.5c0 2.48-2.02 4.5-4.5 4.5-.65 0-1.26-.14-1.82-.38L7.71 15.1c.97.57 2.09.9 3.3.9 1.61 0 3.08-.59 4.22-1.57l.27.27v.79l5.01 4.99L22 19l-4.99-5z"></path></g>
+<g id="zoom-in"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"></path></g>
+<g id="zoom-out"><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"></path></g>
+</defs></svg>
+</iron-iconset-svg>
+<dom-module id="paper-item-shared-styles" assetpath="chrome://resources/polymer/v1_0/paper-item/">
+  <template>
+    <style>
+      :host {
+        display: block;
+        min-height: var(--paper-item-min-height, 48px);
+        padding: 0px 16px;
+      }
+
+      :host > ::content > *:not(:first-child):not(:last-child) {
+        margin-right: 16px;
+      }
+    </style>
+  </template>
+</dom-module>
+<dom-module id="paper-item" assetpath="chrome://resources/polymer/v1_0/paper-item/">
+  <template>
+    <style include="paper-item-shared-styles"></style>
+    <style>
+      :host {
+        @apply(--layout-horizontal);
+        @apply(--layout-center);
+        @apply(--paper-font-subhead);
+
+        @apply(--paper-item);
+      }
+    </style>
+
+    <content></content>
+  </template>
+
+  </dom-module>
+<dom-module id="paper-menu" assetpath="chrome://resources/polymer/v1_0/paper-menu/">
+  <style>
+/**
+@license
+Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
+This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
+The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
+The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
+Code distributed by Google as part of the polymer project is also
+subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
+*/
+
+/* need a wrapper element to make this higher specificity than the :host rule in paper-item */
+.selectable-content > ::content > .iron-selected {
+  font-weight: bold;
+
+  @apply(--paper-menu-selected-item);
+}
+
+.selectable-content > ::content > [disabled] {
+  color: var(--paper-menu-disabled-color, --disabled-text-color);
+}
+
+.selectable-content > ::content > *:focus {
+  position: relative;
+  outline: 0;
+
+  @apply(--paper-menu-focused-item);
+}
+
+.selectable-content > ::content > *:focus:after {
+  @apply(--layout-fit);
+  background: currentColor;
+  opacity: var(--dark-divider-opacity);
+  content: '';
+
+  @apply(--paper-menu-focused-item-after);
+}
+
+.selectable-content > ::content > *[colored]:focus:after {
+  opacity: 0.26;
+}
+
+</style>
+
+  <style>
+    :host {
+      display: block;
+      padding: 8px 0;
+
+      background: var(--paper-menu-background-color, --primary-background-color);
+      color: var(--paper-menu-color, --primary-text-color);
+
+      @apply(--paper-menu);
+    }
+  </style>
+  <template>
+
+    <div class="selectable-content">
+      <content></content>
+    </div>
+
+  </template>
+
+</dom-module>
+
+<dom-module id="iron-overlay-backdrop" assetpath="chrome://resources/polymer/v1_0/iron-overlay-behavior/">
+
+  <style>
+
+    :host {
+      position: fixed;
+      top: 0;
+      left: 0;
+      width: 100vw;
+      height: 100vh;
+      background-color: var(--iron-overlay-backdrop-background-color, #000);
+      opacity: 0;
+      transition: opacity 0.2s;
+
+      @apply(--iron-overlay-backdrop);
+    }
+
+    :host([opened]) {
+      opacity: var(--iron-overlay-backdrop-opacity, 0.6);
+
+      @apply(--iron-overlay-backdrop-opened);
+    }
+
+  </style>
+
+  <template>
+    <content></content>
+  </template>
+
+</dom-module>
+
+<dom-module id="iron-dropdown" assetpath="chrome://resources/polymer/v1_0/iron-dropdown/">
+  <style>
+    :host {
+      position: fixed;
+    }
+
+    #contentWrapper ::content > * {
+      overflow: auto;
+    }
+
+    #contentWrapper.animating ::content > * {
+      overflow: hidden;
+    }
+  </style>
+  <template>
+    <div id="contentWrapper">
+      <content id="content" select=".dropdown-content"></content>
+    </div>
+  </template>
+
+  </dom-module>
+
+<dom-module id="paper-menu-button" assetpath="chrome://resources/polymer/v1_0/paper-menu-button/">
+  <style>
+    :host {
+      display: inline-block;
+      position: relative;
+      padding: 8px;
+      outline: none;
+
+      @apply(--paper-menu-button);
+    }
+
+    :host([disabled]) {
+      cursor: auto;
+      color: var(--disabled-text-color);
+
+      @apply(--paper-menu-button-disabled);
+    }
+
+    :host([vertical-align="top"]) paper-material {
+      margin-bottom: 20px;
+      margin-top: -10px;
+      top: 10px;
+    }
+
+    :host([vertical-align="bottom"]) paper-material {
+      bottom: 10px;
+      margin-bottom: -10px;
+      margin-top: 20px;
+    }
+
+    paper-material {
+      border-radius: 2px;
+      background-color: var(--paper-menu-button-dropdown-background, --primary-background-color);
+
+      @apply(--paper-menu-button-dropdown);
+    }
+  </style>
+  <template>
+    <div id="trigger" on-tap="open">
+      <content select=".dropdown-trigger"></content>
+    </div>
+    <iron-dropdown id="dropdown" opened="{{opened}}" horizontal-align="[[horizontalAlign]]" vertical-align="[[verticalAlign]]" horizontal-offset="[[horizontalOffset]]" vertical-offset="[[verticalOffset]]" open-animation-config="[[openAnimationConfig]]" close-animation-config="[[closeAnimationConfig]]" no-animations="[[noAnimations]]" focus-target="[[_dropdownContent]]">
+      <paper-material class="dropdown-content">
+        <content id="content" select=".dropdown-content"></content>
+      </paper-material>
+    </iron-dropdown>
+  </template>
+</dom-module>
+<dom-module id="paper-icon-button" assetpath="chrome://resources/polymer/v1_0/paper-icon-button/">
+  <style>
+
+    :host {
+      display: inline-block;
+      position: relative;
+      padding: 8px;
+      outline: none;
+      -webkit-tap-highlight-color: rgba(0,0,0,0);
+      -webkit-user-select: none;
+      -moz-user-select: none;
+      -ms-user-select: none;
+      user-select: none;
+      cursor: pointer;
+      z-index: 0;
+
+      @apply(--paper-icon-button);
+    }
+
+    :host #ink {
+      color: var(--paper-icon-button-ink-color, --primary-text-color);
+      opacity: 0.6;
+    }
+
+    :host([disabled]) {
+      color: var(--paper-icon-button-disabled-text, --disabled-text-color);
+      pointer-events: none;
+      cursor: auto;
+      @apply(--paper-icon-button-disabled);
+    }
+  </style>
+  <template>
+    <paper-ripple id="ink" class="circle" center=""></paper-ripple>
+    <iron-icon id="icon" src="[[src]]" icon="[[icon]]" alt$="[[alt]]"></iron-icon>
+  </template>
+</dom-module>
+<dom-module id="paper-input-container" assetpath="chrome://resources/polymer/v1_0/paper-input/">
+  <template>
+
+    <style>
+      :host {
+        display: block;
+        padding: 8px 0;
+
+        @apply(--paper-input-container);
+      }
+
+      :host[inline] {
+        display: inline-block;
+      }
+
+      :host([disabled]) {
+        pointer-events: none;
+        opacity: 0.33;
+
+        @apply(--paper-input-container-disabled);
+      }
+
+      .floated-label-placeholder {
+        @apply(--paper-font-caption);
+      }
+
+      .underline {
+        position: relative;
+      }
+
+      .focused-line {
+        height: 2px;
+
+        -webkit-transform-origin: center center;
+        transform-origin: center center;
+        -webkit-transform: scale3d(0,1,1);
+        transform: scale3d(0,1,1);
+
+        background: var(--paper-input-container-focus-color, --default-primary-color);
+
+        @apply(--paper-input-container-underline-focus);
+      }
+
+      .underline.is-highlighted .focused-line {
+        -webkit-transform: none;
+        transform: none;
+        -webkit-transition: -webkit-transform 0.25s;
+        transition: transform 0.25s;
+
+        @apply(--paper-transition-easing);
+      }
+
+      .underline.is-invalid .focused-line {
+        background: var(--paper-input-container-invalid-color, --google-red-500);
+
+        -webkit-transform: none;
+        transform: none;
+        -webkit-transition: -webkit-transform 0.25s;
+        transition: transform 0.25s;
+
+        @apply(--paper-transition-easing);
+      }
+
+      .unfocused-line {
+        height: 1px;
+        background: var(--paper-input-container-color, --secondary-text-color);
+
+        @apply(--paper-input-container-underline);
+      }
+
+      :host([disabled]) .unfocused-line {
+        border-bottom: 1px dashed;
+        border-color: var(--paper-input-container-color, --secondary-text-color);
+        background: transparent;
+
+        @apply(--paper-input-container-underline-disabled);
+      }
+
+      .label-and-input-container {
+        @apply(--layout-flex);
+        @apply(--layout-relative);
+      }
+
+      .input-content {
+        position: relative;
+        @apply(--layout-horizontal);
+        @apply(--layout-end);
+      }
+
+      .input-content ::content label,
+      .input-content ::content .paper-input-label {
+        position: absolute;
+        top: 0;
+        right: 0;
+        left: 0;
+        font: inherit;
+        color: var(--paper-input-container-color, --secondary-text-color);
+
+        @apply(--paper-font-subhead);
+        @apply(--paper-input-container-label);
+      }
+
+      .input-content.label-is-floating ::content label,
+      .input-content.label-is-floating ::content .paper-input-label {
+        -webkit-transform: translateY(-75%) scale(0.75);
+        transform: translateY(-75%) scale(0.75);
+        -webkit-transform-origin: left top;
+        transform-origin: left top;
+        -webkit-transition: -webkit-transform 0.25s;
+        transition: transform 0.25s;
+
+        @apply(--paper-transition-easing);
+      }
+
+      .input-content.label-is-highlighted ::content label,
+      .input-content.label-is-highlighted ::content .paper-input-label {
+        color: var(--paper-input-container-focus-color, --default-primary-color);
+
+        @apply(--paper-input-container-label-focus);
+      }
+
+      .input-content.is-invalid ::content label,
+      .input-content.is-invalid ::content .paper-input-label {
+        color: var(--paper-input-container-invalid-color, --google-red-500);
+      }
+
+      .input-content.label-is-hidden ::content label,
+      .input-content.label-is-hidden ::content .paper-input-label {
+        visibility: hidden;
+      }
+
+      .input-content ::content input,
+      .input-content ::content textarea,
+      .input-content ::content iron-autogrow-textarea,
+      .input-content ::content .paper-input-input {
+        position: relative; /* to make a stacking context */
+        outline: none;
+        box-shadow: none;
+        padding: 0;
+        width: 100%;
+        background: transparent;
+        border: none;
+        color: var(--paper-input-container-input-color, --primary-text-color);
+        -webkit-appearance: none;
+
+        @apply(--paper-font-subhead);
+        @apply(--paper-input-container-input);
+      }
+
+      ::content [prefix] {
+        @apply(--paper-font-subhead);
+        @apply(--paper-input-prefix);
+      }
+
+      ::content [suffix] {
+        @apply(--paper-font-subhead);
+        @apply(--paper-input-suffix);
+      }
+
+      /* Firefox sets a min-width on the input, which can cause layout issues */
+      .input-content ::content input {
+        min-width: 0;
+      }
+
+      .input-content ::content textarea {
+        resize: none;
+      }
+
+      .add-on-content.is-invalid ::content * {
+        color: var(--paper-input-container-invalid-color, --google-red-500);
+      }
+
+      .add-on-content.is-highlighted ::content * {
+        color: var(--paper-input-container-focus-color, --default-primary-color);
+      }
+    </style>
+
+    <template is="dom-if" if="[[!noLabelFloat]]">
+      <div class="floated-label-placeholder">&nbsp;</div>
+    </template>
+
+    <div class$="[[_computeInputContentClass(noLabelFloat,alwaysFloatLabel,focused,invalid,_inputHasContent)]]">
+      <content select="[prefix]" id="prefix"></content>
+      <div class="label-and-input-container">
+        <content select=":not([add-on]):not([prefix]):not([suffix])"></content>
+      </div>
+      <content select="[suffix]"></content>
+    </div>
+
+    <div class$="[[_computeUnderlineClass(focused,invalid)]]">
+      <div class="unfocused-line fit"></div>
+      <div class="focused-line fit"></div>
+    </div>
+
+    <div class$="[[_computeAddOnContentClass(focused,invalid)]]">
+      <content id="addOnContent" select="[add-on]"></content>
+    </div>
+
+  </template>
+</dom-module>
+
+<dom-module id="cr-search-field" assetpath="chrome://resources/cr_elements/v1_0/cr_search_field/">
+  <template>
+    <paper-icon-button icon="search" id="search-button" disabled$="[[showingSearch_]]" title="[[label]]" on-click="toggleShowingSearch_"></paper-icon-button>
+    <template is="dom-if" if="[[showingSearch_]]" id="search-container">
+      <paper-input-container id="search-term" on-search="onSearchTermSearch_" on-keydown="onSearchTermKeydown_" hidden$="[[!showingSearch_]]" no-label-float="">
+        <input is="iron-input" id="search-input" type="search" placeholder="[[label]]" incremental="">
+        <paper-icon-button icon="cancel" id="clear-search" on-click="toggleShowingSearch_" title="[[clearLabel]]" hidden$="[[!showingSearch_]]"></paper-icon-button>
+      </paper-input-container>
+    </template>
+  </template>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+:host {
+  -webkit-padding-end: 10px;
+  box-sizing: border-box;
+  display: flex;
+  justify-content: flex-end;
+}
+
+:host paper-input-container {
+  margin-top: 2px;
+  max-width: 200px;
+  padding: 2px 0;
+  width: 100%;
+}
+
+#search-term {
+  --paper-input-container-color: rgb(192, 199, 205);
+  --paper-input-container-focus-color: rgb(192, 199, 205);
+  --paper-input-container-input: {
+    color: inherit;
+    font-family: inherit;
+    font-size: inherit;
+  };
+  --paper-input-container-input-color: rgb(192, 199, 205);
+  color: rgb(192, 199, 205);
+  z-index: 0;
+}
+
+#search-term input[type='search']::-webkit-search-decoration,
+#search-term input[type='search']::-webkit-search-cancel-button,
+#search-term input[type='search']::-webkit-search-results-button {
+  -webkit-appearance: none;
+}
+
+#search-term input[type='search']::-webkit-search-cancel-button {
+  display: block;
+  width: 20px;
+}
+
+paper-icon-button {
+  --iron-icon-height: 20px;
+  --iron-icon-width: 20px;
+  --paper-icon-button: {
+    height: 20px;
+    padding: 6px;
+    width: 20px;
+  };
+}
+
+#search-term paper-icon-button {
+  --iron-icon-height: 16px;
+  --iron-icon-width: 16px;
+  --paper-icon-button: {
+    -webkit-margin-end: -8px;
+    height: 16px;
+    padding: 8px;
+    width: 16px;
+  };
+  position: absolute;
+  right: 0;
+  top: -4px;
+  z-index: 1;
+}
+
+:host-context([dir='rtl']) #search-term paper-icon-button {
+  left: 0;
+  right: auto;
+}
+
+</style>
+  </dom-module>
+<dom-module id="downloads-toolbar" assetpath="chrome://downloads/">
+  <template>
+    <div id="title">
+      <h1 i18n-content="title"></h1>
+    </div>
+    <div id="actions">
+      <paper-button class="clear-all" i18n-content="clearAll" on-click="onClearAllClick_"></paper-button>
+      <paper-button i18n-content="openDownloadsFolder" on-click="onOpenDownloadsFolderClick_"></paper-button>
+    </div>
+    <div id="search">
+      <cr-search-field id="search-input" i18n-values="label:search;clear-label:clearSearch"></cr-search-field>
+      <paper-menu-button id="more" horizontal-align="right">
+        <paper-icon-button icon="more-vert" i18n-values="title:moreActions" class="dropdown-trigger"></paper-icon-button>
+        <paper-menu class="dropdown-content">
+          <paper-item class="clear-all" i18n-content="clearAll" on-click="onClearAllClick_"></paper-item>
+          <paper-item i18n-content="openDownloadsFolder" on-click="onOpenDownloadsFolderClick_"></paper-item>
+        </paper-menu>
+      </paper-menu-button>
+    </div>
+  </template>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+* {
+  --downloads-item-width: 622px;
+}
+
+paper-button {
+  font-weight: 500;
+  margin: 0;
+  min-width: auto;
+}
+
+</style>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+:host {
+  align-items: center;
+  background: rgb(63, 85, 102);
+  color: white;
+  content-sizing: padding-box;
+  display: flex;
+  height: 56px;
+}
+
+#title h1 {
+  -webkit-margin-end: 0;
+  -webkit-margin-start: 24px;
+  font-size: 107.7%;
+  font-weight: normal;
+  margin-bottom: 0;
+  margin-top: 0;
+}
+
+#actions {
+  display: flex;
+  flex: none;
+  width: var(--downloads-item-width);
+}
+
+:host(:not([downloads-showing])) #actions {
+  justify-content: center;
+}
+
+#actions paper-button:first-of-type {
+  -webkit-margin-start: -0.57em;  /* Matches paper-button padding. */
+}
+
+#actions paper-button:not(:last-of-type) {
+  -webkit-margin-end: 8px;  /* Margin between items. */
+}
+
+#actions paper-button:last-of-type {
+  -webkit-margin-end: -0.57em;  /* Matches paper-button padding. */
+}
+
+/* TODO(dbeam): use --paper-button-flat-keyboard-focus when possible.
+ * https://github.com/PolymerElements/paper-button/pull/54 */
+#actions paper-button /deep/ .keyboard-focus {
+  color: white;
+}
+
+#actions {
+  color: rgb(192, 199, 205);
+}
+
+#search {
+  -webkit-padding-end: 10px;
+  box-sizing: border-box;
+  display: flex;
+  justify-content: flex-end;
+}
+
+#title,
+#search {
+  /* (1024 total width - 622 item width) / 2 = 201 room to play. */
+  flex: 1 0 201px;
+}
+
+paper-icon-button {
+  --iron-icon-height: 20px;
+  --iron-icon-width: 20px;
+  --paper-icon-button: {
+    height: 20px;
+    padding: 6px;
+    width: 20px;
+  };
+}
+
+#more {
+  --paper-menu-button: {
+    padding: 0;
+  };
+  -webkit-margin-start: 16px;
+}
+
+paper-item {
+  -webkit-user-select: none;
+  cursor: pointer;
+  font: inherit;
+  min-height: 40px;
+}
+
+paper-item:hover {
+  background: #eaeaea;  /* TODO(dbeam): real color? */
+}
+
+@media not all and (max-width: 1024px) {
+  /* Hide vertical dot menu when there's enough room for #actions. */
+  paper-menu-button {
+    display: none;
+  }
+}
+
+@media all and (max-width: 1024px) {
+  /* Hide #actions for narrow windows; they're shown in a vertical dot menu. */
+  #actions {
+    display: none;
+  }
+}
+
+</style>
+  </dom-module>
+<dom-module id="downloads-manager" assetpath="chrome://downloads/">
+  <template>
+    <paper-header-panel id="panel" class="loading">
+      <downloads-toolbar class="paper-header" id="toolbar"></downloads-toolbar>
+      <div id="downloads-list" hidden$="[[!hasDownloads_]]"></div>
+      <div id="no-downloads" hidden$="[[hasDownloads_]]">
+        <div>
+          <div class="illustration"></div>
+          <span></span>
+        </div>
+      </div>
+    </paper-header-panel>
+  </template>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+* {
+  --downloads-item-width: 622px;
+}
+
+paper-button {
+  font-weight: 500;
+  margin: 0;
+  min-width: auto;
+}
+
+</style>
+  <style>
+/* Copyright 2015 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file. */
+
+:host {
+  display: flex;
+  flex: 1 0;
+  flex-direction: column;
+  height: 100%;
+}
+
+@media screen and (max-width: 1024px) {
+  :host {
+    flex-basis: 670px;  /* 622 card width + 24 left margin + 24 right margin. */
+  }
+}
+
+#panel {
+  --paper-header-panel-shadow: {
+    display: none;
+  };
+  --paper-header-panel-standard-container: {
+    display: flex;
+    overflow-y: overlay;
+  };
+}
+
+#no-downloads,
+#downloads-list {
+  flex: 1;
+}
+
+.loading #no-downloads,
+.loading #downloads-list {
+  display: none;
+}
+
+#no-downloads {
+  align-items: center;
+  color: #b4b4b4;
+  display: flex;
+  font-size: 123.1%;
+  font-weight: 500;
+  justify-content: center;
+}
+
+#no-downloads .illustration {
+  background: -webkit-image-set(
+      url("chrome://downloads/1x/no_downloads.png") 1x,
+      url("chrome://downloads/2x/no_downloads.png") 2x) no-repeat center center;
+  height: 144px;  /* Matches natural image height. */
+  margin-bottom: 32px;
+}
+
+</style>
+  </dom-module>
+</div>
+  <downloads-manager></downloads-manager>
+  <command id="clear-all-command" shortcut="Alt-U+0043"></command>
+<if expr="is_macosx">
+  <command id="undo-command" shortcut="Meta-U+005A"></command>
+</if>
+<if expr="not is_macosx">
+  <command id="undo-command" shortcut="Ctrl-U+005A"></command>
+</if>
+  <script src="crisper.js"></script></body></html>
\ No newline at end of file
diff --git a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.css b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.css
index 278cc9ff..b8df52e3 100644
--- a/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.css
+++ b/chrome/browser/resources/media_router/elements/media_router_container/media_router_container.css
@@ -29,6 +29,10 @@
   width: 15px;
 }
 
+#container-header {
+  background-color: rgb(33, 150, 243);
+}
+
 #container-header.cast-mode-list {
   background-color: rgb(0, 150, 136);
 }
@@ -37,14 +41,6 @@
   background-color: rgb(103, 58, 183);
 }
 
-#container-header.route-details {
-  display: none;
-}
-
-#container-header.sink-list {
-  background-color: rgb(33, 150, 243);
-}
-
 #device-missing {
   align-items: center;
   display: flex;
diff --git a/chrome/browser/resources/net_internals/log_view_painter.js b/chrome/browser/resources/net_internals/log_view_painter.js
index 4b29de39..bbfaae41 100644
--- a/chrome/browser/resources/net_internals/log_view_painter.js
+++ b/chrome/browser/resources/net_internals/log_view_painter.js
@@ -536,9 +536,7 @@
     var suffix = line.slice(prefix.length);
     // If private information has already been removed, keep the line as-is.
     // This is often the case when viewing a loaded log.
-    // TODO(mmenke):  Remove '[value was stripped]' check once M24 hits stable.
-    if (suffix.search(/^\[[0-9]+ bytes were stripped\]$/) == -1 &&
-        suffix != '[value was stripped]') {
+    if (suffix.search(/^\[[0-9]+ bytes were stripped\]$/) == -1) {
       return prefix + '[' + suffix.length + ' bytes were stripped]';
     }
   }
diff --git a/chrome/browser/resources/options/manage_profile_overlay.js b/chrome/browser/resources/options/manage_profile_overlay.js
index 5b3e41f..1f80642 100644
--- a/chrome/browser/resources/options/manage_profile_overlay.js
+++ b/chrome/browser/resources/options/manage_profile_overlay.js
@@ -95,25 +95,11 @@
 
       $('create-profile-supervised-sign-in-link').onclick =
           function(event) {
-        // Without the new avatar menu, the signin process will open an overlay
-        // to configure sync, which would replace this overlay. It's smoother to
-        // close this one now.
-        // With the new avatar menu enabled, a sign-in flow in the avatar menu
-        // is triggered instead, which does not open any overlays, so there's no
-        // need to close this one.
-        if (!loadTimeData.getBoolean('newAvatarMenuEnabled')) {
-          // TODO(pamg): Move the sync-setup overlay to a higher layer so this
-          // one can stay open under it, after making sure that doesn't break
-          // anything else.
-          PageManager.closeOverlay();
-        }
         SyncSetupOverlay.startSignIn();
       };
 
       $('create-profile-supervised-sign-in-again-link').onclick =
           function(event) {
-        if (!loadTimeData.getBoolean('newAvatarMenuEnabled'))
-          PageManager.closeOverlay();
         SyncSetupOverlay.showSetupUI();
       };
 
diff --git a/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js b/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js
index 40d40ec..c65365c9 100644
--- a/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js
+++ b/chrome/browser/resources/pdf/elements/viewer-zoom-toolbar/viewer-zoom-toolbar.js
@@ -22,6 +22,10 @@
       }
     },
 
+    isVisible: function() {
+      return this.visible_;
+    },
+
     setTooltips_: function() {
       this.$['fit-button'].tooltips =
           [this.strings.tooltipFitToPage, this.strings.tooltipFitToWidth];
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
index e156922..ee47cd4 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -429,7 +429,7 @@
   handleMouseEvent_: function(e) {
     if (this.isMaterial_) {
       if (e.type == 'mousemove')
-        this.toolbarManager_.showToolbarsForMouseMove(e);
+        this.toolbarManager_.handleMouseMove(e);
       else if (e.type == 'mouseout')
         this.toolbarManager_.hideToolbarsForMouseOut();
     }
diff --git a/chrome/browser/resources/pdf/toolbar_manager.js b/chrome/browser/resources/pdf/toolbar_manager.js
index 0eafe8b..bef7cf8 100644
--- a/chrome/browser/resources/pdf/toolbar_manager.js
+++ b/chrome/browser/resources/pdf/toolbar_manager.js
@@ -77,11 +77,13 @@
 
 ToolbarManager.prototype = {
 
-  showToolbarsForMouseMove: function(e) {
+  handleMouseMove: function(e) {
     this.isMouseNearTopToolbar_ = this.toolbar_ && isMouseNearTopToolbar(e);
     this.isMouseNearSideToolbar_ = isMouseNearSideToolbar(e);
 
     this.keyboardNavigationActive = false;
+    var touchInteractionActive =
+        (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents);
 
     // Allow the top toolbar to be shown if the mouse moves away from the side
     // toolbar (as long as the timeout has elapsed).
@@ -92,10 +94,16 @@
     if (this.isMouseNearTopToolbar_)
       this.sideToolbarAllowedOnly_ = false;
 
-    // Show the toolbars if the mouse is near the top or right of the screen or
-    // if the mouse moved fast.
+    // Tapping the screen with toolbars open tries to close them.
+    if (touchInteractionActive && this.zoomToolbar_.isVisible()) {
+      this.hideToolbarsIfAllowed();
+      return;
+    }
+
+    // Show the toolbars if the mouse is near the top or bottom-right of the
+    // screen, if the mouse moved fast, or if the touchscreen was tapped.
     if (this.isMouseNearTopToolbar_ || this.isMouseNearSideToolbar_ ||
-        isHighVelocityMouseMove(e)) {
+        isHighVelocityMouseMove(e) || touchInteractionActive) {
       if (this.sideToolbarAllowedOnly_)
         this.zoomToolbar_.show();
       else
diff --git a/chrome/browser/resources/settings/internet_page/network_proxy.js b/chrome/browser/resources/settings/internet_page/network_proxy.js
index 110eb42a..c7c02e6 100644
--- a/chrome/browser/resources/settings/internet_page/network_proxy.js
+++ b/chrome/browser/resources/settings/internet_page/network_proxy.js
@@ -90,14 +90,14 @@
   /**
    * Saved Manual properties so that switching to another type does not loose
    * any set properties while the UI is open.
-   * @type {CrOnc.ManualProxySettings|undefined}
+   * @type {!CrOnc.ManualProxySettings|undefined}
    */
   savedManual_: undefined,
 
   /**
    * Saved ExcludeDomains properties so that switching to a non-Manual type does
    * not loose any set exclusions while the UI is open.
-   * @type {Array<string>|undefined}
+   * @type {!Array<string>|undefined}
    */
   savedExcludeDomains_: undefined,
 
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
index 093542db..468ab86 100644
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.cc
@@ -9,11 +9,13 @@
 #include <algorithm>
 #include <vector>
 
+#include "base/metrics/field_trial.h"
 #include "base/metrics/histogram.h"
 #include "base/prefs/pref_service.h"
 #include "base/process/process_info.h"
 #include "base/single_thread_task_runner.h"
 #include "base/stl_util.h"
+#include "base/strings/string_util.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/threading/sequenced_worker_pool.h"
 #include "chrome/browser/chrome_notification_types.h"
@@ -366,6 +368,13 @@
   download_metadata_manager_.AddDownloadManager(download_manager);
 }
 
+// static
+bool IncidentReportingService::IsEnabled() {
+  std::string group_name = base::FieldTrialList::FindFullName(
+      "SafeBrowsingIncidentReportingService");
+  return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
+}
+
 IncidentReportingService::IncidentReportingService(
     SafeBrowsingService* safe_browsing_service,
     const scoped_refptr<net::URLRequestContextGetter>& request_context_getter,
@@ -804,6 +813,8 @@
                              prefs::kSafeBrowsingExtendedReportingEnabled) :
                        false);
 
+  process->set_field_trial_participant(IsEnabled());
+
   // Associate process-wide incidents with the profile that benefits from the
   // strongest safe browsing protections.
   ProfileContext* null_context = GetProfileContext(NULL);
diff --git a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h
index b9f85d1..001dd994 100644
--- a/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h
+++ b/chrome/browser/safe_browsing/incident_reporting/incident_reporting_service.h
@@ -97,6 +97,9 @@
   // storage.
   void AddDownloadManager(content::DownloadManager* download_manager);
 
+  // Returns true if incident reporting is enabled via a field trial.
+  static bool IsEnabled();
+
  protected:
   // A pointer to a function that populates a protobuf with environment data.
   typedef void (*CollectEnvironmentDataFn)(
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index 82c661e..fc2f2ed 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -11,7 +11,6 @@
 #include "base/callback.h"
 #include "base/command_line.h"
 #include "base/lazy_instance.h"
-#include "base/metrics/field_trial.h"
 #include "base/metrics/histogram_macros.h"
 #include "base/path_service.h"
 #include "base/prefs/pref_change_registrar.h"
@@ -95,15 +94,6 @@
       SafeBrowsingService::GetBaseFilename().value() + kCookiesFile);
 }
 
-#if defined(FULL_SAFE_BROWSING)
-// Returns true if the incident reporting service is enabled via a field trial.
-bool IsIncidentReportingServiceEnabled() {
-  const std::string group_name = base::FieldTrialList::FindFullName(
-      "SafeBrowsingIncidentReportingService");
-  return group_name == "Enabled";
-}
-#endif  // defined(FULL_SAFE_BROWSING)
-
 #if defined(SAFE_BROWSING_DB_REMOTE)
 // Android field trial
 const char kAndroidFieldExperiment[] = "SafeBrowsingAndroid";
@@ -268,7 +258,7 @@
       this, url_request_context_getter_.get()));
 #endif
 
-  if (IsIncidentReportingServiceEnabled()) {
+  if (safe_browsing::IncidentReportingService::IsEnabled()) {
     incident_service_.reset(new safe_browsing::IncidentReportingService(
         this, url_request_context_getter_));
     resource_request_detector_.reset(new safe_browsing::ResourceRequestDetector(
diff --git a/chrome/browser/safe_browsing/srt_fetcher_win.cc b/chrome/browser/safe_browsing/srt_fetcher_win.cc
index a4787b1..e21be259 100644
--- a/chrome/browser/safe_browsing/srt_fetcher_win.cc
+++ b/chrome/browser/safe_browsing/srt_fetcher_win.cc
@@ -13,9 +13,12 @@
 #include "base/metrics/sparse_histogram.h"
 #include "base/prefs/pref_service.h"
 #include "base/process/launch.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/utf_string_conversions.h"
 #include "base/task_runner_util.h"
 #include "base/threading/thread_checker.h"
 #include "base/time/time.h"
+#include "base/win/registry.h"
 #include "chrome/browser/browser_process.h"
 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h"
 #include "chrome/browser/profiles/profile.h"
@@ -28,6 +31,7 @@
 #include "chrome/browser/ui/global_error/global_error_service.h"
 #include "chrome/browser/ui/global_error/global_error_service_factory.h"
 #include "components/component_updater/pref_names.h"
+#include "components/rappor/rappor_service.h"
 #include "components/variations/net/variations_http_header_provider.h"
 #include "content/public/browser/browser_thread.h"
 #include "net/base/load_flags.h"
@@ -40,6 +44,9 @@
 
 namespace safe_browsing {
 
+const wchar_t kSoftwareRemovalToolRegistryKey[] =
+    L"Software\\Google\\Software Removal Tool";
+
 namespace {
 
 // Overrides for the reporter launcher and prompt triggers free function, used
@@ -47,6 +54,12 @@
 ReporterLauncher g_reporter_launcher_;
 PromptTrigger g_prompt_trigger_;
 
+const wchar_t kFoundUwsValueName[] = L"FoundUws";
+
+const char kFoundUwsMetricName[] = "SoftwareReporter.FoundUwS";
+const char kFoundUwsReadErrorMetricName[] =
+    "SoftwareReporter.FoundUwSReadError";
+
 void DisplaySRTPrompt(const base::FilePath& download_path) {
   // Find the last active browser, which may be NULL, in which case we won't
   // show the prompt this time and will wait until the next run of the
@@ -120,6 +133,40 @@
   return exit_code;
 }
 
+// Reports UwS found by the software reporter tool via UMA and RAPPOR.
+void ReportFoundUwS() {
+  base::win::RegKey reporter_key(HKEY_CURRENT_USER,
+                                 kSoftwareRemovalToolRegistryKey,
+                                 KEY_QUERY_VALUE | KEY_SET_VALUE);
+  std::vector<base::string16> found_uws_strings;
+  if (reporter_key.Valid() &&
+      reporter_key.ReadValues(kFoundUwsValueName, &found_uws_strings) ==
+          ERROR_SUCCESS) {
+    rappor::RapporService* rappor_service = g_browser_process->rappor_service();
+
+    bool parse_error = false;
+    for (const base::string16& uws_string : found_uws_strings) {
+      // All UwS ids are expected to be integers.
+      uint32_t uws_id = 0;
+      if (base::StringToUint(uws_string, &uws_id)) {
+        UMA_HISTOGRAM_SPARSE_SLOWLY(kFoundUwsMetricName, uws_id);
+        if (rappor_service) {
+          rappor_service->RecordSample(kFoundUwsMetricName,
+                                       rappor::COARSE_RAPPOR_TYPE,
+                                       base::UTF16ToUTF8(uws_string));
+        }
+      } else {
+        parse_error = true;
+      }
+    }
+
+    // Clean up the old value.
+    reporter_key.DeleteValue(kFoundUwsValueName);
+
+    UMA_HISTOGRAM_BOOLEAN(kFoundUwsReadErrorMetricName, parse_error);
+  }
+}
+
 }  // namespace
 
 // Class that will attempt to download the SRT, showing the SRT notification
@@ -302,6 +349,7 @@
       return;
 
     UMA_HISTOGRAM_SPARSE_SLOWLY("SoftwareReporter.ExitCode", exit_code);
+    ReportFoundUwS();
     PrefService* local_state = g_browser_process->local_state();
     if (local_state) {
       local_state->SetInteger(prefs::kSwReporterLastExitCode, exit_code);
diff --git a/chrome/browser/safe_browsing/srt_fetcher_win.h b/chrome/browser/safe_browsing/srt_fetcher_win.h
index 27333e4..76f2813 100644
--- a/chrome/browser/safe_browsing/srt_fetcher_win.h
+++ b/chrome/browser/safe_browsing/srt_fetcher_win.h
@@ -19,6 +19,9 @@
 
 namespace safe_browsing {
 
+// The registry key for the Reporter and Cleaner.
+extern const wchar_t kSoftwareRemovalToolRegistryKey[];
+
 // Reporter exit codes.
 const int kSwReporterCleanupNeeded = 0;
 const int kSwReporterNothingFound = 2;
diff --git a/chrome/browser/search/local_ntp_source.cc b/chrome/browser/search/local_ntp_source.cc
index 7fecfbf..944f29de 100644
--- a/chrome/browser/search/local_ntp_source.cc
+++ b/chrome/browser/search/local_ntp_source.cc
@@ -186,7 +186,7 @@
     return;
   }
 
-#if !defined(OFFICIAL_BUILD)
+#if !defined(GOOGLE_CHROME_BUILD)
   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
   if (command_line->HasSwitch(switches::kLocalNtpReload)) {
     if (stripped_path == "local-ntp.html" || stripped_path == "local-ntp.js" ||
diff --git a/chrome/browser/search/most_visited_iframe_source.cc b/chrome/browser/search/most_visited_iframe_source.cc
index 126bec2..48671d1 100644
--- a/chrome/browser/search/most_visited_iframe_source.cc
+++ b/chrome/browser/search/most_visited_iframe_source.cc
@@ -50,7 +50,7 @@
   GURL url(chrome::kChromeSearchMostVisitedUrl + path_and_query);
   std::string path(url.path());
 
-#if !defined(OFFICIAL_BUILD)
+#if !defined(GOOGLE_CHROME_BUILD)
   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
   if (command_line->HasSwitch(switches::kLocalNtpReload)) {
     std::string rel_path = "most_visited_" + path.substr(1);
diff --git a/chrome/browser/shell_integration.cc b/chrome/browser/shell_integration.cc
index 2ac4b58..25e8ec7 100644
--- a/chrome/browser/shell_integration.cc
+++ b/chrome/browser/shell_integration.cc
@@ -29,6 +29,25 @@
 
 using content::BrowserThread;
 
+namespace {
+
+const struct ShellIntegration::AppModeInfo* gAppModeInfo = nullptr;
+
+}  // namespace
+
+#if !defined(OS_WIN)
+// static
+bool ShellIntegration::SetAsDefaultBrowserInteractive() {
+  return false;
+}
+
+// static
+bool ShellIntegration::SetAsDefaultProtocolClientInteractive(
+    const std::string& protocol) {
+  return false;
+}
+#endif  // !defined(OS_WIN)
+
 // static
 ShellIntegration::DefaultWebClientSetPermission
     ShellIntegration::CanSetAsDefaultProtocolClient() {
@@ -37,7 +56,12 @@
   return CanSetAsDefaultBrowser();
 }
 
-static const struct ShellIntegration::AppModeInfo* gAppModeInfo = NULL;
+#if !defined(OS_WIN)
+// static
+bool ShellIntegration::IsElevationNeededForSettingDefaultProtocolClient() {
+  return false;
+}
+#endif  // !defined(OS_WIN)
 
 // static
 void ShellIntegration::SetAppModeInfo(const struct AppModeInfo* info) {
@@ -112,31 +136,17 @@
 }
 
 #if !defined(OS_WIN)
-
 base::string16 ShellIntegration::GetAppShortcutsSubdirName() {
   if (chrome::GetChannel() == version_info::Channel::CANARY)
     return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME_CANARY);
   return l10n_util::GetStringUTF16(IDS_APP_SHORTCUTS_SUBDIR_NAME);
 }
-
-// static
-bool ShellIntegration::SetAsDefaultBrowserInteractive() {
-  return false;
-}
-
-// static
-bool ShellIntegration::SetAsDefaultProtocolClientInteractive(
-    const std::string& protocol) {
-  return false;
-}
-
-// static
-bool ShellIntegration::IsElevationNeededForSettingDefaultProtocolClient() {
-  return false;
-}
-
 #endif  // !defined(OS_WIN)
 
+///////////////////////////////////////////////////////////////////////////////
+// ShellIntegration::DefaultWebClientObserver
+//
+
 bool ShellIntegration::DefaultWebClientObserver::IsOwnedByWorker() {
   return false;
 }
diff --git a/chrome/browser/shell_integration.h b/chrome/browser/shell_integration.h
index c0e4491a..821c15f 100644
--- a/chrome/browser/shell_integration.h
+++ b/chrome/browser/shell_integration.h
@@ -241,6 +241,11 @@
     // the observer.
     void ExecuteCheckIsDefault();
 
+    // Communicate results to the observer. This function is posted as a task
+    // onto the UI thread by the ExecuteCheckIsDefault function running in the
+    // file thread.
+    void CompleteCheckIsDefault(DefaultWebClientState state);
+
     // Function that handles setting Chrome as the default web client on the
     // file thread. This function is posted as a task onto the file thread.
     // Once it is finished the CompleteSetAsDefault function is posted to the
@@ -251,11 +256,6 @@
     // returns SET_DEFAULT_INTERACTIVE).
     void ExecuteSetAsDefault(bool interactive_permitted);
 
-    // Communicate results to the observer. This function is posted as a task
-    // onto the UI thread by the ExecuteCheckIsDefault function running in the
-    // file thread.
-    void CompleteCheckIsDefault(DefaultWebClientState state);
-
     // When the action to set Chrome as the default has completed this function
     // is run. It is posted as a task back onto the UI thread by the
     // ExecuteSetAsDefault function running in the file thread. This function
diff --git a/chrome/browser/shell_integration_android.cc b/chrome/browser/shell_integration_android.cc
index 30623860b..14062b04 100644
--- a/chrome/browser/shell_integration_android.cc
+++ b/chrome/browser/shell_integration_android.cc
@@ -7,13 +7,6 @@
 
 // TODO: crbug/115375 to track implementation for following methods.
 // static
-ShellIntegration::DefaultWebClientSetPermission
-    ShellIntegration::CanSetAsDefaultBrowser() {
-  NOTIMPLEMENTED();
-  return SET_DEFAULT_NOT_ALLOWED;
-}
-
-// static
 bool ShellIntegration::SetAsDefaultBrowser() {
   NOTIMPLEMENTED();
   return false;
@@ -26,14 +19,14 @@
 }
 
 // static
-ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() {
+ShellIntegration::DefaultWebClientSetPermission
+    ShellIntegration::CanSetAsDefaultBrowser() {
   NOTIMPLEMENTED();
-  return UNKNOWN_DEFAULT;
+  return SET_DEFAULT_NOT_ALLOWED;
 }
 
 // static
-ShellIntegration::DefaultWebClientState
-ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
+ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() {
   NOTIMPLEMENTED();
   return UNKNOWN_DEFAULT;
 }
@@ -43,3 +36,9 @@
   return false;
 }
 
+// static
+ShellIntegration::DefaultWebClientState
+ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
+  NOTIMPLEMENTED();
+  return UNKNOWN_DEFAULT;
+}
diff --git a/chrome/browser/shell_integration_chromeos.cc b/chrome/browser/shell_integration_chromeos.cc
index 03c82a0..b08d1ec 100644
--- a/chrome/browser/shell_integration_chromeos.cc
+++ b/chrome/browser/shell_integration_chromeos.cc
@@ -5,12 +5,6 @@
 #include "chrome/browser/shell_integration.h"
 
 // static
-ShellIntegration::DefaultWebClientSetPermission
-    ShellIntegration::CanSetAsDefaultBrowser() {
-  return SET_DEFAULT_NOT_ALLOWED;
-}
-
-// static
 bool ShellIntegration::SetAsDefaultBrowser() {
   return false;
 }
@@ -21,13 +15,13 @@
 }
 
 // static
-ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() {
-  return UNKNOWN_DEFAULT;
+ShellIntegration::DefaultWebClientSetPermission
+    ShellIntegration::CanSetAsDefaultBrowser() {
+  return SET_DEFAULT_NOT_ALLOWED;
 }
 
 // static
-ShellIntegration::DefaultWebClientState
-ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
+ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() {
   return UNKNOWN_DEFAULT;
 }
 
@@ -36,3 +30,8 @@
   return false;
 }
 
+// static
+ShellIntegration::DefaultWebClientState
+ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
+  return UNKNOWN_DEFAULT;
+}
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index 5994d97..e10795d 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -497,12 +497,6 @@
 }  // namespace
 
 // static
-ShellIntegration::DefaultWebClientSetPermission
-ShellIntegration::CanSetAsDefaultBrowser() {
-  return SET_DEFAULT_UNATTENDED;
-}
-
-// static
 bool ShellIntegration::SetAsDefaultBrowser() {
   return SetDefaultWebClient(std::string());
 }
@@ -514,9 +508,9 @@
 }
 
 // static
-ShellIntegration::DefaultWebClientState
-ShellIntegration::GetDefaultBrowser() {
-  return GetIsDefaultWebClient(std::string());
+ShellIntegration::DefaultWebClientSetPermission
+ShellIntegration::CanSetAsDefaultBrowser() {
+  return SET_DEFAULT_UNATTENDED;
 }
 
 // static
@@ -527,8 +521,8 @@
 
 // static
 ShellIntegration::DefaultWebClientState
-ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
-  return GetIsDefaultWebClient(protocol);
+ShellIntegration::GetDefaultBrowser() {
+  return GetIsDefaultWebClient(std::string());
 }
 
 // static
@@ -544,6 +538,12 @@
   return browser.find("irefox") != std::string::npos;
 }
 
+// static
+ShellIntegration::DefaultWebClientState
+ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
+  return GetIsDefaultWebClient(protocol);
+}
+
 namespace shell_integration_linux {
 
 base::FilePath GetDataWriteLocation(base::Environment* env) {
diff --git a/chrome/browser/shell_integration_mac.mm b/chrome/browser/shell_integration_mac.mm
index 9507d3df..08b60bd 100644
--- a/chrome/browser/shell_integration_mac.mm
+++ b/chrome/browser/shell_integration_mac.mm
@@ -11,15 +11,42 @@
 #include "components/version_info/version_info.h"
 #import "third_party/mozilla/NSWorkspace+Utils.h"
 
-ShellIntegration::DefaultWebClientSetPermission
-    ShellIntegration::CanSetAsDefaultBrowser() {
-  if (chrome::GetChannel() != version_info::Channel::CANARY) {
-    return SET_DEFAULT_UNATTENDED;
-  }
+namespace {
 
-  return SET_DEFAULT_NOT_ALLOWED;
+// Returns true if |identifier| is the bundle id of the default browser.
+bool IsIdentifierDefaultBrowser(NSString* identifier) {
+  NSString* default_browser =
+      [[NSWorkspace sharedWorkspace] defaultBrowserIdentifier];
+  if (!default_browser)
+    return false;
+
+  // We need to ensure we do the comparison case-insensitive as LS doesn't
+  // persist the case of our bundle id.
+  NSComparisonResult result =
+      [default_browser caseInsensitiveCompare:identifier];
+  return result == NSOrderedSame;
 }
 
+// Returns true if |identifier| is the bundle id of the default client
+// application for the given protocol.
+bool IsIdentifierDefaultProtocolClient(NSString* identifier,
+                                       NSString* protocol) {
+  CFStringRef default_client_cf =
+      LSCopyDefaultHandlerForURLScheme(base::mac::NSToCFCast(protocol));
+  NSString* default_client = static_cast<NSString*>(
+      base::mac::CFTypeRefToNSObjectAutorelease(default_client_cf));
+  if (!default_client)
+    return false;
+
+  // We need to ensure we do the comparison case-insensitive as LS doesn't
+  // persist the case of our bundle id.
+  NSComparisonResult result =
+      [default_client caseInsensitiveCompare:identifier];
+  return result == NSOrderedSame;
+}
+
+}  // namespace
+
 // Sets Chromium as default browser to be used by the operating system. This
 // applies only for the current user. Returns false if this cannot be done, or
 // if the operation fails.
@@ -60,42 +87,15 @@
   return return_code == noErr;
 }
 
-namespace {
+ShellIntegration::DefaultWebClientSetPermission
+    ShellIntegration::CanSetAsDefaultBrowser() {
+  if (chrome::GetChannel() != version_info::Channel::CANARY) {
+    return SET_DEFAULT_UNATTENDED;
+  }
 
-// Returns true if |identifier| is the bundle id of the default browser.
-bool IsIdentifierDefaultBrowser(NSString* identifier) {
-  NSString* default_browser =
-      [[NSWorkspace sharedWorkspace] defaultBrowserIdentifier];
-  if (!default_browser)
-    return false;
-
-  // We need to ensure we do the comparison case-insensitive as LS doesn't
-  // persist the case of our bundle id.
-  NSComparisonResult result =
-      [default_browser caseInsensitiveCompare:identifier];
-  return result == NSOrderedSame;
+  return SET_DEFAULT_NOT_ALLOWED;
 }
 
-// Returns true if |identifier| is the bundle id of the default client
-// application for the given protocol.
-bool IsIdentifierDefaultProtocolClient(NSString* identifier,
-                                       NSString* protocol) {
-  CFStringRef default_client_cf =
-      LSCopyDefaultHandlerForURLScheme(base::mac::NSToCFCast(protocol));
-  NSString* default_client = static_cast<NSString*>(
-      base::mac::CFTypeRefToNSObjectAutorelease(default_client_cf));
-  if (!default_client)
-    return false;
-
-  // We need to ensure we do the comparison case-insensitive as LS doesn't
-  // persist the case of our bundle id.
-  NSComparisonResult result =
-      [default_client caseInsensitiveCompare:identifier];
-  return result == NSOrderedSame;
-}
-
-}  // namespace
-
 // static
 base::string16 ShellIntegration::GetApplicationNameForProtocol(
     const GURL& url) {
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 07f7b4b..a27448c 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -242,19 +242,6 @@
 
 }  // namespace
 
-ShellIntegration::DefaultWebClientSetPermission
-    ShellIntegration::CanSetAsDefaultBrowser() {
-  BrowserDistribution* distribution = BrowserDistribution::GetDistribution();
-  if (distribution->GetDefaultBrowserControlPolicy() !=
-          BrowserDistribution::DEFAULT_BROWSER_FULL_CONTROL)
-    return SET_DEFAULT_NOT_ALLOWED;
-
-  if (ShellUtil::CanMakeChromeDefaultUnattended())
-    return SET_DEFAULT_UNATTENDED;
-  else
-    return SET_DEFAULT_INTERACTIVE;
-}
-
 bool ShellIntegration::SetAsDefaultBrowser() {
   base::FilePath chrome_exe;
   if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
@@ -274,6 +261,23 @@
   return true;
 }
 
+bool ShellIntegration::SetAsDefaultBrowserInteractive() {
+  base::FilePath chrome_exe;
+  if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
+    NOTREACHED() << "Error getting app exe path";
+    return false;
+  }
+
+  BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+  if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe)) {
+    LOG(ERROR) << "Failed to launch the set-default-browser Windows UI.";
+    return false;
+  }
+
+  VLOG(1) << "Set-default-browser Windows UI completed.";
+  return true;
+}
+
 bool ShellIntegration::SetAsDefaultProtocolClient(const std::string& protocol) {
   if (protocol.empty())
     return false;
@@ -297,23 +301,6 @@
   return true;
 }
 
-bool ShellIntegration::SetAsDefaultBrowserInteractive() {
-  base::FilePath chrome_exe;
-  if (!PathService::Get(base::FILE_EXE, &chrome_exe)) {
-    NOTREACHED() << "Error getting app exe path";
-    return false;
-  }
-
-  BrowserDistribution* dist = BrowserDistribution::GetDistribution();
-  if (!ShellUtil::ShowMakeChromeDefaultSystemUI(dist, chrome_exe)) {
-    LOG(ERROR) << "Failed to launch the set-default-browser Windows UI.";
-    return false;
-  }
-
-  VLOG(1) << "Set-default-browser Windows UI completed.";
-  return true;
-}
-
 bool ShellIntegration::SetAsDefaultProtocolClientInteractive(
     const std::string& protocol) {
   base::FilePath chrome_exe;
@@ -334,22 +321,23 @@
   return true;
 }
 
+ShellIntegration::DefaultWebClientSetPermission
+    ShellIntegration::CanSetAsDefaultBrowser() {
+  BrowserDistribution* distribution = BrowserDistribution::GetDistribution();
+  if (distribution->GetDefaultBrowserControlPolicy() !=
+          BrowserDistribution::DEFAULT_BROWSER_FULL_CONTROL)
+    return SET_DEFAULT_NOT_ALLOWED;
+
+  if (ShellUtil::CanMakeChromeDefaultUnattended())
+    return SET_DEFAULT_UNATTENDED;
+  else
+    return SET_DEFAULT_INTERACTIVE;
+}
+
 bool ShellIntegration::IsElevationNeededForSettingDefaultProtocolClient() {
   return base::win::GetVersion() < base::win::VERSION_WIN8;
 }
 
-ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() {
-  return GetDefaultWebClientStateFromShellUtilDefaultState(
-      ShellUtil::GetChromeDefaultState());
-}
-
-ShellIntegration::DefaultWebClientState
-    ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
-  return GetDefaultWebClientStateFromShellUtilDefaultState(
-      ShellUtil::GetChromeDefaultProtocolClientState(
-          base::UTF8ToUTF16(protocol)));
-}
-
 base::string16 ShellIntegration::GetApplicationNameForProtocol(
     const GURL& url) {
   // Windows 8 or above requires a new protocol association query.
@@ -359,6 +347,11 @@
     return GetAppForProtocolUsingRegistry(url);
 }
 
+ShellIntegration::DefaultWebClientState ShellIntegration::GetDefaultBrowser() {
+  return GetDefaultWebClientStateFromShellUtilDefaultState(
+      ShellUtil::GetChromeDefaultState());
+}
+
 // There is no reliable way to say which browser is default on a machine (each
 // browser can have some of the protocols/shortcuts). So we look for only HTTP
 // protocol handler. Even this handler is located at different places in
@@ -392,6 +385,13 @@
   return ff_default;
 }
 
+ShellIntegration::DefaultWebClientState
+    ShellIntegration::IsDefaultProtocolClient(const std::string& protocol) {
+  return GetDefaultWebClientStateFromShellUtilDefaultState(
+      ShellUtil::GetChromeDefaultProtocolClientState(
+          base::UTF8ToUTF16(protocol)));
+}
+
 base::string16 ShellIntegration::GetAppModelIdForProfile(
     const base::string16& app_name,
     const base::FilePath& profile_path) {
diff --git a/chrome/browser/signin/easy_unlock_service.cc b/chrome/browser/signin/easy_unlock_service.cc
index 9cc7346..0eda490a9 100644
--- a/chrome/browser/signin/easy_unlock_service.cc
+++ b/chrome/browser/signin/easy_unlock_service.cc
@@ -532,7 +532,6 @@
   // the proximity_auth component.
   if (base::CommandLine::ForCurrentProcess()->HasSwitch(
           proximity_auth::switches::kEnableBluetoothLowEnergyDiscovery) &&
-      auth_attempt_type == EasyUnlockAuthAttempt::TYPE_UNLOCK &&
       proximity_auth_system_) {
     proximity_auth_system_->OnAuthAttempted(user_id);
   }
diff --git a/chrome/browser/signin/signin_global_error.cc b/chrome/browser/signin/signin_global_error.cc
index b2e8f86..71f8a46 100644
--- a/chrome/browser/signin/signin_global_error.cc
+++ b/chrome/browser/signin/signin_global_error.cc
@@ -35,12 +35,8 @@
     SigninErrorController* error_controller,
     Profile* profile)
     : profile_(profile),
-      error_controller_(error_controller),
-      is_added_to_global_error_service_(false) {
+      error_controller_(error_controller) {
   error_controller_->AddObserver(this);
-  is_added_to_global_error_service_ = !switches::IsNewAvatarMenu();
-  if (is_added_to_global_error_service_)
-    GlobalErrorServiceFactory::GetForProfile(profile_)->AddGlobalError(this);
 }
 
 SigninGlobalError::~SigninGlobalError() {
@@ -60,11 +56,6 @@
 }
 
 void SigninGlobalError::Shutdown() {
-  if (is_added_to_global_error_service_) {
-    GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError(this);
-    is_added_to_global_error_service_ = false;
-  }
-
   error_controller_->RemoveObserver(this);
   error_controller_ = NULL;
 }
@@ -106,15 +97,9 @@
   UMA_HISTOGRAM_ENUMERATION("Signin.Reauth",
                             signin_metrics::HISTOGRAM_REAUTH_SHOWN,
                             signin_metrics::HISTOGRAM_REAUTH_MAX);
-  if (switches::IsNewAvatarMenu()) {
-    browser->window()->ShowAvatarBubbleFromAvatarButton(
-        BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH,
-        signin::ManageAccountsParams());
-  } else {
-    chrome::ShowSingletonTab(
-        browser,
-        signin::GetReauthURL(profile_, error_controller_->error_account_id()));
-  }
+  browser->window()->ShowAvatarBubbleFromAvatarButton(
+      BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH,
+      signin::ManageAccountsParams());
 #endif
 }
 
diff --git a/chrome/browser/signin/signin_global_error.h b/chrome/browser/signin/signin_global_error.h
index 86846c8..4d642fc 100644
--- a/chrome/browser/signin/signin_global_error.h
+++ b/chrome/browser/signin/signin_global_error.h
@@ -62,9 +62,6 @@
   // The SigninErrorController that provides auth status.
   SigninErrorController* error_controller_;
 
-  // True if signin global error was added to the global error service.
-  bool is_added_to_global_error_service_;
-
   DISALLOW_COPY_AND_ASSIGN(SigninGlobalError);
 };
 
diff --git a/chrome/browser/signin/signin_promo.cc b/chrome/browser/signin/signin_promo.cc
index 0637886..9db75c8 100644
--- a/chrome/browser/signin/signin_promo.cc
+++ b/chrome/browser/signin/signin_promo.cc
@@ -197,12 +197,9 @@
 }
 
 GURL GetReauthURLWithEmail(const std::string& email) {
-  signin_metrics::Source source = switches::IsNewAvatarMenu() ?
-      signin_metrics::SOURCE_REAUTH : signin_metrics::SOURCE_SETTINGS;
-
   GURL url = signin::GetPromoURL(
-      source, true /* auto_close */,
-      switches::IsNewAvatarMenu() /* is_constrained */);
+      signin_metrics::SOURCE_REAUTH, true /* auto_close */,
+      true /* is_constrained */);
 
   url = net::AppendQueryParameter(url, "email", email);
   url = net::AppendQueryParameter(url, "validateEmail", "1");
diff --git a/chrome/browser/signin/signin_ui_util.cc b/chrome/browser/signin/signin_ui_util.cc
index f7f8a21..bca615f 100644
--- a/chrome/browser/signin/signin_ui_util.cc
+++ b/chrome/browser/signin/signin_ui_util.cc
@@ -163,7 +163,7 @@
 }
 
 void InitializePrefsForProfile(Profile* profile) {
-  if (profile->IsNewProfile() && switches::IsNewAvatarMenu()) {
+  if (profile->IsNewProfile()) {
     // Suppresses the upgrade tutorial for a new profile.
     profile->GetPrefs()->SetInteger(
         prefs::kProfileAvatarTutorialShown, kUpgradeWelcomeTutorialShowMax + 1);
diff --git a/chrome/browser/ssl/captive_portal_metrics_recorder.cc b/chrome/browser/ssl/captive_portal_metrics_recorder.cc
index 4f8473f..9449116 100644
--- a/chrome/browser/ssl/captive_portal_metrics_recorder.cc
+++ b/chrome/browser/ssl/captive_portal_metrics_recorder.cc
@@ -8,16 +8,13 @@
 
 #include "base/metrics/histogram_macros.h"
 #include "chrome/browser/browser_process.h"
+#include "chrome/browser/captive_portal/captive_portal_service.h"
+#include "chrome/browser/captive_portal/captive_portal_service_factory.h"
 #include "chrome/browser/chrome_notification_types.h"
 #include "chrome/browser/profiles/profile.h"
 #include "content/public/browser/notification_service.h"
 #include "content/public/browser/web_contents.h"
 
-#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
-#include "chrome/browser/captive_portal/captive_portal_service.h"
-#include "chrome/browser/captive_portal/captive_portal_service_factory.h"
-#endif
-
 namespace {
 
 // Events for UMA. Do not reorder or change!
@@ -34,37 +31,32 @@
   UNUSED_CAPTIVE_PORTAL_EVENT,
 };
 
-#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
 void RecordCaptivePortalEventStats(SSLInterstitialCauseCaptivePortal event) {
   UMA_HISTOGRAM_ENUMERATION("interstitial.ssl.captive_portal", event,
                             UNUSED_CAPTIVE_PORTAL_EVENT);
 }
-#endif
 
 }  // namespace
 
 CaptivePortalMetricsRecorder::CaptivePortalMetricsRecorder(
     content::WebContents* web_contents,
     bool overridable)
-    : captive_portal_detection_enabled_(false),
+    : overridable_(overridable),
+      captive_portal_detection_enabled_(false),
       captive_portal_probe_completed_(false),
       captive_portal_no_response_(false),
       captive_portal_detected_(false) {
-#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
-  overridable_ = overridable;
   Profile* profile =
       Profile::FromBrowserContext(web_contents->GetBrowserContext());
   captive_portal_detection_enabled_ =
       CaptivePortalServiceFactory::GetForProfile(profile)->enabled();
   registrar_.Add(this, chrome::NOTIFICATION_CAPTIVE_PORTAL_CHECK_RESULT,
                  content::Source<Profile>(profile));
-#endif
 }
 
 CaptivePortalMetricsRecorder::~CaptivePortalMetricsRecorder() {}
 
 void CaptivePortalMetricsRecorder::RecordCaptivePortalUMAStatistics() const {
-#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
   RecordCaptivePortalEventStats(CAPTIVE_PORTAL_ALL);
   if (captive_portal_detection_enabled_)
     RecordCaptivePortalEventStats(
@@ -83,14 +75,12 @@
     RecordCaptivePortalEventStats(overridable_
                                       ? CAPTIVE_PORTAL_NO_RESPONSE_OVERRIDABLE
                                       : CAPTIVE_PORTAL_NO_RESPONSE);
-#endif
 }
 
 void CaptivePortalMetricsRecorder::Observe(
     int type,
     const content::NotificationSource& source,
     const content::NotificationDetails& details) {
-#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
   // When detection is disabled, captive portal service always sends
   // RESULT_INTERNET_CONNECTED. Ignore any probe results in that case.
   if (!captive_portal_detection_enabled_)
@@ -116,5 +106,4 @@
         captive_portal_no_response_ ||
         (results->result == captive_portal::RESULT_NO_RESPONSE);
   }
-#endif
 }
diff --git a/chrome/browser/ssl/captive_portal_metrics_recorder.h b/chrome/browser/ssl/captive_portal_metrics_recorder.h
index 46932cbb..34a885d2 100644
--- a/chrome/browser/ssl/captive_portal_metrics_recorder.h
+++ b/chrome/browser/ssl/captive_portal_metrics_recorder.h
@@ -39,9 +39,7 @@
                const content::NotificationSource& source,
                const content::NotificationDetails& details) override;
 
-#if defined(ENABLE_CAPTIVE_PORTAL_DETECTION)
   bool overridable_;
-#endif
   bool captive_portal_detection_enabled_;
   // Did the probe complete before the interstitial was closed?
   bool captive_portal_probe_completed_;
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 656a4876..3e5991d 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -512,10 +512,15 @@
     "test/test_confirm_bubble_model.h",
     "toolbar/test_toolbar_action_view_controller.cc",
     "toolbar/test_toolbar_action_view_controller.h",
-    "website_settings/mock_permission_bubble_request.cc",
-    "website_settings/mock_permission_bubble_request.h",
   ]
 
+  if (!is_ios && !is_android) {
+    sources += [
+      "website_settings/mock_permission_bubble_request.cc",
+      "website_settings/mock_permission_bubble_request.h",
+    ]
+  }
+
   if (toolkit_views) {
     sources += [ "views/find_bar_host_unittest_util_views.cc" ]
     if (!is_mac) {
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 41d0a34..36d24b6 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -43,7 +43,6 @@
 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
 #include "chrome/browser/custom_handlers/protocol_handler_registry.h"
 #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h"
-#include "chrome/browser/custom_handlers/register_protocol_handler_infobar_delegate.h"
 #include "chrome/browser/custom_handlers/register_protocol_handler_permission_request.h"
 #include "chrome/browser/defaults.h"
 #include "chrome/browser/devtools/devtools_toggle_action.h"
@@ -1821,13 +1820,10 @@
 
   PermissionBubbleManager* bubble_manager =
       PermissionBubbleManager::FromWebContents(web_contents);
-  if (PermissionBubbleManager::Enabled() && bubble_manager) {
+  if (bubble_manager) {
     bubble_manager->AddRequest(
         new RegisterProtocolHandlerPermissionRequest(registry, handler,
                                                      url, user_gesture));
-  } else {
-    RegisterProtocolHandlerInfoBarDelegate::Create(
-        InfoBarService::FromWebContents(web_contents), registry, handler);
   }
 }
 
diff --git a/chrome/browser/ui/browser_command_controller_browsertest.cc b/chrome/browser/ui/browser_command_controller_browsertest.cc
index feb5af2..5a03f0a 100644
--- a/chrome/browser/ui/browser_command_controller_browsertest.cc
+++ b/chrome/browser/ui/browser_command_controller_browsertest.cc
@@ -78,9 +78,6 @@
 // Flakes http://crbug.com/471953
 IN_PROC_BROWSER_TEST_F(BrowserCommandControllerBrowserTest,
                        DISABLED_NewAvatarMenuEnabledInGuestMode) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   EXPECT_EQ(1U, BrowserList::GetInstance(chrome::GetActiveDesktop())->size());
 
   // Create a guest browser nicely. Using CreateProfile() and CreateBrowser()
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc
index a80c758..c6c9a90 100644
--- a/chrome/browser/ui/browser_command_controller_unittest.cc
+++ b/chrome/browser/ui/browser_command_controller_unittest.cc
@@ -173,15 +173,10 @@
   EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_FULLSCREEN));
 }
 
-TEST_F(BrowserCommandControllerTest, OldAvatarMenuEnabledForOneOrMoreProfiles) {
+TEST_F(BrowserCommandControllerTest, AvatarAcceleratorEnabledOnDesktop) {
   if (!profiles::IsMultipleProfilesEnabled())
     return;
 
-  // The command line is reset at the end of every test by the test suite.
-  switches::DisableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-  ASSERT_FALSE(switches::IsNewAvatarMenu());
-
   TestingProfileManager testing_profile_manager(
       TestingBrowserProcess::GetGlobal());
   ASSERT_TRUE(testing_profile_manager.SetUp());
@@ -211,33 +206,6 @@
   testing_profile_manager.DeleteTestingProfile("p2");
 }
 
-TEST_F(BrowserCommandControllerTest, NewAvatarMenuEnabledWhenOnlyOneProfile) {
-  if (!profiles::IsMultipleProfilesEnabled())
-    return;
-
-  // The command line is reset at the end of every test by the test suite.
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
-  TestingProfileManager testing_profile_manager(
-      TestingBrowserProcess::GetGlobal());
-  ASSERT_TRUE(testing_profile_manager.SetUp());
-  ProfileManager* profile_manager = testing_profile_manager.profile_manager();
-
-  chrome::BrowserCommandController command_controller(browser());
-  const CommandUpdater* command_updater = command_controller.command_updater();
-
-  testing_profile_manager.CreateTestingProfile("p1");
-  ASSERT_EQ(1U, profile_manager->GetNumberOfProfiles());
-#if defined(OS_CHROMEOS)
-  // Chrome OS uses system tray menu to handle multi-profiles.
-  EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
-#else
-  EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
-#endif
-  testing_profile_manager.DeleteTestingProfile("p1");
-}
-
 TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) {
   if (!profiles::IsMultipleProfilesEnabled())
     return;
@@ -255,15 +223,7 @@
   chrome::BrowserCommandController command_controller(otr_browser.get());
   const CommandUpdater* command_updater = command_controller.command_updater();
 
-  // Both the old style and the new style avatar menu should be disabled.
-  EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
-  if (switches::IsNewAvatarMenu()) {
-    switches::DisableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
-  } else {
-    switches::EnableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
-  }
+  // The avatar menu should be disabled.
   EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_AVATAR_MENU));
   // The command line is reset at the end of every test by the test suite.
 }
diff --git a/chrome/browser/ui/chrome_bubble_manager.cc b/chrome/browser/ui/chrome_bubble_manager.cc
index b3ed18b..368aff1 100644
--- a/chrome/browser/ui/chrome_bubble_manager.cc
+++ b/chrome/browser/ui/chrome_bubble_manager.cc
@@ -5,6 +5,7 @@
 #include "chrome/browser/ui/chrome_bubble_manager.h"
 
 #include "base/metrics/histogram_macros.h"
+#include "base/metrics/sparse_histogram.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "components/bubble/bubble_controller.h"
 #include "components/bubble/bubble_delegate.h"
@@ -15,11 +16,18 @@
 
 // Add any new enum before BUBBLE_TYPE_MAX and update BubbleType in
 // tools/metrics/histograms/histograms.xml.
-// Do not re-order these because they are used for collecting metrics.
+// Do not re-number these because they are used for collecting metrics.
+// Related bubbles can be grouped together every 10 values.
 enum BubbleType {
-  BUBBLE_TYPE_UNKNOWN,  // Used for unrecognized bubble names.
-  BUBBLE_TYPE_MOCK,     // Used for testing.
-  BUBBLE_TYPE_MAX,      // Number of bubble types; used for metrics.
+  // Special bubble values:
+  BUBBLE_TYPE_UNKNOWN = 0,  // Used for unrecognized bubble names.
+  BUBBLE_TYPE_MOCK = 1,     // Used for testing.
+
+  // Extension-related bubbles:
+  BUBBLE_TYPE_EXTENSION_INSTALLED = 10,  // Displayed after installing.
+
+  // Upper boundary for metrics.
+  BUBBLE_TYPE_MAX,
 };
 
 // Convert from bubble name to ID. The bubble ID will allow collecting the
@@ -30,6 +38,8 @@
   // Translate from bubble name to enum.
   if (bubble->GetName().compare("MockBubble") == 0)
     bubble_type = BUBBLE_TYPE_MOCK;
+  else if (bubble->GetName().compare("ExtensionInstalled") == 0)
+    bubble_type = BUBBLE_TYPE_EXTENSION_INSTALLED;
 
   DCHECK_NE(bubble_type, BUBBLE_TYPE_UNKNOWN);
   DCHECK_NE(bubble_type, BUBBLE_TYPE_MAX);
@@ -45,49 +55,31 @@
   int bubble_id = GetBubbleId(bubble);
   switch (reason) {
     case BUBBLE_CLOSE_FORCED:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.Forced",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.Forced", bubble_id);
       return;
     case BUBBLE_CLOSE_FOCUS_LOST:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.FocusLost",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.FocusLost", bubble_id);
       return;
     case BUBBLE_CLOSE_TABSWITCHED:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.TabSwitched",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.TabSwitched", bubble_id);
       return;
     case BUBBLE_CLOSE_TABDETACHED:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.TabDetached",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.TabDetached", bubble_id);
       return;
     case BUBBLE_CLOSE_USER_DISMISSED:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.UserDismissed",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.UserDismissed", bubble_id);
       return;
     case BUBBLE_CLOSE_NAVIGATED:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.Navigated",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.Navigated", bubble_id);
       return;
     case BUBBLE_CLOSE_FULLSCREEN_TOGGLED:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.FullscreenToggled",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.FullscreenToggled", bubble_id);
       return;
     case BUBBLE_CLOSE_ACCEPTED:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.Accepted",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.Accepted", bubble_id);
       return;
     case BUBBLE_CLOSE_CANCELED:
-      UMA_HISTOGRAM_ENUMERATION("Bubbles.Close.Canceled",
-                                bubble_id,
-                                BUBBLE_TYPE_MAX);
+      UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.Close.Canceled", bubble_id);
       return;
   }
 
@@ -145,8 +137,7 @@
 
 void ChromeBubbleManager::ChromeBubbleMetrics::OnBubbleNeverShown(
     BubbleReference bubble) {
-  UMA_HISTOGRAM_ENUMERATION("Bubbles.NeverShown", GetBubbleId(bubble),
-                            BUBBLE_TYPE_MAX);
+  UMA_HISTOGRAM_SPARSE_SLOWLY("Bubbles.NeverShown", GetBubbleId(bubble));
 }
 
 void ChromeBubbleManager::ChromeBubbleMetrics::OnBubbleClosed(
diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc
index 4e601389..448d16f5 100644
--- a/chrome/browser/ui/chrome_pages.cc
+++ b/chrome/browser/ui/chrome_pages.cc
@@ -370,8 +370,14 @@
   // away from Chrome, and accidentally close the avatar bubble. The same will
   // happen if we had to switch browser windows to show the sign in page. In
   // this case, fallback to the full-tab signin page.
-  if (switches::IsNewAvatarMenu() &&
-      source != signin_metrics::SOURCE_APP_LAUNCHER && !switched_browser) {
+  bool show_avatar_bubble =
+      source != signin_metrics::SOURCE_APP_LAUNCHER && !switched_browser;
+#if defined(OS_CHROMEOS)
+  // ChromeOS doesn't have the avatar bubble.
+  show_avatar_bubble = false;
+#endif
+
+  if (show_avatar_bubble) {
     browser->window()->ShowAvatarBubbleFromAvatarButton(
         BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN,
         signin::ManageAccountsParams());
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller_unittest.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller_unittest.mm
deleted file mode 100644
index 2a82c2f..0000000
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller_unittest.mm
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#import "chrome/browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller.h"
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/basictypes.h"
-#include "base/command_line.h"
-#include "base/mac/scoped_nsobject.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/test_extension_system.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/tabs/tab_strip_model.h"
-#include "chrome/test/base/browser_with_test_window_test.h"
-#include "components/signin/core/common/profile_management_switches.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace {
-
-class BookmarkSyncPromoControllerTest : public BrowserWithTestWindowTest {
- public:
-  void SetUp() override {
-    switches::DisableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
-    BrowserWithTestWindowTest::SetUp();
-    ASSERT_TRUE(profile());
-    // Adds TestExtensionSystem, since signin uses the gaia auth extension.
-    static_cast<extensions::TestExtensionSystem*>(
-        extensions::ExtensionSystem::Get(profile()))
-        ->CreateExtensionService(base::CommandLine::ForCurrentProcess(),
-                                 base::FilePath(), false);
-  }
-};
-
-TEST_F(BookmarkSyncPromoControllerTest, SignInLink) {
-  int starting_tab_count = browser()->tab_strip_model()->count();
-
-  base::scoped_nsobject<BookmarkSyncPromoController> syncPromo(
-      [[BookmarkSyncPromoController alloc] initWithBrowser:browser()]);
-
-  // Simulate clicking the "Sign in" link.
-  [syncPromo textView:nil clickedOnLink:nil atIndex:0u];
-
-  // A new tab should have been opened.
-  int tab_count = browser()->tab_strip_model()->count();
-  EXPECT_EQ(starting_tab_count + 1, tab_count);
-}
-
-}  // namespace
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index c4205301..6249bad 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -1389,8 +1389,7 @@
 }
 
 - (BOOL)shouldUseNewAvatarButton {
-  return switches::IsNewAvatarMenu() &&
-      profiles::IsRegularOrGuestSession(browser_.get());
+  return profiles::IsRegularOrGuestSession(browser_.get());
 }
 
 - (BOOL)isBookmarkBarVisible {
diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm
index 8035295..ee8dc186 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_bridge.mm
@@ -8,6 +8,7 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/browser_window.h"
 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h"
+#include "chrome/browser/ui/extensions/extension_installed_bubble.h"
 #include "extensions/common/extension.h"
 #include "third_party/skia/include/core/SkBitmap.h"
 
@@ -22,10 +23,8 @@
   // worry about it here.
   [[ExtensionInstalledBubbleController alloc]
       initWithParentWindow:browser->window()->GetNativeWindow()
-                 extension:extension
-                    bundle:NULL
-                   browser:browser
-                      icon:icon];
+           extensionBubble:new ExtensionInstalledBubble(extension, browser,
+                                                        icon)];
 }
 
 }  // namespace chrome
@@ -36,8 +35,6 @@
   // worry about it here.
   [[ExtensionInstalledBubbleController alloc]
       initWithParentWindow:browser->window()->GetNativeWindow()
-                 extension:NULL
                     bundle:bundle
-                   browser:browser
-                      icon:SkBitmap()];
+                   browser:browser];
 }
diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h
index 2d3f2a19..18145a7 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h
+++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h
@@ -105,11 +105,15 @@
 
 // Initialize the window, and then create observers to wait for the extension
 // to complete loading, or the browser window to close.
+// Takes ownership of |extensionBubble|.
 - (id)initWithParentWindow:(NSWindow*)parentWindow
-                 extension:(const extensions::Extension*)extension
+           extensionBubble:(ExtensionInstalledBubble*)extensionBubble;
+
+// Initialize the window, and then create observers to wait for the extension
+// to complete loading, or the browser window to close.
+- (id)initWithParentWindow:(NSWindow*)parentWindow
                     bundle:(const extensions::BundleInstaller*)bundle
-                   browser:(Browser*)browser
-                      icon:(SkBitmap)icon;
+                   browser:(Browser*)browser;
 
 // Action for close button.
 - (IBAction)closeWindow:(id)sender;
diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
index ab849ed..f7d0d04f 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm
@@ -59,7 +59,7 @@
 
  private:
   // ExtensionInstalledBubble::ExtensionInstalledBubbleUi:
-  bool MaybeShowNow() override;
+  void Show() override;
 
   // The (owning) installed bubble controller.
   ExtensionInstalledBubbleController* controller_;
@@ -75,11 +75,16 @@
 ExtensionInstalledBubbleBridge::~ExtensionInstalledBubbleBridge() {
 }
 
-bool ExtensionInstalledBubbleBridge::MaybeShowNow() {
-  [controller_ showWindow:controller_];
+// static
+bool ExtensionInstalledBubble::ExtensionInstalledBubbleUi::ShouldShow(
+    ExtensionInstalledBubble* bubble) {
   return true;
 }
 
+void ExtensionInstalledBubbleBridge::Show() {
+  [controller_ showWindow:controller_];
+}
+
 @implementation ExtensionInstalledBubbleController
 
 @synthesize bundle = bundle_;
@@ -87,24 +92,18 @@
 @synthesize pageActionPreviewShowing = pageActionPreviewShowing_;
 
 - (id)initWithParentWindow:(NSWindow*)parentWindow
-                 extension:(const Extension*)extension
-                    bundle:(const BundleInstaller*)bundle
-                   browser:(Browser*)browser
-                      icon:(SkBitmap)icon {
-  NSString* nibName = bundle ? @"ExtensionInstalledBubbleBundle" :
-                               @"ExtensionInstalledBubble";
-  if ((self = [super initWithWindowNibPath:nibName
+           extensionBubble:(ExtensionInstalledBubble*)extensionBubble {
+  if ((self = [super initWithWindowNibPath:@"ExtensionInstalledBubble"
                               parentWindow:parentWindow
                                 anchoredAt:NSZeroPoint])) {
-    bundle_ = bundle;
-    DCHECK(browser);
-    browser_ = browser;
-    icon_.reset([gfx::SkBitmapToNSImage(icon) retain]);
+    DCHECK(extensionBubble);
+    const extensions::Extension* extension = extensionBubble->extension();
+    browser_ = extensionBubble->browser();
+    DCHECK(browser_);
+    icon_.reset([gfx::SkBitmapToNSImage(extensionBubble->icon()) retain]);
     pageActionPreviewShowing_ = NO;
 
-    if (bundle_) {
-      type_ = extension_installed_bubble::kBundle;
-    } else if (extension->is_app()) {
+    if (extension->is_app()) {
       type_ = extension_installed_bubble::kApp;
     } else if (!extensions::OmniboxInfo::GetKeyword(extension).empty()) {
       type_ = extension_installed_bubble::kOmniboxKeyword;
@@ -117,18 +116,28 @@
       type_ = extension_installed_bubble::kGeneric;
     }
 
-    if (type_ == extension_installed_bubble::kBundle) {
-      [self showWindow:self];
-    } else {
-      // Start showing window only after extension has fully loaded.
-      installedBubbleBridge_.reset(new ExtensionInstalledBubbleBridge(self));
-      installedBubble_.reset(new ExtensionInstalledBubble(
-          installedBubbleBridge_.get(),
-          extension,
-          browser,
-          icon));
-      installedBubble_->IgnoreBrowserClosing();
-    }
+    // Start showing window only after extension has fully loaded.
+    installedBubbleBridge_.reset(new ExtensionInstalledBubbleBridge(self));
+    installedBubble_.reset(extensionBubble);
+    installedBubble_->SetBubbleUi(installedBubbleBridge_.get());
+    installedBubble_->IgnoreBrowserClosing();
+  }
+  return self;
+}
+
+- (id)initWithParentWindow:(NSWindow*)parentWindow
+                    bundle:(const BundleInstaller*)bundle
+                   browser:(Browser*)browser {
+  if ((self = [super initWithWindowNibPath:@"ExtensionInstalledBubbleBundle"
+                              parentWindow:parentWindow
+                                anchoredAt:NSZeroPoint])) {
+    bundle_ = bundle;
+    DCHECK(browser);
+    browser_ = browser;
+    icon_.reset([gfx::SkBitmapToNSImage(SkBitmap()) retain]);
+    pageActionPreviewShowing_ = NO;
+    type_ = extension_installed_bubble::kBundle;
+    [self showWindow:self];
   }
   return self;
 }
diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm
index 906edd0..1a511f6 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller_unittest.mm
@@ -17,6 +17,7 @@
 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
 #import "chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.h"
 #import "chrome/browser/ui/cocoa/info_bubble_window.h"
+#include "chrome/browser/ui/extensions/extension_installed_bubble.h"
 #include "chrome/common/chrome_paths.h"
 #include "chrome/test/base/testing_profile.h"
 #include "extensions/common/extension.h"
@@ -114,6 +115,13 @@
     return extension;
   }
 
+  ExtensionInstalledBubbleControllerForTest* CreateController() {
+    return [[ExtensionInstalledBubbleControllerForTest alloc]
+        initWithParentWindow:window_
+             extensionBubble:new ExtensionInstalledBubble(extension_.get(),
+                                                          browser(), icon_)];
+  }
+
   // Required to initialize the extension installed bubble.
   NSWindow* window_;  // weak, owned by CocoaProfileTest.
 
@@ -129,13 +137,7 @@
 // Confirm that window sizes are set correctly for a page action extension.
 TEST_F(ExtensionInstalledBubbleControllerTest, PageActionTest) {
   extension_ = CreateExtension(extension_installed_bubble::kPageAction);
-  ExtensionInstalledBubbleControllerForTest* controller =
-      [[ExtensionInstalledBubbleControllerForTest alloc]
-          initWithParentWindow:window_
-                     extension:extension_.get()
-                        bundle:NULL
-                       browser:browser()
-                          icon:icon_];
+  ExtensionInstalledBubbleControllerForTest* controller = CreateController();
   EXPECT_TRUE(controller);
 
   // Initialize window without having to calculate tabstrip locations.
@@ -189,13 +191,7 @@
 
 TEST_F(ExtensionInstalledBubbleControllerTest, BrowserActionTest) {
   extension_ = CreateExtension(extension_installed_bubble::kBrowserAction);
-  ExtensionInstalledBubbleControllerForTest* controller =
-      [[ExtensionInstalledBubbleControllerForTest alloc]
-          initWithParentWindow:window_
-                     extension:extension_.get()
-                        bundle:NULL
-                       browser:browser()
-                          icon:icon_];
+  ExtensionInstalledBubbleControllerForTest* controller = CreateController();
   EXPECT_TRUE(controller);
 
   // Initialize window without having to calculate tabstrip locations.
@@ -249,13 +245,7 @@
 
 TEST_F(ExtensionInstalledBubbleControllerTest, ParentClose) {
   extension_ = CreateExtension(extension_installed_bubble::kBrowserAction);
-  ExtensionInstalledBubbleControllerForTest* controller =
-      [[ExtensionInstalledBubbleControllerForTest alloc]
-          initWithParentWindow:window_
-                     extension:extension_.get()
-                        bundle:NULL
-                       browser:browser()
-                          icon:icon_];
+  ExtensionInstalledBubbleControllerForTest* controller = CreateController();
   EXPECT_TRUE(controller);
 
   // Bring up the window and disable close animation.
@@ -285,13 +275,7 @@
 
 TEST_F(ExtensionInstalledBubbleControllerTest, AppTest) {
   extension_ = CreateExtension(extension_installed_bubble::kApp);
-  ExtensionInstalledBubbleControllerForTest* controller =
-      [[ExtensionInstalledBubbleControllerForTest alloc]
-          initWithParentWindow:window_
-                     extension:extension_.get()
-                        bundle:NULL
-                       browser:browser()
-                          icon:icon_];
+  ExtensionInstalledBubbleControllerForTest* controller = CreateController();
   EXPECT_TRUE(controller);
   [controller initializeWindow];
   EXPECT_TRUE([controller window]);
diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.h b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.h
index c2c36d1..0c2a733c 100644
--- a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.h
+++ b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.h
@@ -8,7 +8,7 @@
 #import <Cocoa/Cocoa.h>
 
 #include "base/mac/scoped_nsobject.h"
-#import "chrome/browser/ui/passwords/manage_passwords_bubble.h"
+#import "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
 
 namespace content {
 class WebContents;
@@ -19,7 +19,7 @@
 class ManagePasswordsIcon;
 
 // Cocoa implementation of the platform-independent password bubble interface.
-class ManagePasswordsBubbleCocoa : public ManagePasswordsBubble {
+class ManagePasswordsBubbleCocoa {
  public:
   // Creates and shows the bubble, which owns itself. Does nothing if the bubble
   // is already shown.
@@ -39,15 +39,18 @@
   friend class ManagePasswordsBubbleTest;
 
   // Instance-specific logic. Clients should use the static interface.
-  ManagePasswordsBubbleCocoa(content::WebContents* webContents,
-                             DisplayReason displayReason,
-                             ManagePasswordsIcon* icon);
-  ~ManagePasswordsBubbleCocoa() override;
+  ManagePasswordsBubbleCocoa(
+      content::WebContents* webContents,
+      ManagePasswordsBubbleModel::DisplayReason displayReason,
+      ManagePasswordsIcon* icon);
+  ~ManagePasswordsBubbleCocoa();
   void Show(bool user_action);
 
   // Cleans up state and deletes itself. Called when the bubble is closed.
   void OnClose();
 
+  ManagePasswordsBubbleModel model_;
+
   // The location bar icon corresponding to the bubble.
   ManagePasswordsIcon* icon_;
 
diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.mm b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.mm
index dc142b1..8d4baadc 100644
--- a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.mm
+++ b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa.mm
@@ -39,9 +39,9 @@
 
 ManagePasswordsBubbleCocoa::ManagePasswordsBubbleCocoa(
     content::WebContents* webContents,
-    DisplayReason displayReason,
+    ManagePasswordsBubbleModel::DisplayReason displayReason,
     ManagePasswordsIcon* icon)
-    : ManagePasswordsBubble(webContents, displayReason),
+    : model_(webContents, displayReason),
       icon_(icon),
       closing_(false),
       controller_(nil),
@@ -67,7 +67,7 @@
   DCHECK(browserWindow);
   controller_ = [[ManagePasswordsBubbleController alloc]
       initWithParentWindow:browserWindow
-                     model:model()];
+                     model:&model_];
   [controller_ setShouldOpenAsKeyWindow:(user_action ? YES : NO)];
   [controller_ showWindow:nil];
 
@@ -116,9 +116,8 @@
   BrowserWindowController* bwc =
       [BrowserWindowController browserWindowControllerForWindow:window];
   bubble_ = new ManagePasswordsBubbleCocoa(
-      webContents,
-      user_action ? ManagePasswordsBubble::USER_ACTION
-                  : ManagePasswordsBubble::AUTOMATIC,
+      webContents, user_action ? ManagePasswordsBubbleModel::USER_ACTION
+                               : ManagePasswordsBubbleModel::AUTOMATIC,
       [bwc locationBarBridge]->manage_passwords_decoration()->icon());
 
   bubble_->Show(user_action);
diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm
index 44449a2..63d14fa 100644
--- a/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm
+++ b/chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_cocoa_unittest.mm
@@ -18,7 +18,6 @@
 #include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
 #include "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h"
 #import "chrome/browser/ui/cocoa/passwords/manage_passwords_bubble_controller.h"
-#include "chrome/browser/ui/passwords/manage_passwords_bubble.h"
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
 #include "chrome/browser/ui/tab_dialogs.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
diff --git a/chrome/browser/ui/cocoa/passwords/manage_passwords_controller_test.mm b/chrome/browser/ui/cocoa/passwords/manage_passwords_controller_test.mm
index 4ed0cd1..fd4e2f6f 100644
--- a/chrome/browser/ui/cocoa/passwords/manage_passwords_controller_test.mm
+++ b/chrome/browser/ui/cocoa/passwords/manage_passwords_controller_test.mm
@@ -29,7 +29,8 @@
 ManagePasswordsBubbleModel*
 ManagePasswordsControllerTest::model() {
   if (!model_) {
-    model_.reset(new ManagePasswordsBubbleModel(test_web_contents_.get()));
+    model_.reset(new ManagePasswordsBubbleModel(
+        test_web_contents_.get(), ManagePasswordsBubbleModel::AUTOMATIC));
   }
   return model_.get();
 }
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm b/chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm
index e634fdfb..abda2f19 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_base_controller.mm
@@ -93,11 +93,6 @@
       [avatarController_ updateAvatarButtonAndLayoutParent:YES];
   }
 
-  void OnProfileAvatarChanged(const base::FilePath& profile_path) override {
-    if (!switches::IsNewAvatarMenu() && profile_->GetPath() == profile_path)
-      [avatarController_ updateAvatarButtonAndLayoutParent:YES];
-  }
-
   void OnProfileSupervisedUserIdChanged(
       const base::FilePath& profile_path) override {
     if (profile_->GetPath() == profile_path)
@@ -152,18 +147,16 @@
                           withMode:(BrowserWindow::AvatarBubbleMode)mode
                    withServiceType:(signin::GAIAServiceType)serviceType {
   if (menuController_) {
-    if (switches::IsNewAvatarMenu()) {
-      profiles::BubbleViewMode viewMode;
-      profiles::TutorialMode tutorialMode;
-      profiles::BubbleViewModeFromAvatarBubbleMode(
-          mode, &viewMode, &tutorialMode);
-      if (tutorialMode != profiles::TUTORIAL_MODE_NONE) {
-        ProfileChooserController* profileChooserController =
-            base::mac::ObjCCastStrict<ProfileChooserController>(
-                menuController_);
-        [profileChooserController setTutorialMode:tutorialMode];
-        [profileChooserController initMenuContentsWithView:viewMode];
-      }
+    profiles::BubbleViewMode viewMode;
+    profiles::TutorialMode tutorialMode;
+    profiles::BubbleViewModeFromAvatarBubbleMode(
+        mode, &viewMode, &tutorialMode);
+    if (tutorialMode != profiles::TUTORIAL_MODE_NONE) {
+      ProfileChooserController* profileChooserController =
+          base::mac::ObjCCastStrict<ProfileChooserController>(
+              menuController_);
+      [profileChooserController setTutorialMode:tutorialMode];
+      [profileChooserController initMenuContentsWithView:viewMode];
     }
     return;
   }
@@ -179,40 +172,32 @@
 
   // The new avatar bubble does not have an arrow, and it should be anchored
   // to the edge of the avatar button.
-  int anchorX = switches::IsNewAvatarMenu() ?
-      NSMaxX([anchor bounds]) - kMenuXOffsetAdjust :
-      NSMidX([anchor bounds]);
+  int anchorX = NSMaxX([anchor bounds]) - kMenuXOffsetAdjust;
   NSPoint point = NSMakePoint(anchorX,
                               NSMaxY([anchor bounds]) + kMenuYOffsetAdjust);
   point = [anchor convertPoint:point toView:nil];
   point = [[anchor window] convertBaseToScreen:point];
 
   // |menuController_| will automatically release itself on close.
-  if (switches::IsNewAvatarMenu()) {
-    profiles::BubbleViewMode viewMode;
-    profiles::TutorialMode tutorialMode;
-    profiles::BubbleViewModeFromAvatarBubbleMode(
-        mode, &viewMode, &tutorialMode);
-    // Don't start creating the view if it would be an empty fast user switcher.
-    // It has to happen here to prevent the view system from creating an empty
-    // container.
-    if (viewMode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER &&
-        !profiles::HasProfileSwitchTargets(browser_->profile())) {
-      return;
-    }
-
-    menuController_ =
-        [[ProfileChooserController alloc] initWithBrowser:browser_
-                                               anchoredAt:point
-                                                 viewMode:viewMode
-                                             tutorialMode:tutorialMode
-                                              serviceType:serviceType];
-  } else {
-    menuController_ =
-      [[AvatarMenuBubbleController alloc] initWithBrowser:browser_
-                                               anchoredAt:point];
+  profiles::BubbleViewMode viewMode;
+  profiles::TutorialMode tutorialMode;
+  profiles::BubbleViewModeFromAvatarBubbleMode(
+      mode, &viewMode, &tutorialMode);
+  // Don't start creating the view if it would be an empty fast user switcher.
+  // It has to happen here to prevent the view system from creating an empty
+  // container.
+  if (viewMode == profiles::BUBBLE_VIEW_MODE_FAST_PROFILE_CHOOSER &&
+      !profiles::HasProfileSwitchTargets(browser_->profile())) {
+    return;
   }
 
+  menuController_ =
+      [[ProfileChooserController alloc] initWithBrowser:browser_
+                                             anchoredAt:point
+                                               viewMode:viewMode
+                                           tutorialMode:tutorialMode
+                                            serviceType:serviceType];
+
   [[NSNotificationCenter defaultCenter]
       addObserver:self
          selector:@selector(bubbleWillClose:)
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
index 3460037..1e3e745 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_button_controller_unittest.mm
@@ -57,8 +57,6 @@
 class AvatarButtonControllerTest : public CocoaProfileTest {
  public:
   void SetUp() override {
-    switches::EnableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
     DCHECK(profiles::IsMultipleProfilesEnabled());
 
     CocoaProfileTest::SetUp();
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_icon_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/avatar_icon_controller_unittest.mm
index 8c700806..46501ef 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_icon_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_icon_controller_unittest.mm
@@ -16,8 +16,11 @@
 #include "chrome/browser/ui/browser_commands.h"
 #include "chrome/browser/ui/browser_window.h"
 #import "chrome/browser/ui/cocoa/base_bubble_controller.h"
+#import "chrome/browser/ui/cocoa/browser_window_cocoa.h"
+#import "chrome/browser/ui/cocoa/browser_window_controller.h"
 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h"
 #include "chrome/browser/ui/cocoa/info_bubble_window.h"
+#import "chrome/browser/ui/cocoa/profiles/avatar_button_controller.h"
 #import "chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/test/base/testing_profile.h"
@@ -27,15 +30,11 @@
 
 class AvatarIconControllerTest : public CocoaProfileTest {
  public:
+  AvatarIconControllerTest() {}
+
   void SetUp() override {
-    switches::DisableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
     CocoaProfileTest::SetUp();
     ASSERT_TRUE(browser());
-
-    controller_.reset(
-        [[AvatarIconController alloc] initWithBrowser:browser()]);
-    [[controller_ view] setHidden:YES];
   }
 
   void TearDown() override {
@@ -43,86 +42,30 @@
     CocoaProfileTest::TearDown();
   }
 
-  NSButton* button() { return [controller_ buttonView]; }
-
-  NSView* view() { return [controller_ view]; }
-
-  AvatarIconController* controller() { return controller_.get(); }
-
- private:
-  base::scoped_nsobject<AvatarIconController> controller_;
+  AvatarBaseController* icon_controller() {
+    BrowserWindowCocoa* window =
+        static_cast<BrowserWindowCocoa*>(browser()->window());
+    return [window->cocoa_controller() avatarButtonController];
+  }
 };
 
-TEST_F(AvatarIconControllerTest, AddRemoveProfiles) {
-  EXPECT_TRUE([view() isHidden]);
-
-  testing_profile_manager()->CreateTestingProfile("one");
-
-  EXPECT_FALSE([view() isHidden]);
-
-  testing_profile_manager()->CreateTestingProfile("two");
-  EXPECT_FALSE([view() isHidden]);
-
-  testing_profile_manager()->DeleteTestingProfile("one");
-  EXPECT_FALSE([view() isHidden]);
-
-  testing_profile_manager()->DeleteTestingProfile("two");
-  EXPECT_TRUE([view() isHidden]);
-}
-
-TEST_F(AvatarIconControllerTest, DoubleOpen) {
-  // Create a second profile to enable the avatar menu.
-  testing_profile_manager()->CreateTestingProfile("p2");
-
-  EXPECT_FALSE([controller() menuController]);
-
-  [button() performClick:button()];
-
-  BaseBubbleController* menu = [controller() menuController];
-  EXPECT_TRUE([menu isKindOfClass:[AvatarMenuBubbleController class]]);
-
-  EXPECT_TRUE(menu);
-
-  [button() performClick:button()];
-  EXPECT_EQ(menu, [controller() menuController]);
-
-  // Do not animate out because that is hard to test around.
-  static_cast<InfoBubbleWindow*>(menu.window).allowedAnimations =
-      info_bubble::kAnimateNone;
-  [menu close];
-  EXPECT_FALSE([controller() menuController]);
-
-  testing_profile_manager()->DeleteTestingProfile("p2");
-}
-
-TEST_F(AvatarIconControllerTest, SupervisedUserLabel) {
-  DCHECK(!profile()->IsSupervised());
-  EXPECT_FALSE([controller() labelButtonView]);
-
-  // Create a second, supervised profile to enable the avatar menu.
-  std::string name = "p2";
-  TestingProfile* profile = testing_profile_manager()->CreateTestingProfile(
-      name, scoped_ptr<syncable_prefs::PrefServiceSyncable>(),
-      base::ASCIIToUTF16(name), 0, "asdf", TestingProfile::TestingFactories());
-  EXPECT_TRUE(profile->IsSupervised());
-
-  // http://crbug.com/39725
-  TemplateURLServiceFactory::GetInstance()->SetTestingFactoryAndUse(
-      profile, &TemplateURLServiceFactory::BuildInstanceFor);
-  AutocompleteClassifierFactory::GetInstance()->SetTestingFactoryAndUse(
-      profile, &AutocompleteClassifierFactory::BuildInstanceFor);
-  profile->CreateBookmarkModel(true);
-  bookmarks::test::WaitForBookmarkModelToLoad(
-      BookmarkModelFactory::GetForProfile(profile));
-
+TEST_F(AvatarIconControllerTest, ShowingAvatarIconInIncognito) {
   Browser* browser =
-      new Browser(Browser::CreateParams(profile, chrome::GetActiveDesktop()));
-  // Build a new controller to check if it is initialized correctly for a
-  // supervised user profile.
-  base::scoped_nsobject<AvatarIconController> controller(
-      [[AvatarIconController alloc] initWithBrowser:browser]);
-
-  EXPECT_TRUE([controller labelButtonView]);
+      new Browser(Browser::CreateParams(profile()->GetOffTheRecordProfile(),
+                                        chrome::GetActiveDesktop()));
+  BrowserWindowCocoa* window =
+      static_cast<BrowserWindowCocoa*>(browser->window());
+  AvatarBaseController* icon_controller =
+      [window->cocoa_controller() avatarButtonController];
+  // In incognito, we should be using the AvatarIconController to show the
+  // incognito guy.
+  EXPECT_TRUE([icon_controller isKindOfClass:[AvatarIconController class]]);
 
   browser->window()->Close();
 }
+
+TEST_F(AvatarIconControllerTest, ShowingAvatarButtonInRegularSession) {
+  // In a regular session, we should be using the AvatarButtonController to show
+  // the profile name.
+  EXPECT_TRUE([icon_controller() isKindOfClass:[AvatarButtonController class]]);
+}
diff --git a/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm
index 1ededede..b848ab5b 100644
--- a/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/avatar_menu_bubble_controller_unittest.mm
@@ -29,9 +29,6 @@
   }
 
   void SetUp() override {
-    switches::DisableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
-
     CocoaTest::SetUp();
     ASSERT_TRUE(manager_.SetUp());
 
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
index 50e3d415..07787745 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller.mm
@@ -1695,6 +1695,7 @@
   CGFloat xOffset = kHorizontalSpacing;
   CGFloat yOffset = 0;
   CGFloat availableTextWidth = kFixedMenuWidth - 2 * kHorizontalSpacing;
+  CGFloat maxAvailableTextWidth = kFixedMenuWidth - kHorizontalSpacing;
 
   // Profile options. This can be a link to the accounts view, the profile's
   // username for signed in users, or a "Sign in" button for local profiles.
@@ -1702,11 +1703,10 @@
       SigninManagerFactory::GetForProfile(
           browser_->profile()->GetOriginalProfile());
   if (!isGuestSession_ && signinManager->IsSigninAllowed()) {
-    NSView* linksContainer =
-        [self createCurrentProfileLinksForItem:item
-                                          rect:NSMakeRect(xOffset, yOffset,
-                                                          availableTextWidth,
-                                                          0)];
+    NSView* linksContainer = [self
+        createCurrentProfileLinksForItem:item
+                                    rect:NSMakeRect(xOffset, yOffset,
+                                                    maxAvailableTextWidth, 0)];
     [container addSubview:linksContainer];
     yOffset = NSMaxY([linksContainer frame]);
   }
@@ -1771,6 +1771,10 @@
   // Don't double-apply the left margin to the sub-views.
   rect.origin.x = 0;
 
+  // Adds right padding.
+  const CGFloat kRightPadding = kHorizontalSpacing;
+  rect.size.width -= kRightPadding;
+
   // The available links depend on the type of profile that is active.
   if (item.signed_in) {
     // Signed in profiles with no authentication errors do not have a clickable
@@ -1839,6 +1843,9 @@
         l10n_util::GetNSString(IDS_PROFILES_SIGNIN_PROMO),
         NSMakePoint(0, NSMaxY([signinButton frame]) + kVerticalSpacing),
         nil);
+    if (kRightPadding >= 8)
+      rect.size.width += 8;  // Re-stretch a little bit to fit promo text.
+    DCHECK(kRightPadding >= 8);
     [promo setFrameSize:NSMakeSize(rect.size.width, 0)];
     [GTMUILocalizerAndLayoutTweaker sizeToFitFixedWidthTextField:promo];
     [container addSubview:promo];
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
index 5d13036..af7d97c 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
@@ -150,8 +150,6 @@
 };
 
 TEST_F(ProfileChooserControllerTest, InitialLayoutWithNewMenu) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
   StartProfileChooserController();
 
   NSArray* subviews = [[[controller() window] contentView] subviews];
@@ -217,8 +215,6 @@
 }
 
 TEST_F(ProfileChooserControllerTest, RightClickTutorialShownAfterWelcome) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
   // The welcome upgrade tutorial takes precedence so show it then dismiss it.
   // The right click tutorial should be shown right away.
   StartProfileChooserControllerWithTutorialMode(
@@ -229,8 +225,6 @@
 }
 
 TEST_F(ProfileChooserControllerTest, RightClickTutorialShownAfterReopen) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
   // The welcome upgrade tutorial takes precedence so show it then close the
   // menu. Reopening the menu should show the tutorial.
   StartProfileChooserController();
@@ -247,8 +241,6 @@
 }
 
 TEST_F(ProfileChooserControllerTest, RightClickTutorialNotShownAfterDismiss) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
   // The welcome upgrade tutorial takes precedence so show it then close the
   // menu. Reopening the menu should show the tutorial.
   StartProfileChooserController();
@@ -280,9 +272,6 @@
 }
 
 TEST_F(ProfileChooserControllerTest, OtherProfilesSortedAlphabetically) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
-
   // Add two extra profiles, to make sure sorting is alphabetical and not
   // by order of creation.
   testing_profile_manager()->CreateTestingProfile(
@@ -321,8 +310,6 @@
 
 TEST_F(ProfileChooserControllerTest,
     LocalProfileActiveCardLinksWithNewMenu) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
   StartProfileChooserController();
   NSArray* subviews = [[[controller() window] contentView] subviews];
   ASSERT_EQ(2U, [subviews count]);
@@ -369,8 +356,6 @@
 
 TEST_F(ProfileChooserControllerTest,
     SignedInProfileActiveCardLinksWithNewMenu) {
-  switches::EnableNewAvatarMenuForTesting(
-      base::CommandLine::ForCurrentProcess());
   // Sign in the first profile.
   ProfileInfoCache* cache = testing_profile_manager()->profile_info_cache();
   cache->SetAuthInfoOfProfileAtIndex(0, kGaiaId, base::ASCIIToUTF16(kEmail));
diff --git a/chrome/browser/ui/extensions/extension_installed_bubble.cc b/chrome/browser/ui/extensions/extension_installed_bubble.cc
index b5e98b4..21ebaf31 100644
--- a/chrome/browser/ui/extensions/extension_installed_bubble.cc
+++ b/chrome/browser/ui/extensions/extension_installed_bubble.cc
@@ -57,14 +57,12 @@
   return result.Pass();
 }
 
-} // namespace
+}  // namespace
 
-ExtensionInstalledBubble::ExtensionInstalledBubble(
-    ExtensionInstalledBubbleUi* bubble_ui,
-    const Extension* extension,
-    Browser* browser,
-    const SkBitmap& icon)
-    : bubble_ui_(bubble_ui),
+ExtensionInstalledBubble::ExtensionInstalledBubble(const Extension* extension,
+                                                   Browser* browser,
+                                                   const SkBitmap& icon)
+    : bubble_ui_(nullptr),
       extension_(extension),
       browser_(browser),
       icon_(icon),
@@ -130,9 +128,19 @@
       l10n_util::GetStringFUTF16(message_id, extra);
 }
 
+void ExtensionInstalledBubble::SetBubbleUi(
+    ExtensionInstalledBubbleUi* bubble_ui) {
+  DCHECK(!bubble_ui_);
+  DCHECK(bubble_ui);
+  bubble_ui_ = bubble_ui;
+}
+
 void ExtensionInstalledBubble::ShowInternal() {
-  if (bubble_ui_->MaybeShowNow())
+  if (ExtensionInstalledBubbleUi::ShouldShow(this)) {
+    DCHECK(bubble_ui_);
+    bubble_ui_->Show();
     return;
+  }
   if (animation_wait_retries_++ < kAnimationWaitRetries) {
     base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
         FROM_HERE, base::Bind(&ExtensionInstalledBubble::ShowInternal,
diff --git a/chrome/browser/ui/extensions/extension_installed_bubble.h b/chrome/browser/ui/extensions/extension_installed_bubble.h
index 30d9140d..a828cce 100644
--- a/chrome/browser/ui/extensions/extension_installed_bubble.h
+++ b/chrome/browser/ui/extensions/extension_installed_bubble.h
@@ -47,14 +47,16 @@
    public:
     virtual ~ExtensionInstalledBubbleUi() {}
 
-    // Attempts to show the bubble. Called from ShowInternal. Returns false
-    // if, because of animating (such as from adding a new browser action
-    // to the toolbar), the bubble could not be shown immediately.
-    virtual bool MaybeShowNow() = 0;
+    // Returns false if, because of animating (such as from adding a new browser
+    // action to the toolbar), the bubble could not be shown immediately.
+    // TODO(hcarmona): Detect animation in a platform-agnostic manner.
+    static bool ShouldShow(ExtensionInstalledBubble* bubble);
+
+    // Shows the bubble UI. Should be implemented per platform.
+    virtual void Show() = 0;
   };
 
-  ExtensionInstalledBubble(ExtensionInstalledBubbleUi* bubble_ui,
-                           const extensions::Extension* extension,
+  ExtensionInstalledBubble(const extensions::Extension* extension,
                            Browser* browser,
                            const SkBitmap& icon);
 
@@ -73,6 +75,9 @@
   // Returns the string describing how to use the new extension.
   base::string16 GetHowToUseDescription() const;
 
+  // Sets the UI that corresponds to this bubble.
+  void SetBubbleUi(ExtensionInstalledBubbleUi* bubble_ui);
+
  private:
   // Delegates showing the view to our |view_|. Called internally via PostTask.
   void ShowInternal();
diff --git a/chrome/browser/ui/libgtk2ui/BUILD.gn b/chrome/browser/ui/libgtk2ui/BUILD.gn
index 9a92cba3..3ad3e5c5 100644
--- a/chrome/browser/ui/libgtk2ui/BUILD.gn
+++ b/chrome/browser/ui/libgtk2ui/BUILD.gn
@@ -52,8 +52,6 @@
     "menu_util.h",
     "native_theme_gtk2.cc",
     "native_theme_gtk2.h",
-    "owned_widget_gtk2.cc",
-    "owned_widget_gtk2.h",
     "print_dialog_gtk2.cc",
     "print_dialog_gtk2.h",
     "printing_gtk2_util.cc",
diff --git a/chrome/browser/ui/libgtk2ui/DEPS b/chrome/browser/ui/libgtk2ui/DEPS
deleted file mode 100644
index 833892c..0000000
--- a/chrome/browser/ui/libgtk2ui/DEPS
+++ /dev/null
@@ -1,5 +0,0 @@
-# libgtk2ui must be disconnected from all other GTK code.
-include_rules = [
-  "-ui/base/gtk",
-  "-chrome/browser/ui/gtk",
-]
diff --git a/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc b/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc
index 91f0272..0606e3a 100644
--- a/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc
+++ b/chrome/browser/ui/libgtk2ui/app_indicator_icon.cc
@@ -12,7 +12,6 @@
 #include "base/files/file_util.h"
 #include "base/md5.h"
 #include "base/memory/ref_counted_memory.h"
-#include "base/nix/xdg_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/sequenced_worker_pool.h"
@@ -94,6 +93,7 @@
   base::nix::DesktopEnvironment environment =
       base::nix::GetDesktopEnvironment(env.get());
   if (environment != base::nix::DESKTOP_ENVIRONMENT_KDE4 &&
+      environment != base::nix::DESKTOP_ENVIRONMENT_KDE5 &&
       environment != base::nix::DESKTOP_ENVIRONMENT_UNITY) {
     return;
   }
@@ -161,14 +161,12 @@
                                    const gfx::ImageSkia& image,
                                    const base::string16& tool_tip)
     : id_(id),
-      using_kde4_(false),
       icon_(NULL),
       menu_model_(NULL),
       icon_change_count_(0),
       weak_factory_(this) {
   scoped_ptr<base::Environment> env(base::Environment::Create());
-  using_kde4_ = base::nix::GetDesktopEnvironment(env.get()) ==
-      base::nix::DESKTOP_ENVIRONMENT_KDE4;
+  desktop_env_ = base::nix::GetDesktopEnvironment(env.get());
 
   EnsureMethodsLoaded();
   tool_tip_ = base::UTF16ToUTF8(tool_tip);
@@ -204,7 +202,8 @@
       content::BrowserThread::GetBlockingPool()
           ->GetTaskRunnerWithShutdownBehavior(
                 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN);
-  if (using_kde4_) {
+  if (desktop_env_ == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
+      desktop_env_ == base::nix::DESKTOP_ENVIRONMENT_KDE5) {
     base::PostTaskAndReplyWithResult(
         task_runner.get(), FROM_HERE,
         base::Bind(AppIndicatorIcon::WriteKDE4TempImageOnWorkerThread,
diff --git a/chrome/browser/ui/libgtk2ui/app_indicator_icon.h b/chrome/browser/ui/libgtk2ui/app_indicator_icon.h
index 81f5165..b4e80c735 100644
--- a/chrome/browser/ui/libgtk2ui/app_indicator_icon.h
+++ b/chrome/browser/ui/libgtk2ui/app_indicator_icon.h
@@ -8,6 +8,7 @@
 #include "base/files/file_path.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
+#include "base/nix/xdg_util.h"
 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
 #include "ui/views/linux_ui/status_icon_linux.h"
 
@@ -85,8 +86,8 @@
   std::string id_;
   std::string tool_tip_;
 
-  // Whether the user is using KDE.
-  bool using_kde4_;
+  // Used to select KDE or Unity for image setting.
+  base::nix::DesktopEnvironment desktop_env_;
 
   // Gtk status icon wrapper
   AppIndicator* icon_;
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc
index aad16cc..be88310 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.cc
@@ -32,7 +32,7 @@
     : fake_window_(gtk_offscreen_window_new()),
       handler_(CreateNewHandler()),
       has_xkb_(false) {
-  gtk_container_add(GTK_CONTAINER(fake_window_), handler_.get());
+  gtk_container_add(GTK_CONTAINER(fake_window_), handler_);
 
   int opcode, event, error;
   int major = XkbMajorVersion;
@@ -42,7 +42,7 @@
 }
 
 Gtk2KeyBindingsHandler::~Gtk2KeyBindingsHandler() {
-  handler_.Destroy();
+  gtk_widget_destroy(handler_);
   gtk_widget_destroy(fake_window_);
 }
 
@@ -64,9 +64,9 @@
 
   gtk_bindings_activate_event(
 #if GDK_MAJOR_VERSION >= 3
-      G_OBJECT(handler_.get()),
+      G_OBJECT(handler_),
 #else
-      GTK_OBJECT(handler_.get()),
+      GTK_OBJECT(handler_),
 #endif
       &gdk_event);
 
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
index f58cae3..32584d4 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
+++ b/chrome/browser/ui/libgtk2ui/gtk2_key_bindings_handler.h
@@ -11,7 +11,6 @@
 #include <vector>
 
 #include "base/event_types.h"
-#include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
 #include "ui/events/linux/text_edit_command_auralinux.h"
 
 namespace content {
@@ -137,8 +136,7 @@
   static void MoveFocus(GtkWidget* widget, GtkDirectionType arg1);
 
   GtkWidget* fake_window_;
-
-  libgtk2ui::OwnedWidgetGtk handler_;
+  GtkWidget* handler_;
 
   // Buffer to store the match results.
   std::vector<ui::TextEditCommandAuraLinux> edit_commands_;
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
index 52393a5..9774c055 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.cc
@@ -505,6 +505,7 @@
   scoped_ptr<base::Environment> env(base::Environment::Create());
   switch (base::nix::GetDesktopEnvironment(env.get())) {
     case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+    case base::nix::DESKTOP_ENVIRONMENT_KDE5:
       // Starting with KDE 4.4, windows' titlebars can be dragged with the
       // middle mouse button to create tab groups. We don't support that in
       // Chrome, but at least avoid lowering windows in response to middle
@@ -674,6 +675,7 @@
       return true;
     case base::nix::DESKTOP_ENVIRONMENT_KDE3:
     case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+    case base::nix::DESKTOP_ENVIRONMENT_KDE5:
     case base::nix::DESKTOP_ENVIRONMENT_OTHER:
       return false;
   }
diff --git a/chrome/browser/ui/libgtk2ui/gtk2_ui.h b/chrome/browser/ui/libgtk2ui/gtk2_ui.h
index b4dbb37..69e23c8 100644
--- a/chrome/browser/ui/libgtk2ui/gtk2_ui.h
+++ b/chrome/browser/ui/libgtk2ui/gtk2_ui.h
@@ -15,7 +15,6 @@
 #include "chrome/browser/ui/libgtk2ui/gtk2_signal.h"
 #include "chrome/browser/ui/libgtk2ui/gtk2_signal_registrar.h"
 #include "chrome/browser/ui/libgtk2ui/libgtk2ui_export.h"
-#include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
 #include "ui/events/linux/text_edit_key_bindings_delegate_auralinux.h"
 #include "ui/gfx/color_utils.h"
 #include "ui/views/linux_ui/linux_ui.h"
diff --git a/chrome/browser/ui/libgtk2ui/libgtk2ui.gyp b/chrome/browser/ui/libgtk2ui/libgtk2ui.gyp
index de1ed092..3660035 100644
--- a/chrome/browser/ui/libgtk2ui/libgtk2ui.gyp
+++ b/chrome/browser/ui/libgtk2ui/libgtk2ui.gyp
@@ -79,8 +79,6 @@
         'menu_util.h',
         'native_theme_gtk2.cc',
         'native_theme_gtk2.h',
-        'owned_widget_gtk2.cc',
-        'owned_widget_gtk2.h',
         'print_dialog_gtk2.cc',
         'print_dialog_gtk2.h',
         'printing_gtk2_util.cc',
diff --git a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc
index 936cc7b..5dc84db 100644
--- a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc
+++ b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.cc
@@ -440,81 +440,99 @@
 }
 
 GtkWidget* NativeThemeGtk2::GetWindow() const {
-  if (!fake_window_.get()) {
-    fake_window_.Own(chrome_gtk_frame_new());
-    gtk_widget_realize(fake_window_.get());
+  static GtkWidget* fake_window = NULL;
+
+  if (!fake_window) {
+    fake_window = chrome_gtk_frame_new();
+    gtk_widget_realize(fake_window);
   }
 
-  return fake_window_.get();
+  return fake_window;
 }
 
 GtkWidget* NativeThemeGtk2::GetEntry() const {
-  if (!fake_entry_.get()) {
-    fake_entry_.Own(gtk_entry_new());
+  static GtkWidget* fake_entry = NULL;
+
+  if (!fake_entry) {
+    fake_entry = gtk_entry_new();
 
     // The fake entry needs to be in the window so it can be realized so we can
     // use the computed parts of the style.
-    gtk_container_add(GTK_CONTAINER(GetWindow()), fake_entry_.get());
-    gtk_widget_realize(fake_entry_.get());
+    gtk_container_add(GTK_CONTAINER(GetWindow()), fake_entry);
+    gtk_widget_realize(fake_entry);
   }
 
-  return fake_entry_.get();
+  return fake_entry;
 }
 
 GtkWidget* NativeThemeGtk2::GetLabel() const {
-  if (!fake_label_.get())
-    fake_label_.Own(gtk_label_new(""));
+  static GtkWidget* fake_label = NULL;
 
-  return fake_label_.get();
+  if (!fake_label)
+    fake_label = gtk_label_new("");
+
+  return fake_label;
 }
 
 GtkWidget* NativeThemeGtk2::GetButton() const {
-  if (!fake_button_.get())
-    fake_button_.Own(gtk_button_new());
+  static GtkWidget* fake_button = NULL;
 
-  return fake_button_.get();
+  if (!fake_button)
+    fake_button = gtk_button_new();
+
+  return fake_button;
 }
 
 GtkWidget* NativeThemeGtk2::GetBlueButton() const {
-  if (!fake_bluebutton_.get()) {
-    fake_bluebutton_.Own(gtk_button_new());
-    TurnButtonBlue(fake_bluebutton_.get());
+  static GtkWidget* fake_bluebutton = NULL;
+
+  if (!fake_bluebutton) {
+    fake_bluebutton = gtk_button_new();
+    TurnButtonBlue(fake_bluebutton);
   }
 
-  return fake_bluebutton_.get();
+  return fake_bluebutton;
 }
 
 GtkWidget* NativeThemeGtk2::GetTree() const {
-  if (!fake_tree_.get())
-    fake_tree_.Own(gtk_tree_view_new());
+  static GtkWidget* fake_tree = NULL;
 
-  return fake_tree_.get();
+  if (!fake_tree)
+    fake_tree = gtk_tree_view_new();
+
+  return fake_tree;
 }
 
 GtkWidget* NativeThemeGtk2::GetTooltip() const {
-  if (!fake_tooltip_.get()) {
-    fake_tooltip_.Own(gtk_window_new(GTK_WINDOW_TOPLEVEL));
-    gtk_widget_set_name(fake_tooltip_.get(), "gtk-tooltip");
-    gtk_widget_realize(fake_tooltip_.get());
+  static GtkWidget* fake_tooltip = NULL;
+
+  if (!fake_tooltip) {
+    fake_tooltip = gtk_window_new(GTK_WINDOW_TOPLEVEL);
+    gtk_widget_set_name(fake_tooltip, "gtk-tooltip");
+    gtk_widget_realize(fake_tooltip);
   }
 
-  return fake_tooltip_.get();
+  return fake_tooltip;
 }
 
 GtkWidget* NativeThemeGtk2::GetMenu() const {
-  if (!fake_menu_.get())
-    fake_menu_.Own(gtk_custom_menu_new());
+  static GtkWidget* fake_menu = NULL;
 
-  return fake_menu_.get();
+  if (!fake_menu)
+    fake_menu = gtk_custom_menu_new();
+
+  return fake_menu;
 }
 
 GtkWidget* NativeThemeGtk2::GetMenuItem() const {
-  if (!fake_menu_item_.get()) {
-    fake_menu_item_.Own(gtk_custom_menu_item_new());
-    gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item_.get());
+  static GtkWidget* fake_menu_item = NULL;
+
+  if (!fake_menu_item) {
+    fake_menu_item = gtk_custom_menu_item_new();
+    gtk_menu_shell_append(GTK_MENU_SHELL(GetMenu()), fake_menu_item);
   }
 
-  return fake_menu_item_.get();
+  return fake_menu_item;
 }
 
 }  // namespace libgtk2ui
diff --git a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.h b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.h
index f5e8ca9d4..b5acd1b 100644
--- a/chrome/browser/ui/libgtk2ui/native_theme_gtk2.h
+++ b/chrome/browser/ui/libgtk2ui/native_theme_gtk2.h
@@ -7,7 +7,6 @@
 
 #include <gtk/gtk.h>
 
-#include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
 #include "ui/native_theme/native_theme_base.h"
 
 
@@ -47,16 +46,6 @@
   NativeThemeGtk2();
   ~NativeThemeGtk2() override;
 
-  mutable OwnedWidgetGtk fake_window_;
-  mutable OwnedWidgetGtk fake_entry_;
-  mutable OwnedWidgetGtk fake_label_;
-  mutable OwnedWidgetGtk fake_button_;
-  mutable OwnedWidgetGtk fake_bluebutton_;
-  mutable OwnedWidgetGtk fake_tree_;
-  mutable OwnedWidgetGtk fake_tooltip_;
-  mutable OwnedWidgetGtk fake_menu_;
-  mutable OwnedWidgetGtk fake_menu_item_;
-
   DISALLOW_COPY_AND_ASSIGN(NativeThemeGtk2);
 };
 
diff --git a/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.cc b/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.cc
deleted file mode 100644
index e459968..0000000
--- a/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.cc
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h"
-
-#include <gtk/gtk.h>
-
-#include "base/logging.h"
-
-namespace libgtk2ui {
-
-OwnedWidgetGtk::~OwnedWidgetGtk() {
-  Destroy();
-}
-
-void OwnedWidgetGtk::Own(GtkWidget* widget) {
-  if (!widget)
-    return;
-
-  DCHECK(!widget_);
-
-  // Keep a reference
-  g_object_ref_sink(widget);
-  widget_ = widget;
-}
-
-void OwnedWidgetGtk::Destroy() {
-  if (!widget_)
-    return;
-
-  GtkWidget* widget = widget_;
-  widget_ = NULL;
-  gtk_widget_destroy(widget);
-
-  DCHECK(!g_object_is_floating(widget));
-  // NOTE: Assumes some implementation details about glib internals.
-  DCHECK_EQ(G_OBJECT(widget)->ref_count, 1U);
-  g_object_unref(widget);
-}
-
-}  // namespace libgtk2ui
diff --git a/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h b/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h
deleted file mode 100644
index 547f515e..0000000
--- a/chrome/browser/ui/libgtk2ui/owned_widget_gtk2.h
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This class assists you in dealing with a specific situation when managing
-// ownership between a C++ object and a GTK widget.  It is common to have a
-// C++ object which encapsulates a GtkWidget, and that widget is exposed from
-// the object for use outside of the class.  In this situation, you commonly
-// want the GtkWidget's lifetime to match its C++ object's lifetime.  Using an
-// OwnedWidgetGtk will take ownership over the initial reference of the
-// GtkWidget, so that it is "owned" by the C++ object.  Example usage:
-//
-// class FooViewGtk() {
-//  public:
-//   FooViewGtk() { }
-//   ~FooViewGtk() { }
-//   void Init() { vbox_.Own(gtk_vbox_new()); }
-//   GtkWidget* widget() { return vbox_.get() };  // Host my widget!
-//  private:
-//   OwnedWidgetGtk vbox_;
-// };
-//
-// This design will ensure that the widget stays alive from the call to Own()
-// until the call to Destroy().
-//
-// - Details of the problem and OwnedWidgetGtk's solution:
-// In order to make passing ownership more convenient for newly created
-// widgets, GTK has a concept of a "floating" reference.  All GtkObjects (and
-// thus GtkWidgets) inherit from GInitiallyUnowned.  When they are created, the
-// object starts with a reference count of 1, but has its floating flag set.
-// When it is put into a container for the first time, that container will
-// "sink" the floating reference, and the count will still be 1.  Now the
-// container owns the widget, and if we remove the widget from the container,
-// the widget is destroyed.  This style of ownership often causes problems when
-// you have an object encapsulating the widget.  If we just use a raw
-// GtkObject* with no specific ownership management, we push the widget's
-// ownership onto the user of the class.  Now the C++ object can't depend on
-// the widget being valid, since it doesn't manage its lifetime.  If the widget
-// was removed from a container, removing its only reference, it would be
-// destroyed (from the C++ object's perspective) unexpectedly destroyed.  The
-// solution is fairly simple, make sure that the C++ object owns the widget,
-// and thus it is also responsible for destroying it.  This boils down to:
-//   GtkWidget* widget = gtk_widget_new();
-//   g_object_ref_sink(widget);  // Claim the initial floating reference.
-//   ...
-//   gtk_destroy_widget(widget);  // Ask all code to destroy their references.
-//   g_object_unref(widget);  // Destroy the initial reference we had claimed.
-
-#ifndef CHROME_BROWSER_UI_LIBGTK2UI_OWNED_WIDGET_GTK2_H_
-#define CHROME_BROWSER_UI_LIBGTK2UI_OWNED_WIDGET_GTK2_H_
-
-#include "base/basictypes.h"
-
-typedef struct _GtkWidget GtkWidget;
-
-namespace libgtk2ui {
-
-class OwnedWidgetGtk {
- public:
-  // Create an instance that isn't managing any ownership.
-  OwnedWidgetGtk() : widget_(NULL) { }
-  // Create an instance that owns |widget|.
-  explicit OwnedWidgetGtk(GtkWidget* widget) : widget_(NULL) { Own(widget); }
-
-  ~OwnedWidgetGtk();
-
-  // Return the currently owned widget, or NULL if no widget is owned.
-  GtkWidget* get() const { return widget_; }
-  GtkWidget* operator->() const { return widget_; }
-
-  // Takes ownership of a widget, by taking the initial floating reference of
-  // the GtkWidget. It is expected that Own() is called right after the widget
-  // has been created, and before any other references to the widget might have
-  // been added. It is valid to never call Own(), in which case Destroy() will
-  // do nothing. If Own() has been called, you must explicitly call Destroy().
-  void Own(GtkWidget* widget);
-
-  // You may call Destroy() after you have called Own(). Calling Destroy()
-  // will call gtk_widget_destroy(), and drop our reference to the widget.
-  // Destroy() is also called in this object's destructor.
-  // After a call to Destroy(), you may call Own() again. NOTE: It is expected
-  // that after gtk_widget_destroy we will be holding the only reference left
-  // on the object. We assert this in debug mode to help catch any leaks.
-  void Destroy();
-
- private:
-  GtkWidget* widget_;
-
-  DISALLOW_COPY_AND_ASSIGN(OwnedWidgetGtk);
-};
-
-}  // namespace libgtk2ui
-
-#endif  // CHROME_BROWSER_UI_LIBGTK2UI_OWNED_WIDGET_GTK2_H_
diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc
index 39bea0b..a54185b 100644
--- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc
+++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl.cc
@@ -45,7 +45,8 @@
     base::nix::DesktopEnvironment desktop =
         base::nix::GetDesktopEnvironment(env.get());
     if (desktop == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
-        desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4) {
+        desktop == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
+        desktop == base::nix::DESKTOP_ENVIRONMENT_KDE5) {
       // Check to see if the user dislikes the KDE file dialog.
       if (!env->HasVar("NO_CHROME_KDE_FILE_DIALOG")) {
         // Check to see if the KDE dialog works.
diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc
index b7016dc..3a9dbda 100644
--- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc
+++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc
@@ -156,7 +156,7 @@
                                           const std::string& output,
                                           int exit_code, void* params);
 
-  // Should be either DESKTOP_ENVIRONMENT_KDE3 or DESKTOP_ENVIRONMENT_KDE4.
+  // Should be either DESKTOP_ENVIRONMENT_KDE3, KDE4, or KDE5.
   base::nix::DesktopEnvironment desktop_;
 
   // The set of all parent windows for which we are currently running
@@ -195,7 +195,8 @@
     : SelectFileDialogImpl(listener, policy),
       desktop_(desktop) {
   DCHECK(desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE3 ||
-         desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE4);
+         desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE4 ||
+         desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE5);
 }
 
 SelectFileDialogImplKDE::~SelectFileDialogImplKDE() {
diff --git a/chrome/browser/ui/libgtk2ui/unity_service.cc b/chrome/browser/ui/libgtk2ui/unity_service.cc
index 65d83b3..549b361 100644
--- a/chrome/browser/ui/libgtk2ui/unity_service.cc
+++ b/chrome/browser/ui/libgtk2ui/unity_service.cc
@@ -65,7 +65,8 @@
 
   // The "icon-tasks" KDE task manager also honors Unity Launcher API.
   if (desktop_env != base::nix::DESKTOP_ENVIRONMENT_UNITY &&
-      desktop_env != base::nix::DESKTOP_ENVIRONMENT_KDE4)
+      desktop_env != base::nix::DESKTOP_ENVIRONMENT_KDE4 &&
+      desktop_env != base::nix::DESKTOP_ENVIRONMENT_KDE5)
     return;
 
   // Ubuntu still hasn't given us a nice libunity.so symlink.
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble.cc b/chrome/browser/ui/passwords/manage_passwords_bubble.cc
deleted file mode 100644
index 87efd80..0000000
--- a/chrome/browser/ui/passwords/manage_passwords_bubble.cc
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/passwords/manage_passwords_bubble.h"
-
-#include "base/metrics/histogram.h"
-#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
-
-ManagePasswordsBubble::ManagePasswordsBubble(content::WebContents* contents,
-                                             DisplayReason reason)
-    : model_(new ManagePasswordsBubbleModel(contents)) {
-  model()->OnBubbleShown(reason);
-}
-
-ManagePasswordsBubble::~ManagePasswordsBubble() {
-  model()->OnBubbleHidden();
-}
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble.h b/chrome/browser/ui/passwords/manage_passwords_bubble.h
deleted file mode 100644
index fcc445a..0000000
--- a/chrome/browser/ui/passwords/manage_passwords_bubble.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_H_
-#define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_H_
-
-#include "base/basictypes.h"
-#include "base/memory/scoped_ptr.h"
-#include "components/password_manager/core/browser/password_manager_metrics_util.h"
-
-class ManagePasswordsBubbleModel;
-
-namespace content {
-class WebContents;
-}  // namespace content
-
-// Base class for platform-specific password management bubble views. This class
-// is responsible for creating and destroying the model associated with the view
-// and providing a platform-agnostic interface to the bubble.
-class ManagePasswordsBubble {
- public:
-  enum DisplayReason { AUTOMATIC, USER_ACTION };
-
- protected:
-  // Creates a ManagePasswordsBubble. |contents| is used only to create a
-  // ManagePasswordsBubbleModel; this class neither takes ownership of the
-  // object nor stores the pointer.
-  ManagePasswordsBubble(content::WebContents* contents, DisplayReason reason);
-  virtual ~ManagePasswordsBubble();
-
-  ManagePasswordsBubbleModel* model() { return model_.get(); }
-  const ManagePasswordsBubbleModel* model() const { return model_.get(); }
-
- private:
-  scoped_ptr<ManagePasswordsBubbleModel> model_;
-
-  DISALLOW_COPY_AND_ASSIGN(ManagePasswordsBubble);
-};
-
-#endif  // CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_H_
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
index a753a17..499e341 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.cc
@@ -85,10 +85,11 @@
 }  // namespace
 
 ManagePasswordsBubbleModel::ManagePasswordsBubbleModel(
-    content::WebContents* web_contents)
+    content::WebContents* web_contents,
+    DisplayReason display_reason)
     : content::WebContentsObserver(web_contents),
       display_disposition_(metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING),
-      dismissal_reason_(metrics_util::NOT_DISPLAYED),
+      dismissal_reason_(metrics_util::NO_DIRECT_INTERACTION),
       update_password_submission_event_(metrics_util::NO_UPDATE_SUBMISSION) {
   ManagePasswordsUIController* controller =
       ManagePasswordsUIController::FromWebContents(web_contents);
@@ -106,7 +107,7 @@
     local_credentials_ = DeepCopyForms(controller->GetCurrentForms());
     federated_credentials_ = DeepCopyForms(controller->GetFederatedForms());
   } else if (state_ == password_manager::ui::AUTO_SIGNIN_STATE) {
-    pending_password_ = *controller->GetCurrentForms()[0];
+    pending_password_ = controller->PendingPassword();
   } else {
     local_credentials_ = DeepCopyForms(controller->GetCurrentForms());
   }
@@ -147,13 +148,8 @@
 
   manage_link_ =
       l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_MANAGE_PASSWORDS_LINK);
-}
 
-ManagePasswordsBubbleModel::~ManagePasswordsBubbleModel() {}
-
-void ManagePasswordsBubbleModel::OnBubbleShown(
-    ManagePasswordsBubble::DisplayReason reason) {
-  if (reason == ManagePasswordsBubble::USER_ACTION) {
+  if (display_reason == USER_ACTION) {
     switch (state_) {
       case password_manager::ui::PENDING_PASSWORD_STATE:
         display_disposition_ = metrics_util::MANUAL_WITH_PASSWORD_PENDING;
@@ -193,17 +189,10 @@
   }
   metrics_util::LogUIDisplayDisposition(display_disposition_);
 
-  // Default to a dismissal reason of "no interaction". If the user interacts
-  // with the button in such a way that it closes, we'll reset this value
-  // accordingly.
-  dismissal_reason_ = metrics_util::NO_DIRECT_INTERACTION;
-
-  ManagePasswordsUIController* controller =
-      ManagePasswordsUIController::FromWebContents(web_contents());
   controller->OnBubbleShown();
 }
 
-void ManagePasswordsBubbleModel::OnBubbleHidden() {
+ManagePasswordsBubbleModel::~ManagePasswordsBubbleModel() {
   if (state_ == password_manager::ui::PENDING_PASSWORD_STATE) {
     Profile* profile = GetProfile();
     if (profile && IsSmartLockBrandingEnabled(profile)) {
@@ -239,7 +228,6 @@
   if (update_password_submission_event_ != metrics_util::NO_UPDATE_SUBMISSION)
     LogUpdatePasswordSubmissionEvent(update_password_submission_event_);
 }
-
 void ManagePasswordsBubbleModel::OnCancelClicked() {
   DCHECK_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, state_);
   dismissal_reason_ = metrics_util::CLICKED_CANCEL;
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
index 3a26755..e6a8947 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model.h
@@ -6,7 +6,6 @@
 #define CHROME_BROWSER_UI_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_MODEL_H_
 
 #include "base/memory/scoped_vector.h"
-#include "chrome/browser/ui/passwords/manage_passwords_bubble.h"
 #include "components/autofill/core/common/password_form.h"
 #include "components/password_manager/core/browser/password_manager_metrics_util.h"
 #include "components/password_manager/core/common/password_manager_ui.h"
@@ -30,21 +29,16 @@
 class ManagePasswordsBubbleModel : public content::WebContentsObserver {
  public:
   enum PasswordAction { REMOVE_PASSWORD, ADD_PASSWORD };
+  enum DisplayReason { AUTOMATIC, USER_ACTION };
 
   // Creates a ManagePasswordsBubbleModel, which holds a raw pointer to the
-  // WebContents in which it lives. Defaults to a display disposition of
-  // AUTOMATIC_WITH_PASSWORD_PENDING, and a dismissal reason of NOT_DISPLAYED.
-  // The bubble's state is updated from the ManagePasswordsUIController
-  // associated with |web_contents| upon creation.
-  explicit ManagePasswordsBubbleModel(content::WebContents* web_contents);
+  // WebContents in which it lives. Construction implies that the bubble
+  // is shown. The bubble's state is updated from the
+  // ManagePasswordsUIController associated with |web_contents|.
+  ManagePasswordsBubbleModel(content::WebContents* web_contents,
+                             DisplayReason reason);
   ~ManagePasswordsBubbleModel() override;
 
-  // Called by the view code when the bubble is shown.
-  void OnBubbleShown(ManagePasswordsBubble::DisplayReason reason);
-
-  // Called by the view code when the bubble is hidden.
-  void OnBubbleHidden();
-
   // Called by the view code when the "Cancel" button in clicked by the user.
   void OnCancelClicked();
 
diff --git a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
index 4f61e69..1b51b15 100644
--- a/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_bubble_model_unittest.cc
@@ -8,7 +8,6 @@
 #include "base/test/histogram_tester.h"
 #include "chrome/browser/sync/profile_sync_service_factory.h"
 #include "chrome/browser/sync/profile_sync_service_mock.h"
-#include "chrome/browser/ui/passwords/manage_passwords_bubble.h"
 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
 #include "chrome/test/base/testing_profile.h"
@@ -68,43 +67,48 @@
             content::WebContentsTester::CreateTestWebContents(&profile_,
                                                               nullptr)) {}
 
-  void SetUp() override {
-    // Create the test UIController here so that it's bound to
-    // |test_web_contents_| and therefore accessible to the model.
-    new ManagePasswordsUIControllerMock(test_web_contents_.get());
-
-    model_.reset(new ManagePasswordsBubbleModel(test_web_contents_.get()));
-  }
-
   void TearDown() override { model_.reset(); }
 
   PrefService* prefs() { return profile_.GetPrefs(); }
 
   TestingProfile* profile() { return &profile_; }
 
+ protected:
+  void SetUpWithState(password_manager::ui::State state,
+                      ManagePasswordsBubbleModel::DisplayReason reason) {
+    // Create the test UIController here so that it's bound to
+    // |test_web_contents_| and therefore accessible to the model.
+    ManagePasswordsUIControllerMock* mock =
+        new ManagePasswordsUIControllerMock(test_web_contents_.get());
+    mock->SetState(state);
+    model_.reset(
+        new ManagePasswordsBubbleModel(test_web_contents_.get(), reason));
+    mock->UnsetState();
+  }
+
   void PretendPasswordWaiting() {
-    model_->set_state(password_manager::ui::PENDING_PASSWORD_STATE);
-    model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC);
+    SetUpWithState(password_manager::ui::PENDING_PASSWORD_STATE,
+                   ManagePasswordsBubbleModel::AUTOMATIC);
   }
 
   void PretendUpdatePasswordWaiting() {
-    model_->set_state(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE);
-    model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC);
+    SetUpWithState(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE,
+                   ManagePasswordsBubbleModel::AUTOMATIC);
   }
 
   void PretendCredentialsWaiting() {
-    model_->set_state(password_manager::ui::CREDENTIAL_REQUEST_STATE);
-    model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC);
+    SetUpWithState(password_manager::ui::CREDENTIAL_REQUEST_STATE,
+                   ManagePasswordsBubbleModel::AUTOMATIC);
   }
 
   void PretendAutoSigningIn() {
-    model_->set_state(password_manager::ui::AUTO_SIGNIN_STATE);
-    model_->OnBubbleShown(ManagePasswordsBubble::AUTOMATIC);
+    SetUpWithState(password_manager::ui::AUTO_SIGNIN_STATE,
+                   ManagePasswordsBubbleModel::AUTOMATIC);
   }
 
   void PretendManagingPasswords() {
-    model_->set_state(password_manager::ui::MANAGE_STATE);
-    model_->OnBubbleShown(ManagePasswordsBubble::USER_ACTION);
+    SetUpWithState(password_manager::ui::MANAGE_STATE,
+                   ManagePasswordsBubbleModel::USER_ACTION);
   }
 
   ManagePasswordsUIControllerMock* controller() {
@@ -113,7 +117,8 @@
             test_web_contents_.get()));
   }
 
- protected:
+  content::WebContents* test_web_contents() { return test_web_contents_.get(); }
+
   scoped_ptr<ManagePasswordsBubbleModel> model_;
   autofill::PasswordForm test_form_;
 
@@ -123,34 +128,14 @@
   scoped_ptr<content::WebContents> test_web_contents_;
 };
 
-TEST_F(ManagePasswordsBubbleModelTest, DefaultValues) {
-  EXPECT_EQ(model_->display_disposition(),
-            password_manager::metrics_util::AUTOMATIC_WITH_PASSWORD_PENDING);
-  EXPECT_EQ(model_->dismissal_reason(),
-            password_manager::metrics_util::NOT_DISPLAYED);
-  EXPECT_FALSE(controller()->saved_password());
-  EXPECT_FALSE(controller()->never_saved_password());
-}
-
-TEST_F(ManagePasswordsBubbleModelTest, CloseWithoutLogging) {
-  base::HistogramTester histogram_tester;
-  model_->OnBubbleHidden();
-  EXPECT_EQ(model_->dismissal_reason(),
-            password_manager::metrics_util::NOT_DISPLAYED);
-  EXPECT_FALSE(controller()->saved_password());
-  EXPECT_FALSE(controller()->never_saved_password());
-
-  histogram_tester.ExpectTotalCount(kUIDismissalReasonMetric, 0);
-}
-
 TEST_F(ManagePasswordsBubbleModelTest, CloseWithoutInteraction) {
   base::HistogramTester histogram_tester;
   PretendPasswordWaiting();
-  model_->OnBubbleHidden();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::NO_DIRECT_INTERACTION);
   EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE,
             model_->state());
+  model_.reset();
   EXPECT_FALSE(controller()->saved_password());
   EXPECT_FALSE(controller()->never_saved_password());
 
@@ -164,12 +149,12 @@
   base::HistogramTester histogram_tester;
   PretendPasswordWaiting();
   model_->OnSaveClicked();
-  model_->OnBubbleHidden();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::CLICKED_SAVE);
+  model_.reset();
+
   EXPECT_TRUE(controller()->saved_password());
   EXPECT_FALSE(controller()->never_saved_password());
-
   histogram_tester.ExpectUniqueSample(
       kUIDismissalReasonMetric,
       password_manager::metrics_util::CLICKED_SAVE,
@@ -180,13 +165,13 @@
   base::HistogramTester histogram_tester;
   PretendPasswordWaiting();
   model_->OnNeverForThisSiteClicked();
-  model_->OnBubbleHidden();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::CLICKED_NEVER);
   EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE, model_->state());
+  model_.reset();
+
   EXPECT_FALSE(controller()->saved_password());
   EXPECT_TRUE(controller()->never_saved_password());
-
   histogram_tester.ExpectUniqueSample(
       kUIDismissalReasonMetric,
       password_manager::metrics_util::CLICKED_NEVER,
@@ -197,10 +182,11 @@
   base::HistogramTester histogram_tester;
   PretendManagingPasswords();
   model_->OnManageLinkClicked();
-  model_->OnBubbleHidden();
+
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::CLICKED_MANAGE);
   EXPECT_EQ(password_manager::ui::MANAGE_STATE, model_->state());
+  model_.reset();
   EXPECT_FALSE(controller()->saved_password());
   EXPECT_FALSE(controller()->never_saved_password());
 
@@ -214,10 +200,10 @@
   base::HistogramTester histogram_tester;
   PretendManagingPasswords();
   model_->OnDoneClicked();
-  model_->OnBubbleHidden();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::CLICKED_DONE);
   EXPECT_EQ(password_manager::ui::MANAGE_STATE, model_->state());
+  model_.reset();
   EXPECT_FALSE(controller()->saved_password());
   EXPECT_FALSE(controller()->never_saved_password());
 
@@ -234,9 +220,9 @@
   autofill::PasswordForm form;
   model_->OnChooseCredentials(
       form, password_manager::CredentialType::CREDENTIAL_TYPE_PASSWORD);
-  model_->OnBubbleHidden();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::CLICKED_CREDENTIAL);
+  model_.reset();
   EXPECT_FALSE(controller()->saved_password());
   EXPECT_FALSE(controller()->never_saved_password());
   EXPECT_TRUE(controller()->choose_credential());
@@ -252,9 +238,9 @@
   PretendCredentialsWaiting();
   EXPECT_FALSE(controller()->choose_credential());
   model_->OnCancelClicked();
-  model_->OnBubbleHidden();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::CLICKED_CANCEL);
+  model_.reset();
   EXPECT_FALSE(controller()->saved_password());
   EXPECT_FALSE(controller()->never_saved_password());
   EXPECT_FALSE(controller()->choose_credential());
@@ -268,9 +254,9 @@
   base::HistogramTester histogram_tester;
   PretendCredentialsWaiting();
   EXPECT_FALSE(controller()->choose_credential());
-  model_->OnBubbleHidden();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::NO_DIRECT_INTERACTION);
+  model_.reset();
   EXPECT_FALSE(controller()->saved_password());
   EXPECT_FALSE(controller()->never_saved_password());
   EXPECT_FALSE(controller()->choose_credential());
@@ -285,9 +271,9 @@
   base::HistogramTester histogram_tester;
   PretendAutoSigningIn();
   model_->OnAutoSignInToastTimeout();
-  model_->OnBubbleHidden();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::AUTO_SIGNIN_TOAST_TIMEOUT);
+  model_.reset();
 
   histogram_tester.ExpectUniqueSample(
       kUIDismissalReasonMetric,
@@ -302,7 +288,7 @@
   model_->OnAutoSignInClicked();
   EXPECT_EQ(model_->dismissal_reason(),
             password_manager::metrics_util::AUTO_SIGNIN_TOAST_CLICKED);
-  model_->OnBubbleHidden();
+  model_.reset();
 
   EXPECT_TRUE(controller()->manage_accounts());
 
@@ -315,7 +301,7 @@
 TEST_F(ManagePasswordsBubbleModelTest, ClickUpdate) {
   PretendUpdatePasswordWaiting();
   model_->OnUpdateClicked(autofill::PasswordForm());
-  model_->OnBubbleHidden();
+  model_.reset();
   EXPECT_TRUE(controller()->updated_password());
   EXPECT_FALSE(controller()->never_saved_password());
 }
@@ -332,7 +318,9 @@
 
   PretendPasswordWaiting();
   EXPECT_TRUE(model_->ShouldShowGoogleSmartLockWelcome());
-  model_->OnBubbleHidden();
+  model_.reset();
+  model_.reset(new ManagePasswordsBubbleModel(
+      test_web_contents(), ManagePasswordsBubbleModel::AUTOMATIC));
   EXPECT_FALSE(model_->ShouldShowGoogleSmartLockWelcome());
   EXPECT_TRUE(prefs()->GetBoolean(
       password_manager::prefs::kWasSavePrompFirstRunExperienceShown));
@@ -350,7 +338,9 @@
 
   PretendPasswordWaiting();
   EXPECT_FALSE(model_->ShouldShowGoogleSmartLockWelcome());
-  model_->OnBubbleHidden();
+  model_.reset();
+  model_.reset(new ManagePasswordsBubbleModel(
+      test_web_contents(), ManagePasswordsBubbleModel::AUTOMATIC));
   EXPECT_FALSE(model_->ShouldShowGoogleSmartLockWelcome());
   EXPECT_FALSE(prefs()->GetBoolean(
       password_manager::prefs::kWasSavePrompFirstRunExperienceShown));
diff --git a/chrome/browser/ui/passwords/manage_passwords_icon.cc b/chrome/browser/ui/passwords/manage_passwords_icon.cc
index cd560da..8001d68 100644
--- a/chrome/browser/ui/passwords/manage_passwords_icon.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_icon.cc
@@ -43,12 +43,9 @@
   }
 
   // Otherwise, start with the correct values for MANAGE_STATE, and adjust
-// things accordingly if we're in PENDING_STATE.
-// TODO(dconnelly): Figure out how to share the resources with Android.
-#if !defined(OS_ANDROID)
+  // things accordingly if we're in PENDING_STATE.
   icon_id_ = active() ? IDR_SAVE_PASSWORD_ACTIVE : IDR_SAVE_PASSWORD_INACTIVE;
   tooltip_text_id_ = IDS_PASSWORD_MANAGER_TOOLTIP_MANAGE;
   if (state() == password_manager::ui::PENDING_PASSWORD_STATE)
     tooltip_text_id_ = IDS_PASSWORD_MANAGER_TOOLTIP_SAVE;
-#endif
 }
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
index 595528f..40dec22 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.cc
@@ -15,7 +15,6 @@
 #include "chrome/browser/ui/browser_window.h"
 #include "chrome/browser/ui/chrome_pages.h"
 #include "chrome/browser/ui/location_bar/location_bar.h"
-#include "chrome/browser/ui/passwords/manage_passwords_icon.h"
 #include "chrome/browser/ui/tab_dialogs.h"
 #include "chrome/common/url_constants.h"
 #include "chrome/grit/generated_resources.h"
@@ -30,6 +29,8 @@
 #include "chrome/browser/android/chrome_application.h"
 #include "chrome/browser/infobars/infobar_service.h"
 #include "chrome/browser/password_manager/account_chooser_dialog_android.h"
+#else
+#include "chrome/browser/ui/passwords/manage_passwords_icon.h"
 #endif
 
 using autofill::PasswordFormMap;
@@ -343,13 +344,15 @@
 
 const autofill::PasswordForm& ManagePasswordsUIController::
     PendingPassword() const {
+  if (state() == password_manager::ui::AUTO_SIGNIN_STATE)
+    return *GetCurrentForms()[0];
+
   DCHECK(state() == password_manager::ui::PENDING_PASSWORD_STATE ||
          state() == password_manager::ui::PENDING_PASSWORD_UPDATE_STATE ||
          state() == password_manager::ui::CONFIRMATION_STATE)
       << state();
   password_manager::PasswordFormManager* form_manager =
       passwords_data_.form_manager();
-  DCHECK(form_manager);
   return form_manager->pending_credentials();
 }
 
@@ -359,6 +362,7 @@
   return form_manager ? form_manager->password_overridden() : false;
 }
 
+#if !defined(OS_ANDROID)
 void ManagePasswordsUIController::UpdateIconAndBubbleState(
     ManagePasswordsIcon* icon) {
   if (should_pop_up_bubble_) {
@@ -370,12 +374,14 @@
     icon->SetState(state());
   }
 }
+#endif
 
 void ManagePasswordsUIController::OnBubbleShown() {
   should_pop_up_bubble_ = false;
 }
 
 void ManagePasswordsUIController::OnBubbleHidden() {
+  // Avoid using |state()| which is overridden for some unit tests.
   if (state() == password_manager::ui::CREDENTIAL_REQUEST_STATE ||
       state() == password_manager::ui::CONFIRMATION_STATE ||
       state() == password_manager::ui::AUTO_SIGNIN_STATE) {
@@ -384,6 +390,10 @@
   }
 }
 
+password_manager::ui::State ManagePasswordsUIController::state() const {
+  return passwords_data_.state();
+}
+
 void ManagePasswordsUIController::ShowBubbleWithoutUserInteraction() {
   DCHECK(should_pop_up_bubble_);
 #if !defined(OS_ANDROID)
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
index d3f8bdb..c482ffbe 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller.h
@@ -116,9 +116,11 @@
 
   virtual const autofill::PasswordForm& PendingPassword() const;
 
+#if !defined(OS_ANDROID)
   // Set the state of the Omnibox icon, and possibly show the associated bubble
   // without user interaction.
   virtual void UpdateIconAndBubbleState(ManagePasswordsIcon* icon);
+#endif
 
   // Called from the model when the bubble is displayed.
   void OnBubbleShown();
@@ -126,7 +128,7 @@
   // Called from the model when the bubble is hidden.
   void OnBubbleHidden();
 
-  password_manager::ui::State state() const { return passwords_data_.state(); }
+  virtual password_manager::ui::State state() const;
 
   // True if a password is sitting around, waiting for a user to decide whether
   // or not to save it.
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.cc
index 2d241f6..78a7255 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.cc
@@ -17,7 +17,9 @@
       updated_password_(false),
       never_saved_password_(false),
       choose_credential_(false),
-      manage_accounts_(false) {
+      manage_accounts_(false),
+      state_overridden_(false),
+      state_(password_manager::ui::INACTIVE_STATE) {
   // Do not silently replace an existing ManagePasswordsUIController because it
   // unregisters itself in WebContentsDestroyed().
   EXPECT_FALSE(contents->GetUserData(UserDataKey()));
@@ -43,6 +45,20 @@
   pending_password_ = pending_password;
 }
 
+password_manager::ui::State ManagePasswordsUIControllerMock::state() const {
+  return state_overridden_ ? state_ : ManagePasswordsUIController::state();
+}
+
+void ManagePasswordsUIControllerMock::SetState(
+    password_manager::ui::State state) {
+  state_overridden_ = true;
+  state_ = state;
+}
+
+void ManagePasswordsUIControllerMock::UnsetState() {
+  state_overridden_ = false;
+}
+
 void ManagePasswordsUIControllerMock::ManageAccounts() {
   manage_accounts_ = true;
 }
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h
index a112de1b..06780f0 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h
@@ -56,6 +56,10 @@
   const autofill::PasswordForm& PendingPassword() const override;
   void SetPendingPassword(autofill::PasswordForm pending_password);
 
+  password_manager::ui::State state() const override;
+  void SetState(password_manager::ui::State state);
+  void UnsetState();
+
   void ManageAccounts() override;
   bool manage_accounts() const { return manage_accounts_; }
 
@@ -79,6 +83,8 @@
   bool never_saved_password_;
   bool choose_credential_;
   bool manage_accounts_;
+  bool state_overridden_;
+  password_manager::ui::State state_;
   base::TimeDelta elapsed_;
 
   autofill::PasswordForm chosen_credential_;
diff --git a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
index 4914f0b..4918f6ee 100644
--- a/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
+++ b/chrome/browser/ui/passwords/manage_passwords_ui_controller_unittest.cc
@@ -6,10 +6,7 @@
 #include "base/prefs/pref_service.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/time/time.h"
-#include "chrome/browser/ui/passwords/manage_passwords_bubble.h"
 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
-#include "chrome/browser/ui/passwords/manage_passwords_icon.h"
-#include "chrome/browser/ui/passwords/manage_passwords_icon_mock.h"
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller_mock.h"
 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
 #include "chrome/test/base/testing_profile.h"
@@ -25,6 +22,11 @@
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
+#if !defined(OS_ANDROID)
+#include "chrome/browser/ui/passwords/manage_passwords_icon.h"
+#include "chrome/browser/ui/passwords/manage_passwords_icon_mock.h"
+#endif
+
 using ::testing::ElementsAre;
 using ::testing::Pointee;
 
@@ -128,6 +130,20 @@
         ->NavigateAndCommit(GURL("http://example.com"));
   }
 
+  void ExpectIconStateIs(password_manager::ui::State state) {
+// No op on Android, where there is no icon.
+#if !defined(OS_ANDROID)
+    ManagePasswordsIconMock mock;
+    controller()->UpdateIconAndBubbleState(&mock);
+    EXPECT_EQ(state, mock.state());
+#endif
+  }
+
+  void ExpectIconAndControllerStateIs(password_manager::ui::State state) {
+    ExpectIconStateIs(state);
+    EXPECT_EQ(state, controller()->state());
+  }
+
   autofill::PasswordForm& test_local_form() { return test_local_form_; }
   autofill::PasswordForm& test_federated_form() { return test_federated_form_; }
   password_manager::CredentialInfo* credential_info() const {
@@ -142,7 +158,6 @@
   void CredentialCallback(const password_manager::CredentialInfo& info) {
     credential_info_.reset(new password_manager::CredentialInfo(info));
   }
-
   password_manager::StubPasswordManagerClient* client() {
     return &client_;
   }
@@ -170,9 +185,7 @@
   EXPECT_FALSE(controller()->PasswordPendingUserDecision());
   EXPECT_EQ(GURL::EmptyGURL(), controller()->origin());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::INACTIVE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::INACTIVE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, PasswordAutofilled) {
@@ -193,9 +206,7 @@
   // Controller should store a separate copy of the form as it doesn't own it.
   EXPECT_NE(test_form_ptr, controller()->GetCurrentForms()[0]);
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::MANAGE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, PasswordSubmitted) {
@@ -212,10 +223,7 @@
   // ManagePasswordsUIControllerMock::PendingCredentials.
   EXPECT_EQ(GURL::EmptyGURL(), controller()->origin());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE,
-            mock.state());
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, BlacklistedFormPasswordSubmitted) {
@@ -235,9 +243,7 @@
   EXPECT_TRUE(controller()->PasswordPendingUserDecision());
   EXPECT_FALSE(controller()->opened_bubble());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, PasswordSaved) {
@@ -248,11 +254,8 @@
       password_manager::PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES);
   controller()->OnPasswordSubmitted(test_form_manager.Pass());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
   controller()->SavePassword();
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::MANAGE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, PasswordBlacklisted) {
@@ -263,20 +266,15 @@
       password_manager::PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES);
   controller()->OnPasswordSubmitted(test_form_manager.Pass());
 
-  ManagePasswordsIconMock mock;
   controller()->NeverSavePassword();
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, QuickNavigations) {
   scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
       CreateFormManager());
   controller()->OnPasswordSubmitted(test_form_manager.Pass());
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE,
-            mock.state());
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
 
   // Fake-navigate within a second. We expect the bubble's state to persist
   // if a navigation occurs too quickly for a user to reasonably have been
@@ -286,20 +284,15 @@
       base::TimeDelta::FromMilliseconds(kQuickNavigationDelayInMS));
   controller()->DidNavigateMainFrame(content::LoadCommittedDetails(),
                                      content::FrameNavigateParams());
-  controller()->UpdateIconAndBubbleState(&mock);
 
-  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE,
-            mock.state());
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, SlowNavigations) {
   scoped_ptr<password_manager::PasswordFormManager> test_form_manager(
       CreateFormManager());
   controller()->OnPasswordSubmitted(test_form_manager.Pass());
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_STATE,
-            mock.state());
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_STATE);
 
   // Fake-navigate after a second. We expect the bubble's state to be reset
   // if a navigation occurs after this limit.
@@ -307,9 +300,8 @@
       base::TimeDelta::FromMilliseconds(kSlowNavigationDelayInMS));
   controller()->DidNavigateMainFrame(content::LoadCommittedDetails(),
                                      content::FrameNavigateParams());
-  controller()->UpdateIconAndBubbleState(&mock);
 
-  EXPECT_EQ(password_manager::ui::INACTIVE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::INACTIVE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, PasswordSubmittedToNonWebbyURL) {
@@ -328,9 +320,7 @@
   // ManagePasswordsUIControllerMock::PendingCredentials.
   EXPECT_EQ(GURL::EmptyGURL(), controller()->origin());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::INACTIVE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::INACTIVE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, BlacklistBlockedAutofill) {
@@ -345,9 +335,7 @@
   EXPECT_EQ(password_manager::ui::INACTIVE_STATE, controller()->state());
   EXPECT_FALSE(controller()->PasswordPendingUserDecision());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::INACTIVE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::INACTIVE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, BlacklistedElsewhere) {
@@ -366,9 +354,7 @@
   EXPECT_EQ(password_manager::ui::MANAGE_STATE, controller()->state());
   EXPECT_EQ(test_local_form().origin, controller()->origin());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::MANAGE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, AutomaticPasswordSave) {
@@ -379,9 +365,7 @@
   EXPECT_EQ(password_manager::ui::CONFIRMATION_STATE, controller()->state());
 
   controller()->OnBubbleHidden();
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::MANAGE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, ChooseCredentialLocal) {
@@ -400,9 +384,7 @@
   EXPECT_THAT(controller()->GetCurrentForms(),
               ElementsAre(Pointee(test_local_form())));
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::CREDENTIAL_REQUEST_STATE);
 
   controller()->ManagePasswordsUIController::ChooseCredential(
       test_local_form(),
@@ -434,9 +416,7 @@
   EXPECT_THAT(controller()->GetCurrentForms(),
               ElementsAre(Pointee(test_federated_form())));
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::CREDENTIAL_REQUEST_STATE);
 
   controller()->ManagePasswordsUIController::ChooseCredential(
       test_federated_form(),
@@ -468,9 +448,7 @@
   EXPECT_EQ(0u, controller()->GetCurrentForms().size());
   EXPECT_EQ(origin, controller()->origin());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::CREDENTIAL_REQUEST_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::CREDENTIAL_REQUEST_STATE);
 
   controller()->ManagePasswordsUIController::ChooseCredential(
      test_local_form(),
@@ -516,14 +494,9 @@
   EXPECT_EQ(test_local_form().origin, controller()->origin());
   ASSERT_FALSE(controller()->GetCurrentForms().empty());
   EXPECT_EQ(test_local_form(), *controller()->GetCurrentForms()[0]);
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::AUTO_SIGNIN_STATE, mock.state());
-
+  ExpectIconStateIs(password_manager::ui::AUTO_SIGNIN_STATE);
   controller()->OnBubbleHidden();
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, controller()->state());
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state());
+  ExpectIconAndControllerStateIs(password_manager::ui::MANAGE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, AutoSigninClickThrough) {
@@ -534,25 +507,17 @@
   EXPECT_EQ(test_local_form().origin, controller()->origin());
   ASSERT_FALSE(controller()->GetCurrentForms().empty());
   EXPECT_EQ(test_local_form(), *controller()->GetCurrentForms()[0]);
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::AUTO_SIGNIN_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::AUTO_SIGNIN_STATE);
 
   controller()->ManageAccounts();
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, controller()->state());
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state());
+  ExpectIconAndControllerStateIs(password_manager::ui::MANAGE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, AutofillDuringAutoSignin) {
   ScopedVector<autofill::PasswordForm> local_credentials;
   local_credentials.push_back(new autofill::PasswordForm(test_local_form()));
   controller()->OnAutoSignin(local_credentials.Pass());
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::AUTO_SIGNIN_STATE, mock.state());
-  EXPECT_EQ(password_manager::ui::AUTO_SIGNIN_STATE, controller()->state());
-
+  ExpectIconAndControllerStateIs(password_manager::ui::AUTO_SIGNIN_STATE);
   scoped_ptr<autofill::PasswordForm> test_form(
       new autofill::PasswordForm(test_local_form()));
   autofill::PasswordFormMap map;
@@ -560,8 +525,7 @@
   map.insert(kTestUsername, test_form.Pass());
   controller()->OnPasswordAutofilled(map);
 
-  EXPECT_EQ(password_manager::ui::AUTO_SIGNIN_STATE, mock.state());
-  EXPECT_EQ(password_manager::ui::AUTO_SIGNIN_STATE, controller()->state());
+  ExpectIconAndControllerStateIs(password_manager::ui::AUTO_SIGNIN_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, InactiveOnPSLMatched) {
@@ -583,9 +547,7 @@
   EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE,
             controller()->state());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE);
 }
 
 TEST_F(ManagePasswordsUIControllerTest, PasswordUpdated) {
@@ -596,10 +558,7 @@
       password_manager::PasswordFormManager::IGNORE_OTHER_POSSIBLE_USERNAMES);
   controller()->OnUpdatePasswordSubmitted(test_form_manager.Pass());
 
-  ManagePasswordsIconMock mock;
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::PENDING_PASSWORD_UPDATE_STATE);
   controller()->UpdatePassword(autofill::PasswordForm());
-  controller()->UpdateIconAndBubbleState(&mock);
-  EXPECT_EQ(password_manager::ui::MANAGE_STATE, mock.state());
+  ExpectIconStateIs(password_manager::ui::MANAGE_STATE);
 }
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index f7fac349..f114fb6d 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -250,6 +250,45 @@
                   static_cast<int>(output_string.size()));
 }
 
+// Shows the User Manager on startup if the last used profile must sign in or
+// if the last used profile was the guest or system profile.
+// Returns true if the User Manager was shown, false otherwise.
+bool ShowUserManagerOnStartupIfNeeded(
+    Profile* last_used_profile, const base::CommandLine& command_line) {
+#if defined(OS_CHROMEOS)
+  // ChromeOS never shows the User Manager on startup.
+  return false;
+#else
+  const ProfileInfoCache& profile_info =
+      g_browser_process->profile_manager()->GetProfileInfoCache();
+  size_t profile_index = profile_info.GetIndexOfProfileWithPath(
+      last_used_profile->GetPath());
+
+  if (profile_index == std::string::npos ||
+      !profile_info.ProfileIsSigninRequiredAtIndex(profile_index)) {
+    // Signin is not required. However, guest, system or locked profiles cannot
+    // be re-opened on startup. The only exception is if there's already a Guest
+    // window open in a separate process (for example, launching a new browser
+    // after clicking on a downloaded file in Guest mode).
+    if ((!last_used_profile->IsGuestSession() &&
+         !last_used_profile->IsSystemProfile()) ||
+        (chrome::GetTotalBrowserCountForProfile(
+           last_used_profile->GetOffTheRecordProfile()) > 0)) {
+      return false;
+    }
+  }
+
+  // Show the User Manager.
+  profiles::UserManagerProfileSelected action =
+      command_line.HasSwitch(switches::kShowAppList) ?
+          profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER :
+          profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION;
+  UserManager::Show(
+      base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, action);
+  return true;
+#endif
+}
+
 }  // namespace
 
 StartupBrowserCreator::StartupBrowserCreator()
@@ -671,34 +710,8 @@
   // |last_used_profile| is the last used incognito profile. Restoring it will
   // create a browser window for the corresponding original profile.
   if (last_opened_profiles.empty()) {
-    // If the last used profile is locked or was a guest, show the user manager.
-    if (switches::IsNewAvatarMenu()) {
-      ProfileInfoCache& profile_info =
-          g_browser_process->profile_manager()->GetProfileInfoCache();
-      size_t profile_index = profile_info.GetIndexOfProfileWithPath(
-          last_used_profile->GetPath());
-      bool signin_required = profile_index != std::string::npos &&
-          profile_info.ProfileIsSigninRequiredAtIndex(profile_index);
-
-      // Guest, system or locked profiles cannot be re-opened on startup. The
-      // only exception is if there's already a Guest window open in a separate
-      // process (for example, launching a new browser after clicking on a
-      // downloaded file in Guest mode).
-      bool guest_or_system = last_used_profile->IsGuestSession() ||
-                             last_used_profile->IsSystemProfile();
-      bool has_guest_browsers = guest_or_system &&
-          chrome::GetTotalBrowserCountForProfile(
-              last_used_profile->GetOffTheRecordProfile()) > 0;
-      if (signin_required || (guest_or_system && !has_guest_browsers)) {
-        profiles::UserManagerProfileSelected action =
-            command_line.HasSwitch(switches::kShowAppList) ?
-                profiles::USER_MANAGER_SELECT_PROFILE_APP_LAUNCHER :
-                profiles::USER_MANAGER_SELECT_PROFILE_NO_ACTION;
-        UserManager::Show(
-            base::FilePath(), profiles::USER_MANAGER_NO_TUTORIAL, action);
-        return true;
-      }
-    }
+    if (ShowUserManagerOnStartupIfNeeded(last_used_profile, command_line))
+      return true;
 
     Profile* profile_to_open = last_used_profile->IsGuestSession() ?
         last_used_profile->GetOffTheRecordProfile() : last_used_profile;
@@ -709,15 +722,17 @@
       return false;
     }
   } else {
+#if !defined(OS_CHROMEOS)
     // Guest profiles should not be reopened on startup. This can happen if
     // the last used profile was a Guest, but other profiles were also open
     // when Chrome was closed. In this case, pick a different open profile
     // to be the active one, since the Guest profile is never added to the list
     // of open profiles.
-    if (switches::IsNewAvatarMenu() && last_used_profile->IsGuestSession()) {
+    if (last_used_profile->IsGuestSession()) {
       DCHECK(!last_opened_profiles[0]->IsGuestSession());
       last_used_profile = last_opened_profiles[0];
     }
+#endif
 
     // Launch the last used profile with the full command line, and the other
     // opened profiles without the URLs to launch.
diff --git a/chrome/browser/ui/tabs/tab_discard_state.cc b/chrome/browser/ui/tabs/tab_discard_state.cc
index da2a386..728caf84 100644
--- a/chrome/browser/ui/tabs/tab_discard_state.cc
+++ b/chrome/browser/ui/tabs/tab_discard_state.cc
@@ -8,6 +8,7 @@
 #include "content/public/browser/browser_thread.h"
 #include "content/public/browser/web_contents.h"
 
+using base::TimeTicks;
 using content::WebContents;
 
 namespace {
@@ -39,9 +40,16 @@
 }
 
 // static
+void TabDiscardState::CopyState(content::WebContents* old_contents,
+                                content::WebContents* new_contents) {
+  TabDiscardState* old_state = Get(old_contents);
+  TabDiscardState* new_State = Get(new_contents);
+  *new_State = *old_state;
+}
+
+// static
 bool TabDiscardState::IsDiscarded(WebContents* web_contents) {
-  TabDiscardState* discard_state = TabDiscardState::Get(web_contents);
-  return discard_state->is_discarded_;
+  return TabDiscardState::Get(web_contents)->is_discarded_;
 }
 
 // static
@@ -58,20 +66,39 @@
 
 // static
 int TabDiscardState::DiscardCount(WebContents* web_contents) {
-  TabDiscardState* discard_state = TabDiscardState::Get(web_contents);
-  return discard_state->discard_count_;
+  return TabDiscardState::Get(web_contents)->discard_count_;
 }
 
 // static
 void TabDiscardState::IncrementDiscardCount(WebContents* web_contents) {
-  TabDiscardState* discard_state = TabDiscardState::Get(web_contents);
-  discard_state->discard_count_++;
+  TabDiscardState::Get(web_contents)->discard_count_++;
 }
 
 // static
-void TabDiscardState::CopyState(content::WebContents* old_contents,
-                                content::WebContents* new_contents) {
-  TabDiscardState* old_state = Get(old_contents);
-  TabDiscardState* new_State = Get(new_contents);
-  *new_State = *old_state;
+bool TabDiscardState::IsRecentlyAudible(content::WebContents* web_contents) {
+  return TabDiscardState::Get(web_contents)->is_recently_audible_;
 }
+
+// static
+void TabDiscardState::SetRecentlyAudible(content::WebContents* web_contents,
+                                         bool state) {
+  TabDiscardState::Get(web_contents)->is_recently_audible_ = state;
+}
+
+// static
+TimeTicks TabDiscardState::LastAudioChangeTime(
+    content::WebContents* web_contents) {
+  return TabDiscardState::Get(web_contents)->last_audio_change_time_;
+}
+
+// static
+void TabDiscardState::SetLastAudioChangeTime(content::WebContents* web_contents,
+                                             TimeTicks timestamp) {
+  TabDiscardState::Get(web_contents)->last_audio_change_time_ = timestamp;
+}
+
+TabDiscardState::TabDiscardState()
+    : is_discarded_(false),
+      discard_count_(0),
+      is_recently_audible_(false),
+      last_audio_change_time_(TimeTicks::UnixEpoch()) {}
diff --git a/chrome/browser/ui/tabs/tab_discard_state.h b/chrome/browser/ui/tabs/tab_discard_state.h
index 5bdd203..8b4fb3fd 100644
--- a/chrome/browser/ui/tabs/tab_discard_state.h
+++ b/chrome/browser/ui/tabs/tab_discard_state.h
@@ -6,6 +6,7 @@
 #define CHROME_BROWSER_UI_TABS_TAB_DISCARD_STATE_H_
 
 #include "base/supports_user_data.h"
+#include "base/time/time.h"
 
 namespace content {
 class WebContents;
@@ -23,6 +24,10 @@
   // |state| is now owned by |web_contents|
   static void Set(content::WebContents* web_contents, TabDiscardState* state);
 
+  // Copies the discard state from |old_contents| to |new_contents|.
+  static void CopyState(content::WebContents* old_contents,
+                        content::WebContents* new_contents);
+
   // Returns true if |web_contents| has been discarded to save memory.
   static bool IsDiscarded(content::WebContents* web_contents);
 
@@ -35,18 +40,38 @@
   // Increments the number of times |web_contents| has been discarded.
   static void IncrementDiscardCount(content::WebContents* web_contents);
 
-  // Copies the discard state from |old_contents| to |new_contents|.
-  static void CopyState(content::WebContents* old_contents,
-                        content::WebContents* new_contents);
+  // Returns true if audio has recently been audible from the WebContents.
+  static bool IsRecentlyAudible(content::WebContents* web_contents);
 
-  TabDiscardState() : is_discarded_(false), discard_count_(0) {}
+  // Set/clears the state of whether audio has recently been audible from the
+  // WebContents.
+  static void SetRecentlyAudible(content::WebContents* web_contents,
+                                 bool state);
+
+  // Returns the timestamp of the last time |web_contents| changed its audio
+  // state.
+  static base::TimeTicks LastAudioChangeTime(
+      content::WebContents* web_contents);
+
+  // Sets the timestamp of the last time |web_contents| changed its audio state.
+  static void SetLastAudioChangeTime(content::WebContents* web_contents,
+                                     base::TimeTicks timestamp);
 
  private:
+  TabDiscardState();
+
   // Is the tab currently discarded?
   bool is_discarded_;
 
   // Number of times the tab has been discarded.
   int discard_count_;
+
+  // Is the tab playing audio?
+  bool is_recently_audible_;
+
+  // Last time the tab started or stopped playing audio (we record the
+  // transition time).
+  base::TimeTicks last_audio_change_time_;
 };
 
 #endif  // CHROME_BROWSER_UI_TABS_TAB_DISCARD_STATE_H_
diff --git a/chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc b/chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc
index 36802a8..33e4802 100644
--- a/chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc
+++ b/chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc
@@ -7,10 +7,12 @@
 #include "base/strings/string16.h"
 #include "chrome/browser/ui/autofill/password_generation_popup_controller.h"
 #include "chrome/browser/ui/autofill/popup_constants.h"
-#include "grit/theme_resources.h"
 #include "ui/accessibility/ax_view_state.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/gfx/canvas.h"
+#include "ui/gfx/color_palette.h"
+#include "ui/gfx/paint_vector_icon.h"
+#include "ui/gfx/vector_icons_public.h"
 #include "ui/views/background.h"
 #include "ui/views/border.h"
 #include "ui/views/controls/image_view.h"
@@ -88,17 +90,15 @@
             const gfx::FontList& font_list) {
     views::BoxLayout* box_layout = new views::BoxLayout(
         views::BoxLayout::kHorizontal,
-        PasswordGenerationPopupController::kHorizontalPadding,
-        0,
-        15);
+        PasswordGenerationPopupController::kHorizontalPadding, 0,
+        PasswordGenerationPopupController::kHorizontalPadding);
     box_layout->set_main_axis_alignment(
         views::BoxLayout::MAIN_AXIS_ALIGNMENT_START);
     SetLayoutManager(box_layout);
 
     views::ImageView* key_image = new views::ImageView();
-    key_image->SetImage(
-        ui::ResourceBundle::GetSharedInstance().GetImageNamed(
-            IDR_GENERATE_PASSWORD_KEY).ToImageSkia());
+    key_image->SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::AUTOLOGIN, 32,
+                                              gfx::kChromeIconGrey));
     AddChildView(key_image);
 
     PasswordTextBox* password_text_box = new PasswordTextBox();
diff --git a/chrome/browser/ui/views/exclusive_access_bubble_views.cc b/chrome/browser/ui/views/exclusive_access_bubble_views.cc
index a9a1e2e..d69e3a9a 100644
--- a/chrome/browser/ui/views/exclusive_access_bubble_views.cc
+++ b/chrome/browser/ui/views/exclusive_access_bubble_views.cc
@@ -21,6 +21,7 @@
 #include "ui/gfx/animation/slide_animation.h"
 #include "ui/gfx/canvas.h"
 #include "ui/gfx/screen.h"
+#include "ui/native_theme/native_theme.h"
 #include "ui/strings/grit/ui_strings.h"
 #include "ui/views/bubble/bubble_border.h"
 #include "ui/views/controls/button/label_button.h"
@@ -138,9 +139,10 @@
   // See http://crbug.com/462983.
   shadow_type = views::BubbleBorder::SMALL_SHADOW;
 #endif
-  scoped_ptr<views::BubbleBorder> bubble_border(
-      new views::BubbleBorder(views::BubbleBorder::NONE,
-                              shadow_type, SK_ColorWHITE));
+  ui::NativeTheme* theme = ui::NativeTheme::instance();
+  scoped_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder(
+      views::BubbleBorder::NONE, shadow_type,
+      theme->GetSystemColor(ui::NativeTheme::kColorId_BubbleBackground)));
   set_background(new views::BubbleBackground(bubble_border.get()));
   SetBorder(bubble_border.Pass());
   SetFocusable(false);
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
index 798f060a..3ee9b319 100644
--- a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
+++ b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.cc
@@ -456,29 +456,47 @@
 void ExtensionInstalledBubbleView::Show(const Extension* extension,
                                         Browser* browser,
                                         const SkBitmap& icon) {
-  new ExtensionInstalledBubbleView(extension, browser, icon);
+  // ExtensionInstalledBubbleView is deleted in WidgetDelegate::DeleteDelegate.
+  new ExtensionInstalledBubbleView(
+      make_scoped_ptr(new ExtensionInstalledBubble(extension, browser, icon)));
 }
 
 ExtensionInstalledBubbleView::ExtensionInstalledBubbleView(
-    const Extension* extension, Browser *browser, const SkBitmap& icon)
-    : bubble_(this, extension, browser, icon) {
+    scoped_ptr<ExtensionInstalledBubble> bubble)
+    : bubble_(bubble.Pass()) {
+  DCHECK(bubble_);
+  bubble_->SetBubbleUi(this);
 }
 
 ExtensionInstalledBubbleView::~ExtensionInstalledBubbleView() {}
 
-bool ExtensionInstalledBubbleView::MaybeShowNow() {
+// static
+bool ExtensionInstalledBubble::ExtensionInstalledBubbleUi::ShouldShow(
+    ExtensionInstalledBubble* bubble) {
+  if (bubble->type() == bubble->BROWSER_ACTION ||
+      extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) {
+    BrowserActionsContainer* container =
+        BrowserView::GetBrowserViewForBrowser(bubble->browser())
+            ->GetToolbarView()
+            ->browser_actions();
+    return !container->animating();
+  }
+  return true;
+}
+
+void ExtensionInstalledBubbleView::Show() {
   BrowserView* browser_view =
-      BrowserView::GetBrowserViewForBrowser(bubble_.browser());
+      BrowserView::GetBrowserViewForBrowser(bubble_->browser());
 
   views::View* reference_view = NULL;
-  if (bubble_.type() == bubble_.BROWSER_ACTION ||
+  if (bubble_->type() == bubble_->BROWSER_ACTION ||
       extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) {
     BrowserActionsContainer* container =
         browser_view->GetToolbarView()->browser_actions();
-    if (container->animating())
-      return false;
+    // Hitting this DCHECK means |ShouldShow| failed.
+    DCHECK(!container->animating());
 
-    reference_view = container->GetViewForId(bubble_.extension()->id());
+    reference_view = container->GetViewForId(bubble_->extension()->id());
     // If the view is not visible then it is in the chevron, so point the
     // install bubble to the chevron instead. If this is an incognito window,
     // both could be invisible.
@@ -487,16 +505,16 @@
       if (!reference_view || !reference_view->visible())
         reference_view = NULL;  // fall back to app menu below.
     }
-  } else if (bubble_.type() == bubble_.PAGE_ACTION) {
+  } else if (bubble_->type() == bubble_->PAGE_ACTION) {
     LocationBarView* location_bar_view = browser_view->GetLocationBarView();
     ExtensionAction* page_action =
-        extensions::ExtensionActionManager::Get(bubble_.browser()->profile())->
-            GetPageAction(*bubble_.extension());
+        extensions::ExtensionActionManager::Get(bubble_->browser()->profile())
+            ->GetPageAction(*bubble_->extension());
     location_bar_view->SetPreviewEnabledPageAction(page_action,
                                                    true);  // preview_enabled
     reference_view = location_bar_view->GetPageActionView(page_action);
     DCHECK(reference_view);
-  } else if (bubble_.type() == bubble_.OMNIBOX_KEYWORD) {
+  } else if (bubble_->type() == bubble_->OMNIBOX_KEYWORD) {
     LocationBarView* location_bar_view = browser_view->GetLocationBarView();
     reference_view = location_bar_view;
     DCHECK(reference_view);
@@ -507,28 +525,26 @@
     reference_view = browser_view->GetToolbarView()->app_menu();
   SetAnchorView(reference_view);
 
-  set_arrow(bubble_.type() == bubble_.OMNIBOX_KEYWORD ?
-            views::BubbleBorder::TOP_LEFT :
-            views::BubbleBorder::TOP_RIGHT);
+  set_arrow(bubble_->type() == bubble_->OMNIBOX_KEYWORD
+                ? views::BubbleBorder::TOP_LEFT
+                : views::BubbleBorder::TOP_RIGHT);
   SetLayoutManager(new views::FillLayout());
-  AddChildView(new InstalledBubbleContent(bubble_, bubble_.browser()));
+  AddChildView(new InstalledBubbleContent(*bubble_, bubble_->browser()));
 
   views::BubbleDelegateView::CreateBubble(this)->Show();
 
   // The bubble widget is now the parent and owner of |this| and takes care of
   // deletion when the bubble or browser go away.
-  bubble_.IgnoreBrowserClosing();
-
-  return true;
+  bubble_->IgnoreBrowserClosing();
 }
 
 gfx::Rect ExtensionInstalledBubbleView::GetAnchorRect() const {
   // For omnibox keyword bubbles, move the arrow to point to the left edge
   // of the omnibox, just to the right of the icon.
-  if (bubble_.type() == bubble_.OMNIBOX_KEYWORD) {
+  if (bubble_->type() == bubble_->OMNIBOX_KEYWORD) {
     const LocationBarView* location_bar_view =
-        BrowserView::GetBrowserViewForBrowser(bubble_.browser())->
-        GetLocationBarView();
+        BrowserView::GetBrowserViewForBrowser(bubble_->browser())
+            ->GetLocationBarView();
     return gfx::Rect(location_bar_view->GetOmniboxViewOrigin(),
         gfx::Size(0, location_bar_view->omnibox_view()->height()));
   }
@@ -536,13 +552,13 @@
 }
 
 void ExtensionInstalledBubbleView::WindowClosing() {
-  if (bubble_.extension() && bubble_.type() == bubble_.PAGE_ACTION &&
+  if (bubble_->extension() && bubble_->type() == bubble_->PAGE_ACTION &&
       !extensions::FeatureSwitch::extension_action_redesign()->IsEnabled()) {
     BrowserView* browser_view =
-        BrowserView::GetBrowserViewForBrowser(bubble_.browser());
+        BrowserView::GetBrowserViewForBrowser(bubble_->browser());
     browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
-        extensions::ExtensionActionManager::Get(bubble_.browser()->profile())->
-        GetPageAction(*bubble_.extension()),
+        extensions::ExtensionActionManager::Get(bubble_->browser()->profile())
+            ->GetPageAction(*bubble_->extension()),
         false);  // preview_enabled
   }
 }
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.h b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.h
index 9271f4b..6a143be 100644
--- a/chrome/browser/ui/views/extensions/extension_installed_bubble_view.h
+++ b/chrome/browser/ui/views/extensions/extension_installed_bubble_view.h
@@ -6,6 +6,7 @@
 #define CHROME_BROWSER_UI_VIEWS_EXTENSIONS_EXTENSION_INSTALLED_BUBBLE_VIEW_H_
 
 #include "base/compiler_specific.h"
+#include "base/memory/scoped_ptr.h"
 #include "chrome/browser/ui/extensions/extension_installed_bubble.h"
 #include "ui/views/bubble/bubble_delegate.h"
 
@@ -37,14 +38,13 @@
                    const SkBitmap& icon);
 
  private:
-  ExtensionInstalledBubbleView(const extensions::Extension* extension,
-                               Browser* browser,
-                               const SkBitmap& icon);
+  explicit ExtensionInstalledBubbleView(
+      scoped_ptr<ExtensionInstalledBubble> bubble);
 
   ~ExtensionInstalledBubbleView() override;
 
   // ExtensionInstalledBubble::ExtensionInstalledBubbleUi:
-  bool MaybeShowNow() override;
+  void Show() override;
 
   // views::WidgetDelegate:
   void WindowClosing() override;
@@ -52,7 +52,7 @@
   // views::BubbleDelegate:
   gfx::Rect GetAnchorRect() const override;
 
-  ExtensionInstalledBubble bubble_;
+  scoped_ptr<ExtensionInstalledBubble> bubble_;
 
   DISALLOW_COPY_AND_ASSIGN(ExtensionInstalledBubbleView);
 };
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
index c4d6a7c..8e7369b 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view.cc
@@ -73,18 +73,26 @@
   if (!is_visible)
     return;
 
-  // The first time UpdateOldAvatarButton() is called the window is not visible
-  // so DrawTaskBarDecoration() has no effect. Therefore we need to call it
-  // again once the window is visible.
-  if (!browser_view_->IsRegularOrGuestSession() ||
-      !switches::IsNewAvatarMenu()) {
+#if defined(OS_CHROMEOS)
+  // On ChromeOS we always need to give the old avatar button a chance to update
+  // in case we're in a teleported window. On desktop, the old avatar button
+  // only shows up when in incognito mode.
+  UpdateOldAvatarButton();
+  OnProfileAvatarChanged(base::FilePath());
+#else
+  if (!browser_view_->IsRegularOrGuestSession()) {
+    // The first time UpdateOldAvatarButton() is called the window is not
+    // visible so DrawTaskBarDecoration() has no effect. Therefore we need to
+    // call it again once the window is visible.
     UpdateOldAvatarButton();
   }
 
-  // Make sure the task bar icon is correctly updated call
-  // |OnProfileAvatarChanged()| in this case, but only for non guest profiles.
-  if (!browser_view_->IsGuestSession() || !switches::IsNewAvatarMenu())
+  // Call OnProfileAvatarChanged() in this case to make sure the task bar icon
+  // is correctly updated. Guest profiles don't badge the icon so no need to do
+  // this in guest mode.
+  if (!browser_view_->IsGuestSession())
     OnProfileAvatarChanged(base::FilePath());
+#endif
 }
 
 void BrowserNonClientFrameView::ChildPreferredSizeChanged(View* child) {
@@ -179,9 +187,11 @@
 }
 
 void BrowserNonClientFrameView::UpdateAvatar() {
-  if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu())
+#if !defined(OS_CHROMEOS)
+  if (browser_view()->IsRegularOrGuestSession())
     UpdateNewAvatarButtonImpl();
   else
+#endif
     UpdateOldAvatarButton();
 }
 
@@ -246,7 +256,6 @@
 void BrowserNonClientFrameView::UpdateNewAvatarButton(
     views::ButtonListener* listener,
     const NewAvatarButton::AvatarButtonStyle style) {
-  DCHECK(switches::IsNewAvatarMenu());
   // This should never be called in incognito mode.
   DCHECK(browser_view_->IsRegularOrGuestSession());
 
@@ -282,11 +291,12 @@
 void BrowserNonClientFrameView::OnProfileAvatarChanged(
     const base::FilePath& profile_path) {
   UpdateTaskbarDecoration();
-  // Profile avatars are only displayed in the old UI or incognito.
-  if ((!browser_view()->IsGuestSession() && browser_view()->IsOffTheRecord()) ||
-      !switches::IsNewAvatarMenu()) {
+  // Profile avatars are only displayed in incognito or on ChromeOS teleported
+  // windows.
+#if !defined(OS_CHROMEOS)
+  if (!browser_view()->IsGuestSession() && browser_view()->IsOffTheRecord())
+#endif
     UpdateOldAvatarButton();
-  }
 }
 
 void BrowserNonClientFrameView::UpdateTaskbarDecoration() {
diff --git a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
index fd553577e..e8b68fa5 100644
--- a/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
+++ b/chrome/browser/ui/views/frame/browser_non_client_frame_view_ash.cc
@@ -568,7 +568,7 @@
 
 #if defined(FRAME_AVATAR_BUTTON)
 void BrowserNonClientFrameViewAsh::LayoutNewStyleAvatar() {
-  DCHECK(switches::IsNewAvatarMenu());
+  DCHECK(new_avatar_button());
 
   gfx::Size button_size = new_avatar_button()->GetPreferredSize();
   int button_x = width() -
diff --git a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
index 8287970..6475ec4 100644
--- a/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/glass_browser_frame_view.cc
@@ -114,7 +114,6 @@
   // The new avatar button is optionally displayed to the left of the
   // minimize button.
   if (new_avatar_button()) {
-    DCHECK(switches::IsNewAvatarMenu());
     minimize_button_offset -=
         new_avatar_button()->width() + kNewAvatarButtonOffset;
 
@@ -137,8 +136,7 @@
   if (base::i18n::IsRTL()) {
     if (!browser_view()->ShouldShowAvatar() && frame()->IsMaximized()) {
       tabstrip_x += avatar_bounds_.x();
-    } else if (browser_view()->IsRegularOrGuestSession() &&
-               switches::IsNewAvatarMenu()) {
+    } else if (browser_view()->IsRegularOrGuestSession()) {
       tabstrip_x = width() - minimize_button_offset;
     }
 
@@ -274,7 +272,7 @@
 }
 
 void GlassBrowserFrameView::Layout() {
-  if (browser_view()->IsRegularOrGuestSession() && switches::IsNewAvatarMenu())
+  if (browser_view()->IsRegularOrGuestSession())
     LayoutNewStyleAvatar();
   else
     LayoutAvatar();
@@ -487,7 +485,7 @@
 }
 
 void GlassBrowserFrameView::LayoutNewStyleAvatar() {
-  DCHECK(switches::IsNewAvatarMenu());
+  DCHECK(browser_view()->IsRegularOrGuestSession());
   if (!new_avatar_button())
     return;
 
@@ -514,9 +512,6 @@
 }
 
 void GlassBrowserFrameView::LayoutAvatar() {
-  // Even though the avatar is used for both incognito and profiles we always
-  // use the incognito icon to layout the avatar button. The profile icon
-  // can be customized so we can't depend on its size to perform layout.
   gfx::ImageSkia incognito_icon = browser_view()->GetOTRAvatarIcon();
 
   int avatar_x = NonClientBorderThickness() + kAvatarLeftSpacing;
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
index 91f71c9..ea63ba1 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc
@@ -391,7 +391,6 @@
 }
 
 void OpaqueBrowserFrameViewLayout::LayoutNewStyleAvatar(views::View* host) {
-  DCHECK(switches::IsNewAvatarMenu());
   if (!new_avatar_button_)
     return;
 
@@ -689,7 +688,7 @@
   // on the trailing side.
   leading_button_start_++;
 
-  if (delegate_->IsRegularOrGuestSession() && switches::IsNewAvatarMenu())
+  if (delegate_->IsRegularOrGuestSession())
     LayoutNewStyleAvatar(host);
   else
     LayoutAvatar(host);
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
index 1d0f219..921cf49 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view_layout_unittest.cc
@@ -200,33 +200,7 @@
     root_view_->AddChildView(window_title_);
   }
 
-  void AddAvatarButton() {
-    // Disable the New Avatar Menu.
-    switches::DisableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
-
-    menu_button_ = new AvatarMenuButton(nullptr, false);
-    menu_button_->set_id(VIEW_ID_AVATAR_BUTTON);
-    delegate_->SetShouldShowAvatar(true);
-    root_view_->AddChildView(menu_button_);
-  }
-
-#if defined(ENABLE_SUPERVISED_USERS)
-  void AddSupervisedUserAvatarLabel() {
-    supervised_user_avatar_label_ = new SupervisedUserAvatarLabel(nullptr);
-    supervised_user_avatar_label_->set_id(VIEW_ID_SUPERVISED_USER_AVATAR_LABEL);
-    root_view_->AddChildView(supervised_user_avatar_label_);
-
-    // The avatar label should only be used together with the avatar button.
-    AddAvatarButton();
-  }
-#endif
-
   void AddNewAvatarButton() {
-    // Enable the New Avatar Menu.
-    switches::EnableNewAvatarMenuForTesting(
-        base::CommandLine::ForCurrentProcess());
-
     new_avatar_button_ =
         new views::MenuButton(nullptr, base::string16(), nullptr, false);
     new_avatar_button_->set_id(VIEW_ID_NEW_AVATAR_BUTTON);
@@ -414,55 +388,6 @@
   EXPECT_EQ("27,3 370x17", window_title_->bounds().ToString());
 }
 
-TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithAvatar) {
-  // Tests a normal tabstrip window with an avatar icon.
-  AddAvatarButton();
-  root_view_->Layout();
-
-  ExpectBasicWindowBounds();
-
-  // Check the location of the avatar
-  EXPECT_EQ("7,11 40x29", menu_button_->bounds().ToString());
-  EXPECT_EQ("45,13 352x29",
-            layout_manager_->GetBoundsForTabStrip(
-                delegate_->GetTabstripPreferredSize(), kWidth).ToString());
-  EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString());
-}
-
-TEST_F(OpaqueBrowserFrameViewLayoutTest,
-       WindowWithAvatarWithoutCaptionButtonsOnLeft) {
-  // Tests the layout of a chrome window with an avatar icon and no caption
-  // buttons. However, the caption buttons *would* be on the left if they
-  // weren't hidden, and therefore, the avatar icon should be on the right.
-  // The lack of caption buttons should force the tab strip to be condensed.
-  AddAvatarButton();
-  std::vector<views::FrameButton> leading_buttons;
-  std::vector<views::FrameButton> trailing_buttons;
-  leading_buttons.push_back(views::FRAME_BUTTON_CLOSE);
-  leading_buttons.push_back(views::FRAME_BUTTON_MINIMIZE);
-  leading_buttons.push_back(views::FRAME_BUTTON_MAXIMIZE);
-  layout_manager_->SetButtonOrdering(leading_buttons, trailing_buttons);
-  delegate_->SetShouldShowCaptionButtons(false);
-  root_view_->Layout();
-
-  EXPECT_EQ("0,0 0x0", maximize_button_->bounds().ToString());
-  EXPECT_EQ("0,0 0x0", minimize_button_->bounds().ToString());
-  EXPECT_EQ("0,0 0x0", restore_button_->bounds().ToString());
-  EXPECT_EQ("0,0 0x0", close_button_->bounds().ToString());
-
-  // Check the location of the avatar
-  EXPECT_EQ("458,0 40x24", menu_button_->bounds().ToString());
-  EXPECT_EQ("-5,-3 458x29",
-            layout_manager_->GetBoundsForTabStrip(
-                delegate_->GetTabstripPreferredSize(), kWidth).ToString());
-  EXPECT_EQ("251x61", layout_manager_->GetMinimumSize(kWidth).ToString());
-
-  // A normal window with no window icon still produces icon bounds for
-  // Windows, which has a hidden icon that a user can double click on to close
-  // the window.
-  EXPECT_EQ("2,0 17x17", layout_manager_->IconBounds().ToString());
-}
-
 TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithNewAvatar) {
   // Tests a normal tabstrip window with the new style avatar icon.
   AddNewAvatarButton();
@@ -479,75 +404,3 @@
                 delegate_->GetTabstripPreferredSize(), kWidth).ToString());
   EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString());
 }
-
-#if defined(ENABLE_SUPERVISED_USERS)
-TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithAvatarWithButtonsOnLeft) {
-  // Tests the layout of a chrome window with an avatar icon and caption buttons
-  // on the left. The avatar icon should therefore be on the right.
-  // AddAvatarLabel() also adds the avatar button.
-  AddSupervisedUserAvatarLabel();
-  std::vector<views::FrameButton> leading_buttons;
-  std::vector<views::FrameButton> trailing_buttons;
-  leading_buttons.push_back(views::FRAME_BUTTON_CLOSE);
-  leading_buttons.push_back(views::FRAME_BUTTON_MINIMIZE);
-  leading_buttons.push_back(views::FRAME_BUTTON_MAXIMIZE);
-  layout_manager_->SetButtonOrdering(leading_buttons, trailing_buttons);
-  root_view_->Layout();
-
-  EXPECT_EQ("73,1 25x18", maximize_button_->bounds().ToString());
-  EXPECT_EQ("47,1 26x18", minimize_button_->bounds().ToString());
-  EXPECT_EQ("0,0 0x0", restore_button_->bounds().ToString());
-  EXPECT_EQ("4,1 43x18", close_button_->bounds().ToString());
-
-  // Check the location of the avatar
-  EXPECT_EQ("454,11 40x29", menu_button_->bounds().ToString());
-
-  // Check the tab strip bounds.
-  gfx::Rect tab_strip_bounds = layout_manager_->GetBoundsForTabStrip(
-      delegate_->GetTabstripPreferredSize(), kWidth);
-  EXPECT_GT(tab_strip_bounds.x(), maximize_button_->bounds().x());
-  EXPECT_GT(maximize_button_->bounds().right(), tab_strip_bounds.x());
-  EXPECT_EQ(13, tab_strip_bounds.y());
-  EXPECT_EQ(29, tab_strip_bounds.height());
-  EXPECT_GT(supervised_user_avatar_label_->bounds().x(),
-            tab_strip_bounds.right());
-  EXPECT_EQ("261x73", layout_manager_->GetMinimumSize(kWidth).ToString());
-
-  // Check the relative location of the avatar label to the avatar. The right
-  // end of the avatar label should be slightly to the right of the right end of
-  // the avatar icon.
-  EXPECT_GT(supervised_user_avatar_label_->bounds().right(),
-            menu_button_->bounds().right());
-  EXPECT_GT(menu_button_->bounds().x(),
-            supervised_user_avatar_label_->bounds().x());
-  EXPECT_GT(menu_button_->bounds().bottom(),
-            supervised_user_avatar_label_->bounds().bottom());
-  EXPECT_GT(supervised_user_avatar_label_->bounds().y(),
-            menu_button_->bounds().y());
-
-  // This means that the menu will pop out facing the left (if it were to face
-  // the right, it would go outside the window frame and be clipped).
-  EXPECT_TRUE(menu_button_->button_on_right());
-
-  // If the buttons are on the left, there should be no hidden icon for the user
-  // to double click.
-  EXPECT_EQ("0,0 0x0", layout_manager_->IconBounds().ToString());
-}
-
-TEST_F(OpaqueBrowserFrameViewLayoutTest, WindowWithAvatarLabelAndButtonOnLeft) {
-  AddSupervisedUserAvatarLabel();
-  root_view_->Layout();
-
-  ExpectBasicWindowBounds();
-
-  // Check the location of the avatar label relative to the avatar button if
-  // both are displayed on the left side.
-  // The label height and width depends on the font size and the text displayed.
-  // This may possibly change, so we don't test it here.
-  EXPECT_EQ(menu_button_->bounds().x() - 2,
-            supervised_user_avatar_label_->bounds().x());
-  EXPECT_EQ(menu_button_->bounds().bottom() - 3 -
-            supervised_user_avatar_label_->bounds().height(),
-            supervised_user_avatar_label_->bounds().y());
-}
-#endif
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
index c2a5b2a5..1786e45 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -850,8 +850,9 @@
     NULL;
 
 // static
-void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents,
-                                           DisplayReason reason) {
+void ManagePasswordsBubbleView::ShowBubble(
+    content::WebContents* web_contents,
+    ManagePasswordsBubbleModel::DisplayReason reason) {
   Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
   DCHECK(browser);
   DCHECK(browser->window());
@@ -877,7 +878,7 @@
     manage_passwords_bubble_->AdjustForFullscreen(
         browser_view->GetBoundsInScreen());
   }
-  if (reason == AUTOMATIC)
+  if (reason == ManagePasswordsBubbleModel::AUTOMATIC)
     manage_passwords_bubble_->GetWidget()->ShowInactive();
   else
     manage_passwords_bubble_->GetWidget()->Show();
@@ -897,15 +898,15 @@
 }
 
 content::WebContents* ManagePasswordsBubbleView::web_contents() const {
-  return model()->web_contents();
+  return model_.web_contents();
 }
 
 ManagePasswordsBubbleView::ManagePasswordsBubbleView(
     content::WebContents* web_contents,
     ManagePasswordsIconView* anchor_view,
-    DisplayReason reason)
-    : ManagePasswordsBubble(web_contents, reason),
-      ManagedFullScreenBubbleDelegateView(anchor_view, web_contents),
+    ManagePasswordsBubbleModel::DisplayReason reason)
+    : ManagedFullScreenBubbleDelegateView(anchor_view, web_contents),
+      model_(web_contents, reason),
       anchor_view_(anchor_view),
       initially_focused_view_(NULL) {
   // Compensate for built-in vertical padding in the anchor view's image.
@@ -942,23 +943,22 @@
 }
 
 bool ManagePasswordsBubbleView::ShouldShowCloseButton() const {
-  return model()->state() == password_manager::ui::PENDING_PASSWORD_STATE;
+  return model_.state() == password_manager::ui::PENDING_PASSWORD_STATE;
 }
 
 void ManagePasswordsBubbleView::Refresh() {
   RemoveAllChildViews(true);
   initially_focused_view_ = NULL;
-  if (model()->state() == password_manager::ui::PENDING_PASSWORD_STATE) {
+  if (model_.state() == password_manager::ui::PENDING_PASSWORD_STATE) {
     AddChildView(new PendingView(this));
-  } else if (model()->state() ==
+  } else if (model_.state() ==
              password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) {
     AddChildView(new UpdatePendingView(this));
-  } else if (model()->state() == password_manager::ui::CONFIRMATION_STATE) {
+  } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) {
     AddChildView(new SaveConfirmationView(this));
-  } else if (model()->state() ==
-                 password_manager::ui::CREDENTIAL_REQUEST_STATE) {
+  } else if (model_.state() == password_manager::ui::CREDENTIAL_REQUEST_STATE) {
     AddChildView(new AccountChooserView(this));
-  } else if (model()->state() == password_manager::ui::AUTO_SIGNIN_STATE) {
+  } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) {
     AddChildView(new AutoSigninView(this));
   } else {
     AddChildView(new ManageView(this));
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
index 460bae9c..a064629 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h
@@ -5,7 +5,7 @@
 #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
 #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_BUBBLE_VIEW_H_
 
-#include "chrome/browser/ui/passwords/manage_passwords_bubble.h"
+#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
 #include "chrome/browser/ui/views/managed_full_screen_bubble_delegate_view.h"
 
 class ManagePasswordsIconView;
@@ -22,12 +22,11 @@
 // 2. ManageView: Displays the current page's saved credentials.
 // 3. BlacklistedView: Informs the user that the current page is blacklisted.
 //
-class ManagePasswordsBubbleView : public ManagePasswordsBubble,
-                                  public ManagedFullScreenBubbleDelegateView {
+class ManagePasswordsBubbleView : public ManagedFullScreenBubbleDelegateView {
  public:
   // Shows the bubble.
   static void ShowBubble(content::WebContents* web_contents,
-                         DisplayReason reason);
+                         ManagePasswordsBubbleModel::DisplayReason reason);
 
   // Closes the existing bubble.
   static void CloseBubble();
@@ -52,6 +51,8 @@
   }
 #endif
 
+  ManagePasswordsBubbleModel* model() { return &model_; }
+
  private:
   class AccountChooserView;
   class AutoSigninView;
@@ -64,7 +65,7 @@
 
   ManagePasswordsBubbleView(content::WebContents* web_contents,
                             ManagePasswordsIconView* anchor_view,
-                            DisplayReason reason);
+                            ManagePasswordsBubbleModel::DisplayReason reason);
   ~ManagePasswordsBubbleView() override;
 
   // ManagedFullScreenBubbleDelegateView:
@@ -96,6 +97,8 @@
   // The timeout in seconds for the auto sign-in toast.
   static int auto_signin_toast_timeout_;
 
+  ManagePasswordsBubbleModel model_;
+
   ManagePasswordsIconView* anchor_view_;
 
   views::View* initially_focused_view_;
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
index c7a260cc..a7bb61b 100644
--- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
+++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view_browsertest.cc
@@ -7,6 +7,7 @@
 #include "base/command_line.h"
 #include "base/metrics/histogram_samples.h"
 #include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
 #include "chrome/browser/ui/passwords/manage_passwords_test.h"
 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -78,7 +79,7 @@
   EXPECT_FALSE(IsBubbleShowing());
   ManagePasswordsBubbleView::ShowBubble(
       browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubble::USER_ACTION);
+      ManagePasswordsBubbleModel::USER_ACTION);
   EXPECT_TRUE(IsBubbleShowing());
   const ManagePasswordsBubbleView* bubble =
       ManagePasswordsBubbleView::manage_password_bubble();
@@ -91,7 +92,7 @@
   // And, just for grins, ensure that we can re-open the bubble.
   ManagePasswordsBubbleView::ShowBubble(
       browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubble::USER_ACTION);
+      ManagePasswordsBubbleModel::USER_ACTION);
   EXPECT_TRUE(ManagePasswordsBubbleView::manage_password_bubble()->
       GetFocusManager()->GetFocusedView());
   EXPECT_TRUE(IsBubbleShowing());
@@ -227,7 +228,7 @@
 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, MAYBE_CloseOnClick) {
   ManagePasswordsBubbleView::ShowBubble(
       browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubble::AUTOMATIC);
+      ManagePasswordsBubbleModel::AUTOMATIC);
   EXPECT_TRUE(IsBubbleShowing());
   EXPECT_FALSE(ManagePasswordsBubbleView::manage_password_bubble()->
       GetFocusManager()->GetFocusedView());
@@ -238,7 +239,7 @@
 IN_PROC_BROWSER_TEST_F(ManagePasswordsBubbleViewTest, CloseOnEsc) {
   ManagePasswordsBubbleView::ShowBubble(
       browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubble::AUTOMATIC);
+      ManagePasswordsBubbleModel::AUTOMATIC);
   EXPECT_TRUE(IsBubbleShowing());
   ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE,
       false, false, false, false));
@@ -256,7 +257,7 @@
   content::WebContents* web_contents =
       browser()->tab_strip_model()->GetActiveWebContents();
   ManagePasswordsBubbleView::ShowBubble(web_contents,
-                                        ManagePasswordsBubble::AUTOMATIC);
+                                        ManagePasswordsBubbleModel::AUTOMATIC);
   EXPECT_TRUE(IsBubbleShowing());
   EXPECT_FALSE(ManagePasswordsBubbleView::manage_password_bubble()->
       GetFocusManager()->GetFocusedView());
@@ -285,7 +286,7 @@
   EXPECT_FALSE(IsBubbleShowing());
   ManagePasswordsBubbleView::ShowBubble(
       browser()->tab_strip_model()->GetActiveWebContents(),
-      ManagePasswordsBubble::AUTOMATIC);
+      ManagePasswordsBubbleModel::AUTOMATIC);
   EXPECT_TRUE(IsBubbleShowing());
   TabStripModel* tab_model = browser()->tab_strip_model();
   EXPECT_EQ(0, tab_model->active_index());
diff --git a/chrome/browser/ui/views/profiles/avatar_menu_button.cc b/chrome/browser/ui/views/profiles/avatar_menu_button.cc
index 1c0aa182..30da45d23 100644
--- a/chrome/browser/ui/views/profiles/avatar_menu_button.cc
+++ b/chrome/browser/ui/views/profiles/avatar_menu_button.cc
@@ -121,24 +121,20 @@
     if (index == std::string::npos)
       return false;
 
-    if (switches::IsNewAvatarMenu()) {
-      *avatar = cache.GetAvatarIconOfProfileAtIndex(index);
-      // TODO(noms): Once the code for the old avatar menu button is removed,
-      // this function will only be called for badging the taskbar icon.  The
-      // function can be renamed to something like GetAvatarImageForBadging()
-      // and only needs to return the avatar from
-      // AvatarMenu::GetImageForMenuButton().
-#if !defined(OS_CHROMEOS)
-      bool is_badge_rectangle = false;
-      AvatarMenu::GetImageForMenuButton(profile->GetPath(),
-                                        taskbar_badge_avatar,
-                                        &is_badge_rectangle);
+#if defined(OS_CHROMEOS)
+    AvatarMenu::GetImageForMenuButton(profile->GetPath(), avatar, is_rectangle);
+#else
+    *avatar = cache.GetAvatarIconOfProfileAtIndex(index);
+    // TODO(noms): Once the code for the old avatar menu button is removed,
+    // this function will only be called for badging the taskbar icon.  The
+    // function can be renamed to something like GetAvatarImageForBadging()
+    // and only needs to return the avatar from
+    // AvatarMenu::GetImageForMenuButton().
+    bool is_badge_rectangle = false;
+    AvatarMenu::GetImageForMenuButton(profile->GetPath(),
+                                      taskbar_badge_avatar,
+                                      &is_badge_rectangle);
 #endif
-    } else {
-      AvatarMenu::GetImageForMenuButton(profile->GetPath(),
-                                        avatar,
-                                        is_rectangle);
-    }
   }
   return true;
 }
diff --git a/chrome/browser/ui/views/profiles/avatar_menu_button_browsertest.cc b/chrome/browser/ui/views/profiles/avatar_menu_button_browsertest.cc
deleted file mode 100644
index 09265e8..0000000
--- a/chrome/browser/ui/views/profiles/avatar_menu_button_browsertest.cc
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/views/profiles/avatar_menu_button.h"
-
-#include "base/command_line.h"
-#include "base/path_service.h"
-#include "base/strings/utf_string_conversions.h"
-#include "chrome/browser/profiles/profile_manager.h"
-#include "chrome/browser/profiles/profiles_state.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/browser/ui/views/frame/browser_view.h"
-#include "chrome/common/chrome_paths.h"
-#include "chrome/common/chrome_switches.h"
-#include "chrome/test/base/in_process_browser_test.h"
-#include "chrome/test/base/test_switches.h"
-#include "chrome/test/base/testing_browser_process.h"
-#include "components/signin/core/common/profile_management_switches.h"
-
-class AvatarMenuButtonTest : public InProcessBrowserTest {
- public:
-  AvatarMenuButtonTest();
-  ~AvatarMenuButtonTest() override;
-
- protected:
-  void SetUpCommandLine(base::CommandLine* command_line) override;
-  void CreateTestingProfile();
-  AvatarMenuButton* GetAvatarMenuButton();
-  void StartAvatarMenu();
-
- private:
-  DISALLOW_COPY_AND_ASSIGN(AvatarMenuButtonTest);
-};
-
-AvatarMenuButtonTest::AvatarMenuButtonTest() {
-}
-
-AvatarMenuButtonTest::~AvatarMenuButtonTest() {
-}
-
-void AvatarMenuButtonTest::SetUpCommandLine(base::CommandLine* command_line) {
-  switches::DisableNewAvatarMenuForTesting(command_line);
-}
-
-void AvatarMenuButtonTest::CreateTestingProfile() {
-  ProfileManager* profile_manager = g_browser_process->profile_manager();
-  EXPECT_EQ(1u, profile_manager->GetNumberOfProfiles());
-
-  base::FilePath path;
-  PathService::Get(chrome::DIR_USER_DATA, &path);
-  path = path.AppendASCII("test_profile");
-  if (!base::PathExists(path))
-    ASSERT_TRUE(base::CreateDirectory(path));
-  Profile* profile =
-      Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS);
-  profile_manager->RegisterTestingProfile(profile, true, false);
-  EXPECT_EQ(2u, profile_manager->GetNumberOfProfiles());
-}
-
-AvatarMenuButton* AvatarMenuButtonTest::GetAvatarMenuButton() {
-  BrowserView* browser_view = reinterpret_cast<BrowserView*>(
-      browser()->window());
-  return browser_view->frame()->GetAvatarMenuButton();
-}
diff --git a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc
index 14a3246d..b3a0199 100644
--- a/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc
+++ b/chrome/browser/ui/views/profiles/profile_chooser_view_browsertest.cc
@@ -104,7 +104,6 @@
  protected:
   void SetUp() override {
     ExtensionBrowserTest::SetUp();
-    DCHECK(switches::IsNewAvatarMenu());
     DCHECK(switches::IsNewProfileManagement());
   }
 
diff --git a/chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc b/chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc
index 53d28f6..e01845c 100644
--- a/chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc
+++ b/chrome/browser/ui/views/sync/profile_signin_confirmation_dialog_views.cc
@@ -60,8 +60,7 @@
   // bubble.
   // TODO(guohui): removes the workaround once the profile confirmation dialog
   // is fixed.
-  if (switches::IsNewAvatarMenu() && ProfileChooserView::IsShowing())
-    ProfileChooserView::Hide();
+  ProfileChooserView::Hide();
 
   ProfileSigninConfirmationDialogViews* dialog =
       new ProfileSigninConfirmationDialogViews(
diff --git a/chrome/browser/ui/views/tab_dialogs_views.cc b/chrome/browser/ui/views/tab_dialogs_views.cc
index 517764d9..d739fb0 100644
--- a/chrome/browser/ui/views/tab_dialogs_views.cc
+++ b/chrome/browser/ui/views/tab_dialogs_views.cc
@@ -4,6 +4,7 @@
 
 #include "chrome/browser/ui/views/tab_dialogs_views.h"
 
+#include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
 #include "chrome/browser/ui/views/collected_cookies_views.h"
 #include "chrome/browser/ui/views/hung_renderer_view.h"
 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
@@ -59,8 +60,8 @@
     ManagePasswordsBubbleView::CloseBubble();
   }
   ManagePasswordsBubbleView::ShowBubble(
-      web_contents_, user_action ? ManagePasswordsBubble::USER_ACTION
-                                 : ManagePasswordsBubble::AUTOMATIC);
+      web_contents_, user_action ? ManagePasswordsBubbleModel::USER_ACTION
+                                 : ManagePasswordsBubbleModel::AUTOMATIC);
 }
 
 void TabDialogsViews::HideManagePasswordsBubble() {
diff --git a/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc b/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc
index a26d04b..7a9e8b8 100644
--- a/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc
+++ b/chrome/browser/ui/views/web_contents_modal_dialog_manager_views.cc
@@ -44,7 +44,8 @@
       SingleWebContentsDialogManagerDelegate* native_delegate)
       : native_delegate_(native_delegate),
         dialog_(dialog),
-        host_(NULL) {
+        host_(NULL),
+        host_destroying_(false) {
     ManageDialog();
   }
 
@@ -92,6 +93,12 @@
 
   // SingleWebContentsDialogManager overrides
   void Show() override {
+    // The host destroying means the dialogs will be destroyed in short order.
+    // Avoid showing dialogs at this point as the necessary native window
+    // services may not be present.
+    if (host_destroying_)
+      return;
+
     views::Widget* widget = GetWidget(dialog());
 #if defined(USE_AURA)
     scoped_ptr<wm::SuspendChildWindowVisibilityAnimations> suspend;
@@ -154,6 +161,7 @@
   void OnHostDestroying() override {
     host_->RemoveObserver(this);
     host_ = NULL;
+    host_destroying_ = true;
   }
 
   // views::WidgetObserver overrides
@@ -225,6 +233,7 @@
   SingleWebContentsDialogManagerDelegate* native_delegate_;
   gfx::NativeWindow dialog_;
   WebContentsModalDialogHost* host_;
+  bool host_destroying_;
   std::set<views::Widget*> observed_widgets_;
   std::set<views::Widget*> shown_widgets_;
 
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.cc b/chrome/browser/ui/website_settings/permission_bubble_manager.cc
index 201d22f..a14e72d 100644
--- a/chrome/browser/ui/website_settings/permission_bubble_manager.cc
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager.cc
@@ -65,17 +65,6 @@
 
 DEFINE_WEB_CONTENTS_USER_DATA_KEY(PermissionBubbleManager);
 
-// static
-bool PermissionBubbleManager::Enabled() {
-#if defined(OS_ANDROID) || defined(OS_IOS)
-  return false;
-#endif
-  if (base::CommandLine::ForCurrentProcess()->HasSwitch(
-          switches::kDisablePermissionsBubbles))
-    return false;
-  return true;
-}
-
 PermissionBubbleManager::PermissionBubbleManager(
     content::WebContents* web_contents)
     : content::WebContentsObserver(web_contents),
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager.h b/chrome/browser/ui/website_settings/permission_bubble_manager.h
index 3a760e8..4aa06c69 100644
--- a/chrome/browser/ui/website_settings/permission_bubble_manager.h
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager.h
@@ -45,10 +45,6 @@
     DISMISS
   };
 
-  // Return the enabled state of permissions bubbles.
-  // Controlled by a flag and FieldTrial.
-  static bool Enabled();
-
   ~PermissionBubbleManager() override;
 
   // Adds a new request to the permission bubble. Ownership of the request
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager_browsertest.cc b/chrome/browser/ui/website_settings/permission_bubble_manager_browsertest.cc
index d5b4340..503c7dc 100644
--- a/chrome/browser/ui/website_settings/permission_bubble_manager_browsertest.cc
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager_browsertest.cc
@@ -8,7 +8,6 @@
 #include "chrome/browser/ui/browser.h"
 #include "chrome/browser/ui/tabs/tab_strip_model.h"
 #include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h"
-#include "chrome/common/chrome_switches.h"
 #include "chrome/test/base/in_process_browser_test.h"
 #include "chrome/test/base/ui_test_utils.h"
 #include "content/public/test/test_utils.h"
@@ -28,11 +27,6 @@
     InProcessBrowserTest::SetUpOnMainThread();
   }
 
-  void SetUpCommandLine(base::CommandLine* command_line) override {
-    command_line->AppendSwitch(switches::kEnablePermissionsBubbles);
-    InProcessBrowserTest::SetUpCommandLine(command_line);
-  }
-
   PermissionBubbleManager* GetPermissionBubbleManager() {
     return PermissionBubbleManager::FromWebContents(
         browser()->tab_strip_model()->GetActiveWebContents());
diff --git a/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc b/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc
index 3bd40fba..1f5b3c3e 100644
--- a/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc
+++ b/chrome/browser/ui/website_settings/permission_bubble_manager_unittest.cc
@@ -121,13 +121,6 @@
   MockView* view_() { return static_cast<MockView*>(manager_->view_.get()); }
 };
 
-TEST_F(PermissionBubbleManagerTest, TestFlag) {
-  EXPECT_TRUE(PermissionBubbleManager::Enabled());
-  base::CommandLine::ForCurrentProcess()->AppendSwitch(
-      switches::kDisablePermissionsBubbles);
-  EXPECT_FALSE(PermissionBubbleManager::Enabled());
-}
-
 TEST_F(PermissionBubbleManagerTest, SingleRequest) {
   manager_->AddRequest(&request1_);
   manager_->DisplayPendingRequests();
diff --git a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
index 06a611fa..53c542e 100644
--- a/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
+++ b/chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc
@@ -510,10 +510,8 @@
     return &NewWebUI<PopularSitesInternalsUI>;
 #endif
 #if !defined(OS_CHROMEOS) && !defined(OS_ANDROID) && !defined(OS_IOS)
-  if (url.host() == chrome::kChromeUIUserManagerHost &&
-      switches::IsNewAvatarMenu()) {
+  if (url.host() == chrome::kChromeUIUserManagerHost)
     return &NewWebUI<UserManagerUI>;
-  }
 #endif
 
   /****************************************************************************
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index a8d85dd..50b3d08 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -302,14 +302,6 @@
   CallJS("loadAuthExtension", params);
 }
 
-void GaiaScreenHandler::UpdateGaia(const GaiaContext& context) {
-  base::DictionaryValue params;
-  UpdateAuthParams(&params, context.has_users,
-                   context.is_enrolling_consumer_management,
-                   IsRestrictiveProxy());
-  CallJS("updateAuthExtension", params);
-}
-
 void GaiaScreenHandler::ReloadGaia(bool force_reload) {
   if (frame_state_ == FRAME_STATE_LOADING && !force_reload) {
     VLOG(1) << "Skipping reloading of Gaia since gaia is loading.";
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
index 87e05386..e21b6be 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h
@@ -75,12 +75,19 @@
       policy::ConsumerManagementService* consumer_management);
   ~GaiaScreenHandler() override;
 
+  // Decides whether an auth extension should be pre-loaded. If it should,
+  // pre-loads it.
+  void MaybePreloadAuthExtension();
+
+ private:
+  // TODO (antrim@): remove this dependency.
+  friend class SigninScreenHandler;
+
   void LoadGaia(const GaiaContext& context);
 
   // Callback that loads GAIA after version information has been retrieved.
   void LoadGaiaWithVersion(const GaiaContext& context,
                            const std::string& platform_version);
-  void UpdateGaia(const GaiaContext& context);
 
   // Sends request to reload Gaia. If |force_reload| is true, request
   // will be sent in any case, otherwise it will be sent only when Gaia is
@@ -91,20 +98,9 @@
   // we're using the offline login page but the device is online.
   void MonitorOfflineIdle(bool is_online);
 
-  // Decides whether an auth extension should be pre-loaded. If it should,
-  // pre-loads it.
-  void MaybePreloadAuthExtension();
-
   // Show error UI at the end of GAIA flow when user is not whitelisted.
   void ShowWhitelistCheckFailedError();
 
-  FrameState frame_state() const { return frame_state_; }
-  net::Error frame_error() const { return frame_error_; }
-
- private:
-  // TODO (antrim@): remove this dependency.
-  friend class SigninScreenHandler;
-
   // BaseScreenHandler implementation:
   void DeclareLocalizedValues(
       ::login::LocalizedValuesBuilder* builder) override;
@@ -218,6 +214,9 @@
   // Returns temporary unused device Id.
   std::string GetTemporaryDeviceId();
 
+  FrameState frame_state() const { return frame_state_; }
+  net::Error frame_error() const { return frame_error_; }
+
   // Current state of Gaia frame.
   FrameState frame_state_ = FRAME_STATE_UNKNOWN;
 
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
index 22913ca..504263f 100644
--- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc
@@ -250,7 +250,6 @@
   DCHECK(network_state_informer_.get());
   DCHECK(network_error_model_);
   DCHECK(core_oobe_actor_);
-  DCHECK(gaia_screen_handler_);
   gaia_screen_handler_->set_signin_screen_handler(this);
   network_state_informer_->AddObserver(this);
 
@@ -570,7 +569,6 @@
 
 void SigninScreenHandler::OnNetworkReady() {
   VLOG(1) << "OnNetworkReady() call.";
-  DCHECK(gaia_screen_handler_);
   gaia_screen_handler_->MaybePreloadAuthExtension();
 }
 
@@ -634,7 +632,6 @@
       break;
     case UI_STATE_ACCOUNT_PICKER:
       ui_state_ = UI_STATE_ACCOUNT_PICKER;
-      DCHECK(gaia_screen_handler_);
       gaia_screen_handler_->CancelShowGaiaAsync();
       ShowScreen(OobeUI::kScreenAccountPicker, params);
       break;
@@ -956,12 +953,10 @@
 void SigninScreenHandler::ShowSigninScreenForCreds(
     const std::string& username,
     const std::string& password) {
-  DCHECK(gaia_screen_handler_);
   gaia_screen_handler_->ShowSigninScreenForTest(username, password);
 }
 
 void SigninScreenHandler::ShowWhitelistCheckFailedError() {
-  DCHECK(gaia_screen_handler_);
   gaia_screen_handler_->ShowWhitelistCheckFailedError();
 }
 
@@ -1007,15 +1002,6 @@
          is_account_picker_showing_first_time_;
 }
 
-void SigninScreenHandler::UserSettingsChanged() {
-  DCHECK(gaia_screen_handler_);
-  GaiaContext context;
-  if (delegate_)
-    context.has_users = !delegate_->GetUsers().empty();
-  gaia_screen_handler_->UpdateGaia(context);
-  UpdateAddButtonStatus();
-}
-
 void SigninScreenHandler::UpdateAddButtonStatus() {
   CallJS("cr.ui.login.DisplayManager.updateAddUserButtonStatus",
          AllWhitelistedUsersPresent());
@@ -1443,12 +1429,10 @@
 
 void SigninScreenHandler::OnShowAddUser() {
   is_account_picker_showing_first_time_ = false;
-  DCHECK(gaia_screen_handler_);
   gaia_screen_handler_->ShowGaiaAsync(is_enrolling_consumer_management_);
 }
 
 net::Error SigninScreenHandler::FrameError() const {
-  DCHECK(gaia_screen_handler_);
   return gaia_screen_handler_->frame_error();
 }
 
diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
index 3799ab2..ae57985 100644
--- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
+++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h
@@ -316,9 +316,6 @@
   void OnMaximizeModeStarted() override;
   void OnMaximizeModeEnded() override;
 
-  // Updates authentication extension. Called when device settings that affect
-  // sign-in (allow BWSI and allow whitelist) are changed.
-  void UserSettingsChanged();
   void UpdateAddButtonStatus();
 
   // Restore input focus to current user pod.
diff --git a/chrome/browser/ui/webui/downloads_ui.cc b/chrome/browser/ui/webui/downloads_ui.cc
index e69ed4f8..23abd9cb 100644
--- a/chrome/browser/ui/webui/downloads_ui.cc
+++ b/chrome/browser/ui/webui/downloads_ui.cc
@@ -102,10 +102,20 @@
     source->AddLocalizedString("noDownloads", IDS_MD_DOWNLOAD_NO_DOWNLOADS);
     source->AddLocalizedString("search", IDS_MD_DOWNLOAD_SEARCH);
 
+    source->AddResourcePath("1x/incognito_marker.png",
+                            IDR_MD_DOWNLOADS_1X_INCOGNITO_MARKER_PNG);
+    source->AddResourcePath("2x/incognito_marker.png",
+                            IDR_MD_DOWNLOADS_2X_INCOGNITO_MARKER_PNG);
+    source->AddResourcePath("1x/no_downloads.png",
+                            IDR_MD_DOWNLOADS_1X_NO_DOWNLOADS_PNG);
+    source->AddResourcePath("2x/no_downloads.png",
+                            IDR_MD_DOWNLOADS_2X_NO_DOWNLOADS_PNG);
     source->AddResourcePath("action_service.html",
                             IDR_MD_DOWNLOADS_ACTION_SERVICE_HTML);
     source->AddResourcePath("action_service.js",
                             IDR_MD_DOWNLOADS_ACTION_SERVICE_JS);
+    source->AddResourcePath("crisper.js", IDR_MD_DOWNLOADS_CRISPER_JS);
+    source->AddResourcePath("dev.html", IDR_MD_DOWNLOADS_DOWNLOADS_HTML);
     source->AddResourcePath("focus_row.html", IDR_MD_DOWNLOADS_FOCUS_ROW_HTML);
     source->AddResourcePath("focus_row.js", IDR_MD_DOWNLOADS_FOCUS_ROW_JS);
     source->AddResourcePath("item.css", IDR_MD_DOWNLOADS_ITEM_CSS);
@@ -120,7 +130,7 @@
     source->AddResourcePath("toolbar.css", IDR_MD_DOWNLOADS_TOOLBAR_CSS);
     source->AddResourcePath("toolbar.html", IDR_MD_DOWNLOADS_TOOLBAR_HTML);
     source->AddResourcePath("toolbar.js", IDR_MD_DOWNLOADS_TOOLBAR_JS);
-    source->SetDefaultResource(IDR_MD_DOWNLOADS_DOWNLOADS_HTML);
+    source->SetDefaultResource(IDR_MD_DOWNLOADS_VULCANIZED_HTML);
   } else {
     source->AddLocalizedString("controlRetry", IDS_DOWNLOAD_LINK_RETRY);
     source->AddLocalizedString("controlByExtension",
diff --git a/chrome/browser/ui/webui/downloads_util.cc b/chrome/browser/ui/webui/downloads_util.cc
index 914fbda..404cc80e 100644
--- a/chrome/browser/ui/webui/downloads_util.cc
+++ b/chrome/browser/ui/webui/downloads_util.cc
@@ -5,25 +5,26 @@
 #include "chrome/browser/ui/webui/downloads_util.h"
 
 #include "base/command_line.h"
+#include "base/metrics/field_trial.h"
+#include "base/strings/string_util.h"
 #include "chrome/common/channel_info.h"
 #include "chrome/common/chrome_switches.h"
 #include "components/version_info/version_info.h"
 
-bool MdDownloadsEnabled() {
-  base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+const char kMaterialDesignDownloadsFinchTrialName[] = "MaterialDesignDownloads";
 
+bool MdDownloadsEnabled() {
+  // Intentionally call this before checking command line to assign a group.
+  std::string group = base::FieldTrialList::FindFullName(
+      kMaterialDesignDownloadsFinchTrialName);
+
+  base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
   if (cl->HasSwitch(switches::kEnableMaterialDesignDownloads))
     return true;
 
   if (cl->HasSwitch(switches::kDisableMaterialDesignDownloads))
     return false;
 
-  switch (chrome::GetChannel()) {
-    case version_info::Channel::DEV:
-    case version_info::Channel::CANARY:
-    case version_info::Channel::UNKNOWN:
-      return true;
-    default:
-      return false;
-  }
+  return base::StartsWith(group, "Enabled",
+                          base::CompareCase::INSENSITIVE_ASCII);
 }
diff --git a/chrome/browser/ui/webui/downloads_util.h b/chrome/browser/ui/webui/downloads_util.h
index f89bc096..69774605 100644
--- a/chrome/browser/ui/webui/downloads_util.h
+++ b/chrome/browser/ui/webui/downloads_util.h
@@ -5,6 +5,8 @@
 #ifndef CHROME_BROWSER_UI_WEBUI_DOWNLOADS_UTIL_H_
 #define CHROME_BROWSER_UI_WEBUI_DOWNLOADS_UTIL_H_
 
+extern const char kMaterialDesignDownloadsFinchTrialName[];
+
 // Whether the Material Design version of chrome://downloads should be enabled.
 bool MdDownloadsEnabled();
 
diff --git a/chrome/browser/ui/webui/downloads_util_unittest.cc b/chrome/browser/ui/webui/downloads_util_unittest.cc
new file mode 100644
index 0000000..378ded5
--- /dev/null
+++ b/chrome/browser/ui/webui/downloads_util_unittest.cc
@@ -0,0 +1,69 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/webui/downloads_util.h"
+
+#include "base/command_line.h"
+#include "base/macros.h"
+#include "base/metrics/field_trial.h"
+#include "base/test/mock_entropy_provider.h"
+#include "chrome/common/chrome_switches.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using base::FieldTrialList;
+
+const char* kFieldTrialName = kMaterialDesignDownloadsFinchTrialName;
+
+class MdDownloadsEnabledTest : public testing::Test {
+ public:
+  MdDownloadsEnabledTest() : field_trial_list_(new base::MockEntropyProvider) {}
+  ~MdDownloadsEnabledTest() override {}
+
+ private:
+  base::FieldTrialList field_trial_list_;
+};
+
+TEST_F(MdDownloadsEnabledTest, DisabledByDefault) {
+  base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+  ASSERT_FALSE(cl->HasSwitch(switches::kDisableMaterialDesignDownloads));
+  ASSERT_FALSE(cl->HasSwitch(switches::kEnableMaterialDesignDownloads));
+  ASSERT_FALSE(base::FieldTrialList::TrialExists(kFieldTrialName));
+  EXPECT_FALSE(MdDownloadsEnabled());
+}
+
+TEST_F(MdDownloadsEnabledTest, EnabledByFieldTrial) {
+  ASSERT_TRUE(FieldTrialList::CreateFieldTrial(kFieldTrialName, "Enabled2"));
+  EXPECT_TRUE(MdDownloadsEnabled());
+}
+
+TEST_F(MdDownloadsEnabledTest, DisabledByFieldTrial) {
+  ASSERT_TRUE(FieldTrialList::CreateFieldTrial(kFieldTrialName, "Disabled2"));
+  EXPECT_FALSE(MdDownloadsEnabled());
+}
+
+TEST_F(MdDownloadsEnabledTest, EnabledBySwitch) {
+  base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+  cl->AppendSwitch(switches::kEnableMaterialDesignDownloads);
+  EXPECT_TRUE(MdDownloadsEnabled());
+}
+
+TEST_F(MdDownloadsEnabledTest, DisabledBySwitch) {
+  base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+  cl->AppendSwitch(switches::kDisableMaterialDesignDownloads);
+  EXPECT_FALSE(MdDownloadsEnabled());
+}
+
+TEST_F(MdDownloadsEnabledTest, SwitchOverridesFieldTrial1) {
+  ASSERT_TRUE(FieldTrialList::CreateFieldTrial(kFieldTrialName, "Disabled2"));
+  base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+  cl->AppendSwitch(switches::kEnableMaterialDesignDownloads);
+  EXPECT_TRUE(MdDownloadsEnabled());
+}
+
+TEST_F(MdDownloadsEnabledTest, SwitchOverridesFieldTrial2) {
+  ASSERT_TRUE(FieldTrialList::CreateFieldTrial(kFieldTrialName, "Enabled2"));
+  base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
+  cl->AppendSwitch(switches::kDisableMaterialDesignDownloads);
+  EXPECT_FALSE(MdDownloadsEnabled());
+}
diff --git a/chrome/browser/ui/webui/options/advanced_options_utils_linux.cc b/chrome/browser/ui/webui/options/advanced_options_utils_linux.cc
index a05845b..e509a130 100644
--- a/chrome/browser/ui/webui/options/advanced_options_utils_linux.cc
+++ b/chrome/browser/ui/webui/options/advanced_options_utils_linux.cc
@@ -34,9 +34,10 @@
 // has this but it doesn't do the same thing. See below where we use it.
 const char* kGNOME3ProxyConfigCommand[] = {"gnome-control-center", "network",
                                            NULL};
-// KDE3 and KDE4 are only slightly different, but incompatible. Go figure.
+// KDE3, 4, and 5 are only slightly different, but incompatible. Go figure.
 const char* kKDE3ProxyConfigCommand[] = {"kcmshell", "proxy", NULL};
 const char* kKDE4ProxyConfigCommand[] = {"kcmshell4", "proxy", NULL};
+const char* kKDE5ProxyConfigCommand[] = {"kcmshell5", "proxy", NULL};
 
 // The URL for Linux proxy configuration help when not running under a
 // supported desktop environment.
@@ -136,6 +137,10 @@
       launched = StartProxyConfigUtil(kKDE4ProxyConfigCommand);
       break;
 
+    case base::nix::DESKTOP_ENVIRONMENT_KDE5:
+      launched = StartProxyConfigUtil(kKDE5ProxyConfigCommand);
+      break;
+
     case base::nix::DESKTOP_ENVIRONMENT_XFCE:
     case base::nix::DESKTOP_ENVIRONMENT_OTHER:
       break;
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index aceef52..4cc2664e 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -666,14 +666,15 @@
 
   RegisterTitle(values, "thirdPartyImeConfirmOverlay",
                 IDS_OPTIONS_SETTINGS_LANGUAGES_THIRD_PARTY_WARNING_TITLE);
+  values->SetBoolean("usingNewProfilesUI", false);
+#else
+  values->SetBoolean("usingNewProfilesUI", true);
 #endif
 
   values->SetBoolean("showSetDefault", ShouldShowSetDefaultBrowser());
 
   values->SetBoolean("allowAdvancedSettings", ShouldAllowAdvancedSettings());
 
-  values->SetBoolean("usingNewProfilesUI", switches::IsNewAvatarMenu());
-
 #if defined(OS_CHROMEOS)
   values->SetBoolean(
       "showWakeOnWifi",
diff --git a/chrome/browser/ui/webui/options/manage_profile_handler.cc b/chrome/browser/ui/webui/options/manage_profile_handler.cc
index 056c20c..04754bb 100644
--- a/chrome/browser/ui/webui/options/manage_profile_handler.cc
+++ b/chrome/browser/ui/webui/options/manage_profile_handler.cc
@@ -131,8 +131,6 @@
                                supervised_user_dashboard_url,
                                supervised_user_dashboard_display));
 
-  localized_strings->SetBoolean("newAvatarMenuEnabled",
-                                switches::IsNewAvatarMenu());
   localized_strings->SetBoolean("profileShortcutsEnabled",
                                 ProfileShortcutManager::IsFeatureEnabled());
 
diff --git a/chrome/browser/ui/webui/options/sync_setup_handler.cc b/chrome/browser/ui/webui/options/sync_setup_handler.cc
index 8c637c6..5c9a6179 100644
--- a/chrome/browser/ui/webui/options/sync_setup_handler.cc
+++ b/chrome/browser/ui/webui/options/sync_setup_handler.cc
@@ -368,7 +368,7 @@
     SigninErrorController* error_controller =
         SigninErrorControllerFactory::GetForProfile(browser->profile());
     DCHECK(error_controller->HasError());
-    if (switches::IsNewAvatarMenu() && !force_new_tab) {
+    if (!force_new_tab) {
       browser->window()->ShowAvatarBubbleFromAvatarButton(
           BrowserWindow::AVATAR_BUBBLE_MODE_REAUTH,
           signin::ManageAccountsParams());
@@ -378,7 +378,7 @@
     }
   } else {
     signin_metrics::LogSigninSource(signin_metrics::SOURCE_SETTINGS);
-    if (switches::IsNewAvatarMenu() && !force_new_tab) {
+    if (!force_new_tab) {
       browser->window()->ShowAvatarBubbleFromAvatarButton(
           BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN,
           signin::ManageAccountsParams());
diff --git a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
index 5a7b0bb9..83b5eab 100644
--- a/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
+++ b/chrome/browser/ui/webui/signin/inline_login_handler_impl.cc
@@ -356,9 +356,8 @@
     SigninErrorController* error_controller =
         SigninErrorControllerFactory::GetForProfile(profile_);
 
-    bool is_new_avatar_menu = switches::IsNewAvatarMenu();
-
-    OneClickSigninSyncStarter::StartSyncMode start_mode;
+    OneClickSigninSyncStarter::StartSyncMode start_mode =
+        OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST;
     if (source == signin_metrics::SOURCE_SETTINGS || choose_what_to_sync_) {
       bool show_settings_without_configure =
           error_controller->HasError() &&
@@ -367,25 +366,12 @@
       start_mode = show_settings_without_configure ?
           OneClickSigninSyncStarter::SHOW_SETTINGS_WITHOUT_CONFIGURE :
           OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST;
-    } else {
-      start_mode = is_new_avatar_menu ?
-          OneClickSigninSyncStarter::CONFIRM_SYNC_SETTINGS_FIRST :
-          OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS;
     }
 
-    OneClickSigninSyncStarter::ConfirmationRequired confirmation_required;
-    if (confirm_untrusted_signin_) {
-      confirmation_required =
-          OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN;
-    } else if (is_new_avatar_menu) {
-      confirmation_required = OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
-    } else {
-      confirmation_required =
-          source == signin_metrics::SOURCE_SETTINGS ||
-          choose_what_to_sync_ ?
-              OneClickSigninSyncStarter::NO_CONFIRMATION :
-              OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
-    }
+    OneClickSigninSyncStarter::ConfirmationRequired confirmation_required =
+        confirm_untrusted_signin_ ?
+            OneClickSigninSyncStarter::CONFIRM_UNTRUSTED_SIGNIN :
+            OneClickSigninSyncStarter::CONFIRM_AFTER_SIGNIN;
 
     bool start_signin = !HandleCrossAccountError(result.refresh_token, source,
         confirmation_required, start_mode);
diff --git a/chrome/browser/ui/webui/signin/login_ui_service.cc b/chrome/browser/ui/webui/signin/login_ui_service.cc
index 2a63883..cc1681d 100644
--- a/chrome/browser/ui/webui/signin/login_ui_service.cc
+++ b/chrome/browser/ui/webui/signin/login_ui_service.cc
@@ -74,24 +74,15 @@
 
 void LoginUIService::DisplayLoginResult(Browser* browser,
                                         const base::string16& message) {
-  last_login_result_ = message;
-  if (switches::IsNewAvatarMenu()) {
-    browser->window()->ShowAvatarBubbleFromAvatarButton(
-        message.empty() ? BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN :
-                          BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR,
-        signin::ManageAccountsParams());
-  } else {
-#if defined(ENABLE_ONE_CLICK_SIGNIN)
-    browser->window()->ShowOneClickSigninBubble(
-        BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE,
-        base::string16(), /* no SAML email */
-        message,
-        // This callback is never invoked.
-        // TODO(rogerta): Separate out the bubble API so we don't have to pass
-        // ignored |email| and |callback| params.
-        BrowserWindow::StartSyncCallback());
+#if defined(OS_CHROMEOS)
+  // ChromeOS doesn't have the avatar bubble so it never calls this function.
+  NOTREACHED();
 #endif
-  }
+  last_login_result_ = message;
+  browser->window()->ShowAvatarBubbleFromAvatarButton(
+      message.empty() ? BrowserWindow::AVATAR_BUBBLE_MODE_CONFIRM_SIGNIN :
+                        BrowserWindow::AVATAR_BUBBLE_MODE_SHOW_ERROR,
+      signin::ManageAccountsParams());
 }
 
 const base::string16& LoginUIService::GetLastLoginResult() {
diff --git a/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc b/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc
index f7c6482..f46c3e4 100644
--- a/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc
+++ b/chrome/browser/ui/webui/signin/user_manager_ui_browsertest.cc
@@ -26,16 +26,6 @@
                                  public testing::WithParamInterface<bool> {
  public:
   UserManagerUIBrowserTest() {}
-
- protected:
-  void SetUp() override {
-    InProcessBrowserTest::SetUp();
-    DCHECK(switches::IsNewAvatarMenu());
-  }
-
-  void SetUpCommandLine(base::CommandLine* command_line) override {
-    switches::EnableNewAvatarMenuForTesting(command_line);
-  }
 };
 
 IN_PROC_BROWSER_TEST_F(UserManagerUIBrowserTest, PageLoads) {
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 2941ddca..05d1720d 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -405,8 +405,6 @@
       'browser/custom_handlers/protocol_handler_registry.h',
       'browser/custom_handlers/protocol_handler_registry_factory.cc',
       'browser/custom_handlers/protocol_handler_registry_factory.h',
-      'browser/custom_handlers/register_protocol_handler_infobar_delegate.cc',
-      'browser/custom_handlers/register_protocol_handler_infobar_delegate.h',
       'browser/defaults.cc',
       'browser/defaults.h',
       'browser/dom_distiller/dom_distiller_service_factory.cc',
@@ -438,8 +436,6 @@
       'browser/download/download_item_model.h',
       'browser/download/download_path_reservation_tracker.cc',
       'browser/download/download_path_reservation_tracker.h',
-      'browser/download/download_permission_request.cc',
-      'browser/download/download_permission_request.h',
       'browser/download/download_prefs.cc',
       'browser/download/download_prefs.h',
       'browser/download/download_query.cc',
@@ -487,8 +483,6 @@
       'browser/fullscreen_win.cc',
       'browser/geolocation/chrome_access_token_store.cc',
       'browser/geolocation/chrome_access_token_store.h',
-      'browser/geolocation/geolocation_infobar_delegate.cc',
-      'browser/geolocation/geolocation_infobar_delegate.h',
       'browser/geolocation/geolocation_permission_context.cc',
       'browser/geolocation/geolocation_permission_context.h',
       'browser/geolocation/geolocation_permission_context_android.cc',
@@ -621,8 +615,6 @@
       'browser/media/media_stream_device_permissions.h',
       'browser/media/media_stream_devices_controller.cc',
       'browser/media/media_stream_devices_controller.h',
-      'browser/media/media_stream_infobar_delegate.cc',
-      'browser/media/media_stream_infobar_delegate.h',
       'browser/media/media_stream_mic_permission_context_factory.cc',
       'browser/media/media_stream_mic_permission_context_factory.h',
       'browser/media/media_url_constants.cc',
@@ -631,8 +623,6 @@
       'browser/media/midi_permission_context.h',
       'browser/media/midi_permission_context_factory.cc',
       'browser/media/midi_permission_context_factory.h',
-      'browser/media/midi_permission_infobar_delegate.cc',
-      'browser/media/midi_permission_infobar_delegate.h',
       'browser/media/native_desktop_media_list.cc',
       'browser/media/native_desktop_media_list.h',
       'browser/media/permission_bubble_media_access_handler.cc',
@@ -802,8 +792,6 @@
       'browser/storage/durable_storage_permission_context.h',
       'browser/storage/durable_storage_permission_context_factory.cc',
       'browser/storage/durable_storage_permission_context_factory.h',
-      'browser/storage/durable_storage_permission_infobar_delegate.cc',
-      'browser/storage/durable_storage_permission_infobar_delegate.h',
       'browser/tab_contents/navigation_metrics_recorder.cc',
       'browser/tab_contents/navigation_metrics_recorder.h',
       'browser/tab_contents/retargeting_details.h',
@@ -853,6 +841,12 @@
     'chrome_browser_android_sources': [
       'browser/download/download_request_infobar_delegate.cc',
       'browser/download/download_request_infobar_delegate.h',
+      'browser/geolocation/geolocation_infobar_delegate.cc',
+      'browser/geolocation/geolocation_infobar_delegate.h',
+      'browser/media/media_stream_infobar_delegate.cc',
+      'browser/media/media_stream_infobar_delegate.h',
+      'browser/media/midi_permission_infobar_delegate.cc',
+      'browser/media/midi_permission_infobar_delegate.h',
       'browser/media/protected_media_identifier_infobar_delegate.cc',
       'browser/media/protected_media_identifier_infobar_delegate.h',
       'browser/media/protected_media_identifier_permission_context.cc',
@@ -867,11 +861,15 @@
       'browser/password_manager/credential_android.h',
       'browser/password_manager/generated_password_saved_infobar_delegate_android.cc',
       'browser/password_manager/generated_password_saved_infobar_delegate_android.h',
+      'browser/permissions/permission_queue_controller.cc',
+      'browser/permissions/permission_queue_controller.h',
       'browser/precache/precache_manager_factory.cc',
       'browser/precache/precache_manager_factory.h',
       'browser/signin/oauth2_token_service_delegate_android.cc',
       'browser/signin/oauth2_token_service_delegate_android.h',
       'browser/ssl/ssl_add_certificate_android.cc',
+      'browser/storage/durable_storage_permission_infobar_delegate.cc',
+      'browser/storage/durable_storage_permission_infobar_delegate.h',
     ],
     # Cross-platform Ash sources.
     'chrome_browser_ash_sources': [
@@ -902,8 +900,6 @@
       'browser/download/notification/download_notification.h',
       'browser/download/notification/download_notification_manager.cc',
       'browser/download/notification/download_notification_manager.h',
-      'browser/media/protected_media_identifier_infobar_delegate.cc',
-      'browser/media/protected_media_identifier_infobar_delegate.h',
       'browser/media/protected_media_identifier_permission_context.cc',
       'browser/media/protected_media_identifier_permission_context.h',
       'browser/media/protected_media_identifier_permission_context_factory.cc',
@@ -1036,6 +1032,8 @@
       'browser/download/download_crx_util.h',
       'browser/download/download_danger_prompt.cc',
       'browser/download/download_danger_prompt.h',
+      'browser/download/download_permission_request.cc',
+      'browser/download/download_permission_request.h',
       'browser/download/download_shelf.cc',
       'browser/download/download_shelf.h',
       'browser/download/download_shelf_context_menu.cc',
@@ -1195,6 +1193,8 @@
       'browser/net/utility_process_mojo_proxy_resolver_factory.h',
       'browser/pdf/pdf_extension_util.cc',
       'browser/pdf/pdf_extension_util.h',
+      'browser/permissions/permission_bubble_request_impl.cc',
+      'browser/permissions/permission_bubble_request_impl.h',
       'browser/power/process_power_collector.cc',
       'browser/power/process_power_collector.h',
       'browser/process_singleton_modal_dialog_lock.cc',
@@ -1981,8 +1981,6 @@
       'browser/notifications/notification_permission_context.h',
       'browser/notifications/notification_permission_context_factory.cc',
       'browser/notifications/notification_permission_context_factory.h',
-      'browser/notifications/notification_permission_infobar_delegate.cc',
-      'browser/notifications/notification_permission_infobar_delegate.h',
       'browser/notifications/notification_ui_manager.h',
       'browser/notifications/notification_ui_manager_android.cc',
       'browser/notifications/notification_ui_manager_android.h',
@@ -1999,6 +1997,11 @@
       'browser/push_messaging/push_messaging_notification_manager.cc',
       'browser/push_messaging/push_messaging_notification_manager.h',
     ],
+    # Used on Android when notifications are enabled.
+    'chrome_browser_notifications_android_sources': [
+      'browser/notifications/notification_permission_infobar_delegate.cc',
+      'browser/notifications/notification_permission_infobar_delegate.h',
+    ],
     # Used on non-Android platforms when notifications are enabled.
     'chrome_browser_notifications_non_android_sources': [
       'browser/notifications/extension_welcome_notification.cc',
@@ -2064,8 +2067,6 @@
       'browser/password_manager/password_manager_infobar_delegate.h'
     ],
     'chrome_browser_permissions_sources': [
-      'browser/permissions/permission_bubble_request_impl.cc',
-      'browser/permissions/permission_bubble_request_impl.h',
       'browser/permissions/permission_context.cc',
       'browser/permissions/permission_context.h',
       'browser/permissions/permission_context_base.cc',
@@ -2080,8 +2081,6 @@
       'browser/permissions/permission_manager.h',
       'browser/permissions/permission_manager_factory.cc',
       'browser/permissions/permission_manager_factory.h',
-      'browser/permissions/permission_queue_controller.cc',
-      'browser/permissions/permission_queue_controller.h',
       'browser/permissions/permission_request_id.cc',
       'browser/permissions/permission_request_id.h',
       'browser/permissions/permission_update_infobar_delegate_android.cc',
@@ -3250,6 +3249,7 @@
             '../components/components.gyp:web_modal',
             '../components/components.gyp:web_resource',
             '../content/app/resources/content_resources.gyp:content_resources',
+            '../device/devices_app/devices_app.gyp:device_usb_mojo_bindings_lib',
             '../gpu/gpu.gyp:gpu',
             '../media/media.gyp:media',
             '../media/midi/midi.gyp:midi',
@@ -3598,6 +3598,10 @@
               'sources': [
                 '<@(chrome_browser_notifications_non_android_sources)',
               ],
+            }, {
+              'sources': [
+                '<@(chrome_browser_notifications_android_sources)',
+              ],
             }],
           ],
         }],
diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi
index beabe48b..2a77c15 100644
--- a/chrome/chrome_browser_ui.gypi
+++ b/chrome/chrome_browser_ui.gypi
@@ -172,12 +172,6 @@
       'browser/ui/passwords/account_avatar_fetcher.h',
       'browser/ui/passwords/account_chooser_more_combobox_model.cc',
       'browser/ui/passwords/account_chooser_more_combobox_model.h',
-      'browser/ui/passwords/manage_passwords_bubble.cc',
-      'browser/ui/passwords/manage_passwords_bubble.h',
-      'browser/ui/passwords/manage_passwords_bubble_model.cc',
-      'browser/ui/passwords/manage_passwords_bubble_model.h',
-      'browser/ui/passwords/manage_passwords_icon.cc',
-      'browser/ui/passwords/manage_passwords_icon.h',
       'browser/ui/passwords/manage_passwords_state.cc',
       'browser/ui/passwords/manage_passwords_state.h',
       'browser/ui/passwords/manage_passwords_ui_controller.cc',
@@ -259,11 +253,8 @@
       'browser/ui/views/platform_keys_certificate_selector_chromeos.cc',
       'browser/ui/views/platform_keys_certificate_selector_chromeos.h',
       'browser/ui/web_contents_sizer.h',
-      'browser/ui/website_settings/permission_bubble_manager.cc',
-      'browser/ui/website_settings/permission_bubble_manager.h',
       'browser/ui/website_settings/permission_bubble_request.cc',
       'browser/ui/website_settings/permission_bubble_request.h',
-      'browser/ui/website_settings/permission_bubble_view.h',
       'browser/ui/website_settings/website_settings.cc',
       'browser/ui/website_settings/website_settings.h',
       'browser/ui/website_settings/website_settings_ui.cc',
@@ -1620,6 +1611,10 @@
       'browser/ui/panels/stacked_panel_collection.h',
       'browser/ui/panels/stacked_panel_drag_handler.cc',
       'browser/ui/panels/stacked_panel_drag_handler.h',
+      'browser/ui/passwords/manage_passwords_bubble_model.cc',
+      'browser/ui/passwords/manage_passwords_bubble_model.h',
+      'browser/ui/passwords/manage_passwords_icon.cc',
+      'browser/ui/passwords/manage_passwords_icon.h',
       'browser/ui/passwords/manage_passwords_view_utils_desktop.cc',
       'browser/ui/passwords/manage_passwords_view_utils_desktop.h',
       'browser/ui/pdf/adobe_reader_info_win.cc',
@@ -1736,6 +1731,9 @@
       'browser/ui/unload_controller.h',
       'browser/ui/user_manager.cc',
       'browser/ui/user_manager.h',
+      'browser/ui/website_settings/permission_bubble_manager.cc',
+      'browser/ui/website_settings/permission_bubble_manager.h',
+      'browser/ui/website_settings/permission_bubble_view.h',
       'browser/ui/website_settings/permission_menu_model.cc',
       'browser/ui/website_settings/permission_menu_model.h',
       'browser/ui/website_settings/website_settings_infobar_delegate.cc',
diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi
index d063931..8eff757 100644
--- a/chrome/chrome_tests.gypi
+++ b/chrome/chrome_tests.gypi
@@ -652,7 +652,6 @@
       'browser/ui/views/location_bar/zoom_bubble_view_browsertest.cc',
       'browser/ui/views/media_router/media_router_ui_browsertest.cc',
       'browser/ui/views/new_task_manager_view_browsertest.cc',
-      'browser/ui/views/profiles/avatar_menu_button_browsertest.cc',
       'browser/ui/views/toolbar/browser_actions_container_browsertest.cc',
       'browser/ui/views/toolbar/toolbar_view_browsertest.cc',
       'browser/ui/views/translate/translate_bubble_view_browsertest.cc',
@@ -2167,7 +2166,7 @@
         },
       },
       'conditions': [
-        ['chromeos==1 and use_openssl==1', {
+        ['chromeos==1', {
           'dependencies': [
             '../third_party/boringssl/boringssl.gyp:boringssl',
           ]
diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi
index 932a4c80..5c08ca13 100644
--- a/chrome/chrome_tests_unit.gypi
+++ b/chrome/chrome_tests_unit.gypi
@@ -163,7 +163,6 @@
       'browser/password_manager/simple_password_store_mac_unittest.cc',
       'browser/permissions/permission_context_base_unittest.cc',
       'browser/permissions/permission_manager_unittest.cc',
-      'browser/permissions/permission_queue_controller_unittest.cc',
       'browser/predictors/autocomplete_action_predictor_table_unittest.cc',
       'browser/predictors/autocomplete_action_predictor_unittest.cc',
       'browser/predictors/resource_prefetch_common_unittest.cc',
@@ -326,7 +325,6 @@
       'browser/ui/cocoa/bookmarks/bookmark_menu_cocoa_controller_unittest.mm',
       'browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa_unittest.mm',
       'browser/ui/cocoa/bookmarks/bookmark_name_folder_controller_unittest.mm',
-      'browser/ui/cocoa/bookmarks/bookmark_sync_promo_controller_unittest.mm',
       'browser/ui/cocoa/bookmarks/bookmark_tree_browser_cell_unittest.mm',
       'browser/ui/cocoa/browser/edit_search_engine_cocoa_controller_unittest.mm',
       'browser/ui/cocoa/browser/zoom_bubble_controller_unittest.mm',
@@ -469,8 +467,6 @@
       'browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm',
       'browser/ui/find_bar/find_backend_unittest.cc',
       'browser/ui/login/login_prompt_unittest.cc',
-      'browser/ui/passwords/manage_passwords_bubble_model_unittest.cc',
-      'browser/ui/passwords/manage_passwords_icon_mock.cc',
       'browser/ui/passwords/manage_passwords_state_unittest.cc',
       'browser/ui/passwords/manage_passwords_ui_controller_unittest.cc',
       'browser/ui/passwords/manage_passwords_view_utils_unittest.cc',
@@ -481,8 +477,6 @@
       'browser/ui/sync/sync_promo_ui_unittest.cc',
       'browser/ui/tests/ui_gfx_image_unittest.cc',
       'browser/ui/tests/ui_gfx_image_unittest.mm',
-      'browser/ui/website_settings/mock_permission_bubble_view.cc',
-      'browser/ui/website_settings/mock_permission_bubble_view.h',
       'browser/ui/website_settings/website_settings_unittest.cc',
       'browser/ui/webui/fileicon_source_unittest.cc',
       'browser/ui/webui/history_ui_unittest.cc',
@@ -555,6 +549,13 @@
     'chrome_unit_tests_mac_android_sources': [
       'browser/password_manager/save_password_infobar_delegate_unittest.cc',
     ],
+    'chrome_unit_tests_android_sources': [
+      'browser/permissions/permission_queue_controller_unittest.cc',
+    ],
+    'chrome_unit_tests_non_mobile_sources': [
+      'browser/ui/website_settings/mock_permission_bubble_view.cc',
+      'browser/ui/website_settings/mock_permission_bubble_view.h',
+    ],
     'chrome_unit_tests_spellchecker_sources': [
       'browser/spellchecker/feedback_sender_unittest.cc',
       'browser/spellchecker/feedback_unittest.cc',
@@ -1537,6 +1538,9 @@
       'browser/ui/omnibox/omnibox_controller_unittest.cc',
       'browser/ui/omnibox/omnibox_edit_unittest.cc',
       'browser/ui/panels/panel_mouse_watcher_unittest.cc',
+      'browser/ui/passwords/manage_passwords_bubble_model_unittest.cc',
+      'browser/ui/passwords/manage_passwords_icon_mock.cc',
+      'browser/ui/passwords/manage_passwords_icon_mock.h',
       'browser/ui/passwords/manage_passwords_view_utils_desktop_unittest.cc',
       'browser/ui/search/instant_page_unittest.cc',
       'browser/ui/search/instant_search_prerenderer_unittest.cc',
@@ -1574,6 +1578,7 @@
       'browser/ui/toolbar/wrench_menu_model_unittest.cc',
       'browser/ui/website_settings/permission_bubble_manager_unittest.cc',
       'browser/ui/website_settings/permission_menu_model_unittest.cc',
+      'browser/ui/webui/downloads_util_unittest.cc',
       'browser/ui/webui/help/version_updater_chromeos_unittest.cc',
       'browser/ui/webui/ntp/ntp_user_data_logger_unittest.cc',
       'browser/ui/webui/options/autofill_options_handler_unittest.cc',
@@ -1895,6 +1900,12 @@
             ['include', '^test/base/testing_browser_process'],
           ],
         }],
+        ['OS=="ios" or OS=="android"', {
+          'sources!': [
+            'browser/ui/website_settings/mock_permission_bubble_request.cc',
+            'browser/ui/website_settings/mock_permission_bubble_request.h',
+          ]
+        }],
         ['OS=="android"', {
           'sources!': [
             'browser/password_manager/password_manager_test_base.cc',
@@ -2281,6 +2292,9 @@
           'includes': ['chrome_ios_bundle_resources.gypi'],
           'xcode_settings': {'OTHER_LDFLAGS': ['-ObjC']},
         }],
+        ['OS!="android" and OS!="ios"', {
+          'sources': [ '<@(chrome_unit_tests_non_mobile_sources)' ],
+        }],
         ['chromeos==1', {
           'sources!': [
             'browser/metrics/signin_status_metrics_provider_unittest.cc',
@@ -2557,6 +2571,9 @@
         ['OS=="mac" or OS=="android"', {
           'sources': [ '<@(chrome_unit_tests_mac_android_sources)' ],
         }],
+        ['OS=="android"', {
+          'sources': [ '<@(chrome_unit_tests_android_sources)' ],
+        }],
         ['OS!="mac" and OS!="ios"', {
           'dependencies': [
             '../third_party/hunspell/hunspell.gyp:hunspell',
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index 2700884b..5ebc639 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -301,9 +301,6 @@
 // Disable the new material UI - requires out of process PDF plugin.
 const char kDisablePdfMaterialUI[]          = "disable-pdf-material-ui";
 
-// Don't use bubbles for content permissions requests instead of infobars.
-const char kDisablePermissionsBubbles[]      = "disable-permissions-bubbles";
-
 // Disable pop-up blocking.
 const char kDisablePopupBlocking[]          = "disable-popup-blocking";
 
@@ -1269,9 +1266,6 @@
 const char kRelauncherProcess[]             = "relauncher";
 #endif  // defined(OS_MACOSX)
 
-// Use bubbles for content permissions requests instead of infobars.
-const char kEnablePermissionsBubbles[]      = "enable-permissions-bubbles";
-
 #if defined(OS_WIN)
 // Fallback to XPS. By default connector uses CDD.
 const char kEnableCloudPrintXps[]           = "enable-cloud-print-xps";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 721c283a..d649604 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -90,7 +90,6 @@
 extern const char kDisableOutOfProcessPac[];
 extern const char kDisablePasswordManagerReauthentication[];
 extern const char kDisablePdfMaterialUI[];
-extern const char kDisablePermissionsBubbles[];
 extern const char kDisablePopupBlocking[];
 extern const char kDisablePreconnect[];
 extern const char kDisablePrintPreview[];
@@ -142,7 +141,6 @@
 extern const char kEnableOfflineAutoReloadVisibleOnly[];
 extern const char kEnablePanels[];
 extern const char kEnablePdfMaterialUI[];
-extern const char kEnablePermissionsBubbles[];
 extern const char kEnablePotentiallyAnnoyingSecurityFeatures[];
 extern const char kEnablePowerOverlay[];
 extern const char kEnablePrintPreviewRegisterPromos[];
diff --git a/chrome/common/extensions/api/networking_private/networking_private_crypto.cc b/chrome/common/extensions/api/networking_private/networking_private_crypto.cc
index 387b1e17..983ba41 100644
--- a/chrome/common/extensions/api/networking_private/networking_private_crypto.cc
+++ b/chrome/common/extensions/api/networking_private/networking_private_crypto.cc
@@ -83,7 +83,7 @@
                                     &verification_context);
 
   if (verification_result.Failure()) {
-    LOG(ERROR) << kErrorPrefix << verification_result.GetLogString();
+    LOG(ERROR) << kErrorPrefix << verification_result.error_message;
     return false;
   }
 
@@ -104,7 +104,7 @@
       verification_context->VerifySignatureOverData(signature, data);
 
   if (verification_result.Failure()) {
-    LOG(ERROR) << kErrorPrefix << verification_result.GetLogString();
+    LOG(ERROR) << kErrorPrefix << verification_result.error_message;
     return false;
   }
   return true;
diff --git a/chrome/common/extensions/api/tab_capture.idl b/chrome/common/extensions/api/tab_capture.idl
index c6489d6..7d313bc 100644
--- a/chrome/common/extensions/api/tab_capture.idl
+++ b/chrome/common/extensions/api/tab_capture.idl
@@ -39,6 +39,7 @@
     boolean? video;
     MediaStreamConstraint? audioConstraints;
     MediaStreamConstraint? videoConstraints;
+    [nodoc] DOMString? presentationId;
   };
 
   callback GetTabMediaCallback =
@@ -66,6 +67,33 @@
     // to prevent redundant requests for the same tab).
     // |callback| : Callback invoked with CaptureInfo[] for captured tabs.
     static void getCapturedTabs(GetCapturedTabsCallback callback);
+
+    // Creates an off-screen tab and navigates it to the given |startUrl|.
+    // Then, capture is started and a MediaStream is returned via |callback|.
+    //
+    // Off-screen tabs are isolated from the user's normal browser experience.
+    // They do not show up in the browser window or tab strip, nor are they
+    // visible to extensions (e.g., via the chrome.tabs.* APIs).
+    //
+    // An off-screen tab remains alive until one of three events occurs: 1. All
+    // MediaStreams providing its captured content are closed; 2. the page
+    // self-closes (e.g., via window.close()); 3. the extension that called
+    // captureOffscreenTab() is unloaded.
+    //
+    // Sandboxing: The off-screen tab does not have any access whatsoever to the
+    // local user profile (including cookies, HTTP auth, etc.).  Instead, it is
+    // provided its own sandboxed profile.  Also, it cannot access any
+    // interactive resources such as keyboard/mouse input, media recording
+    // devices (e.g., web cams), copy/paste to/from the system clipboard, etc.
+    //
+    // Note: This is a new API, currently only available in Canary/Dev channel,
+    // and may change without notice.
+    //
+    // |options| : Constraints for the capture and returned MediaStream.
+    // |callback| : <code>null</code> on error.
+    static void captureOffscreenTab(DOMString startUrl,
+                                    CaptureOptions options,
+                                    GetTabMediaCallback callback);
   };
 
   interface Events {
diff --git a/chrome/common/safe_browsing/OWNERS b/chrome/common/safe_browsing/OWNERS
index 8cadac0..fb0c4d1 100644
--- a/chrome/common/safe_browsing/OWNERS
+++ b/chrome/common/safe_browsing/OWNERS
@@ -1,5 +1,5 @@
 mattm@chromium.org
-noelutz@google.com
+nparker@chromium.org
 shess@chromium.org
 
 # For security review of IPC message files.
diff --git a/chrome/common/safe_browsing/csd.proto b/chrome/common/safe_browsing/csd.proto
index a8908c87..e55d1ca 100644
--- a/chrome/common/safe_browsing/csd.proto
+++ b/chrome/common/safe_browsing/csd.proto
@@ -546,6 +546,7 @@
         repeated Modification modification = 4;
       }
       repeated ModuleState module_state = 11;
+      optional bool field_trial_participant = 12;
     }
     optional Process process = 3;
   }
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn
index ddd2321..59c1362 100644
--- a/chrome/installer/linux/BUILD.gn
+++ b/chrome/installer/linux/BUILD.gn
@@ -45,6 +45,18 @@
   ]
 }
 
+# This target is provided for compatibility w/ GYP. Users should always
+# depend directly on :linux instead of this target (we set visibility
+# to the empty list to prevent unwanted callers).
+# TODO(GYP): Delete this target after we've migrated away from GYP and
+# updated the bots to build :linux instead.
+group("linux_packages_all") {
+  visibility = []
+  deps = [
+    ":linux",
+  ]
+}
+
 branding_dir = "//chrome/app/theme/$branding_path_component"
 branding_dir_100 =
     "//chrome/app/theme/default_100_percent/$branding_path_component"
diff --git a/chrome/renderer/chrome_render_process_observer.cc b/chrome/renderer/chrome_render_process_observer.cc
index 83de154..f6455ff 100644
--- a/chrome/renderer/chrome_render_process_observer.cc
+++ b/chrome/renderer/chrome_render_process_observer.cc
@@ -37,7 +37,6 @@
 #include "content/public/renderer/render_thread.h"
 #include "content/public/renderer/render_view.h"
 #include "content/public/renderer/render_view_visitor.h"
-#include "crypto/nss_util.h"
 #include "net/base/net_errors.h"
 #include "net/base/net_module.h"
 #include "third_party/WebKit/public/web/WebCache.h"
@@ -261,13 +260,6 @@
       chrome_common_media::LocalizedStringProvider);
 #endif
 
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(USE_OPENSSL)
-  // On platforms where we use system NSS shared libraries,
-  // initialize NSS now because it won't be able to load the .so's
-  // after we engage the sandbox.
-  if (!command_line.HasSwitch(switches::kSingleProcess))
-    crypto::InitNSSSafely();
-#endif
   // Setup initial set of crash dump data for Field Trials in this renderer.
   variations::SetVariationListCrashKeys();
   // Listen for field trial activations to report them to the browser.
diff --git a/chrome/renderer/extensions/cast_streaming_native_handler.cc b/chrome/renderer/extensions/cast_streaming_native_handler.cc
index 160b6fb..4e10f1e6 100644
--- a/chrome/renderer/extensions/cast_streaming_native_handler.cc
+++ b/chrome/renderer/extensions/cast_streaming_native_handler.cc
@@ -763,16 +763,6 @@
     return;
   }
 
-  const std::string url = *v8::String::Utf8Value(args[7]);
-  blink::WebMediaStream stream =
-      blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(GURL(url));
-
-  if (stream.isNull()) {
-    args.GetIsolate()->ThrowException(v8::Exception::TypeError(
-        v8::String::NewFromUtf8(args.GetIsolate(), kInvalidMediaStreamURL)));
-    return;
-  }
-
   const int max_width = args[3]->ToInt32(args.GetIsolate())->Value();
   const int max_height = args[4]->ToInt32(args.GetIsolate())->Value();
   const double fps = args[5]->NumberValue();
@@ -783,6 +773,16 @@
     return;
   }
 
+  const std::string url = *v8::String::Utf8Value(args[6]);
+  blink::WebMediaStream stream =
+      blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(GURL(url));
+
+  if (stream.isNull()) {
+    args.GetIsolate()->ThrowException(v8::Exception::TypeError(
+        v8::String::NewFromUtf8(args.GetIsolate(), kInvalidMediaStreamURL)));
+    return;
+  }
+
   media::VideoCaptureFormat capture_format(gfx::Size(max_width, max_height),
                                            fps, media::PIXEL_FORMAT_I420);
 
@@ -802,14 +802,14 @@
     return;
   }
 
-  base::DictionaryValue* options = NULL;
-  if (args.Length() >= 10) {
+  scoped_ptr<base::DictionaryValue> options;
+  if (args.Length() >= 9) {
     scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create());
-    base::Value* options_value =
-        converter->FromV8Value(args[8], context()->v8_context());
+    scoped_ptr<base::Value> options_value(
+        converter->FromV8Value(args[8], context()->v8_context()));
     if (!options_value->IsType(base::Value::TYPE_NULL)) {
-      if (!options_value || !options_value->GetAsDictionary(&options)) {
-        delete options_value;
+      options = base::DictionaryValue::From(options_value.Pass());
+      if (!options) {
         args.GetIsolate()->ThrowException(v8::Exception::TypeError(
             v8::String::NewFromUtf8(args.GetIsolate(), kUnableToConvertArgs)));
         return;
@@ -818,7 +818,7 @@
   }
 
   if (!options) {
-    options = new base::DictionaryValue();
+    options.reset(new base::DictionaryValue());
   }
 
   v8::CopyablePersistentTraits<v8::Function>::CopyablePersistent error_callback;
@@ -826,19 +826,12 @@
                        v8::Local<v8::Function>(args[7].As<v8::Function>()));
 
   session->Start(
-      audio_config,
-      video_config,
-      local_endpoint,
-      remote_endpoint,
-      make_scoped_ptr(options),
-      capture_format,
+      audio_config, video_config, local_endpoint, remote_endpoint,
+      options.Pass(), capture_format,
       base::Bind(&CastStreamingNativeHandler::AddTracksToMediaStream,
-                 weak_factory_.GetWeakPtr(),
-                 url,
-                 params),
+                 weak_factory_.GetWeakPtr(), url, params),
       base::Bind(&CastStreamingNativeHandler::CallReceiverErrorCallback,
-                 weak_factory_.GetWeakPtr(),
-                 error_callback));
+                 weak_factory_.GetWeakPtr(), error_callback));
 }
 
 void CastStreamingNativeHandler::CallReceiverErrorCallback(
diff --git a/chrome/renderer/resources/extensions/tab_capture_custom_bindings.js b/chrome/renderer/resources/extensions/tab_capture_custom_bindings.js
index 93a60549..ab7ac7c 100644
--- a/chrome/renderer/resources/extensions/tab_capture_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/tab_capture_custom_bindings.js
@@ -9,11 +9,12 @@
 binding.registerCustomHook(function(bindingsAPI, extensionId) {
   var apiFunctions = bindingsAPI.apiFunctions;
 
-  apiFunctions.setCustomCallback('capture',
-      function(name, request, callback, response) {
+  function proxyToGetUserMedia(name, request, callback, response) {
     if (!callback)
       return;
 
+    // TODO(miu): Propagate exceptions and always provide a useful error when
+    // callback() is invoked with a null argument.  http://crbug.com/463679
     if (response) {
       var options = {};
       if (response.audioConstraints)
@@ -24,14 +25,17 @@
       try {
         navigator.webkitGetUserMedia(options,
                                      function(stream) { callback(stream); },
-                                     function() { callback(null); });
+                                     function(exception) { callback(null); });
       } catch (e) {
         callback(null);
       }
     } else {
       callback(null);
     }
-  });
+  }
+
+  apiFunctions.setCustomCallback('capture', proxyToGetUserMedia);
+  apiFunctions.setCustomCallback('captureOffscreenTab', proxyToGetUserMedia);
 });
 
 exports.binding = binding.generate();
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index b81b12d..98c09688a 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -1849,6 +1849,18 @@
               ".",
               "//chrome")
     }
+    if (is_android) {
+      sources += rebase_path(
+              chrome_tests_unit_gypi_values.chrome_unit_tests_android_sources,
+              ".",
+              "//chrome")
+    }
+    if (!is_android && !is_ios) {
+      sources += rebase_path(
+              chrome_tests_unit_gypi_values.chrome_unit_tests_non_mobile_sources,
+              ".",
+              "//chrome")
+    }
     if (!is_mac && !is_ios) {
       deps += [
         "//chrome/tools/convert_dict:lib",
diff --git a/chrome/test/android/unit_tests_apk/AndroidManifest.xml b/chrome/test/android/unit_tests_apk/AndroidManifest.xml
index fc0124c..3fdebe57 100644
--- a/chrome/test/android/unit_tests_apk/AndroidManifest.xml
+++ b/chrome/test/android/unit_tests_apk/AndroidManifest.xml
@@ -11,6 +11,7 @@
       android:versionName="1.0">
 
     <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
diff --git a/chrome/test/base/run_all_unittests.cc b/chrome/test/base/run_all_unittests.cc
index 3ab966f..e2fb975 100644
--- a/chrome/test/base/run_all_unittests.cc
+++ b/chrome/test/base/run_all_unittests.cc
@@ -6,12 +6,12 @@
 #include "base/test/launcher/unit_test_launcher.h"
 #include "chrome/test/base/chrome_unit_test_suite.h"
 #include "content/public/test/unittest_test_suite.h"
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 
 int main(int argc, char **argv) {
   content::UnitTestTestSuite test_suite(new ChromeUnitTestSuite(argc, argv));
 
-  mojo::embedder::test::InitWithSimplePlatformSupport();
+  mojo::embedder::Init();
   return base::LaunchUnitTests(
       argc, argv, base::Bind(&content::UnitTestTestSuite::Run,
                              base::Unretained(&test_suite)));
diff --git a/chrome/test/data/android/tabstest/text_page.html b/chrome/test/data/android/tabstest/text_page.html
index ea6b681..f90b311 100644
--- a/chrome/test/data/android/tabstest/text_page.html
+++ b/chrome/test/data/android/tabstest/text_page.html
@@ -1,22 +1,3 @@
-<script src="scroll.js"></script>
-<script src="scroll_helper.js"></script>
-<script>
-onload = function() {
-  console.log('loaded: 1')
-  if (__get_param('scroll_delta')) {
-    setTimeout(__start_test_scroll, 2000);
-  }
-  if (__get_param('target_offset')) {
-    var target_offset = parseInt(__get_param('target_offset'));
-    __start_monitoring_scroll_position(target_offset);
-  }
-};
-
-if (__get_param('fixed')) {
-  document.write("<div style='width:100%;height:50px;top:200px;left:0;position:fixed;background:red;'></div>");
-}
-</script>
-
 <title>Text page</title>
 
 <p>
diff --git a/chrome/test/data/extensions/api_test/tab_capture/api_tests.js b/chrome/test/data/extensions/api_test/tab_capture/api_tests.js
index 1efad1d..c55e8f60 100644
--- a/chrome/test/data/extensions/api_test/tab_capture/api_tests.js
+++ b/chrome/test/data/extensions/api_test/tab_capture/api_tests.js
@@ -4,6 +4,21 @@
 
 var tabCapture = chrome.tabCapture;
 
+var helloWorldPageUri = 'data:text/html;charset=UTF-8,' +
+    encodeURIComponent('<html><body>Hello world!</body></html>');
+
+function assertIsSameSetOfTabs(list_a, list_b, id_field_name) {
+  chrome.test.assertEq(list_a.length, list_b.length);
+  function tabIdSortFunction(a, b) {
+    return (a[id_field_name] || 0) - (b[id_field_name] || 0);
+  }
+  list_a.sort(tabIdSortFunction);
+  list_b.sort(tabIdSortFunction);
+  for (var i = 0, end = list_a.length; i < end; ++i) {
+    chrome.test.assertEq(list_a[i][id_field_name], list_b[i][id_field_name]);
+  }
+}
+
 chrome.test.runTests([
   function captureTabAndVerifyStateTransitions() {
     // Tab capture events in the order they happen.
@@ -144,5 +159,37 @@
       chrome.test.assertTrue(!stream);
       chrome.test.succeed();
     });
+  },
+
+  function offscreenTabsDoNotShowUpAsCapturedTabs() {
+    tabCapture.getCapturedTabs(function(tab_list_before) {
+      tabCapture.captureOffscreenTab(
+          helloWorldPageUri,
+          {video: true},
+          function(stream) {
+            chrome.test.assertTrue(!!stream);
+            tabCapture.getCapturedTabs(function(tab_list_after) {
+              assertIsSameSetOfTabs(tab_list_before, tab_list_after, 'tabId');
+              stream.getVideoTracks()[0].stop();
+              chrome.test.succeed();
+            });
+          });
+    });
+  },
+
+  function offscreenTabsDoNotShowUpInTabsQuery() {
+    chrome.tabs.query({/* all tabs */}, function(tab_list_before) {
+      tabCapture.captureOffscreenTab(
+          helloWorldPageUri,
+          {video: true},
+          function(stream) {
+            chrome.test.assertTrue(!!stream);
+            chrome.tabs.query({/* all tabs */}, function(tab_list_after) {
+              assertIsSameSetOfTabs(tab_list_before, tab_list_after, 'id');
+              stream.getVideoTracks()[0].stop();
+              chrome.test.succeed();
+            });
+          });
+    });
   }
 ]);
diff --git a/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.html b/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.html
new file mode 100644
index 0000000..fe9dcf9c
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+</body>
+<script src="max_offscreen_tabs.js"></script>
+</html>
diff --git a/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.js b/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.js
new file mode 100644
index 0000000..89b8c4d
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tab_capture/max_offscreen_tabs.js
@@ -0,0 +1,45 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var tabCapture = chrome.tabCapture;
+
+var helloWorldPageUri = 'data:text/html;charset=UTF-8,' +
+    encodeURIComponent('<html><body>Hello world!</body></html>');
+
+chrome.test.runTests([
+ function canOpenUpToThreeOffscreenTabs() {
+   function stopAllStreams(streams) {
+     for (var i = 0, end = streams.length; i < end; ++i) {
+       streams[i].getVideoTracks()[0].stop();
+     }
+   }
+
+   function launchTabsUntilLimitReached(streamsSoFar) {
+     tabCapture.captureOffscreenTab(
+         helloWorldPageUri,
+         {video: true},
+         function(stream) {
+           if (streamsSoFar.length == 3) {
+             // 4th off-screen tab capture should fail.
+             chrome.test.assertFalse(!!stream);
+             stopAllStreams(streamsSoFar);
+             chrome.test.succeed();
+           } else if (stream) {
+             streamsSoFar.push(stream);
+             setTimeout(
+                 function() {
+                   launchTabsUntilLimitReached(streamsSoFar);
+                 }, 0);
+           } else {
+             console.error("Failed to capture stream, iter #" +
+                 streamsSoFar.length);
+             stopAllStreams(streamsSoFar);
+             chrome.test.fail();
+           }
+         });
+   }
+
+   launchTabsUntilLimitReached([]);
+ }
+]);
diff --git a/chrome/test/data/extensions/api_test/tab_capture/offscreen_end_to_end.html b/chrome/test/data/extensions/api_test/tab_capture/offscreen_end_to_end.html
new file mode 100644
index 0000000..c51ddbf
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tab_capture/offscreen_end_to_end.html
@@ -0,0 +1,7 @@
+<html>
+<body style="background-color: #224; width:100%; height:100%">
+<video id="video" autoplay style="position: absolute; top:0; bottom:0; left:0; right:0; margin:auto; border:none;"></video>
+</body>
+<script src="offscreen_test_harness.js"></script>
+<script src="offscreen_end_to_end.js"></script>
+</html>
diff --git a/chrome/test/data/extensions/api_test/tab_capture/offscreen_end_to_end.js b/chrome/test/data/extensions/api_test/tab_capture/offscreen_end_to_end.js
new file mode 100644
index 0000000..e073d07
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tab_capture/offscreen_end_to_end.js
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Returs a full HTML test document for the off-screen tab that renders rotating
+// color fills of red, then green, then blue.
+function makeRotatingColorTestDocument() {
+  return makeOffscreenTabTestDocument('\
+// The test pattern cycles as a color fill of red, then green, then blue.\n\
+var colors = [redColor, greenColor, blueColor];\n\
+\n\
+function colorRotationLoop() {\n\
+  if (!this.iterCount) {\n\
+    this.iterCount = 1;\n\
+  } else {\n\
+    ++this.iterCount;\n\
+  }\n\
+  if (!this.stepTimeMillis) {\n\
+    this.stepTimeMillis = 100;\n\
+  }\n\
+  var idx = this.iterCount % colors.length;\n\
+  if (idx == 0) {  // Completed a cycle.\n\
+    // Increase the wait time between switching test patterns for\n\
+    // overloaded bots that are not capturing all the frames of video.\n\
+    this.stepTimeMillis *= 1.25;\n\
+  }\n\
+  setFillColor(colors[idx]);\n\
+  setTimeout(colorRotationLoop, this.stepTimeMillis);\n\
+}\n\
+colorRotationLoop();');
+}
+
+// Observer side of this end-to-end test.  |stream| is monitored for each of the
+// three fill colors to be generated by the off-screen tab.  Once all three have
+// been observed, the test ends successfully.
+function waitForExpectedColorsAndEndTest(stream) {
+  // Elements from this array are removed as each color is observed.  When it
+  // becomes empty, the test succeeds.
+  var remainingColors = [[255, 0, 0], [0, 255, 0], [0, 0, 255]];
+  var colorDeviation = 10;
+
+  function onMatchedNextColor(idx) {
+    chrome.test.assertTrue(idx < remainingColors.length);
+    remainingColors.splice(idx, 1);
+    if (remainingColors.length == 0) {
+      stopAllTracks(stream);
+      chrome.test.succeed();
+    } else {
+      waitForAnExpectedColor(stream, remainingColors, colorDeviation,
+                             onMatchedNextColor);
+    }
+  }
+  waitForAnExpectedColor(stream, remainingColors, colorDeviation,
+                         onMatchedNextColor);
+}
+
+chrome.test.runTests([
+  function offscreenTabTest() {
+    chrome.tabCapture.captureOffscreenTab(
+        makeDataUriFromDocument(makeRotatingColorTestDocument()),
+        getCaptureOptions(),
+        waitForExpectedColorsAndEndTest);
+  }
+]);
diff --git a/chrome/test/data/extensions/api_test/tab_capture/offscreen_evil_tests.html b/chrome/test/data/extensions/api_test/tab_capture/offscreen_evil_tests.html
new file mode 100644
index 0000000..b924b14
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tab_capture/offscreen_evil_tests.html
@@ -0,0 +1,7 @@
+<html>
+<body style="background-color: #224; width:100%; height:100%">
+<video id="video" autoplay style="position: absolute; top:0; bottom:0; left:0; right:0; margin:auto; border:none;"></video>
+</body>
+<script src="offscreen_test_harness.js"></script>
+<script src="offscreen_evil_tests.js"></script>
+</html>
diff --git a/chrome/test/data/extensions/api_test/tab_capture/offscreen_evil_tests.js b/chrome/test/data/extensions/api_test/tab_capture/offscreen_evil_tests.js
new file mode 100644
index 0000000..f3f822f
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tab_capture/offscreen_evil_tests.js
@@ -0,0 +1,85 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Waits until content sampled from |stream| indicates a success or fail status
+// from an off-screen tab page that renders a green (success) or red (fail)
+// color fill.
+function waitForGreenOrRedTestResultAndEndTest(stream) {
+  waitForAnExpectedColor(stream, [[255, 0, 0], [0, 255, 0]], 64,
+      function (result) {
+        stopAllTracks(stream);
+        if (result == 1) {
+          chrome.test.succeed();
+        } else {
+          // Fail after 3 seconds to allow examining the debug error message.
+          setTimeout(function () { chrome.test.fail(); }, 3000);
+        }
+      }
+  );
+}
+
+chrome.test.runTests([
+  function cannotAccessLocalResources() {
+    chrome.tabCapture.captureOffscreenTab(
+      makeDataUriFromDocument(makeOffscreenTabTestDocument(
+          'function failIfIsLoadable(url, runNextTest) {\n' +
+          '  var request = new XMLHttpRequest();\n' +
+          '  request.open("GET", url);\n' +
+          '  request.addEventListener("load", function () {\n' +
+          '    setDebugMessage(url);\n' +
+          '    setFillColor(redColor);\n' +
+          '  });\n' +
+          '  request.addEventListener("error", function () {\n' +
+          '    setTimeout(runNextTest, 0);\n' +
+          '  });' +
+          '  request.send();\n' +
+          '}\n' +
+          '\n' +
+          'failIfIsLoadable("file://something", function () {\n' +
+          '  failIfIsLoadable("chrome-extension://' + chrome.runtime.id +
+                             '/offscreen_evil_tests.js", function() {\n' +
+          '    setFillColor(greenColor);\n' +
+          '  });\n' +
+          '});')),
+      getCaptureOptions(),
+      waitForGreenOrRedTestResultAndEndTest);
+  },
+
+  function cannotOpenNewTabsOrDialogs() {
+    chrome.tabCapture.captureOffscreenTab(
+      makeDataUriFromDocument(makeOffscreenTabTestDocument(
+          'var wnd = window.open("data:text/html;charset=UTF-8,NOT SEEN");\n' +
+          'if (wnd) {\n' +
+          '  setDebugMessage("window.open() succeeded");\n' +
+          '  setFillColor(redColor);\n' +
+          '} else {\n' +
+          '  var result = window.confirm("Can you see me?");\n' +
+          '  if (result) {\n' +
+          '    setDebugMessage("positive confirm result");\n' +
+          '    setFillColor(redColor);\n' +
+          '  } else {\n' +
+          '    setFillColor(greenColor);\n' +
+          '  }\n' +
+          '}')),
+      getCaptureOptions(),
+      waitForGreenOrRedTestResultAndEndTest);
+  },
+
+  function cannotGetUserMedia() {
+    chrome.tabCapture.captureOffscreenTab(
+      makeDataUriFromDocument(makeOffscreenTabTestDocument(
+          'navigator.webkitGetUserMedia(\n' +
+          '  {video: true},\n' +
+          '  function onSuccess(stream) { setFillColor(redColor); },\n' +
+          '  function onFailure(error) { setFillColor(greenColor); });')),
+      getCaptureOptions(),
+      waitForGreenOrRedTestResultAndEndTest);
+  },
+
+  // NOTE: Before adding any more tests, the maximum off-screen tab limit would
+  // have to be increased (or a design issue resolved).  This is because
+  // off-screen tabs are not closed the instant the LocalMediaStream is stopped,
+  // but approximately 1 second later.
+
+]);
diff --git a/chrome/test/data/extensions/api_test/tab_capture/offscreen_test_harness.js b/chrome/test/data/extensions/api_test/tab_capture/offscreen_test_harness.js
new file mode 100644
index 0000000..53fa06c
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/tab_capture/offscreen_test_harness.js
@@ -0,0 +1,188 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains a test harness for testing the behavior of pages running
+// inside off-screen tabs:
+//
+//   1. It provides a simple way to formulate a data URI containing a full HTML
+//      document that executes arbitrary script.  The arbitrary script running
+//      in the off-screen tab calls setFillColor() to expose its current state
+//      by rendering a color fill.  In addition, the off-screen tab continuously
+//      paints changes that force the tab capture implementation to continuously
+//      capture new video frames.
+//
+//   2. In the extension's JavaScript context, a waitAnForExpectedColor()
+//      function is provided to sample the video frames of the captured
+//      off-screen tab until the center pixel contains one of the colors in a
+//      set of expected colors.
+
+// Width/Height of off-screen tab, rendered content, and captured content.
+var width = 160;
+var height = 120;
+
+// Capture frame rate.
+var frameRate = 8;
+
+// Return a full HTML document that executes the |script|.  The script calls
+// setFillColor() to expose changes to its internal state.
+function makeOffscreenTabTestDocument(script) {
+  return '\
+<html><body style="background-color:black; margin:0; padding:0;"></body>\n\
+<script>\n\
+var redColor = [255, 0, 0];\n\
+var greenColor = [0, 255, 0];\n\
+var blueColor = [0, 0, 255];\n\
+\n\
+var fillColor = [0, 0, 0];\n\
+function setFillColor(color) {\n\
+  fillColor = color;\n\
+}\n\
+\n\
+var debugMessage = "";\n\
+function setDebugMessage(msg) {\n\
+  debugMessage = msg;\n\
+}\n\
+\n\
+function updateTestPattern() {\n\
+  if (!this.canvas) {\n\
+    this.canvas = document.createElement("canvas");\n\
+    this.canvas.width = ' + width + ';\n\
+    this.canvas.height = ' + height + ';\n\
+    this.canvas.style.position = "absolute";\n\
+    this.canvas.style.top = "0px";\n\
+    this.canvas.style.left = "0px";\n\
+    this.canvas.style.width = "100%";\n\
+    this.canvas.style.height = "100%";\n\
+    document.body.appendChild(this.canvas);\n\
+  }\n\
+  var context = this.canvas.getContext("2d");\n\
+  // Fill with solid color.\n\
+  context.fillStyle = "rgb(" + fillColor + ")";\n\
+  context.fillRect(0, 0, this.canvas.width, this.canvas.height);\n\
+  // Draw the circle that moves around the page.\n\
+  var inverseColor =\n\
+      [255 - fillColor[0], 255 - fillColor[1], 255 - fillColor[2]];\n\
+  if (debugMessage) {\n\
+    context.fillStyle = "rgb(" + inverseColor + ")";\n\
+    context.font = "xx-small monospace";\n\
+    context.fillText(debugMessage, 0, 0);\n\
+  }\n\
+  context.fillStyle = "rgba(" + inverseColor + ", 0.5)";\n\
+  context.beginPath();\n\
+  if (!this.frameNumber) {\n\
+    this.frameNumber = 1;\n\
+  } else {\n\
+    ++this.frameNumber;\n\
+  }\n\
+  var i = this.frameNumber % 200;\n\
+  var t = (this.frameNumber + 3000) * (0.01 + i / 8000.0);\n\
+  var x = (Math.sin(t) * 0.45 + 0.5) * this.canvas.width;\n\
+  var y = (Math.cos(t * 0.9) * 0.45 + 0.5) * this.canvas.height;\n\
+  context.arc(x, y, 16, 0, 2 * Math.PI, false);\n\
+  context.closePath();\n\
+  context.fill();\n\
+}\n\
+\n\
+function renderTestPatternLoop() {\n\
+  updateTestPattern();\n\
+  requestAnimationFrame(renderTestPatternLoop);\n\
+}\n\
+renderTestPatternLoop();\n\
+\n' +
+script + '\n\
+</script></html>';
+}
+
+// Return the given |html| document as an encoded data URI.
+function makeDataUriFromDocument(html) {
+  return 'data:text/html;charset=UTF-8,' + encodeURIComponent(html);
+}
+
+// Returns capture options for starting the off-screen tab.
+function getCaptureOptions() {
+  return {
+    video: true,
+    audio: false,
+    videoConstraints: {
+      mandatory: {
+        minWidth: width,
+        minHeight: height,
+        maxWidth: width,
+        maxHeight: height,
+        maxFrameRate: frameRate,
+      }
+    }
+  };
+}
+
+// Samples the video frames from a capture |stream|, testing the color of the
+// center pixel.  Once the pixel matches one of the colors in |expectedColors|,
+// run |callback| with the index of the matched color.  |colorDeviation| is used
+// to imprecisely match colors.
+function waitForAnExpectedColor(
+    stream, expectedColors, colorDeviation, callback) {
+  chrome.test.assertTrue(!!stream);
+  chrome.test.assertTrue(expectedColors.length > 0);
+  chrome.test.assertTrue(!!callback);
+
+  var video = document.getElementById('video');
+  chrome.test.assertTrue(!!video);
+
+  // If not yet done, plug the LocalMediaStream into the video element.
+  if (!this.stream || this.stream != stream) {
+    this.stream = stream;
+    video.src = URL.createObjectURL(stream);
+    video.play();
+  }
+
+  // Create a canvas to sample frames from the video element.
+  if (!this.canvas) {
+    this.canvas = document.createElement("canvas");
+    this.canvas.width = width;
+    this.canvas.height = height;
+  }
+
+  // Only bother examining a video frame if the video timestamp has advanced.
+  var currentVideoTimestamp = video.currentTime;
+  if (!this.lastVideoTimestamp ||
+      this.lastVideoTimestamp < currentVideoTimestamp) {
+    this.lastVideoTimestamp = currentVideoTimestamp;
+
+    // Grab a snapshot of the center pixel of the video.
+    var ctx = this.canvas.getContext("2d");
+    ctx.drawImage(video, 0, 0, width, height);
+    var imageData = ctx.getImageData(width / 2, height / 2, 1, 1);
+    var pixel = [imageData.data[0], imageData.data[1], imageData.data[2]];
+
+    // Does the pixel match one of the expected colors?
+    for (var i = 0, end = expectedColors.length; i < end; ++i) {
+      var color = expectedColors[i];
+      if (Math.abs(pixel[0] - color[0]) <= colorDeviation &&
+          Math.abs(pixel[1] - color[1]) <= colorDeviation &&
+          Math.abs(pixel[2] - color[2]) <= colorDeviation) {
+        console.debug("Observed expected color RGB(" + color +
+            ") in the video as RGB(" + pixel + ")");
+        setTimeout(function () { callback(i); }, 0);
+        return;
+      }
+    }
+  }
+
+  // At this point, an expected color has not been observed.  Schedule another
+  // check after a short delay.
+  setTimeout(
+    function () {
+      waitForAnExpectedColor(stream, expectedColors, colorDeviation, callback);
+    },
+    1000 / frameRate);
+}
+
+// Stops all the tracks in a MediaStream.
+function stopAllTracks(stream) {
+  var tracks = stream.getTracks();
+  for (var i = 0, end = tracks.length; i < end; ++i) {
+    tracks[i].stop();
+  }
+  chrome.test.assertFalse(stream.active);
+}
diff --git a/chrome/test/data/pdf/toolbar_manager_test.js b/chrome/test/data/pdf/toolbar_manager_test.js
index 6aa2c0a..7055479 100644
--- a/chrome/test/data/pdf/toolbar_manager_test.js
+++ b/chrome/test/data/pdf/toolbar_manager_test.js
@@ -24,6 +24,17 @@
   return events;
 }
 
+function makeTapEvent(x, y) {
+  var e = new MouseEvent('mousemove', {
+    clientX: x,
+    clientY: y,
+    movementX: 0,
+    movementY: 0,
+    sourceCapabilities: new InputDeviceCapabilities({firesTouchEvents: true})
+  });
+  return e;
+}
+
 var tests = [
   /**
    * Test that ToolbarManager.forceHideTopToolbar hides (or shows) the top
@@ -38,7 +49,7 @@
 
     var mouseMove = function(fromX, fromY, toX, toY, steps) {
       getMouseMoveEvents(fromX, fromY, toX, toY, steps).forEach(function(e) {
-        toolbarManager.showToolbarsForMouseMove(e);
+        toolbarManager.handleMouseMove(e);
       });
     };
 
@@ -106,7 +117,7 @@
 
     var mouseMove = function(fromX, fromY, toX, toY, steps) {
       getMouseMoveEvents(fromX, fromY, toX, toY, steps).forEach(function(e) {
-        toolbarManager.showToolbarsForMouseMove(e);
+        toolbarManager.handleMouseMove(e);
       });
     };
 
@@ -129,6 +140,45 @@
     chrome.test.assertFalse(toolbar.opened);
 
     chrome.test.succeed();
+  },
+
+  /**
+   * Test that the toolbars can be shown or hidden by tapping with a touch
+   * device.
+   */
+  function testToolbarTouchInteraction() {
+    var mockWindow = new MockWindow(1920, 1080);
+    var toolbar =
+        Polymer.Base.create('viewer-pdf-toolbar', {loadProgress: 100});
+    var zoomToolbar = Polymer.Base.create('viewer-zoom-toolbar');
+    var toolbarManager = new ToolbarManager(mockWindow, toolbar, zoomToolbar);
+
+    toolbarManager.hideToolbarsIfAllowed();
+    chrome.test.assertFalse(toolbar.opened);
+
+    // Tap anywhere on the screen -> Toolbars open.
+    toolbarManager.handleMouseMove(makeTapEvent(500, 500));
+    chrome.test.assertTrue(toolbar.opened, "toolbars open after tap");
+
+    // Tap again -> Toolbars close.
+    toolbarManager.handleMouseMove(makeTapEvent(500, 500));
+    chrome.test.assertFalse(toolbar.opened, "toolbars close after tap");
+
+    // Open toolbars, wait 2 seconds -> Toolbars close.
+    toolbarManager.handleMouseMove(makeTapEvent(500, 500));
+    mockWindow.runTimeout();
+    chrome.test.assertFalse(toolbar.opened, "toolbars close after wait");
+
+    // Open toolbars, tap near toolbars -> Toolbar doesn't close.
+    toolbarManager.handleMouseMove(makeTapEvent(500, 500));
+    toolbarManager.handleMouseMove(makeTapEvent(100, 75));
+    chrome.test.assertTrue(toolbar.opened,
+                           "toolbars stay open after tap near toolbars");
+    mockWindow.runTimeout();
+    chrome.test.assertTrue(toolbar.opened,
+                           "tap near toolbars prevents auto close");
+
+    chrome.test.succeed();
   }
 ];
 
diff --git a/chrome/test/data/push_messaging/push_test.js b/chrome/test/data/push_messaging/push_test.js
index eb709c8..1ed8f816 100644
--- a/chrome/test/data/push_messaging/push_test.js
+++ b/chrome/test/data/push_messaging/push_test.js
@@ -106,12 +106,12 @@
   }).catch(sendErrorToTest);
 }
 
-function GetP256dh() {
+function getCurve25519dh() {
   navigator.serviceWorker.ready.then(function(swRegistration) {
     return swRegistration.pushManager.getSubscription()
         .then(function(subscription) {
           sendResultToTest(btoa(String.fromCharCode.apply(null,
-              new Uint8Array(subscription.getKey('p256dh')))));
+              new Uint8Array(subscription.getKey('curve25519dh')))));
         });
   }).catch(sendErrorToTest);
 }
diff --git a/chrome/test/data/webui/net_internals/log_view_painter.js b/chrome/test/data/webui/net_internals/log_view_painter.js
index e872a834..688b07a 100644
--- a/chrome/test/data/webui/net_internals/log_view_painter.js
+++ b/chrome/test/data/webui/net_internals/log_view_painter.js
@@ -56,13 +56,13 @@
     ['Proxy-Authenticate: Digest realm="asdfasdf", nonce=5, qop="auth"', null],
     ['Proxy-Authenticate: Basic realm=foo,foo=bar , Digest ', null],
 
+    ['cookie: [4 bytes were stripped]', null],
     ['cookie: Stuff [4 bytes were stripped]',
      'cookie: [29 bytes were stripped]'],
     ['cookie: [4 bytes were stripped] Stuff',
      'cookie: [29 bytes were stripped]'],
     ['set-cookie: [4 bytes were stripped]', null],
     ['Proxy-Authenticate: NTLM [23 bytes were stripped]', null],
-    ['cookie: [value was stripped]', null],
   ];
 
   for (var i = 0; i < expectations.length; ++i) {
diff --git a/chrome/test/media_router/resources/common.js b/chrome/test/media_router/resources/common.js
index ef984f0..bd2665b 100644
--- a/chrome/test/media_router/resources/common.js
+++ b/chrome/test/media_router/resources/common.js
@@ -15,8 +15,9 @@
 var defaultRequestSessionId = null;
 
 window.navigator.presentation.defaultRequest = startSessionRequest;
-window.navigator.presentation.defaultRequest.onsessionconnect = function(e) {
-  defaultRequestSessionId = e.session.id;
+window.navigator.presentation.defaultRequest.onconnectionavailable = function(e)
+{
+  defaultRequestSessionId = e.connection.id;
 };
 
 /**
diff --git a/chrome/test/ppapi/ppapi_browsertest.cc b/chrome/test/ppapi/ppapi_browsertest.cc
index 3cc27165..78e41dc 100644
--- a/chrome/test/ppapi/ppapi_browsertest.cc
+++ b/chrome/test/ppapi/ppapi_browsertest.cc
@@ -66,6 +66,7 @@
 
 #define MAYBE_PPAPI_NACL(test_name) DISABLED_##test_name
 
+#define TEST_PPAPI_NACL_NATIVE(test_name)
 #define TEST_PPAPI_NACL(test_name)
 #define TEST_PPAPI_NACL_DISALLOWED_SOCKETS(test_name)
 #define TEST_PPAPI_NACL_WITH_SSL_SERVER(test_name)
@@ -75,11 +76,15 @@
 
 #define MAYBE_PPAPI_NACL(test_name) test_name
 
-// NaCl based PPAPI tests
-#define TEST_PPAPI_NACL(test_name) \
+// NaCl based PPAPI tests (direct-to-native NaCl only, no PNaCl)
+#define TEST_PPAPI_NACL_NATIVE(test_name) \
     IN_PROC_BROWSER_TEST_F(PPAPINaClNewlibTest, test_name) { \
       RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
-    } \
+    }
+
+// NaCl based PPAPI tests
+#define TEST_PPAPI_NACL(test_name) \
+    TEST_PPAPI_NACL_NATIVE(test_name)                       \
     IN_PROC_BROWSER_TEST_F(PPAPINaClPNaClTest, test_name) { \
       RunTestViaHTTP(STRIP_PREFIXES(test_name)); \
     } \
@@ -540,6 +545,10 @@
 
 TEST_PPAPI_NACL(VarResource)
 
+#if defined(__i386__)
+TEST_PPAPI_NACL_NATIVE(NaClIRTStackAlignment)
+#endif
+
 // PostMessage tests.
 #define RUN_POSTMESSAGE_SUBTESTS \
   RunTestViaHTTP( \
diff --git a/chrome/test/telemetry/OWNERS b/chrome/test/telemetry/OWNERS
deleted file mode 100644
index acdc1b8f..0000000
--- a/chrome/test/telemetry/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-achuith@chromium.org
-zelidrag@chromium.org
diff --git a/chrome/test/telemetry/__init__.py b/chrome/test/telemetry/__init__.py
deleted file mode 100644
index d8838d5..0000000
--- a/chrome/test/telemetry/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-"""Telemetry-based functional tests."""
diff --git a/chrome/test/telemetry/chromeos/__init__.py b/chrome/test/telemetry/chromeos/__init__.py
deleted file mode 100644
index 4bcb51e..0000000
--- a/chrome/test/telemetry/chromeos/__init__.py
+++ /dev/null
@@ -1,4 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-"""Telemetry-based chromeos functional tests."""
diff --git a/chrome/test/telemetry/chromeos/autotest_ext/background.js b/chrome/test/telemetry/chromeos/autotest_ext/background.js
deleted file mode 100644
index 9e8503f..0000000
--- a/chrome/test/telemetry/chromeos/autotest_ext/background.js
+++ /dev/null
@@ -1,4 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
diff --git a/chrome/test/telemetry/chromeos/autotest_ext/manifest.json b/chrome/test/telemetry/chromeos/autotest_ext/manifest.json
deleted file mode 100644
index 1eb454e..0000000
--- a/chrome/test/telemetry/chromeos/autotest_ext/manifest.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
-  "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDuUZGKCDbff6IRaxa4Pue7PPkxwPaNhGT3JEqppEsNWFjM80imEdqMbf3lrWqEfaHgaNku7nlpwPO1mu3/4Hr+XdNa5MhfnOnuPee4hyTLwOs3Vzz81wpbdzUxZSi2OmqMyI5oTaBYICfNHLwcuc65N5dbt6WKGeKgTpp4v7j7zwIDAQAB",
-  "description": "Telemetry ChromeOS Autotest component extension",
-  "name": "Telemetry ChromeOS AutoTest Component Extension",
-  "background": {
-    "scripts": ["background.js"]
-  },
-  "manifest_version": 2,
-  "version": "0.1",
-  "permissions" : [
-    "autotestPrivate"
-  ]
-}
diff --git a/chrome/test/telemetry/chromeos/login_unittest.py b/chrome/test/telemetry/chromeos/login_unittest.py
deleted file mode 100644
index cbd74b4..0000000
--- a/chrome/test/telemetry/chromeos/login_unittest.py
+++ /dev/null
@@ -1,324 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import json
-import logging
-import os
-import unittest
-
-from telemetry.core.backends.chrome import cros_interface
-from telemetry.core import exceptions
-from telemetry.core import util
-from telemetry.internal.browser import extension_to_load
-from telemetry.internal.browser import browser_finder
-from telemetry.unittest import options_for_unittests
-
-class CrOSAutoTest(unittest.TestCase):
-  def setUp(self):
-    options = options_for_unittests.GetCopy()
-    self._cri = cros_interface.CrOSInterface(options.cros_remote,
-                                             options.cros_ssh_identity)
-    self._is_guest = options.browser_type == 'cros-chrome-guest'
-    self._username = '' if self._is_guest else options.browser_options.username
-    self._password = options.browser_options.password
-
-  def _IsCryptohomeMounted(self):
-    """Returns True if cryptohome is mounted"""
-    cryptohomeJSON, _ = self._cri.RunCmdOnDevice(['/usr/sbin/cryptohome',
-                                                 '--action=status'])
-    cryptohomeStatus = json.loads(cryptohomeJSON)
-    return (cryptohomeStatus['mounts'] and
-            cryptohomeStatus['mounts'][0]['mounted'])
-
-  def _CreateBrowser(self, autotest_ext=False, auto_login=True):
-    """Finds and creates a browser for tests. if autotest_ext is True,
-    also loads the autotest extension"""
-    options = options_for_unittests.GetCopy()
-
-    if autotest_ext:
-      extension_path = os.path.join(os.path.dirname(__file__), 'autotest_ext')
-      self._load_extension = extension_to_load.ExtensionToLoad(
-          path=extension_path,
-          browser_type=options.browser_type,
-          is_component=True)
-      options.extensions_to_load = [self._load_extension]
-
-    browser_to_create = browser_finder.FindBrowser(options)
-    self.assertTrue(browser_to_create)
-    options.browser_options.create_browser_with_oobe = True
-    options.browser_options.auto_login = auto_login
-    b = browser_to_create.Create(options)
-    b.Start()
-    return b
-
-  def _GetAutotestExtension(self, browser):
-    """Returns the autotest extension instance"""
-    extension = browser.extensions[self._load_extension]
-    self.assertTrue(extension)
-    return extension
-
-  def _GetLoginStatus(self, browser):
-      extension = self._GetAutotestExtension(browser)
-      self.assertTrue(extension.EvaluateJavaScript(
-          "typeof('chrome.autotestPrivate') != 'undefined'"))
-      extension.ExecuteJavaScript('''
-        window.__login_status = null;
-        chrome.autotestPrivate.loginStatus(function(s) {
-          window.__login_status = s;
-        });
-      ''')
-      return util.WaitFor(
-          lambda: extension.EvaluateJavaScript('window.__login_status'), 10)
-
-  def testCryptohomeMounted(self):
-    """Verifies cryptohome mount status for regular and guest user and when
-    logged out"""
-    with self._CreateBrowser() as b:
-      self.assertEquals(1, len(b.tabs))
-      self.assertTrue(b.tabs[0].url)
-      self.assertTrue(self._IsCryptohomeMounted())
-
-      chronos_fs = self._cri.FilesystemMountedAt('/home/chronos/user')
-      self.assertTrue(chronos_fs)
-      if self._is_guest:
-        self.assertEquals(chronos_fs, 'guestfs')
-      else:
-        home, _ = self._cri.RunCmdOnDevice(['/usr/sbin/cryptohome-path',
-                                            'user', self._username])
-        self.assertEquals(self._cri.FilesystemMountedAt(home.rstrip()),
-                          chronos_fs)
-
-    self.assertFalse(self._IsCryptohomeMounted())
-    self.assertEquals(self._cri.FilesystemMountedAt('/home/chronos/user'),
-                      '/dev/mapper/encstateful')
-
-  def testLoginStatus(self):
-    """Tests autotestPrivate.loginStatus"""
-    with self._CreateBrowser(autotest_ext=True) as b:
-      login_status = self._GetLoginStatus(b)
-      self.assertEquals(type(login_status), dict)
-
-      self.assertEquals(not self._is_guest, login_status['isRegularUser'])
-      self.assertEquals(self._is_guest, login_status['isGuest'])
-      self.assertEquals(login_status['email'], self._username)
-      self.assertFalse(login_status['isScreenLocked'])
-
-  def _IsScreenLocked(self, browser):
-    return self._GetLoginStatus(browser)['isScreenLocked']
-
-  def _LockScreen(self, browser):
-      self.assertFalse(self._IsScreenLocked(browser))
-
-      extension = self._GetAutotestExtension(browser)
-      self.assertTrue(extension.EvaluateJavaScript(
-          "typeof chrome.autotestPrivate.lockScreen == 'function'"))
-      logging.info('Locking screen')
-      extension.ExecuteJavaScript('chrome.autotestPrivate.lockScreen();')
-
-      logging.info('Waiting for the lock screen')
-      def ScreenLocked():
-        return (browser.oobe and
-            browser.oobe.EvaluateJavaScript("typeof Oobe == 'function'") and
-            browser.oobe.EvaluateJavaScript(
-            "typeof Oobe.authenticateForTesting == 'function'"))
-      util.WaitFor(ScreenLocked, 10)
-      self.assertTrue(self._IsScreenLocked(browser))
-
-  def _AttemptUnlockBadPassword(self, browser):
-      logging.info('Trying a bad password')
-      def ErrorBubbleVisible():
-        return not browser.oobe.EvaluateJavaScript('''
-            document.getElementById('bubble').hidden
-        ''')
-      self.assertFalse(ErrorBubbleVisible())
-      browser.oobe.ExecuteJavaScript('''
-          Oobe.authenticateForTesting('%s', 'bad');
-      ''' % self._username)
-      util.WaitFor(ErrorBubbleVisible, 10)
-      self.assertTrue(self._IsScreenLocked(browser))
-
-  def _UnlockScreen(self, browser):
-      logging.info('Unlocking')
-      browser.oobe.ExecuteJavaScript('''
-          Oobe.authenticateForTesting('%s', '%s');
-      ''' % (self._username, self._password))
-      util.WaitFor(lambda: not browser.oobe, 10)
-      self.assertFalse(self._IsScreenLocked(browser))
-
-  def testScreenLock(self):
-    """Tests autotestPrivate.screenLock"""
-    with self._CreateBrowser(autotest_ext=True) as browser:
-      self._LockScreen(browser)
-      self._AttemptUnlockBadPassword(browser)
-      self._UnlockScreen(browser)
-
-  def testLogout(self):
-    """Tests autotestPrivate.logout"""
-    with self._CreateBrowser(autotest_ext=True) as b:
-      extension = self._GetAutotestExtension(b)
-      try:
-        extension.ExecuteJavaScript('chrome.autotestPrivate.logout();')
-      except (exceptions.BrowserConnectionGoneException,
-              exceptions.BrowserGoneException):
-        pass
-      util.WaitFor(lambda: not self._IsCryptohomeMounted(), 20)
-
-  def _SwitchRegion(self, region):
-    self._cri.RunCmdOnDevice(['stop', 'ui'])
-
-    # Change VPD (requires RW-enabled firmware).
-    # To save time, region and initial_timezone are not set.
-    vpd = {'initial_locale': region.language_code,
-           'keyboard_layout': region.keyboard}
-
-    for (key, value) in vpd.items():
-      self._cri.RunCmdOnDevice(['vpd', '-s', '"%s"="%s"' % (key, value)])
-
-    # Remove cached files to clear initial locale info and force regeneration.
-    self._cri.RunCmdOnDevice(['rm', '/home/chronos/Local\ State'])
-    self._cri.RunCmdOnDevice(['rm', '/home/chronos/.oobe_completed'])
-    self._cri.RunCmdOnDevice(['dump_vpd_log', '--force'])
-
-    self._cri.RunCmdOnDevice(['start', 'ui'])
-
-  def _OobeHasOption(self, browser, selectId, value):
-    hasOptionJs = '''
-      // Check that the option is present, and selected if it is the default.
-      (function hasOption(selectId, value, isDefault) {
-        var options = document.getElementById(selectId).options;
-        for (var i = 0; i < options.length; i++) {
-          if (options[i].value == value) {
-            // The option is present. Make sure it's selected if necessary.
-            return !isDefault || options.selectedIndex == i;
-          }
-        }
-        return false;
-      })("%s", "%s", %s);
-    '''
-    return browser.oobe.EvaluateJavaScript(
-        hasOptionJs % (selectId, value, 'true'))
-
-  def _ResolveLanguage(self, locale):
-    # If the locale matches a language but not the country, fall back to
-    # an existing locale. See ui/base/l10n/l10n_util.cc.
-    lang, _, region = map(str.lower, locale.partition('-'))
-    if not region:
-      return ""
-
-    # Map from other countries to a localized country
-    if lang == 'es' and region == 'es':
-      return 'es-419'
-    if lang == 'zh':
-      if region in ('hk', 'mo'):
-        return 'zh-TW'
-      return 'zh-CN'
-    if lang == 'en':
-      if region in ('au', 'ca', 'nz', 'za'):
-        return 'en-GB'
-      return 'en-US'
-
-    # No mapping found
-    return ""
-
-  def testOobeLocalization(self):
-    """Tests different region configurations at OOBE"""
-    # Save the original device localization settings.
-    # To save time, only read initial_locale and keyboard_layout.
-    initial_region = self.Region('', '', '', '', '')
-    initial_region.language_code, _ = self._cri.RunCmdOnDevice(
-        ['vpd', '-g', 'initial_locale'])
-    initial_region.keyboard, _ = self._cri.RunCmdOnDevice(
-        ['vpd', '-g', 'keyboard_layout'])
-
-    for region in self.REGIONS_LIST:
-      self._SwitchRegion(region)
-      with self._CreateBrowser(auto_login=False) as browser:
-        # Ensure the dropdown lists have been created.
-        util.WaitFor(lambda: browser.oobe.EvaluateJavaScript(
-                     'document.getElementById("language-select") != null'),
-                     10)
-
-        # Find the language, or an acceptable fallback value.
-        languageFound = self._OobeHasOption(browser,
-                                            'language-select',
-                                            region.language_code)
-        if not languageFound:
-          fallback = self._ResolveLanguage(region.language_code)
-          self.assertTrue(fallback and
-                          self._OobeHasOption(browser,
-                                              'language-select',
-                                              fallback))
-
-        # Find the keyboard layout.
-        self.assertTrue(self._OobeHasOption(
-            browser, 'keyboard-select', region.keyboard))
-
-    # Test is finished. Restore original region settings.
-    self._SwitchRegion(initial_region)
-
-  # The Region class and region list will be available in regions.py.
-  class Region(object):
-    def __init__(self, region_code, keyboard, time_zone, language_code,
-                 keyboard_mechanical_layout, description=None, notes=None):
-      self.region_code = region_code
-      self.keyboard = keyboard
-      self.time_zone = time_zone
-      self.language_code = language_code
-      self.keyboard_mechanical_layout = keyboard_mechanical_layout
-      self.description = description or region_code
-      self.notes = notes
-
-  class Enum(frozenset):
-    def __getattr__(self, name):
-      if name in self:
-        return name
-      raise AttributeError
-
-  KeyboardMechanicalLayout = Enum(['ANSI', 'ISO', 'JIS', 'ABNT2'])
-  _KML = KeyboardMechanicalLayout
-  REGIONS_LIST = [
-    Region('au', 'xkb:us::eng', 'Australia/Sydney', 'en-AU', _KML.ANSI,
-           'Australia'),
-    Region('ca.ansi', 'xkb:us::eng', 'America/Toronto', 'en-CA', _KML.ANSI,
-           'Canada (US keyboard)',
-           'Canada with US (ANSI) keyboard; see http://goto/cros-canada'),
-    Region('ca.fr', 'xkb:ca::fra', 'America/Toronto', 'fr-CA', _KML.ISO,
-           'Canada (French keyboard)',
-           ('Canadian French (ISO) keyboard. The most common configuration for '
-            'Canadian French SKUs.  See http://goto/cros-canada')),
-    Region('ca.hybrid', 'xkb:ca:eng:eng', 'America/Toronto', 'en-CA', _KML.ISO,
-           'Canada (hybrid)',
-           ('Canada with hybrid xkb:ca:eng:eng + xkb:ca::fra keyboard (ISO), '
-            'defaulting to English language and keyboard.  Used only if there '
-            'needs to be a single SKU for all of Canada.  See '
-            'http://goto/cros-canada')),
-    Region('ca.multix', 'xkb:ca:multix:fra', 'America/Toronto', 'fr-CA',
-           _KML.ISO, 'Canada (multilingual)',
-           ("Canadian Multilingual keyboard; you probably don't want this. See "
-            "http://goto/cros-canada")),
-    Region('de', 'xkb:de::ger', 'Europe/Berlin', 'de', _KML.ISO, 'Germany'),
-    Region('fi', 'xkb:fi::fin', 'Europe/Helsinki', 'fi', _KML.ISO, 'Finland'),
-    Region('fr', 'xkb:fr::fra', 'Europe/Paris', 'fr', _KML.ISO, 'France'),
-    Region('gb', 'xkb:gb:extd:eng', 'Europe/London', 'en-GB', _KML.ISO, 'UK'),
-    Region('ie', 'xkb:gb:extd:eng', 'Europe/Dublin', 'en-GB', _KML.ISO,
-           'Ireland'),
-    Region('in', 'xkb:us::eng', 'Asia/Calcutta', 'en-US', _KML.ANSI, 'India'),
-    Region('my', 'xkb:us::eng', 'Asia/Kuala_Lumpur', 'ms', _KML.ANSI,
-           'Malaysia'),
-    Region('nl', 'xkb:us:intl:eng', 'Europe/Amsterdam', 'nl', _KML.ANSI,
-           'Netherlands'),
-    Region('nordic', 'xkb:se::swe', 'Europe/Stockholm', 'en-US', _KML.ISO,
-           'Nordics',
-           ('Unified SKU for Sweden, Norway, and Denmark.  This defaults '
-            'to Swedish keyboard layout, but starts with US English language '
-            'for neutrality.  Use if there is a single combined SKU for Nordic '
-            'countries.')),
-    Region('se', 'xkb:se::swe', 'Europe/Stockholm', 'sv', _KML.ISO, 'Sweden',
-           ("Use this if there separate SKUs for Nordic countries (Sweden, "
-            "Norway, and Denmark), or the device is only shipping to Sweden. "
-            "If there is a single unified SKU, use 'nordic' instead.")),
-    Region('sg', 'xkb:us::eng', 'Asia/Singapore', 'en-GB', _KML.ANSI,
-           'Singapore'),
-    Region('us', 'xkb:us::eng', 'America/Los_Angeles', 'en-US', _KML.ANSI,
-           'United States'),
-  ]
diff --git a/chrome/test/telemetry/run_cros_tests b/chrome/test/telemetry/run_cros_tests
deleted file mode 100755
index c95ead7..0000000
--- a/chrome/test/telemetry/run_cros_tests
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env python
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-import os
-import sys
-
-from telemetry_lib import telemetry
-from telemetry.unittest import gtest_testrunner
-from telemetry.unittest import run_tests
-
-if __name__ == '__main__':
-  top_level_dir = os.path.abspath(os.path.dirname(__file__))
-  runner = gtest_testrunner.GTestTestRunner(print_result_after_run=False)
-  ret = run_tests.Main(sys.argv[1:], '.', top_level_dir, runner)
-
-  if runner.result:
-    runner.result.PrintSummary()
-    sys.exit(min(ret + runner.result.num_errors, 255))
-  else:
-    sys.exit(ret)
diff --git a/chrome/test/telemetry/telemetry_lib.py b/chrome/test/telemetry/telemetry_lib.py
deleted file mode 100644
index eee54240..0000000
--- a/chrome/test/telemetry/telemetry_lib.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-from __future__ import absolute_import
-
-import os
-import sys
-
-path = os.path.join(os.path.dirname(__file__),
-                    '..', '..', '..', 'tools', 'telemetry')
-sys.path.append(path)
-import telemetry
-sys.path.pop()
diff --git a/chrome/utility/safe_browsing/OWNERS b/chrome/utility/safe_browsing/OWNERS
index d66ebf6..064fa74 100644
--- a/chrome/utility/safe_browsing/OWNERS
+++ b/chrome/utility/safe_browsing/OWNERS
@@ -1,3 +1,3 @@
 mattm@chromium.org
-noelutz@google.com
+nparker@chromium.org
 shess@chromium.org
diff --git a/chromecast/browser/cast_permission_manager.cc b/chromecast/browser/cast_permission_manager.cc
index 047a6ff5..a0d10f2 100644
--- a/chromecast/browser/cast_permission_manager.cc
+++ b/chromecast/browser/cast_permission_manager.cc
@@ -18,22 +18,18 @@
 CastPermissionManager::~CastPermissionManager() {
 }
 
-void CastPermissionManager::RequestPermission(
+int CastPermissionManager::RequestPermission(
     content::PermissionType permission,
     content::RenderFrameHost* render_frame_host,
-    int request_id,
     const GURL& origin,
     bool user_gesture,
     const base::Callback<void(content::PermissionStatus)>& callback) {
   LOG(INFO) << __FUNCTION__ << ": " << static_cast<int>(permission);
   callback.Run(content::PermissionStatus::PERMISSION_STATUS_GRANTED);
+  return kNoPendingOperation;
 }
 
-void CastPermissionManager::CancelPermissionRequest(
-    content::PermissionType permission,
-    content::RenderFrameHost* render_frame_host,
-    int request_id,
-    const GURL& origin) {
+void CastPermissionManager::CancelPermissionRequest(int request_id) {
 }
 
 void CastPermissionManager::ResetPermission(
@@ -61,7 +57,7 @@
     const GURL& requesting_origin,
     const GURL& embedding_origin,
     const base::Callback<void(content::PermissionStatus)>& callback) {
-  return -1;
+  return kNoPendingOperation;
 }
 
 void CastPermissionManager::UnsubscribePermissionStatusChange(
diff --git a/chromecast/browser/cast_permission_manager.h b/chromecast/browser/cast_permission_manager.h
index 237eff9..cb84c6a 100644
--- a/chromecast/browser/cast_permission_manager.h
+++ b/chromecast/browser/cast_permission_manager.h
@@ -18,17 +18,13 @@
   ~CastPermissionManager() override;
 
   // content::PermissionManager implementation:
-  void RequestPermission(
+  int RequestPermission(
       content::PermissionType permission,
       content::RenderFrameHost* render_frame_host,
-      int request_id,
       const GURL& requesting_origin,
       bool user_gesture,
       const base::Callback<void(content::PermissionStatus)>& callback) override;
-  void CancelPermissionRequest(content::PermissionType permission,
-                               content::RenderFrameHost* render_frame_host,
-                               int request_id,
-                               const GURL& requesting_origin) override;
+  void CancelPermissionRequest(int request_id) override;
   void ResetPermission(content::PermissionType permission,
                        const GURL& requesting_origin,
                        const GURL& embedding_origin) override;
diff --git a/chromecast/media/audio/cast_audio_manager.cc b/chromecast/media/audio/cast_audio_manager.cc
index 0955372..5aef07c 100644
--- a/chromecast/media/audio/cast_audio_manager.cc
+++ b/chromecast/media/audio/cast_audio_manager.cc
@@ -6,6 +6,7 @@
 
 #include "chromecast/base/task_runner_impl.h"
 #include "chromecast/media/audio/cast_audio_output_stream.h"
+#include "chromecast/media/base/media_message_loop.h"
 #include "chromecast/public/cast_media_shlib.h"
 #include "chromecast/public/media/media_pipeline_backend.h"
 #include "chromecast/public/media/media_pipeline_device_params.h"
@@ -61,13 +62,13 @@
 
 scoped_ptr<MediaPipelineBackend>
 CastAudioManager::CreateMediaPipelineBackend() {
-  DCHECK(GetTaskRunner()->BelongsToCurrentThread());
+  DCHECK(media::MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread());
 
-  if (!audio_task_runner_)
-    audio_task_runner_.reset(new TaskRunnerImpl());
+  if (!backend_task_runner_)
+    backend_task_runner_.reset(new TaskRunnerImpl());
 
   MediaPipelineDeviceParams device_params(
-      MediaPipelineDeviceParams::kModeIgnorePts, audio_task_runner_.get());
+      MediaPipelineDeviceParams::kModeIgnorePts, backend_task_runner_.get());
   return scoped_ptr<MediaPipelineBackend>(
       CastMediaShlib::CreateMediaPipelineBackend(device_params));
 }
diff --git a/chromecast/media/audio/cast_audio_manager.h b/chromecast/media/audio/cast_audio_manager.h
index 4f855e9..ff3bc43 100644
--- a/chromecast/media/audio/cast_audio_manager.h
+++ b/chromecast/media/audio/cast_audio_manager.h
@@ -30,8 +30,8 @@
   ::media::AudioParameters GetInputStreamParameters(
       const std::string& device_id) override;
 
-  // This must be called on audio thread.
-  // See AudioManager::GetTaskRunner.
+  // This must be called on cast media thread.
+  // See chromecast::media::MediaMessageLoop.
   virtual scoped_ptr<MediaPipelineBackend> CreateMediaPipelineBackend();
 
  private:
@@ -51,7 +51,7 @@
       const std::string& output_device_id,
       const ::media::AudioParameters& input_params) override;
 
-  scoped_ptr<TaskRunnerImpl> audio_task_runner_;
+  scoped_ptr<TaskRunnerImpl> backend_task_runner_;
 
   DISALLOW_COPY_AND_ASSIGN(CastAudioManager);
 };
diff --git a/chromecast/media/audio/cast_audio_output_stream.cc b/chromecast/media/audio/cast_audio_output_stream.cc
index d2de208..bb7a54e 100644
--- a/chromecast/media/audio/cast_audio_output_stream.cc
+++ b/chromecast/media/audio/cast_audio_output_stream.cc
@@ -5,9 +5,11 @@
 #include "chromecast/media/audio/cast_audio_output_stream.h"
 
 #include "base/bind.h"
-#include "base/thread_task_runner_handle.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/threading/thread_checker.h"
 #include "chromecast/base/metrics/cast_metrics_helper.h"
 #include "chromecast/media/audio/cast_audio_manager.h"
+#include "chromecast/media/base/media_message_loop.h"
 #include "chromecast/media/cma/base/cast_decoder_buffer_impl.h"
 #include "chromecast/media/cma/base/decoder_buffer_adapter.h"
 #include "chromecast/media/cma/pipeline/frame_status_cb_impl.h"
@@ -16,7 +18,7 @@
 #include "chromecast/public/media/decrypt_context.h"
 #include "chromecast/public/media/media_clock_device.h"
 #include "chromecast/public/media/media_pipeline_backend.h"
-#include "media/audio/fake_audio_worker.h"
+#include "media/base/bind_to_current_loop.h"
 #include "media/base/decoder_buffer.h"
 
 namespace chromecast {
@@ -63,13 +65,115 @@
 }
 }  // namespace
 
+// Backend represents a MediaPipelineBackend adapter that runs on cast
+// media thread (media::MediaMessageLoop::GetTaskRunner).
+// It can be created and destroyed on any thread, but all other member functions
+// must be called on a single thread.
+class CastAudioOutputStream::Backend {
+ public:
+  typedef base::Callback<void(bool)> PushFrameCompletionCallback;
+
+  Backend(const ::media::AudioParameters& audio_params)
+      : audio_params_(audio_params) {
+    thread_checker_.DetachFromThread();
+  }
+  ~Backend() {}
+
+  void Open(CastAudioManager* audio_manager,
+            bool* success,
+            base::WaitableEvent* completion_event) {
+    DCHECK(thread_checker_.CalledOnValidThread());
+    DCHECK(backend_ == nullptr);
+
+    scoped_ptr<MediaPipelineBackend> pipeline_backend =
+        audio_manager->CreateMediaPipelineBackend();
+    if (pipeline_backend && InitClockDevice(pipeline_backend->GetClock()) &&
+        InitAudioDevice(audio_params_, pipeline_backend->GetAudio())) {
+      backend_ = pipeline_backend.Pass();
+    }
+    *success = backend_ != nullptr;
+    completion_event->Signal();
+  }
+
+  void Close() {
+    DCHECK(thread_checker_.CalledOnValidThread());
+
+    if (backend_) {
+      backend_->GetClock()->SetState(MediaClockDevice::kStateIdle);
+      backend_->GetAudio()->SetState(AudioPipelineDevice::kStateIdle);
+    }
+    backend_.reset();
+  }
+
+  void Start() {
+    DCHECK(thread_checker_.CalledOnValidThread());
+
+    MediaClockDevice* clock_device = backend_->GetClock();
+    clock_device->SetState(MediaClockDevice::kStateRunning);
+    clock_device->SetRate(1.0f);
+
+    AudioPipelineDevice* audio_device = backend_->GetAudio();
+    audio_device->SetState(AudioPipelineDevice::kStateRunning);
+  }
+
+  void Stop() {
+    DCHECK(thread_checker_.CalledOnValidThread());
+
+    MediaClockDevice* clock_device = backend_->GetClock();
+    clock_device->SetRate(0.0f);
+  }
+
+  void PushFrame(scoped_refptr<media::DecoderBufferBase> decoder_buffer,
+                 const PushFrameCompletionCallback& completion_cb) {
+    DCHECK(thread_checker_.CalledOnValidThread());
+
+    AudioPipelineDevice* audio_device = backend_->GetAudio();
+    MediaComponentDevice::FrameStatus status =
+        audio_device->PushFrame(nullptr,  // decrypt_context
+                                new CastDecoderBufferImpl(decoder_buffer),
+                                new media::FrameStatusCBImpl(base::Bind(
+                                    &Backend::OnPushFrameStatus,
+                                    base::Unretained(this), completion_cb)));
+
+    if (status != MediaComponentDevice::kFramePending)
+      OnPushFrameStatus(completion_cb, status);
+  }
+
+  void SetVolume(double volume) {
+    DCHECK(thread_checker_.CalledOnValidThread());
+
+    AudioPipelineDevice* audio_device = backend_->GetAudio();
+    audio_device->SetStreamVolumeMultiplier(volume);
+  }
+
+ private:
+  void OnPushFrameStatus(const PushFrameCompletionCallback& completion_cb,
+                         MediaComponentDevice::FrameStatus status) {
+    DCHECK(thread_checker_.CalledOnValidThread());
+    DCHECK_NE(status, MediaComponentDevice::kFramePending);
+
+    completion_cb.Run(status == MediaComponentDevice::kFrameSuccess);
+  }
+
+  const ::media::AudioParameters audio_params_;
+  scoped_ptr<MediaPipelineBackend> backend_;
+  base::ThreadChecker thread_checker_;
+  DISALLOW_COPY_AND_ASSIGN(Backend);
+};
+
+// CastAudioOutputStream runs on audio thread (AudioManager::GetTaskRunner).
 CastAudioOutputStream::CastAudioOutputStream(
     const ::media::AudioParameters& audio_params,
     CastAudioManager* audio_manager)
     : audio_params_(audio_params),
       audio_manager_(audio_manager),
       volume_(1.0),
-      audio_device_busy_(false),
+      source_callback_(nullptr),
+      backend_(new Backend(audio_params)),
+      backend_busy_(false),
+      buffer_duration_(audio_params.GetBufferDuration()),
+      audio_task_runner_(audio_manager->GetTaskRunner()),
+      backend_task_runner_(media::MediaMessageLoop::GetTaskRunner()),
       weak_factory_(this) {
   VLOG(1) << "CastAudioOutputStream " << this << " created with "
           << audio_params_.AsHumanReadableString();
@@ -78,6 +182,8 @@
 CastAudioOutputStream::~CastAudioOutputStream() {}
 
 bool CastAudioOutputStream::Open() {
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
+
   ::media::AudioParameters::Format format = audio_params_.format();
   DCHECK((format == ::media::AudioParameters::AUDIO_PCM_LINEAR) ||
          (format == ::media::AudioParameters::AUDIO_PCM_LOW_LATENCY));
@@ -91,153 +197,138 @@
   DCHECK_GE(audio_params_.channels(), 1);
   DCHECK_LE(audio_params_.channels(), 2);
 
-  media_pipeline_backend_ = audio_manager_->CreateMediaPipelineBackend();
-  if (!media_pipeline_backend_) {
-    LOG(WARNING) << "Failed to create media pipeline backend.";
-    return false;
-  }
+  {
+    // Wait until the backend has initialized so that the outcome can be
+    // communicated to the client.
+    bool success = false;
+    base::WaitableEvent completion_event(false, false);
+    backend_task_runner_->PostTask(
+        FROM_HERE, base::Bind(&Backend::Open, base::Unretained(backend_.get()),
+                              audio_manager_, &success, &completion_event));
+    completion_event.Wait();
 
-  if (!InitClockDevice(media_pipeline_backend_->GetClock())) {
-    LOG(WARNING) << "Failed to initialize clock device.";
-    return false;
+    if (!success) {
+      LOG(WARNING) << "Failed to create media pipeline backend.";
+      return false;
+    }
   }
-
-  if (!InitAudioDevice(audio_params_, media_pipeline_backend_->GetAudio())) {
-    LOG(WARNING) << "Failed to initialize audio device.";
-    return false;
-  }
-
   audio_bus_ = ::media::AudioBus::Create(audio_params_);
-  audio_worker_.reset(new ::media::FakeAudioWorker(
-      base::ThreadTaskRunnerHandle::Get(), audio_params_));
+  decoder_buffer_ = new DecoderBufferAdapter(
+      new ::media::DecoderBuffer(audio_params_.GetBytesPerBuffer()));
 
   VLOG(1) << __FUNCTION__ << " : " << this;
   return true;
 }
 
 void CastAudioOutputStream::Close() {
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
+
   VLOG(1) << __FUNCTION__ << " : " << this;
-
-  if (media_pipeline_backend_) {
-    media_pipeline_backend_->GetClock()->SetState(MediaClockDevice::kStateIdle);
-    media_pipeline_backend_->GetAudio()->SetState(
-        AudioPipelineDevice::kStateIdle);
-  }
-
-  audio_worker_.reset();
-  audio_bus_.reset();
-  media_pipeline_backend_.reset();
-
-  // Signal to the manager that we're closed and can be removed.
-  // This should be the last call in the function as it deletes "this".
-  audio_manager_->ReleaseOutputStream(this);
+  backend_task_runner_->PostTaskAndReply(
+      FROM_HERE, base::Bind(&Backend::Close, base::Unretained(backend_.get())),
+      base::Bind(&CastAudioOutputStream::OnClosed, base::Unretained(this)));
 }
 
 void CastAudioOutputStream::Start(AudioSourceCallback* source_callback) {
-  MediaClockDevice* clock_device = media_pipeline_backend_->GetClock();
-  DCHECK(clock_device);
-  if (!clock_device->SetState(MediaClockDevice::kStateRunning)) {
-    LOG(WARNING) << "Failed to run clock device.";
-    return;
-  }
-  clock_device->SetRate(1.0f);
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
+  DCHECK(source_callback);
 
-  AudioPipelineDevice* audio_device = media_pipeline_backend_->GetAudio();
-  DCHECK(audio_device);
-  if (!audio_device->SetState(AudioPipelineDevice::kStateRunning)) {
-    LOG(WARNING) << "Failed to run audio device.";
-    return;
-  }
+  source_callback_ = source_callback;
+  backend_task_runner_->PostTask(
+      FROM_HERE, base::Bind(&Backend::Start, base::Unretained(backend_.get())));
 
-  VLOG(1) << __FUNCTION__ << " : " << this;
-  audio_worker_->Start(base::Bind(&CastAudioOutputStream::PushFrame,
-                                  weak_factory_.GetWeakPtr(), source_callback));
+  next_push_time_ = base::TimeTicks::Now();
+  if (!backend_busy_) {
+    audio_task_runner_->PostTask(FROM_HERE,
+                                 base::Bind(&CastAudioOutputStream::PushFrame,
+                                            weak_factory_.GetWeakPtr()));
+  }
 
   metrics::CastMetricsHelper::GetInstance()->LogTimeToFirstAudio();
 }
 
 void CastAudioOutputStream::Stop() {
-  VLOG(1) << __FUNCTION__ << " : " << this;
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
 
-  MediaClockDevice* clock_device = media_pipeline_backend_->GetClock();
-  DCHECK(clock_device);
-  clock_device->SetState(MediaClockDevice::kStateIdle);
-  clock_device->SetRate(0.0f);
-
-  AudioPipelineDevice* audio_device = media_pipeline_backend_->GetAudio();
-  DCHECK(audio_device);
-  audio_device->SetState(AudioPipelineDevice::kStatePaused);
-  audio_worker_->Stop();
-  audio_device_busy_ = false;
+  source_callback_ = nullptr;
+  backend_task_runner_->PostTask(
+      FROM_HERE, base::Bind(&Backend::Stop, base::Unretained(backend_.get())));
 }
 
 void CastAudioOutputStream::SetVolume(double volume) {
-  AudioPipelineDevice* audio_device = media_pipeline_backend_->GetAudio();
-  DCHECK(audio_device);
-  audio_device->SetStreamVolumeMultiplier(volume);
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
+
   volume_ = volume;
+  backend_task_runner_->PostTask(
+      FROM_HERE, base::Bind(&Backend::SetVolume,
+                            base::Unretained(backend_.get()), volume));
 }
 
 void CastAudioOutputStream::GetVolume(double* volume) {
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
+
   *volume = volume_;
 }
 
-void CastAudioOutputStream::PushFrame(AudioSourceCallback* source_callback) {
-  DCHECK(source_callback);
-  if (audio_device_busy_) {
-    // Skip pulling data if audio device is still busy.
-    LOG(WARNING) << __FUNCTION__ << " : " << this
-                 << " skipped because audio device is busy.";
+void CastAudioOutputStream::OnClosed() {
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
+
+  VLOG(1) << __FUNCTION__ << " : " << this;
+  // Signal to the manager that we're closed and can be removed.
+  // This should be the last call in the function as it deletes "this".
+  audio_manager_->ReleaseOutputStream(this);
+}
+
+void CastAudioOutputStream::PushFrame() {
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
+  DCHECK(!backend_busy_);
+
+  if (!source_callback_)
+    return;
+
+  uint32_t bytes_delay = 0;
+  int frame_count = source_callback_->OnMoreData(audio_bus_.get(), bytes_delay);
+  VLOG(3) << "frames_filled=" << frame_count << " with latency=" << bytes_delay;
+
+  DCHECK_EQ(frame_count, audio_bus_->frames());
+  DCHECK_EQ(static_cast<int>(decoder_buffer_->data_size()),
+            frame_count * audio_params_.GetBytesPerFrame());
+  audio_bus_->ToInterleaved(frame_count, audio_params_.bits_per_sample() / 8,
+                            decoder_buffer_->writable_data());
+
+  auto completion_cb = ::media::BindToCurrentLoop(base::Bind(
+      &CastAudioOutputStream::OnPushFrameComplete, weak_factory_.GetWeakPtr()));
+  backend_task_runner_->PostTask(
+      FROM_HERE,
+      base::Bind(&Backend::PushFrame, base::Unretained(backend_.get()),
+                 decoder_buffer_, completion_cb));
+  backend_busy_ = true;
+}
+
+void CastAudioOutputStream::OnPushFrameComplete(bool success) {
+  DCHECK(audio_task_runner_->BelongsToCurrentThread());
+
+  backend_busy_ = false;
+  if (!source_callback_)
+    return;
+
+  if (!success) {
+    source_callback_->OnError(this);
     return;
   }
 
-  int frame_count = source_callback->OnMoreData(audio_bus_.get(), 0);
-  DCHECK_EQ(frame_count, audio_bus_->frames());
-  int buffer_size = frame_count * audio_params_.GetBytesPerFrame();
-  scoped_refptr<::media::DecoderBuffer> decoder_buffer(
-      new ::media::DecoderBuffer(buffer_size));
-  audio_bus_->ToInterleaved(frame_count, audio_params_.bits_per_sample() / 8,
-                            decoder_buffer->writable_data());
+  // Schedule next push frame.
+  // Need to account for time spent in pulling and pushing frame as well
+  // as the imprecision of PostDelayedTask().
+  const base::TimeTicks now = base::TimeTicks::Now();
+  base::TimeDelta delay = next_push_time_ + buffer_duration_ - now;
+  delay = std::max(delay, base::TimeDelta());
+  next_push_time_ = now + delay;
 
-  AudioPipelineDevice* audio_device = media_pipeline_backend_->GetAudio();
-  DCHECK(audio_device);
-  MediaComponentDevice::FrameStatus status = audio_device->PushFrame(
-      nullptr,  // decrypt_context
-      new CastDecoderBufferImpl(new DecoderBufferAdapter(decoder_buffer)),
-      new media::FrameStatusCBImpl(
-          base::Bind(&CastAudioOutputStream::OnPushFrameStatus,
-                     weak_factory_.GetWeakPtr(), source_callback)));
-
-  if (status == MediaComponentDevice::kFrameFailed) {
-    // Note: We cannot call OnPushFrameError directly because it will lead to
-    // a recursive lock, which is not supported by base::Lock.
-    // This callback is called with a lock held inside FakeAudioWorker.
-    // Calling FakeAudioWorker::Stop will try to acquire the lock again.
-    base::ThreadTaskRunnerHandle::Get()->PostTask(
-        FROM_HERE, base::Bind(&CastAudioOutputStream::OnPushFrameError,
-                              weak_factory_.GetWeakPtr(), source_callback));
-  } else if (status == MediaComponentDevice::kFramePending) {
-    audio_device_busy_ = true;
-  }
-}
-
-void CastAudioOutputStream::OnPushFrameStatus(
-    AudioSourceCallback* source_callback,
-    MediaComponentDevice::FrameStatus status) {
-  DCHECK(audio_device_busy_);
-  audio_device_busy_ = false;
-
-  DCHECK_NE(status, MediaComponentDevice::kFramePending);
-  if (status == MediaComponentDevice::kFrameFailed)
-    OnPushFrameError(source_callback);
-}
-
-void CastAudioOutputStream::OnPushFrameError(
-    AudioSourceCallback* source_callback) {
-  LOG(WARNING) << __FUNCTION__ << " : " << this;
-  // Inform audio source about the error and stop pulling data.
-  audio_worker_->Stop();
-  source_callback->OnError(this);
+  audio_task_runner_->PostDelayedTask(
+      FROM_HERE,
+      base::Bind(&CastAudioOutputStream::PushFrame, weak_factory_.GetWeakPtr()),
+      delay);
 }
 
 }  // namespace media
diff --git a/chromecast/media/audio/cast_audio_output_stream.h b/chromecast/media/audio/cast_audio_output_stream.h
index b659487..c8ef69cf 100644
--- a/chromecast/media/audio/cast_audio_output_stream.h
+++ b/chromecast/media/audio/cast_audio_output_stream.h
@@ -7,19 +7,19 @@
 
 #include "base/macros.h"
 #include "base/memory/weak_ptr.h"
-#include "chromecast/public/media/media_component_device.h"
+#include "base/time/time.h"
 #include "media/audio/audio_io.h"
 #include "media/audio/audio_parameters.h"
 
-namespace media {
-class FakeAudioWorker;
-}  // namespace media
+namespace base {
+class SingleThreadTaskRunner;
+}  // namespace base
 
 namespace chromecast {
 namespace media {
 
 class CastAudioManager;
-class MediaPipelineBackend;
+class DecoderBufferBase;
 
 class CastAudioOutputStream : public ::media::AudioOutputStream {
  public:
@@ -36,20 +36,26 @@
   void GetVolume(double* volume) override;
 
  private:
-  // Task to push frame into audio pipeline device.
-  void PushFrame(AudioSourceCallback* source_callback);
-  void OnPushFrameStatus(AudioSourceCallback* source_callback,
-                         MediaComponentDevice::FrameStatus status);
-  void OnPushFrameError(AudioSourceCallback* source_callback);
+  class Backend;
 
-  ::media::AudioParameters audio_params_;
-  CastAudioManager* audio_manager_;
+  void OnClosed();
+  void PushFrame();
+  void OnPushFrameComplete(bool success);
+
+  const ::media::AudioParameters audio_params_;
+  CastAudioManager* const audio_manager_;
 
   double volume_;
-  bool audio_device_busy_;
-  scoped_ptr<::media::FakeAudioWorker> audio_worker_;
+  AudioSourceCallback* source_callback_;
   scoped_ptr<::media::AudioBus> audio_bus_;
-  scoped_ptr<MediaPipelineBackend> media_pipeline_backend_;
+  scoped_refptr<media::DecoderBufferBase> decoder_buffer_;
+  scoped_ptr<Backend> backend_;
+  bool backend_busy_;
+  const base::TimeDelta buffer_duration_;
+  base::TimeTicks next_push_time_;
+
+  scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
+  scoped_refptr<base::SingleThreadTaskRunner> backend_task_runner_;
 
   base::WeakPtrFactory<CastAudioOutputStream> weak_factory_;
   DISALLOW_COPY_AND_ASSIGN(CastAudioOutputStream);
diff --git a/chromecast/media/audio/cast_audio_output_stream_unittest.cc b/chromecast/media/audio/cast_audio_output_stream_unittest.cc
index ca5b49a..fdb44aa 100644
--- a/chromecast/media/audio/cast_audio_output_stream_unittest.cc
+++ b/chromecast/media/audio/cast_audio_output_stream_unittest.cc
@@ -2,10 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "base/bind.h"
+#include "base/synchronization/waitable_event.h"
 #include "chromecast/base/metrics/cast_metrics_test_helper.cc"
-#include "chromecast/base/task_runner_impl.h"
 #include "chromecast/media/audio/cast_audio_manager.h"
 #include "chromecast/media/audio/cast_audio_output_stream.h"
+#include "chromecast/media/base/media_message_loop.h"
 #include "chromecast/public/media/audio_pipeline_device.h"
 #include "chromecast/public/media/cast_decoder_buffer.h"
 #include "chromecast/public/media/decoder_config.h"
@@ -19,6 +21,14 @@
 namespace {
 const char kDefaultDeviceId[] = "";
 
+void RunUntilIdle(base::TaskRunner* task_runner) {
+  base::WaitableEvent completion_event(false, false);
+  task_runner->PostTask(FROM_HERE,
+                        base::Bind(&base::WaitableEvent::Signal,
+                                   base::Unretained(&completion_event)));
+  completion_event.Wait();
+}
+
 class FakeClockDevice : public MediaClockDevice {
  public:
   FakeClockDevice() : state_(kStateUninitialized), rate_(0.f) {}
@@ -173,7 +183,9 @@
 
   // CastAudioManager overrides.
   scoped_ptr<MediaPipelineBackend> CreateMediaPipelineBackend() override {
+    DCHECK(media::MediaMessageLoop::GetTaskRunner()->BelongsToCurrentThread());
     DCHECK(!media_pipeline_backend_);
+
     scoped_ptr<FakeMediaPipelineBackend> backend(new FakeMediaPipelineBackend);
     // Cache the backend locally to be used by tests.
     media_pipeline_backend_ = backend.get();
@@ -196,36 +208,33 @@
   FakeMediaPipelineBackend* media_pipeline_backend_;
 };
 
-class AudioOutputStreamTest : public ::testing::Test {
+class CastAudioOutputStreamTest : public ::testing::Test {
  public:
-  AudioOutputStreamTest()
+  CastAudioOutputStreamTest()
       : format_(::media::AudioParameters::AUDIO_PCM_LINEAR),
         channel_layout_(::media::CHANNEL_LAYOUT_MONO),
         sample_rate_(::media::AudioParameters::kAudioCDSampleRate),
         bits_per_sample_(16),
         frames_per_buffer_(256) {}
-  ~AudioOutputStreamTest() override {}
+  ~CastAudioOutputStreamTest() override {}
 
  protected:
   void SetUp() override {
-    message_loop_.reset(new base::MessageLoop());
-    audio_manager_.reset(new FakeAudioManager);
     metrics::InitializeMetricsHelperForTesting();
+
+    audio_manager_.reset(new FakeAudioManager);
+    audio_task_runner_ = audio_manager_->GetTaskRunner();
+    backend_task_runner_ = media::MediaMessageLoop::GetTaskRunner();
   }
 
   void TearDown() override {
     audio_manager_.reset();
-    message_loop_.reset();
   }
 
   ::media::AudioParameters GetAudioParams() {
     return ::media::AudioParameters(format_, channel_layout_, sample_rate_,
                                     bits_per_sample_, frames_per_buffer_);
   }
-  ::media::AudioOutputStream* CreateStream() {
-    return audio_manager_->MakeAudioOutputStream(GetAudioParams(),
-                                                 kDefaultDeviceId);
-  }
   FakeClockDevice* GetClock() {
     MediaPipelineBackend* backend = audio_manager_->media_pipeline_backend();
     return backend ? static_cast<FakeClockDevice*>(backend->GetClock())
@@ -237,9 +246,112 @@
                    : nullptr;
   }
 
-  scoped_ptr<base::MessageLoop> message_loop_;
+  // Synchronous utility functions.
+  ::media::AudioOutputStream* CreateStream() {
+    ::media::AudioOutputStream* stream = nullptr;
+
+    base::WaitableEvent completion_event(false, false);
+    audio_task_runner_->PostTask(
+        FROM_HERE,
+        base::Bind(&CastAudioOutputStreamTest::CreateStreamOnAudioThread,
+                   base::Unretained(this), GetAudioParams(), &stream,
+                   &completion_event));
+    completion_event.Wait();
+
+    return stream;
+  }
+  bool OpenStream(::media::AudioOutputStream* stream) {
+    DCHECK(stream);
+
+    bool success = false;
+    base::WaitableEvent completion_event(false, false);
+    audio_task_runner_->PostTask(
+        FROM_HERE,
+        base::Bind(&CastAudioOutputStreamTest::OpenStreamOnAudioThread,
+                   base::Unretained(this), stream, &success,
+                   &completion_event));
+    completion_event.Wait();
+
+    // Drain the backend task runner so that appropriate states are set on
+    // the backend pipeline devices.
+    RunUntilIdle(backend_task_runner_.get());
+    return success;
+  }
+  void CloseStream(::media::AudioOutputStream* stream) {
+    audio_task_runner_->PostTask(FROM_HERE,
+                                 base::Bind(&::media::AudioOutputStream::Close,
+                                            base::Unretained(stream)));
+    RunUntilIdle(audio_task_runner_.get());
+    RunUntilIdle(backend_task_runner_.get());
+    // Backend task runner may have posted more tasks to the audio task runner.
+    // So we need to drain it once more.
+    RunUntilIdle(audio_task_runner_.get());
+  }
+  void StartStream(
+      ::media::AudioOutputStream* stream,
+      ::media::AudioOutputStream::AudioSourceCallback* source_callback) {
+    audio_task_runner_->PostTask(
+        FROM_HERE, base::Bind(&::media::AudioOutputStream::Start,
+                              base::Unretained(stream), source_callback));
+    // Drain the audio task runner twice so that tasks posted by
+    // media::AudioOutputStream::Start are run as well.
+    RunUntilIdle(audio_task_runner_.get());
+    RunUntilIdle(audio_task_runner_.get());
+    // Drain the backend task runner so that appropriate states are set on
+    // the backend pipeline devices.
+    RunUntilIdle(backend_task_runner_.get());
+    // Drain the audio task runner again to run the tasks posted by the
+    // backend on audio task runner.
+    RunUntilIdle(audio_task_runner_.get());
+  }
+  void StopStream(::media::AudioOutputStream* stream) {
+    audio_task_runner_->PostTask(FROM_HERE,
+                                 base::Bind(&::media::AudioOutputStream::Stop,
+                                            base::Unretained(stream)));
+    RunUntilIdle(audio_task_runner_.get());
+    // Drain the backend task runner so that appropriate states are set on
+    // the backend pipeline devices.
+    RunUntilIdle(backend_task_runner_.get());
+  }
+  void SetStreamVolume(::media::AudioOutputStream* stream, double volume) {
+    audio_task_runner_->PostTask(
+        FROM_HERE, base::Bind(&::media::AudioOutputStream::SetVolume,
+                              base::Unretained(stream), volume));
+    RunUntilIdle(audio_task_runner_.get());
+    // Drain the backend task runner so that appropriate states are set on
+    // the backend pipeline devices.
+    RunUntilIdle(backend_task_runner_.get());
+  }
+  double GetStreamVolume(::media::AudioOutputStream* stream) {
+    double volume = 0.0;
+    audio_task_runner_->PostTask(
+        FROM_HERE, base::Bind(&::media::AudioOutputStream::GetVolume,
+                              base::Unretained(stream), &volume));
+    RunUntilIdle(audio_task_runner_.get());
+    // No need to drain the backend task runner because getting the volume
+    // does not involve posting any task to the backend.
+    return volume;
+  }
+
+  void CreateStreamOnAudioThread(const ::media::AudioParameters& audio_params,
+                                 ::media::AudioOutputStream** stream,
+                                 base::WaitableEvent* completion_event) {
+    DCHECK(audio_task_runner_->BelongsToCurrentThread());
+    *stream = audio_manager_->MakeAudioOutputStream(GetAudioParams(),
+                                                    kDefaultDeviceId);
+    completion_event->Signal();
+  }
+  void OpenStreamOnAudioThread(::media::AudioOutputStream* stream,
+                               bool* success,
+                               base::WaitableEvent* completion_event) {
+    DCHECK(audio_task_runner_->BelongsToCurrentThread());
+    *success = stream->Open();
+    completion_event->Signal();
+  }
+
   scoped_ptr<FakeAudioManager> audio_manager_;
-  scoped_ptr<TaskRunnerImpl> audio_task_runner_;
+  scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_;
+  scoped_refptr<base::SingleThreadTaskRunner> backend_task_runner_;
 
   // AudioParameters used to create AudioOutputStream.
   // Tests can modify these parameters before calling CreateStream.
@@ -250,15 +362,15 @@
   int frames_per_buffer_;
 };
 
-TEST_F(AudioOutputStreamTest, Format) {
+TEST_F(CastAudioOutputStreamTest, Format) {
   ::media::AudioParameters::Format format[] = {
-      ::media::AudioParameters::AUDIO_PCM_LINEAR,
+      //::media::AudioParameters::AUDIO_PCM_LINEAR,
       ::media::AudioParameters::AUDIO_PCM_LOW_LATENCY};
   for (size_t i = 0; i < arraysize(format); ++i) {
     format_ = format[i];
     ::media::AudioOutputStream* stream = CreateStream();
     ASSERT_TRUE(stream);
-    EXPECT_TRUE(stream->Open());
+    EXPECT_TRUE(OpenStream(stream));
 
     FakeAudioPipelineDevice* audio_device = GetAudio();
     ASSERT_TRUE(audio_device);
@@ -267,18 +379,18 @@
     EXPECT_EQ(kSampleFormatS16, audio_config.sample_format);
     EXPECT_FALSE(audio_config.is_encrypted);
 
-    stream->Close();
+    CloseStream(stream);
   }
 }
 
-TEST_F(AudioOutputStreamTest, ChannelLayout) {
+TEST_F(CastAudioOutputStreamTest, ChannelLayout) {
   ::media::ChannelLayout layout[] = {::media::CHANNEL_LAYOUT_MONO,
                                      ::media::CHANNEL_LAYOUT_STEREO};
   for (size_t i = 0; i < arraysize(layout); ++i) {
     channel_layout_ = layout[i];
     ::media::AudioOutputStream* stream = CreateStream();
     ASSERT_TRUE(stream);
-    EXPECT_TRUE(stream->Open());
+    EXPECT_TRUE(OpenStream(stream));
 
     FakeAudioPipelineDevice* audio_device = GetAudio();
     ASSERT_TRUE(audio_device);
@@ -286,44 +398,44 @@
     EXPECT_EQ(::media::ChannelLayoutToChannelCount(channel_layout_),
               audio_config.channel_number);
 
-    stream->Close();
+    CloseStream(stream);
   }
 }
 
-TEST_F(AudioOutputStreamTest, SampleRate) {
+TEST_F(CastAudioOutputStreamTest, SampleRate) {
   sample_rate_ = ::media::AudioParameters::kAudioCDSampleRate;
   ::media::AudioOutputStream* stream = CreateStream();
   ASSERT_TRUE(stream);
-  EXPECT_TRUE(stream->Open());
+  EXPECT_TRUE(OpenStream(stream));
 
   FakeAudioPipelineDevice* audio_device = GetAudio();
   ASSERT_TRUE(audio_device);
   const AudioConfig& audio_config = audio_device->config();
   EXPECT_EQ(sample_rate_, audio_config.samples_per_second);
 
-  stream->Close();
+  CloseStream(stream);
 }
 
-TEST_F(AudioOutputStreamTest, BitsPerSample) {
+TEST_F(CastAudioOutputStreamTest, BitsPerSample) {
   bits_per_sample_ = 16;
   ::media::AudioOutputStream* stream = CreateStream();
   ASSERT_TRUE(stream);
-  EXPECT_TRUE(stream->Open());
+  EXPECT_TRUE(OpenStream(stream));
 
   FakeAudioPipelineDevice* audio_device = GetAudio();
   ASSERT_TRUE(audio_device);
   const AudioConfig& audio_config = audio_device->config();
   EXPECT_EQ(bits_per_sample_ / 8, audio_config.bytes_per_channel);
 
-  stream->Close();
+  CloseStream(stream);
 }
 
-TEST_F(AudioOutputStreamTest, DeviceState) {
+TEST_F(CastAudioOutputStreamTest, DeviceState) {
   ::media::AudioOutputStream* stream = CreateStream();
   ASSERT_TRUE(stream);
   EXPECT_FALSE(GetAudio());
 
-  EXPECT_TRUE(stream->Open());
+  EXPECT_TRUE(OpenStream(stream));
   AudioPipelineDevice* audio_device = GetAudio();
   ASSERT_TRUE(audio_device);
   FakeClockDevice* clock_device = GetClock();
@@ -334,40 +446,39 @@
 
   scoped_ptr<FakeAudioSourceCallback> source_callback(
       new FakeAudioSourceCallback);
-  stream->Start(source_callback.get());
+  StartStream(stream, source_callback.get());
   EXPECT_EQ(AudioPipelineDevice::kStateRunning, audio_device->GetState());
   EXPECT_EQ(MediaClockDevice::kStateRunning, clock_device->GetState());
   EXPECT_EQ(1.f, clock_device->rate());
 
-  stream->Stop();
-  EXPECT_EQ(AudioPipelineDevice::kStatePaused, audio_device->GetState());
-  EXPECT_EQ(MediaClockDevice::kStateIdle, clock_device->GetState());
+  StopStream(stream);
+  EXPECT_EQ(AudioPipelineDevice::kStateRunning, audio_device->GetState());
+  EXPECT_EQ(MediaClockDevice::kStateRunning, clock_device->GetState());
   EXPECT_EQ(0.f, clock_device->rate());
 
-  stream->Close();
+  CloseStream(stream);
   EXPECT_FALSE(GetAudio());
 }
 
-TEST_F(AudioOutputStreamTest, PushFrame) {
+TEST_F(CastAudioOutputStreamTest, PushFrame) {
   ::media::AudioOutputStream* stream = CreateStream();
   ASSERT_TRUE(stream);
-  EXPECT_TRUE(stream->Open());
-
-  scoped_ptr<FakeAudioSourceCallback> source_callback(
-      new FakeAudioSourceCallback);
-  stream->Start(source_callback.get());
+  EXPECT_TRUE(OpenStream(stream));
 
   FakeAudioPipelineDevice* audio_device = GetAudio();
   ASSERT_TRUE(audio_device);
-
+  // Verify initial state.
   EXPECT_EQ(0u, audio_device->pushed_frame_count());
   EXPECT_FALSE(audio_device->last_frame_decrypt_context());
   EXPECT_FALSE(audio_device->last_frame_buffer());
   EXPECT_FALSE(audio_device->last_frame_completion_cb());
 
-  // Let the stream push frames.
-  message_loop_->RunUntilIdle();
+  scoped_ptr<FakeAudioSourceCallback> source_callback(
+      new FakeAudioSourceCallback);
+  StartStream(stream, source_callback.get());
+  StopStream(stream);
 
+  // Verify that the stream pushed frames to the backend.
   EXPECT_LT(0u, audio_device->pushed_frame_count());
   // DecryptContext is always NULL becuase of "raw" audio.
   EXPECT_FALSE(audio_device->last_frame_decrypt_context());
@@ -387,14 +498,13 @@
   // No error must be reported to source callback.
   EXPECT_FALSE(source_callback->error());
 
-  stream->Stop();
-  stream->Close();
+  CloseStream(stream);
 }
 
-TEST_F(AudioOutputStreamTest, DeviceBusy) {
+TEST_F(CastAudioOutputStreamTest, DeviceBusy) {
   ::media::AudioOutputStream* stream = CreateStream();
   ASSERT_TRUE(stream);
-  EXPECT_TRUE(stream->Open());
+  EXPECT_TRUE(OpenStream(stream));
 
   FakeAudioPipelineDevice* audio_device = GetAudio();
   ASSERT_TRUE(audio_device);
@@ -403,25 +513,20 @@
 
   scoped_ptr<FakeAudioSourceCallback> source_callback(
       new FakeAudioSourceCallback);
-  stream->Start(source_callback.get());
-
-  // Let the stream push frames.
-  message_loop_->RunUntilIdle();
+  StartStream(stream, source_callback.get());
 
   // Make sure that one frame was pushed.
   EXPECT_EQ(1u, audio_device->pushed_frame_count());
   // No error must be reported to source callback.
   EXPECT_FALSE(source_callback->error());
 
-  // Sleep for a few frames so that when the message loop is drained
-  // AudioOutputStream would have the opportunity to push more frames.
+  // Sleep for a few frames and verify that more frames were not pushed
+  // because the backend device was busy.
   ::media::AudioParameters audio_params = GetAudioParams();
   base::TimeDelta pause = audio_params.GetBufferDuration() * 5;
   base::PlatformThread::Sleep(pause);
-
-  // Let the stream attempt to push more frames.
-  message_loop_->RunUntilIdle();
-  // But since the device was busy, it must not push more frames.
+  RunUntilIdle(audio_task_runner_.get());
+  RunUntilIdle(backend_task_runner_.get());
   EXPECT_EQ(1u, audio_device->pushed_frame_count());
 
   // Unblock the pipeline and verify that PushFrame resumes.
@@ -430,30 +535,19 @@
   audio_device->last_frame_completion_cb()->Run(
       MediaComponentDevice::kFrameSuccess);
   base::PlatformThread::Sleep(pause);
-  message_loop_->RunUntilIdle();
-  EXPECT_EQ(2u, audio_device->pushed_frame_count());
+  RunUntilIdle(audio_task_runner_.get());
+  RunUntilIdle(backend_task_runner_.get());
+  EXPECT_LT(1u, audio_device->pushed_frame_count());
   EXPECT_FALSE(source_callback->error());
 
-  // Make the pipeline busy again, but this time send kFrameFailed.
-  audio_device->set_pipeline_status(
-      FakeAudioPipelineDevice::PIPELINE_STATUS_BUSY);
-  base::PlatformThread::Sleep(pause);
-  message_loop_->RunUntilIdle();
-  EXPECT_EQ(3u, audio_device->pushed_frame_count());
-  EXPECT_FALSE(source_callback->error());
-
-  audio_device->last_frame_completion_cb()->Run(
-      MediaComponentDevice::kFrameFailed);
-  EXPECT_TRUE(source_callback->error());
-
-  stream->Stop();
-  stream->Close();
+  StopStream(stream);
+  CloseStream(stream);
 }
 
-TEST_F(AudioOutputStreamTest, DeviceError) {
+TEST_F(CastAudioOutputStreamTest, DeviceError) {
   ::media::AudioOutputStream* stream = CreateStream();
   ASSERT_TRUE(stream);
-  EXPECT_TRUE(stream->Open());
+  EXPECT_TRUE(OpenStream(stream));
 
   FakeAudioPipelineDevice* audio_device = GetAudio();
   ASSERT_TRUE(audio_device);
@@ -462,38 +556,34 @@
 
   scoped_ptr<FakeAudioSourceCallback> source_callback(
       new FakeAudioSourceCallback);
-  stream->Start(source_callback.get());
-
-  // Let the stream push frames.
-  message_loop_->RunUntilIdle();
+  StartStream(stream, source_callback.get());
 
   // Make sure that AudioOutputStream attempted to push the initial frame.
   EXPECT_LT(0u, audio_device->pushed_frame_count());
   // AudioOutputStream must report error to source callback.
   EXPECT_TRUE(source_callback->error());
 
-  stream->Stop();
-  stream->Close();
+  StopStream(stream);
+  CloseStream(stream);
 }
 
-TEST_F(AudioOutputStreamTest, Volume) {
+TEST_F(CastAudioOutputStreamTest, Volume) {
   ::media::AudioOutputStream* stream = CreateStream();
   ASSERT_TRUE(stream);
-  ASSERT_TRUE(stream->Open());
+  ASSERT_TRUE(OpenStream(stream));
   FakeAudioPipelineDevice* audio_device = GetAudio();
   ASSERT_TRUE(audio_device);
 
-  double volume = 0.0;
-  stream->GetVolume(&volume);
+  double volume = GetStreamVolume(stream);
   EXPECT_EQ(1.0, volume);
   EXPECT_EQ(1.0f, audio_device->volume_multiplier());
 
-  stream->SetVolume(0.5);
-  stream->GetVolume(&volume);
+  SetStreamVolume(stream, 0.5);
+  volume = GetStreamVolume(stream);
   EXPECT_EQ(0.5, volume);
   EXPECT_EQ(0.5f, audio_device->volume_multiplier());
 
-  stream->Close();
+  CloseStream(stream);
 }
 
 }  // namespace
diff --git a/chromecast/renderer/cast_content_renderer_client.cc b/chromecast/renderer/cast_content_renderer_client.cc
index 63d19cbb..d8a93c5 100644
--- a/chromecast/renderer/cast_content_renderer_client.cc
+++ b/chromecast/renderer/cast_content_renderer_client.cc
@@ -23,7 +23,6 @@
 #include "content/public/renderer/render_frame.h"
 #include "content/public/renderer/render_view.h"
 #include "content/public/renderer/render_view_observer.h"
-#include "crypto/nss_util.h"
 #include "third_party/WebKit/public/platform/WebColor.h"
 #include "third_party/WebKit/public/web/WebSettings.h"
 #include "third_party/WebKit/public/web/WebView.h"
@@ -111,15 +110,6 @@
 
 void CastContentRendererClient::RenderThreadStarted() {
   base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
-#if !defined(USE_OPENSSL)
-  // Note: Copied from chrome_render_process_observer.cc to fix b/8676652.
-  //
-  // On platforms where the system NSS shared libraries are used,
-  // initialize NSS now because it won't be able to load the .so's
-  // after entering the sandbox.
-  if (!command_line->HasSwitch(switches::kSingleProcess))
-    crypto::InitNSSSafely();
-#endif
 
 #if defined(ARCH_CPU_ARM_FAMILY) && !defined(OS_ANDROID)
   PlatformPollFreemem();
diff --git a/components/bubble/bubble_manager.cc b/components/bubble/bubble_manager.cc
index d8883f8..4acc8d7 100644
--- a/components/bubble/bubble_manager.cc
+++ b/components/bubble/bubble_manager.cc
@@ -44,51 +44,15 @@
 bool BubbleManager::CloseBubble(BubbleReference bubble,
                                 BubbleCloseReason reason) {
   DCHECK(thread_checker_.CalledOnValidThread());
-  DCHECK_NE(manager_state_, QUEUE_BUBBLES);
-  if (manager_state_ == SHOW_BUBBLES)
-    manager_state_ = QUEUE_BUBBLES;
-
-  for (auto iter = controllers_.begin(); iter != controllers_.end(); ++iter) {
-    if (*iter == bubble.get()) {
-      bool closed = (*iter)->ShouldClose(reason);
-      if (closed) {
-        (*iter)->DoClose();
-        FOR_EACH_OBSERVER(BubbleManagerObserver, observers_,
-                          OnBubbleClosed((*iter)->AsWeakPtr(), reason));
-        iter = controllers_.erase(iter);
-      }
-      ShowPendingBubbles();
-      return closed;
-    }
-  }
-
-  // Attempting to close a bubble that is already closed or that this manager
-  // doesn't own is a bug.
-  NOTREACHED();
-  return false;
+  return CloseAllMatchingBubbles(bubble.get(), reason);
 }
 
 void BubbleManager::CloseAllBubbles(BubbleCloseReason reason) {
   // The following close reasons don't make sense for multiple bubbles:
   DCHECK_NE(reason, BUBBLE_CLOSE_ACCEPTED);
   DCHECK_NE(reason, BUBBLE_CLOSE_CANCELED);
-
   DCHECK(thread_checker_.CalledOnValidThread());
-  DCHECK_NE(manager_state_, QUEUE_BUBBLES);
-  if (manager_state_ == SHOW_BUBBLES)
-    manager_state_ = QUEUE_BUBBLES;
-
-  for (auto iter = controllers_.begin(); iter != controllers_.end();) {
-    bool closed = (*iter)->ShouldClose(reason);
-    if (closed) {
-      (*iter)->DoClose();
-      FOR_EACH_OBSERVER(BubbleManagerObserver, observers_,
-                        OnBubbleClosed((*iter)->AsWeakPtr(), reason));
-    }
-    iter = closed ? controllers_.erase(iter) : iter + 1;
-  }
-
-  ShowPendingBubbles();
+  CloseAllMatchingBubbles(nullptr, reason);
 }
 
 void BubbleManager::UpdateAllBubbleAnchors() {
@@ -137,3 +101,26 @@
     show_queue_.clear();
   }
 }
+
+bool BubbleManager::CloseAllMatchingBubbles(BubbleController* match,
+                                            BubbleCloseReason reason) {
+  ScopedVector<BubbleController> close_queue;
+
+  for (auto iter = controllers_.begin(); iter != controllers_.end();) {
+    if ((!match || match == *iter) && (*iter)->ShouldClose(reason)) {
+      close_queue.push_back(*iter);
+      iter = controllers_.weak_erase(iter);
+    } else {
+      ++iter;
+    }
+  }
+
+  for (auto controller : close_queue) {
+    controller->DoClose();
+
+    FOR_EACH_OBSERVER(BubbleManagerObserver, observers_,
+                      OnBubbleClosed(controller->AsWeakPtr(), reason));
+  }
+
+  return !close_queue.empty();
+}
diff --git a/components/bubble/bubble_manager.h b/components/bubble/bubble_manager.h
index 5f0d9cf..08429a5 100644
--- a/components/bubble/bubble_manager.h
+++ b/components/bubble/bubble_manager.h
@@ -78,6 +78,12 @@
   // Show any bubbles that were added to |show_queue_|.
   void ShowPendingBubbles();
 
+  // All bubbles will get a close event for the specified |reason| if |match| is
+  // nullptr, otherwise only the bubble held by |match| will get a close event.
+  // Any bubble that is closed will also be deleted.
+  bool CloseAllMatchingBubbles(BubbleController* match,
+                               BubbleCloseReason reason);
+
   base::ObserverList<BubbleManagerObserver> observers_;
 
   // Verify that functions that affect the UI are done on the same thread.
diff --git a/components/bubble/bubble_manager_unittest.cc b/components/bubble/bubble_manager_unittest.cc
index f888987e..c73148f6 100644
--- a/components/bubble/bubble_manager_unittest.cc
+++ b/components/bubble/bubble_manager_unittest.cc
@@ -10,11 +10,20 @@
 
 namespace {
 
+// A "show chain" happens when a bubble decides to show another bubble on close.
+// All bubbles must be iterated to handle a close event. If a bubble shows
+// another bubble while it's being closed, the iterator can get messed up.
 class ChainShowBubbleDelegate : public MockBubbleDelegate {
  public:
+  // |chained_bubble| can be nullptr if not interested in getting a reference to
+  // the chained bubble.
   ChainShowBubbleDelegate(BubbleManager* manager,
-                          scoped_ptr<BubbleDelegate> delegate)
-      : manager_(manager), delegate_(delegate.Pass()), closed_(false) {
+                          scoped_ptr<BubbleDelegate> delegate,
+                          BubbleReference* chained_bubble)
+      : manager_(manager),
+        delegate_(delegate.Pass()),
+        chained_bubble_(chained_bubble),
+        closed_(false) {
     EXPECT_CALL(*this, ShouldClose(testing::_)).WillOnce(testing::Return(true));
   }
 
@@ -22,18 +31,42 @@
 
   void DidClose() override {
     MockBubbleDelegate::DidClose();
-    manager_->ShowBubble(delegate_.Pass());
+    BubbleReference ref = manager_->ShowBubble(delegate_.Pass());
+    if (chained_bubble_)
+      *chained_bubble_ = ref;
     closed_ = true;
   }
 
  private:
   BubbleManager* manager_;
   scoped_ptr<BubbleDelegate> delegate_;
+  BubbleReference* chained_bubble_;
   bool closed_;
 
   DISALLOW_COPY_AND_ASSIGN(ChainShowBubbleDelegate);
 };
 
+// A "close chain" happens when a close event is received while another close
+// event is in progress. Ex: Closing the BubbleUi will hide the bubble, causing
+// it to lose focus, which causes another close event. This test simulates this
+// by sending a close event during the |DidClose| method of a BubbleDelegate.
+// Similarly to the show chain, a close chain can mess up the iterator.
+class ChainCloseBubbleDelegate : public MockBubbleDelegate {
+ public:
+  ChainCloseBubbleDelegate(BubbleManager* manager) : manager_(manager) {}
+
+  ~ChainCloseBubbleDelegate() override {}
+
+  void DidClose() override {
+    manager_->CloseAllBubbles(BUBBLE_CLOSE_FOCUS_LOST);
+  }
+
+ private:
+  BubbleManager* manager_;
+
+  DISALLOW_COPY_AND_ASSIGN(ChainCloseBubbleDelegate);
+};
+
 class MockBubbleManagerObserver : public BubbleManager::BubbleManagerObserver {
  public:
   MockBubbleManagerObserver() {}
@@ -202,6 +235,22 @@
   ASSERT_FALSE(normal_ref3);
 }
 
+TEST_F(BubbleManagerTest, CloseBubbleShouldOnlylCloseSelf) {
+  BubbleReference ref1 = manager_->ShowBubble(MockBubbleDelegate::Default());
+  BubbleReference ref2 = manager_->ShowBubble(MockBubbleDelegate::Default());
+  BubbleReference ref3 = manager_->ShowBubble(MockBubbleDelegate::Default());
+
+  EXPECT_TRUE(ref1);
+  EXPECT_TRUE(ref2);
+  EXPECT_TRUE(ref3);
+
+  ref2->CloseBubble(BUBBLE_CLOSE_FOCUS_LOST);
+
+  EXPECT_TRUE(ref1);
+  EXPECT_FALSE(ref2);
+  EXPECT_TRUE(ref3);
+}
+
 TEST_F(BubbleManagerTest, UpdateAllShouldWorkWithoutBubbles) {
   // Manager shouldn't crash if bubbles have never been added.
   manager_->UpdateAllBubbleAnchors();
@@ -226,27 +275,48 @@
   manager_->CloseAllBubbles(BUBBLE_CLOSE_FOCUS_LOST);
 }
 
+// This test validates that it's possible to show another bubble when
+// |CloseBubble| is called.
 TEST_F(BubbleManagerTest, AllowBubbleChainingOnClose) {
+  BubbleReference chained_bubble;
   BubbleReference ref =
       manager_->ShowBubble(make_scoped_ptr(new ChainShowBubbleDelegate(
-          manager_.get(), MockBubbleDelegate::Default())));
+          manager_.get(), MockBubbleDelegate::Default(), &chained_bubble)));
+  ASSERT_FALSE(chained_bubble);  // Bubble not yet visible.
   ASSERT_TRUE(manager_->CloseBubble(ref, BUBBLE_CLOSE_FORCED));
+  ASSERT_TRUE(chained_bubble);  // Bubble is now visible.
 }
 
+// This test validates that it's possible to show another bubble when
+// |CloseAllBubbles| is called.
 TEST_F(BubbleManagerTest, AllowBubbleChainingOnCloseAll) {
-  manager_->ShowBubble(make_scoped_ptr(new ChainShowBubbleDelegate(
-      manager_.get(), MockBubbleDelegate::Default())));
+  BubbleReference chained_bubble;
+  BubbleReference ref =
+      manager_->ShowBubble(make_scoped_ptr(new ChainShowBubbleDelegate(
+          manager_.get(), MockBubbleDelegate::Default(), &chained_bubble)));
+  ASSERT_FALSE(chained_bubble);  // Bubble not yet visible.
   manager_->CloseAllBubbles(BUBBLE_CLOSE_FORCED);
+  ASSERT_TRUE(chained_bubble);  // Bubble is now visible.
 }
 
+// This test validates that a show chain will not happen in the destructor.
+// While chaining is during the normal life span of the manager, it should NOT
+// happen when the manager is being destroyed.
 TEST_F(BubbleManagerTest, BubblesDoNotChainOnDestroy) {
+  MockBubbleManagerObserver metrics;
+  // |chained_delegate| should never be shown.
+  EXPECT_CALL(metrics, OnBubbleNeverShown(testing::_));
+  // The ChainShowBubbleDelegate should be closed when the manager is destroyed.
+  EXPECT_CALL(metrics, OnBubbleClosed(testing::_, BUBBLE_CLOSE_FORCED));
+  manager_->AddBubbleManagerObserver(&metrics);
+
   scoped_ptr<MockBubbleDelegate> chained_delegate(new MockBubbleDelegate);
   EXPECT_CALL(*chained_delegate->bubble_ui(), Show(testing::_)).Times(0);
   EXPECT_CALL(*chained_delegate, ShouldClose(testing::_)).Times(0);
   EXPECT_CALL(*chained_delegate, DidClose()).Times(0);
 
   manager_->ShowBubble(make_scoped_ptr(new ChainShowBubbleDelegate(
-      manager_.get(), chained_delegate.Pass())));
+      manager_.get(), chained_delegate.Pass(), nullptr)));
   manager_.reset();
 }
 
@@ -263,22 +333,74 @@
   manager_.reset();
 }
 
-TEST_F(BubbleManagerTest, BubbleCloseNeverShownIsCalled) {
-  MockBubbleManagerObserver metrics;
-  // |chained_delegate| should never be shown.
-  EXPECT_CALL(metrics, OnBubbleNeverShown(testing::_));
-  // The ChainShowBubbleDelegate should be closed when the manager is destroyed.
-  EXPECT_CALL(metrics, OnBubbleClosed(testing::_, BUBBLE_CLOSE_FORCED));
-  manager_->AddBubbleManagerObserver(&metrics);
+// In a close chain, it should be possible for the bubble in the second close
+// event to close.
+TEST_F(BubbleManagerTest, BubbleCloseChainCloseClose) {
+  scoped_ptr<ChainCloseBubbleDelegate> closing_bubble(
+      new ChainCloseBubbleDelegate(manager_.get()));
+  EXPECT_CALL(*closing_bubble, ShouldClose(testing::_))
+      .WillOnce(testing::Return(true));
 
-  scoped_ptr<MockBubbleDelegate> chained_delegate(new MockBubbleDelegate);
-  EXPECT_CALL(*chained_delegate->bubble_ui(), Show(testing::_)).Times(0);
-  EXPECT_CALL(*chained_delegate, ShouldClose(testing::_)).Times(0);
-  EXPECT_CALL(*chained_delegate, DidClose()).Times(0);
+  BubbleReference other_bubble_ref =
+      manager_->ShowBubble(MockBubbleDelegate::Default());
 
-  manager_->ShowBubble(make_scoped_ptr(new ChainShowBubbleDelegate(
-      manager_.get(), chained_delegate.Pass())));
-  manager_.reset();
+  BubbleReference closing_bubble_ref =
+      manager_->ShowBubble(closing_bubble.Pass());
+
+  EXPECT_TRUE(other_bubble_ref);
+  EXPECT_TRUE(closing_bubble_ref);
+
+  closing_bubble_ref->CloseBubble(BUBBLE_CLOSE_ACCEPTED);
+
+  EXPECT_FALSE(other_bubble_ref);
+  EXPECT_FALSE(closing_bubble_ref);
+}
+
+// In a close chain, it should be possible for the bubble in the second close
+// event to remain open because close is a request.
+TEST_F(BubbleManagerTest, BubbleCloseChainCloseNoClose) {
+  scoped_ptr<ChainCloseBubbleDelegate> closing_bubble(
+      new ChainCloseBubbleDelegate(manager_.get()));
+  EXPECT_CALL(*closing_bubble, ShouldClose(testing::_))
+      .WillOnce(testing::Return(true));
+
+  BubbleReference other_bubble_ref =
+      manager_->ShowBubble(MockBubbleDelegate::Stubborn());
+
+  BubbleReference closing_bubble_ref =
+      manager_->ShowBubble(closing_bubble.Pass());
+
+  EXPECT_TRUE(other_bubble_ref);
+  EXPECT_TRUE(closing_bubble_ref);
+
+  closing_bubble_ref->CloseBubble(BUBBLE_CLOSE_ACCEPTED);
+
+  EXPECT_TRUE(other_bubble_ref);
+  EXPECT_FALSE(closing_bubble_ref);
+}
+
+// This test is a sanity check. |closing_bubble| will attempt to close all other
+// bubbles if it's closed, but it doesn't want to close. Sending a close request
+// should keep it open without starting a close chain.
+TEST_F(BubbleManagerTest, BubbleCloseChainNoCloseNoClose) {
+  scoped_ptr<ChainCloseBubbleDelegate> closing_bubble(
+      new ChainCloseBubbleDelegate(manager_.get()));
+  EXPECT_CALL(*closing_bubble, ShouldClose(testing::_))
+      .WillRepeatedly(testing::Return(false));
+
+  BubbleReference other_bubble_ref =
+      manager_->ShowBubble(MockBubbleDelegate::Default());
+
+  BubbleReference closing_bubble_ref =
+      manager_->ShowBubble(closing_bubble.Pass());
+
+  EXPECT_TRUE(other_bubble_ref);
+  EXPECT_TRUE(closing_bubble_ref);
+
+  closing_bubble_ref->CloseBubble(BUBBLE_CLOSE_ACCEPTED);
+
+  EXPECT_TRUE(other_bubble_ref);
+  EXPECT_TRUE(closing_bubble_ref);
 }
 
 }  // namespace
diff --git a/components/components_tests.gyp b/components/components_tests.gyp
index 3b9df5e..d6744af 100644
--- a/components/components_tests.gyp
+++ b/components/components_tests.gyp
@@ -247,6 +247,7 @@
       'gcm_driver/gcm_stats_recorder_impl_unittest.cc',
     ],
     'gcm_driver_crypto_unittest_sources': [
+      'gcm_driver/crypto/encryption_header_parsers_unittest.cc',
       'gcm_driver/crypto/gcm_key_store_unittest.cc',
       'gcm_driver/crypto/gcm_message_cryptographer_unittest.cc',
     ],
@@ -593,7 +594,6 @@
     ],
     'search_engines_unittest_sources': [
       'search_engines/default_search_manager_unittest.cc',
-      'search_engines/default_search_policy_handler_unittest.cc',
       'search_engines/default_search_pref_migration_unittest.cc',
       'search_engines/keyword_table_unittest.cc',
       'search_engines/search_host_to_urls_map_unittest.cc',
@@ -984,6 +984,7 @@
         'components.gyp:update_client',
         'components.gyp:update_client_test_support',
         'components.gyp:upload_list',
+        'components.gyp:url_matcher',
         'components.gyp:user_prefs_tracked',
         'components.gyp:user_prefs_tracked_test_support',
         'components.gyp:variations',
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc
index df78cf8e..4e507cb 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.cc
@@ -493,6 +493,24 @@
   return ShouldUseLoFiHeaderForRequests(lofi_status_);
 }
 
+bool DataReductionProxyConfig::IsInLoFiActiveControlExperiment() const {
+  switch (lofi_status_) {
+    case LOFI_STATUS_OFF:
+    case LOFI_STATUS_TEMPORARILY_OFF:
+    case LOFI_STATUS_INACTIVE_CONTROL:
+    case LOFI_STATUS_INACTIVE:
+    case LOFI_STATUS_ACTIVE_FROM_FLAGS:
+    case LOFI_STATUS_ACTIVE:
+      return false;
+    case LOFI_STATUS_ACTIVE_CONTROL:
+      DCHECK(IsIncludedInLoFiControlFieldTrial());
+      return true;
+    default:
+      NOTREACHED() << lofi_status_;
+  }
+  return false;
+}
+
 void DataReductionProxyConfig::PopulateAutoLoFiParams() {
   std::string field_trial = params::GetLoFiFieldTrialName();
 
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h
index 46a301c..86471b0 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config.h
@@ -221,6 +221,10 @@
   // Should be called on all URL requests (main frame and non main frame).
   bool ShouldUseLoFiHeaderForRequests() const;
 
+  // Returns true if the session is in the Lo-Fi control experiment. This
+  // happens if user is in Control group, and connection is slow.
+  bool IsInLoFiActiveControlExperiment() const;
+
   // Sets |lofi_status_| to LOFI_STATUS_OFF.
   void SetLoFiModeOff();
 
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc
index c50e7433..f0135e8 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.cc
@@ -44,6 +44,7 @@
                                configurator,
                                event_creator),
       auto_lofi_enabled_group_(false),
+      auto_lofi_control_group_(false),
       network_quality_prohibitively_slow_(false) {
   network_interfaces_.reset(new net::NetworkInterfaceList());
 }
@@ -102,11 +103,20 @@
   return auto_lofi_enabled_group_;
 }
 
+bool TestDataReductionProxyConfig::IsIncludedInLoFiControlFieldTrial() const {
+  return auto_lofi_control_group_;
+}
+
 void TestDataReductionProxyConfig::SetIncludedInLoFiEnabledFieldTrial(
     bool auto_lofi_enabled_group) {
   auto_lofi_enabled_group_ = auto_lofi_enabled_group;
 }
 
+void TestDataReductionProxyConfig::SetIncludedInLoFiControlFieldTrial(
+    bool auto_lofi_control_group) {
+  auto_lofi_control_group_ = auto_lofi_control_group;
+}
+
 void TestDataReductionProxyConfig::SetNetworkProhibitivelySlow(
     bool network_quality_prohibitively_slow) {
   network_quality_prohibitively_slow_ = network_quality_prohibitively_slow;
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h
index 59ab693..d709461 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_config_test_utils.h
@@ -75,6 +75,11 @@
   // Allows tests to set the session as part of Lo-Fi enabled field trial.
   void SetIncludedInLoFiEnabledFieldTrial(bool included_in_lofi_enabled);
 
+  bool IsIncludedInLoFiControlFieldTrial() const override;
+
+  // Allows tests to set the session as part of Lo-Fi control field trial.
+  void SetIncludedInLoFiControlFieldTrial(bool included_in_lofi_control);
+
   // Allows tests to mark the network as prohibitively slow.
   void SetNetworkProhibitivelySlow(bool network_quality_prohibitively_slow);
 
@@ -91,6 +96,9 @@
   // True if this session is part of Auto Lo-Fi enabled field trial.
   bool auto_lofi_enabled_group_;
 
+  // True if this session is part of Auto Lo-Fi control field trial.
+  bool auto_lofi_control_group_;
+
   // True if network quality is slow enough to turn Auto Lo-Fi ON.
   bool network_quality_prohibitively_slow_;
 };
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
index 24be61b0..6a52cdf 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.cc
@@ -4,6 +4,7 @@
 
 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
 
+#include <algorithm>
 #include <vector>
 
 #include "base/bind.h"
@@ -49,6 +50,7 @@
 const char kClientHeaderOption[] = "c";
 const char kLoFiHeaderOption[] = "q";
 const char kExperimentsOption[] = "exp";
+const char kLoFiExperimentID[] = "lofi_active_control";
 
 // The empty version for the authentication protocol. Currently used by
 // Android webview.
@@ -182,6 +184,29 @@
     RegenerateRequestHeaderValue();
     return;
   }
+
+  // User was not part of Lo-Fi active control experiment, but now is.
+  if (std::find(experiments_.begin(), experiments_.end(),
+                std::string(kLoFiExperimentID)) == experiments_.end() &&
+      data_reduction_proxy_config_->IsInLoFiActiveControlExperiment()) {
+    experiments_.push_back(kLoFiExperimentID);
+    RegenerateRequestHeaderValue();
+    DCHECK(std::find(experiments_.begin(), experiments_.end(),
+                     kLoFiExperimentID) != experiments_.end());
+    return;
+  }
+
+  // User was part of Lo-Fi active control experiment, but now is not.
+  auto it = std::find(experiments_.begin(), experiments_.end(),
+                      std::string(kLoFiExperimentID));
+  if (it != experiments_.end() &&
+      !data_reduction_proxy_config_->IsInLoFiActiveControlExperiment()) {
+    experiments_.erase(it);
+    RegenerateRequestHeaderValue();
+    DCHECK(std::find(experiments_.begin(), experiments_.end(),
+                     std::string(kLoFiExperimentID)) == experiments_.end());
+    return;
+  }
 }
 
 void DataReductionProxyRequestOptions::UpdateExperiments() {
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h
index 240eed6..deaef8c 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h
@@ -31,6 +31,7 @@
 extern const char kClientHeaderOption[];
 extern const char kLoFiHeaderOption[];
 extern const char kExperimentsOption[];
+extern const char kLoFiExperimentID[];
 
 #if defined(OS_ANDROID)
 extern const char kAndroidWebViewProtocolVersion[];
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
index 511f8d9..8daef65 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options_unittest.cc
@@ -314,21 +314,18 @@
 TEST_F(DataReductionProxyRequestOptionsTest, AutoLoFi) {
   const struct {
     bool auto_lofi_enabled_group;
+    bool auto_lofi_control_group;
     bool network_prohibitively_slow;
-
   } tests[] = {
-      {
-       false, false,
-      },
-      {
-       false, true,
-      },
-      {
-       true, false,
-      },
-      {
-       true, true,
-      },
+      {false, false, false},
+      {false, false, true},
+      {true, false, false},
+      {true, false, true},
+      {false, true, false},
+      {false, true, true},
+      // Repeat this test data to simulate user moving out of Lo-Fi control
+      // experiment.
+      {false, true, false},
   };
 
   for (size_t i = 0; i < arraysize(tests); ++i) {
@@ -337,6 +334,8 @@
     // trial and network is prohibitively slow.
     bool expect_lofi_header =
         tests[i].auto_lofi_enabled_group && tests[i].network_prohibitively_slow;
+    bool expect_lofi_experiment_header =
+        tests[i].auto_lofi_control_group && tests[i].network_prohibitively_slow;
 
     std::string expected_header;
     if (!expect_lofi_header) {
@@ -350,8 +349,15 @@
                             std::string(), "low", std::vector<std::string>(),
                             &expected_header);
     }
+
+    if (expect_lofi_experiment_header) {
+      expected_header = expected_header.append(", exp=");
+      expected_header = expected_header.append(kLoFiExperimentID);
+    }
     test_context_->config()->SetIncludedInLoFiEnabledFieldTrial(
         tests[i].auto_lofi_enabled_group);
+    test_context_->config()->SetIncludedInLoFiControlFieldTrial(
+        tests[i].auto_lofi_control_group);
     test_context_->config()->SetNetworkProhibitivelySlow(
         tests[i].network_prohibitively_slow);
 
diff --git a/components/domain_reliability/monitor.cc b/components/domain_reliability/monitor.cc
index 115a6c6..2db9882 100644
--- a/components/domain_reliability/monitor.cc
+++ b/components/domain_reliability/monitor.cc
@@ -9,7 +9,6 @@
 #include "base/profiler/scoped_tracker.h"
 #include "base/single_thread_task_runner.h"
 #include "base/task_runner.h"
-#include "base/time/time.h"
 #include "components/domain_reliability/baked_in_configs.h"
 #include "net/base/load_flags.h"
 #include "net/base/net_errors.h"
@@ -149,18 +148,12 @@
   DCHECK(OnNetworkThread());
   DCHECK(moved_to_network_thread_);
 
-  base::Time now = base::Time::Now();
   for (size_t i = 0; kBakedInJsonConfigs[i]; ++i) {
     base::StringPiece json(kBakedInJsonConfigs[i]);
     scoped_ptr<const DomainReliabilityConfig> config =
         DomainReliabilityConfig::FromJSON(json);
-    if (!config) {
+    if (!config)
       continue;
-    } else if (config->IsExpired(now)) {
-      LOG(WARNING) << "Baked-in Domain Reliability config for "
-                   << config->domain << " is expired.";
-      continue;
-    }
     context_manager_.AddContextForConfig(config.Pass());
   }
 }
diff --git a/components/gcm_driver.gypi b/components/gcm_driver.gypi
index 1090e69..de43bb5 100644
--- a/components/gcm_driver.gypi
+++ b/components/gcm_driver.gypi
@@ -212,12 +212,15 @@
         '../base/base.gyp:base',
         '../components/components.gyp:leveldb_proto',
         '../crypto/crypto.gyp:crypto',
+        '../net/net.gyp:net',
       ],
       'include_dirs': [
         '..',
       ],
       'sources': [
         # Note: file list duplicated in GN build.
+        'gcm_driver/crypto/encryption_header_parsers.cc',
+        'gcm_driver/crypto/encryption_header_parsers.h',
         'gcm_driver/crypto/gcm_encryption_provider.cc',
         'gcm_driver/crypto/gcm_encryption_provider.h',
         'gcm_driver/crypto/gcm_key_store.cc',
diff --git a/components/gcm_driver/crypto/BUILD.gn b/components/gcm_driver/crypto/BUILD.gn
index ad2ec7a..8e0c47e2 100644
--- a/components/gcm_driver/crypto/BUILD.gn
+++ b/components/gcm_driver/crypto/BUILD.gn
@@ -7,6 +7,8 @@
 # GYP version: components/gcm_driver.gypi:gcm_driver_crypto
 source_set("crypto") {
   sources = [
+    "encryption_header_parsers.cc",
+    "encryption_header_parsers.h",
     "gcm_encryption_provider.cc",
     "gcm_encryption_provider.h",
     "gcm_key_store.cc",
@@ -36,6 +38,7 @@
 source_set("unit_tests") {
   testonly = true
   sources = [
+    "encryption_header_parsers_unittest.cc",
     "gcm_key_store_unittest.cc",
     "gcm_message_cryptographer_unittest.cc",
   ]
diff --git a/components/gcm_driver/crypto/DEPS b/components/gcm_driver/crypto/DEPS
index ebda3fe..697581f 100644
--- a/components/gcm_driver/crypto/DEPS
+++ b/components/gcm_driver/crypto/DEPS
@@ -2,4 +2,5 @@
   "+components/gcm_driver",
   "+components/leveldb_proto",
   "+crypto",
+  "+net/http",
 ]
diff --git a/components/gcm_driver/crypto/encryption_header_parsers.cc b/components/gcm_driver/crypto/encryption_header_parsers.cc
new file mode 100644
index 0000000..829b7175
--- /dev/null
+++ b/components/gcm_driver/crypto/encryption_header_parsers.cc
@@ -0,0 +1,224 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/gcm_driver/crypto/encryption_header_parsers.h"
+
+#include "base/base64.h"
+#include "base/numerics/safe_math.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_piece.h"
+#include "base/strings/string_util.h"
+#include "net/http/http_util.h"
+
+namespace gcm {
+
+namespace {
+
+// The default record size in bytes, as defined in section two of
+// https://tools.ietf.org/html/draft-thomson-http-encryption-01.
+const uint64_t kDefaultRecordSizeBytes = 4096;
+
+// TODO(peter): Unify the base64url implementations. https://crbug.com/536745
+bool Base64URLDecode(const base::StringPiece& input, std::string* output) {
+  // Bail on malformed strings, which already contain a '+' or a '/'. All valid
+  // strings should escape these special characters as '-' and '_',
+  // respectively.
+  if (input.find_first_of("+/") != std::string::npos)
+    return false;
+
+  base::CheckedNumeric<size_t> checked_padded_size = input.size();
+  if (input.size() % 4)
+    checked_padded_size += 4 - (input.size() % 4);
+
+  // Add padding to |input|.
+  std::string padded_input(input.begin(), input.end());
+  padded_input.resize(checked_padded_size.ValueOrDie(), '=');
+
+  // Convert to standard base64 alphabet.
+  base::ReplaceChars(padded_input, "-", "+", &padded_input);
+  base::ReplaceChars(padded_input, "_", "/", &padded_input);
+
+  return base::Base64Decode(padded_input, output);
+}
+
+// Decodes the string between |begin| and |end| using base64url, and writes the
+// decoded value to |*salt|. Returns whether the string could be decoded.
+bool ValueToDecodedString(const std::string::const_iterator& begin,
+                          const std::string::const_iterator& end,
+                          std::string* salt) {
+  const base::StringPiece value(begin, end);
+  if (value.empty())
+    return false;
+
+  return Base64URLDecode(value, salt);
+}
+
+// Parses the record size between |begin| and |end|, and writes the value to
+// |*rs|. The value must be an unsigned, 64-bit integer greater than zero that
+// does not start with a plus. Returns whether the record size was valid.
+bool RecordSizeToInt(const std::string::const_iterator& begin,
+                     const std::string::const_iterator& end,
+                     uint64_t* rs) {
+  const base::StringPiece value(begin, end);
+  if (value.empty())
+    return false;
+
+  // Parsing the "rs" parameter uses stricter semantics than parsing rules for
+  // normal integers, in that we want to reject values such as "+5" for
+  // compatibility with UAs that use other number parsing mechanisms.
+  if (value[0] == '+')
+    return false;
+
+  if (!base::StringToUint64(value, rs))
+    return false;
+
+  // The record size MUST be greater than 1.
+  return *rs > 1;
+}
+
+// Parses the string between |input_begin| and |input_end| according to the
+// extended ABNF syntax for the Encryption HTTP header, per the "parameter"
+// rule from RFC 7231 (https://tools.ietf.org/html/rfc7231).
+//
+// encryption_params = [ parameter *( ";" parameter ) ]
+//
+// This implementation applies the parameters defined in section 3.1 of the
+// HTTP encryption encoding document:
+//
+// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-3.1
+//
+// This means that the three supported parameters are:
+//
+//     [ "keyid" "=" string ]
+//     [ ";" "salt" "=" base64url ]
+//     [ ";" "rs" "=" octet-count ]
+bool ParseEncryptionHeaderValuesImpl(std::string::const_iterator input_begin,
+                                     std::string::const_iterator input_end,
+                                     EncryptionHeaderValues* values) {
+  net::HttpUtil::NameValuePairsIterator name_value_pairs(
+      input_begin, input_end, ';',
+      net::HttpUtil::NameValuePairsIterator::VALUES_NOT_OPTIONAL);
+
+  while (name_value_pairs.GetNext()) {
+    const base::StringPiece name(name_value_pairs.name_begin(),
+                                 name_value_pairs.name_end());
+
+    if (base::LowerCaseEqualsASCII(name, "keyid")) {
+      values->keyid.assign(name_value_pairs.value_begin(),
+                           name_value_pairs.value_end());
+    } else if (base::LowerCaseEqualsASCII(name, "salt")) {
+      if (!ValueToDecodedString(name_value_pairs.value_begin(),
+                                name_value_pairs.value_end(), &values->salt)) {
+        return false;
+      }
+    } else if (base::LowerCaseEqualsASCII(name, "rs")) {
+      if (!RecordSizeToInt(name_value_pairs.value_begin(),
+                           name_value_pairs.value_end(), &values->rs)) {
+        return false;
+      }
+    } else {
+      // Silently ignore unknown directives for forward compatibility.
+    }
+  }
+
+  return name_value_pairs.valid();
+}
+
+// Parses the string between |input_begin| and |input_end| according to the
+// extended ABNF syntax for the Encryption-Key HTTP header, per the "parameter"
+// rule from RFC 7231 (https://tools.ietf.org/html/rfc7231).
+//
+// encryption_params = [ parameter *( ";" parameter ) ]
+//
+// This implementation applies the parameters defined in section 4 of the
+// HTTP encryption encoding document:
+//
+//https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-4
+//
+// This means that the three supported parameters are:
+//
+//     [ "keyid" "=" string ]
+//     [ ";" "key" "=" base64url ]
+//     [ ";" "dh" "=" base64url ]
+bool ParseEncryptionKeyHeaderValuesImpl(std::string::const_iterator input_begin,
+                                        std::string::const_iterator input_end,
+                                        EncryptionKeyHeaderValues* values) {
+  net::HttpUtil::NameValuePairsIterator name_value_pairs(
+      input_begin, input_end, ';',
+      net::HttpUtil::NameValuePairsIterator::VALUES_NOT_OPTIONAL);
+
+  while (name_value_pairs.GetNext()) {
+    const base::StringPiece name(name_value_pairs.name_begin(),
+                                 name_value_pairs.name_end());
+
+    if (base::LowerCaseEqualsASCII(name, "keyid")) {
+      values->keyid.assign(name_value_pairs.value_begin(),
+                           name_value_pairs.value_end());
+    } else if (base::LowerCaseEqualsASCII(name, "key")) {
+      if (!ValueToDecodedString(name_value_pairs.value_begin(),
+                                name_value_pairs.value_end(), &values->key)) {
+        return false;
+      }
+    } else if (base::LowerCaseEqualsASCII(name, "dh")) {
+      if (!ValueToDecodedString(name_value_pairs.value_begin(),
+                                name_value_pairs.value_end(), &values->dh)) {
+        return false;
+      }
+    } else {
+      // Silently ignore unknown directives for forward compatibility.
+    }
+  }
+
+  return name_value_pairs.valid();
+}
+
+}  // namespace
+
+bool ParseEncryptionHeader(const std::string& input,
+                           std::vector<EncryptionHeaderValues>* values) {
+  DCHECK(values);
+
+  std::vector<EncryptionHeaderValues> candidate_values;
+
+  net::HttpUtil::ValuesIterator value_iterator(input.begin(), input.end(), ',');
+  while (value_iterator.GetNext()) {
+    EncryptionHeaderValues candidate_value;
+    candidate_value.rs = kDefaultRecordSizeBytes;
+
+    if (!ParseEncryptionHeaderValuesImpl(value_iterator.value_begin(),
+                                         value_iterator.value_end(),
+                                         &candidate_value)) {
+      return false;
+    }
+
+    candidate_values.push_back(candidate_value);
+  }
+
+  values->swap(candidate_values);
+  return true;
+}
+
+bool ParseEncryptionKeyHeader(const std::string& input,
+                              std::vector<EncryptionKeyHeaderValues>* values) {
+  DCHECK(values);
+
+  std::vector<EncryptionKeyHeaderValues> candidate_values;
+
+  net::HttpUtil::ValuesIterator value_iterator(input.begin(), input.end(), ',');
+  while (value_iterator.GetNext()) {
+    EncryptionKeyHeaderValues candidate_value;
+    if (!ParseEncryptionKeyHeaderValuesImpl(value_iterator.value_begin(),
+                                            value_iterator.value_end(),
+                                            &candidate_value)) {
+      return false;
+    }
+
+    candidate_values.push_back(candidate_value);
+  }
+
+  values->swap(candidate_values);
+  return true;
+}
+
+}  // namespace gcm
diff --git a/components/gcm_driver/crypto/encryption_header_parsers.h b/components/gcm_driver/crypto/encryption_header_parsers.h
new file mode 100644
index 0000000..4bf7713
--- /dev/null
+++ b/components/gcm_driver/crypto/encryption_header_parsers.h
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_
+#define COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_
+
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+namespace gcm {
+
+// Structure representing the parsed values from the Encryption HTTP header.
+// |salt| is stored after having been base64url decoded.
+struct EncryptionHeaderValues {
+  std::string keyid;
+  std::string salt;
+  uint64_t rs;
+};
+
+// Parses |input| following the syntax of the Encryption HTTP header. The parsed
+// values will be stored in the |*values| argument.
+//
+// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-3
+//
+// This header follows the #list syntax from the extended ABNF syntax
+// defined in section 1.2 of RFC 7230:
+//
+// https://tools.ietf.org/html/rfc7230#section-1.2
+//
+// Returns whether the |input| could be successfully parsed, and the resulting
+// values are now available in the |*values| argument. Does not modify |*values|
+// unless parsing was successful.
+bool ParseEncryptionHeader(const std::string& input,
+                           std::vector<EncryptionHeaderValues>* values);
+
+// Structure representing the parsed values from the Encryption-Key HTTP header.
+// |key| and |dh| are stored after having been base64url decoded.
+struct EncryptionKeyHeaderValues {
+  std::string keyid;
+  std::string key;
+  std::string dh;
+};
+
+// Parses |input| following the syntax of the Encryption-Key HTTP header. The
+// parsed values will be stored in the |*values| argument.
+//
+// https://tools.ietf.org/html/draft-thomson-http-encryption-01#section-4
+//
+// This header follows the #list syntax from the extended ABNF syntax
+// defined in section 1.2 of RFC 7230:
+//
+// https://tools.ietf.org/html/rfc7230#section-1.2
+//
+// Returns whether the |input| could be successfully parsed, and the resulting
+// values are now available in the |*values| argument. Does not modify |*values|
+// unless parsing was successful.
+bool ParseEncryptionKeyHeader(const std::string& input,
+                              std::vector<EncryptionKeyHeaderValues>* values);
+
+}  // namespace gcm
+
+#endif  // COMPONENTS_GCM_DRIVER_CRYPTO_ENCRYPTION_HEADER_PARSERS_H_
diff --git a/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc b/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
new file mode 100644
index 0000000..5fe00ba
--- /dev/null
+++ b/components/gcm_driver/crypto/encryption_header_parsers_unittest.cc
@@ -0,0 +1,293 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/gcm_driver/crypto/encryption_header_parsers.h"
+
+#include <vector>
+
+#include "base/macros.h"
+#include "base/strings/string_number_conversions.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace gcm {
+
+namespace {
+
+const uint64_t kDefaultRecordSize = 4096;
+
+TEST(EncryptionHeaderParsersTest, ParseValidEncryptionHeaders) {
+  struct {
+    const char* const header;
+    const char* const parsed_keyid;
+    const char* const parsed_salt;
+    uint64_t parsed_rs;
+  } expected_results[] = {
+    { "keyid=foo;salt=c2l4dGVlbmNvb2xieXRlcw;rs=1024",
+      "foo", "sixteencoolbytes", 1024 },
+    { "keyid=foo; salt=c2l4dGVlbmNvb2xieXRlcw; rs=1024",
+      "foo", "sixteencoolbytes", 1024 },
+    { "KEYID=foo;SALT=c2l4dGVlbmNvb2xieXRlcw;RS=1024",
+      "foo", "sixteencoolbytes", 1024 },
+    { " keyid = foo ; salt = c2l4dGVlbmNvb2xieXRlcw ; rs = 1024 ",
+      "foo", "sixteencoolbytes", 1024 },
+    { "keyid=foo", "foo", "", kDefaultRecordSize },
+    { "keyid=foo;", "foo", "", kDefaultRecordSize },
+    { "keyid=\"foo\"", "foo", "", kDefaultRecordSize },
+    { "keyid='foo'", "foo", "", kDefaultRecordSize },
+    { "salt=c2l4dGVlbmNvb2xieXRlcw",
+      "", "sixteencoolbytes", kDefaultRecordSize },
+    { "rs=2048", "", "", 2048 },
+    { "keyid=foo;someothervalue=1;rs=42", "foo", "", 42 },
+    { "keyid=foo;keyid=bar", "bar", "", kDefaultRecordSize },
+  };
+
+  for (size_t i = 0; i < arraysize(expected_results); i++) {
+    SCOPED_TRACE(i);
+
+    std::vector<EncryptionHeaderValues> values;
+    ASSERT_TRUE(ParseEncryptionHeader(expected_results[i].header, &values));
+    ASSERT_EQ(1u, values.size());
+
+    EXPECT_EQ(expected_results[i].parsed_keyid, values[0].keyid);
+    EXPECT_EQ(expected_results[i].parsed_salt, values[0].salt);
+    EXPECT_EQ(expected_results[i].parsed_rs, values[0].rs);
+  }
+}
+
+TEST(EncryptionHeaderParsersTest, ParseValidMultiValueEncryptionHeaders) {
+  const size_t kNumberOfValues = 2u;
+
+  struct {
+    const char* const header;
+    struct {
+      const char* const keyid;
+      const char* const salt;
+      uint64_t rs;
+    } parsed_values[kNumberOfValues];
+  } expected_results[] = {
+    { "keyid=foo;salt=c2l4dGVlbmNvb2xieXRlcw;rs=1024,keyid=foo;salt=c2l4dGVlbm"
+          "Nvb2xieXRlcw;rs=1024",
+      { { "foo", "sixteencoolbytes", 1024 },
+        { "foo", "sixteencoolbytes", 1024 } } },
+    { "keyid=foo,salt=c2l4dGVlbmNvb2xieXRlcw;rs=1024",
+      { { "foo", "", kDefaultRecordSize },
+        { "", "sixteencoolbytes", 1024 } } },
+    { "keyid=foo,keyid=bar;salt=c2l4dGVlbmNvb2xieXRlcw;rs=1024",
+      { { "foo", "", kDefaultRecordSize },
+        { "bar", "sixteencoolbytes", 1024 } } },
+    { "keyid=\"foo,keyid=bar\",salt=c2l4dGVlbmNvb2xieXRlcw",
+      { { "foo,keyid=bar", "", kDefaultRecordSize },
+        { "", "sixteencoolbytes", kDefaultRecordSize } } },
+  };
+
+  for (size_t i = 0; i < arraysize(expected_results); i++) {
+    SCOPED_TRACE(i);
+
+    std::vector<EncryptionHeaderValues> values;
+    ASSERT_TRUE(ParseEncryptionHeader(expected_results[i].header, &values));
+    ASSERT_EQ(kNumberOfValues, values.size());
+
+    for (size_t j = 0; j < kNumberOfValues; ++j) {
+      EXPECT_EQ(expected_results[i].parsed_values[j].keyid, values[j].keyid);
+      EXPECT_EQ(expected_results[i].parsed_values[j].salt, values[j].salt);
+      EXPECT_EQ(expected_results[i].parsed_values[j].rs, values[j].rs);
+    }
+  }
+}
+
+TEST(EncryptionHeaderParsersTest, ParseInvalidEncryptionHeaders) {
+  const char* const expected_failures[] = {
+    "keyid",
+    "keyid=",
+    "keyid=foo;novaluekey",
+    "keyid=foo,keyid",
+    "salt",
+    "salt=",
+    "salt=YmV/2ZXJ-sMDA",
+    "salt=dHdlbHZlY29vbGJ5dGVz=====",
+    "salt=123$xyz",
+    "salt=c2l4dGVlbmNvb2xieXRlcw,salt=123$xyz",
+    "rs",
+    "rs=",
+    "rs=0",
+    "rs=0x13",
+    "rs=1",
+    "rs=-1",
+    "rs=+5",
+    "rs=99999999999999999999999999999999",
+    "rs=2,rs=0",
+    "rs=foobar",
+  };
+
+  for (size_t i = 0; i < arraysize(expected_failures); i++) {
+    SCOPED_TRACE(i);
+
+    std::vector<EncryptionHeaderValues> values;
+    EXPECT_FALSE(ParseEncryptionHeader(expected_failures[i], &values));
+    EXPECT_EQ(0u, values.size());
+  }
+}
+
+TEST(EncryptionHeaderParsersTest, ParseValidEncryptionKeyHeaders) {
+  struct {
+    const char* const header;
+    const char* const parsed_keyid;
+    const char* const parsed_key;
+    const char* const parsed_dh;
+  } expected_results[] = {
+    { "keyid=foo;key=c2l4dGVlbmNvb2xieXRlcw;dh=dHdlbHZlY29vbGJ5dGVz",
+      "foo", "sixteencoolbytes", "twelvecoolbytes" },
+    { "keyid=foo; key=c2l4dGVlbmNvb2xieXRlcw; dh=dHdlbHZlY29vbGJ5dGVz",
+      "foo", "sixteencoolbytes", "twelvecoolbytes" },
+    { "keyid = foo ; key = c2l4dGVlbmNvb2xieXRlcw ; dh = dHdlbHZlY29vbGJ5dGVz ",
+      "foo", "sixteencoolbytes", "twelvecoolbytes" },
+    { "KEYID=foo;KEY=c2l4dGVlbmNvb2xieXRlcw;DH=dHdlbHZlY29vbGJ5dGVz",
+      "foo", "sixteencoolbytes", "twelvecoolbytes" },
+    { "keyid=foo", "foo", "", "" },
+    { "key=c2l4dGVlbmNvb2xieXRlcw", "", "sixteencoolbytes", "" },
+    { "key=\"c2l4dGVlbmNvb2xieXRlcw\"", "", "sixteencoolbytes", "" },
+    { "key='c2l4dGVlbmNvb2xieXRlcw'", "", "sixteencoolbytes", "" },
+    { "dh=dHdlbHZlY29vbGJ5dGVz", "", "", "twelvecoolbytes" },
+    { "keyid=foo;someothervalue=bar;key=dHdlbHZlY29vbGJ5dGVz",
+      "foo", "twelvecoolbytes", "" },
+    { "keyid=foo;keyid=bar", "bar", "", "" },
+  };
+
+  for (size_t i = 0; i < arraysize(expected_results); i++) {
+    SCOPED_TRACE(i);
+
+    std::vector<EncryptionKeyHeaderValues> values;
+    ASSERT_TRUE(ParseEncryptionKeyHeader(expected_results[i].header, &values));
+    ASSERT_EQ(1u, values.size());
+
+    EXPECT_EQ(expected_results[i].parsed_keyid, values[0].keyid);
+    EXPECT_EQ(expected_results[i].parsed_key, values[0].key);
+    EXPECT_EQ(expected_results[i].parsed_dh, values[0].dh);
+  }
+}
+
+TEST(EncryptionHeaderParsersTest, ParseValidMultiValueEncryptionKeyHeaders) {
+  const size_t kNumberOfValues = 2u;
+
+  struct {
+    const char* const header;
+    struct {
+      const char* const keyid;
+      const char* const key;
+      const char* const dh;
+    } parsed_values[kNumberOfValues];
+  } expected_results[] = {
+    { "keyid=foo;key=c2l4dGVlbmNvb2xieXRlcw;dh=dHdlbHZlY29vbGJ5dGVz,keyid=bar;"
+          "key=dHdlbHZlY29vbGJ5dGVz;dh=c2l4dGVlbmNvb2xieXRlcw",
+      { { "foo", "sixteencoolbytes", "twelvecoolbytes" },
+        { "bar", "twelvecoolbytes", "sixteencoolbytes" } } },
+    { "keyid=foo,key=c2l4dGVlbmNvb2xieXRlcw",
+      { { "foo", "", "" },
+        { "", "sixteencoolbytes", "" } } },
+    { "keyid=foo,keyid=bar;dh=dHdlbHZlY29vbGJ5dGVz",
+      { { "foo", "", "" },
+        { "bar", "", "twelvecoolbytes" } } },
+    { "keyid=\"foo,keyid=bar\",key=c2l4dGVlbmNvb2xieXRlcw",
+      { { "foo,keyid=bar", "", "" },
+        { "", "sixteencoolbytes", "" } } },
+  };
+
+  for (size_t i = 0; i < arraysize(expected_results); i++) {
+    SCOPED_TRACE(i);
+
+    std::vector<EncryptionKeyHeaderValues> values;
+    ASSERT_TRUE(ParseEncryptionKeyHeader(expected_results[i].header, &values));
+    ASSERT_EQ(kNumberOfValues, values.size());
+
+    for (size_t j = 0; j < kNumberOfValues; ++j) {
+      EXPECT_EQ(expected_results[i].parsed_values[j].keyid, values[j].keyid);
+      EXPECT_EQ(expected_results[i].parsed_values[j].key, values[j].key);
+      EXPECT_EQ(expected_results[i].parsed_values[j].dh, values[j].dh);
+    }
+  }
+}
+
+TEST(EncryptionHeaderParsersTest, ParseInvalidEncryptionKeyHeaders) {
+  const char* const expected_failures[] = {
+    "keyid",
+    "keyid=",
+    "keyid=foo,keyid",
+    "keyid=foo;novaluekey",
+    "key",
+    "key=",
+    "key=123$xyz",
+    "key=foobar,key=123$xyz",
+    "dh",
+    "dh=",
+    "dh=YmV/2ZXJ-sMDA",
+    "dh=dHdlbHZlY29vbGJ5dGVz=====",
+    "dh=123$xyz",
+  };
+
+  for (size_t i = 0; i < arraysize(expected_failures); i++) {
+    SCOPED_TRACE(i);
+
+    std::vector<EncryptionKeyHeaderValues> values;
+    EXPECT_FALSE(ParseEncryptionKeyHeader(expected_failures[i], &values));
+    EXPECT_EQ(0u, values.size());
+  }
+}
+
+TEST(EncryptionHeaderParsersTest, SixValueHeader) {
+  const char* const header = "keyid=0,keyid=1,keyid=2,keyid=3,keyid=4,keyid=5";
+
+  std::vector<EncryptionHeaderValues> encryption_values;
+  ASSERT_TRUE(ParseEncryptionHeader(header, &encryption_values));
+
+  std::vector<EncryptionKeyHeaderValues> encryption_key_values;
+  ASSERT_TRUE(ParseEncryptionKeyHeader(header, &encryption_key_values));
+
+  ASSERT_EQ(6u, encryption_values.size());
+  ASSERT_EQ(6u, encryption_key_values.size());
+
+  for (size_t i = 0; i < encryption_values.size(); i++) {
+    SCOPED_TRACE(i);
+
+    const std::string value = base::IntToString(i);
+
+    EXPECT_EQ(value, encryption_values[i].keyid);
+    EXPECT_EQ(value, encryption_key_values[i].keyid);
+  }
+}
+
+TEST(EncryptionHeaderParsersTest, InvalidHeadersDoNotModifyOutput) {
+  EncryptionHeaderValues encryption_value;
+  encryption_value.keyid = "mykeyid";
+  encryption_value.salt = "somesalt";
+  encryption_value.rs = 42u;
+
+  std::vector<EncryptionHeaderValues> encryption_values;
+  encryption_values.push_back(encryption_value);
+
+  ASSERT_FALSE(ParseEncryptionHeader("rs=foobar", &encryption_values));
+  ASSERT_EQ(1u, encryption_values.size());
+
+  EXPECT_EQ("mykeyid", encryption_values[0].keyid);
+  EXPECT_EQ("somesalt", encryption_values[0].salt);
+  EXPECT_EQ(42u, encryption_values[0].rs);
+
+  EncryptionKeyHeaderValues encryption_key_value;
+  encryption_key_value.keyid = "myotherkeyid";
+  encryption_key_value.key = "akey";
+  encryption_key_value.dh = "yourdh";
+
+  std::vector<EncryptionKeyHeaderValues> encryption_key_values;
+  encryption_key_values.push_back(encryption_key_value);
+
+  ASSERT_FALSE(ParseEncryptionKeyHeader("key=$$$", &encryption_key_values));
+  ASSERT_EQ(1u, encryption_key_values.size());
+
+  EXPECT_EQ("myotherkeyid", encryption_key_values[0].keyid);
+  EXPECT_EQ("akey", encryption_key_values[0].key);
+  EXPECT_EQ("yourdh", encryption_key_values[0].dh);
+}
+
+}  // namespace
+
+}  // namespace gcm
diff --git a/components/html_viewer/DEPS b/components/html_viewer/DEPS
index d3d4f41..e87124c6 100644
--- a/components/html_viewer/DEPS
+++ b/components/html_viewer/DEPS
@@ -55,7 +55,7 @@
 
 specific_include_rules = {
   "run_all_unittests\.cc": [
-    "+third_party/mojo/src/mojo/edk/embedder/test_embedder.h",
+    "+third_party/mojo/src/mojo/edk/embedder/embedder.h",
   ],
   "html_frame_apptest\.cc": [
     "+components/web_view",
diff --git a/components/html_viewer/run_all_unittests.cc b/components/html_viewer/run_all_unittests.cc
index 5ce14d6..537e378 100644
--- a/components/html_viewer/run_all_unittests.cc
+++ b/components/html_viewer/run_all_unittests.cc
@@ -7,7 +7,7 @@
 #include "base/path_service.h"
 #include "base/test/launcher/unit_test_launcher.h"
 #include "base/test/test_suite.h"
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/gfx/geometry/size.h"
 #include "ui/mojo/init/ui_init.h"
@@ -60,7 +60,7 @@
 #else
   base::AtExitManager at_exit;
 #endif
-  mojo::embedder::test::InitWithSimplePlatformSupport();
+  mojo::embedder::Init();
 
   return base::LaunchUnitTests(argc,
                                argv,
diff --git a/components/nacl.gyp b/components/nacl.gyp
index 480b135..30ee743 100644
--- a/components/nacl.gyp
+++ b/components/nacl.gyp
@@ -318,11 +318,6 @@
                 }, {
                   'defines': ['USE_SECCOMP_BPF'],
                 }],
-                ['use_openssl == 0', {
-                  'dependencies': [
-                    '../sandbox/sandbox.gyp:libc_urandom_override',
-                  ],
-                }],
               ],
               'cflags': ['-fPIE'],
             },
diff --git a/components/nacl/BUILD.gn b/components/nacl/BUILD.gn
index dbc32ee..1284792c 100644
--- a/components/nacl/BUILD.gn
+++ b/components/nacl/BUILD.gn
@@ -39,6 +39,10 @@
       "//ppapi/proxy:ipc",
       "//ppapi/shared_impl",
       "//third_party/mojo/src/mojo/edk/embedder",
+      # TODO(use_chrome_edk): so that EDK in third_party can choose the EDK in
+      # src/mojo if the command line flag is specified. It has to since we can
+      # only have one definition of the Mojo primitives.
+      "//mojo/edk/embedder",
     ]
 
     if (enable_nacl_untrusted) {
@@ -192,10 +196,6 @@
       cflags = [ "-fPIE" ]
 
       ldflags = [ "-pie" ]
-
-      if (!use_openssl) {
-        deps += [ "//sandbox/linux:libc_urandom_override" ]
-      }
     }
 
     source_set("nacl_linux") {
diff --git a/components/nacl/broker/nacl_broker_listener.cc b/components/nacl/broker/nacl_broker_listener.cc
index 84bba866..1116aadf 100644
--- a/components/nacl/broker/nacl_broker_listener.cc
+++ b/components/nacl/broker/nacl_broker_listener.cc
@@ -18,10 +18,15 @@
 #include "components/nacl/common/nacl_switches.h"
 #include "content/public/common/content_switches.h"
 #include "content/public/common/sandbox_init.h"
+#include "ipc/attachment_broker_unprivileged.h"
 #include "ipc/ipc_channel.h"
 #include "ipc/ipc_switches.h"
 #include "sandbox/win/src/sandbox_policy.h"
 
+#if defined(OS_WIN)
+#include "ipc/attachment_broker_unprivileged_win.h"
+#endif
+
 namespace {
 
 void SendReply(IPC::Channel* channel, int32 pid, bool result) {
@@ -31,6 +36,10 @@
 }  // namespace
 
 NaClBrokerListener::NaClBrokerListener() {
+#if defined(OS_WIN)
+  attachment_broker_.reset(new IPC::AttachmentBrokerUnprivilegedWin);
+  IPC::AttachmentBroker::SetGlobal(attachment_broker_.get());
+#endif
 }
 
 NaClBrokerListener::~NaClBrokerListener() {
@@ -41,6 +50,8 @@
       base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
           switches::kProcessChannelID);
   channel_ = IPC::Channel::CreateClient(channel_name, this);
+  if (attachment_broker_.get())
+    attachment_broker_->DesignateBrokerCommunicationChannel(channel_.get());
   CHECK(channel_->Connect());
   base::MessageLoop::current()->Run();
 }
diff --git a/components/nacl/broker/nacl_broker_listener.h b/components/nacl/broker/nacl_broker_listener.h
index 61d2651..0585008 100644
--- a/components/nacl/broker/nacl_broker_listener.h
+++ b/components/nacl/broker/nacl_broker_listener.h
@@ -12,6 +12,7 @@
 #include "ipc/ipc_listener.h"
 
 namespace IPC {
+class AttachmentBrokerUnprivileged;
 class Channel;
 }
 
@@ -41,6 +42,7 @@
   void OnStopBroker();
 
   base::Process browser_process_;
+  scoped_ptr<IPC::AttachmentBrokerUnprivileged> attachment_broker_;
   scoped_ptr<IPC::Channel> channel_;
 
   DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener);
diff --git a/components/nacl/loader/nacl_helper_linux.cc b/components/nacl/loader/nacl_helper_linux.cc
index 2f2530d..f81323ae 100644
--- a/components/nacl/loader/nacl_helper_linux.cc
+++ b/components/nacl/loader/nacl_helper_linux.cc
@@ -38,7 +38,6 @@
 #include "content/public/common/content_descriptors.h"
 #include "content/public/common/send_zygote_child_ping_linux.h"
 #include "content/public/common/zygote_fork_delegate_linux.h"
-#include "crypto/nss_util.h"
 #include "ipc/ipc_descriptors.h"
 #include "ipc/ipc_switches.h"
 #include "sandbox/linux/services/credentials.h"
@@ -51,10 +50,6 @@
 #include "components/nacl/loader/nonsfi/irt_exception_handling.h"
 #endif
 
-#if !defined(USE_OPENSSL)
-#include "sandbox/linux/services/libc_urandom_override.h"
-#endif
-
 namespace {
 
 struct NaClLoaderSystemInfo {
@@ -440,22 +435,6 @@
   base::AtExitManager exit_manager;
   base::RandUint64();  // acquire /dev/urandom fd before sandbox is raised
 
-  // NSS is only needed for SFI NaCl.
-#if !defined(OS_NACL_NONSFI) && !defined(USE_OPENSSL)
-  // Allows NSS to fopen() /dev/urandom.
-  sandbox::InitLibcUrandomOverrides();
-  // Configure NSS for use inside the NaCl process.
-  // The fork check has not caused problems for NaCl, but this appears to be
-  // best practice (see other places LoadNSSLibraries is called.)
-  crypto::DisableNSSForkCheck();
-  // Without this line on Linux, HMAC::Init will instantiate a singleton that
-  // in turn attempts to open a file.  Disabling this behavior avoids a ~70 ms
-  // stall the first time HMAC is used.
-  crypto::ForceNSSNoDBInit();
-  // Load shared libraries before sandbox is raised.
-  // NSS is needed to perform hashing for validation caching.
-  crypto::LoadNSSLibraries();
-#endif  // !defined(OS_NACL_NONSFI) && !defined(USE_OPENSSL)
   const NaClLoaderSystemInfo system_info = {
 #if !defined(OS_NACL_NONSFI)
     // These are not used by nacl_helper_nonsfi.
diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc
index 45caede..918e8c7 100644
--- a/components/nacl/loader/nacl_listener.cc
+++ b/components/nacl/loader/nacl_listener.cc
@@ -24,6 +24,7 @@
 #include "components/nacl/loader/nacl_ipc_adapter.h"
 #include "components/nacl/loader/nacl_validation_db.h"
 #include "components/nacl/loader/nacl_validation_query.h"
+#include "ipc/attachment_broker_unprivileged.h"
 #include "ipc/ipc_channel_handle.h"
 #include "ipc/ipc_switches.h"
 #include "ipc/ipc_sync_channel.h"
@@ -44,6 +45,7 @@
 #include <io.h>
 
 #include "content/public/common/sandbox_init.h"
+#include "ipc/attachment_broker_unprivileged_win.h"
 #endif
 
 namespace {
@@ -194,17 +196,21 @@
   NaClListener* listener_;
 };
 
-
-NaClListener::NaClListener() : shutdown_event_(true, false),
-                               io_thread_("NaCl_IOThread"),
+NaClListener::NaClListener()
+    : shutdown_event_(true, false),
+      io_thread_("NaCl_IOThread"),
 #if defined(OS_LINUX)
-                               prereserved_sandbox_size_(0),
+      prereserved_sandbox_size_(0),
 #endif
 #if defined(OS_POSIX)
-                               number_of_cores_(-1),  // unknown/error
+      number_of_cores_(-1),  // unknown/error
 #endif
-                               main_loop_(NULL),
-                               is_started_(false) {
+      main_loop_(NULL),
+      is_started_(false) {
+#if defined(OS_WIN)
+  attachment_broker_.reset(new IPC::AttachmentBrokerUnprivilegedWin);
+  IPC::AttachmentBroker::SetGlobal(attachment_broker_.get());
+#endif
   io_thread_.StartWithOptions(
       base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
   DCHECK(g_listener == NULL);
@@ -265,6 +271,8 @@
   filter_ = channel_->CreateSyncMessageFilter();
   channel_->AddFilter(new FileTokenMessageFilter());
   channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true);
+  if (attachment_broker_.get())
+    attachment_broker_->DesignateBrokerCommunicationChannel(channel_.get());
   main_loop_ = base::MessageLoop::current();
   main_loop_->Run();
 }
diff --git a/components/nacl/loader/nacl_listener.h b/components/nacl/loader/nacl_listener.h
index 42ce1f0..ac05b815 100644
--- a/components/nacl/loader/nacl_listener.h
+++ b/components/nacl/loader/nacl_listener.h
@@ -17,6 +17,7 @@
 #include "ipc/ipc_listener.h"
 
 namespace IPC {
+class AttachmentBrokerUnprivileged;
 class SyncChannel;
 class SyncMessageFilter;
 }
@@ -74,6 +75,8 @@
       const nacl::NaClResourcePrefetchResult& prefetched_resource_file);
   void OnStart(const nacl::NaClStartParams& params);
 
+  scoped_ptr<IPC::AttachmentBrokerUnprivileged> attachment_broker_;
+
   // A channel back to the browser.
   scoped_ptr<IPC::SyncChannel> channel_;
 
diff --git a/components/page_load_metrics/browser/DEPS b/components/page_load_metrics/browser/DEPS
index f29de5b..9579c84 100644
--- a/components/page_load_metrics/browser/DEPS
+++ b/components/page_load_metrics/browser/DEPS
@@ -1,4 +1,5 @@
 include_rules = [
   "+content/public/browser",
   "+components/page_load_metrics/browser",
+  "+net/base",
 ]
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
index 69ffa62d..df37a05 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
@@ -64,9 +64,16 @@
                              base::TimeDelta::FromMinutes(10), 100)
 
 PageLoadTracker::PageLoadTracker(bool in_foreground)
-    : has_commit_(false), started_in_foreground_(in_foreground) {}
+    : has_commit_(false), started_in_foreground_(in_foreground) {
+  RecordEvent(PAGE_LOAD_STARTED);
+}
 
 PageLoadTracker::~PageLoadTracker() {
+  // Even a load that failed a provisional load should log
+  // that it aborted before first layout.
+  if (timing_.first_layout.is_zero())
+    RecordEvent(PAGE_LOAD_ABORTED_BEFORE_FIRST_LAYOUT);
+
   if (has_commit_)
     RecordTimingHistograms();
 }
@@ -132,11 +139,19 @@
     if (timing_.first_layout < background_delta) {
       PAGE_LOAD_HISTOGRAM("PageLoad.Timing2.NavigationToFirstLayout",
                           timing_.first_layout);
+      RecordEvent(PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_FOREGROUND);
     } else {
       PAGE_LOAD_HISTOGRAM("PageLoad.Timing2.NavigationToFirstLayout.BG",
                           timing_.first_layout);
+      RecordEvent(PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_BACKGROUND);
     }
   }
+
+}
+
+void PageLoadTracker::RecordEvent(PageLoadEvent event) {
+  UMA_HISTOGRAM_ENUMERATION(
+      "PageLoad.EventCounts", event, PAGE_LOAD_LAST_ENTRY);
 }
 
 MetricsWebContentsObserver::MetricsWebContentsObserver(
@@ -179,12 +194,14 @@
       provisional_loads_.take_and_erase(navigation_handle));
   DCHECK(finished_nav);
 
-  // TODO(csharrison) handle the two error cases:
-  // 1. Error pages that replace the previous page.
-  // 2. Error pages that leave the user on the previous page.
-  // For now these cases will be ignored.
-  if (!navigation_handle->HasCommitted())
+  // Handle a pre-commit error here. Navigations that result in an error page
+  // will be ignored.
+  if (!navigation_handle->HasCommitted()) {
+    finished_nav->RecordEvent(PAGE_LOAD_FAILED_BEFORE_COMMIT);
+    if (navigation_handle->GetNetErrorCode() == net::ERR_ABORTED)
+      finished_nav->RecordEvent(PAGE_LOAD_ABORTED_BEFORE_COMMIT);
     return;
+  }
 
   // Don't treat a same-page nav as a new page load.
   if (navigation_handle->IsSamePage())
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.h b/components/page_load_metrics/browser/metrics_web_contents_observer.h
index 45780c1..cf39dc9 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.h
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.h
@@ -12,6 +12,7 @@
 #include "content/public/browser/web_contents.h"
 #include "content/public/browser/web_contents_observer.h"
 #include "content/public/browser/web_contents_user_data.h"
+#include "net/base/net_errors.h"
 
 namespace content {
 class NavigationHandle;
@@ -24,6 +25,37 @@
 
 namespace page_load_metrics {
 
+// If you add elements from this enum, make sure you update the enum
+// value in histograms.xml. Only add elements to the end to prevent
+// inconsistencies between versions.
+enum PageLoadEvent {
+  PAGE_LOAD_STARTED,
+
+  // A provisional load is a load before it commits, i.e. before it receives the
+  // first bytes of the response body or knows the encoding of the response
+  // body. A load failed before it was committed for any reason, e.g. from a
+  // user abort or a network timeout.
+  PAGE_LOAD_FAILED_BEFORE_COMMIT,
+
+  // A subset of PAGE_LOAD_FAILED_BEFORE_COMMIT, this counts the
+  // specific failures due to user aborts.
+  PAGE_LOAD_ABORTED_BEFORE_COMMIT,
+
+  // When a load is aborted anytime before the page's first layout, we increase
+  // these counts. This includes all failed provisional loads.
+  PAGE_LOAD_ABORTED_BEFORE_FIRST_LAYOUT,
+
+  // We increase this count if a page load successfully has a layout.
+  // Differentiate between loads that were backgrounded before first layout.
+  // Note that a load that is backgrounded, then foregrounded before first
+  // layout will still end up in the backgrounded bucket.
+  PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_FOREGROUND,
+  PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_BACKGROUND,
+
+  // Add values before this final count.
+  PAGE_LOAD_LAST_ENTRY
+};
+
 class PageLoadTracker {
  public:
   explicit PageLoadTracker(bool in_foreground);
@@ -33,6 +65,7 @@
 
   // Returns true if the timing was successfully updated.
   bool UpdateTiming(const PageLoadTiming& timing);
+  void RecordEvent(PageLoadEvent event);
 
  private:
   void RecordTimingHistograms();
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc b/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
index c72e647..147f09434 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc
@@ -35,6 +35,9 @@
     "PageLoad.Timing2.NavigationToDOMContentLoadedEventFired.BG";
 const char kBGHistogramNameLoad[] =
     "PageLoad.Timing2.NavigationToLoadEventFired.BG";
+
+const char kHistogramNameEvents[] = "PageLoad.EventCounts";
+
 }  //  namespace
 
 class MetricsWebContentsObserverTest
@@ -334,4 +337,123 @@
   histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout,
                                       first_layout.InMilliseconds(), 1);
 }
+
+TEST_F(MetricsWebContentsObserverTest, FailProvisionalLoad) {
+  content::WebContentsTester* web_contents_tester =
+      content::WebContentsTester::For(web_contents());
+
+  web_contents_tester->StartNavigation(GURL(kDefaultTestUrl));
+  content::RenderFrameHostTester* rfh_tester =
+      content::RenderFrameHostTester::For(main_rfh());
+  rfh_tester->SimulateNavigationError(GURL(kDefaultTestUrl),
+                                      net::ERR_TIMED_OUT);
+  rfh_tester->SimulateNavigationStop();
+
+  histogram_tester_.ExpectTotalCount(kHistogramNameEvents, 3);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_STARTED, 1);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_FAILED_BEFORE_COMMIT, 1);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_ABORTED_BEFORE_FIRST_LAYOUT, 1);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_ABORTED_BEFORE_COMMIT, 0);
+}
+
+TEST_F(MetricsWebContentsObserverTest, AbortProvisionalLoad) {
+  content::WebContentsTester* web_contents_tester =
+      content::WebContentsTester::For(web_contents());
+
+  web_contents_tester->StartNavigation(GURL(kDefaultTestUrl));
+  content::RenderFrameHostTester* rfh_tester =
+      content::RenderFrameHostTester::For(main_rfh());
+  rfh_tester->SimulateNavigationError(GURL(kDefaultTestUrl), net::ERR_ABORTED);
+  rfh_tester->SimulateNavigationStop();
+
+  histogram_tester_.ExpectTotalCount(kHistogramNameEvents, 4);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_STARTED, 1);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_FAILED_BEFORE_COMMIT, 1);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_ABORTED_BEFORE_FIRST_LAYOUT, 1);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_ABORTED_BEFORE_COMMIT, 1);
+}
+
+TEST_F(MetricsWebContentsObserverTest, AbortCommittedLoadBeforeFirstLayout) {
+  PageLoadTiming timing;
+  timing.navigation_start = base::Time::FromDoubleT(10);
+
+  content::WebContentsTester* web_contents_tester =
+      content::WebContentsTester::For(web_contents());
+  web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl));
+
+  observer_->OnMessageReceived(
+      PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing),
+      main_rfh());
+  // Navigate again to force histogram logging.
+  web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2));
+
+  // 3 events: 2 starts and one abort before first layout.
+  histogram_tester_.ExpectTotalCount(kHistogramNameEvents, 3);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_STARTED, 2);
+  histogram_tester_.ExpectBucketCount(
+      kHistogramNameEvents, PAGE_LOAD_ABORTED_BEFORE_FIRST_LAYOUT, 1);
+}
+
+TEST_F(MetricsWebContentsObserverTest,
+       SuccessfulFirstLayoutInForeGroundEvent) {
+  PageLoadTiming timing;
+  timing.navigation_start = base::Time::FromDoubleT(10);
+  timing.first_layout = base::TimeDelta::FromMilliseconds(100);
+
+  content::WebContentsTester* web_contents_tester =
+      content::WebContentsTester::For(web_contents());
+  web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl));
+
+  observer_->OnMessageReceived(
+      PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing),
+      main_rfh());
+  // Navigate again to force histogram logging.
+  web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2));
+
+  // 3 events: 2 starts and one successful first layout.
+  histogram_tester_.ExpectTotalCount(kHistogramNameEvents, 3);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_STARTED, 2);
+  histogram_tester_.ExpectBucketCount(
+      kHistogramNameEvents, PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_FOREGROUND, 1);
+}
+
+TEST_F(MetricsWebContentsObserverTest,
+       SuccessfulFirstLayoutInBackgroundEvent) {
+  PageLoadTiming timing;
+  timing.navigation_start = base::Time::FromDoubleT(
+      (base::TimeTicks::Now() - base::TimeTicks::UnixEpoch()).InSecondsF() - 1);
+
+  timing.first_layout = base::TimeDelta::FromSeconds(30);
+
+  content::WebContentsTester* web_contents_tester =
+      content::WebContentsTester::For(web_contents());
+  web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl));
+  // Background the tab.
+  observer_->WasHidden();
+
+  observer_->OnMessageReceived(
+      PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing),
+      main_rfh());
+
+  observer_->WasShown();
+  // Navigate again to force histogram logging.
+  web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2));
+
+  // 3 events: 2 starts and one successful first layout.
+  histogram_tester_.ExpectTotalCount(kHistogramNameEvents, 3);
+  histogram_tester_.ExpectBucketCount(kHistogramNameEvents,
+                                      PAGE_LOAD_STARTED, 2);
+  histogram_tester_.ExpectBucketCount(
+      kHistogramNameEvents, PAGE_LOAD_SUCCESSFUL_FIRST_LAYOUT_BACKGROUND, 1);
+}
 }  // namespace page_load_metrics
diff --git a/components/password_manager/content/browser/credential_manager_dispatcher.cc b/components/password_manager/content/browser/credential_manager_dispatcher.cc
index bde0f031..a736209 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher.cc
+++ b/components/password_manager/content/browser/credential_manager_dispatcher.cc
@@ -86,19 +86,41 @@
   DCHECK(request_id);
 
   PasswordStore* store = GetPasswordStore();
-  if (store) {
-    if (!pending_require_user_mediation_) {
-      pending_require_user_mediation_.reset(
-          new CredentialManagerPendingRequireUserMediationTask(
-              this, web_contents()->GetLastCommittedURL().GetOrigin()));
+  if (!store) {
+    web_contents()->GetRenderViewHost()->Send(
+        new CredentialManagerMsg_AcknowledgeRequireUserMediation(
+            web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
+    return;
+  }
 
-      // This will result in a callback to
-      // CredentialManagerPendingRequireUserMediationTask::OnGetPasswordStoreResults().
-      store->GetAutofillableLogins(pending_require_user_mediation_.get());
-    } else {
-      pending_require_user_mediation_->AddOrigin(
-          web_contents()->GetLastCommittedURL().GetOrigin());
-    }
+  if (store->affiliated_match_helper()) {
+    store->affiliated_match_helper()->GetAffiliatedAndroidRealms(
+        GetSynthesizedFormForOrigin(),
+        base::Bind(&CredentialManagerDispatcher::ScheduleRequireMediationTask,
+                   weak_factory_.GetWeakPtr(), request_id));
+  } else {
+    std::vector<std::string> no_affiliated_realms;
+    ScheduleRequireMediationTask(request_id, no_affiliated_realms);
+  }
+}
+
+void CredentialManagerDispatcher::ScheduleRequireMediationTask(
+    int request_id,
+    const std::vector<std::string>& android_realms) {
+  DCHECK(GetPasswordStore());
+  if (!pending_require_user_mediation_) {
+    pending_require_user_mediation_.reset(
+        new CredentialManagerPendingRequireUserMediationTask(
+            this, web_contents()->GetLastCommittedURL().GetOrigin(),
+            android_realms));
+
+    // This will result in a callback to
+    // CredentialManagerPendingRequireUserMediationTask::OnGetPasswordStoreResults().
+    GetPasswordStore()->GetAutofillableLogins(
+        pending_require_user_mediation_.get());
+  } else {
+    pending_require_user_mediation_->AddOrigin(
+        web_contents()->GetLastCommittedURL().GetOrigin());
   }
 
   web_contents()->GetRenderViewHost()->Send(
diff --git a/components/password_manager/content/browser/credential_manager_dispatcher.h b/components/password_manager/content/browser/credential_manager_dispatcher.h
index df09e530..88712342 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher.h
+++ b/components/password_manager/content/browser/credential_manager_dispatcher.h
@@ -93,6 +93,13 @@
                            const std::vector<GURL>& federations,
                            const std::vector<std::string>& android_realms);
 
+  // Schedules a CredentialManagerPendingRequireUserMediationTask after the
+  // AffiliationMatchHelper grabs a list of realms related to the current
+  // web origin.
+  void ScheduleRequireMediationTask(
+      int request_id,
+      const std::vector<std::string>& android_realms);
+
   PasswordManagerClient* client_;
   scoped_ptr<CredentialManagerPasswordFormManager> form_manager_;
 
diff --git a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
index b96b5d7..d176b07 100644
--- a/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
+++ b/components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc
@@ -371,6 +371,42 @@
 }
 
 TEST_F(CredentialManagerDispatcherTest,
+       CredentialManagerOnRequireUserMediationWithAffiliation) {
+  store_->AddLogin(form_);
+  store_->AddLogin(cross_origin_form_);
+  store_->AddLogin(affiliated_form1_);
+  store_->AddLogin(affiliated_form2_);
+
+  MockAffiliatedMatchHelper* mock_helper = new MockAffiliatedMatchHelper;
+  store_->SetAffiliatedMatchHelper(make_scoped_ptr(mock_helper));
+
+  std::vector<GURL> federations;
+  std::vector<std::string> affiliated_realms;
+  affiliated_realms.push_back(kTestAndroidRealm1);
+  mock_helper->ExpectCallToGetAffiliatedAndroidRealms(
+      dispatcher_->GetSynthesizedFormForOrigin(), affiliated_realms);
+  RunAllPendingTasks();
+
+  TestPasswordStore::PasswordMap passwords = store_->stored_passwords();
+  EXPECT_EQ(4U, passwords.size());
+  EXPECT_FALSE(passwords[form_.signon_realm][0].skip_zero_click);
+  EXPECT_FALSE(passwords[cross_origin_form_.signon_realm][0].skip_zero_click);
+  EXPECT_FALSE(passwords[affiliated_form1_.signon_realm][0].skip_zero_click);
+  EXPECT_FALSE(passwords[affiliated_form2_.signon_realm][0].skip_zero_click);
+
+  dispatcher()->OnRequireUserMediation(kRequestId);
+  RunAllPendingTasks();
+  process()->sink().ClearMessages();
+
+  passwords = store_->stored_passwords();
+  EXPECT_EQ(4U, passwords.size());
+  EXPECT_TRUE(passwords[form_.signon_realm][0].skip_zero_click);
+  EXPECT_FALSE(passwords[cross_origin_form_.signon_realm][0].skip_zero_click);
+  EXPECT_TRUE(passwords[affiliated_form1_.signon_realm][0].skip_zero_click);
+  EXPECT_FALSE(passwords[affiliated_form2_.signon_realm][0].skip_zero_click);
+}
+
+TEST_F(CredentialManagerDispatcherTest,
        CredentialManagerOnRequestCredentialWithEmptyPasswordStore) {
   std::vector<GURL> federations;
   EXPECT_CALL(
diff --git a/components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.cc b/components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.cc
index 00b5138..9a2aba77 100644
--- a/components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.cc
+++ b/components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.cc
@@ -5,6 +5,7 @@
 #include "components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.h"
 
 #include "components/autofill/core/common/password_form.h"
+#include "components/password_manager/core/browser/affiliated_match_helper.h"
 #include "components/password_manager/core/browser/password_store.h"
 #include "url/gurl.h"
 
@@ -13,8 +14,10 @@
 CredentialManagerPendingRequireUserMediationTask::
     CredentialManagerPendingRequireUserMediationTask(
         CredentialManagerPendingRequireUserMediationTaskDelegate* delegate,
-        const GURL& origin)
-    : delegate_(delegate) {
+        const GURL& origin,
+        const std::vector<std::string>& affiliated_realms)
+    : delegate_(delegate),
+      affiliated_realms_(affiliated_realms.begin(), affiliated_realms.end()) {
   origins_.insert(origin.spec());
 }
 
@@ -30,7 +33,9 @@
     OnGetPasswordStoreResults(ScopedVector<autofill::PasswordForm> results) {
   PasswordStore* store = delegate_->GetPasswordStore();
   for (autofill::PasswordForm* form : results) {
-    if (origins_.count(form->origin.spec())) {
+    if (origins_.count(form->origin.spec()) ||
+        (affiliated_realms_.count(form->signon_realm) &&
+         AffiliatedMatchHelper::IsValidAndroidCredential(*form))) {
       form->skip_zero_click = true;
       // Note that UpdateLogin ends up copying the form while posting a task to
       // update the PasswordStore, so it's fine to let |results| delete the
diff --git a/components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.h b/components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.h
index 5aa129e..adbccbc 100644
--- a/components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.h
+++ b/components/password_manager/core/browser/credential_manager_pending_require_user_mediation_task.h
@@ -37,7 +37,8 @@
  public:
   CredentialManagerPendingRequireUserMediationTask(
       CredentialManagerPendingRequireUserMediationTaskDelegate* delegate,
-      const GURL& origin);
+      const GURL& origin,
+      const std::vector<std::string>& affiliated_realms);
   ~CredentialManagerPendingRequireUserMediationTask() override;
 
   // Adds an origin to require user mediation.
@@ -51,6 +52,7 @@
   CredentialManagerPendingRequireUserMediationTaskDelegate* const
       delegate_;  // Weak.
   std::set<std::string> origins_;
+  std::set<std::string> affiliated_realms_;
 
   DISALLOW_COPY_AND_ASSIGN(CredentialManagerPendingRequireUserMediationTask);
 };
diff --git a/components/precache/android/java/src/org/chromium/components/precache/DeviceState.java b/components/precache/android/java/src/org/chromium/components/precache/DeviceState.java
index 70995ca..4342537 100644
--- a/components/precache/android/java/src/org/chromium/components/precache/DeviceState.java
+++ b/components/precache/android/java/src/org/chromium/components/precache/DeviceState.java
@@ -10,7 +10,6 @@
 import android.net.ConnectivityManager;
 import android.os.BatteryManager;
 
-import org.chromium.base.ApiCompatibilityUtils;
 import org.chromium.base.VisibleForTesting;
 
 /**
@@ -60,10 +59,6 @@
                 || status == BatteryManager.BATTERY_STATUS_FULL;
     }
 
-    public boolean isInteractive(Context context) {
-        return ApiCompatibilityUtils.isInteractive(context);
-    }
-
     /** @return whether the currently active network is Wi-Fi, not roaming, and not metered. */
     public boolean isWifiAvailable(Context context) {
         NetworkInfoDelegate networkInfo =
diff --git a/components/precache/android/javatests/src/org/chromium/components/precache/MockDeviceState.java b/components/precache/android/javatests/src/org/chromium/components/precache/MockDeviceState.java
index 61f601f..1a691412 100644
--- a/components/precache/android/javatests/src/org/chromium/components/precache/MockDeviceState.java
+++ b/components/precache/android/javatests/src/org/chromium/components/precache/MockDeviceState.java
@@ -12,14 +12,12 @@
 public class MockDeviceState extends DeviceState {
     private final int mStickyBatteryStatus;
     private final boolean mPowerIsConnected;
-    private final boolean mInteractive;
     private final boolean mWifiIsAvailable;
 
-    public MockDeviceState(int stickyBatteryStatus, boolean powerIsConnected,
-            boolean interactive, boolean wifiIsAvailable) {
+    public MockDeviceState(
+            int stickyBatteryStatus, boolean powerIsConnected, boolean wifiIsAvailable) {
         mStickyBatteryStatus = stickyBatteryStatus;
         mPowerIsConnected = powerIsConnected;
-        mInteractive = interactive;
         mWifiIsAvailable = wifiIsAvailable;
     }
 
@@ -34,11 +32,6 @@
     }
 
     @Override
-    public boolean isInteractive(Context context) {
-        return mInteractive;
-    }
-
-    @Override
     public boolean isWifiAvailable(Context context) {
         return mWifiIsAvailable;
     }
diff --git a/components/scheduler/renderer/renderer_scheduler_impl.cc b/components/scheduler/renderer/renderer_scheduler_impl.cc
index 6113e23c..1193339b 100644
--- a/components/scheduler/renderer/renderer_scheduler_impl.cc
+++ b/components/scheduler/renderer/renderer_scheduler_impl.cc
@@ -639,8 +639,7 @@
   if (block_expensive_tasks && loading_tasks_seem_expensive)
     new_policy.loading_queue_priority = TaskQueue::DISABLED_PRIORITY;
 
-  if ((block_expensive_tasks && timer_tasks_seem_expensive) ||
-      MainThreadOnly().timer_queue_suspend_count != 0 ||
+  if (MainThreadOnly().timer_queue_suspend_count != 0 ||
       MainThreadOnly().timer_queue_suspended_when_backgrounded) {
     new_policy.timer_queue_priority = TaskQueue::DISABLED_PRIORITY;
   }
diff --git a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
index 8c394370da..4956bf13 100644
--- a/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
+++ b/components/scheduler/renderer/renderer_scheduler_impl_unittest.cc
@@ -736,9 +736,10 @@
   EXPECT_EQ(RendererScheduler::UseCase::COMPOSITOR_GESTURE, CurrentUseCase());
 }
 
+// TODO(skyostil): Re-enable once timer blocking is re-enabled.
 TEST_F(
     RendererSchedulerImplTest,
-    TestCompositorPolicy_ExpensiveTimersDontRunWhenMainThreadOnCriticalPath) {
+    DISABLED_TestCompositorPolicy_ExpensiveTimersDontRunWhenMainThreadOnCriticalPath) {
   std::vector<std::string> run_order;
 
   SimulateExpensiveTasks(timer_task_runner_);
diff --git a/components/scheduler/scheduler.gypi b/components/scheduler/scheduler.gypi
index d9799d26..13ca288e6 100644
--- a/components/scheduler/scheduler.gypi
+++ b/components/scheduler/scheduler.gypi
@@ -9,6 +9,7 @@
       'base/cancelable_closure_holder.h',
       'base/lazy_now.cc',
       'base/lazy_now.h',
+      'base/nestable_single_thread_task_runner.h',
       'base/task_queue.cc',
       'base/task_queue.h',
       'base/task_queue_impl.cc',
@@ -24,7 +25,6 @@
       'child/child_scheduler.h',
       'child/idle_helper.cc',
       'child/idle_helper.h',
-      'child/nestable_single_thread_task_runner.h',
       'child/scheduler_helper.cc',
       'child/scheduler_helper.h',
       'child/scheduler_task_runner_delegate.h',
diff --git a/components/signin/core/browser/about_signin_internals.cc b/components/signin/core/browser/about_signin_internals.cc
index 514f1bf0..7f3a6a10 100644
--- a/components/signin/core/browser/about_signin_internals.cc
+++ b/components/signin/core/browser/about_signin_internals.cc
@@ -514,8 +514,6 @@
   AddSectionEntry(basic_info, "Chrome Version", product_version);
   AddSectionEntry(basic_info, "Webview Based Signin?",
       switches::IsEnableWebviewBasedSignin() == true ? "On" : "Off");
-  AddSectionEntry(basic_info, "New Avatar Menu?",
-      switches::IsNewAvatarMenu() == true ? "On" : "Off");
   AddSectionEntry(basic_info, "New Profile Management?",
       switches::IsNewProfileManagement() == true ? "On" : "Off");
   AddSectionEntry(basic_info, "Account Consistency?",
diff --git a/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java b/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
index d2fe991..db155bc 100644
--- a/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
+++ b/components/signin/core/browser/android/java/src/org/chromium/components/signin/ChildAccountInfoFetcher.java
@@ -5,19 +5,13 @@
 package org.chromium.components.signin;
 
 import android.accounts.Account;
-import android.accounts.AccountManagerCallback;
-import android.accounts.AccountManagerFuture;
-import android.accounts.AuthenticatorException;
-import android.accounts.OperationCanceledException;
 import android.content.Context;
 
 import org.chromium.base.ApplicationStatus;
-import org.chromium.base.Log;
 import org.chromium.base.annotations.CalledByNative;
+import org.chromium.sync.signin.AccountManagerDelegate.Callback;
 import org.chromium.sync.signin.AccountManagerHelper;
 
-import java.io.IOException;
-
 /**
  * ChildAccountInfoFetcher for the Android platform.
  * Checks whether an account is a child account from the AccountManager.
@@ -35,30 +29,11 @@
         Context app = ApplicationStatus.getApplicationContext();
         assert app != null;
         AccountManagerHelper helper = AccountManagerHelper.get(app);
-        Account[] accounts = helper.getGoogleAccounts();
-        Account candidate_account = null;
-        for (Account account : accounts) {
-            if (account.name.equals(accountName)) {
-                candidate_account = account;
-                break;
-            }
-        }
-        if (candidate_account == null) {
-            nativeSetIsChildAccount(nativeAccountFetcherService, accountId, false);
-            return;
-        }
-        helper.checkChildAccount(candidate_account, new AccountManagerCallback<Boolean>() {
+        Account account = helper.createAccountFromName(accountName);
+        helper.checkChildAccount(account, new Callback<Boolean>() {
             @Override
-            public void run(AccountManagerFuture<Boolean> future) {
-                assert future.isDone();
-                try {
-                    boolean isChildAccount = future.getResult();
-                    nativeSetIsChildAccount(nativeAccountFetcherService, accountId, isChildAccount);
-                } catch (AuthenticatorException | IOException e) {
-                    Log.e(TAG, "Error while fetching child account info: ", e);
-                } catch (OperationCanceledException e) {
-                    Log.e(TAG, "Child account info fetch was cancelled. This should not happen.");
-                }
+            public void gotResult(Boolean isChildAccount) {
+                nativeSetIsChildAccount(nativeAccountFetcherService, accountId, isChildAccount);
             }
         });
     }
diff --git a/components/signin/core/browser/child_account_info_fetcher_android.cc b/components/signin/core/browser/child_account_info_fetcher_android.cc
index 0c7c59a..1321588 100644
--- a/components/signin/core/browser/child_account_info_fetcher_android.cc
+++ b/components/signin/core/browser/child_account_info_fetcher_android.cc
@@ -17,6 +17,9 @@
   JNIEnv* env = base::android::AttachCurrentThread();
   std::string account_name =
       service->account_tracker_service()->GetAccountInfo(account_id).email;
+  // The AccountTrackerService may not be populated correctly in tests.
+  if (account_name.empty())
+    return;
   Java_ChildAccountInfoFetcher_fetch(
       env, reinterpret_cast<jlong>(service),
       base::android::ConvertUTF8ToJavaString(env, account_id).obj(),
diff --git a/components/signin/core/common/profile_management_switches.cc b/components/signin/core/common/profile_management_switches.cc
index 768ae5c..5231174 100644
--- a/components/signin/core/common/profile_management_switches.cc
+++ b/components/signin/core/common/profile_management_switches.cc
@@ -17,7 +17,6 @@
 // below assumes the order of the values in this enum.  That is, new profile
 // management is included in consistent identity.
 enum State {
-  STATE_OLD_AVATAR_MENU,
   STATE_NEW_AVATAR_MENU,
   STATE_NEW_PROFILE_MANAGEMENT,
   STATE_ACCOUNT_CONSISTENCY,
@@ -25,26 +24,20 @@
 
 State GetProcessState() {
   // Find the state of both command line args.
-  bool is_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch(
-      switches::kEnableNewAvatarMenu);
   bool is_new_profile_management =
       base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kEnableNewProfileManagement);
   bool is_consistent_identity =
       base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kEnableAccountConsistency);
-  bool not_new_avatar_menu = base::CommandLine::ForCurrentProcess()->HasSwitch(
-      switches::kDisableNewAvatarMenu);
   bool not_new_profile_management =
       base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kDisableNewProfileManagement);
   bool not_consistent_identity =
       base::CommandLine::ForCurrentProcess()->HasSwitch(
           switches::kDisableAccountConsistency);
-  int count_args = (is_new_avatar_menu ? 1 : 0) +
-      (is_new_profile_management ? 1 : 0) +
+  int count_args = (is_new_profile_management ? 1 : 0) +
       (is_consistent_identity ? 1 : 0) +
-      (not_new_avatar_menu ? 1 : 0) +
       (not_new_profile_management ? 1 : 0) +
       (not_consistent_identity ? 1 : 0);
   bool invalid_commandline = count_args > 1;
@@ -67,17 +60,12 @@
         base::FieldTrialList::FindFullName(kNewProfileManagementFieldTrialName);
   }
 
-  // Forcing the old avatar menu takes precedent over other args.
   // Enable command line args take precedent over disable command line args.
   // Consistent identity args take precedent over new profile management args.
-  if (not_new_avatar_menu) {
-    return STATE_OLD_AVATAR_MENU;
-  } else if (is_consistent_identity) {
+  if (is_consistent_identity) {
     return STATE_ACCOUNT_CONSISTENCY;
   } else if (is_new_profile_management) {
     return STATE_NEW_PROFILE_MANAGEMENT;
-  } else if (is_new_avatar_menu) {
-    return STATE_NEW_AVATAR_MENU;
   } else if (not_new_profile_management) {
     return STATE_NEW_AVATAR_MENU;
   } else if (not_consistent_identity) {
@@ -141,15 +129,6 @@
   return CheckFlag(switches::kGoogleProfileInfo, STATE_NEW_AVATAR_MENU);
 }
 
-bool IsNewAvatarMenu() {
-  // NewAvatarMenu is only available on desktop.
-#if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_CHROMEOS)
-  return false;
-#else
-  return GetProcessState() >= STATE_NEW_AVATAR_MENU;
-#endif
-}
-
 bool IsNewProfileManagement() {
   return GetProcessState() >= STATE_NEW_PROFILE_MANAGEMENT;
 }
@@ -159,16 +138,6 @@
   return false;
 }
 
-void EnableNewAvatarMenuForTesting(base::CommandLine* command_line) {
-  command_line->AppendSwitch(switches::kEnableNewAvatarMenu);
-  DCHECK(!command_line->HasSwitch(switches::kDisableNewAvatarMenu));
-}
-
-void DisableNewAvatarMenuForTesting(base::CommandLine* command_line) {
-  command_line->AppendSwitch(switches::kDisableNewAvatarMenu);
-  DCHECK(!command_line->HasSwitch(switches::kEnableNewAvatarMenu));
-}
-
 void EnableNewProfileManagementForTesting(base::CommandLine* command_line) {
   command_line->AppendSwitch(switches::kEnableNewProfileManagement);
   DCHECK(!command_line->HasSwitch(switches::kDisableNewProfileManagement));
diff --git a/components/signin/core/common/profile_management_switches.h b/components/signin/core/common/profile_management_switches.h
index c1ad761..9ef7ab6 100644
--- a/components/signin/core/common/profile_management_switches.h
+++ b/components/signin/core/common/profile_management_switches.h
@@ -28,20 +28,13 @@
 // Enables using GAIA information to populate profile name and icon.
 bool IsGoogleProfileInfo();
 
-// Whether the new avatar menu is enabled, either because new profile management
-// is enabled or because the new profile management preview UI is enabled.
-bool IsNewAvatarMenu();
-
 // Use new profile management system, including profile sign-out and new
 // choosers.
 bool IsNewProfileManagement();
 
 // Whether the new profile management preview has been enabled.
 bool IsNewProfileManagementPreviewEnabled();
-
 // Called in tests to force enabling different modes.
-void EnableNewAvatarMenuForTesting(base::CommandLine* command_line);
-void DisableNewAvatarMenuForTesting(base::CommandLine* command_line);
 void EnableNewProfileManagementForTesting(base::CommandLine* command_line);
 void EnableAccountConsistencyForTesting(base::CommandLine* command_line);
 
diff --git a/components/signin/core/common/signin_switches.cc b/components/signin/core/common/signin_switches.cc
index 2e1950c..a9e549a 100644
--- a/components/signin/core/common/signin_switches.cc
+++ b/components/signin/core/common/signin_switches.cc
@@ -16,9 +16,6 @@
 // Disables new profile management system, including new profile chooser UI.
 const char kDisableNewProfileManagement[] = "disable-new-profile-management";
 
-// Disables the new avatar menu, forcing the top-corner avatar button.
-const char kDisableNewAvatarMenu[] = "disable-new-avatar-menu";
-
 // Disable sending signin scoped device id to LSO with refresh token request.
 const char kDisableSigninScopedDeviceId[] = "disable-signin-scoped-device-id";
 
@@ -29,9 +26,6 @@
 // webview-based flow.
 const char kEnableIframeBasedSignin[] = "enable-iframe-based-signin";
 
-// Enable the new avatar menu and the User Manager.
-const char kEnableNewAvatarMenu[] = "enable-new-avatar-menu";
-
 // Enables new profile management system, including lock mode.
 const char kEnableNewProfileManagement[] = "new-profile-management";
 
diff --git a/components/signin/core/common/signin_switches.h b/components/signin/core/common/signin_switches.h
index 68f34ce33..9e0154ff 100644
--- a/components/signin/core/common/signin_switches.h
+++ b/components/signin/core/common/signin_switches.h
@@ -15,12 +15,10 @@
 // alongside the definition of their values in the .cc file.
 extern const char kClearTokenService[];
 extern const char kDisableAccountConsistency[];
-extern const char kDisableNewAvatarMenu[];
 extern const char kDisableNewProfileManagement[];
 extern const char kDisableSigninScopedDeviceId[];
 extern const char kEnableAccountConsistency[];
 extern const char kEnableIframeBasedSignin[];
-extern const char kEnableNewAvatarMenu[];
 extern const char kEnableNewProfileManagement[];
 extern const char kEnableRefreshTokenAnnotationRequest[];
 extern const char kExtensionsMultiAccount[];
diff --git a/components/test/DEPS b/components/test/DEPS
index 640fa0a..7bd6a586 100644
--- a/components/test/DEPS
+++ b/components/test/DEPS
@@ -5,6 +5,7 @@
   "+components/policy/core/browser/android/component_jni_registrar.h",
   "+components/safe_json/android/component_jni_registrar.h",
   "+components/signin/core/browser/android/component_jni_registrar.h",
+  "+content/browser/android/browser_jni_registrar.h",
   "+content/public/android/java/src/org/chromium/content/browser",
   "+content/public/app/content_jni_onload.h",
   "+content/public/app/content_main.h",
@@ -16,6 +17,7 @@
   "+content/shell/app/shell_main_delegate.h",
   "+jni",
   "+media/base/media_switches.h",
+  "+net/android/net_jni_registrar.h",
   "+ui/android/java/src/org/chromium/ui/base",
   "+ui/base/android/ui_base_jni_registrar.h",
   "+ui/base/resource/resource_bundle.h",
diff --git a/components/test/run_all_unittests.cc b/components/test/run_all_unittests.cc
index d04085e..ef7d826 100644
--- a/components/test/run_all_unittests.cc
+++ b/components/test/run_all_unittests.cc
@@ -26,6 +26,8 @@
 #include "components/policy/core/browser/android/component_jni_registrar.h"
 #include "components/safe_json/android/component_jni_registrar.h"
 #include "components/signin/core/browser/android/component_jni_registrar.h"
+#include "content/browser/android/browser_jni_registrar.h"
+#include "net/android/net_jni_registrar.h"
 #include "ui/base/android/ui_base_jni_registrar.h"
 #include "ui/gfx/android/gfx_jni_registrar.h"
 #endif
@@ -57,6 +59,8 @@
     ASSERT_TRUE(policy::android::RegisterPolicy(env));
     ASSERT_TRUE(safe_json::android::RegisterSafeJsonJni(env));
     ASSERT_TRUE(signin::android::RegisterSigninJni(env));
+    ASSERT_TRUE(net::android::RegisterJni(env));
+    ASSERT_TRUE(content::android::RegisterBrowserJni(env));
 #endif
 
     ui::RegisterPathProvider();
diff --git a/components/test_runner/event_sender.cc b/components/test_runner/event_sender.cc
index bc59773..457027e 100644
--- a/components/test_runner/event_sender.cc
+++ b/components/test_runner/event_sender.cc
@@ -404,6 +404,7 @@
   void TouchCancel();
   void TouchEnd();
   void LeapForward(int milliseconds);
+  double LastEventTimestamp();
   void BeginDragWithFiles(const std::vector<std::string>& files);
   void AddTouchPoint(double x, double y, gin::Arguments* args);
   void MouseDragBegin();
@@ -531,6 +532,7 @@
       .SetMethod("touchCancel", &EventSenderBindings::TouchCancel)
       .SetMethod("touchEnd", &EventSenderBindings::TouchEnd)
       .SetMethod("leapForward", &EventSenderBindings::LeapForward)
+      .SetMethod("lastEventTimestamp", &EventSenderBindings::LastEventTimestamp)
       .SetMethod("beginDragWithFiles", &EventSenderBindings::BeginDragWithFiles)
       .SetMethod("addTouchPoint", &EventSenderBindings::AddTouchPoint)
       .SetMethod("mouseDragBegin", &EventSenderBindings::MouseDragBegin)
@@ -729,6 +731,12 @@
     sender_->LeapForward(milliseconds);
 }
 
+double EventSenderBindings::LastEventTimestamp() {
+  if (sender_)
+    return sender_->last_event_timestamp();
+  return 0;
+}
+
 void EventSenderBindings::BeginDragWithFiles(
     const std::vector<std::string>& files) {
   if (sender_)
@@ -1888,7 +1896,7 @@
                  click_count_,
                  0,
                  &event);
-   view_->handleInputEvent(event);
+   HandleInputEventOnViewOrPopup(event);
 }
 
 
@@ -1946,7 +1954,8 @@
 }
 
 double EventSender::GetCurrentEventTimeSec() {
-  return (delegate_->GetCurrentTimeInMillisecond() + time_offset_ms_) / 1000.0;
+  return (base::TimeTicks::Now() - base::TimeTicks()).InSeconds() +
+         time_offset_ms_ / 1000.0;
 }
 
 void EventSender::DoLeapForward(int milliseconds) {
@@ -2487,6 +2496,8 @@
 }
 
 bool EventSender::HandleInputEventOnViewOrPopup(const WebInputEvent& event) {
+  last_event_timestamp_ = event.timeStampSeconds;
+
   if (WebPagePopup* popup = view_->pagePopup()) {
     if (!WebInputEvent::isKeyboardEventType(event.type))
       return popup->handleInputEvent(event);
diff --git a/components/test_runner/event_sender.h b/components/test_runner/event_sender.h
index f882290..6f48eaf 100644
--- a/components/test_runner/event_sender.h
+++ b/components/test_runner/event_sender.h
@@ -184,6 +184,8 @@
   void ReplaySavedEvents();
   bool HandleInputEventOnViewOrPopup(const blink::WebInputEvent&);
 
+  double last_event_timestamp() { return last_event_timestamp_; }
+
   bool force_layout_on_events() const { return force_layout_on_events_; }
   void set_force_layout_on_events(bool force) {
     force_layout_on_events_ = force;
@@ -279,6 +281,8 @@
 
   uint32 time_offset_ms_;
   int click_count_;
+  // Timestamp (in seconds) of the last event that was dispatched
+  double last_event_timestamp_;
 
   base::WeakPtrFactory<EventSender> weak_factory_;
 
diff --git a/components/update_client/action_update_check.cc b/components/update_client/action_update_check.cc
index d68940e3..cfff7677 100644
--- a/components/update_client/action_update_check.cc
+++ b/components/update_client/action_update_check.cc
@@ -200,6 +200,9 @@
 
   VLOG(1) << "Update check failed." << error;
 
+  ChangeAllItemsState(CrxUpdateItem::State::kChecking,
+                      CrxUpdateItem::State::kNoUpdate);
+
   UpdateComplete(error);
 }
 
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 7e6d6dbe..f893d6a 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -46,7 +46,6 @@
 #include "content/public/common/sandbox_init.h"
 #include "content/renderer/in_process_renderer_thread.h"
 #include "content/utility/in_process_utility_thread.h"
-#include "crypto/nss_util.h"
 #include "ipc/ipc_descriptors.h"
 #include "ipc/ipc_switches.h"
 #include "media/base/media.h"
@@ -108,6 +107,10 @@
 
 #endif  // OS_POSIX
 
+#if defined(USE_NSS_CERTS)
+#include "crypto/nss_util.h"
+#endif
+
 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC)
 extern "C" {
 int tc_set_new_mode(int mode);
diff --git a/content/app/mojo/mojo_init.cc b/content/app/mojo/mojo_init.cc
index bf92f64..8a402bc4 100644
--- a/content/app/mojo/mojo_init.cc
+++ b/content/app/mojo/mojo_init.cc
@@ -7,9 +7,7 @@
 #include "base/lazy_instance.h"
 #include "base/memory/scoped_ptr.h"
 #include "ipc/ipc_channel.h"
-#include "third_party/mojo/src/mojo/edk/embedder/configuration.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
-#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 
 namespace content {
 
@@ -18,10 +16,8 @@
 class MojoInitializer {
  public:
   MojoInitializer() {
-    mojo::embedder::GetConfiguration()->max_message_num_bytes =
-        IPC::Channel::kMaximumMessageSize;
-    mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>(
-        new mojo::embedder::SimplePlatformSupport()));
+    mojo::embedder::SetMaxMessageSize(IPC::Channel::kMaximumMessageSize);
+    mojo::embedder::Init();
   }
 };
 
diff --git a/content/browser/BUILD.gn b/content/browser/BUILD.gn
index 1269200..23dca618 100644
--- a/content/browser/BUILD.gn
+++ b/content/browser/BUILD.gn
@@ -245,10 +245,6 @@
     #           ],
   }
 
-  if (is_linux && !use_openssl) {
-    deps += [ "//sandbox/linux:libc_urandom_override" ]
-  }
-
   if (use_udev) {
     deps += [ "//device/udev_linux" ]
   } else {
@@ -492,7 +488,7 @@
     ]
   }
 
-  if (is_linux && use_openssl) {
+  if (is_linux) {
     deps += [ "//third_party/boringssl" ]
   }
 
diff --git a/content/browser/accessibility/browser_accessibility.h b/content/browser/accessibility/browser_accessibility.h
index d330b613..9e61c4af 100644
--- a/content/browser/accessibility/browser_accessibility.h
+++ b/content/browser/accessibility/browser_accessibility.h
@@ -184,10 +184,13 @@
   virtual bool IsNative() const;
 
 #if defined(OS_MACOSX) && __OBJC__
+  const BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa() const;
   BrowserAccessibilityCocoa* ToBrowserAccessibilityCocoa();
 #elif defined(OS_WIN)
+  const BrowserAccessibilityWin* ToBrowserAccessibilityWin() const;
   BrowserAccessibilityWin* ToBrowserAccessibilityWin();
 #elif defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_X11)
+  const BrowserAccessibilityAuraLinux* ToBrowserAccessibilityAuraLinux() const;
   BrowserAccessibilityAuraLinux* ToBrowserAccessibilityAuraLinux();
 #endif
 
diff --git a/content/browser/accessibility/browser_accessibility_auralinux.cc b/content/browser/accessibility/browser_accessibility_auralinux.cc
index 9fb8e4b..eccdc09 100644
--- a/content/browser/accessibility/browser_accessibility_auralinux.cc
+++ b/content/browser/accessibility/browser_accessibility_auralinux.cc
@@ -724,6 +724,11 @@
   return new BrowserAccessibilityAuraLinux();
 }
 
+const BrowserAccessibilityAuraLinux*
+BrowserAccessibility::ToBrowserAccessibilityAuraLinux() const {
+  return static_cast<const BrowserAccessibilityAuraLinux*>(this);
+}
+
 BrowserAccessibilityAuraLinux*
 BrowserAccessibility::ToBrowserAccessibilityAuraLinux() {
   return static_cast<BrowserAccessibilityAuraLinux*>(this);
diff --git a/content/browser/accessibility/browser_accessibility_mac.mm b/content/browser/accessibility/browser_accessibility_mac.mm
index 1d4c2f92..34b3492 100644
--- a/content/browser/accessibility/browser_accessibility_mac.mm
+++ b/content/browser/accessibility/browser_accessibility_mac.mm
@@ -63,6 +63,11 @@
   [browser_accessibility_cocoa_ swapChildren:&children];
 }
 
+const BrowserAccessibilityCocoa*
+BrowserAccessibility::ToBrowserAccessibilityCocoa() const {
+  return static_cast<const BrowserAccessibilityMac*>(this)->native_view();
+}
+
 BrowserAccessibilityCocoa* BrowserAccessibility::ToBrowserAccessibilityCocoa() {
   return static_cast<BrowserAccessibilityMac*>(this)->
       native_view();
diff --git a/content/browser/accessibility/browser_accessibility_win.cc b/content/browser/accessibility/browser_accessibility_win.cc
index 74e7f11e..7f77ad2 100644
--- a/content/browser/accessibility/browser_accessibility_win.cc
+++ b/content/browser/accessibility/browser_accessibility_win.cc
@@ -207,6 +207,11 @@
   return instance->NewReference();
 }
 
+const BrowserAccessibilityWin* BrowserAccessibility::ToBrowserAccessibilityWin()
+    const {
+  return static_cast<const BrowserAccessibilityWin*>(this);
+}
+
 BrowserAccessibilityWin* BrowserAccessibility::ToBrowserAccessibilityWin() {
   return static_cast<BrowserAccessibilityWin*>(this);
 }
@@ -2010,8 +2015,9 @@
 
   int selection_start, selection_end;
   GetSelectionOffsets(&selection_start, &selection_end);
-  *offset = selection_start;
-  if (selection_start < 0)
+  // The caret is always at the end of the selection, if a selection exists.
+  *offset = selection_end;
+  if (*offset < 0)
     return S_FALSE;
 
   return S_OK;
@@ -2065,8 +2071,9 @@
   int selection_start, selection_end;
   GetSelectionOffsets(&selection_start, &selection_end);
   if (selection_start >= 0 && selection_end >= 0 &&
-      selection_start != selection_end)
+      selection_start != selection_end) {
     *n_selections = 1;
+  }
 
   return S_OK;
 }
@@ -2089,6 +2096,13 @@
   int selection_start, selection_end;
   GetSelectionOffsets(&selection_start, &selection_end);
   if (selection_start >= 0 && selection_end >= 0) {
+    // We should ignore the direction of the selection when exposing start and
+    // end offsets. According to the IA2 Spec the end offset is always increased
+    // by one past the end of the selection. This wouldn't make sense if
+    // end < start.
+    if (selection_end < selection_start)
+      std::swap(selection_start, selection_end);
+
     *start_offset = selection_start;
     *end_offset = selection_end;
   }
@@ -3648,6 +3662,9 @@
 
 int32 BrowserAccessibilityWin::GetHyperlinkIndexFromChild(
     const BrowserAccessibilityWin& child) const {
+  if (hyperlinks().empty())
+    return -1;
+
   auto iterator = std::find(
       hyperlinks().begin(), hyperlinks().end(), child.GetId());
   if (iterator == hyperlinks().end())
@@ -3658,8 +3675,7 @@
 
 int32 BrowserAccessibilityWin::GetHypertextOffsetFromHyperlinkIndex(
     int32 hyperlink_index) const {
-  auto& offsets_map = hyperlink_offset_to_index();
-  for (auto& offset_index : offsets_map) {
+  for (auto& offset_index : hyperlink_offset_to_index()) {
     if (offset_index.second == hyperlink_index)
       return offset_index.first;
   }
@@ -3690,6 +3706,84 @@
   return parent_object->GetHypertextOffsetFromChild(*current_object);
 }
 
+int BrowserAccessibilityWin::GetHypertextOffsetFromEndpoint(
+    const BrowserAccessibilityWin& endpoint_object,
+    int endpoint_offset) const {
+  // There are three cases:
+  // 1. Either the selection endpoint is inside this object or is an ancestor of
+  // of this object. endpoint_offset should be returned.
+  // 2. The selection endpoint is a pure descendant of this object. The offset
+  // of the embedded object character corresponding to the subtree in which
+  // the endpoint is located should be returned.
+  // 3. The selection endpoint is in a completely different part of the tree.
+  // Either 0 or text_length should be returned depending on the direction that
+  // one needs to travel to find the endpoint.
+
+  // Case 1.
+  //
+  // IsDescendantOf includes the case when endpoint_object == this.
+  if (IsDescendantOf(&endpoint_object) ||
+      // Handle the case when the endpoint is a direct text-only child.
+      // The selection offset should still be valid on the parent.
+      (endpoint_object.IsTextOnlyObject() &&
+       endpoint_object.GetParent() == this)) {
+    return endpoint_offset;
+  }
+
+  const BrowserAccessibility* common_parent = this;
+  while (common_parent && !endpoint_object.IsDescendantOf(common_parent)) {
+    common_parent = common_parent->GetParent();
+  }
+  if (!common_parent)
+    return -1;
+
+  auto common_parent_win = common_parent->ToBrowserAccessibilityWin();
+  // Text only objects must have a parent.
+  DCHECK(!IsTextOnlyObject() || GetParent());
+  DCHECK(!endpoint_object.IsTextOnlyObject() || endpoint_object.GetParent());
+  // Text only objects that are direct descendants should behave as if they
+  // are part of their parent when computing hyperlink offsets.
+  const BrowserAccessibilityWin* nearest_non_text_ancestor =
+      IsTextOnlyObject() ? GetParent()->ToBrowserAccessibilityWin() : this;
+  const BrowserAccessibilityWin& nearest_non_text_endpoint =
+      endpoint_object.IsTextOnlyObject()
+          ? *(endpoint_object.GetParent()->ToBrowserAccessibilityWin())
+          : endpoint_object;
+
+  // Case 2.
+  //
+  // We already checked in case 1 if our endpoint is inside this object.
+  // We can safely assume that it is a descendant or in a completely different
+  // part of the tree.
+  if (common_parent_win == nearest_non_text_ancestor) {
+    return nearest_non_text_ancestor->GetHypertextOffsetFromDescendant(
+        nearest_non_text_endpoint);
+  }
+
+  // Case 3.
+  //
+  // We can safely assume that the endpoint is in another part of the tree or
+  // at common parent, and that this object is a descendant of common parent.
+  int current_offset =
+      static_cast<int>(common_parent_win->GetHypertextOffsetFromDescendant(
+          *nearest_non_text_ancestor));
+  DCHECK_GE(current_offset, 0);
+  if (common_parent_win != &nearest_non_text_endpoint) {
+    endpoint_offset =
+        static_cast<int>(common_parent_win->GetHypertextOffsetFromDescendant(
+            nearest_non_text_endpoint));
+    DCHECK_GE(endpoint_offset, 0);
+  }
+
+  if (endpoint_offset < current_offset)
+    return 0;
+  if (endpoint_offset > current_offset)
+    return TextForIAccessibleText().length();
+
+  NOTREACHED();
+  return -1;
+}
+
 int BrowserAccessibilityWin::GetSelectionAnchor() const {
   BrowserAccessibility* root = manager()->GetRoot();
   int32 anchor_id;
@@ -3701,23 +3795,11 @@
   if (!anchor_object)
     return -1;
 
-  // Includes the case when anchor_object == this.
-  if (IsDescendantOf(anchor_object) ||
-      // Text only objects that are direct descendants should behave as if they
-      // are part of this object when computing hypertext.
-      (anchor_object->GetParent() == this &&
-      anchor_object->IsTextOnlyObject())) {
-    int anchor_offset;
-    if (!root->GetIntAttribute(ui::AX_ATTR_ANCHOR_OFFSET, &anchor_offset))
-      return -1;
+  int anchor_offset;
+  if (!root->GetIntAttribute(ui::AX_ATTR_ANCHOR_OFFSET, &anchor_offset))
+    return -1;
 
-    return anchor_offset;
-  }
-
-  if (anchor_object->IsDescendantOf(this))
-    return GetHypertextOffsetFromDescendant(*anchor_object);
-
-  return -1;
+  return GetHypertextOffsetFromEndpoint(*anchor_object, anchor_offset);
 }
 
 int BrowserAccessibilityWin::GetSelectionFocus() const {
@@ -3731,22 +3813,11 @@
   if (!focus_object)
     return -1;
 
-  // Includes the case when focus_object == this.
-  if (IsDescendantOf(focus_object) ||
-      // Text only objects that are direct descendants should behave as if they
-      // are part of this object when computing hypertext.
-      (focus_object->GetParent() == this && focus_object->IsTextOnlyObject())) {
-    int focus_offset;
-    if (!root->GetIntAttribute(ui::AX_ATTR_FOCUS_OFFSET, &focus_offset))
-      return -1;
+  int focus_offset;
+  if (!root->GetIntAttribute(ui::AX_ATTR_FOCUS_OFFSET, &focus_offset))
+    return -1;
 
-    return focus_offset;
-  }
-
-  if (focus_object->IsDescendantOf(this))
-    return GetHypertextOffsetFromDescendant(*focus_object);
-
-  return -1;
+  return GetHypertextOffsetFromEndpoint(*focus_object, focus_offset);
 }
 
 void BrowserAccessibilityWin::GetSelectionOffsets(
@@ -3764,15 +3835,56 @@
   if (*selection_start < 0 || *selection_end < 0)
     return;
 
-  if (*selection_end < *selection_start)
-    std::swap(*selection_start, *selection_end);
+  // If the selection is collapsed or if it only spans one character, return the
+  // selection offsets only if the caret is active on this object or any of its
+  // children.
+  // The focus object indicates the caret position.
+  if (*selection_start == *selection_end) {
+    BrowserAccessibility* root = manager()->GetRoot();
+    int32 focus_id;
+    if (!root || !root->GetIntAttribute(ui::AX_ATTR_FOCUS_OBJECT_ID, &focus_id))
+      return;
 
-  // IA2 Spec says that the end of the selection should be after the last
-  // embedded object character that is part of the selection, if there is one.
-  if (hyperlink_offset_to_index().find(*selection_end) !=
-      hyperlink_offset_to_index().end()) {
-    ++(*selection_end);
+    BrowserAccessibilityWin* focus_object =
+        manager()->GetFromID(focus_id)->ToBrowserAccessibilityWin();
+    if (!focus_object)
+      return;
+
+    if (!focus_object->IsDescendantOf(this) &&
+        !(IsTextOnlyObject() && GetParent() == focus_object)) {
+      *selection_start = -1;
+      *selection_end = -1;
+      return;
+    }
   }
+
+  // The IA2 Spec says that if the largest of the two offsets falls on an
+  // embedded object character and if there is a selection in that embedded
+  // object, it should be incremented by one so that it points after the
+  // embedded object character.
+  // This is a signal to AT software that the embedded object is also part of
+  // the selection.
+  int* largest_offset =
+      (*selection_start <= *selection_end) ? selection_end : selection_start;
+  auto current_object = const_cast<BrowserAccessibilityWin*>(this);
+  LONG hyperlink_index;
+  HRESULT hr =
+      current_object->get_hyperlinkIndex(*largest_offset, &hyperlink_index);
+  if (hr != S_OK)
+    return;
+
+  DCHECK_GE(hyperlink_index, 0);
+  base::win::ScopedComPtr<IAccessibleHyperlink> hyperlink;
+  hr = current_object->get_hyperlink(hyperlink_index, hyperlink.Receive());
+  DCHECK(SUCCEEDED(hr));
+  base::win::ScopedComPtr<IAccessibleText> hyperlink_text;
+  hr = hyperlink.QueryInterface(hyperlink_text.Receive());
+  DCHECK(SUCCEEDED(hr));
+  LONG n_selections = 0;
+  hr = hyperlink_text->get_nSelections(&n_selections);
+  DCHECK(SUCCEEDED(hr));
+  if (n_selections > 0)
+    ++(*largest_offset);
 }
 
 base::string16 BrowserAccessibilityWin::GetNameRecursive() const {
@@ -3799,7 +3911,7 @@
   return value;
 }
 
-base::string16 BrowserAccessibilityWin::TextForIAccessibleText() {
+base::string16 BrowserAccessibilityWin::TextForIAccessibleText() const {
   switch (GetRole()) {
     case ui::AX_ROLE_TEXT_FIELD:
     case ui::AX_ROLE_MENU_LIST_OPTION:
diff --git a/content/browser/accessibility/browser_accessibility_win.h b/content/browser/accessibility/browser_accessibility_win.h
index f5ca8ecd..c4c92b2 100644
--- a/content/browser/accessibility/browser_accessibility_win.h
+++ b/content/browser/accessibility/browser_accessibility_win.h
@@ -766,7 +766,8 @@
   void IntAttributeToIA2(ui::AXIntAttribute attribute,
                          const char* ia2_attr);
 
-  // Functions that help in retrieving hyperlinks. Return -1 in case of failure.
+  // Functions that help when retrieving hyperlinks. Return -1 in case of
+  // failure.
   // (Hyperlink is an IA2 misnomer. It refers to objects embedded within other
   // objects, such as a numbered list within a contenteditable div.)
   int32 GetHyperlinkIndexFromChild(const BrowserAccessibilityWin& child) const;
@@ -775,15 +776,28 @@
   int32 GetHypertextOffsetFromDescendant(
       const BrowserAccessibilityWin& descendant) const;
 
+  // If the selection endpoint is either equal to or an ancestor of this object,
+  // returns endpoint_offset.
+  // If the selection endpoint is a descendant of this object, returns its
+  // embedded character offset. Otherwise, returns either 0 or the length of the
+  // hypertext, depending on the direction of the selection.
+  // Returns -1 in case of unexpected failure, e.g. the selection endpoint
+  // cannot be located in the accessibility tree.
+  int GetHypertextOffsetFromEndpoint(
+      const BrowserAccessibilityWin& endpoint_object,
+      int endpoint_offset) const;
+
   // The following functions retrieve the endpoints of the current selection.
-  // First they checks for a local selection found on the current control, e.g.
+  // First they check for a local selection found on the current control, e.g.
   // when querying the selection on a textarea.
   // If not found they retrieve the global selection found on the current frame.
   int GetSelectionAnchor() const;
   int GetSelectionFocus() const;
   // Retrieves the selection offsets in the way required by the IA2 APIs.
-  // (Selection_start is always <= selection_end and
-  // selection_end is one past the last character of the selection.)
+  // selection_start and selection_end are -1 when there is no selection active
+  // inside this object.
+  // The greatest of the two offsets is one past the last character of the
+  // selection.)
   void GetSelectionOffsets(int* selection_start, int* selection_end) const;
 
   // Append the accessible name from this node and its children.
@@ -795,7 +809,7 @@
 
   // Get the text of this node for the purposes of IAccessibleText - it may
   // be the name, it may be the value, etc. depending on the role.
-  base::string16 TextForIAccessibleText();
+  base::string16 TextForIAccessibleText() const;
 
   bool IsSameHypertextCharacter(size_t old_char_index, size_t new_char_index);
   void ComputeHypertextRemovedAndInserted(
@@ -856,7 +870,6 @@
 
     // Maps the |hypertext_| embedded character offset to an index in
     // |hyperlinks_|.
-    // TODO(nektar): Replace map with vector of offsets.
     std::map<int32, int32> hyperlink_offset_to_index;
 
     // The id of a BrowserAccessibilityWin for each hyperlink.
diff --git a/content/browser/accessibility/browser_accessibility_win_unittest.cc b/content/browser/accessibility/browser_accessibility_win_unittest.cc
index 898e5dce..c1d99b2 100644
--- a/content/browser/accessibility/browser_accessibility_win_unittest.cc
+++ b/content/browser/accessibility/browser_accessibility_win_unittest.cc
@@ -876,10 +876,10 @@
   HRESULT hr = combo_box_accessible->get_caretOffset(&caret_offset);;
   EXPECT_EQ(S_OK, hr);
   EXPECT_EQ(1L, caret_offset);
-  // The caret should be at the start of the selection.
+  // The caret should be at the end of the selection.
   hr = text_field_accessible->get_caretOffset(&caret_offset);;
   EXPECT_EQ(S_OK, hr);
-  EXPECT_EQ(1L, caret_offset);
+  EXPECT_EQ(2L, caret_offset);
 
   // Move the focus to the text field.
   combo_box.state &= ~(1 << ui::AX_STATE_FOCUSED);
@@ -891,7 +891,7 @@
   // The caret should not have moved.
   hr = text_field_accessible->get_caretOffset(&caret_offset);;
   EXPECT_EQ(S_OK, hr);
-  EXPECT_EQ(1L, caret_offset);
+  EXPECT_EQ(2L, caret_offset);
 
   // Test get_nSelections.
   hr = combo_box_accessible->get_nSelections(&n_selections);;
@@ -981,9 +981,15 @@
 
   // -2 is never a valid offset.
   LONG caret_offset = -2;
+  LONG n_selections = -2;
+
+  // No selection should be present.
+  HRESULT hr = div_editable_accessible->get_nSelections(&n_selections);
+  EXPECT_EQ(S_OK, hr);
+  EXPECT_EQ(0L, n_selections);
 
   // The caret should be on the embedded object character.
-  HRESULT hr = div_editable_accessible->get_caretOffset(&caret_offset);;
+  hr = div_editable_accessible->get_caretOffset(&caret_offset);
   EXPECT_EQ(S_OK, hr);
   EXPECT_EQ(6L, caret_offset);
 
@@ -1006,10 +1012,20 @@
   ASSERT_NE(nullptr, link_text_accessible);
 
   // The caret should not have moved.
+  hr = div_editable_accessible->get_nSelections(&n_selections);
+  EXPECT_EQ(S_OK, hr);
+  EXPECT_EQ(0L, n_selections);
   hr = div_editable_accessible->get_caretOffset(&caret_offset);;
   EXPECT_EQ(S_OK, hr);
   EXPECT_EQ(6L, caret_offset);
 
+  hr = link_accessible->get_nSelections(&n_selections);
+  EXPECT_EQ(S_OK, hr);
+  EXPECT_EQ(0L, n_selections);
+  hr = link_text_accessible->get_nSelections(&n_selections);
+  EXPECT_EQ(S_OK, hr);
+  EXPECT_EQ(0L, n_selections);
+
   hr = link_accessible->get_caretOffset(&caret_offset);;
   EXPECT_EQ(S_OK, hr);
   EXPECT_EQ(1L, caret_offset);
@@ -1021,7 +1037,7 @@
   ASSERT_EQ(0, CountedBrowserAccessibility::num_instances());
 }
 
-TEST_F(BrowserAccessibilityTest, DISABLED_TestSelectionInContentEditables) {
+TEST_F(BrowserAccessibilityTest, TestSelectionInContentEditables) {
   ui::AXNodeData root;
   root.id = 1;
   root.role = ui::AX_ROLE_ROOT_WEB_AREA;
@@ -1135,10 +1151,10 @@
   EXPECT_EQ(0L, selection_start);
   EXPECT_EQ(4L, selection_end);
 
-  // The caret should be at the anchor (the start) of the selection.
+  // The caret should be at the focus (the end) of the selection.
   hr = div_editable_accessible->get_caretOffset(&caret_offset);;
   EXPECT_EQ(S_OK, hr);
-  EXPECT_EQ(1L, caret_offset);
+  EXPECT_EQ(7L, caret_offset);
 
   // Move the focus to the content editable.
   div_editable.state |= 1 << ui::AX_STATE_FOCUSED;
@@ -1149,15 +1165,16 @@
   // The caret should not have moved.
   hr = div_editable_accessible->get_caretOffset(&caret_offset);;
   EXPECT_EQ(S_OK, hr);
-  EXPECT_EQ(1L, caret_offset);
+  EXPECT_EQ(7L, caret_offset);
 
-  // The HRESULT should be S_FALSE if the caret is not in the given object.
+  // The caret offset should reflect the position of the selection's focus in
+  // any given object.
   hr = link_accessible->get_caretOffset(&caret_offset);;
-  EXPECT_EQ(S_FALSE, hr);
-  EXPECT_EQ(-1L, caret_offset);
+  EXPECT_EQ(S_OK, hr);
+  EXPECT_EQ(4L, caret_offset);
   hr = link_text_accessible->get_caretOffset(&caret_offset);;
-  EXPECT_EQ(S_FALSE, hr);
-  EXPECT_EQ(-1L, caret_offset);
+  EXPECT_EQ(S_OK, hr);
+  EXPECT_EQ(4L, caret_offset);
 
   hr = div_editable_accessible->get_selection(
       0L /* selection_index */, &selection_start, &selection_end);;
diff --git a/content/browser/android/background_sync_network_observer_android.cc b/content/browser/android/background_sync_network_observer_android.cc
new file mode 100644
index 0000000..533fc36
--- /dev/null
+++ b/content/browser/android/background_sync_network_observer_android.cc
@@ -0,0 +1,86 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/android/background_sync_network_observer_android.h"
+
+#include "jni/BackgroundSyncNetworkObserver_jni.h"
+
+namespace content {
+
+// static
+bool BackgroundSyncNetworkObserverAndroid::Observer::RegisterNetworkObserver(
+    JNIEnv* env) {
+  return RegisterNativesImpl(env);
+}
+
+// static
+scoped_refptr<BackgroundSyncNetworkObserverAndroid::Observer>
+BackgroundSyncNetworkObserverAndroid::Observer::Create(
+    base::Callback<void(net::NetworkChangeNotifier::ConnectionType)> callback) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+  scoped_refptr<BackgroundSyncNetworkObserverAndroid::Observer> observer(
+      new BackgroundSyncNetworkObserverAndroid::Observer(callback));
+  BrowserThread::PostTask(
+      BrowserThread::UI, FROM_HERE,
+      base::Bind(&BackgroundSyncNetworkObserverAndroid::Observer::Init,
+                 observer));
+  return observer;
+}
+
+void BackgroundSyncNetworkObserverAndroid::Observer::Init() {
+  DCHECK_CURRENTLY_ON(BrowserThread::UI);
+  // Attach a Java BackgroundSyncNetworkObserver object. Its lifetime will be
+  // scoped to the lifetime of this object.
+  JNIEnv* env = base::android::AttachCurrentThread();
+  base::android::ScopedJavaGlobalRef<jobject> obj(
+      Java_BackgroundSyncNetworkObserver_createObserver(
+          env, base::android::GetApplicationContext(),
+          reinterpret_cast<jlong>(this)));
+  j_observer_.Reset(obj);
+}
+
+BackgroundSyncNetworkObserverAndroid::Observer::~Observer() {
+  JNIEnv* env = base::android::AttachCurrentThread();
+  Java_BackgroundSyncNetworkObserver_removeObserver(
+      env, j_observer_.obj(), reinterpret_cast<jlong>(this));
+  DCHECK_CURRENTLY_ON(BrowserThread::UI);
+  j_observer_.Release();
+}
+
+void BackgroundSyncNetworkObserverAndroid::Observer::
+    NotifyConnectionTypeChanged(JNIEnv* env,
+                                jobject jcaller,
+                                jint new_connection_type) {
+  DCHECK_CURRENTLY_ON(BrowserThread::UI);
+  BrowserThread::PostTask(
+      BrowserThread::IO, FROM_HERE,
+      base::Bind(callback_,
+                 static_cast<net::NetworkChangeNotifier::ConnectionType>(
+                     new_connection_type)));
+}
+
+BackgroundSyncNetworkObserverAndroid::Observer::Observer(
+    base::Callback<void(net::NetworkChangeNotifier::ConnectionType)> callback)
+    : callback_(callback) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+}
+
+BackgroundSyncNetworkObserverAndroid::BackgroundSyncNetworkObserverAndroid(
+    const base::Closure& network_changed_callback)
+    : BackgroundSyncNetworkObserver(network_changed_callback),
+      weak_ptr_factory_(this) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+  // Remove the observer attached by the NetworkObserver constructor
+  net::NetworkChangeNotifier::RemoveNetworkChangeObserver(this);
+
+  observer_ = Observer::Create(
+      base::Bind(&BackgroundSyncNetworkObserverAndroid::OnNetworkChanged,
+                 weak_ptr_factory_.GetWeakPtr()));
+}
+
+BackgroundSyncNetworkObserverAndroid::~BackgroundSyncNetworkObserverAndroid() {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+}
+}  // namespace content
diff --git a/content/browser/android/background_sync_network_observer_android.h b/content/browser/android/background_sync_network_observer_android.h
new file mode 100644
index 0000000..49e8b0a
--- /dev/null
+++ b/content/browser/android/background_sync_network_observer_android.h
@@ -0,0 +1,80 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_ANDROID_BACKGROUND_SYNC_NETWORK_OBSERVER_ANDROID_H_
+#define CONTENT_BROWSER_ANDROID_BACKGROUND_SYNC_NETWORK_OBSERVER_ANDROID_H_
+
+#include "base/android/jni_android.h"
+#include "base/android/scoped_java_ref.h"
+#include "base/memory/weak_ptr.h"
+#include "content/browser/background_sync/background_sync_network_observer.h"
+#include "content/public/browser/browser_thread.h"
+
+namespace content {
+
+// BackgroundSyncNetworkObserverAndroid is a specialized
+// BackgroundSyncNetworkObserver which is backed by a NetworkChangeNotifier
+// that listens for network events even when the browser is paused, unlike the
+// standard NetworkChangeNotifier. This ensures that sync events can be fired
+// even when the browser is backgrounded, and other network observers are
+// disabled.
+class BackgroundSyncNetworkObserverAndroid
+    : public BackgroundSyncNetworkObserver {
+ public:
+  // Creates a BackgroundSyncNetworkObserver. |network_changed_callback| is
+  // called via PostMessage when the network connection changes.
+  BackgroundSyncNetworkObserverAndroid(
+      const base::Closure& network_changed_callback);
+
+  ~BackgroundSyncNetworkObserverAndroid() override;
+
+  // This class lives on the UI thread and mediates all access to the Java
+  // BackgroundSyncNetworkObserver, which it creates and owns. It is in turn
+  // owned by the BackgroundSyncNetworkObserverAndroid.
+  class Observer : public base::RefCountedThreadSafe<
+                       BackgroundSyncNetworkObserverAndroid::Observer,
+                       content::BrowserThread::DeleteOnUIThread> {
+   public:
+    static scoped_refptr<BackgroundSyncNetworkObserverAndroid::Observer> Create(
+        base::Callback<void(net::NetworkChangeNotifier::ConnectionType)>
+            callback);
+
+    static bool RegisterNetworkObserver(JNIEnv* env);
+
+    // Called from BackgroundSyncNetworkObserver.java over JNI whenever the
+    // connection type changes. This updates the current connection type seen by
+    // this class and calls the |network_changed_callback| provided to the
+    // constructor, on the IO thread, with the new connection type.
+    void NotifyConnectionTypeChanged(JNIEnv* env,
+                                     jobject jcaller,
+                                     jint new_connection_type);
+
+   private:
+    friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
+    friend class base::DeleteHelper<
+        BackgroundSyncNetworkObserverAndroid::Observer>;
+
+    Observer(base::Callback<void(net::NetworkChangeNotifier::ConnectionType)>
+                 callback);
+    void Init();
+    ~Observer();
+
+    // This callback is to be run on the IO thread whenever the connection type
+    // changes.
+    base::Callback<void(net::NetworkChangeNotifier::ConnectionType)> callback_;
+    base::android::ScopedJavaGlobalRef<jobject> j_observer_;
+
+    DISALLOW_COPY_AND_ASSIGN(Observer);
+  };
+
+ private:
+  // Accessed on UI Thread
+  scoped_refptr<Observer> observer_;
+
+  base::WeakPtrFactory<BackgroundSyncNetworkObserverAndroid> weak_ptr_factory_;
+};
+
+}  // namespace content
+
+#endif  // CONTENT_BROWSER_ANDROID_BACKGROUND_SYNC_NETWORK_OBSERVER_ANDROID_H_
diff --git a/content/browser/android/browser_jni_registrar.cc b/content/browser/android/browser_jni_registrar.cc
index 43adba8..bea2065 100644
--- a/content/browser/android/browser_jni_registrar.cc
+++ b/content/browser/android/browser_jni_registrar.cc
@@ -9,6 +9,7 @@
 #include "content/browser/accessibility/browser_accessibility_android.h"
 #include "content/browser/accessibility/browser_accessibility_manager_android.h"
 #include "content/browser/android/background_sync_launcher_android.h"
+#include "content/browser/android/background_sync_network_observer_android.h"
 #include "content/browser/android/browser_startup_controller.h"
 #include "content/browser/android/child_process_launcher_android.h"
 #include "content/browser/android/composited_touch_handle_drawable.h"
@@ -50,6 +51,9 @@
      content::AndroidLocationApiAdapter::RegisterGeolocationService},
     {"BackgroundSyncLauncherAndroid",
      content::BackgroundSyncLauncherAndroid::RegisterLauncher},
+    {"BackgroundSyncNetworkObserverAndroid",
+     content::BackgroundSyncNetworkObserverAndroid::Observer::
+         RegisterNetworkObserver},
     {"BrowserAccessibilityManager",
      content::RegisterBrowserAccessibilityManager},
     {"BrowserStartupController", content::RegisterBrowserStartupController},
diff --git a/content/browser/background_sync/background_sync_browsertest.cc b/content/browser/background_sync/background_sync_browsertest.cc
index eb79df9..ae1ccc94 100644
--- a/content/browser/background_sync/background_sync_browsertest.cc
+++ b/content/browser/background_sync/background_sync_browsertest.cc
@@ -11,6 +11,7 @@
 #include "base/strings/stringprintf.h"
 #include "base/task_runner_util.h"
 #include "content/browser/background_sync/background_sync_manager.h"
+#include "content/browser/background_sync/background_sync_network_observer.h"
 #include "content/browser/background_sync/background_sync_registration_handle.h"
 #include "content/browser/background_sync/background_sync_status.h"
 #include "content/browser/service_worker/service_worker_context_wrapper.h"
@@ -92,20 +93,15 @@
                       callback));
 }
 
+}  // namespace
+
 class BackgroundSyncBrowserTest : public ContentBrowserTest {
  public:
   BackgroundSyncBrowserTest() {}
   ~BackgroundSyncBrowserTest() override {}
 
   void SetUp() override {
-    NetworkChangeNotifier::SetTestNotificationsOnly(true);
-
-#if defined(OS_CHROMEOS)
-    // ChromeOS's NetworkChangeNotifier doesn't get created in
-    // content_browsertests, so make one now.
-    net::NetworkChangeNotifier::CreateMock();
-#endif
-
+    BackgroundSyncNetworkObserver::SetIgnoreNetworkChangeNotifierForTests(true);
     ContentBrowserTest::SetUp();
   }
 
@@ -113,6 +109,12 @@
     shell_ = incognito ? CreateOffTheRecordBrowser() : shell();
   }
 
+  BackgroundSyncContext* GetSyncContextFromShell(Shell* shell) {
+    StoragePartition* storage = BrowserContext::GetDefaultStoragePartition(
+        shell_->web_contents()->GetBrowserContext());
+    return storage->GetBackgroundSyncContext();
+  }
+
   void SetUpCommandLine(base::CommandLine* command_line) override {
     // TODO(jkarlin): Remove this once background sync is no longer
     // experimental.
@@ -128,10 +130,10 @@
         base::FilePath(FILE_PATH_LITERAL("content/test/data/"))));
     ASSERT_TRUE(https_server_->Start());
 
-    SetOnline(true);
-
     SetIncognitoMode(false);
 
+    SetOnline(true);
+
     ASSERT_TRUE(LoadTestPage(kDefaultTestURL));
 
     ContentBrowserTest::SetUpOnMainThread();
@@ -148,7 +150,13 @@
                                                   script, result);
   }
 
+  // This runs asynchronously on the IO thread, but we don't need to wait for it
+  // to complete before running a background sync operation, since those also
+  // run on the IO thread.
   void SetOnline(bool online);
+  void SetOnlineOnIOThread(
+      const scoped_refptr<BackgroundSyncContext>& sync_context,
+      bool online);
 
   // Returns true if the one-shot sync with tag is currently pending. Fails
   // (assertion failure) if the tag isn't registered.
@@ -175,14 +183,28 @@
 };
 
 void BackgroundSyncBrowserTest::SetOnline(bool online) {
+  ASSERT_TRUE(shell_);
+  BrowserThread::PostTask(
+      BrowserThread::IO, FROM_HERE,
+      base::Bind(&BackgroundSyncBrowserTest::SetOnlineOnIOThread,
+                 base::Unretained(this),
+                 base::Unretained(GetSyncContextFromShell(shell_)), online));
+  base::RunLoop().RunUntilIdle();
+}
+
+void BackgroundSyncBrowserTest::SetOnlineOnIOThread(
+    const scoped_refptr<BackgroundSyncContext>& sync_context,
+    bool online) {
+  BackgroundSyncManager* sync_manager = sync_context->background_sync_manager();
+  BackgroundSyncNetworkObserver* network_observer =
+      sync_manager->GetNetworkObserverForTesting();
   if (online) {
-    NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests(
+    network_observer->NotifyManagerIfNetworkChanged(
         NetworkChangeNotifier::CONNECTION_WIFI);
   } else {
-    NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests(
+    network_observer->NotifyManagerIfNetworkChanged(
         NetworkChangeNotifier::CONNECTION_NONE);
   }
-  base::RunLoop().RunUntilIdle();
 }
 
 bool BackgroundSyncBrowserTest::OneShotPending(const std::string& tag) {
@@ -513,6 +535,4 @@
   EXPECT_TRUE(NotifyWhenDoneImmediateOneShot("ok - delay result: false"));
 }
 
-}  // namespace
-
 }  // namespace content
diff --git a/content/browser/background_sync/background_sync_manager.cc b/content/browser/background_sync/background_sync_manager.cc
index 07ac7d8..477b31f 100644
--- a/content/browser/background_sync/background_sync_manager.cc
+++ b/content/browser/background_sync/background_sync_manager.cc
@@ -21,6 +21,7 @@
 
 #if defined(OS_ANDROID)
 #include "content/browser/android/background_sync_launcher_android.h"
+#include "content/browser/android/background_sync_network_observer_android.h"
 #endif
 
 namespace content {
@@ -221,9 +222,15 @@
 
   service_worker_context_->AddObserver(this);
 
+#if defined(OS_ANDROID)
+  network_observer_.reset(new BackgroundSyncNetworkObserverAndroid(
+      base::Bind(&BackgroundSyncManager::OnNetworkChanged,
+                 weak_ptr_factory_.GetWeakPtr())));
+#else
   network_observer_.reset(new BackgroundSyncNetworkObserver(
       base::Bind(&BackgroundSyncManager::OnNetworkChanged,
                  weak_ptr_factory_.GetWeakPtr())));
+#endif
   power_observer_.reset(new BackgroundSyncPowerObserver(base::Bind(
       &BackgroundSyncManager::OnPowerChanged, weak_ptr_factory_.GetWeakPtr())));
 }
diff --git a/content/browser/background_sync/background_sync_manager.h b/content/browser/background_sync/background_sync_manager.h
index 999b310..a845dd3a 100644
--- a/content/browser/background_sync/background_sync_manager.h
+++ b/content/browser/background_sync/background_sync_manager.h
@@ -99,6 +99,10 @@
                              const GURL& pattern) override;
   void OnStorageWiped() override;
 
+  BackgroundSyncNetworkObserver* GetNetworkObserverForTesting() {
+    return network_observer_.get();
+  }
+
  protected:
   // A registration might be referenced by the client longer than
   // the BackgroundSyncManager needs to keep track of it (e.g., the event has
diff --git a/content/browser/background_sync/background_sync_manager_unittest.cc b/content/browser/background_sync/background_sync_manager_unittest.cc
index 4817b0c0..72db49fc 100644
--- a/content/browser/background_sync/background_sync_manager_unittest.cc
+++ b/content/browser/background_sync/background_sync_manager_unittest.cc
@@ -14,6 +14,7 @@
 #include "base/single_thread_task_runner.h"
 #include "base/test/mock_entropy_provider.h"
 #include "base/thread_task_runner_handle.h"
+#include "content/browser/background_sync/background_sync_network_observer.h"
 #include "content/browser/background_sync/background_sync_registration_handle.h"
 #include "content/browser/background_sync/background_sync_status.h"
 #include "content/browser/browser_thread_impl.h"
@@ -233,6 +234,9 @@
   }
 
   void SetUp() override {
+    // Don't let the tests be confused by the real-world device connectivity
+    BackgroundSyncNetworkObserver::SetIgnoreNetworkChangeNotifierForTests(true);
+
     helper_.reset(
         new EmbeddedWorkerTestHelper(base::FilePath(), kRenderProcessId));
 
@@ -251,6 +255,12 @@
     RegisterServiceWorkers();
   }
 
+  void TearDown() override {
+    // Restore the network observer functionality for subsequent tests
+    BackgroundSyncNetworkObserver::SetIgnoreNetworkChangeNotifierForTests(
+        false);
+  }
+
   void RegisterServiceWorkers() {
     bool called_1 = false;
     bool called_2 = false;
@@ -304,7 +314,12 @@
   void SetNetwork(net::NetworkChangeNotifier::ConnectionType connection_type) {
     net::NetworkChangeNotifier::NotifyObserversOfNetworkChangeForTests(
         connection_type);
-    base::RunLoop().RunUntilIdle();
+    if (test_background_sync_manager_) {
+      BackgroundSyncNetworkObserver* network_observer =
+          test_background_sync_manager_->GetNetworkObserverForTesting();
+      network_observer->NotifyManagerIfNetworkChanged(connection_type);
+      base::RunLoop().RunUntilIdle();
+    }
   }
 
   void SetOnBatteryPower(bool on_battery_power) {
diff --git a/content/browser/background_sync/background_sync_network_observer.cc b/content/browser/background_sync/background_sync_network_observer.cc
index 1c6f2bd9..a08e7d8 100644
--- a/content/browser/background_sync/background_sync_network_observer.cc
+++ b/content/browser/background_sync/background_sync_network_observer.cc
@@ -11,6 +11,15 @@
 
 namespace content {
 
+// static
+bool BackgroundSyncNetworkObserver::ignore_network_change_notifier_ = false;
+
+// static
+void BackgroundSyncNetworkObserver::SetIgnoreNetworkChangeNotifierForTests(
+    bool ignore) {
+  ignore_network_change_notifier_ = ignore;
+}
+
 BackgroundSyncNetworkObserver::BackgroundSyncNetworkObserver(
     const base::Closure& network_changed_callback)
     : connection_type_(net::NetworkChangeNotifier::GetConnectionType()),
@@ -47,17 +56,18 @@
   return false;
 }
 
-void BackgroundSyncNetworkObserver::NotifyNetworkChanged() {
-  DCHECK_CURRENTLY_ON(BrowserThread::IO);
-
-  base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
-                                                network_changed_callback_);
-}
-
 void BackgroundSyncNetworkObserver::OnNetworkChanged(
     net::NetworkChangeNotifier::ConnectionType connection_type) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
 
+  if (ignore_network_change_notifier_)
+    return;
+  NotifyManagerIfNetworkChanged(connection_type);
+}
+
+void BackgroundSyncNetworkObserver::NotifyManagerIfNetworkChanged(
+    net::NetworkChangeNotifier::ConnectionType connection_type) {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (connection_type == connection_type_)
     return;
 
@@ -65,4 +75,11 @@
   NotifyNetworkChanged();
 }
 
+void BackgroundSyncNetworkObserver::NotifyNetworkChanged() {
+  DCHECK_CURRENTLY_ON(BrowserThread::IO);
+
+  base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+                                                network_changed_callback_);
+}
+
 }  // namespace content
diff --git a/content/browser/background_sync/background_sync_network_observer.h b/content/browser/background_sync/background_sync_network_observer.h
index 7c81f738..4d47cc6 100644
--- a/content/browser/background_sync/background_sync_network_observer.h
+++ b/content/browser/background_sync/background_sync_network_observer.h
@@ -13,7 +13,7 @@
 namespace content {
 
 class CONTENT_EXPORT BackgroundSyncNetworkObserver
-    : net::NetworkChangeNotifier::NetworkChangeObserver {
+    : public net::NetworkChangeNotifier::NetworkChangeObserver {
  public:
   // Creates a BackgroundSyncNetworkObserver. |network_changed_callback| is
   // called when the network connection changes asynchronously via PostMessage.
@@ -21,22 +21,37 @@
 
   ~BackgroundSyncNetworkObserver() override;
 
+  // Enable or disable notifications coming from the NetworkChangeNotifier. (For
+  // preventing flakes in tests)
+  static void SetIgnoreNetworkChangeNotifierForTests(bool ignore);
+
   // Returns true if the state of the network meets the needs of
   // |network_state|.
   bool NetworkSufficient(SyncNetworkState network_state);
 
- private:
-  void NotifyNetworkChanged();
-
   // NetworkChangeObserver overrides
   void OnNetworkChanged(
       net::NetworkChangeNotifier::ConnectionType connection_type) override;
 
+ private:
+  friend class BackgroundSyncBrowserTest;
+  friend class BackgroundSyncManagerTest;
+
+  // Calls NotifyNetworkChanged if the connection type has changed.
+  void NotifyManagerIfNetworkChanged(
+      net::NetworkChangeNotifier::ConnectionType connection_type);
+
+  void NotifyNetworkChanged();
+
   net::NetworkChangeNotifier::ConnectionType connection_type_;
 
   // The callback to run when the network changes.
   base::Closure network_changed_callback_;
 
+  // Set true to ignore notifications coming from the NetworkChangeNotifier
+  // (to prevent flakes in tests).
+  static bool ignore_network_change_notifier_;
+
   DISALLOW_COPY_AND_ASSIGN(BackgroundSyncNetworkObserver);
 };
 
diff --git a/content/browser/browser_child_process_host_impl.cc b/content/browser/browser_child_process_host_impl.cc
index b337cd4c..2f9076f 100644
--- a/content/browser/browser_child_process_host_impl.cc
+++ b/content/browser/browser_child_process_host_impl.cc
@@ -164,6 +164,7 @@
     switches::kTraceToConsole,
     switches::kV,
     switches::kVModule,
+    "use-new-edk",  // TODO(use_chrome_edk): temporary.
   };
   cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches,
                              arraysize(kForwardSwitches));
diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc
index 8a9a37d..86f4123e 100644
--- a/content/browser/browser_main_loop.cc
+++ b/content/browser/browser_main_loop.cc
@@ -69,6 +69,7 @@
 #include "net/base/network_change_notifier.h"
 #include "net/socket/client_socket_factory.h"
 #include "net/ssl/ssl_config_service.h"
+#include "ipc/mojo/scoped_ipc_support.h"
 #include "skia/ext/skia_memory_dump_provider.h"
 #include "ui/base/clipboard/clipboard.h"
 
@@ -162,6 +163,10 @@
 #include "ui/gfx/x/x11_types.h"
 #endif
 
+#if defined(USE_NSS_CERTS) || !defined(USE_OPENSSL)
+#include "crypto/nss_util.h"
+#endif
+
 // One of the linux specific headers defines this as a macro.
 #ifdef DestroyAll
 #undef DestroyAll
@@ -927,6 +932,7 @@
       base::Bind(base::IgnoreResult(&base::ThreadRestrictions::SetIOAllowed),
                  true));
 
+  mojo_ipc_support_.reset();
   mojo_shell_context_.reset();
 
 #if !defined(OS_IOS)
@@ -1266,6 +1272,9 @@
 #endif  // !defined(OS_IOS)
 
   mojo_shell_context_.reset(new MojoShellContext);
+  mojo_ipc_support_.reset(new IPC::ScopedIPCSupport(
+      BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO)
+          ->task_runner()));
 
   return result_code_;
 }
diff --git a/content/browser/browser_main_loop.h b/content/browser/browser_main_loop.h
index 4650c27..ecc418d4 100644
--- a/content/browser/browser_main_loop.h
+++ b/content/browser/browser_main_loop.h
@@ -27,6 +27,10 @@
 }  // namespace trace_event
 }  // namespace base
 
+namespace IPC {
+class ScopedIPCSupport;
+}
+
 namespace media {
 class AudioManager;
 class UserInputMonitor;
@@ -241,6 +245,7 @@
   // Members initialized in |BrowserThreadsStarted()| --------------------------
   scoped_ptr<base::Thread> indexed_db_thread_;
   scoped_ptr<MojoShellContext> mojo_shell_context_;
+  scoped_ptr<IPC::ScopedIPCSupport> mojo_ipc_support_;
 
   // |user_input_monitor_| has to outlive |audio_manager_|, so declared first.
   scoped_ptr<media::UserInputMonitor> user_input_monitor_;
diff --git a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
index b70436b..0ce27732 100644
--- a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc
@@ -57,6 +57,11 @@
     ~GpuSurfacelessBrowserCompositorOutputSurface() {
 }
 
+bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane()
+    const {
+  return true;
+}
+
 unsigned GpuSurfacelessBrowserCompositorOutputSurface::GetOverlayTextureId()
     const {
   return output_surface_->current_texture_id();
@@ -65,22 +70,7 @@
 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers(
     cc::CompositorFrame* frame) {
   DCHECK(output_surface_);
-
-  GLuint texture = output_surface_->current_texture_id();
   output_surface_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect);
-  const gfx::Size& size = frame->gl_frame_data->size;
-  context_provider_->ContextGL()->ScheduleOverlayPlaneCHROMIUM(
-      0,
-      GL_OVERLAY_TRANSFORM_NONE_CHROMIUM,
-      texture,
-      0,
-      0,
-      size.width(),
-      size.height(),
-      0,
-      0,
-      1.0f,
-      1.0f);
   GpuBrowserCompositorOutputSurface::SwapBuffers(frame);
 }
 
diff --git a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h
index e114ba96..d733772 100644
--- a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h
+++ b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h
@@ -34,6 +34,7 @@
   void OnSwapBuffersComplete() override;
   void BindFramebuffer() override;
   void Reshape(const gfx::Size& size, float scale_factor) override;
+  bool IsDisplayedAsOverlayPlane() const override;
   unsigned GetOverlayTextureId() const override;
 
   void OnSwapBuffersCompleted(const std::vector<ui::LatencyInfo>& latency_info,
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 9e611ac..aa0ff80 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1631,6 +1631,9 @@
         base::Bind(&VRDeviceManager::BindRequest));
   }
 #endif
+
+  GetContentClient()->browser()->RegisterRenderFrameMojoServices(
+      GetServiceRegistry(), this);
 }
 
 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) {
diff --git a/content/browser/frame_host/render_frame_host_manager_browsertest.cc b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
index 3471ee3..fcf00e8 100644
--- a/content/browser/frame_host/render_frame_host_manager_browsertest.cc
+++ b/content/browser/frame_host/render_frame_host_manager_browsertest.cc
@@ -109,8 +109,12 @@
   void NavigateToPageWithLinks(Shell* shell) {
     EXPECT_TRUE(NavigateToURL(
         shell, embedded_test_server()->GetURL("/click-noreferrer-links.html")));
-    std::string script = "setOriginForLinks('" +
-                         embedded_test_server()->base_url().spec() + "');";
+
+    // Rewrite selected links on the page to be actual cross-site (bar.com)
+    // URLs. This does not use the /cross-site/ redirector, since that creates
+    // links that initially look same-site.
+    std::string script = "setOriginForLinks('http://bar.com:" +
+                         embedded_test_server()->base_url().port() + "/');";
     EXPECT_TRUE(ExecuteScript(shell->web_contents(), script));
   }
 
diff --git a/content/browser/loader/async_resource_handler.cc b/content/browser/loader/async_resource_handler.cc
index f8e556c..2eace36 100644
--- a/content/browser/loader/async_resource_handler.cc
+++ b/content/browser/loader/async_resource_handler.cc
@@ -318,9 +318,6 @@
     int size;
     if (!buffer_->ShareToProcess(filter->PeerHandle(), &handle, &size))
       return false;
-    // TODO(erikchen): Temporary debugging to help track down crash.
-    // http://crbug.com/527588.
-    CHECK_LE(size, 512 * 1024);
     filter->Send(new ResourceMsg_SetDataBuffer(
         GetRequestID(), handle, size, filter->peer_pid()));
     sent_first_data_msg_ = true;
diff --git a/content/browser/permissions/permission_service_context.cc b/content/browser/permissions/permission_service_context.cc
index be035809..ec8c386 100644
--- a/content/browser/permissions/permission_service_context.cc
+++ b/content/browser/permissions/permission_service_context.cc
@@ -41,17 +41,17 @@
   services_.erase(it);
 }
 
-void PermissionServiceContext::RenderFrameDeleted(
-    RenderFrameHost* render_frame_host) {
-  CancelPendingOperations(render_frame_host);
-}
-
 void PermissionServiceContext::RenderFrameHostChanged(
     RenderFrameHost* old_host,
     RenderFrameHost* new_host) {
   CancelPendingOperations(old_host);
 }
 
+void PermissionServiceContext::FrameDeleted(
+    RenderFrameHost* render_frame_host) {
+  CancelPendingOperations(render_frame_host);
+}
+
 void PermissionServiceContext::DidNavigateAnyFrame(
     RenderFrameHost* render_frame_host,
     const LoadCommittedDetails& details,
diff --git a/content/browser/permissions/permission_service_context.h b/content/browser/permissions/permission_service_context.h
index e07366d..ac54efb7 100644
--- a/content/browser/permissions/permission_service_context.h
+++ b/content/browser/permissions/permission_service_context.h
@@ -40,9 +40,9 @@
 
  private:
   // WebContentsObserver
-  void RenderFrameDeleted(RenderFrameHost* render_frame_host) override;
   void RenderFrameHostChanged(RenderFrameHost* old_host,
                               RenderFrameHost* new_host) override;
+  void FrameDeleted(RenderFrameHost* render_frame_host) override;
   void DidNavigateAnyFrame(RenderFrameHost* render_frame_host,
                            const LoadCommittedDetails& details,
                            const FrameNavigateParams& params) override;
diff --git a/content/browser/permissions/permission_service_impl.cc b/content/browser/permissions/permission_service_impl.cc
index edba041..4d16c06 100644
--- a/content/browser/permissions/permission_service_impl.cc
+++ b/content/browser/permissions/permission_service_impl.cc
@@ -45,7 +45,8 @@
     PermissionType permission,
     const GURL& origin,
     const PermissionStatusCallback& callback)
-    : permission(permission),
+    : id(PermissionManager::kNoPendingOperation),
+      permission(permission),
       origin(origin),
       callback(callback) {
 }
@@ -117,18 +118,25 @@
   }
 
   PermissionType permission_type = PermissionNameToPermissionType(permission);
-  int request_id = pending_requests_.Add(
+  int pending_request_id = pending_requests_.Add(
       new PendingRequest(permission_type, GURL(origin), callback));
 
-  browser_context->GetPermissionManager()->RequestPermission(
+  int id = browser_context->GetPermissionManager()->RequestPermission(
       permission_type,
       context_->render_frame_host(),
-      request_id,
       GURL(origin),
       user_gesture, // TODO(mlamouri): should be removed (crbug.com/423770)
       base::Bind(&PermissionServiceImpl::OnRequestPermissionResponse,
                  weak_factory_.GetWeakPtr(),
-                 request_id));
+                 pending_request_id));
+
+  // Check if the request still exists. It might have been removed by the
+  // callback if it was run synchronously.
+  PendingRequest* pending_request = pending_requests_.Lookup(
+      pending_request_id);
+  if (!pending_request)
+      return;
+  pending_request->id = id;
 }
 
 void PermissionServiceImpl::RequestPermissions(
@@ -156,7 +164,6 @@
 }
 
 void PermissionServiceImpl::CancelPendingOperations() {
-  DCHECK(context_->render_frame_host());
   DCHECK(context_->GetBrowserContext());
 
   PermissionManager* permission_manager =
@@ -168,10 +175,7 @@
   for (RequestsMap::Iterator<PendingRequest> it(&pending_requests_);
        !it.IsAtEnd(); it.Advance()) {
     permission_manager->CancelPermissionRequest(
-        it.GetCurrentValue()->permission,
-        context_->render_frame_host(),
-        it.GetCurrentKey(),
-        it.GetCurrentValue()->origin);
+        it.GetCurrentValue()->id);
   }
   pending_requests_.Clear();
 
diff --git a/content/browser/permissions/permission_service_impl.h b/content/browser/permissions/permission_service_impl.h
index b83a6973..26321870 100644
--- a/content/browser/permissions/permission_service_impl.h
+++ b/content/browser/permissions/permission_service_impl.h
@@ -48,6 +48,8 @@
                    const PermissionStatusCallback& callback);
     ~PendingRequest();
 
+    // Request ID received from the PermissionManager.
+    int id;
     PermissionType permission;
     GURL origin;
     PermissionStatusCallback callback;
diff --git a/content/browser/power_save_blocker_x11.cc b/content/browser/power_save_blocker_x11.cc
index 4ffe2e6b..ef2acd1 100644
--- a/content/browser/power_save_blocker_x11.cc
+++ b/content/browser/power_save_blocker_x11.cc
@@ -35,7 +35,7 @@
 enum DBusAPI {
   NO_API,           // Disable. No supported API available.
   GNOME_API,        // Use the GNOME API. (Supports more features.)
-  FREEDESKTOP_API,  // Use the FreeDesktop API, for KDE4 and XFCE.
+  FREEDESKTOP_API,  // Use the FreeDesktop API, for KDE4, KDE5, and XFCE.
 };
 
 // Inhibit flags defined in the org.gnome.SessionManager interface.
@@ -368,6 +368,7 @@
       break;
     case base::nix::DESKTOP_ENVIRONMENT_XFCE:
     case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+    case base::nix::DESKTOP_ENVIRONMENT_KDE5:
       if (DPMSEnabled())
         return FREEDESKTOP_API;
       break;
diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc
index 80e2aea..89f89d4 100644
--- a/content/browser/presentation/presentation_service_impl.cc
+++ b/content/browser/presentation/presentation_service_impl.cc
@@ -573,6 +573,11 @@
   service_->client_->OnScreenAvailabilityUpdated(availability_url_, available);
 }
 
+void PresentationServiceImpl::ScreenAvailabilityListenerImpl
+::OnScreenAvailabilityNotSupported() {
+  service_->client_->OnScreenAvailabilityNotSupported(availability_url_);
+}
+
 PresentationServiceImpl::NewSessionMojoCallbackWrapper
 ::NewSessionMojoCallbackWrapper(const NewSessionMojoCallback& callback)
     : callback_(callback) {
diff --git a/content/browser/presentation/presentation_service_impl.h b/content/browser/presentation/presentation_service_impl.h
index 0a3fe6f..cbea133 100644
--- a/content/browser/presentation/presentation_service_impl.h
+++ b/content/browser/presentation/presentation_service_impl.h
@@ -118,6 +118,7 @@
     // PresentationScreenAvailabilityListener implementation.
     std::string GetAvailabilityUrl() const override;
     void OnScreenAvailabilityChanged(bool available) override;
+    void OnScreenAvailabilityNotSupported() override;
 
    private:
     const std::string availability_url_;
diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc
index 09cb237..be53cda 100644
--- a/content/browser/presentation/presentation_service_impl_unittest.cc
+++ b/content/browser/presentation/presentation_service_impl_unittest.cc
@@ -70,11 +70,18 @@
            PresentationServiceDelegate::Observer* observer));
   MOCK_METHOD2(RemoveObserver,
       void(int render_process_id, int render_frame_id));
-  MOCK_METHOD3(AddScreenAvailabilityListener,
-      bool(
-          int render_process_id,
-          int routing_id,
-          PresentationScreenAvailabilityListener* listener));
+
+  bool AddScreenAvailabilityListener(
+      int render_process_id,
+      int routing_id,
+      PresentationScreenAvailabilityListener* listener) override {
+    if (!screen_availability_listening_supported_)
+      listener->OnScreenAvailabilityNotSupported();
+
+    return AddScreenAvailabilityListener();
+  }
+  MOCK_METHOD0(AddScreenAvailabilityListener, bool());
+
   MOCK_METHOD3(RemoveScreenAvailabilityListener,
       void(
           int render_process_id,
@@ -132,6 +139,13 @@
       void(int render_process_id,
            int render_frame_id,
            const content::SessionStateChangedCallback& state_changed_cb));
+
+  void set_screen_availability_listening_supported(bool value) {
+    screen_availability_listening_supported_ = value;
+  }
+
+ private:
+  bool screen_availability_listening_supported_ = true;
 };
 
 class MockPresentationServiceClient :
@@ -147,9 +161,8 @@
   MOCK_METHOD2(OnSessionStateChanged,
                void(const presentation::PresentationSessionInfo& session_info,
                     presentation::PresentationSessionState new_state));
-  void OnScreenAvailabilityNotSupported(const mojo::String& url) override {
-    NOTIMPLEMENTED();
-  }
+
+  MOCK_METHOD1(OnScreenAvailabilityNotSupported, void(const mojo::String& url));
 
   void OnSessionMessagesReceived(
       presentation::PresentationSessionInfoPtr session_info,
@@ -198,7 +211,7 @@
     // using RunLoop.
     // The callback shouldn't be invoked since there is no availability
     // result yet.
-    EXPECT_CALL(mock_delegate_, AddScreenAvailabilityListener(_, _, _))
+    EXPECT_CALL(mock_delegate_, AddScreenAvailabilityListener())
         .WillOnce(DoAll(
             InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit),
             Return(delegate_success)));
@@ -831,4 +844,12 @@
       content::PRESENTATION_SESSION_STATE_CONNECTED);
 }
 
+TEST_F(PresentationServiceImplTest, ScreenAvailabilityNotSupported) {
+  mock_delegate_.set_screen_availability_listening_supported(false);
+  EXPECT_CALL(mock_client_,
+              OnScreenAvailabilityNotSupported(Eq(kPresentationUrl)));
+
+  ListenForScreenAvailabilityAndWait(kPresentationUrl, false);
+}
+
 }  // namespace content
diff --git a/content/browser/push_messaging/push_messaging_message_filter.cc b/content/browser/push_messaging/push_messaging_message_filter.cc
index f75619d..aa8cea5 100644
--- a/content/browser/push_messaging/push_messaging_message_filter.cc
+++ b/content/browser/push_messaging/push_messaging_message_filter.cc
@@ -64,15 +64,15 @@
                             PUSH_GETREGISTRATION_STATUS_LAST + 1);
 }
 
-// Curries the |success| and |p256dh| parameters over to |callback| and
+// Curries the |success| and |curve25519dh| parameters over to |callback| and
 // posts a task to invoke |callback| on the IO thread.
 void ForwardPublicEncryptionKeysToIOThreadProxy(
     const PushMessagingService::PublicKeyCallback& callback,
     bool success,
-    const std::vector<uint8_t>& p256dh) {
+    const std::vector<uint8_t>& curve25519dh) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
-                          base::Bind(callback, success, p256dh));
+                          base::Bind(callback, success, curve25519dh));
 }
 
 // Concatenates the subscription id with the endpoint base to create a new
@@ -148,7 +148,7 @@
 
   void DidRegister(const RegisterData& data,
                    const std::string& push_registration_id,
-                   const std::vector<uint8_t>& p256dh,
+                   const std::vector<uint8_t>& curve25519dh,
                    PushRegistrationStatus status);
 
   // Private Unregister methods on UI thread -----------------------------------
@@ -366,7 +366,7 @@
     const RegisterData& data,
     const std::string& push_registration_id,
     bool success,
-    const std::vector<uint8_t>& p256dh) {
+    const std::vector<uint8_t>& curve25519dh) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (!success) {
     SendRegisterError(data, PUSH_REGISTRATION_STATUS_PUBLIC_KEY_UNAVAILABLE);
@@ -374,7 +374,7 @@
   }
 
   SendRegisterSuccess(data, PUSH_REGISTRATION_STATUS_SUCCESS_FROM_CACHE,
-                      push_registration_id, p256dh);
+                      push_registration_id, curve25519dh);
 }
 
 void PushMessagingMessageFilter::DidGetSenderIdFromStorage(
@@ -451,14 +451,14 @@
 void PushMessagingMessageFilter::Core::DidRegister(
     const RegisterData& data,
     const std::string& push_registration_id,
-    const std::vector<uint8_t>& p256dh,
+    const std::vector<uint8_t>& curve25519dh,
     PushRegistrationStatus status) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
   if (status == PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE) {
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
         base::Bind(&PushMessagingMessageFilter::PersistRegistrationOnIO,
-                   io_parent_, data, push_registration_id, p256dh));
+                   io_parent_, data, push_registration_id, curve25519dh));
   } else {
     BrowserThread::PostTask(
         BrowserThread::IO, FROM_HERE,
@@ -470,7 +470,7 @@
 void PushMessagingMessageFilter::PersistRegistrationOnIO(
     const RegisterData& data,
     const std::string& push_registration_id,
-    const std::vector<uint8_t>& p256dh) {
+    const std::vector<uint8_t>& curve25519dh) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   service_worker_context_->StoreRegistrationUserData(
       data.service_worker_registration_id,
@@ -479,19 +479,19 @@
       push_registration_id,
       base::Bind(&PushMessagingMessageFilter::DidPersistRegistrationOnIO,
                  weak_factory_io_to_io_.GetWeakPtr(),
-                 data, push_registration_id, p256dh));
+                 data, push_registration_id, curve25519dh));
 }
 
 void PushMessagingMessageFilter::DidPersistRegistrationOnIO(
     const RegisterData& data,
     const std::string& push_registration_id,
-    const std::vector<uint8_t>& p256dh,
+    const std::vector<uint8_t>& curve25519dh,
     ServiceWorkerStatusCode service_worker_status) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (service_worker_status == SERVICE_WORKER_OK) {
     SendRegisterSuccess(data,
                         PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE,
-                        push_registration_id, p256dh);
+                        push_registration_id, curve25519dh);
   } else {
     // TODO(johnme): Unregister, so PushMessagingServiceImpl can decrease count.
     SendRegisterError(data, PUSH_REGISTRATION_STATUS_STORAGE_ERROR);
@@ -516,7 +516,7 @@
     const RegisterData& data,
     PushRegistrationStatus status,
     const std::string& push_registration_id,
-    const std::vector<uint8_t>& p256dh) {
+    const std::vector<uint8_t>& curve25519dh) {
   // Only called from IO thread, but would be safe to call from UI thread.
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (push_endpoint_base_.is_empty()) {
@@ -531,12 +531,12 @@
         data.render_frame_id,
         data.request_id,
         CreatePushEndpoint(push_endpoint_base_, push_registration_id),
-        p256dh));
+        curve25519dh));
   } else {
     Send(new PushMessagingMsg_SubscribeFromWorkerSuccess(
         data.request_id,
         CreatePushEndpoint(push_endpoint_base_, push_registration_id),
-        p256dh));
+        curve25519dh));
   }
   RecordRegistrationStatus(status);
 }
@@ -847,7 +847,7 @@
     int request_id,
     const GURL& endpoint,
     bool success,
-    const std::vector<uint8_t>& p256dh) {
+    const std::vector<uint8_t>& curve25519dh) {
   DCHECK_CURRENTLY_ON(BrowserThread::IO);
   if (!success) {
     PushGetRegistrationStatus status =
@@ -860,7 +860,7 @@
   }
 
   Send(new PushMessagingMsg_GetRegistrationSuccess(request_id, endpoint,
-                                                   p256dh));
+                                                   curve25519dh));
 
   RecordGetRegistrationStatus(PUSH_GETREGISTRATION_STATUS_SUCCESS);
 }
diff --git a/content/browser/push_messaging/push_messaging_message_filter.h b/content/browser/push_messaging/push_messaging_message_filter.h
index 737baf2..c95d477 100644
--- a/content/browser/push_messaging/push_messaging_message_filter.h
+++ b/content/browser/push_messaging/push_messaging_message_filter.h
@@ -76,7 +76,7 @@
   void DidGetEncryptionKeys(const RegisterData& data,
                             const std::string& push_registration_id,
                             bool success,
-                            const std::vector<uint8_t>& p256dh);
+                            const std::vector<uint8_t>& curve25519dh);
 
   void DidGetSenderIdFromStorage(const RegisterData& data,
                                  const std::string& sender_id,
@@ -85,12 +85,12 @@
   // Called via PostTask from UI thread.
   void PersistRegistrationOnIO(const RegisterData& data,
                                const std::string& push_registration_id,
-                               const std::vector<uint8_t>& p256dh);
+                               const std::vector<uint8_t>& curve25519dh);
 
   void DidPersistRegistrationOnIO(
       const RegisterData& data,
       const std::string& push_registration_id,
-      const std::vector<uint8_t>& p256dh,
+      const std::vector<uint8_t>& curve25519dh,
       ServiceWorkerStatusCode service_worker_status);
 
   // Called both from IO thread, and via PostTask from UI thread.
@@ -100,7 +100,7 @@
   void SendRegisterSuccess(const RegisterData& data,
                            PushRegistrationStatus status,
                            const std::string& push_registration_id,
-                           const std::vector<uint8_t>& p256dh);
+                           const std::vector<uint8_t>& curve25519dh);
 
   // Unsubscribe methods on IO thread ------------------------------------------
 
@@ -152,7 +152,7 @@
   void DidGetRegistrationKeys(int request_id,
                               const GURL& endpoint,
                               bool success,
-                              const std::vector<uint8_t>& p256dh);
+                              const std::vector<uint8_t>& curve25519dh);
 
   // Helper methods on IO thread -----------------------------------------------
 
diff --git a/content/browser/renderer_host/input/motion_event_android.cc b/content/browser/renderer_host/input/motion_event_android.cc
index 8d36c81..4d30a3f1 100644
--- a/content/browser/renderer_host/input/motion_event_android.cc
+++ b/content/browser/renderer_host/input/motion_event_android.cc
@@ -71,6 +71,10 @@
     result |= MotionEventAndroid::BUTTON_SECONDARY;
   if ((button_state & BUTTON_TERTIARY) != 0)
     result |= MotionEventAndroid::BUTTON_TERTIARY;
+  if ((button_state & BUTTON_STYLUS_PRIMARY) != 0)
+    result |= MotionEventAndroid::BUTTON_STYLUS_PRIMARY;
+  if ((button_state & BUTTON_STYLUS_SECONDARY) != 0)
+    result |= MotionEventAndroid::BUTTON_STYLUS_SECONDARY;
   return result;
 }
 
diff --git a/content/browser/renderer_host/media/audio_input_sync_writer.cc b/content/browser/renderer_host/media/audio_input_sync_writer.cc
index 722f63e..68d052e 100644
--- a/content/browser/renderer_host/media/audio_input_sync_writer.cc
+++ b/content/browser/renderer_host/media/audio_input_sync_writer.cc
@@ -11,6 +11,8 @@
 #include "content/browser/renderer_host/media/media_stream_manager.h"
 
 using media::AudioBus;
+using media::AudioInputBuffer;
+using media::AudioInputBufferParameters;
 
 namespace content {
 
@@ -39,8 +41,10 @@
       next_read_buffer_index_(0),
       number_of_filled_segments_(0),
       write_count_(0),
+      write_to_fifo_count_(0),
       write_error_count_(0),
-      trailing_error_count_(0) {
+      trailing_write_to_fifo_count_(0),
+      trailing_write_error_count_(0) {
   DCHECK_GT(shared_memory_segment_count, 0);
   DCHECK_EQ(shared_memory_size % shared_memory_segment_count, 0u);
   shared_memory_segment_size_ =
@@ -53,31 +57,46 @@
   uint8* ptr = shared_memory_;
   for (int i = 0; i < shared_memory_segment_count; ++i) {
     CHECK_EQ(0U, reinterpret_cast<uintptr_t>(ptr) &
-        (media::AudioBus::kChannelAlignment - 1));
-    media::AudioInputBuffer* buffer =
-        reinterpret_cast<media::AudioInputBuffer*>(ptr);
-    scoped_ptr<media::AudioBus> audio_bus =
-        media::AudioBus::WrapMemory(params, buffer->audio);
+        (AudioBus::kChannelAlignment - 1));
+    AudioInputBuffer* buffer = reinterpret_cast<AudioInputBuffer*>(ptr);
+    scoped_ptr<AudioBus> audio_bus =
+        AudioBus::WrapMemory(params, buffer->audio);
     audio_buses_.push_back(audio_bus.release());
     ptr += shared_memory_segment_size_;
   }
 }
 
 AudioInputSyncWriter::~AudioInputSyncWriter() {
-  // Subtract 'trailing' errors that will happen if the renderer process was
+  // We log the following:
+  // - Percentage of data written to fifo (and not to shared memory).
+  // - Percentage of data dropped (fifo reached max size or socket buffer full).
+  // - Glitch yes/no (at least 1 drop).
+  //
+  // Subtract 'trailing' counts that will happen if the renderer process was
   // killed or e.g. the page refreshed while the input device was open etc.
   // This trims off the end of both the error and write counts so that we
-  // preserve the proportion of errors before the teardown period.
-  DCHECK_LE(trailing_error_count_, write_error_count_);
-  DCHECK_LE(trailing_error_count_, write_count_);
-  write_error_count_ -= trailing_error_count_;
-  write_count_ -= trailing_error_count_;
+  // preserve the proportion of counts before the teardown period. We pick
+  // the largest trailing count as the time we consider that the trailing errors
+  // begun, and subract that from the total write count.
+  DCHECK_LE(trailing_write_to_fifo_count_, write_to_fifo_count_);
+  DCHECK_LE(trailing_write_to_fifo_count_, write_count_);
+  DCHECK_LE(trailing_write_error_count_, write_error_count_);
+  DCHECK_LE(trailing_write_error_count_, write_count_);
+
+  write_to_fifo_count_ -= trailing_write_to_fifo_count_;
+  write_error_count_ -= trailing_write_error_count_;
+  write_count_ -= std::max(trailing_write_to_fifo_count_,
+                           trailing_write_error_count_);
 
   if (write_count_ == 0)
     return;
 
   UMA_HISTOGRAM_PERCENTAGE(
       "Media.AudioCapturerMissedReadDeadline",
+      100.0 * write_to_fifo_count_ / write_count_);
+
+  UMA_HISTOGRAM_PERCENTAGE(
+      "Media.AudioCapturerDroppedData",
       100.0 * write_error_count_ / write_count_);
 
   UMA_HISTOGRAM_ENUMERATION("Media.AudioCapturerAudioGlitches",
@@ -98,37 +117,12 @@
   DVLOG(1) << log_string;
 }
 
-void AudioInputSyncWriter::Write(const media::AudioBus* data,
+void AudioInputSyncWriter::Write(const AudioBus* data,
                                  double volume,
                                  bool key_pressed,
                                  uint32 hardware_delay_bytes) {
   ++write_count_;
-
-#if !defined(OS_ANDROID)
-  static const base::TimeDelta kLogDelayThreadhold =
-      base::TimeDelta::FromMilliseconds(500);
-
-  std::ostringstream oss;
-  if (last_write_time_.is_null()) {
-    // This is the first time Write is called.
-    base::TimeDelta interval = base::Time::Now() - creation_time_;
-    oss << "AISW::Write: audio input data received for the first time: delay "
-           "= " << interval.InMilliseconds() << "ms";
-
-  } else {
-    base::TimeDelta interval = base::Time::Now() - last_write_time_;
-    if (interval > kLogDelayThreadhold) {
-      oss << "AISW::Write: audio input data delay unexpectedly long: delay = "
-          << interval.InMilliseconds() << "ms";
-    }
-  }
-  if (!oss.str().empty()) {
-    AddToNativeLog(oss.str());
-    DVLOG(1) << oss.str();
-  }
-
-  last_write_time_ = base::Time::Now();
-#endif
+  CheckTimeSinceLastWrite();
 
   // Check that the renderer side has read data so that we don't overwrite data
   // that hasn't been read yet. The renderer side sends a signal over the socket
@@ -149,54 +143,38 @@
     }
   }
 
-  // Check that the ring buffer isn't full, and if it is log error and drop the
-  // buffer.
-  if (number_of_filled_segments_ ==
+  bool write_error = !WriteDataFromFifoToSharedMemory();
+
+  // Write the current data to the shared memory if there is room, otherwise
+  // put it in the fifo.
+  if (number_of_filled_segments_ <
       static_cast<int>(shared_memory_segment_count_)) {
-    const std::string error_message =
-        "No room in ring buffer to write data to. Dropping the data.";
-    LOG(ERROR) << error_message;
-    AddToNativeLog(error_message);
-    ++write_error_count_;
-    ++trailing_error_count_;
-    return;
+    WriteParametersToCurrentSegment(volume, key_pressed, hardware_delay_bytes);
+
+    // Copy data into shared memory using pre-allocated audio buses.
+    AudioBus* audio_bus = audio_buses_[current_segment_id_];
+    data->CopyTo(audio_bus);
+
+    if (!SignalDataWrittenAndUpdateCounters())
+      write_error = true;
+
+    trailing_write_to_fifo_count_ = 0;
+  } else {
+    if (!PushDataToFifo(data, volume, key_pressed, hardware_delay_bytes))
+      write_error = true;
+
+    ++write_to_fifo_count_;
+    ++trailing_write_to_fifo_count_;
   }
 
-  // Write audio parameters to shared memory.
-  uint8* ptr = shared_memory_;
-  ptr += current_segment_id_ * shared_memory_segment_size_;
-  media::AudioInputBuffer* buffer =
-      reinterpret_cast<media::AudioInputBuffer*>(ptr);
-  buffer->params.volume = volume;
-  buffer->params.size = audio_bus_memory_size_;
-  buffer->params.key_pressed = key_pressed;
-  buffer->params.hardware_delay_bytes = hardware_delay_bytes;
-  buffer->params.id = next_buffer_id_++;
-
-  // Copy data from the native audio layer into shared memory using pre-
-  // allocated audio buses.
-  media::AudioBus* audio_bus = audio_buses_[current_segment_id_];
-  data->CopyTo(audio_bus);
-
-  if (socket_->Send(&current_segment_id_, sizeof(current_segment_id_)) !=
-      sizeof(current_segment_id_)) {
-    const std::string error_message = "No room in socket buffer.";
-    LOG(ERROR) << error_message;
-    AddToNativeLog(error_message);
+  // Increase write error counts if error, or reset the trailing error counter
+  // if all write operations went well (no data dropped).
+  if (write_error) {
     ++write_error_count_;
-    ++trailing_error_count_;
-    return;
+    ++trailing_write_error_count_;
+  } else {
+    trailing_write_error_count_ = 0;
   }
-
-  // Successfully delivered the buffer. Clear the trailing failure count.
-  trailing_error_count_ = 0;
-
-  if (++current_segment_id_ >= shared_memory_segment_count_)
-    current_segment_id_ = 0;
-
-  ++number_of_filled_segments_;
-  CHECK_LE(number_of_filled_segments_,
-           static_cast<int>(shared_memory_segment_count_));
 }
 
 void AudioInputSyncWriter::Close() {
@@ -216,8 +194,145 @@
   return foreign_socket_->PrepareTransitDescriptor(process_handle, descriptor);
 }
 
+void AudioInputSyncWriter::CheckTimeSinceLastWrite() {
+#if !defined(OS_ANDROID)
+  static const base::TimeDelta kLogDelayThreadhold =
+      base::TimeDelta::FromMilliseconds(500);
+
+  std::ostringstream oss;
+  if (last_write_time_.is_null()) {
+    // This is the first time Write is called.
+    base::TimeDelta interval = base::Time::Now() - creation_time_;
+    oss << "AISW::Write: audio input data received for the first time: delay "
+           "= " << interval.InMilliseconds() << "ms";
+  } else {
+    base::TimeDelta interval = base::Time::Now() - last_write_time_;
+    if (interval > kLogDelayThreadhold) {
+      oss << "AISW::Write: audio input data delay unexpectedly long: delay = "
+          << interval.InMilliseconds() << "ms";
+    }
+  }
+  if (!oss.str().empty()) {
+    AddToNativeLog(oss.str());
+    DVLOG(1) << oss.str();
+  }
+
+  last_write_time_ = base::Time::Now();
+#endif
+}
+
 void AudioInputSyncWriter::AddToNativeLog(const std::string& message) {
   MediaStreamManager::SendMessageToNativeLog(message);
 }
 
+bool AudioInputSyncWriter::PushDataToFifo(
+    const AudioBus* data,
+    double volume,
+    bool key_pressed,
+    uint32 hardware_delay_bytes) {
+  if (overflow_buses_.size() == kMaxOverflowBusesSize) {
+    const std::string error_message = "AISW: No room in fifo.";
+    LOG(ERROR) << error_message;
+    AddToNativeLog(error_message);
+    return false;
+  }
+
+  if (overflow_buses_.empty()) {
+    const std::string message = "AISW: Starting to use fifo.";
+    DVLOG(1) << message;
+    AddToNativeLog(message);
+  }
+
+  // Push parameters to fifo.
+  AudioInputBufferParameters params =
+      { volume, 0, hardware_delay_bytes, 0, key_pressed };
+  overflow_params_.push_back(params);
+
+  // Push audio data to fifo.
+  scoped_ptr<AudioBus> audio_bus =
+      AudioBus::Create(data->channels(), data->frames());
+  data->CopyTo(audio_bus.get());
+  overflow_buses_.push_back(audio_bus.release());
+
+  DCHECK_LE(overflow_buses_.size(), static_cast<size_t>(kMaxOverflowBusesSize));
+  DCHECK_EQ(overflow_params_.size(), overflow_buses_.size());
+
+  return true;
+}
+
+bool AudioInputSyncWriter::WriteDataFromFifoToSharedMemory() {
+  if (overflow_buses_.empty())
+    return true;
+
+  const int segment_count = static_cast<int>(shared_memory_segment_count_);
+  bool write_error = false;
+  auto params_it = overflow_params_.begin();
+  auto audio_bus_it = overflow_buses_.begin();
+  DCHECK_EQ(overflow_params_.size(), overflow_buses_.size());
+
+  while (audio_bus_it != overflow_buses_.end() &&
+         number_of_filled_segments_ < segment_count) {
+    // Write parameters to shared memory.
+    WriteParametersToCurrentSegment((*params_it).volume,
+                                    (*params_it).key_pressed,
+                                    (*params_it).hardware_delay_bytes);
+
+    // Copy data from the fifo into shared memory using pre-allocated audio
+    // buses.
+    (*audio_bus_it)->CopyTo(audio_buses_[current_segment_id_]);
+
+    if (!SignalDataWrittenAndUpdateCounters())
+      write_error = true;
+
+    ++params_it;
+    ++audio_bus_it;
+  }
+
+  // Erase all copied data from fifo.
+  overflow_params_.erase(overflow_params_.begin(), params_it);
+  overflow_buses_.erase(overflow_buses_.begin(), audio_bus_it);
+
+  if (overflow_buses_.empty()) {
+    const std::string message = "AISW: Fifo emptied.";
+    DVLOG(1) << message;
+    AddToNativeLog(message);
+  }
+
+  DCHECK_EQ(overflow_params_.size(), overflow_buses_.size());
+  return !write_error;
+}
+
+void AudioInputSyncWriter::WriteParametersToCurrentSegment(
+    double volume,
+    bool key_pressed,
+    uint32 hardware_delay_bytes) {
+  uint8* ptr = shared_memory_;
+  ptr += current_segment_id_ * shared_memory_segment_size_;
+  AudioInputBuffer* buffer = reinterpret_cast<AudioInputBuffer*>(ptr);
+  buffer->params.volume = volume;
+  buffer->params.size = audio_bus_memory_size_;
+  buffer->params.key_pressed = key_pressed;
+  buffer->params.hardware_delay_bytes = hardware_delay_bytes;
+  buffer->params.id = next_buffer_id_;
+}
+
+bool AudioInputSyncWriter::SignalDataWrittenAndUpdateCounters() {
+  if (socket_->Send(&current_segment_id_, sizeof(current_segment_id_)) !=
+      sizeof(current_segment_id_)) {
+    const std::string error_message = "AISW: No room in socket buffer.";
+    LOG(ERROR) << error_message;
+    AddToNativeLog(error_message);
+    return false;
+  }
+
+  if (++current_segment_id_ >= shared_memory_segment_count_)
+    current_segment_id_ = 0;
+  ++number_of_filled_segments_;
+  CHECK_LE(number_of_filled_segments_,
+           static_cast<int>(shared_memory_segment_count_));
+  ++next_buffer_id_;
+
+  return true;
+}
+
 }  // namespace content
diff --git a/content/browser/renderer_host/media/audio_input_sync_writer.h b/content/browser/renderer_host/media/audio_input_sync_writer.h
index 0bfeb69f..896a0d8 100644
--- a/content/browser/renderer_host/media/audio_input_sync_writer.h
+++ b/content/browser/renderer_host/media/audio_input_sync_writer.h
@@ -5,6 +5,9 @@
 #ifndef CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_
 #define CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_INPUT_SYNC_WRITER_H_
 
+#include <deque>
+
+#include "base/gtest_prod_util.h"
 #include "base/memory/scoped_vector.h"
 #include "base/process/process.h"
 #include "base/sync_socket.h"
@@ -27,6 +30,10 @@
 class CONTENT_EXPORT AudioInputSyncWriter
     : public media::AudioInputController::SyncWriter {
  public:
+  // Maximum fifo size (|overflow_buses_| and |overflow_params_|) in number of
+  // AudioBuses.
+  enum { kMaxOverflowBusesSize = 100 };
+
   AudioInputSyncWriter(void* shared_memory,
                        size_t shared_memory_size,
                        int shared_memory_segment_count,
@@ -50,9 +57,44 @@
   scoped_ptr<base::CancelableSyncSocket> socket_;
 
  private:
+  friend class AudioInputSyncWriterTest;
+  FRIEND_TEST_ALL_PREFIXES(AudioInputSyncWriterTest, MultipleWritesAndReads);
+  FRIEND_TEST_ALL_PREFIXES(AudioInputSyncWriterTest, MultipleWritesNoReads);
+  FRIEND_TEST_ALL_PREFIXES(AudioInputSyncWriterTest, FillAndEmptyRingBuffer);
+  FRIEND_TEST_ALL_PREFIXES(AudioInputSyncWriterTest, FillRingBufferAndFifo);
+  FRIEND_TEST_ALL_PREFIXES(AudioInputSyncWriterTest,
+                           MultipleFillAndEmptyRingBufferAndPartOfFifo);
+
+  // Called by Write(). Checks the time since last called and if larger than a
+  // threshold logs info about that.
+  void CheckTimeSinceLastWrite();
+
   // Virtual function for native logging to be able to override in tests.
   virtual void AddToNativeLog(const std::string& message);
 
+  // Push |data| and metadata to |audio_buffer_fifo_|. Returns true if
+  // successful. Logs error and returns false if the fifo already reached the
+  // maximum size.
+  bool PushDataToFifo(const media::AudioBus* data,
+                      double volume,
+                      bool key_pressed,
+                      uint32 hardware_delay_bytes);
+
+  // Writes as much data as possible from the fifo (|overflow_buses_|) to the
+  // shared memory ring buffer. Returns true if all operations were successful,
+  // otherwise false.
+  bool WriteDataFromFifoToSharedMemory();
+
+  // Write audio parameters to current segment in shared memory.
+  void WriteParametersToCurrentSegment(double volume,
+                                       bool key_pressed,
+                                       uint32 hardware_delay_bytes);
+
+  // Signals over the socket that data has been written to the current segment.
+  // Updates counters and returns true if successful. Logs error and returns
+  // false if failure.
+  bool SignalDataWrittenAndUpdateCounters();
+
   uint8* shared_memory_;
   uint32 shared_memory_segment_size_;
   uint32 shared_memory_segment_count_;
@@ -84,19 +126,34 @@
   // ensure the we don't overwrite data that hasn't been read yet.
   int number_of_filled_segments_;
 
-  // Counts the total number of calls to Write() and number of failures due to
-  // ring buffer being full.
+  // Counts the total number of calls to Write().
   size_t write_count_;
+
+  // Counts the number of writes to the fifo instead of to the shared memory.
+  size_t write_to_fifo_count_;
+
+  // Counts the number of errors that causes data to be dropped, due to either
+  // the fifo or the socket buffer being full.
   size_t write_error_count_;
 
-  // Counts how many errors we get during renderer process teardown so that we
-  // can account for that (subtract) when we calculate the overall error count.
-  size_t trailing_error_count_;
+  // Counts the fifo writes and errors we get during renderer process teardown
+  // so that we can account for that (subtract) when we calculate the overall
+  // counts.
+  size_t trailing_write_to_fifo_count_;
+  size_t trailing_write_error_count_;
 
   // Vector of audio buses allocated during construction and deleted in the
   // destructor.
   ScopedVector<media::AudioBus> audio_buses_;
 
+  // Fifo for audio that is used in case there isn't room in the shared memory.
+  // This can for example happen under load when the consumer side is starved.
+  // It should ideally be rare, but we need to guarantee that the data arrives
+  // since audio processing such as echo cancelling requires that to perform
+  // properly.
+  ScopedVector<media::AudioBus> overflow_buses_;
+  std::deque<media::AudioInputBufferParameters> overflow_params_;
+
   DISALLOW_IMPLICIT_CONSTRUCTORS(AudioInputSyncWriter);
 };
 
diff --git a/content/browser/renderer_host/media/audio_input_sync_writer_unittest.cc b/content/browser/renderer_host/media/audio_input_sync_writer_unittest.cc
index cce27ca..26b05ed 100644
--- a/content/browser/renderer_host/media/audio_input_sync_writer_unittest.cc
+++ b/content/browser/renderer_host/media/audio_input_sync_writer_unittest.cc
@@ -153,7 +153,8 @@
   }
 
   // Get total number of expected log calls. On non-Android we expect one log
-  // call at first Write() call, zero on Android. Besides that only for errors.
+  // call at first Write() call, zero on Android. Besides that only for errors
+  // and fifo info.
   int GetTotalNumberOfExpectedLogCalls(int expected_calls_due_to_error) {
 #if defined(OS_ANDROID)
     return expected_calls_due_to_error;
@@ -162,6 +163,19 @@
 #endif
   }
 
+  // Tests expected numbers which are given as arguments.
+  bool TestSocketAndFifoExpectations(int number_of_buffers_in_socket,
+                                     size_t number_of_verifications_in_socket,
+                                     size_t number_of_buffers_in_fifo) {
+    EXPECT_EQ(number_of_buffers_in_socket, socket_->NumberOfBuffersFilled());
+    EXPECT_EQ(number_of_verifications_in_socket, socket_->Peek());
+    EXPECT_EQ(number_of_buffers_in_fifo, writer_->overflow_buses_.size());
+
+    return number_of_buffers_in_socket == socket_->NumberOfBuffersFilled() &&
+           number_of_verifications_in_socket == socket_->Peek() &&
+           number_of_buffers_in_fifo == writer_->overflow_buses_.size();
+  }
+
  protected:
   scoped_ptr<AudioInputSyncWriterUnderTest> writer_;
   MockCancelableSyncSocket* socket_;
@@ -174,17 +188,14 @@
 };
 
 TEST_F(AudioInputSyncWriterTest, SingleWriteAndRead) {
-  // We always expect one log call at first write.
   EXPECT_CALL(*writer_.get(), AddToNativeLog(_))
       .Times(GetTotalNumberOfExpectedLogCalls(0));
 
   writer_->Write(audio_bus_.get(), 0, false, 0);
-  EXPECT_EQ(1, socket_->NumberOfBuffersFilled());
-  EXPECT_EQ(0u, socket_->Peek());
+  EXPECT_TRUE(TestSocketAndFifoExpectations(1, 0, 0));
 
   socket_->Read(1);
-  EXPECT_EQ(0, socket_->NumberOfBuffersFilled());
-  EXPECT_EQ(sizeof(uint32_t), socket_->Peek());
+  EXPECT_TRUE(TestSocketAndFifoExpectations(0, 1 * sizeof(uint32_t), 0));
 }
 
 TEST_F(AudioInputSyncWriterTest, MultipleWritesAndReads) {
@@ -193,73 +204,159 @@
 
   for (int i = 1; i <= 2 * kSegments; ++i) {
     writer_->Write(audio_bus_.get(), 0, false, 0);
-    EXPECT_EQ(1, socket_->NumberOfBuffersFilled());
-    EXPECT_EQ(0u, socket_->Peek());
-
+    EXPECT_TRUE(TestSocketAndFifoExpectations(1, 0, 0));
     socket_->Read(1);
-    EXPECT_EQ(0, socket_->NumberOfBuffersFilled());
-    EXPECT_EQ(sizeof(uint32_t), socket_->Peek());
+    EXPECT_TRUE(TestSocketAndFifoExpectations(0, 1 * sizeof(uint32_t), 0));
   }
 }
 
 TEST_F(AudioInputSyncWriterTest, MultipleWritesNoReads) {
   EXPECT_CALL(*writer_.get(), AddToNativeLog(_))
-      .Times(GetTotalNumberOfExpectedLogCalls(kSegments));
+      .Times(GetTotalNumberOfExpectedLogCalls(1));
 
+  // Fill the ring buffer.
   for (int i = 1; i <= kSegments; ++i) {
     writer_->Write(audio_bus_.get(), 0, false, 0);
-    EXPECT_EQ(i, socket_->NumberOfBuffersFilled());
-    EXPECT_EQ(0u, socket_->Peek());
+    EXPECT_TRUE(TestSocketAndFifoExpectations(i, 0, 0));
   }
 
-  // Now the ring buffer is full, do more writes. We should get an extra error
-  // log call for each write. See top EXPECT_CALL.
-  for (int i = 1; i <= kSegments; ++i) {
+  // Now the ring buffer is full, do more writes. We should start filling the
+  // fifo and should get one extra log call for that.
+  for (size_t i = 1; i <= kSegments; ++i) {
     writer_->Write(audio_bus_.get(), 0, false, 0);
-    EXPECT_EQ(kSegments, socket_->NumberOfBuffersFilled());
-    EXPECT_EQ(0u, socket_->Peek());
+    EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, i));
   }
 }
 
 TEST_F(AudioInputSyncWriterTest, FillAndEmptyRingBuffer) {
   EXPECT_CALL(*writer_.get(), AddToNativeLog(_))
-      .Times(GetTotalNumberOfExpectedLogCalls(1));
+      .Times(GetTotalNumberOfExpectedLogCalls(2));
 
-  // Fill ring buffer.
+  // Fill the ring buffer.
   for (int i = 1; i <= kSegments; ++i) {
     writer_->Write(audio_bus_.get(), 0, false, 0);
   }
-  EXPECT_EQ(kSegments, socket_->NumberOfBuffersFilled());
-  EXPECT_EQ(0u, socket_->Peek());
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 0));
 
   // Empty half of the ring buffer.
-  int buffers_to_read = kSegments / 2;
+  const int buffers_to_read = kSegments / 2;
   socket_->Read(buffers_to_read);
-  EXPECT_EQ(kSegments - buffers_to_read, socket_->NumberOfBuffersFilled());
-  EXPECT_EQ(buffers_to_read * sizeof(uint32_t), socket_->Peek());
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments - buffers_to_read,
+                                            buffers_to_read * sizeof(uint32_t),
+                                            0));
 
   // Fill up again. The first write should do receive until that queue is
   // empty.
   for (int i = kSegments - buffers_to_read + 1; i <= kSegments; ++i) {
     writer_->Write(audio_bus_.get(), 0, false, 0);
-    EXPECT_EQ(i, socket_->NumberOfBuffersFilled());
-    EXPECT_EQ(0u, socket_->Peek());
+    EXPECT_TRUE(TestSocketAndFifoExpectations(i, 0, 0));
   }
 
-  // Another write, should render and extra error log call.
+  // Another write, should put the data in the fifo, and render an extra log
+  // call.
   writer_->Write(audio_bus_.get(), 0, false, 0);
-  EXPECT_EQ(kSegments, socket_->NumberOfBuffersFilled());
-  EXPECT_EQ(0u, socket_->Peek());
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 1));
 
   // Empty the ring buffer.
   socket_->Read(kSegments);
-  EXPECT_EQ(0, socket_->NumberOfBuffersFilled());
-  EXPECT_EQ(kSegments * sizeof(uint32_t), socket_->Peek());
+  EXPECT_TRUE(
+      TestSocketAndFifoExpectations(0, kSegments * sizeof(uint32_t), 1));
 
-  // Another write, should do receive until that queue is empty.
+  // Another write, should do receive until that queue is empty and write both
+  // the data in the fifo and the new data, and render a log call.
   writer_->Write(audio_bus_.get(), 0, false, 0);
-  EXPECT_EQ(1, socket_->NumberOfBuffersFilled());
-  EXPECT_EQ(0u, socket_->Peek());
+  EXPECT_TRUE(TestSocketAndFifoExpectations(2, 0, 0));
+
+  // Read the two data blocks.
+  socket_->Read(2);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(0, 2 * sizeof(uint32_t), 0));
+}
+
+TEST_F(AudioInputSyncWriterTest, FillRingBufferAndFifo) {
+  EXPECT_CALL(*writer_.get(), AddToNativeLog(_))
+      .Times(GetTotalNumberOfExpectedLogCalls(2));
+
+  // Fill the ring buffer.
+  for (int i = 1; i <= kSegments; ++i) {
+    writer_->Write(audio_bus_.get(), 0, false, 0);
+  }
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 0));
+
+  // Fill the fifo. Should render one log call for starting filling it.
+  const size_t max_fifo_size = AudioInputSyncWriter::kMaxOverflowBusesSize;
+  for (size_t i = 1; i <= max_fifo_size; ++i) {
+    writer_->Write(audio_bus_.get(), 0, false, 0);
+  }
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, max_fifo_size));
+
+  // Another write, data should be dropped and render one log call.
+  writer_->Write(audio_bus_.get(), 0, false, 0);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, max_fifo_size));
+}
+
+TEST_F(AudioInputSyncWriterTest, MultipleFillAndEmptyRingBufferAndPartOfFifo) {
+  EXPECT_CALL(*writer_.get(), AddToNativeLog(_))
+      .Times(GetTotalNumberOfExpectedLogCalls(4));
+
+  // Fill the ring buffer.
+  for (int i = 1; i <= kSegments; ++i) {
+    writer_->Write(audio_bus_.get(), 0, false, 0);
+  }
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 0));
+
+  // Write more data, should be put in the fifo and render one log call for
+  // starting filling it.
+  for (size_t i = 1; i <= 2 * kSegments; ++i) {
+    writer_->Write(audio_bus_.get(), 0, false, 0);
+  }
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 2 * kSegments));
+
+  // Empty the ring buffer.
+  socket_->Read(kSegments);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(0, kSegments * sizeof(uint32_t),
+                                            2 * kSegments));
+
+  // Another write should fill up the ring buffer with data from the fifo and
+  // put this data into the fifo.
+  writer_->Write(audio_bus_.get(), 0, false, 0);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, kSegments + 1));
+
+  // Empty the ring buffer again.
+  socket_->Read(kSegments);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(0, kSegments * sizeof(uint32_t),
+                                            kSegments + 1));
+
+  // Another write should fill up the ring buffer with data from the fifo and
+  // put this data into the fifo.
+  writer_->Write(audio_bus_.get(), 0, false, 0);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 2));
+
+  // Empty the ring buffer again.
+  socket_->Read(kSegments);
+  EXPECT_TRUE(
+      TestSocketAndFifoExpectations(0, kSegments * sizeof(uint32_t), 2));
+
+  // Another write should put the remaining data in the fifo in the ring buffer
+  // together with this data. Should render a log call for emptying the fifo.
+  writer_->Write(audio_bus_.get(), 0, false, 0);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(3, 0, 0));
+
+  // Read the remaining data.
+  socket_->Read(3);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(0, 3 * sizeof(uint32_t), 0));
+
+  // Fill the ring buffer and part of the fifo. Should render one log call for
+  // starting filling it.
+  for (int i = 1; i <= kSegments + 2; ++i) {
+    writer_->Write(audio_bus_.get(), 0, false, 0);
+  }
+  EXPECT_TRUE(TestSocketAndFifoExpectations(kSegments, 0, 2));
+
+  // Empty both. Should render a log call for emptying the fifo.
+  socket_->Read(kSegments);
+  writer_->Write(audio_bus_.get(), 0, false, 0);
+  socket_->Read(3);
+  EXPECT_TRUE(TestSocketAndFifoExpectations(0, 3 * sizeof(uint32_t), 0));
 }
 
 }  // namespace content
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 3500c28..ff87202 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1434,6 +1434,7 @@
 #if defined(OS_CHROMEOS)
     switches::kDisableVaapiAcceleratedVideoEncode,
 #endif
+    "use-new-edk",  // TODO(use_chrome_edk): temporary.
   };
   renderer_cmd->CopySwitchesFrom(browser_cmd, kSwitchNames,
                                  arraysize(kSwitchNames));
diff --git a/content/browser/renderer_host/render_process_host_impl.h b/content/browser/renderer_host/render_process_host_impl.h
index d10590d..a648d2db 100644
--- a/content/browser/renderer_host/render_process_host_impl.h
+++ b/content/browser/renderer_host/render_process_host_impl.h
@@ -267,8 +267,7 @@
   BluetoothDispatcherHost* GetBluetoothDispatcherHost();
 
  protected:
-  // A proxy for our IPC::Channel that lives on the IO thread (see
-  // browser_process.h)
+  // A proxy for our IPC::Channel that lives on the IO thread.
   scoped_ptr<IPC::ChannelProxy> channel_;
 
   // True if fast shutdown has been performed on this RPH.
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index b9b8896..512dfee 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -197,6 +197,7 @@
       allow_privileged_mouse_lock_(false),
       has_touch_handler_(false),
       is_in_gesture_scroll_(false),
+      received_paint_after_load_(false),
       next_browser_snapshot_id_(1),
       owned_by_render_frame_host_(false),
       is_focused_(false),
@@ -476,6 +477,8 @@
 #endif
     IPC_MESSAGE_HANDLER(InputHostMsg_ImeCompositionRangeChanged,
                         OnImeCompositionRangeChanged)
+    IPC_MESSAGE_HANDLER(ViewHostMsg_DidFirstPaintAfterLoad,
+                        OnFirstPaintAfterLoad)
     IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
 
@@ -918,13 +921,23 @@
 }
 
 void RenderWidgetHostImpl::StartNewContentRenderingTimeout() {
-  if (new_content_rendering_timeout_)
-    new_content_rendering_timeout_->Start(new_content_rendering_delay_);
+  // It is possible for a compositor frame to arrive before the browser is
+  // notified about the page being committed, in which case no timer is
+  // necessary.
+  if (received_paint_after_load_) {
+    received_paint_after_load_ = false;
+    return;
+  }
+
+  new_content_rendering_timeout_->Start(new_content_rendering_delay_);
 }
 
-void RenderWidgetHostImpl::StopNewContentRenderingTimeout() {
-  if (new_content_rendering_timeout_)
+void RenderWidgetHostImpl::OnFirstPaintAfterLoad() {
+  if (new_content_rendering_timeout_->IsRunning()) {
     new_content_rendering_timeout_->Stop();
+  } else {
+    received_paint_after_load_ = true;
+  }
 }
 
 void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) {
@@ -1515,8 +1528,6 @@
   // chrome/browser/extensions/api/cast_streaming/performance_test.cc
   TRACE_EVENT0("test_fps,benchmark", "OnSwapCompositorFrame");
 
-  StopNewContentRenderingTimeout();
-
   ViewHostMsg_SwapCompositorFrame::Param param;
   if (!ViewHostMsg_SwapCompositorFrame::Read(&message, &param))
     return false;
diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h
index 08b24ba4..3489495 100644
--- a/content/browser/renderer_host/render_widget_host_impl.h
+++ b/content/browser/renderer_host/render_widget_host_impl.h
@@ -263,9 +263,11 @@
   // a new compositor frame is not received before it expires.
   void StartNewContentRenderingTimeout();
 
-  // Stops the rendering timeout and prevents it from clearing any displayed
-  // graphics.
-  void StopNewContentRenderingTimeout();
+  // Notification that a new compositor frame has been generated following
+  // a page load. This stops |new_content_rendering_timeout_|, or prevents
+  // the timer from running if the load commit message hasn't been received
+  // yet.
+  void OnFirstPaintAfterLoad();
 
   // Forwards the given message to the renderer. These are called by the view
   // when it has received a message.
@@ -810,6 +812,18 @@
 
   scoped_ptr<TimeoutMonitor> new_content_rendering_timeout_;
 
+  // This boolean is true if RenderWidgetHostImpl receives a compositor frame
+  // from a newly loaded page before StartNewContentRenderingTimeout() is
+  // called. This means that a paint for the new load has completed before
+  // the browser received a DidCommitProvisionalLoad message. In that case
+  // |new_content_rendering_timeout_| is not needed. The renderer will send
+  // both the FirstPaintAfterLoad and DidCommitProvisionalLoad messages after
+  // any new page navigation, it doesn't matter which is received first, and
+  // it should not be possible to interleave other navigations in between
+  // receipt of those messages (unless FirstPaintAfterLoad is prevented from
+  // being sent, in which case the timer should fire).
+  bool received_paint_after_load_;
+
 #if defined(OS_WIN)
   std::list<HWND> dummy_windows_for_activation_;
 #endif
diff --git a/content/browser/renderer_host/render_widget_host_unittest.cc b/content/browser/renderer_host/render_widget_host_unittest.cc
index 0e2557c3..785288d 100644
--- a/content/browser/renderer_host/render_widget_host_unittest.cc
+++ b/content/browser/renderer_host/render_widget_host_unittest.cc
@@ -1106,7 +1106,18 @@
 
   // Test immediate start and stop, ensuring that the timeout doesn't fire.
   host_->StartNewContentRenderingTimeout();
-  host_->StopNewContentRenderingTimeout();
+  host_->OnFirstPaintAfterLoad();
+  base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+      FROM_HERE, base::MessageLoop::QuitClosure(),
+      TimeDelta::FromMicroseconds(20));
+  base::MessageLoop::current()->Run();
+
+  EXPECT_FALSE(host_->new_content_rendering_timeout_fired());
+
+  // Test that the timer doesn't fire if it receives a stop before
+  // a start.
+  host_->OnFirstPaintAfterLoad();
+  host_->StartNewContentRenderingTimeout();
   base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
       FROM_HERE, base::MessageLoop::QuitClosure(),
       TimeDelta::FromMicroseconds(20));
diff --git a/content/browser/service_worker/service_worker_context_core.h b/content/browser/service_worker/service_worker_context_core.h
index 2467ba6..42e25b75 100644
--- a/content/browser/service_worker/service_worker_context_core.h
+++ b/content/browser/service_worker/service_worker_context_core.h
@@ -178,11 +178,15 @@
                              const RegistrationCallback& callback);
   void UnregisterServiceWorker(const GURL& pattern,
                                const UnregistrationCallback& callback);
+
   // Callback is called issued after all unregistrations occur.  The Status
   // is populated as SERVICE_WORKER_OK if all succeed, or SERVICE_WORKER_FAILED
   // if any did not succeed.
   void UnregisterServiceWorkers(const GURL& origin,
                                 const UnregistrationCallback& callback);
+
+  // Updates the service worker. If |force_bypass_cache| is true or 24 hours
+  // have passed since the last update, bypasses the browser cache.
   void UpdateServiceWorker(ServiceWorkerRegistration* registration,
                            bool force_bypass_cache);
   void UpdateServiceWorker(ServiceWorkerRegistration* registration,
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
index 7d1c05e..e08b37e0 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -416,6 +416,11 @@
   if (!context_core_)
     return;
   DCHECK(registration);
+  // TODO(jungkees): |force_bypass_cache| is set to true because the call stack
+  // is initiated by an update button on DevTools that expects the cache is
+  // bypassed. However, in order to provide options for callers to choose the
+  // cache bypass mode, plumb |force_bypass_cache| through to
+  // UpdateRegistration().
   context_core_->UpdateServiceWorker(registration.get(),
                                      true /* force_bypass_cache */);
 }
diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc
index c192d96..a042183 100644
--- a/content/browser/service_worker/service_worker_dispatcher_host.cc
+++ b/content/browser/service_worker/service_worker_dispatcher_host.cc
@@ -437,10 +437,8 @@
     return;
   }
 
-  // The spec says, "update() pings the server for an updated version of this
-  // script without consulting caches", so set |force_bypass_cache| to true.
   GetContext()->UpdateServiceWorker(
-      registration, true /* force_bypass_cache */,
+      registration, false /* force_bypass_cache */,
       false /* skip_script_comparison */, provider_host,
       base::Bind(&ServiceWorkerDispatcherHost::UpdateComplete, this, thread_id,
                  provider_id, request_id));
diff --git a/content/child/child_discardable_shared_memory_manager.cc b/content/child/child_discardable_shared_memory_manager.cc
index cbe069a..1069fa7 100644
--- a/content/child/child_discardable_shared_memory_manager.cc
+++ b/content/child/child_discardable_shared_memory_manager.cc
@@ -149,6 +149,8 @@
       continue;
     }
 
+    free_span->set_is_locked(true);
+
     // Memory usage is guaranteed to have changed after having removed
     // at least one span from the free lists.
     MemoryUsageChanged(heap_.GetSize(), heap_.GetSizeOfFreeLists());
@@ -179,6 +181,7 @@
   scoped_ptr<DiscardableSharedMemoryHeap::Span> new_span(heap_.Grow(
       shared_memory.Pass(), allocation_size_in_bytes, new_id,
       base::Bind(&SendDeletedDiscardableSharedMemoryMessage, sender_, new_id)));
+  new_span->set_is_locked(true);
 
   // Unlock and insert any left over memory into free lists.
   if (pages < pages_to_allocate) {
@@ -188,6 +191,7 @@
         leftover->start() * base::GetPageSize() -
             reinterpret_cast<size_t>(leftover->shared_memory()->memory()),
         leftover->length() * base::GetPageSize());
+    leftover->set_is_locked(false);
     heap_.MergeIntoFreeLists(leftover.Pass());
   }
 
@@ -229,9 +233,11 @@
 
   switch (span->shared_memory()->Lock(offset, length)) {
     case base::DiscardableSharedMemory::SUCCESS:
+      span->set_is_locked(true);
       return true;
     case base::DiscardableSharedMemory::PURGED:
       span->shared_memory()->Unlock(offset, length);
+      span->set_is_locked(false);
       return false;
     case base::DiscardableSharedMemory::FAILED:
       return false;
@@ -250,6 +256,7 @@
       reinterpret_cast<size_t>(span->shared_memory()->memory());
   size_t length = span->length() * base::GetPageSize();
 
+  span->set_is_locked(false);
   return span->shared_memory()->Unlock(offset, length);
 }
 
diff --git a/content/child/push_messaging/push_provider.cc b/content/child/push_messaging/push_provider.cc
index ab33df4..ba82b0f9 100644
--- a/content/child/push_messaging/push_provider.cc
+++ b/content/child/push_messaging/push_provider.cc
@@ -148,14 +148,14 @@
 void PushProvider::OnSubscribeFromWorkerSuccess(
     int request_id,
     const GURL& endpoint,
-    const std::vector<uint8_t>& p256dh) {
+    const std::vector<uint8_t>& curve25519dh) {
   blink::WebPushSubscriptionCallbacks* callbacks =
       subscription_callbacks_.Lookup(request_id);
   if (!callbacks)
     return;
 
   callbacks->onSuccess(blink::adoptWebPtr(
-      new blink::WebPushSubscription(endpoint, p256dh)));
+      new blink::WebPushSubscription(endpoint, curve25519dh)));
 
   subscription_callbacks_.Remove(request_id);
 }
@@ -208,14 +208,14 @@
 void PushProvider::OnGetRegistrationSuccess(
     int request_id,
     const GURL& endpoint,
-    const std::vector<uint8_t>& p256dh) {
+    const std::vector<uint8_t>& curve25519dh) {
   blink::WebPushSubscriptionCallbacks* callbacks =
       subscription_callbacks_.Lookup(request_id);
   if (!callbacks)
     return;
 
   callbacks->onSuccess(blink::adoptWebPtr(
-      new blink::WebPushSubscription(endpoint, p256dh)));
+      new blink::WebPushSubscription(endpoint, curve25519dh)));
 
   subscription_callbacks_.Remove(request_id);
 }
diff --git a/content/child/push_messaging/push_provider.h b/content/child/push_messaging/push_provider.h
index c01796b..546dfe7 100644
--- a/content/child/push_messaging/push_provider.h
+++ b/content/child/push_messaging/push_provider.h
@@ -67,7 +67,7 @@
   // IPC message handlers.
   void OnSubscribeFromWorkerSuccess(int request_id,
                                     const GURL& endpoint,
-                                    const std::vector<uint8_t>& p256dh);
+                                    const std::vector<uint8_t>& curve25519dh);
   void OnSubscribeFromWorkerError(int request_id,
                                   PushRegistrationStatus status);
   void OnUnsubscribeSuccess(int request_id, bool did_unsubscribe);
@@ -76,7 +76,7 @@
                           const std::string& error_message);
   void OnGetRegistrationSuccess(int request_id,
                                 const GURL& endpoint,
-                                const std::vector<uint8_t>& p256dh);
+                                const std::vector<uint8_t>& curve25519dh);
   void OnGetRegistrationError(int request_id, PushGetRegistrationStatus status);
   void OnGetPermissionStatusSuccess(int request_id,
                                     blink::WebPushPermissionStatus status);
diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc
index e96efec..aeb1cbe 100644
--- a/content/child/resource_dispatcher.cc
+++ b/content/child/resource_dispatcher.cc
@@ -180,9 +180,6 @@
                                          base::SharedMemoryHandle shm_handle,
                                          int shm_size,
                                          base::ProcessId renderer_pid) {
-  // TODO(erikchen): Temporary debugging to help track down crash.
-  // http://crbug.com/527588.
-  CHECK_LE(shm_size, 512 * 1024);
   TRACE_EVENT0("loader", "ResourceDispatcher::OnSetDataBuffer");
   PendingRequestInfo* request_info = GetPendingRequestInfo(request_id);
   if (!request_info)
diff --git a/content/common/child_process_host_impl.cc b/content/common/child_process_host_impl.cc
index 071d96d..dcc52ac99 100644
--- a/content/common/child_process_host_impl.cc
+++ b/content/common/child_process_host_impl.cc
@@ -111,6 +111,13 @@
 #if defined(OS_WIN)
   AddFilter(new FontCacheDispatcher());
 #endif
+#if USE_ATTACHMENT_BROKER
+  // Construct the privileged attachment broker early in the life cycle of a
+  // child process. This ensures that when a test is being run in one of the
+  // single process modes, the global attachment broker is the privileged
+  // attachment broker, rather than an unprivileged attachment broker.
+  GetAttachmentBroker();
+#endif
 }
 
 ChildProcessHostImpl::~ChildProcessHostImpl() {
diff --git a/content/common/discardable_shared_memory_heap.cc b/content/common/discardable_shared_memory_heap.cc
index ccf2729..b641c06 100644
--- a/content/common/discardable_shared_memory_heap.cc
+++ b/content/common/discardable_shared_memory_heap.cc
@@ -28,8 +28,10 @@
     base::DiscardableSharedMemory* shared_memory,
     size_t start,
     size_t length)
-    : shared_memory_(shared_memory), start_(start), length_(length) {
-}
+    : shared_memory_(shared_memory),
+      start_(start),
+      length_(length),
+      is_locked_(false) {}
 
 DiscardableSharedMemoryHeap::Span::~Span() {
 }
@@ -278,6 +280,7 @@
   if (extra) {
     scoped_ptr<Span> leftover(
         new Span(serving->shared_memory_, serving->start_ + blocks, extra));
+    leftover->set_is_locked(false);
     DCHECK_IMPLIES(extra > 1, spans_.find(leftover->start_) == spans_.end());
     RegisterSpan(leftover.get());
 
@@ -366,18 +369,23 @@
     int32_t segment_id,
     base::trace_event::ProcessMemoryDump* pmd) {
   size_t allocated_objects_count = 0;
-  size_t allocated_objects_size_in_bytes = 0;
+  size_t allocated_objects_blocks = 0;
+  size_t locked_objects_blocks = 0;
   size_t offset =
       reinterpret_cast<size_t>(shared_memory->memory()) / block_size_;
   size_t end = offset + size / block_size_;
   while (offset < end) {
     Span* span = spans_[offset];
     if (!IsInFreeList(span)) {
+      allocated_objects_blocks += span->length_;
+      locked_objects_blocks += span->is_locked_ ? span->length_ : 0;
       allocated_objects_count++;
-      allocated_objects_size_in_bytes += span->length_ * block_size_;
     }
     offset += span->length_;
   }
+  size_t allocated_objects_size_in_bytes =
+      allocated_objects_blocks * block_size_;
+  size_t locked_objects_size_in_bytes = locked_objects_blocks * block_size_;
 
   std::string segment_dump_name =
       base::StringPrintf("discardable/segment_%d", segment_id);
@@ -385,16 +393,19 @@
       pmd->CreateAllocatorDump(segment_dump_name);
   segment_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
                           base::trace_event::MemoryAllocatorDump::kUnitsBytes,
-                          static_cast<uint64_t>(size));
+                          size);
 
   base::trace_event::MemoryAllocatorDump* obj_dump =
       pmd->CreateAllocatorDump(segment_dump_name + "/allocated_objects");
   obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameObjectCount,
                       base::trace_event::MemoryAllocatorDump::kUnitsObjects,
-                      static_cast<uint64_t>(allocated_objects_count));
+                      allocated_objects_count);
   obj_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
                       base::trace_event::MemoryAllocatorDump::kUnitsBytes,
-                      static_cast<uint64_t>(allocated_objects_size_in_bytes));
+                      allocated_objects_size_in_bytes);
+  obj_dump->AddScalar("locked_size",
+                      base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+                      locked_objects_size_in_bytes);
 
   // Emit an ownership edge towards a global allocator dump node. This allows
   // to avoid double-counting segments when both browser and child process emit
diff --git a/content/common/discardable_shared_memory_heap.h b/content/common/discardable_shared_memory_heap.h
index 100b03f..ce8787a 100644
--- a/content/common/discardable_shared_memory_heap.h
+++ b/content/common/discardable_shared_memory_heap.h
@@ -30,6 +30,7 @@
     base::DiscardableSharedMemory* shared_memory() { return shared_memory_; }
     size_t start() const { return start_; }
     size_t length() const { return length_; }
+    void set_is_locked(bool is_locked) { is_locked_ = is_locked; }
 
    private:
     friend class DiscardableSharedMemoryHeap;
@@ -41,6 +42,7 @@
     base::DiscardableSharedMemory* shared_memory_;
     size_t start_;
     size_t length_;
+    bool is_locked_;
 
     DISALLOW_COPY_AND_ASSIGN(Span);
   };
diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc
index c31e167d..eb8e8ff5 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -241,7 +241,7 @@
 #endif
 
   use_virtualized_gl_context_ |=
-      context_group_->feature_info()->UseVirtualizedGLContexts();
+      context_group_->feature_info()->workarounds().use_virtualized_gl_contexts;
 
   if (offscreen && initial_size_.IsEmpty()) {
     // If we're an offscreen surface with zero width and/or height, set to a
diff --git a/content/common/gpu/stream_texture_android.cc b/content/common/gpu/stream_texture_android.cc
index 4949916..20f1da7 100644
--- a/content/common/gpu/stream_texture_android.cc
+++ b/content/common/gpu/stream_texture_android.cc
@@ -105,7 +105,8 @@
     DCHECK(!needs_make_current || !owner_stub_->decoder()
                                        ->GetContextGroup()
                                        ->feature_info()
-                                       ->UseVirtualizedGLContexts());
+                                       ->workarounds()
+                                       .use_virtualized_gl_contexts);
     if (needs_make_current) {
       scoped_make_current.reset(new ui::ScopedMakeCurrent(
           owner_stub_->decoder()->GetGLContext(), owner_stub_->surface()));
diff --git a/content/common/host_discardable_shared_memory_manager.cc b/content/common/host_discardable_shared_memory_manager.cc
index 97351e5..8af1d4d 100644
--- a/content/common/host_discardable_shared_memory_manager.cc
+++ b/content/common/host_discardable_shared_memory_manager.cc
@@ -180,10 +180,17 @@
           "discardable/process_%x/segment_%d", child_process_id, segment_id);
       base::trace_event::MemoryAllocatorDump* dump =
           pmd->CreateAllocatorDump(dump_name);
+
       dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
                       base::trace_event::MemoryAllocatorDump::kUnitsBytes,
                       segment->memory()->mapped_size());
 
+      // Host can only tell if whole segment is locked or not.
+      dump->AddScalar(
+          "locked_size", base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+          segment->memory()->IsMemoryLocked() ? segment->memory()->mapped_size()
+                                              : 0u);
+
       // Create the cross-process ownership edge. If the child creates a
       // corresponding dump for the same segment, this will avoid to
       // double-count them in tracing. If, instead, no other process will emit a
diff --git a/content/common/push_messaging_messages.h b/content/common/push_messaging_messages.h
index 4e591861..0578c24 100644
--- a/content/common/push_messaging_messages.h
+++ b/content/common/push_messaging_messages.h
@@ -34,12 +34,12 @@
 IPC_MESSAGE_ROUTED3(PushMessagingMsg_SubscribeFromDocumentSuccess,
                     int32_t /* request_id */,
                     GURL /* push_endpoint */,
-                    std::vector<uint8_t> /* p256dh */)
+                    std::vector<uint8_t> /* curve25519dh */)
 
 IPC_MESSAGE_CONTROL3(PushMessagingMsg_SubscribeFromWorkerSuccess,
                      int32_t /* request_id */,
                      GURL /* push_endpoint */,
-                     std::vector<uint8_t> /* p256dh */)
+                     std::vector<uint8_t> /* curve25519dh */)
 
 IPC_MESSAGE_ROUTED2(PushMessagingMsg_SubscribeFromDocumentError,
                     int32_t /* request_id */,
@@ -61,7 +61,7 @@
 IPC_MESSAGE_CONTROL3(PushMessagingMsg_GetRegistrationSuccess,
                      int32_t /* request_id */,
                      GURL /* push_endpoint */,
-                     std::vector<uint8_t> /* p256dh */)
+                     std::vector<uint8_t> /* curve25519dh */)
 
 IPC_MESSAGE_CONTROL2(PushMessagingMsg_GetRegistrationError,
                      int32_t /* request_id */,
diff --git a/content/common/sandbox_mac_system_access_unittest.mm b/content/common/sandbox_mac_system_access_unittest.mm
index 8a6c1d3..00e21b06 100644
--- a/content/common/sandbox_mac_system_access_unittest.mm
+++ b/content/common/sandbox_mac_system_access_unittest.mm
@@ -3,6 +3,7 @@
 // found in the LICENSE file.
 
 #import <Cocoa/Cocoa.h>
+#include <openssl/rand.h>
 
 #include "base/files/file_util.h"
 #include "base/files/scoped_file.h"
@@ -10,14 +11,8 @@
 #include "base/strings/sys_string_conversions.h"
 #include "content/common/sandbox_mac.h"
 #include "content/common/sandbox_mac_unittest_helper.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-#if defined(USE_OPENSSL)
-#include <openssl/rand.h>
 #include "crypto/openssl_util.h"
-#else
-#include "crypto/nss_util.h"
-#endif
+#include "testing/gtest/include/gtest/gtest.h"
 
 namespace content {
 
@@ -127,8 +122,6 @@
   EXPECT_TRUE(RunTestInAllSandboxTypes("MacSandboxedUrandomTestCase", NULL));
 }
 
-#if defined(USE_OPENSSL)
-
 //--------------------- OpenSSL Sandboxing ----------------------
 // Test case for checking sandboxing of OpenSSL initialization.
 class MacSandboxedOpenSSLTestCase : public MacSandboxTestCase {
@@ -150,29 +143,4 @@
   EXPECT_TRUE(RunTestInAllSandboxTypes("MacSandboxedOpenSSLTestCase", NULL));
 }
 
-#else  // !defined(USE_OPENSSL)
-
-//--------------------- NSS Sandboxing ----------------------
-// Test case for checking sandboxing of NSS initialization.
-class MacSandboxedNSSTestCase : public MacSandboxTestCase {
- public:
-  bool SandboxedTest() override;
-};
-
-REGISTER_SANDBOX_TEST_CASE(MacSandboxedNSSTestCase);
-
-bool MacSandboxedNSSTestCase::SandboxedTest() {
-  // If NSS cannot read from /dev/urandom, NSS initialization will call abort(),
-  // which will cause this test case to fail.
-  crypto::ForceNSSNoDBInit();
-  crypto::EnsureNSSInit();
-  return true;
-}
-
-TEST_F(MacSandboxTest, NSSAccess) {
-  EXPECT_TRUE(RunTestInAllSandboxTypes("MacSandboxedNSSTestCase", NULL));
-}
-
-#endif  // defined(USE_OPENSSL)
-
 }  // namespace content
diff --git a/content/common/view_messages.h b/content/common/view_messages.h
index 93c8a21..28a2353 100644
--- a/content/common/view_messages.h
+++ b/content/common/view_messages.h
@@ -1323,6 +1323,12 @@
 // after the frame widget has painted something.
 IPC_MESSAGE_ROUTED0(ViewHostMsg_DidFirstVisuallyNonEmptyPaint)
 
+// Send after a paint happens after any page commit, including a blank one.
+// TODO(kenrb): This, and all ViewHostMsg_* messages that actually pertain to
+// RenderWidget(Host), should be renamed to WidgetHostMsg_*.
+// See https://crbug.com/537793.
+IPC_MESSAGE_ROUTED0(ViewHostMsg_DidFirstPaintAfterLoad)
+
 #if defined(OS_ANDROID)
 // Response to ViewMsg_FindMatchRects.
 //
diff --git a/content/content_browser.gypi b/content/content_browser.gypi
index 0f43540..ceaf350 100644
--- a/content/content_browser.gypi
+++ b/content/content_browser.gypi
@@ -346,6 +346,8 @@
       'browser/android/animation_utils.h',
       'browser/android/background_sync_launcher_android.cc',
       'browser/android/background_sync_launcher_android.h',
+      'browser/android/background_sync_network_observer_android.cc',
+      'browser/android/background_sync_network_observer_android.h',
       'browser/android/browser_jni_registrar.cc',
       'browser/android/browser_jni_registrar.h',
       'browser/android/browser_startup_controller.cc',
@@ -1991,11 +1993,6 @@
         '<@(auralinux_browser_sources)',
       ],
     }],
-    ['OS=="linux" and use_openssl==0', {
-      'dependencies': [
-        '../sandbox/sandbox.gyp:libc_urandom_override',
-      ],
-    }],
     ['use_udev == 1', {
       'dependencies': [
         '../device/udev_linux/udev.gyp:udev_linux',
@@ -2171,7 +2168,7 @@
         'browser/media/media_web_contents_observer.h',
       ],
     }],
-    ['OS == "linux" and use_openssl==1', {
+    ['OS == "linux"', {
       'dependencies': [
         '../third_party/boringssl/boringssl.gyp:boringssl',
       ],
diff --git a/content/content_jni.gypi b/content/content_jni.gypi
index c93e4efd..3a154d4 100644
--- a/content/content_jni.gypi
+++ b/content/content_jni.gypi
@@ -12,6 +12,7 @@
     'public/android/java/src/org/chromium/content/app/ContentMain.java',
     'public/android/java/src/org/chromium/content/browser/accessibility/BrowserAccessibilityManager.java',
     'public/android/java/src/org/chromium/content/browser/BackgroundSyncLauncher.java',
+    'public/android/java/src/org/chromium/content/browser/BackgroundSyncNetworkObserver.java',
     'public/android/java/src/org/chromium/content/browser/BrowserStartupController.java',
     'public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java',
     'public/android/java/src/org/chromium/content/browser/ContentReadbackHandler.java',
diff --git a/content/content_renderer.gypi b/content/content_renderer.gypi
index 2f0be33..f9cbf85d2 100644
--- a/content/content_renderer.gypi
+++ b/content/content_renderer.gypi
@@ -335,10 +335,10 @@
       'renderer/notification_permission_dispatcher.h',
       'renderer/peripheral_content_heuristic.cc',
       'renderer/peripheral_content_heuristic.h',
+      'renderer/presentation/presentation_connection_client.cc',
+      'renderer/presentation/presentation_connection_client.h',
       'renderer/presentation/presentation_dispatcher.cc',
       'renderer/presentation/presentation_dispatcher.h',
-      'renderer/presentation/presentation_session_client.cc',
-      'renderer/presentation/presentation_session_client.h',
       'renderer/push_messaging/push_messaging_dispatcher.cc',
       'renderer/push_messaging/push_messaging_dispatcher.h',
       'renderer/raster_worker_pool.cc',
diff --git a/content/content_tests.gypi b/content/content_tests.gypi
index 7876515..e374b9ec 100644
--- a/content/content_tests.gypi
+++ b/content/content_tests.gypi
@@ -1220,7 +1220,7 @@
             '../ui/ozone/ozone.gyp:ozone_base',
           ],
         }],
-        ['OS == "mac" and use_openssl==1', {
+        ['OS == "mac"', {
           'dependencies': [
             '../third_party/boringssl/boringssl.gyp:boringssl',
           ],
diff --git a/content/ppapi_plugin/ppapi_plugin_main.cc b/content/ppapi_plugin/ppapi_plugin_main.cc
index feaaf4b1..497e195d 100644
--- a/content/ppapi_plugin/ppapi_plugin_main.cc
+++ b/content/ppapi_plugin/ppapi_plugin_main.cc
@@ -19,7 +19,6 @@
 #include "content/public/common/content_switches.h"
 #include "content/public/common/main_function_params.h"
 #include "content/public/plugin/content_plugin_client.h"
-#include "crypto/nss_util.h"
 #include "ppapi/proxy/plugin_globals.h"
 #include "ppapi/proxy/proxy_module.h"
 #include "ui/base/ui_base_switches.h"
@@ -121,12 +120,6 @@
   base::trace_event::TraceLog::GetInstance()->SetProcessSortIndex(
       kTraceEventPpapiProcessSortIndex);
 
-#if defined(OS_LINUX) && !defined(USE_OPENSSL)
-  // Some out-of-process PPAPI plugins use NSS.
-  // NSS must be initialized before enabling the sandbox below.
-  crypto::InitNSSSafely();
-#endif
-
   // Allow the embedder to perform any necessary per-process initialization
   // before the sandbox is initialized.
   if (GetContentClient()->plugin())
diff --git a/content/public/android/java/src/org/chromium/content/app/ContentApplication.java b/content/public/android/java/src/org/chromium/content/app/ContentApplication.java
index 892f72f7..fea54ae 100644
--- a/content/public/android/java/src/org/chromium/content/app/ContentApplication.java
+++ b/content/public/android/java/src/org/chromium/content/app/ContentApplication.java
@@ -20,6 +20,14 @@
     private TracingControllerAndroid mTracingController;
     private boolean mLibraryDependenciesInitialized;
 
+    public ContentApplication() {
+        this(true /* mShouldInitializeApplicationStatusTracking */);
+    }
+
+    protected ContentApplication(boolean shouldInitializeApplicationStatusTracking) {
+        super(shouldInitializeApplicationStatusTracking);
+    }
+
     TracingControllerAndroid getTracingController() {
         if (mTracingController == null) {
             mTracingController = new TracingControllerAndroid(this);
diff --git a/content/public/android/java/src/org/chromium/content/browser/BackgroundSyncNetworkObserver.java b/content/public/android/java/src/org/chromium/content/browser/BackgroundSyncNetworkObserver.java
new file mode 100644
index 0000000..25c2846
--- /dev/null
+++ b/content/public/android/java/src/org/chromium/content/browser/BackgroundSyncNetworkObserver.java
@@ -0,0 +1,109 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.browser;
+
+import android.Manifest;
+import android.content.Context;
+import android.content.pm.PackageManager;
+import android.os.Process;
+
+import org.chromium.base.ThreadUtils;
+import org.chromium.base.annotations.CalledByNative;
+import org.chromium.base.annotations.JNINamespace;
+import org.chromium.base.annotations.NativeClassQualifiedName;
+import org.chromium.net.NetworkChangeNotifierAutoDetect;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Contains the Java code used by the BackgroundSyncNetworkObserverAndroid C++ class.
+ *
+ * The purpose of this class is to listen for and forward network connectivity events to the
+ * BackgroundSyncNetworkObserverAndroid objects even when the application is paused. The standard
+ * NetworkChangeNotifier does not listen for connectivity events when the application is paused.
+ *
+ * This class maintains a NetworkChangeNotifierAutoDetect, which exists for as long as any
+ * BackgroundSyncNetworkObserverAndroid objects are registered.
+ *
+ * This class lives on the main thread.
+ */
+@JNINamespace("content")
+class BackgroundSyncNetworkObserver implements NetworkChangeNotifierAutoDetect.Observer {
+    private static final String TAG = "cr_BgSyncNetObserver";
+
+    private NetworkChangeNotifierAutoDetect mNotifier;
+    private Context mContext;
+
+    // The singleton instance.
+    private static BackgroundSyncNetworkObserver sInstance = null;
+
+    // List of native observers. These are each called when the network state changes.
+    private List<Long> mNativePtrs;
+
+    private BackgroundSyncNetworkObserver(Context ctx) {
+        ThreadUtils.assertOnUiThread();
+        mContext = ctx;
+        mNativePtrs = new ArrayList<Long>();
+    }
+
+    private static boolean canCreateObserver(Context ctx) {
+        return ctx.checkPermission(
+                       Manifest.permission.ACCESS_NETWORK_STATE, Process.myPid(), Process.myUid())
+                == PackageManager.PERMISSION_GRANTED;
+    }
+
+    @CalledByNative
+    private static BackgroundSyncNetworkObserver createObserver(Context ctx, long nativePtr) {
+        ThreadUtils.assertOnUiThread();
+        if (sInstance == null) {
+            sInstance = new BackgroundSyncNetworkObserver(ctx);
+        }
+        sInstance.registerObserver(nativePtr);
+        return sInstance;
+    }
+
+    private void registerObserver(final long nativePtr) {
+        ThreadUtils.assertOnUiThread();
+        if (!canCreateObserver(mContext)) {
+            return;
+        }
+
+        // Create the NetworkChangeNotifierAutoDetect if it does not exist already.
+        if (mNotifier == null) {
+            mNotifier =
+                    new NetworkChangeNotifierAutoDetect(this, mContext, true /* always listen */);
+        }
+        mNativePtrs.add(nativePtr);
+
+        nativeNotifyConnectionTypeChanged(
+                nativePtr, mNotifier.getCurrentConnectionType(mNotifier.getCurrentNetworkState()));
+    }
+
+    @CalledByNative
+    private void removeObserver(long nativePtr) {
+        ThreadUtils.assertOnUiThread();
+        mNativePtrs.remove(nativePtr);
+        // Destroy the NetworkChangeNotifierAutoDetect if there are no more observers.
+        if (mNativePtrs.size() == 0 && mNotifier != null) {
+            mNotifier.destroy();
+            mNotifier = null;
+        }
+    }
+
+    @Override
+    public void onConnectionTypeChanged(int newConnectionType) {
+        ThreadUtils.assertOnUiThread();
+        for (Long nativePtr : mNativePtrs) {
+            nativeNotifyConnectionTypeChanged(nativePtr, newConnectionType);
+        }
+    }
+
+    @Override
+    public void onMaxBandwidthChanged(double maxBandwidthMbps) {}
+
+    @NativeClassQualifiedName("BackgroundSyncNetworkObserverAndroid::Observer")
+    private native void nativeNotifyConnectionTypeChanged(long nativePtr, int newConnectionType);
+}
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
index 8901f845..8a81f8f 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewClient.java
@@ -57,13 +57,6 @@
 
         if (!shouldPropagateKey(keyCode)) return true;
 
-        // We also have to intercept some shortcuts before we send them to the ContentView.
-        if (event.isCtrlPressed() && (keyCode == KeyEvent.KEYCODE_TAB
-                || keyCode == KeyEvent.KEYCODE_W
-                || keyCode == KeyEvent.KEYCODE_F4)) {
-            return true;
-        }
-
         return false;
     }
 
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewDownloadDelegate.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewDownloadDelegate.java
index 266f7c9..4caff13 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewDownloadDelegate.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewDownloadDelegate.java
@@ -29,4 +29,12 @@
      * @param downloadId The download id.
      */
     void onDangerousDownload(String filename, int downloadId);
+
+    /**
+     * Called when file access has been requested to complete a download.
+     * @param callbackId The callback ID used to trigger success or failure of the download.
+     *
+     * @see DownloadController#onRequestFileAccessResult(long, boolean)
+     */
+    void requestFileAccess(long callbackId);
 }
diff --git a/content/public/android/java/src/org/chromium/content/browser/DownloadController.java b/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
index 3adb4a1..c942d05 100644
--- a/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
+++ b/content/public/android/java/src/org/chromium/content/browser/DownloadController.java
@@ -65,7 +65,7 @@
      * The download delegate is expected to handle the download.
      */
     @CalledByNative
-    public void newHttpGetDownload(ContentViewCore view, String url,
+    private void newHttpGetDownload(ContentViewCore view, String url,
             String userAgent, String contentDisposition, String mimeType,
             String cookie, String referer, boolean hasUserGesture,
             String filename, long contentLength) {
@@ -96,7 +96,7 @@
      * @param mimeType Mime of the downloaded item.
      */
     @CalledByNative
-    public void onDownloadStarted(ContentViewCore view, String filename, String mimeType) {
+    private void onDownloadStarted(ContentViewCore view, String filename, String mimeType) {
         ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView(view);
 
         if (downloadDelegate != null) {
@@ -109,7 +109,7 @@
      * download. This can be either a POST download or a GET download with authentication.
      */
     @CalledByNative
-    public void onDownloadCompleted(Context context, String url, String mimeType,
+    private void onDownloadCompleted(Context context, String url, String mimeType,
             String filename, String path, long contentLength, boolean successful, int downloadId,
             boolean hasUserGesture) {
         if (sDownloadNotificationService != null) {
@@ -134,7 +134,7 @@
      * network stack use custom notification to display the progress of downloads.
      */
     @CalledByNative
-    public void onDownloadUpdated(Context context, String url, String mimeType,
+    private void onDownloadUpdated(Context context, String url, String mimeType,
             String filename, String path, long contentLength, boolean successful, int downloadId,
             int percentCompleted, long timeRemainingInMs, boolean hasUserGesture) {
         if (sDownloadNotificationService != null) {
@@ -160,7 +160,7 @@
      * Notifies the download delegate that a dangerous download started.
      */
     @CalledByNative
-    public void onDangerousDownload(ContentViewCore view, String filename,
+    private void onDangerousDownload(ContentViewCore view, String filename,
             int downloadId) {
         ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView(view);
         if (downloadDelegate != null) {
@@ -186,16 +186,31 @@
      * @param callbackId The native callback function pointer.
      */
     @CalledByNative
-    private void requestFileAccess(ContentViewCore view, final long callbackId) {
-        PermissionCallback permissionCallback = new PermissionCallback() {
-            @Override
-            public void onRequestPermissionsResult(String[] permissions, int[] grantResults) {
-                nativeOnRequestFileAccessResult(
-                        callbackId, grantResults[0] == PackageManager.PERMISSION_GRANTED);
-            }
-        };
-        view.getWindowAndroid().requestPermissions(
-                new String[] {permission.WRITE_EXTERNAL_STORAGE}, permissionCallback);
+    private void requestFileAccess(final ContentViewCore view, final long callbackId) {
+        ContentViewDownloadDelegate downloadDelegate = downloadDelegateFromView(view);
+        if (downloadDelegate != null) {
+            downloadDelegate.requestFileAccess(callbackId);
+        } else {
+            PermissionCallback permissionCallback = new PermissionCallback() {
+                @Override
+                public void onRequestPermissionsResult(String[] permissions, int[] grantResults) {
+                    onRequestFileAccessResult(
+                            callbackId, grantResults[0] == PackageManager.PERMISSION_GRANTED);
+                }
+            };
+            view.getWindowAndroid().requestPermissions(
+                    new String[] {android.Manifest.permission.WRITE_EXTERNAL_STORAGE},
+                    permissionCallback);
+        }
+    }
+
+    /**
+     * Notify the results of a file access request.
+     * @param callbackId The ID of the callback.
+     * @param granted Whether access was granted.
+     */
+    public void onRequestFileAccessResult(long callbackId, boolean granted) {
+        nativeOnRequestFileAccessResult(callbackId, granted);
     }
 
     // native methods
diff --git a/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java b/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java
index b83c353..eabf0e9 100644
--- a/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java
+++ b/content/public/android/javatests/src/org/chromium/content/browser/webcontents/WebContentsTest.java
@@ -9,6 +9,7 @@
 import android.os.Parcel;
 import android.test.suitebuilder.annotation.SmallTest;
 
+import org.chromium.base.test.util.DisabledTest;
 import org.chromium.content_public.browser.WebContents;
 import org.chromium.content_shell.Shell;
 import org.chromium.content_shell_apk.ContentShellActivity;
@@ -33,7 +34,11 @@
      * @throws InterruptedException
      * @throws ExecutionException
      */
+    /*
     @SmallTest
+    https://crbug.com/538625
+    */
+    @DisabledTest
     public void testWebContentsIsDestroyedMethod() throws InterruptedException, ExecutionException {
         final ContentShellActivity activity = launchContentShellWithUrl(TEST_URL_1);
         waitForActiveShellToBeDoneLoading();
@@ -194,7 +199,11 @@
      * @throws InterruptedException
      * @throws ExecutionException
      */
+    /*
     @SmallTest
+    https://crbug.com/538625
+    */
+    @DisabledTest
     public void testSerializingADestroyedWebContentsDoesNotDeserialize()
             throws InterruptedException, ExecutionException {
         ContentShellActivity activity = launchContentShellWithUrl(TEST_URL_1);
@@ -229,7 +238,11 @@
      * @throws InterruptedException
      * @throws ExecutionException
      */
+    /*
     @SmallTest
+    https://crbug.com/538625
+    */
+    @DisabledTest
     public void testDestroyingAWebContentsAfterSerializingDoesNotDeserialize()
             throws InterruptedException, ExecutionException {
         ContentShellActivity activity = launchContentShellWithUrl(TEST_URL_1);
@@ -298,4 +311,4 @@
             parcel.recycle();
         }
     }
-}
\ No newline at end of file
+}
diff --git a/content/public/browser/content_browser_client.h b/content/public/browser/content_browser_client.h
index d01fe152..5104d99 100644
--- a/content/public/browser/content_browser_client.h
+++ b/content/public/browser/content_browser_client.h
@@ -624,6 +624,12 @@
       ServiceRegistry* registry,
       RenderFrameHost* render_frame_host) {}
 
+  // Allows to register browser Mojo services exposed through the
+  // RenderFrameHost.
+  virtual void RegisterRenderFrameMojoServices(
+      ServiceRegistry* registry,
+      RenderFrameHost* render_frame_host) {}
+
   using StaticMojoApplicationMap =
       std::map<GURL, base::Callback<scoped_ptr<mojo::ApplicationDelegate>()>>;
 
diff --git a/content/public/browser/permission_manager.h b/content/public/browser/permission_manager.h
index 5a2e0787..0108b66d 100644
--- a/content/public/browser/permission_manager.h
+++ b/content/public/browser/permission_manager.h
@@ -19,27 +19,31 @@
 // management for the content layer.
 class CONTENT_EXPORT PermissionManager {
  public:
+  // Constant retured when registering and subscribing if
+  // cancelling/unsubscribing at a later stage would have no effect.
+  static const int kNoPendingOperation = -1;
+
   virtual ~PermissionManager() = default;
 
-  // Requests a permission on behalf of a frame identified by render_frame_host.
-  // The |request_id| is an identifier that can later be used if the request is
-  // cancelled (see CancelPermissionRequest).
+  // Requests a permission on behalf of a frame identified by
+  // render_frame_host.
   // When the permission request is handled, whether it failed, timed out or
   // succeeded, the |callback| will be run.
-  virtual void RequestPermission(
+  // Returns a request id which can be used to cancel the permission (see
+  // CancelPermissionRequest). This can be kNoPendingOperation if
+  // there is no further need to cancel the permission in which case |callback|
+  // was invoked.
+  virtual int RequestPermission(
       PermissionType permission,
       RenderFrameHost* render_frame_host,
-      int request_id,
       const GURL& requesting_origin,
       bool user_gesture,
       const base::Callback<void(PermissionStatus)>& callback) = 0;
 
-  // Cancels a previously requested permission. The given parameter must match
-  // the ones passed to the RequestPermission call.
-  virtual void CancelPermissionRequest(PermissionType permission,
-                                       RenderFrameHost* render_frame_host,
-                                       int request_id,
-                                       const GURL& requesting_origin) = 0;
+  // Cancels a previous permission request specified by |request_id|. Cancelling
+  // an already cancelled request or providing the |request_id|
+  // kNoPendingOperation is a no-op.
+  virtual void CancelPermissionRequest(int request_id) = 0;
 
   // Returns the permission status of a given requesting_origin/embedding_origin
   // tuple. This is not taking a RenderFrameHost because the call might happen
@@ -63,7 +67,8 @@
 
   // Runs the given |callback| whenever the |permission| associated with the
   // pair { requesting_origin, embedding_origin } changes.
-  // Returns the subscription_id to be used to unsubscribe.
+  // Returns the subscription_id to be used to unsubscribe. Can be
+  // kNoPendingOperation if the subscribe was not successful.
   virtual int SubscribePermissionStatusChange(
       PermissionType permission,
       const GURL& requesting_origin,
@@ -72,7 +77,9 @@
 
   // Unregisters from permission status change notifications.
   // The |subscription_id| must match the value returned by the
-  // SubscribePermissionStatusChange call.
+  // SubscribePermissionStatusChange call. Unsubscribing
+  // an already unsubscribed |subscription_id| or providing the
+  // |subscription_id| kNoPendingOperation is a no-op.
   virtual void UnsubscribePermissionStatusChange(int subscription_id) = 0;
 };
 
diff --git a/content/public/browser/presentation_screen_availability_listener.h b/content/public/browser/presentation_screen_availability_listener.h
index 4580ddf..473981c2 100644
--- a/content/public/browser/presentation_screen_availability_listener.h
+++ b/content/public/browser/presentation_screen_availability_listener.h
@@ -26,6 +26,11 @@
   // Called when screen availability for the associated Presentation URL has
   // changed to |available|.
   virtual void OnScreenAvailabilityChanged(bool available) = 0;
+
+  // Callend when screen availability monitoring is not supported by the
+  // by the implementation because of system limitations like running low on
+  // battery or having resource constraints.
+  virtual void OnScreenAvailabilityNotSupported() = 0;
 };
 
 }  // namespace content
diff --git a/content/public/browser/push_messaging_service.h b/content/public/browser/push_messaging_service.h
index e7d7f7f..4e533d1 100644
--- a/content/public/browser/push_messaging_service.h
+++ b/content/public/browser/push_messaging_service.h
@@ -26,13 +26,13 @@
  public:
   using RegisterCallback =
       base::Callback<void(const std::string& registration_id,
-                          const std::vector<uint8_t>& p256dh,
+                          const std::vector<uint8_t>& curve25519dh,
                           PushRegistrationStatus status)>;
   using UnregisterCallback = base::Callback<void(PushUnregistrationStatus)>;
 
   using PublicKeyCallback = base::Callback<void(
       bool success,
-      const std::vector<uint8_t>& p256dh)>;
+      const std::vector<uint8_t>& curve25519dh)>;
 
   using StringCallback = base::Callback<void(const std::string& data,
                                              bool success,
diff --git a/content/renderer/accessibility/blink_ax_enum_conversion.cc b/content/renderer/accessibility/blink_ax_enum_conversion.cc
index ba6709a3..11aa9d5 100644
--- a/content/renderer/accessibility/blink_ax_enum_conversion.cc
+++ b/content/renderer/accessibility/blink_ax_enum_conversion.cc
@@ -352,6 +352,8 @@
       return ui::AX_EVENT_ARIA_ATTRIBUTE_CHANGED;
     case blink::WebAXEventAutocorrectionOccured:
       return ui::AX_EVENT_AUTOCORRECTION_OCCURED;
+    case blink::WebAXEventBlur:
+      return ui::AX_EVENT_BLUR;
     case blink::WebAXEventCheckedStateChanged:
       return ui::AX_EVENT_CHECKED_STATE_CHANGED;
     case blink::WebAXEventChildrenChanged:
diff --git a/content/renderer/accessibility/blink_ax_tree_source.h b/content/renderer/accessibility/blink_ax_tree_source.h
index d7265f2..2f002de 100644
--- a/content/renderer/accessibility/blink_ax_tree_source.h
+++ b/content/renderer/accessibility/blink_ax_tree_source.h
@@ -32,7 +32,7 @@
   // accessibility focus will force loading inline text box children,
   // which aren't always loaded by default on all platforms.
   int accessibility_focus_id() { return accessibility_focus_id_; }
-  void set_accessiblity_focus_id(int id) { accessibility_focus_id_ = id; }
+  void set_accessibility_focus_id(int id) { accessibility_focus_id_ = id; }
 
   // AXTreeSource implementation.
   blink::WebAXObject GetRoot() const override;
diff --git a/content/renderer/accessibility/renderer_accessibility.cc b/content/renderer/accessibility/renderer_accessibility.cc
index 812af62..7452337 100644
--- a/content/renderer/accessibility/renderer_accessibility.cc
+++ b/content/renderer/accessibility/renderer_accessibility.cc
@@ -382,7 +382,7 @@
   if (tree_source_.accessibility_focus_id() == acc_obj_id)
     return;
 
-  tree_source_.set_accessiblity_focus_id(acc_obj_id);
+  tree_source_.set_accessibility_focus_id(acc_obj_id);
 
   const WebDocument& document = GetMainDocument();
   if (document.isNull())
diff --git a/content/renderer/media/rtc_video_decoder.cc b/content/renderer/media/rtc_video_decoder.cc
index f2d4872..504b512 100644
--- a/content/renderer/media/rtc_video_decoder.cc
+++ b/content/renderer/media/rtc_video_decoder.cc
@@ -58,10 +58,12 @@
 
 RTCVideoDecoder::BufferData::BufferData(int32 bitstream_buffer_id,
                                         uint32_t timestamp,
-                                        size_t size)
+                                        size_t size,
+                                        const gfx::Rect& visible_rect)
     : bitstream_buffer_id(bitstream_buffer_id),
       timestamp(timestamp),
-      size(size) {}
+      size(size),
+      visible_rect(visible_rect) {}
 
 RTCVideoDecoder::BufferData::BufferData() {}
 
@@ -221,7 +223,8 @@
   // Create buffer metadata.
   BufferData buffer_data(next_bitstream_buffer_id_,
                          inputImage._timeStamp,
-                         inputImage._length);
+                         inputImage._length,
+                         gfx::Rect(frame_size_));
   // Mask against 30 bits, to avoid (undefined) wraparound on signed integer.
   next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & ID_LAST;
 
@@ -363,23 +366,23 @@
     NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
     return;
   }
-  const media::PictureBuffer& pb = it->second;
 
-  // Validate picture rectangle from GPU.
-  if (picture.visible_rect().IsEmpty() ||
-      !gfx::Rect(pb.size()).Contains(picture.visible_rect())) {
-    NOTREACHED() << "Invalid picture size from VDA: "
-                 << picture.visible_rect().ToString() << " should fit in "
-                 << pb.size().ToString();
+  uint32_t timestamp = 0;
+  gfx::Rect visible_rect;
+  GetBufferData(picture.bitstream_buffer_id(), &timestamp, &visible_rect);
+  if (!picture.visible_rect().IsEmpty())
+    visible_rect = picture.visible_rect();
+
+  const media::PictureBuffer& pb = it->second;
+  if (visible_rect.IsEmpty() || !gfx::Rect(pb.size()).Contains(visible_rect)) {
+    LOG(ERROR) << "Invalid picture size: " << visible_rect.ToString()
+               << " should fit in " << pb.size().ToString();
     NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
     return;
   }
 
-  // Create a media::VideoFrame.
-  uint32_t timestamp = 0;
-  GetBufferData(picture.bitstream_buffer_id(), &timestamp);
   scoped_refptr<media::VideoFrame> frame =
-      CreateVideoFrame(picture, pb, timestamp);
+      CreateVideoFrame(picture, pb, timestamp, visible_rect);
   bool inserted =
       picture_buffers_at_display_.insert(std::make_pair(
                                              picture.picture_buffer_id(),
@@ -405,8 +408,8 @@
 scoped_refptr<media::VideoFrame> RTCVideoDecoder::CreateVideoFrame(
     const media::Picture& picture,
     const media::PictureBuffer& pb,
-    uint32_t timestamp) {
-  gfx::Rect visible_rect(picture.visible_rect());
+    uint32_t timestamp,
+    const gfx::Rect& visible_rect) {
   DCHECK(decoder_texture_target_);
   // Convert timestamp from 90KHz to ms.
   base::TimeDelta timestamp_ms = base::TimeDelta::FromInternalValue(
@@ -791,13 +794,15 @@
 }
 
 void RTCVideoDecoder::GetBufferData(int32 bitstream_buffer_id,
-                                    uint32_t* timestamp) {
+                                    uint32_t* timestamp,
+                                    gfx::Rect* visible_rect) {
   for (std::list<BufferData>::iterator it = input_buffer_data_.begin();
        it != input_buffer_data_.end();
        ++it) {
     if (it->bitstream_buffer_id != bitstream_buffer_id)
       continue;
     *timestamp = it->timestamp;
+    *visible_rect = it->visible_rect;
     return;
   }
   NOTREACHED() << "Missing bitstream buffer id: " << bitstream_buffer_id;
diff --git a/content/renderer/media/rtc_video_decoder.h b/content/renderer/media/rtc_video_decoder.h
index 9a92aac..fd445f55 100644
--- a/content/renderer/media/rtc_video_decoder.h
+++ b/content/renderer/media/rtc_video_decoder.h
@@ -22,6 +22,7 @@
 #include "media/video/picture.h"
 #include "media/video/video_decode_accelerator.h"
 #include "third_party/webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
+#include "ui/gfx/geometry/rect.h"
 
 namespace base {
 class WaitableEvent;
@@ -89,12 +90,14 @@
   struct BufferData {
     BufferData(int32 bitstream_buffer_id,
                uint32_t timestamp,
-               size_t size);
+               size_t size,
+               const gfx::Rect& visible_rect);
     BufferData();
     ~BufferData();
     int32 bitstream_buffer_id;
     uint32_t timestamp;  // in 90KHz
     size_t size;  // buffer size
+    gfx::Rect visible_rect;
   };
 
   FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, IsBufferAfterReset);
@@ -133,7 +136,8 @@
   scoped_refptr<media::VideoFrame> CreateVideoFrame(
       const media::Picture& picture,
       const media::PictureBuffer& pb,
-      uint32_t timestamp);
+      uint32_t timestamp,
+      const gfx::Rect& visible_rect);
 
   // Resets VDA.
   void ResetInternal();
@@ -168,7 +172,9 @@
   // Stores the buffer metadata to |input_buffer_data_|.
   void RecordBufferData(const BufferData& buffer_data);
   // Gets the buffer metadata from |input_buffer_data_|.
-  void GetBufferData(int32 bitstream_buffer_id, uint32_t* timestamp);
+  void GetBufferData(int32 bitstream_buffer_id,
+                     uint32_t* timestamp,
+                     gfx::Rect* visible_rect);
 
   // Records the result of InitDecode to UMA and returns |status|.
   int32_t RecordInitDecodeUMA(int32_t status);
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
index f342e3a..b4f8c05 100644
--- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
+++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -55,12 +55,7 @@
 #include "third_party/WebKit/public/web/WebDocument.h"
 #include "third_party/WebKit/public/web/WebFrame.h"
 #include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h"
-
-#if defined(USE_OPENSSL)
 #include "third_party/webrtc/base/ssladapter.h"
-#else
-#include "net/socket/nss_ssl_util.h"
-#endif
 
 #if defined(OS_ANDROID)
 #include "media/base/android/media_codec_bridge.h"
@@ -342,16 +337,11 @@
   CHECK(worker_thread_);
 
   // Init SSL, which will be needed by PeerConnection.
-#if defined(USE_OPENSSL)
   if (!rtc::InitializeSSL()) {
     LOG(ERROR) << "Failed on InitializeSSL.";
     NOTREACHED();
     return;
   }
-#else
-  // TODO(ronghuawu): Replace this call with InitializeSSL.
-  net::EnsureNSSSSLInit();
-#endif
 
   base::WaitableEvent start_signaling_event(true, false);
   chrome_signaling_thread_.task_runner()->PostTask(
@@ -482,8 +472,13 @@
   }
 
   if (!enforce_preferences) {
+    VLOG(3) << "WebRTC routing preferences will not be enforced";
     port_config.enable_multiple_routes = true;
     port_config.enable_nonproxied_udp = true;
+  } else {
+    VLOG(3) << "WebRTC routing preferences: multiple_routes: "
+            << port_config.enable_multiple_routes
+            << ", nonproxied_udp: " << port_config.enable_nonproxied_udp;
   }
 
   const GURL& requesting_origin =
diff --git a/content/renderer/p2p/filtering_network_manager.cc b/content/renderer/p2p/filtering_network_manager.cc
index 64eafcb7..4c636e7 100644
--- a/content/renderer/p2p/filtering_network_manager.cc
+++ b/content/renderer/p2p/filtering_network_manager.cc
@@ -27,6 +27,7 @@
   if (!media_permission_) {
     initialized_ = true;
     set_enumeration_permission(ENUMERATION_ALLOWED);
+    VLOG(3) << "media_permission is not passed, granting permission";
     return;
   }
 }
@@ -88,11 +89,14 @@
 
   if (enumeration_permission() == ENUMERATION_ALLOWED)
     network_manager_->GetNetworks(networks);
+
+  VLOG(3) << "GetNetworks() returns " << networks->size() << " networks.";
 }
 
 void FilteringNetworkManager::OnPermissionStatus(bool granted) {
   DCHECK(thread_checker_.CalledOnValidThread());
   DCHECK_GT(pending_permission_checks_, 0);
+  VLOG(3) << "OnPermissionStatus: " << granted;
 
   --pending_permission_checks_;
 
diff --git a/content/renderer/presentation/presentation_connection_client.cc b/content/renderer/presentation/presentation_connection_client.cc
new file mode 100644
index 0000000..bd3419f
--- /dev/null
+++ b/content/renderer/presentation/presentation_connection_client.cc
@@ -0,0 +1,36 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/renderer/presentation/presentation_connection_client.h"
+
+#include "base/logging.h"
+#include "third_party/WebKit/public/platform/WebString.h"
+
+namespace content {
+
+PresentationConnectionClient::PresentationConnectionClient(
+    presentation::PresentationSessionInfoPtr session_info)
+    : url_(blink::WebString::fromUTF8(session_info->url)),
+      id_(blink::WebString::fromUTF8(session_info->id)) {
+}
+
+PresentationConnectionClient::PresentationConnectionClient(
+    const mojo::String& url,
+    const mojo::String& id)
+    : url_(blink::WebString::fromUTF8(url)),
+      id_(blink::WebString::fromUTF8(id)) {
+}
+
+PresentationConnectionClient::~PresentationConnectionClient() {
+}
+
+blink::WebString PresentationConnectionClient::getUrl() {
+    return url_;
+}
+
+blink::WebString PresentationConnectionClient::getId() {
+    return id_;
+}
+
+}  // namespace content
diff --git a/content/renderer/presentation/presentation_connection_client.h b/content/renderer/presentation/presentation_connection_client.h
new file mode 100644
index 0000000..4e8a591e
--- /dev/null
+++ b/content/renderer/presentation/presentation_connection_client.h
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_SESSION_CLIENT_H_
+#define CONTENT_RENDERER_PRESENTATION_PRESENTATION_SESSION_CLIENT_H_
+
+#include "base/compiler_specific.h"
+#include "content/common/content_export.h"
+#include "content/common/presentation/presentation_service.mojom.h"
+#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationConnectionClient.h"
+
+namespace content {
+
+// PresentationConnectionClient is passed to the Blink layer if presentation
+// session has been created successfully. Owned by the callback.
+class CONTENT_EXPORT PresentationConnectionClient
+    : public NON_EXPORTED_BASE(blink::WebPresentationConnectionClient) {
+ public:
+  explicit PresentationConnectionClient(
+        presentation::PresentationSessionInfoPtr session_info);
+  explicit PresentationConnectionClient(const mojo::String& url,
+                                     const mojo::String& id);
+  ~PresentationConnectionClient() override;
+
+  // WebPresentationConnectionClient implementation.
+  blink::WebString getUrl() override;
+  blink::WebString getId() override;
+
+ private:
+  blink::WebString url_;
+  blink::WebString id_;
+};
+
+}  // namespace content
+
+#endif  // CONTENT_RENDERER_PRESENTATION_PRESENTATION_SESSION_CLIENT_H_
diff --git a/content/renderer/presentation/presentation_dispatcher.cc b/content/renderer/presentation/presentation_dispatcher.cc
index 836b425c..a2c7bc8 100644
--- a/content/renderer/presentation/presentation_dispatcher.cc
+++ b/content/renderer/presentation/presentation_dispatcher.cc
@@ -12,7 +12,7 @@
 #include "content/public/common/presentation_constants.h"
 #include "content/public/common/service_registry.h"
 #include "content/public/renderer/render_frame.h"
-#include "content/renderer/presentation/presentation_session_client.h"
+#include "content/renderer/presentation/presentation_connection_client.h"
 #include "third_party/WebKit/public/platform/WebString.h"
 #include "third_party/WebKit/public/platform/WebURL.h"
 #include "third_party/WebKit/public/platform/modules/presentation/WebPresentationAvailabilityObserver.h"
@@ -38,17 +38,17 @@
   }
 }
 
-blink::WebPresentationSessionState GetWebPresentationSessionStateFromMojo(
+blink::WebPresentationConnectionState GetWebPresentationConnectionStateFromMojo(
         presentation::PresentationSessionState mojoSessionState) {
   switch (mojoSessionState) {
     case presentation::PRESENTATION_SESSION_STATE_CONNECTED:
-      return blink::WebPresentationSessionState::Connected;
+      return blink::WebPresentationConnectionState::Connected;
     case presentation::PRESENTATION_SESSION_STATE_DISCONNECTED:
-      return blink::WebPresentationSessionState::Disconnected;
+      return blink::WebPresentationConnectionState::Disconnected;
   }
 
   NOTREACHED();
-  return blink::WebPresentationSessionState::Disconnected;
+  return blink::WebPresentationConnectionState::Disconnected;
 }
 
 }  // namespace
@@ -79,7 +79,7 @@
 
 void PresentationDispatcher::startSession(
     const blink::WebString& presentationUrl,
-    blink::WebPresentationSessionClientCallbacks* callback) {
+    blink::WebPresentationConnectionClientCallbacks* callback) {
   DCHECK(callback);
   ConnectToPresentationServiceIfNeeded();
 
@@ -96,7 +96,7 @@
 void PresentationDispatcher::joinSession(
     const blink::WebString& presentationUrl,
     const blink::WebString& presentationId,
-    blink::WebPresentationSessionClientCallbacks* callback) {
+    blink::WebPresentationConnectionClientCallbacks* callback) {
   DCHECK(callback);
   ConnectToPresentationServiceIfNeeded();
 
@@ -342,13 +342,13 @@
 
   if (!session_info.is_null()) {
     controller_->didStartDefaultSession(
-        new PresentationSessionClient(session_info.Clone()));
+        new PresentationConnectionClient(session_info.Clone()));
     presentation_service_->ListenForSessionMessages(session_info.Pass());
   }
 }
 
 void PresentationDispatcher::OnSessionCreated(
-    blink::WebPresentationSessionClientCallbacks* callback,
+    blink::WebPresentationConnectionClientCallbacks* callback,
     presentation::PresentationSessionInfoPtr session_info,
     presentation::PresentationErrorPtr error) {
   DCHECK(callback);
@@ -361,8 +361,8 @@
   }
 
   DCHECK(!session_info.is_null());
-  callback->onSuccess(
-      blink::adoptWebPtr(new PresentationSessionClient(session_info.Clone())));
+  callback->onSuccess(blink::adoptWebPtr(
+      new PresentationConnectionClient(session_info.Clone())));
   presentation_service_->ListenForSessionMessages(session_info.Pass());
 }
 
@@ -374,8 +374,8 @@
 
   DCHECK(!session_info.is_null());
   controller_->didChangeSessionState(
-      new PresentationSessionClient(session_info.Pass()),
-      GetWebPresentationSessionStateFromMojo(session_state));
+      new PresentationConnectionClient(session_info.Pass()),
+      GetWebPresentationConnectionStateFromMojo(session_state));
 }
 
 void PresentationDispatcher::OnSessionMessagesReceived(
@@ -387,8 +387,8 @@
   for (size_t i = 0; i < messages.size(); ++i) {
     // Note: Passing batches of messages to the Blink layer would be more
     // efficient.
-    scoped_ptr<PresentationSessionClient> session_client(
-        new PresentationSessionClient(session_info->url, session_info->id));
+    scoped_ptr<PresentationConnectionClient> session_client(
+        new PresentationConnectionClient(session_info->url, session_info->id));
     switch (messages[i]->type) {
       case presentation::PresentationMessageType::
           PRESENTATION_MESSAGE_TYPE_TEXT: {
diff --git a/content/renderer/presentation/presentation_dispatcher.h b/content/renderer/presentation/presentation_dispatcher.h
index 24d72e7..08ae828 100644
--- a/content/renderer/presentation/presentation_dispatcher.h
+++ b/content/renderer/presentation/presentation_dispatcher.h
@@ -60,11 +60,11 @@
   void setController(blink::WebPresentationController* controller) override;
   void startSession(
       const blink::WebString& presentationUrl,
-      blink::WebPresentationSessionClientCallbacks* callback) override;
+      blink::WebPresentationConnectionClientCallbacks* callback) override;
   void joinSession(
       const blink::WebString& presentationUrl,
       const blink::WebString& presentationId,
-      blink::WebPresentationSessionClientCallbacks* callback) override;
+      blink::WebPresentationConnectionClientCallbacks* callback) override;
   void sendString(const blink::WebString& presentationUrl,
                   const blink::WebString& presentationId,
                   const blink::WebString& message) override;
@@ -102,7 +102,7 @@
       mojo::Array<presentation::SessionMessagePtr> messages) override;
 
   void OnSessionCreated(
-      blink::WebPresentationSessionClientCallbacks* callback,
+      blink::WebPresentationConnectionClientCallbacks* callback,
       presentation::PresentationSessionInfoPtr session_info,
       presentation::PresentationErrorPtr error);
   void OnDefaultSessionStarted(
diff --git a/content/renderer/presentation/presentation_session_client.cc b/content/renderer/presentation/presentation_session_client.cc
deleted file mode 100644
index be8c754d..0000000
--- a/content/renderer/presentation/presentation_session_client.cc
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "content/renderer/presentation/presentation_session_client.h"
-
-#include "base/logging.h"
-#include "third_party/WebKit/public/platform/WebString.h"
-
-namespace content {
-
-PresentationSessionClient::PresentationSessionClient(
-    presentation::PresentationSessionInfoPtr session_info)
-    : url_(blink::WebString::fromUTF8(session_info->url)),
-      id_(blink::WebString::fromUTF8(session_info->id)) {
-}
-
-PresentationSessionClient::PresentationSessionClient(const mojo::String& url,
-                                                     const mojo::String& id)
-    : url_(blink::WebString::fromUTF8(url)),
-      id_(blink::WebString::fromUTF8(id)) {
-}
-
-PresentationSessionClient::~PresentationSessionClient() {
-}
-
-blink::WebString PresentationSessionClient::getUrl() {
-    return url_;
-}
-
-blink::WebString PresentationSessionClient::getId() {
-    return id_;
-}
-
-}  // namespace content
diff --git a/content/renderer/presentation/presentation_session_client.h b/content/renderer/presentation/presentation_session_client.h
deleted file mode 100644
index 05c289f9..0000000
--- a/content/renderer/presentation/presentation_session_client.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CONTENT_RENDERER_PRESENTATION_PRESENTATION_SESSION_CLIENT_H_
-#define CONTENT_RENDERER_PRESENTATION_PRESENTATION_SESSION_CLIENT_H_
-
-#include "base/compiler_specific.h"
-#include "content/common/content_export.h"
-#include "content/common/presentation/presentation_service.mojom.h"
-#include "third_party/WebKit/public/platform/modules/presentation/WebPresentationSessionClient.h"
-
-namespace content {
-
-// PresentationSessionClient is passed to the Blink layer if presentation
-// session has been created successfully. Owned by the callback.
-class CONTENT_EXPORT PresentationSessionClient
-    : public NON_EXPORTED_BASE(blink::WebPresentationSessionClient) {
- public:
-  explicit PresentationSessionClient(
-        presentation::PresentationSessionInfoPtr session_info);
-  explicit PresentationSessionClient(const mojo::String& url,
-                                     const mojo::String& id);
-  ~PresentationSessionClient() override;
-
-  // WebPresentationSessionClient implementation.
-  blink::WebString getUrl() override;
-  blink::WebString getId() override;
-
- private:
-  blink::WebString url_;
-  blink::WebString id_;
-};
-
-}  // namespace content
-
-#endif  // CONTENT_RENDERER_PRESENTATION_PRESENTATION_SESSION_CLIENT_H_
diff --git a/content/renderer/push_messaging/push_messaging_dispatcher.cc b/content/renderer/push_messaging/push_messaging_dispatcher.cc
index ca9747e..dcf79de 100644
--- a/content/renderer/push_messaging/push_messaging_dispatcher.cc
+++ b/content/renderer/push_messaging/push_messaging_dispatcher.cc
@@ -85,13 +85,13 @@
 void PushMessagingDispatcher::OnSubscribeFromDocumentSuccess(
     int32_t request_id,
     const GURL& endpoint,
-    const std::vector<uint8_t>& p256dh) {
+    const std::vector<uint8_t>& curve25519dh) {
   blink::WebPushSubscriptionCallbacks* callbacks =
       subscription_callbacks_.Lookup(request_id);
   DCHECK(callbacks);
 
   callbacks->onSuccess(blink::adoptWebPtr(
-      new blink::WebPushSubscription(endpoint, p256dh)));
+      new blink::WebPushSubscription(endpoint, curve25519dh)));
 
   subscription_callbacks_.Remove(request_id);
 }
diff --git a/content/renderer/push_messaging/push_messaging_dispatcher.h b/content/renderer/push_messaging/push_messaging_dispatcher.h
index 6c2678e..f3cf3c8 100644
--- a/content/renderer/push_messaging/push_messaging_dispatcher.h
+++ b/content/renderer/push_messaging/push_messaging_dispatcher.h
@@ -53,7 +53,7 @@
 
   void OnSubscribeFromDocumentSuccess(int32_t request_id,
                                       const GURL& endpoint,
-                                      const std::vector<uint8_t>& p256dh);
+                                      const std::vector<uint8_t>& curve25519dh);
 
   void OnSubscribeFromDocumentError(int32_t request_id,
                                     PushRegistrationStatus status);
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 045540de..7b801547 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -2740,6 +2740,14 @@
     }
   }
 
+  // For new page navigations, the browser process needs to be notified of the
+  // first paint of that page, so it can cancel the timer that waits for it.
+  if (is_main_frame_ && !navigation_state->WasWithinSamePage()) {
+    render_view_->QueueMessage(
+        new ViewHostMsg_DidFirstPaintAfterLoad(render_view_->routing_id_),
+        MESSAGE_DELIVERY_POLICY_WITH_VISUAL_STATE);
+  }
+
   // When we perform a new navigation, we need to update the last committed
   // session history entry with state for the page we are leaving. Do this
   // before updating the HistoryController state.
@@ -3866,9 +3874,7 @@
 blink::WebUSBClient* RenderFrameImpl::usbClient() {
 #if !defined(OS_ANDROID)
   if (!usb_client_) {
-    mojo::ServiceProviderPtr device_services =
-        ConnectToApplication(GURL(device::kDevicesMojoAppUrl));
-    usb_client_.reset(new WebUSBClientImpl(device_services.Pass()));
+    usb_client_.reset(new WebUSBClientImpl(GetServiceRegistry()));
   }
 #endif
   return usb_client_.get();
diff --git a/content/renderer/usb/web_usb_client_impl.cc b/content/renderer/usb/web_usb_client_impl.cc
index 9449c35e..43446af 100644
--- a/content/renderer/usb/web_usb_client_impl.cc
+++ b/content/renderer/usb/web_usb_client_impl.cc
@@ -10,11 +10,9 @@
 #include "base/move.h"
 #include "base/strings/utf_string_conversions.h"
 #include "content/child/scoped_web_callbacks.h"
+#include "content/public/common/service_registry.h"
 #include "content/renderer/usb/type_converters.h"
 #include "content/renderer/usb/web_usb_device_impl.h"
-#include "device/devices_app/public/cpp/constants.h"
-#include "mojo/application/public/cpp/connect.h"
-#include "mojo/application/public/interfaces/shell.mojom.h"
 #include "third_party/WebKit/public/platform/WebCallbacks.h"
 #include "third_party/WebKit/public/platform/WebPassOwnPtr.h"
 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBDeviceFilter.h"
@@ -53,10 +51,8 @@
 
 void OnGetDevicesComplete(
     ScopedWebCallbacks<blink::WebUSBClientGetDevicesCallbacks> scoped_callbacks,
-    mojo::ServiceProvider* device_services,
+    device::usb::DeviceManager* device_manager,
     mojo::Array<device::usb::DeviceInfoPtr> results) {
-  device::usb::DeviceManagerPtr device_manager;
-  mojo::ConnectToService(device_services, &device_manager);
   blink::WebVector<blink::WebUSBDevice*>* devices =
       new blink::WebVector<blink::WebUSBDevice*>(results.size());
   for (size_t i = 0; i < results.size(); ++i) {
@@ -70,9 +66,10 @@
 
 }  // namespace
 
-WebUSBClientImpl::WebUSBClientImpl(mojo::ServiceProviderPtr device_services)
-    : device_services_(device_services.Pass()) {
-  mojo::ConnectToService(device_services_.get(), &device_manager_);
+WebUSBClientImpl::WebUSBClientImpl(content::ServiceRegistry* service_registry) {
+  service_registry->ConnectToRemoteService(mojo::GetProxy(&device_manager_));
+  device_manager_.set_connection_error_handler(
+      [this]() { LOG(ERROR) << "Device manager connection failed."; });
 }
 
 WebUSBClientImpl::~WebUSBClientImpl() {}
@@ -83,7 +80,7 @@
   device_manager_->GetDevices(
       nullptr,
       base::Bind(&OnGetDevicesComplete, base::Passed(&scoped_callbacks),
-                 base::Unretained(device_services_.get())));
+                 base::Unretained(device_manager_.get())));
 }
 
 void WebUSBClientImpl::requestDevice(
diff --git a/content/renderer/usb/web_usb_client_impl.h b/content/renderer/usb/web_usb_client_impl.h
index dc2d106..612f842 100644
--- a/content/renderer/usb/web_usb_client_impl.h
+++ b/content/renderer/usb/web_usb_client_impl.h
@@ -5,17 +5,17 @@
 #ifndef CONTENT_RENDERER_USB_WEB_USB_CLIENT_IMPL_H_
 #define CONTENT_RENDERER_USB_WEB_USB_CLIENT_IMPL_H_
 
-#include "base/id_map.h"
 #include "base/macros.h"
 #include "device/devices_app/usb/public/interfaces/device_manager.mojom.h"
-#include "mojo/application/public/interfaces/service_provider.mojom.h"
 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h"
 
 namespace content {
 
+class ServiceRegistry;
+
 class WebUSBClientImpl : public blink::WebUSBClient {
  public:
-  explicit WebUSBClientImpl(mojo::ServiceProviderPtr device_services);
+  explicit WebUSBClientImpl(content::ServiceRegistry* service_registry);
   ~WebUSBClientImpl() override;
 
  private:
@@ -29,7 +29,6 @@
   void OnDeviceChangeNotification(
       device::usb::DeviceChangeNotificationPtr notification);
 
-  mojo::ServiceProviderPtr device_services_;
   device::usb::DeviceManagerPtr device_manager_;
   Observer* observer_ = nullptr;
 
diff --git a/content/shell/browser/layout_test/layout_test_permission_manager.cc b/content/shell/browser/layout_test/layout_test_permission_manager.cc
index 21300f3..9791db4 100644
--- a/content/shell/browser/layout_test/layout_test_permission_manager.cc
+++ b/content/shell/browser/layout_test/layout_test_permission_manager.cc
@@ -61,10 +61,9 @@
 LayoutTestPermissionManager::~LayoutTestPermissionManager() {
 }
 
-void LayoutTestPermissionManager::RequestPermission(
+int LayoutTestPermissionManager::RequestPermission(
     PermissionType permission,
     RenderFrameHost* render_frame_host,
-    int request_id,
     const GURL& requesting_origin,
     bool user_gesture,
     const base::Callback<void(PermissionStatus)>& callback) {
@@ -74,13 +73,10 @@
       permission, requesting_origin,
       WebContents::FromRenderFrameHost(render_frame_host)
           ->GetLastCommittedURL().GetOrigin()));
+  return kNoPendingOperation;
 }
 
-void LayoutTestPermissionManager::CancelPermissionRequest(
-    PermissionType permission,
-    RenderFrameHost* render_frame_host,
-    int request_id,
-    const GURL& requesting_origin) {
+void LayoutTestPermissionManager::CancelPermissionRequest(int request_id) {
   DCHECK_CURRENTLY_ON(BrowserThread::UI);
 }
 
diff --git a/content/shell/browser/layout_test/layout_test_permission_manager.h b/content/shell/browser/layout_test/layout_test_permission_manager.h
index e980992e..b7fba52 100644
--- a/content/shell/browser/layout_test/layout_test_permission_manager.h
+++ b/content/shell/browser/layout_test/layout_test_permission_manager.h
@@ -21,17 +21,13 @@
   ~LayoutTestPermissionManager() override;
 
   // PermissionManager overrides.
-  void RequestPermission(
+  int RequestPermission(
       PermissionType permission,
       RenderFrameHost* render_frame_host,
-      int request_id,
       const GURL& requesting_origin,
       bool user_gesture,
       const base::Callback<void(PermissionStatus)>& callback) override;
-  void CancelPermissionRequest(PermissionType permission,
-                               RenderFrameHost* render_frame_host,
-                               int request_id,
-                               const GURL& requesting_origin) override;
+  void CancelPermissionRequest(int request_id) override;
   void ResetPermission(PermissionType permission,
                        const GURL& requesting_origin,
                        const GURL& embedding_origin) override;
diff --git a/content/shell/browser/layout_test/layout_test_push_messaging_service.cc b/content/shell/browser/layout_test/layout_test_push_messaging_service.cc
index e108c03..03498e7 100644
--- a/content/shell/browser/layout_test/layout_test_push_messaging_service.cc
+++ b/content/shell/browser/layout_test/layout_test_push_messaging_service.cc
@@ -16,14 +16,14 @@
 
 namespace {
 
-// P-256 public key made available to layout tests. Must be 32 bytes.
-const uint8_t kTestP256Key[] = {
+// Curve25519 public key made available to layout tests. Must be 32 bytes.
+const uint8_t kTestCurve25519dh[] = {
   0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B,
   0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
   0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
 };
 
-static_assert(sizeof(kTestP256Key) == 32,
+static_assert(sizeof(kTestCurve25519dh) == 32,
               "The fake public key must have the size of a real public key.");
 
 blink::WebPushPermissionStatus ToWebPushPermissionStatus(
@@ -73,10 +73,10 @@
     const PushMessagingService::RegisterCallback& callback) {
   if (GetPermissionStatus(requesting_origin, requesting_origin, user_visible) ==
       blink::WebPushPermissionStatusGranted) {
-    std::vector<uint8_t> p256dh(
-        kTestP256Key, kTestP256Key + arraysize(kTestP256Key));
+    std::vector<uint8_t> curve25519dh(
+        kTestCurve25519dh, kTestCurve25519dh + arraysize(kTestCurve25519dh));
 
-    callback.Run("layoutTestRegistrationId", p256dh,
+    callback.Run("layoutTestRegistrationId", curve25519dh,
                  PUSH_REGISTRATION_STATUS_SUCCESS_FROM_PUSH_SERVICE);
   } else {
     callback.Run("registration_id", std::vector<uint8_t>(),
@@ -88,10 +88,10 @@
     const GURL& origin,
     int64_t service_worker_registration_id,
     const PublicKeyCallback& callback) {
-  std::vector<uint8_t> p256dh(
-        kTestP256Key, kTestP256Key + arraysize(kTestP256Key));
+  std::vector<uint8_t> curve25519dh(
+        kTestCurve25519dh, kTestCurve25519dh + arraysize(kTestCurve25519dh));
 
-  callback.Run(true /* success */, p256dh);
+  callback.Run(true /* success */, curve25519dh);
 }
 
 blink::WebPushPermissionStatus
diff --git a/content/shell/browser/shell_permission_manager.cc b/content/shell/browser/shell_permission_manager.cc
index fffcfa5..7c591d8b 100644
--- a/content/shell/browser/shell_permission_manager.cc
+++ b/content/shell/browser/shell_permission_manager.cc
@@ -16,22 +16,18 @@
 ShellPermissionManager::~ShellPermissionManager() {
 }
 
-void ShellPermissionManager::RequestPermission(
+int ShellPermissionManager::RequestPermission(
     PermissionType permission,
     RenderFrameHost* render_frame_host,
-    int request_id,
     const GURL& requesting_origin,
     bool user_gesture,
     const base::Callback<void(PermissionStatus)>& callback) {
   callback.Run(permission == PermissionType::GEOLOCATION
                    ? PERMISSION_STATUS_GRANTED : PERMISSION_STATUS_DENIED);
+  return kNoPendingOperation;
 }
 
-void ShellPermissionManager::CancelPermissionRequest(
-    PermissionType permission,
-    RenderFrameHost* render_frame_host,
-    int request_id,
-    const GURL& requesting_origin) {
+void ShellPermissionManager::CancelPermissionRequest(int request_id) {
 }
 
 void ShellPermissionManager::ResetPermission(
@@ -58,7 +54,7 @@
     const GURL& requesting_origin,
     const GURL& embedding_origin,
     const base::Callback<void(PermissionStatus)>& callback) {
-  return -1;
+  return kNoPendingOperation;
 }
 
 void ShellPermissionManager::UnsubscribePermissionStatusChange(
diff --git a/content/shell/browser/shell_permission_manager.h b/content/shell/browser/shell_permission_manager.h
index 96a8e2c..0b195d4d 100644
--- a/content/shell/browser/shell_permission_manager.h
+++ b/content/shell/browser/shell_permission_manager.h
@@ -17,17 +17,13 @@
   ~ShellPermissionManager() override;
 
   // PermissionManager implementation.
-  void RequestPermission(
+  int RequestPermission(
       PermissionType permission,
       RenderFrameHost* render_frame_host,
-      int request_id,
       const GURL& requesting_origin,
       bool user_gesture,
       const base::Callback<void(PermissionStatus)>& callback) override;
-  void CancelPermissionRequest(PermissionType permission,
-                               RenderFrameHost* render_frame_host,
-                               int request_id,
-                               const GURL& requesting_origin) override;
+  void CancelPermissionRequest(int request_id) override;
   void ResetPermission(PermissionType permission,
                        const GURL& requesting_origin,
                        const GURL& embedding_origin) override;
diff --git a/content/test/data/accessibility/aria/aria-searchbox-with-selection-expected-win.txt b/content/test/data/accessibility/aria/aria-searchbox-with-selection-expected-win.txt
index bf62da6..7ccc5639 100644
--- a/content/test/data/accessibility/aria/aria-searchbox-with-selection-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-searchbox-with-selection-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=1 selection_start=0 selection_end=1
-++ROLE_SYSTEM_TEXT FOCUSABLE xml-roles:searchbox caret_offset=0 n_selections=1 selection_start=0 selection_end=20
-++++ROLE_SYSTEM_STATICTEXT name='ARIA role searchbox.' caret_offset=0 n_selections=1 selection_start=0 selection_end=20
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++ROLE_SYSTEM_TEXT FOCUSABLE xml-roles:searchbox caret_offset=20 n_selections=1 selection_start=0 selection_end=20
+++++ROLE_SYSTEM_STATICTEXT name='ARIA role searchbox.' caret_offset=20 n_selections=1 selection_start=0 selection_end=20
diff --git a/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-win.txt b/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-win.txt
index 24593b4e..60e2ceef 100644
--- a/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-win.txt
+++ b/content/test/data/accessibility/aria/aria-textbox-with-selection-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=1 selection_start=0 selection_end=2
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=1 n_selections=1 selection_start=0 selection_end=1
 ++ROLE_SYSTEM_TEXT IA2_STATE_SINGLE_LINE xml-roles:textbox caret_offset=0 n_selections=0
 ++ROLE_SYSTEM_TEXT IA2_STATE_MULTI_LINE xml-roles:textbox caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/html/contenteditable-descendants-expected-win.txt b/content/test/data/accessibility/html/contenteditable-descendants-expected-win.txt
index b83a1dda..9156a30 100644
--- a/content/test/data/accessibility/html/contenteditable-descendants-expected-win.txt
+++ b/content/test/data/accessibility/html/contenteditable-descendants-expected-win.txt
@@ -1,25 +1,25 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1><obj2>'
-++IA2_ROLE_SECTION FOCUSABLE IA2_STATE_EDITABLE ia2_hypertext='<obj0><obj1><obj2>'
-++++IA2_ROLE_PARAGRAPH IA2_STATE_EDITABLE ia2_hypertext='A contenteditable with a <obj1> and an <obj3> and a <obj5>.'
-++++++ROLE_SYSTEM_STATICTEXT name='A contenteditable with a ' IA2_STATE_EDITABLE ia2_hypertext='A contenteditable with a '
-++++++ROLE_SYSTEM_LINK name='link' LINKED IA2_STATE_EDITABLE ia2_hypertext='link'
-++++++++ROLE_SYSTEM_STATICTEXT name='link' LINKED IA2_STATE_EDITABLE ia2_hypertext='link'
-++++++ROLE_SYSTEM_STATICTEXT name=' and an ' IA2_STATE_EDITABLE ia2_hypertext=' and an '
-++++++ROLE_SYSTEM_GRAPHIC name='Image' IA2_STATE_EDITABLE ia2_hypertext='Image'
-++++++ROLE_SYSTEM_STATICTEXT name=' and a ' IA2_STATE_EDITABLE ia2_hypertext=' and a '
-++++++ROLE_SYSTEM_PUSHBUTTON name='Button' FOCUSABLE IA2_STATE_EDITABLE ia2_hypertext='Button'
-++++++ROLE_SYSTEM_STATICTEXT name='.' IA2_STATE_EDITABLE ia2_hypertext='.'
-++++ROLE_SYSTEM_TABLE IA2_STATE_EDITABLE ia2_hypertext='<obj0><obj1><obj2>'
-++++++ROLE_SYSTEM_ROW IA2_STATE_EDITABLE ia2_hypertext='<obj0>'
-++++++++ROLE_SYSTEM_CELL IA2_STATE_EDITABLE ia2_hypertext='Always expose editable tables as tables.'
-++++++++++ROLE_SYSTEM_STATICTEXT name='Always expose editable tables as tables.' IA2_STATE_EDITABLE ia2_hypertext='Always expose editable tables as tables.'
-++++++ROLE_SYSTEM_COLUMN
-++++++IA2_ROLE_SECTION
-++++ROLE_SYSTEM_LIST IA2_STATE_EDITABLE ia2_hypertext='<obj0>'
-++++++ROLE_SYSTEM_LISTITEM name='Editable list item.' IA2_STATE_EDITABLE ia2_hypertext='<obj0>Editable list item.'
-++++++++ROLE_SYSTEM_STATICTEXT name='1' ia2_hypertext='1'
-++++++++ROLE_SYSTEM_STATICTEXT name='Editable list item.' IA2_STATE_EDITABLE ia2_hypertext='Editable list item.'
-++IA2_ROLE_PARAGRAPH ia2_hypertext='Non-editable paragraph.'
-++++ROLE_SYSTEM_STATICTEXT name='Non-editable paragraph.' ia2_hypertext='Non-editable paragraph.'
-++IA2_ROLE_PARAGRAPH FOCUSABLE IA2_STATE_EDITABLE ia2_hypertext='Should keep the role but change the state.'
-++++ROLE_SYSTEM_STATICTEXT name='Should keep the role but change the state.' IA2_STATE_EDITABLE ia2_hypertext='Should keep the role but change the state.'
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE ia2_hypertext='<obj0><obj1><obj2>' n_selections=0
+++IA2_ROLE_SECTION FOCUSABLE IA2_STATE_EDITABLE ia2_hypertext='<obj0><obj1><obj2>' n_selections=0
+++++IA2_ROLE_PARAGRAPH IA2_STATE_EDITABLE ia2_hypertext='A contenteditable with a <obj1> and an <obj3> and a <obj5>.' n_selections=0
+++++++ROLE_SYSTEM_STATICTEXT name='A contenteditable with a ' IA2_STATE_EDITABLE ia2_hypertext='A contenteditable with a ' n_selections=0
+++++++ROLE_SYSTEM_LINK name='link' LINKED IA2_STATE_EDITABLE ia2_hypertext='link' n_selections=0
+++++++++ROLE_SYSTEM_STATICTEXT name='link' LINKED IA2_STATE_EDITABLE ia2_hypertext='link' n_selections=0
+++++++ROLE_SYSTEM_STATICTEXT name=' and an ' IA2_STATE_EDITABLE ia2_hypertext=' and an ' n_selections=0
+++++++ROLE_SYSTEM_GRAPHIC name='Image' IA2_STATE_EDITABLE ia2_hypertext='Image' n_selections=0
+++++++ROLE_SYSTEM_STATICTEXT name=' and a ' IA2_STATE_EDITABLE ia2_hypertext=' and a ' n_selections=0
+++++++ROLE_SYSTEM_PUSHBUTTON name='Button' FOCUSABLE IA2_STATE_EDITABLE ia2_hypertext='Button' n_selections=0
+++++++ROLE_SYSTEM_STATICTEXT name='.' IA2_STATE_EDITABLE ia2_hypertext='.' n_selections=0
+++++ROLE_SYSTEM_TABLE IA2_STATE_EDITABLE ia2_hypertext='<obj0><obj1><obj2>' n_selections=0
+++++++ROLE_SYSTEM_ROW IA2_STATE_EDITABLE ia2_hypertext='<obj0>' n_selections=0
+++++++++ROLE_SYSTEM_CELL IA2_STATE_EDITABLE ia2_hypertext='Always expose editable tables as tables.' n_selections=0
+++++++++++ROLE_SYSTEM_STATICTEXT name='Always expose editable tables as tables.' IA2_STATE_EDITABLE ia2_hypertext='Always expose editable tables as tables.' n_selections=0
+++++++ROLE_SYSTEM_COLUMN n_selections=0
+++++++IA2_ROLE_SECTION n_selections=0
+++++ROLE_SYSTEM_LIST IA2_STATE_EDITABLE ia2_hypertext='<obj0>' n_selections=0
+++++++ROLE_SYSTEM_LISTITEM name='Editable list item.' IA2_STATE_EDITABLE ia2_hypertext='<obj0>Editable list item.' n_selections=0
+++++++++ROLE_SYSTEM_STATICTEXT name='1' ia2_hypertext='1' n_selections=0
+++++++++ROLE_SYSTEM_STATICTEXT name='Editable list item.' IA2_STATE_EDITABLE ia2_hypertext='Editable list item.' n_selections=0
+++IA2_ROLE_PARAGRAPH ia2_hypertext='Non-editable paragraph.' n_selections=0
+++++ROLE_SYSTEM_STATICTEXT name='Non-editable paragraph.' ia2_hypertext='Non-editable paragraph.' n_selections=0
+++IA2_ROLE_PARAGRAPH FOCUSABLE IA2_STATE_EDITABLE ia2_hypertext='Should keep the role but change the state.' n_selections=0
+++++ROLE_SYSTEM_STATICTEXT name='Should keep the role but change the state.' IA2_STATE_EDITABLE ia2_hypertext='Should keep the role but change the state.' n_selections=0
diff --git a/content/test/data/accessibility/html/contenteditable-descendants.html b/content/test/data/accessibility/html/contenteditable-descendants.html
index 5f669b3..95de2ce 100644
--- a/content/test/data/accessibility/html/contenteditable-descendants.html
+++ b/content/test/data/accessibility/html/contenteditable-descendants.html
@@ -2,6 +2,10 @@
 @WIN-ALLOW:IA2_STATE_EDITABLE
 @WIN-ALLOW:LINKED
 @WIN-ALLOW:ia2_hypertext=*
+@WIN-ALLOW:caret_offset*
+@WIN-ALLOW:n_selections*
+@WIN-ALLOW:selection_start*
+@WIN-ALLOW:selection_end*
 -->
 <div contenteditable>
   <p>A contenteditable with a
diff --git a/content/test/data/accessibility/html/input-password-expected-win.txt b/content/test/data/accessibility/html/input-password-expected-win.txt
index bade846..49ca3b0 100644
--- a/content/test/data/accessibility/html/input-password-expected-win.txt
+++ b/content/test/data/accessibility/html/input-password-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=1 selection_start=0 selection_end=1
-++IA2_ROLE_SECTION caret_offset=0 n_selections=1 selection_start=0 selection_end=1
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=0
+++IA2_ROLE_SECTION caret_offset=0 n_selections=0
 ++++ROLE_SYSTEM_TEXT value='••••••' FOCUSABLE PROTECTED IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:password caret_offset=6 n_selections=0
diff --git a/content/test/data/accessibility/html/input-text-expected-win.txt b/content/test/data/accessibility/html/input-text-expected-win.txt
index e7135f4..76873be 100644
--- a/content/test/data/accessibility/html/input-text-expected-win.txt
+++ b/content/test/data/accessibility/html/input-text-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=1 selection_start=0 selection_end=1
-++IA2_ROLE_SECTION caret_offset=0 n_selections=1 selection_start=0 selection_end=1
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=0
+++IA2_ROLE_SECTION caret_offset=0 n_selections=0
 ++++ROLE_SYSTEM_TEXT name='Name' FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:text caret_offset=0 n_selections=0
diff --git a/content/test/data/accessibility/html/input-text-with-selection-expected-win.txt b/content/test/data/accessibility/html/input-text-with-selection-expected-win.txt
index 1128b5b9..b8258b9 100644
--- a/content/test/data/accessibility/html/input-text-with-selection-expected-win.txt
+++ b/content/test/data/accessibility/html/input-text-with-selection-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=1 selection_start=0 selection_end=1
-++IA2_ROLE_SECTION caret_offset=0 n_selections=1 selection_start=0 selection_end=1
-++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:text caret_offset=3 n_selections=1 selection_start=3 selection_end=5
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++IA2_ROLE_SECTION caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_SELECTABLE_TEXT IA2_STATE_SINGLE_LINE text-input-type:text caret_offset=5 n_selections=1 selection_start=3 selection_end=5
diff --git a/content/test/data/accessibility/html/textarea-with-selection-expected-win.txt b/content/test/data/accessibility/html/textarea-with-selection-expected-win.txt
index 64792a2a..207596f 100644
--- a/content/test/data/accessibility/html/textarea-with-selection-expected-win.txt
+++ b/content/test/data/accessibility/html/textarea-with-selection-expected-win.txt
@@ -1,3 +1,3 @@
-ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=0 n_selections=1 selection_start=0 selection_end=1
-++IA2_ROLE_SECTION caret_offset=0 n_selections=1 selection_start=0 selection_end=1
-++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_MULTI_LINE IA2_STATE_SELECTABLE_TEXT caret_offset=0 n_selections=1 selection_start=0 selection_end=58
+ROLE_SYSTEM_DOCUMENT READONLY FOCUSABLE caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++IA2_ROLE_SECTION caret_offset=1 n_selections=1 selection_start=0 selection_end=1
+++++ROLE_SYSTEM_TEXT FOCUSABLE IA2_STATE_EDITABLE IA2_STATE_MULTI_LINE IA2_STATE_SELECTABLE_TEXT caret_offset=58 n_selections=1 selection_start=0 selection_end=58
diff --git a/content/test/data/cross_site_iframe_factory.html b/content/test/data/cross_site_iframe_factory.html
index f55b09d..5084f4c6 100644
--- a/content/test/data/cross_site_iframe_factory.html
+++ b/content/test/data/cross_site_iframe_factory.html
@@ -4,8 +4,8 @@
 
 Example usage in a browsertest, explained:
 
-  GURL url =
-    test_server()->GetURL("a.com", "/cross_site_iframe_factory.html?a(b(c,d))");
+  GURL url = embedded_test_server()->
+      GetURL("a.com", "/cross_site_iframe_factory.html?a(b(c,d))");
 
 When you navigate to the above URL, the outer document (on a.com) will create a
 single iframe:
diff --git a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
index 4c2f7d17..3e3df9e 100644
--- a/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
+++ b/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
@@ -199,6 +199,14 @@
         bug=536887)
     self.Fail('deqp/functional/gles3/fbostencilbuffer.html', ['mac', 'intel'],
         bug=536887)
+    self.Fail('deqp/functional/gles3/rbostatequery.html', ['mac', 'intel'],
+        bug=536887)
+    self.Fail('deqp/functional/gles3/readpixel.html', ['mac', 'intel'],
+        bug=536887)
+    self.Fail('deqp/functional/gles3/shaderapi.html', ['mac', 'intel'],
+        bug=536887)
+    self.Fail('deqp/functional/gles3/stringquery.html', ['mac', 'intel'],
+        bug=536887)
 
     # Linux only.
     self.Fail('conformance2/glsl3/vector-dynamic-indexing.html',
diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc
index 9b7ec29d..0ad4699 100644
--- a/content/zygote/zygote_main_linux.cc
+++ b/content/zygote/zygote_main_linux.cc
@@ -6,6 +6,7 @@
 
 #include <dlfcn.h>
 #include <fcntl.h>
+#include <openssl/rand.h>
 #include <pthread.h>
 #include <signal.h>
 #include <string.h>
@@ -39,7 +40,6 @@
 #include "content/public/common/sandbox_linux.h"
 #include "content/public/common/zygote_fork_delegate_linux.h"
 #include "content/zygote/zygote_linux.h"
-#include "crypto/nss_util.h"
 #include "sandbox/linux/services/credentials.h"
 #include "sandbox/linux/services/init_process_reaper.h"
 #include "sandbox/linux/services/namespace_sandbox.h"
@@ -52,12 +52,6 @@
 #include <sys/prctl.h>
 #endif
 
-#if defined(USE_OPENSSL)
-#include <openssl/rand.h>
-#else
-#include "sandbox/linux/services/libc_urandom_override.h"
-#endif
-
 #if defined(ENABLE_PLUGINS)
 #include "content/common/pepper_plugin_list.h"
 #include "content/public/common/pepper_plugin_info.h"
@@ -338,15 +332,10 @@
   // cached and there's no more need to access the file system.
   scoped_ptr<icu::TimeZone> zone(icu::TimeZone::createDefault());
 
-#if defined(USE_OPENSSL)
   // Pass BoringSSL a copy of the /dev/urandom file descriptor so RAND_bytes
   // will work inside the sandbox.
   RAND_set_urandom_fd(base::GetUrandomFD());
-#else
-  // NSS libraries are loaded before sandbox is activated. This is to allow
-  // successful initialization of NSS which tries to load extra library files.
-  crypto::LoadNSSLibraries();
-#endif
+
 #if defined(ENABLE_PLUGINS)
   // Ensure access to the Pepper plugins before the sandbox is turned on.
   PreloadPepperPlugins();
@@ -523,9 +512,6 @@
 bool ZygoteMain(const MainFunctionParams& params,
                 ScopedVector<ZygoteForkDelegate> fork_delegates) {
   g_am_zygote_or_renderer = true;
-#if !defined(USE_OPENSSL)
-  sandbox::InitLibcUrandomOverrides();
-#endif
 
   std::vector<int> fds_to_close_post_fork;
 
diff --git a/crypto/nss_util.cc b/crypto/nss_util.cc
index 4e8aab4d..d13170c0 100644
--- a/crypto/nss_util.cc
+++ b/crypto/nss_util.cc
@@ -670,14 +670,6 @@
   }
 #endif  // defined(USE_NSS_CERTS)
 
-#if !defined(USE_OPENSSL)
-  // This method is used to force NSS to be initialized without a DB.
-  // Call this method before NSSInitSingleton() is constructed.
-  static void ForceNoDBInit() {
-    force_nodb_init_ = true;
-  }
-#endif
-
  private:
   friend struct base::DefaultLazyInstanceTraits<NSSInitSingleton>;
 
@@ -712,12 +704,6 @@
     SECStatus status = SECFailure;
     bool nodb_init = false;
 
-#if !defined(USE_OPENSSL)
-    // ForceNoDBInit was called.
-    if (force_nodb_init_)
-      nodb_init = true;
-#endif
-
 #if !defined(USE_NSS_CERTS)
     // Use the system certificate store, so initialize NSS without database.
     nodb_init = true;
@@ -875,11 +861,6 @@
     }
   }
 
-#if !defined(USE_OPENSSL)
-  // If this is set to true NSS is forced to be initialized without a DB.
-  static bool force_nodb_init_;
-#endif
-
   bool tpm_token_enabled_for_nss_;
   bool initializing_tpm_token_;
   typedef std::vector<base::Closure> TPMReadyCallbackList;
@@ -901,11 +882,6 @@
   base::ThreadChecker thread_checker_;
 };
 
-#if !defined(USE_OPENSSL)
-// static
-bool NSSInitSingleton::force_nodb_init_ = false;
-#endif
-
 base::LazyInstance<NSSInitSingleton>::Leaky
     g_nss_singleton = LAZY_INSTANCE_INITIALIZER;
 }  // namespace
@@ -939,19 +915,6 @@
   g_nspr_singleton.Get();
 }
 
-#if !defined(USE_OPENSSL)
-void InitNSSSafely() {
-  // We might fork, but we haven't loaded any security modules.
-  DisableNSSForkCheck();
-  // If we're sandboxed, we shouldn't be able to open user security modules,
-  // but it's more correct to tell NSS to not even try.
-  // Loading user security modules would have security implications.
-  ForceNSSNoDBInit();
-  // Initialize NSS.
-  EnsureNSSInit();
-}
-#endif  // !defined(USE_OPENSSL)
-
 void EnsureNSSInit() {
   // Initializing SSL causes us to do blocking IO.
   // Temporarily allow it until we fix
@@ -960,73 +923,6 @@
   g_nss_singleton.Get();
 }
 
-#if !defined(USE_OPENSSL)
-
-void ForceNSSNoDBInit() {
-  NSSInitSingleton::ForceNoDBInit();
-}
-
-void DisableNSSForkCheck() {
-  scoped_ptr<base::Environment> env(base::Environment::Create());
-  env->SetVar("NSS_STRICT_NOFORK", "DISABLED");
-}
-
-void LoadNSSLibraries() {
-  // Some NSS libraries are linked dynamically so load them here.
-#if defined(USE_NSS_CERTS)
-  // Try to search for multiple directories to load the libraries.
-  std::vector<base::FilePath> paths;
-
-  // Use relative path to Search PATH for the library files.
-  paths.push_back(base::FilePath());
-
-  // For Debian derivatives NSS libraries are located here.
-  paths.push_back(base::FilePath("/usr/lib/nss"));
-
-  // Ubuntu 11.10 (Oneiric) and Debian Wheezy place the libraries here.
-#if defined(ARCH_CPU_X86_64)
-  paths.push_back(base::FilePath("/usr/lib/x86_64-linux-gnu/nss"));
-#elif defined(ARCH_CPU_X86)
-  paths.push_back(base::FilePath("/usr/lib/i386-linux-gnu/nss"));
-#elif defined(ARCH_CPU_ARMEL)
-#if defined(__ARM_PCS_VFP)
-  paths.push_back(base::FilePath("/usr/lib/arm-linux-gnueabihf/nss"));
-#else
-  paths.push_back(base::FilePath("/usr/lib/arm-linux-gnueabi/nss"));
-#endif  // defined(__ARM_PCS_VFP)
-#elif defined(ARCH_CPU_MIPSEL)
-  paths.push_back(base::FilePath("/usr/lib/mipsel-linux-gnu/nss"));
-#endif  // defined(ARCH_CPU_X86_64)
-
-  // A list of library files to load.
-  std::vector<std::string> libs;
-  libs.push_back("libsoftokn3.so");
-  libs.push_back("libfreebl3.so");
-
-  // For each combination of library file and path, check for existence and
-  // then load.
-  size_t loaded = 0;
-  for (size_t i = 0; i < libs.size(); ++i) {
-    for (size_t j = 0; j < paths.size(); ++j) {
-      base::FilePath path = paths[j].Append(libs[i]);
-      base::NativeLibrary lib = base::LoadNativeLibrary(path, NULL);
-      if (lib) {
-        ++loaded;
-        break;
-      }
-    }
-  }
-
-  if (loaded == libs.size()) {
-    VLOG(3) << "NSS libraries loaded.";
-  } else {
-    LOG(ERROR) << "Failed to load NSS libraries.";
-  }
-#endif  // defined(USE_NSS_CERTS)
-}
-
-#endif  // !defined(USE_OPENSSL)
-
 bool CheckNSSVersion(const char* version) {
   return !!NSS_VersionCheck(version);
 }
diff --git a/crypto/nss_util.h b/crypto/nss_util.h
index 98b0f72..06c1e5d9d5 100644
--- a/crypto/nss_util.h
+++ b/crypto/nss_util.h
@@ -33,65 +33,11 @@
 // thread-safe, and NSPR will only ever be initialized once.
 CRYPTO_EXPORT void EnsureNSPRInit();
 
-#if !defined(USE_OPENSSL)
-// Initialize NSS safely for strict sandboxing.  This function tells NSS to not
-// load user security modules, and makes sure NSS will have proper entropy in a
-// restricted, sandboxed environment.
-//
-// As a defense in depth measure, this function should be called in a sandboxed
-// environment.  That way, in the event of a bug, NSS will still not be able to
-// load security modules that could expose private data and keys.
-//
-// Make sure to get an LGTM from the Chrome Security Team if you use this.
-CRYPTO_EXPORT void InitNSSSafely();
-#endif  // !defined(USE_OPENSSL)
-
 // Initialize NSS if it isn't already initialized.  This must be called before
 // any other NSS functions.  This function is thread-safe, and NSS will only
 // ever be initialized once.
 CRYPTO_EXPORT void EnsureNSSInit();
 
-#if !defined(USE_OPENSSL)
-
-// Call this before calling EnsureNSSInit() will force NSS to initialize
-// without a persistent DB.  This is used for the special case where access of
-// persistent DB is prohibited.
-//
-// TODO(hclam): Isolate loading default root certs.
-//
-// NSS will be initialized without loading any user security modules, including
-// the built-in root certificates module. User security modules need to be
-// loaded manually after NSS initialization.
-//
-// If EnsureNSSInit() is called before then this function has no effect.
-//
-// Calling this method only has effect on Linux.
-//
-// WARNING: Use this with caution.
-CRYPTO_EXPORT void ForceNSSNoDBInit();
-
-// This method is used to disable checks in NSS when used in a forked process.
-// NSS checks whether it is running a forked process to avoid problems when
-// using user security modules in a forked process.  However if we are sure
-// there are no modules loaded before the process is forked then there is no
-// harm disabling the check.
-//
-// This method must be called before EnsureNSSInit() to take effect.
-//
-// WARNING: Use this with caution.
-CRYPTO_EXPORT void DisableNSSForkCheck();
-
-// Load NSS library files. This function has no effect on Mac and Windows.
-// This loads the necessary NSS library files so that NSS can be initialized
-// after loading additional library files is disallowed, for example when the
-// sandbox is active.
-//
-// Note that this does not load libnssckbi.so which contains the root
-// certificates.
-CRYPTO_EXPORT void LoadNSSLibraries();
-
-#endif  // !USE_OPENSSL
-
 // Check if the current NSS version is greater than or equals to |version|.
 // A sample version string is "3.12.3".
 bool CheckNSSVersion(const char* version);
diff --git a/device/devices_app/devices_app.cc b/device/devices_app/devices_app.cc
index 599c64fc..134948d 100644
--- a/device/devices_app/devices_app.cc
+++ b/device/devices_app/devices_app.cc
@@ -72,22 +72,15 @@
   DISALLOW_COPY_AND_ASSIGN(USBServiceInitializer);
 };
 
-DevicesApp::DevicesApp(
-    scoped_refptr<base::SequencedTaskRunner> service_task_runner)
-    : app_impl_(nullptr),
-      service_task_runner_(service_task_runner),
-      active_device_manager_count_(0) {
-}
+DevicesApp::DevicesApp()
+    : app_impl_(nullptr), active_device_manager_count_(0) {}
 
 DevicesApp::~DevicesApp() {
 }
 
 void DevicesApp::Initialize(mojo::ApplicationImpl* app) {
   app_impl_ = app;
-  if (!service_task_runner_) {
-    service_initializer_.reset(new USBServiceInitializer);
-    service_task_runner_ = base::ThreadTaskRunnerHandle::Get();
-  }
+  service_initializer_.reset(new USBServiceInitializer);
   StartIdleTimer();
 }
 
@@ -110,8 +103,8 @@
   connection->ConnectToService(&permission_provider);
 
   // Owned by its message pipe.
-  usb::DeviceManagerImpl* device_manager = new usb::DeviceManagerImpl(
-      request.Pass(), permission_provider.Pass(), service_task_runner_);
+  usb::DeviceManagerImpl* device_manager =
+      new usb::DeviceManagerImpl(permission_provider.Pass(), request.Pass());
   device_manager->set_connection_error_handler(
       base::Bind(&DevicesApp::OnConnectionError, base::Unretained(this)));
 
diff --git a/device/devices_app/devices_app.h b/device/devices_app/devices_app.h
index cac12f4..1671570 100644
--- a/device/devices_app/devices_app.h
+++ b/device/devices_app/devices_app.h
@@ -12,10 +12,6 @@
 #include "mojo/application/public/cpp/application_delegate.h"
 #include "mojo/application/public/cpp/interface_factory.h"
 
-namespace base {
-class SequencedTaskRunner;
-}
-
 namespace mojo {
 class ApplicationImpl;
 }
@@ -29,8 +25,7 @@
 class DevicesApp : public mojo::ApplicationDelegate,
                    public mojo::InterfaceFactory<usb::DeviceManager> {
  public:
-  explicit DevicesApp(
-      scoped_refptr<base::SequencedTaskRunner> service_task_runner);
+  DevicesApp();
   ~DevicesApp() override;
 
  private:
@@ -56,7 +51,6 @@
 
   mojo::ApplicationImpl* app_impl_;
   scoped_ptr<USBServiceInitializer> service_initializer_;
-  scoped_refptr<base::SequencedTaskRunner> service_task_runner_;
   size_t active_device_manager_count_;
 
   // Callback used to shut down the app after a period of inactivity.
diff --git a/device/devices_app/main.cc b/device/devices_app/main.cc
index 4c8e61b..b828750 100644
--- a/device/devices_app/main.cc
+++ b/device/devices_app/main.cc
@@ -10,6 +10,6 @@
 
 MojoResult MojoMain(MojoHandle shell_handle) {
   mojo::ApplicationRunner runner(
-      device::DevicesAppFactory::CreateApp(nullptr).release());
+      device::DevicesAppFactory::CreateApp().release());
   return runner.Run(shell_handle);
 }
diff --git a/device/devices_app/public/cpp/devices_app_factory.cc b/device/devices_app/public/cpp/devices_app_factory.cc
index ee85c09..a6ffe4e 100644
--- a/device/devices_app/public/cpp/devices_app_factory.cc
+++ b/device/devices_app/public/cpp/devices_app_factory.cc
@@ -9,10 +9,8 @@
 namespace device {
 
 // static
-scoped_ptr<mojo::ApplicationDelegate> DevicesAppFactory::CreateApp(
-    scoped_refptr<base::SequencedTaskRunner> service_task_runner) {
-  return scoped_ptr<mojo::ApplicationDelegate>(
-      new DevicesApp(service_task_runner));
+scoped_ptr<mojo::ApplicationDelegate> DevicesAppFactory::CreateApp() {
+  return scoped_ptr<mojo::ApplicationDelegate>(new DevicesApp());
 }
 
 }  // namespace device
diff --git a/device/devices_app/public/cpp/devices_app_factory.h b/device/devices_app/public/cpp/devices_app_factory.h
index 5642741..ba03185 100644
--- a/device/devices_app/public/cpp/devices_app_factory.h
+++ b/device/devices_app/public/cpp/devices_app_factory.h
@@ -8,10 +8,6 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 
-namespace base {
-class SequencedTaskRunner;
-}
-
 namespace mojo {
 class ApplicationDelegate;
 }
@@ -24,13 +20,7 @@
   // Creates a DevicesApp delegate which can be used to launch a new instance
   // of the devices app on a mojo application runner. The caller owns the
   // delegate.
-  //
-  // |service_task_runner| is the thread TaskRunner on which the UsbService
-  // lives. This argument should be removed once UsbService is owned by the
-  // USB device manager and no longer part of the public device API. If null,
-  // the app will construct its own DeviceClient and UsbService.
-  static scoped_ptr<mojo::ApplicationDelegate> CreateApp(
-      scoped_refptr<base::SequencedTaskRunner> service_task_runner);
+  static scoped_ptr<mojo::ApplicationDelegate> CreateApp();
 };
 
 }  // namespace device
diff --git a/device/devices_app/usb/device_manager_impl.cc b/device/devices_app/usb/device_manager_impl.cc
index 0fc287da..25fcd75 100644
--- a/device/devices_app/usb/device_manager_impl.cc
+++ b/device/devices_app/usb/device_manager_impl.cc
@@ -7,11 +7,7 @@
 #include "base/bind.h"
 #include "base/location.h"
 #include "base/memory/scoped_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "base/scoped_observer.h"
-#include "base/sequenced_task_runner.h"
 #include "base/stl_util.h"
-#include "base/thread_task_runner_handle.h"
 #include "device/core/device_client.h"
 #include "device/devices_app/usb/device_impl.h"
 #include "device/devices_app/usb/public/interfaces/device.mojom.h"
@@ -30,39 +26,6 @@
 using DeviceList = DeviceManagerImpl::DeviceList;
 using DeviceMap = DeviceManagerImpl::DeviceMap;
 
-void OnGetDevicesOnServiceThread(
-    const base::Callback<void(const DeviceList&)>& callback,
-    scoped_refptr<base::TaskRunner> callback_task_runner,
-    const DeviceList& devices) {
-  callback_task_runner->PostTask(FROM_HERE, base::Bind(callback, devices));
-}
-
-void GetDevicesOnServiceThread(
-    const base::Callback<void(const DeviceList&)>& callback,
-    scoped_refptr<base::TaskRunner> callback_task_runner) {
-  DCHECK(DeviceClient::Get());
-  UsbService* usb_service = DeviceClient::Get()->GetUsbService();
-  if (usb_service) {
-    usb_service->GetDevices(base::Bind(&OnGetDevicesOnServiceThread, callback,
-                                       callback_task_runner));
-  } else {
-    callback_task_runner->PostTask(FROM_HERE,
-                                   base::Bind(callback, DeviceList()));
-  }
-}
-
-void GetDeviceOnServiceThread(
-    const mojo::String& guid,
-    const base::Callback<void(scoped_refptr<UsbDevice>)>& callback,
-    scoped_refptr<base::TaskRunner> callback_task_runner) {
-  DCHECK(DeviceClient::Get());
-  scoped_refptr<UsbDevice> device;
-  UsbService* usb_service = DeviceClient::Get()->GetUsbService();
-  if (usb_service)
-    device = usb_service->GetDevice(guid);
-  callback_task_runner->PostTask(FROM_HERE, base::Bind(callback, device));
-}
-
 void FilterAndConvertDevicesAndThen(
     const DeviceMap& devices,
     const DeviceManagerImpl::GetDevicesCallback& callback,
@@ -79,57 +42,18 @@
 
 }  // namespace
 
-class DeviceManagerImpl::ServiceThreadHelper
-    : public UsbService::Observer,
-      public base::MessageLoop::DestructionObserver {
- public:
-  ServiceThreadHelper(base::WeakPtr<DeviceManagerImpl> manager,
-                      scoped_refptr<base::TaskRunner> task_runner)
-      : observer_(this), manager_(manager), task_runner_(task_runner) {}
-
-  ~ServiceThreadHelper() override {
-    base::MessageLoop::current()->RemoveDestructionObserver(this);
-  }
-
-  static void Start(scoped_ptr<ServiceThreadHelper> self) {
-    UsbService* usb_service = DeviceClient::Get()->GetUsbService();
-    if (usb_service)
-      self->observer_.Add(usb_service);
-
-    // |self| now owned by the current message loop.
-    base::MessageLoop::current()->AddDestructionObserver(self.release());
-  }
-
- private:
-  // UsbService::Observer
-  void OnDeviceAdded(scoped_refptr<UsbDevice> device) override {
-    task_runner_->PostTask(
-        FROM_HERE,
-        base::Bind(&DeviceManagerImpl::OnDeviceAdded, manager_, device));
-  }
-
-  void OnDeviceRemoved(scoped_refptr<UsbDevice> device) override {
-    task_runner_->PostTask(
-        FROM_HERE,
-        base::Bind(&DeviceManagerImpl::OnDeviceRemoved, manager_, device));
-  }
-
-  void WillDestroyUsbService() override { observer_.RemoveAll(); }
-
-  // base::MessageLoop::DestructionObserver
-  void WillDestroyCurrentMessageLoop() override { delete this; }
-
-  ScopedObserver<UsbService, UsbService::Observer> observer_;
-  base::WeakPtr<DeviceManagerImpl> manager_;
-  scoped_refptr<base::TaskRunner> task_runner_;
-};
+// static
+void DeviceManagerImpl::Create(PermissionProviderPtr permission_provider,
+                               mojo::InterfaceRequest<DeviceManager> request) {
+  // The created object is owned by its binding.
+  new DeviceManagerImpl(permission_provider.Pass(), request.Pass());
+}
 
 DeviceManagerImpl::DeviceManagerImpl(
-    mojo::InterfaceRequest<DeviceManager> request,
     PermissionProviderPtr permission_provider,
-    scoped_refptr<base::SequencedTaskRunner> service_task_runner)
+    mojo::InterfaceRequest<DeviceManager> request)
     : permission_provider_(permission_provider.Pass()),
-      service_task_runner_(service_task_runner),
+      observer_(this),
       binding_(this, request.Pass()),
       weak_factory_(this) {
   // This object owns itself and will be destroyed if either the message pipe
@@ -138,29 +62,27 @@
   binding_.set_connection_error_handler([this]() { delete this; });
   permission_provider_.set_connection_error_handler([this]() { delete this; });
 
-  scoped_ptr<ServiceThreadHelper> helper(new ServiceThreadHelper(
-      weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get()));
-  helper_ = helper.get();
-  service_task_runner_->PostTask(
-      FROM_HERE,
-      base::Bind(&ServiceThreadHelper::Start, base::Passed(&helper)));
+  DCHECK(DeviceClient::Get());
+  usb_service_ = DeviceClient::Get()->GetUsbService();
+  if (usb_service_)
+    observer_.Add(usb_service_);
 }
 
 DeviceManagerImpl::~DeviceManagerImpl() {
-  // It is safe to call this if |helper_| was already destroyed when
-  // |service_task_runner_| exited as the task will never execute.
-  service_task_runner_->DeleteSoon(FROM_HERE, helper_);
   connection_error_handler_.Run();
 }
 
 void DeviceManagerImpl::GetDevices(EnumerationOptionsPtr options,
                                    const GetDevicesCallback& callback) {
-  auto get_devices_callback =
-      base::Bind(&DeviceManagerImpl::OnGetDevices, weak_factory_.GetWeakPtr(),
-                 base::Passed(&options), callback);
-  service_task_runner_->PostTask(
-      FROM_HERE, base::Bind(&GetDevicesOnServiceThread, get_devices_callback,
-                            base::ThreadTaskRunnerHandle::Get()));
+  if (!usb_service_) {
+    mojo::Array<DeviceInfoPtr> no_devices;
+    callback.Run(no_devices.Pass());
+    return;
+  }
+
+  usb_service_->GetDevices(base::Bind(&DeviceManagerImpl::OnGetDevices,
+                                      weak_factory_.GetWeakPtr(),
+                                      base::Passed(&options), callback));
 }
 
 void DeviceManagerImpl::GetDeviceChanges(
@@ -172,18 +94,10 @@
 void DeviceManagerImpl::GetDevice(
     const mojo::String& guid,
     mojo::InterfaceRequest<Device> device_request) {
-  auto get_device_callback =
-      base::Bind(&DeviceManagerImpl::OnGetDevice, weak_factory_.GetWeakPtr(),
-                 base::Passed(&device_request));
-  service_task_runner_->PostTask(
-      FROM_HERE,
-      base::Bind(&GetDeviceOnServiceThread, guid, get_device_callback,
-                 base::ThreadTaskRunnerHandle::Get()));
-}
+  if (!usb_service_)
+    return;
 
-void DeviceManagerImpl::OnGetDevice(
-    mojo::InterfaceRequest<Device> device_request,
-    scoped_refptr<UsbDevice> device) {
+  scoped_refptr<UsbDevice> device = usb_service_->GetDevice(guid);
   if (!device)
     return;
 
@@ -242,6 +156,11 @@
   MaybeRunDeviceChangesCallback();
 }
 
+void DeviceManagerImpl::WillDestroyUsbService() {
+  observer_.RemoveAll();
+  usb_service_ = nullptr;
+}
+
 void DeviceManagerImpl::MaybeRunDeviceChangesCallback() {
   if (!permission_request_pending_ && !device_change_callbacks_.empty()) {
     DeviceMap devices_added;
diff --git a/device/devices_app/usb/device_manager_impl.h b/device/devices_app/usb/device_manager_impl.h
index 31e8173..2401303 100644
--- a/device/devices_app/usb/device_manager_impl.h
+++ b/device/devices_app/usb/device_manager_impl.h
@@ -13,8 +13,10 @@
 #include "base/memory/ref_counted.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/weak_ptr.h"
+#include "base/scoped_observer.h"
 #include "device/devices_app/usb/public/interfaces/device_manager.mojom.h"
 #include "device/devices_app/usb/public/interfaces/permission_provider.mojom.h"
+#include "device/usb/usb_service.h"
 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h"
 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 #include "third_party/mojo/src/mojo/public/cpp/bindings/interface_request.h"
@@ -35,15 +37,17 @@
 
 // Implementation of the public DeviceManager interface. This interface can be
 // requested from the devices app located at "mojo:devices", if available.
-class DeviceManagerImpl : public DeviceManager {
+class DeviceManagerImpl : public DeviceManager,
+                          public device::UsbService::Observer {
  public:
   using DeviceList = std::vector<scoped_refptr<UsbDevice>>;
   using DeviceMap = std::map<std::string, scoped_refptr<device::UsbDevice>>;
 
-  DeviceManagerImpl(
-      mojo::InterfaceRequest<DeviceManager> request,
-      PermissionProviderPtr permission_provider,
-      scoped_refptr<base::SequencedTaskRunner> service_task_runner);
+  static void Create(PermissionProviderPtr permission_provider,
+                     mojo::InterfaceRequest<DeviceManager> request);
+
+  DeviceManagerImpl(PermissionProviderPtr permission_provider,
+                    mojo::InterfaceRequest<DeviceManager> request);
   ~DeviceManagerImpl() override;
 
   void set_connection_error_handler(const mojo::Closure& error_handler) {
@@ -51,8 +55,6 @@
   }
 
  private:
-  class ServiceThreadHelper;
-
   // DeviceManager implementation:
   void GetDevices(EnumerationOptionsPtr options,
                   const GetDevicesCallback& callback) override;
@@ -61,8 +63,6 @@
                  mojo::InterfaceRequest<Device> device_request) override;
 
   // Callbacks to handle the async responses from the underlying UsbService.
-  void OnGetDevice(mojo::InterfaceRequest<Device> device_request,
-                   scoped_refptr<UsbDevice> device);
   void OnGetDevicePermissionCheckComplete(
       scoped_refptr<device::UsbDevice> device,
       mojo::InterfaceRequest<Device> device_request,
@@ -71,9 +71,11 @@
                     const GetDevicesCallback& callback,
                     const DeviceList& devices);
 
-  // Methods called by |helper_| when devices are added or removed.
-  void OnDeviceAdded(scoped_refptr<device::UsbDevice> device);
-  void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device);
+  // UsbService::Observer implementation:
+  void OnDeviceAdded(scoped_refptr<device::UsbDevice> device) override;
+  void OnDeviceRemoved(scoped_refptr<device::UsbDevice> device) override;
+  void WillDestroyUsbService() override;
+
   void MaybeRunDeviceChangesCallback();
   void OnEnumerationPermissionCheckComplete(
       const DeviceMap& devices_added,
@@ -81,7 +83,6 @@
       mojo::Array<mojo::String> allowed_guids);
 
   PermissionProviderPtr permission_provider_;
-  scoped_refptr<base::SequencedTaskRunner> service_task_runner_;
 
   // If there are unfinished calls to GetDeviceChanges their callbacks
   // are stored in |device_change_callbacks_|. Otherwise device changes
@@ -94,9 +95,8 @@
   // only perform a single request to |permission_provider_| at a time.
   bool permission_request_pending_ = false;
 
-  // |helper_| is owned by the service thread and holds a weak reference
-  // back to the device manager that created it.
-  ServiceThreadHelper* helper_;
+  UsbService* usb_service_;
+  ScopedObserver<device::UsbService, device::UsbService::Observer> observer_;
 
   mojo::Closure connection_error_handler_;
 
diff --git a/device/devices_app/usb/device_manager_impl_unittest.cc b/device/devices_app/usb/device_manager_impl_unittest.cc
index d4e43c88..ca7e0bd 100644
--- a/device/devices_app/usb/device_manager_impl_unittest.cc
+++ b/device/devices_app/usb/device_manager_impl_unittest.cc
@@ -58,9 +58,8 @@
     PermissionProviderPtr permission_provider;
     permission_provider_.Bind(mojo::GetProxy(&permission_provider));
     DeviceManagerPtr device_manager;
-    new DeviceManagerImpl(mojo::GetProxy(&device_manager),
-                          permission_provider.Pass(),
-                          base::ThreadTaskRunnerHandle::Get());
+    DeviceManagerImpl::Create(permission_provider.Pass(),
+                              mojo::GetProxy(&device_manager));
     return device_manager.Pass();
   }
 
diff --git a/device/test/run_all_unittests.cc b/device/test/run_all_unittests.cc
index 36c936b..9894155 100644
--- a/device/test/run_all_unittests.cc
+++ b/device/test/run_all_unittests.cc
@@ -5,7 +5,7 @@
 #include "base/bind.h"
 #include "base/test/launcher/unit_test_launcher.h"
 #include "base/test/test_suite.h"
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 
 #if defined(OS_ANDROID)
 #include "base/android/jni_android.h"
@@ -19,7 +19,7 @@
 
   base::TestSuite test_suite(argc, argv);
 
-  mojo::embedder::test::InitWithSimplePlatformSupport();
+  mojo::embedder::Init();
   return base::LaunchUnitTests(
       argc,
       argv,
diff --git a/extensions/browser/api/cast_channel/cast_auth_util.cc b/extensions/browser/api/cast_channel/cast_auth_util.cc
index 759ee7d1..10c3775 100644
--- a/extensions/browser/api/cast_channel/cast_auth_util.cc
+++ b/extensions/browser/api/cast_channel/cast_auth_util.cc
@@ -64,7 +64,6 @@
     const cast_crypto::VerificationResult& result) {
   AuthResult translated;
   translated.error_message = result.error_message;
-  translated.nss_error_code = result.library_error_code;
   switch (result.error_type) {
     case cast_crypto::VerificationResult::ERROR_NONE:
       translated.error_type = AuthResult::ERROR_NONE;
@@ -90,8 +89,10 @@
 }  // namespace
 
 AuthResult::AuthResult()
-    : error_type(ERROR_NONE), nss_error_code(0), channel_policies(POLICY_NONE) {
-}
+    : error_type(ERROR_NONE), channel_policies(POLICY_NONE) {}
+
+AuthResult::AuthResult(const std::string& error_message, ErrorType error_type)
+    : error_message(error_message), error_type(error_type) {}
 
 AuthResult::~AuthResult() {
 }
@@ -99,22 +100,7 @@
 // static
 AuthResult AuthResult::CreateWithParseError(const std::string& error_message,
                                             ErrorType error_type) {
-  return AuthResult(kParseErrorPrefix + error_message, error_type, 0);
-}
-
-// static
-AuthResult AuthResult::CreateWithNSSError(const std::string& error_message,
-                                          ErrorType error_type,
-                                          int nss_error_code) {
-  return AuthResult(error_message, error_type, nss_error_code);
-}
-
-AuthResult::AuthResult(const std::string& error_message,
-                       ErrorType error_type,
-                       int nss_error_code)
-    : error_message(error_message),
-      error_type(error_type),
-      nss_error_code(nss_error_code) {
+  return AuthResult(kParseErrorPrefix + error_message, error_type);
 }
 
 AuthResult AuthenticateChallengeReply(const CastMessage& challenge_reply,
diff --git a/extensions/browser/api/cast_channel/cast_auth_util.h b/extensions/browser/api/cast_channel/cast_auth_util.h
index a5005862..e1c07f4d 100644
--- a/extensions/browser/api/cast_channel/cast_auth_util.h
+++ b/extensions/browser/api/cast_channel/cast_auth_util.h
@@ -37,25 +37,19 @@
 
   // Constructs a AuthResult that corresponds to success.
   AuthResult();
+
+  AuthResult(const std::string& error_message, ErrorType error_type);
+
   ~AuthResult();
 
   static AuthResult CreateWithParseError(const std::string& error_message,
                                          ErrorType error_type);
-  static AuthResult CreateWithNSSError(const std::string& error_message,
-                                       ErrorType error_type,
-                                       int nss_error_code);
 
   bool success() const { return error_type == ERROR_NONE; }
 
   std::string error_message;
   ErrorType error_type;
-  int nss_error_code;
   unsigned int channel_policies;
-
- private:
-  AuthResult(const std::string& error_message,
-             ErrorType error_type,
-             int nss_error_code);
 };
 
 // Authenticates the given |challenge_reply|:
diff --git a/extensions/browser/api/cast_channel/cast_channel_api.cc b/extensions/browser/api/cast_channel/cast_channel_api.cc
index 52c4d90a..0b1fa2e 100644
--- a/extensions/browser/api/cast_channel/cast_channel_api.cc
+++ b/extensions/browser/api/cast_channel/cast_channel_api.cc
@@ -90,8 +90,6 @@
   }
   if (last_errors.net_return_value <= 0)
     error_info->net_return_value.reset(new int(last_errors.net_return_value));
-  if (last_errors.nss_error_code < 0)
-    error_info->nss_error_code.reset(new int(last_errors.nss_error_code));
 }
 
 bool IsValidConnectInfoPort(const ConnectInfo& connect_info) {
diff --git a/extensions/browser/api/cast_channel/logger.cc b/extensions/browser/api/cast_channel/logger.cc
index 77b281f0..e6d3a77f 100644
--- a/extensions/browser/api/cast_channel/logger.cc
+++ b/extensions/browser/api/cast_channel/logger.cc
@@ -115,10 +115,6 @@
         event.challenge_reply_error_type();
     last_errors->event_type = event.type();
   }
-  if (event.has_nss_error_code()) {
-    last_errors->nss_error_code = event.nss_error_code();
-    last_errors->event_type = event.type();
-  }
 }
 
 }  // namespace
@@ -265,8 +261,6 @@
   SocketEvent event = CreateEvent(proto::AUTH_CHALLENGE_REPLY);
   event.set_challenge_reply_error_type(
       ChallegeReplyErrorToProto(auth_result.error_type));
-  if (auth_result.nss_error_code != 0)
-    event.set_nss_error_code(auth_result.nss_error_code);
 
   LogSocketEvent(channel_id, event);
 }
diff --git a/extensions/browser/api/cast_channel/logger_unittest.cc b/extensions/browser/api/cast_channel/logger_unittest.cc
index b3a40adb..13e00b7 100644
--- a/extensions/browser/api/cast_channel/logger_unittest.cc
+++ b/extensions/browser/api/cast_channel/logger_unittest.cc
@@ -16,8 +16,6 @@
 namespace api {
 namespace cast_channel {
 
-const int kTestNssErrorCode = -8164;
-
 using proto::AggregatedSocketEvent;
 using proto::EventType;
 using proto::Log;
@@ -107,9 +105,7 @@
   clock_->Advance(base::TimeDelta::FromMicroseconds(1));
 
   auth_result =
-      AuthResult::CreateWithNSSError("Parsing failed",
-                                     AuthResult::ERROR_CERT_PARSING_FAILED,
-                                     kTestNssErrorCode);
+      AuthResult("Parsing failed", AuthResult::ERROR_CERT_PARSING_FAILED);
   logger_->LogSocketChallengeReplyEvent(2, auth_result);
 
   LastErrors last_errors = logger_->GetLastErrors(2);
@@ -117,7 +113,6 @@
   EXPECT_EQ(last_errors.net_return_value, net::OK);
   EXPECT_EQ(last_errors.challenge_reply_error_type,
             proto::CHALLENGE_REPLY_ERROR_CERT_PARSING_FAILED);
-  EXPECT_EQ(last_errors.nss_error_code, kTestNssErrorCode);
 
   scoped_ptr<Log> log = GetLog();
   ASSERT_TRUE(log);
@@ -179,7 +174,7 @@
       EXPECT_EQ(proto::CHALLENGE_REPLY_ERROR_CERT_PARSING_FAILED,
                 event.challenge_reply_error_type());
       EXPECT_FALSE(event.has_net_return_value());
-      EXPECT_EQ(kTestNssErrorCode, event.nss_error_code());
+      EXPECT_FALSE(event.has_nss_error_code());
     }
   }
 }
@@ -212,21 +207,16 @@
   EXPECT_EQ(last_errors.net_return_value, net::OK);
   EXPECT_EQ(last_errors.challenge_reply_error_type,
             proto::CHALLENGE_REPLY_ERROR_NONE);
-  EXPECT_EQ(last_errors.nss_error_code, 0);
 
-  // Now log a challenge reply error with NSS error code.  LastErrors will be
-  // set.
+  // Now log a challenge reply error.  LastErrors will be set.
   clock_->Advance(base::TimeDelta::FromMicroseconds(1));
-  auth_result = AuthResult::CreateWithNSSError(
-      "Some error",
-      AuthResult::ErrorType::ERROR_WRONG_PAYLOAD_TYPE,
-      kTestNssErrorCode);
+  auth_result =
+      AuthResult("Some error failed", AuthResult::ERROR_WRONG_PAYLOAD_TYPE);
   logger_->LogSocketChallengeReplyEvent(3, auth_result);
   last_errors = logger_->GetLastErrors(3);
   EXPECT_EQ(last_errors.event_type, proto::AUTH_CHALLENGE_REPLY);
   EXPECT_EQ(last_errors.challenge_reply_error_type,
             proto::CHALLENGE_REPLY_ERROR_WRONG_PAYLOAD_TYPE);
-  EXPECT_EQ(last_errors.nss_error_code, kTestNssErrorCode);
 
   // Logging a non-error event does not change the LastErrors for the channel.
   clock_->Advance(base::TimeDelta::FromMicroseconds(1));
@@ -235,7 +225,6 @@
   EXPECT_EQ(last_errors.event_type, proto::AUTH_CHALLENGE_REPLY);
   EXPECT_EQ(last_errors.challenge_reply_error_type,
             proto::CHALLENGE_REPLY_ERROR_WRONG_PAYLOAD_TYPE);
-  EXPECT_EQ(last_errors.nss_error_code, kTestNssErrorCode);
 }
 
 TEST_F(CastChannelLoggerTest, LogSocketReadWrite) {
diff --git a/extensions/browser/api/cast_channel/logger_util.cc b/extensions/browser/api/cast_channel/logger_util.cc
index db5f201..35e2c10 100644
--- a/extensions/browser/api/cast_channel/logger_util.cc
+++ b/extensions/browser/api/cast_channel/logger_util.cc
@@ -12,9 +12,7 @@
 LastErrors::LastErrors()
     : event_type(proto::EVENT_TYPE_UNKNOWN),
       challenge_reply_error_type(proto::CHALLENGE_REPLY_ERROR_NONE),
-      net_return_value(net::OK),
-      nss_error_code(0) {
-}
+      net_return_value(net::OK) {}
 
 LastErrors::~LastErrors() {
 }
diff --git a/extensions/browser/api/cast_channel/logger_util.h b/extensions/browser/api/cast_channel/logger_util.h
index 2a9f2935..2b5de5b 100644
--- a/extensions/browser/api/cast_channel/logger_util.h
+++ b/extensions/browser/api/cast_channel/logger_util.h
@@ -31,9 +31,6 @@
 
   // The most recent net_return_value logged for the socket.
   int net_return_value;
-
-  // The most recent NSS error logged for the socket.
-  int nss_error_code;
 };
 
 }  // namespace cast_channel
diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h
index 3c918e2..afaec45 100644
--- a/extensions/browser/extension_function_histogram_value.h
+++ b/extensions/browser/extension_function_histogram_value.h
@@ -1151,6 +1151,7 @@
   EASYUNLOCKPRIVATE_SETUPCONNECTIONSEND,
   DATAREDUCTIONPROXY_GETDATAUSAGE,
   EASYUNLOCKPRIVATE_SETUPCONNECTIONGETDEVICEADDRESS,
+  TABCAPTURE_CAPTUREOFFSCREENTAB,
   // Last entry: Add new entries above, then run:
   // python tools/metrics/histograms/update_extension_histograms.py
   ENUM_BOUNDARY
diff --git a/extensions/common/BUILD.gn b/extensions/common/BUILD.gn
index c76d9b1..3a557d3 100644
--- a/extensions/common/BUILD.gn
+++ b/extensions/common/BUILD.gn
@@ -60,6 +60,7 @@
       "//extensions:extensions_resources",
       "//ipc",
       "//net",
+      "//third_party/boringssl",
       "//third_party/icu",
       "//third_party/libxml",
       "//third_party/re2",
@@ -69,19 +70,6 @@
       "//url",
     ]
 
-    if (use_openssl) {
-      sources +=
-          rebase_path(extensions_gypi_values.extensions_common_sources_openssl,
-                      ".",
-                      "//extensions")
-      deps += [ "//third_party/boringssl" ]
-    } else {
-      sources += rebase_path(
-              extensions_gypi_values.extensions_common_sources_nonopenssl,
-              ".",
-              "//extensions")
-    }
-
     if (enable_nacl) {
       nacl_sources =
           rebase_path(extensions_gypi_values.extensions_common_sources_nacl,
diff --git a/extensions/common/api/cast_channel/logging.proto b/extensions/common/api/cast_channel/logging.proto
index a629aee..6ac52e4 100644
--- a/extensions/common/api/cast_channel/logging.proto
+++ b/extensions/common/api/cast_channel/logging.proto
@@ -142,6 +142,7 @@
   optional ErrorState error_state = 10;
 
   optional ChallengeReplyErrorType challenge_reply_error_type = 11;
+  // No longer used.
   optional int32 nss_error_code = 12;
 }
 
diff --git a/extensions/common/cast/cast_cert_validator.cc b/extensions/common/cast/cast_cert_validator.cc
index cdd803aec..5bf7300 100644
--- a/extensions/common/cast/cast_cert_validator.cc
+++ b/extensions/common/cast/cast_cert_validator.cc
@@ -4,27 +4,156 @@
 
 #include "extensions/common/cast/cast_cert_validator.h"
 
+#include <openssl/digest.h>
+#include <openssl/evp.h>
+#include <openssl/rsa.h>
+#include <openssl/x509.h>
+
+#include "base/logging.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
+#include "crypto/openssl_util.h"
+#include "crypto/scoped_openssl_types.h"
 #include "extensions/browser/api/cast_channel/cast_auth_ica.h"
+#include "net/cert/x509_certificate.h"
+#include "net/cert/x509_util_openssl.h"
+#include "net/ssl/scoped_openssl_types.h"
 
 namespace extensions {
 namespace api {
 namespace cast_crypto {
+namespace {
 
-VerificationResult::VerificationResult()
-    : VerificationResult("", ERROR_NONE, 0) {
-}
+class CertVerificationContextImpl : public CertVerificationContext {
+ public:
+  // Takes ownership of the passed-in x509 object
+  explicit CertVerificationContextImpl(net::ScopedX509 x509)
+      : x509_(x509.Pass()) {}
+
+  VerificationResult VerifySignatureOverData(
+      const base::StringPiece& signature,
+      const base::StringPiece& data) const override {
+    // Retrieve public key object.
+    crypto::ScopedEVP_PKEY public_key(X509_get_pubkey(x509_.get()));
+    if (!public_key) {
+      return VerificationResult(
+          "Failed to extract device certificate public key.",
+          VerificationResult::ERROR_CERT_INVALID);
+    }
+    // Make sure the key is RSA.
+    const int public_key_type = EVP_PKEY_id(public_key.get());
+    if (public_key_type != EVP_PKEY_RSA) {
+      return VerificationResult(
+          std::string("Expected RSA key type for client certificate, got ") +
+              base::IntToString(public_key_type) + " instead.",
+          VerificationResult::ERROR_CERT_INVALID);
+    }
+    // Verify signature.
+    const crypto::ScopedEVP_MD_CTX ctx(EVP_MD_CTX_create());
+    if (!ctx ||
+        !EVP_DigestVerifyInit(ctx.get(), nullptr, EVP_sha1(), nullptr,
+                              public_key.get()) ||
+        !EVP_DigestVerifyUpdate(ctx.get(), data.data(), data.size()) ||
+        !EVP_DigestVerifyFinal(
+            ctx.get(), reinterpret_cast<const uint8_t*>(signature.data()),
+            signature.size())) {
+      return VerificationResult("Signature verification failed.",
+                                VerificationResult::ERROR_SIGNATURE_INVALID);
+    }
+    return VerificationResult();
+  }
+
+  std::string GetCommonName() const override {
+    int common_name_length = X509_NAME_get_text_by_NID(
+        x509_->cert_info->subject, NID_commonName, NULL, 0);
+    if (common_name_length < 0)
+      return std::string();
+    std::string common_name;
+    common_name_length = X509_NAME_get_text_by_NID(
+        x509_->cert_info->subject, NID_commonName,
+        base::WriteInto(&common_name,
+                        static_cast<size_t>(common_name_length) + 1),
+        common_name_length + 1);
+    if (common_name_length < 0)
+      return std::string();
+    return common_name;
+  }
+
+ private:
+  net::ScopedX509 x509_;
+};
+
+}  // namespace
+
+VerificationResult::VerificationResult() : VerificationResult("", ERROR_NONE) {}
 
 VerificationResult::VerificationResult(const std::string& in_error_message,
                                        ErrorType in_error_type)
-    : VerificationResult(in_error_message, in_error_type, 0) {
-}
+    : error_type(in_error_type), error_message(in_error_message) {}
 
-VerificationResult::VerificationResult(const std::string& in_error_message,
-                                       ErrorType in_error_type,
-                                       int in_error_code)
-    : error_type(in_error_type),
-      error_message(in_error_message),
-      library_error_code(in_error_code) {
+VerificationResult VerifyDeviceCert(
+    const base::StringPiece& device_cert,
+    const std::vector<std::string>& ica_certs,
+    scoped_ptr<CertVerificationContext>* context) {
+  crypto::EnsureOpenSSLInit();
+  crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
+
+  // If the list of intermediates is empty then use kPublicKeyICA1 as
+  // the trusted CA (legacy case).
+  // Otherwise, use the first intermediate in the list as long as it
+  // is in the allowed list of intermediates.
+  base::StringPiece ica_public_key_der =
+      (ica_certs.size() == 0)
+          ? cast_channel::GetDefaultTrustedICAPublicKey()
+          : cast_channel::GetTrustedICAPublicKey(ica_certs[0]);
+
+  if (ica_public_key_der.empty()) {
+    return VerificationResult(
+        "Device certificate is not signed by a trusted CA",
+        VerificationResult::ERROR_CERT_UNTRUSTED);
+  }
+
+  // Initialize the ICA public key.
+  const uint8_t* ica_public_key_der_ptr =
+      reinterpret_cast<const uint8_t*>(ica_public_key_der.data());
+  const uint8_t* ica_public_key_der_end =
+      ica_public_key_der_ptr + ica_public_key_der.size();
+  crypto::ScopedRSA ica_public_key_rsa(d2i_RSAPublicKey(
+      NULL, &ica_public_key_der_ptr, ica_public_key_der.size()));
+  if (!ica_public_key_rsa || ica_public_key_der_ptr != ica_public_key_der_end) {
+    return VerificationResult("Failed to import trusted public key.",
+                              VerificationResult::ERROR_INTERNAL);
+  }
+  crypto::ScopedEVP_PKEY ica_public_key_evp(EVP_PKEY_new());
+  if (!ica_public_key_evp ||
+      !EVP_PKEY_set1_RSA(ica_public_key_evp.get(), ica_public_key_rsa.get())) {
+    return VerificationResult("Failed to import trusted public key.",
+                              VerificationResult::ERROR_INTERNAL);
+  }
+
+  // Parse the device certificate.
+  const uint8_t* device_cert_der_ptr =
+      reinterpret_cast<const uint8_t*>(device_cert.data());
+  const uint8_t* device_cert_der_end = device_cert_der_ptr + device_cert.size();
+  net::ScopedX509 device_cert_x509(
+      d2i_X509(NULL, &device_cert_der_ptr, device_cert.size()));
+  if (!device_cert_x509 || device_cert_der_ptr != device_cert_der_end) {
+    return VerificationResult("Failed to parse device certificate.",
+                              VerificationResult::ERROR_CERT_INVALID);
+  }
+
+  // Verify device certificate.
+  if (X509_verify(device_cert_x509.get(), ica_public_key_evp.get()) != 1) {
+    return VerificationResult(
+        "Device certificate signature verification failed.",
+        VerificationResult::ERROR_CERT_INVALID);
+  }
+
+  if (context)
+    context->reset(new CertVerificationContextImpl(device_cert_x509.Pass()));
+
+  return VerificationResult();
 }
 
 bool SetTrustedCertificateAuthoritiesForTest(const std::string& keys,
diff --git a/extensions/common/cast/cast_cert_validator.h b/extensions/common/cast/cast_cert_validator.h
index 720fff56..8a37fa1 100644
--- a/extensions/common/cast/cast_cert_validator.h
+++ b/extensions/common/cast/cast_cert_validator.h
@@ -39,25 +39,17 @@
 
   // Construct error-related objects
   VerificationResult(const std::string& error_message, ErrorType error_type);
-  VerificationResult(const std::string& error_message,
-                     ErrorType error_type,
-                     int error_code);
 
   bool Success() const { return error_type == ERROR_NONE; }
   bool Failure() const { return error_type != ERROR_NONE; }
 
-  // Generates a string representation of this object for logging.
-  std::string GetLogString() const;
-
   ErrorType error_type;
   // Human-readable description of the problem if error_type != ERROR_NONE
   std::string error_message;
-  // May contain the underlying crypto library error code.
-  int library_error_code;
 };
 
-// An object of this type is returned by the VerifyCert function, and can be
-// used for additional certificate-related operations, using the verified
+// An object of this type is returned by the VerifyDeviceCert function, and can
+// be used for additional certificate-related operations, using the verified
 // certificate.
 class CertVerificationContext {
  public:
diff --git a/extensions/common/cast/cast_cert_validator_nss.cc b/extensions/common/cast/cast_cert_validator_nss.cc
deleted file mode 100644
index 47b76482..0000000
--- a/extensions/common/cast/cast_cert_validator_nss.cc
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "extensions/common/cast/cast_cert_validator.h"
-
-#include <cert.h>
-#include <cryptohi.h>
-#include <pk11pub.h>
-#include <seccomon.h>
-
-#include "base/logging.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/strings/string_number_conversions.h"
-#include "crypto/nss_util.h"
-#include "crypto/scoped_nss_types.h"
-#include "extensions/browser/api/cast_channel/cast_auth_ica.h"
-
-namespace extensions {
-namespace api {
-namespace cast_crypto {
-
-namespace {
-
-typedef scoped_ptr<
-    CERTCertificate,
-    crypto::NSSDestroyer<CERTCertificate, CERT_DestroyCertificate>>
-    ScopedCERTCertificate;
-
-class CertVerificationContextNSS : public CertVerificationContext {
- public:
-  explicit CertVerificationContextNSS(CERTCertificate* certificate)
-      : certificate_(certificate) {}
-
-  VerificationResult VerifySignatureOverData(
-      const base::StringPiece& signature,
-      const base::StringPiece& data) const override {
-    // Retrieve public key object
-    crypto::ScopedSECKEYPublicKey public_key_obj(
-        CERT_ExtractPublicKey(certificate_.get()));
-    if (!public_key_obj.get()) {
-      return VerificationResult(
-          "Failed to extract device certificate public key.",
-          VerificationResult::ERROR_CERT_INVALID);
-    }
-    // Verify signature.
-    SECItem signature_item;
-    signature_item.type = siBuffer;
-    signature_item.data =
-        reinterpret_cast<unsigned char*>(const_cast<char*>(signature.data()));
-    signature_item.len = signature.length();
-    if (VFY_VerifyDataDirect(
-            reinterpret_cast<unsigned char*>(const_cast<char*>(data.data())),
-            data.size(), public_key_obj.get(), &signature_item,
-            SEC_OID_PKCS1_RSA_ENCRYPTION, SEC_OID_SHA1, NULL,
-            NULL) != SECSuccess) {
-      return VerificationResult("Signature verification failed.",
-                                VerificationResult::ERROR_SIGNATURE_INVALID,
-                                PORT_GetError());
-    }
-    return VerificationResult();
-  }
-
-  std::string GetCommonName() const override {
-    char* common_name = CERT_GetCommonName(&certificate_->subject);
-    if (!common_name)
-      return std::string();
-
-    std::string result(common_name);
-    PORT_Free(common_name);
-    return result;
-  }
-
- private:
-  ScopedCERTCertificate certificate_;
-};
-
-}  // namespace
-
-VerificationResult VerifyDeviceCert(
-    const base::StringPiece& device_cert,
-    const std::vector<std::string>& ica_certs,
-    scoped_ptr<CertVerificationContext>* context) {
-  crypto::EnsureNSSInit();
-
-  // If the list of intermediates is empty then use kPublicKeyICA1 as
-  // the trusted CA (legacy case).
-  // Otherwise, use the first intermediate in the list as long as it
-  // is in the allowed list of intermediates.
-  base::StringPiece ica_public_key_der =
-      (ica_certs.size() == 0)
-          ? cast_channel::GetDefaultTrustedICAPublicKey()
-          : cast_channel::GetTrustedICAPublicKey(ica_certs[0]);
-
-  if (ica_public_key_der.empty()) {
-    return VerificationResult(
-        "Device certificate is not signed by a trusted CA",
-        VerificationResult::ERROR_CERT_UNTRUSTED);
-  }
-  // Initialize the ICA public key.
-  SECItem ica_public_key_der_item;
-  ica_public_key_der_item.type = SECItemType::siDERCertBuffer;
-  ica_public_key_der_item.data = const_cast<uint8_t*>(
-      reinterpret_cast<const uint8_t*>(ica_public_key_der.data()));
-  ica_public_key_der_item.len = ica_public_key_der.size();
-
-  crypto::ScopedSECKEYPublicKey ica_public_key_obj(
-      SECKEY_ImportDERPublicKey(&ica_public_key_der_item, CKK_RSA));
-  if (!ica_public_key_obj) {
-    return VerificationResult("Failed to import trusted public key.",
-                              VerificationResult::ERROR_INTERNAL,
-                              PORT_GetError());
-  }
-  SECItem device_cert_der_item;
-  device_cert_der_item.type = siDERCertBuffer;
-  // Make a copy of certificate string so it is safe to type cast.
-  device_cert_der_item.data =
-      reinterpret_cast<unsigned char*>(const_cast<char*>(device_cert.data()));
-  device_cert_der_item.len = device_cert.length();
-
-  // Parse into a certificate structure.
-  ScopedCERTCertificate device_cert_obj(CERT_NewTempCertificate(
-      CERT_GetDefaultCertDB(), &device_cert_der_item, NULL, PR_FALSE, PR_TRUE));
-  if (!device_cert_obj.get()) {
-    return VerificationResult("Failed to parse device certificate.",
-                              VerificationResult::ERROR_CERT_INVALID,
-                              PORT_GetError());
-  }
-  if (CERT_VerifySignedDataWithPublicKey(&device_cert_obj->signatureWrap,
-                                         ica_public_key_obj.get(),
-                                         NULL) != SECSuccess) {
-    return VerificationResult("Signature verification failed.",
-                              VerificationResult::ERROR_SIGNATURE_INVALID,
-                              PORT_GetError());
-  }
-  if (context) {
-    scoped_ptr<CertVerificationContext> tmp_context(
-        new CertVerificationContextNSS(device_cert_obj.release()));
-    tmp_context.swap(*context);
-  }
-
-  return VerificationResult();
-}
-
-std::string VerificationResult::GetLogString() const {
-  std::string nssError = "NSS Error Code: ";
-  nssError += base::IntToString(library_error_code);
-  return error_message.size()
-             ? std::string("Error: ") + error_message + ", " + nssError
-             : nssError;
-}
-
-}  // namespace cast_crypto
-}  // namespace api
-}  // namespace extensions
diff --git a/extensions/common/cast/cast_cert_validator_openssl.cc b/extensions/common/cast/cast_cert_validator_openssl.cc
deleted file mode 100644
index 4e0e08b..0000000
--- a/extensions/common/cast/cast_cert_validator_openssl.cc
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "extensions/common/cast/cast_cert_validator.h"
-
-#include <openssl/digest.h>
-#include <openssl/evp.h>
-#include <openssl/rsa.h>
-#include <openssl/x509.h>
-
-#include "base/logging.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/string_util.h"
-#include "base/strings/stringprintf.h"
-#include "crypto/openssl_util.h"
-#include "crypto/scoped_openssl_types.h"
-#include "extensions/browser/api/cast_channel/cast_auth_ica.h"
-#include "net/cert/x509_certificate.h"
-#include "net/cert/x509_util_openssl.h"
-#include "net/ssl/scoped_openssl_types.h"
-
-namespace extensions {
-namespace api {
-namespace cast_crypto {
-namespace {
-
-class CertVerificationContextOpenSSL : public CertVerificationContext {
- public:
-  // Takes ownership of the passed-in x509 object
-  explicit CertVerificationContextOpenSSL(X509* x509) : x509_(x509) {}
-
-  VerificationResult VerifySignatureOverData(
-      const base::StringPiece& signature,
-      const base::StringPiece& data) const override {
-    // Retrieve public key object.
-    crypto::ScopedEVP_PKEY public_key(X509_get_pubkey(x509_.get()));
-    if (!public_key) {
-      return VerificationResult(
-          "Failed to extract device certificate public key.",
-          VerificationResult::ERROR_CERT_INVALID);
-    }
-    // Make sure the key is RSA.
-    const int public_key_type = EVP_PKEY_id(public_key.get());
-    if (public_key_type != EVP_PKEY_RSA) {
-      return VerificationResult(
-          std::string("Expected RSA key type for client certificate, got ") +
-              base::IntToString(public_key_type) + " instead.",
-          VerificationResult::ERROR_CERT_INVALID);
-    }
-    // Verify signature.
-    const crypto::ScopedEVP_MD_CTX ctx(EVP_MD_CTX_create());
-    if (!ctx ||
-        !EVP_DigestVerifyInit(ctx.get(), NULL, EVP_sha1(), NULL,
-                              public_key.get()) ||
-        !EVP_DigestVerifyUpdate(ctx.get(), data.data(), data.size()) ||
-        !EVP_DigestVerifyFinal(
-            ctx.get(), reinterpret_cast<const uint8_t*>(signature.data()),
-            signature.size())) {
-      return VerificationResult("Signature verification failed.",
-                                VerificationResult::ERROR_SIGNATURE_INVALID);
-    }
-    return VerificationResult();
-  }
-
-  std::string GetCommonName() const override {
-    int common_name_length = X509_NAME_get_text_by_NID(
-        x509_->cert_info->subject, NID_commonName, NULL, 0);
-    if (common_name_length < 0)
-      return std::string();
-    std::string common_name;
-    common_name_length = X509_NAME_get_text_by_NID(
-        x509_->cert_info->subject, NID_commonName,
-        base::WriteInto(&common_name,
-                        static_cast<size_t>(common_name_length) + 1),
-        common_name_length + 1);
-    if (common_name_length < 0)
-      return std::string();
-    return common_name;
-  }
-
- private:
-  net::ScopedX509 x509_;
-};
-
-}  // namespace
-
-VerificationResult VerifyDeviceCert(
-    const base::StringPiece& device_cert,
-    const std::vector<std::string>& ica_certs,
-    scoped_ptr<CertVerificationContext>* context) {
-  crypto::EnsureOpenSSLInit();
-  crypto::OpenSSLErrStackTracer err_tracer(FROM_HERE);
-
-  // If the list of intermediates is empty then use kPublicKeyICA1 as
-  // the trusted CA (legacy case).
-  // Otherwise, use the first intermediate in the list as long as it
-  // is in the allowed list of intermediates.
-  base::StringPiece ica_public_key_der =
-      (ica_certs.size() == 0)
-          ? cast_channel::GetDefaultTrustedICAPublicKey()
-          : cast_channel::GetTrustedICAPublicKey(ica_certs[0]);
-
-  if (ica_public_key_der.empty()) {
-    return VerificationResult(
-        "Device certificate is not signed by a trusted CA",
-        VerificationResult::ERROR_CERT_UNTRUSTED);
-  }
-  // Initialize the ICA public key.
-  const uint8_t* ica_public_key_der_ptr =
-      reinterpret_cast<const uint8_t*>(ica_public_key_der.data());
-  const uint8_t* ica_public_key_der_end =
-      ica_public_key_der_ptr + ica_public_key_der.size();
-  crypto::ScopedRSA ica_public_key_rsa(d2i_RSAPublicKey(
-      NULL, &ica_public_key_der_ptr, ica_public_key_der.size()));
-  if (!ica_public_key_rsa || ica_public_key_der_ptr != ica_public_key_der_end) {
-    return VerificationResult("Failed to import trusted public key.",
-                              VerificationResult::ERROR_INTERNAL);
-  }
-  crypto::ScopedEVP_PKEY ica_public_key_evp(EVP_PKEY_new());
-  if (!ica_public_key_evp ||
-      !EVP_PKEY_set1_RSA(ica_public_key_evp.get(), ica_public_key_rsa.get())) {
-    return VerificationResult("Failed to import trusted public key.",
-                              VerificationResult::ERROR_INTERNAL);
-  }
-  // Parse the device certificate.
-  const uint8_t* device_cert_der_ptr =
-      reinterpret_cast<const uint8_t*>(device_cert.data());
-  const uint8_t* device_cert_der_end = device_cert_der_ptr + device_cert.size();
-  net::ScopedX509 device_cert_x509(
-      d2i_X509(NULL, &device_cert_der_ptr, device_cert.size()));
-  if (!device_cert_x509 || device_cert_der_ptr != device_cert_der_end) {
-    return VerificationResult("Failed to parse device certificate.",
-                              VerificationResult::ERROR_CERT_INVALID);
-  }
-  // Verify device certificate.
-  if (X509_verify(device_cert_x509.get(), ica_public_key_evp.get()) != 1) {
-    return VerificationResult(
-        "Device certificate signature verification failed.",
-        VerificationResult::ERROR_CERT_INVALID);
-  }
-
-  if (context) {
-    scoped_ptr<CertVerificationContext> tmp_context(
-        new CertVerificationContextOpenSSL(device_cert_x509.release()));
-    tmp_context.swap(*context);
-  }
-
-  return VerificationResult();
-}
-
-std::string VerificationResult::GetLogString() const {
-  return error_message;
-}
-
-}  // namespace cast_crypto
-}  // namespace api
-}  // namespace extensions
diff --git a/extensions/components/native_app_window/native_app_window_views.cc b/extensions/components/native_app_window/native_app_window_views.cc
index 75188cea..b060233b 100644
--- a/extensions/components/native_app_window/native_app_window_views.cc
+++ b/extensions/components/native_app_window/native_app_window_views.cc
@@ -274,6 +274,12 @@
 
 // WidgetObserver implementation.
 
+void NativeAppWindowViews::OnWidgetDestroying(views::Widget* widget) {
+  FOR_EACH_OBSERVER(web_modal::ModalDialogHostObserver,
+                    observer_list_,
+                    OnHostDestroying());
+}
+
 void NativeAppWindowViews::OnWidgetVisibilityChanged(views::Widget* widget,
                                                      bool visible) {
   app_window_->OnNativeWindowChanged();
diff --git a/extensions/components/native_app_window/native_app_window_views.h b/extensions/components/native_app_window/native_app_window_views.h
index 8073794..576e9f6b 100644
--- a/extensions/components/native_app_window/native_app_window_views.h
+++ b/extensions/components/native_app_window/native_app_window_views.h
@@ -115,6 +115,7 @@
       const gfx::Point& location) override;
 
   // WidgetObserver implementation.
+  void OnWidgetDestroying(views::Widget* widget) override;
   void OnWidgetVisibilityChanged(views::Widget* widget, bool visible) override;
   void OnWidgetActivationChanged(views::Widget* widget, bool active) override;
 
diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp
index 6e807d43..c7976da 100644
--- a/extensions/extensions.gyp
+++ b/extensions/extensions.gyp
@@ -59,6 +59,7 @@
         '../ui/gfx/gfx.gyp:gfx_geometry',
         '../ui/gfx/ipc/gfx_ipc.gyp:gfx_ipc',
         '../url/url.gyp:url_lib',
+        '../third_party/boringssl/boringssl.gyp:boringssl',
         '../third_party/libxml/libxml.gyp:libxml',
         'common/api/api.gyp:extensions_api',
         'extensions_resources.gyp:extensions_resources',
@@ -90,31 +91,6 @@
             '<@(extensions_common_sources_nacl)',
           ],
         }],
-        ['use_openssl==1', {
-          'sources': [
-            '<@(extensions_common_sources_openssl)',
-          ],
-          'dependencies': [
-            '../third_party/boringssl/boringssl.gyp:boringssl',
-          ],
-        }, {
-          'sources': [
-            '<@(extensions_common_sources_nonopenssl)'
-          ],
-          'conditions': [
-            ['os_posix == 1 and OS != "mac" and OS != "ios" and OS != "android"', {
-              'dependencies': [
-                '../build/linux/system.gyp:ssl',
-              ],
-            }],
-            ['OS == "mac" or OS == "ios" or OS == "win"', {
-              'dependencies': [
-                '../third_party/nss/nss.gyp:nspr',
-                '../third_party/nss/nss.gyp:nss',
-              ],
-            }],
-          ],
-        }],
       ],
     },
     {
diff --git a/extensions/extensions.gypi b/extensions/extensions.gypi
index 575ed02a..450a943 100644
--- a/extensions/extensions.gypi
+++ b/extensions/extensions.gypi
@@ -228,12 +228,6 @@
       'common/manifest_handlers/nacl_modules_handler.cc',
       'common/manifest_handlers/nacl_modules_handler.h',
     ],
-    'extensions_common_sources_openssl': [
-      'common/cast/cast_cert_validator_openssl.cc',
-    ],
-    'extensions_common_sources_nonopenssl': [
-      'common/cast/cast_cert_validator_nss.cc',
-    ],
     'extensions_browser_sources': [
       # NOTE: When moving an API out of Chrome be sure to verify that the
       # Android build still compiles. See conditions below.
@@ -947,7 +941,6 @@
       'renderer/resources/storage_area.js',
       'renderer/resources/test_custom_bindings.js',
       'renderer/resources/uncaught_exception_handler.js',
-      'renderer/resources/unload_event.js',
       'renderer/resources/utils.js',
       'renderer/resources/guest_view/app_view/app_view.js',
       'renderer/resources/guest_view/extension_options/extension_options.js',
diff --git a/extensions/renderer/api/serial/serial_api_unittest.cc b/extensions/renderer/api/serial/serial_api_unittest.cc
index 8ba15f0..f90fe761f 100644
--- a/extensions/renderer/api/serial/serial_api_unittest.cc
+++ b/extensions/renderer/api/serial/serial_api_unittest.cc
@@ -682,21 +682,22 @@
   RunTest("serial_unittest.js", "testSendUnknownConnectionId");
 }
 
-TEST_F(SerialApiTest, StashAndRestoreDuringEcho) {
+// Note: these tests are disabled, since there is no good story for persisting
+// the stashed handles when an extension process is shut down. See
+// https://crbug.com/538774
+TEST_F(SerialApiTest, DISABLED_StashAndRestoreDuringEcho) {
   ASSERT_NO_FATAL_FAILURE(RunTest("serial_unittest.js", "testSendAndStash"));
-  env()->context()->DispatchOnUnloadEvent();
   scoped_ptr<ModuleSystemTestEnvironment> new_env(CreateEnvironment());
   ApiTestEnvironment new_api_test_env(new_env.get());
   PrepareEnvironment(&new_api_test_env, stash_backend_.get());
   new_api_test_env.RunTest("serial_unittest.js", "testRestoreAndReceive");
 }
 
-TEST_F(SerialApiTest, StashAndRestoreDuringEchoError) {
+TEST_F(SerialApiTest, DISABLED_StashAndRestoreDuringEchoError) {
   io_handler_ =
       new ReceiveErrorTestIoHandler(device::serial::RECEIVE_ERROR_DEVICE_LOST);
   ASSERT_NO_FATAL_FAILURE(
       RunTest("serial_unittest.js", "testRestoreAndReceiveErrorSetUp"));
-  env()->context()->DispatchOnUnloadEvent();
   scoped_ptr<ModuleSystemTestEnvironment> new_env(CreateEnvironment());
   ApiTestEnvironment new_api_test_env(new_env.get());
   PrepareEnvironment(&new_api_test_env, stash_backend_.get());
@@ -706,7 +707,6 @@
 TEST_F(SerialApiTest, StashAndRestoreNoConnections) {
   ASSERT_NO_FATAL_FAILURE(
       RunTest("serial_unittest.js", "testStashNoConnections"));
-  env()->context()->DispatchOnUnloadEvent();
   io_handler_ = nullptr;
   scoped_ptr<ModuleSystemTestEnvironment> new_env(CreateEnvironment());
   ApiTestEnvironment new_api_test_env(new_env.get());
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index fa475ca..fa73ccc 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -427,7 +427,6 @@
   if (!context)
     return;
 
-  context->DispatchOnUnloadEvent();
   // TODO(kalman): Make |request_sender| use |context->AddInvalidationObserver|.
   // In fact |request_sender_| should really be owned by ScriptContext.
   request_sender_->InvalidateSource(context);
@@ -619,7 +618,6 @@
                      IDR_BROWSER_TEST_ENVIRONMENT_SPECIFIC_BINDINGS_JS));
   resources.push_back(std::make_pair("uncaught_exception_handler",
                                      IDR_UNCAUGHT_EXCEPTION_HANDLER_JS));
-  resources.push_back(std::make_pair("unload_event", IDR_UNLOAD_EVENT_JS));
   resources.push_back(std::make_pair("utils", IDR_UTILS_JS));
   resources.push_back(std::make_pair("webRequest",
                                      IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS));
diff --git a/extensions/renderer/mojo/stash_client_unittest.cc b/extensions/renderer/mojo/stash_client_unittest.cc
index ec3dc3f..f8076cd 100644
--- a/extensions/renderer/mojo/stash_client_unittest.cc
+++ b/extensions/renderer/mojo/stash_client_unittest.cc
@@ -39,7 +39,6 @@
 // Test that stashing and restoring work correctly.
 TEST_F(StashClientTest, StashAndRestore) {
   ASSERT_NO_FATAL_FAILURE(RunTest("stash_client_unittest.js", "testStash"));
-  env()->context()->DispatchOnUnloadEvent();
   scoped_ptr<ModuleSystemTestEnvironment> restore_test_env(CreateEnvironment());
   ApiTestEnvironment restore_environment(restore_test_env.get());
   PrepareEnvironment(&restore_environment);
diff --git a/extensions/renderer/programmatic_script_injector.cc b/extensions/renderer/programmatic_script_injector.cc
index 3c9b938..97d68a6d 100644
--- a/extensions/renderer/programmatic_script_injector.cc
+++ b/extensions/renderer/programmatic_script_injector.cc
@@ -9,7 +9,6 @@
 #include "base/values.h"
 #include "content/public/common/url_constants.h"
 #include "content/public/renderer/render_frame.h"
-#include "content/public/renderer/render_frame_observer.h"
 #include "extensions/common/error_utils.h"
 #include "extensions/common/extension_messages.h"
 #include "extensions/common/manifest_constants.h"
@@ -23,33 +22,12 @@
 
 namespace extensions {
 
-// Watches for the deletion of a RenderFrame, after which is_valid will return
-// false.
-class ProgrammaticScriptInjector::FrameWatcher
-    : public content::RenderFrameObserver {
- public:
-  explicit FrameWatcher(content::RenderFrame* render_frame)
-      : content::RenderFrameObserver(render_frame), is_valid_(true) {}
-  ~FrameWatcher() override {}
-
-  bool is_frame_valid() const { return is_valid_; }
-
- private:
-  void FrameDetached() override { is_valid_ = false; }
-  void OnDestruct() override { is_valid_ = false; }
-
-  bool is_valid_;
-
-  DISALLOW_COPY_AND_ASSIGN(FrameWatcher);
-};
-
 ProgrammaticScriptInjector::ProgrammaticScriptInjector(
     const ExtensionMsg_ExecuteCode_Params& params,
     content::RenderFrame* render_frame)
     : params_(new ExtensionMsg_ExecuteCode_Params(params)),
       url_(
           ScriptContext::GetDataSourceURLForFrame(render_frame->GetWebFrame())),
-      frame_watcher_(new FrameWatcher(render_frame)),
       finished_(false) {
   effective_url_ = ScriptContext::GetEffectiveDocumentURL(
       render_frame->GetWebFrame(), url_, params.match_about_blank);
@@ -136,14 +114,17 @@
 
 void ProgrammaticScriptInjector::OnInjectionComplete(
     scoped_ptr<base::Value> execution_result,
-    UserScript::RunLocation run_location) {
+    UserScript::RunLocation run_location,
+    content::RenderFrame* render_frame) {
   DCHECK(results_.empty());
   if (execution_result)
     results_.Append(execution_result.Pass());
-  Finish(std::string());
+  Finish(std::string(), render_frame);
 }
 
-void ProgrammaticScriptInjector::OnWillNotInject(InjectFailureReason reason) {
+void ProgrammaticScriptInjector::OnWillNotInject(
+    InjectFailureReason reason,
+    content::RenderFrame* render_frame) {
   std::string error;
   switch (reason) {
     case NOT_ALLOWED:
@@ -160,24 +141,25 @@
     case WONT_INJECT:
       break;
   }
-  Finish(error);
+  Finish(error, render_frame);
 }
 
 UserScript::RunLocation ProgrammaticScriptInjector::GetRunLocation() const {
   return static_cast<UserScript::RunLocation>(params_->run_at);
 }
 
-void ProgrammaticScriptInjector::Finish(const std::string& error) {
+void ProgrammaticScriptInjector::Finish(const std::string& error,
+                                        content::RenderFrame* render_frame) {
   DCHECK(!finished_);
   finished_ = true;
 
   // It's possible that the render frame was destroyed in the course of
   // injecting scripts. Don't respond if it was (the browser side watches for
   // frame deletions so nothing is left hanging).
-  if (frame_watcher_->is_frame_valid()) {
-    frame_watcher_->render_frame()->Send(
+  if (render_frame) {
+    render_frame->Send(
         new ExtensionHostMsg_ExecuteCodeFinished(
-            frame_watcher_->render_frame()->GetRoutingID(), params_->request_id,
+            render_frame->GetRoutingID(), params_->request_id,
             error, url_, results_));
   }
 }
diff --git a/extensions/renderer/programmatic_script_injector.h b/extensions/renderer/programmatic_script_injector.h
index 1f5584c..159ff1c5 100644
--- a/extensions/renderer/programmatic_script_injector.h
+++ b/extensions/renderer/programmatic_script_injector.h
@@ -27,8 +27,6 @@
   ~ProgrammaticScriptInjector() override;
 
  private:
-  class FrameWatcher;
-
   // ScriptInjector implementation.
   UserScript::InjectionType script_type() const override;
   bool ShouldExecuteInMainWorld() const override;
@@ -47,15 +45,17 @@
   void GetRunInfo(ScriptsRunInfo* scripts_run_info,
                   UserScript::RunLocation run_location) const override;
   void OnInjectionComplete(scoped_ptr<base::Value> execution_result,
-                           UserScript::RunLocation run_location) override;
-  void OnWillNotInject(InjectFailureReason reason) override;
+                           UserScript::RunLocation run_location,
+                           content::RenderFrame* render_frame) override;
+  void OnWillNotInject(InjectFailureReason reason,
+                       content::RenderFrame* render_frame) override;
 
   // Return the run location for this injector.
   UserScript::RunLocation GetRunLocation() const;
 
   // Notify the browser that the script was injected (or never will be), and
   // send along any results or errors.
-  void Finish(const std::string& error);
+  void Finish(const std::string& error, content::RenderFrame* render_frame);
 
   // The parameters for injecting the script.
   scoped_ptr<ExtensionMsg_ExecuteCode_Params> params_;
@@ -68,9 +68,6 @@
   // security decisions, to avoid race conditions (e.g. due to navigation).
   GURL effective_url_;
 
-  // A helper class to hold the render frame and watch for its deletion.
-  scoped_ptr<FrameWatcher> frame_watcher_;
-
   // The results of the script execution.
   base::ListValue results_;
 
diff --git a/extensions/renderer/resources/extensions_renderer_resources.grd b/extensions/renderer/resources/extensions_renderer_resources.grd
index d3fcb7d..8a087059 100644
--- a/extensions/renderer/resources/extensions_renderer_resources.grd
+++ b/extensions/renderer/resources/extensions_renderer_resources.grd
@@ -55,7 +55,6 @@
       <include name="IDR_STASH_MOJOM_JS" file="${mojom_root}\extensions\common\mojo\stash.mojom.js" use_base_dir="false" type="BINDATA" />
       <include name="IDR_TEST_CUSTOM_BINDINGS_JS" file="test_custom_bindings.js" type="BINDATA" />
       <include name="IDR_UNCAUGHT_EXCEPTION_HANDLER_JS" file="uncaught_exception_handler.js" type="BINDATA" />
-      <include name="IDR_UNLOAD_EVENT_JS" file="unload_event.js" type="BINDATA" />
       <include name="IDR_UTILS_JS" file="utils.js" type="BINDATA" />
       <include name="IDR_WEB_VIEW_ACTION_REQUESTS_JS" file="guest_view/web_view/web_view_action_requests.js" type="BINDATA" />
       <include name="IDR_WEB_VIEW_API_METHODS_JS" file="guest_view/web_view/web_view_api_methods.js" type="BINDATA" />
diff --git a/extensions/renderer/resources/stash_client.js b/extensions/renderer/resources/stash_client.js
index 110e700c..b7f50fe3 100644
--- a/extensions/renderer/resources/stash_client.js
+++ b/extensions/renderer/resources/stash_client.js
@@ -19,8 +19,6 @@
   var service = new stashMojom.StashService.proxyClass(new routerModule.Router(
       serviceProvider.connectToService(stashMojom.StashService.name)));
 
-  var unloadEvent = require('unload_event');
-
   /**
    * A callback invoked to obtain objects to stash from a particular client.
    * @callback module:stash_client.StashCallback
@@ -149,7 +147,7 @@
     });
   }
 
-  unloadEvent.addListener(function() {
+  function saveStashForTesting() {
     Promise.all($Array.map(clients, function(client) {
       return client.serialize();
     })).then(function(stashedObjects) {
@@ -160,10 +158,11 @@
       });
       service.addToStash(flattenedObjectsToStash);
     });
-  });
+  }
 
   return {
     registerClient: registerClient,
     retrieve: retrieve,
+    saveStashForTesting, saveStashForTesting,
   };
 });
diff --git a/extensions/renderer/resources/unload_event.js b/extensions/renderer/resources/unload_event.js
deleted file mode 100644
index 753c2f0..0000000
--- a/extensions/renderer/resources/unload_event.js
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Special unload event. We don't use the DOM unload because that slows down
-// tab shutdown. On the other hand, onUnload might not always fire, since
-// Chrome will terminate renderers on shutdown (SuddenTermination).
-
-// Implement a primitive subset of the Event interface as needed, since if this
-// was to use the real event object there would be a circular dependency.
-var listeners = [];
-
-exports.addListener = function(listener) {
-  $Array.push(listeners, listener);
-};
-
-exports.removeListener = function(listener) {
-  for (var i = 0; i < listeners.length; ++i) {
-    if (listeners[i] == listener) {
-      $Array.splice(listeners, i, 1);
-      return;
-    }
-  }
-};
-
-exports.wasDispatched = false;
-
-// dispatch() is called from C++.
-exports.dispatch = function() {
-  exports.wasDispatched = true;
-  for (var i = 0; i < listeners.length; ++i)
-    listeners[i]();
-};
diff --git a/extensions/renderer/script_context.cc b/extensions/renderer/script_context.cc
index e49a3f0..462e30a 100644
--- a/extensions/renderer/script_context.cc
+++ b/extensions/renderer/script_context.cc
@@ -232,13 +232,6 @@
       kEventBindings, "dispatchEvent", arraysize(argv), argv);
 }
 
-void ScriptContext::DispatchOnUnloadEvent() {
-  DCHECK(thread_checker_.CalledOnValidThread());
-  v8::HandleScope handle_scope(isolate());
-  v8::Context::Scope context_scope(v8_context());
-  module_system_->CallModuleMethod("unload_event", "dispatch");
-}
-
 std::string ScriptContext::GetContextTypeDescription() const {
   DCHECK(thread_checker_.CalledOnValidThread());
   return GetContextTypeDescriptionString(context_type_);
diff --git a/extensions/renderer/script_context.h b/extensions/renderer/script_context.h
index b58b71e5..a345d07 100644
--- a/extensions/renderer/script_context.h
+++ b/extensions/renderer/script_context.h
@@ -118,9 +118,6 @@
 
   void DispatchEvent(const char* event_name, v8::Local<v8::Array> args) const;
 
-  // Fires the onunload event on the unload_event module.
-  void DispatchOnUnloadEvent();
-
   // Returns the availability of the API |api_name|.
   Feature::Availability GetAvailability(const std::string& api_name);
 
diff --git a/extensions/renderer/script_context_set.cc b/extensions/renderer/script_context_set.cc
index a9877dd..f3a1111b 100644
--- a/extensions/renderer/script_context_set.cc
+++ b/extensions/renderer/script_context_set.cc
@@ -125,9 +125,8 @@
 std::set<ScriptContext*> ScriptContextSet::OnExtensionUnloaded(
     const std::string& extension_id) {
   std::set<ScriptContext*> removed;
-  ForEach(extension_id,
-          base::Bind(&ScriptContextSet::DispatchOnUnloadEventAndRemove,
-                     base::Unretained(this), &removed));
+  ForEach(extension_id, base::Bind(&ScriptContextSet::RecordAndRemove,
+                                   base::Unretained(this), &removed));
   return removed;
 }
 
@@ -217,12 +216,10 @@
   return Feature::WEB_PAGE_CONTEXT;
 }
 
-void ScriptContextSet::DispatchOnUnloadEventAndRemove(
-    std::set<ScriptContext*>* out,
-    ScriptContext* context) {
-  context->DispatchOnUnloadEvent();
-  Remove(context);  // deleted asynchronously
-  out->insert(context);
+void ScriptContextSet::RecordAndRemove(std::set<ScriptContext*>* removed,
+                                       ScriptContext* context) {
+  removed->insert(context);
+  Remove(context);  // Note: context deletion is deferred to the message loop.
 }
 
 }  // namespace extensions
diff --git a/extensions/renderer/script_context_set.h b/extensions/renderer/script_context_set.h
index be58fe5..8ca3dbf 100644
--- a/extensions/renderer/script_context_set.h
+++ b/extensions/renderer/script_context_set.h
@@ -124,10 +124,9 @@
       const GURL& url,
       const blink::WebSecurityOrigin& origin);
 
-  // Calls Remove on |context| then appends |context| to |out|.
-  // This is a helper designed to be used by OnExtensionUnloaded with ForEach.
-  void DispatchOnUnloadEventAndRemove(std::set<ScriptContext*>* out,
-                                      ScriptContext* context);
+  // Helper for OnExtensionUnloaded().
+  void RecordAndRemove(std::set<ScriptContext*>* removed,
+                       ScriptContext* context);
 
   // Weak reference to all installed Extensions that are also active in this
   // process.
diff --git a/extensions/renderer/script_injection.cc b/extensions/renderer/script_injection.cc
index 26fdc1bd..f924a01 100644
--- a/extensions/renderer/script_injection.cc
+++ b/extensions/renderer/script_injection.cc
@@ -78,6 +78,25 @@
 
 }  // namespace
 
+// Watches for the deletion of a RenderFrame, after which is_valid will return
+// false.
+class ScriptInjection::FrameWatcher : public content::RenderFrameObserver {
+ public:
+  FrameWatcher(content::RenderFrame* render_frame,
+               ScriptInjection* injection)
+      : content::RenderFrameObserver(render_frame),
+        injection_(injection) {}
+  ~FrameWatcher() override {}
+
+ private:
+  void FrameDetached() override { injection_->invalidate_render_frame(); }
+  void OnDestruct() override { injection_->invalidate_render_frame(); }
+
+  ScriptInjection* injection_;
+
+  DISALLOW_COPY_AND_ASSIGN(FrameWatcher);
+};
+
 // static
 std::string ScriptInjection::GetHostIdForIsolatedWorld(int isolated_world_id) {
   const IsolatedWorldMap& isolated_worlds = g_isolated_worlds.Get();
@@ -106,13 +125,14 @@
       request_id_(kInvalidRequestId),
       complete_(false),
       did_inject_js_(false),
+      frame_watcher_(new FrameWatcher(render_frame, this)),
       weak_ptr_factory_(this) {
   CHECK(injection_host_.get());
 }
 
 ScriptInjection::~ScriptInjection() {
   if (!complete_)
-    injector_->OnWillNotInject(ScriptInjector::WONT_INJECT);
+    NotifyWillNotInject(ScriptInjector::WONT_INJECT);
 }
 
 ScriptInjection::InjectionResult ScriptInjection::TryToInject(
@@ -183,7 +203,7 @@
 void ScriptInjection::NotifyWillNotInject(
     ScriptInjector::InjectFailureReason reason) {
   complete_ = true;
-  injector_->OnWillNotInject(reason);
+  injector_->OnWillNotInject(reason, render_frame_);
 }
 
 ScriptInjection::InjectionResult ScriptInjection::Inject(
@@ -205,10 +225,12 @@
 
   injector_->GetRunInfo(scripts_run_info, run_location_);
 
-  if (complete_)
-    injector_->OnInjectionComplete(execution_result_.Pass(), run_location_);
-  else
+  if (complete_) {
+    injector_->OnInjectionComplete(execution_result_.Pass(), run_location_,
+                                   render_frame_);
+  } else {
     ++scripts_run_info->num_blocking_js;
+  }
 
   return complete_ ? INJECTION_FINISHED : INJECTION_BLOCKED;
 }
@@ -280,7 +302,8 @@
   // If |async_completion_callback_| is set, it means the script finished
   // asynchronously, and we should run it.
   if (!async_completion_callback_.is_null()) {
-    injector_->OnInjectionComplete(execution_result_.Pass(), run_location_);
+    injector_->OnInjectionComplete(execution_result_.Pass(), run_location_,
+                                   render_frame_);
     // Warning: this object can be destroyed after this line!
     async_completion_callback_.Run(this);
   }
diff --git a/extensions/renderer/script_injection.h b/extensions/renderer/script_injection.h
index 9a6805f0..0c7e1866 100644
--- a/extensions/renderer/script_injection.h
+++ b/extensions/renderer/script_injection.h
@@ -77,12 +77,16 @@
   // Resets the pointer of the injection host when the host is gone.
   void OnHostRemoved();
 
+  void invalidate_render_frame() { render_frame_ = nullptr; }
+
   // Accessors.
   content::RenderFrame* render_frame() const { return render_frame_; }
   const HostID& host_id() const { return injection_host_->id(); }
   int64 request_id() const { return request_id_; }
 
  private:
+  class FrameWatcher;
+
   // Sends a message to the browser to request permission to inject.
   void RequestPermissionFromBrowser();
 
@@ -132,6 +136,9 @@
   // The callback to run upon completing asynchronously.
   CompletionCallback async_completion_callback_;
 
+  // A helper class to hold the render frame and watch for its deletion.
+  scoped_ptr<FrameWatcher> frame_watcher_;
+
   base::WeakPtrFactory<ScriptInjection> weak_ptr_factory_;
 
   DISALLOW_COPY_AND_ASSIGN(ScriptInjection);
diff --git a/extensions/renderer/script_injection_manager.cc b/extensions/renderer/script_injection_manager.cc
index ebf89e2..5ab712f 100644
--- a/extensions/renderer/script_injection_manager.cc
+++ b/extensions/renderer/script_injection_manager.cc
@@ -223,6 +223,10 @@
 }
 
 ScriptInjectionManager::~ScriptInjectionManager() {
+  for (ScriptInjection* injection : pending_injections_)
+    injection->invalidate_render_frame();
+  for (ScriptInjection* injection : running_injections_)
+    injection->invalidate_render_frame();
 }
 
 void ScriptInjectionManager::OnRenderFrameCreated(
@@ -354,14 +358,15 @@
   active_injection_frames_.insert(frame);
 
   ScriptsRunInfo scripts_run_info(frame, run_location);
-  std::vector<ScriptInjection*> released_injections;
-  frame_injections.release(&released_injections);
-  for (ScriptInjection* injection : released_injections) {
+  for (ScopedVector<ScriptInjection>::iterator iter = frame_injections.begin();
+       iter != frame_injections.end();) {
     // It's possible for the frame to be invalidated in the course of injection
     // (if a script removes its own frame, for example). If this happens, abort.
     if (!active_injection_frames_.count(frame))
       break;
-    TryToInject(make_scoped_ptr(injection), run_location, &scripts_run_info);
+    scoped_ptr<ScriptInjection> injection(*iter);
+    iter = frame_injections.weak_erase(iter);
+    TryToInject(injection.Pass(), run_location, &scripts_run_info);
   }
 
   // We are done running in the frame.
diff --git a/extensions/renderer/script_injector.h b/extensions/renderer/script_injector.h
index 21d434cf..a51e1d5a 100644
--- a/extensions/renderer/script_injector.h
+++ b/extensions/renderer/script_injector.h
@@ -79,12 +79,18 @@
 
   // Notifies the script that injection has completed, with a possibly-populated
   // list of results (depending on whether or not ExpectsResults() was true).
+  // |render_frame| contains the render frame, or null if the frame was
+  // invalidated.
   virtual void OnInjectionComplete(
       scoped_ptr<base::Value> execution_result,
-      UserScript::RunLocation run_location) = 0;
+      UserScript::RunLocation run_location,
+      content::RenderFrame* render_frame) = 0;
 
   // Notifies the script that injection will never occur.
-  virtual void OnWillNotInject(InjectFailureReason reason) = 0;
+  // |render_frame| contains the render frame, or null if the frame was
+  // invalidated.
+  virtual void OnWillNotInject(InjectFailureReason reason,
+                               content::RenderFrame* render_frame) = 0;
 };
 
 }  // namespace extensions
diff --git a/extensions/renderer/user_script_injector.cc b/extensions/renderer/user_script_injector.cc
index 511fac3..548b4d6 100644
--- a/extensions/renderer/user_script_injector.cc
+++ b/extensions/renderer/user_script_injector.cc
@@ -260,10 +260,12 @@
 
 void UserScriptInjector::OnInjectionComplete(
     scoped_ptr<base::Value> execution_result,
-    UserScript::RunLocation run_location) {
+    UserScript::RunLocation run_location,
+    content::RenderFrame* render_frame) {
 }
 
-void UserScriptInjector::OnWillNotInject(InjectFailureReason reason) {
+void UserScriptInjector::OnWillNotInject(InjectFailureReason reason,
+                                         content::RenderFrame* render_frame) {
 }
 
 }  // namespace extensions
diff --git a/extensions/renderer/user_script_injector.h b/extensions/renderer/user_script_injector.h
index 1ee8fed..c98af0b 100644
--- a/extensions/renderer/user_script_injector.h
+++ b/extensions/renderer/user_script_injector.h
@@ -53,8 +53,10 @@
   void GetRunInfo(ScriptsRunInfo* scripts_run_info,
                   UserScript::RunLocation run_location) const override;
   void OnInjectionComplete(scoped_ptr<base::Value> execution_result,
-                           UserScript::RunLocation run_location) override;
-  void OnWillNotInject(InjectFailureReason reason) override;
+                           UserScript::RunLocation run_location,
+                           content::RenderFrame* render_frame) override;
+  void OnWillNotInject(InjectFailureReason reason,
+                       content::RenderFrame* render_frame) override;
 
   // The associated user script. Owned by the UserScriptInjector that created
   // this object.
diff --git a/extensions/test/data/stash_client_unittest.js b/extensions/test/data/stash_client_unittest.js
index 5d65799..fc498f88 100644
--- a/extensions/test/data/stash_client_unittest.js
+++ b/extensions/test/data/stash_client_unittest.js
@@ -54,6 +54,7 @@
         stashedObject.stashed_handles = [dataPipe.consumerHandle];
         return [{serialization: stashedObject, monitorHandles: true}];
       });
+      stashClient.saveStashForTesting();
     }).then(test.succeed, test.fail);
   },
 
diff --git a/extensions/test/extensions_unittests_main.cc b/extensions/test/extensions_unittests_main.cc
index f39e40d..ac9e8ddf3 100644
--- a/extensions/test/extensions_unittests_main.cc
+++ b/extensions/test/extensions_unittests_main.cc
@@ -13,7 +13,7 @@
 #include "extensions/common/constants.h"
 #include "extensions/common/extension_paths.h"
 #include "extensions/test/test_extensions_client.h"
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "ui/base/resource/resource_bundle.h"
 #include "ui/gl/test/gl_surface_test_support.h"
 #include "url/url_util.h"
@@ -110,7 +110,7 @@
 int main(int argc, char** argv) {
   content::UnitTestTestSuite test_suite(new ExtensionsTestSuite(argc, argv));
 
-  mojo::embedder::test::InitWithSimplePlatformSupport();
+  mojo::embedder::Init();
   return base::LaunchUnitTests(argc,
                                argv,
                                base::Bind(&content::UnitTestTestSuite::Run,
diff --git a/gpu/command_buffer/service/feature_info.cc b/gpu/command_buffer/service/feature_info.cc
index ea162a6..b781b96 100644
--- a/gpu/command_buffer/service/feature_info.cc
+++ b/gpu/command_buffer/service/feature_info.cc
@@ -220,9 +220,6 @@
   enable_gl_path_rendering_switch_ =
       command_line->HasSwitch(switches::kEnableGLPathRendering);
 
-  disable_virtual_contexts_ =
-      command_line->HasSwitch(switches::kDisableVirtualContexts);
-
   // The shader translator is needed to translate from WebGL-conformant GLES SL
   // to normal GLES SL, enforce WebGL conformance, translate from GLES SL 1.0 to
   // target context GLSL, etc.
diff --git a/gpu/command_buffer/service/feature_info.h b/gpu/command_buffer/service/feature_info.h
index 0043463..653afd9 100644
--- a/gpu/command_buffer/service/feature_info.h
+++ b/gpu/command_buffer/service/feature_info.h
@@ -148,11 +148,6 @@
 
   bool disable_shader_translator() const { return disable_shader_translator_; }
 
-  bool UseVirtualizedGLContexts() const {
-    return !disable_virtual_contexts_ &&
-           workarounds_.use_virtualized_gl_contexts;
-  }
-
   bool IsWebGLContext() const;
 
  private:
@@ -188,9 +183,6 @@
   // Whether the command line switch kEnableGLPathRendering is passed in.
   bool enable_gl_path_rendering_switch_;
 
-  // Whether the command line switch kDisableVirtualContexts is passed in.
-  bool disable_virtual_contexts_;
-
   bool disable_shader_translator_;
   scoped_ptr<gfx::GLVersionInfo> gl_version_info_;
 
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 96562c83..fc12bfe 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -12200,7 +12200,7 @@
                << GLES2Util::GetStringEnum(driver_status);
 
     // Don't pretend we know which client was responsible.
-    if (feature_info_->UseVirtualizedGLContexts())
+    if (workarounds().use_virtualized_gl_contexts)
       driver_status = GL_UNKNOWN_CONTEXT_RESET_ARB;
 
     switch (driver_status) {
diff --git a/gpu/command_buffer/service/gpu_switches.cc b/gpu/command_buffer/service/gpu_switches.cc
index e55dca4..171f543 100644
--- a/gpu/command_buffer/service/gpu_switches.cc
+++ b/gpu/command_buffer/service/gpu_switches.cc
@@ -76,10 +76,6 @@
 // and driver. This is used in GPU rasterization.
 const char kEnableGLPathRendering[] = "enable-gl-path-rendering";
 
-// Provide an override to disable virtual contexts, some systems may be
-// experiencing problems with it, and we need an easy way to confirm.
-const char kDisableVirtualContexts[] = "disable-virtual-contexts";
-
 const char* kGpuSwitches[] = {
     kCompileShaderAlwaysSucceeds,
     kDisableGLErrorLimit,
@@ -100,7 +96,6 @@
     kGLShaderIntermOutput,
     kEmulateShaderPrecision,
     kEnableGLPathRendering,
-    kDisableVirtualContexts,
 };
 
 const int kNumGpuSwitches = arraysize(kGpuSwitches);
diff --git a/gpu/command_buffer/service/gpu_switches.h b/gpu/command_buffer/service/gpu_switches.h
index a34d09de..ac347e4 100644
--- a/gpu/command_buffer/service/gpu_switches.h
+++ b/gpu/command_buffer/service/gpu_switches.h
@@ -31,7 +31,6 @@
 GPU_EXPORT extern const char kGLShaderIntermOutput[];
 GPU_EXPORT extern const char kEmulateShaderPrecision[];
 GPU_EXPORT extern const char kEnableGLPathRendering[];
-GPU_EXPORT extern const char kDisableVirtualContexts[];
 
 GPU_EXPORT extern const char* kGpuSwitches[];
 GPU_EXPORT extern const int kNumGpuSwitches;
diff --git a/gpu/command_buffer/service/in_process_command_buffer.cc b/gpu/command_buffer/service/in_process_command_buffer.cc
index 9711aad..19e36161 100644
--- a/gpu/command_buffer/service/in_process_command_buffer.cc
+++ b/gpu/command_buffer/service/in_process_command_buffer.cc
@@ -352,7 +352,8 @@
   if (service_->UseVirtualizedGLContexts() ||
       decoder_->GetContextGroup()
           ->feature_info()
-          ->UseVirtualizedGLContexts()) {
+          ->workarounds()
+          .use_virtualized_gl_contexts) {
     context_ = gl_share_group_->GetSharedContext();
     if (!context_.get()) {
       context_ = gfx::GLContext::CreateGLContext(
diff --git a/gpu/config/gpu_info_collector_mac.mm b/gpu/config/gpu_info_collector_mac.mm
index bbe3780..61050649 100644
--- a/gpu/config/gpu_info_collector_mac.mm
+++ b/gpu/config/gpu_info_collector_mac.mm
@@ -9,6 +9,7 @@
 #include "base/logging.h"
 #include "base/mac/mac_util.h"
 #include "base/mac/scoped_cftyperef.h"
+#include "base/mac/scoped_ioobject.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/strings/string_number_conversions.h"
 #include "base/strings/string_piece.h"
@@ -75,8 +76,9 @@
   if (IOServiceGetMatchingServices(kIOMasterPortDefault,
                                    match_dictionary,
                                    &entry_iterator) == kIOReturnSuccess) {
-    io_registry_entry_t entry;
-    while ((entry = IOIteratorNext(entry_iterator))) {
+
+    base::mac::ScopedIOObject<io_registry_entry_t> entry;
+    while (entry.reset(IOIteratorNext(entry_iterator)), entry) {
       GPUInfo::GPUDevice gpu;
       if (GetEntryProperty(entry, CFSTR("class-code")) != 0x30000) {
         // 0x30000 : DISPLAY_VGA
diff --git a/ios/chrome/app/strings/ios_strings.grd b/ios/chrome/app/strings/ios_strings.grd
index 96098c6..022c1b6 100644
--- a/ios/chrome/app/strings/ios_strings.grd
+++ b/ios/chrome/app/strings/ios_strings.grd
@@ -163,6 +163,15 @@
       <message name="IDS_IOS_LOCATION_USAGE_CANCEL" desc="Title for the alert button to cancel sending location for Omnibox queries [Length: 20em] [iOS only]">
         Not Now
       </message>
+
+      <!-- iOS Net-Export strings -->
+      <message name="IDS_IOS_NET_EXPORT_NO_EMAIL_ACCOUNTS_ALERT_MESSAGE" desc="The message of the alert informing a user with no email accounts that he or she needs to configure an email account to send net-export data. [Length: 70em]">
+        To send net-export data, please configure your email account in the Settings app.
+      </message>
+      <message name="IDS_IOS_NET_EXPORT_NO_EMAIL_ACCOUNTS_ALERT_TITLE" desc="The title of the alert informing a user with no email accounts that he or she needs to configure an email account to send net-export data. [Length: 20em]">
+        No Email Accounts
+      </message>
+
       <message name="IDS_IOS_VERSION_COPIED" desc="The message displayed when the version label is tapped (in About settings) [Length: 10em] [iOS only]">
         Copied
       </message>
diff --git a/ios/chrome/browser/DEPS b/ios/chrome/browser/DEPS
index d35af2e..f5ef641b 100644
--- a/ios/chrome/browser/DEPS
+++ b/ios/chrome/browser/DEPS
@@ -26,6 +26,7 @@
   "+components/keyed_service/ios",
   "+components/leveldb_proto",
   "+components/metrics",
+  "+components/net_log",
   "+components/network_time",
   "+components/omnibox/browser",
   "+components/open_from_clipboard",
diff --git a/ios/chrome/browser/application_context.h b/ios/chrome/browser/application_context.h
index b7762fa7..db856c62 100644
--- a/ios/chrome/browser/application_context.h
+++ b/ios/chrome/browser/application_context.h
@@ -21,6 +21,10 @@
 class URLRequestContextGetter;
 }
 
+namespace net_log {
+class ChromeNetLog;
+}
+
 namespace policy {
 class BrowserPolicyConnector;
 }
@@ -58,9 +62,12 @@
   // Gets the policy connector, creating and starting it if necessary.
   virtual policy::BrowserPolicyConnector* GetBrowserPolicyConnector() = 0;
 
-  // Gets the RapporService. May returns null.
+  // Gets the RapporService. May return null.
   virtual rappor::RapporService* GetRapporService() = 0;
 
+  // Gets the ChromeNetLog.
+  virtual net_log::ChromeNetLog* GetNetLog() = 0;
+
  protected:
   // Sets the global ApplicationContext instance.
   static void SetApplicationContext(ApplicationContext* context);
diff --git a/ios/chrome/browser/application_context_impl.cc b/ios/chrome/browser/application_context_impl.cc
index 01684e6..8b3eec7 100644
--- a/ios/chrome/browser/application_context_impl.cc
+++ b/ios/chrome/browser/application_context_impl.cc
@@ -4,13 +4,23 @@
 
 #include "ios/chrome/browser/application_context_impl.h"
 
+#include "base/command_line.h"
+#include "base/files/file_path.h"
 #include "base/logging.h"
+#include "components/net_log/chrome_net_log.h"
 #include "components/translate/core/browser/translate_download_manager.h"
+#include "ios/chrome/common/channel_info.h"
 #include "ios/public/provider/chrome/browser/chrome_browser_provider.h"
+#include "net/log/net_log_capture_mode.h"
 
-ApplicationContextImpl::ApplicationContextImpl() {
+ApplicationContextImpl::ApplicationContextImpl(
+    const base::CommandLine& command_line) {
   DCHECK(!GetApplicationContext());
   SetApplicationContext(this);
+
+  net_log_.reset(new net_log::ChromeNetLog(
+      base::FilePath(), net::NetLogCaptureMode::Default(),
+      command_line.GetCommandLineString(), GetChannelString()));
 }
 
 ApplicationContextImpl::~ApplicationContextImpl() {
@@ -59,3 +69,7 @@
 rappor::RapporService* ApplicationContextImpl::GetRapporService() {
   return ios::GetChromeBrowserProvider()->GetRapporService();
 }
+
+net_log::ChromeNetLog* ApplicationContextImpl::GetNetLog() {
+  return net_log_.get();
+}
diff --git a/ios/chrome/browser/application_context_impl.h b/ios/chrome/browser/application_context_impl.h
index dee386c..dd7e0a1 100644
--- a/ios/chrome/browser/application_context_impl.h
+++ b/ios/chrome/browser/application_context_impl.h
@@ -8,12 +8,17 @@
 #include <string>
 
 #include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
 #include "base/threading/thread_checker.h"
 #include "ios/chrome/browser/application_context.h"
 
+namespace base {
+class CommandLine;
+}
+
 class ApplicationContextImpl : public ApplicationContext {
  public:
-  ApplicationContextImpl();
+  ApplicationContextImpl(const base::CommandLine& command_line);
   ~ApplicationContextImpl() override;
 
   // Sets the locale used by the application.
@@ -28,8 +33,10 @@
   metrics::MetricsService* GetMetricsService() override;
   policy::BrowserPolicyConnector* GetBrowserPolicyConnector() override;
   rappor::RapporService* GetRapporService() override;
+  net_log::ChromeNetLog* GetNetLog() override;
 
   base::ThreadChecker thread_checker_;
+  scoped_ptr<net_log::ChromeNetLog> net_log_;
   std::string application_locale_;
 
   DISALLOW_COPY_AND_ASSIGN(ApplicationContextImpl);
diff --git a/ios/chrome/browser/chrome_url_constants.cc b/ios/chrome/browser/chrome_url_constants.cc
index 557064d..d3f5961 100644
--- a/ios/chrome/browser/chrome_url_constants.cc
+++ b/ios/chrome/browser/chrome_url_constants.cc
@@ -7,5 +7,6 @@
 const char kChromeUINewTabURL[] = "chrome://newtab/";
 
 const char kChromeUIExternalFileHost[] = "external-file";
+const char kChromeUINetExportHost[] = "net-export";
 const char kChromeUIOmahaHost[] = "omaha";
 const char kChromeUISyncInternalsHost[] = "sync-internals";
diff --git a/ios/chrome/browser/chrome_url_constants.h b/ios/chrome/browser/chrome_url_constants.h
index 6ed08b0..269a2924 100644
--- a/ios/chrome/browser/chrome_url_constants.h
+++ b/ios/chrome/browser/chrome_url_constants.h
@@ -17,6 +17,7 @@
 
 // URL components for Chrome on iOS.
 extern const char kChromeUIExternalFileHost[];
+extern const char kChromeUINetExportHost[];
 extern const char kChromeUIOmahaHost[];
 extern const char kChromeUISyncInternalsHost[];
 
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.cc b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.cc
new file mode 100644
index 0000000..239baf10
--- /dev/null
+++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.cc
@@ -0,0 +1,31 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h"
+
+#include "base/prefs/pref_service.h"
+#include "ios/chrome/browser/application_context.h"
+
+// static
+bool IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled() {
+  return IsMetricsReportingEnabled(GetApplicationContext()->GetLocalState());
+}
+
+// static
+bool IOSChromeMetricsServiceAccessor::RegisterSyntheticFieldTrial(
+    const std::string& trial_name,
+    const std::string& group_name) {
+  return metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial(
+      GetApplicationContext()->GetMetricsService(), trial_name, group_name);
+}
+
+// static
+bool IOSChromeMetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash(
+    uint32_t trial_name_hash,
+    const std::string& group_name) {
+  return metrics::MetricsServiceAccessor::
+      RegisterSyntheticFieldTrialWithNameHash(
+          GetApplicationContext()->GetMetricsService(), trial_name_hash,
+          group_name);
+}
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h
new file mode 100644
index 0000000..02e1b3c
--- /dev/null
+++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h
@@ -0,0 +1,53 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_
+#define IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_
+
+#include <stdint.h>
+#include <string>
+
+#include "base/gtest_prod_util.h"
+#include "base/macros.h"
+#include "components/metrics/metrics_service_accessor.h"
+
+namespace {
+class CrashesDOMHandler;
+}
+
+// This class limits and documents access to metrics service helper methods.
+// Since these methods are private, each user has to be explicitly declared
+// as a 'friend' below.
+class IOSChromeMetricsServiceAccessor : public metrics::MetricsServiceAccessor {
+ private:
+  // TODO(blundell): Remove these //chrome classes as friends once they're no
+  // longer used by the iOS port.
+  friend class ::CrashesDOMHandler;
+  friend class DataReductionProxyChromeSettings;
+  friend class MetricsServicesManager;
+
+  FRIEND_TEST_ALL_PREFIXES(IOSChromeMetricsServiceAccessorTest,
+                           MetricsReportingEnabled);
+
+  // Returns true if metrics reporting is enabled.
+  static bool IsMetricsAndCrashReportingEnabled();
+
+  // Calls metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrial() with
+  // ApplicationContext's MetricsService. See that function's declaration for
+  // details.
+  static bool RegisterSyntheticFieldTrial(const std::string& trial_name,
+                                          const std::string& group_name);
+
+  // Calls
+  // metrics::MetricsServiceAccessor::RegisterSyntheticFieldTrialWithNameHash()
+  // with ApplicationContext's MetricsService. See that function's declaration
+  // for details.
+  static bool RegisterSyntheticFieldTrialWithNameHash(
+      uint32_t trial_name_hash,
+      const std::string& group_name);
+
+  DISALLOW_IMPLICIT_CONSTRUCTORS(IOSChromeMetricsServiceAccessor);
+};
+
+#endif  // IOS_CHROME_BROWSER_METRICS_IOS_CHROME_METRICS_SERVICE_ACCESSOR_H_
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc
new file mode 100644
index 0000000..3fa20c6
--- /dev/null
+++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc
@@ -0,0 +1,59 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor.h"
+
+#include "base/base_switches.h"
+#include "base/prefs/pref_registry_simple.h"
+#include "base/prefs/testing_pref_service.h"
+#include "components/metrics/metrics_pref_names.h"
+#include "ios/chrome/test/testing_application_context.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class IOSChromeMetricsServiceAccessorTest : public testing::Test {
+ public:
+  IOSChromeMetricsServiceAccessorTest() {
+    prefs_.registry()->RegisterBooleanPref(
+        metrics::prefs::kMetricsReportingEnabled, false);
+    TestingApplicationContext::GetGlobal()->SetLocalState(&prefs_);
+  }
+
+  PrefService* GetLocalState() { return &prefs_; }
+
+ private:
+  TestingPrefServiceSimple prefs_;
+
+  DISALLOW_COPY_AND_ASSIGN(IOSChromeMetricsServiceAccessorTest);
+};
+
+TEST_F(IOSChromeMetricsServiceAccessorTest, MetricsReportingEnabled) {
+#if defined(GOOGLE_CHROME_BUILD)
+  const char* pref = metrics::prefs::kMetricsReportingEnabled;
+  GetLocalState()->SetDefaultPrefValue(pref, new base::FundamentalValue(false));
+
+  GetLocalState()->SetBoolean(pref, false);
+  EXPECT_FALSE(
+      IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
+  GetLocalState()->SetBoolean(pref, true);
+  EXPECT_TRUE(
+      IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
+  GetLocalState()->ClearPref(pref);
+  EXPECT_FALSE(
+      IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
+
+  // If field trials are forced, metrics should always be disabled, regardless
+  // of the value of the pref.
+  base::CommandLine::ForCurrentProcess()->AppendSwitch(
+      switches::kForceFieldTrials);
+  EXPECT_FALSE(
+      IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
+  GetLocalState()->SetBoolean(pref, true);
+  EXPECT_FALSE(
+      IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
+#else
+  // Metrics Reporting is never enabled when GOOGLE_CHROME_BUILD is undefined.
+  EXPECT_FALSE(
+      IOSChromeMetricsServiceAccessor::IsMetricsAndCrashReportingEnabled());
+#endif
+}
diff --git a/ios/chrome/browser/pref_names.cc b/ios/chrome/browser/pref_names.cc
index b6d5d1a..c6b9a17f 100644
--- a/ios/chrome/browser/pref_names.cc
+++ b/ios/chrome/browser/pref_names.cc
@@ -66,6 +66,12 @@
 const char kMetricsReportingWifiOnly[] =
     "ios.user_experience_metrics.wifi_only";
 
+// A boolean pref set to true if prediction of network actions is allowed.
+// Actions include prerendering of web pages.
+// NOTE: The "dns_prefetching.enabled" value is used so that historical user
+// preferences are not lost.
+const char kNetworkPredictionEnabled[] = "dns_prefetching.enabled";
+
 // Preference that hold a boolean indicating whether network prediction should
 // be limited to wifi (when enabled).
 const char kNetworkPredictionWifiOnly[] = "ios.dns_prefetching.wifi_only";
diff --git a/ios/chrome/browser/pref_names.h b/ios/chrome/browser/pref_names.h
index fdb52887..16e8f97 100644
--- a/ios/chrome/browser/pref_names.h
+++ b/ios/chrome/browser/pref_names.h
@@ -32,7 +32,12 @@
 extern const char kIosHandoffToOtherDevices[];
 extern const char kLastSessionExitedCleanly[];
 extern const char kMetricsReportingWifiOnly[];
+
+// TODO(stkhapugin): Consider migrating from these two bools to an integer.
+// http://crbug.com/538573
+extern const char kNetworkPredictionEnabled[];
 extern const char kNetworkPredictionWifiOnly[];
+
 extern const char kNtpShownBookmarksFolder[];
 extern const char kShowMemoryDebuggingTools[];
 
diff --git a/ios/chrome/browser/ui/webui/net_export/OWNERS b/ios/chrome/browser/ui/webui/net_export/OWNERS
new file mode 100644
index 0000000..a7b5af5
--- /dev/null
+++ b/ios/chrome/browser/ui/webui/net_export/OWNERS
@@ -0,0 +1,10 @@
+agl@chromium.org
+battre@chromium.org
+cbentzel@chromium.org
+eroman@chromium.org
+mattm@chromium.org
+mef@chromium.org
+mmenke@chromium.org
+rdsmith@chromium.org
+rsleevi@chromium.org
+rtenneti@chromium.org
diff --git a/ios/chrome/browser/ui/webui/net_export/net_export_ui.cc b/ios/chrome/browser/ui/webui/net_export/net_export_ui.cc
new file mode 100644
index 0000000..342ffeb
--- /dev/null
+++ b/ios/chrome/browser/ui/webui/net_export/net_export_ui.cc
@@ -0,0 +1,240 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/ui/webui/net_export/net_export_ui.h"
+
+#include <string>
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/strings/string_util.h"
+#include "base/strings/utf_string_conversions.h"
+#include "base/values.h"
+#include "components/net_log/chrome_net_log.h"
+#include "components/net_log/net_export_ui_constants.h"
+#include "components/net_log/net_log_temp_file.h"
+#include "grit/components_resources.h"
+#include "ios/chrome/browser/application_context.h"
+#include "ios/chrome/browser/chrome_url_constants.h"
+#include "ios/chrome/browser/ui/show_mail_composer_util.h"
+#include "ios/chrome/grit/ios_strings.h"
+#include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h"
+#include "ios/public/provider/web/web_ui_ios.h"
+#include "ios/public/provider/web/web_ui_ios_message_handler.h"
+#include "ios/web/public/web_thread.h"
+#include "ios/web/public/web_ui_ios_data_source.h"
+
+namespace {
+
+web::WebUIIOSDataSource* CreateNetExportHTMLSource() {
+  web::WebUIIOSDataSource* source =
+      web::WebUIIOSDataSource::Create(kChromeUINetExportHost);
+
+  source->SetJsonPath("strings.js");
+  source->AddResourcePath(net_log::kNetExportUIJS, IDR_NET_LOG_NET_EXPORT_JS);
+  source->SetDefaultResource(IDR_NET_LOG_NET_EXPORT_HTML);
+  return source;
+}
+
+// This class receives javascript messages from the renderer.
+// Note that the WebUI infrastructure runs on the UI thread, therefore all of
+// this class's public methods are expected to run on the UI thread. All static
+// functions except SendEmail run on FILE_USER_BLOCKING thread.
+class NetExportMessageHandler
+    : public web::WebUIIOSMessageHandler,
+      public base::SupportsWeakPtr<NetExportMessageHandler> {
+ public:
+  NetExportMessageHandler();
+  ~NetExportMessageHandler() override;
+
+  // WebUIMessageHandler implementation.
+  void RegisterMessages() override;
+
+  // Messages.
+  void OnGetExportNetLogInfo(const base::ListValue* list);
+  void OnStartNetLog(const base::ListValue* list);
+  void OnStopNetLog(const base::ListValue* list);
+  void OnSendNetLog(const base::ListValue* list);
+
+ private:
+  // Calls NetLogTempFile's ProcessCommand with DO_START and DO_STOP commands.
+  static void ProcessNetLogCommand(
+      base::WeakPtr<NetExportMessageHandler> net_export_message_handler,
+      net_log::NetLogTempFile* net_log_temp_file,
+      net_log::NetLogTempFile::Command command);
+
+  // Returns the path to the file which has NetLog data.
+  static base::FilePath GetNetLogFileName(
+      net_log::NetLogTempFile* net_log_temp_file);
+
+  // Send state/file information from NetLogTempFile.
+  static void SendExportNetLogInfo(
+      base::WeakPtr<NetExportMessageHandler> net_export_message_handler,
+      net_log::NetLogTempFile* net_log_temp_file);
+
+  // Send NetLog data via email. This runs on UI thread.
+  static void SendEmail(const base::FilePath& file_to_send);
+
+  // Call NetExportView.onExportNetLogInfoChanged JavsScript function in the
+  // renderer, passing in |arg|. Takes ownership of |arg|.
+  void OnExportNetLogInfoChanged(base::Value* arg);
+
+  // Cache of GetApplicationContex()->GetNetLog()->net_log_temp_file().
+  net_log::NetLogTempFile* net_log_temp_file_;
+
+  base::WeakPtrFactory<NetExportMessageHandler> weak_ptr_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(NetExportMessageHandler);
+};
+
+NetExportMessageHandler::NetExportMessageHandler()
+    : net_log_temp_file_(GetApplicationContext()
+                             ->GetNetLog()
+                             ->net_log_temp_file()),
+      weak_ptr_factory_(this) {}
+
+NetExportMessageHandler::~NetExportMessageHandler() {
+  // Cancel any in-progress requests to collect net_log into temporary file.
+  web::WebThread::PostTask(web::WebThread::FILE_USER_BLOCKING, FROM_HERE,
+                           base::Bind(&net_log::NetLogTempFile::ProcessCommand,
+                                      base::Unretained(net_log_temp_file_),
+                                      net_log::NetLogTempFile::DO_STOP));
+}
+
+void NetExportMessageHandler::RegisterMessages() {
+  DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI);
+
+  web_ui()->RegisterMessageCallback(
+      net_log::kGetExportNetLogInfoHandler,
+      base::Bind(&NetExportMessageHandler::OnGetExportNetLogInfo,
+                 base::Unretained(this)));
+  web_ui()->RegisterMessageCallback(
+      net_log::kStartNetLogHandler,
+      base::Bind(&NetExportMessageHandler::OnStartNetLog,
+                 base::Unretained(this)));
+  web_ui()->RegisterMessageCallback(
+      net_log::kStopNetLogHandler,
+      base::Bind(&NetExportMessageHandler::OnStopNetLog,
+                 base::Unretained(this)));
+  web_ui()->RegisterMessageCallback(
+      net_log::kSendNetLogHandler,
+      base::Bind(&NetExportMessageHandler::OnSendNetLog,
+                 base::Unretained(this)));
+}
+
+void NetExportMessageHandler::OnGetExportNetLogInfo(
+    const base::ListValue* list) {
+  web::WebThread::PostTask(
+      web::WebThread::FILE_USER_BLOCKING, FROM_HERE,
+      base::Bind(&NetExportMessageHandler::SendExportNetLogInfo,
+                 weak_ptr_factory_.GetWeakPtr(), net_log_temp_file_));
+}
+
+void NetExportMessageHandler::OnStartNetLog(const base::ListValue* list) {
+  std::string log_mode;
+  bool result = list->GetString(0, &log_mode);
+  DCHECK(result);
+
+  net_log::NetLogTempFile::Command command;
+  if (log_mode == "LOG_BYTES") {
+    command = net_log::NetLogTempFile::DO_START_LOG_BYTES;
+  } else if (log_mode == "NORMAL") {
+    command = net_log::NetLogTempFile::DO_START;
+  } else {
+    DCHECK_EQ("STRIP_PRIVATE_DATA", log_mode);
+    command = net_log::NetLogTempFile::DO_START_STRIP_PRIVATE_DATA;
+  }
+
+  ProcessNetLogCommand(weak_ptr_factory_.GetWeakPtr(), net_log_temp_file_,
+                       command);
+}
+
+void NetExportMessageHandler::OnStopNetLog(const base::ListValue* list) {
+  ProcessNetLogCommand(weak_ptr_factory_.GetWeakPtr(), net_log_temp_file_,
+                       net_log::NetLogTempFile::DO_STOP);
+}
+
+void NetExportMessageHandler::OnSendNetLog(const base::ListValue* list) {
+  web::WebThread::PostTaskAndReplyWithResult(
+      web::WebThread::FILE_USER_BLOCKING, FROM_HERE,
+      base::Bind(&NetExportMessageHandler::GetNetLogFileName,
+                 base::Unretained(net_log_temp_file_)),
+      base::Bind(&NetExportMessageHandler::SendEmail));
+}
+
+// static
+void NetExportMessageHandler::ProcessNetLogCommand(
+    base::WeakPtr<NetExportMessageHandler> net_export_message_handler,
+    net_log::NetLogTempFile* net_log_temp_file,
+    net_log::NetLogTempFile::Command command) {
+  if (!web::WebThread::CurrentlyOn(web::WebThread::FILE_USER_BLOCKING)) {
+    web::WebThread::PostTask(
+        web::WebThread::FILE_USER_BLOCKING, FROM_HERE,
+        base::Bind(&NetExportMessageHandler::ProcessNetLogCommand,
+                   net_export_message_handler, net_log_temp_file, command));
+    return;
+  }
+
+  DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::FILE_USER_BLOCKING);
+  net_log_temp_file->ProcessCommand(command);
+  SendExportNetLogInfo(net_export_message_handler, net_log_temp_file);
+}
+
+// static
+base::FilePath NetExportMessageHandler::GetNetLogFileName(
+    net_log::NetLogTempFile* net_log_temp_file) {
+  DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::FILE_USER_BLOCKING);
+  base::FilePath net_export_file_path;
+  net_log_temp_file->GetFilePath(&net_export_file_path);
+  return net_export_file_path;
+}
+
+// static
+void NetExportMessageHandler::SendExportNetLogInfo(
+    base::WeakPtr<NetExportMessageHandler> net_export_message_handler,
+    net_log::NetLogTempFile* net_log_temp_file) {
+  DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::FILE_USER_BLOCKING);
+  base::Value* value = net_log_temp_file->GetState();
+  if (!web::WebThread::PostTask(
+          web::WebThread::UI, FROM_HERE,
+          base::Bind(&NetExportMessageHandler::OnExportNetLogInfoChanged,
+                     net_export_message_handler, value))) {
+    // Failed posting the task, avoid leaking.
+    delete value;
+  }
+}
+
+// static
+void NetExportMessageHandler::SendEmail(const base::FilePath& file_to_send) {
+  if (file_to_send.empty())
+    return;
+  DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI);
+
+  std::string email;
+  std::string subject = "net_internals_log";
+  std::string title = "Issue number: ";
+  std::string body =
+      "Please add some informative text about the network issues.";
+  ShowMailComposer(base::UTF8ToUTF16(email), base::UTF8ToUTF16(subject),
+                   base::UTF8ToUTF16(body), base::UTF8ToUTF16(title),
+                   file_to_send,
+                   IDS_IOS_NET_EXPORT_NO_EMAIL_ACCOUNTS_ALERT_TITLE,
+                   IDS_IOS_NET_EXPORT_NO_EMAIL_ACCOUNTS_ALERT_MESSAGE);
+}
+
+void NetExportMessageHandler::OnExportNetLogInfoChanged(base::Value* arg) {
+  scoped_ptr<base::Value> value(arg);
+  DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI);
+  web_ui()->CallJavascriptFunction(net_log::kOnExportNetLogInfoChanged, *arg);
+}
+
+}  // namespace
+
+NetExportUI::NetExportUI(web::WebUIIOS* web_ui)
+    : web::WebUIIOSController(web_ui) {
+  web_ui->AddMessageHandler(new NetExportMessageHandler());
+  web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui),
+                               CreateNetExportHTMLSource());
+}
diff --git a/ios/chrome/browser/ui/webui/net_export/net_export_ui.h b/ios/chrome/browser/ui/webui/net_export/net_export_ui.h
new file mode 100644
index 0000000..fa2083a3
--- /dev/null
+++ b/ios/chrome/browser/ui/webui/net_export/net_export_ui.h
@@ -0,0 +1,20 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UI_WEBUI_NET_EXPORT_NET_EXPORT_UI_H_
+#define IOS_CHROME_BROWSER_UI_WEBUI_NET_EXPORT_NET_EXPORT_UI_H_
+
+#include "base/macros.h"
+#include "ios/public/provider/web/web_ui_ios_controller.h"
+
+// The C++ back-end for the chrome://net-export webui page.
+class NetExportUI : public web::WebUIIOSController {
+ public:
+  explicit NetExportUI(web::WebUIIOS* web_ui);
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(NetExportUI);
+};
+
+#endif  // IOS_CHROME_BROWSER_UI_WEBUI_NET_EXPORT_NET_EXPORT_UI_H_
diff --git a/ios/chrome/browser/update_client/OWNERS b/ios/chrome/browser/update_client/OWNERS
new file mode 100644
index 0000000..be72ff8
--- /dev/null
+++ b/ios/chrome/browser/update_client/OWNERS
@@ -0,0 +1,4 @@
+asargent@chromium.org
+cpu@chromium.org
+sorin@chromium.org
+waffles@chromium.org
diff --git a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.cc b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.cc
new file mode 100644
index 0000000..127deec6
--- /dev/null
+++ b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.cc
@@ -0,0 +1,39 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h"
+
+#include "base/lazy_instance.h"
+#include "base/strings/stringprintf.h"
+#include "components/version_info/version_info.h"
+#include "ios/chrome/browser/application_context.h"
+#include "ios/chrome/common/channel_info.h"
+
+namespace {
+
+base::LazyInstance<IOSChromeUpdateQueryParamsDelegate> g_delegate =
+    LAZY_INSTANCE_INITIALIZER;
+
+}  // namespace
+
+IOSChromeUpdateQueryParamsDelegate::IOSChromeUpdateQueryParamsDelegate() {}
+
+IOSChromeUpdateQueryParamsDelegate::~IOSChromeUpdateQueryParamsDelegate() {}
+
+// static
+IOSChromeUpdateQueryParamsDelegate*
+IOSChromeUpdateQueryParamsDelegate::GetInstance() {
+  return g_delegate.Pointer();
+}
+
+std::string IOSChromeUpdateQueryParamsDelegate::GetExtraParams() {
+  return base::StringPrintf(
+      "&prodchannel=%s&prodversion=%s&lang=%s", GetChannelString().c_str(),
+      version_info::GetVersionNumber().c_str(), GetLang().c_str());
+}
+
+// static
+const std::string& IOSChromeUpdateQueryParamsDelegate::GetLang() {
+  return GetApplicationContext()->GetApplicationLocale();
+}
diff --git a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h
new file mode 100644
index 0000000..00a9e06
--- /dev/null
+++ b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h
@@ -0,0 +1,33 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UPDATE_CLIENT_IOS_CHROME_UPDATE_QUERY_PARAMS_DELEGATE_H_
+#define IOS_CHROME_BROWSER_UPDATE_CLIENT_IOS_CHROME_UPDATE_QUERY_PARAMS_DELEGATE_H_
+
+#include <string>
+
+#include "base/macros.h"
+#include "components/update_client/update_query_params_delegate.h"
+
+class IOSChromeUpdateQueryParamsDelegate
+    : public update_client::UpdateQueryParamsDelegate {
+ public:
+  IOSChromeUpdateQueryParamsDelegate();
+  ~IOSChromeUpdateQueryParamsDelegate() override;
+
+  // Gets the LazyInstance for IOSChromeUpdateQueryParamsDelegate.
+  static IOSChromeUpdateQueryParamsDelegate* GetInstance();
+
+  // update_client::UpdateQueryParamsDelegate:
+  std::string GetExtraParams() override;
+
+  // Returns the language for the present locale. Possible return values are
+  // standard tags for languages, such as "en", "en-US", "de", "fr", "af", etc.
+  static const std::string& GetLang();
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(IOSChromeUpdateQueryParamsDelegate);
+};
+
+#endif  // IOS_CHROME_BROWSER_UPDATE_CLIENT_IOS_CHROME_UPDATE_QUERY_PARAMS_DELEGATE_H_
diff --git a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc
new file mode 100644
index 0000000..b6b0a4d
--- /dev/null
+++ b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc
@@ -0,0 +1,58 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate.h"
+
+#include <string>
+
+#include "base/bind.h"
+#include "base/callback_helpers.h"
+#include "base/strings/stringprintf.h"
+#include "components/update_client/update_query_params.h"
+#include "components/version_info/version_info.h"
+#include "ios/chrome/common/channel_info.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using base::StringPrintf;
+
+namespace {
+
+bool Contains(const std::string& source, const std::string& target) {
+  return source.find(target) != std::string::npos;
+}
+
+}  // namespace
+
+void TestParams(update_client::UpdateQueryParams::ProdId prod_id) {
+  std::string params = update_client::UpdateQueryParams::Get(prod_id);
+
+  EXPECT_TRUE(Contains(
+      params,
+      StringPrintf("os=%s", update_client::UpdateQueryParams::GetOS())));
+  EXPECT_TRUE(Contains(
+      params,
+      StringPrintf("arch=%s", update_client::UpdateQueryParams::GetArch())));
+  EXPECT_TRUE(Contains(
+      params, StringPrintf(
+                  "prod=%s",
+                  update_client::UpdateQueryParams::GetProdIdString(prod_id))));
+  EXPECT_TRUE(Contains(
+      params, StringPrintf("prodchannel=%s", GetChannelString().c_str())));
+  EXPECT_TRUE(
+      Contains(params, StringPrintf("prodversion=%s",
+                                    version_info::GetVersionNumber().c_str())));
+  EXPECT_TRUE(Contains(
+      params,
+      StringPrintf("lang=%s",
+                   IOSChromeUpdateQueryParamsDelegate::GetLang().c_str())));
+}
+
+TEST(IOSChromeUpdateQueryParamsDelegateTest, GetParams) {
+  base::ScopedClosureRunner runner(
+      base::Bind(update_client::UpdateQueryParams::SetDelegate, nullptr));
+  update_client::UpdateQueryParams::SetDelegate(
+      IOSChromeUpdateQueryParamsDelegate::GetInstance());
+
+  TestParams(update_client::UpdateQueryParams::CHROME);
+}
diff --git a/ios/chrome/ios_chrome.gyp b/ios/chrome/ios_chrome.gyp
index 7085d345..66c965a 100644
--- a/ios/chrome/ios_chrome.gyp
+++ b/ios/chrome/ios_chrome.gyp
@@ -68,6 +68,7 @@
         '../../components/components.gyp:keyed_service_ios',
         '../../components/components.gyp:leveldb_proto',
         '../../components/components.gyp:metrics',
+        '../../components/components.gyp:net_log',
         '../../components/components.gyp:network_time',
         '../../components/components.gyp:omnibox_browser',
         '../../components/components.gyp:open_from_clipboard',
@@ -281,6 +282,8 @@
         'browser/memory/memory_metrics.h',
         'browser/metrics/field_trial_synchronizer.cc',
         'browser/metrics/field_trial_synchronizer.h',
+        'browser/metrics/ios_chrome_metrics_service_accessor.h',
+        'browser/metrics/ios_chrome_metrics_service_accessor.cc',
         'browser/metrics/ios_chrome_stability_metrics_provider.h',
         'browser/metrics/ios_chrome_stability_metrics_provider.cc',
         'browser/metrics/ios_stability_metrics_provider.h',
@@ -465,6 +468,8 @@
         'browser/ui/uikit_ui_util.h',
         'browser/ui/uikit_ui_util.mm',
         'browser/ui/url_loader.h',
+        'browser/ui/webui/net_export/net_export_ui.cc',
+        'browser/ui/webui/net_export/net_export_ui.h',
         'browser/ui/webui/sync_internals/sync_internals_message_handler.cc',
         'browser/ui/webui/sync_internals/sync_internals_message_handler.h',
         'browser/ui/webui/sync_internals/sync_internals_ui.cc',
@@ -477,6 +482,8 @@
         'browser/updatable_config/updatable_config_base.mm',
         'browser/updatable_config/updatable_dictionary.h',
         'browser/updatable_config/updatable_dictionary.mm',
+        'browser/update_client/ios_chrome_update_query_params_delegate.cc',
+        'browser/update_client/ios_chrome_update_query_params_delegate.h',
         'browser/web/dom_altering_lock.h',
         'browser/web/dom_altering_lock.mm',
         'browser/web/web_view_type_util.h',
diff --git a/ios/chrome/ios_chrome_tests.gyp b/ios/chrome/ios_chrome_tests.gyp
index f0dcb55..8900fe1 100644
--- a/ios/chrome/ios_chrome_tests.gyp
+++ b/ios/chrome/ios_chrome_tests.gyp
@@ -17,6 +17,8 @@
         '../../components/components.gyp:enhanced_bookmarks_test_support',
         '../../components/components.gyp:metrics',
         '../../components/components.gyp:metrics_test_support',
+        '../../components/components.gyp:update_client',
+        '../../components/components.gyp:version_info',
         '../../net/net.gyp:net_test_support',
         '../../testing/gmock.gyp:gmock',
         '../../testing/gtest.gyp:gtest',
@@ -41,6 +43,7 @@
         'browser/geolocation/omnibox_geolocation_local_state_unittest.mm',
         'browser/install_time_util_unittest.mm',
         'browser/installation_notifier_unittest.mm',
+        'browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc',
         'browser/metrics/previous_session_info_unittest.mm',
         'browser/metrics/ios_chrome_stability_metrics_provider_unittest.cc',
         'browser/metrics/ios_stability_metrics_provider_unittest.mm',
@@ -59,6 +62,7 @@
         'browser/ui/native_content_controller_unittest.mm',
         'browser/ui/ui_util_unittest.mm',
         'browser/ui/uikit_ui_util_unittest.mm',
+        'browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc',
         'browser/web_resource/web_resource_util_unittest.cc',
         'common/string_util_unittest.mm',
       ],
diff --git a/ios/chrome/test/testing_application_context.cc b/ios/chrome/test/testing_application_context.cc
index 445aa442..4b70b86 100644
--- a/ios/chrome/test/testing_application_context.cc
+++ b/ios/chrome/test/testing_application_context.cc
@@ -69,3 +69,7 @@
 rappor::RapporService* TestingApplicationContext::GetRapporService() {
   return nullptr;
 }
+
+net_log::ChromeNetLog* TestingApplicationContext::GetNetLog() {
+  return nullptr;
+}
diff --git a/ios/chrome/test/testing_application_context.h b/ios/chrome/test/testing_application_context.h
index 6701e1f..37505f6 100644
--- a/ios/chrome/test/testing_application_context.h
+++ b/ios/chrome/test/testing_application_context.h
@@ -32,6 +32,7 @@
   metrics::MetricsService* GetMetricsService() override;
   policy::BrowserPolicyConnector* GetBrowserPolicyConnector() override;
   rappor::RapporService* GetRapporService() override;
+  net_log::ChromeNetLog* GetNetLog() override;
 
  private:
   base::ThreadChecker thread_checker_;
diff --git a/ios/web/web_state/web_view_internal_creation_util.mm b/ios/web/web_state/web_view_internal_creation_util.mm
index c25283a..3fdb1b15 100644
--- a/ios/web/web_state/web_view_internal_creation_util.mm
+++ b/ios/web/web_state/web_view_internal_creation_util.mm
@@ -187,6 +187,10 @@
 #endif
   PostWKWebViewCreation(result, browser_state);
 
+  // By default the web view uses a very sluggish scroll speed. Set it to a more
+  // reasonable value.
+  result.scrollView.decelerationRate = UIScrollViewDecelerationRateNormal;
+
   return result;
 }
 
diff --git a/ipc/attachment_broker.cc b/ipc/attachment_broker.cc
index 362fc1f..2fc4fb4 100644
--- a/ipc/attachment_broker.cc
+++ b/ipc/attachment_broker.cc
@@ -14,10 +14,8 @@
 
 // static
 void AttachmentBroker::SetGlobal(AttachmentBroker* broker) {
-  // TODO(erikchen): There should be a CHECK here to make sure that
-  // |g_attachment_broker| is nullptr. Right now, this causes problems with
-  // --single_process and similar testing conditions. I'm temporarily removing
-  // this CHECK. http://crbug.com/534539.
+  CHECK(!g_attachment_broker)
+      << "An attachment broker already exists with memory address: " << broker;
   g_attachment_broker = broker;
 }
 
diff --git a/ipc/ipc_message_utils.cc b/ipc/ipc_message_utils.cc
index 5c0c493..3baf2ee 100644
--- a/ipc/ipc_message_utils.cc
+++ b/ipc/ipc_message_utils.cc
@@ -548,8 +548,14 @@
                                                   const param_type& p) {
   m->WriteInt(p.GetType());
 
-  if (p.GetType() == base::SharedMemoryHandle::POSIX)
-    ParamTraits<base::FileDescriptor>::Write(m, p.GetFileDescriptor());
+  switch (p.GetType()) {
+    case base::SharedMemoryHandle::POSIX:
+      ParamTraits<base::FileDescriptor>::Write(m, p.GetFileDescriptor());
+      break;
+    case base::SharedMemoryHandle::MACH:
+      // TODO(erikchen): Implement me. http://crbug.com/535711
+      break;
+  }
 }
 
 bool ParamTraits<base::SharedMemoryHandle>::Read(const Message* m,
@@ -566,33 +572,44 @@
       shm_type = static_cast<base::SharedMemoryHandle::Type>(type);
       break;
     }
-    default:
+    default: {
       return false;
+    }
   }
 
-  if (shm_type == base::SharedMemoryHandle::POSIX) {
-    base::FileDescriptor file_descriptor;
+  switch (shm_type) {
+    case base::SharedMemoryHandle::POSIX: {
+      base::FileDescriptor file_descriptor;
 
-    bool success =
-        ParamTraits<base::FileDescriptor>::Read(m, iter, &file_descriptor);
-    if (!success)
-      return false;
+      bool success =
+          ParamTraits<base::FileDescriptor>::Read(m, iter, &file_descriptor);
+      if (!success)
+        return false;
 
-    *r = base::SharedMemoryHandle(file_descriptor.fd,
-                                  file_descriptor.auto_close);
-    return true;
+      *r = base::SharedMemoryHandle(file_descriptor.fd,
+                                    file_descriptor.auto_close);
+      return true;
+    }
+    case base::SharedMemoryHandle::MACH: {
+      // TODO(erikchen): Implement me. http://crbug.com/535711
+      return true;
+    }
   }
-
-  return true;
 }
 
 void ParamTraits<base::SharedMemoryHandle>::Log(const param_type& p,
                                                 std::string* l) {
-  if (p.GetType() == base::SharedMemoryHandle::POSIX) {
-    l->append(base::StringPrintf("Mechanism POSIX Fd"));
-    ParamTraits<base::FileDescriptor>::Log(p.GetFileDescriptor(), l);
+  switch (p.GetType()) {
+    case base::SharedMemoryHandle::POSIX:
+      l->append("POSIX Fd: ");
+      ParamTraits<base::FileDescriptor>::Log(p.GetFileDescriptor(), l);
+      break;
+    case base::SharedMemoryHandle::MACH:
+      // TODO(erikchen): Implement me. http://crbug.com/535711
+      break;
   }
 }
+
 #elif defined(OS_WIN)
 void ParamTraits<base::SharedMemoryHandle>::Write(Message* m,
                                                   const param_type& p) {
diff --git a/ipc/mojo/DEPS b/ipc/mojo/DEPS
index fb36693..40dca36e 100644
--- a/ipc/mojo/DEPS
+++ b/ipc/mojo/DEPS
@@ -1,4 +1,5 @@
 include_rules = [
+  "+mojo/edk/embedder",
   "+third_party/mojo/src/mojo/public",
   "+third_party/mojo/src/mojo/edk/embedder",
 ]
diff --git a/ipc/mojo/async_handle_waiter.cc b/ipc/mojo/async_handle_waiter.cc
index b9e68d7..652764e 100644
--- a/ipc/mojo/async_handle_waiter.cc
+++ b/ipc/mojo/async_handle_waiter.cc
@@ -86,6 +86,11 @@
   }
 
   void DidProcessIOEvent() override {
+    // This object could have been constructed in another's class's
+    // DidProcessIOEvent.
+    if (io_loop_level_== 0)
+      return;
+
     DCHECK_GE(io_loop_level_, 1);
 
     // Leaving a nested loop.
diff --git a/ipc/mojo/ipc_channel_mojo.cc b/ipc/mojo/ipc_channel_mojo.cc
index a0f3a9d..3f4d31f 100644
--- a/ipc/mojo/ipc_channel_mojo.cc
+++ b/ipc/mojo/ipc_channel_mojo.cc
@@ -6,6 +6,7 @@
 
 #include "base/bind.h"
 #include "base/bind_helpers.h"
+#include "base/command_line.h"
 #include "base/lazy_instance.h"
 #include "base/thread_task_runner_handle.h"
 #include "ipc/ipc_listener.h"
@@ -15,6 +16,7 @@
 #include "ipc/mojo/client_channel.mojom.h"
 #include "ipc/mojo/ipc_mojo_bootstrap.h"
 #include "ipc/mojo/ipc_mojo_handle_attachment.h"
+#include "mojo/edk/embedder/embedder.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "third_party/mojo/src/mojo/public/cpp/bindings/binding.h"
 
@@ -26,6 +28,10 @@
 
 namespace {
 
+// TODO(jam): do more tests on using channel on same thread if it supports it (
+// i.e. with use-new-edk and Windows). Also see message_pipe_dispatcher.cc
+bool g_use_channel_on_io_thread_only = true;
+
 class MojoChannelFactory : public ChannelFactory {
  public:
   MojoChannelFactory(scoped_refptr<base::TaskRunner> io_runner,
@@ -53,20 +59,47 @@
  public:
   ClientChannelMojo(scoped_refptr<base::TaskRunner> io_runner,
                     const ChannelHandle& handle,
-                    Listener* listener);
-  ~ClientChannelMojo() override;
+                    Listener* listener)
+      : ChannelMojo(io_runner, handle, Channel::MODE_CLIENT, listener),
+        binding_(this),
+        weak_factory_(this) {
+  }
+  ~ClientChannelMojo() override {}
+
   // MojoBootstrap::Delegate implementation
-  void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle) override;
+  void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle,
+                       int32 peer_pid) override {
+    if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) {
+      mojo::edk::ScopedPlatformHandle edk_handle(mojo::edk::PlatformHandle(
+#if defined(OS_WIN)
+          handle.release().handle));
+#else
+          handle.release().fd));
+#endif
+      InitMessageReader(
+          mojo::edk::CreateMessagePipe(edk_handle.Pass()), peer_pid);
+      return;
+    }
+    CreateMessagingPipe(handle.Pass(), base::Bind(&ClientChannelMojo::BindPipe,
+                                                  weak_factory_.GetWeakPtr()));
+  }
 
   // ClientChannel implementation
   void Init(
       mojo::ScopedMessagePipeHandle pipe,
       int32_t peer_pid,
-      const mojo::Callback<void(int32_t)>& callback) override;
+      const mojo::Callback<void(int32_t)>& callback) override {
+   InitMessageReader(pipe.Pass(), static_cast<base::ProcessId>(peer_pid));
+   callback.Run(GetSelfPID());
+  }
 
  private:
-  void BindPipe(mojo::ScopedMessagePipeHandle handle);
-  void OnConnectionError();
+  void BindPipe(mojo::ScopedMessagePipeHandle handle) {
+    binding_.Bind(handle.Pass());
+  }
+  void OnConnectionError() {
+    listener()->OnChannelError();
+  }
 
   mojo::Binding<ClientChannel> binding_;
   base::WeakPtrFactory<ClientChannelMojo> weak_factory_;
@@ -74,59 +107,81 @@
   DISALLOW_COPY_AND_ASSIGN(ClientChannelMojo);
 };
 
-ClientChannelMojo::ClientChannelMojo(scoped_refptr<base::TaskRunner> io_runner,
-                                     const ChannelHandle& handle,
-                                     Listener* listener)
-    : ChannelMojo(io_runner, handle, Channel::MODE_CLIENT, listener),
-      binding_(this),
-      weak_factory_(this) {}
-
-ClientChannelMojo::~ClientChannelMojo() {
-}
-
-void ClientChannelMojo::OnPipeAvailable(
-    mojo::embedder::ScopedPlatformHandle handle) {
-  CreateMessagingPipe(handle.Pass(), base::Bind(&ClientChannelMojo::BindPipe,
-                                                weak_factory_.GetWeakPtr()));
-}
-
-void ClientChannelMojo::Init(
-    mojo::ScopedMessagePipeHandle pipe,
-    int32_t peer_pid,
-    const mojo::Callback<void(int32_t)>& callback) {
-  InitMessageReader(pipe.Pass(), static_cast<base::ProcessId>(peer_pid));
-  callback.Run(GetSelfPID());
-}
-
-void ClientChannelMojo::BindPipe(mojo::ScopedMessagePipeHandle handle) {
-  binding_.Bind(handle.Pass());
-}
-
-void ClientChannelMojo::OnConnectionError() {
-  listener()->OnChannelError();
-}
-
 //------------------------------------------------------------------------------
 
 class ServerChannelMojo : public ChannelMojo {
  public:
   ServerChannelMojo(scoped_refptr<base::TaskRunner> io_runner,
                     const ChannelHandle& handle,
-                    Listener* listener);
-  ~ServerChannelMojo() override;
+                    Listener* listener)
+      : ChannelMojo(io_runner, handle, Channel::MODE_SERVER, listener),
+        weak_factory_(this) {
+  }
+  ~ServerChannelMojo() override {
+    Close();
+  }
 
   // MojoBootstrap::Delegate implementation
-  void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle) override;
+  void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle,
+                       int32 peer_pid) override {
+    if (base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk")) {
+      mojo::edk::ScopedPlatformHandle edk_handle(mojo::edk::PlatformHandle(
+#if defined(OS_WIN)
+          handle.release().handle));
+#else
+          handle.release().fd));
+#endif
+      message_pipe_ = mojo::edk::CreateMessagePipe(edk_handle.Pass());
+      if (!message_pipe_.is_valid()) {
+        LOG(WARNING) << "mojo::CreateMessagePipe failed: ";
+        listener()->OnChannelError();
+        return;
+      }
+      InitMessageReader(message_pipe_.Pass(), peer_pid);
+      return;
+    }
+
+    mojo::ScopedMessagePipeHandle peer;
+    MojoResult create_result =
+        mojo::CreateMessagePipe(nullptr, &message_pipe_, &peer);
+    if (create_result != MOJO_RESULT_OK) {
+      LOG(WARNING) << "mojo::CreateMessagePipe failed: " << create_result;
+      listener()->OnChannelError();
+      return;
+    }
+    CreateMessagingPipe(
+        handle.Pass(),
+        base::Bind(&ServerChannelMojo::InitClientChannel,
+                   weak_factory_.GetWeakPtr(), base::Passed(&peer)));
+  }
   // Channel override
-  void Close() override;
+  void Close() override {
+    client_channel_.reset();
+    message_pipe_.reset();
+    ChannelMojo::Close();
+  }
 
  private:
   void InitClientChannel(mojo::ScopedMessagePipeHandle peer_handle,
-                         mojo::ScopedMessagePipeHandle handle);
-  void OnConnectionError();
+                         mojo::ScopedMessagePipeHandle handle) {
+    client_channel_.Bind(
+        mojo::InterfacePtrInfo<ClientChannel>(handle.Pass(), 0u));
+    client_channel_.set_connection_error_handler(base::Bind(
+        &ServerChannelMojo::OnConnectionError, base::Unretained(this)));
+    client_channel_->Init(
+        peer_handle.Pass(), static_cast<int32_t>(GetSelfPID()),
+        base::Bind(&ServerChannelMojo::ClientChannelWasInitialized,
+                   base::Unretained(this)));
+  }
+
+  void OnConnectionError() {
+    listener()->OnChannelError();
+  }
 
   // ClientChannelClient implementation
-  void ClientChannelWasInitialized(int32_t peer_pid);
+  void ClientChannelWasInitialized(int32_t peer_pid) {
+    InitMessageReader(message_pipe_.Pass(), peer_pid);
+  }
 
   mojo::InterfacePtr<ClientChannel> client_channel_;
   mojo::ScopedMessagePipeHandle message_pipe_;
@@ -135,59 +190,6 @@
   DISALLOW_COPY_AND_ASSIGN(ServerChannelMojo);
 };
 
-ServerChannelMojo::ServerChannelMojo(scoped_refptr<base::TaskRunner> io_runner,
-                                     const ChannelHandle& handle,
-                                     Listener* listener)
-    : ChannelMojo(io_runner, handle, Channel::MODE_SERVER, listener),
-      weak_factory_(this) {}
-
-ServerChannelMojo::~ServerChannelMojo() {
-  Close();
-}
-
-void ServerChannelMojo::OnPipeAvailable(
-    mojo::embedder::ScopedPlatformHandle handle) {
-  mojo::ScopedMessagePipeHandle peer;
-  MojoResult create_result =
-      mojo::CreateMessagePipe(nullptr, &message_pipe_, &peer);
-  if (create_result != MOJO_RESULT_OK) {
-    LOG(WARNING) << "mojo::CreateMessagePipe failed: " << create_result;
-    listener()->OnChannelError();
-    return;
-  }
-  CreateMessagingPipe(
-      handle.Pass(),
-      base::Bind(&ServerChannelMojo::InitClientChannel,
-                 weak_factory_.GetWeakPtr(), base::Passed(&peer)));
-}
-
-void ServerChannelMojo::Close() {
-  client_channel_.reset();
-  message_pipe_.reset();
-  ChannelMojo::Close();
-}
-
-void ServerChannelMojo::InitClientChannel(
-    mojo::ScopedMessagePipeHandle peer_handle,
-    mojo::ScopedMessagePipeHandle handle) {
-  client_channel_.Bind(
-      mojo::InterfacePtrInfo<ClientChannel>(handle.Pass(), 0u));
-  client_channel_.set_connection_error_handler(base::Bind(
-      &ServerChannelMojo::OnConnectionError, base::Unretained(this)));
-  client_channel_->Init(
-      peer_handle.Pass(), static_cast<int32_t>(GetSelfPID()),
-      base::Bind(&ServerChannelMojo::ClientChannelWasInitialized,
-                 base::Unretained(this)));
-}
-
-void ServerChannelMojo::OnConnectionError() {
-  listener()->OnChannelError();
-}
-
-void ServerChannelMojo::ClientChannelWasInitialized(int32_t peer_pid) {
-  InitMessageReader(message_pipe_.Pass(), peer_pid);
-}
-
 #if defined(OS_POSIX) && !defined(OS_NACL)
 
 base::ScopedFD TakeOrDupFile(internal::PlatformFileAttachment* attachment) {
@@ -276,7 +278,8 @@
   // Create MojoBootstrap after all members are set as it touches
   // ChannelMojo from a different thread.
   bootstrap_ = MojoBootstrap::Create(handle, mode, this);
-  if (io_runner == base::MessageLoop::current()->task_runner()) {
+  if (!g_use_channel_on_io_thread_only ||
+      io_runner == base::MessageLoop::current()->task_runner()) {
     InitOnIOThread();
   } else {
     io_runner->PostTask(FROM_HERE, base::Bind(&ChannelMojo::InitOnIOThread,
@@ -298,7 +301,8 @@
     const CreateMessagingPipeCallback& callback) {
   auto return_callback = base::Bind(&ChannelMojo::OnMessagingPipeCreated,
                                     weak_factory_.GetWeakPtr(), callback);
-  if (base::ThreadTaskRunnerHandle::Get() == io_runner_) {
+  if (!g_use_channel_on_io_thread_only ||
+      base::ThreadTaskRunnerHandle::Get() == io_runner_) {
     CreateMessagingPipeOnIOThread(
         handle.Pass(), base::ThreadTaskRunnerHandle::Get(), return_callback);
   } else {
@@ -487,7 +491,7 @@
           }
 
           MojoHandle wrapped_handle;
-          MojoResult wrap_result = CreatePlatformHandleWrapper(
+          MojoResult wrap_result = mojo::embedder::CreatePlatformHandleWrapper(
               mojo::embedder::ScopedPlatformHandle(
                   mojo::embedder::PlatformHandle(file.release())),
               &wrapped_handle);
diff --git a/ipc/mojo/ipc_mojo_bootstrap.cc b/ipc/mojo/ipc_mojo_bootstrap.cc
index 32579f9..b668a7bc 100644
--- a/ipc/mojo/ipc_mojo_bootstrap.cc
+++ b/ipc/mojo/ipc_mojo_bootstrap.cc
@@ -31,11 +31,12 @@
 
   mojo::embedder::ScopedPlatformHandle server_pipe_;
   bool connected_;
+  int32_t peer_pid_;
 
   DISALLOW_COPY_AND_ASSIGN(MojoServerBootstrap);
 };
 
-MojoServerBootstrap::MojoServerBootstrap() : connected_(false) {
+MojoServerBootstrap::MojoServerBootstrap() : connected_(false), peer_pid_(0) {
 }
 
 void MojoServerBootstrap::SendClientPipe(int32_t peer_pid) {
@@ -78,6 +79,7 @@
 void MojoServerBootstrap::OnChannelConnected(int32_t peer_pid) {
   DCHECK_EQ(state(), STATE_INITIALIZED);
   connected_ = true;
+  peer_pid_ = peer_pid;
   SendClientPipe(peer_pid);
 }
 
@@ -91,7 +93,7 @@
   set_state(STATE_READY);
   CHECK(server_pipe_.is_valid());
   delegate()->OnPipeAvailable(
-      mojo::embedder::ScopedPlatformHandle(server_pipe_.release()));
+      mojo::embedder::ScopedPlatformHandle(server_pipe_.release()), peer_pid_);
 
   return true;
 }
@@ -107,10 +109,12 @@
   bool OnMessageReceived(const Message& message) override;
   void OnChannelConnected(int32_t peer_pid) override;
 
+  int32 peer_pid_;
+
   DISALLOW_COPY_AND_ASSIGN(MojoClientBootstrap);
 };
 
-MojoClientBootstrap::MojoClientBootstrap() {
+MojoClientBootstrap::MojoClientBootstrap() : peer_pid_(0) {
 }
 
 bool MojoClientBootstrap::OnMessageReceived(const Message& message) {
@@ -133,12 +137,13 @@
   set_state(STATE_READY);
   delegate()->OnPipeAvailable(
       mojo::embedder::ScopedPlatformHandle(mojo::embedder::PlatformHandle(
-          PlatformFileForTransitToPlatformFile(pipe))));
+          PlatformFileForTransitToPlatformFile(pipe))), peer_pid_);
 
   return true;
 }
 
 void MojoClientBootstrap::OnChannelConnected(int32_t peer_pid) {
+  peer_pid_ = peer_pid;
 }
 
 }  // namespace
diff --git a/ipc/mojo/ipc_mojo_bootstrap.h b/ipc/mojo/ipc_mojo_bootstrap.h
index c1ee64c6..27a038ba 100644
--- a/ipc/mojo/ipc_mojo_bootstrap.h
+++ b/ipc/mojo/ipc_mojo_bootstrap.h
@@ -28,7 +28,8 @@
   class Delegate {
    public:
     virtual void OnPipeAvailable(
-        mojo::embedder::ScopedPlatformHandle handle) = 0;
+        mojo::embedder::ScopedPlatformHandle handle,
+        int32 peer_pid) = 0;
     virtual void OnBootstrapError() = 0;
   };
 
diff --git a/ipc/mojo/ipc_mojo_bootstrap_unittest.cc b/ipc/mojo/ipc_mojo_bootstrap_unittest.cc
index 1c3d7ee..528c235 100644
--- a/ipc/mojo/ipc_mojo_bootstrap_unittest.cc
+++ b/ipc/mojo/ipc_mojo_bootstrap_unittest.cc
@@ -23,7 +23,8 @@
  public:
   TestingDelegate() : passed_(false) {}
 
-  void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle) override;
+  void OnPipeAvailable(mojo::embedder::ScopedPlatformHandle handle,
+                       int32 peer_pid) override;
   void OnBootstrapError() override;
 
   bool passed() const { return passed_; }
@@ -33,7 +34,8 @@
 };
 
 void TestingDelegate::OnPipeAvailable(
-    mojo::embedder::ScopedPlatformHandle handle) {
+    mojo::embedder::ScopedPlatformHandle handle,
+    int32 peer_pid) {
   passed_ = true;
   base::MessageLoop::current()->Quit();
 }
diff --git a/ipc/mojo/ipc_mojo_perftest.cc b/ipc/mojo/ipc_mojo_perftest.cc
index e3b91fd..6fdcbab 100644
--- a/ipc/mojo/ipc_mojo_perftest.cc
+++ b/ipc/mojo/ipc_mojo_perftest.cc
@@ -6,17 +6,17 @@
 #include "base/run_loop.h"
 #include "ipc/ipc_perftest_support.h"
 #include "ipc/mojo/ipc_channel_mojo.h"
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
 
 namespace {
 
 // This is needed because we rely on //base/test:test_support_perf and
 // it provides main() which doesn't have Mojo initialization.  We need
-// some way to call InitWithSimplePlatformSupport() only once before
-// using Mojo.
+// some way to call Init() only once before using Mojo.
 struct MojoInitialier {
   MojoInitialier() {
-    mojo::embedder::test::InitWithSimplePlatformSupport();
+    mojo::embedder::Init();
   }
 };
 
@@ -65,6 +65,20 @@
   run_loop.RunUntilIdle();
 }
 
+// Test to see how many channels we can create.
+TEST_F(MojoChannelPerfTest, DISABLED_MaxChannelCount) {
+#if defined(OS_POSIX)
+  LOG(INFO) << "base::GetMaxFds " << base::GetMaxFds();
+  base::SetFdLimit(20000);
+#endif
+
+  std::vector<mojo::embedder::PlatformChannelPair*> channels;
+  for (size_t i = 0; i < 10000; ++i) {
+    LOG(INFO) << "channels size: " << channels.size();
+    channels.push_back(new mojo::embedder::PlatformChannelPair());
+  }
+}
+
 class MojoTestClient : public IPC::test::PingPongTestClient {
  public:
   typedef IPC::test::PingPongTestClient SuperType;
diff --git a/ipc/mojo/run_all_unittests.cc b/ipc/mojo/run_all_unittests.cc
index fe2bf85c..6382474 100644
--- a/ipc/mojo/run_all_unittests.cc
+++ b/ipc/mojo/run_all_unittests.cc
@@ -6,7 +6,7 @@
 #include "base/bind.h"
 #include "base/test/launcher/unit_test_launcher.h"
 #include "base/test/test_suite.h"
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 
 #if defined(OS_ANDROID)
 #include "base/android/jni_android.h"
@@ -29,7 +29,7 @@
 }  // namespace
 
 int main(int argc, char** argv) {
-  mojo::embedder::test::InitWithSimplePlatformSupport();
+  mojo::embedder::Init();
 #if defined(OS_ANDROID)
   JNIEnv* env = base::android::AttachCurrentThread();
   base::RegisterContentUriTestUtils(env);
diff --git a/ipc/mojo/scoped_ipc_support.cc b/ipc/mojo/scoped_ipc_support.cc
index b1d530e..5729463 100644
--- a/ipc/mojo/scoped_ipc_support.cc
+++ b/ipc/mojo/scoped_ipc_support.cc
@@ -18,7 +18,8 @@
 namespace IPC {
 
 namespace {
-
+// TODO(use_chrome_edk)
+//class IPCSupportInitializer : public mojo::edk::ProcessDelegate {
 class IPCSupportInitializer : public mojo::embedder::ProcessDelegate {
  public:
   IPCSupportInitializer()
diff --git a/mandoline/BUILD.gn b/mandoline/BUILD.gn
index cfb9b290..3df7ccd 100644
--- a/mandoline/BUILD.gn
+++ b/mandoline/BUILD.gn
@@ -27,6 +27,10 @@
     "//mojo:tests",
   ]
 
+  data_deps = [
+    "//tools/perf/clear_system_cache",  # For startup.cold.* telemetry testing.
+  ]
+
   if (use_x11) {
     deps += [ "//tools/xdisplaycheck" ]
   }
diff --git a/media/audio/alsa/alsa_wrapper.cc b/media/audio/alsa/alsa_wrapper.cc
index d77e27e..4e229a5 100644
--- a/media/audio/alsa/alsa_wrapper.cc
+++ b/media/audio/alsa/alsa_wrapper.cc
@@ -42,6 +42,10 @@
   return snd_pcm_prepare(handle);
 }
 
+int AlsaWrapper::PcmDrain(snd_pcm_t* handle) {
+  return snd_pcm_drain(handle);
+}
+
 int AlsaWrapper::PcmDrop(snd_pcm_t* handle) {
   return snd_pcm_drop(handle);
 }
diff --git a/media/audio/alsa/alsa_wrapper.h b/media/audio/alsa/alsa_wrapper.h
index 4b3c295..d8b817a 100644
--- a/media/audio/alsa/alsa_wrapper.h
+++ b/media/audio/alsa/alsa_wrapper.h
@@ -30,6 +30,7 @@
                       snd_pcm_stream_t stream, int mode);
   virtual int PcmClose(snd_pcm_t* handle);
   virtual int PcmPrepare(snd_pcm_t* handle);
+  virtual int PcmDrain(snd_pcm_t* handle);
   virtual int PcmDrop(snd_pcm_t* handle);
   virtual int PcmDelay(snd_pcm_t* handle, snd_pcm_sframes_t* delay);
   virtual snd_pcm_sframes_t PcmWritei(snd_pcm_t* handle,
diff --git a/media/audio/alsa/audio_manager_alsa.cc b/media/audio/alsa/audio_manager_alsa.cc
index 1d658fc..29b6cb29 100644
--- a/media/audio/alsa/audio_manager_alsa.cc
+++ b/media/audio/alsa/audio_manager_alsa.cc
@@ -57,6 +57,7 @@
       break;
     case base::nix::DESKTOP_ENVIRONMENT_KDE3:
     case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+    case base::nix::DESKTOP_ENVIRONMENT_KDE5:
       command_line.SetProgram(base::FilePath("kmix"));
       break;
     case base::nix::DESKTOP_ENVIRONMENT_UNITY:
diff --git a/media/audio/cras/audio_manager_cras.cc b/media/audio/cras/audio_manager_cras.cc
index 411bec5a..e872ada 100644
--- a/media/audio/cras/audio_manager_cras.cc
+++ b/media/audio/cras/audio_manager_cras.cc
@@ -10,6 +10,7 @@
 #include "base/environment.h"
 #include "base/logging.h"
 #include "base/metrics/field_trial.h"
+#include "base/metrics/histogram.h"
 #include "base/nix/xdg_util.h"
 #include "base/stl_util.h"
 #include "chromeos/audio/audio_device.h"
@@ -40,10 +41,23 @@
 // Default input buffer size.
 const int kDefaultInputBufferSize = 1024;
 
-const char kBeamformingOnUniqueId[] = "beamforming-on";
-const char kBeamformingOffUniqueId[] = "beamforming-off";
+const char kBeamformingOnDeviceId[] = "default-beamforming-on";
+const char kBeamformingOffDeviceId[] = "default-beamforming-off";
 
-bool IsBeamformingDefaultedOn() {
+enum CrosBeamformingDeviceState {
+  BEAMFORMING_DEFAULT_ENABLED = 0,
+  BEAMFORMING_USER_ENABLED,
+  BEAMFORMING_DEFAULT_DISABLED,
+  BEAMFORMING_USER_DISABLED,
+  BEAMFORMING_STATE_MAX = BEAMFORMING_USER_DISABLED
+};
+
+void RecordBeamformingDeviceState(CrosBeamformingDeviceState state) {
+  UMA_HISTOGRAM_ENUMERATION("Media.CrosBeamformingDeviceState", state,
+                            BEAMFORMING_STATE_MAX + 1);
+}
+
+bool IsBeamformingDefaultEnabled() {
   return base::FieldTrialList::FindFullName("ChromebookBeamforming") ==
          "Enabled";
 }
@@ -56,27 +70,6 @@
                                           AudioManagerBase::kDefaultDeviceId));
 }
 
-// Adds the beamforming on and off devices to |device_names|.
-void AddBeamformingDevices(AudioDeviceNames* device_names) {
-  DCHECK(device_names->empty());
-  const AudioDeviceName beamforming_on_device(
-      GetLocalizedStringUTF8(BEAMFORMING_ON_DEFAULT_AUDIO_INPUT_DEVICE_NAME),
-      kBeamformingOnUniqueId);
-  const AudioDeviceName beamforming_off_device(
-      GetLocalizedStringUTF8(BEAMFORMING_OFF_DEFAULT_AUDIO_INPUT_DEVICE_NAME),
-      kBeamformingOffUniqueId);
-
-  if (IsBeamformingDefaultedOn()) {
-    // Users in the experiment will have the "beamforming on" device appear
-    // first in the list. This causes it to be selected by default.
-    device_names->push_back(beamforming_on_device);
-    device_names->push_back(beamforming_off_device);
-  } else {
-    device_names->push_back(beamforming_off_device);
-    device_names->push_back(beamforming_on_device);
-  }
-}
-
 // Returns a mic positions string if the machine has a beamforming capable
 // internal mic and otherwise an empty string.
 std::string MicPositions() {
@@ -95,6 +88,37 @@
 
 }  // namespace
 
+// Adds the beamforming on and off devices to |device_names|.
+void AudioManagerCras::AddBeamformingDevices(AudioDeviceNames* device_names) {
+  DCHECK(device_names->empty());
+  const std::string beamforming_on_name =
+      GetLocalizedStringUTF8(BEAMFORMING_ON_DEFAULT_AUDIO_INPUT_DEVICE_NAME);
+  const std::string beamforming_off_name =
+      GetLocalizedStringUTF8(BEAMFORMING_OFF_DEFAULT_AUDIO_INPUT_DEVICE_NAME);
+
+  if (IsBeamformingDefaultEnabled()) {
+    // The first device in the list is expected to have a "default" device ID.
+    // Web apps may depend on this behavior.
+    beamforming_on_device_id_ = AudioManagerBase::kDefaultDeviceId;
+    beamforming_off_device_id_ = kBeamformingOffDeviceId;
+
+    // Users in the experiment will have the "beamforming on" device appear
+    // first in the list. This causes it to be selected by default.
+    device_names->push_back(
+        AudioDeviceName(beamforming_on_name, beamforming_on_device_id_));
+    device_names->push_back(
+        AudioDeviceName(beamforming_off_name, beamforming_off_device_id_));
+  } else {
+    beamforming_off_device_id_ = AudioManagerBase::kDefaultDeviceId;
+    beamforming_on_device_id_ = kBeamformingOnDeviceId;
+
+    device_names->push_back(
+        AudioDeviceName(beamforming_off_name, beamforming_off_device_id_));
+    device_names->push_back(
+        AudioDeviceName(beamforming_on_name, beamforming_on_device_id_));
+  }
+}
+
 bool AudioManagerCras::HasAudioOutputDevices() {
   return true;
 }
@@ -110,7 +134,10 @@
 }
 
 AudioManagerCras::AudioManagerCras(AudioLogFactory* audio_log_factory)
-    : AudioManagerBase(audio_log_factory), has_keyboard_mic_(false) {
+    : AudioManagerBase(audio_log_factory),
+      has_keyboard_mic_(false),
+      beamforming_on_device_id_(nullptr),
+      beamforming_off_device_id_(nullptr) {
   SetMaxOutputStreamsAllowed(kMaxOutputStreams);
 }
 
@@ -156,8 +183,32 @@
                          buffer_size);
   if (has_keyboard_mic_)
     params.set_effects(AudioParameters::KEYBOARD_MIC);
-  if (device_id == kBeamformingOnUniqueId)
-    params.set_mic_positions(mic_positions_);
+
+  if (mic_positions_.size() > 1) {
+    // We have the mic_positions_ check here because one of the beamforming
+    // devices will have been assigned the "default" ID, which could otherwise
+    // be confused with the ID in the non-beamforming-capable-device case.
+    DCHECK(beamforming_on_device_id_);
+    DCHECK(beamforming_off_device_id_);
+
+    if (device_id == beamforming_on_device_id_) {
+      params.set_mic_positions(mic_positions_);
+
+      // Record a UMA metric based on the state of the experiment and the
+      // selected device. This will tell us i) how common it is for users to
+      // manually adjust the beamforming device and ii) how contaminated our
+      // metric experiment buckets are.
+      if (IsBeamformingDefaultEnabled())
+        RecordBeamformingDeviceState(BEAMFORMING_DEFAULT_ENABLED);
+      else
+        RecordBeamformingDeviceState(BEAMFORMING_USER_ENABLED);
+    } else if (device_id == beamforming_off_device_id_) {
+      if (!IsBeamformingDefaultEnabled())
+        RecordBeamformingDeviceState(BEAMFORMING_DEFAULT_DISABLED);
+      else
+        RecordBeamformingDeviceState(BEAMFORMING_USER_DISABLED);
+    }
+  }
   return params;
 }
 
diff --git a/media/audio/cras/audio_manager_cras.h b/media/audio/cras/audio_manager_cras.h
index 275f5c2..fbe01027 100644
--- a/media/audio/cras/audio_manager_cras.h
+++ b/media/audio/cras/audio_manager_cras.h
@@ -59,11 +59,16 @@
   AudioInputStream* MakeInputStream(const AudioParameters& params,
                                     const std::string& device_id);
 
+  void AddBeamformingDevices(AudioDeviceNames* device_names);
+
   bool has_keyboard_mic_;
 
   // Stores the mic positions field from the device.
   std::vector<Point> mic_positions_;
 
+  const char* beamforming_on_device_id_;
+  const char* beamforming_off_device_id_;
+
   DISALLOW_COPY_AND_ASSIGN(AudioManagerCras);
 };
 
diff --git a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
index 38a08187..b4213977 100644
--- a/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
+++ b/media/base/android/java/src/org/chromium/media/MediaCodecBridge.java
@@ -790,7 +790,6 @@
         }
     }
 
-    // TODO(xhwang): fix deprecation warnings crbug.com/527916
     @SuppressWarnings("deprecation")
     private int getAudioFormat(int channelCount) {
         switch (channelCount) {
@@ -803,7 +802,11 @@
             case 6:
                 return AudioFormat.CHANNEL_OUT_5POINT1;
             case 8:
-                return AudioFormat.CHANNEL_OUT_7POINT1;
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
+                    return AudioFormat.CHANNEL_OUT_7POINT1_SURROUND;
+                } else {
+                    return AudioFormat.CHANNEL_OUT_7POINT1;
+                }
             default:
                 return AudioFormat.CHANNEL_OUT_DEFAULT;
         }
diff --git a/media/base/android/java/src/org/chromium/media/MediaDrmBridge.java b/media/base/android/java/src/org/chromium/media/MediaDrmBridge.java
index 6d71eb6..c501c2a 100644
--- a/media/base/android/java/src/org/chromium/media/MediaDrmBridge.java
+++ b/media/base/android/java/src/org/chromium/media/MediaDrmBridge.java
@@ -946,8 +946,6 @@
         });
     }
 
-    // TODO(xhwang): fix deprecation warnings crbug.com/527916
-    @SuppressWarnings("deprecation")
     private class EventListener implements MediaDrm.OnEventListener {
         @Override
         public void onEvent(
@@ -961,9 +959,6 @@
                 return;
             }
             switch(event) {
-                case MediaDrm.EVENT_PROVISION_REQUIRED:
-                    Log.d(TAG, "MediaDrm.EVENT_PROVISION_REQUIRED");
-                    break;
                 case MediaDrm.EVENT_KEY_REQUIRED:
                     Log.d(TAG, "MediaDrm.EVENT_KEY_REQUIRED");
                     if (mProvisioningPending) {
diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc
index 78029e1d..b2f482d 100644
--- a/media/base/key_systems.cc
+++ b/media/base/key_systems.cc
@@ -446,7 +446,7 @@
              EmeFeatureSupport::ALWAYS_ENABLED);
     }
 
-    DCHECK(!IsSupportedKeySystem(info.key_system))
+    DCHECK(!IsConcreteSupportedKeySystem(info.key_system))
         << "Key system '" << info.key_system << "' already registered";
     DCHECK(!parent_key_system_map_.count(info.key_system))
         <<  "'" << info.key_system << "' is already registered as a parent";
@@ -660,7 +660,20 @@
 
 bool KeySystemsImpl::IsSupportedKeySystem(const std::string& key_system) const {
   DCHECK(thread_checker_.CalledOnValidThread());
-  return concrete_key_system_map_.count(key_system) != 0;
+
+  if (!IsConcreteSupportedKeySystem(key_system))
+    return false;
+
+  // TODO(ddorwin): Move this to where we add key systems when prefixed EME is
+  // removed (crbug.com/249976).
+  if (!IsPotentiallySupportedKeySystem(key_system)) {
+    // If you encounter this path, see the comments for the above function.
+    DLOG(ERROR) << "Unrecognized key system " << key_system
+                << ". See code comments.";
+    return false;
+  }
+
+  return true;
 }
 
 EmeConfigRule KeySystemsImpl::GetContentTypeConfigRule(
@@ -877,22 +890,6 @@
       key_system);
 }
 
-bool IsSupportedKeySystem(const std::string& key_system) {
-  if (!KeySystemsImpl::GetInstance()->IsSupportedKeySystem(key_system))
-    return false;
-
-  // TODO(ddorwin): Move this to where we add key systems when prefixed EME is
-  // removed (crbug.com/249976).
-  if (!IsPotentiallySupportedKeySystem(key_system)) {
-    // If you encounter this path, see the comments for the above function.
-    NOTREACHED() << "Unrecognized key system " << key_system
-                 << ". See code comments.";
-    return false;
-  }
-
-  return true;
-}
-
 bool IsSupportedKeySystemWithInitDataType(const std::string& key_system,
                                           EmeInitDataType init_data_type) {
   return KeySystemsImpl::GetInstance()->IsSupportedInitDataType(key_system,
diff --git a/media/base/key_systems.h b/media/base/key_systems.h
index ade5d65c..92a4b63 100644
--- a/media/base/key_systems.h
+++ b/media/base/key_systems.h
@@ -82,11 +82,6 @@
 MEDIA_EXPORT std::string GetPrefixedKeySystemName(
     const std::string& key_system);
 
-// Use for unprefixed EME only!
-// Returns whether |key_system| is a supported key system.
-// Note: Shouldn't be used for prefixed API as the original
-MEDIA_EXPORT bool IsSupportedKeySystem(const std::string& key_system);
-
 // Use for prefixed EME only!
 MEDIA_EXPORT bool IsSupportedKeySystemWithInitDataType(
     const std::string& key_system,
diff --git a/media/base/key_systems_unittest.cc b/media/base/key_systems_unittest.cc
index b97852d1..1254394 100644
--- a/media/base/key_systems_unittest.cc
+++ b/media/base/key_systems_unittest.cc
@@ -73,6 +73,10 @@
           EmeConfigRule::NOT_SUPPORTED);
 }
 
+static bool IsSupportedKeySystem(const std::string& key_system) {
+  return KeySystems::GetInstance()->IsSupportedKeySystem(key_system);
+}
+
 // Adds test container and codec masks.
 // This function must be called after SetMediaClient() if a MediaClient will be
 // provided.
diff --git a/media/base/video_capture_types.h b/media/base/video_capture_types.h
index 4790ea5..d6ad5e3 100644
--- a/media/base/video_capture_types.h
+++ b/media/base/video_capture_types.h
@@ -62,6 +62,7 @@
   FREQUENCY_60HZ = 60,
   FREQUENCY_MAX = FREQUENCY_60HZ
 };
+
 // Assert that the int:frequency mapping is correct.
 static_assert(static_cast<int>(PowerLineFrequency::FREQUENCY_DEFAULT) == 0,
               "static_cast<int>(FREQUENCY_DEFAULT) must equal 0.");
diff --git a/media/blink/webcontentdecryptionmodule_impl.cc b/media/blink/webcontentdecryptionmodule_impl.cc
index 1681b86..d6509da 100644
--- a/media/blink/webcontentdecryptionmodule_impl.cc
+++ b/media/blink/webcontentdecryptionmodule_impl.cc
@@ -43,7 +43,8 @@
 
   // TODO(ddorwin): This should be a DCHECK.
   std::string key_system_ascii = base::UTF16ToASCII(key_system);
-  if (!media::IsSupportedKeySystem(key_system_ascii)) {
+  if (!media::KeySystems::GetInstance()->IsSupportedKeySystem(
+          key_system_ascii)) {
     std::string message =
         "Keysystem '" + key_system_ascii + "' is not supported.";
     result->completeWithError(
diff --git a/media/capture/video/linux/video_capture_device_linux.cc b/media/capture/video/linux/video_capture_device_linux.cc
index 487199e..cbf2b490 100644
--- a/media/capture/video/linux/video_capture_device_linux.cc
+++ b/media/capture/video/linux/video_capture_device_linux.cc
@@ -132,11 +132,12 @@
 }
 
 // static
-int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2(int frequency) {
+int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2(
+    PowerLineFrequency frequency) {
   switch (frequency) {
-    case static_cast<int>(media::PowerLineFrequency::FREQUENCY_50HZ):
+    case media::PowerLineFrequency::FREQUENCY_50HZ:
       return V4L2_CID_POWER_LINE_FREQUENCY_50HZ;
-    case static_cast<int>(media::PowerLineFrequency::FREQUENCY_60HZ):
+    case media::PowerLineFrequency::FREQUENCY_60HZ:
       return V4L2_CID_POWER_LINE_FREQUENCY_60HZ;
     default:
       // If we have no idea of the frequency, at least try and set it to AUTO.
diff --git a/media/capture/video/linux/video_capture_device_linux.h b/media/capture/video/linux/video_capture_device_linux.h
index 61e2cba6..100d87f7 100644
--- a/media/capture/video/linux/video_capture_device_linux.h
+++ b/media/capture/video/linux/video_capture_device_linux.h
@@ -41,7 +41,7 @@
   void SetRotation(int rotation);
 
  private:
-  static int TranslatePowerLineFrequencyToV4L2(int frequency);
+  static int TranslatePowerLineFrequencyToV4L2(PowerLineFrequency frequency);
 
   // Internal delegate doing the actual capture setting, buffer allocation and
   // circulation with the V4L2 API. Created and deleted in the thread where
diff --git a/media/capture/video/mac/video_capture_device_mac.mm b/media/capture/video/mac/video_capture_device_mac.mm
index 8f71b681..5fc083e 100644
--- a/media/capture/video/mac/video_capture_device_mac.mm
+++ b/media/capture/video/mac/video_capture_device_mac.mm
@@ -189,7 +189,7 @@
 // set the appropriate Power Line frequency for flicker removal.
 static void SetAntiFlickerInVideoControlInterface(
     IOCFPlugInInterface** plugin_interface,
-    const int frequency) {
+    const PowerLineFrequency frequency) {
   // Create, the control interface for the found plugin, and release
   // the intermediate plugin.
   IOUSBInterfaceInterface** control_interface = NULL;
@@ -249,7 +249,8 @@
   command.wValue = (selector << 8);
   command.wLength = kPuPowerLineFrequencyControlCommandSize;
   command.wLenDone = 0;
-  int power_line_flag_value = (frequency == 50) ? k50Hz : k60Hz;
+  int power_line_flag_value =
+      (frequency == PowerLineFrequency::FREQUENCY_50HZ) ? k50Hz : k60Hz;
   command.pData = &power_line_flag_value;
 
   IOReturn ret =
@@ -257,8 +258,8 @@
   DLOG_IF(ERROR, ret != kIOReturnSuccess) << "Anti-flicker control request"
                                           << " failed (0x" << std::hex << ret
                                           << "), unit id: " << real_unit_id;
-  DVLOG_IF(1, ret == kIOReturnSuccess) << "Anti-flicker set to " << frequency
-                                       << "Hz";
+  DVLOG_IF(1, ret == kIOReturnSuccess) << "Anti-flicker set to "
+                                       << static_cast<int>(frequency) << "Hz";
 
   (*control_interface)->USBInterfaceClose(control_interface);
 }
@@ -270,11 +271,11 @@
 // are created. The latter is used to a send a power frequency setting command.
 static void SetAntiFlickerInUsbDevice(const int vendor_id,
                                       const int product_id,
-                                      const int frequency) {
-  if (frequency == 0)
+                                      const PowerLineFrequency frequency) {
+  if (frequency == PowerLineFrequency::FREQUENCY_DEFAULT)
     return;
-  DVLOG(1) << "Setting Power Line Frequency to " << frequency << " Hz, device "
-           << std::hex << vendor_id << "-" << product_id;
+  DVLOG(1) << "Setting Power Line Frequency to " << static_cast<int>(frequency)
+           << " Hz, device " << std::hex << vendor_id << "-" << product_id;
 
   // Compose a search dictionary with vendor and product ID.
   CFMutableDictionaryRef query_dictionary =
diff --git a/media/capture/video/video_capture_device.cc b/media/capture/video/video_capture_device.cc
index 01816c2..e7e2c91a 100644
--- a/media/capture/video/video_capture_device.cc
+++ b/media/capture/video/video_capture_device.cc
@@ -145,10 +145,11 @@
 VideoCaptureDevice::~VideoCaptureDevice() {
 }
 
-int VideoCaptureDevice::GetPowerLineFrequencyForLocation() const {
-  std::string current_country = base::CountryCodeForCurrentTimezone();
+PowerLineFrequency VideoCaptureDevice::GetPowerLineFrequencyForLocation()
+    const {
+  const std::string current_country = base::CountryCodeForCurrentTimezone();
   if (current_country.empty())
-    return 0;
+    return PowerLineFrequency::FREQUENCY_DEFAULT;
   // Sorted out list of countries with 60Hz power line frequency, from
   // http://en.wikipedia.org/wiki/Mains_electricity_by_country
   const char* countries_using_60Hz[] = {
@@ -160,17 +161,17 @@
       countries_using_60Hz + arraysize(countries_using_60Hz);
   if (std::find(countries_using_60Hz, countries_using_60Hz_end,
                 current_country) == countries_using_60Hz_end) {
-    return static_cast<int>(media::PowerLineFrequency::FREQUENCY_50HZ);
+    return media::PowerLineFrequency::FREQUENCY_50HZ;
   }
-  return static_cast<int>(media::PowerLineFrequency::FREQUENCY_60HZ);
+  return media::PowerLineFrequency::FREQUENCY_60HZ;
 }
 
-int VideoCaptureDevice::GetPowerLineFrequency(
+PowerLineFrequency VideoCaptureDevice::GetPowerLineFrequency(
     const VideoCaptureParams& params) const {
   switch (params.power_line_frequency) {
     case media::PowerLineFrequency::FREQUENCY_50HZ:  // fall through
     case media::PowerLineFrequency::FREQUENCY_60HZ:
-      return static_cast<int>(params.power_line_frequency);
+      return params.power_line_frequency;
     default:
       return GetPowerLineFrequencyForLocation();
   }
diff --git a/media/capture/video/video_capture_device.h b/media/capture/video/video_capture_device.h
index 33601336..b66409b5 100644
--- a/media/capture/video/video_capture_device.h
+++ b/media/capture/video/video_capture_device.h
@@ -283,12 +283,13 @@
 
   // Gets the power line frequency, either from the params if specified by the
   // user or from the current system time zone.
-  int GetPowerLineFrequency(const VideoCaptureParams& params) const;
+  PowerLineFrequency GetPowerLineFrequency(
+      const VideoCaptureParams& params) const;
 
  private:
   // Gets the power line frequency from the current system time zone if this is
   // defined, otherwise returns 0.
-  int GetPowerLineFrequencyForLocation() const;
+  PowerLineFrequency GetPowerLineFrequencyForLocation() const;
 };
 
 }  // namespace media
diff --git a/media/capture/video/win/video_capture_device_win.cc b/media/capture/video/win/video_capture_device_win.cc
index 055fc21..9960406e 100644
--- a/media/capture/video/win/video_capture_device_win.cc
+++ b/media/capture/video/win/video_capture_device_win.cc
@@ -539,11 +539,9 @@
 // Set the power line frequency removal in |capture_filter_| if available.
 void VideoCaptureDeviceWin::SetAntiFlickerInCaptureFilter(
     const VideoCaptureParams& params) {
-  const int power_line_frequency = GetPowerLineFrequency(params);
-  if (power_line_frequency !=
-          static_cast<int>(media::PowerLineFrequency::FREQUENCY_50HZ) &&
-      power_line_frequency !=
-          static_cast<int>(media::PowerLineFrequency::FREQUENCY_60HZ)) {
+  const PowerLineFrequency power_line_frequency = GetPowerLineFrequency(params);
+  if (power_line_frequency != media::PowerLineFrequency::FREQUENCY_50HZ &&
+      power_line_frequency != media::PowerLineFrequency::FREQUENCY_60HZ) {
     return;
   }
   ScopedComPtr<IKsPropertySet> ks_propset;
@@ -559,10 +557,9 @@
     data.Property.Set = PROPSETID_VIDCAP_VIDEOPROCAMP;
     data.Property.Id = KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY;
     data.Property.Flags = KSPROPERTY_TYPE_SET;
-    data.Value = (power_line_frequency ==
-                  static_cast<int>(media::PowerLineFrequency::FREQUENCY_50HZ))
-                     ? 1
-                     : 2;
+    data.Value =
+        (power_line_frequency == media::PowerLineFrequency::FREQUENCY_50HZ) ? 1
+                                                                            : 2;
     data.Flags = KSPROPERTY_VIDEOPROCAMP_FLAGS_MANUAL;
     hr = ks_propset->Set(PROPSETID_VIDCAP_VIDEOPROCAMP,
                          KSPROPERTY_VIDEOPROCAMP_POWERLINE_FREQUENCY, &data,
diff --git a/media/cast/sender/vp8_quantizer_parser.cc b/media/cast/sender/vp8_quantizer_parser.cc
index 1af91f9..167e7ccc 100644
--- a/media/cast/sender/vp8_quantizer_parser.cc
+++ b/media/cast/sender/vp8_quantizer_parser.cc
@@ -12,11 +12,11 @@
 // Vp8BitReader is a re-implementation of a subset of the VP8 entropy decoder.
 // It is used to decompress the VP8 bitstream for the purposes of quickly
 // parsing the VP8 frame headers.  It is mostly the exact same implementation
-// found in third_party/libvpx/.../vp8/decoder/dboolhuff.h except that only the
-// portion of the implementation needed to parse the frame headers is present.
-// As of this writing, the implementation in libvpx could not be re-used
-// because of the way that the code is structured, and lack of the necessary
-// parts being exported.
+// found in third_party/libvpx_new/.../vp8/decoder/dboolhuff.h except that only
+// the portion of the implementation needed to parse the frame headers is
+// present. As of this writing, the implementation in libvpx could not be
+// re-used because of the way that the code is structured, and lack of the
+// necessary parts being exported.
 class Vp8BitReader {
  public:
   Vp8BitReader(const uint8* data, size_t size)
diff --git a/media/test/data/test_key_system_instantiation.html b/media/test/data/test_key_system_instantiation.html
index 0199920..93e4869 100644
--- a/media/test/data/test_key_system_instantiation.html
+++ b/media/test/data/test_key_system_instantiation.html
@@ -1,21 +1,90 @@
 <html>
   <body>
-    <video controls="" name="video">
-      <!-- This test doesn't play the video, so any file will do
-           as long as it can be loaded. -->
-      <source src="bear-320x240-av_enc-a.webm" type="video/webm">
-    </video>
     <script type="text/javascript">
-      function testKeySystemInstantiation(keySystem) {
-        var video = document.getElementsByTagName('video')[0];
-        var initData = new Uint8Array([0x41, 0x42, 0x43]);
-        try {
-          video.webkitGenerateKeyRequest(keySystem, initData);
-          return 'success';
-        } catch (err) {
-          return err.name;
+      // Since promises run asynchronously, use the pages title to keep track
+      // of the result.
+      function setResultInTitle(title) {
+        document.title = title;
+      };
+
+      // Compares 2 arrays of MediaKeySystemMediaCapability, comparing only
+      // |contentType|. This assumes the order is the same. Returns "success"
+      // if they match, an error message if they don't.
+      function verifyCapabilitiesAreEqual(actual, expected) {
+        if (actual.length != expected.length)
+          return "mismatched lengths";
+        for (var i = 0; i < actual.length; i++) {
+          // Only compare |contentType|. Other properties are ignored.
+          if (actual[i].contentType !== expected[i].contentType)
+            return actual[i].contentType + " does not match " +
+                   expected[i].contentType + " at index " + i;
         }
+        return "success";
       }
+
+      // Calls navigator.requestMediaKeySystemAccess() using the supplied codec
+      // lists, and then verifies the result. Sets page title when done.
+      function requestMediaKeySystemAccessAndVerifyConfiguration(
+          keySystem, initDataType, audioCodecList, videoCodecList) {
+        var configuration = {initDataTypes: [initDataType]};
+        if (audioCodecList !== null) {
+          configuration.audioCapabilities = [];
+          for (entry of audioCodecList) {
+            configuration.audioCapabilities.push({contentType: entry});
+          };
+        }
+        if (videoCodecList !== null) {
+          configuration.videoCapabilities = [];
+          for (entry of videoCodecList) {
+            configuration.videoCapabilities.push({contentType: entry});
+          };
+        }
+        // This is using promises which will run asynchronously.
+        navigator.requestMediaKeySystemAccess(keySystem, [configuration])
+            .then(function(response) {
+              var allowedConfig = response.getConfiguration();
+              if (allowedConfig.initDataTypes.length !== 1) {
+                setResultInTitle("initDataType length mismatch");
+                return;
+              }
+              if (allowedConfig.initDataTypes[0] !== initDataType) {
+                setResultInTitle("initDataType returned " +
+                                 allowedConfig.initDataTypes[0] +
+                                 ", expected " + initDataType);
+                return;
+              }
+              if (audioCodecList !== null) {
+                var result =
+                    verifyCapabilitiesAreEqual(allowedConfig.audioCapabilities,
+                                            configuration.audioCapabilities);
+                if (result !== "success") {
+                  setResultInTitle(result);
+                  return;
+                }
+              } else if (allowedConfig.audioCapabilities) {
+                setResultInTitle("audioCapabilities set when none expected");
+                return;
+              }
+              if (videoCodecList !== null) {
+                setResultInTitle(
+                    verifyCapabilitiesAreEqual(allowedConfig.videoCapabilities,
+                                            configuration.videoCapabilities));
+                return;
+              } else if (allowedConfig.videoCapabilities) {
+                setResultInTitle("videoCapabilities set when none expected");
+                return;
+              }
+              setResultInTitle("success");
+            })
+            .catch(function(err) { setResultInTitle(err.message); });
+      };
+
+      function checkKeySystemWithMediaMimeType(keySystem, initDataType,
+                                               audioCodecList, videoCodecList) {
+        setResultInTitle("");
+        requestMediaKeySystemAccessAndVerifyConfiguration(
+            keySystem, initDataType, audioCodecList, videoCodecList);
+      };
     </script>
   </body>
 </html>
diff --git a/mojo/BUILD.gn b/mojo/BUILD.gn
index 9e42c4c..04f79cb1 100644
--- a/mojo/BUILD.gn
+++ b/mojo/BUILD.gn
@@ -34,6 +34,7 @@
 group("mojo_public_bindings_unittests_run") {
   testonly = true
   deps = [
+    # TODO(use_chrome_edk): "//mojo/edk/test:mojo_public_bindings_unittests"
     "//third_party/mojo/src/mojo/edk/test:mojo_public_bindings_unittests",
   ]
 }
@@ -43,6 +44,7 @@
 group("mojo_public_environment_unittests_run") {
   testonly = true
   deps = [
+    # TODO(use_chrome_edk): "//mojo/edk/test:mojo_public_environment_unittests"
     "//third_party/mojo/src/mojo/edk/test:mojo_public_environment_unittests",
   ]
 }
@@ -52,6 +54,7 @@
 group("mojo_public_system_unittests_run") {
   testonly = true
   deps = [
+    # TODO(use_chrome_edk): "//mojo/edk/test:mojo_public_system_unittests"
     "//third_party/mojo/src/mojo/edk/test:mojo_public_system_unittests",
   ]
 }
@@ -61,6 +64,7 @@
 group("mojo_public_utility_unittests_run") {
   testonly = true
   deps = [
+    # TODO(use_chrome_edk): "//mojo/edk/test:mojo_public_utility_unittests"
     "//third_party/mojo/src/mojo/edk/test:mojo_public_utility_unittests",
   ]
 }
@@ -72,6 +76,16 @@
     "//mojo/application/public/cpp/tests:mojo_public_application_unittests",
     "//mojo/common:mojo_common_unittests",
     "//mojo/converters/surfaces/tests:mojo_surfaces_lib_unittests",
+
+    # TODO(use_chrome_edk):
+    #"//mojo/edk/js/test:js_unittests",
+    #"//mojo/edk/system:mojo_message_pipe_perftests",
+    #"//mojo/edk/system:mojo_system_unittests",
+    #"//mojo/edk/test:mojo_public_bindings_unittests",
+    #"//mojo/edk/test:mojo_public_environment_unittests",
+    #"//mojo/edk/test:mojo_public_system_perftests",
+    #"//mojo/edk/test:mojo_public_system_unittests",
+    #"//mojo/edk/test:mojo_public_utility_unittests",
     "//third_party/mojo/src/mojo/edk/js/test:js_unittests",
     "//third_party/mojo/src/mojo/edk/system:mojo_message_pipe_perftests",
     "//third_party/mojo/src/mojo/edk/system:mojo_system_unittests",
diff --git a/mojo/android/javatests/init_library.cc b/mojo/android/javatests/init_library.cc
index 92d11d9..8615897 100644
--- a/mojo/android/javatests/init_library.cc
+++ b/mojo/android/javatests/init_library.cc
@@ -10,8 +10,7 @@
 #include "mojo/android/javatests/mojo_test_case.h"
 #include "mojo/android/javatests/validation_test_util.h"
 #include "mojo/android/system/core_impl.h"
-#include "mojo/edk/embedder/embedder.h"
-#include "mojo/edk/embedder/simple_platform_support.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 
 namespace {
 
@@ -28,8 +27,7 @@
 }
 
 bool Init() {
-  mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>(
-      new mojo::embedder::SimplePlatformSupport()));
+  mojo::embedder::Init();
   return true;
 }
 
diff --git a/mojo/edk/DEPS b/mojo/edk/DEPS
new file mode 100644
index 0000000..7fa76cd
--- /dev/null
+++ b/mojo/edk/DEPS
@@ -0,0 +1,13 @@
+include_rules = [
+  # This code is checked into the chromium repo so it's fine to depend on this.
+  "+base",
+  "+crypto",
+  "+build",
+  "+gin",
+  "+testing",
+  "+third_party/ashmem",
+  "+v8",
+
+  # internal includes.
+  "+mojo",
+]
diff --git a/mojo/edk/embedder/BUILD.gn b/mojo/edk/embedder/BUILD.gn
new file mode 100644
index 0000000..9a6f57d4
--- /dev/null
+++ b/mojo/edk/embedder/BUILD.gn
@@ -0,0 +1,146 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../mojo_edk.gni")
+
+mojo_edk_source_set("embedder") {
+  # This isn't really a standalone target; it must be linked into the
+  # mojo_system_impl component.
+  visibility = [
+    "//mojo/edk/system",
+    "//components/nacl:nacl",
+  ]
+
+  sources = [
+    "configuration.h",
+    "embedder.cc",
+    "embedder.h",
+    "embedder_internal.h",
+    "entrypoints.cc",
+
+    # Test-only code:
+    # TODO(vtl): It's a little unfortunate that these end up in the same
+    # component as non-test-only code. In the static build, this code should
+    # hopefully be dead-stripped.
+    "test_embedder.cc",
+    "test_embedder.h",
+  ]
+
+  defines = [
+    "MOJO_SYSTEM_IMPL_IMPLEMENTATION",
+    "MOJO_SYSTEM_IMPLEMENTATION",
+  ]
+
+  configs = [ "//mojo/edk/system:system_config" ]
+
+  public_deps = [
+    ":delegates",
+    ":platform",
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+
+  deps = [
+    "//base",
+  ]
+}
+
+mojo_edk_source_set("platform") {
+  # This isn't really a standalone target; it must be linked into the
+  # mojo_system_impl component.
+  visibility = [
+    ":embedder",
+    "//mojo/edk/system",
+  ]
+
+  sources = [
+    "platform_channel_pair.cc",
+    "platform_channel_pair.h",
+    "platform_channel_pair_posix.cc",
+    "platform_channel_pair_win.cc",
+    "platform_channel_utils_posix.cc",
+    "platform_channel_utils_posix.h",
+    "platform_handle.cc",
+    "platform_handle.h",
+    "platform_handle_utils.h",
+    "platform_handle_utils_posix.cc",
+    "platform_handle_utils_win.cc",
+    "platform_handle_vector.h",
+    "platform_shared_buffer.h",
+    "platform_support.h",
+    "scoped_platform_handle.h",
+    "simple_platform_shared_buffer.cc",
+    "simple_platform_shared_buffer.h",
+    "simple_platform_shared_buffer_android.cc",
+    "simple_platform_shared_buffer_posix.cc",
+    "simple_platform_shared_buffer_win.cc",
+    "simple_platform_support.cc",
+    "simple_platform_support.h",
+  ]
+
+  defines = [ "MOJO_SYSTEM_IMPL_IMPLEMENTATION" ]
+
+  configs = [ "//mojo/edk/system:system_config" ]
+
+  public_deps = [
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+
+  deps = [
+    "//base",
+  ]
+
+  if (is_android) {
+    deps += [ "//third_party/ashmem" ]
+  }
+}
+
+mojo_edk_source_set("delegates") {
+  # This isn't really a standalone target; it must be linked into the
+  # mojo_system_impl component.
+  visibility = [
+    ":embedder",
+    "//mojo/edk/system",
+  ]
+
+  sources = [
+    "process_delegate.h",
+  ]
+
+  defines = [ "MOJO_SYSTEM_IMPL_IMPLEMENTATION" ]
+
+  configs = [ "//mojo/edk/system:system_config" ]
+
+  public_deps = [
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+}
+
+# TODO(use_chrome_edk): remove "2"
+mojo_edk_source_set("embedder_unittests2") {
+  testonly = true
+
+  # TODO(use_chrome_edk): remove "2". Also enable this visibility check when we
+  # figure out why it's failing just on Android.
+  #visibility = [ "//mojo/edk/system:mojo_system_unittests2" ]
+
+  sources = [
+    "embedder_unittest.cc",
+    "platform_channel_pair_posix_unittest.cc",
+    "simple_platform_shared_buffer_unittest.cc",
+  ]
+
+  deps = [
+    "//base",
+    "//base/test:test_support",
+    "//mojo/edk/system",
+    "//mojo/message_pump",
+
+    # TODO(use_chrome_edk): temporary since the Mojo wrapper primitives are
+    # declared in third party only for now.
+    "//third_party/mojo/src/mojo/edk/system",
+    "//mojo/edk/system:test_utils",
+    "//mojo/edk/test:test_support",
+    "//testing/gtest",
+  ]
+}
diff --git a/mojo/edk/embedder/README.md b/mojo/edk/embedder/README.md
new file mode 100644
index 0000000..f976fcb
--- /dev/null
+++ b/mojo/edk/embedder/README.md
@@ -0,0 +1,13 @@
+Mojo Embedder API
+=================
+
+The Mojo Embedder API is an unstable, internal API to the Mojo system
+implementation. It should be used by code running on top of the system-level
+APIs to set up the Mojo environment (instead of directly instantiating things
+from src/mojo/edk/system).
+
+Example uses: Mojo shell, to set up the Mojo environment for Mojo apps; Chromium
+code, to set up the Mojo IPC system for use between processes. Note that most
+code should use the Mojo Public API (under src/mojo/public) instead. The
+Embedder API should only be used to initialize the environment, set up the
+initial MessagePipe between two processes, etc.
diff --git a/mojo/edk/embedder/configuration.h b/mojo/edk/embedder/configuration.h
new file mode 100644
index 0000000..c63d018
--- /dev/null
+++ b/mojo/edk/embedder/configuration.h
@@ -0,0 +1,68 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_CONFIGURATION_H_
+#define MOJO_EDK_EMBEDDER_CONFIGURATION_H_
+
+#include <stddef.h>
+
+namespace mojo {
+namespace edk {
+
+// A set of constants that the Mojo system internally uses. These values should
+// be consistent across all processes on the same system.
+//
+// In general, there should be no need to change these values from their
+// defaults. However, if you do change them, you must do so before
+// initialization.
+struct Configuration {
+  // Maximum number of open (Mojo) handles. The default is 1,000,000.
+  //
+  // TODO(vtl): This doesn't count "live" handles, some of which may live in
+  // messages.
+  size_t max_handle_table_size;
+
+  // Maximum number of active memory mappings. The default is 1,000,000.
+  size_t max_mapping_table_sze;
+
+  // Upper limit of |MojoWaitMany()|'s |num_handles|. The default is 1,000,000.
+  // Must be same as or smaller than |max_handle_table_size|.
+  size_t max_wait_many_num_handles;
+
+  // Maximum data size of messages sent over message pipes, in bytes. The
+  // default is 4MB.
+  size_t max_message_num_bytes;
+
+  // Maximum number of handles that can be attached to messages sent over
+  // message pipes. The default is 10,000.
+  size_t max_message_num_handles;
+
+  // Maximum capacity of a data pipe, in bytes. The default is 256MB. This value
+  // must fit into a |uint32_t|. WARNING: If you bump it closer to 2^32, you
+  // must audit all the code to check that we don't overflow (2^31 would
+  // definitely be risky; up to 2^30 is probably okay).
+  size_t max_data_pipe_capacity_bytes;
+
+  // Default data pipe capacity, if not specified explicitly in the creation
+  // options. The default is 1MB.
+  size_t default_data_pipe_capacity_bytes;
+
+  // Alignment for the "start" of the data buffer used by data pipes. (The
+  // alignment of elements will depend on this and the element size.)  The
+  // default is 16 bytes.
+  size_t data_pipe_buffer_alignment_bytes;
+
+  // Maximum size of a single shared memory segment, in bytes. The default is
+  // 1GB.
+  //
+  // TODO(vtl): Set this hard limit appropriately (e.g., higher on 64-bit).
+  // (This will also entail some auditing to make sure I'm not messing up my
+  // checks anywhere.)
+  size_t max_shared_memory_num_bytes;
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_CONFIGURATION_H_
diff --git a/mojo/edk/embedder/embedder.cc b/mojo/edk/embedder/embedder.cc
new file mode 100644
index 0000000..9f2b94a
--- /dev/null
+++ b/mojo/edk/embedder/embedder.cc
@@ -0,0 +1,171 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/embedder.h"
+
+#include "base/atomicops.h"
+#include "base/bind.h"
+#include "base/bind_helpers.h"
+#include "base/location.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/task_runner.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/embedder/process_delegate.h"
+#include "mojo/edk/embedder/simple_platform_support.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/core.h"
+#include "mojo/edk/system/message_pipe_dispatcher.h"
+#include "mojo/edk/system/platform_handle_dispatcher.h"
+
+namespace mojo {
+namespace edk {
+
+// TODO(jam): move into annonymous namespace. Keep outside for debugging in VS
+// temporarily.
+int g_channel_count = 0;
+bool g_wait_for_no_more_channels = false;
+
+namespace {
+
+// Note: Called on the I/O thread.
+void ShutdownIPCSupportHelper(bool wait_for_no_more_channels) {
+  if (wait_for_no_more_channels && g_channel_count) {
+    g_wait_for_no_more_channels = true;
+    return;
+  }
+
+  internal::g_delegate_thread_task_runner->PostTask(
+      FROM_HERE, base::Bind(&ProcessDelegate::OnShutdownComplete,
+                            base::Unretained(internal::g_process_delegate)));
+}
+
+}  // namespace
+
+namespace internal {
+
+// Declared in embedder_internal.h.
+PlatformSupport* g_platform_support = nullptr;
+Core* g_core = nullptr;
+
+base::TaskRunner* g_delegate_thread_task_runner;
+ProcessDelegate* g_process_delegate;
+base::TaskRunner* g_io_thread_task_runner = nullptr;
+
+void ChannelStarted() {
+  DCHECK(g_io_thread_task_runner->RunsTasksOnCurrentThread());
+  g_channel_count++;
+}
+
+void ChannelShutdown() {
+  DCHECK(g_io_thread_task_runner->RunsTasksOnCurrentThread());
+  g_channel_count--;
+  if (!g_channel_count && g_wait_for_no_more_channels) {
+    // Reset g_wait_for_no_more_channels for unit tests which initialize and
+    // tear down multiple times in a process.
+    g_wait_for_no_more_channels = false;
+    ShutdownIPCSupportHelper(false);
+  }
+}
+
+}  // namespace internal
+
+void SetMaxMessageSize(size_t bytes) {
+  GetMutableConfiguration()->max_message_num_bytes = bytes;
+}
+
+void Init() {
+  DCHECK(!internal::g_platform_support);
+  internal::g_platform_support = new SimplePlatformSupport();
+
+  DCHECK(!internal::g_core);
+  internal::g_core = new Core(internal::g_platform_support);
+}
+
+MojoResult AsyncWait(MojoHandle handle,
+                     MojoHandleSignals signals,
+                     const base::Callback<void(MojoResult)>& callback) {
+  return internal::g_core->AsyncWait(handle, signals, callback);
+}
+
+MojoResult CreatePlatformHandleWrapper(
+    ScopedPlatformHandle platform_handle,
+    MojoHandle* platform_handle_wrapper_handle) {
+  DCHECK(platform_handle_wrapper_handle);
+
+  scoped_refptr<Dispatcher> dispatcher =
+      PlatformHandleDispatcher::Create(platform_handle.Pass());
+
+  DCHECK(internal::g_core);
+  MojoHandle h = internal::g_core->AddDispatcher(dispatcher);
+  if (h == MOJO_HANDLE_INVALID) {
+    LOG(ERROR) << "Handle table full";
+    dispatcher->Close();
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+  }
+
+  *platform_handle_wrapper_handle = h;
+  return MOJO_RESULT_OK;
+}
+
+MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
+                                     ScopedPlatformHandle* platform_handle) {
+  DCHECK(platform_handle);
+
+  DCHECK(internal::g_core);
+  scoped_refptr<Dispatcher> dispatcher(
+      internal::g_core->GetDispatcher(platform_handle_wrapper_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  if (dispatcher->GetType() != Dispatcher::Type::PLATFORM_HANDLE)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  *platform_handle =
+      static_cast<PlatformHandleDispatcher*>(dispatcher.get())
+          ->PassPlatformHandle()
+          .Pass();
+  return MOJO_RESULT_OK;
+}
+
+void InitIPCSupport(scoped_refptr<base::TaskRunner> delegate_thread_task_runner,
+                    ProcessDelegate* process_delegate,
+                    scoped_refptr<base::TaskRunner> io_thread_task_runner) {
+  // |Init()| must have already been called.
+  DCHECK(internal::g_core);
+  internal::g_delegate_thread_task_runner = delegate_thread_task_runner.get();
+  internal::g_process_delegate = process_delegate;
+  internal::g_io_thread_task_runner = io_thread_task_runner.get();
+}
+
+void ShutdownIPCSupportOnIOThread() {
+}
+
+void ShutdownIPCSupport() {
+  internal::g_io_thread_task_runner->PostTask(
+      FROM_HERE, base::Bind(&ShutdownIPCSupportHelper, false));
+}
+
+void ShutdownIPCSupportAndWaitForNoChannels() {
+  internal::g_io_thread_task_runner->PostTask(
+      FROM_HERE, base::Bind(&ShutdownIPCSupportHelper, true));
+}
+
+ScopedMessagePipeHandle CreateMessagePipe(
+    ScopedPlatformHandle platform_handle) {
+  scoped_refptr<MessagePipeDispatcher> dispatcher =
+      MessagePipeDispatcher::Create(
+          MessagePipeDispatcher::kDefaultCreateOptions);
+
+  ScopedMessagePipeHandle rv(
+      MessagePipeHandle(internal::g_core->AddDispatcher(dispatcher)));
+  CHECK(rv.is_valid());
+  dispatcher->Init(platform_handle.Pass());
+  // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it
+  // once that's fixed.
+  return rv.Pass();
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/embedder.h b/mojo/edk/embedder/embedder.h
new file mode 100644
index 0000000..30a548e5
--- /dev/null
+++ b/mojo/edk/embedder/embedder.h
@@ -0,0 +1,111 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_EMBEDDER_H_
+#define MOJO_EDK_EMBEDDER_EMBEDDER_H_
+
+#include <string>
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/task_runner.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/message_pipe.h"
+
+namespace mojo {
+namespace edk {
+
+class ProcessDelegate;
+
+// Basic configuration/initialization ------------------------------------------
+
+// |Init()| sets up the basic Mojo system environment, making the |Mojo...()|
+// functions available and functional. This is never shut down (except in tests
+// -- see test_embedder.h).
+
+// Allows changing the default max message size. Must be called before Init.
+MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes);
+
+// Must be called first, or just after setting configuration parameters, to
+// initialize the (global, singleton) system.
+MOJO_SYSTEM_IMPL_EXPORT void Init();
+
+// Basic functions -------------------------------------------------------------
+
+// The functions in this section are available once |Init()| has been called.
+
+// Start waiting on the handle asynchronously. On success, |callback| will be
+// called exactly once, when |handle| satisfies a signal in |signals| or it
+// becomes known that it will never do so. |callback| will be executed on an
+// arbitrary thread, so it must not call any Mojo system or embedder functions.
+MOJO_SYSTEM_IMPL_EXPORT MojoResult
+AsyncWait(MojoHandle handle,
+          MojoHandleSignals signals,
+          const base::Callback<void(MojoResult)>& callback);
+
+// Creates a |MojoHandle| that wraps the given |PlatformHandle| (taking
+// ownership of it). This |MojoHandle| can then, e.g., be passed through message
+// pipes. Note: This takes ownership (and thus closes) |platform_handle| even on
+// failure, which is different from what you'd expect from a Mojo API, but it
+// makes for a more convenient embedder API.
+MOJO_SYSTEM_IMPL_EXPORT MojoResult
+CreatePlatformHandleWrapper(ScopedPlatformHandle platform_handle,
+                            MojoHandle* platform_handle_wrapper_handle);
+
+// Retrieves the |PlatformHandle| that was wrapped into a |MojoHandle| (using
+// |CreatePlatformHandleWrapper()| above). Note that the |MojoHandle| must still
+// be closed separately.
+MOJO_SYSTEM_IMPL_EXPORT MojoResult
+PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
+                          ScopedPlatformHandle* platform_handle);
+
+// Initialialization/shutdown for interprocess communication (IPC) -------------
+
+// |InitIPCSupport()| sets up the subsystem for interprocess communication,
+// making the IPC functions (in the following section) available and functional.
+// (This may only be done after |Init()|.)
+//
+// This subsystem may be shut down, using |ShutdownIPCSupportOnIOThread()| or
+// |ShutdownIPCSupport()|. None of the IPC functions may be called while or
+// after either of these is called.
+
+// Initializes a process of the given type; to be called after |Init()|.
+//   - |process_delegate| must be a process delegate of the appropriate type
+//     corresponding to |process_type|; its methods will be called on
+//     |delegate_thread_task_runner|.
+//   - |delegate_thread_task_runner|, |process_delegate|, and
+//     |io_thread_task_runner| should live at least until
+//     |ShutdownIPCSupport()|'s callback has been run or
+//     |ShutdownIPCSupportOnIOThread()| has completed.
+MOJO_SYSTEM_IMPL_EXPORT void InitIPCSupport(
+    scoped_refptr<base::TaskRunner> delegate_thread_task_runner,
+    ProcessDelegate* process_delegate,
+    scoped_refptr<base::TaskRunner> io_thread_task_runner);
+
+// Shuts down the subsystem initialized by |InitIPCSupport()|. This must be
+// called on the I/O thread (given to |InitIPCSupport()|). This completes
+// synchronously and does not result in a call to the process delegate's
+// |OnShutdownComplete()|.
+MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupportOnIOThread();
+
+// Like |ShutdownIPCSupportOnIOThread()|, but may be called from any thread,
+// signalling shutdown completion via the process delegate's
+// |OnShutdownComplete()|.
+MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupport();
+
+// Like above, but doesn't call |OnShutdownComplete| until all channels are
+// gone.
+// TODO(jam): this should be the default behavior.
+MOJO_SYSTEM_IMPL_EXPORT void ShutdownIPCSupportAndWaitForNoChannels();
+
+// Creates a message pipe from a platform handle. Safe to call from any thread.
+MOJO_SYSTEM_IMPL_EXPORT ScopedMessagePipeHandle
+CreateMessagePipe(ScopedPlatformHandle platform_handle);
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_EMBEDDER_H_
diff --git a/mojo/edk/embedder/embedder_internal.h b/mojo/edk/embedder/embedder_internal.h
new file mode 100644
index 0000000..6fd3dfc
--- /dev/null
+++ b/mojo/edk/embedder/embedder_internal.h
@@ -0,0 +1,46 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This header contains internal details for the *implementation* of the
+// embedder API. It should not be included by any public header (nor by users of
+// the embedder API).
+
+#ifndef MOJO_EDK_EMBEDDER_EMBEDDER_INTERNAL_H_
+#define MOJO_EDK_EMBEDDER_EMBEDDER_INTERNAL_H_
+
+#include <stdint.h>
+
+namespace base {
+class TaskRunner;
+}
+
+namespace mojo {
+
+namespace edk {
+
+class Core;
+class PlatformSupport;
+class ProcessDelegate;
+
+namespace internal {
+
+// Instance of |PlatformSupport| to use.
+extern PlatformSupport* g_platform_support;
+
+// Instance of |Core| used by the system functions (|Mojo...()|).
+extern Core* g_core;
+extern base::TaskRunner* g_delegate_thread_task_runner;
+extern ProcessDelegate* g_process_delegate;
+extern base::TaskRunner* g_io_thread_task_runner;
+
+// Called on the IO thread.
+void ChannelStarted();
+void ChannelShutdown();
+}  // namespace internal
+
+}  // namepace edk
+
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_EMBEDDER_INTERNAL_H_
diff --git a/mojo/edk/embedder/embedder_unittest.cc b/mojo/edk/embedder/embedder_unittest.cc
new file mode 100644
index 0000000..f74b9a27
--- /dev/null
+++ b/mojo/edk/embedder/embedder_unittest.cc
@@ -0,0 +1,560 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/embedder.h"
+
+#include "base/bind.h"
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/test/test_timeouts.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
+#include "mojo/edk/embedder/simple_platform_support.h"
+#include "mojo/edk/embedder/test_embedder.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/test/multiprocess_test_helper.h"
+#include "mojo/message_pump/message_pump_mojo.h"
+#include "mojo/public/c/system/core.h"
+#include "mojo/public/cpp/system/handle.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "mojo/public/cpp/system/message_pipe.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+const MojoHandleSignals kSignalReadadableWritable =
+    MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE;
+
+const MojoHandleSignals kSignalAll = MOJO_HANDLE_SIGNAL_READABLE |
+                                     MOJO_HANDLE_SIGNAL_WRITABLE |
+                                     MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+
+class EmbedderTest : public test::MojoSystemTest {
+ public:
+  EmbedderTest() {}
+  ~EmbedderTest() override {}
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(EmbedderTest);
+};
+
+TEST_F(EmbedderTest, ChannelBasic) {
+  MojoHandle server_mp, client_mp;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &server_mp, &client_mp));
+
+  // We can write to a message pipe handle immediately.
+  const char kHello[] = "hello";
+
+  size_t write_size = sizeof(kHello);
+  const char* write_buffer = kHello;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(server_mp, write_buffer,
+                             static_cast<uint32_t>(write_size), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Now wait for the other side to become readable.
+  MojoHandleSignalsState state;
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+  char read_buffer[1000] = {};
+  uint32_t num_bytes = static_cast<uint32_t>(sizeof(read_buffer));
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoReadMessage(client_mp, read_buffer, &num_bytes, nullptr,
+                            nullptr, MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(write_size, num_bytes);
+  EXPECT_STREQ(kHello, read_buffer);
+
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp));
+}
+
+// Test sending a MP which has read messages out of the OS pipe but which have
+// not been consumed using MojoReadMessage yet.
+TEST_F(EmbedderTest, SendReadableMessagePipe) {
+  MojoHandle server_mp, client_mp;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &server_mp, &client_mp));
+
+  MojoHandle server_mp2, client_mp2;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &server_mp2, &client_mp2));
+
+  // Write to server2 and wait for client2 to be readable before sending it.
+  // client2's MessagePipeDispatcher will have the message below in its
+  // message_queue_. For extra measures, also verify that this pending message
+  // can contain a message pipe.
+  MojoHandle server_mp3, client_mp3;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &server_mp3, &client_mp3));
+  const char kHello[] = "hello";
+  size_t write_size;
+  const char* write_buffer;
+  write_buffer = kHello;
+  write_size = sizeof(kHello);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(server_mp2, write_buffer,
+                             static_cast<uint32_t>(write_size), &client_mp3, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  MojoHandleSignalsState state;
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(client_mp2, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+  // Now send client2
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(server_mp, write_buffer,
+                             static_cast<uint32_t>(write_size), &client_mp2, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+  char read_buffer[20000] = {};
+  uint32_t num_bytes = static_cast<uint32_t>(sizeof(read_buffer));
+  MojoHandle ports[10];
+  uint32_t num_ports;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoReadMessage(client_mp, read_buffer, &num_bytes, &ports[0],
+                            &num_ports, MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(write_size, num_bytes);
+  EXPECT_STREQ(kHello, read_buffer);
+  EXPECT_EQ(1u, num_ports);
+
+
+  client_mp2 = ports[0];
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(client_mp2, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoReadMessage(client_mp2, read_buffer, &num_bytes, &client_mp3,
+                            &num_ports, MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(write_size, num_bytes);
+  EXPECT_STREQ(kHello, read_buffer);
+  EXPECT_EQ(1u, num_ports);
+
+
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp3));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp3));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp2));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp2));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp));
+}
+
+// TODO(jam): fix and renable
+TEST_F(EmbedderTest, DISABLED_SendMessagePipeWithWriteQueue) {
+  MojoHandle server_mp, client_mp;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &server_mp, &client_mp));
+
+  MojoHandle server_mp2, client_mp2;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &server_mp2, &client_mp2));
+
+  static const size_t kNumMessages = 1001;
+  for (size_t i = 0; i < kNumMessages; i++) {
+    std::string write_buffer(i, 'A' + (i % 26));
+    ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(client_mp2, write_buffer.data(),
+                             write_buffer.size(), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+  }
+
+  // Now send client2
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(server_mp, nullptr, 0, &client_mp2, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  MojoHandleSignalsState state;
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+  /// todo: read all msgs written..
+
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp2));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp2));
+
+
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp));
+}
+
+TEST_F(EmbedderTest, ChannelsHandlePassing) {
+  MojoHandle server_mp, client_mp;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &server_mp, &client_mp));
+  EXPECT_NE(server_mp, MOJO_HANDLE_INVALID);
+  EXPECT_NE(client_mp, MOJO_HANDLE_INVALID);
+
+  MojoHandle h0, h1;
+  EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &h0, &h1));
+
+  // Write a message to |h0| (attaching nothing).
+  const char kHello[] = "hello";
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(h0, kHello, static_cast<uint32_t>(sizeof(kHello)),
+                             nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Write one message to |server_mp|, attaching |h1|.
+  const char kWorld[] = "world!!!";
+  EXPECT_EQ(
+      MOJO_RESULT_OK,
+      MojoWriteMessage(server_mp, kWorld, static_cast<uint32_t>(sizeof(kWorld)),
+                       &h1, 1, MOJO_WRITE_MESSAGE_FLAG_NONE));
+  h1 = MOJO_HANDLE_INVALID;
+
+  // Write another message to |h0|.
+  const char kFoo[] = "foo";
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(h0, kFoo, static_cast<uint32_t>(sizeof(kFoo)),
+                             nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Wait for |client_mp| to become readable.
+  MojoHandleSignalsState state;
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+  // Read a message from |client_mp|.
+  char buffer[1000] = {};
+  uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer));
+  MojoHandle handles[10] = {};
+  uint32_t num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoReadMessage(client_mp, buffer, &num_bytes, handles,
+                            &num_handles, MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(sizeof(kWorld), num_bytes);
+  EXPECT_STREQ(kWorld, buffer);
+  EXPECT_EQ(1u, num_handles);
+  EXPECT_NE(handles[0], MOJO_HANDLE_INVALID);
+  h1 = handles[0];
+
+  // Wait for |h1| to become readable.
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(h1, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+  // Read a message from |h1|.
+  memset(buffer, 0, sizeof(buffer));
+  num_bytes = static_cast<uint32_t>(sizeof(buffer));
+  memset(handles, 0, sizeof(handles));
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoReadMessage(h1, buffer, &num_bytes, handles, &num_handles,
+                            MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(sizeof(kHello), num_bytes);
+  EXPECT_STREQ(kHello, buffer);
+  EXPECT_EQ(0u, num_handles);
+
+  // Wait for |h1| to become readable (again).
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(h1, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+  // Read the second message from |h1|.
+  memset(buffer, 0, sizeof(buffer));
+  num_bytes = static_cast<uint32_t>(sizeof(buffer));
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoReadMessage(h1, buffer, &num_bytes, nullptr, nullptr,
+                            MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(sizeof(kFoo), num_bytes);
+  EXPECT_STREQ(kFoo, buffer);
+
+  // Write a message to |h1|.
+  const char kBarBaz[] = "barbaz";
+  EXPECT_EQ(
+      MOJO_RESULT_OK,
+      MojoWriteMessage(h1, kBarBaz, static_cast<uint32_t>(sizeof(kBarBaz)),
+                       nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Wait for |h0| to become readable.
+  EXPECT_EQ(MOJO_RESULT_OK, MojoWait(h0, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+  EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+  // Read a message from |h0|.
+  memset(buffer, 0, sizeof(buffer));
+  num_bytes = static_cast<uint32_t>(sizeof(buffer));
+  EXPECT_EQ(MOJO_RESULT_OK,
+            MojoReadMessage(h0, buffer, &num_bytes, nullptr, nullptr,
+                            MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(sizeof(kBarBaz), num_bytes);
+  EXPECT_STREQ(kBarBaz, buffer);
+
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h0));
+  EXPECT_EQ(MOJO_RESULT_OK, MojoClose(h1));
+}
+
+// The sequence of messages sent is:
+//       server_mp   client_mp   mp0         mp1         mp2         mp3
+//   1.  "hello"
+//   2.              "world!"
+//   3.                          "FOO"
+//   4.  "Bar"+mp1
+//   5.  (close)
+//   6.              (close)
+//   7.                                                              "baz"
+//   8.                                                              (closed)
+//   9.                                      "quux"+mp2
+//  10.                          (close)
+//  11.                                      (wait/cl.)
+//  12.                                                  (wait/cl.)
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_MultiprocessChannels DISABLED_MultiprocessChannels
+#else
+#define MAYBE_MultiprocessChannels MultiprocessChannels
+#endif  // defined(OS_ANDROID)
+TEST_F(EmbedderTest, MAYBE_MultiprocessChannels) {
+  test::MultiprocessTestHelper multiprocess_test_helper;
+  multiprocess_test_helper.StartChild("MultiprocessChannelsClient");
+
+  {
+    MojoHandle server_mp = CreateMessagePipe(
+        multiprocess_test_helper.server_platform_handle.Pass()).release().
+            value();
+
+    // 1. Write a message to |server_mp| (attaching nothing).
+    const char kHello[] = "hello";
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoWriteMessage(server_mp, kHello,
+                               static_cast<uint32_t>(sizeof(kHello)), nullptr,
+                               0, MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+    // TODO(vtl): If the scope were ended immediately here (maybe after closing
+    // |server_mp|), we die with a fatal error in |Channel::HandleLocalError()|.
+
+    // 2. Read a message from |server_mp|.
+    MojoHandleSignalsState state;
+    EXPECT_EQ(MOJO_RESULT_OK, MojoWait(server_mp, MOJO_HANDLE_SIGNAL_READABLE,
+                                       MOJO_DEADLINE_INDEFINITE, &state));
+    EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+    EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+    char buffer[1000] = {};
+    uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer));
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoReadMessage(server_mp, buffer, &num_bytes, nullptr, nullptr,
+                              MOJO_READ_MESSAGE_FLAG_NONE));
+    const char kWorld[] = "world!";
+    EXPECT_EQ(sizeof(kWorld), num_bytes);
+    EXPECT_STREQ(kWorld, buffer);
+
+    // Create a new message pipe (endpoints |mp0| and |mp1|).
+    MojoHandle mp0, mp1;
+    EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &mp0, &mp1));
+
+    // 3. Write something to |mp0|.
+    const char kFoo[] = "FOO";
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoWriteMessage(mp0, kFoo, static_cast<uint32_t>(sizeof(kFoo)),
+                               nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+    // 4. Write a message to |server_mp|, attaching |mp1|.
+    const char kBar[] = "Bar";
+    EXPECT_EQ(
+        MOJO_RESULT_OK,
+        MojoWriteMessage(server_mp, kBar, static_cast<uint32_t>(sizeof(kBar)),
+                         &mp1, 1, MOJO_WRITE_MESSAGE_FLAG_NONE));
+    mp1 = MOJO_HANDLE_INVALID;
+
+    // 5. Close |server_mp|.
+    EXPECT_EQ(MOJO_RESULT_OK, MojoClose(server_mp));
+
+    // 9. Read a message from |mp0|, which should have |mp2| attached.
+    EXPECT_EQ(MOJO_RESULT_OK, MojoWait(mp0, MOJO_HANDLE_SIGNAL_READABLE,
+                                       MOJO_DEADLINE_INDEFINITE, &state));
+    EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+    EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+    memset(buffer, 0, sizeof(buffer));
+    num_bytes = static_cast<uint32_t>(sizeof(buffer));
+    MojoHandle mp2 = MOJO_HANDLE_INVALID;
+    uint32_t num_handles = 1;
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoReadMessage(mp0, buffer, &num_bytes, &mp2, &num_handles,
+                              MOJO_READ_MESSAGE_FLAG_NONE));
+    const char kQuux[] = "quux";
+    EXPECT_EQ(sizeof(kQuux), num_bytes);
+    EXPECT_STREQ(kQuux, buffer);
+    EXPECT_EQ(1u, num_handles);
+    EXPECT_NE(mp2, MOJO_HANDLE_INVALID);
+
+    // 7. Read a message from |mp2|.
+    EXPECT_EQ(MOJO_RESULT_OK, MojoWait(mp2, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                                       MOJO_DEADLINE_INDEFINITE, &state));
+    EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+              state.satisfied_signals);
+    EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+              state.satisfiable_signals);
+
+    memset(buffer, 0, sizeof(buffer));
+    num_bytes = static_cast<uint32_t>(sizeof(buffer));
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoReadMessage(mp2, buffer, &num_bytes, nullptr, nullptr,
+                              MOJO_READ_MESSAGE_FLAG_NONE));
+    const char kBaz[] = "baz";
+    EXPECT_EQ(sizeof(kBaz), num_bytes);
+    EXPECT_STREQ(kBaz, buffer);
+
+    // 10. Close |mp0|.
+    EXPECT_EQ(MOJO_RESULT_OK, MojoClose(mp0));
+
+// 12. Wait on |mp2| (which should eventually fail) and then close it.
+// TODO(vtl): crbug.com/351768
+#if 0
+    EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+              MojoWait(mp2, MOJO_HANDLE_SIGNAL_READABLE,
+                       MOJO_DEADLINE_INDEFINITE,
+                       &state));
+    EXPECT_EQ(MOJO_HANDLE_SIGNAL_NONE, state.satisfied_signals);
+    EXPECT_EQ(MOJO_HANDLE_SIGNAL_NONE, state.satisfiable_signals);
+#endif
+    EXPECT_EQ(MOJO_RESULT_OK, MojoClose(mp2));
+  }
+
+  EXPECT_TRUE(multiprocess_test_helper.WaitForChildTestShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_TEST(MultiprocessChannelsClient) {
+  ScopedPlatformHandle client_platform_handle =
+      test::MultiprocessTestHelper::client_platform_handle.Pass();
+  EXPECT_TRUE(client_platform_handle.is_valid());
+
+  base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
+
+  {
+    test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
+    MojoHandle client_mp = CreateMessagePipe(
+        client_platform_handle.Pass()).release().value();
+
+    // 1. Read the first message from |client_mp|.
+    MojoHandleSignalsState state;
+    EXPECT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE,
+                                       MOJO_DEADLINE_INDEFINITE, &state));
+    EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+    EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+    char buffer[1000] = {};
+    uint32_t num_bytes = static_cast<uint32_t>(sizeof(buffer));
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoReadMessage(client_mp, buffer, &num_bytes, nullptr, nullptr,
+                              MOJO_READ_MESSAGE_FLAG_NONE));
+    const char kHello[] = "hello";
+    EXPECT_EQ(sizeof(kHello), num_bytes);
+    EXPECT_STREQ(kHello, buffer);
+
+    // 2. Write a message to |client_mp| (attaching nothing).
+    const char kWorld[] = "world!";
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoWriteMessage(client_mp, kWorld,
+                               static_cast<uint32_t>(sizeof(kWorld)), nullptr,
+                               0, MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+    // 4. Read a message from |client_mp|, which should have |mp1| attached.
+    EXPECT_EQ(MOJO_RESULT_OK, MojoWait(client_mp, MOJO_HANDLE_SIGNAL_READABLE,
+                                       MOJO_DEADLINE_INDEFINITE, &state));
+    // The other end of the handle may or may not be closed at this point, so we
+    // can't test MOJO_HANDLE_SIGNAL_WRITABLE or MOJO_HANDLE_SIGNAL_PEER_CLOSED.
+    EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE,
+              state.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE);
+    EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE,
+              state.satisfiable_signals & MOJO_HANDLE_SIGNAL_READABLE);
+    // TODO(vtl): If the scope were to end here (and |client_mp| closed), we'd
+    // die (again due to |Channel::HandleLocalError()|).
+    memset(buffer, 0, sizeof(buffer));
+    num_bytes = static_cast<uint32_t>(sizeof(buffer));
+    MojoHandle mp1 = MOJO_HANDLE_INVALID;
+    uint32_t num_handles = 1;
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoReadMessage(client_mp, buffer, &num_bytes, &mp1, &num_handles,
+                              MOJO_READ_MESSAGE_FLAG_NONE));
+    const char kBar[] = "Bar";
+    EXPECT_EQ(sizeof(kBar), num_bytes);
+    EXPECT_STREQ(kBar, buffer);
+    EXPECT_EQ(1u, num_handles);
+    EXPECT_NE(mp1, MOJO_HANDLE_INVALID);
+    // TODO(vtl): If the scope were to end here (and the two handles closed),
+    // we'd die due to |Channel::RunRemoteMessagePipeEndpoint()| not handling
+    // write errors (assuming the parent had closed the pipe).
+
+    // 6. Close |client_mp|.
+    EXPECT_EQ(MOJO_RESULT_OK, MojoClose(client_mp));
+
+    // Create a new message pipe (endpoints |mp2| and |mp3|).
+    MojoHandle mp2, mp3;
+    EXPECT_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &mp2, &mp3));
+
+    // 7. Write a message to |mp3|.
+    const char kBaz[] = "baz";
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoWriteMessage(mp3, kBaz, static_cast<uint32_t>(sizeof(kBaz)),
+                               nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+    // 8. Close |mp3|.
+    EXPECT_EQ(MOJO_RESULT_OK, MojoClose(mp3));
+
+    // 9. Write a message to |mp1|, attaching |mp2|.
+    const char kQuux[] = "quux";
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoWriteMessage(mp1, kQuux, static_cast<uint32_t>(sizeof(kQuux)),
+                               &mp2, 1, MOJO_WRITE_MESSAGE_FLAG_NONE));
+    mp2 = MOJO_HANDLE_INVALID;
+
+    // 3. Read a message from |mp1|.
+    EXPECT_EQ(MOJO_RESULT_OK, MojoWait(mp1, MOJO_HANDLE_SIGNAL_READABLE,
+                                       MOJO_DEADLINE_INDEFINITE, &state));
+    EXPECT_EQ(kSignalReadadableWritable, state.satisfied_signals);
+    EXPECT_EQ(kSignalAll, state.satisfiable_signals);
+
+    memset(buffer, 0, sizeof(buffer));
+    num_bytes = static_cast<uint32_t>(sizeof(buffer));
+    EXPECT_EQ(MOJO_RESULT_OK,
+              MojoReadMessage(mp1, buffer, &num_bytes, nullptr, nullptr,
+                              MOJO_READ_MESSAGE_FLAG_NONE));
+    const char kFoo[] = "FOO";
+    EXPECT_EQ(sizeof(kFoo), num_bytes);
+    EXPECT_STREQ(kFoo, buffer);
+
+    // 11. Wait on |mp1| (which should eventually fail) and then close it.
+    EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+              MojoWait(mp1, MOJO_HANDLE_SIGNAL_READABLE,
+                       MOJO_DEADLINE_INDEFINITE, &state));
+    EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfied_signals);
+    EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfiable_signals);
+    EXPECT_EQ(MOJO_RESULT_OK, MojoClose(mp1));
+  }
+}
+
+// TODO(vtl): Test immediate write & close.
+// TODO(vtl): Test broken-connection cases.
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/entrypoints.cc b/mojo/edk/embedder/entrypoints.cc
new file mode 100644
index 0000000..6247c5f
--- /dev/null
+++ b/mojo/edk/embedder/entrypoints.cc
@@ -0,0 +1,149 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/system/core.h"
+#include "mojo/public/c/system/buffer.h"
+#include "mojo/public/c/system/data_pipe.h"
+#include "mojo/public/c/system/functions.h"
+#include "mojo/public/c/system/message_pipe.h"
+
+using mojo::edk::internal::g_core;
+
+// TODO(use_chrome_edk): commented out since for now we use the entrypoints in
+// third_party and that checks the command line to redirect here.
+/*
+
+// Definitions of the system functions.
+extern "C" {
+MojoTimeTicks MojoGetTimeTicksNow() {
+  return g_core->GetTimeTicksNow();
+}
+
+MojoResult MojoClose(MojoHandle handle) {
+  return g_core->Close(handle);
+}
+
+MojoResult MojoWait(MojoHandle handle,
+                    MojoHandleSignals signals,
+                    MojoDeadline deadline,
+                    MojoHandleSignalsState* signals_state) {
+  return g_core->Wait(handle, signals, deadline, signals_state);
+}
+
+MojoResult MojoWaitMany(const MojoHandle* handles,
+                        const MojoHandleSignals* signals,
+                        uint32_t num_handles,
+                        MojoDeadline deadline,
+                        uint32_t* result_index,
+                        MojoHandleSignalsState* signals_states) {
+  return g_core->WaitMany(handles, signals, num_handles, deadline, result_index,
+                          signals_states);
+}
+
+MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options,
+                                 MojoHandle* message_pipe_handle0,
+                                 MojoHandle* message_pipe_handle1) {
+  return g_core->CreateMessagePipe(options, message_pipe_handle0,
+                                   message_pipe_handle1);
+}
+
+MojoResult MojoWriteMessage(MojoHandle message_pipe_handle,
+                            const void* bytes,
+                            uint32_t num_bytes,
+                            const MojoHandle* handles,
+                            uint32_t num_handles,
+                            MojoWriteMessageFlags flags) {
+  return g_core->WriteMessage(message_pipe_handle, bytes, num_bytes, handles,
+                              num_handles, flags);
+}
+
+MojoResult MojoReadMessage(MojoHandle message_pipe_handle,
+                           void* bytes,
+                           uint32_t* num_bytes,
+                           MojoHandle* handles,
+                           uint32_t* num_handles,
+                           MojoReadMessageFlags flags) {
+  return g_core->ReadMessage(
+      message_pipe_handle, bytes, num_bytes, handles, num_handles, flags);
+}
+
+MojoResult MojoCreateDataPipe(const MojoCreateDataPipeOptions* options,
+                              MojoHandle* data_pipe_producer_handle,
+                              MojoHandle* data_pipe_consumer_handle) {
+  return g_core->CreateDataPipe(options, data_pipe_producer_handle,
+                                data_pipe_consumer_handle);
+}
+
+MojoResult MojoWriteData(MojoHandle data_pipe_producer_handle,
+                         const void* elements,
+                         uint32_t* num_elements,
+                         MojoWriteDataFlags flags) {
+  return g_core->WriteData(data_pipe_producer_handle, elements, num_elements,
+                           flags);
+}
+
+MojoResult MojoBeginWriteData(MojoHandle data_pipe_producer_handle,
+                              void** buffer,
+                              uint32_t* buffer_num_elements,
+                              MojoWriteDataFlags flags) {
+  return g_core->BeginWriteData(data_pipe_producer_handle, buffer,
+                                buffer_num_elements, flags);
+}
+
+MojoResult MojoEndWriteData(MojoHandle data_pipe_producer_handle,
+                            uint32_t num_elements_written) {
+  return g_core->EndWriteData(data_pipe_producer_handle, num_elements_written);
+}
+
+MojoResult MojoReadData(MojoHandle data_pipe_consumer_handle,
+                        void* elements,
+                        uint32_t* num_elements,
+                        MojoReadDataFlags flags) {
+  return g_core->ReadData(data_pipe_consumer_handle, elements, num_elements,
+                          flags);
+}
+
+MojoResult MojoBeginReadData(MojoHandle data_pipe_consumer_handle,
+                             const void** buffer,
+                             uint32_t* buffer_num_elements,
+                             MojoReadDataFlags flags) {
+  return g_core->BeginReadData(data_pipe_consumer_handle, buffer,
+                               buffer_num_elements, flags);
+}
+
+MojoResult MojoEndReadData(MojoHandle data_pipe_consumer_handle,
+                           uint32_t num_elements_read) {
+  return g_core->EndReadData(data_pipe_consumer_handle, num_elements_read);
+}
+
+MojoResult MojoCreateSharedBuffer(
+    const struct MojoCreateSharedBufferOptions* options,
+    uint64_t num_bytes,
+    MojoHandle* shared_buffer_handle) {
+  return g_core->CreateSharedBuffer(options, num_bytes, shared_buffer_handle);
+}
+
+MojoResult MojoDuplicateBufferHandle(
+    MojoHandle buffer_handle,
+    const struct MojoDuplicateBufferHandleOptions* options,
+    MojoHandle* new_buffer_handle) {
+  return g_core->DuplicateBufferHandle(buffer_handle, options,
+                                       new_buffer_handle);
+}
+
+MojoResult MojoMapBuffer(MojoHandle buffer_handle,
+                         uint64_t offset,
+                         uint64_t num_bytes,
+                         void** buffer,
+                         MojoMapBufferFlags flags) {
+  return g_core->MapBuffer(buffer_handle, offset, num_bytes, buffer, flags);
+}
+
+MojoResult MojoUnmapBuffer(void* buffer) {
+  return g_core->UnmapBuffer(buffer);
+}
+
+}  // extern "C"
+*/
diff --git a/mojo/edk/embedder/platform_channel_pair.cc b/mojo/edk/embedder/platform_channel_pair.cc
new file mode 100644
index 0000000..b083df67
--- /dev/null
+++ b/mojo/edk/embedder/platform_channel_pair.cc
@@ -0,0 +1,32 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/platform_channel_pair.h"
+
+#include "base/logging.h"
+
+namespace mojo {
+namespace edk {
+
+const char PlatformChannelPair::kMojoPlatformChannelHandleSwitch[] =
+    "mojo-platform-channel-handle";
+
+PlatformChannelPair::~PlatformChannelPair() {
+}
+
+ScopedPlatformHandle PlatformChannelPair::PassServerHandle() {
+  return server_handle_.Pass();
+}
+
+ScopedPlatformHandle PlatformChannelPair::PassClientHandle() {
+  return client_handle_.Pass();
+}
+
+void PlatformChannelPair::ChildProcessLaunched() {
+  DCHECK(client_handle_.is_valid());
+  client_handle_.reset();
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_channel_pair.h b/mojo/edk/embedder/platform_channel_pair.h
new file mode 100644
index 0000000..7487837
--- /dev/null
+++ b/mojo/edk/embedder/platform_channel_pair.h
@@ -0,0 +1,94 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_PAIR_H_
+#define MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_PAIR_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "base/process/launch.h"
+#include "build/build_config.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace base {
+class CommandLine;
+}
+
+namespace mojo {
+namespace edk {
+
+// It would be nice to refactor base/process/launch.h to have a more platform-
+// independent way of representing handles that are passed to child processes.
+#if defined(OS_WIN)
+using HandlePassingInformation = base::HandlesToInheritVector;
+#elif defined(OS_POSIX)
+using HandlePassingInformation = base::FileHandleMappingVector;
+#else
+#error "Unsupported."
+#endif
+
+// This is used to create a pair of |PlatformHandle|s that are connected by a
+// suitable (platform-specific) bidirectional "pipe" (e.g., socket on POSIX,
+// named pipe on Windows). The resulting handles can then be used in the same
+// process (e.g., in tests) or between processes. (The "server" handle is the
+// one that will be used in the process that created the pair, whereas the
+// "client" handle is the one that will be used in a different process.)
+//
+// This class provides facilities for passing the client handle to a child
+// process. The parent should call |PrepareToPassClientHandlelToChildProcess()|
+// to get the data needed to do this, spawn the child using that data, and then
+// call |ChildProcessLaunched()|. Note that on Windows this facility (will) only
+// work on Vista and later (TODO(vtl)).
+//
+// Note: |PlatformChannelPair()|, |PassClientHandleFromParentProcess()| and
+// |PrepareToPassClientHandleToChildProcess()| have platform-specific
+// implementations.
+//
+// Note: On POSIX platforms, to write to the "pipe", use
+// |PlatformChannel{Write,Writev}()| (from platform_channel_utils_posix.h)
+// instead of |write()|, |writev()|, etc. Otherwise, you have to worry about
+// platform differences in suppressing |SIGPIPE|.
+class MOJO_SYSTEM_IMPL_EXPORT PlatformChannelPair {
+ public:
+  PlatformChannelPair();
+  ~PlatformChannelPair();
+
+  ScopedPlatformHandle PassServerHandle();
+
+  // For in-process use (e.g., in tests or to pass over another channel).
+  ScopedPlatformHandle PassClientHandle();
+
+  // To be called in the child process, after the parent process called
+  // |PrepareToPassClientHandleToChildProcess()| and launched the child (using
+  // the provided data), to create a client handle connected to the server
+  // handle (in the parent process).
+  static ScopedPlatformHandle PassClientHandleFromParentProcess(
+      const base::CommandLine& command_line);
+
+  // Prepares to pass the client channel to a new child process, to be launched
+  // using |LaunchProcess()| (from base/launch.h). Modifies |*command_line| and
+  // |*handle_passing_info| as needed.
+  // Note: For Windows, this method only works on Vista and later.
+  void PrepareToPassClientHandleToChildProcess(
+      base::CommandLine* command_line,
+      HandlePassingInformation* handle_passing_info) const;
+
+  // To be called once the child process has been successfully launched, to do
+  // any cleanup necessary.
+  void ChildProcessLaunched();
+
+ private:
+  static const char kMojoPlatformChannelHandleSwitch[];
+
+  ScopedPlatformHandle server_handle_;
+  ScopedPlatformHandle client_handle_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformChannelPair);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_PAIR_H_
diff --git a/mojo/edk/embedder/platform_channel_pair_posix.cc b/mojo/edk/embedder/platform_channel_pair_posix.cc
new file mode 100644
index 0000000..8cdac366
--- /dev/null
+++ b/mojo/edk/embedder/platform_channel_pair_posix.cc
@@ -0,0 +1,111 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/platform_channel_pair.h"
+
+#include <fcntl.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/posix/global_descriptors.h"
+#include "base/strings/string_number_conversions.h"
+#include "build/build_config.h"
+#include "mojo/edk/embedder/platform_handle.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+bool IsTargetDescriptorUsed(
+    const base::FileHandleMappingVector& file_handle_mapping,
+    int target_fd) {
+  for (size_t i = 0; i < file_handle_mapping.size(); i++) {
+    if (file_handle_mapping[i].second == target_fd)
+      return true;
+  }
+  return false;
+}
+
+}  // namespace
+
+PlatformChannelPair::PlatformChannelPair() {
+  // Create the Unix domain socket and set the ends to nonblocking.
+  int fds[2];
+  // TODO(vtl): Maybe fail gracefully if |socketpair()| fails.
+  PCHECK(socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0);
+  PCHECK(fcntl(fds[0], F_SETFL, O_NONBLOCK) == 0);
+  PCHECK(fcntl(fds[1], F_SETFL, O_NONBLOCK) == 0);
+
+#if defined(OS_MACOSX)
+  // This turns off |SIGPIPE| when writing to a closed socket (causing it to
+  // fail with |EPIPE| instead). On Linux, we have to use |send...()| with
+  // |MSG_NOSIGNAL| -- which is not supported on Mac -- instead.
+  int no_sigpipe = 1;
+  PCHECK(setsockopt(fds[0], SOL_SOCKET, SO_NOSIGPIPE, &no_sigpipe,
+                    sizeof(no_sigpipe)) == 0);
+  PCHECK(setsockopt(fds[1], SOL_SOCKET, SO_NOSIGPIPE, &no_sigpipe,
+                    sizeof(no_sigpipe)) == 0);
+#endif  // defined(OS_MACOSX)
+
+  server_handle_.reset(PlatformHandle(fds[0]));
+  DCHECK(server_handle_.is_valid());
+  client_handle_.reset(PlatformHandle(fds[1]));
+  DCHECK(client_handle_.is_valid());
+}
+
+// static
+ScopedPlatformHandle PlatformChannelPair::PassClientHandleFromParentProcess(
+    const base::CommandLine& command_line) {
+  std::string client_fd_string =
+      command_line.GetSwitchValueASCII(kMojoPlatformChannelHandleSwitch);
+  int client_fd = -1;
+  if (client_fd_string.empty() ||
+      !base::StringToInt(client_fd_string, &client_fd) ||
+      client_fd < base::GlobalDescriptors::kBaseDescriptor) {
+    LOG(ERROR) << "Missing or invalid --" << kMojoPlatformChannelHandleSwitch;
+    return ScopedPlatformHandle();
+  }
+
+  return ScopedPlatformHandle(PlatformHandle(client_fd));
+}
+
+void PlatformChannelPair::PrepareToPassClientHandleToChildProcess(
+    base::CommandLine* command_line,
+    base::FileHandleMappingVector* handle_passing_info) const {
+  DCHECK(command_line);
+  DCHECK(handle_passing_info);
+  // This is an arbitrary sanity check. (Note that this guarantees that the loop
+  // below will terminate sanely.)
+  CHECK_LT(handle_passing_info->size(), 1000u);
+
+  DCHECK(client_handle_.is_valid());
+
+  // Find a suitable FD to map our client handle to in the child process.
+  // This has quadratic time complexity in the size of |*handle_passing_info|,
+  // but |*handle_passing_info| should be very small (usually/often empty).
+  int target_fd = base::GlobalDescriptors::kBaseDescriptor;
+  while (IsTargetDescriptorUsed(*handle_passing_info, target_fd))
+    target_fd++;
+
+  handle_passing_info->push_back(
+      std::pair<int, int>(client_handle_.get().fd, target_fd));
+  // Log a warning if the command line already has the switch, but "clobber" it
+  // anyway, since it's reasonably likely that all the switches were just copied
+  // from the parent.
+  LOG_IF(WARNING, command_line->HasSwitch(kMojoPlatformChannelHandleSwitch))
+      << "Child command line already has switch --"
+      << kMojoPlatformChannelHandleSwitch << "="
+      << command_line->GetSwitchValueASCII(kMojoPlatformChannelHandleSwitch);
+  // (Any existing switch won't actually be removed from the command line, but
+  // the last one appended takes precedence.)
+  command_line->AppendSwitchASCII(kMojoPlatformChannelHandleSwitch,
+                                  base::IntToString(target_fd));
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc b/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
new file mode 100644
index 0000000..a0bb7fd4
--- /dev/null
+++ b/mojo/edk/embedder/platform_channel_pair_posix_unittest.cc
@@ -0,0 +1,260 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/platform_channel_pair.h"
+
+#include <errno.h>
+#include <poll.h>
+#include <signal.h>
+#include <stdio.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include <deque>
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_file.h"
+#include "base/files/scoped_temp_dir.h"
+#include "base/logging.h"
+#include "mojo/edk/embedder/platform_channel_utils_posix.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/test/test_utils.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+void WaitReadable(PlatformHandle h) {
+  struct pollfd pfds = {};
+  pfds.fd = h.fd;
+  pfds.events = POLLIN;
+  CHECK_EQ(poll(&pfds, 1, -1), 1);
+}
+
+class PlatformChannelPairPosixTest : public testing::Test {
+ public:
+  PlatformChannelPairPosixTest() {}
+  ~PlatformChannelPairPosixTest() override {}
+
+  void SetUp() override {
+    // Make sure |SIGPIPE| isn't being ignored.
+    struct sigaction action = {};
+    action.sa_handler = SIG_DFL;
+    ASSERT_EQ(0, sigaction(SIGPIPE, &action, &old_action_));
+  }
+
+  void TearDown() override {
+    // Restore the |SIGPIPE| handler.
+    ASSERT_EQ(0, sigaction(SIGPIPE, &old_action_, nullptr));
+  }
+
+ private:
+  struct sigaction old_action_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformChannelPairPosixTest);
+};
+
+TEST_F(PlatformChannelPairPosixTest, NoSigPipe) {
+  PlatformChannelPair channel_pair;
+  ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
+  ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
+
+  // Write to the client.
+  static const char kHello[] = "hello";
+  EXPECT_EQ(static_cast<ssize_t>(sizeof(kHello)),
+            write(client_handle.get().fd, kHello, sizeof(kHello)));
+
+  // Close the client.
+  client_handle.reset();
+
+  // Read from the server; this should be okay.
+  char buffer[100] = {};
+  EXPECT_EQ(static_cast<ssize_t>(sizeof(kHello)),
+            read(server_handle.get().fd, buffer, sizeof(buffer)));
+  EXPECT_STREQ(kHello, buffer);
+
+  // Try reading again.
+  ssize_t result = read(server_handle.get().fd, buffer, sizeof(buffer));
+  // We should probably get zero (for "end of file"), but -1 would also be okay.
+  EXPECT_TRUE(result == 0 || result == -1);
+  if (result == -1)
+    PLOG(WARNING) << "read (expected 0 for EOF)";
+
+  // Test our replacement for |write()|/|send()|.
+  result = PlatformChannelWrite(server_handle.get(), kHello, sizeof(kHello));
+  EXPECT_EQ(-1, result);
+  if (errno != EPIPE)
+    PLOG(WARNING) << "write (expected EPIPE)";
+
+  // Test our replacement for |writev()|/|sendv()|.
+  struct iovec iov[2] = {{const_cast<char*>(kHello), sizeof(kHello)},
+                         {const_cast<char*>(kHello), sizeof(kHello)}};
+  result = PlatformChannelWritev(server_handle.get(), iov, 2);
+  EXPECT_EQ(-1, result);
+  if (errno != EPIPE)
+    PLOG(WARNING) << "write (expected EPIPE)";
+}
+
+TEST_F(PlatformChannelPairPosixTest, SendReceiveData) {
+  PlatformChannelPair channel_pair;
+  ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
+  ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
+
+  for (size_t i = 0; i < 10; i++) {
+    std::string send_string(1 << i, 'A' + i);
+
+    EXPECT_EQ(static_cast<ssize_t>(send_string.size()),
+              PlatformChannelWrite(server_handle.get(), send_string.data(),
+                                   send_string.size()));
+
+    WaitReadable(client_handle.get());
+
+    char buf[10000] = {};
+    std::deque<PlatformHandle> received_handles;
+    ssize_t result = PlatformChannelRecvmsg(client_handle.get(), buf,
+                                            sizeof(buf), &received_handles);
+    EXPECT_EQ(static_cast<ssize_t>(send_string.size()), result);
+    EXPECT_EQ(send_string, std::string(buf, static_cast<size_t>(result)));
+    EXPECT_TRUE(received_handles.empty());
+  }
+}
+
+TEST_F(PlatformChannelPairPosixTest, SendReceiveFDs) {
+  base::ScopedTempDir temp_dir;
+  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+
+  static const char kHello[] = "hello";
+
+  PlatformChannelPair channel_pair;
+  ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
+  ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
+
+// Reduce the number of FDs opened on OS X to avoid test flake.
+#if defined(OS_MACOSX)
+  const size_t kNumHandlesToSend = kPlatformChannelMaxNumHandles / 2;
+#else
+  const size_t kNumHandlesToSend = kPlatformChannelMaxNumHandles;
+#endif
+
+  for (size_t i = 1; i < kNumHandlesToSend; i++) {
+    // Make |i| files, with the j-th file consisting of j copies of the digit
+    // |c|.
+    const char c = '0' + (i % 10);
+    ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector);
+    for (size_t j = 1; j <= i; j++) {
+      base::FilePath unused;
+      base::ScopedFILE fp(
+          base::CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+      ASSERT_TRUE(fp);
+      ASSERT_EQ(j, fwrite(std::string(j, c).data(), 1, j, fp.get()));
+      platform_handles->push_back(
+          test::PlatformHandleFromFILE(fp.Pass()).release());
+      ASSERT_TRUE(platform_handles->back().is_valid());
+    }
+
+    // Send the FDs (+ "hello").
+    struct iovec iov = {const_cast<char*>(kHello), sizeof(kHello)};
+    // We assume that the |sendmsg()| actually sends all the data.
+    EXPECT_EQ(static_cast<ssize_t>(sizeof(kHello)),
+              PlatformChannelSendmsgWithHandles(server_handle.get(), &iov, 1,
+                                                &platform_handles->at(0),
+                                                platform_handles->size()));
+
+    WaitReadable(client_handle.get());
+
+    char buf[10000] = {};
+    std::deque<PlatformHandle> received_handles;
+    // We assume that the |recvmsg()| actually reads all the data.
+    EXPECT_EQ(static_cast<ssize_t>(sizeof(kHello)),
+              PlatformChannelRecvmsg(client_handle.get(), buf, sizeof(buf),
+                                     &received_handles));
+    EXPECT_STREQ(kHello, buf);
+    EXPECT_EQ(i, received_handles.size());
+
+    for (size_t j = 0; !received_handles.empty(); j++) {
+      base::ScopedFILE fp(test::FILEFromPlatformHandle(
+          ScopedPlatformHandle(received_handles.front()), "rb"));
+      received_handles.pop_front();
+      ASSERT_TRUE(fp);
+      rewind(fp.get());
+      char read_buf[kNumHandlesToSend];
+      size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get());
+      EXPECT_EQ(j + 1, bytes_read);
+      EXPECT_EQ(std::string(j + 1, c), std::string(read_buf, bytes_read));
+    }
+  }
+}
+
+TEST_F(PlatformChannelPairPosixTest, AppendReceivedFDs) {
+  base::ScopedTempDir temp_dir;
+  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+
+  static const char kHello[] = "hello";
+
+  PlatformChannelPair channel_pair;
+  ScopedPlatformHandle server_handle = channel_pair.PassServerHandle().Pass();
+  ScopedPlatformHandle client_handle = channel_pair.PassClientHandle().Pass();
+
+  const std::string file_contents("hello world");
+
+  {
+    base::FilePath unused;
+    base::ScopedFILE fp(
+        base::CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+    ASSERT_TRUE(fp);
+    ASSERT_EQ(file_contents.size(),
+              fwrite(file_contents.data(), 1, file_contents.size(), fp.get()));
+    ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector);
+    platform_handles->push_back(
+        test::PlatformHandleFromFILE(fp.Pass()).release());
+    ASSERT_TRUE(platform_handles->back().is_valid());
+
+    // Send the FD (+ "hello").
+    struct iovec iov = {const_cast<char*>(kHello), sizeof(kHello)};
+    // We assume that the |sendmsg()| actually sends all the data.
+    EXPECT_EQ(static_cast<ssize_t>(sizeof(kHello)),
+              PlatformChannelSendmsgWithHandles(server_handle.get(), &iov, 1,
+                                                &platform_handles->at(0),
+                                                platform_handles->size()));
+  }
+
+  WaitReadable(client_handle.get());
+
+  // Start with an invalid handle in the deque.
+  std::deque<PlatformHandle> received_handles;
+  received_handles.push_back(PlatformHandle());
+
+  char buf[100] = {};
+  // We assume that the |recvmsg()| actually reads all the data.
+  EXPECT_EQ(static_cast<ssize_t>(sizeof(kHello)),
+            PlatformChannelRecvmsg(client_handle.get(), buf, sizeof(buf),
+                                   &received_handles));
+  EXPECT_STREQ(kHello, buf);
+  ASSERT_EQ(2u, received_handles.size());
+  EXPECT_FALSE(received_handles[0].is_valid());
+  EXPECT_TRUE(received_handles[1].is_valid());
+
+  {
+    base::ScopedFILE fp(test::FILEFromPlatformHandle(
+        ScopedPlatformHandle(received_handles[1]), "rb"));
+    received_handles[1] = PlatformHandle();
+    ASSERT_TRUE(fp);
+    rewind(fp.get());
+    char read_buf[100];
+    size_t bytes_read = fread(read_buf, 1, sizeof(read_buf), fp.get());
+    EXPECT_EQ(file_contents.size(), bytes_read);
+    EXPECT_EQ(file_contents, std::string(read_buf, bytes_read));
+  }
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_channel_pair_win.cc b/mojo/edk/embedder/platform_channel_pair_win.cc
new file mode 100644
index 0000000..8ba325a
--- /dev/null
+++ b/mojo/edk/embedder/platform_channel_pair_win.cc
@@ -0,0 +1,111 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/platform_channel_pair.h"
+
+#include <windows.h>
+
+#include <string>
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/rand_util.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/strings/stringprintf.h"
+#include "base/win/windows_version.h"
+#include "mojo/edk/embedder/platform_handle.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+std::wstring GeneratePipeName() {
+  return base::StringPrintf(L"\\\\.\\pipe\\mojo.%u.%u.%I64u",
+                            GetCurrentProcessId(), GetCurrentThreadId(),
+                            base::RandUint64());
+}
+
+}  // namespace
+
+PlatformChannelPair::PlatformChannelPair() {
+  std::wstring pipe_name = GeneratePipeName();
+
+  const DWORD kOpenMode =
+      PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE;
+  const DWORD kPipeMode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE;
+  server_handle_.reset(PlatformHandle(
+      CreateNamedPipeW(pipe_name.c_str(), kOpenMode, kPipeMode,
+                       1,           // Max instances.
+                       4096,        // Out buffer size.
+                       4096,        // In buffer size.
+                       5000,        // Timeout in milliseconds.
+                       nullptr)));  // Default security descriptor.
+  PCHECK(server_handle_.is_valid());
+
+  const DWORD kDesiredAccess = GENERIC_READ | GENERIC_WRITE;
+  // The SECURITY_ANONYMOUS flag means that the server side cannot impersonate
+  // the client.
+  const DWORD kFlags =
+      SECURITY_SQOS_PRESENT | SECURITY_ANONYMOUS | FILE_FLAG_OVERLAPPED;
+  // Allow the handle to be inherited by child processes.
+  SECURITY_ATTRIBUTES security_attributes = {
+      sizeof(SECURITY_ATTRIBUTES), nullptr, TRUE};
+  client_handle_.reset(
+      PlatformHandle(CreateFileW(pipe_name.c_str(), kDesiredAccess,
+                                 0,  // No sharing.
+                                 &security_attributes, OPEN_EXISTING, kFlags,
+                                 nullptr)));  // No template file.
+  PCHECK(client_handle_.is_valid());
+
+  // Since a client has connected, ConnectNamedPipe() should return zero and
+  // GetLastError() should return ERROR_PIPE_CONNECTED.
+  CHECK(!ConnectNamedPipe(server_handle_.get().handle, nullptr));
+  PCHECK(GetLastError() == ERROR_PIPE_CONNECTED);
+}
+
+// static
+ScopedPlatformHandle PlatformChannelPair::PassClientHandleFromParentProcess(
+    const base::CommandLine& command_line) {
+  std::string client_handle_string =
+      command_line.GetSwitchValueASCII(kMojoPlatformChannelHandleSwitch);
+
+  int client_handle_value = 0;
+  if (client_handle_string.empty() ||
+      !base::StringToInt(client_handle_string, &client_handle_value)) {
+    LOG(ERROR) << "Missing or invalid --" << kMojoPlatformChannelHandleSwitch;
+    return ScopedPlatformHandle();
+  }
+
+  return ScopedPlatformHandle(
+      PlatformHandle(LongToHandle(client_handle_value)));
+}
+
+void PlatformChannelPair::PrepareToPassClientHandleToChildProcess(
+    base::CommandLine* command_line,
+    base::HandlesToInheritVector* handle_passing_info) const {
+  DCHECK(command_line);
+  DCHECK(handle_passing_info);
+  DCHECK(client_handle_.is_valid());
+
+  CHECK_GE(base::win::GetVersion(), base::win::VERSION_VISTA);
+
+  handle_passing_info->push_back(client_handle_.get().handle);
+
+  // Log a warning if the command line already has the switch, but "clobber" it
+  // anyway, since it's reasonably likely that all the switches were just copied
+  // from the parent.
+  LOG_IF(WARNING, command_line->HasSwitch(kMojoPlatformChannelHandleSwitch))
+      << "Child command line already has switch --"
+      << kMojoPlatformChannelHandleSwitch << "="
+      << command_line->GetSwitchValueASCII(kMojoPlatformChannelHandleSwitch);
+  // (Any existing switch won't actually be removed from the command line, but
+  // the last one appended takes precedence.)
+  command_line->AppendSwitchASCII(
+      kMojoPlatformChannelHandleSwitch,
+      base::IntToString(HandleToLong(client_handle_.get().handle)));
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_channel_utils_posix.cc b/mojo/edk/embedder/platform_channel_utils_posix.cc
new file mode 100644
index 0000000..4af45e82
--- /dev/null
+++ b/mojo/edk/embedder/platform_channel_utils_posix.cc
@@ -0,0 +1,186 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/platform_channel_utils_posix.h"
+
+#include <sys/socket.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include "base/logging.h"
+#include "base/posix/eintr_wrapper.h"
+#include "build/build_config.h"
+
+namespace mojo {
+namespace edk {
+
+// On Linux, |SIGPIPE| is suppressed by passing |MSG_NOSIGNAL| to
+// |send()|/|sendmsg()|. (There is no way of suppressing |SIGPIPE| on
+// |write()|/|writev().) On Mac, |SIGPIPE| is suppressed by setting the
+// |SO_NOSIGPIPE| option on the socket.
+//
+// Performance notes:
+//  - On Linux, we have to use |send()|/|sendmsg()| rather than
+//    |write()|/|writev()| in order to suppress |SIGPIPE|. This is okay, since
+//    |send()| is (slightly) faster than |write()| (!), while |sendmsg()| is
+//    quite comparable to |writev()|.
+//  - On Mac, we may use |write()|/|writev()|. Here, |write()| is considerably
+//    faster than |send()|, whereas |sendmsg()| is quite comparable to
+//    |writev()|.
+//  - On both platforms, an appropriate |sendmsg()|/|writev()| is considerably
+//    faster than two |send()|s/|write()|s.
+//  - Relative numbers (minimum real times from 10 runs) for one |write()| of
+//    1032 bytes, one |send()| of 1032 bytes, one |writev()| of 32+1000 bytes,
+//    one |sendmsg()| of 32+1000 bytes, two |write()|s of 32 and 1000 bytes, two
+//    |send()|s of 32 and 1000 bytes:
+//    - Linux: 0.81 s, 0.77 s, 0.87 s, 0.89 s, 1.31 s, 1.22 s
+//    - Mac: 2.21 s, 2.91 s, 2.98 s, 3.08 s, 3.59 s, 4.74 s
+
+// Flags to use with calling |send()| or |sendmsg()| (see above).
+#if defined(OS_MACOSX)
+const int kSendFlags = 0;
+#else
+const int kSendFlags = MSG_NOSIGNAL;
+#endif
+
+ssize_t PlatformChannelWrite(PlatformHandle h,
+                             const void* bytes,
+                             size_t num_bytes) {
+  DCHECK(h.is_valid());
+  DCHECK(bytes);
+  DCHECK_GT(num_bytes, 0u);
+
+#if defined(OS_MACOSX)
+  return HANDLE_EINTR(write(h.fd, bytes, num_bytes));
+#else
+  return send(h.fd, bytes, num_bytes, kSendFlags);
+#endif
+}
+
+ssize_t PlatformChannelWritev(PlatformHandle h,
+                              struct iovec* iov,
+                              size_t num_iov) {
+  DCHECK(h.is_valid());
+  DCHECK(iov);
+  DCHECK_GT(num_iov, 0u);
+
+#if defined(OS_MACOSX)
+  return HANDLE_EINTR(writev(h.fd, iov, static_cast<int>(num_iov)));
+#else
+  struct msghdr msg = {};
+  msg.msg_iov = iov;
+  msg.msg_iovlen = num_iov;
+  return HANDLE_EINTR(sendmsg(h.fd, &msg, kSendFlags));
+#endif
+}
+
+ssize_t PlatformChannelSendmsgWithHandles(PlatformHandle h,
+                                          struct iovec* iov,
+                                          size_t num_iov,
+                                          PlatformHandle* platform_handles,
+                                          size_t num_platform_handles) {
+  DCHECK(iov);
+  DCHECK_GT(num_iov, 0u);
+  DCHECK(platform_handles);
+  DCHECK_GT(num_platform_handles, 0u);
+  DCHECK_LE(num_platform_handles, kPlatformChannelMaxNumHandles);
+
+  char cmsg_buf[CMSG_SPACE(kPlatformChannelMaxNumHandles * sizeof(int))];
+  struct msghdr msg = {};
+  msg.msg_iov = iov;
+  msg.msg_iovlen = num_iov;
+  msg.msg_control = cmsg_buf;
+  msg.msg_controllen = CMSG_LEN(num_platform_handles * sizeof(int));
+  struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
+  cmsg->cmsg_level = SOL_SOCKET;
+  cmsg->cmsg_type = SCM_RIGHTS;
+  cmsg->cmsg_len = CMSG_LEN(num_platform_handles * sizeof(int));
+  for (size_t i = 0; i < num_platform_handles; i++) {
+    DCHECK(platform_handles[i].is_valid());
+    reinterpret_cast<int*>(CMSG_DATA(cmsg))[i] = platform_handles[i].fd;
+  }
+
+  return HANDLE_EINTR(sendmsg(h.fd, &msg, kSendFlags));
+}
+
+bool PlatformChannelSendHandles(PlatformHandle h,
+                                PlatformHandle* handles,
+                                size_t num_handles) {
+  DCHECK(handles);
+  DCHECK_GT(num_handles, 0u);
+  DCHECK_LE(num_handles, kPlatformChannelMaxNumHandles);
+
+  // Note: |sendmsg()| fails on Mac if we don't write at least one character.
+  struct iovec iov = {const_cast<char*>(""), 1};
+  char cmsg_buf[CMSG_SPACE(kPlatformChannelMaxNumHandles * sizeof(int))];
+  struct msghdr msg = {};
+  msg.msg_iov = &iov;
+  msg.msg_iovlen = 1;
+  msg.msg_control = cmsg_buf;
+  msg.msg_controllen = CMSG_LEN(num_handles * sizeof(int));
+  struct cmsghdr* cmsg = CMSG_FIRSTHDR(&msg);
+  cmsg->cmsg_level = SOL_SOCKET;
+  cmsg->cmsg_type = SCM_RIGHTS;
+  cmsg->cmsg_len = CMSG_LEN(num_handles * sizeof(int));
+  for (size_t i = 0; i < num_handles; i++) {
+    DCHECK(handles[i].is_valid());
+    reinterpret_cast<int*>(CMSG_DATA(cmsg))[i] = handles[i].fd;
+  }
+
+  ssize_t result = HANDLE_EINTR(sendmsg(h.fd, &msg, kSendFlags));
+  if (result < 1) {
+    DCHECK_EQ(result, -1);
+    return false;
+  }
+
+  for (size_t i = 0; i < num_handles; i++)
+    handles[i].CloseIfNecessary();
+  return true;
+}
+
+ssize_t PlatformChannelRecvmsg(PlatformHandle h,
+                               void* buf,
+                               size_t num_bytes,
+                               std::deque<PlatformHandle>* platform_handles) {
+  DCHECK(buf);
+  DCHECK_GT(num_bytes, 0u);
+  DCHECK(platform_handles);
+
+  struct iovec iov = {buf, num_bytes};
+  char cmsg_buf[CMSG_SPACE(kPlatformChannelMaxNumHandles * sizeof(int))];
+  struct msghdr msg = {};
+  msg.msg_iov = &iov;
+  msg.msg_iovlen = 1;
+  msg.msg_control = cmsg_buf;
+  msg.msg_controllen = sizeof(cmsg_buf);
+
+  ssize_t result = HANDLE_EINTR(recvmsg(h.fd, &msg, MSG_DONTWAIT));
+  if (result < 0)
+    return result;
+
+  // Success; no control messages.
+  if (msg.msg_controllen == 0)
+    return result;
+
+  DCHECK(!(msg.msg_flags & MSG_CTRUNC));
+
+  for (cmsghdr* cmsg = CMSG_FIRSTHDR(&msg); cmsg;
+       cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+    if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) {
+      size_t payload_length = cmsg->cmsg_len - CMSG_LEN(0);
+      DCHECK_EQ(payload_length % sizeof(int), 0u);
+      size_t num_fds = payload_length / sizeof(int);
+      const int* fds = reinterpret_cast<int*>(CMSG_DATA(cmsg));
+      for (size_t i = 0; i < num_fds; i++) {
+        platform_handles->push_back(PlatformHandle(fds[i]));
+        DCHECK(platform_handles->back().is_valid());
+      }
+    }
+  }
+
+  return result;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_channel_utils_posix.h b/mojo/edk/embedder/platform_channel_utils_posix.h
new file mode 100644
index 0000000..00e6a16c
--- /dev/null
+++ b/mojo/edk/embedder/platform_channel_utils_posix.h
@@ -0,0 +1,76 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_H_
+#define MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_H_
+
+#include <stddef.h>
+#include <sys/types.h>  // For |ssize_t|.
+
+#include <deque>
+
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+struct iovec;  // Declared in <sys/uio.h>.
+
+namespace mojo {
+namespace edk {
+
+// The maximum number of handles that can be sent "at once" using
+// |PlatformChannelSendmsgWithHandles()|.
+// TODO(vtl): This number is taken from ipc/ipc_message_attachment_set.h:
+// |IPC::MessageAttachmentSet::kMaxDescriptorsPerMessage|.
+const size_t kPlatformChannelMaxNumHandles = 128;
+
+// Use these to write to a socket created using |PlatformChannelPair| (or
+// equivalent). These are like |write()| and |writev()|, but handle |EINTR| and
+// never raise |SIGPIPE|. (Note: On Mac, the suppression of |SIGPIPE| is set up
+// by |PlatformChannelPair|.)
+MOJO_SYSTEM_IMPL_EXPORT ssize_t
+PlatformChannelWrite(PlatformHandle h, const void* bytes, size_t num_bytes);
+MOJO_SYSTEM_IMPL_EXPORT ssize_t
+PlatformChannelWritev(PlatformHandle h, struct iovec* iov, size_t num_iov);
+
+// Writes data, and the given set of |PlatformHandle|s (i.e., file descriptors)
+// over the Unix domain socket given by |h| (e.g., created using
+// |PlatformChannelPair()|). All the handles must be valid, and there must be at
+// least one and at most |kPlatformChannelMaxNumHandles| handles. The return
+// value is as for |sendmsg()|, namely -1 on failure and otherwise the number of
+// bytes of data sent on success (note that this may not be all the data
+// specified by |iov|). (The handles are not closed, regardless of success or
+// failure.)
+MOJO_SYSTEM_IMPL_EXPORT ssize_t
+PlatformChannelSendmsgWithHandles(PlatformHandle h,
+                                  struct iovec* iov,
+                                  size_t num_iov,
+                                  PlatformHandle* platform_handles,
+                                  size_t num_platform_handles);
+
+// TODO(vtl): Remove this once I've switched things over to
+// |PlatformChannelSendmsgWithHandles()|.
+// Sends |PlatformHandle|s (i.e., file descriptors) over the Unix domain socket
+// (e.g., created using PlatformChannelPair|). (These will be sent in a single
+// message having one null byte of data and one control message header with all
+// the file descriptors.) All of the handles must be valid, and there must be at
+// most |kPlatformChannelMaxNumHandles| (and at least one handle). Returns true
+// on success, in which case it closes all the handles.
+MOJO_SYSTEM_IMPL_EXPORT bool PlatformChannelSendHandles(PlatformHandle h,
+                                                        PlatformHandle* handles,
+                                                        size_t num_handles);
+
+// Wrapper around |recvmsg()|, which will extract any attached file descriptors
+// (in the control message) to |PlatformHandle|s (and append them to
+// |platform_handles|). (This also handles |EINTR|.)
+MOJO_SYSTEM_IMPL_EXPORT ssize_t
+PlatformChannelRecvmsg(PlatformHandle h,
+                       void* buf,
+                       size_t num_bytes,
+                       std::deque<PlatformHandle>* platform_handles);
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_PLATFORM_CHANNEL_UTILS_POSIX_H_
diff --git a/mojo/edk/embedder/platform_handle.cc b/mojo/edk/embedder/platform_handle.cc
new file mode 100644
index 0000000..816c7e8
--- /dev/null
+++ b/mojo/edk/embedder/platform_handle.cc
@@ -0,0 +1,39 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/platform_handle.h"
+
+#include "build/build_config.h"
+#if defined(OS_POSIX)
+#include <unistd.h>
+#elif defined(OS_WIN)
+#include <windows.h>
+#else
+#error "Platform not yet supported."
+#endif
+
+#include "base/logging.h"
+
+namespace mojo {
+namespace edk {
+
+void PlatformHandle::CloseIfNecessary() {
+  if (!is_valid())
+    return;
+
+#if defined(OS_POSIX)
+  bool success = (close(fd) == 0);
+  DPCHECK(success);
+  fd = -1;
+#elif defined(OS_WIN)
+  bool success = !!CloseHandle(handle);
+  DPCHECK(success);
+  handle = INVALID_HANDLE_VALUE;
+#else
+#error "Platform not yet supported."
+#endif
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_handle.h b/mojo/edk/embedder/platform_handle.h
new file mode 100644
index 0000000..91a4eec
--- /dev/null
+++ b/mojo/edk/embedder/platform_handle.h
@@ -0,0 +1,47 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
+#define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
+
+#include "build/build_config.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
+namespace mojo {
+namespace edk {
+
+#if defined(OS_POSIX)
+struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle {
+  PlatformHandle() : fd(-1) {}
+  explicit PlatformHandle(int fd) : fd(fd) {}
+
+  void CloseIfNecessary();
+
+  bool is_valid() const { return fd != -1; }
+
+  int fd;
+};
+#elif defined(OS_WIN)
+struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandle {
+  PlatformHandle() : handle(INVALID_HANDLE_VALUE) {}
+  explicit PlatformHandle(HANDLE handle) : handle(handle) {}
+
+  void CloseIfNecessary();
+
+  bool is_valid() const { return handle != INVALID_HANDLE_VALUE; }
+
+  HANDLE handle;
+};
+#else
+#error "Platform not yet supported."
+#endif
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_H_
diff --git a/mojo/edk/embedder/platform_handle_utils.h b/mojo/edk/embedder/platform_handle_utils.h
new file mode 100644
index 0000000..fa683e4
--- /dev/null
+++ b/mojo/edk/embedder/platform_handle_utils.h
@@ -0,0 +1,33 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_UTILS_H_
+#define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_UTILS_H_
+
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+namespace mojo {
+namespace edk {
+
+// Closes all the |PlatformHandle|s in the given container.
+template <typename PlatformHandleContainer>
+MOJO_SYSTEM_IMPL_EXPORT inline void CloseAllPlatformHandles(
+    PlatformHandleContainer* platform_handles) {
+  for (typename PlatformHandleContainer::iterator it =
+           platform_handles->begin();
+       it != platform_handles->end(); ++it)
+    it->CloseIfNecessary();
+}
+
+// Duplicates the given |PlatformHandle| (which must be valid). (Returns an
+// invalid |ScopedPlatformHandle| on failure.)
+MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle
+DuplicatePlatformHandle(PlatformHandle platform_handle);
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_UTILS_H_
diff --git a/mojo/edk/embedder/platform_handle_utils_posix.cc b/mojo/edk/embedder/platform_handle_utils_posix.cc
new file mode 100644
index 0000000..1f6ecce
--- /dev/null
+++ b/mojo/edk/embedder/platform_handle_utils_posix.cc
@@ -0,0 +1,22 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/platform_handle_utils.h"
+
+#include <unistd.h>
+
+#include "base/logging.h"
+
+namespace mojo {
+namespace edk {
+
+ScopedPlatformHandle DuplicatePlatformHandle(PlatformHandle platform_handle) {
+  DCHECK(platform_handle.is_valid());
+  // Note that |dup()| returns -1 on error (which is exactly the value we use
+  // for invalid |PlatformHandle| FDs).
+  return ScopedPlatformHandle(PlatformHandle(dup(platform_handle.fd)));
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_handle_utils_win.cc b/mojo/edk/embedder/platform_handle_utils_win.cc
new file mode 100644
index 0000000..eebfdeb7
--- /dev/null
+++ b/mojo/edk/embedder/platform_handle_utils_win.cc
@@ -0,0 +1,27 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/platform_handle_utils.h"
+
+#include <windows.h>
+
+#include "base/logging.h"
+
+namespace mojo {
+namespace edk {
+
+ScopedPlatformHandle DuplicatePlatformHandle(PlatformHandle platform_handle) {
+  DCHECK(platform_handle.is_valid());
+
+  HANDLE new_handle;
+  if (!DuplicateHandle(GetCurrentProcess(), platform_handle.handle,
+                       GetCurrentProcess(), &new_handle, 0, TRUE,
+                       DUPLICATE_SAME_ACCESS))
+    return ScopedPlatformHandle();
+  DCHECK_NE(new_handle, INVALID_HANDLE_VALUE);
+  return ScopedPlatformHandle(PlatformHandle(new_handle));
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/platform_handle_vector.h b/mojo/edk/embedder/platform_handle_vector.h
new file mode 100644
index 0000000..2bea729
--- /dev/null
+++ b/mojo/edk/embedder/platform_handle_vector.h
@@ -0,0 +1,35 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_VECTOR_H_
+#define MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_VECTOR_H_
+
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/embedder/platform_handle_utils.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+namespace mojo {
+namespace edk {
+
+using PlatformHandleVector = std::vector<PlatformHandle>;
+
+// A deleter (for use with |scoped_ptr|) which closes all handles and then
+// |delete|s the |PlatformHandleVector|.
+struct MOJO_SYSTEM_IMPL_EXPORT PlatformHandleVectorDeleter {
+  void operator()(PlatformHandleVector* platform_handles) const {
+    CloseAllPlatformHandles(platform_handles);
+    delete platform_handles;
+  }
+};
+
+using ScopedPlatformHandleVectorPtr =
+    scoped_ptr<PlatformHandleVector, PlatformHandleVectorDeleter>;
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_PLATFORM_HANDLE_VECTOR_H_
diff --git a/mojo/edk/embedder/platform_shared_buffer.h b/mojo/edk/embedder/platform_shared_buffer.h
new file mode 100644
index 0000000..c7256af
--- /dev/null
+++ b/mojo/edk/embedder/platform_shared_buffer.h
@@ -0,0 +1,102 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_PLATFORM_SHARED_BUFFER_H_
+#define MOJO_EDK_EMBEDDER_PLATFORM_SHARED_BUFFER_H_
+
+#include <stddef.h>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+class PlatformSharedBufferMapping;
+
+// |PlatformSharedBuffer| is an interface for a thread-safe, ref-counted wrapper
+// around OS-specific shared memory. It has the following features:
+//   - A |PlatformSharedBuffer| simply represents a piece of shared memory that
+//     *may* be mapped and *may* be shared to another process.
+//   - A single |PlatformSharedBuffer| may be mapped multiple times. The
+//     lifetime of the mapping (owned by |PlatformSharedBufferMapping|) is
+//     separate from the lifetime of the |PlatformSharedBuffer|.
+//   - Sizes/offsets (of the shared memory and mappings) are arbitrary, and not
+//     restricted by page size. However, more memory may actually be mapped than
+//     requested.
+//
+// It currently does NOT support the following:
+//   - Sharing read-only. (This will probably eventually be supported.)
+//
+// TODO(vtl): Rectify this with |base::SharedMemory|.
+class MOJO_SYSTEM_IMPL_EXPORT PlatformSharedBuffer
+    : public base::RefCountedThreadSafe<PlatformSharedBuffer> {
+ public:
+  // Gets the size of shared buffer (in number of bytes).
+  virtual size_t GetNumBytes() const = 0;
+
+  // Maps (some) of the shared buffer into memory; [|offset|, |offset + length|]
+  // must be contained in [0, |num_bytes|], and |length| must be at least 1.
+  // Returns null on failure.
+  virtual scoped_ptr<PlatformSharedBufferMapping> Map(size_t offset,
+                                                      size_t length) = 0;
+
+  // Checks if |offset| and |length| are valid arguments.
+  virtual bool IsValidMap(size_t offset, size_t length) = 0;
+
+  // Like |Map()|, but doesn't check its arguments (which should have been
+  // preflighted using |IsValidMap()|).
+  virtual scoped_ptr<PlatformSharedBufferMapping> MapNoCheck(size_t offset,
+                                                             size_t length) = 0;
+
+  // Duplicates the underlying platform handle and passes it to the caller.
+  // TODO(vtl): On POSIX, we'll need two FDs to support sharing read-only.
+  virtual ScopedPlatformHandle DuplicatePlatformHandle() = 0;
+
+  // Passes the underlying platform handle to the caller. This should only be
+  // called if there's a unique reference to this object (owned by the caller).
+  // After calling this, this object should no longer be used, but should only
+  // be disposed of.
+  virtual ScopedPlatformHandle PassPlatformHandle() = 0;
+
+ protected:
+  friend class base::RefCountedThreadSafe<PlatformSharedBuffer>;
+
+  PlatformSharedBuffer() {}
+  virtual ~PlatformSharedBuffer() {}
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformSharedBuffer);
+};
+
+// An interface for a mapping of a |PlatformSharedBuffer| (compararable to a
+// "file view" in Windows); see above. Created by (implementations of)
+// |PlatformSharedBuffer::Map()|. Automatically unmaps memory on destruction.
+//
+// Mappings are NOT thread-safe.
+//
+// Note: This is an entirely separate class (instead of
+// |PlatformSharedBuffer::Mapping|) so that it can be forward-declared.
+class MOJO_SYSTEM_IMPL_EXPORT PlatformSharedBufferMapping {
+ public:
+  // IMPORTANT: Implementations must implement a destructor that unmaps memory.
+  virtual ~PlatformSharedBufferMapping() {}
+
+  virtual void* GetBase() const = 0;
+  virtual size_t GetLength() const = 0;
+
+ protected:
+  PlatformSharedBufferMapping() {}
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformSharedBufferMapping);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_PLATFORM_SHARED_BUFFER_H_
diff --git a/mojo/edk/embedder/platform_support.h b/mojo/edk/embedder/platform_support.h
new file mode 100644
index 0000000..160ba79
--- /dev/null
+++ b/mojo/edk/embedder/platform_support.h
@@ -0,0 +1,43 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_PLATFORM_SUPPORT_H_
+#define MOJO_EDK_EMBEDDER_PLATFORM_SUPPORT_H_
+
+#include <stddef.h>
+
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+class PlatformSharedBuffer;
+
+// This class is provided by the embedder to implement (typically
+// platform-dependent) things needed by the Mojo system implementation.
+// Implementations must be thread-safe.
+class MOJO_SYSTEM_IMPL_EXPORT PlatformSupport {
+ public:
+  virtual ~PlatformSupport() {}
+
+  virtual void GetCryptoRandomBytes(void* bytes, size_t num_bytes) = 0;
+
+  virtual PlatformSharedBuffer* CreateSharedBuffer(size_t num_bytes) = 0;
+  virtual PlatformSharedBuffer* CreateSharedBufferFromHandle(
+      size_t num_bytes,
+      ScopedPlatformHandle platform_handle) = 0;
+
+ protected:
+  PlatformSupport() {}
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformSupport);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_PLATFORM_SUPPORT_H_
diff --git a/mojo/edk/embedder/process_delegate.h b/mojo/edk/embedder/process_delegate.h
new file mode 100644
index 0000000..e5f90af
--- /dev/null
+++ b/mojo/edk/embedder/process_delegate.h
@@ -0,0 +1,32 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_PROCESS_DELEGATE_H_
+#define MOJO_EDK_EMBEDDER_PROCESS_DELEGATE_H_
+
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// An interface for process delegates.
+class MOJO_SYSTEM_IMPL_EXPORT ProcessDelegate {
+ public:
+  // Called when |ShutdownIPCSupport()| has "completed". Note that this is NOT
+  // called if |ShutdownIPCSupportOnIOThread()| is used instead.
+  virtual void OnShutdownComplete() = 0;
+
+ protected:
+  ProcessDelegate() {}
+  virtual ~ProcessDelegate() {}
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ProcessDelegate);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_PROCESS_DELEGATE_H_
diff --git a/mojo/edk/embedder/scoped_platform_handle.h b/mojo/edk/embedder/scoped_platform_handle.h
new file mode 100644
index 0000000..ae75202
--- /dev/null
+++ b/mojo/edk/embedder/scoped_platform_handle.h
@@ -0,0 +1,62 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_SCOPED_PLATFORM_HANDLE_H_
+#define MOJO_EDK_EMBEDDER_SCOPED_PLATFORM_HANDLE_H_
+
+#include "base/move.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+class MOJO_SYSTEM_IMPL_EXPORT ScopedPlatformHandle {
+  MOVE_ONLY_TYPE_WITH_MOVE_CONSTRUCTOR_FOR_CPP_03(ScopedPlatformHandle)
+
+ public:
+  ScopedPlatformHandle() {}
+  explicit ScopedPlatformHandle(PlatformHandle handle) : handle_(handle) {}
+  ~ScopedPlatformHandle() { handle_.CloseIfNecessary(); }
+
+  // Move-only constructor and operator=.
+  ScopedPlatformHandle(ScopedPlatformHandle&& other)
+      : handle_(other.release()) {}
+
+  ScopedPlatformHandle& operator=(ScopedPlatformHandle&& other) {
+    if (this != &other)
+      handle_ = other.release();
+    return *this;
+  }
+
+  const PlatformHandle& get() const { return handle_; }
+
+  void swap(ScopedPlatformHandle& other) {
+    PlatformHandle temp = handle_;
+    handle_ = other.handle_;
+    other.handle_ = temp;
+  }
+
+  PlatformHandle release() MOJO_WARN_UNUSED_RESULT {
+    PlatformHandle rv = handle_;
+    handle_ = PlatformHandle();
+    return rv;
+  }
+
+  void reset(PlatformHandle handle = PlatformHandle()) {
+    handle_.CloseIfNecessary();
+    handle_ = handle;
+  }
+
+  bool is_valid() const { return handle_.is_valid(); }
+
+ private:
+  PlatformHandle handle_;
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_SCOPED_PLATFORM_HANDLE_H_
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer.cc b/mojo/edk/embedder/simple_platform_shared_buffer.cc
new file mode 100644
index 0000000..c09eb80
--- /dev/null
+++ b/mojo/edk/embedder/simple_platform_shared_buffer.cc
@@ -0,0 +1,108 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/simple_platform_shared_buffer.h"
+
+#include "base/logging.h"
+#include "mojo/edk/embedder/platform_handle_utils.h"
+
+namespace mojo {
+namespace edk {
+
+// static
+SimplePlatformSharedBuffer* SimplePlatformSharedBuffer::Create(
+    size_t num_bytes) {
+  DCHECK_GT(num_bytes, 0u);
+
+  SimplePlatformSharedBuffer* rv = new SimplePlatformSharedBuffer(num_bytes);
+  if (!rv->Init()) {
+    // We can't just delete it directly, due to the "in destructor" (debug)
+    // check.
+    scoped_refptr<SimplePlatformSharedBuffer> deleter(rv);
+    return nullptr;
+  }
+
+  return rv;
+}
+
+// static
+SimplePlatformSharedBuffer*
+SimplePlatformSharedBuffer::CreateFromPlatformHandle(
+    size_t num_bytes,
+    ScopedPlatformHandle platform_handle) {
+  DCHECK_GT(num_bytes, 0u);
+
+  SimplePlatformSharedBuffer* rv = new SimplePlatformSharedBuffer(num_bytes);
+  if (!rv->InitFromPlatformHandle(platform_handle.Pass())) {
+    // We can't just delete it directly, due to the "in destructor" (debug)
+    // check.
+    scoped_refptr<SimplePlatformSharedBuffer> deleter(rv);
+    return nullptr;
+  }
+
+  return rv;
+}
+
+size_t SimplePlatformSharedBuffer::GetNumBytes() const {
+  return num_bytes_;
+}
+
+scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::Map(
+    size_t offset,
+    size_t length) {
+  if (!IsValidMap(offset, length))
+    return nullptr;
+
+  return MapNoCheck(offset, length);
+}
+
+bool SimplePlatformSharedBuffer::IsValidMap(size_t offset, size_t length) {
+  if (offset > num_bytes_ || length == 0)
+    return false;
+
+  // Note: This is an overflow-safe check of |offset + length > num_bytes_|
+  // (that |num_bytes >= offset| is verified above).
+  if (length > num_bytes_ - offset)
+    return false;
+
+  return true;
+}
+
+scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::MapNoCheck(
+    size_t offset,
+    size_t length) {
+  DCHECK(IsValidMap(offset, length));
+  return MapImpl(offset, length);
+}
+
+ScopedPlatformHandle SimplePlatformSharedBuffer::DuplicatePlatformHandle() {
+  return mojo::edk::DuplicatePlatformHandle(handle_.get());
+}
+
+ScopedPlatformHandle SimplePlatformSharedBuffer::PassPlatformHandle() {
+  DCHECK(HasOneRef());
+  return handle_.Pass();
+}
+
+SimplePlatformSharedBuffer::SimplePlatformSharedBuffer(size_t num_bytes)
+    : num_bytes_(num_bytes) {
+}
+
+SimplePlatformSharedBuffer::~SimplePlatformSharedBuffer() {
+}
+
+SimplePlatformSharedBufferMapping::~SimplePlatformSharedBufferMapping() {
+  Unmap();
+}
+
+void* SimplePlatformSharedBufferMapping::GetBase() const {
+  return base_;
+}
+
+size_t SimplePlatformSharedBufferMapping::GetLength() const {
+  return length_;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer.h b/mojo/edk/embedder/simple_platform_shared_buffer.h
new file mode 100644
index 0000000..798bc3a
--- /dev/null
+++ b/mojo/edk/embedder/simple_platform_shared_buffer.h
@@ -0,0 +1,101 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SHARED_BUFFER_H_
+#define MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SHARED_BUFFER_H_
+
+#include <stddef.h>
+
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// A simple implementation of |PlatformSharedBuffer|.
+class MOJO_SYSTEM_IMPL_EXPORT SimplePlatformSharedBuffer final
+    : public PlatformSharedBuffer {
+ public:
+  // Creates a shared buffer of size |num_bytes| bytes (initially zero-filled).
+  // |num_bytes| must be nonzero. Returns null on failure.
+  static SimplePlatformSharedBuffer* Create(size_t num_bytes);
+
+  static SimplePlatformSharedBuffer* CreateFromPlatformHandle(
+      size_t num_bytes,
+      ScopedPlatformHandle platform_handle);
+
+  // |PlatformSharedBuffer| implementation:
+  size_t GetNumBytes() const override;
+  scoped_ptr<PlatformSharedBufferMapping> Map(size_t offset,
+                                              size_t length) override;
+  bool IsValidMap(size_t offset, size_t length) override;
+  scoped_ptr<PlatformSharedBufferMapping> MapNoCheck(size_t offset,
+                                                     size_t length) override;
+  ScopedPlatformHandle DuplicatePlatformHandle() override;
+  ScopedPlatformHandle PassPlatformHandle() override;
+
+ private:
+  explicit SimplePlatformSharedBuffer(size_t num_bytes);
+  ~SimplePlatformSharedBuffer() override;
+
+  // Implemented in simple_platform_shared_buffer_{posix,win}.cc:
+
+  // This is called by |Create()| before this object is given to anyone.
+  bool Init();
+
+  // This is like |Init()|, but for |CreateFromPlatformHandle()|. (Note: It
+  // should verify that |platform_handle| is an appropriate handle for the
+  // claimed |num_bytes_|.)
+  bool InitFromPlatformHandle(ScopedPlatformHandle platform_handle);
+
+  // The platform-dependent part of |Map()|; doesn't check arguments.
+  scoped_ptr<PlatformSharedBufferMapping> MapImpl(size_t offset, size_t length);
+
+  const size_t num_bytes_;
+
+  // This is set in |Init()|/|InitFromPlatformHandle()| and never modified
+  // (except by |PassPlatformHandle()|; see the comments above its declaration),
+  // hence does not need to be protected by a lock.
+  ScopedPlatformHandle handle_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSharedBuffer);
+};
+
+// An implementation of |PlatformSharedBufferMapping|, produced by
+// |SimplePlatformSharedBuffer|.
+class MOJO_SYSTEM_IMPL_EXPORT SimplePlatformSharedBufferMapping
+    : public PlatformSharedBufferMapping {
+ public:
+  ~SimplePlatformSharedBufferMapping() override;
+
+  void* GetBase() const override;
+  size_t GetLength() const override;
+
+ private:
+  friend class SimplePlatformSharedBuffer;
+
+  SimplePlatformSharedBufferMapping(void* base,
+                                    size_t length,
+                                    void* real_base,
+                                    size_t real_length)
+      : base_(base),
+        length_(length),
+        real_base_(real_base),
+        real_length_(real_length) {}
+  void Unmap();
+
+  void* const base_;
+  const size_t length_;
+
+  void* const real_base_;
+  const size_t real_length_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSharedBufferMapping);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SHARED_BUFFER_H_
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_android.cc b/mojo/edk/embedder/simple_platform_shared_buffer_android.cc
new file mode 100644
index 0000000..d855604
--- /dev/null
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_android.cc
@@ -0,0 +1,72 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/simple_platform_shared_buffer.h"
+
+#include <stdint.h>
+#include <sys/mman.h>   // For |PROT_...|.
+#include <sys/types.h>  // For |off_t|.
+
+#include <limits>
+
+#include "base/files/scoped_file.h"
+#include "base/logging.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "third_party/ashmem/ashmem.h"
+
+namespace mojo {
+namespace edk {
+
+// SimplePlatformSharedBuffer --------------------------------------------------
+
+bool SimplePlatformSharedBuffer::Init() {
+  DCHECK(!handle_.is_valid());
+
+  if (static_cast<uint64_t>(num_bytes_) >
+      static_cast<uint64_t>(std::numeric_limits<off_t>::max())) {
+    return false;
+  }
+
+  base::ScopedFD fd(ashmem_create_region(nullptr, num_bytes_));
+  if (!fd.is_valid()) {
+    DPLOG(ERROR) << "ashmem_create_region()";
+    return false;
+  }
+
+  if (ashmem_set_prot_region(fd.get(), PROT_READ | PROT_WRITE) < 0) {
+    DPLOG(ERROR) << "ashmem_set_prot_region()";
+    return false;
+  }
+
+  handle_.reset(PlatformHandle(fd.release()));
+  return true;
+}
+
+bool SimplePlatformSharedBuffer::InitFromPlatformHandle(
+    ScopedPlatformHandle platform_handle) {
+  DCHECK(!handle_.is_valid());
+
+  if (static_cast<uint64_t>(num_bytes_) >
+      static_cast<uint64_t>(std::numeric_limits<off_t>::max())) {
+    return false;
+  }
+
+  int size = ashmem_get_size_region(platform_handle.get().fd);
+
+  if (size < 0) {
+    DPLOG(ERROR) << "ashmem_get_size_region()";
+    return false;
+  }
+
+  if (static_cast<size_t>(size) != num_bytes_) {
+    LOG(ERROR) << "Shared memory region has the wrong size";
+    return false;
+  }
+
+  handle_ = platform_handle.Pass();
+  return true;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc b/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
new file mode 100644
index 0000000..6914b39
--- /dev/null
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_posix.cc
@@ -0,0 +1,158 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/simple_platform_shared_buffer.h"
+
+#include <stdint.h>
+#include <stdio.h>     // For |fileno()|.
+#include <sys/mman.h>  // For |mmap()|/|munmap()|.
+#include <sys/stat.h>
+#include <sys/types.h>  // For |off_t|.
+#include <unistd.h>
+
+#include <limits>
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_file.h"
+#include "base/logging.h"
+#include "base/posix/eintr_wrapper.h"
+#include "base/sys_info.h"
+#include "base/threading/thread_restrictions.h"
+#include "mojo/edk/embedder/platform_handle.h"
+
+// We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a
+// |uint64_t|.
+static_assert(sizeof(size_t) <= sizeof(uint64_t), "size_t too big");
+static_assert(sizeof(off_t) <= sizeof(uint64_t), "off_t too big");
+
+namespace mojo {
+namespace edk {
+
+// SimplePlatformSharedBuffer --------------------------------------------------
+
+// The implementation for android uses ashmem to generate the file descriptor
+// for the shared memory. See simple_platform_shared_buffer_android.cc
+#if !defined(OS_ANDROID)
+
+bool SimplePlatformSharedBuffer::Init() {
+  DCHECK(!handle_.is_valid());
+
+  base::ThreadRestrictions::ScopedAllowIO allow_io;
+
+  if (static_cast<uint64_t>(num_bytes_) >
+      static_cast<uint64_t>(std::numeric_limits<off_t>::max())) {
+    return false;
+  }
+
+  // TODO(vtl): This is stupid. The implementation of
+  // |CreateAndOpenTemporaryFileInDir()| starts with an FD, |fdopen()|s to get a
+  // |FILE*|, and then we have to |dup(fileno(fp))| to get back to an FD that we
+  // can own. (base/memory/shared_memory_posix.cc does this too, with more
+  // |fstat()|s thrown in for good measure.)
+  base::FilePath shared_buffer_dir;
+  if (!base::GetShmemTempDir(false, &shared_buffer_dir)) {
+    LOG(ERROR) << "Failed to get temporary directory for shared memory";
+    return false;
+  }
+  base::FilePath shared_buffer_file;
+  base::ScopedFILE fp(base::CreateAndOpenTemporaryFileInDir(
+      shared_buffer_dir, &shared_buffer_file));
+  if (!fp) {
+    LOG(ERROR) << "Failed to create/open temporary file for shared memory";
+    return false;
+  }
+  // Note: |unlink()| is not interruptible.
+  if (unlink(shared_buffer_file.value().c_str()) != 0) {
+    PLOG(WARNING) << "unlink";
+    // This isn't "fatal" (e.g., someone else may have unlinked the file first),
+    // so we may as well continue.
+  }
+
+  // Note: |dup()| is not interruptible (but |dup2()|/|dup3()| are).
+  base::ScopedFD fd(dup(fileno(fp.get())));
+  if (!fd.is_valid()) {
+    PLOG(ERROR) << "dup";
+    return false;
+  }
+
+  if (HANDLE_EINTR(ftruncate(fd.get(), static_cast<off_t>(num_bytes_))) != 0) {
+    PLOG(ERROR) << "ftruncate";
+    return false;
+  }
+
+  handle_.reset(PlatformHandle(fd.release()));
+  return true;
+}
+
+bool SimplePlatformSharedBuffer::InitFromPlatformHandle(
+    ScopedPlatformHandle platform_handle) {
+  DCHECK(!handle_.is_valid());
+
+  if (static_cast<uint64_t>(num_bytes_) >
+      static_cast<uint64_t>(std::numeric_limits<off_t>::max())) {
+    return false;
+  }
+
+  struct stat sb = {};
+  // Note: |fstat()| isn't interruptible.
+  if (fstat(platform_handle.get().fd, &sb) != 0) {
+    PLOG(ERROR) << "fstat";
+    return false;
+  }
+
+  if (!S_ISREG(sb.st_mode)) {
+    LOG(ERROR) << "Platform handle not to a regular file";
+    return false;
+  }
+
+  if (sb.st_size != static_cast<off_t>(num_bytes_)) {
+    LOG(ERROR) << "Shared memory file has the wrong size";
+    return false;
+  }
+
+  // TODO(vtl): More checks?
+
+  handle_ = platform_handle.Pass();
+  return true;
+}
+
+#endif  // !defined(OS_ANDROID)
+
+scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::MapImpl(
+    size_t offset,
+    size_t length) {
+  size_t offset_rounding = offset % base::SysInfo::VMAllocationGranularity();
+  size_t real_offset = offset - offset_rounding;
+  size_t real_length = length + offset_rounding;
+
+  // This should hold (since we checked |num_bytes| versus the maximum value of
+  // |off_t| on creation, but it never hurts to be paranoid.
+  DCHECK_LE(static_cast<uint64_t>(real_offset),
+            static_cast<uint64_t>(std::numeric_limits<off_t>::max()));
+
+  void* real_base =
+      mmap(nullptr, real_length, PROT_READ | PROT_WRITE, MAP_SHARED,
+           handle_.get().fd, static_cast<off_t>(real_offset));
+  // |mmap()| should return |MAP_FAILED| (a.k.a. -1) on error. But it shouldn't
+  // return null either.
+  if (real_base == MAP_FAILED || !real_base) {
+    PLOG(ERROR) << "mmap";
+    return nullptr;
+  }
+
+  void* base = static_cast<char*>(real_base) + offset_rounding;
+  return make_scoped_ptr(new SimplePlatformSharedBufferMapping(
+      base, length, real_base, real_length));
+}
+
+// SimplePlatformSharedBufferMapping -------------------------------------------
+
+void SimplePlatformSharedBufferMapping::Unmap() {
+  int result = munmap(real_base_, real_length_);
+  PLOG_IF(ERROR, result != 0) << "munmap";
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
new file mode 100644
index 0000000..a0e915e
--- /dev/null
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_unittest.cc
@@ -0,0 +1,187 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/simple_platform_shared_buffer.h"
+
+#include <limits>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+TEST(SimplePlatformSharedBufferTest, Basic) {
+  const size_t kNumInts = 100;
+  const size_t kNumBytes = kNumInts * sizeof(int);
+  // A fudge so that we're not just writing zero bytes 75% of the time.
+  const int kFudge = 1234567890;
+
+  // Make some memory.
+  scoped_refptr<SimplePlatformSharedBuffer> buffer(
+      SimplePlatformSharedBuffer::Create(kNumBytes));
+  ASSERT_TRUE(buffer);
+
+  // Map it all, scribble some stuff, and then unmap it.
+  {
+    EXPECT_TRUE(buffer->IsValidMap(0, kNumBytes));
+    scoped_ptr<PlatformSharedBufferMapping> mapping(buffer->Map(0, kNumBytes));
+    ASSERT_TRUE(mapping);
+    ASSERT_TRUE(mapping->GetBase());
+    int* stuff = static_cast<int*>(mapping->GetBase());
+    for (size_t i = 0; i < kNumInts; i++)
+      stuff[i] = static_cast<int>(i) + kFudge;
+  }
+
+  // Map it all again, check that our scribbling is still there, then do a
+  // partial mapping and scribble on that, check that everything is coherent,
+  // unmap the first mapping, scribble on some of the second mapping, and then
+  // unmap it.
+  {
+    ASSERT_TRUE(buffer->IsValidMap(0, kNumBytes));
+    // Use |MapNoCheck()| this time.
+    scoped_ptr<PlatformSharedBufferMapping> mapping1(
+        buffer->MapNoCheck(0, kNumBytes));
+    ASSERT_TRUE(mapping1);
+    ASSERT_TRUE(mapping1->GetBase());
+    int* stuff1 = static_cast<int*>(mapping1->GetBase());
+    for (size_t i = 0; i < kNumInts; i++)
+      EXPECT_EQ(static_cast<int>(i) + kFudge, stuff1[i]) << i;
+
+    scoped_ptr<PlatformSharedBufferMapping> mapping2(
+        buffer->Map((kNumInts / 2) * sizeof(int), 2 * sizeof(int)));
+    ASSERT_TRUE(mapping2);
+    ASSERT_TRUE(mapping2->GetBase());
+    int* stuff2 = static_cast<int*>(mapping2->GetBase());
+    EXPECT_EQ(static_cast<int>(kNumInts / 2) + kFudge, stuff2[0]);
+    EXPECT_EQ(static_cast<int>(kNumInts / 2) + 1 + kFudge, stuff2[1]);
+
+    stuff2[0] = 123;
+    stuff2[1] = 456;
+    EXPECT_EQ(123, stuff1[kNumInts / 2]);
+    EXPECT_EQ(456, stuff1[kNumInts / 2 + 1]);
+
+    mapping1.reset();
+
+    EXPECT_EQ(123, stuff2[0]);
+    EXPECT_EQ(456, stuff2[1]);
+    stuff2[1] = 789;
+  }
+
+  // Do another partial mapping and check that everything is the way we expect
+  // it to be.
+  {
+    EXPECT_TRUE(buffer->IsValidMap(sizeof(int), kNumBytes - sizeof(int)));
+    scoped_ptr<PlatformSharedBufferMapping> mapping(
+        buffer->Map(sizeof(int), kNumBytes - sizeof(int)));
+    ASSERT_TRUE(mapping);
+    ASSERT_TRUE(mapping->GetBase());
+    int* stuff = static_cast<int*>(mapping->GetBase());
+
+    for (size_t j = 0; j < kNumInts - 1; j++) {
+      int i = static_cast<int>(j) + 1;
+      if (i == kNumInts / 2) {
+        EXPECT_EQ(123, stuff[j]);
+      } else if (i == kNumInts / 2 + 1) {
+        EXPECT_EQ(789, stuff[j]);
+      } else {
+        EXPECT_EQ(i + kFudge, stuff[j]) << i;
+      }
+    }
+  }
+}
+
+// TODO(vtl): Bigger buffers.
+
+TEST(SimplePlatformSharedBufferTest, InvalidMappings) {
+  scoped_refptr<SimplePlatformSharedBuffer> buffer(
+      SimplePlatformSharedBuffer::Create(100));
+  ASSERT_TRUE(buffer);
+
+  // Zero length not allowed.
+  EXPECT_FALSE(buffer->Map(0, 0));
+  EXPECT_FALSE(buffer->IsValidMap(0, 0));
+
+  // Okay:
+  EXPECT_TRUE(buffer->Map(0, 100));
+  EXPECT_TRUE(buffer->IsValidMap(0, 100));
+  // Offset + length too big.
+  EXPECT_FALSE(buffer->Map(0, 101));
+  EXPECT_FALSE(buffer->IsValidMap(0, 101));
+  EXPECT_FALSE(buffer->Map(1, 100));
+  EXPECT_FALSE(buffer->IsValidMap(1, 100));
+
+  // Okay:
+  EXPECT_TRUE(buffer->Map(50, 50));
+  EXPECT_TRUE(buffer->IsValidMap(50, 50));
+  // Offset + length too big.
+  EXPECT_FALSE(buffer->Map(50, 51));
+  EXPECT_FALSE(buffer->IsValidMap(50, 51));
+  EXPECT_FALSE(buffer->Map(51, 50));
+  EXPECT_FALSE(buffer->IsValidMap(51, 50));
+}
+
+TEST(SimplePlatformSharedBufferTest, TooBig) {
+  // If |size_t| is 32-bit, it's quite possible/likely that |Create()| succeeds
+  // (since it only involves creating a 4 GB file).
+  const size_t kMaxSizeT = std::numeric_limits<size_t>::max();
+  scoped_refptr<SimplePlatformSharedBuffer> buffer(
+      SimplePlatformSharedBuffer::Create(kMaxSizeT));
+  // But, assuming |sizeof(size_t) == sizeof(void*)|, mapping all of it should
+  // always fail.
+  if (buffer)
+    EXPECT_FALSE(buffer->Map(0, kMaxSizeT));
+}
+
+// Tests that separate mappings get distinct addresses.
+// Note: It's not inconceivable that the OS could ref-count identical mappings
+// and reuse the same address, in which case we'd have to be more careful about
+// using the address as the key for unmapping.
+TEST(SimplePlatformSharedBufferTest, MappingsDistinct) {
+  scoped_refptr<SimplePlatformSharedBuffer> buffer(
+      SimplePlatformSharedBuffer::Create(100));
+  scoped_ptr<PlatformSharedBufferMapping> mapping1(buffer->Map(0, 100));
+  scoped_ptr<PlatformSharedBufferMapping> mapping2(buffer->Map(0, 100));
+  EXPECT_NE(mapping1->GetBase(), mapping2->GetBase());
+}
+
+TEST(SimplePlatformSharedBufferTest, BufferZeroInitialized) {
+  static const size_t kSizes[] = {10, 100, 1000, 10000, 100000};
+  for (size_t i = 0; i < MOJO_ARRAYSIZE(kSizes); i++) {
+    scoped_refptr<SimplePlatformSharedBuffer> buffer(
+        SimplePlatformSharedBuffer::Create(kSizes[i]));
+    scoped_ptr<PlatformSharedBufferMapping> mapping(buffer->Map(0, kSizes[i]));
+    for (size_t j = 0; j < kSizes[i]; j++) {
+      // "Assert" instead of "expect" so we don't spam the output with thousands
+      // of failures if we fail.
+      ASSERT_EQ('\0', static_cast<char*>(mapping->GetBase())[j])
+          << "size " << kSizes[i] << ", offset " << j;
+    }
+  }
+}
+
+TEST(SimplePlatformSharedBufferTest, MappingsOutliveBuffer) {
+  scoped_ptr<PlatformSharedBufferMapping> mapping1;
+  scoped_ptr<PlatformSharedBufferMapping> mapping2;
+
+  {
+    scoped_refptr<SimplePlatformSharedBuffer> buffer(
+        SimplePlatformSharedBuffer::Create(100));
+    mapping1 = buffer->Map(0, 100).Pass();
+    mapping2 = buffer->Map(50, 50).Pass();
+    static_cast<char*>(mapping1->GetBase())[50] = 'x';
+  }
+
+  EXPECT_EQ('x', static_cast<char*>(mapping2->GetBase())[0]);
+
+  static_cast<char*>(mapping2->GetBase())[1] = 'y';
+  EXPECT_EQ('y', static_cast<char*>(mapping1->GetBase())[51]);
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/simple_platform_shared_buffer_win.cc b/mojo/edk/embedder/simple_platform_shared_buffer_win.cc
new file mode 100644
index 0000000..a2b205ef
--- /dev/null
+++ b/mojo/edk/embedder/simple_platform_shared_buffer_win.cc
@@ -0,0 +1,88 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/simple_platform_shared_buffer.h"
+
+#include <windows.h>
+
+#include <limits>
+
+#include "base/logging.h"
+#include "base/sys_info.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+
+namespace mojo {
+namespace edk {
+
+// SimplePlatformSharedBuffer --------------------------------------------------
+
+bool SimplePlatformSharedBuffer::Init() {
+  DCHECK(!handle_.is_valid());
+
+  // TODO(vtl): Currently, we only support mapping up to 2^32-1 bytes.
+  if (static_cast<uint64_t>(num_bytes_) >
+      static_cast<uint64_t>(std::numeric_limits<DWORD>::max())) {
+    return false;
+  }
+
+  // IMPORTANT NOTE: Unnamed objects are NOT SECURABLE. Thus if we ever want to
+  // share read-only to other processes, we'll have to name our file mapping
+  // object.
+  // TODO(vtl): Unlike |base::SharedMemory|, we don't round up the size (to a
+  // multiple of 64 KB). This may cause problems with NaCl. Cross this bridge
+  // when we get there. crbug.com/210609
+  handle_.reset(PlatformHandle(
+      CreateFileMapping(INVALID_HANDLE_VALUE, nullptr, PAGE_READWRITE, 0,
+                        static_cast<DWORD>(num_bytes_), nullptr)));
+  if (!handle_.is_valid()) {
+    PLOG(ERROR) << "CreateFileMapping";
+    return false;
+  }
+
+  return true;
+}
+
+bool SimplePlatformSharedBuffer::InitFromPlatformHandle(
+    ScopedPlatformHandle platform_handle) {
+  DCHECK(!handle_.is_valid());
+
+  handle_ = platform_handle.Pass();
+  return true;
+}
+
+scoped_ptr<PlatformSharedBufferMapping> SimplePlatformSharedBuffer::MapImpl(
+    size_t offset,
+    size_t length) {
+  size_t offset_rounding = offset % base::SysInfo::VMAllocationGranularity();
+  size_t real_offset = offset - offset_rounding;
+  size_t real_length = length + offset_rounding;
+
+  // This should hold (since we checked |num_bytes| versus the maximum value of
+  // |off_t| on creation, but it never hurts to be paranoid.
+  DCHECK_LE(static_cast<uint64_t>(real_offset),
+            static_cast<uint64_t>(std::numeric_limits<DWORD>::max()));
+
+  void* real_base =
+      MapViewOfFile(handle_.get().handle, FILE_MAP_READ | FILE_MAP_WRITE, 0,
+                    static_cast<DWORD>(real_offset), real_length);
+  if (!real_base) {
+    PLOG(ERROR) << "MapViewOfFile";
+    return nullptr;
+  }
+
+  void* base = static_cast<char*>(real_base) + offset_rounding;
+  return make_scoped_ptr(new SimplePlatformSharedBufferMapping(
+      base, length, real_base, real_length));
+}
+
+// SimplePlatformSharedBufferMapping -------------------------------------------
+
+void SimplePlatformSharedBufferMapping::Unmap() {
+  BOOL result = UnmapViewOfFile(real_base_);
+  PLOG_IF(ERROR, !result) << "UnmapViewOfFile";
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/simple_platform_support.cc b/mojo/edk/embedder/simple_platform_support.cc
new file mode 100644
index 0000000..814cd68
--- /dev/null
+++ b/mojo/edk/embedder/simple_platform_support.cc
@@ -0,0 +1,31 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/simple_platform_support.h"
+
+#include "base/rand_util.h"
+#include "mojo/edk/embedder/simple_platform_shared_buffer.h"
+
+namespace mojo {
+namespace edk {
+
+void SimplePlatformSupport::GetCryptoRandomBytes(void* bytes,
+                                                 size_t num_bytes) {
+  base::RandBytes(bytes, num_bytes);
+}
+
+PlatformSharedBuffer* SimplePlatformSupport::CreateSharedBuffer(
+    size_t num_bytes) {
+  return SimplePlatformSharedBuffer::Create(num_bytes);
+}
+
+PlatformSharedBuffer* SimplePlatformSupport::CreateSharedBufferFromHandle(
+    size_t num_bytes,
+    ScopedPlatformHandle platform_handle) {
+  return SimplePlatformSharedBuffer::CreateFromPlatformHandle(
+      num_bytes, platform_handle.Pass());
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/embedder/simple_platform_support.h b/mojo/edk/embedder/simple_platform_support.h
new file mode 100644
index 0000000..ef97d91
--- /dev/null
+++ b/mojo/edk/embedder/simple_platform_support.h
@@ -0,0 +1,39 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_
+#define MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_
+
+#include "mojo/edk/embedder/platform_support.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// A simple implementation of |PlatformSupport|, when sandboxing and
+// multiprocess support are not issues (e.g., in most tests). Note: This class
+// has no state, and different instances of |SimplePlatformSupport| are mutually
+// compatible (i.e., you don't need to use a single instance of it everywhere --
+// you may simply create one whenever/wherever you need it).
+class MOJO_SYSTEM_IMPL_EXPORT SimplePlatformSupport final
+    : public PlatformSupport {
+ public:
+  SimplePlatformSupport() {}
+  ~SimplePlatformSupport() override {}
+
+  void GetCryptoRandomBytes(void* bytes, size_t num_bytes) override;
+  PlatformSharedBuffer* CreateSharedBuffer(size_t num_bytes) override;
+  PlatformSharedBuffer* CreateSharedBufferFromHandle(
+      size_t num_bytes,
+      ScopedPlatformHandle platform_handle) override;
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSupport);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_
diff --git a/mojo/edk/embedder/test_embedder.cc b/mojo/edk/embedder/test_embedder.cc
new file mode 100644
index 0000000..b33ea7be
--- /dev/null
+++ b/mojo/edk/embedder/test_embedder.cc
@@ -0,0 +1,56 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/embedder/test_embedder.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/embedder/platform_support.h"
+#include "mojo/edk/system/core.h"
+#include "mojo/edk/system/handle_table.h"
+
+namespace mojo {
+
+namespace edk {
+namespace internal {
+
+bool ShutdownCheckNoLeaks(Core* core) {
+  // No point in taking the lock.
+  const HandleTable::HandleToEntryMap& handle_to_entry_map =
+      core->handle_table_.handle_to_entry_map_;
+
+  if (handle_to_entry_map.empty())
+    return true;
+
+  for (HandleTable::HandleToEntryMap::const_iterator it =
+           handle_to_entry_map.begin();
+       it != handle_to_entry_map.end(); ++it) {
+    LOG(ERROR) << "Mojo embedder shutdown: Leaking handle " << (*it).first;
+  }
+  return false;
+}
+
+}  // namespace internal
+
+namespace test {
+
+bool Shutdown() {
+  CHECK(internal::g_core);
+  bool rv = internal::ShutdownCheckNoLeaks(internal::g_core);
+  delete internal::g_core;
+  internal::g_core = nullptr;
+
+  CHECK(internal::g_platform_support);
+  delete internal::g_platform_support;
+  internal::g_platform_support = nullptr;
+
+  return rv;
+}
+
+}  // namespace test
+}  // namespace edk
+
+}  // namespace mojo
diff --git a/mojo/edk/embedder/test_embedder.h b/mojo/edk/embedder/test_embedder.h
new file mode 100644
index 0000000..c64ba17
--- /dev/null
+++ b/mojo/edk/embedder/test_embedder.h
@@ -0,0 +1,28 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_EMBEDDER_TEST_EMBEDDER_H_
+#define MOJO_EDK_EMBEDDER_TEST_EMBEDDER_H_
+
+#include "mojo/edk/system/system_impl_export.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+// This shuts down the global, singleton instance. (Note: "Real" embedders are
+// not expected to ever shut down this instance. This |Shutdown()| function will
+// do more work to ensure that tests don't leak, etc.) Returns true if there
+// were no problems, false if there were leaks -- i.e., handles still open -- or
+// any other problems.
+//
+// Note: It is up to the caller to ensure that there are not outstanding
+// callbacks from |CreateChannel()| before calling this.
+MOJO_SYSTEM_IMPL_EXPORT bool Shutdown();
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_EMBEDDER_TEST_EMBEDDER_H_
diff --git a/mojo/edk/js/BUILD.gn b/mojo/edk/js/BUILD.gn
new file mode 100644
index 0000000..dc61068e
--- /dev/null
+++ b/mojo/edk/js/BUILD.gn
@@ -0,0 +1,65 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../mojo_edk.gni")
+
+# TODO(hansmuller): The organization of tests in this directory is weird:
+#   * Really, js_unittests tests public stuff, so that should live in public
+#     and be reworked as some sort of apptest.
+#   * Both js_unittests and js_integration_tests should auto-generate their
+#     tests somehow. The .cc files are just test runner stubs, including
+#     explicit lists of .js files.
+group("tests") {
+  testonly = true
+  deps = [
+    # TODO(use_chrome_edk): remove "2"
+    "test:js_unittests2",
+    "test:js_integration_tests2",
+  ]
+}
+
+mojo_edk_source_set("js") {
+  sources = [
+    "core.cc",
+    "core.h",
+    "drain_data.cc",
+    "drain_data.h",
+    "handle.cc",
+    "handle.h",
+    "handle_close_observer.h",
+    "mojo_runner_delegate.cc",
+    "mojo_runner_delegate.h",
+    "support.cc",
+    "support.h",
+    "threading.cc",
+    "threading.h",
+    "waiting_callback.cc",
+    "waiting_callback.h",
+  ]
+
+  public_deps = [
+    "//base",
+    "//gin",
+    "//v8",
+  ]
+
+  deps = [
+    "//third_party/mojo/src/mojo/public/cpp/environment",
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+}
+
+mojo_edk_source_set("js_unittests") {
+  testonly = true
+  sources = [
+    "handle_unittest.cc",
+  ]
+
+  deps = [
+    "//mojo/edk/js",
+    "//mojo/edk/test:test_support",
+    "//testing/gtest",
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+}
diff --git a/mojo/edk/js/core.cc b/mojo/edk/js/core.cc
new file mode 100644
index 0000000..ed592b4
--- /dev/null
+++ b/mojo/edk/js/core.cc
@@ -0,0 +1,379 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/js/core.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "gin/arguments.h"
+#include "gin/array_buffer.h"
+#include "gin/converter.h"
+#include "gin/dictionary.h"
+#include "gin/function_template.h"
+#include "gin/handle.h"
+#include "gin/object_template_builder.h"
+#include "gin/per_isolate_data.h"
+#include "gin/public/wrapper_info.h"
+#include "gin/wrappable.h"
+#include "mojo/edk/js/drain_data.h"
+#include "mojo/edk/js/handle.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+MojoResult CloseHandle(gin::Handle<HandleWrapper> handle) {
+  if (!handle->get().is_valid())
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  handle->Close();
+  return MOJO_RESULT_OK;
+}
+
+gin::Dictionary WaitHandle(const gin::Arguments& args,
+                           mojo::Handle handle,
+                           MojoHandleSignals signals,
+                           MojoDeadline deadline) {
+  v8::Isolate* isolate = args.isolate();
+  gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(isolate);
+
+  MojoHandleSignalsState signals_state;
+  MojoResult result = mojo::Wait(handle, signals, deadline, &signals_state);
+  dictionary.Set("result", result);
+
+  mojo::WaitManyResult wmv(result, 0);
+  if (!wmv.AreSignalsStatesValid()) {
+    dictionary.Set("signalsState", v8::Null(isolate).As<v8::Value>());
+  } else {
+    gin::Dictionary signalsStateDict = gin::Dictionary::CreateEmpty(isolate);
+    signalsStateDict.Set("satisfiedSignals", signals_state.satisfied_signals);
+    signalsStateDict.Set("satisfiableSignals",
+                         signals_state.satisfiable_signals);
+    dictionary.Set("signalsState", signalsStateDict);
+  }
+
+  return dictionary;
+}
+
+gin::Dictionary WaitMany(const gin::Arguments& args,
+                         const std::vector<mojo::Handle>& handles,
+                         const std::vector<MojoHandleSignals>& signals,
+                         MojoDeadline deadline) {
+  v8::Isolate* isolate = args.isolate();
+  gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(isolate);
+
+  std::vector<MojoHandleSignalsState> signals_states(signals.size());
+  mojo::WaitManyResult wmv =
+      mojo::WaitMany(handles, signals, deadline, &signals_states);
+  dictionary.Set("result", wmv.result);
+  if (wmv.IsIndexValid()) {
+    dictionary.Set("index", wmv.index);
+  } else {
+    dictionary.Set("index", v8::Null(isolate).As<v8::Value>());
+  }
+  if (wmv.AreSignalsStatesValid()) {
+    std::vector<gin::Dictionary> vec;
+    for (size_t i = 0; i < handles.size(); ++i) {
+      gin::Dictionary signalsStateDict = gin::Dictionary::CreateEmpty(isolate);
+      signalsStateDict.Set("satisfiedSignals",
+                           signals_states[i].satisfied_signals);
+      signalsStateDict.Set("satisfiableSignals",
+                           signals_states[i].satisfiable_signals);
+      vec.push_back(signalsStateDict);
+    }
+    dictionary.Set("signalsState", vec);
+  } else {
+    dictionary.Set("signalsState", v8::Null(isolate).As<v8::Value>());
+  }
+
+  return dictionary;
+}
+
+gin::Dictionary CreateMessagePipe(const gin::Arguments& args) {
+  gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate());
+  dictionary.Set("result", MOJO_RESULT_INVALID_ARGUMENT);
+
+  MojoHandle handle0 = MOJO_HANDLE_INVALID;
+  MojoHandle handle1 = MOJO_HANDLE_INVALID;
+  MojoResult result = MOJO_RESULT_OK;
+
+  v8::Handle<v8::Value> options_value = args.PeekNext();
+  if (options_value.IsEmpty() || options_value->IsNull() ||
+      options_value->IsUndefined()) {
+    result = MojoCreateMessagePipe(NULL, &handle0, &handle1);
+  } else if (options_value->IsObject()) {
+    gin::Dictionary options_dict(args.isolate(), options_value->ToObject());
+    MojoCreateMessagePipeOptions options;
+    // For future struct_size, we can probably infer that from the presence of
+    // properties in options_dict. For now, it's always 8.
+    options.struct_size = 8;
+    // Ideally these would be optional. But the interface makes it hard to
+    // typecheck them then.
+    if (!options_dict.Get("flags", &options.flags)) {
+      return dictionary;
+    }
+
+    result = MojoCreateMessagePipe(&options, &handle0, &handle1);
+  } else {
+      return dictionary;
+  }
+
+  CHECK_EQ(MOJO_RESULT_OK, result);
+
+  dictionary.Set("result", result);
+  dictionary.Set("handle0", mojo::Handle(handle0));
+  dictionary.Set("handle1", mojo::Handle(handle1));
+  return dictionary;
+}
+
+MojoResult WriteMessage(
+    mojo::Handle handle,
+    const gin::ArrayBufferView& buffer,
+    const std::vector<gin::Handle<HandleWrapper> >& handles,
+    MojoWriteMessageFlags flags) {
+  std::vector<MojoHandle> raw_handles(handles.size());
+  for (size_t i = 0; i < handles.size(); ++i)
+    raw_handles[i] = handles[i]->get().value();
+  MojoResult rv = MojoWriteMessage(handle.value(),
+                          buffer.bytes(),
+                          static_cast<uint32_t>(buffer.num_bytes()),
+                          raw_handles.empty() ? NULL : &raw_handles[0],
+                          static_cast<uint32_t>(raw_handles.size()),
+                          flags);
+  // MojoWriteMessage takes ownership of the handles upon success, so
+  // release them here.
+  if (rv == MOJO_RESULT_OK) {
+    for (size_t i = 0; i < handles.size(); ++i)
+      ignore_result(handles[i]->release());
+  }
+  return rv;
+}
+
+gin::Dictionary ReadMessage(const gin::Arguments& args,
+                            mojo::Handle handle,
+                            MojoReadMessageFlags flags) {
+  uint32_t num_bytes = 0;
+  uint32_t num_handles = 0;
+  MojoResult result = MojoReadMessage(
+      handle.value(), NULL, &num_bytes, NULL, &num_handles, flags);
+  if (result != MOJO_RESULT_RESOURCE_EXHAUSTED) {
+    gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate());
+    dictionary.Set("result", result);
+    return dictionary;
+  }
+
+  v8::Handle<v8::ArrayBuffer> array_buffer =
+      v8::ArrayBuffer::New(args.isolate(), num_bytes);
+  std::vector<mojo::Handle> handles(num_handles);
+
+  gin::ArrayBuffer buffer;
+  ConvertFromV8(args.isolate(), array_buffer, &buffer);
+  CHECK(buffer.num_bytes() == num_bytes);
+
+  result = MojoReadMessage(handle.value(),
+                           buffer.bytes(),
+                           &num_bytes,
+                           handles.empty() ? NULL :
+                               reinterpret_cast<MojoHandle*>(&handles[0]),
+                           &num_handles,
+                           flags);
+
+  CHECK(buffer.num_bytes() == num_bytes);
+  CHECK(handles.size() == num_handles);
+
+  gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate());
+  dictionary.Set("result", result);
+  dictionary.Set("buffer", array_buffer);
+  dictionary.Set("handles", handles);
+  return dictionary;
+}
+
+gin::Dictionary CreateDataPipe(const gin::Arguments& args) {
+  gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate());
+  dictionary.Set("result", MOJO_RESULT_INVALID_ARGUMENT);
+
+  MojoHandle producer_handle = MOJO_HANDLE_INVALID;
+  MojoHandle consumer_handle = MOJO_HANDLE_INVALID;
+  MojoResult result = MOJO_RESULT_OK;
+
+  v8::Handle<v8::Value> options_value = args.PeekNext();
+  if (options_value.IsEmpty() || options_value->IsNull() ||
+      options_value->IsUndefined()) {
+    result = MojoCreateDataPipe(NULL, &producer_handle, &consumer_handle);
+  } else if (options_value->IsObject()) {
+    gin::Dictionary options_dict(args.isolate(), options_value->ToObject());
+    MojoCreateDataPipeOptions options;
+    // For future struct_size, we can probably infer that from the presence of
+    // properties in options_dict. For now, it's always 16.
+    options.struct_size = 16;
+    // Ideally these would be optional. But the interface makes it hard to
+    // typecheck them then.
+    if (!options_dict.Get("flags", &options.flags) ||
+        !options_dict.Get("elementNumBytes", &options.element_num_bytes) ||
+        !options_dict.Get("capacityNumBytes", &options.capacity_num_bytes)) {
+      return dictionary;
+    }
+
+    result = MojoCreateDataPipe(&options, &producer_handle, &consumer_handle);
+  } else {
+    return dictionary;
+  }
+
+  CHECK_EQ(MOJO_RESULT_OK, result);
+
+  dictionary.Set("result", result);
+  dictionary.Set("producerHandle", mojo::Handle(producer_handle));
+  dictionary.Set("consumerHandle", mojo::Handle(consumer_handle));
+  return dictionary;
+}
+
+gin::Dictionary WriteData(const gin::Arguments& args,
+                          mojo::Handle handle,
+                          const gin::ArrayBufferView& buffer,
+                          MojoWriteDataFlags flags) {
+  uint32_t num_bytes = static_cast<uint32_t>(buffer.num_bytes());
+  MojoResult result =
+      MojoWriteData(handle.value(), buffer.bytes(), &num_bytes, flags);
+  gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate());
+  dictionary.Set("result", result);
+  dictionary.Set("numBytes", num_bytes);
+  return dictionary;
+}
+
+gin::Dictionary ReadData(const gin::Arguments& args,
+                         mojo::Handle handle,
+                         MojoReadDataFlags flags) {
+  uint32_t num_bytes = 0;
+  MojoResult result = MojoReadData(
+      handle.value(), NULL, &num_bytes, MOJO_READ_DATA_FLAG_QUERY);
+  if (result != MOJO_RESULT_OK) {
+    gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate());
+    dictionary.Set("result", result);
+    return dictionary;
+  }
+
+  v8::Handle<v8::ArrayBuffer> array_buffer =
+      v8::ArrayBuffer::New(args.isolate(), num_bytes);
+  gin::ArrayBuffer buffer;
+  ConvertFromV8(args.isolate(), array_buffer, &buffer);
+  CHECK_EQ(num_bytes, buffer.num_bytes());
+
+  result = MojoReadData(handle.value(), buffer.bytes(), &num_bytes, flags);
+  CHECK_EQ(num_bytes, buffer.num_bytes());
+
+  gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(args.isolate());
+  dictionary.Set("result", result);
+  dictionary.Set("buffer", array_buffer);
+  return dictionary;
+}
+
+// Asynchronously read all of the data available for the specified data pipe
+// consumer handle until the remote handle is closed or an error occurs. A
+// Promise is returned whose settled value is an object like this:
+// {result: core.RESULT_OK, buffer: dataArrayBuffer}. If the read failed,
+// then the Promise is rejected, the result will be the actual error code,
+// and the buffer will contain whatever was read before the error occurred.
+// The drainData data pipe handle argument is closed automatically.
+
+v8::Handle<v8::Value> DoDrainData(gin::Arguments* args,
+                                  gin::Handle<HandleWrapper> handle) {
+  return (new DrainData(args->isolate(), handle->release()))->GetPromise();
+}
+
+bool IsHandle(gin::Arguments* args, v8::Handle<v8::Value> val) {
+  gin::Handle<mojo::edk::HandleWrapper> ignore_handle;
+  return gin::Converter<gin::Handle<mojo::edk::HandleWrapper>>::FromV8(
+      args->isolate(), val, &ignore_handle);
+}
+
+
+gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
+
+}  // namespace
+
+const char Core::kModuleName[] = "mojo/public/js/core";
+
+v8::Local<v8::Value> Core::GetModule(v8::Isolate* isolate) {
+  gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
+  v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
+      &g_wrapper_info);
+
+  if (templ.IsEmpty()) {
+    templ =
+        gin::ObjectTemplateBuilder(isolate)
+            // TODO(mpcomplete): Should these just be methods on the JS Handle
+            // object?
+            .SetMethod("close", CloseHandle)
+            .SetMethod("wait", WaitHandle)
+            .SetMethod("waitMany", WaitMany)
+            .SetMethod("createMessagePipe", CreateMessagePipe)
+            .SetMethod("writeMessage", WriteMessage)
+            .SetMethod("readMessage", ReadMessage)
+            .SetMethod("createDataPipe", CreateDataPipe)
+            .SetMethod("writeData", WriteData)
+            .SetMethod("readData", ReadData)
+            .SetMethod("drainData", DoDrainData)
+            .SetMethod("isHandle", IsHandle)
+
+            .SetValue("RESULT_OK", MOJO_RESULT_OK)
+            .SetValue("RESULT_CANCELLED", MOJO_RESULT_CANCELLED)
+            .SetValue("RESULT_UNKNOWN", MOJO_RESULT_UNKNOWN)
+            .SetValue("RESULT_INVALID_ARGUMENT", MOJO_RESULT_INVALID_ARGUMENT)
+            .SetValue("RESULT_DEADLINE_EXCEEDED", MOJO_RESULT_DEADLINE_EXCEEDED)
+            .SetValue("RESULT_NOT_FOUND", MOJO_RESULT_NOT_FOUND)
+            .SetValue("RESULT_ALREADY_EXISTS", MOJO_RESULT_ALREADY_EXISTS)
+            .SetValue("RESULT_PERMISSION_DENIED", MOJO_RESULT_PERMISSION_DENIED)
+            .SetValue("RESULT_RESOURCE_EXHAUSTED",
+                      MOJO_RESULT_RESOURCE_EXHAUSTED)
+            .SetValue("RESULT_FAILED_PRECONDITION",
+                      MOJO_RESULT_FAILED_PRECONDITION)
+            .SetValue("RESULT_ABORTED", MOJO_RESULT_ABORTED)
+            .SetValue("RESULT_OUT_OF_RANGE", MOJO_RESULT_OUT_OF_RANGE)
+            .SetValue("RESULT_UNIMPLEMENTED", MOJO_RESULT_UNIMPLEMENTED)
+            .SetValue("RESULT_INTERNAL", MOJO_RESULT_INTERNAL)
+            .SetValue("RESULT_UNAVAILABLE", MOJO_RESULT_UNAVAILABLE)
+            .SetValue("RESULT_DATA_LOSS", MOJO_RESULT_DATA_LOSS)
+            .SetValue("RESULT_BUSY", MOJO_RESULT_BUSY)
+            .SetValue("RESULT_SHOULD_WAIT", MOJO_RESULT_SHOULD_WAIT)
+
+            .SetValue("DEADLINE_INDEFINITE", MOJO_DEADLINE_INDEFINITE)
+
+            .SetValue("HANDLE_SIGNAL_NONE", MOJO_HANDLE_SIGNAL_NONE)
+            .SetValue("HANDLE_SIGNAL_READABLE", MOJO_HANDLE_SIGNAL_READABLE)
+            .SetValue("HANDLE_SIGNAL_WRITABLE", MOJO_HANDLE_SIGNAL_WRITABLE)
+            .SetValue("HANDLE_SIGNAL_PEER_CLOSED",
+                      MOJO_HANDLE_SIGNAL_PEER_CLOSED)
+
+            .SetValue("CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE",
+                      MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE)
+
+            .SetValue("WRITE_MESSAGE_FLAG_NONE", MOJO_WRITE_MESSAGE_FLAG_NONE)
+
+            .SetValue("READ_MESSAGE_FLAG_NONE", MOJO_READ_MESSAGE_FLAG_NONE)
+            .SetValue("READ_MESSAGE_FLAG_MAY_DISCARD",
+                      MOJO_READ_MESSAGE_FLAG_MAY_DISCARD)
+
+            .SetValue("CREATE_DATA_PIPE_OPTIONS_FLAG_NONE",
+                      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE)
+
+            .SetValue("WRITE_DATA_FLAG_NONE", MOJO_WRITE_DATA_FLAG_NONE)
+            .SetValue("WRITE_DATA_FLAG_ALL_OR_NONE",
+                      MOJO_WRITE_DATA_FLAG_ALL_OR_NONE)
+
+            .SetValue("READ_DATA_FLAG_NONE", MOJO_READ_DATA_FLAG_NONE)
+            .SetValue("READ_DATA_FLAG_ALL_OR_NONE",
+                      MOJO_READ_DATA_FLAG_ALL_OR_NONE)
+            .SetValue("READ_DATA_FLAG_DISCARD", MOJO_READ_DATA_FLAG_DISCARD)
+            .SetValue("READ_DATA_FLAG_QUERY", MOJO_READ_DATA_FLAG_QUERY)
+            .SetValue("READ_DATA_FLAG_PEEK", MOJO_READ_DATA_FLAG_PEEK)
+            .Build();
+
+    data->SetObjectTemplate(&g_wrapper_info, templ);
+  }
+
+  return templ->NewInstance();
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/core.h b/mojo/edk/js/core.h
new file mode 100644
index 0000000..c13b2da4
--- /dev/null
+++ b/mojo/edk/js/core.h
@@ -0,0 +1,22 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_JS_CORE_H_
+#define MOJO_EDK_JS_CORE_H_
+
+#include "v8/include/v8.h"
+
+namespace mojo {
+namespace edk {
+
+class Core {
+ public:
+  static const char kModuleName[];
+  static v8::Local<v8::Value> GetModule(v8::Isolate* isolate);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_JS_CORE_H_
diff --git a/mojo/edk/js/drain_data.cc b/mojo/edk/js/drain_data.cc
new file mode 100644
index 0000000..d8fa091
--- /dev/null
+++ b/mojo/edk/js/drain_data.cc
@@ -0,0 +1,131 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/js/drain_data.h"
+
+#include "gin/array_buffer.h"
+#include "gin/converter.h"
+#include "gin/dictionary.h"
+#include "gin/per_context_data.h"
+#include "gin/per_isolate_data.h"
+#include "mojo/public/cpp/environment/environment.h"
+#include "mojo/public/cpp/system/core.h"
+
+namespace mojo {
+namespace edk {
+
+DrainData::DrainData(v8::Isolate* isolate, mojo::Handle handle)
+    : isolate_(isolate),
+      handle_(DataPipeConsumerHandle(handle.value())),
+      wait_id_(0) {
+
+  v8::Handle<v8::Context> context(isolate_->GetCurrentContext());
+  runner_ = gin::PerContextData::From(context)->runner()->GetWeakPtr();
+
+  WaitForData();
+}
+
+v8::Handle<v8::Value> DrainData::GetPromise() {
+  CHECK(resolver_.IsEmpty());
+  v8::Handle<v8::Promise::Resolver> resolver(
+      v8::Promise::Resolver::New(isolate_));
+  resolver_.Reset(isolate_, resolver);
+  return resolver->GetPromise();
+}
+
+DrainData::~DrainData() {
+  if (wait_id_)
+    Environment::GetDefaultAsyncWaiter()->CancelWait(wait_id_);
+  resolver_.Reset();
+}
+
+void DrainData::WaitForData() {
+  wait_id_ = Environment::GetDefaultAsyncWaiter()->AsyncWait(
+      handle_.get().value(),
+      MOJO_HANDLE_SIGNAL_READABLE,
+      MOJO_DEADLINE_INDEFINITE,
+      &DrainData::WaitCompleted,
+      this);
+}
+
+void DrainData::DataReady(MojoResult result) {
+  wait_id_ = 0;
+  if (result != MOJO_RESULT_OK) {
+    DeliverData(result);
+    return;
+  }
+  while (result == MOJO_RESULT_OK) {
+    result = ReadData();
+    if (result == MOJO_RESULT_SHOULD_WAIT)
+      WaitForData();
+    else if (result != MOJO_RESULT_OK)
+      DeliverData(result);
+  }
+}
+
+MojoResult DrainData::ReadData() {
+  const void* buffer;
+  uint32_t num_bytes = 0;
+  MojoResult result = BeginReadDataRaw(
+      handle_.get(), &buffer, &num_bytes, MOJO_READ_DATA_FLAG_NONE);
+  if (result != MOJO_RESULT_OK)
+    return result;
+  const char* p = static_cast<const char*>(buffer);
+  DataBuffer* data_buffer = new DataBuffer(p, p + num_bytes);
+  data_buffers_.push_back(data_buffer);
+  return EndReadDataRaw(handle_.get(), num_bytes);
+}
+
+void DrainData::DeliverData(MojoResult result) {
+  if (!runner_) {
+    delete this;
+    return;
+  }
+
+  size_t total_bytes = 0;
+  for (unsigned i = 0; i < data_buffers_.size(); i++)
+    total_bytes += data_buffers_[i]->size();
+
+  // Create a total_bytes length ArrayBuffer return value.
+  gin::Runner::Scope scope(runner_.get());
+  v8::Handle<v8::ArrayBuffer> array_buffer =
+      v8::ArrayBuffer::New(isolate_, total_bytes);
+  gin::ArrayBuffer buffer;
+  ConvertFromV8(isolate_, array_buffer, &buffer);
+  CHECK_EQ(total_bytes, buffer.num_bytes());
+
+  // Copy the data_buffers into the ArrayBuffer.
+  char* array_buffer_ptr = static_cast<char*>(buffer.bytes());
+  size_t offset = 0;
+  for (size_t i = 0; i < data_buffers_.size(); i++) {
+    size_t num_bytes = data_buffers_[i]->size();
+    if (num_bytes == 0)
+      continue;
+    const char* data_buffer_ptr = &((*data_buffers_[i])[0]);
+    memcpy(array_buffer_ptr + offset, data_buffer_ptr, num_bytes);
+    offset += num_bytes;
+  }
+
+  // The "settled" value of the promise always includes all of the data
+  // that was read before either an error occurred or the remote pipe handle
+  // was closed. The latter is indicated by MOJO_RESULT_FAILED_PRECONDITION.
+
+  v8::Handle<v8::Promise::Resolver> resolver(
+      v8::Local<v8::Promise::Resolver>::New(isolate_, resolver_));
+
+  gin::Dictionary dictionary = gin::Dictionary::CreateEmpty(isolate_);
+  dictionary.Set("result", result);
+  dictionary.Set("buffer", array_buffer);
+  v8::Handle<v8::Value> settled_value(ConvertToV8(isolate_, dictionary));
+
+  if (result == MOJO_RESULT_FAILED_PRECONDITION)
+    resolver->Resolve(settled_value);
+  else
+    resolver->Reject(settled_value);
+
+  delete this;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/drain_data.h b/mojo/edk/js/drain_data.h
new file mode 100644
index 0000000..63c9e49
--- /dev/null
+++ b/mojo/edk/js/drain_data.h
@@ -0,0 +1,64 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_JS_DRAIN_DATA_H_
+#define MOJO_EDK_JS_DRAIN_DATA_H_
+
+#include "base/memory/scoped_vector.h"
+#include "gin/runner.h"
+#include "mojo/public/c/environment/async_waiter.h"
+#include "mojo/public/cpp/system/core.h"
+#include "v8/include/v8.h"
+
+namespace mojo {
+namespace edk {
+
+// This class is the implementation of the Mojo JavaScript core module's
+// drainData() method. It is not intended to be used directly. The caller
+// allocates a DrainData on the heap and returns GetPromise() to JS. The
+// implementation deletes itself after reading as much data as possible
+// and rejecting or resolving the Promise.
+
+class DrainData {
+ public:
+  // Starts waiting for data on the specified data pipe consumer handle.
+  // See WaitForData(). The constructor does not block.
+  DrainData(v8::Isolate* isolate, mojo::Handle handle);
+
+  // Returns a Promise that will be settled when no more data can be read.
+  // Should be called just once on a newly allocated DrainData object.
+  v8::Handle<v8::Value> GetPromise();
+
+ private:
+  ~DrainData();
+
+  // Registers an "async waiter" that calls DataReady() via WaitCompleted().
+  void WaitForData();
+  static void WaitCompleted(void* self, MojoResult result) {
+    static_cast<DrainData*>(self)->DataReady(result);
+  }
+
+  // Use ReadData() to read whatever is availble now on handle_ and save
+  // it in data_buffers_.
+  void DataReady(MojoResult result);
+  MojoResult ReadData();
+
+  // When the remote data pipe handle is closed, or an error occurs, deliver
+  // all of the buffered data to the JS Promise and then delete this.
+  void DeliverData(MojoResult result);
+
+  using DataBuffer = std::vector<char>;
+
+  v8::Isolate* isolate_;
+  ScopedDataPipeConsumerHandle handle_;
+  MojoAsyncWaitID wait_id_;
+  base::WeakPtr<gin::Runner> runner_;
+  v8::UniquePersistent<v8::Promise::Resolver> resolver_;
+  ScopedVector<DataBuffer> data_buffers_;
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_JS_DRAIN_DATA_H_
diff --git a/mojo/edk/js/handle.cc b/mojo/edk/js/handle.cc
new file mode 100644
index 0000000..c465f463
--- /dev/null
+++ b/mojo/edk/js/handle.cc
@@ -0,0 +1,83 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/js/handle.h"
+
+#include "mojo/edk/js/handle_close_observer.h"
+
+namespace mojo {
+namespace edk {
+
+gin::WrapperInfo HandleWrapper::kWrapperInfo = { gin::kEmbedderNativeGin };
+
+HandleWrapper::HandleWrapper(MojoHandle handle)
+    : handle_(mojo::Handle(handle)) {
+}
+
+HandleWrapper::~HandleWrapper() {
+  NotifyCloseObservers();
+}
+
+void HandleWrapper::Close() {
+  NotifyCloseObservers();
+  handle_.reset();
+}
+
+void HandleWrapper::AddCloseObserver(HandleCloseObserver* observer) {
+  close_observers_.AddObserver(observer);
+}
+
+void HandleWrapper::RemoveCloseObserver(HandleCloseObserver* observer) {
+  close_observers_.RemoveObserver(observer);
+}
+
+void HandleWrapper::NotifyCloseObservers() {
+  if (!handle_.is_valid())
+    return;
+
+  FOR_EACH_OBSERVER(HandleCloseObserver, close_observers_, OnWillCloseHandle());
+}
+
+}  // namespace edk
+}  // namespace mojo
+
+namespace gin {
+
+v8::Handle<v8::Value> Converter<mojo::Handle>::ToV8(v8::Isolate* isolate,
+                                                    const mojo::Handle& val) {
+  if (!val.is_valid())
+    return v8::Null(isolate);
+  return mojo::edk::HandleWrapper::Create(isolate, val.value()).ToV8();
+}
+
+bool Converter<mojo::Handle>::FromV8(v8::Isolate* isolate,
+                                     v8::Handle<v8::Value> val,
+                                     mojo::Handle* out) {
+  if (val->IsNull()) {
+    *out = mojo::Handle();
+    return true;
+  }
+
+  gin::Handle<mojo::edk::HandleWrapper> handle;
+  if (!Converter<gin::Handle<mojo::edk::HandleWrapper> >::FromV8(
+      isolate, val, &handle))
+    return false;
+
+  *out = handle->get();
+  return true;
+}
+
+v8::Handle<v8::Value> Converter<mojo::MessagePipeHandle>::ToV8(
+    v8::Isolate* isolate, mojo::MessagePipeHandle val) {
+  return Converter<mojo::Handle>::ToV8(isolate, val);
+}
+
+bool Converter<mojo::MessagePipeHandle>::FromV8(v8::Isolate* isolate,
+                                                v8::Handle<v8::Value> val,
+                                                mojo::MessagePipeHandle* out) {
+  return Converter<mojo::Handle>::FromV8(isolate, val, out);
+}
+
+
+}  // namespace gin
diff --git a/mojo/edk/js/handle.h b/mojo/edk/js/handle.h
new file mode 100644
index 0000000..9fa92b0
--- /dev/null
+++ b/mojo/edk/js/handle.h
@@ -0,0 +1,99 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_JS_HANDLE_H_
+#define MOJO_EDK_JS_HANDLE_H_
+
+#include "base/observer_list.h"
+#include "gin/converter.h"
+#include "gin/handle.h"
+#include "gin/wrappable.h"
+#include "mojo/public/cpp/system/core.h"
+
+namespace mojo {
+namespace edk {
+class HandleCloseObserver;
+
+// Wrapper for mojo Handles exposed to JavaScript. This ensures the Handle
+// is Closed when its JS object is garbage collected.
+class HandleWrapper : public gin::Wrappable<HandleWrapper> {
+ public:
+  static gin::WrapperInfo kWrapperInfo;
+
+  static gin::Handle<HandleWrapper> Create(v8::Isolate* isolate,
+                                           MojoHandle handle) {
+    return gin::CreateHandle(isolate, new HandleWrapper(handle));
+  }
+
+  mojo::Handle get() const { return handle_.get(); }
+  mojo::Handle release() { return handle_.release(); }
+  void Close();
+
+  void AddCloseObserver(HandleCloseObserver* observer);
+  void RemoveCloseObserver(HandleCloseObserver* observer);
+
+ protected:
+  HandleWrapper(MojoHandle handle);
+  ~HandleWrapper() override;
+  void NotifyCloseObservers();
+
+  mojo::ScopedHandle handle_;
+  base::ObserverList<HandleCloseObserver> close_observers_;
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+namespace gin {
+
+// Note: It's important to use this converter rather than the one for
+// MojoHandle, since that will do a simple int32 conversion. It's unfortunate
+// there's no way to prevent against accidental use.
+// TODO(mpcomplete): define converters for all Handle subtypes.
+template<>
+struct Converter<mojo::Handle> {
+  static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
+                                    const mojo::Handle& val);
+  static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+                     mojo::Handle* out);
+};
+
+template<>
+struct Converter<mojo::MessagePipeHandle> {
+  static v8::Handle<v8::Value> ToV8(v8::Isolate* isolate,
+                                    mojo::MessagePipeHandle val);
+  static bool FromV8(v8::Isolate* isolate,
+                     v8::Handle<v8::Value> val,
+                     mojo::MessagePipeHandle* out);
+};
+
+// We need to specialize the normal gin::Handle converter in order to handle
+// converting |null| to a wrapper for an empty mojo::Handle.
+template<>
+struct Converter<gin::Handle<mojo::edk::HandleWrapper> > {
+  static v8::Handle<v8::Value> ToV8(
+      v8::Isolate* isolate,
+      const gin::Handle<mojo::edk::HandleWrapper>& val) {
+    return val.ToV8();
+  }
+
+  static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
+                     gin::Handle<mojo::edk::HandleWrapper>* out) {
+    if (val->IsNull()) {
+      *out = mojo::edk::HandleWrapper::Create(isolate, MOJO_HANDLE_INVALID);
+      return true;
+    }
+
+    mojo::edk::HandleWrapper* object = NULL;
+    if (!Converter<mojo::edk::HandleWrapper*>::FromV8(isolate, val, &object)) {
+      return false;
+    }
+    *out = gin::Handle<mojo::edk::HandleWrapper>(val, object);
+    return true;
+  }
+};
+
+}  // namespace gin
+
+#endif  // MOJO_EDK_JS_HANDLE_H_
diff --git a/mojo/edk/js/handle_close_observer.h b/mojo/edk/js/handle_close_observer.h
new file mode 100644
index 0000000..b507350
--- /dev/null
+++ b/mojo/edk/js/handle_close_observer.h
@@ -0,0 +1,22 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_JS_HANDLE_CLOSE_OBSERVER_H_
+#define MOJO_EDK_JS_HANDLE_CLOSE_OBSERVER_H_
+
+namespace mojo {
+namespace edk {
+
+class HandleCloseObserver {
+ public:
+  virtual void OnWillCloseHandle() = 0;
+
+ protected:
+  virtual ~HandleCloseObserver() {}
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_JS_HANDLE_CLOSE_OBSERVER_H_
diff --git a/mojo/edk/js/handle_unittest.cc b/mojo/edk/js/handle_unittest.cc
new file mode 100644
index 0000000..6ee44445
--- /dev/null
+++ b/mojo/edk/js/handle_unittest.cc
@@ -0,0 +1,90 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/macros.h"
+#include "mojo/edk/js/handle.h"
+#include "mojo/edk/js/handle_close_observer.h"
+#include "mojo/public/cpp/system/core.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+
+class HandleWrapperTest : public testing::Test,
+                          public HandleCloseObserver {
+ public:
+  HandleWrapperTest() : closes_observed_(0) {}
+
+  void OnWillCloseHandle() override { closes_observed_++; }
+
+ protected:
+  int closes_observed_;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(HandleWrapperTest);
+};
+
+class TestHandleWrapper : public HandleWrapper {
+ public:
+  explicit TestHandleWrapper(MojoHandle handle) : HandleWrapper(handle) {}
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(TestHandleWrapper);
+};
+
+// Test that calling Close() on a HandleWrapper for an invalid handle does not
+// notify observers.
+TEST_F(HandleWrapperTest, CloseWithInvalidHandle) {
+  {
+    TestHandleWrapper wrapper(MOJO_HANDLE_INVALID);
+    wrapper.AddCloseObserver(this);
+    ASSERT_EQ(0, closes_observed_);
+    wrapper.Close();
+    EXPECT_EQ(0, closes_observed_);
+  }
+  EXPECT_EQ(0, closes_observed_);
+}
+
+// Test that destroying a HandleWrapper for an invalid handle does not notify
+// observers.
+TEST_F(HandleWrapperTest, DestroyWithInvalidHandle) {
+  {
+    TestHandleWrapper wrapper(MOJO_HANDLE_INVALID);
+    wrapper.AddCloseObserver(this);
+    ASSERT_EQ(0, closes_observed_);
+  }
+  EXPECT_EQ(0, closes_observed_);
+}
+
+// Test that calling Close on a HandleWrapper for a valid handle notifies
+// observers once.
+TEST_F(HandleWrapperTest, CloseWithValidHandle) {
+  {
+    mojo::MessagePipe pipe;
+    TestHandleWrapper wrapper(pipe.handle0.release().value());
+    wrapper.AddCloseObserver(this);
+    ASSERT_EQ(0, closes_observed_);
+    wrapper.Close();
+    EXPECT_EQ(1, closes_observed_);
+    // Check that calling close again doesn't notify observers.
+    wrapper.Close();
+    EXPECT_EQ(1, closes_observed_);
+  }
+  // Check that destroying a closed HandleWrapper doesn't notify observers.
+  EXPECT_EQ(1, closes_observed_);
+}
+
+// Test that destroying a HandleWrapper for a valid handle notifies observers.
+TEST_F(HandleWrapperTest, DestroyWithValidHandle) {
+  {
+    mojo::MessagePipe pipe;
+    TestHandleWrapper wrapper(pipe.handle0.release().value());
+    wrapper.AddCloseObserver(this);
+    ASSERT_EQ(0, closes_observed_);
+  }
+  EXPECT_EQ(1, closes_observed_);
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/mojo_runner_delegate.cc b/mojo/edk/js/mojo_runner_delegate.cc
new file mode 100644
index 0000000..9b18b55d
--- /dev/null
+++ b/mojo/edk/js/mojo_runner_delegate.cc
@@ -0,0 +1,78 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/js/mojo_runner_delegate.h"
+
+#include "base/bind.h"
+#include "base/path_service.h"
+#include "gin/converter.h"
+#include "gin/modules/console.h"
+#include "gin/modules/module_registry.h"
+#include "gin/modules/timer.h"
+#include "gin/try_catch.h"
+#include "mojo/edk/js/core.h"
+#include "mojo/edk/js/handle.h"
+#include "mojo/edk/js/support.h"
+#include "mojo/edk/js/threading.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+// TODO(abarth): Rather than loading these modules from the file system, we
+// should load them from the network via Mojo IPC.
+std::vector<base::FilePath> GetModuleSearchPaths() {
+  std::vector<base::FilePath> search_paths(2);
+  PathService::Get(base::DIR_SOURCE_ROOT, &search_paths[0]);
+  PathService::Get(base::DIR_EXE, &search_paths[1]);
+  search_paths[1] = search_paths[1].AppendASCII("gen");
+  return search_paths;
+}
+
+void StartCallback(base::WeakPtr<gin::Runner> runner,
+                   MojoHandle pipe,
+                   v8::Handle<v8::Value> module) {
+  v8::Isolate* isolate = runner->GetContextHolder()->isolate();
+  v8::Handle<v8::Function> start;
+  CHECK(gin::ConvertFromV8(isolate, module, &start));
+
+  v8::Handle<v8::Value> args[] = {
+      gin::ConvertToV8(isolate, Handle(pipe)) };
+  runner->Call(start, runner->global(), 1, args);
+}
+
+}  // namespace
+
+MojoRunnerDelegate::MojoRunnerDelegate()
+    : ModuleRunnerDelegate(GetModuleSearchPaths()) {
+  AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
+  AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule);
+  AddBuiltinModule(Core::kModuleName, Core::GetModule);
+  AddBuiltinModule(Support::kModuleName, Support::GetModule);
+  AddBuiltinModule(Threading::kModuleName, Threading::GetModule);
+}
+
+MojoRunnerDelegate::~MojoRunnerDelegate() {
+}
+
+void MojoRunnerDelegate::Start(gin::Runner* runner,
+                               MojoHandle pipe,
+                               const std::string& module) {
+  gin::Runner::Scope scope(runner);
+  gin::ModuleRegistry* registry =
+      gin::ModuleRegistry::From(runner->GetContextHolder()->context());
+  registry->LoadModule(runner->GetContextHolder()->isolate(), module,
+                       base::Bind(StartCallback, runner->GetWeakPtr(), pipe));
+  AttemptToLoadMoreModules(runner);
+}
+
+void MojoRunnerDelegate::UnhandledException(gin::ShellRunner* runner,
+                                            gin::TryCatch& try_catch) {
+  gin::ModuleRunnerDelegate::UnhandledException(runner, try_catch);
+  LOG(ERROR) << try_catch.GetStackTrace();
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/mojo_runner_delegate.h b/mojo/edk/js/mojo_runner_delegate.h
new file mode 100644
index 0000000..7b50b30
--- /dev/null
+++ b/mojo/edk/js/mojo_runner_delegate.h
@@ -0,0 +1,33 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_JS_MOJO_RUNNER_DELEGATE_H_
+#define MOJO_EDK_JS_MOJO_RUNNER_DELEGATE_H_
+
+#include "base/macros.h"
+#include "gin/modules/module_runner_delegate.h"
+#include "mojo/public/c/system/core.h"
+
+namespace mojo {
+namespace edk {
+
+class MojoRunnerDelegate : public gin::ModuleRunnerDelegate {
+ public:
+  MojoRunnerDelegate();
+  ~MojoRunnerDelegate() override;
+
+  void Start(gin::Runner* runner, MojoHandle pipe, const std::string& module);
+
+ private:
+  // From ModuleRunnerDelegate:
+  void UnhandledException(gin::ShellRunner* runner,
+                          gin::TryCatch& try_catch) override;
+
+  DISALLOW_COPY_AND_ASSIGN(MojoRunnerDelegate);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_JS_MOJO_RUNNER_DELEGATE_H_
diff --git a/mojo/edk/js/support.cc b/mojo/edk/js/support.cc
new file mode 100644
index 0000000..3e4391ca
--- /dev/null
+++ b/mojo/edk/js/support.cc
@@ -0,0 +1,60 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/js/support.h"
+
+#include "base/bind.h"
+#include "gin/arguments.h"
+#include "gin/converter.h"
+#include "gin/function_template.h"
+#include "gin/object_template_builder.h"
+#include "gin/per_isolate_data.h"
+#include "gin/public/wrapper_info.h"
+#include "gin/wrappable.h"
+#include "mojo/edk/js/handle.h"
+#include "mojo/edk/js/waiting_callback.h"
+#include "mojo/public/cpp/system/core.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+WaitingCallback* AsyncWait(const gin::Arguments& args,
+                           gin::Handle<HandleWrapper> handle,
+                           MojoHandleSignals signals,
+                           v8::Handle<v8::Function> callback) {
+  return WaitingCallback::Create(args.isolate(), callback, handle, signals)
+             .get();
+}
+
+void CancelWait(WaitingCallback* waiting_callback) {
+  waiting_callback->Cancel();
+}
+
+gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
+
+}  // namespace
+
+const char Support::kModuleName[] = "mojo/public/js/support";
+
+v8::Local<v8::Value> Support::GetModule(v8::Isolate* isolate) {
+  gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
+  v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
+      &g_wrapper_info);
+
+  if (templ.IsEmpty()) {
+    templ = gin::ObjectTemplateBuilder(isolate)
+                .SetMethod("asyncWait", AsyncWait)
+                .SetMethod("cancelWait", CancelWait)
+                .Build();
+
+    data->SetObjectTemplate(&g_wrapper_info, templ);
+  }
+
+  return templ->NewInstance();
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/support.h b/mojo/edk/js/support.h
new file mode 100644
index 0000000..1edc00c
--- /dev/null
+++ b/mojo/edk/js/support.h
@@ -0,0 +1,22 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_JS_SUPPORT_H_
+#define MOJO_EDK_JS_SUPPORT_H_
+
+#include "v8/include/v8.h"
+
+namespace mojo {
+namespace edk {
+
+class Support {
+ public:
+  static const char kModuleName[];
+  static v8::Local<v8::Value> GetModule(v8::Isolate* isolate);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_JS_SUPPORT_H_
diff --git a/mojo/edk/js/test/BUILD.gn b/mojo/edk/js/test/BUILD.gn
new file mode 100644
index 0000000..86390ba
--- /dev/null
+++ b/mojo/edk/js/test/BUILD.gn
@@ -0,0 +1,46 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//testing/test.gni")
+
+# TODO(use_chrome_edk): remove "2"
+test("js_unittests2") {
+  deps = [
+    "../../js",
+    "../../js:js_unittests",
+    "../../test:run_all_unittests",
+    "../../test:test_support",
+    "//base",
+    "//gin:gin_test",
+    "//mojo/environment:chromium",
+    "//third_party/mojo/src/mojo/public/cpp/environment",
+    "//third_party/mojo/src/mojo/public/cpp/system",
+    "//third_party/mojo/src/mojo/public/cpp/utility",
+    "//third_party/mojo/src/mojo/public/interfaces/bindings/tests:test_interfaces",
+    "//third_party/mojo/src/mojo/public/interfaces/bindings/tests:test_interfaces_experimental",
+  ]
+
+  sources = [
+    "run_js_tests.cc",
+  ]
+}
+
+# TODO(use_chrome_edk): remove "2"
+test("js_integration_tests2") {
+  deps = [
+    "../../js",
+    "../../js/tests:js_to_cpp_tests",
+    "../../test:run_all_unittests",
+    "../../test:test_support",
+    "//third_party/mojo/src/mojo/public/cpp/bindings",
+    "//third_party/mojo/src/mojo/public/interfaces/bindings/tests:test_interfaces",
+    "//base",
+    "//gin:gin_test",
+    "//mojo/environment:chromium",
+  ]
+
+  sources = [
+    "run_js_integration_tests.cc",
+  ]
+}
diff --git a/mojo/edk/js/test/hexdump.js b/mojo/edk/js/test/hexdump.js
new file mode 100644
index 0000000..b36c47f
--- /dev/null
+++ b/mojo/edk/js/test/hexdump.js
@@ -0,0 +1,34 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+define(function() {
+  function hexify(value, length) {
+    var hex = value.toString(16);
+    while (hex.length < length)
+      hex = "0" + hex;
+    return hex;
+  }
+
+  function dumpArray(bytes) {
+    var dumped = "";
+    for (var i = 0; i < bytes.length; ++i) {
+      dumped += hexify(bytes[i], 2);
+
+      if (i % 16 == 15) {
+        dumped += "\n";
+        continue;
+      }
+
+      if (i % 2 == 1)
+        dumped += " ";
+      if (i % 8 == 7)
+        dumped += " ";
+    }
+    return dumped;
+  }
+
+  var exports = {};
+  exports.dumpArray = dumpArray;
+  return exports;
+});
diff --git a/mojo/edk/js/test/run_js_integration_tests.cc b/mojo/edk/js/test/run_js_integration_tests.cc
new file mode 100644
index 0000000..2512881
--- /dev/null
+++ b/mojo/edk/js/test/run_js_integration_tests.cc
@@ -0,0 +1,57 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/files/file_path.h"
+#include "base/path_service.h"
+#include "gin/modules/console.h"
+#include "gin/modules/module_registry.h"
+#include "gin/modules/timer.h"
+#include "gin/test/file_runner.h"
+#include "gin/test/gtest.h"
+#include "mojo/edk/js/core.h"
+#include "mojo/edk/js/support.h"
+#include "mojo/edk/js/threading.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+class TestRunnerDelegate : public gin::FileRunnerDelegate {
+ public:
+  TestRunnerDelegate() {
+    AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
+    AddBuiltinModule(Core::kModuleName, Core::GetModule);
+    AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule);
+    AddBuiltinModule(Threading::kModuleName, Threading::GetModule);
+  }
+ private:
+  DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate);
+};
+
+void RunTest(std::string test, bool addSupportModule) {
+  base::FilePath path;
+  PathService::Get(base::DIR_SOURCE_ROOT, &path);
+  path = path.AppendASCII("mojo")
+             .AppendASCII("edk")
+             .AppendASCII("js")
+             .AppendASCII("tests")
+             .AppendASCII(test);
+  TestRunnerDelegate delegate;
+  if (addSupportModule)
+    delegate.AddBuiltinModule(Support::kModuleName, Support::GetModule);
+  gin::RunTestFromFile(path, &delegate, true);
+}
+
+TEST(JSTest, connection) {
+  RunTest("connection_tests.js", false);
+}
+
+TEST(JSTest, sample_service) {
+  RunTest("sample_service_tests.js", true);
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/test/run_js_tests.cc b/mojo/edk/js/test/run_js_tests.cc
new file mode 100644
index 0000000..76de3e6a
--- /dev/null
+++ b/mojo/edk/js/test/run_js_tests.cc
@@ -0,0 +1,66 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/files/file_path.h"
+#include "base/path_service.h"
+#include "gin/modules/console.h"
+#include "gin/modules/module_registry.h"
+#include "gin/test/file_runner.h"
+#include "gin/test/gtest.h"
+#include "mojo/edk/js/core.h"
+#include "mojo/edk/js/support.h"
+#include "mojo/public/cpp/environment/environment.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+class TestRunnerDelegate : public gin::FileRunnerDelegate {
+ public:
+  TestRunnerDelegate() {
+    AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
+    AddBuiltinModule(Core::kModuleName, Core::GetModule);
+    AddBuiltinModule(Support::kModuleName, Support::GetModule);
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate);
+};
+
+void RunTest(std::string test, bool run_until_idle) {
+  base::FilePath path;
+  PathService::Get(base::DIR_SOURCE_ROOT, &path);
+  path = path.AppendASCII("mojo")
+             .AppendASCII("public")
+             .AppendASCII("js")
+             .AppendASCII(test);
+  TestRunnerDelegate delegate;
+  gin::RunTestFromFile(path, &delegate, run_until_idle);
+}
+
+// TODO(abarth): Should we autogenerate these stubs from GYP?
+TEST(JSTest, core) {
+  RunTest("core_unittests.js", true);
+}
+
+TEST(JSTest, codec) {
+  RunTest("codec_unittests.js", true);
+}
+
+TEST(JSTest, struct) {
+  RunTest("struct_unittests.js", true);
+}
+
+TEST(JSTest, union) {
+  RunTest("union_unittests.js", true);
+}
+
+TEST(JSTest, validation) {
+  RunTest("validation_unittests.js", true);
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/tests/BUILD.gn b/mojo/edk/js/tests/BUILD.gn
new file mode 100644
index 0000000..a6be00f
--- /dev/null
+++ b/mojo/edk/js/tests/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../../mojo_edk.gni")
+import("../../../../third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
+
+mojo_edk_source_set("js_to_cpp_tests") {
+  testonly = true
+
+  deps = [
+    ":js_to_cpp_bindings",
+    "//gin:gin_test",
+    "//mojo/edk/js",
+    "//mojo/edk/test:test_support",
+    "//third_party/mojo/src/mojo/public/cpp/bindings",
+    "//third_party/mojo/src/mojo/public/cpp/system",
+    "//third_party/mojo/src/mojo/public/interfaces/bindings/tests:test_interfaces",
+    "//third_party/mojo/src/mojo/public/interfaces/bindings/tests:test_interfaces_experimental",
+  ]
+
+  sources = [
+    "js_to_cpp_tests.cc",
+  ]
+}
+
+mojom("js_to_cpp_bindings") {
+  sources = [
+    "js_to_cpp.mojom",
+  ]
+}
diff --git a/mojo/edk/js/tests/connection_tests.js b/mojo/edk/js/tests/connection_tests.js
new file mode 100644
index 0000000..ff59aeb
--- /dev/null
+++ b/mojo/edk/js/tests/connection_tests.js
@@ -0,0 +1,240 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Mock out the support module to avoid depending on the message loop.
+define("mojo/public/js/support", ["timer"], function(timer) {
+  var waitingCallbacks = [];
+
+  function WaitCookie(id) {
+    this.id = id;
+  }
+
+  function asyncWait(handle, flags, callback) {
+    var id = waitingCallbacks.length;
+    waitingCallbacks.push(callback);
+    return new WaitCookie(id);
+  }
+
+  function cancelWait(cookie) {
+    waitingCallbacks[cookie.id] = null;
+  }
+
+  function numberOfWaitingCallbacks() {
+    var count = 0;
+    for (var i = 0; i < waitingCallbacks.length; ++i) {
+      if (waitingCallbacks[i])
+        ++count;
+    }
+    return count;
+  }
+
+  function pumpOnce(result) {
+    var callbacks = waitingCallbacks;
+    waitingCallbacks = [];
+    for (var i = 0; i < callbacks.length; ++i) {
+      if (callbacks[i])
+        callbacks[i](result);
+    }
+  }
+
+  // Queue up a pumpOnce call to execute after the stack unwinds. Use
+  // this to trigger a pump after all Promises are executed.
+  function queuePump(result) {
+    timer.createOneShot(0, pumpOnce.bind(undefined, result));
+  }
+
+  var exports = {};
+  exports.asyncWait = asyncWait;
+  exports.cancelWait = cancelWait;
+  exports.numberOfWaitingCallbacks = numberOfWaitingCallbacks;
+  exports.pumpOnce = pumpOnce;
+  exports.queuePump = queuePump;
+  return exports;
+});
+
+define([
+    "gin/test/expect",
+    "mojo/public/js/support",
+    "mojo/public/js/core",
+    "mojo/public/js/connection",
+    "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom",
+    "mojo/public/interfaces/bindings/tests/sample_service.mojom",
+    "mojo/public/js/threading",
+    "gc",
+], function(expect,
+            mockSupport,
+            core,
+            connection,
+            sample_interfaces,
+            sample_service,
+            threading,
+            gc) {
+  testClientServer();
+  testWriteToClosedPipe();
+  testRequestResponse().then(function() {
+    this.result = "PASS";
+    gc.collectGarbage();  // should not crash
+    threading.quit();
+  }.bind(this)).catch(function(e) {
+    this.result = "FAIL: " + (e.stack || e);
+    threading.quit();
+  }.bind(this));
+
+  function createPeerConnection(handle, stubClass, proxyClass) {
+    var c = new connection.Connection(handle, stubClass, proxyClass);
+    if (c.local)
+      c.local.peer = c.remote;
+    if (c.remote)
+      c.remote.peer = c.local;
+    return c;
+  }
+
+  function testClientServer() {
+    var receivedFrobinate = false;
+
+    // ServiceImpl ------------------------------------------------------------
+
+    function ServiceImpl() {
+    }
+
+    ServiceImpl.prototype = Object.create(
+        sample_service.Service.stubClass.prototype);
+
+    ServiceImpl.prototype.frobinate = function(foo, baz, port) {
+      receivedFrobinate = true;
+
+      expect(foo.name).toBe("Example name");
+      expect(baz).toBeTruthy();
+      expect(core.close(port)).toBe(core.RESULT_OK);
+
+      return Promise.resolve(42);
+    };
+
+    var pipe = core.createMessagePipe();
+    var anotherPipe = core.createMessagePipe();
+    var sourcePipe = core.createMessagePipe();
+
+    var connection0 = createPeerConnection(
+        pipe.handle0, ServiceImpl);
+
+    var connection1 = createPeerConnection(
+        pipe.handle1, undefined, sample_service.Service.proxyClass);
+
+    var foo = new sample_service.Foo();
+    foo.bar = new sample_service.Bar();
+    foo.name = "Example name";
+    foo.source = sourcePipe.handle0;
+    connection1.remote.frobinate(foo, true, anotherPipe.handle0);
+
+    mockSupport.pumpOnce(core.RESULT_OK);
+
+    expect(receivedFrobinate).toBeTruthy();
+
+    connection0.close();
+    connection1.close();
+
+    expect(mockSupport.numberOfWaitingCallbacks()).toBe(0);
+
+    // sourcePipe.handle0 was closed automatically when sent over IPC.
+    expect(core.close(sourcePipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT);
+    // sourcePipe.handle1 hasn't been closed yet.
+    expect(core.close(sourcePipe.handle1)).toBe(core.RESULT_OK);
+
+    // anotherPipe.handle0 was closed automatically when sent over IPC.
+    expect(core.close(anotherPipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT);
+    // anotherPipe.handle1 hasn't been closed yet.
+    expect(core.close(anotherPipe.handle1)).toBe(core.RESULT_OK);
+
+    // The Connection object is responsible for closing these handles.
+    expect(core.close(pipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT);
+    expect(core.close(pipe.handle1)).toBe(core.RESULT_INVALID_ARGUMENT);
+  }
+
+  function testWriteToClosedPipe() {
+    var pipe = core.createMessagePipe();
+
+    var connection1 = createPeerConnection(
+        pipe.handle1, function() {}, sample_service.Service.proxyClass);
+
+    // Close the other end of the pipe.
+    core.close(pipe.handle0);
+
+    // Not observed yet because we haven't pumped events yet.
+    expect(connection1.encounteredError()).toBeFalsy();
+
+    var foo = new sample_service.Foo();
+    foo.bar = new sample_service.Bar();
+    connection1.remote.frobinate(null, true, null);
+
+    // Write failures are not reported.
+    expect(connection1.encounteredError()).toBeFalsy();
+
+    // Pump events, and then we should start observing the closed pipe.
+    mockSupport.pumpOnce(core.RESULT_OK);
+
+    expect(connection1.encounteredError()).toBeTruthy();
+
+    connection1.close();
+  }
+
+  function testRequestResponse() {
+
+    // ProviderImpl ------------------------------------------------------------
+
+    function ProviderImpl() {
+    }
+
+    ProviderImpl.prototype =
+        Object.create(sample_interfaces.Provider.stubClass.prototype);
+
+    ProviderImpl.prototype.echoString = function(a) {
+      mockSupport.queuePump(core.RESULT_OK);
+      return Promise.resolve({a: a});
+    };
+
+    ProviderImpl.prototype.echoStrings = function(a, b) {
+      mockSupport.queuePump(core.RESULT_OK);
+      return Promise.resolve({a: a, b: b});
+    };
+
+    var pipe = core.createMessagePipe();
+
+    var connection0 = createPeerConnection(
+        pipe.handle0,
+        ProviderImpl);
+
+    var connection1 = createPeerConnection(
+        pipe.handle1,
+        undefined,
+        sample_interfaces.Provider.proxyClass);
+
+    var origReadMessage = core.readMessage;
+    // echoString
+    mockSupport.queuePump(core.RESULT_OK);
+    return connection1.remote.echoString("hello").then(function(response) {
+      expect(response.a).toBe("hello");
+    }).then(function() {
+      // echoStrings
+      mockSupport.queuePump(core.RESULT_OK);
+      return connection1.remote.echoStrings("hello", "world");
+    }).then(function(response) {
+      expect(response.a).toBe("hello");
+      expect(response.b).toBe("world");
+    }).then(function() {
+      // Mock a read failure, expect it to fail.
+      core.readMessage = function() {
+        return { result: core.RESULT_UNKNOWN };
+      };
+      mockSupport.queuePump(core.RESULT_OK);
+      return connection1.remote.echoString("goodbye");
+    }).then(function() {
+      throw Error("Expected echoString to fail.");
+    }, function(error) {
+      expect(error.message).toBe("Connection error: " + core.RESULT_UNKNOWN);
+
+      // Clean up.
+      core.readMessage = origReadMessage;
+    });
+  }
+});
diff --git a/mojo/edk/js/tests/js_to_cpp.mojom b/mojo/edk/js/tests/js_to_cpp.mojom
new file mode 100644
index 0000000..688b22b3
--- /dev/null
+++ b/mojo/edk/js/tests/js_to_cpp.mojom
@@ -0,0 +1,54 @@
+module js_to_cpp;
+
+// This struct encompasses all of the basic types, so that they
+// may be sent from C++ to JS and back for validation.
+struct EchoArgs {
+  int64 si64;
+  int32 si32;
+  int16 si16;
+  int8  si8;
+  uint64 ui64;
+  uint32 ui32;
+  uint16 ui16;
+  uint8  ui8;
+  float float_val;
+  float float_inf;
+  float float_nan;
+  double double_val;
+  double double_inf;
+  double double_nan;
+  string? name;
+  array<string>? string_array;
+  handle<message_pipe>? message_handle;
+  handle<data_pipe_consumer>? data_handle;
+};
+
+struct EchoArgsList {
+  EchoArgsList? next;
+  EchoArgs? item;
+};
+
+// Note: For messages which control test flow, pick numbers that are unlikely
+// to be hit as a result of our deliberate corruption of response messages.
+interface CppSide {
+  // Sent for all tests to notify that the JS side is now ready.
+  StartTest@88888888();
+
+  // Indicates end for echo, bit-flip, and back-pointer tests.
+  TestFinished@99999999();
+
+  // Responses from specific tests.
+  PingResponse();
+  EchoResponse(EchoArgsList list);
+  BitFlipResponse(EchoArgsList arg);
+  BackPointerResponse(EchoArgsList arg);
+};
+
+interface JsSide {
+  SetCppSide(CppSide cpp);
+
+  Ping();
+  Echo(int32 numIterations, EchoArgs arg);
+  BitFlip(EchoArgs arg);
+  BackPointer(EchoArgs arg);
+};
diff --git a/mojo/edk/js/tests/js_to_cpp_tests.cc b/mojo/edk/js/tests/js_to_cpp_tests.cc
new file mode 100644
index 0000000..f9a9b92
--- /dev/null
+++ b/mojo/edk/js/tests/js_to_cpp_tests.cc
@@ -0,0 +1,427 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/at_exit.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/macros.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
+#include "base/strings/utf_string_conversions.h"
+#include "gin/array_buffer.h"
+#include "gin/public/isolate_holder.h"
+#include "mojo/edk/js/mojo_runner_delegate.h"
+#include "mojo/edk/js/tests/js_to_cpp.mojom.h"
+#include "mojo/edk/test/test_utils.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "mojo/public/cpp/system/core.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+
+// Global value updated by some checks to prevent compilers from optimizing
+// reads out of existence.
+uint32 g_waste_accumulator = 0;
+
+namespace {
+
+// Negative numbers with different values in each byte, the last of
+// which can survive promotion to double and back.
+const int8  kExpectedInt8Value = -65;
+const int16 kExpectedInt16Value = -16961;
+const int32 kExpectedInt32Value = -1145258561;
+const int64 kExpectedInt64Value = -77263311946305LL;
+
+// Positive numbers with different values in each byte, the last of
+// which can survive promotion to double and back.
+const uint8  kExpectedUInt8Value = 65;
+const uint16 kExpectedUInt16Value = 16961;
+const uint32 kExpectedUInt32Value = 1145258561;
+const uint64 kExpectedUInt64Value = 77263311946305LL;
+
+// Double/float values, including special case constants.
+const double kExpectedDoubleVal = 3.14159265358979323846;
+const double kExpectedDoubleInf = std::numeric_limits<double>::infinity();
+const double kExpectedDoubleNan = std::numeric_limits<double>::quiet_NaN();
+const float kExpectedFloatVal = static_cast<float>(kExpectedDoubleVal);
+const float kExpectedFloatInf = std::numeric_limits<float>::infinity();
+const float kExpectedFloatNan = std::numeric_limits<float>::quiet_NaN();
+
+// NaN has the property that it is not equal to itself.
+#define EXPECT_NAN(x) EXPECT_NE(x, x)
+
+void CheckDataPipe(MojoHandle data_pipe_handle) {
+  unsigned char buffer[100];
+  uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
+  MojoResult result = MojoReadData(
+      data_pipe_handle, buffer, &buffer_size, MOJO_READ_DATA_FLAG_NONE);
+  EXPECT_EQ(MOJO_RESULT_OK, result);
+  EXPECT_EQ(64u, buffer_size);
+  for (int i = 0; i < 64; ++i) {
+    EXPECT_EQ(i, buffer[i]);
+  }
+}
+
+void CheckMessagePipe(MojoHandle message_pipe_handle) {
+  unsigned char buffer[100];
+  uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
+  MojoResult result = MojoReadMessage(
+      message_pipe_handle, buffer, &buffer_size, 0, 0, 0);
+  EXPECT_EQ(MOJO_RESULT_OK, result);
+  EXPECT_EQ(64u, buffer_size);
+  for (int i = 0; i < 64; ++i) {
+    EXPECT_EQ(255 - i, buffer[i]);
+  }
+}
+
+js_to_cpp::EchoArgsPtr BuildSampleEchoArgs() {
+  js_to_cpp::EchoArgsPtr args(js_to_cpp::EchoArgs::New());
+  args->si64 = kExpectedInt64Value;
+  args->si32 = kExpectedInt32Value;
+  args->si16 = kExpectedInt16Value;
+  args->si8 = kExpectedInt8Value;
+  args->ui64 = kExpectedUInt64Value;
+  args->ui32 = kExpectedUInt32Value;
+  args->ui16 = kExpectedUInt16Value;
+  args->ui8 = kExpectedUInt8Value;
+  args->float_val = kExpectedFloatVal;
+  args->float_inf = kExpectedFloatInf;
+  args->float_nan = kExpectedFloatNan;
+  args->double_val = kExpectedDoubleVal;
+  args->double_inf = kExpectedDoubleInf;
+  args->double_nan = kExpectedDoubleNan;
+  args->name = "coming";
+  Array<String> string_array(3);
+  string_array[0] = "one";
+  string_array[1] = "two";
+  string_array[2] = "three";
+  args->string_array = string_array.Pass();
+  return args.Pass();
+}
+
+void CheckSampleEchoArgs(const js_to_cpp::EchoArgs& arg) {
+  EXPECT_EQ(kExpectedInt64Value, arg.si64);
+  EXPECT_EQ(kExpectedInt32Value, arg.si32);
+  EXPECT_EQ(kExpectedInt16Value, arg.si16);
+  EXPECT_EQ(kExpectedInt8Value, arg.si8);
+  EXPECT_EQ(kExpectedUInt64Value, arg.ui64);
+  EXPECT_EQ(kExpectedUInt32Value, arg.ui32);
+  EXPECT_EQ(kExpectedUInt16Value, arg.ui16);
+  EXPECT_EQ(kExpectedUInt8Value, arg.ui8);
+  EXPECT_EQ(kExpectedFloatVal, arg.float_val);
+  EXPECT_EQ(kExpectedFloatInf, arg.float_inf);
+  EXPECT_NAN(arg.float_nan);
+  EXPECT_EQ(kExpectedDoubleVal, arg.double_val);
+  EXPECT_EQ(kExpectedDoubleInf, arg.double_inf);
+  EXPECT_NAN(arg.double_nan);
+  EXPECT_EQ(std::string("coming"), arg.name.get());
+  EXPECT_EQ(std::string("one"), arg.string_array[0].get());
+  EXPECT_EQ(std::string("two"), arg.string_array[1].get());
+  EXPECT_EQ(std::string("three"), arg.string_array[2].get());
+  CheckDataPipe(arg.data_handle.get().value());
+  CheckMessagePipe(arg.message_handle.get().value());
+}
+
+void CheckSampleEchoArgsList(const js_to_cpp::EchoArgsListPtr& list) {
+  if (list.is_null())
+    return;
+  CheckSampleEchoArgs(*list->item);
+  CheckSampleEchoArgsList(list->next);
+}
+
+// More forgiving checks are needed in the face of potentially corrupt
+// messages. The values don't matter so long as all accesses are within
+// bounds.
+void CheckCorruptedString(const String& arg) {
+  if (arg.is_null())
+    return;
+  for (size_t i = 0; i < arg.size(); ++i)
+    g_waste_accumulator += arg[i];
+}
+
+void CheckCorruptedStringArray(const Array<String>& string_array) {
+  if (string_array.is_null())
+    return;
+  for (size_t i = 0; i < string_array.size(); ++i)
+    CheckCorruptedString(string_array[i]);
+}
+
+void CheckCorruptedDataPipe(MojoHandle data_pipe_handle) {
+  unsigned char buffer[100];
+  uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
+  MojoResult result = MojoReadData(
+      data_pipe_handle, buffer, &buffer_size, MOJO_READ_DATA_FLAG_NONE);
+  if (result != MOJO_RESULT_OK)
+    return;
+  for (uint32_t i = 0; i < buffer_size; ++i)
+    g_waste_accumulator += buffer[i];
+}
+
+void CheckCorruptedMessagePipe(MojoHandle message_pipe_handle) {
+  unsigned char buffer[100];
+  uint32_t buffer_size = static_cast<uint32_t>(sizeof(buffer));
+  MojoResult result = MojoReadMessage(
+      message_pipe_handle, buffer, &buffer_size, 0, 0, 0);
+  if (result != MOJO_RESULT_OK)
+    return;
+  for (uint32_t i = 0; i < buffer_size; ++i)
+    g_waste_accumulator += buffer[i];
+}
+
+void CheckCorruptedEchoArgs(const js_to_cpp::EchoArgsPtr& arg) {
+  if (arg.is_null())
+    return;
+  CheckCorruptedString(arg->name);
+  CheckCorruptedStringArray(arg->string_array);
+  if (arg->data_handle.is_valid())
+    CheckCorruptedDataPipe(arg->data_handle.get().value());
+  if (arg->message_handle.is_valid())
+    CheckCorruptedMessagePipe(arg->message_handle.get().value());
+}
+
+void CheckCorruptedEchoArgsList(const js_to_cpp::EchoArgsListPtr& list) {
+  if (list.is_null())
+    return;
+  CheckCorruptedEchoArgs(list->item);
+  CheckCorruptedEchoArgsList(list->next);
+}
+
+// Base Provider implementation class. It's expected that tests subclass and
+// override the appropriate Provider functions. When test is done quit the
+// run_loop().
+class CppSideConnection : public js_to_cpp::CppSide {
+ public:
+  CppSideConnection()
+      : run_loop_(nullptr),
+        js_side_(nullptr),
+        mishandled_messages_(0),
+        binding_(this) {}
+  ~CppSideConnection() override {}
+
+  void set_run_loop(base::RunLoop* run_loop) { run_loop_ = run_loop; }
+  base::RunLoop* run_loop() { return run_loop_; }
+
+  void set_js_side(js_to_cpp::JsSide* js_side) { js_side_ = js_side; }
+  js_to_cpp::JsSide* js_side() { return js_side_; }
+
+  void Bind(InterfaceRequest<js_to_cpp::CppSide> request) {
+    binding_.Bind(request.Pass());
+    // Keep the pipe open even after validation errors.
+    binding_.internal_router()->EnableTestingMode();
+  }
+
+  // js_to_cpp::CppSide:
+  void StartTest() override { NOTREACHED(); }
+
+  void TestFinished() override { NOTREACHED(); }
+
+  void PingResponse() override { mishandled_messages_ += 1; }
+
+  void EchoResponse(js_to_cpp::EchoArgsListPtr list) override {
+    mishandled_messages_ += 1;
+  }
+
+  void BitFlipResponse(js_to_cpp::EchoArgsListPtr list) override {
+    mishandled_messages_ += 1;
+  }
+
+  void BackPointerResponse(js_to_cpp::EchoArgsListPtr list) override {
+    mishandled_messages_ += 1;
+  }
+
+ protected:
+  base::RunLoop* run_loop_;
+  js_to_cpp::JsSide* js_side_;
+  int mishandled_messages_;
+  mojo::Binding<js_to_cpp::CppSide> binding_;
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(CppSideConnection);
+};
+
+// Trivial test to verify a message sent from JS is received.
+class PingCppSideConnection : public CppSideConnection {
+ public:
+  PingCppSideConnection() : got_message_(false) {}
+  ~PingCppSideConnection() override {}
+
+  // js_to_cpp::CppSide:
+  void StartTest() override { js_side_->Ping(); }
+
+  void PingResponse() override {
+    got_message_ = true;
+    run_loop()->Quit();
+  }
+
+  bool DidSucceed() {
+    return got_message_ && !mishandled_messages_;
+  }
+
+ private:
+  bool got_message_;
+  DISALLOW_COPY_AND_ASSIGN(PingCppSideConnection);
+};
+
+// Test that parameters are passed with correct values.
+class EchoCppSideConnection : public CppSideConnection {
+ public:
+  EchoCppSideConnection() :
+      message_count_(0),
+      termination_seen_(false) {
+  }
+  ~EchoCppSideConnection() override {}
+
+  // js_to_cpp::CppSide:
+  void StartTest() override {
+    js_side_->Echo(kExpectedMessageCount, BuildSampleEchoArgs());
+  }
+
+  void EchoResponse(js_to_cpp::EchoArgsListPtr list) override {
+    const js_to_cpp::EchoArgsPtr& special_arg = list->item;
+    message_count_ += 1;
+    EXPECT_EQ(-1, special_arg->si64);
+    EXPECT_EQ(-1, special_arg->si32);
+    EXPECT_EQ(-1, special_arg->si16);
+    EXPECT_EQ(-1, special_arg->si8);
+    EXPECT_EQ(std::string("going"), special_arg->name.To<std::string>());
+    CheckSampleEchoArgsList(list->next);
+  }
+
+  void TestFinished() override {
+    termination_seen_ = true;
+    run_loop()->Quit();
+  }
+
+  bool DidSucceed() {
+    return termination_seen_ &&
+        !mishandled_messages_ &&
+        message_count_ == kExpectedMessageCount;
+  }
+
+ private:
+  static const int kExpectedMessageCount = 10;
+  int message_count_;
+  bool termination_seen_;
+  DISALLOW_COPY_AND_ASSIGN(EchoCppSideConnection);
+};
+
+// Test that corrupted messages don't wreak havoc.
+class BitFlipCppSideConnection : public CppSideConnection {
+ public:
+  BitFlipCppSideConnection() : termination_seen_(false) {}
+  ~BitFlipCppSideConnection() override {}
+
+  // js_to_cpp::CppSide:
+  void StartTest() override { js_side_->BitFlip(BuildSampleEchoArgs()); }
+
+  void BitFlipResponse(js_to_cpp::EchoArgsListPtr list) override {
+    CheckCorruptedEchoArgsList(list);
+  }
+
+  void TestFinished() override {
+    termination_seen_ = true;
+    run_loop()->Quit();
+  }
+
+  bool DidSucceed() {
+    return termination_seen_;
+  }
+
+ private:
+  bool termination_seen_;
+  DISALLOW_COPY_AND_ASSIGN(BitFlipCppSideConnection);
+};
+
+// Test that severely random messages don't wreak havoc.
+class BackPointerCppSideConnection : public CppSideConnection {
+ public:
+  BackPointerCppSideConnection() : termination_seen_(false) {}
+  ~BackPointerCppSideConnection() override {}
+
+  // js_to_cpp::CppSide:
+  void StartTest() override { js_side_->BackPointer(BuildSampleEchoArgs()); }
+
+  void BackPointerResponse(js_to_cpp::EchoArgsListPtr list) override {
+    CheckCorruptedEchoArgsList(list);
+  }
+
+  void TestFinished() override {
+    termination_seen_ = true;
+    run_loop()->Quit();
+  }
+
+  bool DidSucceed() {
+    return termination_seen_;
+  }
+
+ private:
+  bool termination_seen_;
+  DISALLOW_COPY_AND_ASSIGN(BackPointerCppSideConnection);
+};
+
+}  // namespace
+
+class JsToCppTest : public testing::Test {
+ public:
+  JsToCppTest() {}
+
+  void RunTest(const std::string& test, CppSideConnection* cpp_side) {
+    cpp_side->set_run_loop(&run_loop_);
+
+    js_to_cpp::JsSidePtr js_side;
+    auto js_side_proxy = GetProxy(&js_side);
+
+    cpp_side->set_js_side(js_side.get());
+    js_to_cpp::CppSidePtr cpp_side_ptr;
+    cpp_side->Bind(GetProxy(&cpp_side_ptr));
+
+    js_side->SetCppSide(cpp_side_ptr.Pass());
+
+    gin::IsolateHolder::Initialize(gin::IsolateHolder::kStrictMode,
+                                   gin::ArrayBufferAllocator::SharedInstance());
+    gin::IsolateHolder instance;
+    MojoRunnerDelegate delegate;
+    gin::ShellRunner runner(&delegate, instance.isolate());
+    delegate.Start(&runner, js_side_proxy.PassMessagePipe().release().value(),
+                   test);
+
+    run_loop_.Run();
+  }
+
+ private:
+  base::ShadowingAtExitManager at_exit_;
+  base::MessageLoop loop;
+  base::RunLoop run_loop_;
+
+  DISALLOW_COPY_AND_ASSIGN(JsToCppTest);
+};
+
+TEST_F(JsToCppTest, Ping) {
+  PingCppSideConnection cpp_side_connection;
+  RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection);
+  EXPECT_TRUE(cpp_side_connection.DidSucceed());
+}
+
+TEST_F(JsToCppTest, Echo) {
+  EchoCppSideConnection cpp_side_connection;
+  RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection);
+  EXPECT_TRUE(cpp_side_connection.DidSucceed());
+}
+
+TEST_F(JsToCppTest, BitFlip) {
+  BitFlipCppSideConnection cpp_side_connection;
+  RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection);
+  EXPECT_TRUE(cpp_side_connection.DidSucceed());
+}
+
+TEST_F(JsToCppTest, BackPointer) {
+  BackPointerCppSideConnection cpp_side_connection;
+  RunTest("mojo/edk/js/tests/js_to_cpp_tests", &cpp_side_connection);
+  EXPECT_TRUE(cpp_side_connection.DidSucceed());
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/tests/js_to_cpp_tests.js b/mojo/edk/js/tests/js_to_cpp_tests.js
new file mode 100644
index 0000000..ddecc4b
--- /dev/null
+++ b/mojo/edk/js/tests/js_to_cpp_tests.js
@@ -0,0 +1,228 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+define('mojo/edk/js/tests/js_to_cpp_tests', [
+  'console',
+  'mojo/edk/js/tests/js_to_cpp.mojom',
+  'mojo/public/js/bindings',
+  'mojo/public/js/connection',
+  'mojo/public/js/connector',
+  'mojo/public/js/core',
+], function (console, jsToCpp, bindings, connection, connector, core) {
+  var retainedJsSide;
+  var retainedJsSideStub;
+  var sampleData;
+  var sampleMessage;
+  var BAD_VALUE = 13;
+  var DATA_PIPE_PARAMS = {
+    flags: core.CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,
+    elementNumBytes: 1,
+    capacityNumBytes: 64
+  };
+
+  function JsSideConnection() {
+  }
+
+  JsSideConnection.prototype =
+      Object.create(jsToCpp.JsSide.stubClass.prototype);
+
+  JsSideConnection.prototype.setCppSide = function(cppSide) {
+    this.cppSide_ = cppSide;
+    this.cppSide_.startTest();
+  };
+
+  JsSideConnection.prototype.ping = function (arg) {
+    this.cppSide_.pingResponse();
+  };
+
+  JsSideConnection.prototype.echo = function (numIterations, arg) {
+    var dataPipe1;
+    var dataPipe2;
+    var i;
+    var messagePipe1;
+    var messagePipe2;
+    var specialArg;
+
+    // Ensure expected negative values are negative.
+    if (arg.si64 > 0)
+      arg.si64 = BAD_VALUE;
+
+    if (arg.si32 > 0)
+      arg.si32 = BAD_VALUE;
+
+    if (arg.si16 > 0)
+      arg.si16 = BAD_VALUE;
+
+    if (arg.si8 > 0)
+      arg.si8 = BAD_VALUE;
+
+    for (i = 0; i < numIterations; ++i) {
+      dataPipe1 = core.createDataPipe(DATA_PIPE_PARAMS);
+      dataPipe2 = core.createDataPipe(DATA_PIPE_PARAMS);
+      messagePipe1 = core.createMessagePipe();
+      messagePipe2 = core.createMessagePipe();
+
+      arg.data_handle = dataPipe1.consumerHandle;
+      arg.message_handle = messagePipe1.handle1;
+
+      specialArg = new jsToCpp.EchoArgs();
+      specialArg.si64 = -1;
+      specialArg.si32 = -1;
+      specialArg.si16 = -1;
+      specialArg.si8 = -1;
+      specialArg.name = 'going';
+      specialArg.data_handle = dataPipe2.consumerHandle;
+      specialArg.message_handle = messagePipe2.handle1;
+
+      writeDataPipe(dataPipe1, sampleData);
+      writeDataPipe(dataPipe2, sampleData);
+      writeMessagePipe(messagePipe1, sampleMessage);
+      writeMessagePipe(messagePipe2, sampleMessage);
+
+      this.cppSide_.echoResponse(createEchoArgsList(specialArg, arg));
+
+      core.close(dataPipe1.producerHandle);
+      core.close(dataPipe2.producerHandle);
+      core.close(messagePipe1.handle0);
+      core.close(messagePipe2.handle0);
+    }
+    this.cppSide_.testFinished();
+  };
+
+  JsSideConnection.prototype.bitFlip = function (arg) {
+    var iteration = 0;
+    var dataPipe;
+    var messagePipe;
+    var proto = connector.Connector.prototype;
+    var stopSignalled = false;
+
+    proto.realAccept = proto.accept;
+    proto.accept = function (message) {
+      var offset = iteration / 8;
+      var mask;
+      var value;
+      if (offset < message.buffer.arrayBuffer.byteLength) {
+        mask = 1 << (iteration % 8);
+        value = message.buffer.getUint8(offset) ^ mask;
+        message.buffer.setUint8(offset, value);
+        return this.realAccept(message);
+      }
+      stopSignalled = true;
+      return false;
+    };
+
+    while (!stopSignalled) {
+      dataPipe = core.createDataPipe(DATA_PIPE_PARAMS);
+      messagePipe = core.createMessagePipe();
+      writeDataPipe(dataPipe, sampleData);
+      writeMessagePipe(messagePipe, sampleMessage);
+      arg.data_handle = dataPipe.consumerHandle;
+      arg.message_handle = messagePipe.handle1;
+
+      this.cppSide_.bitFlipResponse(createEchoArgsList(arg));
+
+      core.close(dataPipe.producerHandle);
+      core.close(messagePipe.handle0);
+      iteration += 1;
+    }
+
+    proto.accept = proto.realAccept;
+    proto.realAccept = null;
+    this.cppSide_.testFinished();
+  };
+
+  JsSideConnection.prototype.backPointer = function (arg) {
+    var iteration = 0;
+    var dataPipe;
+    var messagePipe;
+    var proto = connector.Connector.prototype;
+    var stopSignalled = false;
+
+    proto.realAccept = proto.accept;
+    proto.accept = function (message) {
+      var delta = 8 * (1 + iteration % 32);
+      var offset = 8 * ((iteration / 32) | 0);
+      if (offset < message.buffer.arrayBuffer.byteLength - 4) {
+        message.buffer.dataView.setUint32(offset, 0x100000000 - delta, true);
+        message.buffer.dataView.setUint32(offset + 4, 0xffffffff, true);
+        return this.realAccept(message);
+      }
+      stopSignalled = true;
+      return false;
+    };
+
+    while (!stopSignalled) {
+      dataPipe = core.createDataPipe(DATA_PIPE_PARAMS);
+      messagePipe = core.createMessagePipe();
+      writeDataPipe(dataPipe, sampleData);
+      writeMessagePipe(messagePipe, sampleMessage);
+      arg.data_handle = dataPipe.consumerHandle;
+      arg.message_handle = messagePipe.handle1;
+
+      this.cppSide_.backPointerResponse(createEchoArgsList(arg));
+
+      core.close(dataPipe.producerHandle);
+      core.close(messagePipe.handle0);
+      iteration += 1;
+    }
+
+    proto.accept = proto.realAccept;
+    proto.realAccept = null;
+    this.cppSide_.testFinished();
+  };
+
+  function writeDataPipe(pipe, data) {
+    var writeResult = core.writeData(
+      pipe.producerHandle, data, core.WRITE_DATA_FLAG_ALL_OR_NONE);
+
+    if (writeResult.result != core.RESULT_OK) {
+      console.log('ERROR: Data pipe write result was ' + writeResult.result);
+      return false;
+    }
+    if (writeResult.numBytes != data.length) {
+      console.log('ERROR: Data pipe write length was ' + writeResult.numBytes);
+      return false;
+    }
+    return true;
+  }
+
+  function writeMessagePipe(pipe, arrayBuffer) {
+    var result = core.writeMessage(pipe.handle0, arrayBuffer, [], 0);
+    if (result != core.RESULT_OK) {
+      console.log('ERROR: Message pipe write result was ' + result);
+      return false;
+    }
+    return true;
+  }
+
+  function createEchoArgsListElement(item, next) {
+    var list = new jsToCpp.EchoArgsList();
+    list.item = item;
+    list.next = next;
+    return list;
+  }
+
+  function createEchoArgsList() {
+    var genuineArray = Array.prototype.slice.call(arguments);
+    return genuineArray.reduceRight(function (previous, current) {
+      return createEchoArgsListElement(current, previous);
+    }, null);
+  }
+
+  return function(jsSideRequestHandle) {
+    var i;
+    sampleData = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes);
+    for (i = 0; i < sampleData.length; ++i) {
+      sampleData[i] = i;
+    }
+    sampleMessage = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes);
+    for (i = 0; i < sampleMessage.length; ++i) {
+      sampleMessage[i] = 255 - i;
+    }
+    retainedJsSideStub =
+        connection.bindHandleToStub(jsSideRequestHandle, jsToCpp.JsSide);
+    retainedJsSide = new JsSideConnection;
+    bindings.StubBindings(retainedJsSideStub).delegate = retainedJsSide;
+  };
+});
diff --git a/mojo/edk/js/tests/sample_service_tests.js b/mojo/edk/js/tests/sample_service_tests.js
new file mode 100644
index 0000000..ac8ce2e
--- /dev/null
+++ b/mojo/edk/js/tests/sample_service_tests.js
@@ -0,0 +1,171 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+define([
+    "console",
+    "mojo/edk/js/test/hexdump",
+    "gin/test/expect",
+    "mojo/public/interfaces/bindings/tests/sample_service.mojom",
+    "mojo/public/interfaces/bindings/tests/sample_import.mojom",
+    "mojo/public/interfaces/bindings/tests/sample_import2.mojom",
+    "mojo/public/js/core",
+  ], function(console, hexdump, expect, sample, imported, imported2, core) {
+
+  var global = this;
+
+  // Set this variable to true to print the binary message in hex.
+  var dumpMessageAsHex = false;
+
+  function makeFoo() {
+    var bar = new sample.Bar();
+    bar.alpha = 20;
+    bar.beta = 40;
+    bar.gamma = 60;
+    bar.type = sample.Bar.Type.VERTICAL;
+
+    var extra_bars = new Array(3);
+    for (var i = 0; i < extra_bars.length; ++i) {
+      var base = i * 100;
+      var type = i % 2 ?
+          sample.Bar.Type.VERTICAL : sample.Bar.Type.HORIZONTAL;
+      extra_bars[i] = new sample.Bar();
+      extra_bars[i].alpha = base;
+      extra_bars[i].beta = base + 20;
+      extra_bars[i].gamma = base + 40;
+      extra_bars[i].type = type;
+    }
+
+    var data = new Array(10);
+    for (var i = 0; i < data.length; ++i) {
+      data[i] = data.length - i;
+    }
+
+    var source = 0xFFFF;  // Invent a dummy handle.
+
+    var foo = new sample.Foo();
+    foo.name = "foopy";
+    foo.x = 1;
+    foo.y = 2;
+    foo.a = false;
+    foo.b = true;
+    foo.c = false;
+    foo.bar = bar;
+    foo.extra_bars = extra_bars;
+    foo.data = data;
+    foo.source = source;
+    return foo;
+  }
+
+  // Check that the given |Foo| is identical to the one made by |MakeFoo()|.
+  function checkFoo(foo) {
+    expect(foo.name).toBe("foopy");
+    expect(foo.x).toBe(1);
+    expect(foo.y).toBe(2);
+    expect(foo.a).toBeFalsy();
+    expect(foo.b).toBeTruthy();
+    expect(foo.c).toBeFalsy();
+    expect(foo.bar.alpha).toBe(20);
+    expect(foo.bar.beta).toBe(40);
+    expect(foo.bar.gamma).toBe(60);
+    expect(foo.bar.type).toBe(sample.Bar.Type.VERTICAL);
+
+    expect(foo.extra_bars.length).toBe(3);
+    for (var i = 0; i < foo.extra_bars.length; ++i) {
+      var base = i * 100;
+      var type = i % 2 ?
+          sample.Bar.Type.VERTICAL : sample.Bar.Type.HORIZONTAL;
+      expect(foo.extra_bars[i].alpha).toBe(base);
+      expect(foo.extra_bars[i].beta).toBe(base + 20);
+      expect(foo.extra_bars[i].gamma).toBe(base + 40);
+      expect(foo.extra_bars[i].type).toBe(type);
+    }
+
+    expect(foo.data.length).toBe(10);
+    for (var i = 0; i < foo.data.length; ++i)
+      expect(foo.data[i]).toBe(foo.data.length - i);
+
+    expect(foo.source).toBe(0xFFFF);
+  }
+
+  // Check that values are set to the defaults if we don't override them.
+  function checkDefaultValues() {
+    var bar = new sample.Bar();
+    expect(bar.alpha).toBe(255);
+    expect(bar.type).toBe(sample.Bar.Type.VERTICAL);
+
+    var foo = new sample.Foo();
+    expect(foo.name).toBe("Fooby");
+    expect(foo.a).toBeTruthy();
+    expect(foo.data).toBeNull();
+
+    var defaults = new sample.DefaultsTest();
+    expect(defaults.a0).toBe(-12);
+    expect(defaults.a1).toBe(sample.kTwelve);
+    expect(defaults.a2).toBe(1234);
+    expect(defaults.a3).toBe(34567);
+    expect(defaults.a4).toBe(123456);
+    expect(defaults.a5).toBe(3456789012);
+    expect(defaults.a6).toBe(-111111111111);
+    // JS doesn't have a 64 bit integer type so this is just checking that the
+    // expected and actual values have the same closest double value.
+    expect(defaults.a7).toBe(9999999999999999999);
+    expect(defaults.a8).toBe(0x12345);
+    expect(defaults.a9).toBe(-0x12345);
+    expect(defaults.a10).toBe(1234);
+    expect(defaults.a11).toBe(true);
+    expect(defaults.a12).toBe(false);
+    expect(defaults.a13).toBe(123.25);
+    expect(defaults.a14).toBe(1234567890.123);
+    expect(defaults.a15).toBe(1E10);
+    expect(defaults.a16).toBe(-1.2E+20);
+    expect(defaults.a17).toBe(1.23E-20);
+    expect(defaults.a20).toBe(sample.Bar.Type.BOTH);
+    expect(defaults.a21).toBeNull();
+    expect(defaults.a22).toBeTruthy();
+    expect(defaults.a22.shape).toBe(imported.Shape.RECTANGLE);
+    expect(defaults.a22.color).toBe(imported2.Color.BLACK);
+    expect(defaults.a21).toBeNull();
+    expect(defaults.a23).toBe(0xFFFFFFFFFFFFFFFF);
+    expect(defaults.a24).toBe(0x123456789);
+    expect(defaults.a25).toBe(-0x123456789);
+  }
+
+  function ServiceImpl() {
+  }
+
+  ServiceImpl.prototype = Object.create(sample.Service.stubClass.prototype);
+
+  ServiceImpl.prototype.frobinate = function(foo, baz, port) {
+    checkFoo(foo);
+    expect(baz).toBe(sample.Service.BazOptions.EXTRA);
+    expect(core.isHandle(port)).toBeTruthy();
+    global.result = "PASS";
+  };
+
+  function SimpleMessageReceiver() {
+  }
+
+  SimpleMessageReceiver.prototype.acceptAndExpectResponse = function(message) {
+    if (dumpMessageAsHex) {
+      var uint8Array = new Uint8Array(message.buffer.arrayBuffer);
+      console.log(hexdump.dumpArray(uint8Array));
+    }
+    // Imagine some IPC happened here.
+    var serviceImpl = new ServiceImpl();
+    return serviceImpl.acceptWithResponder(message, { accept: function() {} });
+  };
+
+  var serviceProxy = new sample.Service.proxyClass;
+  serviceProxy.receiver_ = new SimpleMessageReceiver;
+
+  checkDefaultValues();
+
+  var foo = makeFoo();
+  checkFoo(foo);
+
+  var pipe = core.createMessagePipe();
+  serviceProxy.frobinate(foo, sample.Service.BazOptions.EXTRA, pipe.handle0);
+  expect(core.close(pipe.handle0)).toBe(core.RESULT_OK);
+  expect(core.close(pipe.handle1)).toBe(core.RESULT_OK);
+});
diff --git a/mojo/edk/js/threading.cc b/mojo/edk/js/threading.cc
new file mode 100644
index 0000000..1e6c9a65
--- /dev/null
+++ b/mojo/edk/js/threading.cc
@@ -0,0 +1,47 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/js/threading.h"
+
+#include "base/message_loop/message_loop.h"
+#include "gin/object_template_builder.h"
+#include "gin/per_isolate_data.h"
+#include "mojo/edk/js/handle.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+void Quit() {
+  base::MessageLoop::current()->QuitNow();
+}
+
+gin::WrapperInfo g_wrapper_info = { gin::kEmbedderNativeGin };
+
+}  // namespace
+
+const char Threading::kModuleName[] = "mojo/public/js/threading";
+
+v8::Local<v8::Value> Threading::GetModule(v8::Isolate* isolate) {
+  gin::PerIsolateData* data = gin::PerIsolateData::From(isolate);
+  v8::Local<v8::ObjectTemplate> templ = data->GetObjectTemplate(
+      &g_wrapper_info);
+
+  if (templ.IsEmpty()) {
+    templ = gin::ObjectTemplateBuilder(isolate)
+        .SetMethod("quit", Quit)
+        .Build();
+
+    data->SetObjectTemplate(&g_wrapper_info, templ);
+  }
+
+  return templ->NewInstance();
+}
+
+Threading::Threading() {
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/threading.h b/mojo/edk/js/threading.h
new file mode 100644
index 0000000..1a1803d
--- /dev/null
+++ b/mojo/edk/js/threading.h
@@ -0,0 +1,25 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_JS_THREADING_H_
+#define MOJO_EDK_JS_THREADING_H_
+
+#include "gin/public/wrapper_info.h"
+#include "v8/include/v8.h"
+
+namespace mojo {
+namespace edk {
+
+class Threading {
+ public:
+  static const char kModuleName[];
+  static v8::Local<v8::Value> GetModule(v8::Isolate* isolate);
+ private:
+  Threading();
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_JS_THREADING_H_
diff --git a/mojo/edk/js/waiting_callback.cc b/mojo/edk/js/waiting_callback.cc
new file mode 100644
index 0000000..0bc875dd
--- /dev/null
+++ b/mojo/edk/js/waiting_callback.cc
@@ -0,0 +1,115 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/js/waiting_callback.h"
+
+#include "base/bind.h"
+#include "base/message_loop/message_loop.h"
+#include "gin/per_context_data.h"
+#include "mojo/public/cpp/environment/environment.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+v8::Handle<v8::String> GetHiddenPropertyName(v8::Isolate* isolate) {
+  return gin::StringToSymbol(isolate, "::mojo::js::WaitingCallback");
+}
+
+}  // namespace
+
+gin::WrapperInfo WaitingCallback::kWrapperInfo = { gin::kEmbedderNativeGin };
+
+// static
+gin::Handle<WaitingCallback> WaitingCallback::Create(
+    v8::Isolate* isolate,
+    v8::Handle<v8::Function> callback,
+    gin::Handle<HandleWrapper> handle_wrapper,
+    MojoHandleSignals signals) {
+  gin::Handle<WaitingCallback> waiting_callback = gin::CreateHandle(
+      isolate, new WaitingCallback(isolate, callback, handle_wrapper));
+  waiting_callback->wait_id_ = Environment::GetDefaultAsyncWaiter()->AsyncWait(
+      handle_wrapper->get().value(),
+      signals,
+      MOJO_DEADLINE_INDEFINITE,
+      &WaitingCallback::CallOnHandleReady,
+      waiting_callback.get());
+  return waiting_callback;
+}
+
+void WaitingCallback::Cancel() {
+  if (!wait_id_)
+    return;
+
+  handle_wrapper_->RemoveCloseObserver(this);
+  handle_wrapper_ = NULL;
+  Environment::GetDefaultAsyncWaiter()->CancelWait(wait_id_);
+  wait_id_ = 0;
+}
+
+WaitingCallback::WaitingCallback(v8::Isolate* isolate,
+                                 v8::Handle<v8::Function> callback,
+                                 gin::Handle<HandleWrapper> handle_wrapper)
+    : wait_id_(0), handle_wrapper_(handle_wrapper.get()), weak_factory_(this) {
+  handle_wrapper_->AddCloseObserver(this);
+  v8::Handle<v8::Context> context = isolate->GetCurrentContext();
+  runner_ = gin::PerContextData::From(context)->runner()->GetWeakPtr();
+  GetWrapper(isolate)->SetHiddenValue(GetHiddenPropertyName(isolate), callback);
+}
+
+WaitingCallback::~WaitingCallback() {
+  Cancel();
+}
+
+// static
+void WaitingCallback::CallOnHandleReady(void* closure, MojoResult result) {
+  static_cast<WaitingCallback*>(closure)->OnHandleReady(result);
+}
+
+void WaitingCallback::ClearWaitId() {
+  wait_id_ = 0;
+  handle_wrapper_->RemoveCloseObserver(this);
+  handle_wrapper_ = nullptr;
+}
+
+void WaitingCallback::OnHandleReady(MojoResult result) {
+  ClearWaitId();
+  CallCallback(result);
+}
+
+void WaitingCallback::CallCallback(MojoResult result) {
+  // ClearWaitId must already have been called.
+  DCHECK(!wait_id_);
+  DCHECK(!handle_wrapper_);
+
+  if (!runner_)
+    return;
+
+  gin::Runner::Scope scope(runner_.get());
+  v8::Isolate* isolate = runner_->GetContextHolder()->isolate();
+
+  v8::Handle<v8::Value> hidden_value =
+      GetWrapper(isolate)->GetHiddenValue(GetHiddenPropertyName(isolate));
+  v8::Handle<v8::Function> callback;
+  CHECK(gin::ConvertFromV8(isolate, hidden_value, &callback));
+
+  v8::Handle<v8::Value> args[] = { gin::ConvertToV8(isolate, result) };
+  runner_->Call(callback, runner_->global(), 1, args);
+}
+
+void WaitingCallback::OnWillCloseHandle() {
+  Environment::GetDefaultAsyncWaiter()->CancelWait(wait_id_);
+
+  // This may be called from GC, so we can't execute Javascript now, call
+  // ClearWaitId explicitly, and CallCallback asynchronously.
+  ClearWaitId();
+  base::MessageLoop::current()->PostTask(
+      FROM_HERE,
+      base::Bind(&WaitingCallback::CallCallback, weak_factory_.GetWeakPtr(),
+                 MOJO_RESULT_INVALID_ARGUMENT));
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/js/waiting_callback.h b/mojo/edk/js/waiting_callback.h
new file mode 100644
index 0000000..c1b76aa
--- /dev/null
+++ b/mojo/edk/js/waiting_callback.h
@@ -0,0 +1,68 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_JS_WAITING_CALLBACK_H_
+#define MOJO_EDK_JS_WAITING_CALLBACK_H_
+
+#include "base/memory/weak_ptr.h"
+#include "gin/handle.h"
+#include "gin/runner.h"
+#include "gin/wrappable.h"
+#include "mojo/edk/js/handle.h"
+#include "mojo/edk/js/handle_close_observer.h"
+#include "mojo/public/c/environment/async_waiter.h"
+#include "mojo/public/cpp/system/core.h"
+
+namespace mojo {
+namespace edk {
+
+class WaitingCallback : public gin::Wrappable<WaitingCallback>,
+                        public HandleCloseObserver {
+ public:
+  static gin::WrapperInfo kWrapperInfo;
+
+  // Creates a new WaitingCallback.
+  static gin::Handle<WaitingCallback> Create(
+      v8::Isolate* isolate,
+      v8::Handle<v8::Function> callback,
+      gin::Handle<HandleWrapper> handle_wrapper,
+      MojoHandleSignals signals);
+
+  // Cancels the callback. Does nothing if a callback is not pending. This is
+  // implicitly invoked from the destructor but can be explicitly invoked as
+  // necessary.
+  void Cancel();
+
+ private:
+  WaitingCallback(v8::Isolate* isolate,
+                  v8::Handle<v8::Function> callback,
+                  gin::Handle<HandleWrapper> handle_wrapper);
+  ~WaitingCallback() override;
+
+  // Callback from MojoAsyncWaiter. |closure| is the WaitingCallback.
+  static void CallOnHandleReady(void* closure, MojoResult result);
+
+  // Invoked from CallOnHandleReady() (CallOnHandleReady() must be static).
+  void OnHandleReady(MojoResult result);
+
+  // Invoked by the HandleWrapper if the handle is closed while this wait is
+  // still in progress.
+  void OnWillCloseHandle() override;
+
+  void ClearWaitId();
+  void CallCallback(MojoResult result);
+
+  base::WeakPtr<gin::Runner> runner_;
+  MojoAsyncWaitID wait_id_;
+
+  HandleWrapper* handle_wrapper_;
+  base::WeakPtrFactory<WaitingCallback> weak_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(WaitingCallback);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_JS_WAITING_CALLBACK_H_
diff --git a/mojo/edk/mojo_edk.gni b/mojo/edk/mojo_edk.gni
new file mode 100644
index 0000000..efb2a5f
--- /dev/null
+++ b/mojo/edk/mojo_edk.gni
@@ -0,0 +1,69 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../../third_party/mojo/src/mojo/public/mojo_sdk.gni")
+
+# A mojo_edk_source_set is a mojo_sdk_source_set that does not restrict
+# external dependencies and understands the following additional variables, all
+# of which admit a list of the relevant elements specified relative to the
+# location of the Mojo EDK:
+# allow_circular_mojo_edk_includes_from
+template("mojo_edk_source_set") {
+  mojo_sdk_source_set(target_name) {
+    if (defined(invoker.public_deps) || defined(invoker.deps)) {
+      restrict_external_deps = false
+    }
+
+    if (defined(invoker.visibility)) {
+      visibility = invoker.visibility
+    }
+    if (defined(invoker.testonly)) {
+      testonly = invoker.testonly
+    }
+    if (defined(invoker.sources)) {
+      sources = invoker.sources
+    }
+    if (defined(invoker.defines)) {
+      defines = invoker.defines
+    }
+    if (defined(invoker.public_configs)) {
+      public_configs = invoker.public_configs
+    }
+
+    configs = []
+    if (defined(invoker.configs)) {
+      configs = invoker.configs
+    }
+
+    allow_circular_includes_from = []
+    if (defined(invoker.allow_circular_includes_from)) {
+      allow_circular_includes_from += invoker.allow_circular_includes_from
+    }
+    if (defined(invoker.allow_circular_mojo_edk_includes_from)) {
+      foreach(edk_target, invoker.allow_circular_mojo_edk_includes_from) {
+        # Check that the EDK target was not mistakenly given as an absolute
+        # path.
+        assert(get_path_info(edk_target, "abspath") != edk_target)
+        allow_circular_includes_from +=
+            [ rebase_path(edk_target, ".", mojo_root) ]
+      }
+    }
+
+    if (defined(invoker.public_deps)) {
+      public_deps = invoker.public_deps
+    }
+    mojo_sdk_public_deps = []
+    if (defined(invoker.mojo_sdk_public_deps)) {
+      mojo_sdk_public_deps += invoker.mojo_sdk_public_deps
+    }
+
+    if (defined(invoker.deps)) {
+      deps = invoker.deps
+    }
+    mojo_sdk_deps = []
+    if (defined(invoker.mojo_sdk_deps)) {
+      mojo_sdk_deps += invoker.mojo_sdk_deps
+    }
+  }
+}
diff --git a/mojo/edk/system/BUILD.gn b/mojo/edk/system/BUILD.gn
new file mode 100644
index 0000000..b81601b
--- /dev/null
+++ b/mojo/edk/system/BUILD.gn
@@ -0,0 +1,208 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../mojo_edk.gni")
+import("//testing/test.gni")
+import("../../../third_party/mojo/src/mojo/public/tools/bindings/mojom.gni")
+
+if (is_android) {
+  import("//build/config/android/config.gni")
+  import("//build/config/android/rules.gni")
+}
+
+config("system_config") {
+  defines = [
+    # Ensures that dependent projects import the core functions on Windows.
+    "MOJO_USE_SYSTEM_IMPL",
+  ]
+}
+
+mojom("master") {
+  sources = [
+    "master.mojom",
+  ]
+}
+
+static_library("system") {
+# TODO(use_chrome_edk): this should be a component to match third_party,
+# but since third_party includes it, we either make it a static library
+# or we have to change the export macros to be different than third_party.
+#component("system") {
+  # TODO(use_chrome_edk): remove "2"
+  output_name = "mojo_system_impl2"
+
+  sources = [
+    "async_waiter.cc",
+    "async_waiter.h",
+    "awakable.h",
+    "awakable_list.cc",
+    "awakable_list.h",
+    "configuration.cc",
+    "configuration.h",
+    "core.cc",
+    "core.h",
+    "data_pipe.cc",
+    "data_pipe.h",
+    "data_pipe_consumer_dispatcher.cc",
+    "data_pipe_consumer_dispatcher.h",
+    "data_pipe_producer_dispatcher.cc",
+    "data_pipe_producer_dispatcher.h",
+    "dispatcher.cc",
+    "dispatcher.h",
+    "handle_signals_state.h",
+    "handle_table.cc",
+    "handle_table.h",
+    "mapping_table.cc",
+    "mapping_table.h",
+    #"master_impl.cc",
+    #"master_impl.h",
+    "message_in_transit.cc",
+    "message_in_transit.h",
+    "message_in_transit_queue.cc",
+    "message_in_transit_queue.h",
+    "message_pipe_dispatcher.cc",
+    "message_pipe_dispatcher.h",
+    "options_validation.h",
+    "platform_handle_dispatcher.cc",
+    "platform_handle_dispatcher.h",
+    "raw_channel.cc",
+    "raw_channel.h",
+    "raw_channel_posix.cc",
+    "raw_channel_win.cc",
+    "shared_buffer_dispatcher.cc",
+    "shared_buffer_dispatcher.h",
+    "simple_dispatcher.cc",
+    "simple_dispatcher.h",
+    "transport_data.cc",
+    "transport_data.h",
+    "waiter.cc",
+    "waiter.h",
+  ]
+
+  defines = [
+    "MOJO_SYSTEM_IMPL_IMPLEMENTATION",
+    "MOJO_SYSTEM_IMPLEMENTATION",
+  ]
+
+  all_dependent_configs = [ ":system_config" ]
+
+  public_deps = [
+    "../embedder",
+    "../embedder:delegates",
+    "../embedder:platform",
+    "../../../third_party/mojo/src/mojo/public/c/system",
+    "../../../third_party/mojo/src/mojo/public/cpp/system",
+  ]
+
+  deps = [
+    "//base",
+    "//base/third_party/dynamic_annotations",
+    #":master",
+  ]
+
+  if (is_win) {
+    cflags = [ "/wd4324" ]  # Structure was padded due to __declspec(align()),
+                            # which is uninteresting.
+  }
+
+  allow_circular_includes_from = [ "../embedder" ]
+}
+
+group("tests") {
+  testonly = true
+  deps = [
+    # TODO(use_chrome_edk): remove "2"
+    ":mojo_system_unittests2",
+    ":mojo_message_pipe_perftests2",
+  ]
+}
+
+mojo_edk_source_set("test_utils") {
+  testonly = true
+
+  sources = [
+    "test_utils.cc",
+    "test_utils.h",
+  ]
+
+  public_deps = [
+    "//third_party/mojo/src/mojo/public/c/system",
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+
+  deps = [
+    "//base",
+    "//base/test:test_support",
+    "//mojo/edk/test:test_support",
+    "//testing/gtest:gtest",
+  ]
+}
+
+# TODO(use_chrome_edk): remove "2"
+test("mojo_system_unittests2") {
+  sources = [
+    "../test/multiprocess_test_helper_unittest.cc",
+    "awakable_list_unittest.cc",
+    "core_test_base.cc",
+    "core_test_base.h",
+    "core_unittest.cc",
+    "data_pipe_unittest.cc",
+    "dispatcher_unittest.cc",
+    #"master_impl_unittest.cc",
+
+    "message_in_transit_queue_unittest.cc",
+    "message_in_transit_test_utils.cc",
+    "message_in_transit_test_utils.h",
+    "message_pipe_test_utils.cc",
+    "message_pipe_test_utils.h",
+    "message_pipe_unittest.cc",
+    "multiprocess_message_pipe_unittest.cc",
+    "options_validation_unittest.cc",
+    "platform_handle_dispatcher_unittest.cc",
+
+    "raw_channel_unittest.cc",
+    "run_all_unittests.cc",
+    "shared_buffer_dispatcher_unittest.cc",
+    "simple_dispatcher_unittest.cc",
+    "waiter_test_utils.cc",
+    "waiter_test_utils.h",
+    "waiter_unittest.cc",
+  ]
+
+  deps = [
+    ":system",
+    ":test_utils",
+
+    # TODO(use_chrome_edk): remove "2"
+    "../embedder:embedder_unittests2",
+    "../../../third_party/mojo/src/mojo/public/cpp/environment:standalone",
+    "../test:test_support",
+    "//base",
+    "//base/test:test_support",
+    "//testing/gtest",
+  ]
+
+  # TODO(use_chrome_edk): remove "2"
+  allow_circular_includes_from = [ "../embedder:embedder_unittests2" ]
+}
+
+# TODO(use_chrome_edk): remove "2"
+test("mojo_message_pipe_perftests2") {
+  sources = [
+    "message_pipe_perftest.cc",
+    "message_pipe_test_utils.cc",
+    "message_pipe_test_utils.h",
+  ]
+
+  deps = [
+    ":system",
+    ":test_utils",
+    "../test:test_support",
+    "../test:run_all_perftests",
+    "../../../third_party/mojo/src/mojo/public/cpp/environment:standalone",
+    "//base",
+    "//base/test:test_support",
+    "//testing/gtest",
+  ]
+}
diff --git a/mojo/edk/system/async_waiter.cc b/mojo/edk/system/async_waiter.cc
new file mode 100644
index 0000000..d2e7000
--- /dev/null
+++ b/mojo/edk/system/async_waiter.cc
@@ -0,0 +1,23 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/async_waiter.h"
+
+namespace mojo {
+namespace edk {
+
+AsyncWaiter::AsyncWaiter(const AwakeCallback& callback) : callback_(callback) {
+}
+
+AsyncWaiter::~AsyncWaiter() {
+}
+
+bool AsyncWaiter::Awake(MojoResult result, uintptr_t context) {
+  callback_.Run(result);
+  delete this;
+  return false;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/async_waiter.h b/mojo/edk/system/async_waiter.h
new file mode 100644
index 0000000..19ef5d6
--- /dev/null
+++ b/mojo/edk/system/async_waiter.h
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_ASYNC_WAITER_H_
+#define MOJO_EDK_SYSTEM_ASYNC_WAITER_H_
+
+#include "base/callback.h"
+#include "mojo/edk/system/awakable.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// An |Awakable| implementation that just calls a given callback object.
+class MOJO_SYSTEM_IMPL_EXPORT AsyncWaiter final : public Awakable {
+ public:
+  using AwakeCallback = base::Callback<void(MojoResult)>;
+
+  // |callback| must satisfy the same contract as |Awakable::Awake()|.
+  explicit AsyncWaiter(const AwakeCallback& callback);
+  virtual ~AsyncWaiter();
+
+ private:
+  // |Awakable| implementation:
+  bool Awake(MojoResult result, uintptr_t context) override;
+
+  AwakeCallback callback_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(AsyncWaiter);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_ASYNC_WAITER_H_
diff --git a/mojo/edk/system/awakable.h b/mojo/edk/system/awakable.h
new file mode 100644
index 0000000..2cb10f5
--- /dev/null
+++ b/mojo/edk/system/awakable.h
@@ -0,0 +1,34 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_AWAKABLE_H_
+#define MOJO_EDK_SYSTEM_AWAKABLE_H_
+
+#include <stdint.h>
+
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+
+namespace mojo {
+namespace edk {
+
+// An interface that may be waited on |AwakableList|.
+class MOJO_SYSTEM_IMPL_EXPORT Awakable {
+ public:
+  // |Awake()| must satisfy the following contract:
+  // * As this is called from any thread, this must be thread-safe.
+  // * As this is called inside a lock, this must not call anything that takes
+  //   "non-terminal" locks, i.e., those which are always safe to take.
+  // This should return false if this must not be called again for the same
+  // reason (e.g., for the same call to |AwakableList::Add()|).
+  virtual bool Awake(MojoResult result, uintptr_t context) = 0;
+
+ protected:
+  Awakable() {}
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_AWAKABLE_H_
diff --git a/mojo/edk/system/awakable_list.cc b/mojo/edk/system/awakable_list.cc
new file mode 100644
index 0000000..84f7e45
--- /dev/null
+++ b/mojo/edk/system/awakable_list.cc
@@ -0,0 +1,74 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/awakable_list.h"
+
+#include <algorithm>
+
+#include "base/logging.h"
+#include "mojo/edk/system/awakable.h"
+#include "mojo/edk/system/handle_signals_state.h"
+
+namespace mojo {
+namespace edk {
+
+AwakableList::AwakableList() {
+}
+
+AwakableList::~AwakableList() {
+  DCHECK(awakables_.empty());
+}
+
+void AwakableList::AwakeForStateChange(const HandleSignalsState& state) {
+  // Instead of deleting elements in-place, swap them with the last element and
+  // erase the elements from the end.
+  auto last = awakables_.end();
+  for (AwakeInfoList::iterator it = awakables_.begin(); it != last;) {
+    bool keep = true;
+    if (state.satisfies(it->signals))
+      keep = it->awakable->Awake(MOJO_RESULT_OK, it->context);
+    else if (!state.can_satisfy(it->signals))
+      keep = it->awakable->Awake(MOJO_RESULT_FAILED_PRECONDITION, it->context);
+
+    if (!keep) {
+      --last;
+      std::swap(*it, *last);
+    } else {
+      ++it;
+    }
+  }
+  awakables_.erase(last, awakables_.end());
+}
+
+void AwakableList::CancelAll() {
+  for (AwakeInfoList::iterator it = awakables_.begin(); it != awakables_.end();
+       ++it) {
+    it->awakable->Awake(MOJO_RESULT_CANCELLED, it->context);
+  }
+  awakables_.clear();
+}
+
+void AwakableList::Add(Awakable* awakable,
+                       MojoHandleSignals signals,
+                       uint32_t context) {
+  awakables_.push_back(AwakeInfo(awakable, signals, context));
+}
+
+void AwakableList::Remove(Awakable* awakable) {
+  // We allow a thread to wait on the same handle multiple times simultaneously,
+  // so we need to scan the entire list and remove all occurrences of |waiter|.
+  auto last = awakables_.end();
+  for (AwakeInfoList::iterator it = awakables_.begin(); it != last;) {
+    if (it->awakable == awakable) {
+      --last;
+      std::swap(*it, *last);
+    } else {
+      ++it;
+    }
+  }
+  awakables_.erase(last, awakables_.end());
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/awakable_list.h b/mojo/edk/system/awakable_list.h
new file mode 100644
index 0000000..7f8a6d6
--- /dev/null
+++ b/mojo/edk/system/awakable_list.h
@@ -0,0 +1,58 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_
+#define MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+class Awakable;
+struct HandleSignalsState;
+
+// |AwakableList| tracks all the |Waiter|s that are waiting on a given
+// handle/|Dispatcher|. There should be a |AwakableList| for each handle that
+// can be waited on (in any way). In the simple case, the |AwakableList| is
+// owned by the |Dispatcher|, whereas in more complex cases it is owned by the
+// secondary object (see simple_dispatcher.* and the explanatory comment in
+// core.cc). This class is thread-unsafe (all concurrent access must be
+// protected by some lock).
+class MOJO_SYSTEM_IMPL_EXPORT AwakableList {
+ public:
+  AwakableList();
+  ~AwakableList();
+
+  void AwakeForStateChange(const HandleSignalsState& state);
+  void CancelAll();
+  void Add(Awakable* awakable, MojoHandleSignals signals, uint32_t context);
+  void Remove(Awakable* awakable);
+
+ private:
+  struct AwakeInfo {
+    AwakeInfo(Awakable* awakable, MojoHandleSignals signals, uint32_t context)
+        : awakable(awakable), signals(signals), context(context) {}
+
+    Awakable* awakable;
+    MojoHandleSignals signals;
+    uint32_t context;
+  };
+  using AwakeInfoList = std::vector<AwakeInfo>;
+
+  AwakeInfoList awakables_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(AwakableList);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_AWAKABLE_LIST_H_
diff --git a/mojo/edk/system/awakable_list_unittest.cc b/mojo/edk/system/awakable_list_unittest.cc
new file mode 100644
index 0000000..5b5ba8f
--- /dev/null
+++ b/mojo/edk/system/awakable_list_unittest.cc
@@ -0,0 +1,356 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a
+// heavily-loaded system). Sorry. |test::EpsilonDeadline()| may be increased to
+// increase tolerance and reduce observed flakiness (though doing so reduces the
+// meaningfulness of the test).
+
+#include "mojo/edk/system/awakable_list.h"
+
+#include "mojo/edk/system/handle_signals_state.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/system/waiter.h"
+#include "mojo/edk/system/waiter_test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+TEST(AwakableListTest, BasicCancel) {
+  MojoResult result;
+  uint32_t context;
+
+  // Cancel immediately after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 1);
+    thread.Start();
+    awakable_list.CancelAll();
+    // Double-remove okay:
+    awakable_list.Remove(thread.waiter());
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result);
+  EXPECT_EQ(1u, context);
+
+  // Cancel before after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_WRITABLE, 2);
+    awakable_list.CancelAll();
+    thread.Start();
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result);
+  EXPECT_EQ(2u, context);
+
+  // Cancel some time after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 3);
+    thread.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    awakable_list.CancelAll();
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result);
+  EXPECT_EQ(3u, context);
+}
+
+TEST(AwakableListTest, BasicAwakeSatisfied) {
+  MojoResult result;
+  uint32_t context;
+
+  // Awake immediately after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 1);
+    thread.Start();
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_READABLE,
+        MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE));
+    awakable_list.Remove(thread.waiter());
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_OK, result);
+  EXPECT_EQ(1u, context);
+
+  // Awake before after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_WRITABLE, 2);
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_WRITABLE,
+        MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE));
+    awakable_list.Remove(thread.waiter());
+    // Double-remove okay:
+    awakable_list.Remove(thread.waiter());
+    thread.Start();
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_OK, result);
+  EXPECT_EQ(2u, context);
+
+  // Awake some time after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 3);
+    thread.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_READABLE,
+        MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE));
+    awakable_list.Remove(thread.waiter());
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_OK, result);
+  EXPECT_EQ(3u, context);
+}
+
+TEST(AwakableListTest, BasicAwakeUnsatisfiable) {
+  MojoResult result;
+  uint32_t context;
+
+  // Awake (for unsatisfiability) immediately after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 1);
+    thread.Start();
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_NONE, MOJO_HANDLE_SIGNAL_WRITABLE));
+    awakable_list.Remove(thread.waiter());
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
+  EXPECT_EQ(1u, context);
+
+  // Awake (for unsatisfiability) before after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_WRITABLE, 2);
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_READABLE, MOJO_HANDLE_SIGNAL_READABLE));
+    awakable_list.Remove(thread.waiter());
+    thread.Start();
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
+  EXPECT_EQ(2u, context);
+
+  // Awake (for unsatisfiability) some time after thread start.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread(&result, &context);
+    awakable_list.Add(thread.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 3);
+    thread.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_NONE, MOJO_HANDLE_SIGNAL_WRITABLE));
+    awakable_list.Remove(thread.waiter());
+    // Double-remove okay:
+    awakable_list.Remove(thread.waiter());
+  }  // Join |thread|.
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
+  EXPECT_EQ(3u, context);
+}
+
+TEST(AwakableListTest, MultipleAwakables) {
+  MojoResult result1;
+  MojoResult result2;
+  MojoResult result3;
+  MojoResult result4;
+  uint32_t context1;
+  uint32_t context2;
+  uint32_t context3;
+  uint32_t context4;
+
+  // Cancel two awakables.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread1(&result1, &context1);
+    awakable_list.Add(thread1.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 1);
+    thread1.Start();
+    test::SimpleWaiterThread thread2(&result2, &context2);
+    awakable_list.Add(thread2.waiter(), MOJO_HANDLE_SIGNAL_WRITABLE, 2);
+    thread2.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    awakable_list.CancelAll();
+  }  // Join threads.
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result1);
+  EXPECT_EQ(1u, context1);
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result2);
+  EXPECT_EQ(2u, context2);
+
+  // Awake one awakable, cancel other.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread1(&result1, &context1);
+    awakable_list.Add(thread1.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 3);
+    thread1.Start();
+    test::SimpleWaiterThread thread2(&result2, &context2);
+    awakable_list.Add(thread2.waiter(), MOJO_HANDLE_SIGNAL_WRITABLE, 4);
+    thread2.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_READABLE,
+        MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE));
+    awakable_list.Remove(thread1.waiter());
+    awakable_list.CancelAll();
+  }  // Join threads.
+  EXPECT_EQ(MOJO_RESULT_OK, result1);
+  EXPECT_EQ(3u, context1);
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result2);
+  EXPECT_EQ(4u, context2);
+
+  // Cancel one awakable, awake other for unsatisfiability.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread1(&result1, &context1);
+    awakable_list.Add(thread1.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 5);
+    thread1.Start();
+    test::SimpleWaiterThread thread2(&result2, &context2);
+    awakable_list.Add(thread2.waiter(), MOJO_HANDLE_SIGNAL_WRITABLE, 6);
+    thread2.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_NONE, MOJO_HANDLE_SIGNAL_READABLE));
+    awakable_list.Remove(thread2.waiter());
+    awakable_list.CancelAll();
+  }  // Join threads.
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result1);
+  EXPECT_EQ(5u, context1);
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result2);
+  EXPECT_EQ(6u, context2);
+
+  // Cancel one awakable, awake other for unsatisfiability.
+  {
+    AwakableList awakable_list;
+    test::SimpleWaiterThread thread1(&result1, &context1);
+    awakable_list.Add(thread1.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 7);
+    thread1.Start();
+
+    test::Sleep(1 * test::EpsilonDeadline());
+
+    // Should do nothing.
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_NONE,
+        MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE));
+
+    test::SimpleWaiterThread thread2(&result2, &context2);
+    awakable_list.Add(thread2.waiter(), MOJO_HANDLE_SIGNAL_WRITABLE, 8);
+    thread2.Start();
+
+    test::Sleep(1 * test::EpsilonDeadline());
+
+    // Awake #1.
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_READABLE,
+        MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE));
+    awakable_list.Remove(thread1.waiter());
+
+    test::Sleep(1 * test::EpsilonDeadline());
+
+    test::SimpleWaiterThread thread3(&result3, &context3);
+    awakable_list.Add(thread3.waiter(), MOJO_HANDLE_SIGNAL_WRITABLE, 9);
+    thread3.Start();
+
+    test::SimpleWaiterThread thread4(&result4, &context4);
+    awakable_list.Add(thread4.waiter(), MOJO_HANDLE_SIGNAL_READABLE, 10);
+    thread4.Start();
+
+    test::Sleep(1 * test::EpsilonDeadline());
+
+    // Awake #2 and #3 for unsatisfiability.
+    awakable_list.AwakeForStateChange(HandleSignalsState(
+        MOJO_HANDLE_SIGNAL_NONE, MOJO_HANDLE_SIGNAL_READABLE));
+    awakable_list.Remove(thread2.waiter());
+    awakable_list.Remove(thread3.waiter());
+
+    // Cancel #4.
+    awakable_list.CancelAll();
+  }  // Join threads.
+  EXPECT_EQ(MOJO_RESULT_OK, result1);
+  EXPECT_EQ(7u, context1);
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result2);
+  EXPECT_EQ(8u, context2);
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result3);
+  EXPECT_EQ(9u, context3);
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result4);
+  EXPECT_EQ(10u, context4);
+}
+
+class KeepAwakable : public Awakable {
+ public:
+  KeepAwakable() : awake_count(0) {}
+
+  bool Awake(MojoResult result, uintptr_t context) override {
+    awake_count++;
+    return true;
+  }
+
+  int awake_count;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(KeepAwakable);
+};
+
+class RemoveAwakable : public Awakable {
+ public:
+  RemoveAwakable() : awake_count(0) {}
+
+  bool Awake(MojoResult result, uintptr_t context) override {
+    awake_count++;
+    return false;
+  }
+
+  int awake_count;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(RemoveAwakable);
+};
+
+TEST(AwakableListTest, KeepAwakablesReturningTrue) {
+  KeepAwakable keep0;
+  KeepAwakable keep1;
+  RemoveAwakable remove0;
+  RemoveAwakable remove1;
+  RemoveAwakable remove2;
+
+  HandleSignalsState hss(MOJO_HANDLE_SIGNAL_WRITABLE,
+                         MOJO_HANDLE_SIGNAL_WRITABLE);
+
+  AwakableList remove_all;
+  remove_all.Add(&remove0, MOJO_HANDLE_SIGNAL_WRITABLE, 0);
+  remove_all.Add(&remove1, MOJO_HANDLE_SIGNAL_WRITABLE, 0);
+
+  remove_all.AwakeForStateChange(hss);
+  EXPECT_EQ(remove0.awake_count, 1);
+  EXPECT_EQ(remove1.awake_count, 1);
+
+  remove_all.AwakeForStateChange(hss);
+  EXPECT_EQ(remove0.awake_count, 1);
+  EXPECT_EQ(remove1.awake_count, 1);
+
+  AwakableList remove_first;
+  remove_first.Add(&remove2, MOJO_HANDLE_SIGNAL_WRITABLE, 0);
+  remove_first.Add(&keep0, MOJO_HANDLE_SIGNAL_WRITABLE, 0);
+  remove_first.Add(&keep1, MOJO_HANDLE_SIGNAL_WRITABLE, 0);
+
+  remove_first.AwakeForStateChange(hss);
+  EXPECT_EQ(keep0.awake_count, 1);
+  EXPECT_EQ(keep1.awake_count, 1);
+  EXPECT_EQ(remove2.awake_count, 1);
+
+  remove_first.AwakeForStateChange(hss);
+  EXPECT_EQ(keep0.awake_count, 2);
+  EXPECT_EQ(keep1.awake_count, 2);
+  EXPECT_EQ(remove2.awake_count, 1);
+
+  remove_first.Remove(&keep0);
+  remove_first.Remove(&keep1);
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/configuration.cc b/mojo/edk/system/configuration.cc
new file mode 100644
index 0000000..9aaed31
--- /dev/null
+++ b/mojo/edk/system/configuration.cc
@@ -0,0 +1,26 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/configuration.h"
+
+namespace mojo {
+namespace edk {
+namespace internal {
+
+// These default values should be synced with the documentation in
+// mojo/edk/embedder/configuration.h.
+Configuration g_configuration = {
+    1000000,              // max_handle_table_size
+    1000000,              // max_mapping_table_sze
+    1000000,              // max_wait_many_num_handles
+    4 * 1024 * 1024,      // max_message_num_bytes
+    10000,                // max_message_num_handles
+    256 * 1024 * 1024,    // max_data_pipe_capacity_bytes
+    1024 * 1024,          // default_data_pipe_capacity_bytes
+    16,                   // data_pipe_buffer_alignment_bytes
+    1024 * 1024 * 1024};  // max_shared_memory_num_bytes
+
+}  // namespace internal
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/configuration.h b/mojo/edk/system/configuration.h
new file mode 100644
index 0000000..038835f
--- /dev/null
+++ b/mojo/edk/system/configuration.h
@@ -0,0 +1,29 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_CONFIGURATION_H_
+#define MOJO_EDK_SYSTEM_CONFIGURATION_H_
+
+#include "mojo/edk/embedder/configuration.h"
+#include "mojo/edk/system/system_impl_export.h"
+
+namespace mojo {
+namespace edk {
+
+namespace internal {
+MOJO_SYSTEM_IMPL_EXPORT extern Configuration g_configuration;
+}  // namespace internal
+
+MOJO_SYSTEM_IMPL_EXPORT inline const Configuration& GetConfiguration() {
+  return internal::g_configuration;
+}
+
+MOJO_SYSTEM_IMPL_EXPORT inline Configuration* GetMutableConfiguration() {
+  return &internal::g_configuration;
+}
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_CONFIGURATION_H_
diff --git a/mojo/edk/system/core.cc b/mojo/edk/system/core.cc
new file mode 100644
index 0000000..370573f
--- /dev/null
+++ b/mojo/edk/system/core.cc
@@ -0,0 +1,594 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/core.h"
+
+#include <vector>
+
+#include "base/logging.h"
+#include "base/time/time.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/embedder/platform_support.h"
+#include "mojo/edk/system/async_waiter.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/data_pipe.h"
+#include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
+#include "mojo/edk/system/data_pipe_producer_dispatcher.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/handle_signals_state.h"
+#include "mojo/edk/system/message_pipe_dispatcher.h"
+#include "mojo/edk/system/shared_buffer_dispatcher.h"
+#include "mojo/edk/system/waiter.h"
+#include "mojo/public/c/system/macros.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// Implementation notes
+//
+// Mojo primitives are implemented by the singleton |Core| object. Most calls
+// are for a "primary" handle (the first argument). |Core::GetDispatcher()| is
+// used to look up a |Dispatcher| object for a given handle. That object
+// implements most primitives for that object. The wait primitives are not
+// attached to objects and are implemented by |Core| itself.
+//
+// Some objects have multiple handles associated to them, e.g., message pipes
+// (which have two). In such a case, there is still a |Dispatcher| (e.g.,
+// |MessagePipeDispatcher|) for each handle, with each handle having a strong
+// reference to the common "secondary" object (e.g., |MessagePipe|). This
+// secondary object does NOT have any references to the |Dispatcher|s (even if
+// it did, it wouldn't be able to do anything with them due to lock order
+// requirements -- see below).
+//
+// Waiting is implemented by having the thread that wants to wait call the
+// |Dispatcher|s for the handles that it wants to wait on with a |Waiter|
+// object; this |Waiter| object may be created on the stack of that thread or be
+// kept in thread local storage for that thread (TODO(vtl): future improvement).
+// The |Dispatcher| then adds the |Waiter| to an |AwakableList| that's either
+// owned by that |Dispatcher| (see |SimpleDispatcher|) or by a secondary object
+// (e.g., |MessagePipe|). To signal/wake a |Waiter|, the object in question --
+// either a |SimpleDispatcher| or a secondary object -- talks to its
+// |AwakableList|.
+
+// Thread-safety notes
+//
+// Mojo primitives calls are thread-safe. We achieve this with relatively
+// fine-grained locking. There is a global handle table lock. This lock should
+// be held as briefly as possible (TODO(vtl): a future improvement would be to
+// switch it to a reader-writer lock). Each |Dispatcher| object then has a lock
+// (which subclasses can use to protect their data).
+//
+// The lock ordering is as follows:
+//   1. global handle table lock, global mapping table lock
+//   2. |Dispatcher| locks
+//   3. secondary object locks
+//   ...
+//   INF. |Waiter| locks
+//
+// Notes:
+//    - While holding a |Dispatcher| lock, you may not unconditionally attempt
+//      to take another |Dispatcher| lock. (This has consequences on the
+//      concurrency semantics of |MojoWriteMessage()| when passing handles.)
+//      Doing so would lead to deadlock.
+//    - Locks at the "INF" level may not have any locks taken while they are
+//      held.
+
+// TODO(vtl): This should take a |scoped_ptr<PlatformSupport>| as a parameter.
+Core::Core(PlatformSupport* platform_support)
+    : platform_support_(platform_support) {
+}
+
+Core::~Core() {
+}
+
+MojoHandle Core::AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher) {
+  base::AutoLock locker(handle_table_lock_);
+  return handle_table_.AddDispatcher(dispatcher);
+}
+
+scoped_refptr<Dispatcher> Core::GetDispatcher(MojoHandle handle) {
+  if (handle == MOJO_HANDLE_INVALID)
+    return nullptr;
+
+  base::AutoLock locker(handle_table_lock_);
+  return handle_table_.GetDispatcher(handle);
+}
+
+MojoResult Core::AsyncWait(MojoHandle handle,
+                           MojoHandleSignals signals,
+                           const base::Callback<void(MojoResult)>& callback) {
+  scoped_refptr<Dispatcher> dispatcher = GetDispatcher(handle);
+  DCHECK(dispatcher);
+
+  scoped_ptr<AsyncWaiter> waiter = make_scoped_ptr(new AsyncWaiter(callback));
+  MojoResult rv = dispatcher->AddAwakable(waiter.get(), signals, 0, nullptr);
+  if (rv == MOJO_RESULT_OK)
+    ignore_result(waiter.release());
+  return rv;
+}
+
+MojoTimeTicks Core::GetTimeTicksNow() {
+  return base::TimeTicks::Now().ToInternalValue();
+}
+
+MojoResult Core::Close(MojoHandle handle) {
+  if (handle == MOJO_HANDLE_INVALID)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  scoped_refptr<Dispatcher> dispatcher;
+  {
+    base::AutoLock locker(handle_table_lock_);
+    MojoResult result =
+        handle_table_.GetAndRemoveDispatcher(handle, &dispatcher);
+    if (result != MOJO_RESULT_OK)
+      return result;
+  }
+
+  // The dispatcher doesn't have a say in being closed, but gets notified of it.
+  // Note: This is done outside of |handle_table_lock_|. As a result, there's a
+  // race condition that the dispatcher must handle; see the comment in
+  // |Dispatcher| in dispatcher.h.
+  return dispatcher->Close();
+}
+
+MojoResult Core::Wait(MojoHandle handle,
+                      MojoHandleSignals signals,
+                      MojoDeadline deadline,
+                      MojoHandleSignalsState* signals_state) {
+  uint32_t unused = static_cast<uint32_t>(-1);
+  HandleSignalsState hss;
+  MojoResult rv = WaitManyInternal(&handle, &signals, 1, deadline, &unused,
+                                   signals_state ? &hss : nullptr);
+  if (rv != MOJO_RESULT_INVALID_ARGUMENT && signals_state)
+    *signals_state = hss;
+  return rv;
+}
+
+MojoResult Core::WaitMany(const MojoHandle* handles,
+                          const MojoHandleSignals* signals,
+                          uint32_t num_handles,
+                          MojoDeadline deadline,
+                          uint32_t* result_index,
+                          MojoHandleSignalsState* signals_state) {
+  if (num_handles < 1)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  if (num_handles > GetConfiguration().max_wait_many_num_handles)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+
+  uint32_t index = static_cast<uint32_t>(-1);
+  MojoResult rv;
+  if (!signals_state) {
+    rv = WaitManyInternal(handles, signals, num_handles, deadline, &index,
+                          nullptr);
+  } else {
+    // Note: The |reinterpret_cast| is safe, since |HandleSignalsState| is a
+    // subclass of |MojoHandleSignalsState| that doesn't add any data members.
+    rv = WaitManyInternal(handles, signals, num_handles, deadline, &index,
+                          reinterpret_cast<HandleSignalsState*>(signals_state));
+  }
+  if (index != static_cast<uint32_t>(-1) && result_index)
+    *result_index = index;
+  return rv;
+}
+
+MojoResult Core::CreateMessagePipe(
+    const MojoCreateMessagePipeOptions* options,
+    MojoHandle* message_pipe_handle0,
+    MojoHandle* message_pipe_handle1) {
+  CHECK(message_pipe_handle0);
+  CHECK(message_pipe_handle1);
+  MojoCreateMessagePipeOptions validated_options = {};
+  MojoResult result =
+      MessagePipeDispatcher::ValidateCreateOptions(options, &validated_options);
+  if (result != MOJO_RESULT_OK)
+    return result;
+
+  scoped_refptr<MessagePipeDispatcher> dispatcher0 =
+      MessagePipeDispatcher::Create(validated_options);
+  scoped_refptr<MessagePipeDispatcher> dispatcher1 =
+      MessagePipeDispatcher::Create(validated_options);
+
+  std::pair<MojoHandle, MojoHandle> handle_pair;
+  {
+    base::AutoLock locker(handle_table_lock_);
+    handle_pair = handle_table_.AddDispatcherPair(dispatcher0, dispatcher1);
+  }
+  if (handle_pair.first == MOJO_HANDLE_INVALID) {
+    DCHECK_EQ(handle_pair.second, MOJO_HANDLE_INVALID);
+    LOG(ERROR) << "Handle table full";
+    dispatcher0->Close();
+    dispatcher1->Close();
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+  }
+
+  PlatformChannelPair channel_pair;
+  dispatcher0->Init(channel_pair.PassServerHandle());
+  dispatcher1->Init(channel_pair.PassClientHandle());
+
+  *message_pipe_handle0 = handle_pair.first;
+  *message_pipe_handle1 = handle_pair.second;
+  return MOJO_RESULT_OK;
+}
+
+// Implementation note: To properly cancel waiters and avoid other races, this
+// does not transfer dispatchers from one handle to another, even when sending a
+// message in-process. Instead, it must transfer the "contents" of the
+// dispatcher to a new dispatcher, and then close the old dispatcher. If this
+// isn't done, in the in-process case, calls on the old handle may complete
+// after the the message has been received and a new handle created (and
+// possibly even after calls have been made on the new handle).
+MojoResult Core::WriteMessage(MojoHandle message_pipe_handle,
+                              const void* bytes,
+                              uint32_t num_bytes,
+                              const MojoHandle* handles,
+                              uint32_t num_handles,
+                              MojoWriteMessageFlags flags) {
+  scoped_refptr<Dispatcher> dispatcher(GetDispatcher(message_pipe_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  // Easy case: not sending any handles.
+  if (num_handles == 0)
+    return dispatcher->WriteMessage(bytes, num_bytes, nullptr, flags);
+
+  // We have to handle |handles| here, since we have to mark them busy in the
+  // global handle table. We can't delegate this to the dispatcher, since the
+  // handle table lock must be acquired before the dispatcher lock.
+  //
+  // (This leads to an oddity: |handles|/|num_handles| are always verified for
+  // validity, even for dispatchers that don't support |WriteMessage()| and will
+  // simply return failure unconditionally. It also breaks the usual
+  // left-to-right verification order of arguments.)
+  if (num_handles > GetConfiguration().max_message_num_handles)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+
+  // We'll need to hold on to the dispatchers so that we can pass them on to
+  // |WriteMessage()| and also so that we can unlock their locks afterwards
+  // without accessing the handle table. These can be dumb pointers, since their
+  // entries in the handle table won't get removed (since they'll be marked as
+  // busy).
+  std::vector<DispatcherTransport> transports(num_handles);
+
+  // When we pass handles, we have to try to take all their dispatchers' locks
+  // and mark the handles as busy. If the call succeeds, we then remove the
+  // handles from the handle table.
+  {
+    base::AutoLock locker(handle_table_lock_);
+    MojoResult result = handle_table_.MarkBusyAndStartTransport(
+        message_pipe_handle, handles, num_handles, &transports);
+    if (result != MOJO_RESULT_OK)
+      return result;
+  }
+
+  MojoResult rv =
+      dispatcher->WriteMessage(bytes, num_bytes, &transports, flags);
+
+  // We need to release the dispatcher locks before we take the handle table
+  // lock.
+  for (uint32_t i = 0; i < num_handles; i++)
+    transports[i].End();
+
+  {
+    base::AutoLock locker(handle_table_lock_);
+    if (rv == MOJO_RESULT_OK) {
+      handle_table_.RemoveBusyHandles(handles, num_handles);
+    } else {
+      handle_table_.RestoreBusyHandles(handles, num_handles);
+    }
+  }
+
+  return rv;
+}
+
+MojoResult Core::ReadMessage(MojoHandle message_pipe_handle,
+                             void* bytes,
+                             uint32_t* num_bytes,
+                             MojoHandle* handles,
+                             uint32_t* num_handles,
+                             MojoReadMessageFlags flags) {
+  scoped_refptr<Dispatcher> dispatcher(GetDispatcher(message_pipe_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  MojoResult rv;
+  uint32_t num_handles_value = num_handles ? *num_handles : 0;
+  if (num_handles_value == 0) {
+    // Easy case: won't receive any handles.
+    rv = dispatcher->ReadMessage(bytes, num_bytes, nullptr, &num_handles_value,
+                                 flags);
+  } else {
+    DispatcherVector dispatchers;
+    rv = dispatcher->ReadMessage(bytes, num_bytes, &dispatchers,
+                                 &num_handles_value, flags);
+    if (!dispatchers.empty()) {
+      DCHECK_EQ(rv, MOJO_RESULT_OK);
+      DCHECK(num_handles);
+      DCHECK_LE(dispatchers.size(), static_cast<size_t>(num_handles_value));
+
+      bool success;
+      {
+        base::AutoLock locker(handle_table_lock_);
+        success = handle_table_.AddDispatcherVector(dispatchers, handles);
+      }
+      if (!success) {
+        LOG(ERROR) << "Received message with " << dispatchers.size()
+                   << " handles, but handle table full";
+        // Close dispatchers (outside the lock).
+        for (size_t i = 0; i < dispatchers.size(); i++) {
+          if (dispatchers[i])
+            dispatchers[i]->Close();
+        }
+        if (rv == MOJO_RESULT_OK)
+          rv = MOJO_RESULT_RESOURCE_EXHAUSTED;
+      }
+    }
+  }
+
+  if (num_handles)
+    *num_handles = num_handles_value;
+  return rv;
+}
+
+MojoResult Core::CreateDataPipe(
+    const MojoCreateDataPipeOptions* options,
+    MojoHandle* data_pipe_producer_handle,
+    MojoHandle* data_pipe_consumer_handle) {
+  MojoCreateDataPipeOptions validated_options = {};
+  MojoResult result =
+      DataPipe::ValidateCreateOptions(options, &validated_options);
+  if (result != MOJO_RESULT_OK)
+    return result;
+
+  scoped_refptr<DataPipeProducerDispatcher> producer_dispatcher =
+      DataPipeProducerDispatcher::Create(validated_options);
+  scoped_refptr<DataPipeConsumerDispatcher> consumer_dispatcher =
+      DataPipeConsumerDispatcher::Create(validated_options);
+
+  std::pair<MojoHandle, MojoHandle> handle_pair;
+  {
+    base::AutoLock locker(handle_table_lock_);
+    handle_pair = handle_table_.AddDispatcherPair(producer_dispatcher,
+                                                  consumer_dispatcher);
+  }
+  if (handle_pair.first == MOJO_HANDLE_INVALID) {
+    DCHECK_EQ(handle_pair.second, MOJO_HANDLE_INVALID);
+    LOG(ERROR) << "Handle table full";
+    producer_dispatcher->Close();
+    consumer_dispatcher->Close();
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+  }
+  DCHECK_NE(handle_pair.second, MOJO_HANDLE_INVALID);
+
+  PlatformChannelPair channel_pair;
+  producer_dispatcher->Init(channel_pair.PassServerHandle());
+  consumer_dispatcher->Init(channel_pair.PassClientHandle());
+
+  *data_pipe_producer_handle = handle_pair.first;
+  *data_pipe_consumer_handle = handle_pair.second;
+  return MOJO_RESULT_OK;
+}
+
+MojoResult Core::WriteData(MojoHandle data_pipe_producer_handle,
+                           const void* elements,
+                           uint32_t* num_bytes,
+                           MojoWriteDataFlags flags) {
+  scoped_refptr<Dispatcher> dispatcher(
+      GetDispatcher(data_pipe_producer_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return dispatcher->WriteData(elements, num_bytes, flags);
+}
+
+MojoResult Core::BeginWriteData(MojoHandle data_pipe_producer_handle,
+                                void** buffer,
+                                uint32_t* buffer_num_bytes,
+                                MojoWriteDataFlags flags) {
+  scoped_refptr<Dispatcher> dispatcher(
+      GetDispatcher(data_pipe_producer_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return dispatcher->BeginWriteData(buffer, buffer_num_bytes, flags);
+}
+
+MojoResult Core::EndWriteData(MojoHandle data_pipe_producer_handle,
+                              uint32_t num_bytes_written) {
+  scoped_refptr<Dispatcher> dispatcher(
+      GetDispatcher(data_pipe_producer_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return dispatcher->EndWriteData(num_bytes_written);
+}
+
+MojoResult Core::ReadData(MojoHandle data_pipe_consumer_handle,
+                          void* elements,
+                          uint32_t* num_bytes,
+                          MojoReadDataFlags flags) {
+  scoped_refptr<Dispatcher> dispatcher(
+      GetDispatcher(data_pipe_consumer_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return dispatcher->ReadData(elements, num_bytes, flags);
+}
+
+MojoResult Core::BeginReadData(MojoHandle data_pipe_consumer_handle,
+                               const void** buffer,
+                               uint32_t* buffer_num_bytes,
+                               MojoReadDataFlags flags) {
+  scoped_refptr<Dispatcher> dispatcher(
+      GetDispatcher(data_pipe_consumer_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return dispatcher->BeginReadData(buffer, buffer_num_bytes, flags);
+}
+
+MojoResult Core::EndReadData(MojoHandle data_pipe_consumer_handle,
+                             uint32_t num_bytes_read) {
+  scoped_refptr<Dispatcher> dispatcher(
+      GetDispatcher(data_pipe_consumer_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return dispatcher->EndReadData(num_bytes_read);
+}
+
+MojoResult Core::CreateSharedBuffer(
+    const MojoCreateSharedBufferOptions* options,
+    uint64_t num_bytes,
+    MojoHandle* shared_buffer_handle) {
+  MojoCreateSharedBufferOptions validated_options = {};
+  MojoResult result = SharedBufferDispatcher::ValidateCreateOptions(
+      options, &validated_options);
+  if (result != MOJO_RESULT_OK)
+    return result;
+
+  scoped_refptr<SharedBufferDispatcher> dispatcher;
+  result = SharedBufferDispatcher::Create(platform_support_, validated_options,
+                                          num_bytes, &dispatcher);
+  if (result != MOJO_RESULT_OK) {
+    DCHECK(!dispatcher);
+    return result;
+  }
+
+  *shared_buffer_handle = AddDispatcher(dispatcher);
+  if (*shared_buffer_handle == MOJO_HANDLE_INVALID) {
+    LOG(ERROR) << "Handle table full";
+    dispatcher->Close();
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+  }
+
+  return MOJO_RESULT_OK;
+}
+
+MojoResult Core::DuplicateBufferHandle(
+    MojoHandle buffer_handle,
+    const MojoDuplicateBufferHandleOptions* options,
+    MojoHandle* new_buffer_handle) {
+  scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  // Don't verify |options| here; that's the dispatcher's job.
+  scoped_refptr<Dispatcher> new_dispatcher;
+  MojoResult result =
+      dispatcher->DuplicateBufferHandle(options, &new_dispatcher);
+  if (result != MOJO_RESULT_OK)
+    return result;
+
+  *new_buffer_handle = AddDispatcher(new_dispatcher);
+  if (*new_buffer_handle == MOJO_HANDLE_INVALID) {
+    LOG(ERROR) << "Handle table full";
+    dispatcher->Close();
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+  }
+
+  return MOJO_RESULT_OK;
+}
+
+MojoResult Core::MapBuffer(MojoHandle buffer_handle,
+                           uint64_t offset,
+                           uint64_t num_bytes,
+                           void** buffer,
+                           MojoMapBufferFlags flags) {
+  scoped_refptr<Dispatcher> dispatcher(GetDispatcher(buffer_handle));
+  if (!dispatcher)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  scoped_ptr<PlatformSharedBufferMapping> mapping;
+  MojoResult result = dispatcher->MapBuffer(offset, num_bytes, flags, &mapping);
+  if (result != MOJO_RESULT_OK)
+    return result;
+
+  DCHECK(mapping);
+  void* address = mapping->GetBase();
+  {
+    base::AutoLock locker(mapping_table_lock_);
+    result = mapping_table_.AddMapping(mapping.Pass());
+  }
+  if (result != MOJO_RESULT_OK)
+    return result;
+
+  *buffer = address;
+  return MOJO_RESULT_OK;
+}
+
+MojoResult Core::UnmapBuffer(void* buffer) {
+  base::AutoLock locker(mapping_table_lock_);
+  return mapping_table_.RemoveMapping(buffer);
+}
+
+// Note: We allow |handles| to repeat the same handle multiple times, since
+// different flags may be specified.
+// TODO(vtl): This incurs a performance cost in |Remove()|. Analyze this
+// more carefully and address it if necessary.
+MojoResult Core::WaitManyInternal(const MojoHandle* handles,
+                                  const MojoHandleSignals* signals,
+                                  uint32_t num_handles,
+                                  MojoDeadline deadline,
+                                  uint32_t* result_index,
+                                  HandleSignalsState* signals_states) {
+  CHECK(handles);
+  CHECK(signals);
+  DCHECK_GT(num_handles, 0u);
+  if (result_index) {
+    DCHECK_EQ(*result_index, static_cast<uint32_t>(-1));
+  }
+
+  DispatcherVector dispatchers;
+  dispatchers.reserve(num_handles);
+  for (uint32_t i = 0; i < num_handles; i++) {
+    scoped_refptr<Dispatcher> dispatcher = GetDispatcher(handles[i]);
+    if (!dispatcher) {
+      if (result_index && result_index)
+        *result_index = i;
+      return MOJO_RESULT_INVALID_ARGUMENT;
+    }
+    dispatchers.push_back(dispatcher);
+  }
+
+  // TODO(vtl): Should make the waiter live (permanently) in TLS.
+  Waiter waiter;
+  waiter.Init();
+
+  uint32_t i;
+  MojoResult rv = MOJO_RESULT_OK;
+  for (i = 0; i < num_handles; i++) {
+    rv = dispatchers[i]->AddAwakable(
+        &waiter, signals[i], i, signals_states ? &signals_states[i] : nullptr);
+    if (rv != MOJO_RESULT_OK) {
+      if (result_index)
+        *result_index = i;
+      break;
+    }
+  }
+  uint32_t num_added = i;
+
+  if (rv == MOJO_RESULT_ALREADY_EXISTS)
+    rv = MOJO_RESULT_OK;  // The i-th one is already "triggered".
+  else if (rv == MOJO_RESULT_OK)
+    rv = waiter.Wait(deadline, result_index);
+
+  // Make sure no other dispatchers try to wake |waiter| for the current
+  // |Wait()|/|WaitMany()| call. (Only after doing this can |waiter| be
+  // destroyed, but this would still be required if the waiter were in TLS.)
+  for (i = 0; i < num_added; i++) {
+    dispatchers[i]->RemoveAwakable(
+        &waiter, signals_states ? &signals_states[i] : nullptr);
+  }
+  if (signals_states) {
+    for (; i < num_handles; i++)
+      signals_states[i] = dispatchers[i]->GetHandleSignalsState();
+  }
+
+  return rv;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/core.h b/mojo/edk/system/core.h
new file mode 100644
index 0000000..3c2154a
--- /dev/null
+++ b/mojo/edk/system/core.h
@@ -0,0 +1,179 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_CORE_H_
+#define MOJO_EDK_SYSTEM_CORE_H_
+
+#include <stdint.h>
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
+#include "mojo/edk/system/handle_table.h"
+#include "mojo/edk/system/mapping_table.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/buffer.h"
+#include "mojo/public/c/system/data_pipe.h"
+#include "mojo/public/c/system/message_pipe.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+
+namespace edk {
+
+class Dispatcher;
+class PlatformSupport;
+struct HandleSignalsState;
+
+// |Core| is an object that implements the Mojo system calls. All public methods
+// are thread-safe.
+class MOJO_SYSTEM_IMPL_EXPORT Core {
+ public:
+  // ---------------------------------------------------------------------------
+
+  // These methods are only to be used by via the embedder API (and internally):
+
+  // |*platform_support| must outlive this object.
+  explicit Core(PlatformSupport* platform_support);
+  virtual ~Core();
+
+  // Adds |dispatcher| to the handle table, returning the handle for it. Returns
+  // |MOJO_HANDLE_INVALID| on failure, namely if the handle table is full.
+  MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher);
+
+  // Looks up the dispatcher for the given handle. Returns null if the handle is
+  // invalid.
+  scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle);
+
+  // Watches on the given handle for the given signals, calling |callback| when
+  // a signal is satisfied or when all signals become unsatisfiable. |callback|
+  // must satisfy stringent requirements -- see |Awakable::Awake()| in
+  // awakable.h. In particular, it must not call any Mojo system functions.
+  MojoResult AsyncWait(MojoHandle handle,
+                       MojoHandleSignals signals,
+                       const base::Callback<void(MojoResult)>& callback);
+
+  PlatformSupport* platform_support() const {
+    return platform_support_;
+  }
+
+  // ---------------------------------------------------------------------------
+
+  // The following methods are essentially implementations of the Mojo Core
+  // functions of the Mojo API, with the C interface translated to C++ by
+  // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract
+  // of these methods is to look at the header files defining the corresponding
+  // API functions, referenced below.
+
+  // These methods correspond to the API functions defined in
+  // "mojo/public/c/system/functions.h":
+  MojoTimeTicks GetTimeTicksNow();
+  MojoResult Close(MojoHandle handle);
+  MojoResult Wait(MojoHandle handle,
+                  MojoHandleSignals signals,
+                  MojoDeadline deadline,
+                  MojoHandleSignalsState* signals_state);
+  MojoResult WaitMany(const MojoHandle* handles,
+                      const MojoHandleSignals* signals,
+                      uint32_t num_handles,
+                      MojoDeadline deadline,
+                      uint32_t* result_index,
+                      MojoHandleSignalsState* signals_states);
+
+  // These methods correspond to the API functions defined in
+  // "mojo/public/c/system/message_pipe.h":
+  MojoResult CreateMessagePipe(
+      const MojoCreateMessagePipeOptions* options,
+      MojoHandle* message_pipe_handle0,
+      MojoHandle* message_pipe_handle1);
+  MojoResult WriteMessage(MojoHandle message_pipe_handle,
+                          const void* bytes,
+                          uint32_t num_bytes,
+                          const MojoHandle* handles,
+                          uint32_t num_handles,
+                          MojoWriteMessageFlags flags);
+  MojoResult ReadMessage(MojoHandle message_pipe_handle,
+                         void* bytes,
+                         uint32_t* num_bytes,
+                         MojoHandle* handles,
+                         uint32_t* num_handles,
+                         MojoReadMessageFlags flags);
+
+  // These methods correspond to the API functions defined in
+  // "mojo/public/c/system/data_pipe.h":
+  MojoResult CreateDataPipe(
+      const MojoCreateDataPipeOptions* options,
+      MojoHandle* data_pipe_producer_handle,
+      MojoHandle* data_pipe_consumer_handle);
+  MojoResult WriteData(MojoHandle data_pipe_producer_handle,
+                       const void* elements,
+                       uint32_t* num_bytes,
+                       MojoWriteDataFlags flags);
+  MojoResult BeginWriteData(MojoHandle data_pipe_producer_handle,
+                            void** buffer,
+                            uint32_t* buffer_num_bytes,
+                            MojoWriteDataFlags flags);
+  MojoResult EndWriteData(MojoHandle data_pipe_producer_handle,
+                          uint32_t num_bytes_written);
+  MojoResult ReadData(MojoHandle data_pipe_consumer_handle,
+                      void* elements,
+                      uint32_t* num_bytes,
+                      MojoReadDataFlags flags);
+  MojoResult BeginReadData(MojoHandle data_pipe_consumer_handle,
+                           const void** buffer,
+                           uint32_t* buffer_num_bytes,
+                           MojoReadDataFlags flags);
+  MojoResult EndReadData(MojoHandle data_pipe_consumer_handle,
+                         uint32_t num_bytes_read);
+
+  // These methods correspond to the API functions defined in
+  // "mojo/public/c/system/buffer.h":
+  MojoResult CreateSharedBuffer(
+      const MojoCreateSharedBufferOptions* options,
+      uint64_t num_bytes,
+      MojoHandle* shared_buffer_handle);
+  MojoResult DuplicateBufferHandle(
+      MojoHandle buffer_handle,
+      const MojoDuplicateBufferHandleOptions* options,
+      MojoHandle* new_buffer_handle);
+  MojoResult MapBuffer(MojoHandle buffer_handle,
+                       uint64_t offset,
+                       uint64_t num_bytes,
+                       void** buffer,
+                       MojoMapBufferFlags flags);
+  MojoResult UnmapBuffer(void* buffer);
+
+ private:
+  friend bool internal::ShutdownCheckNoLeaks(Core*);
+
+  // Internal implementation of |Wait()| and |WaitMany()|; doesn't do basic
+  // validation of arguments. |*result_index| is only set if the result (whether
+  // success or failure) applies to a specific handle, so its value should be
+  // preinitialized to |static_cast<uint32_t>(-1)|.
+  MojoResult WaitManyInternal(const MojoHandle* handles,
+                              const MojoHandleSignals* signals,
+                              uint32_t num_handles,
+                              MojoDeadline deadline,
+                              uint32_t* result_index,
+                              HandleSignalsState* signals_states);
+
+  PlatformSupport* const platform_support_;
+
+  // TODO(vtl): |handle_table_lock_| should be a reader-writer lock (if only we
+  // had them).
+  base::Lock handle_table_lock_;  // Protects |handle_table_|.
+  HandleTable handle_table_;
+
+  base::Lock mapping_table_lock_;  // Protects |mapping_table_|.
+  MappingTable mapping_table_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(Core);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_CORE_H_
diff --git a/mojo/edk/system/core_test_base.cc b/mojo/edk/system/core_test_base.cc
new file mode 100644
index 0000000..9962767
--- /dev/null
+++ b/mojo/edk/system/core_test_base.cc
@@ -0,0 +1,373 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/core_test_base.h"
+
+#include <vector>
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/core.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+namespace {
+
+// MockDispatcher --------------------------------------------------------------
+
+class MockDispatcher : public Dispatcher {
+ public:
+  static scoped_refptr<MockDispatcher> Create(
+      CoreTestBase::MockHandleInfo* info) {
+    return make_scoped_refptr(new MockDispatcher(info));
+  }
+
+  // |Dispatcher| private methods:
+  Type GetType() const override { return Type::UNKNOWN; }
+
+ private:
+  explicit MockDispatcher(CoreTestBase::MockHandleInfo* info) : info_(info) {
+    CHECK(info_);
+    info_->IncrementCtorCallCount();
+  }
+
+  ~MockDispatcher() override { info_->IncrementDtorCallCount(); }
+
+  // |Dispatcher| protected methods:
+  void CloseImplNoLock() override {
+    info_->IncrementCloseCallCount();
+    lock().AssertAcquired();
+  }
+
+  MojoResult WriteMessageImplNoLock(
+      const void* bytes,
+      uint32_t num_bytes,
+      std::vector<DispatcherTransport>* transports,
+      MojoWriteMessageFlags /*flags*/) override {
+    info_->IncrementWriteMessageCallCount();
+    lock().AssertAcquired();
+
+    if (num_bytes > GetConfiguration().max_message_num_bytes)
+      return MOJO_RESULT_RESOURCE_EXHAUSTED;
+
+    if (transports)
+      return MOJO_RESULT_UNIMPLEMENTED;
+
+    return MOJO_RESULT_OK;
+  }
+
+  MojoResult ReadMessageImplNoLock(void* bytes,
+                                   uint32_t* num_bytes,
+                                   DispatcherVector* dispatchers,
+                                   uint32_t* num_dispatchers,
+                                   MojoReadMessageFlags /*flags*/) override {
+    info_->IncrementReadMessageCallCount();
+    lock().AssertAcquired();
+
+    if (num_dispatchers) {
+      *num_dispatchers = 1;
+      if (dispatchers) {
+        // Okay to leave an invalid dispatcher.
+        dispatchers->resize(1);
+      }
+    }
+
+    return MOJO_RESULT_OK;
+  }
+
+  MojoResult WriteDataImplNoLock(const void* /*elements*/,
+                                 uint32_t* /*num_bytes*/,
+                                 MojoWriteDataFlags /*flags*/) override {
+    info_->IncrementWriteDataCallCount();
+    lock().AssertAcquired();
+    return MOJO_RESULT_UNIMPLEMENTED;
+  }
+
+  MojoResult BeginWriteDataImplNoLock(
+      void** /*buffer*/,
+      uint32_t* /*buffer_num_bytes*/,
+      MojoWriteDataFlags /*flags*/) override {
+    info_->IncrementBeginWriteDataCallCount();
+    lock().AssertAcquired();
+    return MOJO_RESULT_UNIMPLEMENTED;
+  }
+
+  MojoResult EndWriteDataImplNoLock(uint32_t /*num_bytes_written*/) override {
+    info_->IncrementEndWriteDataCallCount();
+    lock().AssertAcquired();
+    return MOJO_RESULT_UNIMPLEMENTED;
+  }
+
+  MojoResult ReadDataImplNoLock(void* /*elements*/,
+                                uint32_t* /*num_bytes*/,
+                                MojoReadDataFlags /*flags*/) override {
+    info_->IncrementReadDataCallCount();
+    lock().AssertAcquired();
+    return MOJO_RESULT_UNIMPLEMENTED;
+  }
+
+  MojoResult BeginReadDataImplNoLock(const void** /*buffer*/,
+                                     uint32_t* /*buffer_num_bytes*/,
+                                     MojoReadDataFlags /*flags*/) override {
+    info_->IncrementBeginReadDataCallCount();
+    lock().AssertAcquired();
+    return MOJO_RESULT_UNIMPLEMENTED;
+  }
+
+  MojoResult EndReadDataImplNoLock(uint32_t /*num_bytes_read*/) override {
+    info_->IncrementEndReadDataCallCount();
+    lock().AssertAcquired();
+    return MOJO_RESULT_UNIMPLEMENTED;
+  }
+
+  MojoResult AddAwakableImplNoLock(Awakable* awakable,
+                                   MojoHandleSignals /*signals*/,
+                                   uint32_t /*context*/,
+                                   HandleSignalsState* signals_state) override {
+    info_->IncrementAddAwakableCallCount();
+    lock().AssertAcquired();
+    if (signals_state)
+      *signals_state = HandleSignalsState();
+    if (info_->IsAddAwakableAllowed()) {
+      info_->AwakableWasAdded(awakable);
+      return MOJO_RESULT_OK;
+    }
+
+    return MOJO_RESULT_FAILED_PRECONDITION;
+  }
+
+  void RemoveAwakableImplNoLock(Awakable* /*awakable*/,
+                                HandleSignalsState* signals_state) override {
+    info_->IncrementRemoveAwakableCallCount();
+    lock().AssertAcquired();
+    if (signals_state)
+      *signals_state = HandleSignalsState();
+  }
+
+  void CancelAllAwakablesNoLock() override {
+    info_->IncrementCancelAllAwakablesCallCount();
+    lock().AssertAcquired();
+  }
+
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
+      override {
+    return Create(info_);
+  }
+
+  CoreTestBase::MockHandleInfo* const info_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MockDispatcher);
+};
+
+}  // namespace
+
+// CoreTestBase ----------------------------------------------------------------
+
+CoreTestBase::CoreTestBase() {
+}
+
+CoreTestBase::~CoreTestBase() {
+}
+
+MojoHandle CoreTestBase::CreateMockHandle(CoreTestBase::MockHandleInfo* info) {
+  scoped_refptr<MockDispatcher> dispatcher = MockDispatcher::Create(info);
+  return core()->AddDispatcher(dispatcher);
+}
+
+// CoreTestBase_MockHandleInfo -------------------------------------------------
+
+CoreTestBase_MockHandleInfo::CoreTestBase_MockHandleInfo()
+    : ctor_call_count_(0),
+      dtor_call_count_(0),
+      close_call_count_(0),
+      write_message_call_count_(0),
+      read_message_call_count_(0),
+      write_data_call_count_(0),
+      begin_write_data_call_count_(0),
+      end_write_data_call_count_(0),
+      read_data_call_count_(0),
+      begin_read_data_call_count_(0),
+      end_read_data_call_count_(0),
+      add_awakable_call_count_(0),
+      remove_awakable_call_count_(0),
+      cancel_all_awakables_call_count_(0),
+      add_awakable_allowed_(false) {
+}
+
+CoreTestBase_MockHandleInfo::~CoreTestBase_MockHandleInfo() {
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetCtorCallCount() const {
+  base::AutoLock locker(lock_);
+  return ctor_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetDtorCallCount() const {
+  base::AutoLock locker(lock_);
+  return dtor_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetCloseCallCount() const {
+  base::AutoLock locker(lock_);
+  return close_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetWriteMessageCallCount() const {
+  base::AutoLock locker(lock_);
+  return write_message_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetReadMessageCallCount() const {
+  base::AutoLock locker(lock_);
+  return read_message_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetWriteDataCallCount() const {
+  base::AutoLock locker(lock_);
+  return write_data_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetBeginWriteDataCallCount() const {
+  base::AutoLock locker(lock_);
+  return begin_write_data_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetEndWriteDataCallCount() const {
+  base::AutoLock locker(lock_);
+  return end_write_data_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetReadDataCallCount() const {
+  base::AutoLock locker(lock_);
+  return read_data_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetBeginReadDataCallCount() const {
+  base::AutoLock locker(lock_);
+  return begin_read_data_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetEndReadDataCallCount() const {
+  base::AutoLock locker(lock_);
+  return end_read_data_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetAddAwakableCallCount() const {
+  base::AutoLock locker(lock_);
+  return add_awakable_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetRemoveAwakableCallCount() const {
+  base::AutoLock locker(lock_);
+  return remove_awakable_call_count_;
+}
+
+unsigned CoreTestBase_MockHandleInfo::GetCancelAllAwakablesCallCount() const {
+  base::AutoLock locker(lock_);
+  return cancel_all_awakables_call_count_;
+}
+
+size_t CoreTestBase_MockHandleInfo::GetAddedAwakableSize() const {
+  base::AutoLock locker(lock_);
+  return added_awakables_.size();
+}
+
+Awakable* CoreTestBase_MockHandleInfo::GetAddedAwakableAt(unsigned i) const {
+  base::AutoLock locker(lock_);
+  return added_awakables_[i];
+}
+
+void CoreTestBase_MockHandleInfo::IncrementCtorCallCount() {
+  base::AutoLock locker(lock_);
+  ctor_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementDtorCallCount() {
+  base::AutoLock locker(lock_);
+  dtor_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementCloseCallCount() {
+  base::AutoLock locker(lock_);
+  close_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementWriteMessageCallCount() {
+  base::AutoLock locker(lock_);
+  write_message_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementReadMessageCallCount() {
+  base::AutoLock locker(lock_);
+  read_message_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementWriteDataCallCount() {
+  base::AutoLock locker(lock_);
+  write_data_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementBeginWriteDataCallCount() {
+  base::AutoLock locker(lock_);
+  begin_write_data_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementEndWriteDataCallCount() {
+  base::AutoLock locker(lock_);
+  end_write_data_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementReadDataCallCount() {
+  base::AutoLock locker(lock_);
+  read_data_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementBeginReadDataCallCount() {
+  base::AutoLock locker(lock_);
+  begin_read_data_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementEndReadDataCallCount() {
+  base::AutoLock locker(lock_);
+  end_read_data_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementAddAwakableCallCount() {
+  base::AutoLock locker(lock_);
+  add_awakable_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementRemoveAwakableCallCount() {
+  base::AutoLock locker(lock_);
+  remove_awakable_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::IncrementCancelAllAwakablesCallCount() {
+  base::AutoLock locker(lock_);
+  cancel_all_awakables_call_count_++;
+}
+
+void CoreTestBase_MockHandleInfo::AllowAddAwakable(bool alllow) {
+  base::AutoLock locker(lock_);
+  add_awakable_allowed_ = alllow;
+}
+
+bool CoreTestBase_MockHandleInfo::IsAddAwakableAllowed() const {
+  base::AutoLock locker(lock_);
+  return add_awakable_allowed_;
+}
+
+void CoreTestBase_MockHandleInfo::AwakableWasAdded(Awakable* awakable) {
+  base::AutoLock locker(lock_);
+  added_awakables_.push_back(awakable);
+}
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/core_test_base.h b/mojo/edk/system/core_test_base.h
new file mode 100644
index 0000000..bbdaa5c
--- /dev/null
+++ b/mojo/edk/system/core_test_base.h
@@ -0,0 +1,112 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_
+#define MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_
+
+#include "base/synchronization/lock.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+
+class Core;
+class Awakable;
+
+namespace test {
+
+class CoreTestBase_MockHandleInfo;
+
+class CoreTestBase : public MojoSystemTest {
+ public:
+  using MockHandleInfo = CoreTestBase_MockHandleInfo;
+
+  CoreTestBase();
+  ~CoreTestBase() override;
+
+ protected:
+  // |info| must remain alive until the returned handle is closed.
+  MojoHandle CreateMockHandle(MockHandleInfo* info);
+
+  Core* core() { return mojo::edk::internal::g_core; }
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(CoreTestBase);
+};
+
+class CoreTestBase_MockHandleInfo {
+ public:
+  CoreTestBase_MockHandleInfo();
+  ~CoreTestBase_MockHandleInfo();
+
+  unsigned GetCtorCallCount() const;
+  unsigned GetDtorCallCount() const;
+  unsigned GetCloseCallCount() const;
+  unsigned GetWriteMessageCallCount() const;
+  unsigned GetReadMessageCallCount() const;
+  unsigned GetWriteDataCallCount() const;
+  unsigned GetBeginWriteDataCallCount() const;
+  unsigned GetEndWriteDataCallCount() const;
+  unsigned GetReadDataCallCount() const;
+  unsigned GetBeginReadDataCallCount() const;
+  unsigned GetEndReadDataCallCount() const;
+  unsigned GetAddAwakableCallCount() const;
+  unsigned GetRemoveAwakableCallCount() const;
+  unsigned GetCancelAllAwakablesCallCount() const;
+
+  size_t GetAddedAwakableSize() const;
+  Awakable* GetAddedAwakableAt(unsigned i) const;
+
+  // For use by |MockDispatcher|:
+  void IncrementCtorCallCount();
+  void IncrementDtorCallCount();
+  void IncrementCloseCallCount();
+  void IncrementWriteMessageCallCount();
+  void IncrementReadMessageCallCount();
+  void IncrementWriteDataCallCount();
+  void IncrementBeginWriteDataCallCount();
+  void IncrementEndWriteDataCallCount();
+  void IncrementReadDataCallCount();
+  void IncrementBeginReadDataCallCount();
+  void IncrementEndReadDataCallCount();
+  void IncrementAddAwakableCallCount();
+  void IncrementRemoveAwakableCallCount();
+  void IncrementCancelAllAwakablesCallCount();
+
+  void AllowAddAwakable(bool alllow);
+  bool IsAddAwakableAllowed() const;
+  void AwakableWasAdded(Awakable*);
+
+ private:
+  mutable base::Lock lock_;  // Protects the following members.
+  unsigned ctor_call_count_;
+  unsigned dtor_call_count_;
+  unsigned close_call_count_;
+  unsigned write_message_call_count_;
+  unsigned read_message_call_count_;
+  unsigned write_data_call_count_;
+  unsigned begin_write_data_call_count_;
+  unsigned end_write_data_call_count_;
+  unsigned read_data_call_count_;
+  unsigned begin_read_data_call_count_;
+  unsigned end_read_data_call_count_;
+  unsigned add_awakable_call_count_;
+  unsigned remove_awakable_call_count_;
+  unsigned cancel_all_awakables_call_count_;
+
+  bool add_awakable_allowed_;
+  std::vector<Awakable*> added_awakables_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(CoreTestBase_MockHandleInfo);
+};
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_CORE_TEST_BASE_H_
diff --git a/mojo/edk/system/core_unittest.cc b/mojo/edk/system/core_unittest.cc
new file mode 100644
index 0000000..bd7dfd9
--- /dev/null
+++ b/mojo/edk/system/core_unittest.cc
@@ -0,0 +1,1265 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/core.h"
+
+#include <stdint.h>
+
+#include <limits>
+
+#include "base/bind.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/system/awakable.h"
+#include "mojo/edk/system/core_test_base.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+const MojoHandleSignalsState kEmptyMojoHandleSignalsState = {0u, 0u};
+const MojoHandleSignalsState kFullMojoHandleSignalsState = {~0u, ~0u};
+const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE |
+                                      MOJO_HANDLE_SIGNAL_WRITABLE |
+                                      MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+
+using CoreTest = test::CoreTestBase;
+
+TEST_F(CoreTest, GetTimeTicksNow) {
+  const MojoTimeTicks start = core()->GetTimeTicksNow();
+  EXPECT_NE(static_cast<MojoTimeTicks>(0), start)
+      << "GetTimeTicksNow should return nonzero value";
+  test::Sleep(test::DeadlineFromMilliseconds(15));
+  const MojoTimeTicks finish = core()->GetTimeTicksNow();
+  // Allow for some fuzz in sleep.
+  EXPECT_GE((finish - start), static_cast<MojoTimeTicks>(8000))
+      << "Sleeping should result in increasing time ticks";
+}
+
+TEST_F(CoreTest, Basic) {
+  MockHandleInfo info;
+
+  EXPECT_EQ(0u, info.GetCtorCallCount());
+  MojoHandle h = CreateMockHandle(&info);
+  EXPECT_EQ(1u, info.GetCtorCallCount());
+  EXPECT_NE(h, MOJO_HANDLE_INVALID);
+
+  EXPECT_EQ(0u, info.GetWriteMessageCallCount());
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h, nullptr, 0, nullptr, 0,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(1u, info.GetWriteMessageCallCount());
+
+  EXPECT_EQ(0u, info.GetReadMessageCallCount());
+  uint32_t num_bytes = 0;
+  EXPECT_EQ(
+      MOJO_RESULT_OK,
+      core()->ReadMessage(h, nullptr, &num_bytes, nullptr, nullptr,
+                          MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(1u, info.GetReadMessageCallCount());
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(h, nullptr, nullptr, nullptr, nullptr,
+                                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(2u, info.GetReadMessageCallCount());
+
+  EXPECT_EQ(0u, info.GetWriteDataCallCount());
+  EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+            core()->WriteData(h, nullptr, nullptr, MOJO_WRITE_DATA_FLAG_NONE));
+  EXPECT_EQ(1u, info.GetWriteDataCallCount());
+
+  EXPECT_EQ(0u, info.GetBeginWriteDataCallCount());
+  EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+            core()->BeginWriteData(h, nullptr, nullptr,
+                                   MOJO_WRITE_DATA_FLAG_NONE));
+  EXPECT_EQ(1u, info.GetBeginWriteDataCallCount());
+
+  EXPECT_EQ(0u, info.GetEndWriteDataCallCount());
+  EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED, core()->EndWriteData(h, 0));
+  EXPECT_EQ(1u, info.GetEndWriteDataCallCount());
+
+  EXPECT_EQ(0u, info.GetReadDataCallCount());
+  EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+            core()->ReadData(h, nullptr, nullptr, MOJO_READ_DATA_FLAG_NONE));
+  EXPECT_EQ(1u, info.GetReadDataCallCount());
+
+  EXPECT_EQ(0u, info.GetBeginReadDataCallCount());
+  EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+            core()->BeginReadData(h, nullptr, nullptr,
+                                  MOJO_READ_DATA_FLAG_NONE));
+  EXPECT_EQ(1u, info.GetBeginReadDataCallCount());
+
+  EXPECT_EQ(0u, info.GetEndReadDataCallCount());
+  EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED, core()->EndReadData(h, 0));
+  EXPECT_EQ(1u, info.GetEndReadDataCallCount());
+
+  EXPECT_EQ(0u, info.GetAddAwakableCallCount());
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            core()->Wait(h, ~MOJO_HANDLE_SIGNAL_NONE, MOJO_DEADLINE_INDEFINITE,
+                         nullptr));
+  EXPECT_EQ(1u, info.GetAddAwakableCallCount());
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            core()->Wait(h, ~MOJO_HANDLE_SIGNAL_NONE, 0, nullptr));
+  EXPECT_EQ(2u, info.GetAddAwakableCallCount());
+  MojoHandleSignalsState hss = kFullMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            core()->Wait(h, ~MOJO_HANDLE_SIGNAL_NONE, MOJO_DEADLINE_INDEFINITE,
+                         &hss));
+  EXPECT_EQ(3u, info.GetAddAwakableCallCount());
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->Wait(h, ~MOJO_HANDLE_SIGNAL_NONE, 10 * 1000, nullptr));
+  EXPECT_EQ(4u, info.GetAddAwakableCallCount());
+  hss = kFullMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            core()->Wait(h, ~MOJO_HANDLE_SIGNAL_NONE, 10 * 1000, &hss));
+  EXPECT_EQ(5u, info.GetAddAwakableCallCount());
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+
+  MojoHandleSignals handle_signals = ~MOJO_HANDLE_SIGNAL_NONE;
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->WaitMany(&h, &handle_signals, 1, MOJO_DEADLINE_INDEFINITE,
+                       nullptr, nullptr));
+  EXPECT_EQ(6u, info.GetAddAwakableCallCount());
+  uint32_t result_index = static_cast<uint32_t>(-1);
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->WaitMany(&h, &handle_signals, 1, MOJO_DEADLINE_INDEFINITE,
+                       &result_index, nullptr));
+  EXPECT_EQ(7u, info.GetAddAwakableCallCount());
+  EXPECT_EQ(0u, result_index);
+  hss = kFullMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->WaitMany(&h, &handle_signals, 1, MOJO_DEADLINE_INDEFINITE,
+                       nullptr, &hss));
+  EXPECT_EQ(8u, info.GetAddAwakableCallCount());
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+  result_index = static_cast<uint32_t>(-1);
+  hss = kFullMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->WaitMany(&h, &handle_signals, 1, MOJO_DEADLINE_INDEFINITE,
+                       &result_index, &hss));
+  EXPECT_EQ(9u, info.GetAddAwakableCallCount());
+  EXPECT_EQ(0u, result_index);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+
+  EXPECT_EQ(0u, info.GetDtorCallCount());
+  EXPECT_EQ(0u, info.GetCloseCallCount());
+  EXPECT_EQ(0u, info.GetCancelAllAwakablesCallCount());
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
+  EXPECT_EQ(1u, info.GetCancelAllAwakablesCallCount());
+  EXPECT_EQ(1u, info.GetCloseCallCount());
+  EXPECT_EQ(1u, info.GetDtorCallCount());
+
+  // No awakables should ever have ever been added.
+  EXPECT_EQ(0u, info.GetRemoveAwakableCallCount());
+}
+
+TEST_F(CoreTest, InvalidArguments) {
+  // |Close()|:
+  {
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->Close(MOJO_HANDLE_INVALID));
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->Close(10));
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->Close(1000000000));
+
+    // Test a double-close.
+    MockHandleInfo info;
+    MojoHandle h = CreateMockHandle(&info);
+    EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
+    EXPECT_EQ(1u, info.GetCloseCallCount());
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->Close(h));
+    EXPECT_EQ(1u, info.GetCloseCallCount());
+  }
+
+  // |Wait()|:
+  {
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->Wait(MOJO_HANDLE_INVALID, ~MOJO_HANDLE_SIGNAL_NONE,
+                           MOJO_DEADLINE_INDEFINITE, nullptr));
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->Wait(10, ~MOJO_HANDLE_SIGNAL_NONE,
+                           MOJO_DEADLINE_INDEFINITE, nullptr));
+
+    MojoHandleSignalsState hss = kFullMojoHandleSignalsState;
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->Wait(MOJO_HANDLE_INVALID, ~MOJO_HANDLE_SIGNAL_NONE,
+                           MOJO_DEADLINE_INDEFINITE, &hss));
+    // On invalid argument, it shouldn't modify the handle signals state.
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
+              hss.satisfied_signals);
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfiable_signals,
+              hss.satisfiable_signals);
+    hss = kFullMojoHandleSignalsState;
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->Wait(10, ~MOJO_HANDLE_SIGNAL_NONE,
+                           MOJO_DEADLINE_INDEFINITE, &hss));
+    // On invalid argument, it shouldn't modify the handle signals state.
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
+              hss.satisfied_signals);
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfiable_signals,
+              hss.satisfiable_signals);
+  }
+
+  // |WaitMany()|:
+  {
+    MojoHandle handles[2] = {MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID};
+    MojoHandleSignals signals[2] = {~MOJO_HANDLE_SIGNAL_NONE,
+                                    ~MOJO_HANDLE_SIGNAL_NONE};
+    EXPECT_EQ(
+        MOJO_RESULT_INVALID_ARGUMENT,
+        core()->WaitMany(handles, signals, 0, MOJO_DEADLINE_INDEFINITE,
+                         nullptr, nullptr));
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->WaitMany(nullptr, signals, 0, MOJO_DEADLINE_INDEFINITE,
+                               nullptr, nullptr));
+    // If |num_handles| is invalid, it should leave |result_index| and
+    // |signals_states| alone.
+    // (We use -1 internally; make sure that doesn't leak.)
+    uint32_t result_index = 123;
+    MojoHandleSignalsState hss = kFullMojoHandleSignalsState;
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->WaitMany(nullptr, signals, 0, MOJO_DEADLINE_INDEFINITE,
+                               &result_index, &hss));
+    EXPECT_EQ(123u, result_index);
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
+              hss.satisfied_signals);
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfiable_signals,
+              hss.satisfiable_signals);
+
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->WaitMany(handles, nullptr, 0, MOJO_DEADLINE_INDEFINITE,
+                               nullptr, nullptr));
+    EXPECT_EQ(
+        MOJO_RESULT_INVALID_ARGUMENT,
+        core()->WaitMany(handles, signals, 1, MOJO_DEADLINE_INDEFINITE, nullptr,
+                         nullptr));
+    // But if a handle is bad, then it should set |result_index| but still leave
+    // |signals_states| alone.
+    result_index = static_cast<uint32_t>(-1);
+    hss = kFullMojoHandleSignalsState;
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->WaitMany(
+                  handles, signals, 1, MOJO_DEADLINE_INDEFINITE, &result_index,
+                  &hss));
+    EXPECT_EQ(0u, result_index);
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
+              hss.satisfied_signals);
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfiable_signals,
+              hss.satisfiable_signals);
+
+    MockHandleInfo info[2];
+    handles[0] = CreateMockHandle(&info[0]);
+
+    result_index = static_cast<uint32_t>(-1);
+    hss = kFullMojoHandleSignalsState;
+    EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+              core()->WaitMany(
+                  handles, signals, 1, MOJO_DEADLINE_INDEFINITE, &result_index,
+                  &hss));
+    EXPECT_EQ(0u, result_index);
+    EXPECT_EQ(0u, hss.satisfied_signals);
+    EXPECT_EQ(0u, hss.satisfiable_signals);
+
+    // On invalid argument, it'll leave |signals_states| alone.
+    result_index = static_cast<uint32_t>(-1);
+    hss = kFullMojoHandleSignalsState;
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->WaitMany(
+                  handles, signals, 2, MOJO_DEADLINE_INDEFINITE, &result_index,
+                  &hss));
+    EXPECT_EQ(1u, result_index);
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfied_signals,
+              hss.satisfied_signals);
+    EXPECT_EQ(kFullMojoHandleSignalsState.satisfiable_signals,
+              hss.satisfiable_signals);
+    handles[1] = handles[0] + 1;  // Invalid handle.
+    EXPECT_EQ(
+        MOJO_RESULT_INVALID_ARGUMENT,
+        core()->WaitMany(handles, signals, 2, MOJO_DEADLINE_INDEFINITE, nullptr,
+                         nullptr));
+    handles[1] = CreateMockHandle(&info[1]);
+    EXPECT_EQ(
+        MOJO_RESULT_FAILED_PRECONDITION,
+        core()->WaitMany(handles, signals, 2, MOJO_DEADLINE_INDEFINITE, nullptr,
+                         nullptr));
+
+    // TODO(vtl): Test one where we get "failed precondition" only for the
+    // second handle (and the first one is valid to wait on).
+
+    EXPECT_EQ(MOJO_RESULT_OK, core()->Close(handles[0]));
+    EXPECT_EQ(MOJO_RESULT_OK, core()->Close(handles[1]));
+  }
+
+  // |CreateMessagePipe()|: Nothing to check (apart from things that cause
+  // death).
+
+  // |WriteMessage()|:
+  // Only check arguments checked by |Core|, namely |handle|, |handles|, and
+  // |num_handles|.
+  {
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              core()->WriteMessage(MOJO_HANDLE_INVALID, nullptr, 0,
+                                   nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+    MockHandleInfo info;
+    MojoHandle h = CreateMockHandle(&info);
+    MojoHandle handles[2] = {MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID};
+
+    // Huge handle count (implausibly big on some systems -- more than can be
+    // stored in a 32-bit address space).
+    // Note: This may return either |MOJO_RESULT_INVALID_ARGUMENT| or
+    // |MOJO_RESULT_RESOURCE_EXHAUSTED|, depending on whether it's plausible or
+    // not.
+    EXPECT_NE(
+        MOJO_RESULT_OK,
+        core()->WriteMessage(h, nullptr, 0, handles,
+                             std::numeric_limits<uint32_t>::max(),
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(0u, info.GetWriteMessageCallCount());
+
+    // Huge handle count (plausibly big).
+    EXPECT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
+              core()->WriteMessage(
+                  h, nullptr, 0, handles,
+                  std::numeric_limits<uint32_t>::max() / sizeof(handles[0]),
+                  MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(0u, info.GetWriteMessageCallCount());
+
+    // Invalid handle in |handles|.
+    EXPECT_EQ(
+        MOJO_RESULT_INVALID_ARGUMENT,
+        core()->WriteMessage(h, nullptr, 0, handles, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(0u, info.GetWriteMessageCallCount());
+
+    // Two invalid handles in |handles|.
+    EXPECT_EQ(
+        MOJO_RESULT_INVALID_ARGUMENT,
+        core()->WriteMessage(h, nullptr, 0, handles, 2,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(0u, info.GetWriteMessageCallCount());
+
+    // Can't send a handle over itself.
+    handles[0] = h;
+    EXPECT_EQ(
+        MOJO_RESULT_BUSY,
+        core()->WriteMessage(h, nullptr, 0, handles, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(0u, info.GetWriteMessageCallCount());
+
+    MockHandleInfo info2;
+    MojoHandle h2 = CreateMockHandle(&info2);
+
+    // This is "okay", but |MockDispatcher| doesn't implement it.
+    handles[0] = h2;
+    EXPECT_EQ(
+        MOJO_RESULT_UNIMPLEMENTED,
+        core()->WriteMessage(h, nullptr, 0, handles, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(1u, info.GetWriteMessageCallCount());
+
+    // One of the |handles| is still invalid.
+    EXPECT_EQ(
+        MOJO_RESULT_INVALID_ARGUMENT,
+        core()->WriteMessage(h, nullptr, 0, handles, 2,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(1u, info.GetWriteMessageCallCount());
+
+    // One of the |handles| is the same as |handle|.
+    handles[1] = h;
+    EXPECT_EQ(
+        MOJO_RESULT_BUSY,
+        core()->WriteMessage(h, nullptr, 0, handles, 2,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(1u, info.GetWriteMessageCallCount());
+
+    // Can't send a handle twice in the same message.
+    handles[1] = h2;
+    EXPECT_EQ(
+        MOJO_RESULT_BUSY,
+        core()->WriteMessage(h, nullptr, 0, handles, 2,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+    EXPECT_EQ(1u, info.GetWriteMessageCallCount());
+
+    // Note: Since we never successfully sent anything with it, |h2| should
+    // still be valid.
+    EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h2));
+
+    EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
+  }
+
+  // |ReadMessage()|:
+  // Only check arguments checked by |Core|, namely |handle|, |handles|, and
+  // |num_handles|.
+  {
+    EXPECT_EQ(
+        MOJO_RESULT_INVALID_ARGUMENT,
+        core()->ReadMessage(MOJO_HANDLE_INVALID, nullptr, nullptr, nullptr,
+                            nullptr, MOJO_READ_MESSAGE_FLAG_NONE));
+
+    MockHandleInfo info;
+    MojoHandle h = CreateMockHandle(&info);
+
+    // Okay.
+    uint32_t handle_count = 0;
+    EXPECT_EQ(MOJO_RESULT_OK,
+              core()->ReadMessage(
+                  h, nullptr, nullptr, nullptr, &handle_count,
+                  MOJO_READ_MESSAGE_FLAG_NONE));
+    // Checked by |Core|, shouldn't go through to the dispatcher.
+    EXPECT_EQ(1u, info.GetReadMessageCallCount());
+
+    EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
+  }
+}
+
+// These test invalid arguments that should cause death if we're being paranoid
+// about checking arguments (which we would want to do if, e.g., we were in a
+// true "kernel" situation, but we might not want to do otherwise for
+// performance reasons). Probably blatant errors like passing in null pointers
+// (for required pointer arguments) will still cause death, but perhaps not
+// predictably.
+TEST_F(CoreTest, InvalidArgumentsDeath) {
+  const char kMemoryCheckFailedRegex[] = "Check failed";
+
+  // |WaitMany()|:
+  {
+    MojoHandle handle = MOJO_HANDLE_INVALID;
+    MojoHandleSignals signals = ~MOJO_HANDLE_SIGNAL_NONE;
+    EXPECT_DEATH_IF_SUPPORTED(
+        core()->WaitMany(nullptr, &signals, 1, MOJO_DEADLINE_INDEFINITE,
+                         nullptr, nullptr),
+        kMemoryCheckFailedRegex);
+    EXPECT_DEATH_IF_SUPPORTED(
+        core()->WaitMany(&handle, nullptr, 1, MOJO_DEADLINE_INDEFINITE, nullptr,
+                         nullptr),
+        kMemoryCheckFailedRegex);
+    // TODO(vtl): |result_index| and |signals_states| are optional. Test them
+    // with non-null invalid pointers?
+  }
+
+  // |CreateMessagePipe()|:
+  {
+    MojoHandle h;
+    EXPECT_DEATH_IF_SUPPORTED(
+        core()->CreateMessagePipe(nullptr, nullptr, nullptr),
+        kMemoryCheckFailedRegex);
+    EXPECT_DEATH_IF_SUPPORTED(
+        core()->CreateMessagePipe(nullptr, &h, nullptr),
+        kMemoryCheckFailedRegex);
+    EXPECT_DEATH_IF_SUPPORTED(
+        core()->CreateMessagePipe(nullptr, nullptr, &h),
+        kMemoryCheckFailedRegex);
+  }
+
+  // |WriteMessage()|:
+  // Only check arguments checked by |Core|, namely |handle|, |handles|, and
+  // |num_handles|.
+  {
+    MockHandleInfo info;
+    MojoHandle h = CreateMockHandle(&info);
+
+    // Null |handles| with nonzero |num_handles|.
+    EXPECT_DEATH_IF_SUPPORTED(
+        core()->WriteMessage(h, nullptr, 0, nullptr, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE),
+        kMemoryCheckFailedRegex);
+
+    EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
+  }
+
+  // |ReadMessage()|:
+  // Only check arguments checked by |Core|, namely |handle|, |handles|, and
+  // |num_handles|.
+  {
+    MockHandleInfo info;
+    MojoHandle h = CreateMockHandle(&info);
+
+    uint32_t handle_count = 1;
+    EXPECT_DEATH_IF_SUPPORTED(
+        core()->ReadMessage(h, nullptr, nullptr, nullptr, &handle_count,
+                            MOJO_READ_MESSAGE_FLAG_NONE),
+        kMemoryCheckFailedRegex);
+
+    EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
+  }
+}
+
+// TODO(vtl): test |Wait()| and |WaitMany()| properly
+//  - including |WaitMany()| with the same handle more than once (with
+//    same/different signals)
+
+TEST_F(CoreTest, MessagePipe) {
+  MojoHandle h[2];
+  MojoHandleSignalsState hss[2];
+  uint32_t result_index;
+
+  EXPECT_EQ(MOJO_RESULT_OK, core()->CreateMessagePipe(nullptr, &h[0], &h[1]));
+  // Should get two distinct, valid handles.
+  EXPECT_NE(h[0], MOJO_HANDLE_INVALID);
+  EXPECT_NE(h[1], MOJO_HANDLE_INVALID);
+  EXPECT_NE(h[0], h[1]);
+
+  // Neither should be readable.
+  MojoHandleSignals signals[2] = {MOJO_HANDLE_SIGNAL_READABLE,
+                                  MOJO_HANDLE_SIGNAL_READABLE};
+  result_index = static_cast<uint32_t>(-1);
+  hss[0] = kEmptyMojoHandleSignalsState;
+  hss[1] = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_DEADLINE_EXCEEDED,
+      core()->WaitMany(h, signals, 2, 0, &result_index, hss));
+  EXPECT_EQ(static_cast<uint32_t>(-1), result_index);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[0].satisfiable_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[1].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[1].satisfiable_signals);
+
+  // Try to read anyway.
+  char buffer[1] = {'a'};
+  uint32_t buffer_size = 1;
+  EXPECT_EQ(
+      MOJO_RESULT_SHOULD_WAIT,
+      core()->ReadMessage(h[0], buffer, &buffer_size, nullptr, nullptr,
+                          MOJO_READ_MESSAGE_FLAG_NONE));
+  // Check that it left its inputs alone.
+  EXPECT_EQ('a', buffer[0]);
+  EXPECT_EQ(1u, buffer_size);
+
+  // Both should be writable.
+  hss[0] = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(h[0], MOJO_HANDLE_SIGNAL_WRITABLE,
+                                         1000000000, &hss[0]));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[0].satisfiable_signals);
+  hss[0] = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(h[1], MOJO_HANDLE_SIGNAL_WRITABLE,
+                                         1000000000, &hss[0]));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[0].satisfiable_signals);
+
+  // Also check that |h[1]| is writable using |WaitMany()|.
+  signals[0] = MOJO_HANDLE_SIGNAL_READABLE;
+  signals[1] = MOJO_HANDLE_SIGNAL_WRITABLE;
+  result_index = static_cast<uint32_t>(-1);
+  hss[0] = kEmptyMojoHandleSignalsState;
+  hss[1] = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_OK,
+      core()->WaitMany(h, signals, 2, MOJO_DEADLINE_INDEFINITE, &result_index,
+                       hss));
+  EXPECT_EQ(1u, result_index);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[0].satisfiable_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[1].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[1].satisfiable_signals);
+
+  // Write to |h[1]|.
+  buffer[0] = 'b';
+  EXPECT_EQ(
+      MOJO_RESULT_OK,
+      core()->WriteMessage(h[1], buffer, 1, nullptr, 0,
+                           MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Check that |h[0]| is now readable.
+  signals[0] = MOJO_HANDLE_SIGNAL_READABLE;
+  signals[1] = MOJO_HANDLE_SIGNAL_READABLE;
+  result_index = static_cast<uint32_t>(-1);
+  hss[0] = kEmptyMojoHandleSignalsState;
+  hss[1] = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_OK,
+      core()->WaitMany(h, signals, 2, MOJO_DEADLINE_INDEFINITE, &result_index,
+                       hss));
+  EXPECT_EQ(0u, result_index);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss[0].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[0].satisfiable_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[1].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[1].satisfiable_signals);
+
+  // Read from |h[0]|.
+  // First, get only the size.
+  buffer_size = 0;
+  EXPECT_EQ(
+      MOJO_RESULT_RESOURCE_EXHAUSTED,
+      core()->ReadMessage(h[0], nullptr, &buffer_size, nullptr, nullptr,
+                          MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(1u, buffer_size);
+  // Then actually read it.
+  buffer[0] = 'c';
+  buffer_size = 1;
+  EXPECT_EQ(
+      MOJO_RESULT_OK,
+      core()->ReadMessage(h[0], buffer, &buffer_size, nullptr, nullptr,
+                          MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ('b', buffer[0]);
+  EXPECT_EQ(1u, buffer_size);
+
+  // |h[0]| should no longer be readable.
+  hss[0] = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            core()->Wait(h[0], MOJO_HANDLE_SIGNAL_READABLE, 0, &hss[0]));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss[0].satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss[0].satisfiable_signals);
+
+  // Write to |h[0]|.
+  buffer[0] = 'd';
+  EXPECT_EQ(
+      MOJO_RESULT_OK,
+      core()->WriteMessage(h[0], buffer, 1, nullptr, 0,
+                           MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Close |h[0]|.
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h[0]));
+
+  // Wait for |h[1]| to learn about the other end's closure.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h[1], MOJO_HANDLE_SIGNAL_PEER_CLOSED, 1000000000,
+                         &hss[0]));
+
+  // Check that |h[1]| is no longer writable (and will never be).
+  hss[0] = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            core()->Wait(h[1], MOJO_HANDLE_SIGNAL_WRITABLE, 1000000000,
+                         &hss[0]));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss[0].satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss[0].satisfiable_signals);
+
+  // Check that |h[1]| is still readable (for the moment).
+  hss[0] = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(h[1], MOJO_HANDLE_SIGNAL_READABLE,
+                                         1000000000, &hss[0]));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss[0].satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss[0].satisfiable_signals);
+
+  // Discard a message from |h[1]|.
+  EXPECT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
+            core()->ReadMessage(h[1], nullptr, nullptr, nullptr, nullptr,
+                                MOJO_READ_MESSAGE_FLAG_MAY_DISCARD));
+
+  // |h[1]| is no longer readable (and will never be).
+  hss[0] = kFullMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            core()->Wait(h[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss[0]));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss[0].satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss[0].satisfiable_signals);
+
+  // Try writing to |h[1]|.
+  buffer[0] = 'e';
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->WriteMessage(h[1], buffer, 1, nullptr, 0,
+                           MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h[1]));
+}
+
+// Tests passing a message pipe handle.
+TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing1) {
+  const char kHello[] = "hello";
+  const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello));
+  const char kWorld[] = "world!!!";
+  const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld));
+  char buffer[100];
+  const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
+  uint32_t num_bytes;
+  MojoHandle handles[10];
+  uint32_t num_handles;
+  MojoHandleSignalsState hss;
+  MojoHandle h_received;
+
+  MojoHandle h_passing[2];
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->CreateMessagePipe(nullptr, &h_passing[0], &h_passing[1]));
+
+  // Make sure that |h_passing[]| work properly.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h_passing[0], kHello, kHelloSize, nullptr, 0,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(
+                h_passing[1], buffer, &num_bytes, handles, &num_handles,
+                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kHelloSize, num_bytes);
+  EXPECT_STREQ(kHello, buffer);
+  EXPECT_EQ(0u, num_handles);
+
+  // Make sure that you can't pass either of the message pipe's handles over
+  // itself.
+  EXPECT_EQ(MOJO_RESULT_BUSY,
+            core()->WriteMessage(h_passing[0], kHello, kHelloSize,
+                                 &h_passing[0], 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            core()->WriteMessage(h_passing[0], kHello, kHelloSize,
+                                 &h_passing[1], 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  MojoHandle h_passed[2];
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->CreateMessagePipe(nullptr, &h_passed[0], &h_passed[1]));
+
+  // Make sure that |h_passed[]| work properly.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h_passed[0], kHello, kHelloSize, nullptr, 0,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h_passed[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(
+                h_passed[1], buffer, &num_bytes, handles, &num_handles,
+                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kHelloSize, num_bytes);
+  EXPECT_STREQ(kHello, buffer);
+  EXPECT_EQ(0u, num_handles);
+
+  // Send |h_passed[1]| from |h_passing[0]| to |h_passing[1]|.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h_passing[0], kWorld, kWorldSize,
+                                 &h_passed[1], 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(
+                h_passing[1], buffer, &num_bytes, handles, &num_handles,
+                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kWorldSize, num_bytes);
+  EXPECT_STREQ(kWorld, buffer);
+  EXPECT_EQ(1u, num_handles);
+  h_received = handles[0];
+  EXPECT_NE(h_received, MOJO_HANDLE_INVALID);
+  EXPECT_NE(h_received, h_passing[0]);
+  EXPECT_NE(h_received, h_passing[1]);
+  EXPECT_NE(h_received, h_passed[0]);
+
+  // Note: We rely on the Mojo system not re-using handle values very often.
+  EXPECT_NE(h_received, h_passed[1]);
+
+  // |h_passed[1]| should no longer be valid; check that trying to close it
+  // fails. See above note.
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->Close(h_passed[1]));
+
+  // Write to |h_passed[0]|. Should receive on |h_received|.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h_passed[0], kHello, kHelloSize, nullptr, 0,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h_received, MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(
+                h_received, buffer, &num_bytes, handles, &num_handles,
+                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kHelloSize, num_bytes);
+  EXPECT_STREQ(kHello, buffer);
+  EXPECT_EQ(0u, num_handles);
+
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passing[0]));
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passing[1]));
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passed[0]));
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_received));
+}
+
+TEST_F(CoreTest, DataPipe) {
+  MojoHandle ph, ch;  // p is for producer and c is for consumer.
+  MojoHandleSignalsState hss;
+
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->CreateDataPipe(nullptr, &ph, &ch));
+  // Should get two distinct, valid handles.
+  EXPECT_NE(ph, MOJO_HANDLE_INVALID);
+  EXPECT_NE(ch, MOJO_HANDLE_INVALID);
+  EXPECT_NE(ph, ch);
+
+  // Producer should be never-readable, but already writable.
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->Wait(ph, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(ph, MOJO_HANDLE_SIGNAL_WRITABLE, 0,
+                                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Consumer should be never-writable, and not yet readable.
+  hss = kFullMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->Wait(ch, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss));
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+  hss = kFullMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_DEADLINE_EXCEEDED,
+      core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Write.
+  signed char elements[2] = {'A', 'B'};
+  uint32_t num_bytes = 2u;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteData(ph, elements, &num_bytes,
+                              MOJO_WRITE_DATA_FLAG_NONE));
+  EXPECT_EQ(2u, num_bytes);
+
+  // Wait for the data to arrive to the consumer.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 1000000000, &hss));
+
+  // Consumer should now be readable.
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 0,
+                                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Peek one character.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = 1u;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadData(
+                ch, elements, &num_bytes,
+                MOJO_READ_DATA_FLAG_NONE | MOJO_READ_DATA_FLAG_PEEK));
+  EXPECT_EQ('A', elements[0]);
+  EXPECT_EQ(-1, elements[1]);
+
+  // Read one character.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = 1u;
+  EXPECT_EQ(MOJO_RESULT_OK, core()->ReadData(ch, elements, &num_bytes,
+                                             MOJO_READ_DATA_FLAG_NONE));
+  EXPECT_EQ('A', elements[0]);
+  EXPECT_EQ(-1, elements[1]);
+
+  // Two-phase write.
+  void* write_ptr = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            core()->BeginWriteData(ph, &write_ptr, &num_bytes,
+                                   MOJO_WRITE_DATA_FLAG_NONE));
+  // We count on the default options providing a decent buffer size.
+  ASSERT_GE(num_bytes, 3u);
+
+  // Trying to do a normal write during a two-phase write should fail.
+  elements[0] = 'X';
+  num_bytes = 1u;
+  EXPECT_EQ(MOJO_RESULT_BUSY,
+            core()->WriteData(ph, elements, &num_bytes,
+                              MOJO_WRITE_DATA_FLAG_NONE));
+
+  // Actually write the data, and complete it now.
+  static_cast<char*>(write_ptr)[0] = 'C';
+  static_cast<char*>(write_ptr)[1] = 'D';
+  static_cast<char*>(write_ptr)[2] = 'E';
+  EXPECT_EQ(MOJO_RESULT_OK, core()->EndWriteData(ph, 3u));
+
+  // Wait for the data to arrive to the consumer.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 1000000000, &hss));
+
+  // Query how much data we have.
+  num_bytes = 0;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadData(ch, nullptr, &num_bytes,
+                             MOJO_READ_DATA_FLAG_QUERY));
+  EXPECT_GE(num_bytes, 1u);
+
+  // Try to query with peek. Should fail.
+  num_bytes = 0;
+  EXPECT_EQ(
+      MOJO_RESULT_INVALID_ARGUMENT,
+      core()->ReadData(ch, nullptr, &num_bytes,
+                       MOJO_READ_DATA_FLAG_QUERY | MOJO_READ_DATA_FLAG_PEEK));
+  EXPECT_EQ(0u, num_bytes);
+
+  // Try to discard ten characters, in all-or-none mode. Should fail.
+  num_bytes = 10;
+  EXPECT_EQ(MOJO_RESULT_OUT_OF_RANGE,
+            core()->ReadData(
+                ch, nullptr, &num_bytes,
+                MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_ALL_OR_NONE));
+
+  // Try to discard two characters, in peek mode. Should fail.
+  num_bytes = 2;
+  EXPECT_EQ(
+      MOJO_RESULT_INVALID_ARGUMENT,
+      core()->ReadData(ch, nullptr, &num_bytes,
+                       MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_PEEK));
+
+  // Discard a character.
+  num_bytes = 1;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadData(
+                ch, nullptr, &num_bytes,
+                MOJO_READ_DATA_FLAG_DISCARD | MOJO_READ_DATA_FLAG_ALL_OR_NONE));
+
+  // Ensure the 3 bytes were read.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 1000000000, &hss));
+
+  // Try a two-phase read of the remaining three bytes with peek. Should fail.
+  const void* read_ptr = nullptr;
+  num_bytes = 3;
+  ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            core()->BeginReadData(ch, &read_ptr, &num_bytes,
+                                  MOJO_READ_DATA_FLAG_PEEK));
+
+  // Read the remaining two characters, in two-phase mode (all-or-none).
+  num_bytes = 3;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            core()->BeginReadData(ch, &read_ptr, &num_bytes,
+                                  MOJO_READ_DATA_FLAG_ALL_OR_NONE));
+  // Note: Count on still being able to do the contiguous read here.
+  ASSERT_EQ(3u, num_bytes);
+
+  // Discarding right now should fail.
+  num_bytes = 1;
+  EXPECT_EQ(MOJO_RESULT_BUSY,
+            core()->ReadData(ch, nullptr, &num_bytes,
+                             MOJO_READ_DATA_FLAG_DISCARD));
+
+  // Actually check our data and end the two-phase read.
+  EXPECT_EQ('C', static_cast<const char*>(read_ptr)[0]);
+  EXPECT_EQ('D', static_cast<const char*>(read_ptr)[1]);
+  EXPECT_EQ('E', static_cast<const char*>(read_ptr)[2]);
+  EXPECT_EQ(MOJO_RESULT_OK, core()->EndReadData(ch, 3u));
+
+  // Consumer should now be no longer readable.
+  hss = kFullMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_DEADLINE_EXCEEDED,
+      core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // TODO(vtl): More.
+
+  // Close the producer.
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ph));
+
+  // Wait for this to get to the consumer.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(ch, MOJO_HANDLE_SIGNAL_PEER_CLOSED, 1000000000, &hss));
+
+  // The consumer should now be never-readable.
+  hss = kFullMojoHandleSignalsState;
+  EXPECT_EQ(
+      MOJO_RESULT_FAILED_PRECONDITION,
+      core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ch));
+}
+
+// Tests passing data pipe producer and consumer handles.
+TEST_F(CoreTest, MessagePipeBasicLocalHandlePassing2) {
+  const char kHello[] = "hello";
+  const uint32_t kHelloSize = static_cast<uint32_t>(sizeof(kHello));
+  const char kWorld[] = "world!!!";
+  const uint32_t kWorldSize = static_cast<uint32_t>(sizeof(kWorld));
+  char buffer[100];
+  const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
+  uint32_t num_bytes;
+  MojoHandle handles[10];
+  uint32_t num_handles;
+  MojoHandleSignalsState hss;
+
+  MojoHandle h_passing[2];
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->CreateMessagePipe(nullptr, &h_passing[0], &h_passing[1]));
+
+  MojoHandle ph, ch;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->CreateDataPipe(nullptr, &ph, &ch));
+
+  // Send |ch| from |h_passing[0]| to |h_passing[1]|.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h_passing[0], kHello, kHelloSize, &ch, 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(
+                h_passing[1], buffer, &num_bytes, handles, &num_handles,
+                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kHelloSize, num_bytes);
+  EXPECT_STREQ(kHello, buffer);
+  EXPECT_EQ(1u, num_handles);
+  MojoHandle ch_received = handles[0];
+  EXPECT_NE(ch_received, MOJO_HANDLE_INVALID);
+  EXPECT_NE(ch_received, h_passing[0]);
+  EXPECT_NE(ch_received, h_passing[1]);
+  EXPECT_NE(ch_received, ph);
+
+  // Note: We rely on the Mojo system not re-using handle values very often.
+  EXPECT_NE(ch_received, ch);
+
+  // |ch| should no longer be valid; check that trying to close it fails. See
+  // above note.
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->Close(ch));
+
+  // Write to |ph|. Should receive on |ch_received|.
+  num_bytes = kWorldSize;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteData(ph, kWorld, &num_bytes,
+                              MOJO_WRITE_DATA_FLAG_ALL_OR_NONE));
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(ch_received, MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadData(ch_received, buffer, &num_bytes,
+                             MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kWorldSize, num_bytes);
+  EXPECT_STREQ(kWorld, buffer);
+
+  // Now pass |ph| in the same direction.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h_passing[0], kWorld, kWorldSize, &ph, 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(
+                h_passing[1], buffer, &num_bytes, handles, &num_handles,
+                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kWorldSize, num_bytes);
+  EXPECT_STREQ(kWorld, buffer);
+  EXPECT_EQ(1u, num_handles);
+  MojoHandle ph_received = handles[0];
+  EXPECT_NE(ph_received, MOJO_HANDLE_INVALID);
+  EXPECT_NE(ph_received, h_passing[0]);
+  EXPECT_NE(ph_received, h_passing[1]);
+  EXPECT_NE(ph_received, ch_received);
+
+  // Again, rely on the Mojo system not re-using handle values very often.
+  EXPECT_NE(ph_received, ph);
+
+  // |ph| should no longer be valid; check that trying to close it fails. See
+  // above note.
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, core()->Close(ph));
+
+  // Write to |ph_received|. Should receive on |ch_received|.
+  num_bytes = kHelloSize;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteData(ph_received, kHello, &num_bytes,
+                              MOJO_WRITE_DATA_FLAG_ALL_OR_NONE));
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(ch_received, MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadData(ch_received, buffer, &num_bytes,
+                             MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kHelloSize, num_bytes);
+  EXPECT_STREQ(kHello, buffer);
+
+  ph = ph_received;
+  ph_received = MOJO_HANDLE_INVALID;
+  ch = ch_received;
+  ch_received = MOJO_HANDLE_INVALID;
+
+  // Make sure that |ph| can't be sent if it's in a two-phase write.
+  void* write_ptr = nullptr;
+  num_bytes = 0;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            core()->BeginWriteData(ph, &write_ptr, &num_bytes,
+                                   MOJO_WRITE_DATA_FLAG_NONE));
+  ASSERT_GE(num_bytes, 1u);
+  EXPECT_EQ(MOJO_RESULT_BUSY,
+            core()->WriteMessage(h_passing[0], kHello, kHelloSize, &ph, 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // But |ch| can, even if |ph| is in a two-phase write.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h_passing[0], kHello, kHelloSize, &ch, 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  ch = MOJO_HANDLE_INVALID;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         nullptr));
+  num_bytes = kBufferSize;
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(
+                h_passing[1], buffer, &num_bytes, handles, &num_handles,
+                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kHelloSize, num_bytes);
+  EXPECT_STREQ(kHello, buffer);
+  EXPECT_EQ(1u, num_handles);
+  ch = handles[0];
+  EXPECT_NE(ch, MOJO_HANDLE_INVALID);
+
+  // Complete the two-phase write.
+  static_cast<char*>(write_ptr)[0] = 'x';
+  EXPECT_EQ(MOJO_RESULT_OK, core()->EndWriteData(ph, 1));
+
+  // Wait for |ch| to be readable.
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Wait(ch, MOJO_HANDLE_SIGNAL_READABLE,
+                                         1000000000, &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Make sure that |ch| can't be sent if it's in a two-phase read.
+  const void* read_ptr = nullptr;
+  num_bytes = 1;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            core()->BeginReadData(ch, &read_ptr, &num_bytes,
+                                  MOJO_READ_DATA_FLAG_ALL_OR_NONE));
+  EXPECT_EQ(MOJO_RESULT_BUSY,
+            core()->WriteMessage(h_passing[0], kHello, kHelloSize, &ch, 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // But |ph| can, even if |ch| is in a two-phase read.
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->WriteMessage(h_passing[0], kWorld, kWorldSize, &ph, 1,
+                                 MOJO_WRITE_MESSAGE_FLAG_NONE));
+  ph = MOJO_HANDLE_INVALID;
+  hss = kEmptyMojoHandleSignalsState;
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->Wait(h_passing[1], MOJO_HANDLE_SIGNAL_READABLE, 1000000000,
+                         &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  EXPECT_EQ(kAllSignals, hss.satisfiable_signals);
+  num_bytes = kBufferSize;
+  num_handles = MOJO_ARRAYSIZE(handles);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->ReadMessage(
+                h_passing[1], buffer, &num_bytes, handles, &num_handles,
+                MOJO_READ_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(kWorldSize, num_bytes);
+  EXPECT_STREQ(kWorld, buffer);
+  EXPECT_EQ(1u, num_handles);
+  ph = handles[0];
+  EXPECT_NE(ph, MOJO_HANDLE_INVALID);
+
+  // Complete the two-phase read.
+  EXPECT_EQ('x', static_cast<const char*>(read_ptr)[0]);
+  EXPECT_EQ(MOJO_RESULT_OK, core()->EndReadData(ch, 1));
+
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passing[0]));
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h_passing[1]));
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ph));
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(ch));
+}
+
+struct TestAsyncWaiter {
+  TestAsyncWaiter() : result(MOJO_RESULT_UNKNOWN) {}
+
+  void Awake(MojoResult r) { result = r; }
+
+  MojoResult result;
+};
+
+TEST_F(CoreTest, AsyncWait) {
+  TestAsyncWaiter waiter;
+  MockHandleInfo info;
+  MojoHandle h = CreateMockHandle(&info);
+
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            core()->AsyncWait(h, MOJO_HANDLE_SIGNAL_READABLE,
+                              base::Bind(&TestAsyncWaiter::Awake,
+                                         base::Unretained(&waiter))));
+  EXPECT_EQ(0u, info.GetAddedAwakableSize());
+
+  info.AllowAddAwakable(true);
+  EXPECT_EQ(MOJO_RESULT_OK,
+            core()->AsyncWait(h, MOJO_HANDLE_SIGNAL_READABLE,
+                              base::Bind(&TestAsyncWaiter::Awake,
+                                         base::Unretained(&waiter))));
+  EXPECT_EQ(1u, info.GetAddedAwakableSize());
+
+  EXPECT_FALSE(info.GetAddedAwakableAt(0)->Awake(MOJO_RESULT_BUSY, 0));
+  EXPECT_EQ(MOJO_RESULT_BUSY, waiter.result);
+
+  EXPECT_EQ(MOJO_RESULT_OK, core()->Close(h));
+}
+
+// TODO(vtl): Test |DuplicateBufferHandle()| and |MapBuffer()|.
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/data_pipe.cc b/mojo/edk/system/data_pipe.cc
new file mode 100644
index 0000000..ce04bf9
--- /dev/null
+++ b/mojo/edk/system/data_pipe.cc
@@ -0,0 +1,203 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/data_pipe.h"
+
+#include <string.h>
+
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/options_validation.h"
+#include "mojo/edk/system/raw_channel.h"
+#include "mojo/edk/system/transport_data.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+const size_t kInvalidDataPipeHandleIndex = static_cast<size_t>(-1);
+
+struct MOJO_ALIGNAS(8) SerializedDataPipeHandleDispatcher {
+  size_t platform_handle_index;  // (Or |kInvalidDataPipeHandleIndex|.)
+
+  // These are from MojoCreateDataPipeOptions
+  MojoCreateDataPipeOptionsFlags flags;
+  uint32_t element_num_bytes;
+  uint32_t capacity_num_bytes;
+
+  size_t shared_memory_handle_index;  // (Or |kInvalidDataPipeHandleIndex|.)
+  uint32_t shared_memory_size;
+};
+
+}  // namespace
+
+MojoCreateDataPipeOptions DataPipe::GetDefaultCreateOptions() {
+  MojoCreateDataPipeOptions result = {
+      static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions)),
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,
+      1u,
+      static_cast<uint32_t>(
+          GetConfiguration().default_data_pipe_capacity_bytes)};
+  return result;
+}
+
+MojoResult DataPipe::ValidateCreateOptions(
+    const MojoCreateDataPipeOptions* in_options,
+    MojoCreateDataPipeOptions* out_options) {
+  const MojoCreateDataPipeOptionsFlags kKnownFlags =
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE;
+
+  *out_options = GetDefaultCreateOptions();
+  if (!in_options)
+    return MOJO_RESULT_OK;
+
+  UserOptionsReader<MojoCreateDataPipeOptions> reader(in_options);
+  if (!reader.is_valid())
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  if (!OPTIONS_STRUCT_HAS_MEMBER(MojoCreateDataPipeOptions, flags, reader))
+    return MOJO_RESULT_OK;
+  if ((reader.options().flags & ~kKnownFlags))
+    return MOJO_RESULT_UNIMPLEMENTED;
+  out_options->flags = reader.options().flags;
+
+  // Checks for fields beyond |flags|:
+
+  if (!OPTIONS_STRUCT_HAS_MEMBER(MojoCreateDataPipeOptions, element_num_bytes,
+                                 reader))
+    return MOJO_RESULT_OK;
+  if (reader.options().element_num_bytes == 0)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  out_options->element_num_bytes = reader.options().element_num_bytes;
+
+  if (!OPTIONS_STRUCT_HAS_MEMBER(MojoCreateDataPipeOptions, capacity_num_bytes,
+                                 reader) ||
+      reader.options().capacity_num_bytes == 0) {
+    // Round the default capacity down to a multiple of the element size (but at
+    // least one element).
+    size_t default_data_pipe_capacity_bytes =
+        GetConfiguration().default_data_pipe_capacity_bytes;
+    out_options->capacity_num_bytes =
+        std::max(static_cast<uint32_t>(default_data_pipe_capacity_bytes -
+                                       (default_data_pipe_capacity_bytes %
+                                        out_options->element_num_bytes)),
+                 out_options->element_num_bytes);
+    return MOJO_RESULT_OK;
+  }
+  if (reader.options().capacity_num_bytes % out_options->element_num_bytes != 0)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  if (reader.options().capacity_num_bytes >
+      GetConfiguration().max_data_pipe_capacity_bytes)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+  out_options->capacity_num_bytes = reader.options().capacity_num_bytes;
+
+  return MOJO_RESULT_OK;
+}
+
+void DataPipe::StartSerialize(bool have_channel_handle,
+                              bool have_shared_memory,
+                              size_t* max_size,
+                              size_t* max_platform_handles) {
+  *max_size = sizeof(SerializedDataPipeHandleDispatcher);
+  *max_platform_handles = 0;
+  if (have_channel_handle)
+    (*max_platform_handles)++;
+  if (have_shared_memory)
+    (*max_platform_handles)++;
+  DCHECK_LE(*max_size, TransportData::kMaxSerializedDispatcherSize);
+}
+
+void DataPipe::EndSerialize(const MojoCreateDataPipeOptions& options,
+                            ScopedPlatformHandle channel_handle,
+                            ScopedPlatformHandle shared_memory_handle,
+                            size_t shared_memory_size,
+                            void* destination,
+                            size_t* actual_size,
+                            PlatformHandleVector* platform_handles) {
+  SerializedDataPipeHandleDispatcher* serialization =
+      static_cast<SerializedDataPipeHandleDispatcher*>(destination);
+  if (channel_handle.is_valid()) {
+    serialization->platform_handle_index = platform_handles->size();
+    platform_handles->push_back(channel_handle.release());
+  } else {
+    serialization->platform_handle_index = kInvalidDataPipeHandleIndex;
+  }
+
+  serialization->flags = options.flags;
+  serialization->element_num_bytes = options.element_num_bytes;
+  serialization->capacity_num_bytes = options.capacity_num_bytes;
+
+  serialization->shared_memory_size = static_cast<uint32_t>(shared_memory_size);
+  if (serialization->shared_memory_size) {
+    serialization->shared_memory_handle_index = platform_handles->size();
+    platform_handles->push_back(shared_memory_handle.release());
+  }
+
+  *actual_size = sizeof(SerializedDataPipeHandleDispatcher);
+}
+
+ScopedPlatformHandle DataPipe::Deserialize(
+    const void* source,
+    size_t size,
+    PlatformHandleVector* platform_handles,
+    MojoCreateDataPipeOptions* options,
+    ScopedPlatformHandle* shared_memory_handle,
+    size_t* shared_memory_size) {
+  if (size != sizeof(SerializedDataPipeHandleDispatcher)) {
+    LOG(ERROR) << "Invalid serialized platform handle dispatcher (bad size)";
+    return ScopedPlatformHandle();
+  }
+
+  const SerializedDataPipeHandleDispatcher* serialization =
+      static_cast<const SerializedDataPipeHandleDispatcher*>(source);
+  size_t platform_handle_index = serialization->platform_handle_index;
+
+  // Starts off invalid, which is what we want.
+  PlatformHandle platform_handle;
+  if (platform_handle_index != kInvalidDataPipeHandleIndex) {
+    if (!platform_handles ||
+        platform_handle_index >= platform_handles->size()) {
+      LOG(ERROR)
+          << "Invalid serialized platform handle dispatcher (missing handles)";
+      return ScopedPlatformHandle();
+    }
+
+    // We take ownership of the handle, so we have to invalidate the one in
+    // |platform_handles|.
+    std::swap(platform_handle, (*platform_handles)[platform_handle_index]);
+  }
+
+  options->struct_size = sizeof(MojoCreateDataPipeOptions);
+  options->flags = serialization->flags;
+  options->element_num_bytes = serialization->element_num_bytes;
+  options->capacity_num_bytes = serialization->capacity_num_bytes;
+
+  if (shared_memory_size) {
+    *shared_memory_size = serialization->shared_memory_size;
+    if (*shared_memory_size) {
+      DCHECK(serialization->shared_memory_handle_index !=
+             kInvalidDataPipeHandleIndex);
+      if (!serialization->shared_memory_handle_index ||
+          serialization->shared_memory_handle_index >=
+              platform_handles->size()) {
+        LOG(ERROR) << "Invalid serialized platform handle dispatcher "
+                   << "(missing handles)";
+        return ScopedPlatformHandle();
+      }
+
+      PlatformHandle temp_shared_memory_handle;
+      std::swap(temp_shared_memory_handle,
+                (*platform_handles)[serialization->shared_memory_handle_index]);
+      *shared_memory_handle =
+          ScopedPlatformHandle(temp_shared_memory_handle);
+    }
+  }
+
+  size -= sizeof(SerializedDataPipeHandleDispatcher);
+
+  return ScopedPlatformHandle(platform_handle);
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/data_pipe.h b/mojo/edk/system/data_pipe.h
new file mode 100644
index 0000000..f17416b
--- /dev/null
+++ b/mojo/edk/system/data_pipe.h
@@ -0,0 +1,63 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_DATA_PIPE_H_
+#define MOJO_EDK_SYSTEM_DATA_PIPE_H_
+
+#include "base/compiler_specific.h"
+#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/data_pipe.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+class RawChannel;
+
+// Shared code between DataPipeConsumerDispatcher and
+// DataPipeProducerDispatcher.
+class MOJO_SYSTEM_IMPL_EXPORT DataPipe {
+ public:
+  // The default options for |MojoCreateDataPipe()|. (Real uses should obtain
+  // this via |ValidateCreateOptions()| with a null |in_options|; this is
+  // exposed directly for testing convenience.)
+  static MojoCreateDataPipeOptions GetDefaultCreateOptions();
+
+  // Validates and/or sets default options for |MojoCreateDataPipeOptions|. If
+  // non-null, |in_options| must point to a struct of at least
+  // |in_options->struct_size| bytes. |out_options| must point to a (current)
+  // |MojoCreateDataPipeOptions| and will be entirely overwritten on success (it
+  // may be partly overwritten on failure).
+  static MojoResult ValidateCreateOptions(
+      const MojoCreateDataPipeOptions* in_options,
+      MojoCreateDataPipeOptions* out_options);
+
+  // Helper methods used by DataPipeConsumerDispatcher and
+  // DataPipeProducerDispatcher for serialization and deserialization.
+  static void StartSerialize(bool have_channel_handle,
+                             bool have_shared_memory,
+                             size_t* max_size,
+                             size_t* max_platform_handles);
+  static void EndSerialize(const MojoCreateDataPipeOptions& options,
+                           ScopedPlatformHandle channel_handle,
+                           ScopedPlatformHandle shared_memory_handle,
+                           size_t shared_memory_size,
+                           void* destination,
+                           size_t* actual_size,
+                           PlatformHandleVector* platform_handles);
+  static ScopedPlatformHandle Deserialize(
+      const void* source,
+      size_t size,
+      PlatformHandleVector* platform_handles,
+      MojoCreateDataPipeOptions* options,
+      ScopedPlatformHandle* shared_memory_handle,
+      size_t* shared_memory_size);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_DATA_PIPE_H_
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.cc b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
new file mode 100644
index 0000000..1cf4367
--- /dev/null
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.cc
@@ -0,0 +1,474 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
+
+#include <algorithm>
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/embedder/platform_support.h"
+#include "mojo/edk/system/data_pipe.h"
+
+namespace mojo {
+namespace edk {
+
+struct SharedMemoryHeader {
+  uint32_t data_size;
+  uint32_t read_buffer_size;
+};
+
+void DataPipeConsumerDispatcher::Init(ScopedPlatformHandle message_pipe) {
+  if (message_pipe.is_valid()) {
+    channel_ = RawChannel::Create(message_pipe.Pass());
+    if (!serialized_read_buffer_.empty())
+      channel_->SetInitialReadBufferData(
+          &serialized_read_buffer_[0], serialized_read_buffer_.size());
+    serialized_read_buffer_.clear();
+    internal::g_io_thread_task_runner->PostTask(
+        FROM_HERE, base::Bind(&DataPipeConsumerDispatcher::InitOnIO, this));
+  }
+}
+
+void DataPipeConsumerDispatcher::InitOnIO() {
+  base::AutoLock locker(lock());
+  calling_init_ = true;
+  if (channel_)
+    channel_->Init(this);
+  calling_init_ = false;
+}
+
+void DataPipeConsumerDispatcher::CloseOnIO() {
+  base::AutoLock locker(lock());
+  if (channel_) {
+    channel_->Shutdown();
+    channel_ = nullptr;
+  }
+}
+
+Dispatcher::Type DataPipeConsumerDispatcher::GetType() const {
+  return Type::DATA_PIPE_CONSUMER;
+}
+
+scoped_refptr<DataPipeConsumerDispatcher>
+DataPipeConsumerDispatcher::Deserialize(
+    const void* source,
+    size_t size,
+    PlatformHandleVector* platform_handles) {
+  MojoCreateDataPipeOptions options;
+  ScopedPlatformHandle shared_memory_handle;
+  size_t shared_memory_size = 0;
+
+  ScopedPlatformHandle platform_handle =
+      DataPipe::Deserialize(source, size, platform_handles, &options,
+      &shared_memory_handle, &shared_memory_size);
+
+  scoped_refptr<DataPipeConsumerDispatcher> rv(Create(options));
+
+  if (shared_memory_size) {
+    scoped_refptr<PlatformSharedBuffer> shared_buffer(
+        internal::g_platform_support->CreateSharedBufferFromHandle(
+            shared_memory_size, shared_memory_handle.Pass()));;
+    scoped_ptr<PlatformSharedBufferMapping> mapping(
+        shared_buffer->Map(0, shared_memory_size));
+    char* buffer = static_cast<char*>(mapping->GetBase());
+    SharedMemoryHeader* header = reinterpret_cast<SharedMemoryHeader*>(buffer);
+    buffer += sizeof(SharedMemoryHeader);
+    if (header->data_size) {
+      rv->data_.resize(header->data_size);
+      memcpy(&rv->data_[0], buffer, header->data_size);
+      buffer += header->data_size;
+    }
+    if (header->read_buffer_size) {
+      rv->serialized_read_buffer_.resize(header->read_buffer_size);
+      memcpy(&rv->serialized_read_buffer_[0], buffer, header->read_buffer_size);
+      buffer += header->read_buffer_size;
+    }
+
+  }
+
+  if (platform_handle.is_valid())
+    rv->Init(platform_handle.Pass());
+  return rv;
+}
+
+DataPipeConsumerDispatcher::DataPipeConsumerDispatcher(
+    const MojoCreateDataPipeOptions& options)
+    : options_(options),
+      channel_(nullptr),
+      calling_init_(false),
+      in_two_phase_read_(false),
+      two_phase_max_bytes_read_(0),
+      error_(false),
+      serialized_(false) {
+}
+
+DataPipeConsumerDispatcher::~DataPipeConsumerDispatcher() {
+  // |Close()|/|CloseImplNoLock()| should have taken care of the channel.
+  DCHECK(!channel_);
+}
+
+void DataPipeConsumerDispatcher::CancelAllAwakablesNoLock() {
+  lock().AssertAcquired();
+  awakable_list_.CancelAll();
+}
+
+void DataPipeConsumerDispatcher::CloseImplNoLock() {
+  lock().AssertAcquired();
+  internal::g_io_thread_task_runner->PostTask(
+      FROM_HERE, base::Bind(&DataPipeConsumerDispatcher::CloseOnIO, this));
+}
+
+scoped_refptr<Dispatcher>
+DataPipeConsumerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
+  lock().AssertAcquired();
+
+  SerializeInternal();
+
+  scoped_refptr<DataPipeConsumerDispatcher> rv = Create(options_);
+  rv->channel_ = channel_;
+  channel_ = nullptr;
+  rv->options_ = options_;
+  data_.swap(rv->data_);
+  serialized_read_buffer_.swap(rv->serialized_read_buffer_);
+  rv->serialized_platform_handle_ = serialized_platform_handle_.Pass();
+  rv->serialized_ = true;
+
+  return scoped_refptr<Dispatcher>(rv.get());
+}
+
+MojoResult DataPipeConsumerDispatcher::ReadDataImplNoLock(
+    void* elements,
+    uint32_t* num_bytes,
+    MojoReadDataFlags flags) {
+  lock().AssertAcquired();
+  if (in_two_phase_read_)
+    return MOJO_RESULT_BUSY;
+
+  if ((flags & MOJO_READ_DATA_FLAG_QUERY)) {
+    if ((flags & MOJO_READ_DATA_FLAG_PEEK) ||
+        (flags & MOJO_READ_DATA_FLAG_DISCARD))
+      return MOJO_RESULT_INVALID_ARGUMENT;
+    DCHECK(!(flags & MOJO_READ_DATA_FLAG_DISCARD));  // Handled above.
+    DVLOG_IF(2, elements)
+        << "Query mode: ignoring non-null |elements|";
+    *num_bytes = static_cast<uint32_t>(data_.size());
+    return MOJO_RESULT_OK;
+  }
+
+  bool discard = false;
+  if ((flags & MOJO_READ_DATA_FLAG_DISCARD)) {
+    // These flags are mutally exclusive.
+    if (flags & MOJO_READ_DATA_FLAG_PEEK)
+      return MOJO_RESULT_INVALID_ARGUMENT;
+    DVLOG_IF(2, elements)
+        << "Discard mode: ignoring non-null |elements|";
+    discard = true;
+  }
+
+  uint32_t max_num_bytes_to_read = *num_bytes;
+  if (max_num_bytes_to_read % options_.element_num_bytes != 0)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  bool all_or_none = flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE;
+  uint32_t min_num_bytes_to_read =
+      all_or_none ? max_num_bytes_to_read : 0;
+
+  if (min_num_bytes_to_read > data_.size())
+    return error_ ? MOJO_RESULT_FAILED_PRECONDITION : MOJO_RESULT_OUT_OF_RANGE;
+
+  uint32_t bytes_to_read = std::min(max_num_bytes_to_read,
+                                    static_cast<uint32_t>(data_.size()));
+  if (bytes_to_read == 0)
+    return error_ ? MOJO_RESULT_FAILED_PRECONDITION : MOJO_RESULT_SHOULD_WAIT;
+
+  if (!discard)
+    memcpy(elements, &data_[0], bytes_to_read);
+  *num_bytes = bytes_to_read;
+
+  bool peek = !!(flags & MOJO_READ_DATA_FLAG_PEEK);
+  if (discard || !peek)
+    data_.erase(data_.begin(), data_.begin() + bytes_to_read);
+
+  return MOJO_RESULT_OK;
+}
+
+MojoResult DataPipeConsumerDispatcher::BeginReadDataImplNoLock(
+    const void** buffer,
+    uint32_t* buffer_num_bytes,
+    MojoReadDataFlags flags) {
+  lock().AssertAcquired();
+  if (in_two_phase_read_)
+    return MOJO_RESULT_BUSY;
+
+  // These flags may not be used in two-phase mode.
+  if ((flags & MOJO_READ_DATA_FLAG_DISCARD) ||
+      (flags & MOJO_READ_DATA_FLAG_QUERY) ||
+      (flags & MOJO_READ_DATA_FLAG_PEEK))
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  bool all_or_none = flags & MOJO_READ_DATA_FLAG_ALL_OR_NONE;
+  uint32_t min_num_bytes_to_read = 0;
+  if (all_or_none) {
+    min_num_bytes_to_read = *buffer_num_bytes;
+    if (min_num_bytes_to_read % options_.element_num_bytes != 0)
+      return MOJO_RESULT_INVALID_ARGUMENT;
+  }
+
+  uint32_t max_num_bytes_to_read = static_cast<uint32_t>(data_.size());
+  if (min_num_bytes_to_read > max_num_bytes_to_read)
+    return error_ ? MOJO_RESULT_FAILED_PRECONDITION : MOJO_RESULT_OUT_OF_RANGE;
+  if (max_num_bytes_to_read == 0)
+    return error_ ? MOJO_RESULT_FAILED_PRECONDITION : MOJO_RESULT_SHOULD_WAIT;
+
+  in_two_phase_read_ = true;
+  *buffer = &data_[0];
+  *buffer_num_bytes = max_num_bytes_to_read;
+  two_phase_max_bytes_read_ = max_num_bytes_to_read;
+
+  return MOJO_RESULT_OK;
+}
+
+MojoResult DataPipeConsumerDispatcher::EndReadDataImplNoLock(
+    uint32_t num_bytes_read) {
+  lock().AssertAcquired();
+  if (!in_two_phase_read_)
+    return MOJO_RESULT_FAILED_PRECONDITION;
+
+  MojoResult rv;
+  if (num_bytes_read > two_phase_max_bytes_read_ ||
+      num_bytes_read % options_.element_num_bytes != 0) {
+    rv = MOJO_RESULT_INVALID_ARGUMENT;
+  } else {
+    rv = MOJO_RESULT_OK;
+    data_.erase(data_.begin(), data_.begin() + num_bytes_read);
+  }
+
+  in_two_phase_read_ = false;
+  two_phase_max_bytes_read_ = 0;
+
+  // If we're now readable, we *became* readable (since we weren't readable
+  // during the two-phase read), so awake consumer awakables.
+  HandleSignalsState new_state = GetHandleSignalsStateImplNoLock();
+  if (new_state.satisfies(MOJO_HANDLE_SIGNAL_READABLE))
+    awakable_list_.AwakeForStateChange(new_state);
+
+  return rv;
+}
+
+HandleSignalsState DataPipeConsumerDispatcher::GetHandleSignalsStateImplNoLock()
+    const {
+  lock().AssertAcquired();
+
+  HandleSignalsState rv;
+  if (!data_.empty()) {
+    if (!in_two_phase_read_)
+      rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_READABLE;
+    rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_READABLE;
+  } else if (!error_) {
+    rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_READABLE;
+  }
+
+  if (error_)
+    rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+  rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+  return rv;
+}
+
+MojoResult DataPipeConsumerDispatcher::AddAwakableImplNoLock(
+    Awakable* awakable,
+    MojoHandleSignals signals,
+    uint32_t context,
+    HandleSignalsState* signals_state) {
+  lock().AssertAcquired();
+  HandleSignalsState state = GetHandleSignalsStateImplNoLock();
+  if (state.satisfies(signals)) {
+    if (signals_state)
+      *signals_state = state;
+    return MOJO_RESULT_ALREADY_EXISTS;
+  }
+  if (!state.can_satisfy(signals)) {
+    if (signals_state)
+      *signals_state = state;
+    return MOJO_RESULT_FAILED_PRECONDITION;
+  }
+
+  awakable_list_.Add(awakable, signals, context);
+  return MOJO_RESULT_OK;
+}
+
+void DataPipeConsumerDispatcher::RemoveAwakableImplNoLock(
+    Awakable* awakable,
+    HandleSignalsState* signals_state) {
+  lock().AssertAcquired();
+  awakable_list_.Remove(awakable);
+  if (signals_state)
+    *signals_state = GetHandleSignalsStateImplNoLock();
+}
+
+void DataPipeConsumerDispatcher::StartSerializeImplNoLock(
+    size_t* max_size,
+    size_t* max_platform_handles) {
+  if (!serialized_) {
+    // Handles the case where we have messages read off RawChannel but not ready
+    // by MojoReadMessage.
+    SerializeInternal();
+  }
+
+  DataPipe::StartSerialize(serialized_platform_handle_.is_valid(),
+                           !data_.empty(),
+                           max_size, max_platform_handles);
+}
+
+bool DataPipeConsumerDispatcher::EndSerializeAndCloseImplNoLock(
+    void* destination,
+    size_t* actual_size,
+    PlatformHandleVector* platform_handles) {
+  ScopedPlatformHandle shared_memory_handle;
+  size_t shared_memory_size =  data_.size() + serialized_read_buffer_.size();
+  if (shared_memory_size) {
+    shared_memory_size += sizeof(SharedMemoryHeader);
+    SharedMemoryHeader header;
+    header.data_size = static_cast<uint32_t>(data_.size());
+    header.read_buffer_size =
+        static_cast<uint32_t>(serialized_read_buffer_.size());
+
+    scoped_refptr<PlatformSharedBuffer> shared_buffer(
+        internal::g_platform_support->CreateSharedBuffer(
+            shared_memory_size));
+    scoped_ptr<PlatformSharedBufferMapping> mapping(
+        shared_buffer->Map(0, shared_memory_size));
+
+    char* start = static_cast<char*>(mapping->GetBase());
+    memcpy(start, &header, sizeof(SharedMemoryHeader));
+    start += sizeof(SharedMemoryHeader);
+
+    if (!data_.empty()) {
+      memcpy(start, &data_[0], data_.size());
+      start += data_.size();
+    }
+
+    if (!serialized_read_buffer_.empty()) {
+      memcpy(start, &serialized_read_buffer_[0],
+             serialized_read_buffer_.size());
+      start += serialized_read_buffer_.size();
+    }
+
+    shared_memory_handle.reset(shared_buffer->PassPlatformHandle().release());
+  }
+
+  DataPipe::EndSerialize(
+      options_,
+      serialized_platform_handle_.Pass(),
+      shared_memory_handle.Pass(),
+      shared_memory_size, destination, actual_size,
+      platform_handles);
+  CloseImplNoLock();
+  return true;
+}
+
+void DataPipeConsumerDispatcher::TransportStarted() {
+  started_transport_.Acquire();
+}
+
+void DataPipeConsumerDispatcher::TransportEnded() {
+  started_transport_.Release();
+
+  base::AutoLock locker(lock());
+
+  // If transporting of DP failed, we might have got more data and didn't awake
+  // for.
+  // TODO(jam): should we care about only alerting if it was empty before
+  // TransportStarted?
+  if (!data_.empty())
+    awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+}
+
+bool DataPipeConsumerDispatcher::IsBusyNoLock() const {
+  lock().AssertAcquired();
+  return in_two_phase_read_;
+}
+
+void DataPipeConsumerDispatcher::OnReadMessage(
+    const MessageInTransit::View& message_view,
+    ScopedPlatformHandleVectorPtr platform_handles) {
+  scoped_ptr<MessageInTransit> message(new MessageInTransit(message_view));
+
+  if (started_transport_.Try()) {
+    // We're not in the middle of being sent.
+
+    // Can get synchronously called back in Init if there was initial data.
+    scoped_ptr<base::AutoLock> locker;
+    if (!calling_init_) {
+      locker.reset(new base::AutoLock(lock()));
+    }
+
+    size_t old_size = data_.size();
+    data_.resize(old_size + message->num_bytes());
+    memcpy(&data_[old_size], message->bytes(), message->num_bytes());
+    if (!old_size)
+      awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+    started_transport_.Release();
+  } else {
+    size_t old_size = data_.size();
+    data_.resize(old_size + message->num_bytes());
+    memcpy(&data_[old_size], message->bytes(), message->num_bytes());
+  }
+}
+
+void DataPipeConsumerDispatcher::OnError(Error error) {
+  switch (error) {
+    case ERROR_READ_SHUTDOWN:
+      // The other side was cleanly closed, so this isn't actually an error.
+      DVLOG(1) << "DataPipeConsumerDispatcher read error (shutdown)";
+      break;
+    case ERROR_READ_BROKEN:
+      LOG(ERROR) << "DataPipeConsumerDispatcher read error (connection broken)";
+      break;
+    case ERROR_READ_BAD_MESSAGE:
+      // Receiving a bad message means either a bug, data corruption, or
+      // malicious attack (probably due to some other bug).
+      LOG(ERROR) << "DataPipeConsumerDispatcher read error (received bad "
+                 << "message)";
+      break;
+    case ERROR_READ_UNKNOWN:
+      LOG(ERROR) << "DataPipeConsumerDispatcher read error (unknown)";
+      break;
+    case ERROR_WRITE:
+      LOG(ERROR) << "DataPipeConsumerDispatcher shouldn't write messages";
+      break;
+  }
+
+  error_ = true;
+  if (started_transport_.Try()) {
+    base::AutoLock locker(lock());
+    awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+    started_transport_.Release();
+
+    base::MessageLoop::current()->PostTask(
+        FROM_HERE,
+        base::Bind(&RawChannel::Shutdown, base::Unretained(channel_)));
+    channel_ = nullptr;
+  } else {
+    // We must be waiting to call ReleaseHandle. It will call Shutdown.
+  }
+}
+
+void DataPipeConsumerDispatcher::SerializeInternal() {
+  // need to stop watching handle immediately, even tho not on IO thread, so
+  // that other messages aren't read after this.
+  if (channel_) {
+    serialized_platform_handle_ =
+        channel_->ReleaseHandle(&serialized_read_buffer_);
+
+    channel_ = nullptr;
+    serialized_ = true;
+  }
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/data_pipe_consumer_dispatcher.h b/mojo/edk/system/data_pipe_consumer_dispatcher.h
new file mode 100644
index 0000000..76ca69e
--- /dev/null
+++ b/mojo/edk/system/data_pipe_consumer_dispatcher.h
@@ -0,0 +1,117 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_
+#define MOJO_EDK_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_
+
+#include "base/memory/ref_counted.h"
+#include "mojo/edk/system/awakable_list.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/raw_channel.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// This is the |Dispatcher| implementation for the consumer handle for data
+// pipes (created by the Mojo primitive |MojoCreateDataPipe()|). This class is
+// thread-safe.
+class MOJO_SYSTEM_IMPL_EXPORT DataPipeConsumerDispatcher final
+    : public Dispatcher, public RawChannel::Delegate {
+ public:
+  static scoped_refptr<DataPipeConsumerDispatcher> Create(
+      const MojoCreateDataPipeOptions& options) {
+    return make_scoped_refptr(new DataPipeConsumerDispatcher(options));
+  }
+
+  // Must be called before any other methods.
+  void Init(ScopedPlatformHandle message_pipe);
+
+  // |Dispatcher| public methods:
+  Type GetType() const override;
+
+  // The "opposite" of |SerializeAndClose()|. (Typically this is called by
+  // |Dispatcher::Deserialize()|.)
+  static scoped_refptr<DataPipeConsumerDispatcher>
+  Deserialize(const void* source,
+              size_t size,
+              PlatformHandleVector* platform_handles);
+
+ private:
+  DataPipeConsumerDispatcher(const MojoCreateDataPipeOptions& options);
+  ~DataPipeConsumerDispatcher() override;
+
+  void InitOnIO();
+  void CloseOnIO();
+
+  // |Dispatcher| protected methods:
+  void CancelAllAwakablesNoLock() override;
+  void CloseImplNoLock() override;
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
+      override;
+  MojoResult ReadDataImplNoLock(void* elements,
+                                uint32_t* num_bytes,
+                                MojoReadDataFlags flags) override;
+  MojoResult BeginReadDataImplNoLock(const void** buffer,
+                                     uint32_t* buffer_num_bytes,
+                                     MojoReadDataFlags flags) override;
+  MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read) override;
+  HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
+  MojoResult AddAwakableImplNoLock(Awakable* awakable,
+                                   MojoHandleSignals signals,
+                                   uint32_t context,
+                                   HandleSignalsState* signals_state) override;
+  void RemoveAwakableImplNoLock(Awakable* awakable,
+                                HandleSignalsState* signals_state) override;
+  void StartSerializeImplNoLock(size_t* max_size,
+                                size_t* max_platform_handles) override;
+  bool EndSerializeAndCloseImplNoLock(
+      void* destination,
+      size_t* actual_size,
+      PlatformHandleVector* platform_handles) override;
+  void TransportStarted() override;
+  void TransportEnded() override;
+  bool IsBusyNoLock() const override;
+
+  // |RawChannel::Delegate methods:
+  void OnReadMessage(
+    const MessageInTransit::View& message_view,
+    ScopedPlatformHandleVectorPtr platform_handles) override;
+  void OnError(Error error) override;
+
+  // See comment in MessagePipeDispatcher for this method.
+  void SerializeInternal();
+
+  MojoCreateDataPipeOptions options_;
+
+  // Protected by |lock()|:
+  RawChannel* channel_;  // This will be null if closed.
+
+  // Queue of incoming messages.
+  std::vector<char> data_;
+  AwakableList awakable_list_;
+
+  // If DispatcherTransport is created. Must be set before lock() is called to
+  // avoid deadlocks with RawChannel calling us.
+  base::Lock started_transport_;
+
+  bool calling_init_;
+
+  bool in_two_phase_read_;
+  uint32_t two_phase_max_bytes_read_;
+
+  bool error_;
+
+  bool serialized_;
+  std::vector<char> serialized_read_buffer_;
+  ScopedPlatformHandle serialized_platform_handle_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipeConsumerDispatcher);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_DATA_PIPE_CONSUMER_DISPATCHER_H_
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.cc b/mojo/edk/system/data_pipe_producer_dispatcher.cc
new file mode 100644
index 0000000..5da76d5
--- /dev/null
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.cc
@@ -0,0 +1,357 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/data_pipe_producer_dispatcher.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/data_pipe.h"
+
+namespace mojo {
+namespace edk {
+
+void DataPipeProducerDispatcher::Init(ScopedPlatformHandle message_pipe) {
+  if (message_pipe.is_valid()) {
+    channel_ = RawChannel::Create(message_pipe.Pass());
+    internal::g_io_thread_task_runner->PostTask(
+        FROM_HERE, base::Bind(&DataPipeProducerDispatcher::InitOnIO, this));
+  }
+}
+
+void DataPipeProducerDispatcher::InitOnIO() {
+  base::AutoLock locker(lock());
+  if (channel_)
+    channel_->Init(this);
+}
+
+void DataPipeProducerDispatcher::CloseOnIO() {
+  base::AutoLock locker(lock());
+  if (channel_) {
+    channel_->Shutdown();
+    channel_ = nullptr;
+  }
+}
+
+Dispatcher::Type DataPipeProducerDispatcher::GetType() const {
+  return Type::DATA_PIPE_PRODUCER;
+}
+
+scoped_refptr<DataPipeProducerDispatcher>
+DataPipeProducerDispatcher::Deserialize(
+    const void* source,
+    size_t size,
+    PlatformHandleVector* platform_handles) {
+  MojoCreateDataPipeOptions options;
+  ScopedPlatformHandle platform_handle =
+      DataPipe::Deserialize(source, size, platform_handles, &options,
+        nullptr, 0);
+
+  scoped_refptr<DataPipeProducerDispatcher> rv(Create(options));
+  if (platform_handle.is_valid())
+    rv->Init(platform_handle.Pass());
+  return rv;
+}
+
+DataPipeProducerDispatcher::DataPipeProducerDispatcher(
+    const MojoCreateDataPipeOptions& options)
+    : options_(options), channel_(nullptr), error_(false) {
+}
+
+DataPipeProducerDispatcher::~DataPipeProducerDispatcher() {
+  // |Close()|/|CloseImplNoLock()| should have taken care of the channel.
+  DCHECK(!channel_);
+}
+
+void DataPipeProducerDispatcher::CancelAllAwakablesNoLock() {
+  lock().AssertAcquired();
+  awakable_list_.CancelAll();
+}
+
+void DataPipeProducerDispatcher::CloseImplNoLock() {
+  lock().AssertAcquired();
+  internal::g_io_thread_task_runner->PostTask(
+      FROM_HERE, base::Bind(&DataPipeProducerDispatcher::CloseOnIO, this));
+}
+
+scoped_refptr<Dispatcher>
+DataPipeProducerDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
+  lock().AssertAcquired();
+
+  scoped_refptr<DataPipeProducerDispatcher> rv = Create(options_);
+  rv->channel_ = channel_;
+  channel_ = nullptr;
+  rv->options_ = options_;
+  return scoped_refptr<Dispatcher>(rv.get());
+}
+
+MojoResult DataPipeProducerDispatcher::WriteDataImplNoLock(
+    const void* elements,
+    uint32_t* num_bytes,
+    MojoWriteDataFlags flags) {
+  lock().AssertAcquired();
+  if (InTwoPhaseWrite())
+    return MOJO_RESULT_BUSY;
+  if (error_)
+    return MOJO_RESULT_FAILED_PRECONDITION;
+  if (*num_bytes % options_.element_num_bytes != 0)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  if (*num_bytes == 0)
+    return MOJO_RESULT_OK;  // Nothing to do.
+
+  // For now, we ignore options.capacity_num_bytes as a total of all pending
+  // writes (and just treat it per message). We will implement that later if
+  // we need to. All current uses want all their data to be sent, and it's not
+  // clear that this backpressure should be done at the mojo layer or at a
+  // higher application layer.
+  bool all_or_none = flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE;
+  uint32_t min_num_bytes_to_write = all_or_none ? *num_bytes : 0;
+  if (min_num_bytes_to_write > options_.capacity_num_bytes) {
+    // Don't return "should wait" since you can't wait for a specified amount of
+    // data.
+    return MOJO_RESULT_OUT_OF_RANGE;
+  }
+
+  uint32_t num_bytes_to_write =
+      std::min(*num_bytes, options_.capacity_num_bytes);
+  if (num_bytes_to_write == 0)
+    return MOJO_RESULT_SHOULD_WAIT;
+
+  HandleSignalsState old_state = GetHandleSignalsStateImplNoLock();
+
+  *num_bytes = num_bytes_to_write;
+  WriteDataIntoMessages(elements, num_bytes_to_write);
+
+  HandleSignalsState new_state = GetHandleSignalsStateImplNoLock();
+  if (!new_state.equals(old_state))
+    awakable_list_.AwakeForStateChange(new_state);
+  return MOJO_RESULT_OK;
+}
+
+MojoResult DataPipeProducerDispatcher::BeginWriteDataImplNoLock(
+    void** buffer,
+    uint32_t* buffer_num_bytes,
+    MojoWriteDataFlags flags) {
+  lock().AssertAcquired();
+  if (InTwoPhaseWrite())
+    return MOJO_RESULT_BUSY;
+  if (error_)
+    return MOJO_RESULT_FAILED_PRECONDITION;
+
+  bool all_or_none = flags & MOJO_WRITE_DATA_FLAG_ALL_OR_NONE;
+  uint32_t min_num_bytes_to_write = 0;
+  if (all_or_none) {
+    min_num_bytes_to_write = *buffer_num_bytes;
+    if (min_num_bytes_to_write % options_.element_num_bytes != 0)
+      return MOJO_RESULT_INVALID_ARGUMENT;
+    if (min_num_bytes_to_write > options_.capacity_num_bytes) {
+      // Don't return "should wait" since you can't wait for a specified amount
+      // of data.
+      return MOJO_RESULT_OUT_OF_RANGE;
+    }
+  }
+
+  // See comment in WriteDataImplNoLock about ignoring capacity_num_bytes.
+  if (*buffer_num_bytes == 0)
+    *buffer_num_bytes = options_.capacity_num_bytes;
+
+  two_phase_data_.resize(*buffer_num_bytes);
+  *buffer = &two_phase_data_[0];
+
+  // TODO: if buffer_num_bytes.Get() > GetConfiguration().max_message_num_bytes
+  // we can construct a MessageInTransit here. But then we need to make
+  // MessageInTransit support changing its data size later.
+
+  return MOJO_RESULT_OK;
+}
+
+MojoResult DataPipeProducerDispatcher::EndWriteDataImplNoLock(
+    uint32_t num_bytes_written) {
+  lock().AssertAcquired();
+  if (!InTwoPhaseWrite())
+    return MOJO_RESULT_FAILED_PRECONDITION;
+
+  // Note: Allow successful completion of the two-phase write even if the other
+  // side has been closed.
+  MojoResult rv = MOJO_RESULT_OK;
+  if (num_bytes_written > two_phase_data_.size() ||
+      num_bytes_written % options_.element_num_bytes != 0) {
+    rv = MOJO_RESULT_INVALID_ARGUMENT;
+  } else if (channel_) {
+    WriteDataIntoMessages(&two_phase_data_[0], num_bytes_written);
+  }
+
+  // Two-phase write ended even on failure.
+  two_phase_data_.clear();
+  // If we're now writable, we *became* writable (since we weren't writable
+  // during the two-phase write), so awake producer awakables.
+  HandleSignalsState new_state = GetHandleSignalsStateImplNoLock();
+  if (new_state.satisfies(MOJO_HANDLE_SIGNAL_WRITABLE))
+    awakable_list_.AwakeForStateChange(new_state);
+
+  return rv;
+}
+
+HandleSignalsState DataPipeProducerDispatcher::GetHandleSignalsStateImplNoLock()
+    const {
+  lock().AssertAcquired();
+
+  HandleSignalsState rv;
+  if (!error_) {
+    if (!InTwoPhaseWrite())
+      rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_WRITABLE;
+    rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_WRITABLE;
+  } else {
+    rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+  }
+  rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+  return rv;
+}
+
+MojoResult DataPipeProducerDispatcher::AddAwakableImplNoLock(
+    Awakable* awakable,
+    MojoHandleSignals signals,
+    uint32_t context,
+    HandleSignalsState* signals_state) {
+  lock().AssertAcquired();
+  HandleSignalsState state = GetHandleSignalsStateImplNoLock();
+  if (state.satisfies(signals)) {
+    if (signals_state)
+      *signals_state = state;
+    return MOJO_RESULT_ALREADY_EXISTS;
+  }
+  if (!state.can_satisfy(signals)) {
+    if (signals_state)
+      *signals_state = state;
+    return MOJO_RESULT_FAILED_PRECONDITION;
+  }
+
+  awakable_list_.Add(awakable, signals, context);
+  return MOJO_RESULT_OK;
+}
+
+void DataPipeProducerDispatcher::RemoveAwakableImplNoLock(
+    Awakable* awakable,
+    HandleSignalsState* signals_state) {
+  lock().AssertAcquired();
+  awakable_list_.Remove(awakable);
+  if (signals_state)
+    *signals_state = GetHandleSignalsStateImplNoLock();
+}
+
+void DataPipeProducerDispatcher::StartSerializeImplNoLock(
+    size_t* max_size,
+    size_t* max_platform_handles) {
+  DCHECK(HasOneRef());  // Only one ref => no need to take the lock.
+
+  if (channel_) {
+    std::vector<char> temp;
+    serialized_platform_handle_ = channel_->ReleaseHandle(&temp);
+    channel_ = nullptr;
+    DCHECK(temp.empty());
+  }
+  DataPipe::StartSerialize(serialized_platform_handle_.is_valid(),
+                           false, max_size, max_platform_handles);
+}
+
+bool DataPipeProducerDispatcher::EndSerializeAndCloseImplNoLock(
+    void* destination,
+    size_t* actual_size,
+    PlatformHandleVector* platform_handles) {
+  DCHECK(HasOneRef());  // Only one ref => no need to take the lock.
+
+  DataPipe::EndSerialize(
+      options_,
+      serialized_platform_handle_.Pass(),
+      ScopedPlatformHandle(), 0,
+      destination, actual_size, platform_handles);
+  CloseImplNoLock();
+  return true;
+}
+
+void DataPipeProducerDispatcher::TransportStarted() {
+  started_transport_.Acquire();
+}
+
+void DataPipeProducerDispatcher::TransportEnded() {
+  started_transport_.Release();
+}
+
+bool DataPipeProducerDispatcher::IsBusyNoLock() const {
+  lock().AssertAcquired();
+  return InTwoPhaseWrite();
+}
+
+void DataPipeProducerDispatcher::OnReadMessage(
+    const MessageInTransit::View& message_view,
+    ScopedPlatformHandleVectorPtr platform_handles) {
+  NOTREACHED();
+}
+
+void DataPipeProducerDispatcher::OnError(Error error) {
+  switch (error) {
+    case ERROR_READ_SHUTDOWN:
+    case ERROR_READ_BROKEN:
+    case ERROR_READ_BAD_MESSAGE:
+    case ERROR_READ_UNKNOWN:
+      LOG(ERROR) << "DataPipeProducerDispatcher shouldn't read messages";
+      break;
+    case ERROR_WRITE:
+      // Write errors are slightly notable: they probably shouldn't happen under
+      // normal operation (but maybe the other side crashed).
+      LOG(WARNING) << "DataPipeProducerDispatcher write error";
+      break;
+  }
+
+  error_ = true;
+  if (started_transport_.Try()) {
+    base::AutoLock locker(lock());
+    awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+
+    base::MessageLoop::current()->PostTask(
+        FROM_HERE,
+        base::Bind(&RawChannel::Shutdown, base::Unretained(channel_)));
+    channel_ = nullptr;
+    started_transport_.Release();
+  } else {
+    // We must be waiting to call ReleaseHandle. It will call Shutdown.
+  }
+}
+
+bool DataPipeProducerDispatcher::InTwoPhaseWrite() const {
+  return !two_phase_data_.empty();
+}
+
+bool DataPipeProducerDispatcher::WriteDataIntoMessages(
+    const void* elements,
+    uint32_t num_bytes) {
+  // The maximum amount of data to send per message (make it a multiple of the
+  // element size.
+  size_t max_message_num_bytes = GetConfiguration().max_message_num_bytes;
+  max_message_num_bytes -= max_message_num_bytes % options_.element_num_bytes;
+  DCHECK_GT(max_message_num_bytes, 0u);
+
+  uint32_t offset = 0;
+  while (offset < num_bytes) {
+    uint32_t message_num_bytes =
+        std::min(static_cast<uint32_t>(max_message_num_bytes),
+                 num_bytes - offset);
+    scoped_ptr<MessageInTransit> message(new MessageInTransit(
+        MessageInTransit::Type::MESSAGE, message_num_bytes,
+        static_cast<const char*>(elements) + offset));
+    if (!channel_->WriteMessage(message.Pass())) {
+      error_ = true;
+      return false;
+    }
+
+    offset += message_num_bytes;
+  }
+
+  return true;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/data_pipe_producer_dispatcher.h b/mojo/edk/system/data_pipe_producer_dispatcher.h
new file mode 100644
index 0000000..7c28ae6
--- /dev/null
+++ b/mojo/edk/system/data_pipe_producer_dispatcher.h
@@ -0,0 +1,110 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_DATA_PIPE_PRODUCER_DISPATCHER_H_
+#define MOJO_EDK_SYSTEM_DATA_PIPE_PRODUCER_DISPATCHER_H_
+
+#include "base/memory/ref_counted.h"
+#include "mojo/edk/system/awakable_list.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/raw_channel.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// This is the |Dispatcher| implementation for the producer handle for data
+// pipes (created by the Mojo primitive |MojoCreateDataPipe()|). This class is
+// thread-safe.
+class MOJO_SYSTEM_IMPL_EXPORT DataPipeProducerDispatcher final
+    : public Dispatcher, public RawChannel::Delegate {
+ public:
+  static scoped_refptr<DataPipeProducerDispatcher> Create(
+      const MojoCreateDataPipeOptions& options) {
+    return make_scoped_refptr(new DataPipeProducerDispatcher(options));
+  }
+
+  // Must be called before any other methods.
+  void Init(ScopedPlatformHandle message_pipe);
+
+  // |Dispatcher| public methods:
+  Type GetType() const override;
+
+  // The "opposite" of |SerializeAndClose()|. (Typically this is called by
+  // |Dispatcher::Deserialize()|.)
+  static scoped_refptr<DataPipeProducerDispatcher>
+  Deserialize(const void* source,
+              size_t size,
+              PlatformHandleVector* platform_handles);
+
+ private:
+  DataPipeProducerDispatcher(const MojoCreateDataPipeOptions& options);
+  ~DataPipeProducerDispatcher() override;
+
+  void InitOnIO();
+  void CloseOnIO();
+
+  // |Dispatcher| protected methods:
+  void CancelAllAwakablesNoLock() override;
+  void CloseImplNoLock() override;
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
+      override;
+  MojoResult WriteDataImplNoLock(const void* elements,
+                                 uint32_t* num_bytes,
+                                 MojoWriteDataFlags flags) override;
+  MojoResult BeginWriteDataImplNoLock(void** buffer,
+                                      uint32_t* buffer_num_bytes,
+                                      MojoWriteDataFlags flags) override;
+  MojoResult EndWriteDataImplNoLock(uint32_t num_bytes_written) override;
+  HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
+  MojoResult AddAwakableImplNoLock(Awakable* awakable,
+                                   MojoHandleSignals signals,
+                                   uint32_t context,
+                                   HandleSignalsState* signals_state) override;
+  void RemoveAwakableImplNoLock(Awakable* awakable,
+                                HandleSignalsState* signals_state) override;
+  void StartSerializeImplNoLock(size_t* max_size,
+                                size_t* max_platform_handles) override;
+  bool EndSerializeAndCloseImplNoLock(
+      void* destination,
+      size_t* actual_size,
+      PlatformHandleVector* platform_handles) override;
+  void TransportStarted() override;
+  void TransportEnded() override;
+  bool IsBusyNoLock() const override;
+
+  // |RawChannel::Delegate methods:
+  void OnReadMessage(
+    const MessageInTransit::View& message_view,
+    ScopedPlatformHandleVectorPtr platform_handles) override;
+  void OnError(Error error) override;
+
+  bool InTwoPhaseWrite() const;
+  bool WriteDataIntoMessages(const void* elements, uint32_t num_bytes);
+
+  MojoCreateDataPipeOptions options_;
+
+  // Protected by |lock()|:
+  RawChannel* channel_;  // This will be null if closed.
+
+  AwakableList awakable_list_;
+
+  // If DispatcherTransport is created. Must be set before lock() is called to
+  // avoid deadlocks with RawChannel calling us.
+  base::Lock started_transport_;
+
+  bool error_;
+
+  ScopedPlatformHandle serialized_platform_handle_;
+
+  std::vector<char> two_phase_data_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipeProducerDispatcher);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_DATA_PIPE_PRODUCER_DISPATCHER_H_
diff --git a/mojo/edk/system/data_pipe_unittest.cc b/mojo/edk/system/data_pipe_unittest.cc
new file mode 100644
index 0000000..1fdb02d
--- /dev/null
+++ b/mojo/edk/system/data_pipe_unittest.cc
@@ -0,0 +1,1571 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdint.h>
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
+#include "mojo/edk/embedder/simple_platform_support.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/system/waiter.h"
+#include "mojo/public/c/system/data_pipe.h"
+#include "mojo/public/c/system/functions.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+const uint32_t kSizeOfOptions =
+    static_cast<uint32_t>(sizeof(MojoCreateDataPipeOptions));
+
+// In various places, we have to poll (since, e.g., we can't yet wait for a
+// certain amount of data to be available). This is the maximum number of
+// iterations (separated by a short sleep).
+// TODO(vtl): Get rid of this.
+const size_t kMaxPoll = 100;
+
+class DataPipeTest : public test::MojoSystemTest {
+ public:
+  DataPipeTest() : producer_(MOJO_HANDLE_INVALID),
+                   consumer_(MOJO_HANDLE_INVALID) {}
+
+  ~DataPipeTest() override {
+    if (producer_ != MOJO_HANDLE_INVALID)
+      CHECK_EQ(MOJO_RESULT_OK, MojoClose(producer_));
+    if (consumer_ != MOJO_HANDLE_INVALID)
+      CHECK_EQ(MOJO_RESULT_OK, MojoClose(consumer_));
+  }
+
+  MojoResult Create(const MojoCreateDataPipeOptions* options) {
+    return MojoCreateDataPipe(options, &producer_, &consumer_);
+  }
+
+  MojoResult WriteData(const void* elements,
+                       uint32_t* num_bytes,
+                       bool all_or_none = false) {
+    return MojoWriteData(producer_, elements, num_bytes,
+                         all_or_none ? MOJO_READ_DATA_FLAG_ALL_OR_NONE :
+                                       MOJO_WRITE_DATA_FLAG_NONE);
+  }
+
+  MojoResult ReadData(void* elements,
+                      uint32_t* num_bytes,
+                      bool all_or_none = false,
+                      bool peek = false) {
+    MojoReadDataFlags flags = MOJO_READ_DATA_FLAG_NONE;
+    if (all_or_none)
+      flags |= MOJO_READ_DATA_FLAG_ALL_OR_NONE;
+    if (peek)
+      flags |= MOJO_READ_DATA_FLAG_PEEK;
+    return MojoReadData(consumer_, elements, num_bytes, flags);
+  }
+
+  MojoResult QueryData(uint32_t* num_bytes) {
+    return MojoReadData(consumer_, nullptr, num_bytes,
+                        MOJO_READ_DATA_FLAG_QUERY);
+  }
+
+  MojoResult DiscardData(uint32_t* num_bytes, bool all_or_none = false) {
+    MojoReadDataFlags flags = MOJO_READ_DATA_FLAG_DISCARD;
+    if (all_or_none)
+      flags |= MOJO_READ_DATA_FLAG_ALL_OR_NONE;
+    return MojoReadData(consumer_, nullptr, num_bytes, flags);
+  }
+
+  MojoResult BeginReadData(const void** elements,
+                           uint32_t* num_bytes,
+                           bool all_or_none = false) {
+    MojoReadDataFlags flags = MOJO_READ_DATA_FLAG_NONE;
+    if (all_or_none)
+      flags |= MOJO_READ_DATA_FLAG_ALL_OR_NONE;
+    return MojoBeginReadData(consumer_, elements, num_bytes, flags);
+  }
+
+  MojoResult EndReadData(uint32_t num_bytes_read) {
+    return MojoEndReadData(consumer_, num_bytes_read);
+  }
+
+  MojoResult BeginWriteData(void** elements,
+                            uint32_t* num_bytes,
+                            bool all_or_none = false) {
+    MojoReadDataFlags flags = MOJO_READ_DATA_FLAG_NONE;
+    if (all_or_none)
+      flags |= MOJO_READ_DATA_FLAG_ALL_OR_NONE;
+    return MojoBeginWriteData(producer_, elements, num_bytes, flags);
+  }
+
+  MojoResult EndWriteData(uint32_t num_bytes_written) {
+    return MojoEndWriteData(producer_, num_bytes_written);
+  }
+
+  MojoResult CloseProducer() {
+    MojoResult rv = MojoClose(producer_);
+    producer_ = MOJO_HANDLE_INVALID;
+    return rv;
+  }
+
+  MojoResult CloseConsumer() {
+    MojoResult rv = MojoClose(consumer_);
+    consumer_ = MOJO_HANDLE_INVALID;
+    return rv;
+  }
+
+  MojoHandle producer_, consumer_;
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(DataPipeTest);
+};
+
+TEST_F(DataPipeTest, Basic) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      1000 * sizeof(int32_t)                    // |capacity_num_bytes|.
+  };
+
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+
+  // We can write to a data pipe handle immediately.
+  int32_t elements[10] = {};
+  uint32_t num_bytes = 0;
+
+  num_bytes =
+      static_cast<uint32_t>(MOJO_ARRAYSIZE(elements) * sizeof(elements[0]));
+
+  elements[0] = 123;
+  elements[1] = 456;
+  num_bytes = static_cast<uint32_t>(2u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(&elements[0], &num_bytes));
+
+  // Now wait for the other side to become readable.
+  MojoHandleSignalsState state;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &state));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, state.satisfied_signals);
+
+  elements[0] = -1;
+  elements[1] = -1;
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(&elements[0], &num_bytes));
+  ASSERT_EQ(static_cast<uint32_t>(2u * sizeof(elements[0])), num_bytes);
+  ASSERT_EQ(elements[0], 123);
+  ASSERT_EQ(elements[1], 456);
+}
+
+// Tests creation of data pipes with various (valid) options.
+TEST_F(DataPipeTest, CreateAndMaybeTransfer) {
+  MojoCreateDataPipeOptions test_options[] = {
+      // Default options.
+      {},
+      // Trivial element size, non-default capacity.
+      {kSizeOfOptions,                           // |struct_size|.
+       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+       1,                                        // |element_num_bytes|.
+       1000},                                    // |capacity_num_bytes|.
+      // Nontrivial element size, non-default capacity.
+      {kSizeOfOptions,                           // |struct_size|.
+       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+       4,                                        // |element_num_bytes|.
+       4000},                                    // |capacity_num_bytes|.
+      // Nontrivial element size, default capacity.
+      {kSizeOfOptions,                           // |struct_size|.
+       MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+       100,                                      // |element_num_bytes|.
+       0}                                        // |capacity_num_bytes|.
+  };
+  for (size_t i = 0; i < arraysize(test_options); i++) {
+    MojoHandle producer_handle, consumer_handle;
+    MojoCreateDataPipeOptions* options =
+        i ? &test_options[i] : nullptr;
+    ASSERT_EQ(MOJO_RESULT_OK,
+              MojoCreateDataPipe(options, &producer_handle, &consumer_handle));
+    ASSERT_EQ(MOJO_RESULT_OK, MojoClose(producer_handle));
+    ASSERT_EQ(MOJO_RESULT_OK, MojoClose(consumer_handle));
+  }
+}
+
+TEST_F(DataPipeTest, SimpleReadWrite) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      1000 * sizeof(int32_t)                    // |capacity_num_bytes|.
+  };
+
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  int32_t elements[10] = {};
+  uint32_t num_bytes = 0;
+
+  // Try reading; nothing there yet.
+  num_bytes =
+      static_cast<uint32_t>(MOJO_ARRAYSIZE(elements) * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT, ReadData(elements, &num_bytes));
+
+  // Query; nothing there yet.
+  num_bytes = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(0u, num_bytes);
+
+  // Discard; nothing there yet.
+  num_bytes = static_cast<uint32_t>(5u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT, DiscardData(&num_bytes));
+
+  // Read with invalid |num_bytes|.
+  num_bytes = sizeof(elements[0]) + 1;
+  ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT, ReadData(elements, &num_bytes));
+
+  // Write two elements.
+  elements[0] = 123;
+  elements[1] = 456;
+  num_bytes = static_cast<uint32_t>(2u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(elements, &num_bytes));
+  // It should have written everything (even without "all or none").
+  ASSERT_EQ(2u * sizeof(elements[0]), num_bytes);
+
+  // Wait.
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Query.
+  // TODO(vtl): It's theoretically possible (though not with the current
+  // implementation/configured limits) that not all the data has arrived yet.
+  // (The theoretically-correct assertion here is that |num_bytes| is |1 * ...|
+  // or |2 * ...|.)
+  num_bytes = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(2 * sizeof(elements[0]), num_bytes);
+
+  // Read one element.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(elements, &num_bytes));
+  ASSERT_EQ(1u * sizeof(elements[0]), num_bytes);
+  ASSERT_EQ(123, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Query.
+  // TODO(vtl): See previous TODO. (If we got 2 elements there, however, we
+  // should get 1 here.)
+  num_bytes = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(1 * sizeof(elements[0]), num_bytes);
+
+  // Peek one element.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(elements, &num_bytes, false, true));
+  ASSERT_EQ(1u * sizeof(elements[0]), num_bytes);
+  ASSERT_EQ(456, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Query. Still has 1 element remaining.
+  num_bytes = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(1 * sizeof(elements[0]), num_bytes);
+
+  // Try to read two elements, with "all or none".
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(2u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE,
+            ReadData(elements, &num_bytes, true, false));
+  ASSERT_EQ(-1, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Try to read two elements, without "all or none".
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(2u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(elements, &num_bytes, false, false));
+  ASSERT_EQ(1u * sizeof(elements[0]), num_bytes);
+  ASSERT_EQ(456, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Query.
+  num_bytes = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(0u, num_bytes);
+}
+
+// Note: The "basic" waiting tests test that the "wait states" are correct in
+// various situations; they don't test that waiters are properly awoken on state
+// changes. (For that, we need to use multiple threads.)
+TEST_F(DataPipeTest, BasicProducerWaiting) {
+  // Note: We take advantage of the fact that current for current
+  // implementations capacities are strict maximums. This is not guaranteed by
+  // the API.
+
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      2 * sizeof(int32_t)                       // |capacity_num_bytes|.
+  };
+  Create(&options);
+  MojoHandleSignalsState hss;
+
+  // Never readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Already writable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss));
+
+  // Write two elements.
+  int32_t elements[2] = {123, 456};
+  uint32_t num_bytes = static_cast<uint32_t>(2u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(elements, &num_bytes, true));
+  ASSERT_EQ(static_cast<uint32_t>(2u * sizeof(elements[0])), num_bytes);
+
+  // Wait for data to become available to the consumer.
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Peek one element.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(elements, &num_bytes, true, true));
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
+  ASSERT_EQ(123, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Read one element.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(elements, &num_bytes, true, false));
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
+  ASSERT_EQ(123, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Try writing, using a two-phase write.
+  void* buffer = nullptr;
+  num_bytes = static_cast<uint32_t>(3u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&buffer, &num_bytes));
+  EXPECT_TRUE(buffer);
+  ASSERT_GE(num_bytes, static_cast<uint32_t>(1u * sizeof(elements[0])));
+
+  static_cast<int32_t*>(buffer)[0] = 789;
+  ASSERT_EQ(MOJO_RESULT_OK, EndWriteData(static_cast<uint32_t>(
+                                         1u * sizeof(elements[0]))));
+
+  // Read one element, using a two-phase read.
+  const void* read_buffer = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            BeginReadData(&read_buffer, &num_bytes, false));
+  EXPECT_TRUE(read_buffer);
+  // Since we only read one element (after having written three in all), the
+  // two-phase read should only allow us to read one. This checks an
+  // implementation detail!
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
+  ASSERT_EQ(456, static_cast<const int32_t*>(read_buffer)[0]);
+  ASSERT_EQ(MOJO_RESULT_OK, EndReadData(static_cast<uint32_t>(
+                                        1u * sizeof(elements[0]))));
+
+  // Write one element.
+  elements[0] = 123;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(elements, &num_bytes));
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
+
+  // Close the consumer.
+  CloseConsumer();
+
+  // It should now be never-writable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+}
+
+TEST_F(DataPipeTest, PeerClosedProducerWaiting) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      2 * sizeof(int32_t)                       // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // Close the consumer.
+  CloseConsumer();
+
+  // It should be signaled.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+}
+
+TEST_F(DataPipeTest, PeerClosedConsumerWaiting) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      2 * sizeof(int32_t)                       // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // Close the producer.
+  CloseProducer();
+
+  // It should be signaled.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+}
+
+TEST_F(DataPipeTest, BasicConsumerWaiting) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      1000 * sizeof(int32_t)                    // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // Never writable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_WRITABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(0u, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Write two elements.
+  int32_t elements[2] = {123, 456};
+  uint32_t num_bytes = static_cast<uint32_t>(2u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(elements, &num_bytes, true));
+
+  // Wait for readability.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Discard one element.
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, DiscardData(&num_bytes, true));
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
+
+  // Should still be readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Peek one element.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(elements, &num_bytes, true, true));
+  ASSERT_EQ(456, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Should still be readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Read one element.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(elements, &num_bytes, true));
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
+  ASSERT_EQ(456, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Write one element.
+  elements[0] = 789;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(elements, &num_bytes, true));
+
+  // Waiting should now succeed.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Close the producer.
+  CloseProducer();
+
+  // Should still be readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Wait for the peer closed signal.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_TRUE((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_PEER_CLOSED) != 0);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Read one element.
+  elements[0] = -1;
+  elements[1] = -1;
+  num_bytes = static_cast<uint32_t>(1u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(elements, &num_bytes, true));
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
+  ASSERT_EQ(789, elements[0]);
+  ASSERT_EQ(-1, elements[1]);
+
+  // Should be never-readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+}
+
+// Test with two-phase APIs and also closing the producer with an active
+// consumer waiter.
+TEST_F(DataPipeTest, ConsumerWaitingTwoPhase) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      1000 * sizeof(int32_t)                    // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // Write two elements.
+  int32_t* elements = nullptr;
+  void* buffer = nullptr;
+  // Request room for three (but we'll only write two).
+  uint32_t num_bytes = static_cast<uint32_t>(3u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&buffer, &num_bytes, true));
+  EXPECT_TRUE(buffer);
+  EXPECT_GE(num_bytes, static_cast<uint32_t>(3u * sizeof(elements[0])));
+  elements = static_cast<int32_t*>(buffer);
+  elements[0] = 123;
+  elements[1] = 456;
+  ASSERT_EQ(MOJO_RESULT_OK, EndWriteData(2u * sizeof(elements[0])));
+
+  // Wait for readability.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Read one element.
+  // Request two in all-or-none mode, but only read one.
+  const void* read_buffer = nullptr;
+  num_bytes = static_cast<uint32_t>(2u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, BeginReadData(&read_buffer, &num_bytes, true));
+  EXPECT_TRUE(read_buffer);
+  ASSERT_EQ(static_cast<uint32_t>(2u * sizeof(elements[0])), num_bytes);
+  const int32_t* read_elements = static_cast<const int32_t*>(read_buffer);
+  ASSERT_EQ(123, read_elements[0]);
+  ASSERT_EQ(MOJO_RESULT_OK, EndReadData(1u * sizeof(elements[0])));
+
+  // Should still be readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Read one element.
+  // Request three, but not in all-or-none mode.
+  read_buffer = nullptr;
+  num_bytes = static_cast<uint32_t>(3u * sizeof(elements[0]));
+  ASSERT_EQ(MOJO_RESULT_OK, BeginReadData(&read_buffer, &num_bytes));
+  EXPECT_TRUE(read_buffer);
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(elements[0])), num_bytes);
+  read_elements = static_cast<const int32_t*>(read_buffer);
+  ASSERT_EQ(456, read_elements[0]);
+  ASSERT_EQ(MOJO_RESULT_OK, EndReadData(1u * sizeof(elements[0])));
+
+  // Close the producer.
+  CloseProducer();
+
+  // Should be never-readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+}
+
+// Tests that data pipes aren't writable/readable during two-phase writes/reads.
+TEST_F(DataPipeTest, BasicTwoPhaseWaiting) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      1000 * sizeof(int32_t)                    // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // It should be writable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  uint32_t num_bytes = static_cast<uint32_t>(1u * sizeof(int32_t));
+  void* write_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&write_ptr, &num_bytes));
+  EXPECT_TRUE(write_ptr);
+  EXPECT_GE(num_bytes, static_cast<uint32_t>(1u * sizeof(int32_t)));
+
+  // At this point, it shouldn't be writable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss));
+  ASSERT_EQ(0u, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // It shouldn't be readable yet either (we'll wait later).
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  ASSERT_EQ(0u, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  static_cast<int32_t*>(write_ptr)[0] = 123;
+  ASSERT_EQ(MOJO_RESULT_OK, EndWriteData(1u * sizeof(int32_t)));
+
+  // It should immediately be writable again.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // It should become readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Start another two-phase write and check that it's readable even in the
+  // middle of it.
+  num_bytes = static_cast<uint32_t>(1u * sizeof(int32_t));
+  write_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&write_ptr, &num_bytes));
+  EXPECT_TRUE(write_ptr);
+  EXPECT_GE(num_bytes, static_cast<uint32_t>(1u * sizeof(int32_t)));
+
+  // It should be readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // End the two-phase write without writing anything.
+  ASSERT_EQ(MOJO_RESULT_OK, EndWriteData(0u));
+
+  // Start a two-phase read.
+  num_bytes = static_cast<uint32_t>(1u * sizeof(int32_t));
+  const void* read_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginReadData(&read_ptr, &num_bytes));
+  EXPECT_TRUE(read_ptr);
+  ASSERT_EQ(static_cast<uint32_t>(1u * sizeof(int32_t)), num_bytes);
+
+  // At this point, it should still be writable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // But not readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  ASSERT_EQ(0u, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // End the two-phase read without reading anything.
+  ASSERT_EQ(MOJO_RESULT_OK, EndReadData(0u));
+
+  // It should be readable again.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+}
+
+void Seq(int32_t start, size_t count, int32_t* out) {
+  for (size_t i = 0; i < count; i++)
+    out[i] = start + static_cast<int32_t>(i);
+}
+
+TEST_F(DataPipeTest, AllOrNone) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      10 * sizeof(int32_t)                      // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // Try writing way too much.
+  uint32_t num_bytes = 20u * sizeof(int32_t);
+  int32_t buffer[100];
+  Seq(0, MOJO_ARRAYSIZE(buffer), buffer);
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE, WriteData(buffer, &num_bytes, true));
+
+  // Should still be empty.
+  num_bytes = ~0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(0u, num_bytes);
+
+  // Write some data.
+  num_bytes = 5u * sizeof(int32_t);
+  Seq(100, MOJO_ARRAYSIZE(buffer), buffer);
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(buffer, &num_bytes, true));
+  ASSERT_EQ(5u * sizeof(int32_t), num_bytes);
+
+  // Wait for data.
+  // TODO(vtl): There's no real guarantee that all the data will become
+  // available at once (except that in current implementations, with reasonable
+  // limits, it will). Eventually, we'll be able to wait for a specified amount
+  // of data to become available.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Half full.
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(5u * sizeof(int32_t), num_bytes);
+
+  /* TODO(jam): enable if we end up observing max capacity
+  // Too much.
+  num_bytes = 6u * sizeof(int32_t);
+  Seq(200, MOJO_ARRAYSIZE(buffer), buffer);
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE, WriteData(buffer, &num_bytes, true));
+  */
+
+  // Try reading too much.
+  num_bytes = 11u * sizeof(int32_t);
+  memset(buffer, 0xab, sizeof(buffer));
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE, ReadData(buffer, &num_bytes, true));
+  int32_t expected_buffer[100];
+  memset(expected_buffer, 0xab, sizeof(expected_buffer));
+  ASSERT_EQ(0, memcmp(buffer, expected_buffer, sizeof(buffer)));
+
+  // Try discarding too much.
+  num_bytes = 11u * sizeof(int32_t);
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE, DiscardData(&num_bytes, true));
+
+  // Just a little.
+  num_bytes = 2u * sizeof(int32_t);
+  Seq(300, MOJO_ARRAYSIZE(buffer), buffer);
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(buffer, &num_bytes, true));
+  ASSERT_EQ(2u * sizeof(int32_t), num_bytes);
+
+  // Just right.
+  num_bytes = 3u * sizeof(int32_t);
+  Seq(400, MOJO_ARRAYSIZE(buffer), buffer);
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(buffer, &num_bytes, true));
+  ASSERT_EQ(3u * sizeof(int32_t), num_bytes);
+
+  // TODO(vtl): Hack (see also the TODO above): We can't currently wait for a
+  // specified amount of data to be available, so poll.
+  for (size_t i = 0; i < kMaxPoll; i++) {
+    num_bytes = 0u;
+    ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+    if (num_bytes >= 10u * sizeof(int32_t))
+      break;
+
+    test::Sleep(test::EpsilonDeadline());
+  }
+  ASSERT_EQ(10u * sizeof(int32_t), num_bytes);
+
+  // Read half.
+  num_bytes = 5u * sizeof(int32_t);
+  memset(buffer, 0xab, sizeof(buffer));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(buffer, &num_bytes, true));
+  ASSERT_EQ(5u * sizeof(int32_t), num_bytes);
+  memset(expected_buffer, 0xab, sizeof(expected_buffer));
+  Seq(100, 5, expected_buffer);
+  ASSERT_EQ(0, memcmp(buffer, expected_buffer, sizeof(buffer)));
+
+  // Try reading too much again.
+  num_bytes = 6u * sizeof(int32_t);
+  memset(buffer, 0xab, sizeof(buffer));
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE, ReadData(buffer, &num_bytes, true));
+  memset(expected_buffer, 0xab, sizeof(expected_buffer));
+  ASSERT_EQ(0, memcmp(buffer, expected_buffer, sizeof(buffer)));
+
+  // Try discarding too much again.
+  num_bytes = 6u * sizeof(int32_t);
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE, DiscardData(&num_bytes, true));
+
+  // Discard a little.
+  num_bytes = 2u * sizeof(int32_t);
+  ASSERT_EQ(MOJO_RESULT_OK, DiscardData(&num_bytes, true));
+  ASSERT_EQ(2u * sizeof(int32_t), num_bytes);
+
+  // Three left.
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(3u * sizeof(int32_t), num_bytes);
+
+  // Close the producer, then test producer-closed cases.
+  CloseProducer();
+
+  // Wait.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Try reading too much; "failed precondition" since the producer is closed.
+  num_bytes = 4u * sizeof(int32_t);
+  memset(buffer, 0xab, sizeof(buffer));
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            ReadData(buffer, &num_bytes, true));
+  memset(expected_buffer, 0xab, sizeof(expected_buffer));
+  ASSERT_EQ(0, memcmp(buffer, expected_buffer, sizeof(buffer)));
+
+  // Try discarding too much; "failed precondition" again.
+  num_bytes = 4u * sizeof(int32_t);
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, DiscardData(&num_bytes, true));
+
+  // Read a little.
+  num_bytes = 2u * sizeof(int32_t);
+  memset(buffer, 0xab, sizeof(buffer));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(buffer, &num_bytes, true));
+  ASSERT_EQ(2u * sizeof(int32_t), num_bytes);
+  memset(expected_buffer, 0xab, sizeof(expected_buffer));
+  Seq(400, 2, expected_buffer);
+  ASSERT_EQ(0, memcmp(buffer, expected_buffer, sizeof(buffer)));
+
+  // Discard the remaining element.
+  num_bytes = 1u * sizeof(int32_t);
+  ASSERT_EQ(MOJO_RESULT_OK, DiscardData(&num_bytes, true));
+  ASSERT_EQ(1u * sizeof(int32_t), num_bytes);
+
+  // Empty again.
+  num_bytes = ~0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(0u, num_bytes);
+}
+
+TEST_F(DataPipeTest, DISABLED_TwoPhaseAllOrNone) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      10 * sizeof(int32_t)                      // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // Try writing way too much (two-phase).
+  uint32_t num_bytes = 20u * sizeof(int32_t);
+  void* write_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE,
+            BeginWriteData(&write_ptr, &num_bytes, true));
+
+  // Try writing an amount which isn't a multiple of the element size
+  // (two-phase).
+  static_assert(sizeof(int32_t) > 1u, "Wow! int32_t's have size 1");
+  num_bytes = 1u;
+  write_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            BeginWriteData(&write_ptr, &num_bytes, true));
+
+  // Try reading way too much (two-phase).
+  num_bytes = 20u * sizeof(int32_t);
+  const void* read_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE,
+            BeginReadData(&read_ptr, &num_bytes, true));
+
+  // Write half (two-phase).
+  num_bytes = 5u * sizeof(int32_t);
+  write_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&write_ptr, &num_bytes, true));
+  // May provide more space than requested.
+  EXPECT_GE(num_bytes, 5u * sizeof(int32_t));
+  EXPECT_TRUE(write_ptr);
+  Seq(0, 5, static_cast<int32_t*>(write_ptr));
+  ASSERT_EQ(MOJO_RESULT_OK, EndWriteData(5u * sizeof(int32_t)));
+
+  // Wait for data.
+  // TODO(vtl): (See corresponding TODO in AllOrNone.)
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Try reading an amount which isn't a multiple of the element size
+  // (two-phase).
+  num_bytes = 1u;
+  read_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            BeginReadData(&read_ptr, &num_bytes, true));
+
+  // Read one (two-phase).
+  num_bytes = 1u * sizeof(int32_t);
+  read_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginReadData(&read_ptr, &num_bytes, true));
+  EXPECT_GE(num_bytes, 1u * sizeof(int32_t));
+  ASSERT_EQ(0, static_cast<const int32_t*>(read_ptr)[0]);
+  ASSERT_EQ(MOJO_RESULT_OK, EndReadData(1u * sizeof(int32_t)));
+
+  // We should have four left, leaving room for six.
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(4u * sizeof(int32_t), num_bytes);
+
+  // Assuming a tight circular buffer of the specified capacity, we can't do a
+  // two-phase write of six now.
+  num_bytes = 6u * sizeof(int32_t);
+  write_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE,
+            BeginWriteData(&write_ptr, &num_bytes, true));
+
+  // TODO(vtl): Hack (see also the TODO above): We can't currently wait for a
+  // specified amount of space to be available, so poll.
+  for (size_t i = 0; i < kMaxPoll; i++) {
+    // Write six elements (simple), filling the buffer.
+    num_bytes = 6u * sizeof(int32_t);
+    int32_t buffer[100];
+    Seq(100, 6, buffer);
+    MojoResult result = WriteData(buffer, &num_bytes, true);
+    if (result == MOJO_RESULT_OK)
+      break;
+    ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE, result);
+
+    test::Sleep(test::EpsilonDeadline());
+  }
+  ASSERT_EQ(6u * sizeof(int32_t), num_bytes);
+
+  // TODO(vtl): Hack: poll again.
+  for (size_t i = 0; i < kMaxPoll; i++) {
+    // We have ten.
+    num_bytes = 0u;
+    ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+    if (num_bytes >= 10u * sizeof(int32_t))
+      break;
+
+    test::Sleep(test::EpsilonDeadline());
+  }
+  ASSERT_EQ(10u * sizeof(int32_t), num_bytes);
+
+  // Note: Whether a two-phase read of ten would fail here or not is
+  // implementation-dependent.
+
+  // Close the producer.
+  CloseProducer();
+
+  // A two-phase read of nine should work.
+  num_bytes = 9u * sizeof(int32_t);
+  read_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginReadData(&read_ptr, &num_bytes, true));
+  EXPECT_GE(num_bytes, 9u * sizeof(int32_t));
+  ASSERT_EQ(1, static_cast<const int32_t*>(read_ptr)[0]);
+  ASSERT_EQ(2, static_cast<const int32_t*>(read_ptr)[1]);
+  ASSERT_EQ(3, static_cast<const int32_t*>(read_ptr)[2]);
+  ASSERT_EQ(4, static_cast<const int32_t*>(read_ptr)[3]);
+  ASSERT_EQ(100, static_cast<const int32_t*>(read_ptr)[4]);
+  ASSERT_EQ(101, static_cast<const int32_t*>(read_ptr)[5]);
+  ASSERT_EQ(102, static_cast<const int32_t*>(read_ptr)[6]);
+  ASSERT_EQ(103, static_cast<const int32_t*>(read_ptr)[7]);
+  ASSERT_EQ(104, static_cast<const int32_t*>(read_ptr)[8]);
+  ASSERT_EQ(MOJO_RESULT_OK, EndReadData(9u * sizeof(int32_t)));
+
+  // Wait for peer closed.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // A two-phase read of two should fail, with "failed precondition".
+  num_bytes = 2u * sizeof(int32_t);
+  read_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            BeginReadData(&read_ptr, &num_bytes, true));
+}
+
+/*
+jam: this is testing that the implementation uses a circular buffer, which we
+don't use currently.
+// Tests that |ProducerWriteData()| and |ConsumerReadData()| writes and reads,
+// respectively, as much as possible, even if it may have to "wrap around" the
+// internal circular buffer. (Note that the two-phase write and read need not do
+// this.)
+TYPED_TEST(DataPipeImplTest, WrapAround) {
+  unsigned char test_data[1000];
+  for (size_t i = 0; i < MOJO_ARRAYSIZE(test_data); i++)
+    test_data[i] = static_cast<unsigned char>(i);
+
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      1u,                                       // |element_num_bytes|.
+      100u                                      // |capacity_num_bytes|.
+  };
+  MojoCreateDataPipeOptions validated_options = {};
+  // This test won't be valid if |ValidateCreateOptions()| decides to give the
+  // pipe more space.
+  ASSERT_EQ(MOJO_RESULT_OK, DataPipe::ValidateCreateOptions(
+                                &options, &validated_options));
+  ASSERT_EQ(100u, validated_options.capacity_num_bytes);
+  this->Create(options);
+  this->DoTransfer();
+
+  Waiter waiter;
+  HandleSignalsState hss;
+
+  // Add waiter.
+  waiter.Init();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            this->ConsumerAddAwakable(&waiter, MOJO_HANDLE_SIGNAL_READABLE, 1,
+                                      nullptr));
+
+  // Write 20 bytes.
+  uint32_t num_bytes = 20u;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            this->ProducerWriteData(&test_data[0], &num_bytes, false));
+  ASSERT_EQ(20u, num_bytes);
+
+  // Wait for data.
+  // TODO(vtl): (See corresponding TODO in AllOrNone.)
+  ASSERT_EQ(MOJO_RESULT_OK, waiter.Wait(test::TinyDeadline(), nullptr));
+  hss = HandleSignalsState();
+  this->ConsumerRemoveAwakable(&waiter, &hss);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Read 10 bytes.
+  unsigned char read_buffer[1000] = {0};
+  num_bytes = 10u;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            this->ConsumerReadData(read_buffer, &num_bytes, false, false));
+  ASSERT_EQ(10u, num_bytes);
+  ASSERT_EQ(0, memcmp(read_buffer, &test_data[0], 10u));
+
+  if (this->IsStrictCircularBuffer()) {
+    // Check that a two-phase write can now only write (at most) 80 bytes. (This
+    // checks an implementation detail; this behavior is not guaranteed.)
+    void* write_buffer_ptr = nullptr;
+    num_bytes = 0u;
+    ASSERT_EQ(MOJO_RESULT_OK,
+              this->ProducerBeginWriteData(&write_buffer_ptr, &num_bytes,
+                                           false));
+    EXPECT_TRUE(write_buffer_ptr);
+    ASSERT_EQ(80u, num_bytes);
+    ASSERT_EQ(MOJO_RESULT_OK, this->ProducerEndWriteData(0u));
+  }
+
+  // TODO(vtl): (See corresponding TODO in TwoPhaseAllOrNone.)
+  size_t total_num_bytes = 0;
+  for (size_t i = 0; i < kMaxPoll; i++) {
+    // Write as much data as we can (using |ProducerWriteData()|). We should
+    // write 90 bytes (eventually).
+    num_bytes = 200u;
+    MojoResult result = this->ProducerWriteData(
+        &test_data[20 + total_num_bytes], &num_bytes, false);
+    if (result == MOJO_RESULT_OK) {
+      total_num_bytes += num_bytes;
+      if (total_num_bytes >= 90u)
+        break;
+    } else {
+      ASSERT_EQ(MOJO_RESULT_OUT_OF_RANGE, result);
+    }
+
+    test::Sleep(test::EpsilonDeadline());
+  }
+  ASSERT_EQ(90u, total_num_bytes);
+
+  // TODO(vtl): (See corresponding TODO in TwoPhaseAllOrNone.)
+  for (size_t i = 0; i < kMaxPoll; i++) {
+    // We have 100.
+    num_bytes = 0u;
+    ASSERT_EQ(MOJO_RESULT_OK,
+              this->ConsumerQueryData(&num_bytes));
+    if (num_bytes >= 100u)
+      break;
+
+    test::Sleep(test::EpsilonDeadline());
+  }
+  ASSERT_EQ(100u, num_bytes);
+
+  if (this->IsStrictCircularBuffer()) {
+    // Check that a two-phase read can now only read (at most) 90 bytes. (This
+    // checks an implementation detail; this behavior is not guaranteed.)
+    const void* read_buffer_ptr = nullptr;
+    num_bytes = 0u;
+    ASSERT_EQ(MOJO_RESULT_OK,
+              this->ConsumerBeginReadData(&read_buffer_ptr, &num_bytes, false));
+    EXPECT_TRUE(read_buffer_ptr);
+    ASSERT_EQ(90u, num_bytes);
+    ASSERT_EQ(MOJO_RESULT_OK, this->ConsumerEndReadData(0u));
+  }
+
+  // Read as much as possible (using |ConsumerReadData()|). We should read 100
+  // bytes.
+  num_bytes = static_cast<uint32_t>(MOJO_ARRAYSIZE(read_buffer) *
+                                    sizeof(read_buffer[0]));
+  memset(read_buffer, 0, num_bytes);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            this->ConsumerReadData(read_buffer, &num_bytes, false, false));
+  ASSERT_EQ(100u, num_bytes);
+  ASSERT_EQ(0, memcmp(read_buffer, &test_data[10], 100u));
+
+  this->ProducerClose();
+  this->ConsumerClose();
+}
+*/
+
+// Tests the behavior of writing (simple and two-phase), closing the producer,
+// then reading (simple and two-phase).
+TEST_F(DataPipeTest, WriteCloseProducerRead) {
+  const char kTestData[] = "hello world";
+  const uint32_t kTestDataSize = static_cast<uint32_t>(sizeof(kTestData));
+
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      1u,                                       // |element_num_bytes|.
+      1000u                                     // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+
+  // Write some data, so we'll have something to read.
+  uint32_t num_bytes = kTestDataSize;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(kTestData, &num_bytes, false));
+  ASSERT_EQ(kTestDataSize, num_bytes);
+
+  // Write it again, so we'll have something left over.
+  num_bytes = kTestDataSize;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(kTestData, &num_bytes, false));
+  ASSERT_EQ(kTestDataSize, num_bytes);
+
+  // Start two-phase write.
+  void* write_buffer_ptr = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            BeginWriteData(&write_buffer_ptr, &num_bytes, false));
+  EXPECT_TRUE(write_buffer_ptr);
+  EXPECT_GT(num_bytes, 0u);
+
+  // TODO(vtl): (See corresponding TODO in TwoPhaseAllOrNone.)
+  for (size_t i = 0; i < kMaxPoll; i++) {
+    num_bytes = 0u;
+    ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+    if (num_bytes >= 2u * kTestDataSize)
+      break;
+
+    test::Sleep(test::EpsilonDeadline());
+  }
+  ASSERT_EQ(2u * kTestDataSize, num_bytes);
+
+  // Start two-phase read.
+  const void* read_buffer_ptr = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            BeginReadData(&read_buffer_ptr, &num_bytes));
+  EXPECT_TRUE(read_buffer_ptr);
+  ASSERT_EQ(2u * kTestDataSize, num_bytes);
+
+  // Close the producer.
+  CloseProducer();
+
+  // The consumer can finish its two-phase read.
+  ASSERT_EQ(0, memcmp(read_buffer_ptr, kTestData, kTestDataSize));
+  ASSERT_EQ(MOJO_RESULT_OK, EndReadData(kTestDataSize));
+
+  // And start another.
+  read_buffer_ptr = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            BeginReadData(&read_buffer_ptr, &num_bytes));
+  EXPECT_TRUE(read_buffer_ptr);
+  ASSERT_EQ(kTestDataSize, num_bytes);
+}
+
+
+// Tests the behavior of interrupting a two-phase read and write by closing the
+// consumer.
+TEST_F(DataPipeTest, TwoPhaseWriteReadCloseConsumer) {
+  const char kTestData[] = "hello world";
+  const uint32_t kTestDataSize = static_cast<uint32_t>(sizeof(kTestData));
+
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      1u,                                       // |element_num_bytes|.
+      1000u                                     // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // Write some data, so we'll have something to read.
+  uint32_t num_bytes = kTestDataSize;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(kTestData, &num_bytes));
+  ASSERT_EQ(kTestDataSize, num_bytes);
+
+  // Start two-phase write.
+  void* write_buffer_ptr = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&write_buffer_ptr, &num_bytes));
+  EXPECT_TRUE(write_buffer_ptr);
+  ASSERT_GT(num_bytes, kTestDataSize);
+
+  // Wait for data.
+  // TODO(vtl): (See corresponding TODO in AllOrNone.)
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Start two-phase read.
+  const void* read_buffer_ptr = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginReadData(&read_buffer_ptr, &num_bytes));
+  EXPECT_TRUE(read_buffer_ptr);
+  ASSERT_EQ(kTestDataSize, num_bytes);
+
+  // Close the consumer.
+  CloseConsumer();
+
+  // Wait for producer to know that the consumer is closed.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(producer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+
+  // Actually write some data. (Note: Premature freeing of the buffer would
+  // probably only be detected under ASAN or similar.)
+  memcpy(write_buffer_ptr, kTestData, kTestDataSize);
+  // Note: Even though the consumer has been closed, ending the two-phase
+  // write will report success.
+  ASSERT_EQ(MOJO_RESULT_OK, EndWriteData(kTestDataSize));
+
+  // But trying to write should result in failure.
+  num_bytes = kTestDataSize;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, WriteData(kTestData, &num_bytes));
+
+  // As will trying to start another two-phase write.
+  write_buffer_ptr = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            BeginWriteData(&write_buffer_ptr, &num_bytes));
+}
+
+// Tests the behavior of "interrupting" a two-phase write by closing both the
+// producer and the consumer.
+TEST_F(DataPipeTest, TwoPhaseWriteCloseBoth) {
+  const uint32_t kTestDataSize = 15u;
+
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      1u,                                       // |element_num_bytes|.
+      1000u                                     // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+
+  // Start two-phase write.
+  void* write_buffer_ptr = nullptr;
+  uint32_t num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&write_buffer_ptr, &num_bytes));
+  EXPECT_TRUE(write_buffer_ptr);
+  ASSERT_GT(num_bytes, kTestDataSize);
+}
+
+// Tests the behavior of writing, closing the producer, and then reading (with
+// and without data remaining).
+TEST_F(DataPipeTest, WriteCloseProducerReadNoData) {
+  const char kTestData[] = "hello world";
+  const uint32_t kTestDataSize = static_cast<uint32_t>(sizeof(kTestData));
+
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      1u,                                       // |element_num_bytes|.
+      1000u                                     // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // Write some data, so we'll have something to read.
+  uint32_t num_bytes = kTestDataSize;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(kTestData, &num_bytes));
+  ASSERT_EQ(kTestDataSize, num_bytes);
+
+  // Close the producer.
+  CloseProducer();
+
+  // Wait. (Note that once the consumer knows that the producer is closed, it
+  // must also know about all the data that was sent.)
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Peek that data.
+  char buffer[1000];
+  num_bytes = static_cast<uint32_t>(sizeof(buffer));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(buffer, &num_bytes, false, true));
+  ASSERT_EQ(kTestDataSize, num_bytes);
+  ASSERT_EQ(0, memcmp(buffer, kTestData, kTestDataSize));
+
+  // Read that data.
+  memset(buffer, 0, 1000);
+  num_bytes = static_cast<uint32_t>(sizeof(buffer));
+  ASSERT_EQ(MOJO_RESULT_OK, ReadData(buffer, &num_bytes));
+  ASSERT_EQ(kTestDataSize, num_bytes);
+  ASSERT_EQ(0, memcmp(buffer, kTestData, kTestDataSize));
+
+  // A second read should fail.
+  num_bytes = static_cast<uint32_t>(sizeof(buffer));
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, ReadData(buffer, &num_bytes));
+
+  // A two-phase read should also fail.
+  const void* read_buffer_ptr = nullptr;
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            ReadData(&read_buffer_ptr, &num_bytes));
+
+  // Ditto for discard.
+  num_bytes = 10u;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, DiscardData(&num_bytes));
+}
+
+// Test that two-phase reads/writes behave correctly when given invalid
+// arguments.
+TEST_F(DataPipeTest, TwoPhaseMoreInvalidArguments) {
+  const MojoCreateDataPipeOptions options = {
+      kSizeOfOptions,                           // |struct_size|.
+      MOJO_CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,  // |flags|.
+      static_cast<uint32_t>(sizeof(int32_t)),   // |element_num_bytes|.
+      10 * sizeof(int32_t)                      // |capacity_num_bytes|.
+  };
+  ASSERT_EQ(MOJO_RESULT_OK, Create(&options));
+  MojoHandleSignalsState hss;
+
+  // No data.
+  uint32_t num_bytes = 1000u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(0u, num_bytes);
+
+  // Try "ending" a two-phase write when one isn't active.
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            EndWriteData(1u * sizeof(int32_t)));
+
+  // Wait a bit, to make sure that if a signal were (incorrectly) sent, it'd
+  // have time to propagate.
+  test::Sleep(test::EpsilonDeadline());
+
+  // Still no data.
+  num_bytes = 1000u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(0u, num_bytes);
+
+  // Try ending a two-phase write with an invalid amount (too much).
+  num_bytes = 0u;
+  void* write_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&write_ptr, &num_bytes));
+  ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            EndWriteData(num_bytes + static_cast<uint32_t>(sizeof(int32_t))));
+
+  // But the two-phase write still ended.
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, EndWriteData(0u));
+
+  // Wait a bit (as above).
+  test::Sleep(test::EpsilonDeadline());
+
+  // Still no data.
+  num_bytes = 1000u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(0u, num_bytes);
+
+  // Try ending a two-phase write with an invalid amount (not a multiple of the
+  // element size).
+  num_bytes = 0u;
+  write_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginWriteData(&write_ptr, &num_bytes));
+  EXPECT_GE(num_bytes, 1u);
+  ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT, EndWriteData(1u));
+
+  // But the two-phase write still ended.
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, EndWriteData(0u));
+
+  // Wait a bit (as above).
+  test::Sleep(test::EpsilonDeadline());
+
+  // Still no data.
+  num_bytes = 1000u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(0u, num_bytes);
+
+  // Now write some data, so we'll be able to try reading.
+  int32_t element = 123;
+  num_bytes = 1u * sizeof(int32_t);
+  ASSERT_EQ(MOJO_RESULT_OK, WriteData(&element, &num_bytes));
+
+  // Wait for data.
+  // TODO(vtl): (See corresponding TODO in AllOrNone.)
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(consumer_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // One element available.
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(1u * sizeof(int32_t), num_bytes);
+
+  // Try "ending" a two-phase read when one isn't active.
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION, EndReadData(1u * sizeof(int32_t)));
+
+  // Still one element available.
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(1u * sizeof(int32_t), num_bytes);
+
+  // Try ending a two-phase read with an invalid amount (too much).
+  num_bytes = 0u;
+  const void* read_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginReadData(&read_ptr, &num_bytes));
+  ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            EndReadData(num_bytes + static_cast<uint32_t>(sizeof(int32_t))));
+
+  // Still one element available.
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(1u * sizeof(int32_t), num_bytes);
+
+  // Try ending a two-phase read with an invalid amount (not a multiple of the
+  // element size).
+  num_bytes = 0u;
+  read_ptr = nullptr;
+  ASSERT_EQ(MOJO_RESULT_OK, BeginReadData(&read_ptr, &num_bytes));
+  ASSERT_EQ(1u * sizeof(int32_t), num_bytes);
+  ASSERT_EQ(123, static_cast<const int32_t*>(read_ptr)[0]);
+  ASSERT_EQ(MOJO_RESULT_INVALID_ARGUMENT, EndReadData(1u));
+
+  // Still one element available.
+  num_bytes = 0u;
+  ASSERT_EQ(MOJO_RESULT_OK, QueryData(&num_bytes));
+  ASSERT_EQ(1u * sizeof(int32_t), num_bytes);
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/dispatcher.cc b/mojo/edk/system/dispatcher.cc
new file mode 100644
index 0000000..e7426e51
--- /dev/null
+++ b/mojo/edk/system/dispatcher.cc
@@ -0,0 +1,493 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/dispatcher.h"
+
+#include "base/logging.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
+#include "mojo/edk/system/data_pipe_producer_dispatcher.h"
+#include "mojo/edk/system/message_pipe_dispatcher.h"
+#include "mojo/edk/system/platform_handle_dispatcher.h"
+#include "mojo/edk/system/shared_buffer_dispatcher.h"
+
+namespace mojo {
+namespace edk {
+
+namespace test {
+
+// TODO(vtl): Maybe this should be defined in a test-only file instead.
+DispatcherTransport DispatcherTryStartTransport(Dispatcher* dispatcher) {
+  return Dispatcher::HandleTableAccess::TryStartTransport(dispatcher);
+}
+
+}  // namespace test
+
+// Dispatcher ------------------------------------------------------------------
+
+// static
+DispatcherTransport Dispatcher::HandleTableAccess::TryStartTransport(
+    Dispatcher* dispatcher) {
+  DCHECK(dispatcher);
+
+  // Our dispatcher implementations hop to IO thread on initialization, so it's
+  // valid that while their RawChannel os being initialized on IO thread, the
+  // dispatcher is being sent. We handle this by just acquiring the lock.
+
+  // See comment in header for why we need this.
+  dispatcher->TransportStarted();
+
+  dispatcher->lock_.Acquire();
+
+  // We shouldn't race with things that close dispatchers, since closing can
+  // only take place either under |handle_table_lock_| or when the handle is
+  // marked as busy.
+  DCHECK(!dispatcher->is_closed_);
+
+  return DispatcherTransport(dispatcher);
+}
+
+// static
+void Dispatcher::TransportDataAccess::StartSerialize(
+    Dispatcher* dispatcher,
+    size_t* max_size,
+    size_t* max_platform_handles) {
+  DCHECK(dispatcher);
+  dispatcher->StartSerialize(max_size, max_platform_handles);
+}
+
+// static
+bool Dispatcher::TransportDataAccess::EndSerializeAndClose(
+    Dispatcher* dispatcher,
+    void* destination,
+    size_t* actual_size,
+    PlatformHandleVector* platform_handles) {
+  DCHECK(dispatcher);
+  return dispatcher->EndSerializeAndClose(destination, actual_size,
+                                          platform_handles);
+}
+
+// static
+scoped_refptr<Dispatcher> Dispatcher::TransportDataAccess::Deserialize(
+    int32_t type,
+    const void* source,
+    size_t size,
+    PlatformHandleVector* platform_handles) {
+  switch (static_cast<Dispatcher::Type>(type)) {
+    case Type::UNKNOWN:
+      DVLOG(2) << "Deserializing invalid handle";
+      return nullptr;
+    case Type::MESSAGE_PIPE:
+      return scoped_refptr<Dispatcher>(MessagePipeDispatcher::Deserialize(
+          source, size, platform_handles));
+    case Type::DATA_PIPE_PRODUCER:
+      return scoped_refptr<Dispatcher>(
+          DataPipeProducerDispatcher::Deserialize(
+              source, size, platform_handles));
+    case Type::DATA_PIPE_CONSUMER:
+      return scoped_refptr<Dispatcher>(
+          DataPipeConsumerDispatcher::Deserialize(
+              source, size, platform_handles));
+    case Type::SHARED_BUFFER:
+      return scoped_refptr<Dispatcher>(SharedBufferDispatcher::Deserialize(
+          source, size, platform_handles));
+    case Type::PLATFORM_HANDLE:
+      return scoped_refptr<Dispatcher>(PlatformHandleDispatcher::Deserialize(
+          source, size, platform_handles));
+  }
+  LOG(WARNING) << "Unknown dispatcher type " << type;
+  return nullptr;
+}
+
+MojoResult Dispatcher::Close() {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  CloseNoLock();
+  return MOJO_RESULT_OK;
+}
+
+MojoResult Dispatcher::WriteMessage(
+    const void* bytes,
+    uint32_t num_bytes,
+    std::vector<DispatcherTransport>* transports,
+    MojoWriteMessageFlags flags) {
+  DCHECK(!transports ||
+         (transports->size() > 0 &&
+          transports->size() < GetConfiguration().max_message_num_handles));
+
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return WriteMessageImplNoLock(bytes, num_bytes, transports, flags);
+}
+
+MojoResult Dispatcher::ReadMessage(void* bytes,
+                                   uint32_t* num_bytes,
+                                   DispatcherVector* dispatchers,
+                                   uint32_t* num_dispatchers,
+                                   MojoReadMessageFlags flags) {
+  DCHECK(!num_dispatchers || *num_dispatchers == 0 ||
+         (dispatchers && dispatchers->empty()));
+
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return ReadMessageImplNoLock(bytes, num_bytes, dispatchers, num_dispatchers,
+                               flags);
+}
+
+MojoResult Dispatcher::WriteData(const void* elements,
+                                 uint32_t* num_bytes,
+                                 MojoWriteDataFlags flags) {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return WriteDataImplNoLock(elements, num_bytes, flags);
+}
+
+MojoResult Dispatcher::BeginWriteData(void** buffer,
+                                      uint32_t* buffer_num_bytes,
+                                      MojoWriteDataFlags flags) {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return BeginWriteDataImplNoLock(buffer, buffer_num_bytes, flags);
+}
+
+MojoResult Dispatcher::EndWriteData(uint32_t num_bytes_written) {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return EndWriteDataImplNoLock(num_bytes_written);
+}
+
+MojoResult Dispatcher::ReadData(void* elements,
+                                uint32_t* num_bytes,
+                                MojoReadDataFlags flags) {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return ReadDataImplNoLock(elements, num_bytes, flags);
+}
+
+MojoResult Dispatcher::BeginReadData(const void** buffer,
+                                     uint32_t* buffer_num_bytes,
+                                     MojoReadDataFlags flags) {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return BeginReadDataImplNoLock(buffer, buffer_num_bytes, flags);
+}
+
+MojoResult Dispatcher::EndReadData(uint32_t num_bytes_read) {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return EndReadDataImplNoLock(num_bytes_read);
+}
+
+MojoResult Dispatcher::DuplicateBufferHandle(
+    const MojoDuplicateBufferHandleOptions* options,
+    scoped_refptr<Dispatcher>* new_dispatcher) {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return DuplicateBufferHandleImplNoLock(options, new_dispatcher);
+}
+
+MojoResult Dispatcher::MapBuffer(
+    uint64_t offset,
+    uint64_t num_bytes,
+    MojoMapBufferFlags flags,
+    scoped_ptr<PlatformSharedBufferMapping>* mapping) {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  return MapBufferImplNoLock(offset, num_bytes, flags, mapping);
+}
+
+HandleSignalsState Dispatcher::GetHandleSignalsState() const {
+  base::AutoLock locker(lock_);
+  if (is_closed_)
+    return HandleSignalsState();
+
+  return GetHandleSignalsStateImplNoLock();
+}
+
+MojoResult Dispatcher::AddAwakable(Awakable* awakable,
+                                   MojoHandleSignals signals,
+                                   uint32_t context,
+                                   HandleSignalsState* signals_state) {
+  base::AutoLock locker(lock_);
+  if (is_closed_) {
+    if (signals_state)
+      *signals_state = HandleSignalsState();
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  }
+
+  return AddAwakableImplNoLock(awakable, signals, context, signals_state);
+}
+
+void Dispatcher::RemoveAwakable(Awakable* awakable,
+                                HandleSignalsState* handle_signals_state) {
+  base::AutoLock locker(lock_);
+  if (is_closed_) {
+    if (handle_signals_state)
+      *handle_signals_state = HandleSignalsState();
+    return;
+  }
+
+  RemoveAwakableImplNoLock(awakable, handle_signals_state);
+}
+
+Dispatcher::Dispatcher() : is_closed_(false) {
+}
+
+Dispatcher::~Dispatcher() {
+  // Make sure that |Close()| was called.
+  DCHECK(is_closed_);
+}
+
+void Dispatcher::CancelAllAwakablesNoLock() {
+  lock_.AssertAcquired();
+  DCHECK(is_closed_);
+  // By default, waiting isn't supported. Only dispatchers that can be waited on
+  // will do something nontrivial.
+}
+
+void Dispatcher::CloseImplNoLock() {
+  lock_.AssertAcquired();
+  DCHECK(is_closed_);
+  // This may not need to do anything. Dispatchers should override this to do
+  // any actual close-time cleanup necessary.
+}
+
+MojoResult Dispatcher::WriteMessageImplNoLock(
+    const void* /*bytes*/,
+    uint32_t /*num_bytes*/,
+    std::vector<DispatcherTransport>* /*transports*/,
+    MojoWriteMessageFlags /*flags*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for message pipe dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::ReadMessageImplNoLock(
+    void* /*bytes*/,
+    uint32_t* /*num_bytes*/,
+    DispatcherVector* /*dispatchers*/,
+    uint32_t* /*num_dispatchers*/,
+    MojoReadMessageFlags /*flags*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for message pipe dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::WriteDataImplNoLock(const void* /*elements*/,
+                                           uint32_t* /*num_bytes*/,
+                                           MojoWriteDataFlags /*flags*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for data pipe dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::BeginWriteDataImplNoLock(
+    void** /*buffer*/,
+    uint32_t* /*buffer_num_bytes*/,
+    MojoWriteDataFlags /*flags*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for data pipe dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::EndWriteDataImplNoLock(uint32_t /*num_bytes_written*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for data pipe dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::ReadDataImplNoLock(void* /*elements*/,
+                                          uint32_t* /*num_bytes*/,
+                                          MojoReadDataFlags /*flags*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for data pipe dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::BeginReadDataImplNoLock(
+    const void** /*buffer*/,
+    uint32_t* /*buffer_num_bytes*/,
+    MojoReadDataFlags /*flags*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for data pipe dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::EndReadDataImplNoLock(uint32_t /*num_bytes_read*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for data pipe dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::DuplicateBufferHandleImplNoLock(
+    const MojoDuplicateBufferHandleOptions* /*options*/,
+    scoped_refptr<Dispatcher>* /*new_dispatcher*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for buffer dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+MojoResult Dispatcher::MapBufferImplNoLock(
+    uint64_t /*offset*/,
+    uint64_t /*num_bytes*/,
+    MojoMapBufferFlags /*flags*/,
+    scoped_ptr<PlatformSharedBufferMapping>* /*mapping*/) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, not supported. Only needed for buffer dispatchers.
+  return MOJO_RESULT_INVALID_ARGUMENT;
+}
+
+HandleSignalsState Dispatcher::GetHandleSignalsStateImplNoLock() const {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, waiting isn't supported. Only dispatchers that can be waited on
+  // will do something nontrivial.
+  return HandleSignalsState();
+}
+
+MojoResult Dispatcher::AddAwakableImplNoLock(
+    Awakable* /*awakable*/,
+    MojoHandleSignals /*signals*/,
+    uint32_t /*context*/,
+    HandleSignalsState* signals_state) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, waiting isn't supported. Only dispatchers that can be waited on
+  // will do something nontrivial.
+  if (signals_state)
+    *signals_state = HandleSignalsState();
+  return MOJO_RESULT_FAILED_PRECONDITION;
+}
+
+void Dispatcher::RemoveAwakableImplNoLock(Awakable* /*awakable*/,
+                                          HandleSignalsState* signals_state) {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // By default, waiting isn't supported. Only dispatchers that can be waited on
+  // will do something nontrivial.
+  if (signals_state)
+    *signals_state = HandleSignalsState();
+}
+
+void Dispatcher::StartSerializeImplNoLock(size_t* max_size,
+                                          size_t* max_platform_handles) {
+  DCHECK(HasOneRef());  // Only one ref => no need to take the lock.
+  DCHECK(!is_closed_);
+  *max_size = 0;
+  *max_platform_handles = 0;
+}
+
+bool Dispatcher::EndSerializeAndCloseImplNoLock(
+    void* /*destination*/,
+    size_t* /*actual_size*/,
+    PlatformHandleVector* /*platform_handles*/) {
+  DCHECK(HasOneRef());  // Only one ref => no need to take the lock.
+  DCHECK(is_closed_);
+  // By default, serializing isn't supported, so just close.
+  CloseImplNoLock();
+  return false;
+}
+
+bool Dispatcher::IsBusyNoLock() const {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+  // Most dispatchers support only "atomic" operations, so they are never busy
+  // (in this sense).
+  return false;
+}
+
+void Dispatcher::CloseNoLock() {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+
+  is_closed_ = true;
+  CancelAllAwakablesNoLock();
+  CloseImplNoLock();
+}
+
+scoped_refptr<Dispatcher>
+Dispatcher::CreateEquivalentDispatcherAndCloseNoLock() {
+  lock_.AssertAcquired();
+  DCHECK(!is_closed_);
+
+  is_closed_ = true;
+  CancelAllAwakablesNoLock();
+  return CreateEquivalentDispatcherAndCloseImplNoLock();
+}
+
+void Dispatcher::StartSerialize(size_t* max_size,
+                                size_t* max_platform_handles) {
+  DCHECK(max_size);
+  DCHECK(max_platform_handles);
+  DCHECK(!is_closed_);
+  StartSerializeImplNoLock(max_size, max_platform_handles);
+}
+
+bool Dispatcher::EndSerializeAndClose(void* destination,
+                                      size_t* actual_size,
+                                      PlatformHandleVector* platform_handles) {
+  DCHECK(actual_size);
+  DCHECK(!is_closed_);
+
+  // Like other |...Close()| methods, we mark ourselves as closed before calling
+  // the impl. But there's no need to cancel waiters: we shouldn't have any (and
+  // shouldn't be in |Core|'s handle table.
+  is_closed_ = true;
+
+#if !defined(NDEBUG)
+  // See the comment above |EndSerializeAndCloseImplNoLock()|. In brief: Locking
+  // isn't actually needed, but we need to satisfy assertions (which we don't
+  // want to remove or weaken).
+  base::AutoLock locker(lock_);
+#endif
+
+  return EndSerializeAndCloseImplNoLock(destination, actual_size,
+                                        platform_handles);
+}
+
+// DispatcherTransport ---------------------------------------------------------
+
+void DispatcherTransport::End() {
+  DCHECK(dispatcher_);
+  dispatcher_->lock_.Release();
+
+  dispatcher_->TransportEnded();
+
+  dispatcher_ = nullptr;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/dispatcher.h b/mojo/edk/system/dispatcher.h
new file mode 100644
index 0000000..514c329
--- /dev/null
+++ b/mojo/edk/system/dispatcher.h
@@ -0,0 +1,409 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_DISPATCHER_H_
+#define MOJO_EDK_SYSTEM_DISPATCHER_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <ostream>
+#include <vector>
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/synchronization/lock.h"
+#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/system/handle_signals_state.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/buffer.h"
+#include "mojo/public/c/system/data_pipe.h"
+#include "mojo/public/c/system/message_pipe.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+class Core;
+class Dispatcher;
+class DispatcherTransport;
+class HandleTable;
+class LocalMessagePipeEndpoint;
+class PlatformSharedBufferMapping;
+class ProxyMessagePipeEndpoint;
+class TransportData;
+class Awakable;
+
+using DispatcherVector = std::vector<scoped_refptr<Dispatcher>>;
+
+namespace test {
+
+// Test helper. We need to declare it here so we can friend it.
+MOJO_SYSTEM_IMPL_EXPORT DispatcherTransport
+DispatcherTryStartTransport(Dispatcher* dispatcher);
+
+}  // namespace test
+
+// A |Dispatcher| implements Mojo primitives that are "attached" to a particular
+// handle. This includes most (all?) primitives except for |MojoWait...()|. This
+// object is thread-safe, with its state being protected by a single lock
+// |lock_|, which is also made available to implementation subclasses (via the
+// |lock()| method).
+class MOJO_SYSTEM_IMPL_EXPORT Dispatcher
+    : public base::RefCountedThreadSafe<Dispatcher> {
+ public:
+  enum class Type {
+    UNKNOWN = 0,
+    MESSAGE_PIPE,
+    DATA_PIPE_PRODUCER,
+    DATA_PIPE_CONSUMER,
+    SHARED_BUFFER,
+
+    // "Private" types (not exposed via the public interface):
+    PLATFORM_HANDLE = -1
+  };
+  virtual Type GetType() const = 0;
+
+  // These methods implement the various primitives named |Mojo...()|. These
+  // take |lock_| and handle races with |Close()|. Then they call out to
+  // subclasses' |...ImplNoLock()| methods (still under |lock_|), which actually
+  // implement the primitives.
+  // NOTE(vtl): This puts a big lock around each dispatcher (i.e., handle), and
+  // prevents the various |...ImplNoLock()|s from releasing the lock as soon as
+  // possible. If this becomes an issue, we can rethink this.
+  MojoResult Close();
+
+  // |transports| may be non-null if and only if there are handles to be
+  // written; not that |this| must not be in |transports|. On success, all the
+  // dispatchers in |transports| must have been moved to a closed state; on
+  // failure, they should remain in their original state.
+  MojoResult WriteMessage(const void* bytes,
+                          uint32_t num_bytes,
+                          std::vector<DispatcherTransport>* transports,
+                          MojoWriteMessageFlags flags);
+  // |dispatchers| must be non-null but empty, if |num_dispatchers| is non-null
+  // and nonzero. On success, it will be set to the dispatchers to be received
+  // (and assigned handles) as part of the message.
+  MojoResult ReadMessage(void* bytes,
+                         uint32_t* num_bytes,
+                         DispatcherVector* dispatchers,
+                         uint32_t* num_dispatchers,
+                         MojoReadMessageFlags flags);
+  MojoResult WriteData(const void* elements,
+                       uint32_t* elements_num_bytes,
+                       MojoWriteDataFlags flags);
+  MojoResult BeginWriteData(void** buffer,
+                            uint32_t* buffer_num_bytes,
+                            MojoWriteDataFlags flags);
+  MojoResult EndWriteData(uint32_t num_bytes_written);
+  MojoResult ReadData(void* elements,
+                      uint32_t* num_bytes,
+                      MojoReadDataFlags flags);
+  MojoResult BeginReadData(const void** buffer,
+                           uint32_t* buffer_num_bytes,
+                           MojoReadDataFlags flags);
+  MojoResult EndReadData(uint32_t num_bytes_read);
+  // |options| may be null. |new_dispatcher| must not be null, but
+  // |*new_dispatcher| should be null (and will contain the dispatcher for the
+  // new handle on success).
+  MojoResult DuplicateBufferHandle(
+      const MojoDuplicateBufferHandleOptions* options,
+      scoped_refptr<Dispatcher>* new_dispatcher);
+  MojoResult MapBuffer(
+      uint64_t offset,
+      uint64_t num_bytes,
+      MojoMapBufferFlags flags,
+      scoped_ptr<PlatformSharedBufferMapping>* mapping);
+
+  // Gets the current handle signals state. (The default implementation simply
+  // returns a default-constructed |HandleSignalsState|, i.e., no signals
+  // satisfied or satisfiable.) Note: The state is subject to change from other
+  // threads.
+  HandleSignalsState GetHandleSignalsState() const;
+
+  // Adds an awakable to this dispatcher, which will be woken up when this
+  // object changes state to satisfy |signals| with context |context|. It will
+  // also be woken up when it becomes impossible for the object to ever satisfy
+  // |signals| with a suitable error status.
+  //
+  // If |signals_state| is non-null, on *failure* |*signals_state| will be set
+  // to the current handle signals state (on success, it is left untouched).
+  //
+  // Returns:
+  //  - |MOJO_RESULT_OK| if the awakable was added;
+  //  - |MOJO_RESULT_ALREADY_EXISTS| if |signals| is already satisfied;
+  //  - |MOJO_RESULT_INVALID_ARGUMENT| if the dispatcher has been closed; and
+  //  - |MOJO_RESULT_FAILED_PRECONDITION| if it is not (or no longer) possible
+  //    that |signals| will ever be satisfied.
+  MojoResult AddAwakable(Awakable* awakable,
+                         MojoHandleSignals signals,
+                         uint32_t context,
+                         HandleSignalsState* signals_state);
+  // Removes an awakable from this dispatcher. (It is valid to call this
+  // multiple times for the same |awakable| on the same object, so long as
+  // |AddAwakable()| was called at most once.) If |signals_state| is non-null,
+  // |*signals_state| will be set to the current handle signals state.
+  void RemoveAwakable(Awakable* awakable, HandleSignalsState* signals_state);
+
+  // A dispatcher must be put into a special state in order to be sent across a
+  // message pipe. Outside of tests, only |HandleTableAccess| is allowed to do
+  // this, since there are requirements on the handle table (see below).
+  //
+  // In this special state, only a restricted set of operations is allowed.
+  // These are the ones available as |DispatcherTransport| methods. Other
+  // |Dispatcher| methods must not be called until |DispatcherTransport::End()|
+  // has been called.
+  class HandleTableAccess {
+   private:
+    friend class Core;
+    friend class HandleTable;
+    // Tests also need this, to avoid needing |Core|.
+    friend DispatcherTransport test::DispatcherTryStartTransport(Dispatcher*);
+
+    // This must be called under the handle table lock and only if the handle
+    // table entry is not marked busy. The caller must maintain a reference to
+    // |dispatcher| until |DispatcherTransport::End()| is called.
+    static DispatcherTransport TryStartTransport(Dispatcher* dispatcher);
+  };
+
+  // A |TransportData| may serialize dispatchers that are given to it (and which
+  // were previously attached to the |MessageInTransit| that is creating it) and
+  // and then (probably in a different process) deserialize.
+  // Note that the |MessageInTransit| "owns" (i.e., has the only ref to) these
+  // dispatchers, so there are no locking issues. (There's no lock ordering
+  // issue, and in fact no need to take dispatcher locks at all.)
+  // TODO(vtl): Consider making another wrapper similar to |DispatcherTransport|
+  // (but with an owning, unique reference), and having
+  // |CreateEquivalentDispatcherAndCloseImplNoLock()| return that wrapper (and
+  // |MessageInTransit|, etc. only holding on to such wrappers).
+  class TransportDataAccess {
+   private:
+    friend class TransportData;
+
+    // Serialization API. These functions may only be called on such
+    // dispatchers. See the |Dispatcher| methods of the same names for more
+    // details.
+    static void StartSerialize(Dispatcher* dispatcher,
+                               size_t* max_size,
+                               size_t* max_platform_handles);
+    static bool EndSerializeAndClose(
+        Dispatcher* dispatcher,
+        void* destination,
+        size_t* actual_size,
+        PlatformHandleVector* platform_handles);
+
+    // Deserialization API.
+    // Note: This "clears" (i.e., reset to the invalid handle) any platform
+    // handles that it takes ownership of.
+    static scoped_refptr<Dispatcher> Deserialize(
+        int32_t type,
+        const void* source,
+        size_t size,
+        PlatformHandleVector* platform_handles);
+  };
+
+ protected:
+  friend class base::RefCountedThreadSafe<Dispatcher>;
+  friend class MessagePipeDispatcher;  // For TransportStarted/TransportEnded.
+
+  Dispatcher();
+  virtual ~Dispatcher();
+
+  // These are to be overridden by subclasses (if necessary). They are called
+  // exactly once -- first |CancelAllAwakablesNoLock()|, then
+  // |CloseImplNoLock()|,
+  // when the dispatcher is being closed. They are called under |lock_|.
+  virtual void CancelAllAwakablesNoLock();
+  virtual void CloseImplNoLock();
+  virtual scoped_refptr<Dispatcher>
+  CreateEquivalentDispatcherAndCloseImplNoLock() = 0;
+
+  // These are to be overridden by subclasses (if necessary). They are never
+  // called after the dispatcher has been closed. They are called under |lock_|.
+  // See the descriptions of the methods without the "ImplNoLock" for more
+  // information.
+  virtual MojoResult WriteMessageImplNoLock(
+      const void* bytes,
+      uint32_t num_bytes,
+      std::vector<DispatcherTransport>* transports,
+      MojoWriteMessageFlags flags);
+  virtual MojoResult ReadMessageImplNoLock(void* bytes,
+                                           uint32_t* num_bytes,
+                                           DispatcherVector* dispatchers,
+                                           uint32_t* num_dispatchers,
+                                           MojoReadMessageFlags flags);
+  virtual MojoResult WriteDataImplNoLock(const void* elements,
+                                         uint32_t* num_bytes,
+                                         MojoWriteDataFlags flags);
+  virtual MojoResult BeginWriteDataImplNoLock(
+      void** buffer,
+      uint32_t* buffer_num_bytes,
+      MojoWriteDataFlags flags);
+  virtual MojoResult EndWriteDataImplNoLock(uint32_t num_bytes_written);
+  virtual MojoResult ReadDataImplNoLock(void* elements,
+                                        uint32_t* num_bytes,
+                                        MojoReadDataFlags flags);
+  virtual MojoResult BeginReadDataImplNoLock(
+      const void** buffer,
+      uint32_t* buffer_num_bytes,
+      MojoReadDataFlags flags);
+  virtual MojoResult EndReadDataImplNoLock(uint32_t num_bytes_read);
+  virtual MojoResult DuplicateBufferHandleImplNoLock(
+      const MojoDuplicateBufferHandleOptions* options,
+      scoped_refptr<Dispatcher>* new_dispatcher);
+  virtual MojoResult MapBufferImplNoLock(
+      uint64_t offset,
+      uint64_t num_bytes,
+      MojoMapBufferFlags flags,
+      scoped_ptr<PlatformSharedBufferMapping>* mapping);
+  virtual HandleSignalsState GetHandleSignalsStateImplNoLock() const;
+  virtual MojoResult AddAwakableImplNoLock(Awakable* awakable,
+                                           MojoHandleSignals signals,
+                                           uint32_t context,
+                                           HandleSignalsState* signals_state);
+  virtual void RemoveAwakableImplNoLock(Awakable* awakable,
+                                        HandleSignalsState* signals_state);
+
+  // These implement the API used to serialize dispatchers (described below).
+  // They will only be called on a dispatcher that's attached to and "owned" by
+  // a |MessageInTransit|. See the non-"impl" versions for more information.
+  //
+  // Note: |StartSerializeImplNoLock()| is actually called with |lock_| NOT
+  // held, since the dispatcher should only be accessible to the calling thread.
+  // On Debug builds, |EndSerializeAndCloseImplNoLock()| is called with |lock_|
+  // held, to satisfy any |lock_.AssertAcquired()| (e.g., in |CloseImplNoLock()|
+  // -- and anything it calls); disentangling those assertions is
+  // difficult/fragile, and would weaken our general checking of invariants.
+  //
+  // TODO(vtl): Consider making these pure virtual once most things support
+  // being passed over a message pipe.
+  virtual void StartSerializeImplNoLock(size_t* max_size,
+                                        size_t* max_platform_handles);
+  virtual bool EndSerializeAndCloseImplNoLock(
+      void* destination,
+      size_t* actual_size,
+      PlatformHandleVector* platform_handles);
+
+  // These are called before and after a dispatcher is being transported. i.e.
+  // |TransportStarted| is called |StartSerializeImplNoLock| and
+  // |TransportEnded| is called after |EndSerializeAndCloseImplNoLock|. They are
+  // needed to avoid deadlocks when transporting a dispatcher. The reason is
+  // that |StartSerializeImplNoLock| is called on the main thread and will lead
+  // to calling RawChannel::ReleaseHandle. The dispatcher is locked and it will
+  // acquire RawChannel's locks as well. however the RawChannel could have its
+  // locks acquired on the IO thread and be waiting to acquire the dispatcher's
+  // lock. To solve this deadlock, |TransportStarted| is called before the
+  // dispatcher's lock is acquired.
+  virtual void TransportStarted() {}
+  virtual void TransportEnded() {}
+
+  // This should be overridden to return true if/when there's an ongoing
+  // operation (e.g., two-phase read/writes on data pipes) that should prevent a
+  // handle from being sent over a message pipe (with status "busy").
+  virtual bool IsBusyNoLock() const;
+
+  // Available to subclasses. (Note: Returns a non-const reference, just like
+  // |base::AutoLock|'s constructor takes a non-const reference.)
+  base::Lock& lock() const { return lock_; }
+
+ private:
+  friend class DispatcherTransport;
+
+  // Closes the dispatcher. This must be done under lock, and unlike |Close()|,
+  // the dispatcher must not be closed already. (This is the "equivalent" of
+  // |CreateEquivalentDispatcherAndCloseNoLock()|, for situations where the
+  // dispatcher must be disposed of instead of "transferred".)
+  void CloseNoLock();
+
+  // Creates an equivalent dispatcher -- representing the same resource as this
+  // dispatcher -- and close (i.e., disable) this dispatcher. I.e., this
+  // dispatcher will look as though it was closed, but the resource it
+  // represents will be assigned to the new dispatcher. This must be called
+  // under the dispatcher's lock.
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseNoLock();
+
+  // API to serialize dispatchers, exposed to only |TransportData| (via
+  // |TransportData|). They may only be called on a dispatcher attached to a
+  // |MessageInTransit| (and in particular not in |CoreImpl|'s handle table).
+  //
+  // Starts the serialization. Returns (via the two "out" parameters) the
+  // maximum amount of space that may be needed to serialize this dispatcher (no
+  // more than |TransportData::kMaxSerializedDispatcherSize|) and the maximum
+  // number of |PlatformHandle|s that may need to be attached (no more than
+  // |TransportData::kMaxSerializedDispatcherPlatformHandles|). If this
+  // dispatcher cannot be serialized, |*max_size| and |*max_platform_handles|
+  // should be set to zero. A call to this method will ALWAYS be followed by a
+  // call to |EndSerializeAndClose()| (even if this dispatcher cannot be
+  // serialized).
+  void StartSerialize(size_t* max_size,
+                      size_t* max_platform_handles);
+  // Completes the serialization of this dispatcher and closes it. (This call
+  // will always follow an earlier call to |StartSerialize()|. This does so by
+  // writing to |destination| and appending any |PlatformHandle|s needed to
+  // |platform_handles| (which may be null if no platform handles were indicated
+  // to be required to |StartSerialize()|). This may write no more than the
+  // amount indicated by |StartSerialize()|. (WARNING: Beware of races, e.g., if
+  // something can be mutated between the two calls!) Returns true on success,
+  // in which case |*actual_size| is set to the amount it actually wrote to
+  // |destination|. On failure, |*actual_size| should not be modified; however,
+  // the dispatcher will still be closed.
+  bool EndSerializeAndClose(void* destination,
+                            size_t* actual_size,
+                            PlatformHandleVector* platform_handles);
+
+  // This protects the following members as well as any state added by
+  // subclasses.
+  mutable base::Lock lock_;
+  bool is_closed_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(Dispatcher);
+};
+
+// Wrapper around a |Dispatcher| pointer, while it's being processed to be
+// passed in a message pipe. See the comment about
+// |Dispatcher::HandleTableAccess| for more details.
+//
+// Note: This class is deliberately "thin" -- no more expensive than a
+// |Dispatcher*|.
+class MOJO_SYSTEM_IMPL_EXPORT DispatcherTransport {
+ public:
+  DispatcherTransport() : dispatcher_(nullptr) {}
+
+  void End();
+
+  Dispatcher::Type GetType() const { return dispatcher_->GetType(); }
+  bool IsBusy() const { return dispatcher_->IsBusyNoLock(); }
+  void Close() { dispatcher_->CloseNoLock(); }
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndClose() {
+    return dispatcher_->CreateEquivalentDispatcherAndCloseNoLock();
+  }
+
+  bool is_valid() const { return !!dispatcher_; }
+
+ protected:
+  Dispatcher* dispatcher() { return dispatcher_; }
+
+ private:
+  friend class Dispatcher::HandleTableAccess;
+  friend class MessagePipeDispatcher;  // For AttachTransportsNoLock.
+
+  explicit DispatcherTransport(Dispatcher* dispatcher)
+      : dispatcher_(dispatcher) {}
+
+  Dispatcher* dispatcher_;
+
+  // Copy and assign allowed.
+};
+
+// So logging macros and |DCHECK_EQ()|, etc. work.
+MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(std::ostream& out,
+                                                        Dispatcher::Type type) {
+  return out << static_cast<int>(type);
+}
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_DISPATCHER_H_
diff --git a/mojo/edk/system/dispatcher_unittest.cc b/mojo/edk/system/dispatcher_unittest.cc
new file mode 100644
index 0000000..8b3017e
--- /dev/null
+++ b/mojo/edk/system/dispatcher_unittest.cc
@@ -0,0 +1,295 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/dispatcher.h"
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_vector.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/threading/simple_thread.h"
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/system/waiter.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+// Trivial subclass that makes the constructor public.
+class TrivialDispatcher final : public Dispatcher {
+ public:
+  TrivialDispatcher() {}
+
+  Type GetType() const override { return Type::UNKNOWN; }
+
+ private:
+  friend class base::RefCountedThreadSafe<TrivialDispatcher>;
+  ~TrivialDispatcher() override {}
+
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
+      override {
+    lock().AssertAcquired();
+    return scoped_refptr<Dispatcher>(new TrivialDispatcher());
+  }
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(TrivialDispatcher);
+};
+
+TEST(DispatcherTest, Basic) {
+  scoped_refptr<Dispatcher> d(new TrivialDispatcher());
+
+  EXPECT_EQ(Dispatcher::Type::UNKNOWN, d->GetType());
+
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->WriteMessage(nullptr, 0, nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->ReadMessage(nullptr, nullptr, nullptr, nullptr,
+                           MOJO_WRITE_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->WriteData(nullptr, nullptr, MOJO_WRITE_DATA_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->BeginWriteData(nullptr, nullptr, MOJO_WRITE_DATA_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, d->EndWriteData(0));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->ReadData(nullptr, nullptr, MOJO_READ_DATA_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->BeginReadData(nullptr, nullptr, MOJO_READ_DATA_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, d->EndReadData(0));
+  Waiter w;
+  w.Init();
+  HandleSignalsState hss;
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            d->AddAwakable(&w, ~MOJO_HANDLE_SIGNAL_NONE, 0, &hss));
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+  // Okay to remove even if it wasn't added (or was already removed).
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+
+  EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->WriteMessage(nullptr, 0, nullptr, MOJO_WRITE_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->ReadMessage(nullptr, nullptr, nullptr, nullptr,
+                           MOJO_WRITE_MESSAGE_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->WriteData(nullptr, nullptr, MOJO_WRITE_DATA_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->BeginWriteData(nullptr, nullptr, MOJO_WRITE_DATA_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, d->EndWriteData(0));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->ReadData(nullptr, nullptr, MOJO_READ_DATA_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->BeginReadData(nullptr, nullptr, MOJO_READ_DATA_FLAG_NONE));
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, d->EndReadData(0));
+  hss = HandleSignalsState();
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->AddAwakable(&w, ~MOJO_HANDLE_SIGNAL_NONE, 0, &hss));
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+}
+
+class ThreadSafetyStressThread : public base::SimpleThread {
+ public:
+  enum DispatcherOp {
+    CLOSE = 0,
+    WRITE_MESSAGE,
+    READ_MESSAGE,
+    WRITE_DATA,
+    BEGIN_WRITE_DATA,
+    END_WRITE_DATA,
+    READ_DATA,
+    BEGIN_READ_DATA,
+    END_READ_DATA,
+    DUPLICATE_BUFFER_HANDLE,
+    MAP_BUFFER,
+    ADD_WAITER,
+    REMOVE_WAITER,
+    DISPATCHER_OP_COUNT
+  };
+
+  ThreadSafetyStressThread(base::WaitableEvent* event,
+                           scoped_refptr<Dispatcher> dispatcher,
+                           DispatcherOp op)
+      : base::SimpleThread("thread_safety_stress_thread"),
+        event_(event),
+        dispatcher_(dispatcher),
+        op_(op) {
+    CHECK_LE(0, op_);
+    CHECK_LT(op_, DISPATCHER_OP_COUNT);
+  }
+
+  ~ThreadSafetyStressThread() override { Join(); }
+
+ private:
+  void Run() override {
+    event_->Wait();
+
+    waiter_.Init();
+    switch (op_) {
+      case CLOSE: {
+        MojoResult r = dispatcher_->Close();
+        EXPECT_TRUE(r == MOJO_RESULT_OK || r == MOJO_RESULT_INVALID_ARGUMENT)
+            << "Result: " << r;
+        break;
+      }
+      case WRITE_MESSAGE:
+        EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+                  dispatcher_->WriteMessage(nullptr, 0, nullptr,
+                                            MOJO_WRITE_MESSAGE_FLAG_NONE));
+        break;
+      case READ_MESSAGE:
+        EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+                  dispatcher_->ReadMessage(nullptr, nullptr, nullptr, nullptr,
+                                           MOJO_WRITE_MESSAGE_FLAG_NONE));
+        break;
+      case WRITE_DATA:
+        EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+                  dispatcher_->WriteData(nullptr, nullptr,
+                                         MOJO_WRITE_DATA_FLAG_NONE));
+        break;
+      case BEGIN_WRITE_DATA:
+        EXPECT_EQ(
+            MOJO_RESULT_INVALID_ARGUMENT,
+            dispatcher_->BeginWriteData(nullptr, nullptr,
+                                        MOJO_WRITE_DATA_FLAG_NONE));
+        break;
+      case END_WRITE_DATA:
+        EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, dispatcher_->EndWriteData(0));
+        break;
+      case READ_DATA:
+        EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+                  dispatcher_->ReadData(nullptr, nullptr,
+                                        MOJO_READ_DATA_FLAG_NONE));
+        break;
+      case BEGIN_READ_DATA:
+        EXPECT_EQ(
+            MOJO_RESULT_INVALID_ARGUMENT,
+            dispatcher_->BeginReadData(nullptr, nullptr,
+                                       MOJO_READ_DATA_FLAG_NONE));
+        break;
+      case END_READ_DATA:
+        EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, dispatcher_->EndReadData(0));
+        break;
+      case DUPLICATE_BUFFER_HANDLE: {
+        scoped_refptr<Dispatcher> unused;
+        EXPECT_EQ(
+            MOJO_RESULT_INVALID_ARGUMENT,
+            dispatcher_->DuplicateBufferHandle(nullptr, &unused));
+        break;
+      }
+      case MAP_BUFFER: {
+        scoped_ptr<PlatformSharedBufferMapping> unused;
+        EXPECT_EQ(
+            MOJO_RESULT_INVALID_ARGUMENT,
+            dispatcher_->MapBuffer(0u, 0u, MOJO_MAP_BUFFER_FLAG_NONE, &unused));
+        break;
+      }
+      case ADD_WAITER: {
+        HandleSignalsState hss;
+        MojoResult r = dispatcher_->AddAwakable(
+            &waiter_, ~MOJO_HANDLE_SIGNAL_NONE, 0, &hss);
+        EXPECT_TRUE(r == MOJO_RESULT_FAILED_PRECONDITION ||
+                    r == MOJO_RESULT_INVALID_ARGUMENT);
+        EXPECT_EQ(0u, hss.satisfied_signals);
+        EXPECT_EQ(0u, hss.satisfiable_signals);
+        break;
+      }
+      case REMOVE_WAITER: {
+        HandleSignalsState hss;
+        dispatcher_->RemoveAwakable(&waiter_, &hss);
+        EXPECT_EQ(0u, hss.satisfied_signals);
+        EXPECT_EQ(0u, hss.satisfiable_signals);
+        break;
+      }
+      default:
+        NOTREACHED();
+        break;
+    }
+
+    // Always try to remove the waiter, in case we added it.
+    HandleSignalsState hss;
+    dispatcher_->RemoveAwakable(&waiter_, &hss);
+    EXPECT_EQ(0u, hss.satisfied_signals);
+    EXPECT_EQ(0u, hss.satisfiable_signals);
+  }
+
+  base::WaitableEvent* const event_;
+  const scoped_refptr<Dispatcher> dispatcher_;
+  const DispatcherOp op_;
+
+  Waiter waiter_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ThreadSafetyStressThread);
+};
+
+TEST(DispatcherTest, ThreadSafetyStress) {
+  static const size_t kRepeatCount = 20;
+  static const size_t kNumThreads = 100;
+
+  for (size_t i = 0; i < kRepeatCount; i++) {
+    // Manual reset, not initially signalled.
+    base::WaitableEvent event(true, false);
+    scoped_refptr<Dispatcher> d(new TrivialDispatcher());
+
+    {
+      ScopedVector<ThreadSafetyStressThread> threads;
+      for (size_t j = 0; j < kNumThreads; j++) {
+        ThreadSafetyStressThread::DispatcherOp op =
+            static_cast<ThreadSafetyStressThread::DispatcherOp>(
+                (i + j) % ThreadSafetyStressThread::DISPATCHER_OP_COUNT);
+        threads.push_back(new ThreadSafetyStressThread(&event, d, op));
+        threads.back()->Start();
+      }
+      // Kicks off real work on the threads:
+      event.Signal();
+    }  // Joins all the threads.
+
+    // One of the threads should already have closed the dispatcher.
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT, d->Close());
+  }
+}
+
+TEST(DispatcherTest, ThreadSafetyStressNoClose) {
+  static const size_t kRepeatCount = 20;
+  static const size_t kNumThreads = 100;
+
+  for (size_t i = 0; i < kRepeatCount; i++) {
+    // Manual reset, not initially signalled.
+    base::WaitableEvent event(true, false);
+    scoped_refptr<Dispatcher> d(new TrivialDispatcher());
+
+    {
+      ScopedVector<ThreadSafetyStressThread> threads;
+      for (size_t j = 0; j < kNumThreads; j++) {
+        ThreadSafetyStressThread::DispatcherOp op =
+            static_cast<ThreadSafetyStressThread::DispatcherOp>(
+                (i + j) % (ThreadSafetyStressThread::DISPATCHER_OP_COUNT - 1) +
+                1);
+        threads.push_back(new ThreadSafetyStressThread(&event, d, op));
+        threads.back()->Start();
+      }
+      // Kicks off real work on the threads:
+      event.Signal();
+    }  // Joins all the threads.
+
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/handle_signals_state.h b/mojo/edk/system/handle_signals_state.h
new file mode 100644
index 0000000..1c47a28
--- /dev/null
+++ b/mojo/edk/system/handle_signals_state.h
@@ -0,0 +1,49 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_HANDLE_SIGNALS_STATE_H_
+#define MOJO_EDK_SYSTEM_HANDLE_SIGNALS_STATE_H_
+
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+
+namespace mojo {
+namespace edk {
+
+// Just "add" some constructors and methods to the C struct
+// |MojoHandleSignalsState| (for convenience). This should add no overhead.
+struct MOJO_SYSTEM_IMPL_EXPORT HandleSignalsState final
+    : public MojoHandleSignalsState {
+  HandleSignalsState() {
+    satisfied_signals = MOJO_HANDLE_SIGNAL_NONE;
+    satisfiable_signals = MOJO_HANDLE_SIGNAL_NONE;
+  }
+  HandleSignalsState(MojoHandleSignals satisfied,
+                     MojoHandleSignals satisfiable) {
+    satisfied_signals = satisfied;
+    satisfiable_signals = satisfiable;
+  }
+
+  bool equals(const HandleSignalsState& other) const {
+    return satisfied_signals == other.satisfied_signals &&
+           satisfiable_signals == other.satisfiable_signals;
+  }
+
+  bool satisfies(MojoHandleSignals signals) const {
+    return !!(satisfied_signals & signals);
+  }
+
+  bool can_satisfy(MojoHandleSignals signals) const {
+    return !!(satisfiable_signals & signals);
+  }
+
+  // (Copy and assignment allowed.)
+};
+static_assert(sizeof(HandleSignalsState) == sizeof(MojoHandleSignalsState),
+              "HandleSignalsState should add no overhead");
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_HANDLE_SIGNALS_STATE_H_
diff --git a/mojo/edk/system/handle_table.cc b/mojo/edk/system/handle_table.cc
new file mode 100644
index 0000000..a9774c8
--- /dev/null
+++ b/mojo/edk/system/handle_table.cc
@@ -0,0 +1,243 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/handle_table.h"
+
+#include <limits>
+
+#include "base/logging.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/dispatcher.h"
+
+namespace mojo {
+namespace edk {
+
+HandleTable::Entry::Entry() : busy(false) {
+}
+
+HandleTable::Entry::Entry(const scoped_refptr<Dispatcher>& dispatcher)
+    : dispatcher(dispatcher), busy(false) {
+}
+
+HandleTable::Entry::~Entry() {
+  DCHECK(!busy);
+}
+
+HandleTable::HandleTable() : next_handle_(MOJO_HANDLE_INVALID + 1) {
+}
+
+HandleTable::~HandleTable() {
+  // This should usually not be reached (the only instance should be owned by
+  // the singleton |Core|, which lives forever), except in tests.
+}
+
+Dispatcher* HandleTable::GetDispatcher(MojoHandle handle) {
+  DCHECK_NE(handle, MOJO_HANDLE_INVALID);
+
+  HandleToEntryMap::iterator it = handle_to_entry_map_.find(handle);
+  if (it == handle_to_entry_map_.end())
+    return nullptr;
+  return it->second.dispatcher.get();
+}
+
+MojoResult HandleTable::GetAndRemoveDispatcher(
+    MojoHandle handle,
+    scoped_refptr<Dispatcher>* dispatcher) {
+  DCHECK_NE(handle, MOJO_HANDLE_INVALID);
+  DCHECK(dispatcher);
+
+  HandleToEntryMap::iterator it = handle_to_entry_map_.find(handle);
+  if (it == handle_to_entry_map_.end())
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  if (it->second.busy)
+    return MOJO_RESULT_BUSY;
+  *dispatcher = it->second.dispatcher;
+  handle_to_entry_map_.erase(it);
+
+  return MOJO_RESULT_OK;
+}
+
+MojoHandle HandleTable::AddDispatcher(
+    const scoped_refptr<Dispatcher>& dispatcher) {
+  if (handle_to_entry_map_.size() >= GetConfiguration().max_handle_table_size)
+    return MOJO_HANDLE_INVALID;
+  return AddDispatcherNoSizeCheck(dispatcher);
+}
+
+std::pair<MojoHandle, MojoHandle> HandleTable::AddDispatcherPair(
+    const scoped_refptr<Dispatcher>& dispatcher0,
+    const scoped_refptr<Dispatcher>& dispatcher1) {
+  if (handle_to_entry_map_.size() + 1 >=
+      GetConfiguration().max_handle_table_size)
+    return std::make_pair(MOJO_HANDLE_INVALID, MOJO_HANDLE_INVALID);
+  return std::make_pair(AddDispatcherNoSizeCheck(dispatcher0),
+                        AddDispatcherNoSizeCheck(dispatcher1));
+}
+
+bool HandleTable::AddDispatcherVector(const DispatcherVector& dispatchers,
+                                      MojoHandle* handles) {
+  size_t max_message_num_handles = GetConfiguration().max_message_num_handles;
+  size_t max_handle_table_size = GetConfiguration().max_handle_table_size;
+
+  DCHECK_LE(dispatchers.size(), max_message_num_handles);
+  DCHECK(handles);
+  DCHECK_LT(
+      static_cast<uint64_t>(max_handle_table_size) + max_message_num_handles,
+      std::numeric_limits<size_t>::max())
+      << "Addition may overflow";
+
+  if (handle_to_entry_map_.size() + dispatchers.size() > max_handle_table_size)
+    return false;
+
+  for (size_t i = 0; i < dispatchers.size(); i++) {
+    if (dispatchers[i]) {
+      handles[i] = AddDispatcherNoSizeCheck(dispatchers[i]);
+    } else {
+      LOG(WARNING) << "Invalid dispatcher at index " << i;
+      handles[i] = MOJO_HANDLE_INVALID;
+    }
+  }
+  return true;
+}
+
+MojoResult HandleTable::MarkBusyAndStartTransport(
+    MojoHandle disallowed_handle,
+    const MojoHandle* handles,
+    uint32_t num_handles,
+    std::vector<DispatcherTransport>* transports) {
+  DCHECK_NE(disallowed_handle, MOJO_HANDLE_INVALID);
+  DCHECK(handles);
+  DCHECK_LE(num_handles, GetConfiguration().max_message_num_handles);
+  DCHECK(transports);
+  DCHECK_EQ(transports->size(), num_handles);
+
+  std::vector<Entry*> entries(num_handles);
+
+  // First verify all the handles and get their dispatchers.
+  uint32_t i;
+  MojoResult error_result = MOJO_RESULT_INTERNAL;
+  for (i = 0; i < num_handles; i++) {
+    // Sending your own handle is not allowed (and, for consistency, returns
+    // "busy").
+    if (handles[i] == disallowed_handle) {
+      error_result = MOJO_RESULT_BUSY;
+      break;
+    }
+
+    HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]);
+    if (it == handle_to_entry_map_.end()) {
+      error_result = MOJO_RESULT_INVALID_ARGUMENT;
+      break;
+    }
+
+    entries[i] = &it->second;
+    if (entries[i]->busy) {
+      error_result = MOJO_RESULT_BUSY;
+      break;
+    }
+    // Note: By marking the handle as busy here, we're also preventing the
+    // same handle from being sent multiple times in the same message.
+    entries[i]->busy = true;
+
+    // Try to start the transport.
+    DispatcherTransport transport =
+        Dispatcher::HandleTableAccess::TryStartTransport(
+            entries[i]->dispatcher.get());
+    if (!transport.is_valid()) {
+      // Only log for Debug builds, since this is not a problem with the system
+      // code, but with user code.
+      DLOG(WARNING) << "Likely race condition in user code detected: attempt "
+                       "to transfer handle " << handles[i]
+                    << " while it is in use on a different thread";
+
+      // Unset the busy flag (since it won't be unset below).
+      entries[i]->busy = false;
+      error_result = MOJO_RESULT_BUSY;
+      break;
+    }
+
+    // Check if the dispatcher is busy (e.g., in a two-phase read/write).
+    // (Note that this must be done after the dispatcher's lock is acquired.)
+    if (transport.IsBusy()) {
+      // Unset the busy flag and end the transport (since it won't be done
+      // below).
+      entries[i]->busy = false;
+      transport.End();
+      error_result = MOJO_RESULT_BUSY;
+      break;
+    }
+
+    // Hang on to the transport (which we'll need to end the transport).
+    (*transports)[i] = transport;
+  }
+  if (i < num_handles) {
+    DCHECK_NE(error_result, MOJO_RESULT_INTERNAL);
+
+    // Unset the busy flags and release the locks.
+    for (uint32_t j = 0; j < i; j++) {
+      DCHECK(entries[j]->busy);
+      entries[j]->busy = false;
+      (*transports)[j].End();
+    }
+    return error_result;
+  }
+
+  return MOJO_RESULT_OK;
+}
+
+MojoHandle HandleTable::AddDispatcherNoSizeCheck(
+    const scoped_refptr<Dispatcher>& dispatcher) {
+  DCHECK(dispatcher);
+  DCHECK_LT(handle_to_entry_map_.size(),
+            GetConfiguration().max_handle_table_size);
+  DCHECK_NE(next_handle_, MOJO_HANDLE_INVALID);
+
+  // TODO(vtl): Maybe we want to do something different/smarter. (Or maybe try
+  // assigning randomly?)
+  while (handle_to_entry_map_.find(next_handle_) !=
+         handle_to_entry_map_.end()) {
+    next_handle_++;
+    if (next_handle_ == MOJO_HANDLE_INVALID)
+      next_handle_++;
+  }
+
+  MojoHandle new_handle = next_handle_;
+  handle_to_entry_map_[new_handle] = Entry(dispatcher);
+
+  next_handle_++;
+  if (next_handle_ == MOJO_HANDLE_INVALID)
+    next_handle_++;
+
+  return new_handle;
+}
+
+void HandleTable::RemoveBusyHandles(const MojoHandle* handles,
+                                    uint32_t num_handles) {
+  DCHECK(handles);
+  DCHECK_LE(num_handles, GetConfiguration().max_message_num_handles);
+
+  for (uint32_t i = 0; i < num_handles; i++) {
+    HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]);
+    DCHECK(it != handle_to_entry_map_.end());
+    DCHECK(it->second.busy);
+    it->second.busy = false;  // For the sake of a |DCHECK()|.
+    handle_to_entry_map_.erase(it);
+  }
+}
+
+void HandleTable::RestoreBusyHandles(const MojoHandle* handles,
+                                     uint32_t num_handles) {
+  DCHECK(handles);
+  DCHECK_LE(num_handles, GetConfiguration().max_message_num_handles);
+
+  for (uint32_t i = 0; i < num_handles; i++) {
+    HandleToEntryMap::iterator it = handle_to_entry_map_.find(handles[i]);
+    DCHECK(it != handle_to_entry_map_.end());
+    DCHECK(it->second.busy);
+    it->second.busy = false;
+  }
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/handle_table.h b/mojo/edk/system/handle_table.h
new file mode 100644
index 0000000..de5ac05
--- /dev/null
+++ b/mojo/edk/system/handle_table.h
@@ -0,0 +1,144 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_HANDLE_TABLE_H_
+#define MOJO_EDK_SYSTEM_HANDLE_TABLE_H_
+
+#include <utility>
+#include <vector>
+
+#include "base/containers/hash_tables.h"
+#include "base/memory/ref_counted.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+class Core;
+class Dispatcher;
+class DispatcherTransport;
+
+using DispatcherVector = std::vector<scoped_refptr<Dispatcher>>;
+
+// Test-only function (defined/used in embedder/test_embedder.cc). Declared here
+// so it can be friended.
+namespace internal {
+bool ShutdownCheckNoLeaks(Core*);
+}
+
+// This class provides the (global) handle table (owned by |Core|), which maps
+// (valid) |MojoHandle|s to |Dispatcher|s. This is abstracted so that, e.g.,
+// caching may be added.
+//
+// This class is NOT thread-safe; locking is left to |Core| (since it may need
+// to make several changes -- "atomically" or in rapid successsion, in which
+// case the extra locking/unlocking would be unnecessary overhead).
+
+class MOJO_SYSTEM_IMPL_EXPORT HandleTable {
+ public:
+  HandleTable();
+  ~HandleTable();
+
+  // Gets the dispatcher for a given handle (which should not be
+  // |MOJO_HANDLE_INVALID|). Returns null if there's no dispatcher for the given
+  // handle.
+  // WARNING: For efficiency, this returns a dumb pointer. If you're going to
+  // use the result outside |Core|'s lock, you MUST take a reference (e.g., by
+  // storing the result inside a |scoped_refptr|).
+  Dispatcher* GetDispatcher(MojoHandle handle);
+
+  // On success, gets the dispatcher for a given handle (which should not be
+  // |MOJO_HANDLE_INVALID|) and removes it. (On failure, returns an appropriate
+  // result (and leaves |dispatcher| alone), namely
+  // |MOJO_RESULT_INVALID_ARGUMENT| if there's no dispatcher for the given
+  // handle or |MOJO_RESULT_BUSY| if the handle is marked as busy.)
+  MojoResult GetAndRemoveDispatcher(MojoHandle handle,
+                                    scoped_refptr<Dispatcher>* dispatcher);
+
+  // Adds a dispatcher (which must be valid), returning the handle for it.
+  // Returns |MOJO_HANDLE_INVALID| on failure (if the handle table is full).
+  MojoHandle AddDispatcher(const scoped_refptr<Dispatcher>& dispatcher);
+
+  // Adds a pair of dispatchers (which must be valid), return a pair of handles
+  // for them. On failure (if the handle table is full), the first (and second)
+  // handles will be |MOJO_HANDLE_INVALID|, and neither dispatcher will be
+  // added.
+  std::pair<MojoHandle, MojoHandle> AddDispatcherPair(
+      const scoped_refptr<Dispatcher>& dispatcher0,
+      const scoped_refptr<Dispatcher>& dispatcher1);
+
+  // Adds the given vector of dispatchers (of size at most
+  // |kMaxMessageNumHandles|). |handles| must point to an array of size at least
+  // |dispatchers.size()|. Unlike the other |AddDispatcher...()| functions, some
+  // of the dispatchers may be invalid (null). Returns true on success and false
+  // on failure (if the handle table is full), in which case it leaves
+  // |handles[...]| untouched (and all dispatchers unadded).
+  bool AddDispatcherVector(const DispatcherVector& dispatchers,
+                           MojoHandle* handles);
+
+  // Tries to mark the given handles as busy and start transport on them (i.e.,
+  // take their dispatcher locks); |transports| must be sized to contain
+  // |num_handles| elements. On failure, returns them to their original
+  // (non-busy, unlocked state).
+  MojoResult MarkBusyAndStartTransport(
+      MojoHandle disallowed_handle,
+      const MojoHandle* handles,
+      uint32_t num_handles,
+      std::vector<DispatcherTransport>* transports);
+
+  // Remove the given handles, which must all be present and which should have
+  // previously been marked busy by |MarkBusyAndStartTransport()|.
+  void RemoveBusyHandles(const MojoHandle* handles, uint32_t num_handles);
+
+  // Restores the given handles, which must all be present and which should have
+  // previously been marked busy by |MarkBusyAndStartTransport()|, to a non-busy
+  // state.
+  void RestoreBusyHandles(const MojoHandle* handles, uint32_t num_handles);
+
+ private:
+  friend bool internal::ShutdownCheckNoLeaks(Core*);
+
+  // The |busy| member is used only to deal with functions (in particular
+  // |Core::WriteMessage()|) that want to hold on to a dispatcher and later
+  // remove it from the handle table, without holding on to the handle table
+  // lock.
+  //
+  // For example, if |Core::WriteMessage()| is called with a handle to be sent,
+  // (under the handle table lock) it must first check that that handle is not
+  // busy (if it is busy, then it fails with |MOJO_RESULT_BUSY|) and then marks
+  // it as busy. To avoid deadlock, it should also try to acquire the locks for
+  // all the dispatchers for the handles that it is sending (and fail with
+  // |MOJO_RESULT_BUSY| if the attempt fails). At this point, it can release the
+  // handle table lock.
+  //
+  // If |Core::Close()| is simultaneously called on that handle, it too checks
+  // if the handle is marked busy. If it is, it fails (with |MOJO_RESULT_BUSY|).
+  // This prevents |Core::WriteMessage()| from sending a handle that has been
+  // closed (or learning about this too late).
+  struct Entry {
+    Entry();
+    explicit Entry(const scoped_refptr<Dispatcher>& dispatcher);
+    ~Entry();
+
+    scoped_refptr<Dispatcher> dispatcher;
+    bool busy;
+  };
+  using HandleToEntryMap = base::hash_map<MojoHandle, Entry>;
+
+  // Adds the given dispatcher to the handle table, not doing any size checks.
+  MojoHandle AddDispatcherNoSizeCheck(
+      const scoped_refptr<Dispatcher>& dispatcher);
+
+  HandleToEntryMap handle_to_entry_map_;
+  MojoHandle next_handle_;  // Invariant: never |MOJO_HANDLE_INVALID|.
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(HandleTable);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_HANDLE_TABLE_H_
diff --git a/mojo/edk/system/mapping_table.cc b/mojo/edk/system/mapping_table.cc
new file mode 100644
index 0000000..46afe5a
--- /dev/null
+++ b/mojo/edk/system/mapping_table.cc
@@ -0,0 +1,48 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/mapping_table.h"
+
+#include "base/logging.h"
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/system/configuration.h"
+
+namespace mojo {
+namespace edk {
+
+MappingTable::MappingTable() {
+}
+
+MappingTable::~MappingTable() {
+  // This should usually not be reached (the only instance should be owned by
+  // the singleton |Core|, which lives forever), except in tests.
+}
+
+MojoResult MappingTable::AddMapping(
+    scoped_ptr<PlatformSharedBufferMapping> mapping) {
+  DCHECK(mapping);
+
+  if (address_to_mapping_map_.size() >=
+      GetConfiguration().max_mapping_table_sze)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+
+  void* address = mapping->GetBase();
+  DCHECK(address_to_mapping_map_.find(address) ==
+         address_to_mapping_map_.end());
+  address_to_mapping_map_[address] = mapping.release();
+  return MOJO_RESULT_OK;
+}
+
+MojoResult MappingTable::RemoveMapping(void* address) {
+  AddressToMappingMap::iterator it = address_to_mapping_map_.find(address);
+  if (it == address_to_mapping_map_.end())
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  PlatformSharedBufferMapping* mapping_to_delete = it->second;
+  address_to_mapping_map_.erase(it);
+  delete mapping_to_delete;
+  return MOJO_RESULT_OK;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/mapping_table.h b/mojo/edk/system/mapping_table.h
new file mode 100644
index 0000000..fb2acf36
--- /dev/null
+++ b/mojo/edk/system/mapping_table.h
@@ -0,0 +1,57 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_MAPPING_TABLE_H_
+#define MOJO_EDK_SYSTEM_MAPPING_TABLE_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+#include "base/containers/hash_tables.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+
+namespace edk {
+class Core;
+class PlatformSharedBufferMapping;
+
+// Test-only function (defined/used in embedder/test_embedder.cc). Declared here
+// so it can be friended.
+namespace internal {
+bool ShutdownCheckNoLeaks(Core*);
+}
+
+// This class provides the (global) table of memory mappings (owned by |Core|),
+// which maps mapping base addresses to |PlatformSharedBufferMapping|s.
+//
+// This class is NOT thread-safe; locking is left to |Core|.
+class MOJO_SYSTEM_IMPL_EXPORT MappingTable {
+ public:
+  MappingTable();
+  ~MappingTable();
+
+  // Tries to add a mapping. (Takes ownership of the mapping in all cases; on
+  // failure, it will be destroyed.)
+  MojoResult AddMapping(scoped_ptr<PlatformSharedBufferMapping> mapping);
+  MojoResult RemoveMapping(void* address);
+
+ private:
+  friend bool internal::ShutdownCheckNoLeaks(Core*);
+
+  using AddressToMappingMap =
+      base::hash_map<void*, PlatformSharedBufferMapping*>;
+  AddressToMappingMap address_to_mapping_map_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MappingTable);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_MAPPING_TABLE_H_
diff --git a/mojo/edk/system/master.mojom b/mojo/edk/system/master.mojom
new file mode 100644
index 0000000..0757a8d
--- /dev/null
+++ b/mojo/edk/system/master.mojom
@@ -0,0 +1,11 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+module mojo;
+
+interface Master {
+  // These methods are only called on Windows.
+  HandleToToken(handle platform_handle) => (int32 result, uint64 token);
+  TokenToHandle(uint64 token) => (int32 result, handle platform_handle);
+};
diff --git a/mojo/edk/system/master_impl.cc b/mojo/edk/system/master_impl.cc
new file mode 100644
index 0000000..13b76f2
--- /dev/null
+++ b/mojo/edk/system/master_impl.cc
@@ -0,0 +1,107 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/master_impl.h"
+
+#include "base/containers/hash_tables.h"
+#include "base/lazy_instance.h"
+#include "base/logging.h"
+#include "base/rand_util.h"
+#include "mojo/edk/embedder/embedder.h"
+
+#if defined(OS_WIN)
+base::LazyInstance<base::hash_map<uint64_t, HANDLE>>::Leaky
+    g_token_map = LAZY_INSTANCE_INITIALIZER;
+#endif
+
+namespace mojo {
+namespace edk {
+
+MasterImpl::MasterImpl(base::ProcessId slave_pid)
+#if defined(OS_WIN)
+    : slave_process_(
+          base::Process::OpenWithAccess(slave_pid, PROCESS_DUP_HANDLE))
+#endif
+      {
+#if defined(OS_WIN)
+  DCHECK(slave_process_.IsValid());
+#endif
+}
+
+MasterImpl::~MasterImpl() {
+}
+
+void MasterImpl::HandleToToken(ScopedHandle platform_handle,
+                               const HandleToTokenCallback& callback) {
+#if defined(OS_WIN)
+  ScopedPlatformHandle sender_handle;
+  MojoResult unwrap_result = PassWrappedPlatformHandle(
+      platform_handle.get().value(), &sender_handle);
+  if (unwrap_result != MOJO_RESULT_OK) {
+    DLOG(WARNING) << "HandleToToken couldn't unwrap platform handle.";
+    callback.Run(unwrap_result, 0);
+    return;
+  }
+
+  HANDLE master_handle = NULL;
+  BOOL dup_result =
+      DuplicateHandle(slave_process_.Handle(), sender_handle.release().handle,
+                      base::GetCurrentProcessHandle(), &master_handle, 0,
+                      FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+  if (!dup_result) {
+    DLOG(WARNING) << "HandleToToken couldn't duplicate slave handle.";
+    callback.Run(MOJO_RESULT_INVALID_ARGUMENT, 0);
+    return;
+  }
+
+  uint64_t token = base::RandUint64();
+  g_token_map.Get()[token] = master_handle;
+  callback.Run(MOJO_RESULT_OK, token);
+#else
+  NOTREACHED();
+#endif
+}
+
+void MasterImpl::TokenToHandle(uint64_t token,
+                               const TokenToHandleCallback& callback) {
+#if defined(OS_WIN)
+  auto it = g_token_map.Get().find(token);
+  if (it == g_token_map.Get().end()) {
+    DLOG(WARNING) << "TokenToHandle didn't find token.";
+    callback.Run(MOJO_RESULT_INVALID_ARGUMENT, ScopedHandle());
+    return;
+  }
+
+  HANDLE slave_handle = NULL;
+  BOOL dup_result =
+      DuplicateHandle(base::GetCurrentProcessHandle(), it->second,
+                      slave_process_.Handle(), &slave_handle, 0,
+                      FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+  if (!dup_result) {
+    DLOG(WARNING) << "TokenToHandle couldn't duplicate slave handle.";
+    callback.Run(MOJO_RESULT_INTERNAL, ScopedHandle());
+    return;
+  }
+
+  ScopedPlatformHandle platform_handle;
+  platform_handle.reset(PlatformHandle(slave_handle));
+
+  MojoHandle handle;
+  MojoResult wrap_result = CreatePlatformHandleWrapper(
+      platform_handle.Pass(), &handle);
+  if (wrap_result != MOJO_RESULT_OK) {
+    DLOG(WARNING) << "TokenToHandle couldn't unwrap platform handle.";
+    callback.Run(wrap_result, ScopedHandle());
+    return;
+  }
+
+  callback.Run(MOJO_RESULT_OK, ScopedHandle(Handle(handle)));
+  g_token_map.Get().erase(it);
+#else
+  NOTREACHED();
+#endif
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/master_impl.h b/mojo/edk/system/master_impl.h
new file mode 100644
index 0000000..621db13
--- /dev/null
+++ b/mojo/edk/system/master_impl.h
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_MASTER_IMPL_H_
+#define MOJO_EDK_SYSTEM_MASTER_IMPL_H_
+
+#include "base/process/process.h"
+#include "mojo/edk/system/master.mojom.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#endif
+
+namespace mojo {
+namespace edk {
+
+// An instance of this class exists in the maste process for each slave process.
+class MasterImpl : public Master {
+ public:
+  explicit MasterImpl(base::ProcessId slave_pid);
+  ~MasterImpl() override;
+
+  // Master implementation:
+  void HandleToToken(ScopedHandle platform_handle,
+                     const HandleToTokenCallback& callback) override;
+  void TokenToHandle(uint64_t token,
+                     const TokenToHandleCallback& callback) override;
+
+ private:
+#if defined(OS_WIN)
+  base::Process slave_process_;
+#endif
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MasterImpl);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_MASTER_IMPL_H_
diff --git a/mojo/edk/system/master_impl_unittest.cc b/mojo/edk/system/master_impl_unittest.cc
new file mode 100644
index 0000000..a0a731e
--- /dev/null
+++ b/mojo/edk/system/master_impl_unittest.cc
@@ -0,0 +1,120 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/master_impl.h"
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_file.h"
+#include "base/files/scoped_temp_dir.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/test/test_utils.h"
+#include "mojo/public/c/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+static const char kHelloWorld[] = "hello world";
+
+#if defined(OS_WIN)
+
+class MasterImplTest : public ::testing::Test {
+ public:
+  MasterImplTest() {}
+
+  // Returns a ScopedHandle to a file with the magic string.
+  ScopedHandle GetScopedHandle() {
+    if (!temp_dir_.IsValid())
+      CHECK(temp_dir_.CreateUniqueTempDir());
+    base::FilePath unused;
+    base::ScopedFILE fp(
+        CreateAndOpenTemporaryFileInDir(temp_dir_.path(), &unused));
+    CHECK(fp);
+    EXPECT_EQ(sizeof(kHelloWorld),
+              fwrite(kHelloWorld, 1, sizeof(kHelloWorld), fp.get()));
+    ScopedPlatformHandle platform_handle(
+        test::PlatformHandleFromFILE(fp.Pass()));
+    CHECK(platform_handle.is_valid());
+
+    MojoHandle handle;
+    MojoResult wrap_result = CreatePlatformHandleWrapper(
+        platform_handle.Pass(), &handle);
+    CHECK(wrap_result == MOJO_RESULT_OK);
+    return ScopedHandle(Handle(handle));
+  }
+
+  // Check that the given ScopedHandle has a file with the magic string.
+  bool CheckScopedHandle(ScopedHandle handle) {
+    ScopedPlatformHandle platform_handle;
+    MojoResult unwrap_result = PassWrappedPlatformHandle(
+        handle.get().value(), &platform_handle);
+    if (unwrap_result != MOJO_RESULT_OK)
+      return false;
+    base::ScopedFILE fp =
+        test::FILEFromPlatformHandle(platform_handle.Pass(), "rb").Pass();
+    if (!fp)
+      return false;
+    rewind(fp.get());
+    char read_buffer[1000] = {};
+    if (fread(read_buffer, 1, sizeof(read_buffer), fp.get()) !=
+        sizeof(kHelloWorld)) {
+      return false;
+    }
+    return std::string(read_buffer) == kHelloWorld;
+  }
+
+ private:
+  base::ScopedTempDir temp_dir_;
+};
+
+TEST_F(MasterImplTest, Basic) {
+  MasterImpl master(base::GetCurrentProcId());
+  uint64_t token;
+  master.HandleToToken(GetScopedHandle(),
+                       [&token](int32_t result, uint64_t t) {
+                         ASSERT_EQ(result, MOJO_RESULT_OK);
+                         token = t;
+                       });
+
+  ScopedHandle handle;
+  master.TokenToHandle(token,
+                       [&handle](int32_t result, ScopedHandle h) {
+                         ASSERT_EQ(result, MOJO_RESULT_OK);
+                         handle = h.Pass();
+                       });
+
+  ASSERT_TRUE(CheckScopedHandle(handle.Pass()));
+}
+
+TEST_F(MasterImplTest, TokenIsRemoved) {
+  MasterImpl master(base::GetCurrentProcId());
+  uint64_t token;
+  master.HandleToToken(GetScopedHandle(),
+                       [&token](int32_t result, uint64_t t) {
+                         ASSERT_EQ(result, MOJO_RESULT_OK);
+                         token = t;
+                       });
+
+  ScopedHandle handle;
+  master.TokenToHandle(token,
+                       [&handle](int32_t result, ScopedHandle h) {
+                         ASSERT_EQ(result, MOJO_RESULT_OK);
+                         handle = h.Pass();
+                       });
+
+  ASSERT_TRUE(CheckScopedHandle(handle.Pass()));
+
+  master.TokenToHandle(token,
+                       [&handle](int32_t result, ScopedHandle h) {
+                         ASSERT_EQ(result, MOJO_RESULT_INVALID_ARGUMENT);
+                       });
+}
+
+#endif  // OS_WIN
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/message_in_transit.cc b/mojo/edk/system/message_in_transit.cc
new file mode 100644
index 0000000..b85efc7
--- /dev/null
+++ b/mojo/edk/system/message_in_transit.cc
@@ -0,0 +1,184 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/message_in_transit.h"
+
+#include <string.h>
+
+#include <ostream>
+
+#include "base/logging.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/transport_data.h"
+
+namespace mojo {
+namespace edk {
+
+MOJO_STATIC_CONST_MEMBER_DEFINITION const size_t
+    MessageInTransit::kMessageAlignment;
+
+struct MessageInTransit::PrivateStructForCompileAsserts {
+  // The size of |Header| must be a multiple of the alignment.
+  static_assert(sizeof(Header) % kMessageAlignment == 0,
+                "sizeof(MessageInTransit::Header) invalid");
+};
+
+MessageInTransit::View::View(size_t message_size, const void* buffer)
+    : buffer_(buffer) {
+  size_t next_message_size = 0;
+  DCHECK(MessageInTransit::GetNextMessageSize(buffer_, message_size,
+                                              &next_message_size));
+  DCHECK_EQ(message_size, next_message_size);
+  // This should be equivalent.
+  DCHECK_EQ(message_size, total_size());
+}
+
+bool MessageInTransit::View::IsValid(size_t serialized_platform_handle_size,
+                                     const char** error_message) const {
+  size_t max_message_num_bytes = GetConfiguration().max_message_num_bytes;
+  // Avoid dangerous situations, but making sure that the size of the "header" +
+  // the size of the data fits into a 31-bit number.
+  DCHECK_LE(static_cast<uint64_t>(sizeof(Header)) + max_message_num_bytes,
+            0x7fffffffULL)
+      << "GetConfiguration().max_message_num_bytes too big";
+
+  // We assume (to avoid extra rounding code) that the maximum message (data)
+  // size is a multiple of the alignment.
+  DCHECK_EQ(max_message_num_bytes % kMessageAlignment, 0U)
+      << "GetConfiguration().max_message_num_bytes not a multiple of alignment";
+
+  // Note: This also implies a check on the |main_buffer_size()|, which is just
+  // |RoundUpMessageAlignment(sizeof(Header) + num_bytes())|.
+  if (num_bytes() > max_message_num_bytes) {
+    *error_message = "Message data payload too large";
+    return false;
+  }
+
+  if (transport_data_buffer_size() > 0) {
+    const char* e = TransportData::ValidateBuffer(
+        serialized_platform_handle_size, transport_data_buffer(),
+        transport_data_buffer_size());
+    if (e) {
+      *error_message = e;
+      return false;
+    }
+  }
+
+  return true;
+}
+
+MessageInTransit::MessageInTransit(Type type,
+                                   uint32_t num_bytes,
+                                   const void* bytes)
+    : main_buffer_size_(RoundUpMessageAlignment(sizeof(Header) + num_bytes)),
+      main_buffer_(static_cast<char*>(
+          base::AlignedAlloc(main_buffer_size_, kMessageAlignment))) {
+  ConstructorHelper(type, num_bytes);
+  if (bytes) {
+    memcpy(MessageInTransit::bytes(), bytes, num_bytes);
+    memset(static_cast<char*>(MessageInTransit::bytes()) + num_bytes, 0,
+           main_buffer_size_ - sizeof(Header) - num_bytes);
+  } else {
+    memset(MessageInTransit::bytes(), 0, main_buffer_size_ - sizeof(Header));
+  }
+}
+
+MessageInTransit::MessageInTransit(const View& message_view)
+    : main_buffer_size_(message_view.main_buffer_size()),
+      main_buffer_(static_cast<char*>(
+          base::AlignedAlloc(main_buffer_size_, kMessageAlignment))) {
+  DCHECK_GE(main_buffer_size_, sizeof(Header));
+  DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u);
+
+  memcpy(main_buffer_.get(), message_view.main_buffer(), main_buffer_size_);
+  DCHECK_EQ(main_buffer_size_,
+            RoundUpMessageAlignment(sizeof(Header) + num_bytes()));
+}
+
+MessageInTransit::~MessageInTransit() {
+  if (dispatchers_) {
+    for (size_t i = 0; i < dispatchers_->size(); i++) {
+      if (!(*dispatchers_)[i])
+        continue;
+      (*dispatchers_)[i]->Close();
+    }
+  }
+}
+
+// static
+bool MessageInTransit::GetNextMessageSize(const void* buffer,
+                                          size_t buffer_size,
+                                          size_t* next_message_size) {
+  DCHECK(next_message_size);
+  if (!buffer_size)
+    return false;
+  DCHECK(buffer);
+  DCHECK_EQ(
+      reinterpret_cast<uintptr_t>(buffer) % MessageInTransit::kMessageAlignment,
+      0u);
+
+  if (buffer_size < sizeof(Header))
+    return false;
+
+  const Header* header = static_cast<const Header*>(buffer);
+  *next_message_size = header->total_size;
+  DCHECK_EQ(*next_message_size % kMessageAlignment, 0u);
+  return true;
+}
+
+void MessageInTransit::SetDispatchers(
+    scoped_ptr<DispatcherVector> dispatchers) {
+  DCHECK(dispatchers);
+  DCHECK(!dispatchers_);
+  DCHECK(!transport_data_);
+
+  dispatchers_ = dispatchers.Pass();
+}
+
+void MessageInTransit::SetTransportData(
+    scoped_ptr<TransportData> transport_data) {
+  DCHECK(transport_data);
+  DCHECK(!transport_data_);
+  DCHECK(!dispatchers_);
+
+  transport_data_ = transport_data.Pass();
+  UpdateTotalSize();
+}
+
+void MessageInTransit::SerializeAndCloseDispatchers() {
+  DCHECK(!transport_data_);
+
+  if (!dispatchers_ || !dispatchers_->size())
+    return;
+
+  transport_data_.reset(new TransportData(dispatchers_.Pass()));
+
+  // Update the sizes in the message header.
+  UpdateTotalSize();
+}
+
+void MessageInTransit::ConstructorHelper(Type type,
+                                         uint32_t num_bytes) {
+  DCHECK_LE(num_bytes, GetConfiguration().max_message_num_bytes);
+
+  // |total_size| is updated below, from the other values.
+  header()->type = type;
+  header()->num_bytes = num_bytes;
+  header()->unused = 0;
+  // Note: If dispatchers are subsequently attached, then |total_size| will have
+  // to be adjusted.
+  UpdateTotalSize();
+}
+
+void MessageInTransit::UpdateTotalSize() {
+  DCHECK_EQ(main_buffer_size_ % kMessageAlignment, 0u);
+  header()->total_size = static_cast<uint32_t>(main_buffer_size_);
+  if (transport_data_) {
+    header()->total_size +=
+        static_cast<uint32_t>(transport_data_->buffer_size());
+  }
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/message_in_transit.h b/mojo/edk/system/message_in_transit.h
new file mode 100644
index 0000000..f0cd7a7
--- /dev/null
+++ b/mojo/edk/system/message_in_transit.h
@@ -0,0 +1,234 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_
+#define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <ostream>
+#include <vector>
+
+#include "base/memory/aligned_memory.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+class RawChannel;
+class TransportData;
+
+// This class is used to represent data in transit. It is thread-unsafe.
+//
+// |MessageInTransit| buffers:
+//
+// A |MessageInTransit| can be serialized by writing the main buffer and then,
+// if it has one, the transport data buffer. Both buffers are
+// |kMessageAlignment|-byte aligned and a multiple of |kMessageAlignment| bytes
+// in size.
+//
+// The main buffer consists of the header (of type |Header|, which is an
+// internal detail of this class) followed immediately by the message data
+// (accessed by |bytes()| and of size |num_bytes()|, and also
+// |kMessageAlignment|-byte aligned), and then any padding needed to make the
+// main buffer a multiple of |kMessageAlignment| bytes in size.
+//
+// See |TransportData| for a description of the (serialized) transport data
+// buffer.
+class MOJO_SYSTEM_IMPL_EXPORT MessageInTransit {
+ public:
+  enum class Type : uint16_t {
+    MESSAGE = 0,
+    RAW_CHANNEL_POSIX_EXTRA_PLATFORM_HANDLES = 1,
+    RAW_CHANNEL_QUIT = 2,
+  };
+
+  // Messages (the header and data) must always be aligned to a multiple of this
+  // quantity (which must be a power of 2).
+  static const size_t kMessageAlignment = 8;
+
+  // Forward-declare |Header| so that |View| can use it:
+ private:
+  struct Header;
+
+ public:
+  // This represents a view of serialized message data in a raw buffer.
+  class MOJO_SYSTEM_IMPL_EXPORT View {
+   public:
+    // Constructs a view from the given buffer of the given size. (The size must
+    // be as provided by |MessageInTransit::GetNextMessageSize()|.) The buffer
+    // must remain alive/unmodified through the lifetime of this object.
+    // |buffer| should be |kMessageAlignment|-byte aligned.
+    View(size_t message_size, const void* buffer);
+
+    // Checks that the given |View| appears to be for a valid message, within
+    // predetermined limits (e.g., |num_bytes()| and |main_buffer_size()|, that
+    // |transport_data_buffer()|/|transport_data_buffer_size()| is for valid
+    // transport data -- see |TransportData::ValidateBuffer()|).
+    //
+    // It returns true (and leaves |error_message| alone) if this object appears
+    // to be a valid message (according to the above) and false, pointing
+    // |*error_message| to a suitable error message, if not.
+    bool IsValid(size_t serialized_platform_handle_size,
+                 const char** error_message) const;
+
+    // API parallel to that for |MessageInTransit| itself (mostly getters for
+    // header data).
+    const void* main_buffer() const { return buffer_; }
+    size_t main_buffer_size() const {
+      return RoundUpMessageAlignment(sizeof(Header) + header()->num_bytes);
+    }
+    const void* transport_data_buffer() const {
+      return (total_size() > main_buffer_size())
+                 ? static_cast<const char*>(buffer_) + main_buffer_size()
+                 : nullptr;
+    }
+    size_t transport_data_buffer_size() const {
+      return total_size() - main_buffer_size();
+    }
+    size_t total_size() const { return header()->total_size; }
+    uint32_t num_bytes() const { return header()->num_bytes; }
+    const void* bytes() const {
+      return static_cast<const char*>(buffer_) + sizeof(Header);
+    }
+    Type type() const { return header()->type; }
+
+   private:
+    const Header* header() const { return static_cast<const Header*>(buffer_); }
+
+    const void* const buffer_;
+
+    // Though this struct is trivial, disallow copy and assign, since it doesn't
+    // own its data. (If you're copying/assigning this, you're probably doing
+    // something wrong.)
+    MOJO_DISALLOW_COPY_AND_ASSIGN(View);
+  };
+
+  // |bytes| is optional; if null, the message data will be zero-initialized.
+  MessageInTransit(Type type,
+                   uint32_t num_bytes,
+                   const void* bytes);
+  // Constructs a |MessageInTransit| from a |View|.
+  explicit MessageInTransit(const View& message_view);
+
+  ~MessageInTransit();
+
+  // Gets the size of the next message from |buffer|, which has |buffer_size|
+  // bytes currently available, returning true and setting |*next_message_size|
+  // on success. |buffer| should be aligned on a |kMessageAlignment| boundary
+  // (and on success, |*next_message_size| will be a multiple of
+  // |kMessageAlignment|).
+  // TODO(vtl): In |RawChannelPosix|, the alignment requirements are currently
+  // satisified on a faith-based basis.
+  static bool GetNextMessageSize(const void* buffer,
+                                 size_t buffer_size,
+                                 size_t* next_message_size);
+
+  // Makes this message "own" the given set of dispatchers. The dispatchers must
+  // not be referenced from anywhere else (in particular, not from the handle
+  // table), i.e., each dispatcher must have a reference count of 1. This
+  // message must not already have dispatchers.
+  void SetDispatchers(scoped_ptr<DispatcherVector> dispatchers);
+
+  // Sets the |TransportData| for this message. This should only be done when
+  // there are no dispatchers and no existing |TransportData|.
+  void SetTransportData(scoped_ptr<TransportData> transport_data);
+
+  // Serializes any dispatchers to the secondary buffer. This message must not
+  // already have a secondary buffer (so this must only be called once). The
+  // caller must ensure (e.g., by holding on to a reference) that |channel|
+  // stays alive through the call.
+  void SerializeAndCloseDispatchers();
+
+  // Gets the main buffer and its size (in number of bytes), respectively.
+  const void* main_buffer() const { return main_buffer_.get(); }
+  size_t main_buffer_size() const { return main_buffer_size_; }
+
+  // Gets the transport data buffer (if any).
+  const TransportData* transport_data() const { return transport_data_.get(); }
+  TransportData* transport_data() { return transport_data_.get(); }
+
+  // Gets the total size of the message (see comment in |Header|, below).
+  size_t total_size() const { return header()->total_size; }
+
+  // Gets the size of the message data.
+  uint32_t num_bytes() const { return header()->num_bytes; }
+
+  // Gets the message data (of size |num_bytes()| bytes).
+  const void* bytes() const { return main_buffer_.get() + sizeof(Header); }
+  void* bytes() { return main_buffer_.get() + sizeof(Header); }
+
+  Type type() const { return header()->type; }
+
+  // Gets the dispatchers attached to this message; this may return null if
+  // there are none. Note that the caller may mutate the set of dispatchers
+  // (e.g., take ownership of all the dispatchers, leaving the vector empty).
+  DispatcherVector* dispatchers() { return dispatchers_.get(); }
+
+  // Returns true if this message has dispatchers attached.
+  bool has_dispatchers() const {
+    return dispatchers_ && !dispatchers_->empty();
+  }
+
+  // Rounds |n| up to a multiple of |kMessageAlignment|.
+  static inline size_t RoundUpMessageAlignment(size_t n) {
+    return (n + kMessageAlignment - 1) & ~(kMessageAlignment - 1);
+  }
+
+ private:
+  // To allow us to make compile-assertions about |Header| in the .cc file.
+  struct PrivateStructForCompileAsserts;
+
+  // Header for the data (main buffer). Must be a multiple of
+  // |kMessageAlignment| bytes in size. Must be POD.
+  struct Header {
+    // Total size of the message, including the header, the message data
+    // ("bytes") including padding (to make it a multiple of |kMessageAlignment|
+    // bytes), and serialized handle information. Note that this may not be the
+    // correct value if dispatchers are attached but
+    // |SerializeAndCloseDispatchers()| has not been called.
+    uint32_t total_size;
+    Type type;                         // 2 bytes.
+    Type unusedforalignment;           // 2 bytes.
+    uint32_t num_bytes;
+    uint32_t unused;
+  };
+
+  const Header* header() const {
+    return reinterpret_cast<const Header*>(main_buffer_.get());
+  }
+  Header* header() { return reinterpret_cast<Header*>(main_buffer_.get()); }
+
+  void ConstructorHelper(Type type, uint32_t num_bytes);
+  void UpdateTotalSize();
+
+  const size_t main_buffer_size_;
+  const scoped_ptr<char, base::AlignedFreeDeleter> main_buffer_;  // Never null.
+
+  scoped_ptr<TransportData> transport_data_;  // May be null.
+
+  // Any dispatchers that may be attached to this message. These dispatchers
+  // should be "owned" by this message, i.e., have a ref count of exactly 1. (We
+  // allow a dispatcher entry to be null, in case it couldn't be duplicated for
+  // some reason.)
+  scoped_ptr<DispatcherVector> dispatchers_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MessageInTransit);
+};
+
+// So logging macros and |DCHECK_EQ()|, etc. work.
+MOJO_SYSTEM_IMPL_EXPORT inline std::ostream& operator<<(
+    std::ostream& out,
+    MessageInTransit::Type type) {
+  return out << static_cast<uint16_t>(type);
+}
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_H_
diff --git a/mojo/edk/system/message_in_transit_queue.cc b/mojo/edk/system/message_in_transit_queue.cc
new file mode 100644
index 0000000..f95bf724
--- /dev/null
+++ b/mojo/edk/system/message_in_transit_queue.cc
@@ -0,0 +1,33 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/message_in_transit_queue.h"
+
+#include "base/logging.h"
+
+namespace mojo {
+namespace edk {
+
+MessageInTransitQueue::MessageInTransitQueue() {
+}
+
+MessageInTransitQueue::~MessageInTransitQueue() {
+  if (!IsEmpty()) {
+    LOG(WARNING) << "Destroying nonempty message queue";
+    Clear();
+  }
+}
+
+void MessageInTransitQueue::Clear() {
+  for (auto* message : queue_)
+    delete message;
+  queue_.clear();
+}
+
+void MessageInTransitQueue::Swap(MessageInTransitQueue* other) {
+  queue_.swap(other->queue_);
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/message_in_transit_queue.h b/mojo/edk/system/message_in_transit_queue.h
new file mode 100644
index 0000000..4a05490
--- /dev/null
+++ b/mojo/edk/system/message_in_transit_queue.h
@@ -0,0 +1,62 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_QUEUE_H_
+#define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_QUEUE_H_
+
+#include <deque>
+
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/system/message_in_transit.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// A simple queue for |MessageInTransit|s (that owns its messages).
+// This class is not thread-safe.
+class MOJO_SYSTEM_IMPL_EXPORT MessageInTransitQueue {
+ public:
+  MessageInTransitQueue();
+  ~MessageInTransitQueue();
+
+  bool IsEmpty() const { return queue_.empty(); }
+  size_t Size() const { return queue_.size(); }
+
+  void AddMessage(scoped_ptr<MessageInTransit> message) {
+    queue_.push_back(message.release());
+  }
+
+  scoped_ptr<MessageInTransit> GetMessage() {
+    MessageInTransit* rv = queue_.front();
+    queue_.pop_front();
+    return make_scoped_ptr(rv);
+  }
+
+  const MessageInTransit* PeekMessage() const { return queue_.front(); }
+  MessageInTransit* PeekMessage() { return queue_.front(); }
+
+  void DiscardMessage() {
+    delete queue_.front();
+    queue_.pop_front();
+  }
+
+  void Clear();
+
+  // Efficiently swaps contents with |*other|.
+  void Swap(MessageInTransitQueue* other);
+
+ private:
+  // TODO(vtl): When C++11 is available, switch this to a deque of
+  // |scoped_ptr|/|unique_ptr|s.
+  std::deque<MessageInTransit*> queue_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MessageInTransitQueue);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_QUEUE_H_
diff --git a/mojo/edk/system/message_in_transit_queue_unittest.cc b/mojo/edk/system/message_in_transit_queue_unittest.cc
new file mode 100644
index 0000000..7e715d2
--- /dev/null
+++ b/mojo/edk/system/message_in_transit_queue_unittest.cc
@@ -0,0 +1,91 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/message_in_transit_queue.h"
+
+#include "mojo/edk/system/message_in_transit_test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+TEST(MessageInTransitQueueTest, Basic) {
+  MessageInTransitQueue queue;
+  EXPECT_TRUE(queue.IsEmpty());
+
+  queue.AddMessage(test::MakeTestMessage(1));
+  ASSERT_FALSE(queue.IsEmpty());
+  EXPECT_EQ(1u, queue.Size());
+
+  test::VerifyTestMessage(queue.PeekMessage(), 1);
+  ASSERT_FALSE(queue.IsEmpty());
+  EXPECT_EQ(1u, queue.Size());
+
+  queue.AddMessage(test::MakeTestMessage(2));
+  queue.AddMessage(test::MakeTestMessage(3));
+  ASSERT_FALSE(queue.IsEmpty());
+  EXPECT_EQ(3u, queue.Size());
+
+  test::VerifyTestMessage(queue.GetMessage().get(), 1);
+  ASSERT_FALSE(queue.IsEmpty());
+  EXPECT_EQ(2u, queue.Size());
+
+  test::VerifyTestMessage(queue.PeekMessage(), 2);
+  ASSERT_FALSE(queue.IsEmpty());
+  EXPECT_EQ(2u, queue.Size());
+
+  queue.DiscardMessage();
+  ASSERT_FALSE(queue.IsEmpty());
+  EXPECT_EQ(1u, queue.Size());
+
+  test::VerifyTestMessage(queue.GetMessage().get(), 3);
+  EXPECT_TRUE(queue.IsEmpty());
+  EXPECT_EQ(0u, queue.Size());
+
+  queue.AddMessage(test::MakeTestMessage(4));
+  ASSERT_FALSE(queue.IsEmpty());
+  EXPECT_EQ(1u, queue.Size());
+
+  test::VerifyTestMessage(queue.PeekMessage(), 4);
+  ASSERT_FALSE(queue.IsEmpty());
+  EXPECT_EQ(1u, queue.Size());
+
+  queue.Clear();
+  EXPECT_TRUE(queue.IsEmpty());
+  EXPECT_EQ(0u, queue.Size());
+}
+
+TEST(MessageInTransitQueueTest, Swap) {
+  MessageInTransitQueue queue1;
+  MessageInTransitQueue queue2;
+
+  queue1.AddMessage(test::MakeTestMessage(1));
+  queue1.AddMessage(test::MakeTestMessage(2));
+  queue1.AddMessage(test::MakeTestMessage(3));
+  EXPECT_EQ(3u, queue1.Size());
+
+  queue2.AddMessage(test::MakeTestMessage(4));
+  queue2.AddMessage(test::MakeTestMessage(5));
+  EXPECT_EQ(2u, queue2.Size());
+
+  queue1.Swap(&queue2);
+  EXPECT_EQ(2u, queue1.Size());
+  EXPECT_EQ(3u, queue2.Size());
+  test::VerifyTestMessage(queue1.GetMessage().get(), 4);
+  test::VerifyTestMessage(queue1.GetMessage().get(), 5);
+  EXPECT_TRUE(queue1.IsEmpty());
+
+  queue1.Swap(&queue2);
+  EXPECT_TRUE(queue2.IsEmpty());
+
+  test::VerifyTestMessage(queue1.GetMessage().get(), 1);
+  test::VerifyTestMessage(queue1.GetMessage().get(), 2);
+  test::VerifyTestMessage(queue1.GetMessage().get(), 3);
+  EXPECT_TRUE(queue1.IsEmpty());
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/message_in_transit_test_utils.cc b/mojo/edk/system/message_in_transit_test_utils.cc
new file mode 100644
index 0000000..8013626
--- /dev/null
+++ b/mojo/edk/system/message_in_transit_test_utils.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/message_in_transit_test_utils.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+scoped_ptr<MessageInTransit> MakeTestMessage(unsigned id) {
+  return make_scoped_ptr(
+      new MessageInTransit(MessageInTransit::Type::MESSAGE,
+                           static_cast<uint32_t>(sizeof(id)), &id));
+}
+
+void VerifyTestMessage(const MessageInTransit* message, unsigned id) {
+  ASSERT_TRUE(message);
+  EXPECT_EQ(MessageInTransit::Type::MESSAGE, message->type());
+  EXPECT_EQ(sizeof(id), message->num_bytes());
+  EXPECT_EQ(id, *static_cast<const unsigned*>(message->bytes()));
+}
+
+bool IsTestMessage(MessageInTransit* message, unsigned* id) {
+  if (message->type() != MessageInTransit::Type::MESSAGE ||
+      message->num_bytes() != sizeof(*id))
+    return false;
+
+  *id = *static_cast<const unsigned*>(message->bytes());
+  return true;
+}
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/message_in_transit_test_utils.h b/mojo/edk/system/message_in_transit_test_utils.h
new file mode 100644
index 0000000..079d27b
--- /dev/null
+++ b/mojo/edk/system/message_in_transit_test_utils.h
@@ -0,0 +1,35 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_TEST_UTILS_H_
+#define MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_TEST_UTILS_H_
+
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/system/message_in_transit.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+// Makes a test message. It will be of type
+// |MessageInTransit::Type::ENDPOINT_CLIENT| and subtype
+// |MessageInTransit::Subtype::ENDPOINT_CLIENT_DATA|, and contain data
+// associated with |id| (so that test messages with different |id|s are
+// distinguishable).
+scoped_ptr<MessageInTransit> MakeTestMessage(unsigned id);
+
+// Verifies a test message: ASSERTs that |message| is non-null, and EXPECTs that
+// it looks like a message created using |MakeTestMessage(id)| (see above).
+void VerifyTestMessage(const MessageInTransit* message, unsigned id);
+
+// Checks if |message| looks like a test message created using
+// |MakeTestMessage()|, in which case it returns true and sets |*id|. (Otherwise
+// it returns false and leaves |*id| alone.)
+bool IsTestMessage(MessageInTransit* message, unsigned* id);
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_MESSAGE_IN_TRANSIT_TEST_UTILS_H_
diff --git a/mojo/edk/system/message_pipe_dispatcher.cc b/mojo/edk/system/message_pipe_dispatcher.cc
new file mode 100644
index 0000000..ebd07a3c
--- /dev/null
+++ b/mojo/edk/system/message_pipe_dispatcher.cc
@@ -0,0 +1,720 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/message_pipe_dispatcher.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/message_in_transit.h"
+#include "mojo/edk/system/options_validation.h"
+#include "mojo/edk/system/transport_data.h"
+
+namespace mojo {
+namespace edk {
+
+// TODO(jam): do more tests on using channel on same thread if it supports it (
+// i.e. with USE_CHROME_EDK and Windows). Also see ipc_channel_mojo.cc
+bool g_use_channel_on_io_thread_only = true;
+
+const size_t kInvalidMessagePipeHandleIndex = static_cast<size_t>(-1);
+
+struct MOJO_ALIGNAS(8) SerializedMessagePipeHandleDispatcher {
+  size_t platform_handle_index;  // (Or |kInvalidMessagePipeHandleIndex|.)
+  size_t read_buffer_size; // any bytes after this are serialized messages
+};
+
+// MessagePipeDispatcher -------------------------------------------------------
+
+const MojoCreateMessagePipeOptions
+    MessagePipeDispatcher::kDefaultCreateOptions = {
+        static_cast<uint32_t>(sizeof(MojoCreateMessagePipeOptions)),
+        MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE};
+
+MojoResult MessagePipeDispatcher::ValidateCreateOptions(
+    const MojoCreateMessagePipeOptions* in_options,
+    MojoCreateMessagePipeOptions* out_options) {
+  const MojoCreateMessagePipeOptionsFlags kKnownFlags =
+      MOJO_CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE;
+
+  *out_options = kDefaultCreateOptions;
+  if (!in_options)
+    return MOJO_RESULT_OK;
+
+  UserOptionsReader<MojoCreateMessagePipeOptions> reader(in_options);
+  if (!reader.is_valid())
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  if (!OPTIONS_STRUCT_HAS_MEMBER(MojoCreateMessagePipeOptions, flags, reader))
+    return MOJO_RESULT_OK;
+  if ((reader.options().flags & ~kKnownFlags))
+    return MOJO_RESULT_UNIMPLEMENTED;
+  out_options->flags = reader.options().flags;
+
+  // Checks for fields beyond |flags|:
+
+  // (Nothing here yet.)
+
+  return MOJO_RESULT_OK;
+}
+
+void MessagePipeDispatcher::Init(ScopedPlatformHandle message_pipe) {
+  InitWithReadBuffer(message_pipe.Pass(), nullptr, 0);
+}
+
+void MessagePipeDispatcher::InitWithReadBuffer(
+    ScopedPlatformHandle message_pipe,
+    char* data,
+    size_t size) {
+  if (message_pipe.get().is_valid()) {
+    channel_ = RawChannel::Create(message_pipe.Pass());
+
+    // TODO(jam): It's probably cleaner to pass this in Init call.
+    if (size)
+      channel_->SetInitialReadBufferData(data, size);
+    if (g_use_channel_on_io_thread_only) {
+      internal::g_io_thread_task_runner->PostTask(
+          FROM_HERE, base::Bind(&MessagePipeDispatcher::InitOnIO, this));
+    } else {
+      InitOnIO();
+    }
+    // TODO(jam): optimize for when running on IO thread?
+  }
+}
+
+void MessagePipeDispatcher::InitOnIO() {
+  base::AutoLock locker(lock());
+  calling_init_ = true;
+  if (channel_)
+    channel_->Init(this);
+  calling_init_ = false;
+}
+
+void MessagePipeDispatcher::CloseOnIO() {
+  base::AutoLock locker(lock());
+
+  if (channel_) {
+    channel_->Shutdown();
+    channel_ = nullptr;
+  }
+}
+
+Dispatcher::Type MessagePipeDispatcher::GetType() const {
+  return Type::MESSAGE_PIPE;
+}
+
+// TODO(jam): this is copied from RawChannelWin till I figure out what's the
+// best way we want to share this. Need to also consider posix which does
+// require access to the RawChannel.
+// Since this is used for serialization of messages read/written to a MP that
+// aren't consumed by Mojo primitives yet, there could be an unbounded number of
+// them when a MP is being sent. As a result, even for POSIX we will probably
+// want to send the handles to the shell process and exchange them for tokens
+// (since we can be sure that the shell will respond to our IPCs, compared to
+// the other end where we're sending the MP to, which may not be reading...).
+ScopedPlatformHandleVectorPtr GetReadPlatformHandles(
+    size_t num_platform_handles,
+    const void* platform_handle_table) {
+  // TODO(jam): this code will have to be updated once it's used in a sandbox
+  // and the receiving process doesn't have duplicate permission for the
+  // receiver. Once there's a broker and we have a connection to it (possibly
+  // through ConnectionManager), then we can make a sync IPC to it here to get a
+  // token for this handle, and it will duplicate the handle to is process. Then
+  // we pass the token to the receiver, which will then make a sync call to the
+  // broker to get a duplicated handle. This will also allow us to avoid leaks
+  // of the handle if the receiver dies, since the broker can notice that.
+  DCHECK_GT(num_platform_handles, 0u);
+  ScopedPlatformHandleVectorPtr rv(new PlatformHandleVector());
+
+#if defined(OS_WIN)
+  const char* serialization_data =
+      static_cast<const char*>(platform_handle_table);
+  for (size_t i = 0; i < num_platform_handles; i++) {
+    DWORD pid = *reinterpret_cast<const DWORD*>(serialization_data);
+    serialization_data += sizeof(DWORD);
+    HANDLE source_handle = *reinterpret_cast<const HANDLE*>(serialization_data);
+    serialization_data += sizeof(HANDLE);
+    base::Process sender =
+        base::Process::OpenWithAccess(pid, PROCESS_DUP_HANDLE);
+    DCHECK(sender.IsValid());
+    HANDLE target_handle = NULL;
+    BOOL dup_result =
+        DuplicateHandle(sender.Handle(), source_handle,
+                        base::GetCurrentProcessHandle(), &target_handle, 0,
+                        FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+    DCHECK(dup_result);
+    rv->push_back(PlatformHandle(target_handle));
+  }
+#else
+  NOTREACHED() << "TODO(jam): implement";
+#endif
+  return rv.Pass();
+}
+
+scoped_refptr<MessagePipeDispatcher> MessagePipeDispatcher::Deserialize(
+    const void* source,
+    size_t size,
+    PlatformHandleVector* platform_handles) {
+  const SerializedMessagePipeHandleDispatcher* serialization =
+      static_cast<const SerializedMessagePipeHandleDispatcher*>(source);
+  size_t platform_handle_index = serialization->platform_handle_index;
+
+
+  // Starts off invalid, which is what we want.
+  PlatformHandle platform_handle;
+
+  if (platform_handle_index != kInvalidMessagePipeHandleIndex) {
+    if (!platform_handles ||
+        platform_handle_index >= platform_handles->size()) {
+      LOG(ERROR)
+          << "Invalid serialized platform handle dispatcher (missing handles)";
+      return nullptr;
+    }
+
+    // We take ownership of the handle, so we have to invalidate the one in
+    // |platform_handles|.
+    std::swap(platform_handle, (*platform_handles)[platform_handle_index]);
+  }
+
+  // TODO(jam): temporary until we send message_queue_ via shared memory.
+  size -= sizeof(SerializedMessagePipeHandleDispatcher);
+  const char* messages = static_cast<const char*>(source);
+  messages += sizeof(SerializedMessagePipeHandleDispatcher);
+
+  char* initial_read_data = nullptr;
+  size_t initial_read_size = 0;
+
+  if (serialization->read_buffer_size) {
+    initial_read_data = const_cast<char*>(messages);
+    initial_read_size = serialization->read_buffer_size;
+
+    messages += initial_read_size;
+    size -= initial_read_size;
+  }
+
+  scoped_refptr<MessagePipeDispatcher> rv(
+      Create(MessagePipeDispatcher::kDefaultCreateOptions));
+  rv->InitWithReadBuffer(
+      ScopedPlatformHandle(platform_handle),
+      initial_read_data, initial_read_size);
+
+  while (size) {
+    size_t message_size;
+    CHECK(MessageInTransit::GetNextMessageSize(
+              messages, size, &message_size));
+    MessageInTransit::View message_view(message_size, messages);
+    size -= message_size;
+    messages += message_size;
+
+    // TODO(jam): Copied below from RawChannelWin. See commment above
+    // GetReadPlatformHandles.
+    ScopedPlatformHandleVectorPtr platform_handles;
+    if (message_view.transport_data_buffer()) {
+      size_t num_platform_handles;
+      const void* platform_handle_table;
+      TransportData::GetPlatformHandleTable(
+          message_view.transport_data_buffer(), &num_platform_handles,
+          &platform_handle_table);
+
+      if (num_platform_handles > 0) {
+        platform_handles =
+            GetReadPlatformHandles(num_platform_handles,
+                                    platform_handle_table).Pass();
+        if (!platform_handles) {
+          LOG(ERROR) << "Invalid number of platform handles received";
+          return nullptr;
+        }
+      }
+    }
+
+    // TODO(jam): Copied below from RawChannelWin. See commment above
+    // GetReadPlatformHandles.
+    scoped_ptr<MessageInTransit> message(new MessageInTransit(message_view));
+    if (message_view.transport_data_buffer_size() > 0) {
+      DCHECK(message_view.transport_data_buffer());
+      message->SetDispatchers(TransportData::DeserializeDispatchers(
+          message_view.transport_data_buffer(),
+          message_view.transport_data_buffer_size(), platform_handles.Pass()));
+    }
+
+    rv->message_queue_.AddMessage(message.Pass());
+  }
+
+  return rv;
+}
+
+MessagePipeDispatcher::MessagePipeDispatcher()
+    : channel_(nullptr),
+      serialized_(false),
+      calling_init_(false),
+      error_(false) {
+}
+
+MessagePipeDispatcher::~MessagePipeDispatcher() {
+  // |Close()|/|CloseImplNoLock()| should have taken care of the channel.
+  DCHECK(!channel_);
+}
+
+void MessagePipeDispatcher::CancelAllAwakablesNoLock() {
+  lock().AssertAcquired();
+  awakable_list_.CancelAll();
+}
+
+void MessagePipeDispatcher::CloseImplNoLock() {
+  lock().AssertAcquired();
+  if (g_use_channel_on_io_thread_only) {
+    internal::g_io_thread_task_runner->PostTask(
+        FROM_HERE, base::Bind(&MessagePipeDispatcher::CloseOnIO, this));
+  } else {
+    CloseOnIO();
+  }
+}
+
+void MessagePipeDispatcher::SerializeInternal() {
+  // We need to stop watching handle immediately, even tho not on IO thread, so
+  // that other messages aren't read after this.
+  {
+    if (channel_) {
+      serialized_platform_handle_ =
+          channel_->ReleaseHandle(&serialized_read_buffer_).release();
+      channel_ = nullptr;
+    } else {
+      // It's valid that the other side wrote some data and closed its end.
+    }
+  }
+
+  DCHECK(serialized_message_queue_.empty());
+  // see comment in method below, this is only temporary till we implement a
+  // solution with shared buffer
+  while (!message_queue_.IsEmpty()) {
+    scoped_ptr<MessageInTransit> message = message_queue_.GetMessage();
+    size_t cur_size = serialized_message_queue_.size();
+
+
+    // When MojoWriteMessage is called, the MessageInTransit doesn't have
+    // dispatchers set and CreateEquivaent... is called since the dispatchers
+    // can be referenced by others. here dispatchers aren't referenced by
+    // others, but rawchannel can still call to them. so since we dont call
+    // createequiv, manually call TransportStarted and TransportEnd.
+    DispatcherVector dispatchers;
+    if (message->has_dispatchers())
+      dispatchers = *message->dispatchers();
+    for (size_t i = 0; i < dispatchers.size(); ++i)
+      dispatchers[i]->TransportStarted();
+
+    // TODO(jam): this handling for dispatchers only works on windows where we
+    // send transportdata as bytes instead of as parameters to sendmsg.
+    message->SerializeAndCloseDispatchers();
+    // cont'd below
+
+
+    size_t main_buffer_size = message->main_buffer_size();
+    size_t transport_data_buffer_size = message->transport_data() ?
+        message->transport_data()->buffer_size() : 0;
+    size_t total_size = message->total_size();
+
+    serialized_message_queue_.resize(cur_size + total_size);
+    memcpy(&serialized_message_queue_[cur_size], message->main_buffer(),
+           main_buffer_size);
+
+    // cont'd
+    if (transport_data_buffer_size != 0) {
+#if defined(OS_WIN)
+      // TODO(jam): copied from RawChannelWin::WriteNoLock(
+      if (RawChannel::GetSerializedPlatformHandleSize()) {
+        char* serialization_data =
+            static_cast<char*>(message->transport_data()->buffer()) +
+             message->transport_data()->platform_handle_table_offset();
+        PlatformHandleVector* all_platform_handles =
+            message->transport_data()->platform_handles();
+        if (all_platform_handles) {
+          DWORD current_process_id = base::GetCurrentProcId();
+          for (size_t i = 0; i < all_platform_handles->size(); i++) {
+            *reinterpret_cast<DWORD*>(serialization_data) = current_process_id;
+            serialization_data += sizeof(DWORD);
+            *reinterpret_cast<HANDLE*>(serialization_data) =
+                all_platform_handles->at(i).handle;
+            serialization_data += sizeof(HANDLE);
+            all_platform_handles->at(i) = PlatformHandle();
+          }
+        }
+      }
+
+      memcpy(&serialized_message_queue_[
+                 cur_size + total_size - transport_data_buffer_size],
+             message->transport_data()->buffer(), transport_data_buffer_size);
+#else
+      NOTREACHED() << "TODO(jam) implement";
+#endif
+    }
+
+    for (size_t i = 0; i < dispatchers.size(); ++i)
+      dispatchers[i]->TransportEnded();
+  }
+
+  serialized_ = true;
+}
+
+scoped_refptr<Dispatcher>
+MessagePipeDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
+  lock().AssertAcquired();
+
+  SerializeInternal();
+
+  // TODO(vtl): Currently, there are no options, so we just use
+  // |kDefaultCreateOptions|. Eventually, we'll have to duplicate the options
+  // too.
+  scoped_refptr<MessagePipeDispatcher> rv = Create(kDefaultCreateOptions);
+  rv->serialized_platform_handle_ = serialized_platform_handle_;
+  serialized_platform_handle_ = PlatformHandle();
+  serialized_message_queue_.swap(rv->serialized_message_queue_);
+  serialized_read_buffer_.swap(rv->serialized_read_buffer_);
+  rv->serialized_ = true;
+  return scoped_refptr<Dispatcher>(rv.get());
+}
+
+MojoResult MessagePipeDispatcher::WriteMessageImplNoLock(
+    const void* bytes,
+    uint32_t num_bytes,
+    std::vector<DispatcherTransport>* transports,
+    MojoWriteMessageFlags flags) {
+
+  DCHECK(!transports ||
+         (transports->size() > 0 &&
+          transports->size() <= GetConfiguration().max_message_num_handles));
+
+  lock().AssertAcquired();
+
+  if (!channel_) {
+    DCHECK(error_);
+    return MOJO_RESULT_FAILED_PRECONDITION;
+  }
+
+  if (num_bytes > GetConfiguration().max_message_num_bytes)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+  scoped_ptr<MessageInTransit> message(new MessageInTransit(
+      MessageInTransit::Type::MESSAGE, num_bytes, bytes));
+  if (transports) {
+    MojoResult result = AttachTransportsNoLock(message.get(), transports);
+    if (result != MOJO_RESULT_OK)
+      return result;
+  }
+
+  message->SerializeAndCloseDispatchers();
+  channel_->WriteMessage(message.Pass());
+
+  return MOJO_RESULT_OK;
+}
+
+MojoResult MessagePipeDispatcher::ReadMessageImplNoLock(
+    void* bytes,
+    uint32_t* num_bytes,
+    DispatcherVector* dispatchers,
+    uint32_t* num_dispatchers,
+    MojoReadMessageFlags flags) {
+  lock().AssertAcquired();
+  DCHECK(!dispatchers || dispatchers->empty());
+
+  const uint32_t max_bytes = !num_bytes ? 0 : *num_bytes;
+  const uint32_t max_num_dispatchers = num_dispatchers ? *num_dispatchers : 0;
+
+  if (message_queue_.IsEmpty()) {
+    return error_ ? MOJO_RESULT_FAILED_PRECONDITION
+                  : MOJO_RESULT_SHOULD_WAIT;
+  }
+
+  // TODO(vtl): If |flags & MOJO_READ_MESSAGE_FLAG_MAY_DISCARD|, we could pop
+  // and release the lock immediately.
+  bool enough_space = true;
+  MessageInTransit* message = message_queue_.PeekMessage();
+  if (num_bytes)
+    *num_bytes = message->num_bytes();
+  if (message->num_bytes() <= max_bytes)
+    memcpy(bytes, message->bytes(), message->num_bytes());
+  else
+    enough_space = false;
+
+  if (DispatcherVector* queued_dispatchers = message->dispatchers()) {
+    if (num_dispatchers)
+      *num_dispatchers = static_cast<uint32_t>(queued_dispatchers->size());
+    if (enough_space) {
+      if (queued_dispatchers->empty()) {
+        // Nothing to do.
+      } else if (queued_dispatchers->size() <= max_num_dispatchers) {
+        DCHECK(dispatchers);
+        dispatchers->swap(*queued_dispatchers);
+      } else {
+        enough_space = false;
+      }
+    }
+  } else {
+    if (num_dispatchers)
+      *num_dispatchers = 0;
+  }
+
+  message = nullptr;
+
+  if (enough_space || (flags & MOJO_READ_MESSAGE_FLAG_MAY_DISCARD)) {
+    message_queue_.DiscardMessage();
+
+    // Now it's empty, thus no longer readable.
+    if (message_queue_.IsEmpty()) {
+      // It's currently not possible to wait for non-readability, but we should
+      // do the state change anyway.
+      awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+    }
+  }
+
+  if (!enough_space)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+
+  return MOJO_RESULT_OK;
+}
+
+HandleSignalsState MessagePipeDispatcher::GetHandleSignalsStateImplNoLock()
+    const {
+  lock().AssertAcquired();
+
+  HandleSignalsState rv;
+  if (!message_queue_.IsEmpty()) {
+    rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_READABLE;
+    rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_READABLE;
+  }
+  if (!error_) {
+    rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_WRITABLE;
+    rv.satisfiable_signals |=
+        MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE;
+  } else {
+    rv.satisfied_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+  }
+  rv.satisfiable_signals |= MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+  return rv;
+}
+
+MojoResult MessagePipeDispatcher::AddAwakableImplNoLock(
+    Awakable* awakable,
+    MojoHandleSignals signals,
+    uint32_t context,
+    HandleSignalsState* signals_state) {
+  lock().AssertAcquired();
+  HandleSignalsState state = GetHandleSignalsStateImplNoLock();
+  if (state.satisfies(signals)) {
+    if (signals_state)
+      *signals_state = state;
+    return MOJO_RESULT_ALREADY_EXISTS;
+  }
+  if (!state.can_satisfy(signals)) {
+    if (signals_state)
+      *signals_state = state;
+    return MOJO_RESULT_FAILED_PRECONDITION;
+  }
+
+  awakable_list_.Add(awakable, signals, context);
+  return MOJO_RESULT_OK;
+}
+
+void MessagePipeDispatcher::RemoveAwakableImplNoLock(
+    Awakable* awakable,
+    HandleSignalsState* signals_state) {
+  lock().AssertAcquired();
+
+  awakable_list_.Remove(awakable);
+  if (signals_state)
+    *signals_state = GetHandleSignalsStateImplNoLock();
+}
+
+void MessagePipeDispatcher::StartSerializeImplNoLock(
+    size_t* max_size,
+    size_t* max_platform_handles) {
+  if (!serialized_)
+    SerializeInternal();
+
+  *max_platform_handles = serialized_platform_handle_.is_valid() ? 1 : 0;
+
+  DCHECK_EQ(serialized_message_queue_.size() %
+            MessageInTransit::kMessageAlignment, 0U);
+  *max_size = sizeof(SerializedMessagePipeHandleDispatcher) +
+              serialized_message_queue_.size() +
+              serialized_read_buffer_.size();
+
+  DCHECK_LE(*max_size, TransportData::kMaxSerializedDispatcherSize);
+}
+
+bool MessagePipeDispatcher::EndSerializeAndCloseImplNoLock(
+    void* destination,
+    size_t* actual_size,
+    PlatformHandleVector* platform_handles) {
+  CloseImplNoLock();
+  SerializedMessagePipeHandleDispatcher* serialization =
+      static_cast<SerializedMessagePipeHandleDispatcher*>(destination);
+  if (serialized_platform_handle_.is_valid()) {
+    serialization->platform_handle_index = platform_handles->size();
+    platform_handles->push_back(serialized_platform_handle_);
+  } else {
+    serialization->platform_handle_index = kInvalidMessagePipeHandleIndex;
+  }
+  serialization->read_buffer_size = serialized_read_buffer_.size();
+
+  char* destination_char = static_cast<char*>(destination);
+  destination_char += sizeof(SerializedMessagePipeHandleDispatcher);
+
+  if (!serialized_read_buffer_.empty()) {
+    memcpy(destination_char, &serialized_read_buffer_[0],
+           serialized_read_buffer_.size());
+    destination_char += serialized_read_buffer_.size();
+  }
+
+
+  if (!serialized_message_queue_.empty()) {
+    memcpy(destination_char,
+           &serialized_message_queue_[0],
+           serialized_message_queue_.size());
+  }
+
+  *actual_size =
+      sizeof(SerializedMessagePipeHandleDispatcher) +
+      serialized_message_queue_.size() +
+      serialized_read_buffer_.size();
+
+  return true;
+}
+
+void MessagePipeDispatcher::TransportStarted() {
+  started_transport_.Acquire();
+}
+
+void MessagePipeDispatcher::TransportEnded() {
+  started_transport_.Release();
+
+  base::AutoLock locker(lock());
+
+  // If transporting of MPD failed, we might have got more data and didn't
+  // awake for.
+  // TODO(jam): should we care about only alerting if it was empty before
+  // TransportStarted?
+  if (!message_queue_.IsEmpty())
+    awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+}
+
+void MessagePipeDispatcher::OnReadMessage(
+    const MessageInTransit::View& message_view,
+    ScopedPlatformHandleVectorPtr platform_handles) {
+  scoped_ptr<MessageInTransit> message(new MessageInTransit(message_view));
+  if (message_view.transport_data_buffer_size() > 0) {
+    DCHECK(message_view.transport_data_buffer());
+    message->SetDispatchers(TransportData::DeserializeDispatchers(
+        message_view.transport_data_buffer(),
+        message_view.transport_data_buffer_size(), platform_handles.Pass()));
+  }
+
+  if (started_transport_.Try()) {
+    // we're not in the middle of being sent
+
+    // Can get synchronously called back in Init if there was initial data.
+    scoped_ptr<base::AutoLock> locker;
+    if (!calling_init_) {
+      locker.reset(new base::AutoLock(lock()));
+    }
+
+    bool was_empty = message_queue_.IsEmpty();
+    message_queue_.AddMessage(message.Pass());
+    if (was_empty)
+      awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+
+    started_transport_.Release();
+  } else {
+
+    // if RawChannel is calling OnRead, that means it has its read_lock_
+    // acquired. that means StartSerialize can't be accessing message queue as
+    // it waits on releasehandle first which acquires readlock_!
+    message_queue_.AddMessage(message.Pass());
+  }
+}
+
+void MessagePipeDispatcher::OnError(Error error) {
+  switch (error) {
+    case ERROR_READ_SHUTDOWN:
+      // The other side was cleanly closed, so this isn't actually an error.
+      DVLOG(1) << "MessagePipeDispatcher read error (shutdown)";
+      break;
+    case ERROR_READ_BROKEN:
+      LOG(ERROR) << "MessagePipeDispatcher read error (connection broken)";
+      break;
+    case ERROR_READ_BAD_MESSAGE:
+      // Receiving a bad message means either a bug, data corruption, or
+      // malicious attack (probably due to some other bug).
+      LOG(ERROR) << "MessagePipeDispatcher read error (received bad message)";
+      break;
+    case ERROR_READ_UNKNOWN:
+      LOG(ERROR) << "MessagePipeDispatcher read error (unknown)";
+      break;
+    case ERROR_WRITE:
+      // Write errors are slightly notable: they probably shouldn't happen under
+      // normal operation (but maybe the other side crashed).
+      LOG(WARNING) << "MessagePipeDispatcher write error";
+      break;
+  }
+
+  error_ = true;
+  if (started_transport_.Try()) {
+    base::AutoLock locker(lock());
+    awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+
+    base::MessageLoop::current()->PostTask(
+        FROM_HERE,
+        base::Bind(&RawChannel::Shutdown, base::Unretained(channel_)));
+    channel_ = nullptr;
+    started_transport_.Release();
+  } else {
+    // We must be waiting to call ReleaseHandle. It will call Shutdown.
+  }
+}
+
+MojoResult MessagePipeDispatcher::AttachTransportsNoLock(
+    MessageInTransit* message,
+    std::vector<DispatcherTransport>* transports) {
+  DCHECK(!message->has_dispatchers());
+
+  // You're not allowed to send either handle to a message pipe over the message
+  // pipe, so check for this. (The case of trying to write a handle to itself is
+  // taken care of by |Core|. That case kind of makes sense, but leads to
+  // complications if, e.g., both sides try to do the same thing with their
+  // respective handles simultaneously. The other case, of trying to write the
+  // peer handle to a handle, doesn't make sense -- since no handle will be
+  // available to read the message from.)
+  for (size_t i = 0; i < transports->size(); i++) {
+    if (!(*transports)[i].is_valid())
+      continue;
+    if ((*transports)[i].GetType() == Dispatcher::Type::MESSAGE_PIPE) {
+      MessagePipeDispatcher* mp =
+          static_cast<MessagePipeDispatcher*>(((*transports)[i]).dispatcher());
+      if (channel_ && mp->channel_ && channel_->IsOtherEndOf(mp->channel_)) {
+        // The other case should have been disallowed by |Core|. (Note: |port|
+        // is the peer port of the handle given to |WriteMessage()|.)
+        return MOJO_RESULT_INVALID_ARGUMENT;
+      }
+    }
+  }
+
+  // Clone the dispatchers and attach them to the message. (This must be done as
+  // a separate loop, since we want to leave the dispatchers alone on failure.)
+  scoped_ptr<DispatcherVector> dispatchers(new DispatcherVector());
+  dispatchers->reserve(transports->size());
+  for (size_t i = 0; i < transports->size(); i++) {
+    if ((*transports)[i].is_valid()) {
+      dispatchers->push_back(
+          (*transports)[i].CreateEquivalentDispatcherAndClose());
+    } else {
+      LOG(WARNING) << "Enqueueing null dispatcher";
+      dispatchers->push_back(nullptr);
+    }
+  }
+  message->SetDispatchers(dispatchers.Pass());
+  return MOJO_RESULT_OK;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/message_pipe_dispatcher.h b/mojo/edk/system/message_pipe_dispatcher.h
new file mode 100644
index 0000000..c47b550
--- /dev/null
+++ b/mojo/edk/system/message_pipe_dispatcher.h
@@ -0,0 +1,145 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
+#define MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
+
+#include "base/memory/ref_counted.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
+#include "mojo/edk/system/awakable_list.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/raw_channel.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// This is the |Dispatcher| implementation for message pipes (created by the
+// Mojo primitive |MojoCreateMessagePipe()|). This class is thread-safe.
+class MOJO_SYSTEM_IMPL_EXPORT MessagePipeDispatcher final
+    : public Dispatcher, public RawChannel::Delegate {
+ public:
+  // The default options to use for |MojoCreateMessagePipe()|. (Real uses
+  // should obtain this via |ValidateCreateOptions()| with a null |in_options|;
+  // this is exposed directly for testing convenience.)
+  static const MojoCreateMessagePipeOptions kDefaultCreateOptions;
+
+  static scoped_refptr<MessagePipeDispatcher> Create(
+      const MojoCreateMessagePipeOptions& /*validated_options*/) {
+    return make_scoped_refptr(new MessagePipeDispatcher());
+  }
+
+  // Validates and/or sets default options for |MojoCreateMessagePipeOptions|.
+  // If non-null, |in_options| must point to a struct of at least
+  // |in_options->struct_size| bytes. |out_options| must point to a (current)
+  // |MojoCreateMessagePipeOptions| and will be entirely overwritten on success
+  // (it may be partly overwritten on failure).
+  static MojoResult ValidateCreateOptions(
+      const MojoCreateMessagePipeOptions* in_options,
+      MojoCreateMessagePipeOptions* out_options);
+
+  // Must be called before any other methods. (This method is not thread-safe.)
+  void Init(ScopedPlatformHandle message_pipe);
+
+  // |Dispatcher| public methods:
+  Type GetType() const override;
+
+  // The "opposite" of |SerializeAndClose()|. (Typically this is called by
+  // |Dispatcher::Deserialize()|.)
+  static scoped_refptr<MessagePipeDispatcher> Deserialize(
+      const void* source,
+      size_t size,
+      PlatformHandleVector* platform_handles);
+
+ private:
+  MessagePipeDispatcher();
+  ~MessagePipeDispatcher() override;
+
+  void InitWithReadBuffer(ScopedPlatformHandle message_pipe,
+                          char* data,
+                          size_t size);
+
+  void InitOnIO();
+  void CloseOnIO();
+
+  // |Dispatcher| protected methods:
+  void CancelAllAwakablesNoLock() override;
+  void CloseImplNoLock() override;
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
+      override;
+  MojoResult WriteMessageImplNoLock(
+      const void* bytes,
+      uint32_t num_bytes,
+      std::vector<DispatcherTransport>* transports,
+      MojoWriteMessageFlags flags) override;
+  MojoResult ReadMessageImplNoLock(void* bytes,
+                                   uint32_t* num_bytes,
+                                   DispatcherVector* dispatchers,
+                                   uint32_t* num_dispatchers,
+                                   MojoReadMessageFlags flags) override;
+  HandleSignalsState GetHandleSignalsStateImplNoLock() const override;
+  MojoResult AddAwakableImplNoLock(Awakable* awakable,
+                                   MojoHandleSignals signals,
+                                   uint32_t context,
+                                   HandleSignalsState* signals_state) override;
+  void RemoveAwakableImplNoLock(Awakable* awakable,
+                                HandleSignalsState* signals_state) override;
+  void StartSerializeImplNoLock(size_t* max_size,
+                                size_t* max_platform_handles) override;
+  bool EndSerializeAndCloseImplNoLock(
+      void* destination,
+      size_t* actual_size,
+      PlatformHandleVector* platform_handles) override;
+  void TransportStarted() override;
+  void TransportEnded() override;
+
+  // |RawChannel::Delegate methods:
+  void OnReadMessage(
+    const MessageInTransit::View& message_view,
+    ScopedPlatformHandleVectorPtr platform_handles) override;
+  void OnError(Error error) override;
+
+  // Calls ReleaseHandle and serializes the raw channel. This is split into a
+  // function because it's called in two different ways:
+  // 1) When serializing "live" dispatchers that are passed to MojoWriteMessage,
+  // CreateEquivalentDispatcherAndCloseImplNoLock calls this.
+  // 2) When serializing dispatchers that are attached to deserialized messages
+  // which haven't been consumed by MojoReadMessage, StartSerializeImplNoLock
+  // calls this.
+  void SerializeInternal();
+
+  MojoResult AttachTransportsNoLock(
+      MessageInTransit* message,
+      std::vector<DispatcherTransport>* transports);
+
+  // Protected by |lock()|:
+  RawChannel* channel_;
+
+  // Queue of incoming messages that we read from RawChannel but haven't been
+  // consumed through MojoReadMessage yet.
+  MessageInTransitQueue message_queue_;
+  // When sending MP, contains serialized message_queue_.
+  bool serialized_;
+  // TODO(jam): stop using this and use shared memory instead since we are
+  // limited to 10K.
+  std::vector<char> serialized_message_queue_;
+  std::vector<char> serialized_read_buffer_;
+  PlatformHandle serialized_platform_handle_;
+  AwakableList awakable_list_;
+
+  // If DispatcherTransport is created. Must be set before lock() is called to
+  // avoid deadlocks with RawChannel calling us.
+  base::Lock started_transport_;
+
+  bool calling_init_;
+  bool error_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeDispatcher);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_MESSAGE_PIPE_DISPATCHER_H_
diff --git a/mojo/edk/system/message_pipe_perftest.cc b/mojo/edk/system/message_pipe_perftest.cc
new file mode 100644
index 0000000..5d59e656
--- /dev/null
+++ b/mojo/edk/system/message_pipe_perftest.cc
@@ -0,0 +1,162 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/strings/stringprintf.h"
+#include "base/test/perf_time_logger.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/handle_signals_state.h"
+#include "mojo/edk/system/message_pipe_test_utils.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/test/test_utils.h"
+#include "mojo/public/c/system/functions.h"
+#include "mojo/public/cpp/system/message_pipe.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+class MultiprocessMessagePipePerfTest
+    : public test::MultiprocessMessagePipeTestBase {
+ public:
+  MultiprocessMessagePipePerfTest()
+      : test::MultiprocessMessagePipeTestBase(base::MessageLoop::TYPE_IO),
+        message_count_(0),
+        message_size_(0) {}
+
+  void SetUpMeasurement(int message_count, size_t message_size) {
+    message_count_ = message_count;
+    message_size_ = message_size;
+    payload_ = std::string(message_size, '*');
+    read_buffer_.resize(message_size * 2);
+  }
+
+ protected:
+  void WriteWaitThenRead(MojoHandle mp) {
+    CHECK_EQ(MojoWriteMessage(mp, payload_.data(),
+                              static_cast<uint32_t>(payload_.size()), nullptr,
+                              0, MOJO_WRITE_MESSAGE_FLAG_NONE),
+             MOJO_RESULT_OK);
+    HandleSignalsState hss;
+    CHECK_EQ(MojoWait(mp, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE,
+                      &hss),
+             MOJO_RESULT_OK);
+    uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer_.size());
+    CHECK_EQ(MojoReadMessage(mp, &read_buffer_[0], &read_buffer_size, nullptr,
+                             nullptr, MOJO_READ_MESSAGE_FLAG_NONE),
+             MOJO_RESULT_OK);
+    CHECK_EQ(read_buffer_size, static_cast<uint32_t>(payload_.size()));
+  }
+
+  void SendQuitMessage(MojoHandle mp) {
+    CHECK_EQ(MojoWriteMessage(mp, "", 0, nullptr, 0,
+                              MOJO_WRITE_MESSAGE_FLAG_NONE),
+             MOJO_RESULT_OK);
+  }
+
+  void Measure(MojoHandle mp) {
+    // Have one ping-pong to ensure channel being established.
+    WriteWaitThenRead(mp);
+
+    std::string test_name =
+        base::StringPrintf("IPC_Perf_%dx_%u", message_count_,
+                           static_cast<unsigned>(message_size_));
+    base::PerfTimeLogger logger(test_name.c_str());
+
+    for (int i = 0; i < message_count_; ++i)
+      WriteWaitThenRead(mp);
+
+    logger.Done();
+  }
+
+ private:
+  int message_count_;
+  size_t message_size_;
+  std::string payload_;
+  std::string read_buffer_;
+  scoped_ptr<base::PerfTimeLogger> perf_logger_;
+};
+
+// For each message received, sends a reply message with the same contents
+// repeated twice, until the other end is closed or it receives "quitquitquit"
+// (which it doesn't reply to). It'll return the number of messages received,
+// not including any "quitquitquit" message, modulo 100.
+MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PingPongClient) {
+  SimplePlatformSupport platform_support;
+  base::MessageLoop message_loop(base::MessageLoop::TYPE_IO);
+  base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
+  test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
+
+  ScopedPlatformHandle client_platform_handle =
+      test::MultiprocessTestHelper::client_platform_handle.Pass();
+  CHECK(client_platform_handle.is_valid());
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(client_platform_handle.Pass());
+
+  std::string buffer(1000000, '\0');
+  int rv = 0;
+  while (true) {
+    // Wait for our end of the message pipe to be readable.
+    HandleSignalsState hss;
+    MojoResult result =
+        MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+                 MOJO_DEADLINE_INDEFINITE, &hss);
+    if (result != MOJO_RESULT_OK) {
+      rv = result;
+      break;
+    }
+
+    uint32_t read_size = static_cast<uint32_t>(buffer.size());
+    CHECK_EQ(MojoReadMessage(mp.get().value(), &buffer[0],
+                             &read_size, nullptr,
+                             0, MOJO_READ_MESSAGE_FLAG_NONE),
+             MOJO_RESULT_OK);
+
+    // Empty message indicates quit.
+    if (read_size == 0)
+      break;
+
+    CHECK_EQ(MojoWriteMessage(mp.get().value(), &buffer[0],
+                              read_size,
+                              nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE),
+             MOJO_RESULT_OK);
+  }
+
+  return rv;
+}
+
+// Repeatedly sends messages as previous one got replied by the child.
+// Waits for the child to close its end before quitting once specified
+// number of messages has been sent.
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_PingPong DISABLED_PingPong
+#else
+#define MAYBE_PingPong PingPong
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessMessagePipePerfTest, MAYBE_PingPong) {
+  helper()->StartChild("PingPongClient");
+
+  ScopedMessagePipeHandle mp = CreateMessagePipe(
+      helper()->server_platform_handle.Pass());
+
+  // This values are set to align with one at ipc_pertests.cc for comparison.
+  const size_t kMsgSize[5] = {12, 144, 1728, 20736, 248832};
+  const int kMessageCount[5] = {50000, 50000, 50000, 12000, 1000};
+
+  for (size_t i = 0; i < 5; i++) {
+    SetUpMeasurement(kMessageCount[i], kMsgSize[i]);
+    Measure(mp.get().value());
+  }
+
+  SendQuitMessage(mp.get().value());
+  EXPECT_EQ(0, helper()->WaitForChildShutdown());
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/message_pipe_test_utils.cc b/mojo/edk/system/message_pipe_test_utils.cc
new file mode 100644
index 0000000..1e337fb
--- /dev/null
+++ b/mojo/edk/system/message_pipe_test_utils.cc
@@ -0,0 +1,32 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/message_pipe_test_utils.h"
+
+#include "mojo/edk/system/test_utils.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+#if !defined(OS_IOS)
+MultiprocessMessagePipeTestBase::MultiprocessMessagePipeTestBase()
+    : test_io_thread_(base::TestIOThread::kAutoStart),
+      ipc_support_(test_io_thread_.task_runner()) {
+}
+
+MultiprocessMessagePipeTestBase::MultiprocessMessagePipeTestBase(
+    base::MessageLoop::Type main_message_loop_type)
+    : message_loop_(main_message_loop_type),
+      test_io_thread_(base::TestIOThread::kAutoStart),
+      ipc_support_(test_io_thread_.task_runner()) {
+}
+
+MultiprocessMessagePipeTestBase::~MultiprocessMessagePipeTestBase() {
+}
+#endif
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/message_pipe_test_utils.h b/mojo/edk/system/message_pipe_test_utils.h
new file mode 100644
index 0000000..e067329d
--- /dev/null
+++ b/mojo/edk/system/message_pipe_test_utils.h
@@ -0,0 +1,51 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
+#define MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
+
+#include "base/message_loop/message_loop.h"
+#include "base/test/test_io_thread.h"
+#include "mojo/edk/embedder/simple_platform_support.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/test/multiprocess_test_helper.h"
+#include "mojo/edk/test/scoped_ipc_support.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+class ChannelEndpoint;
+class MessagePipe;
+
+namespace test {
+
+#if !defined(OS_IOS)
+class MultiprocessMessagePipeTestBase : public testing::Test {
+ public:
+  MultiprocessMessagePipeTestBase();
+  MultiprocessMessagePipeTestBase(
+      base::MessageLoop::Type main_message_loop_type);
+  ~MultiprocessMessagePipeTestBase() override;
+
+ protected:
+  PlatformSupport* platform_support() { return &platform_support_; }
+  test::MultiprocessTestHelper* helper() { return &helper_; }
+
+ private:
+  SimplePlatformSupport platform_support_;
+  base::MessageLoop message_loop_;
+  base::TestIOThread test_io_thread_;
+  test::ScopedIPCSupport ipc_support_;
+  test::MultiprocessTestHelper helper_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessMessagePipeTestBase);
+};
+#endif
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_MESSAGE_PIPE_TEST_UTILS_H_
diff --git a/mojo/edk/system/message_pipe_unittest.cc b/mojo/edk/system/message_pipe_unittest.cc
new file mode 100644
index 0000000..9283acc
--- /dev/null
+++ b/mojo/edk/system/message_pipe_unittest.cc
@@ -0,0 +1,409 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/memory/ref_counted.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/public/c/system/core.h"
+#include "mojo/public/c/system/types.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+const MojoHandleSignals kAllSignals = MOJO_HANDLE_SIGNAL_READABLE |
+                                      MOJO_HANDLE_SIGNAL_WRITABLE |
+                                      MOJO_HANDLE_SIGNAL_PEER_CLOSED;
+static const char kHelloWorld[] = "hello world";
+
+class MessagePipeTest : public test::MojoSystemTest {
+ public:
+  MessagePipeTest() {
+    CHECK_EQ(MOJO_RESULT_OK, MojoCreateMessagePipe(nullptr, &pipe0_, &pipe1_));
+  }
+
+  ~MessagePipeTest() override {
+    if (pipe0_ != MOJO_HANDLE_INVALID)
+      CHECK_EQ(MOJO_RESULT_OK, MojoClose(pipe0_));
+    if (pipe1_ != MOJO_HANDLE_INVALID)
+      CHECK_EQ(MOJO_RESULT_OK, MojoClose(pipe1_));
+  }
+
+  MojoResult WriteMessage(MojoHandle message_pipe_handle,
+                          const void* bytes,
+                          uint32_t num_bytes) {
+    return MojoWriteMessage(message_pipe_handle, bytes, num_bytes, nullptr, 0,
+                            MOJO_WRITE_MESSAGE_FLAG_NONE);
+  }
+
+  MojoResult ReadMessage(MojoHandle message_pipe_handle,
+                         void* bytes,
+                         uint32_t* num_bytes,
+                         bool may_discard = false) {
+    return MojoReadMessage(message_pipe_handle, bytes, num_bytes, nullptr, 0,
+                           may_discard ? MOJO_READ_MESSAGE_FLAG_MAY_DISCARD :
+                                         MOJO_READ_MESSAGE_FLAG_NONE);
+  }
+
+  MojoHandle pipe0_, pipe1_;
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MessagePipeTest);
+};
+
+TEST_F(MessagePipeTest, WriteData) {
+  ASSERT_EQ(MOJO_RESULT_OK,
+            WriteMessage(pipe0_, kHelloWorld, sizeof(kHelloWorld)));
+}
+
+// Tests:
+//  - only default flags
+//  - reading messages from a port
+//    - when there are no/one/two messages available for that port
+//    - with buffer size 0 (and null buffer) -- should get size
+//    - with too-small buffer -- should get size
+//    - also verify that buffers aren't modified when/where they shouldn't be
+//  - writing messages to a port
+//    - in the obvious scenarios (as above)
+//    - to a port that's been closed
+//  - writing a message to a port, closing the other (would be the source) port,
+//    and reading it
+TEST_F(MessagePipeTest, Basic) {
+  int32_t buffer[2];
+  const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
+  uint32_t buffer_size;
+
+  // Nothing to read yet on port 0.
+  buffer[0] = 123;
+  buffer[1] = 456;
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT, ReadMessage(pipe0_, buffer, &buffer_size));
+  ASSERT_EQ(kBufferSize, buffer_size);
+  ASSERT_EQ(123, buffer[0]);
+  ASSERT_EQ(456, buffer[1]);
+
+  // Ditto for port 1.
+  buffer[0] = 123;
+  buffer[1] = 456;
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT, ReadMessage(pipe1_, buffer, &buffer_size));
+
+  // Write from port 1 (to port 0).
+  buffer[0] = 789012345;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe1_, buffer, sizeof(buffer[0])));
+
+  MojoHandleSignalsState state;
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Read from port 0.
+  buffer[0] = 123;
+  buffer[1] = 456;
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_OK, ReadMessage(pipe0_, buffer, &buffer_size));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+  ASSERT_EQ(789012345, buffer[0]);
+  ASSERT_EQ(456, buffer[1]);
+
+  // Read again from port 0 -- it should be empty.
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT, ReadMessage(pipe0_, buffer, &buffer_size));
+
+  // Write two messages from port 0 (to port 1).
+  buffer[0] = 123456789;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe0_, buffer, sizeof(buffer[0])));
+  buffer[0] = 234567890;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe0_, buffer, sizeof(buffer[0])));
+
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Read from port 1 with buffer size 0 (should get the size of next message).
+  // Also test that giving a null buffer is okay when the buffer size is 0.
+  buffer_size = 0;
+  ASSERT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
+            ReadMessage(pipe1_, nullptr, &buffer_size));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+
+  // Read from port 1 with buffer size 1 (too small; should get the size of next
+  // message).
+  buffer[0] = 123;
+  buffer[1] = 456;
+  buffer_size = 1;
+  ASSERT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
+            ReadMessage(pipe1_, buffer, &buffer_size));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+  ASSERT_EQ(123, buffer[0]);
+  ASSERT_EQ(456, buffer[1]);
+
+  // Read from port 1.
+  buffer[0] = 123;
+  buffer[1] = 456;
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_OK, ReadMessage(pipe1_, buffer, &buffer_size));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+  ASSERT_EQ(123456789, buffer[0]);
+  ASSERT_EQ(456, buffer[1]);
+
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Read again from port 1.
+  buffer[0] = 123;
+  buffer[1] = 456;
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_OK, ReadMessage(pipe1_, buffer, &buffer_size));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+  ASSERT_EQ(234567890, buffer[0]);
+  ASSERT_EQ(456, buffer[1]);
+
+  // Read again from port 1 -- it should be empty.
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT, ReadMessage(pipe1_, buffer, &buffer_size));
+
+  // Write from port 0 (to port 1).
+  buffer[0] = 345678901;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe0_, buffer, sizeof(buffer[0])));
+
+  // Close port 0.
+  MojoClose(pipe0_);
+  pipe0_ = MOJO_HANDLE_INVALID;
+
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Try to write from port 1 (to port 0).
+  buffer[0] = 456789012;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            WriteMessage(pipe1_, buffer, sizeof(buffer[0])));
+
+  // Read from port 1; should still get message (even though port 0 was closed).
+  buffer[0] = 123;
+  buffer[1] = 456;
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_OK, ReadMessage(pipe1_, buffer, &buffer_size));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+  ASSERT_EQ(345678901, buffer[0]);
+  ASSERT_EQ(456, buffer[1]);
+
+  // Read again from port 1 -- it should be empty (and port 0 is closed).
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            ReadMessage(pipe1_, buffer, &buffer_size));
+}
+
+TEST_F(MessagePipeTest, CloseWithQueuedIncomingMessages) {
+  int32_t buffer[1];
+  const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
+  uint32_t buffer_size;
+
+  // Write some messages from port 1 (to port 0).
+  for (int32_t i = 0; i < 5; i++) {
+    buffer[0] = i;
+    ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe1_, buffer, kBufferSize));
+  }
+
+  MojoHandleSignalsState state;
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Port 0 shouldn't be empty.
+  buffer_size = 0;
+  ASSERT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
+            ReadMessage(pipe0_, nullptr, &buffer_size));
+  ASSERT_EQ(kBufferSize, buffer_size);
+
+  // Close port 0 first, which should have outstanding (incoming) messages.
+  MojoClose(pipe0_);
+  MojoClose(pipe1_);
+  pipe0_ = pipe1_ = MOJO_HANDLE_INVALID;
+}
+
+TEST_F(MessagePipeTest, DiscardMode) {
+  int32_t buffer[2];
+  const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
+  uint32_t buffer_size;
+
+  // Write from port 1 (to port 0).
+  buffer[0] = 789012345;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe1_, buffer, sizeof(buffer[0])));
+
+  MojoHandleSignalsState state;
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Read/discard from port 0 (no buffer); get size.
+  buffer_size = 0;
+  ASSERT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
+            ReadMessage(pipe0_, nullptr, &buffer_size, true));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+
+  // Read again from port 0 -- it should be empty.
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT,
+            ReadMessage(pipe0_, buffer, &buffer_size, true));
+
+  // Write from port 1 (to port 0).
+  buffer[0] = 890123456;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            WriteMessage(pipe1_, buffer, sizeof(buffer[0])));
+
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Read from port 0 (buffer big enough).
+  buffer[0] = 123;
+  buffer[1] = 456;
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_OK, ReadMessage(pipe0_, buffer, &buffer_size, true));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+  ASSERT_EQ(890123456, buffer[0]);
+  ASSERT_EQ(456, buffer[1]);
+
+  // Read again from port 0 -- it should be empty.
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT,
+            ReadMessage(pipe0_, buffer, &buffer_size, true));
+
+  // Write from port 1 (to port 0).
+  buffer[0] = 901234567;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe1_, buffer, sizeof(buffer[0])));
+
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Read/discard from port 0 (buffer too small); get size.
+  buffer_size = 1;
+  ASSERT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
+            ReadMessage(pipe0_, buffer, &buffer_size, true));
+  ASSERT_EQ(static_cast<uint32_t>(sizeof(buffer[0])), buffer_size);
+
+  // Read again from port 0 -- it should be empty.
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT,
+            ReadMessage(pipe0_, buffer, &buffer_size, true));
+
+  // Write from port 1 (to port 0).
+  buffer[0] = 123456789;
+  buffer[1] = 0;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe1_, buffer, sizeof(buffer[0])));
+
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &state));
+
+  // Discard from port 0.
+  buffer_size = 1;
+  ASSERT_EQ(MOJO_RESULT_RESOURCE_EXHAUSTED,
+            ReadMessage(pipe0_, nullptr, 0, true));
+
+  // Read again from port 0 -- it should be empty.
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_SHOULD_WAIT,
+            ReadMessage(pipe0_, buffer, &buffer_size, true));
+}
+
+TEST_F(MessagePipeTest, BasicWaiting) {
+  MojoHandleSignalsState hss;
+
+  int32_t buffer[1];
+  const uint32_t kBufferSize = static_cast<uint32_t>(sizeof(buffer));
+  uint32_t buffer_size;
+
+  // Always writable (until the other port is closed).
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_WRITABLE, 0,
+                                     &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  ASSERT_EQ(kAllSignals, hss.satisfiable_signals);
+  hss = MojoHandleSignalsState();
+
+  // Not yet readable.
+  ASSERT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  ASSERT_EQ(kAllSignals, hss.satisfiable_signals);
+
+  // The peer is not closed.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            MojoWait(pipe0_, MOJO_HANDLE_SIGNAL_PEER_CLOSED, 0, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  ASSERT_EQ(kAllSignals, hss.satisfiable_signals);
+
+  // Write from port 0 (to port 1), to make port 1 readable.
+  buffer[0] = 123456789;
+  ASSERT_EQ(MOJO_RESULT_OK, WriteMessage(pipe0_, buffer, kBufferSize));
+
+  // Port 1 should already be readable now.
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  ASSERT_EQ(kAllSignals, hss.satisfiable_signals);
+  // ... and still writable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_WRITABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfied_signals);
+  ASSERT_EQ(kAllSignals, hss.satisfiable_signals);
+
+  // Close port 0.
+  MojoClose(pipe0_);
+  pipe0_ = MOJO_HANDLE_INVALID;
+
+  // Port 1 should be signaled with peer closed.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+                                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Port 1 should not be writable.
+  hss = MojoHandleSignalsState();
+
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_WRITABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // But it should still be readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_OK, MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_READABLE,
+                                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
+            hss.satisfiable_signals);
+
+  // Read from port 1.
+  buffer[0] = 0;
+  buffer_size = kBufferSize;
+  ASSERT_EQ(MOJO_RESULT_OK, ReadMessage(pipe1_, buffer, &buffer_size));
+  ASSERT_EQ(123456789, buffer[0]);
+
+  // Now port 1 should no longer be readable.
+  hss = MojoHandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(pipe1_, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/multiprocess_message_pipe_unittest.cc b/mojo/edk/system/multiprocess_message_pipe_unittest.cc
new file mode 100644
index 0000000..4cfeef5
--- /dev/null
+++ b/mojo/edk/system/multiprocess_message_pipe_unittest.cc
@@ -0,0 +1,782 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+#include <string>
+#include <vector>
+
+#include "base/bind.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_file.h"
+#include "base/files/scoped_temp_dir.h"
+#include "base/location.h"
+#include "base/logging.h"
+#include "base/test/test_io_thread.h"
+#include "build/build_config.h"  // TODO(vtl): Remove this.
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/message_pipe_test_utils.h"
+#include "mojo/edk/system/platform_handle_dispatcher.h"
+#include "mojo/edk/system/raw_channel.h"
+#include "mojo/edk/system/shared_buffer_dispatcher.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/test/test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+
+namespace mojo {
+namespace edk {
+namespace {
+
+class MultiprocessMessagePipeTest
+    : public test::MultiprocessMessagePipeTestBase {};
+
+// For each message received, sends a reply message with the same contents
+// repeated twice, until the other end is closed or it receives "quitquitquit"
+// (which it doesn't reply to). It'll return the number of messages received,
+// not including any "quitquitquit" message, modulo 100.
+MOJO_MULTIPROCESS_TEST_CHILD_MAIN(EchoEcho) {
+  SimplePlatformSupport platform_support;
+  base::MessageLoop message_loop;
+  base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
+  test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
+
+  ScopedPlatformHandle client_platform_handle =
+      test::MultiprocessTestHelper::client_platform_handle.Pass();
+  CHECK(client_platform_handle.is_valid());
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(client_platform_handle.Pass());
+
+  const std::string quitquitquit("quitquitquit");
+  int rv = 0;
+  for (;; rv = (rv + 1) % 100) {
+    // Wait for our end of the message pipe to be readable.
+    HandleSignalsState hss;
+    MojoResult result =
+        MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+                 MOJO_DEADLINE_INDEFINITE, &hss);
+    if (result != MOJO_RESULT_OK) {
+      // It was closed, probably.
+      CHECK_EQ(result, MOJO_RESULT_FAILED_PRECONDITION);
+      CHECK_EQ(hss.satisfied_signals, MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+      CHECK_EQ(hss.satisfiable_signals, MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+      break;
+    } else {
+      CHECK((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE));
+      CHECK((hss.satisfiable_signals & MOJO_HANDLE_SIGNAL_READABLE));
+    }
+
+    std::string read_buffer(1000, '\0');
+    uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+    CHECK_EQ(MojoReadMessage(mp.get().value(), &read_buffer[0],
+                             &read_buffer_size, nullptr,
+                             0, MOJO_READ_MESSAGE_FLAG_NONE),
+             MOJO_RESULT_OK);
+    read_buffer.resize(read_buffer_size);
+    VLOG(2) << "Child got: " << read_buffer;
+
+    if (read_buffer == quitquitquit) {
+      VLOG(2) << "Child quitting.";
+      break;
+    }
+
+    std::string write_buffer = read_buffer + read_buffer;
+    CHECK_EQ(MojoWriteMessage(mp.get().value(), write_buffer.data(),
+                              write_buffer.size(),
+                              nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE),
+             MOJO_RESULT_OK);
+  }
+
+   return rv;
+}
+
+// Sends "hello" to child, and expects "hellohello" back.
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_Basic DISABLED_Basic
+#else
+#define MAYBE_Basic Basic
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessMessagePipeTest, MAYBE_Basic) {
+  helper()->StartChild("EchoEcho");
+
+  ScopedMessagePipeHandle mp = CreateMessagePipe(
+      helper()->server_platform_handle.Pass());
+
+  std::string hello("hello");
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), hello.data(),
+                             hello.size(), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  HandleSignalsState hss;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+               MOJO_DEADLINE_INDEFINITE, &hss));
+  // The child may or may not have closed its end of the message pipe and died
+  // (and we may or may not know it yet), so our end may or may not appear as
+  // writable.
+  EXPECT_TRUE((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE));
+  EXPECT_TRUE((hss.satisfiable_signals & MOJO_HANDLE_SIGNAL_READABLE));
+
+  std::string read_buffer(1000, '\0');
+  uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+  CHECK_EQ(MojoReadMessage(mp.get().value(), &read_buffer[0],
+                           &read_buffer_size, nullptr, 0,
+                           MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  read_buffer.resize(read_buffer_size);
+  VLOG(2) << "Parent got: " << read_buffer;
+  ASSERT_EQ(hello + hello, read_buffer);
+
+  MojoClose(mp.release().value());
+
+  // We sent one message.
+  ASSERT_EQ(1 % 100, helper()->WaitForChildShutdown());
+}
+
+// Sends a bunch of messages to the child. Expects them "repeated" back. Waits
+// for the child to close its end before quitting.
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_QueueMessages DISABLED_QueueMessages
+#else
+#define MAYBE_QueueMessages QueueMessages
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessMessagePipeTest, MAYBE_QueueMessages) {
+  helper()->StartChild("EchoEcho");
+
+  ScopedMessagePipeHandle mp = CreateMessagePipe(
+      helper()->server_platform_handle.Pass());
+
+  static const size_t kNumMessages = 1001;
+  for (size_t i = 0; i < kNumMessages; i++) {
+    std::string write_buffer(i, 'A' + (i % 26));
+    ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), write_buffer.data(),
+                             write_buffer.size(), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+  }
+
+  const std::string quitquitquit("quitquitquit");
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), quitquitquit.data(),
+                             quitquitquit.size(), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  for (size_t i = 0; i < kNumMessages; i++) {
+    HandleSignalsState hss;
+    ASSERT_EQ(MOJO_RESULT_OK,
+              MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+                       MOJO_DEADLINE_INDEFINITE, &hss));
+    // The child may or may not have closed its end of the message pipe and died
+    // (and we may or may not know it yet), so our end may or may not appear as
+    // writable.
+    ASSERT_TRUE((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE));
+    ASSERT_TRUE((hss.satisfiable_signals & MOJO_HANDLE_SIGNAL_READABLE));
+
+    std::string read_buffer(kNumMessages * 2, '\0');
+    uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+    ASSERT_EQ(MojoReadMessage(mp.get().value(), &read_buffer[0],
+                             &read_buffer_size, nullptr, 0,
+                             MOJO_READ_MESSAGE_FLAG_NONE),
+             MOJO_RESULT_OK);
+    read_buffer.resize(read_buffer_size);
+
+    ASSERT_EQ(std::string(i * 2, 'A' + (i % 26)), read_buffer);
+  }
+
+  // Wait for it to become readable, which should fail (since we sent
+  // "quitquitquit").
+  HandleSignalsState hss;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+
+  ASSERT_EQ(static_cast<int>(kNumMessages % 100),
+            helper()->WaitForChildShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_MAIN(CheckSharedBuffer) {
+  SimplePlatformSupport platform_support;
+  base::MessageLoop message_loop;
+  base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
+  test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
+
+  ScopedPlatformHandle client_platform_handle =
+      test::MultiprocessTestHelper::client_platform_handle.Pass();
+  CHECK(client_platform_handle.is_valid());
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(client_platform_handle.Pass());
+
+  // Wait for the first message from our parent.
+  HandleSignalsState hss;
+  CHECK_EQ(MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+               MOJO_DEADLINE_INDEFINITE, &hss),
+           MOJO_RESULT_OK);
+  // In this test, the parent definitely doesn't close its end of the message
+  // pipe before we do.
+  CHECK_EQ(hss.satisfied_signals,
+           MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE);
+  CHECK_EQ(hss.satisfiable_signals, MOJO_HANDLE_SIGNAL_READABLE |
+                                    MOJO_HANDLE_SIGNAL_WRITABLE |
+                                    MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+
+  // It should have a shared buffer.
+  std::string read_buffer(100, '\0');
+  uint32_t num_bytes = static_cast<uint32_t>(read_buffer.size());
+  MojoHandle handles[10];
+  uint32_t num_handlers = MOJO_ARRAYSIZE(handles);  // Maximum number to receive
+  CHECK_EQ(MojoReadMessage(mp.get().value(), &read_buffer[0],
+                           &num_bytes, &handles[0],
+                           &num_handlers, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  read_buffer.resize(num_bytes);
+  CHECK_EQ(read_buffer, std::string("go 1"));
+  CHECK_EQ(num_handlers, 1u);
+
+  // Make a mapping.
+  void* buffer;
+  CHECK_EQ(MojoMapBuffer(handles[0], 0, 100, &buffer,
+                         MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE),
+           MOJO_RESULT_OK);
+
+  // Write some stuff to the shared buffer.
+  static const char kHello[] = "hello";
+  memcpy(buffer, kHello, sizeof(kHello));
+
+  // We should be able to close the dispatcher now.
+  MojoClose(handles[0]);
+
+  // And send a message to signal that we've written stuff.
+  const std::string go2("go 2");
+  CHECK_EQ(MojoWriteMessage(mp.get().value(), go2.data(),
+                              go2.size(), nullptr, 0,
+                              MOJO_WRITE_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+
+  // Now wait for our parent to send us a message.
+  hss = HandleSignalsState();
+  CHECK_EQ(MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+               MOJO_DEADLINE_INDEFINITE, &hss),
+           MOJO_RESULT_OK);
+  CHECK_EQ(hss.satisfied_signals,
+           MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE);
+  CHECK_EQ(hss.satisfiable_signals, MOJO_HANDLE_SIGNAL_READABLE |
+                                        MOJO_HANDLE_SIGNAL_WRITABLE |
+                                        MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+
+  read_buffer = std::string(100, '\0');
+  num_bytes = static_cast<uint32_t>(read_buffer.size());
+  CHECK_EQ(MojoReadMessage(mp.get().value(), &read_buffer[0], &num_bytes,
+                           nullptr, 0, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  read_buffer.resize(num_bytes);
+  CHECK_EQ(read_buffer, std::string("go 3"));
+
+  // It should have written something to the shared buffer.
+  static const char kWorld[] = "world!!!";
+  CHECK_EQ(memcmp(buffer, kWorld, sizeof(kWorld)), 0);
+
+  // And we're done.
+
+  return 0;
+}
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_SharedBufferPassing DISABLED_SharedBufferPassing
+#else
+#define MAYBE_SharedBufferPassing SharedBufferPassing
+#endif
+TEST_F(MultiprocessMessagePipeTest, MAYBE_SharedBufferPassing) {
+  helper()->StartChild("CheckSharedBuffer");
+
+  ScopedMessagePipeHandle mp = CreateMessagePipe(
+      helper()->server_platform_handle.Pass());
+
+  // Make a shared buffer.
+  MojoCreateSharedBufferOptions options;
+  options.struct_size = sizeof(options);
+  options.flags = MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE;
+
+  MojoHandle shared_buffer;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateSharedBuffer(&options, 100, &shared_buffer));
+
+  // Send the shared buffer.
+  const std::string go1("go 1");
+
+  MojoHandle duplicated_shared_buffer;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoDuplicateBufferHandle(
+                shared_buffer,
+                nullptr,
+                &duplicated_shared_buffer));
+  MojoHandle handles[1];
+  handles[0] = duplicated_shared_buffer;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), &go1[0], go1.size(), &handles[0],
+                             MOJO_ARRAYSIZE(handles),
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Wait for a message from the child.
+  HandleSignalsState hss;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  EXPECT_TRUE((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE));
+  EXPECT_TRUE((hss.satisfiable_signals & MOJO_HANDLE_SIGNAL_READABLE));
+
+  std::string read_buffer(100, '\0');
+  uint32_t num_bytes = static_cast<uint32_t>(read_buffer.size());
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoReadMessage(mp.get().value(), &read_buffer[0],
+                             &num_bytes, nullptr, 0,
+                             MOJO_READ_MESSAGE_FLAG_NONE));
+  read_buffer.resize(num_bytes);
+  ASSERT_EQ(std::string("go 2"), read_buffer);
+
+  // After we get it, the child should have written something to the shared
+  // buffer.
+  static const char kHello[] = "hello";
+  void* buffer;
+  CHECK_EQ(MojoMapBuffer(shared_buffer, 0, 100, &buffer,
+                         MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE),
+           MOJO_RESULT_OK);
+  ASSERT_EQ(0, memcmp(buffer, kHello, sizeof(kHello)));
+
+  // Now we'll write some stuff to the shared buffer.
+  static const char kWorld[] = "world!!!";
+  memcpy(buffer, kWorld, sizeof(kWorld));
+
+  // And send a message to signal that we've written stuff.
+  const std::string go3("go 3");
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), &go3[0],
+                             go3.size(), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Wait for |mp| to become readable, which should fail.
+  hss = HandleSignalsState();
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+
+  MojoClose(mp.release().value());
+
+  ASSERT_EQ(0, helper()->WaitForChildShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_MAIN(CheckPlatformHandleFile) {
+  SimplePlatformSupport platform_support;
+  base::MessageLoop message_loop;
+  base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
+  test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
+
+  ScopedPlatformHandle client_platform_handle =
+      test::MultiprocessTestHelper::client_platform_handle.Pass();
+  CHECK(client_platform_handle.is_valid());
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(client_platform_handle.Pass());
+
+  HandleSignalsState hss;
+  CHECK_EQ(MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+               MOJO_DEADLINE_INDEFINITE, &hss),
+           MOJO_RESULT_OK);
+  CHECK_EQ(hss.satisfied_signals,
+           MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE);
+  CHECK_EQ(hss.satisfiable_signals, MOJO_HANDLE_SIGNAL_READABLE |
+                                        MOJO_HANDLE_SIGNAL_WRITABLE |
+                                        MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+
+  std::string read_buffer(100, '\0');
+  uint32_t num_bytes = static_cast<uint32_t>(read_buffer.size());
+  MojoHandle handles[255];  // Maximum number to receive.
+  uint32_t num_handlers = MOJO_ARRAYSIZE(handles);
+
+  CHECK_EQ(MojoReadMessage(mp.get().value(), &read_buffer[0],
+                           &num_bytes, &handles[0],
+                           &num_handlers, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  MojoClose(mp.release().value());
+
+  read_buffer.resize(num_bytes);
+  char hello[32];
+  int num_handles = 0;
+  sscanf(read_buffer.c_str(), "%s %d", hello, &num_handles);
+  CHECK_EQ(std::string("hello"), std::string(hello));
+  CHECK_GT(num_handles, 0);
+
+  for (int i = 0; i < num_handles; ++i) {
+    ScopedPlatformHandle h;
+    CHECK_EQ(PassWrappedPlatformHandle(
+                handles[i], &h),
+             MOJO_RESULT_OK);
+    CHECK(h.is_valid());
+    MojoClose(handles[i]);
+
+    base::ScopedFILE fp(test::FILEFromPlatformHandle(h.Pass(), "r"));
+    CHECK(fp);
+    std::string fread_buffer(100, '\0');
+    size_t bytes_read =
+        fread(&fread_buffer[0], 1, fread_buffer.size(), fp.get());
+    fread_buffer.resize(bytes_read);
+    CHECK_EQ(fread_buffer, "world");
+  }
+
+  return 0;
+}
+
+class MultiprocessMessagePipeTestWithPipeCount
+    : public test::MultiprocessMessagePipeTestBase,
+      public testing::WithParamInterface<size_t> {};
+
+TEST_P(MultiprocessMessagePipeTestWithPipeCount, PlatformHandlePassing) {
+  base::ScopedTempDir temp_dir;
+  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+
+  helper()->StartChild("CheckPlatformHandleFile");
+  ScopedMessagePipeHandle mp = CreateMessagePipe(
+      helper()->server_platform_handle.Pass());
+
+  std::vector<MojoHandle> handles;
+
+  size_t pipe_count = GetParam();
+  for (size_t i = 0; i < pipe_count; ++i) {
+    base::FilePath unused;
+    base::ScopedFILE fp(
+        CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+    const std::string world("world");
+    CHECK_EQ(fwrite(&world[0], 1, world.size(), fp.get()), world.size());
+    fflush(fp.get());
+    rewind(fp.get());
+    MojoHandle handle;
+    ASSERT_EQ(CreatePlatformHandleWrapper(
+                  ScopedPlatformHandle(test::PlatformHandleFromFILE(fp.Pass())),
+                  &handle),
+              MOJO_RESULT_OK);
+    handles.push_back(handle);
+  }
+
+  char message[128];
+  sprintf(message, "hello %d", static_cast<int>(pipe_count));
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), message,
+                             strlen(message),
+                             &handles[0], handles.size(),
+                              MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Wait for it to become readable, which should fail.
+  HandleSignalsState hss;
+  ASSERT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfied_signals);
+  ASSERT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, hss.satisfiable_signals);
+
+  MojoClose(mp.release().value());
+
+  ASSERT_EQ(0, helper()->WaitForChildShutdown());
+}
+
+// Android multi-process tests are not executing the new process. This is flaky.
+#if !defined(OS_ANDROID)
+INSTANTIATE_TEST_CASE_P(PipeCount,
+                        MultiprocessMessagePipeTestWithPipeCount,
+                        testing::Values(1u, 128u, 140u));
+#endif
+
+MOJO_MULTIPROCESS_TEST_CHILD_MAIN(CheckMessagePipe) {
+  SimplePlatformSupport platform_support;
+  base::MessageLoop message_loop;
+  base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
+  test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
+
+  ScopedPlatformHandle client_platform_handle =
+      test::MultiprocessTestHelper::client_platform_handle.Pass();
+  CHECK(client_platform_handle.is_valid());
+
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(client_platform_handle.Pass());
+
+  // Wait for the first message from our parent.
+  HandleSignalsState hss;
+  CHECK_EQ(MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+               MOJO_DEADLINE_INDEFINITE, &hss),
+           MOJO_RESULT_OK);
+  // In this test, the parent definitely doesn't close its end of the message
+  // pipe before we do.
+  CHECK_EQ(hss.satisfied_signals,
+           MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE);
+  CHECK_EQ(hss.satisfiable_signals, MOJO_HANDLE_SIGNAL_READABLE |
+                                    MOJO_HANDLE_SIGNAL_WRITABLE |
+                                    MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+
+  // It should have a message pipe.
+  MojoHandle handles[10];
+  uint32_t num_handlers = MOJO_ARRAYSIZE(handles);
+  CHECK_EQ(MojoReadMessage(mp.get().value(), nullptr,
+                           nullptr, &handles[0],
+                           &num_handlers, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  CHECK_EQ(num_handlers, 1u);
+
+  // Read data from the received message pipe.
+  CHECK_EQ(MojoWait(handles[0], MOJO_HANDLE_SIGNAL_READABLE,
+               MOJO_DEADLINE_INDEFINITE, &hss),
+           MOJO_RESULT_OK);
+  CHECK_EQ(hss.satisfied_signals,
+           MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE);
+  CHECK_EQ(hss.satisfiable_signals, MOJO_HANDLE_SIGNAL_READABLE |
+                                    MOJO_HANDLE_SIGNAL_WRITABLE |
+                                    MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+
+  std::string read_buffer(100, '\0');
+  uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+  CHECK_EQ(MojoReadMessage(handles[0], &read_buffer[0],
+                           &read_buffer_size, nullptr,
+                           0, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  read_buffer.resize(read_buffer_size);
+  CHECK_EQ(read_buffer, std::string("hello"));
+
+  // Now write some data into the message pipe.
+  std::string write_buffer = "world";
+  CHECK_EQ(MojoWriteMessage(handles[0], write_buffer.data(),
+                            write_buffer.size(),
+                            nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE),
+            MOJO_RESULT_OK);
+  MojoClose(handles[0]);
+  return 0;
+}
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_MessagePipePassing DISABLED_MessagePipePassing
+#else
+#define MAYBE_MessagePipePassing MessagePipePassing
+#endif
+TEST_F(MultiprocessMessagePipeTest, MAYBE_MessagePipePassing) {
+  helper()->StartChild("CheckMessagePipe");
+
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(helper()->server_platform_handle.Pass());
+  MojoCreateSharedBufferOptions options;
+  options.struct_size = sizeof(options);
+  options.flags = MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE;
+
+  MojoHandle mp1, mp2;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &mp1, &mp2));
+
+  // Write a string into one end of the new message pipe and send the other end.
+  const std::string hello("hello");
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp1, &hello[0], hello.size(), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), nullptr, 0, &mp2, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Wait for a message from the child.
+  HandleSignalsState hss;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(mp1, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  EXPECT_TRUE((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE));
+  EXPECT_TRUE((hss.satisfiable_signals & MOJO_HANDLE_SIGNAL_READABLE));
+
+  std::string read_buffer(100, '\0');
+  uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+  CHECK_EQ(MojoReadMessage(mp1, &read_buffer[0],
+                           &read_buffer_size, nullptr,
+                           0, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  read_buffer.resize(read_buffer_size);
+  CHECK_EQ(read_buffer, std::string("world"));
+
+  MojoClose(mp1);
+  MojoClose(mp.release().value());
+
+  ASSERT_EQ(0, helper()->WaitForChildShutdown());
+}
+
+// Like above test, but verifies passing the other MP handle works as well.
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_MessagePipeTwoPassing DISABLED_MessagePipeTwoPassing
+#else
+#define MAYBE_MessagePipeTwoPassing MessagePipeTwoPassing
+#endif
+TEST_F(MultiprocessMessagePipeTest, MAYBE_MessagePipeTwoPassing) {
+  helper()->StartChild("CheckMessagePipe");
+
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(helper()->server_platform_handle.Pass());
+
+  MojoHandle mp1, mp2;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &mp2, &mp1));
+
+  // Write a string into one end of the new message pipe and send the other end.
+  const std::string hello("hello");
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp1, &hello[0], hello.size(), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), nullptr, 0, &mp2, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Wait for a message from the child.
+  HandleSignalsState hss;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(mp1, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  EXPECT_TRUE((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE));
+  EXPECT_TRUE((hss.satisfiable_signals & MOJO_HANDLE_SIGNAL_READABLE));
+
+  std::string read_buffer(100, '\0');
+  uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+  CHECK_EQ(MojoReadMessage(mp1, &read_buffer[0],
+                           &read_buffer_size, nullptr,
+                           0, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  read_buffer.resize(read_buffer_size);
+  CHECK_EQ(read_buffer, std::string("world"));
+
+  MojoClose(mp.release().value());
+
+  ASSERT_EQ(0, helper()->WaitForChildShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_MAIN(DataPipeConsumer) {
+  SimplePlatformSupport platform_support;
+  base::MessageLoop message_loop;
+  base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
+  test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
+
+  ScopedPlatformHandle client_platform_handle =
+      test::MultiprocessTestHelper::client_platform_handle.Pass();
+  CHECK(client_platform_handle.is_valid());
+
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(client_platform_handle.Pass());
+
+  // Wait for the first message from our parent.
+  HandleSignalsState hss;
+  CHECK_EQ(MojoWait(mp.get().value(), MOJO_HANDLE_SIGNAL_READABLE,
+               MOJO_DEADLINE_INDEFINITE, &hss),
+           MOJO_RESULT_OK);
+  // In this test, the parent definitely doesn't close its end of the message
+  // pipe before we do.
+  CHECK_EQ(hss.satisfied_signals,
+           MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE);
+  CHECK_EQ(hss.satisfiable_signals, MOJO_HANDLE_SIGNAL_READABLE |
+                                    MOJO_HANDLE_SIGNAL_WRITABLE |
+                                    MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+
+  // It should have a message pipe.
+  MojoHandle handles[10];
+  uint32_t num_handlers = MOJO_ARRAYSIZE(handles);
+  CHECK_EQ(MojoReadMessage(mp.get().value(), nullptr,
+                           nullptr, &handles[0],
+                           &num_handlers, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  CHECK_EQ(num_handlers, 1u);
+
+  // Read data from the received message pipe.
+  CHECK_EQ(MojoWait(handles[0], MOJO_HANDLE_SIGNAL_READABLE,
+               MOJO_DEADLINE_INDEFINITE, &hss),
+           MOJO_RESULT_OK);
+  CHECK_EQ(hss.satisfied_signals,
+           MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE);
+  CHECK_EQ(hss.satisfiable_signals, MOJO_HANDLE_SIGNAL_READABLE |
+                                    MOJO_HANDLE_SIGNAL_WRITABLE |
+                                    MOJO_HANDLE_SIGNAL_PEER_CLOSED);
+
+  std::string read_buffer(100, '\0');
+  uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+  CHECK_EQ(MojoReadMessage(handles[0], &read_buffer[0],
+                           &read_buffer_size, nullptr,
+                           0, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  read_buffer.resize(read_buffer_size);
+  CHECK_EQ(read_buffer, std::string("hello"));
+
+  // Now write some data into the message pipe.
+  std::string write_buffer = "world";
+  CHECK_EQ(MojoWriteMessage(handles[0], write_buffer.data(),
+                            write_buffer.size(),
+                            nullptr, 0, MOJO_WRITE_MESSAGE_FLAG_NONE),
+            MOJO_RESULT_OK);
+  MojoClose(handles[0]);
+  return 0;
+}
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_DataPipeConsumer DISABLED_DataPipeConsumer
+#else
+#define MAYBE_DataPipeConsumer DataPipeConsumer
+#endif
+TEST_F(MultiprocessMessagePipeTest, MAYBE_DataPipeConsumer) {
+  helper()->StartChild("DataPipeConsumer");
+
+  ScopedMessagePipeHandle mp =
+      CreateMessagePipe(helper()->server_platform_handle.Pass());
+  MojoCreateSharedBufferOptions options;
+  options.struct_size = sizeof(options);
+  options.flags = MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE;
+
+  MojoHandle mp1, mp2;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoCreateMessagePipe(nullptr, &mp2, &mp1));
+
+  // Write a string into one end of the new message pipe and send the other end.
+  const std::string hello("hello");
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp1, &hello[0], hello.size(), nullptr, 0,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWriteMessage(mp.get().value(), nullptr, 0, &mp2, 1,
+                             MOJO_WRITE_MESSAGE_FLAG_NONE));
+
+  // Wait for a message from the child.
+  HandleSignalsState hss;
+  ASSERT_EQ(MOJO_RESULT_OK,
+            MojoWait(mp1, MOJO_HANDLE_SIGNAL_READABLE,
+                     MOJO_DEADLINE_INDEFINITE, &hss));
+  EXPECT_TRUE((hss.satisfied_signals & MOJO_HANDLE_SIGNAL_READABLE));
+  EXPECT_TRUE((hss.satisfiable_signals & MOJO_HANDLE_SIGNAL_READABLE));
+
+  std::string read_buffer(100, '\0');
+  uint32_t read_buffer_size = static_cast<uint32_t>(read_buffer.size());
+  CHECK_EQ(MojoReadMessage(mp1, &read_buffer[0],
+                           &read_buffer_size, nullptr,
+                           0, MOJO_READ_MESSAGE_FLAG_NONE),
+           MOJO_RESULT_OK);
+  read_buffer.resize(read_buffer_size);
+  CHECK_EQ(read_buffer, std::string("world"));
+
+  MojoClose(mp1);
+  MojoClose(mp.release().value());
+
+  ASSERT_EQ(0, helper()->WaitForChildShutdown());
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/options_validation.h b/mojo/edk/system/options_validation.h
new file mode 100644
index 0000000..6925075a
--- /dev/null
+++ b/mojo/edk/system/options_validation.h
@@ -0,0 +1,97 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Functions to help with verifying various |Mojo...Options| structs from the
+// (public, C) API. These are "extensible" structs, which all have |struct_size|
+// as their first member. All fields (other than |struct_size|) are optional,
+// but any |flags| specified must be known to the system (otherwise, an error of
+// |MOJO_RESULT_UNIMPLEMENTED| should be returned).
+
+#ifndef MOJO_EDK_SYSTEM_OPTIONS_VALIDATION_H_
+#define MOJO_EDK_SYSTEM_OPTIONS_VALIDATION_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <algorithm>
+
+#include "base/logging.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+template <class Options>
+class UserOptionsReader {
+ public:
+  // Constructor from a |const* Options| (which it checks -- this constructor
+  // has side effects!).
+  // Note: We initialize |options_reader_| without checking, since we do a check
+  // in |GetSizeForReader()|.
+  explicit UserOptionsReader(const Options* options) {
+    CHECK(options && IsAligned<MOJO_ALIGNOF(Options)>(options));
+    options_ = GetSizeForReader(options) == 0 ? nullptr : options;
+    static_assert(offsetof(Options, struct_size) == 0,
+                  "struct_size not first member of Options");
+    // TODO(vtl): Enable when MSVC supports this (C++11 extended sizeof):
+    //   static_assert(sizeof(Options::struct_size) == sizeof(uint32_t),
+    //                 "Options::struct_size not a uint32_t");
+    // (Or maybe assert that its type is uint32_t?)
+  }
+
+  bool is_valid() const { return !!options_; }
+
+  const Options& options() const {
+    DCHECK(is_valid());
+    return *options_;
+  }
+
+  // Checks that the given (variable-size) |options| passed to the constructor
+  // (plausibly) has a member at the given offset with the given size. You
+  // probably want to use |OPTIONS_STRUCT_HAS_MEMBER()| instead.
+  bool HasMember(size_t offset, size_t size) const {
+    DCHECK(is_valid());
+    // We assume that |offset| and |size| are reasonable, since they should come
+    // from |offsetof(Options, some_member)| and |sizeof(Options::some_member)|,
+    // respectively.
+    return options().struct_size >= offset + size;
+  }
+
+ private:
+  static inline size_t GetSizeForReader(const Options* options) {
+    uint32_t struct_size = *reinterpret_cast<const uint32_t*>(options);
+    if (struct_size < sizeof(uint32_t))
+      return 0;
+
+    return std::min(static_cast<size_t>(struct_size), sizeof(Options));
+  }
+
+  template <size_t alignment>
+  static bool IsAligned(const void* pointer) {
+    return reinterpret_cast<uintptr_t>(pointer) % alignment == 0;
+  }
+
+  const Options* options_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(UserOptionsReader);
+};
+
+// Macro to invoke |UserOptionsReader<Options>::HasMember()| parametrized by
+// member name instead of offset and size.
+//
+// (We can't just give |HasMember()| a member pointer template argument instead,
+// since there's no good/strictly-correct way to get an offset from that.)
+//
+// TODO(vtl): With C++11, use |sizeof(Options::member)| instead of (the
+// contortion below). We might also be able to pull out the type |Options| from
+// |reader| (using |decltype|) instead of requiring a parameter.
+#define OPTIONS_STRUCT_HAS_MEMBER(Options, member, reader) \
+  reader.HasMember(offsetof(Options, member), sizeof(reader.options().member))
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_OPTIONS_VALIDATION_H_
diff --git a/mojo/edk/system/options_validation_unittest.cc b/mojo/edk/system/options_validation_unittest.cc
new file mode 100644
index 0000000..d2c81808
--- /dev/null
+++ b/mojo/edk/system/options_validation_unittest.cc
@@ -0,0 +1,130 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/options_validation.h"
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "mojo/public/c/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+// Declare a test options struct just as we do in actual public headers.
+
+using TestOptionsFlags = uint32_t;
+
+static_assert(MOJO_ALIGNOF(int64_t) == 8, "int64_t has weird alignment");
+struct MOJO_ALIGNAS(8) TestOptions {
+  uint32_t struct_size;
+  TestOptionsFlags flags;
+  uint32_t member1;
+  uint32_t member2;
+};
+static_assert(sizeof(TestOptions) == 16, "TestOptions has wrong size");
+
+const uint32_t kSizeOfTestOptions = static_cast<uint32_t>(sizeof(TestOptions));
+
+TEST(OptionsValidationTest, Valid) {
+  {
+    const TestOptions kOptions = {kSizeOfTestOptions};
+    UserOptionsReader<TestOptions> reader(&kOptions);
+    EXPECT_TRUE(reader.is_valid());
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, flags, reader));
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member1, reader));
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member2, reader));
+  }
+  {
+    const TestOptions kOptions = {static_cast<uint32_t>(
+        offsetof(TestOptions, struct_size) + sizeof(uint32_t))};
+    UserOptionsReader<TestOptions> reader(&kOptions);
+    EXPECT_TRUE(reader.is_valid());
+    EXPECT_FALSE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, flags, reader));
+    EXPECT_FALSE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member1, reader));
+    EXPECT_FALSE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member2, reader));
+  }
+
+  {
+    const TestOptions kOptions = {
+        static_cast<uint32_t>(offsetof(TestOptions, flags) + sizeof(uint32_t))};
+    UserOptionsReader<TestOptions> reader(&kOptions);
+    EXPECT_TRUE(reader.is_valid());
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, flags, reader));
+    EXPECT_FALSE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member1, reader));
+    EXPECT_FALSE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member2, reader));
+  }
+  {
+    MOJO_ALIGNAS(8) char buf[sizeof(TestOptions) + 100] = {};
+    TestOptions* options = reinterpret_cast<TestOptions*>(buf);
+    options->struct_size = kSizeOfTestOptions + 1;
+    UserOptionsReader<TestOptions> reader(options);
+    EXPECT_TRUE(reader.is_valid());
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, flags, reader));
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member1, reader));
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member2, reader));
+  }
+  {
+    MOJO_ALIGNAS(8) char buf[sizeof(TestOptions) + 100] = {};
+    TestOptions* options = reinterpret_cast<TestOptions*>(buf);
+    options->struct_size = kSizeOfTestOptions + 4;
+    UserOptionsReader<TestOptions> reader(options);
+    EXPECT_TRUE(reader.is_valid());
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, flags, reader));
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member1, reader));
+    EXPECT_TRUE(OPTIONS_STRUCT_HAS_MEMBER(TestOptions, member2, reader));
+  }
+}
+
+TEST(OptionsValidationTest, Invalid) {
+  // Size too small:
+  for (size_t i = 0; i < sizeof(uint32_t); i++) {
+    TestOptions options = {static_cast<uint32_t>(i)};
+    UserOptionsReader<TestOptions> reader(&options);
+    EXPECT_FALSE(reader.is_valid()) << i;
+  }
+}
+
+// These test invalid arguments that should cause death if we're being paranoid
+// about checking arguments (which we would want to do if, e.g., we were in a
+// true "kernel" situation, but we might not want to do otherwise for
+// performance reasons). Probably blatant errors like passing in null pointers
+// (for required pointer arguments) will still cause death, but perhaps not
+// predictably.
+TEST(OptionsValidationTest, InvalidDeath) {
+  const char kMemoryCheckFailedRegex[] = "Check failed";
+
+  // Null:
+  EXPECT_DEATH_IF_SUPPORTED(
+      { UserOptionsReader<TestOptions> reader((nullptr)); },
+      kMemoryCheckFailedRegex);
+
+  // Unaligned:
+  EXPECT_DEATH_IF_SUPPORTED(
+      {
+        UserOptionsReader<TestOptions> reader(
+            reinterpret_cast<const TestOptions*>(1));
+      },
+      kMemoryCheckFailedRegex);
+  // Note: The current implementation checks the size only after checking the
+  // alignment versus that required for the |uint32_t| size, so it won't die in
+  // the expected way if you pass, e.g., 4. So we have to manufacture a valid
+  // pointer at an offset of alignment 4.
+  EXPECT_DEATH_IF_SUPPORTED(
+      {
+        uint32_t buffer[100] = {};
+        TestOptions* options = (reinterpret_cast<uintptr_t>(buffer) % 8 == 0)
+                                   ? reinterpret_cast<TestOptions*>(&buffer[1])
+                                   : reinterpret_cast<TestOptions*>(&buffer[0]);
+        options->struct_size = static_cast<uint32_t>(sizeof(TestOptions));
+        UserOptionsReader<TestOptions> reader(options);
+      },
+      kMemoryCheckFailedRegex);
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/platform_handle_dispatcher.cc b/mojo/edk/system/platform_handle_dispatcher.cc
new file mode 100644
index 0000000..f788626
--- /dev/null
+++ b/mojo/edk/system/platform_handle_dispatcher.cc
@@ -0,0 +1,113 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/platform_handle_dispatcher.h"
+
+#include <algorithm>
+
+#include "base/logging.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+const size_t kInvalidPlatformHandleIndex = static_cast<size_t>(-1);
+
+struct MOJO_ALIGNAS(8) SerializedPlatformHandleDispatcher {
+  size_t platform_handle_index;  // (Or |kInvalidPlatformHandleIndex|.)
+};
+
+}  // namespace
+
+ScopedPlatformHandle PlatformHandleDispatcher::PassPlatformHandle() {
+  base::AutoLock locker(lock());
+  return platform_handle_.Pass();
+}
+
+Dispatcher::Type PlatformHandleDispatcher::GetType() const {
+  return Type::PLATFORM_HANDLE;
+}
+
+// static
+scoped_refptr<PlatformHandleDispatcher> PlatformHandleDispatcher::Deserialize(
+    const void* source,
+    size_t size,
+    PlatformHandleVector* platform_handles) {
+  if (size != sizeof(SerializedPlatformHandleDispatcher)) {
+    LOG(ERROR) << "Invalid serialized platform handle dispatcher (bad size)";
+    return nullptr;
+  }
+
+  const SerializedPlatformHandleDispatcher* serialization =
+      static_cast<const SerializedPlatformHandleDispatcher*>(source);
+  size_t platform_handle_index = serialization->platform_handle_index;
+
+  // Starts off invalid, which is what we want.
+  PlatformHandle platform_handle;
+
+  if (platform_handle_index != kInvalidPlatformHandleIndex) {
+    if (!platform_handles ||
+        platform_handle_index >= platform_handles->size()) {
+      LOG(ERROR)
+          << "Invalid serialized platform handle dispatcher (missing handles)";
+      return nullptr;
+    }
+
+    // We take ownership of the handle, so we have to invalidate the one in
+    // |platform_handles|.
+    std::swap(platform_handle, (*platform_handles)[platform_handle_index]);
+  }
+
+  return Create(ScopedPlatformHandle(platform_handle));
+}
+
+PlatformHandleDispatcher::PlatformHandleDispatcher(
+    ScopedPlatformHandle platform_handle)
+    : platform_handle_(platform_handle.Pass()) {
+}
+
+PlatformHandleDispatcher::~PlatformHandleDispatcher() {
+}
+
+void PlatformHandleDispatcher::CloseImplNoLock() {
+  lock().AssertAcquired();
+  platform_handle_.reset();
+}
+
+scoped_refptr<Dispatcher>
+PlatformHandleDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
+  lock().AssertAcquired();
+  return Create(platform_handle_.Pass());
+}
+
+void PlatformHandleDispatcher::StartSerializeImplNoLock(
+    size_t* max_size,
+    size_t* max_platform_handles) {
+  DCHECK(HasOneRef());  // Only one ref => no need to take the lock.
+  *max_size = sizeof(SerializedPlatformHandleDispatcher);
+  *max_platform_handles = 1;
+}
+
+bool PlatformHandleDispatcher::EndSerializeAndCloseImplNoLock(
+    void* destination,
+    size_t* actual_size,
+    PlatformHandleVector* platform_handles) {
+  DCHECK(HasOneRef());  // Only one ref => no need to take the lock.
+
+  SerializedPlatformHandleDispatcher* serialization =
+      static_cast<SerializedPlatformHandleDispatcher*>(destination);
+  if (platform_handle_.is_valid()) {
+    serialization->platform_handle_index = platform_handles->size();
+    platform_handles->push_back(platform_handle_.release());
+  } else {
+    serialization->platform_handle_index = kInvalidPlatformHandleIndex;
+  }
+
+  *actual_size = sizeof(SerializedPlatformHandleDispatcher);
+  return true;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/platform_handle_dispatcher.h b/mojo/edk/system/platform_handle_dispatcher.h
new file mode 100644
index 0000000..99ffcac
--- /dev/null
+++ b/mojo/edk/system/platform_handle_dispatcher.h
@@ -0,0 +1,63 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_
+#define MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_
+
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/simple_dispatcher.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// A dispatcher that simply wraps/transports a |PlatformHandle| (only for use by
+// the embedder).
+class MOJO_SYSTEM_IMPL_EXPORT PlatformHandleDispatcher final
+    : public SimpleDispatcher {
+ public:
+  static scoped_refptr<PlatformHandleDispatcher> Create(
+      ScopedPlatformHandle platform_handle) {
+    return make_scoped_refptr(
+        new PlatformHandleDispatcher(platform_handle.Pass()));
+  }
+
+  ScopedPlatformHandle PassPlatformHandle();
+
+  // |Dispatcher| public methods:
+  Type GetType() const override;
+
+  // The "opposite" of |SerializeAndClose()|. (Typically this is called by
+  // |Dispatcher::Deserialize()|.)
+  static scoped_refptr<PlatformHandleDispatcher> Deserialize(
+      const void* source,
+      size_t size,
+      PlatformHandleVector* platform_handles);
+
+ private:
+  explicit PlatformHandleDispatcher(
+      ScopedPlatformHandle platform_handle);
+  ~PlatformHandleDispatcher() override;
+
+  // |Dispatcher| protected methods:
+  void CloseImplNoLock() override;
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
+      override;
+  void StartSerializeImplNoLock(size_t* max_size,
+                                size_t* max_platform_handles) override;
+  bool EndSerializeAndCloseImplNoLock(
+      void* destination,
+      size_t* actual_size,
+      PlatformHandleVector* platform_handles) override;
+
+  ScopedPlatformHandle platform_handle_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformHandleDispatcher);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_PLATFORM_HANDLE_DISPATCHER_H_
diff --git a/mojo/edk/system/platform_handle_dispatcher_unittest.cc b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
new file mode 100644
index 0000000..77f4761
--- /dev/null
+++ b/mojo/edk/system/platform_handle_dispatcher_unittest.cc
@@ -0,0 +1,110 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/platform_handle_dispatcher.h"
+
+#include <stdio.h>
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_file.h"
+#include "base/files/scoped_temp_dir.h"
+#include "base/memory/ref_counted.h"
+#include "mojo/edk/test/test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+TEST(PlatformHandleDispatcherTest, Basic) {
+  base::ScopedTempDir temp_dir;
+  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+
+  static const char kHelloWorld[] = "hello world";
+
+  base::FilePath unused;
+  base::ScopedFILE fp(
+      CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+  ASSERT_TRUE(fp);
+  EXPECT_EQ(sizeof(kHelloWorld),
+            fwrite(kHelloWorld, 1, sizeof(kHelloWorld), fp.get()));
+
+  ScopedPlatformHandle h(test::PlatformHandleFromFILE(fp.Pass()));
+  EXPECT_FALSE(fp);
+  ASSERT_TRUE(h.is_valid());
+
+  scoped_refptr<PlatformHandleDispatcher> dispatcher =
+      PlatformHandleDispatcher::Create(h.Pass());
+  EXPECT_FALSE(h.is_valid());
+  EXPECT_EQ(Dispatcher::Type::PLATFORM_HANDLE, dispatcher->GetType());
+
+  h = dispatcher->PassPlatformHandle().Pass();
+  EXPECT_TRUE(h.is_valid());
+
+  fp = test::FILEFromPlatformHandle(h.Pass(), "rb").Pass();
+  EXPECT_FALSE(h.is_valid());
+  EXPECT_TRUE(fp);
+
+  rewind(fp.get());
+  char read_buffer[1000] = {};
+  EXPECT_EQ(sizeof(kHelloWorld),
+            fread(read_buffer, 1, sizeof(read_buffer), fp.get()));
+  EXPECT_STREQ(kHelloWorld, read_buffer);
+
+  // Try getting the handle again. (It should fail cleanly.)
+  h = dispatcher->PassPlatformHandle().Pass();
+  EXPECT_FALSE(h.is_valid());
+
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close());
+}
+
+TEST(PlatformHandleDispatcherTest, CreateEquivalentDispatcherAndClose) {
+  base::ScopedTempDir temp_dir;
+  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+
+  static const char kFooBar[] = "foo bar";
+
+  base::FilePath unused;
+  base::ScopedFILE fp(
+      CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+  EXPECT_EQ(sizeof(kFooBar), fwrite(kFooBar, 1, sizeof(kFooBar), fp.get()));
+
+  scoped_refptr<PlatformHandleDispatcher> dispatcher =
+      PlatformHandleDispatcher::Create(
+          test::PlatformHandleFromFILE(fp.Pass()));
+
+  DispatcherTransport transport(
+      test::DispatcherTryStartTransport(dispatcher.get()));
+  EXPECT_TRUE(transport.is_valid());
+  EXPECT_EQ(Dispatcher::Type::PLATFORM_HANDLE, transport.GetType());
+  EXPECT_FALSE(transport.IsBusy());
+
+  scoped_refptr<Dispatcher> generic_dispatcher =
+      transport.CreateEquivalentDispatcherAndClose();
+  ASSERT_TRUE(generic_dispatcher);
+
+  transport.End();
+  EXPECT_TRUE(dispatcher->HasOneRef());
+  dispatcher = nullptr;
+
+  ASSERT_EQ(Dispatcher::Type::PLATFORM_HANDLE, generic_dispatcher->GetType());
+  dispatcher = static_cast<PlatformHandleDispatcher*>(generic_dispatcher.get());
+
+  fp = test::FILEFromPlatformHandle(dispatcher->PassPlatformHandle(),
+                                          "rb").Pass();
+  EXPECT_TRUE(fp);
+
+  rewind(fp.get());
+  char read_buffer[1000] = {};
+  EXPECT_EQ(sizeof(kFooBar),
+            fread(read_buffer, 1, sizeof(read_buffer), fp.get()));
+  EXPECT_STREQ(kFooBar, read_buffer);
+
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close());
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/raw_channel.cc b/mojo/edk/system/raw_channel.cc
new file mode 100644
index 0000000..acada52
--- /dev/null
+++ b/mojo/edk/system/raw_channel.cc
@@ -0,0 +1,631 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/raw_channel.h"
+
+#include <string.h>
+
+#include <algorithm>
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/logging.h"
+#include "base/message_loop/message_loop.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/system/message_in_transit.h"
+#include "mojo/edk/system/transport_data.h"
+
+namespace mojo {
+namespace edk {
+
+const size_t kReadSize = 4096;
+
+// RawChannel::ReadBuffer ------------------------------------------------------
+
+RawChannel::ReadBuffer::ReadBuffer() : buffer_(kReadSize), num_valid_bytes_(0) {
+}
+
+RawChannel::ReadBuffer::~ReadBuffer() {
+}
+
+void RawChannel::ReadBuffer::GetBuffer(char** addr, size_t* size) {
+  DCHECK_GE(buffer_.size(), num_valid_bytes_ + kReadSize);
+  *addr = &buffer_[0] + num_valid_bytes_;
+  *size = kReadSize;
+}
+
+// RawChannel::WriteBuffer -----------------------------------------------------
+
+RawChannel::WriteBuffer::WriteBuffer()
+    : serialized_platform_handle_size_(0),
+      platform_handles_offset_(0),
+      data_offset_(0) {
+}
+
+RawChannel::WriteBuffer::~WriteBuffer() {
+  message_queue_.Clear();
+}
+
+bool RawChannel::WriteBuffer::HavePlatformHandlesToSend() const {
+  if (message_queue_.IsEmpty())
+    return false;
+
+  const TransportData* transport_data =
+      message_queue_.PeekMessage()->transport_data();
+  if (!transport_data)
+    return false;
+
+  const PlatformHandleVector* all_platform_handles =
+      transport_data->platform_handles();
+  if (!all_platform_handles) {
+    DCHECK_EQ(platform_handles_offset_, 0u);
+    return false;
+  }
+  if (platform_handles_offset_ >= all_platform_handles->size()) {
+    DCHECK_EQ(platform_handles_offset_, all_platform_handles->size());
+    return false;
+  }
+
+  return true;
+}
+
+void RawChannel::WriteBuffer::GetPlatformHandlesToSend(
+    size_t* num_platform_handles,
+    PlatformHandle** platform_handles,
+    void** serialization_data) {
+  DCHECK(HavePlatformHandlesToSend());
+
+  MessageInTransit* message = message_queue_.PeekMessage();
+  TransportData* transport_data = message->transport_data();
+  PlatformHandleVector* all_platform_handles =
+      transport_data->platform_handles();
+  *num_platform_handles =
+      all_platform_handles->size() - platform_handles_offset_;
+  *platform_handles = &(*all_platform_handles)[platform_handles_offset_];
+
+  if (serialized_platform_handle_size_ > 0) {
+    size_t serialization_data_offset =
+        transport_data->platform_handle_table_offset();
+    serialization_data_offset +=
+        platform_handles_offset_ * serialized_platform_handle_size_;
+    *serialization_data = static_cast<char*>(transport_data->buffer()) +
+                          serialization_data_offset;
+  } else {
+    *serialization_data = nullptr;
+  }
+}
+
+void RawChannel::WriteBuffer::GetBuffers(std::vector<Buffer>* buffers) const {
+  buffers->clear();
+
+  if (message_queue_.IsEmpty())
+    return;
+
+  const MessageInTransit* message = message_queue_.PeekMessage();
+  DCHECK_LT(data_offset_, message->total_size());
+  size_t bytes_to_write = message->total_size() - data_offset_;
+
+  size_t transport_data_buffer_size =
+      message->transport_data() ? message->transport_data()->buffer_size() : 0;
+
+  if (!transport_data_buffer_size) {
+    // Only write from the main buffer.
+    DCHECK_LT(data_offset_, message->main_buffer_size());
+    DCHECK_LE(bytes_to_write, message->main_buffer_size());
+    Buffer buffer = {
+        static_cast<const char*>(message->main_buffer()) + data_offset_,
+        bytes_to_write};
+
+    buffers->push_back(buffer);
+    return;
+  }
+
+  if (data_offset_ >= message->main_buffer_size()) {
+    // Only write from the transport data buffer.
+    DCHECK_LT(data_offset_ - message->main_buffer_size(),
+              transport_data_buffer_size);
+    DCHECK_LE(bytes_to_write, transport_data_buffer_size);
+    Buffer buffer = {
+        static_cast<const char*>(message->transport_data()->buffer()) +
+            (data_offset_ - message->main_buffer_size()),
+        bytes_to_write};
+
+    buffers->push_back(buffer);
+    return;
+  }
+
+  // TODO(vtl): We could actually send out buffers from multiple messages, with
+  // the "stopping" condition being reaching a message with platform handles
+  // attached.
+
+  // Write from both buffers.
+  DCHECK_EQ(bytes_to_write, message->main_buffer_size() - data_offset_ +
+                                transport_data_buffer_size);
+  Buffer buffer1 = {
+      static_cast<const char*>(message->main_buffer()) + data_offset_,
+      message->main_buffer_size() - data_offset_};
+  buffers->push_back(buffer1);
+  Buffer buffer2 = {
+      static_cast<const char*>(message->transport_data()->buffer()),
+      transport_data_buffer_size};
+  buffers->push_back(buffer2);
+}
+
+// RawChannel ------------------------------------------------------------------
+
+RawChannel::RawChannel()
+    : message_loop_for_io_(nullptr),
+      delegate_(nullptr),
+      write_ready_(false),
+      write_stopped_(false),
+      error_occurred_(false),
+      weak_ptr_factory_(this) {
+  read_buffer_.reset(new ReadBuffer);
+  write_buffer_.reset(new WriteBuffer());
+}
+
+RawChannel::~RawChannel() {
+  DCHECK(!read_buffer_);
+  DCHECK(!write_buffer_);
+
+  // Only want to decrement counter if Init was called.
+  if (message_loop_for_io_) {
+    // No need to take the |write_lock_| here -- if there are still weak
+    // pointers outstanding, then we're hosed anyway (since we wouldn't be able
+    // to invalidate them cleanly, since we might not be on the I/O thread).
+  //  DCHECK(!weak_ptr_factory_.HasWeakPtrs());
+    internal::ChannelShutdown();
+  }
+}
+
+void RawChannel::Init(Delegate* delegate) {
+  internal::ChannelStarted();
+  DCHECK(delegate);
+
+  base::AutoLock read_locker(read_lock_);
+  // solves race where initialiing on io thread while main thread is serializing
+  // this channel and releases handle.
+  base::AutoLock locker(write_lock_);
+
+  DCHECK(!delegate_);
+  delegate_ = delegate;
+
+  DCHECK(!message_loop_for_io_);
+  message_loop_for_io_ =
+      static_cast<base::MessageLoopForIO*>(base::MessageLoop::current());
+
+  OnInit();
+
+  if (read_buffer_->num_valid_bytes()) {
+    // We had serialized read buffer data through SetInitialReadBufferData call.
+    // Make sure we read messages out of it now, otherwise the delegate won't
+    // get notified if no other data gets written to the pipe.
+    // Although this means that we can call back synchronously into the caller,
+    // that's easier than posting a task to do this. That is because if we post
+    // a task, a pending read could have started and we wouldn't be able to move
+    // the read buffer since it can be in use by the OS in an async operation.
+    bool did_dispatch_message = false;
+    bool stop_dispatching = false;
+    DispatchMessages(&did_dispatch_message, &stop_dispatching);
+  }
+
+  IOResult io_result = ScheduleRead();
+  if (io_result != IO_PENDING) {
+    // This will notify the delegate about the read failure. Although we're on
+    // the I/O thread, don't call it in the nested context.
+    message_loop_for_io_->PostTask(
+        FROM_HERE, base::Bind(&RawChannel::OnReadCompleted,
+                              weak_ptr_factory_.GetWeakPtr(), io_result, 0));
+  }
+  // Note: |ScheduleRead()| failure is treated as a read failure (by notifying
+  // the delegate), not an initialization failure.
+
+  write_ready_ = true;
+  write_buffer_->serialized_platform_handle_size_ =
+      GetSerializedPlatformHandleSize();
+  if (!write_buffer_->message_queue_.IsEmpty())
+    SendQueuedMessagesNoLock();
+}
+
+void RawChannel::Shutdown() {
+  weak_ptr_factory_.InvalidateWeakPtrs();
+
+  // Normally, we want to flush any pending writes before shutting down. This
+  // doesn't apply when 1) we don't have a handle (for obvious reasons) or
+  // 2) when the other side already quit and asked us to close the handle to
+  // ensure that we read everything out of the pipe first.
+  if (!HandleForDebuggingNoLock().is_valid() || error_occurred_) {
+    {
+      base::AutoLock read_locker(read_lock_);
+      base::AutoLock locker(write_lock_);
+      OnShutdownNoLock(read_buffer_.Pass(), write_buffer_.Pass());
+    }
+    delete this;
+    return;
+  }
+
+  base::AutoLock read_locker(read_lock_);
+  base::AutoLock locker(write_lock_);
+  DCHECK(read_buffer_->num_valid_bytes() == 0) <<
+      "RawChannel::Shutdown called but there is pending data to be read";
+
+  // happens on shutdown if didn't call init when doing createduplicate
+  if (message_loop_for_io()) {
+    DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
+  }
+
+  // Reset the delegate so that it won't receive further calls.
+  delegate_ = nullptr;
+
+  bool empty = write_buffer_->message_queue_.IsEmpty();
+
+  // We may have no messages to write. However just because our end of the pipe
+  // wrote everything doesn't mean that the other end read it. We don't want to
+  // call FlushFileBuffers since a) that only works for server end of the pipe,
+  // and b) it pauses this thread (which can block a process on another, or
+  // worse hang if both pipes are in the same process).
+  scoped_ptr<MessageInTransit> quit_message(new MessageInTransit(
+      MessageInTransit::Type::RAW_CHANNEL_QUIT, 0, nullptr));
+  EnqueueMessageNoLock(quit_message.Pass());
+  write_stopped_ = true;
+
+  if (empty)
+    SendQueuedMessagesNoLock();
+}
+
+ScopedPlatformHandle RawChannel::ReleaseHandle(
+    std::vector<char>* read_buffer) {
+  ScopedPlatformHandle rv;
+  {
+    base::AutoLock read_locker(read_lock_);
+    base::AutoLock locker(write_lock_);
+    rv = ReleaseHandleNoLock(read_buffer);
+
+    // TODO(jam); if we use these, use nolock versions of these methods that are
+    // copied.
+    if (!write_buffer_->message_queue_.IsEmpty()) {
+      NOTREACHED() << "TODO(JAM)";
+    }
+
+    delegate_ = nullptr;
+
+    // The Unretained is safe because above cancelled IO so we shouldn't get any
+    // channel errors.
+    // |message_loop_for_io_| might not be set yet
+    internal::g_io_thread_task_runner->PostTask(
+        FROM_HERE,
+        base::Bind(&RawChannel::Shutdown, base::Unretained(this)));
+  }
+
+  return rv;
+}
+
+// Reminder: This must be thread-safe.
+bool RawChannel::WriteMessage(scoped_ptr<MessageInTransit> message) {
+  DCHECK(message);
+  base::AutoLock locker(write_lock_);
+  if (write_stopped_)
+    return false;
+
+  bool queue_was_empty = write_buffer_->message_queue_.IsEmpty();
+  EnqueueMessageNoLock(message.Pass());
+  if (queue_was_empty && write_ready_)
+    return SendQueuedMessagesNoLock();
+
+  return true;
+}
+
+bool RawChannel::SendQueuedMessagesNoLock() {
+  DCHECK_EQ(write_buffer_->data_offset_, 0u);
+
+  size_t platform_handles_written = 0;
+  size_t bytes_written = 0;
+  IOResult io_result = WriteNoLock(&platform_handles_written, &bytes_written);
+  if (io_result == IO_PENDING)
+    return true;
+
+  bool result = OnWriteCompletedNoLock(io_result, platform_handles_written,
+                                       bytes_written);
+  if (!result) {
+    // Even if we're on the I/O thread, don't call |OnError()| in the nested
+    // context.
+    message_loop_for_io_->PostTask(
+        FROM_HERE,
+        base::Bind(&RawChannel::LockAndCallOnError,
+                   weak_ptr_factory_.GetWeakPtr(),
+                   Delegate::ERROR_WRITE));
+  }
+
+  return result;
+}
+
+// Reminder: This must be thread-safe.
+bool RawChannel::IsWriteBufferEmpty() {
+  base::AutoLock locker(write_lock_);
+  return write_buffer_->message_queue_.IsEmpty();
+}
+
+bool RawChannel::IsReadBufferEmpty() {
+  base::AutoLock locker(read_lock_);
+  return read_buffer_->num_valid_bytes_ != 0;
+}
+
+void RawChannel::SetInitialReadBufferData(char* data, size_t size) {
+  base::AutoLock locker(read_lock_);
+  // TODO(jam): copy power of 2 algorithm below? or share.
+  read_buffer_->buffer_.resize(size+kReadSize);
+  memcpy(&read_buffer_->buffer_[0], data, size);
+  read_buffer_->num_valid_bytes_ = size;
+}
+
+void RawChannel::OnReadCompleted(IOResult io_result, size_t bytes_read) {
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
+
+  base::AutoLock locker(read_lock_);
+
+  // Keep reading data in a loop, and dispatch messages if enough data is
+  // received. Exit the loop if any of the following happens:
+  //   - one or more messages were dispatched;
+  //   - the last read failed, was a partial read or would block;
+  //   - |Shutdown()| was called.
+  do {
+    switch (io_result) {
+      case IO_SUCCEEDED:
+        break;
+      case IO_FAILED_SHUTDOWN:
+      case IO_FAILED_BROKEN:
+      case IO_FAILED_UNKNOWN:
+        CallOnError(ReadIOResultToError(io_result));
+        return;  // |this| may have been destroyed in |CallOnError()|.
+      case IO_PENDING:
+        NOTREACHED();
+        return;
+    }
+
+    read_buffer_->num_valid_bytes_ += bytes_read;
+
+    // Dispatch all the messages that we can.
+    bool did_dispatch_message = false;
+    bool stop_dispatching = false;
+    DispatchMessages(&did_dispatch_message, &stop_dispatching);
+    if (stop_dispatching)
+      return;
+
+    if (read_buffer_->buffer_.size() - read_buffer_->num_valid_bytes_ <
+        kReadSize) {
+      // Use power-of-2 buffer sizes.
+      // TODO(vtl): Make sure the buffer doesn't get too large (and enforce the
+      // maximum message size to whatever extent necessary).
+      // TODO(vtl): We may often be able to peek at the header and get the real
+      // required extra space (which may be much bigger than |kReadSize|).
+      size_t new_size = std::max(read_buffer_->buffer_.size(), kReadSize);
+      while (new_size < read_buffer_->num_valid_bytes_ + kReadSize)
+        new_size *= 2;
+
+      // TODO(vtl): It's suboptimal to zero out the fresh memory.
+      read_buffer_->buffer_.resize(new_size, 0);
+    }
+
+    // (1) If we dispatched any messages, stop reading for now (and let the
+    // message loop do its thing for another round).
+    // TODO(vtl): Is this the behavior we want? (Alternatives: i. Dispatch only
+    // a single message. Risks: slower, more complex if we want to avoid lots of
+    // copying. ii. Keep reading until there's no more data and dispatch all the
+    // messages we can. Risks: starvation of other users of the message loop.)
+    // (2) If we didn't max out |kReadSize|, stop reading for now.
+    bool schedule_for_later = did_dispatch_message || bytes_read < kReadSize;
+    bytes_read = 0;
+    io_result = schedule_for_later ? ScheduleRead() : Read(&bytes_read);
+  } while (io_result != IO_PENDING);
+}
+
+void RawChannel::OnWriteCompleted(IOResult io_result,
+                                  size_t platform_handles_written,
+                                  size_t bytes_written) {
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
+  DCHECK_NE(io_result, IO_PENDING);
+
+  bool did_fail = false;
+  {
+    base::AutoLock locker(write_lock_);
+    did_fail = !OnWriteCompletedNoLock(io_result, platform_handles_written,
+                                       bytes_written);
+  }
+
+  if (did_fail) {
+    LockAndCallOnError(Delegate::ERROR_WRITE);
+    return;  // |this| may have been destroyed in |CallOnError()|.
+  }
+}
+
+void RawChannel::EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message) {
+  write_lock_.AssertAcquired();
+  DCHECK(HandleForDebuggingNoLock().is_valid());
+  write_buffer_->message_queue_.AddMessage(message.Pass());
+}
+
+bool RawChannel::OnReadMessageForRawChannel(
+    const MessageInTransit::View& message_view) {
+  if (message_view.type() == MessageInTransit::Type::RAW_CHANNEL_QUIT) {
+    message_loop_for_io_->PostTask(
+        FROM_HERE, base::Bind(&RawChannel::LockAndCallOnError,
+                              weak_ptr_factory_.GetWeakPtr(),
+                              Delegate::ERROR_READ_SHUTDOWN));
+    return true;
+  }
+
+  // No non-implementation specific |RawChannel| control messages.
+  LOG(ERROR) << "Invalid control message (type " << message_view.type()
+             << ")";
+  return false;
+}
+
+RawChannel::Delegate::Error RawChannel::ReadIOResultToError(
+    IOResult io_result) {
+  switch (io_result) {
+    case IO_FAILED_SHUTDOWN:
+      return Delegate::ERROR_READ_SHUTDOWN;
+    case IO_FAILED_BROKEN:
+      return Delegate::ERROR_READ_BROKEN;
+    case IO_FAILED_UNKNOWN:
+      return Delegate::ERROR_READ_UNKNOWN;
+    case IO_SUCCEEDED:
+    case IO_PENDING:
+      NOTREACHED();
+      break;
+  }
+  return Delegate::ERROR_READ_UNKNOWN;
+}
+
+void RawChannel::CallOnError(Delegate::Error error) {
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io_);
+  read_lock_.AssertAcquired();
+  error_occurred_ = true;
+  if (delegate_) {
+    delegate_->OnError(error);
+  } else {
+    // We depend on delegate to delete since it could be waiting to call
+    // ReleaseHandle.
+    base::MessageLoop::current()->PostTask(
+        FROM_HERE,
+        base::Bind(&RawChannel::Shutdown, weak_ptr_factory_.GetWeakPtr()));
+  }
+}
+
+void RawChannel::LockAndCallOnError(Delegate::Error error) {
+  base::AutoLock locker(read_lock_);
+  CallOnError(error);
+}
+
+bool RawChannel::OnWriteCompletedNoLock(IOResult io_result,
+                                        size_t platform_handles_written,
+                                        size_t bytes_written) {
+  write_lock_.AssertAcquired();
+
+  DCHECK(!write_buffer_->message_queue_.IsEmpty());
+
+  if (io_result == IO_SUCCEEDED) {
+    write_buffer_->platform_handles_offset_ += platform_handles_written;
+    write_buffer_->data_offset_ += bytes_written;
+
+    MessageInTransit* message = write_buffer_->message_queue_.PeekMessage();
+    if (write_buffer_->data_offset_ >= message->total_size()) {
+      // Complete write.
+      CHECK_EQ(write_buffer_->data_offset_, message->total_size());
+      write_buffer_->message_queue_.DiscardMessage();
+      write_buffer_->platform_handles_offset_ = 0;
+      write_buffer_->data_offset_ = 0;
+
+      if (write_buffer_->message_queue_.IsEmpty())
+        return true;
+    }
+
+    // Schedule the next write.
+    io_result = ScheduleWriteNoLock();
+    if (io_result == IO_PENDING)
+      return true;
+    DCHECK_NE(io_result, IO_SUCCEEDED);
+  }
+
+  write_stopped_ = true;
+  write_buffer_->message_queue_.Clear();
+  write_buffer_->platform_handles_offset_ = 0;
+  write_buffer_->data_offset_ = 0;
+  return false;
+}
+
+void RawChannel::DispatchMessages(bool* did_dispatch_message,
+                                  bool* stop_dispatching) {
+  *did_dispatch_message = false;
+  *stop_dispatching = false;
+  // Tracks the offset of the first undispatched message in |read_buffer_|.
+  // Currently, we copy data to ensure that this is zero at the beginning.
+  size_t read_buffer_start = 0;
+  size_t remaining_bytes = read_buffer_->num_valid_bytes_;
+  size_t message_size;
+  // Note that we rely on short-circuit evaluation here:
+  //   - |read_buffer_start| may be an invalid index into
+  //     |read_buffer_->buffer_| if |remaining_bytes| is zero.
+  //   - |message_size| is only valid if |GetNextMessageSize()| returns true.
+  // TODO(vtl): Use |message_size| more intelligently (e.g., to request the
+  // next read).
+  // TODO(vtl): Validate that |message_size| is sane.
+  while (remaining_bytes > 0 && MessageInTransit::GetNextMessageSize(
+                                    &read_buffer_->buffer_[read_buffer_start],
+                                    remaining_bytes, &message_size) &&
+          remaining_bytes >= message_size) {
+    MessageInTransit::View message_view(
+        message_size, &read_buffer_->buffer_[read_buffer_start]);
+    DCHECK_EQ(message_view.total_size(), message_size);
+
+    const char* error_message = nullptr;
+    if (!message_view.IsValid(GetSerializedPlatformHandleSize(),
+                              &error_message)) {
+      DCHECK(error_message);
+      LOG(ERROR) << "Received invalid message: " << error_message;
+      CallOnError(Delegate::ERROR_READ_BAD_MESSAGE);
+      *stop_dispatching = true;
+      return;  // |this| may have been destroyed in |CallOnError()|.
+    }
+
+    if (message_view.type() != MessageInTransit::Type::MESSAGE) {
+      if (!OnReadMessageForRawChannel(message_view)) {
+        CallOnError(Delegate::ERROR_READ_BAD_MESSAGE);
+        *stop_dispatching = true;
+        return;  // |this| may have been destroyed in |CallOnError()|.
+      }
+    } else {
+      ScopedPlatformHandleVectorPtr platform_handles;
+      if (message_view.transport_data_buffer()) {
+        size_t num_platform_handles;
+        const void* platform_handle_table;
+        TransportData::GetPlatformHandleTable(
+            message_view.transport_data_buffer(), &num_platform_handles,
+            &platform_handle_table);
+
+        if (num_platform_handles > 0) {
+          platform_handles =
+              GetReadPlatformHandles(num_platform_handles,
+                                      platform_handle_table).Pass();
+          if (!platform_handles) {
+            LOG(ERROR) << "Invalid number of platform handles received";
+            CallOnError(Delegate::ERROR_READ_BAD_MESSAGE);
+            *stop_dispatching = true;
+            return;  // |this| may have been destroyed in |CallOnError()|.
+          }
+        }
+      }
+
+      // TODO(vtl): In the case that we aren't expecting any platform handles,
+      // for the POSIX implementation, we should confirm that none are stored.
+
+      // Dispatch the message.
+      // Note: it's valid to get here without a delegate. i.e. after Shutdown
+      // is called, if this object still has a valid handle we keep it alive
+      // until the other side closes it in response to the RAW_CHANNEL_QUIT
+      // message. In the meantime the sender could have sent us a message.
+      if (delegate_)
+        delegate_->OnReadMessage(message_view, platform_handles.Pass());
+    }
+
+    *did_dispatch_message = true;
+
+    // Update our state.
+    read_buffer_start += message_size;
+    remaining_bytes -= message_size;
+  }
+
+  if (read_buffer_start > 0) {
+    // Move data back to start.
+    read_buffer_->num_valid_bytes_ = remaining_bytes;
+    if (read_buffer_->num_valid_bytes_ > 0) {
+      memmove(&read_buffer_->buffer_[0],
+              &read_buffer_->buffer_[read_buffer_start], remaining_bytes);
+    }
+    read_buffer_start = 0;
+  }
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/raw_channel.h b/mojo/edk/system/raw_channel.h
new file mode 100644
index 0000000..ccc9f13
--- /dev/null
+++ b/mojo/edk/system/raw_channel.h
@@ -0,0 +1,409 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_RAW_CHANNEL_H_
+#define MOJO_EDK_SYSTEM_RAW_CHANNEL_H_
+
+#include <vector>
+
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/synchronization/lock.h"
+#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/message_in_transit.h"
+#include "mojo/edk/system/message_in_transit_queue.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace base {
+class MessageLoopForIO;
+}
+
+namespace mojo {
+namespace edk {
+
+// |RawChannel| is an interface and base class for objects that wrap an OS
+// "pipe". It presents the following interface to users:
+//  - Receives and dispatches messages on an I/O thread (running a
+//    |MessageLoopForIO|.
+//  - Provides a thread-safe way of writing messages (|WriteMessage()|);
+//    writing/queueing messages will not block and is atomic from the point of
+//    view of the caller. If necessary, messages are queued (to be written on
+//    the aforementioned thread).
+//
+// OS-specific implementation subclasses are to be instantiated using the
+// |Create()| static factory method.
+//
+// With the exception of |WriteMessage()|, this class is thread-unsafe (and in
+// general its methods should only be used on the I/O thread, i.e., the thread
+// on which |Init()| is called).
+class MOJO_SYSTEM_IMPL_EXPORT RawChannel {
+ public:
+
+  // The |Delegate| is only accessed on the same thread as the message loop
+  // (passed in on creation).
+  class MOJO_SYSTEM_IMPL_EXPORT Delegate {
+   public:
+    enum Error {
+      // Failed read due to raw channel shutdown (e.g., on the other side).
+      ERROR_READ_SHUTDOWN,
+      // Failed read due to raw channel being broken (e.g., if the other side
+      // died without shutting down).
+      ERROR_READ_BROKEN,
+      // Received a bad message.
+      ERROR_READ_BAD_MESSAGE,
+      // Unknown read error.
+      ERROR_READ_UNKNOWN,
+      // Generic write error.
+      ERROR_WRITE
+    };
+
+    // Called when a message is read. The delegate may not call back into this
+    // object synchronously.
+    virtual void OnReadMessage(
+        const MessageInTransit::View& message_view,
+        ScopedPlatformHandleVectorPtr platform_handles) = 0;
+
+    // Called when there's a (fatal) error. The delegate may not call back into
+    // this object synchronously.
+    //
+    // For each raw channel, there'll be at most one |ERROR_READ_...| and at
+    // most one |ERROR_WRITE| notification. After |OnError(ERROR_READ_...)|,
+    // |OnReadMessage()| won't be called again.
+    virtual void OnError(Error error) = 0;
+
+   protected:
+    virtual ~Delegate() {}
+  };
+
+  // Static factory method. |handle| should be a handle to a
+  // (platform-appropriate) bidirectional communication channel (e.g., a socket
+  // on POSIX, a named pipe on Windows).
+  static RawChannel* Create(ScopedPlatformHandle handle);
+
+  // Returns the amount of space needed in the |MessageInTransit|'s
+  // |TransportData|'s "platform handle table" per platform handle (to be
+  // attached to a message). (This amount may be zero.)
+  static size_t GetSerializedPlatformHandleSize();
+
+  // This must be called (on an I/O thread) before this object is used. Does
+  // *not* take ownership of |delegate|. Both the I/O thread and |delegate| must
+  // remain alive until |Shutdown()| is called (unless this fails); |delegate|
+  // will no longer be used after |Shutdown()|.
+  void Init(Delegate* delegate);
+
+  // This must be called (on the I/O thread) before this object is destroyed.
+  void Shutdown();
+
+  // Returns the platform handle for the pipe synchronously.
+  // |read_buffer| contains partially read data, if any.
+  // NOTE: After calling this, consider the channel shutdown and don't call into
+  // it anymore
+  ScopedPlatformHandle ReleaseHandle(std::vector<char>* read_buffer);
+
+  // Writes the given message (or schedules it to be written). |message| must
+  // have no |Dispatcher|s still attached (i.e.,
+  // |SerializeAndCloseDispatchers()| should have been called). This method is
+  // thread-safe and may be called from any thread. Returns true on success.
+  bool WriteMessage(scoped_ptr<MessageInTransit> message);
+
+  // Returns true if the write buffer is empty (i.e., all messages written using
+  // |WriteMessage()| have actually been sent.
+  // TODO(vtl): We should really also notify our delegate when the write buffer
+  // becomes empty (or something like that).
+  bool IsWriteBufferEmpty();
+
+  bool IsReadBufferEmpty();
+
+  void SetInitialReadBufferData(char* data, size_t size);
+
+  // Checks if this RawChannel is the other endpoint to |other|.
+  bool IsOtherEndOf(RawChannel* other);
+
+ protected:
+  // Result of I/O operations.
+  enum IOResult {
+    IO_SUCCEEDED,
+    // Failed due to a (probably) clean shutdown (e.g., of the other end).
+    IO_FAILED_SHUTDOWN,
+    // Failed due to the connection being broken (e.g., the other end dying).
+    IO_FAILED_BROKEN,
+    // Failed due to some other (unexpected) reason.
+    IO_FAILED_UNKNOWN,
+    IO_PENDING
+  };
+
+  class MOJO_SYSTEM_IMPL_EXPORT ReadBuffer {
+   public:
+    ReadBuffer();
+    ~ReadBuffer();
+
+    void GetBuffer(char** addr, size_t* size);
+
+    void Reset() {num_valid_bytes_ = 0; }
+
+    // temp for debugging
+    // TODO(jam): pass in a cleaner way to ReleaseHandle, just like shutdown
+    // case.
+    char* buffer() { return &buffer_[0]; }
+    size_t num_valid_bytes() {return num_valid_bytes_;}
+
+   private:
+    friend class RawChannel;
+
+    // We store data from |[Schedule]Read()|s in |buffer_|. The start of
+    // |buffer_| is always aligned with a message boundary (we will copy memory
+    // to ensure this), but |buffer_| may be larger than the actual number of
+    // bytes we have.
+    std::vector<char> buffer_;
+    size_t num_valid_bytes_;
+
+    MOJO_DISALLOW_COPY_AND_ASSIGN(ReadBuffer);
+  };
+
+  class MOJO_SYSTEM_IMPL_EXPORT WriteBuffer {
+   public:
+    struct Buffer {
+      const char* addr;
+      size_t size;
+    };
+
+    WriteBuffer();
+    ~WriteBuffer();
+
+    // Returns true if there are (more) platform handles to be sent (from the
+    // front of |message_queue_|).
+    bool HavePlatformHandlesToSend() const;
+    // Gets platform handles to be sent (from the front of |message_queue_|).
+    // This should only be called if |HavePlatformHandlesToSend()| returned
+    // true. There are two components to this: the actual |PlatformHandle|s
+    // (which should be closed once sent) and any additional serialization
+    // information (which will be embedded in the message's data; there are
+    // |GetSerializedPlatformHandleSize()| bytes per handle). Once all platform
+    // handles have been sent, the message data should be written next (see
+    // |GetBuffers()|).
+    // TODO(vtl): Maybe this method should be const, but
+    // |PlatformHandle::CloseIfNecessary()| isn't const (and actually modifies
+    // state).
+    void GetPlatformHandlesToSend(size_t* num_platform_handles,
+                                  PlatformHandle** platform_handles,
+                                  void** serialization_data);
+
+    // Gets buffers to be written. These buffers will always come from the front
+    // of |message_queue_|. Once they are completely written, the front
+    // |MessageInTransit| should be popped (and destroyed); this is done in
+    // |OnWriteCompletedNoLock()|.
+    void GetBuffers(std::vector<Buffer>* buffers) const;
+
+
+
+
+
+    // temp for testing
+    size_t queue_size() {return message_queue_.Size();}
+
+    // TODO(jam): better way of giving buffer on release handle
+    MessageInTransitQueue* message_queue() { return &message_queue_; }
+
+
+
+    // TODO JAM REMOVE AND ADD METHODS
+//   private:
+    friend class RawChannel;
+
+    size_t serialized_platform_handle_size_;
+
+    MessageInTransitQueue message_queue_;
+    // Platform handles are sent before the message data, but doing so may
+    // require several passes. |platform_handles_offset_| indicates the position
+    // in the first message's vector of platform handles to send next.
+    size_t platform_handles_offset_;
+    // The first message's data may have been partially sent. |data_offset_|
+    // indicates the position in the first message's data to start the next
+    // write.
+    size_t data_offset_;
+
+    MOJO_DISALLOW_COPY_AND_ASSIGN(WriteBuffer);
+  };
+
+  RawChannel();
+
+  // Shutdown must be called on the IO thread. This object deletes itself once
+  // it's flushed all pending writes and insured that the other side of the pipe
+  // read them.
+  virtual ~RawChannel();
+
+  // |result| must not be |IO_PENDING|. Must be called on the I/O thread WITHOUT
+  // |write_lock_| held. This object may be destroyed by this call.
+  void OnReadCompleted(IOResult io_result, size_t bytes_read);
+  // |result| must not be |IO_PENDING|. Must be called on the I/O thread WITHOUT
+  // |write_lock_| held. This object may be destroyed by this call.
+  void OnWriteCompleted(IOResult io_result,
+                        size_t platform_handles_written,
+                        size_t bytes_written);
+
+  base::MessageLoopForIO* message_loop_for_io() { return message_loop_for_io_; }
+  base::Lock& write_lock() { return write_lock_; }
+  base::Lock& read_lock() { return read_lock_; }
+
+  // Should only be called on the I/O thread.
+  ReadBuffer* read_buffer() { return read_buffer_.get(); }
+
+  // Only called under |write_lock_|.
+  WriteBuffer* write_buffer_no_lock() {
+    write_lock_.AssertAcquired();
+    return write_buffer_.get();
+  }
+
+  // Adds |message| to the write message queue. Implementation subclasses may
+  // override this to add any additional "control" messages needed. This is
+  // called (on any thread) with |write_lock_| held.
+  virtual void EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message);
+
+  // Handles any control messages targeted to the |RawChannel| (or
+  // implementation subclass). Implementation subclasses may override this to
+  // handle any implementation-specific control messages, but should call
+  // |RawChannel::OnReadMessageForRawChannel()| for any remaining messages.
+  // Returns true on success and false on error (e.g., invalid control message).
+  // This is only called on the I/O thread.
+  virtual bool OnReadMessageForRawChannel(
+      const MessageInTransit::View& message_view);
+
+  virtual PlatformHandle HandleForDebuggingNoLock() = 0;
+
+  // Implementation must write any pending messages synchronously.
+  // TODO(jam): change to return shared memory with pending serialized msgs.
+  virtual ScopedPlatformHandle ReleaseHandleNoLock(
+      std::vector<char>* read_buffer) = 0;
+
+  // Reads into |read_buffer()|.
+  // This class guarantees that:
+  // - the area indicated by |GetBuffer()| will stay valid until read completion
+  //   (but please also see the comments for |OnShutdownNoLock()|);
+  // - a second read is not started if there is a pending read;
+  // - the method is called on the I/O thread WITHOUT |write_lock_| held.
+  //
+  // The implementing subclass must guarantee that:
+  // - |bytes_read| is untouched unless |Read()| returns |IO_SUCCEEDED|;
+  // - if the method returns |IO_PENDING|, |OnReadCompleted()| will be called on
+  //   the I/O thread to report the result, unless |Shutdown()| is called.
+  virtual IOResult Read(size_t* bytes_read) = 0;
+  // Similar to |Read()|, except that the implementing subclass must also
+  // guarantee that the method doesn't succeed synchronously, i.e., it only
+  // returns |IO_FAILED_...| or |IO_PENDING|.
+  virtual IOResult ScheduleRead() = 0;
+
+  // Called by |OnReadCompleted()| to get the platform handles associated with
+  // the given platform handle table (from a message). This should only be
+  // called when |num_platform_handles| is nonzero. Returns null if the
+  // |num_platform_handles| handles are not available. Only called on the I/O
+  // thread (without |write_lock_| held).
+  virtual ScopedPlatformHandleVectorPtr GetReadPlatformHandles(
+      size_t num_platform_handles,
+      const void* platform_handle_table) = 0;
+
+  // Writes contents in |write_buffer_no_lock()|.
+  // This class guarantees that:
+  // - the |PlatformHandle|s given by |GetPlatformHandlesToSend()| and the
+  //   buffer(s) given by |GetBuffers()| will remain valid until write
+  //   completion (see also the comments for |OnShutdownNoLock()|);
+  // - a second write is not started if there is a pending write;
+  // - the method is called under |write_lock_|.
+  //
+  // The implementing subclass must guarantee that:
+  // - |platform_handles_written| and |bytes_written| are untouched unless
+  //   |WriteNoLock()| returns |IO_SUCCEEDED|;
+  // - if the method returns |IO_PENDING|, |OnWriteCompleted()| will be called
+  //   on the I/O thread to report the result, unless |Shutdown()| is called.
+  virtual IOResult WriteNoLock(size_t* platform_handles_written,
+                               size_t* bytes_written) = 0;
+  // Similar to |WriteNoLock()|, except that the implementing subclass must also
+  // guarantee that the method doesn't succeed synchronously, i.e., it only
+  // returns |IO_FAILED_...| or |IO_PENDING|.
+  virtual IOResult ScheduleWriteNoLock() = 0;
+
+  // Must be called on the I/O thread WITHOUT |write_lock_| held.
+  virtual void OnInit() = 0;
+  // On shutdown, passes the ownership of the buffers to subclasses, which may
+  // want to preserve them if there are pending read/writes. After this is
+  // called, |OnReadCompleted()| must no longer be called. Must be called on the
+  // I/O thread under |write_lock_|.
+  virtual void OnShutdownNoLock(scoped_ptr<ReadBuffer> read_buffer,
+                                scoped_ptr<WriteBuffer> write_buffer) = 0;
+
+  bool SendQueuedMessagesNoLock();
+
+ private:
+  friend class base::DeleteHelper<RawChannel>;
+
+  // Converts an |IO_FAILED_...| for a read to a |Delegate::Error|.
+  static Delegate::Error ReadIOResultToError(IOResult io_result);
+
+  // Calls |delegate_->OnError(error)|. Must be called on the I/O thread WITHOUT
+  // |write_lock_| held. This object may be destroyed by this call.
+  void CallOnError(Delegate::Error error);
+
+  void LockAndCallOnError(Delegate::Error error);
+
+  // If |io_result| is |IO_SUCCESS|, updates the write buffer and schedules a
+  // write operation to run later if there is more to write. If |io_result| is
+  // failure or any other error occurs, cancels pending writes and returns
+  // false. Must be called under |write_lock_| and only if |write_stopped_| is
+  // false.
+  bool OnWriteCompletedNoLock(IOResult io_result,
+                              size_t platform_handles_written,
+                              size_t bytes_written);
+
+  // Helper method to dispatch messages from the read buffer.
+  // |did_dispatch_message| is true iff it dispatched any messages.
+  // |stop_dispatching| is set to true if the code calling this should stop
+  // dispatching, either because we hit an erorr or the delegate shutdown the
+  // channel.
+  void DispatchMessages(bool* did_dispatch_message, bool* stop_dispatching);
+
+  // Set in |Init()| and never changed (hence usable on any thread without
+  // locking):
+  base::MessageLoopForIO* message_loop_for_io_;
+
+
+
+
+
+  // TODO(jam): one lock only... but profile first to ensure it doesn't slow
+  // things down compared to fine grained locks.
+
+
+
+
+  // Only used on the I/O thread:
+
+  base::Lock read_lock_;  // Protects read_buffer_.
+  // This is usually only accessed on IO thread, except when ReleaseHandle is
+  // called.
+  scoped_ptr<ReadBuffer> read_buffer_;
+  // ditto: usually used on io thread except ReleaseHandle
+  Delegate* delegate_;
+
+  // If grabbing both locks, grab read first.
+
+  base::Lock write_lock_;  // Protects the following members.
+  bool write_ready_;
+  bool write_stopped_;
+  scoped_ptr<WriteBuffer> write_buffer_;
+
+  bool error_occurred_;
+
+  // This is used for posting tasks from write threads to the I/O thread. It
+  // must only be accessed under |write_lock_|. The weak pointers it produces
+  // are only used/invalidated on the I/O thread.
+  base::WeakPtrFactory<RawChannel> weak_ptr_factory_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannel);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_RAW_CHANNEL_H_
diff --git a/mojo/edk/system/raw_channel_posix.cc b/mojo/edk/system/raw_channel_posix.cc
new file mode 100644
index 0000000..773684b
--- /dev/null
+++ b/mojo/edk/system/raw_channel_posix.cc
@@ -0,0 +1,521 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/raw_channel.h"
+
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/uio.h>
+#include <unistd.h>
+
+#include <algorithm>
+#include <deque>
+
+#include "base/bind.h"
+#include "base/location.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/synchronization/lock.h"
+#include "mojo/edk/embedder/platform_channel_utils_posix.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/system/transport_data.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+class RawChannelPosix final : public RawChannel,
+                              public base::MessageLoopForIO::Watcher {
+ public:
+  explicit RawChannelPosix(ScopedPlatformHandle handle);
+  ~RawChannelPosix() override;
+
+ private:
+  // |RawChannel| protected methods:
+  // Actually override this so that we can send multiple messages with (only)
+  // FDs if necessary.
+  void EnqueueMessageNoLock(scoped_ptr<MessageInTransit> message) override;
+  // Override this to handle those extra FD-only messages.
+  bool OnReadMessageForRawChannel(
+      const MessageInTransit::View& message_view) override;
+
+  ScopedPlatformHandle ReleaseHandleNoLock(
+      std::vector<char>* read_buffer_out) override;
+  PlatformHandle HandleForDebuggingNoLock() override;
+  IOResult Read(size_t* bytes_read) override;
+  IOResult ScheduleRead() override;
+  ScopedPlatformHandleVectorPtr GetReadPlatformHandles(
+      size_t num_platform_handles,
+      const void* platform_handle_table) override;
+  IOResult WriteNoLock(size_t* platform_handles_written,
+                       size_t* bytes_written) override;
+  IOResult ScheduleWriteNoLock() override;
+  void OnInit() override;
+  void OnShutdownNoLock(scoped_ptr<ReadBuffer> read_buffer,
+                        scoped_ptr<WriteBuffer> write_buffer) override;
+
+  // |base::MessageLoopForIO::Watcher| implementation:
+  void OnFileCanReadWithoutBlocking(int fd) override;
+  void OnFileCanWriteWithoutBlocking(int fd) override;
+
+  // Implements most of |Read()| (except for a bit of clean-up):
+  IOResult ReadImpl(size_t* bytes_read);
+
+  // Watches for |fd_| to become writable. Must be called on the I/O thread.
+  void WaitToWrite();
+
+  ScopedPlatformHandle fd_;
+
+  // The following members are only used on the I/O thread:
+  scoped_ptr<base::MessageLoopForIO::FileDescriptorWatcher> read_watcher_;
+  scoped_ptr<base::MessageLoopForIO::FileDescriptorWatcher> write_watcher_;
+
+  bool pending_read_;
+
+  std::deque<PlatformHandle> read_platform_handles_;
+
+  // The following members are used on multiple threads and protected by
+  // |write_lock()|:
+  bool pending_write_;
+
+  // This is used for posting tasks from write threads to the I/O thread. It
+  // must only be accessed under |write_lock_|. The weak pointers it produces
+  // are only used/invalidated on the I/O thread.
+  base::WeakPtrFactory<RawChannelPosix> weak_ptr_factory_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannelPosix);
+};
+
+RawChannelPosix::RawChannelPosix(ScopedPlatformHandle handle)
+    : fd_(handle.Pass()),
+      pending_read_(false),
+      pending_write_(false),
+      weak_ptr_factory_(this) {
+  DCHECK(fd_.is_valid());
+}
+
+RawChannelPosix::~RawChannelPosix() {
+  DCHECK(!pending_read_);
+  DCHECK(!pending_write_);
+
+  // No need to take the |write_lock()| here -- if there are still weak pointers
+  // outstanding, then we're hosed anyway (since we wouldn't be able to
+  // invalidate them cleanly, since we might not be on the I/O thread).
+  DCHECK(!weak_ptr_factory_.HasWeakPtrs());
+
+  // These must have been shut down/destroyed on the I/O thread.
+  DCHECK(!read_watcher_);
+  DCHECK(!write_watcher_);
+
+  CloseAllPlatformHandles(&read_platform_handles_);
+}
+
+void RawChannelPosix::EnqueueMessageNoLock(
+    scoped_ptr<MessageInTransit> message) {
+  if (message->transport_data()) {
+    PlatformHandleVector* const platform_handles =
+        message->transport_data()->platform_handles();
+    if (platform_handles &&
+        platform_handles->size() > kPlatformChannelMaxNumHandles) {
+      // We can't attach all the FDs to a single message, so we have to "split"
+      // the message. Send as many control messages as needed first with FDs
+      // attached (and no data).
+      size_t i = 0;
+      for (; platform_handles->size() - i > kPlatformChannelMaxNumHandles;
+           i += kPlatformChannelMaxNumHandles) {
+        scoped_ptr<MessageInTransit> fd_message(new MessageInTransit(
+            MessageInTransit::Type::RAW_CHANNEL_POSIX_EXTRA_PLATFORM_HANDLES, 0,
+            nullptr));
+        ScopedPlatformHandleVectorPtr fds(
+            new PlatformHandleVector(
+                platform_handles->begin() + i,
+                platform_handles->begin() + i + kPlatformChannelMaxNumHandles));
+        fd_message->SetTransportData(make_scoped_ptr(
+            new TransportData(fds.Pass(), GetSerializedPlatformHandleSize())));
+        RawChannel::EnqueueMessageNoLock(fd_message.Pass());
+      }
+
+      // Remove the handles that we "moved" into the other messages.
+      platform_handles->erase(platform_handles->begin(),
+                              platform_handles->begin() + i);
+    }
+  }
+
+  RawChannel::EnqueueMessageNoLock(message.Pass());
+}
+
+bool RawChannelPosix::OnReadMessageForRawChannel(
+    const MessageInTransit::View& message_view) {
+  if (message_view.type() ==
+      MessageInTransit::Type::RAW_CHANNEL_POSIX_EXTRA_PLATFORM_HANDLES) {
+    // We don't need to do anything. |RawChannel| won't extract the platform
+    // handles, and they'll be accumulated in |Read()|.
+    return true;
+  }
+
+  return RawChannel::OnReadMessageForRawChannel(message_view);
+}
+
+
+ScopedPlatformHandle RawChannelPosix::ReleaseHandleNoLock(
+    std::vector<char>* read_buffer_out) {
+  std::vector<WriteBuffer::Buffer> buffers;
+  write_buffer_no_lock()->GetBuffers(&buffers);
+  if (!buffers.empty()) {
+    // TODO(jam): copy code in OnShutdownNoLock
+    NOTREACHED() << "releasing handle with pending write buffer";
+  }
+
+  NOTREACHED() << "TODO(jam) IMPLEMENT";/*
+  if (handle_.is_valid()) {
+    // SetInitialBuffer could have been called on main thread before OnInit
+    // is called on Io thread. and in meantime releasehandle called.
+    //DCHECK(read_buffer()->num_valid_bytes() == 0);
+    if (read_buffer()->num_valid_bytes()) {
+      read_buffer_out->resize(read_buffer()->num_valid_bytes());
+      memcpy(&(*read_buffer_out)[0], read_buffer()->buffer(),
+             read_buffer()->num_valid_bytes());
+      read_buffer()->Reset();
+    }
+    DCHECK(write_buffer_no_lock()->queue_size() == 0);
+    return ScopedPlatformHandle(PlatformHandle(handle_.release().handle));
+  }
+
+  return io_handler_->ReleaseHandle(read_buffer_out);
+  */
+  return fd_.Pass();
+}
+
+PlatformHandle RawChannelPosix::HandleForDebuggingNoLock() {
+  return fd_.get();
+}
+
+RawChannel::IOResult RawChannelPosix::Read(size_t* bytes_read) {
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+  DCHECK(!pending_read_);
+
+  IOResult rv = ReadImpl(bytes_read);
+  if (rv != IO_SUCCEEDED && rv != IO_PENDING) {
+    // Make sure that |OnFileCanReadWithoutBlocking()| won't be called again.
+    read_watcher_.reset();
+  }
+  return rv;
+}
+
+RawChannel::IOResult RawChannelPosix::ScheduleRead() {
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+  DCHECK(!pending_read_);
+
+  pending_read_ = true;
+
+  return IO_PENDING;
+}
+
+ScopedPlatformHandleVectorPtr RawChannelPosix::GetReadPlatformHandles(
+    size_t num_platform_handles,
+    const void* /*platform_handle_table*/) {
+  DCHECK_GT(num_platform_handles, 0u);
+
+  if (read_platform_handles_.size() < num_platform_handles) {
+    CloseAllPlatformHandles(&read_platform_handles_);
+    read_platform_handles_.clear();
+    return ScopedPlatformHandleVectorPtr();
+  }
+
+  ScopedPlatformHandleVectorPtr rv(
+      new PlatformHandleVector(num_platform_handles));
+  rv->assign(read_platform_handles_.begin(),
+             read_platform_handles_.begin() + num_platform_handles);
+  read_platform_handles_.erase(
+      read_platform_handles_.begin(),
+      read_platform_handles_.begin() + num_platform_handles);
+  return rv.Pass();
+}
+
+RawChannel::IOResult RawChannelPosix::WriteNoLock(
+    size_t* platform_handles_written,
+    size_t* bytes_written) {
+  write_lock().AssertAcquired();
+
+  DCHECK(!pending_write_);
+
+  size_t num_platform_handles = 0;
+  ssize_t write_result;
+  if (write_buffer_no_lock()->HavePlatformHandlesToSend()) {
+    PlatformHandle* platform_handles;
+    void* serialization_data;  // Actually unused.
+    write_buffer_no_lock()->GetPlatformHandlesToSend(
+        &num_platform_handles, &platform_handles, &serialization_data);
+    DCHECK_GT(num_platform_handles, 0u);
+    DCHECK_LE(num_platform_handles, kPlatformChannelMaxNumHandles);
+    DCHECK(platform_handles);
+
+    // TODO(vtl): Reduce code duplication. (This is duplicated from below.)
+    std::vector<WriteBuffer::Buffer> buffers;
+    write_buffer_no_lock()->GetBuffers(&buffers);
+    DCHECK(!buffers.empty());
+    const size_t kMaxBufferCount = 10;
+    iovec iov[kMaxBufferCount];
+    size_t buffer_count = std::min(buffers.size(), kMaxBufferCount);
+    for (size_t i = 0; i < buffer_count; ++i) {
+      iov[i].iov_base = const_cast<char*>(buffers[i].addr);
+      iov[i].iov_len = buffers[i].size;
+    }
+
+    write_result = PlatformChannelSendmsgWithHandles(
+        fd_.get(), iov, buffer_count, platform_handles, num_platform_handles);
+    if (write_result >= 0) {
+      for (size_t i = 0; i < num_platform_handles; i++)
+        platform_handles[i].CloseIfNecessary();
+    }
+  } else {
+    std::vector<WriteBuffer::Buffer> buffers;
+    write_buffer_no_lock()->GetBuffers(&buffers);
+    DCHECK(!buffers.empty());
+
+    if (buffers.size() == 1) {
+      write_result = PlatformChannelWrite(fd_.get(), buffers[0].addr,
+                                          buffers[0].size);
+    } else {
+      const size_t kMaxBufferCount = 10;
+      iovec iov[kMaxBufferCount];
+      size_t buffer_count = std::min(buffers.size(), kMaxBufferCount);
+      for (size_t i = 0; i < buffer_count; ++i) {
+        iov[i].iov_base = const_cast<char*>(buffers[i].addr);
+        iov[i].iov_len = buffers[i].size;
+      }
+
+      write_result = PlatformChannelWritev(fd_.get(), iov, buffer_count);
+    }
+  }
+
+  if (write_result >= 0) {
+    *platform_handles_written = num_platform_handles;
+    *bytes_written = static_cast<size_t>(write_result);
+    return IO_SUCCEEDED;
+  }
+
+  if (errno == EPIPE)
+    return IO_FAILED_SHUTDOWN;
+
+  if (errno != EAGAIN && errno != EWOULDBLOCK) {
+    PLOG(WARNING) << "sendmsg/write/writev";
+    return IO_FAILED_UNKNOWN;
+  }
+
+  return ScheduleWriteNoLock();
+}
+
+RawChannel::IOResult RawChannelPosix::ScheduleWriteNoLock() {
+  write_lock().AssertAcquired();
+
+  DCHECK(!pending_write_);
+
+  // Set up to wait for the FD to become writable.
+  // If we're not on the I/O thread, we have to post a task to do this.
+  if (base::MessageLoop::current() != message_loop_for_io()) {
+    message_loop_for_io()->PostTask(FROM_HERE,
+                                    base::Bind(&RawChannelPosix::WaitToWrite,
+                                               weak_ptr_factory_.GetWeakPtr()));
+    pending_write_ = true;
+    return IO_PENDING;
+  }
+
+  if (message_loop_for_io()->WatchFileDescriptor(
+          fd_.get().fd, false, base::MessageLoopForIO::WATCH_WRITE,
+          write_watcher_.get(), this)) {
+    pending_write_ = true;
+    return IO_PENDING;
+  }
+
+  return IO_FAILED_UNKNOWN;
+}
+
+void RawChannelPosix::OnInit() {
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+
+  DCHECK(!read_watcher_);
+  read_watcher_.reset(new base::MessageLoopForIO::FileDescriptorWatcher());
+  DCHECK(!write_watcher_);
+  write_watcher_.reset(new base::MessageLoopForIO::FileDescriptorWatcher());
+
+  // I don't know how this can fail (unless |fd_| is bad, in which case it's a
+  // bug in our code). I also don't know if |WatchFileDescriptor()| actually
+  // fails cleanly.
+  CHECK(message_loop_for_io()->WatchFileDescriptor(
+      fd_.get().fd, true, base::MessageLoopForIO::WATCH_READ,
+      read_watcher_.get(), this));
+}
+
+void RawChannelPosix::OnShutdownNoLock(
+    scoped_ptr<ReadBuffer> /*read_buffer*/,
+    scoped_ptr<WriteBuffer> /*write_buffer*/) {
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+  write_lock().AssertAcquired();
+
+  read_watcher_.reset();   // This will stop watching (if necessary).
+  write_watcher_.reset();  // This will stop watching (if necessary).
+
+  pending_read_ = false;
+  pending_write_ = false;
+
+  DCHECK(fd_.is_valid());
+  fd_.reset();
+
+  weak_ptr_factory_.InvalidateWeakPtrs();
+}
+
+void RawChannelPosix::OnFileCanReadWithoutBlocking(int fd) {
+  DCHECK_EQ(fd, fd_.get().fd);
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+
+  if (!pending_read_) {
+    NOTREACHED();
+    return;
+  }
+
+  pending_read_ = false;
+  size_t bytes_read = 0;
+  IOResult io_result = Read(&bytes_read);
+  if (io_result != IO_PENDING) {
+    OnReadCompleted(io_result, bytes_read);
+    // TODO(vtl): If we weren't destroyed, we'd like to do
+    //
+    //   DCHECK(!read_watcher_ || pending_read_);
+    //
+    // On failure, |read_watcher_| must have been reset; on success, we assume
+    // that |OnReadCompleted()| always schedules another read. Otherwise, we
+    // could end up spinning -- getting |OnFileCanReadWithoutBlocking()| again
+    // and again but not doing any actual read.
+    // TODO(yzshen): An alternative is to stop watching if RawChannel doesn't
+    // schedule a new read. But that code won't be reached under the current
+    // RawChannel implementation.
+    return;  // |this| may have been destroyed in |OnReadCompleted()|.
+  }
+
+  DCHECK(pending_read_);
+}
+
+void RawChannelPosix::OnFileCanWriteWithoutBlocking(int fd) {
+  DCHECK_EQ(fd, fd_.get().fd);
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+
+  IOResult io_result;
+  size_t platform_handles_written = 0;
+  size_t bytes_written = 0;
+  {
+    base::AutoLock locker(write_lock());
+
+    DCHECK(pending_write_);
+
+    pending_write_ = false;
+    io_result = WriteNoLock(&platform_handles_written, &bytes_written);
+  }
+
+  if (io_result != IO_PENDING) {
+    OnWriteCompleted(io_result, platform_handles_written, bytes_written);
+    return;  // |this| may have been destroyed in |OnWriteCompleted()|.
+  }
+}
+
+RawChannel::IOResult RawChannelPosix::ReadImpl(size_t* bytes_read) {
+  char* buffer = nullptr;
+  size_t bytes_to_read = 0;
+  read_buffer()->GetBuffer(&buffer, &bytes_to_read);
+
+  size_t old_num_platform_handles = read_platform_handles_.size();
+  ssize_t read_result = PlatformChannelRecvmsg(
+      fd_.get(), buffer, bytes_to_read, &read_platform_handles_);
+  if (read_platform_handles_.size() > old_num_platform_handles) {
+    DCHECK_LE(read_platform_handles_.size() - old_num_platform_handles,
+              kPlatformChannelMaxNumHandles);
+
+    // We should never accumulate more than |TransportData::kMaxPlatformHandles
+    // + kPlatformChannelMaxNumHandles| handles. (The latter part is
+    // possible because we could have accumulated all the handles for a message,
+    // then received the message data plus the first set of handles for the next
+    // message in the subsequent |recvmsg()|.)
+    if (read_platform_handles_.size() >
+        (TransportData::GetMaxPlatformHandles() +
+         kPlatformChannelMaxNumHandles)) {
+      LOG(ERROR) << "Received too many platform handles";
+      CloseAllPlatformHandles(&read_platform_handles_);
+      read_platform_handles_.clear();
+      return IO_FAILED_UNKNOWN;
+    }
+  }
+
+  if (read_result > 0) {
+    *bytes_read = static_cast<size_t>(read_result);
+    return IO_SUCCEEDED;
+  }
+
+  // |read_result == 0| means "end of file".
+  if (read_result == 0)
+    return IO_FAILED_SHUTDOWN;
+
+  if (errno == EAGAIN || errno == EWOULDBLOCK)
+    return ScheduleRead();
+
+  if (errno == ECONNRESET)
+    return IO_FAILED_BROKEN;
+
+  PLOG(WARNING) << "recvmsg";
+  return IO_FAILED_UNKNOWN;
+}
+
+void RawChannelPosix::WaitToWrite() {
+  DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+
+  DCHECK(write_watcher_);
+
+  if (!message_loop_for_io()->WatchFileDescriptor(
+          fd_.get().fd, false, base::MessageLoopForIO::WATCH_WRITE,
+          write_watcher_.get(), this)) {
+    {
+      base::AutoLock locker(write_lock());
+
+      DCHECK(pending_write_);
+      pending_write_ = false;
+    }
+    OnWriteCompleted(IO_FAILED_UNKNOWN, 0, 0);
+    return;  // |this| may have been destroyed in |OnWriteCompleted()|.
+  }
+}
+
+}  // namespace
+
+// -----------------------------------------------------------------------------
+
+// Static factory method declared in raw_channel.h.
+// static
+RawChannel* RawChannel::Create(ScopedPlatformHandle handle) {
+  return new RawChannelPosix(handle.Pass());
+}
+
+size_t RawChannel::GetSerializedPlatformHandleSize() {
+  // We don't actually need any space on POSIX (since we just send FDs).
+  return 0;
+}
+
+bool RawChannel::IsOtherEndOf(RawChannel* other) {
+  DCHECK_NE(other, this);
+  PlatformHandle this_handle = HandleForDebuggingNoLock();
+  PlatformHandle other_handle = other->HandleForDebuggingNoLock();
+
+  struct stat stat1, stat2;
+  if (fstat(this_handle.fd, &stat1) < 0)
+    return false;
+  if (fstat(other_handle.fd, &stat2) < 0)
+    return false;
+  return (stat1.st_dev == stat2.st_dev) && (stat1.st_ino == stat2.st_ino);
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/raw_channel_unittest.cc b/mojo/edk/system/raw_channel_unittest.cc
new file mode 100644
index 0000000..af75543
--- /dev/null
+++ b/mojo/edk/system/raw_channel_unittest.cc
@@ -0,0 +1,661 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/raw_channel.h"
+
+#include <stdint.h>
+#include <stdio.h>
+
+#include <vector>
+
+#include "base/bind.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/files/scoped_file.h"
+#include "base/files/scoped_temp_dir.h"
+#include "base/location.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/memory/scoped_vector.h"
+#include "base/rand_util.h"
+#include "base/synchronization/lock.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/test/test_io_thread.h"
+#include "base/threading/simple_thread.h"
+#include "build/build_config.h"  // TODO(vtl): Remove this.
+#include "mojo/edk/embedder/platform_channel_pair.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/system/message_in_transit.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/system/transport_data.h"
+#include "mojo/edk/test/test_utils.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+scoped_ptr<MessageInTransit> MakeTestMessage(uint32_t num_bytes) {
+  std::vector<unsigned char> bytes(num_bytes, 0);
+  for (size_t i = 0; i < num_bytes; i++)
+    bytes[i] = static_cast<unsigned char>(i + num_bytes);
+  return make_scoped_ptr(
+      new MessageInTransit(MessageInTransit::Type::MESSAGE,
+                           num_bytes, bytes.empty() ? nullptr : &bytes[0]));
+}
+
+bool CheckMessageData(const void* bytes, uint32_t num_bytes) {
+  const unsigned char* b = static_cast<const unsigned char*>(bytes);
+  for (uint32_t i = 0; i < num_bytes; i++) {
+    if (b[i] != static_cast<unsigned char>(i + num_bytes))
+      return false;
+  }
+  return true;
+}
+
+void InitOnIOThread(RawChannel* raw_channel, RawChannel::Delegate* delegate) {
+  raw_channel->Init(delegate);
+}
+
+bool WriteTestMessageToHandle(const PlatformHandle& handle,
+                              uint32_t num_bytes) {
+  scoped_ptr<MessageInTransit> message(MakeTestMessage(num_bytes));
+
+  size_t write_size = 0;
+  test::BlockingWrite(handle, message->main_buffer(),
+                      message->main_buffer_size(), &write_size);
+  return write_size == message->main_buffer_size();
+}
+
+// -----------------------------------------------------------------------------
+
+class RawChannelTest : public test::MojoSystemTest {
+ public:
+  RawChannelTest() {}
+  ~RawChannelTest() override {}
+
+  void SetUp() override {
+    PlatformChannelPair channel_pair;
+    handles[0] = channel_pair.PassServerHandle();
+    handles[1] = channel_pair.PassClientHandle();\
+  }
+
+  void TearDown() override {
+    handles[0].reset();
+    handles[1].reset();
+  }
+
+ protected:
+  ScopedPlatformHandle handles[2];
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannelTest);
+};
+
+// RawChannelTest.WriteMessage -------------------------------------------------
+
+class WriteOnlyRawChannelDelegate : public RawChannel::Delegate {
+ public:
+  WriteOnlyRawChannelDelegate() {}
+  ~WriteOnlyRawChannelDelegate() override {}
+
+  // |RawChannel::Delegate| implementation:
+  void OnReadMessage(
+      const MessageInTransit::View& /*message_view*/,
+      ScopedPlatformHandleVectorPtr /*platform_handles*/) override {
+    CHECK(false);  // Should not get called.
+  }
+  void OnError(Error error) override {
+    // We'll get a read (shutdown) error when the connection is closed.
+    CHECK_EQ(error, ERROR_READ_SHUTDOWN);
+  }
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(WriteOnlyRawChannelDelegate);
+};
+
+static const unsigned kMessageReaderSleepMs = 1;
+static const size_t kMessageReaderMaxPollIterations = 3000;
+
+class TestMessageReaderAndChecker {
+ public:
+  explicit TestMessageReaderAndChecker(PlatformHandle handle)
+      : handle_(handle) {}
+  ~TestMessageReaderAndChecker() { CHECK(bytes_.empty()); }
+
+  bool ReadAndCheckNextMessage(uint32_t expected_size) {
+    unsigned char buffer[4096];
+
+    for (size_t i = 0; i < kMessageReaderMaxPollIterations;) {
+      size_t read_size = 0;
+      CHECK(test::NonBlockingRead(handle_, buffer, sizeof(buffer), &read_size));
+
+      // Append newly-read data to |bytes_|.
+      bytes_.insert(bytes_.end(), buffer, buffer + read_size);
+
+      // If we have the header....
+      size_t message_size;
+      if (MessageInTransit::GetNextMessageSize(
+              bytes_.empty() ? nullptr : &bytes_[0], bytes_.size(),
+              &message_size)) {
+        // If we've read the whole message....
+        if (bytes_.size() >= message_size) {
+          bool rv = true;
+          MessageInTransit::View message_view(message_size, &bytes_[0]);
+          CHECK_EQ(message_view.main_buffer_size(), message_size);
+
+          if (message_view.num_bytes() != expected_size) {
+            LOG(ERROR) << "Wrong size: " << message_size << " instead of "
+                       << expected_size << " bytes.";
+            rv = false;
+          } else if (!CheckMessageData(message_view.bytes(),
+                                       message_view.num_bytes())) {
+            LOG(ERROR) << "Incorrect message bytes.";
+            rv = false;
+          }
+
+          // Erase message data.
+          bytes_.erase(bytes_.begin(),
+                       bytes_.begin() + message_view.main_buffer_size());
+          return rv;
+        }
+      }
+
+      if (static_cast<size_t>(read_size) < sizeof(buffer)) {
+        i++;
+        test::Sleep(test::DeadlineFromMilliseconds(kMessageReaderSleepMs));
+      }
+    }
+
+    LOG(ERROR) << "Too many iterations.";
+    return false;
+  }
+
+ private:
+  const PlatformHandle handle_;
+
+  // The start of the received data should always be on a message boundary.
+  std::vector<unsigned char> bytes_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(TestMessageReaderAndChecker);
+};
+
+// Tests writing (and verifies reading using our own custom reader).
+TEST_F(RawChannelTest, WriteMessage) {
+  WriteOnlyRawChannelDelegate delegate;
+  RawChannel* rc = RawChannel::Create(handles[0].Pass());
+  TestMessageReaderAndChecker checker(handles[1].get());
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&InitOnIOThread, rc, base::Unretained(&delegate)));
+
+  // Write and read, for a variety of sizes.
+  for (uint32_t size = 1; size < 5 * 1000 * 1000; size += size / 2 + 1) {
+    EXPECT_TRUE(rc->WriteMessage(MakeTestMessage(size)));
+    EXPECT_TRUE(checker.ReadAndCheckNextMessage(size)) << size;
+  }
+
+  // Write/queue and read afterwards, for a variety of sizes.
+  for (uint32_t size = 1; size < 5 * 1000 * 1000; size += size / 2 + 1)
+    EXPECT_TRUE(rc->WriteMessage(MakeTestMessage(size)));
+  for (uint32_t size = 1; size < 5 * 1000 * 1000; size += size / 2 + 1)
+    EXPECT_TRUE(checker.ReadAndCheckNextMessage(size)) << size;
+
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE, base::Bind(&RawChannel::Shutdown, base::Unretained(rc)));
+}
+
+// RawChannelTest.OnReadMessage ------------------------------------------------
+
+class ReadCheckerRawChannelDelegate : public RawChannel::Delegate {
+ public:
+  ReadCheckerRawChannelDelegate() : done_event_(false, false), position_(0) {}
+  ~ReadCheckerRawChannelDelegate() override {}
+
+  // |RawChannel::Delegate| implementation (called on the I/O thread):
+  void OnReadMessage(
+      const MessageInTransit::View& message_view,
+      ScopedPlatformHandleVectorPtr platform_handles) override {
+    EXPECT_FALSE(platform_handles);
+
+    size_t position;
+    size_t expected_size;
+    bool should_signal = false;
+    {
+      base::AutoLock locker(lock_);
+      CHECK_LT(position_, expected_sizes_.size());
+      position = position_;
+      expected_size = expected_sizes_[position];
+      position_++;
+      if (position_ >= expected_sizes_.size())
+        should_signal = true;
+    }
+
+    EXPECT_EQ(expected_size, message_view.num_bytes()) << position;
+    if (message_view.num_bytes() == expected_size) {
+      EXPECT_TRUE(
+          CheckMessageData(message_view.bytes(), message_view.num_bytes()))
+          << position;
+    }
+
+    if (should_signal)
+      done_event_.Signal();
+  }
+  void OnError(Error error) override {
+    // We'll get a read (shutdown) error when the connection is closed.
+    CHECK_EQ(error, ERROR_READ_SHUTDOWN);
+  }
+
+  // Waits for all the messages (of sizes |expected_sizes_|) to be seen.
+  void Wait() { done_event_.Wait(); }
+
+  void SetExpectedSizes(const std::vector<uint32_t>& expected_sizes) {
+    base::AutoLock locker(lock_);
+    CHECK_EQ(position_, expected_sizes_.size());
+    expected_sizes_ = expected_sizes;
+    position_ = 0;
+  }
+
+ private:
+  base::WaitableEvent done_event_;
+
+  base::Lock lock_;  // Protects the following members.
+  std::vector<uint32_t> expected_sizes_;
+  size_t position_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ReadCheckerRawChannelDelegate);
+};
+
+// Tests reading (writing using our own custom writer).
+TEST_F(RawChannelTest, OnReadMessage) {
+  ReadCheckerRawChannelDelegate delegate;
+  RawChannel* rc = RawChannel::Create(handles[0].Pass());
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&InitOnIOThread, rc, base::Unretained(&delegate)));
+
+  // Write and read, for a variety of sizes.
+  for (uint32_t size = 1; size < 5 * 1000 * 1000; size += size / 2 + 1) {
+    delegate.SetExpectedSizes(std::vector<uint32_t>(1, size));
+
+    EXPECT_TRUE(WriteTestMessageToHandle(handles[1].get(), size));
+
+    delegate.Wait();
+  }
+
+  // Set up reader and write as fast as we can.
+  // Write/queue and read afterwards, for a variety of sizes.
+  std::vector<uint32_t> expected_sizes;
+  for (uint32_t size = 1; size < 5 * 1000 * 1000; size += size / 2 + 1)
+    expected_sizes.push_back(size);
+  delegate.SetExpectedSizes(expected_sizes);
+  for (uint32_t size = 1; size < 5 * 1000 * 1000; size += size / 2 + 1)
+    EXPECT_TRUE(WriteTestMessageToHandle(handles[1].get(), size));
+  delegate.Wait();
+
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE, base::Bind(&RawChannel::Shutdown, base::Unretained(rc)));
+}
+
+// RawChannelTest.WriteMessageAndOnReadMessage ---------------------------------
+
+class RawChannelWriterThread : public base::SimpleThread {
+ public:
+  RawChannelWriterThread(RawChannel* raw_channel, size_t write_count)
+      : base::SimpleThread("raw_channel_writer_thread"),
+        raw_channel_(raw_channel),
+        left_to_write_(write_count) {}
+
+  ~RawChannelWriterThread() override { Join(); }
+
+ private:
+  void Run() override {
+    static const int kMaxRandomMessageSize = 25000;
+
+    while (left_to_write_-- > 0) {
+      EXPECT_TRUE(raw_channel_->WriteMessage(MakeTestMessage(
+          static_cast<uint32_t>(base::RandInt(1, kMaxRandomMessageSize)))));
+    }
+  }
+
+  RawChannel* const raw_channel_;
+  size_t left_to_write_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannelWriterThread);
+};
+
+class ReadCountdownRawChannelDelegate : public RawChannel::Delegate {
+ public:
+  explicit ReadCountdownRawChannelDelegate(size_t expected_count)
+      : done_event_(false, false), expected_count_(expected_count), count_(0) {}
+  ~ReadCountdownRawChannelDelegate() override {}
+
+  // |RawChannel::Delegate| implementation (called on the I/O thread):
+  void OnReadMessage(
+      const MessageInTransit::View& message_view,
+      ScopedPlatformHandleVectorPtr platform_handles) override {
+    EXPECT_FALSE(platform_handles);
+
+    EXPECT_LT(count_, expected_count_);
+    count_++;
+
+    EXPECT_TRUE(
+        CheckMessageData(message_view.bytes(), message_view.num_bytes()));
+
+    if (count_ >= expected_count_)
+      done_event_.Signal();
+  }
+  void OnError(Error error) override {
+    // We'll get a read (shutdown) error when the connection is closed.
+    CHECK_EQ(error, ERROR_READ_SHUTDOWN);
+  }
+
+  // Waits for all the messages to have been seen.
+  void Wait() { done_event_.Wait(); }
+
+ private:
+  base::WaitableEvent done_event_;
+  size_t expected_count_;
+  size_t count_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ReadCountdownRawChannelDelegate);
+};
+
+TEST_F(RawChannelTest, WriteMessageAndOnReadMessage) {
+  static const size_t kNumWriterThreads = 10;
+  static const size_t kNumWriteMessagesPerThread = 4000;
+
+  WriteOnlyRawChannelDelegate writer_delegate;
+  RawChannel* writer_rc = RawChannel::Create(handles[0].Pass());
+  test_io_thread()->PostTaskAndWait(
+    FROM_HERE,
+    base::Bind(&InitOnIOThread, writer_rc,
+               base::Unretained(&writer_delegate)));
+
+  ReadCountdownRawChannelDelegate reader_delegate(kNumWriterThreads *
+                                                  kNumWriteMessagesPerThread);
+  RawChannel* reader_rc = RawChannel::Create(handles[1].Pass());
+  test_io_thread()->PostTaskAndWait(
+    FROM_HERE,
+    base::Bind(&InitOnIOThread, reader_rc,
+               base::Unretained(&reader_delegate)));
+
+  {
+    ScopedVector<RawChannelWriterThread> writer_threads;
+    for (size_t i = 0; i < kNumWriterThreads; i++) {
+      writer_threads.push_back(new RawChannelWriterThread(
+          writer_rc, kNumWriteMessagesPerThread));
+    }
+    for (size_t i = 0; i < writer_threads.size(); i++)
+      writer_threads[i]->Start();
+  }  // Joins all the writer threads.
+
+  // Sleep a bit, to let any extraneous reads be processed. (There shouldn't be
+  // any, but we want to know about them.)
+  test::Sleep(test::DeadlineFromMilliseconds(100));
+
+  // Wait for reading to finish.
+  reader_delegate.Wait();
+
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&RawChannel::Shutdown, base::Unretained(reader_rc)));
+
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&RawChannel::Shutdown, base::Unretained(writer_rc)));
+}
+
+// RawChannelTest.OnError ------------------------------------------------------
+
+class ErrorRecordingRawChannelDelegate
+    : public ReadCountdownRawChannelDelegate {
+ public:
+  ErrorRecordingRawChannelDelegate(size_t expected_read_count,
+                                   bool expect_read_error,
+                                   bool expect_write_error)
+      : ReadCountdownRawChannelDelegate(expected_read_count),
+        got_read_error_event_(false, false),
+        got_write_error_event_(false, false),
+        expecting_read_error_(expect_read_error),
+        expecting_write_error_(expect_write_error) {}
+
+  ~ErrorRecordingRawChannelDelegate() override {}
+
+  void OnError(Error error) override {
+    switch (error) {
+      case ERROR_READ_SHUTDOWN:
+        ASSERT_TRUE(expecting_read_error_);
+        expecting_read_error_ = false;
+        got_read_error_event_.Signal();
+        break;
+      case ERROR_READ_BROKEN:
+        // TODO(vtl): Test broken connections.
+        CHECK(false);
+        break;
+      case ERROR_READ_BAD_MESSAGE:
+        // TODO(vtl): Test reception/detection of bad messages.
+        CHECK(false);
+        break;
+      case ERROR_READ_UNKNOWN:
+        // TODO(vtl): Test however it is we might get here.
+        CHECK(false);
+        break;
+      case ERROR_WRITE:
+        ASSERT_TRUE(expecting_write_error_);
+        expecting_write_error_ = false;
+        got_write_error_event_.Signal();
+        break;
+    }
+  }
+
+  void WaitForReadError() { got_read_error_event_.Wait(); }
+  void WaitForWriteError() { got_write_error_event_.Wait(); }
+
+ private:
+  base::WaitableEvent got_read_error_event_;
+  base::WaitableEvent got_write_error_event_;
+
+  bool expecting_read_error_;
+  bool expecting_write_error_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ErrorRecordingRawChannelDelegate);
+};
+
+// Tests (fatal) errors.
+TEST_F(RawChannelTest, OnError) {
+  ErrorRecordingRawChannelDelegate delegate(0, true, true);
+  RawChannel* rc = RawChannel::Create(handles[0].Pass());
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&InitOnIOThread, rc, base::Unretained(&delegate)));
+
+  // Close the handle of the other end, which should make writing fail.
+  handles[1].reset();
+
+  EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1)));
+
+  // We should get a write error.
+  delegate.WaitForWriteError();
+
+  // We should also get a read error.
+  delegate.WaitForReadError();
+
+  EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(2)));
+
+  // Sleep a bit, to make sure we don't get another |OnError()|
+  // notification. (If we actually get another one, |OnError()| crashes.)
+  test::Sleep(test::DeadlineFromMilliseconds(20));
+
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE, base::Bind(&RawChannel::Shutdown, base::Unretained(rc)));
+}
+
+// RawChannelTest.ReadUnaffectedByWriteError -----------------------------------
+
+TEST_F(RawChannelTest, ReadUnaffectedByWriteError) {
+  const size_t kMessageCount = 5;
+
+  // Write a few messages into the other end.
+  uint32_t message_size = 1;
+  for (size_t i = 0; i < kMessageCount;
+       i++, message_size += message_size / 2 + 1)
+    EXPECT_TRUE(WriteTestMessageToHandle(handles[1].get(), message_size));
+
+  // Close the other end, which should make writing fail.
+  handles[1].reset();
+
+  // Only start up reading here. The system buffer should still contain the
+  // messages that were written.
+  ErrorRecordingRawChannelDelegate delegate(kMessageCount, true, true);
+  RawChannel* rc = RawChannel::Create(handles[0].Pass());
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&InitOnIOThread, rc, base::Unretained(&delegate)));
+
+  EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1)));
+
+  // We should definitely get a write error.
+  delegate.WaitForWriteError();
+
+  // Wait for reading to finish. A writing failure shouldn't affect reading.
+  delegate.Wait();
+
+  // And then we should get a read error.
+  delegate.WaitForReadError();
+
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE, base::Bind(&RawChannel::Shutdown, base::Unretained(rc)));
+}
+
+// RawChannelTest.WriteMessageAfterShutdown ------------------------------------
+
+// Makes sure that calling |WriteMessage()| after |Shutdown()| behaves
+// correctly.
+TEST_F(RawChannelTest, WriteMessageAfterShutdown) {
+  WriteOnlyRawChannelDelegate delegate;
+  RawChannel* rc = RawChannel::Create(handles[0].Pass());
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&InitOnIOThread, rc, base::Unretained(&delegate)));
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE, base::Bind(&RawChannel::Shutdown, base::Unretained(rc)));
+
+  EXPECT_FALSE(rc->WriteMessage(MakeTestMessage(1)));
+}
+
+// RawChannelTest.ReadWritePlatformHandles -------------------------------------
+
+class ReadPlatformHandlesCheckerRawChannelDelegate
+    : public RawChannel::Delegate {
+ public:
+  ReadPlatformHandlesCheckerRawChannelDelegate() : done_event_(false, false) {}
+  ~ReadPlatformHandlesCheckerRawChannelDelegate() override {}
+
+  // |RawChannel::Delegate| implementation (called on the I/O thread):
+  void OnReadMessage(
+      const MessageInTransit::View& message_view,
+      ScopedPlatformHandleVectorPtr platform_handles) override {
+    const char kHello[] = "hello";
+
+    EXPECT_EQ(sizeof(kHello), message_view.num_bytes());
+    EXPECT_STREQ(kHello, static_cast<const char*>(message_view.bytes()));
+
+    ASSERT_TRUE(platform_handles);
+    ASSERT_EQ(2u, platform_handles->size());
+    ScopedPlatformHandle h1(platform_handles->at(0));
+    EXPECT_TRUE(h1.is_valid());
+    ScopedPlatformHandle h2(platform_handles->at(1));
+    EXPECT_TRUE(h2.is_valid());
+    platform_handles->clear();
+
+    {
+      char buffer[100] = {};
+
+      base::ScopedFILE fp(test::FILEFromPlatformHandle(h1.Pass(), "rb"));
+      EXPECT_TRUE(fp);
+      rewind(fp.get());
+      EXPECT_EQ(1u, fread(buffer, 1, sizeof(buffer), fp.get()));
+      EXPECT_EQ('1', buffer[0]);
+    }
+
+    {
+      char buffer[100] = {};
+      base::ScopedFILE fp(test::FILEFromPlatformHandle(h2.Pass(), "rb"));
+      EXPECT_TRUE(fp);
+      rewind(fp.get());
+      EXPECT_EQ(1u, fread(buffer, 1, sizeof(buffer), fp.get()));
+      EXPECT_EQ('2', buffer[0]);
+    }
+
+    done_event_.Signal();
+  }
+  void OnError(Error error) override {
+    // We'll get a read (shutdown) error when the connection is closed.
+    CHECK_EQ(error, ERROR_READ_SHUTDOWN);
+  }
+
+  void Wait() { done_event_.Wait(); }
+
+ private:
+  base::WaitableEvent done_event_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ReadPlatformHandlesCheckerRawChannelDelegate);
+};
+
+TEST_F(RawChannelTest, ReadWritePlatformHandles) {
+  base::ScopedTempDir temp_dir;
+  ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
+
+  WriteOnlyRawChannelDelegate write_delegate;
+  RawChannel* rc_write = RawChannel::Create(handles[0].Pass());
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&InitOnIOThread, rc_write, base::Unretained(&write_delegate)));
+
+  ReadPlatformHandlesCheckerRawChannelDelegate read_delegate;
+  RawChannel* rc_read = RawChannel::Create(handles[1].Pass());
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&InitOnIOThread, rc_read, base::Unretained(&read_delegate)));
+
+  base::FilePath unused;
+  base::ScopedFILE fp1(
+      base::CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+  EXPECT_EQ(1u, fwrite("1", 1, 1, fp1.get()));
+  base::ScopedFILE fp2(
+      base::CreateAndOpenTemporaryFileInDir(temp_dir.path(), &unused));
+  EXPECT_EQ(1u, fwrite("2", 1, 1, fp2.get()));
+
+  {
+    const char kHello[] = "hello";
+    ScopedPlatformHandleVectorPtr platform_handles(new PlatformHandleVector());
+    platform_handles->push_back(
+        test::PlatformHandleFromFILE(fp1.Pass()).release());
+    platform_handles->push_back(
+        test::PlatformHandleFromFILE(fp2.Pass()).release());
+
+    scoped_ptr<MessageInTransit> message(
+        new MessageInTransit(MessageInTransit::Type::MESSAGE,
+                             sizeof(kHello), kHello));
+    message->SetTransportData(make_scoped_ptr(new TransportData(
+        platform_handles.Pass(), rc_write->GetSerializedPlatformHandleSize())));
+    EXPECT_TRUE(rc_write->WriteMessage(message.Pass()));
+  }
+
+  read_delegate.Wait();
+
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&RawChannel::Shutdown, base::Unretained(rc_read)));
+  test_io_thread()->PostTaskAndWait(
+      FROM_HERE,
+      base::Bind(&RawChannel::Shutdown, base::Unretained(rc_write)));
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/raw_channel_win.cc b/mojo/edk/system/raw_channel_win.cc
new file mode 100644
index 0000000..03c44709
--- /dev/null
+++ b/mojo/edk/system/raw_channel_win.cc
@@ -0,0 +1,894 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/raw_channel.h"
+
+#include <windows.h>
+
+#include "base/bind.h"
+#include "base/lazy_instance.h"
+#include "base/location.h"
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/message_loop/message_loop.h"
+#include "base/process/process.h"
+#include "base/synchronization/lock.h"
+#include "base/win/object_watcher.h"
+#include "base/win/windows_version.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/public/cpp/system/macros.h"
+
+#define STATUS_CANCELLED 0xC0000120
+#define STATUS_PIPE_BROKEN 0xC000014B
+
+// We can't use IO completion ports if we send a message pipe. The reason is
+// that the only way to stop an existing IOCP is by closing the pipe handle.
+// See https://msdn.microsoft.com/en-us/library/windows/hardware/ff545834(v=vs.85).aspx
+bool g_use_iocp = false;
+
+// Manual reset per
+// Doc for overlapped I/O says use manual per
+//   https://msdn.microsoft.com/en-us/library/windows/desktop/ms684342(v=vs.85).aspx
+// However using an auto-reset event makes the perf test 5x faster and also
+// works since we don't wait on the event elsewhere or call GetOverlappedResult
+// before it fires.
+bool g_use_autoreset_event = true;
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+struct MOJO_ALIGNAS(8) SerializedHandle {
+  DWORD handle_pid;
+  HANDLE handle;
+};
+
+class VistaOrHigherFunctions {
+ public:
+  VistaOrHigherFunctions()
+      : is_vista_or_higher_(
+          base::win::GetVersion() >= base::win::VERSION_VISTA),
+        set_file_completion_notification_modes_(nullptr),
+        cancel_io_ex_(nullptr),
+        get_file_information_by_handle_ex_(nullptr) {
+    if (!is_vista_or_higher_)
+      return;
+
+    HMODULE module = GetModuleHandleW(L"kernel32.dll");
+    set_file_completion_notification_modes_ =
+        reinterpret_cast<SetFileCompletionNotificationModesFunc>(
+            GetProcAddress(module, "SetFileCompletionNotificationModes"));
+    DCHECK(set_file_completion_notification_modes_);
+
+    cancel_io_ex_ =
+        reinterpret_cast<CancelIoExFunc>(GetProcAddress(module, "CancelIoEx"));
+    DCHECK(cancel_io_ex_);
+
+    get_file_information_by_handle_ex_ =
+        reinterpret_cast<GetFileInformationByHandleExFunc>(
+            GetProcAddress(module, "GetFileInformationByHandleEx"));
+    DCHECK(get_file_information_by_handle_ex_);
+  }
+
+  bool is_vista_or_higher() const { return is_vista_or_higher_; }
+
+  BOOL SetFileCompletionNotificationModes(HANDLE handle, UCHAR flags) {
+    return set_file_completion_notification_modes_(handle, flags);
+  }
+
+  BOOL CancelIoEx(HANDLE handle, LPOVERLAPPED overlapped) {
+    return cancel_io_ex_(handle, overlapped);
+  }
+
+  BOOL GetFileInformationByHandleEx(HANDLE handle,
+                                    FILE_INFO_BY_HANDLE_CLASS file_info_class,
+                                    LPVOID file_info,
+                                    DWORD buffer_size) {
+    return get_file_information_by_handle_ex_(
+        handle, file_info_class, file_info, buffer_size);
+  }
+
+ private:
+  using SetFileCompletionNotificationModesFunc = BOOL(WINAPI*)(HANDLE, UCHAR);
+  using CancelIoExFunc = BOOL(WINAPI*)(HANDLE, LPOVERLAPPED);
+  using GetFileInformationByHandleExFunc = BOOL(WINAPI*)(
+      HANDLE, FILE_INFO_BY_HANDLE_CLASS, LPVOID, DWORD);
+
+  bool is_vista_or_higher_;
+  SetFileCompletionNotificationModesFunc
+      set_file_completion_notification_modes_;
+  CancelIoExFunc cancel_io_ex_;
+  GetFileInformationByHandleExFunc get_file_information_by_handle_ex_;
+};
+
+base::LazyInstance<VistaOrHigherFunctions> g_vista_or_higher_functions =
+    LAZY_INSTANCE_INITIALIZER;
+
+class RawChannelWin final : public RawChannel {
+ public:
+  RawChannelWin(ScopedPlatformHandle handle)
+      : handle_(handle.Pass()),
+        io_handler_(nullptr),
+        skip_completion_port_on_success_(
+            g_use_iocp &&
+            g_vista_or_higher_functions.Get().is_vista_or_higher()) {
+    DCHECK(handle_.is_valid());
+  }
+  ~RawChannelWin() override {
+    DCHECK(!io_handler_);
+  }
+
+ private:
+  // RawChannelIOHandler receives OS notifications for I/O completion. It must
+  // be created on the I/O thread.
+  //
+  // It manages its own destruction. Destruction happens on the I/O thread when
+  // all the following conditions are satisfied:
+  //   - |DetachFromOwnerNoLock()| has been called;
+  //   - there is no pending read;
+  //   - there is no pending write.
+  class RawChannelIOHandler : public base::MessageLoopForIO::IOHandler,
+    public base::win::ObjectWatcher::Delegate {
+   public:
+    RawChannelIOHandler(RawChannelWin* owner,
+                        ScopedPlatformHandle handle)
+        : handle_(handle.Pass()),
+          owner_(owner),
+          suppress_self_destruct_(false),
+          pending_read_(false),
+          pending_write_(false),
+          platform_handles_written_(0) {
+      memset(&read_context_.overlapped, 0, sizeof(read_context_.overlapped));
+      memset(&write_context_.overlapped, 0, sizeof(write_context_.overlapped));
+      if (g_use_iocp) {
+        owner_->message_loop_for_io()->RegisterIOHandler(
+            handle_.get().handle, this);
+        read_context_.handler = this;
+        write_context_.handler = this;
+      } else {
+        read_event = CreateEvent(
+            NULL, g_use_autoreset_event ? FALSE : TRUE, FALSE, NULL);
+        write_event = CreateEvent(
+            NULL, g_use_autoreset_event ? FALSE : TRUE, FALSE, NULL);
+        read_context_.overlapped.hEvent = read_event;
+        write_context_.overlapped.hEvent = write_event;
+
+
+        if (g_use_autoreset_event) {
+          read_watcher_.StartWatchingMultipleTimes(read_event, this);
+          write_watcher_.StartWatchingMultipleTimes(write_event, this);
+        }
+      }
+    }
+
+    ~RawChannelIOHandler() override {
+      DCHECK(ShouldSelfDestruct());
+    }
+
+    HANDLE handle() const { return handle_.get().handle; }
+
+    // The following methods are only called by the owner on the I/O thread.
+    bool pending_read() const {
+      DCHECK(owner_);
+      DCHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
+      return pending_read_;
+    }
+
+    base::MessageLoopForIO::IOContext* read_context() {
+      DCHECK(owner_);
+      DCHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
+      return &read_context_;
+    }
+
+    // Instructs the object to wait for an |OnIOCompleted()| notification.
+    void OnPendingReadStarted() {
+      DCHECK(owner_);
+      DCHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
+      DCHECK(!pending_read_);
+      pending_read_ = true;
+    }
+
+    // The following methods are only called by the owner under
+    // |owner_->write_lock()|.
+    bool pending_write_no_lock() const {
+      DCHECK(owner_);
+      owner_->write_lock().AssertAcquired();
+      return pending_write_;
+    }
+
+    base::MessageLoopForIO::IOContext* write_context_no_lock() {
+      DCHECK(owner_);
+      owner_->write_lock().AssertAcquired();
+      return &write_context_;
+    }
+    // Instructs the object to wait for an |OnIOCompleted()| notification.
+    void OnPendingWriteStartedNoLock(size_t platform_handles_written) {
+      DCHECK(owner_);
+      owner_->write_lock().AssertAcquired();
+      DCHECK(!pending_write_);
+      pending_write_ = true;
+      platform_handles_written_ = platform_handles_written;
+    }
+
+    // |base::MessageLoopForIO::IOHandler| implementation:
+    // Must be called on the I/O thread. It could be called before or after
+    // detached from the owner.
+    void OnIOCompleted(base::MessageLoopForIO::IOContext* context,
+                       DWORD bytes_transferred,
+                       DWORD error) override {
+      DCHECK(!owner_ ||
+             base::MessageLoop::current() == owner_->message_loop_for_io());
+
+      // Suppress self-destruction inside |OnReadCompleted()|, etc. (in case
+      // they result in a call to |Shutdown()|).
+      bool old_suppress_self_destruct = suppress_self_destruct_;
+      suppress_self_destruct_ = true;
+
+      if (context == &read_context_)
+        OnReadCompleted(bytes_transferred, error);
+      else if (context == &write_context_)
+        OnWriteCompleted(bytes_transferred, error);
+      else
+        NOTREACHED();
+
+      // Maybe allow self-destruction again.
+      suppress_self_destruct_ = old_suppress_self_destruct;
+
+      if (ShouldSelfDestruct())
+        delete this;
+    }
+
+    // Must be called on the I/O thread under |owner_->write_lock()|.
+    // After this call, the owner must not make any further calls on this
+    // object, and therefore the object is used on the I/O thread exclusively
+    // (if it stays alive).
+    void DetachFromOwnerNoLock(scoped_ptr<ReadBuffer> read_buffer,
+                               scoped_ptr<WriteBuffer> write_buffer) {
+      DCHECK(owner_);
+      DCHECK_EQ(base::MessageLoop::current(), owner_->message_loop_for_io());
+      //owner_->write_lock().AssertAcquired();
+
+      // If read/write is pending, we have to retain the corresponding buffer.
+      if (pending_read_)
+        preserved_read_buffer_after_detach_ = read_buffer.Pass();
+      if (pending_write_)
+        preserved_write_buffer_after_detach_ = write_buffer.Pass();
+
+      owner_ = nullptr;
+      if (ShouldSelfDestruct())
+        delete this;
+    }
+
+    ScopedPlatformHandle ReleaseHandle(std::vector<char>* read_buffer) {
+      if (g_vista_or_higher_functions.Get().is_vista_or_higher()) {
+        g_vista_or_higher_functions.Get().CancelIoEx(handle(), nullptr);
+      } else {
+        CHECK(false) << "TODO(jam): handle XP";
+      }
+
+      // NOTE: The above call will cancel pending IO calls.
+      size_t read_buffer_byte_size = owner_->read_buffer()->num_valid_bytes();
+
+      if (pending_read_) {
+        DWORD bytes_read_dword = 0;
+
+        DWORD old_bytes = read_context_.overlapped.InternalHigh;
+
+        // Since we cancelled pending IO calls above, we need to know if the
+        // read did succeed (i.e. it completed and there's a pending task posted
+        // to alert us) or if it was cancelled. This important because if the
+        // read completed, we don't want to serialize those bytes again.
+        //TODO(jam): for XP, can return TRUE here to wait. also below.
+        BOOL rv = GetOverlappedResult(
+            handle(), &read_context_.overlapped, &bytes_read_dword, FALSE);
+        DCHECK_EQ(old_bytes, bytes_read_dword);
+        if (rv) {
+          if (read_context_.overlapped.Internal != STATUS_CANCELLED) {
+            read_buffer_byte_size += read_context_.overlapped.InternalHigh;
+          }
+        }
+        pending_read_ = false;
+      }
+
+      RawChannel::WriteBuffer* write_buffer = owner_->write_buffer_no_lock();
+
+      if (pending_write_) {
+        DWORD bytes_written_dword = 0;
+        DWORD old_bytes = write_context_.overlapped.InternalHigh;
+
+        // See comment above.
+        BOOL rv = GetOverlappedResult(
+            handle(), &write_context_.overlapped, &bytes_written_dword, FALSE);
+
+        if (old_bytes != bytes_written_dword) {
+          NOTREACHED() << "TODO(jam): this shouldn't be reached";
+        }
+
+        if (rv) {
+          if (write_context_.overlapped.Internal != STATUS_CANCELLED) {
+            CHECK(write_buffer->queue_size() != 0);
+
+            // TODO(jam)
+            DCHECK(!write_buffer->HavePlatformHandlesToSend());
+
+            write_buffer->data_offset_ += bytes_written_dword;
+
+            // TODO(jam): copied from OnWriteCompletedNoLock
+            MessageInTransit* message =
+                write_buffer->message_queue()->PeekMessage();
+            if (write_buffer->data_offset_ >= message->total_size()) {
+              // Complete write.
+              CHECK_EQ(write_buffer->data_offset_, message->total_size());
+              write_buffer->message_queue_.DiscardMessage();
+              write_buffer->platform_handles_offset_ = 0;
+              write_buffer->data_offset_ = 0;
+            }
+
+
+            //TODO(jam): handle more write msgs
+            DCHECK(write_buffer->message_queue_.IsEmpty());
+          }
+        }
+        pending_write_ = false;
+      }
+
+      if (read_buffer_byte_size) {
+        read_buffer->resize(read_buffer_byte_size);
+        memcpy(&(*read_buffer)[0], owner_->read_buffer()->buffer(),
+               read_buffer_byte_size);
+        owner_->read_buffer()->Reset();
+      }
+
+      return ScopedPlatformHandle(handle_.release());
+    }
+
+    void OnObjectSignaled(HANDLE object) override {
+      // Since this is called on the IO thread, no locks needed for owner_.
+      bool handle_is_valid = false;
+      if (owner_)
+        owner_->read_lock().Acquire();
+      handle_is_valid = handle_.is_valid();
+      if (owner_)
+        owner_->read_lock().Release();
+      if (!handle_is_valid) {
+        if (object == read_event)
+          pending_read_ = false;
+        else
+          pending_write_ = false;
+        if (ShouldSelfDestruct())
+          delete this;
+        return;
+      }
+
+      if (object == read_event) {
+        OnIOCompleted(&read_context_, read_context_.overlapped.InternalHigh,
+                      read_context_.overlapped.Internal);
+
+      } else {
+        CHECK(object == write_event);
+        OnIOCompleted(&write_context_, write_context_.overlapped.InternalHigh,
+                      write_context_.overlapped.Internal);
+      }
+    }
+    HANDLE read_event, write_event;
+    base::win::ObjectWatcher read_watcher_, write_watcher_;
+
+   private:
+    // Returns true if |owner_| has been reset and there is not pending read or
+    // write.
+    // Must be called on the I/O thread.
+    bool ShouldSelfDestruct() const {
+      if (owner_ || suppress_self_destruct_)
+        return false;
+
+      // Note: Detached, hence no lock needed for |pending_write_|.
+      return !pending_read_ && !pending_write_;
+    }
+
+    // Must be called on the I/O thread. It may be called before or after
+    // detaching from the owner.
+    void OnReadCompleted(DWORD bytes_read, DWORD error) {
+      DCHECK(!owner_ ||
+             base::MessageLoop::current() == owner_->message_loop_for_io());
+      DCHECK(suppress_self_destruct_);
+
+      if (g_use_autoreset_event && !pending_read_)
+        return;
+
+      CHECK(pending_read_);
+      pending_read_ = false;
+      if (!owner_)
+        return;
+
+      // Note: |OnReadCompleted()| may detach us from |owner_|.
+      if (error == ERROR_SUCCESS) {
+        DCHECK_GT(bytes_read, 0u);
+        owner_->OnReadCompleted(IO_SUCCEEDED, bytes_read);
+      } else if (error == ERROR_BROKEN_PIPE  ||
+                 (g_use_autoreset_event && error == STATUS_PIPE_BROKEN)) {
+        DCHECK_EQ(bytes_read, 0u);
+        owner_->OnReadCompleted(IO_FAILED_SHUTDOWN, 0);
+      } else if (error == ERROR_NO_MORE_ITEMS && g_use_autoreset_event) {
+        return owner_->OnReadCompleted(IO_SUCCEEDED, bytes_read);
+      } else {
+        DCHECK_EQ(bytes_read, 0u);
+        LOG(WARNING) << "ReadFile: " << logging::SystemErrorCodeToString(error);
+        owner_->OnReadCompleted(IO_FAILED_UNKNOWN, 0);
+      }
+    }
+
+    // Must be called on the I/O thread. It may be called before or after
+    // detaching from the owner.
+    void OnWriteCompleted(DWORD bytes_written, DWORD error) {
+      DCHECK(!owner_ ||
+             base::MessageLoop::current() == owner_->message_loop_for_io());
+      DCHECK(suppress_self_destruct_);
+
+      if (!owner_) {
+        // No lock needed.
+        CHECK(pending_write_);
+        pending_write_ = false;
+        return;
+      }
+
+      {
+        base::AutoLock locker(owner_->write_lock());
+        if (g_use_autoreset_event && !pending_write_)
+          return;
+
+        CHECK(pending_write_);
+        pending_write_ = false;
+      }
+
+      // Note: |OnWriteCompleted()| may detach us from |owner_|.
+      if (error == ERROR_SUCCESS) {
+        // Reset |platform_handles_written_| before calling |OnWriteCompleted()|
+        // since that function may call back to this class and set it again.
+        size_t local_platform_handles_written_ = platform_handles_written_;
+        platform_handles_written_ = 0;
+        owner_->OnWriteCompleted(IO_SUCCEEDED, local_platform_handles_written_,
+                                 bytes_written);
+      } else if (error == ERROR_BROKEN_PIPE  ||
+                 (g_use_autoreset_event && error == STATUS_PIPE_BROKEN)) {
+        owner_->OnWriteCompleted(IO_FAILED_SHUTDOWN, 0, 0);
+      } else if (error == ERROR_NO_MORE_ITEMS && g_use_autoreset_event) {
+         size_t local_platform_handles_written_ = platform_handles_written_;
+        platform_handles_written_ = 0;
+        owner_->OnWriteCompleted(IO_SUCCEEDED, local_platform_handles_written_,
+                                 bytes_written);
+      } else {
+        LOG(WARNING) << "WriteFile: "
+                     << logging::SystemErrorCodeToString(error);
+        owner_->OnWriteCompleted(IO_FAILED_UNKNOWN, 0, 0);
+      }
+    }
+
+    ScopedPlatformHandle handle_;
+
+    // |owner_| is reset on the I/O thread under |owner_->write_lock()|.
+    // Therefore, it may be used on any thread under lock; or on the I/O thread
+    // without locking.
+    RawChannelWin* owner_;
+
+    // The following members must be used on the I/O thread.
+    scoped_ptr<ReadBuffer> preserved_read_buffer_after_detach_;
+    scoped_ptr<WriteBuffer> preserved_write_buffer_after_detach_;
+    bool suppress_self_destruct_;
+
+    bool pending_read_;
+    base::MessageLoopForIO::IOContext read_context_;
+
+    // The following members must be used under |owner_->write_lock()| while the
+    // object is still attached to the owner, and only on the I/O thread
+    // afterwards.
+    bool pending_write_;
+    size_t platform_handles_written_;
+    base::MessageLoopForIO::IOContext write_context_;
+
+    MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannelIOHandler);
+  };
+
+  ScopedPlatformHandle ReleaseHandleNoLock(
+      std::vector<char>* read_buffer_out) override {
+    std::vector<WriteBuffer::Buffer> buffers;
+    write_buffer_no_lock()->GetBuffers(&buffers);
+    if (!buffers.empty()) {
+      // TODO(jam): copy code in OnShutdownNoLock
+      NOTREACHED() << "releasing handle with pending write buffer";
+    }
+
+
+    if (handle_.is_valid()) {
+      // SetInitialBuffer could have been called on main thread before OnInit
+      // is called on Io thread. and in meantime releasehandle called.
+      //DCHECK(read_buffer()->num_valid_bytes() == 0);
+      if (read_buffer()->num_valid_bytes()) {
+        read_buffer_out->resize(read_buffer()->num_valid_bytes());
+        memcpy(&(*read_buffer_out)[0], read_buffer()->buffer(),
+               read_buffer()->num_valid_bytes());
+        read_buffer()->Reset();
+      }
+      DCHECK(write_buffer_no_lock()->queue_size() == 0);
+      return ScopedPlatformHandle(PlatformHandle(handle_.release().handle));
+    }
+
+    return io_handler_->ReleaseHandle(read_buffer_out);
+  }
+  PlatformHandle HandleForDebuggingNoLock() override {
+    if (handle_.is_valid())
+      return handle_.get();
+
+    if (!io_handler_)
+      return PlatformHandle();
+
+    return PlatformHandle(io_handler_->handle());
+  }
+
+  IOResult Read(size_t* bytes_read) override  {
+    DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+
+    char* buffer = nullptr;
+    size_t bytes_to_read = 0;
+    read_buffer()->GetBuffer(&buffer, &bytes_to_read);
+
+    DCHECK(io_handler_);
+    DCHECK(!io_handler_->pending_read());
+    BOOL result = ReadFile(
+        io_handler_->handle(), buffer, static_cast<DWORD>(bytes_to_read),
+        nullptr, &io_handler_->read_context()->overlapped);
+    if (!result) {
+      DWORD error = GetLastError();
+      if (error == ERROR_BROKEN_PIPE)
+        return IO_FAILED_SHUTDOWN;
+      if (error != ERROR_IO_PENDING) {
+        LOG(WARNING) << "ReadFile: " << logging::SystemErrorCodeToString(error);
+        return IO_FAILED_UNKNOWN;
+      }
+    }
+
+    if (result && skip_completion_port_on_success_) {
+      DWORD bytes_read_dword = 0;
+      BOOL get_size_result = GetOverlappedResult(
+          io_handler_->handle(), &io_handler_->read_context()->overlapped,
+          &bytes_read_dword, FALSE);
+      DPCHECK(get_size_result);
+      *bytes_read = bytes_read_dword;
+      return IO_SUCCEEDED;
+    }
+
+    if (!g_use_autoreset_event) {
+      if (!g_use_iocp) {
+        io_handler_->read_watcher_.StartWatchingOnce(
+            io_handler_->read_event, io_handler_);
+      }
+    }
+    // If the read is pending or the read has succeeded but we don't skip
+    // completion port on success, instruct |io_handler_| to wait for the
+    // completion packet.
+    //
+    // TODO(yzshen): It seems there isn't document saying that all error cases
+    // (other than ERROR_IO_PENDING) are guaranteed to *not* queue a completion
+    // packet. If we do get one for errors,
+    // |RawChannelIOHandler::OnIOCompleted()| will crash so we will learn about
+    // it.
+
+    io_handler_->OnPendingReadStarted();
+    return IO_PENDING;
+  }
+
+  IOResult ScheduleRead() override {
+    if (!io_handler_)
+      return IO_PENDING;  // OnInit could have earlied out.
+
+    DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+    DCHECK(io_handler_);
+    DCHECK(!io_handler_->pending_read());
+
+    size_t bytes_read = 0;
+    IOResult io_result = Read(&bytes_read);
+    if (io_result == IO_SUCCEEDED) {
+      DCHECK(skip_completion_port_on_success_);
+
+      // We have finished reading successfully. Queue a notification manually.
+      io_handler_->OnPendingReadStarted();
+      // |io_handler_| won't go away before the task is run, so it is safe to
+      // use |base::Unretained()|.
+      message_loop_for_io()->PostTask(
+          FROM_HERE, base::Bind(&RawChannelIOHandler::OnIOCompleted,
+                                base::Unretained(io_handler_),
+                                base::Unretained(io_handler_->read_context()),
+                                static_cast<DWORD>(bytes_read), ERROR_SUCCESS));
+      return IO_PENDING;
+    }
+
+    return io_result;
+  }
+  ScopedPlatformHandleVectorPtr GetReadPlatformHandles(
+      size_t num_platform_handles,
+      const void* platform_handle_table) override {
+    // TODO(jam): this code will have to be updated once it's used in a sandbox
+    // and the receiving process doesn't have duplicate permission for the
+    // receiver. Once there's a broker and we have a connection to it (possibly
+    // through ConnectionManager), then we can make a sync IPC to it here to get
+    // a token for this handle, and it will duplicate the handle to is process.
+    // Then we pass the token to the receiver, which will then make a sync call
+    // to the broker to get a duplicated handle. This will also allow us to
+    // avoid leaks of the handle if the receiver dies, since the broker can
+    // notice that.
+    DCHECK_GT(num_platform_handles, 0u);
+    ScopedPlatformHandleVectorPtr rv(new PlatformHandleVector());
+
+    const SerializedHandle* serialization_data =
+        static_cast<const SerializedHandle*>(platform_handle_table);
+    for (size_t i = 0; i < num_platform_handles; i++) {
+      DWORD pid = serialization_data->handle_pid;
+      HANDLE source_handle = serialization_data->handle;
+      serialization_data ++;
+      base::Process sender =
+          base::Process::OpenWithAccess(pid, PROCESS_DUP_HANDLE);
+      DCHECK(sender.IsValid());
+      HANDLE target_handle = NULL;
+      BOOL dup_result = DuplicateHandle(
+          sender.Handle(), source_handle,
+          base::GetCurrentProcessHandle(), &target_handle, 0,
+          FALSE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
+      DCHECK(dup_result);
+      rv->push_back(PlatformHandle(target_handle));
+    }
+    return rv.Pass();
+  }
+
+  IOResult WriteNoLock(size_t* platform_handles_written,
+                       size_t* bytes_written) override  {
+    write_lock().AssertAcquired();
+
+    DCHECK(io_handler_);
+    DCHECK(!io_handler_->pending_write_no_lock());
+
+    size_t num_platform_handles = 0;
+    if (write_buffer_no_lock()->HavePlatformHandlesToSend()) {
+      // Since we're not sure which process might ultimately deserialize this
+      // message, we can't duplicate the handle now. Instead, write the process
+      // ID and handle now and let the receiver duplicate it.
+      PlatformHandle* platform_handles;
+      void* serialization_data_temp;
+      write_buffer_no_lock()->GetPlatformHandlesToSend(
+          &num_platform_handles, &platform_handles, &serialization_data_temp);
+      SerializedHandle* serialization_data =
+          static_cast<SerializedHandle*>(serialization_data_temp);
+      DCHECK_GT(num_platform_handles, 0u);
+      DCHECK(platform_handles);
+
+      DWORD current_process_id = base::GetCurrentProcId();
+      for (size_t i = 0; i < num_platform_handles; i++) {
+        serialization_data->handle_pid = current_process_id;
+        serialization_data->handle = platform_handles[i].handle;
+        serialization_data++;
+        platform_handles[i] = PlatformHandle();
+      }
+    }
+
+    std::vector<WriteBuffer::Buffer> buffers;
+    write_buffer_no_lock()->GetBuffers(&buffers);
+    DCHECK(!buffers.empty());
+
+    // TODO(yzshen): Handle multi-segment writes more efficiently.
+    DWORD bytes_written_dword = 0;
+
+
+    /* jam: comment below is commented out because with the latest code I don't
+    see this. Note that this code is incorrect for two reasons:
+    1) the buffer would need to be saved until the write is finished
+    2) this still doesn't fix the problem of there being more data or messages
+       to be sent. the proper fix is to serialize pending messages to shared
+       memory.
+
+    // TODO(jam): right now we get in bad situation where we might first write
+    // the main buffer and then the MP gets sent before we write the transport
+    // buffer. We can fix this by sending information about partially written
+    // messages, or by teaching transport buffer how to grow the main buffer and
+    // write its data there.
+    // Until that's done, for now make another copy.
+
+    size_t total_size = buffers[0].size;
+    if (buffers.size() > 1)
+      total_size+=buffers[1].size;
+    char* buf = new char[total_size];
+    memcpy(buf, buffers[0].addr, buffers[0].size);
+    if (buffers.size() > 1)
+      memcpy(buf + buffers[0].size, buffers[1].addr, buffers[1].size);
+
+    BOOL result = WriteFile(
+        io_handler_->handle(), buf,
+        static_cast<DWORD>(total_size),
+        &bytes_written_dword,
+        &io_handler_->write_context_no_lock()->overlapped);
+    delete [] buf;
+
+    if (!result) {
+      DWORD error = GetLastError();
+      if (error == ERROR_BROKEN_PIPE)
+        return IO_FAILED_SHUTDOWN;
+      if (error != ERROR_IO_PENDING) {
+        LOG(WARNING) << "WriteFile: "
+                     << logging::SystemErrorCodeToString(error);
+        return IO_FAILED_UNKNOWN;
+      }
+    }
+    */
+
+    BOOL result =
+        WriteFile(io_handler_->handle(), buffers[0].addr,
+                  static_cast<DWORD>(buffers[0].size), &bytes_written_dword,
+                  &io_handler_->write_context_no_lock()->overlapped);
+    if (!result) {
+      DWORD error = GetLastError();
+      if (error == ERROR_BROKEN_PIPE)
+        return IO_FAILED_SHUTDOWN;
+      if (error != ERROR_IO_PENDING) {
+        LOG(WARNING) << "WriteFile: "
+                     << logging::SystemErrorCodeToString(error);
+        return IO_FAILED_UNKNOWN;
+      }
+    }
+
+    if (result && skip_completion_port_on_success_) {
+      *platform_handles_written = num_platform_handles;
+      *bytes_written = bytes_written_dword;
+      return IO_SUCCEEDED;
+    }
+
+    if (!g_use_autoreset_event) {
+      if (!g_use_iocp) {
+        io_handler_->write_watcher_.StartWatchingOnce(
+            io_handler_->write_event, io_handler_);
+      }
+    }
+    // If the write is pending or the write has succeeded but we don't skip
+    // completion port on success, instruct |io_handler_| to wait for the
+    // completion packet.
+    //
+    // TODO(yzshen): it seems there isn't document saying that all error cases
+    // (other than ERROR_IO_PENDING) are guaranteed to *not* queue a completion
+    // packet. If we do get one for errors,
+    // |RawChannelIOHandler::OnIOCompleted()| will crash so we will learn about
+    // it.
+
+    io_handler_->OnPendingWriteStartedNoLock(num_platform_handles);
+    return IO_PENDING;
+  }
+
+  IOResult ScheduleWriteNoLock() override {
+    write_lock().AssertAcquired();
+
+    DCHECK(io_handler_);
+    DCHECK(!io_handler_->pending_write_no_lock());
+
+    size_t platform_handles_written = 0;
+    size_t bytes_written = 0;
+    IOResult io_result = WriteNoLock(&platform_handles_written, &bytes_written);
+    if (io_result == IO_SUCCEEDED) {
+      DCHECK(skip_completion_port_on_success_);
+
+      // We have finished writing successfully. Queue a notification manually.
+      io_handler_->OnPendingWriteStartedNoLock(platform_handles_written);
+      // |io_handler_| won't go away before that task is run, so it is safe to
+      // use |base::Unretained()|.
+      message_loop_for_io()->PostTask(
+          FROM_HERE,
+          base::Bind(&RawChannelIOHandler::OnIOCompleted,
+                     base::Unretained(io_handler_),
+                     base::Unretained(io_handler_->write_context_no_lock()),
+                     static_cast<DWORD>(bytes_written), ERROR_SUCCESS));
+      return IO_PENDING;
+    }
+
+    return io_result;
+  }
+
+  void OnInit() override {
+    DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+
+    if (!handle_.is_valid()) {
+      LOG(ERROR) << "Note: RawChannelWin " << this
+                 << " early exiting in OnInit because no handle";
+      return;
+    }
+
+    DCHECK(handle_.is_valid());
+    if (skip_completion_port_on_success_) {
+      // I don't know how this can fail (unless |handle_| is bad, in which case
+      // it's a bug in our code).
+      CHECK(g_vista_or_higher_functions.Get().
+          SetFileCompletionNotificationModes(
+              handle_.get().handle, FILE_SKIP_COMPLETION_PORT_ON_SUCCESS));
+    }
+
+    DCHECK(!io_handler_);
+    io_handler_ = new RawChannelIOHandler(this, handle_.Pass());
+  }
+
+  void OnShutdownNoLock(scoped_ptr<ReadBuffer> read_buffer,
+                        scoped_ptr<WriteBuffer> write_buffer) override {
+    // happens on shutdown if didn't call init when doing createduplicate
+    if (message_loop_for_io()) {
+      DCHECK_EQ(base::MessageLoop::current(), message_loop_for_io());
+    }
+
+    if (!io_handler_) {
+      // This is hit when creating a duplicate dispatcher since we don't call
+      // Init on it.
+      DCHECK_EQ(read_buffer->num_valid_bytes(), 0U);
+      DCHECK_EQ(write_buffer->queue_size(), 0U);
+      return;
+    }
+
+    if (io_handler_->pending_read() || io_handler_->pending_write_no_lock()) {
+      // |io_handler_| will be alive until pending read/write (if any)
+      // completes. Call |CancelIoEx()| or |CancelIo()| so that resources can be
+      // freed up as soon as possible.
+      // Note: |CancelIo()| only cancels read/write requests started from this
+      // thread.
+      if (g_vista_or_higher_functions.Get().is_vista_or_higher()) {
+        g_vista_or_higher_functions.Get().CancelIoEx(io_handler_->handle(),
+                                                     nullptr);
+      } else {
+        CancelIo(io_handler_->handle());
+      }
+    }
+
+    io_handler_->DetachFromOwnerNoLock(read_buffer.Pass(), write_buffer.Pass());
+    io_handler_ = nullptr;
+  }
+
+  // Passed to |io_handler_| during initialization.
+  ScopedPlatformHandle handle_;
+
+  RawChannelIOHandler* io_handler_;
+
+  const bool skip_completion_port_on_success_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(RawChannelWin);
+};
+
+
+}  // namespace
+
+// -----------------------------------------------------------------------------
+
+RawChannel* RawChannel::Create(ScopedPlatformHandle handle) {
+  return new RawChannelWin(handle.Pass());
+}
+
+size_t RawChannel::GetSerializedPlatformHandleSize() {
+  return sizeof(SerializedHandle);
+}
+
+bool RawChannel::IsOtherEndOf(RawChannel* other) {
+  DCHECK_NE(other, this);
+  PlatformHandle this_handle = HandleForDebuggingNoLock();
+  PlatformHandle other_handle = other->HandleForDebuggingNoLock();
+
+  if (g_vista_or_higher_functions.Get().is_vista_or_higher()) {
+    WCHAR data1[_MAX_PATH + sizeof(FILE_NAME_INFO)];
+    WCHAR data2[_MAX_PATH + sizeof(FILE_NAME_INFO)];
+    FILE_NAME_INFO* fileinfo1 = reinterpret_cast<FILE_NAME_INFO *>(data1);
+    FILE_NAME_INFO* fileinfo2 = reinterpret_cast<FILE_NAME_INFO *>(data2);
+    CHECK(g_vista_or_higher_functions.Get().GetFileInformationByHandleEx(
+        this_handle.handle, FileNameInfo, fileinfo1, arraysize(data1)));
+    CHECK(g_vista_or_higher_functions.Get().GetFileInformationByHandleEx(
+        other_handle.handle, FileNameInfo, fileinfo2, arraysize(data2)));
+    std::wstring filepath1(fileinfo1->FileName, fileinfo1->FileNameLength / 2);
+    std::wstring filepath2(fileinfo2->FileName, fileinfo2->FileNameLength / 2);
+    return filepath1 == filepath2;
+  } else {
+    // TODO: XP: see http://stackoverflow.com/questions/65170/how-to-get-name-associated-with-open-handle/5286888#5286888
+    CHECK(false) << "TODO(jam): handle XP";
+    return false;
+  }
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/run_all_unittests.cc b/mojo/edk/system/run_all_unittests.cc
new file mode 100644
index 0000000..b68f6e2
--- /dev/null
+++ b/mojo/edk/system/run_all_unittests.cc
@@ -0,0 +1,28 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/bind.h"
+#include "base/command_line.h"
+#include "base/test/launcher/unit_test_launcher.h"
+#include "base/test/test_suite.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+int main(int argc, char** argv) {
+// Silence death test thread warnings on Linux. We can afford to run our death
+// tests a little more slowly (< 10 ms per death test on a Z620).
+// On android, we need to run in the default mode, as the threadsafe mode
+// relies on execve which is not available.
+#if !defined(OS_ANDROID)
+  testing::GTEST_FLAG(death_test_style) = "threadsafe";
+#endif
+  mojo::edk::Init();
+  base::TestSuite test_suite(argc, argv);
+  // TODO(use_chrome_edk): temporary to force new EDK.
+  base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk");
+
+  return base::LaunchUnitTests(
+      argc, argv,
+      base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
+}
diff --git a/mojo/edk/system/shared_buffer_dispatcher.cc b/mojo/edk/system/shared_buffer_dispatcher.cc
new file mode 100644
index 0000000..bf68eb3f
--- /dev/null
+++ b/mojo/edk/system/shared_buffer_dispatcher.cc
@@ -0,0 +1,270 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/shared_buffer_dispatcher.h"
+
+#include <limits>
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/edk/embedder/embedder_internal.h"
+#include "mojo/edk/embedder/platform_support.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/options_validation.h"
+#include "mojo/public/c/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+namespace {
+
+struct MOJO_ALIGNAS(8) SerializedSharedBufferDispatcher {
+  size_t num_bytes;
+  size_t platform_handle_index;
+};
+
+}  // namespace
+
+// static
+const MojoCreateSharedBufferOptions
+    SharedBufferDispatcher::kDefaultCreateOptions = {
+        static_cast<uint32_t>(sizeof(MojoCreateSharedBufferOptions)),
+        MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE};
+
+// static
+MojoResult SharedBufferDispatcher::ValidateCreateOptions(
+    const MojoCreateSharedBufferOptions* in_options,
+    MojoCreateSharedBufferOptions* out_options) {
+  const MojoCreateSharedBufferOptionsFlags kKnownFlags =
+      MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE;
+
+  *out_options = kDefaultCreateOptions;
+  if (!in_options)
+    return MOJO_RESULT_OK;
+
+  UserOptionsReader<MojoCreateSharedBufferOptions> reader(in_options);
+  if (!reader.is_valid())
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  if (!OPTIONS_STRUCT_HAS_MEMBER(MojoCreateSharedBufferOptions, flags, reader))
+    return MOJO_RESULT_OK;
+  if ((reader.options().flags & ~kKnownFlags))
+    return MOJO_RESULT_UNIMPLEMENTED;
+  out_options->flags = reader.options().flags;
+
+  // Checks for fields beyond |flags|:
+
+  // (Nothing here yet.)
+
+  return MOJO_RESULT_OK;
+}
+
+// static
+MojoResult SharedBufferDispatcher::Create(
+    PlatformSupport* platform_support,
+    const MojoCreateSharedBufferOptions& /*validated_options*/,
+    uint64_t num_bytes,
+    scoped_refptr<SharedBufferDispatcher>* result) {
+  if (!num_bytes)
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  if (num_bytes > GetConfiguration().max_shared_memory_num_bytes)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+
+  scoped_refptr<PlatformSharedBuffer> shared_buffer(
+      platform_support->CreateSharedBuffer(static_cast<size_t>(num_bytes)));
+  if (!shared_buffer)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+
+  *result = CreateInternal(shared_buffer.Pass());
+  return MOJO_RESULT_OK;
+}
+
+Dispatcher::Type SharedBufferDispatcher::GetType() const {
+  return Type::SHARED_BUFFER;
+}
+
+// static
+scoped_refptr<SharedBufferDispatcher> SharedBufferDispatcher::Deserialize(
+    const void* source,
+    size_t size,
+    PlatformHandleVector* platform_handles) {
+
+  if (size != sizeof(SerializedSharedBufferDispatcher)) {
+    LOG(ERROR) << "Invalid serialized shared buffer dispatcher (bad size)";
+    return nullptr;
+  }
+
+  const SerializedSharedBufferDispatcher* serialization =
+      static_cast<const SerializedSharedBufferDispatcher*>(source);
+  size_t num_bytes = serialization->num_bytes;
+  size_t platform_handle_index = serialization->platform_handle_index;
+
+  if (!num_bytes) {
+    LOG(ERROR)
+        << "Invalid serialized shared buffer dispatcher (invalid num_bytes)";
+    return nullptr;
+  }
+
+  if (!platform_handles || platform_handle_index >= platform_handles->size()) {
+    LOG(ERROR)
+        << "Invalid serialized shared buffer dispatcher (missing handles)";
+    return nullptr;
+  }
+
+  // Starts off invalid, which is what we want.
+  PlatformHandle platform_handle;
+  // We take ownership of the handle, so we have to invalidate the one in
+  // |platform_handles|.
+  std::swap(platform_handle, (*platform_handles)[platform_handle_index]);
+
+  // Wrapping |platform_handle| in a |ScopedPlatformHandle| means that it'll be
+  // closed even if creation fails.
+  scoped_refptr<PlatformSharedBuffer> shared_buffer(
+      internal::g_platform_support->CreateSharedBufferFromHandle(
+          num_bytes, ScopedPlatformHandle(platform_handle)));
+  if (!shared_buffer) {
+    LOG(ERROR)
+        << "Invalid serialized shared buffer dispatcher (invalid num_bytes?)";
+    return nullptr;
+  }
+
+  return CreateInternal(shared_buffer.Pass());
+}
+
+SharedBufferDispatcher::SharedBufferDispatcher(
+    scoped_refptr<PlatformSharedBuffer> shared_buffer)
+    : shared_buffer_(shared_buffer) {
+  DCHECK(shared_buffer_);
+}
+
+SharedBufferDispatcher::~SharedBufferDispatcher() {
+}
+
+// static
+MojoResult SharedBufferDispatcher::ValidateDuplicateOptions(
+    const MojoDuplicateBufferHandleOptions* in_options,
+    MojoDuplicateBufferHandleOptions* out_options) {
+  const MojoDuplicateBufferHandleOptionsFlags kKnownFlags =
+      MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE;
+  static const MojoDuplicateBufferHandleOptions kDefaultOptions = {
+      static_cast<uint32_t>(sizeof(MojoDuplicateBufferHandleOptions)),
+      MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE};
+
+  *out_options = kDefaultOptions;
+  if (!in_options)
+    return MOJO_RESULT_OK;
+
+  UserOptionsReader<MojoDuplicateBufferHandleOptions> reader(in_options);
+  if (!reader.is_valid())
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  if (!OPTIONS_STRUCT_HAS_MEMBER(MojoDuplicateBufferHandleOptions, flags,
+                                 reader))
+    return MOJO_RESULT_OK;
+  if ((reader.options().flags & ~kKnownFlags))
+    return MOJO_RESULT_UNIMPLEMENTED;
+  out_options->flags = reader.options().flags;
+
+  // Checks for fields beyond |flags|:
+
+  // (Nothing here yet.)
+
+  return MOJO_RESULT_OK;
+}
+
+void SharedBufferDispatcher::CloseImplNoLock() {
+  lock().AssertAcquired();
+  DCHECK(shared_buffer_);
+  shared_buffer_ = nullptr;
+}
+
+scoped_refptr<Dispatcher>
+SharedBufferDispatcher::CreateEquivalentDispatcherAndCloseImplNoLock() {
+  lock().AssertAcquired();
+  DCHECK(shared_buffer_);
+  return CreateInternal(shared_buffer_.Pass());
+}
+
+MojoResult SharedBufferDispatcher::DuplicateBufferHandleImplNoLock(
+    const MojoDuplicateBufferHandleOptions* options,
+    scoped_refptr<Dispatcher>* new_dispatcher) {
+  lock().AssertAcquired();
+
+  MojoDuplicateBufferHandleOptions validated_options;
+  MojoResult result = ValidateDuplicateOptions(options, &validated_options);
+  if (result != MOJO_RESULT_OK)
+    return result;
+
+  // Note: Since this is "duplicate", we keep our ref to |shared_buffer_|.
+  *new_dispatcher = CreateInternal(shared_buffer_);
+  return MOJO_RESULT_OK;
+}
+
+MojoResult SharedBufferDispatcher::MapBufferImplNoLock(
+    uint64_t offset,
+    uint64_t num_bytes,
+    MojoMapBufferFlags flags,
+    scoped_ptr<PlatformSharedBufferMapping>* mapping) {
+  lock().AssertAcquired();
+  DCHECK(shared_buffer_);
+
+  if (offset > static_cast<uint64_t>(std::numeric_limits<size_t>::max()))
+    return MOJO_RESULT_INVALID_ARGUMENT;
+  if (num_bytes > static_cast<uint64_t>(std::numeric_limits<size_t>::max()))
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  if (!shared_buffer_->IsValidMap(static_cast<size_t>(offset),
+                                  static_cast<size_t>(num_bytes)))
+    return MOJO_RESULT_INVALID_ARGUMENT;
+
+  DCHECK(mapping);
+  *mapping = shared_buffer_->MapNoCheck(static_cast<size_t>(offset),
+                                        static_cast<size_t>(num_bytes));
+  if (!*mapping)
+    return MOJO_RESULT_RESOURCE_EXHAUSTED;
+
+  return MOJO_RESULT_OK;
+}
+
+void SharedBufferDispatcher::StartSerializeImplNoLock(
+    size_t* max_size,
+    size_t* max_platform_handles) {
+  DCHECK(HasOneRef());  // Only one ref => no need to take the lock.
+  *max_size = sizeof(SerializedSharedBufferDispatcher);
+  *max_platform_handles = 1;
+}
+
+bool SharedBufferDispatcher::EndSerializeAndCloseImplNoLock(
+    void* destination,
+    size_t* actual_size,
+    PlatformHandleVector* platform_handles) {
+  DCHECK(HasOneRef());  // Only one ref => no need to take the lock.
+  DCHECK(shared_buffer_);
+
+  SerializedSharedBufferDispatcher* serialization =
+      static_cast<SerializedSharedBufferDispatcher*>(destination);
+  // If there's only one reference to |shared_buffer_|, then it's ours (and no
+  // one else can make any more references to it), so we can just take its
+  // handle.
+  ScopedPlatformHandle platform_handle(
+      shared_buffer_->HasOneRef() ? shared_buffer_->PassPlatformHandle()
+                                  : shared_buffer_->DuplicatePlatformHandle());
+  if (!platform_handle.is_valid()) {
+    shared_buffer_ = nullptr;
+    return false;
+  }
+
+  serialization->num_bytes = shared_buffer_->GetNumBytes();
+  serialization->platform_handle_index = platform_handles->size();
+  platform_handles->push_back(platform_handle.release());
+  *actual_size = sizeof(SerializedSharedBufferDispatcher);
+
+  shared_buffer_ = nullptr;
+
+  return true;
+}
+
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/shared_buffer_dispatcher.h b/mojo/edk/system/shared_buffer_dispatcher.h
new file mode 100644
index 0000000..f3fc9e80c
--- /dev/null
+++ b/mojo/edk/system/shared_buffer_dispatcher.h
@@ -0,0 +1,104 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_
+#define MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_
+
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/system/simple_dispatcher.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+
+namespace edk {
+class PlatformSupport;
+
+// TODO(vtl): We derive from SimpleDispatcher, even though we don't currently
+// have anything that's waitable. I want to add a "transferrable" wait flag
+// (which would entail overriding |GetHandleSignalsStateImplNoLock()|, etc.).
+class MOJO_SYSTEM_IMPL_EXPORT SharedBufferDispatcher final
+    : public SimpleDispatcher {
+ public:
+  // The default options to use for |MojoCreateSharedBuffer()|. (Real uses
+  // should obtain this via |ValidateCreateOptions()| with a null |in_options|;
+  // this is exposed directly for testing convenience.)
+  static const MojoCreateSharedBufferOptions kDefaultCreateOptions;
+
+  // Validates and/or sets default options for |MojoCreateSharedBufferOptions|.
+  // If non-null, |in_options| must point to a struct of at least
+  // |in_options->struct_size| bytes. |out_options| must point to a (current)
+  // |MojoCreateSharedBufferOptions| and will be entirely overwritten on success
+  // (it may be partly overwritten on failure).
+  static MojoResult ValidateCreateOptions(
+      const MojoCreateSharedBufferOptions* in_options,
+      MojoCreateSharedBufferOptions* out_options);
+
+  // Static factory method: |validated_options| must be validated (obviously).
+  // On failure, |*result| will be left as-is.
+  // TODO(vtl): This should probably be made to return a scoped_refptr and have
+  // a MojoResult out parameter instead.
+  static MojoResult Create(
+      PlatformSupport* platform_support,
+      const MojoCreateSharedBufferOptions& validated_options,
+      uint64_t num_bytes,
+      scoped_refptr<SharedBufferDispatcher>* result);
+
+  // |Dispatcher| public methods:
+  Type GetType() const override;
+
+  // The "opposite" of |SerializeAndClose()|. (Typically this is called by
+  // |Dispatcher::Deserialize()|.)
+  static scoped_refptr<SharedBufferDispatcher> Deserialize(
+      const void* source,
+      size_t size,
+      PlatformHandleVector* platform_handles);
+
+ private:
+  static scoped_refptr<SharedBufferDispatcher> CreateInternal(
+      scoped_refptr<PlatformSharedBuffer> shared_buffer) {
+    return make_scoped_refptr(new SharedBufferDispatcher(shared_buffer.Pass()));
+  }
+
+  explicit SharedBufferDispatcher(
+      scoped_refptr<PlatformSharedBuffer> shared_buffer);
+  ~SharedBufferDispatcher() override;
+
+  // Validates and/or sets default options for
+  // |MojoDuplicateBufferHandleOptions|. If non-null, |in_options| must point to
+  // a struct of at least |in_options->struct_size| bytes. |out_options| must
+  // point to a (current) |MojoDuplicateBufferHandleOptions| and will be
+  // entirely overwritten on success (it may be partly overwritten on failure).
+  static MojoResult ValidateDuplicateOptions(
+      const MojoDuplicateBufferHandleOptions* in_options,
+      MojoDuplicateBufferHandleOptions* out_options);
+
+  // |Dispatcher| protected methods:
+  void CloseImplNoLock() override;
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
+      override;
+  MojoResult DuplicateBufferHandleImplNoLock(
+      const MojoDuplicateBufferHandleOptions* options,
+      scoped_refptr<Dispatcher>* new_dispatcher) override;
+  MojoResult MapBufferImplNoLock(
+      uint64_t offset,
+      uint64_t num_bytes,
+      MojoMapBufferFlags flags,
+      scoped_ptr<PlatformSharedBufferMapping>* mapping) override;
+  void StartSerializeImplNoLock(size_t* max_size,
+                                size_t* max_platform_handles) override;
+  bool EndSerializeAndCloseImplNoLock(
+      void* destination,
+      size_t* actual_size,
+      PlatformHandleVector* platform_handles) override;
+
+  scoped_refptr<PlatformSharedBuffer> shared_buffer_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcher);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_SHARED_BUFFER_DISPATCHER_H_
diff --git a/mojo/edk/system/shared_buffer_dispatcher_unittest.cc b/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
new file mode 100644
index 0000000..ceb936b
--- /dev/null
+++ b/mojo/edk/system/shared_buffer_dispatcher_unittest.cc
@@ -0,0 +1,277 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/shared_buffer_dispatcher.h"
+
+#include <limits>
+
+#include "base/memory/ref_counted.h"
+#include "mojo/edk/embedder/platform_shared_buffer.h"
+#include "mojo/edk/embedder/simple_platform_support.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+// NOTE(vtl): There's currently not much to test for in
+// |SharedBufferDispatcher::ValidateCreateOptions()|, but the tests should be
+// expanded if/when options are added, so I've kept the general form of the
+// tests from data_pipe_unittest.cc.
+
+const uint32_t kSizeOfCreateOptions = sizeof(MojoCreateSharedBufferOptions);
+
+// Does a cursory sanity check of |validated_options|. Calls
+// |ValidateCreateOptions()| on already-validated options. The validated options
+// should be valid, and the revalidated copy should be the same.
+void RevalidateCreateOptions(
+    const MojoCreateSharedBufferOptions& validated_options) {
+  EXPECT_EQ(kSizeOfCreateOptions, validated_options.struct_size);
+  // Nothing to check for flags.
+
+  MojoCreateSharedBufferOptions revalidated_options = {};
+  EXPECT_EQ(MOJO_RESULT_OK,
+            SharedBufferDispatcher::ValidateCreateOptions(
+                &validated_options, &revalidated_options));
+  EXPECT_EQ(validated_options.struct_size, revalidated_options.struct_size);
+  EXPECT_EQ(validated_options.flags, revalidated_options.flags);
+}
+
+class SharedBufferDispatcherTest : public testing::Test {
+ public:
+  SharedBufferDispatcherTest() {}
+  ~SharedBufferDispatcherTest() override {}
+
+  PlatformSupport* platform_support() { return &platform_support_; }
+
+ private:
+  SimplePlatformSupport platform_support_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(SharedBufferDispatcherTest);
+};
+
+// Tests valid inputs to |ValidateCreateOptions()|.
+TEST_F(SharedBufferDispatcherTest, ValidateCreateOptionsValid) {
+  // Default options.
+  {
+    MojoCreateSharedBufferOptions validated_options = {};
+    EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::ValidateCreateOptions(
+                                  nullptr, &validated_options));
+    RevalidateCreateOptions(validated_options);
+  }
+
+  // Different flags.
+  MojoCreateSharedBufferOptionsFlags flags_values[] = {
+      MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE};
+  for (size_t i = 0; i < MOJO_ARRAYSIZE(flags_values); i++) {
+    const MojoCreateSharedBufferOptionsFlags flags = flags_values[i];
+
+    // Different capacities (size 1).
+    for (uint32_t capacity = 1; capacity <= 100 * 1000 * 1000; capacity *= 10) {
+      MojoCreateSharedBufferOptions options = {
+          kSizeOfCreateOptions,  // |struct_size|.
+          flags                  // |flags|.
+      };
+      MojoCreateSharedBufferOptions validated_options = {};
+      EXPECT_EQ(MOJO_RESULT_OK,
+                SharedBufferDispatcher::ValidateCreateOptions(
+                    &options, &validated_options))
+          << capacity;
+      RevalidateCreateOptions(validated_options);
+      EXPECT_EQ(options.flags, validated_options.flags);
+    }
+  }
+}
+
+TEST_F(SharedBufferDispatcherTest, ValidateCreateOptionsInvalid) {
+  // Invalid |struct_size|.
+  {
+    MojoCreateSharedBufferOptions options = {
+        1,                                           // |struct_size|.
+        MOJO_CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE  // |flags|.
+    };
+    MojoCreateSharedBufferOptions unused;
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              SharedBufferDispatcher::ValidateCreateOptions(
+                  &options, &unused));
+  }
+
+  // Unknown |flags|.
+  {
+    MojoCreateSharedBufferOptions options = {
+        kSizeOfCreateOptions,  // |struct_size|.
+        ~0u                    // |flags|.
+    };
+    MojoCreateSharedBufferOptions unused;
+    EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+              SharedBufferDispatcher::ValidateCreateOptions(
+                  &options, &unused));
+  }
+}
+
+TEST_F(SharedBufferDispatcherTest, CreateAndMapBuffer) {
+  scoped_refptr<SharedBufferDispatcher> dispatcher;
+  EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::Create(
+                                platform_support(),
+                                SharedBufferDispatcher::kDefaultCreateOptions,
+                                100, &dispatcher));
+  ASSERT_TRUE(dispatcher);
+  EXPECT_EQ(Dispatcher::Type::SHARED_BUFFER, dispatcher->GetType());
+
+  // Make a couple of mappings.
+  scoped_ptr<PlatformSharedBufferMapping> mapping1;
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher->MapBuffer(
+                                0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping1));
+  ASSERT_TRUE(mapping1);
+  ASSERT_TRUE(mapping1->GetBase());
+  EXPECT_EQ(100u, mapping1->GetLength());
+  // Write something.
+  static_cast<char*>(mapping1->GetBase())[50] = 'x';
+
+  scoped_ptr<PlatformSharedBufferMapping> mapping2;
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher->MapBuffer(
+                                50, 50, MOJO_MAP_BUFFER_FLAG_NONE, &mapping2));
+  ASSERT_TRUE(mapping2);
+  ASSERT_TRUE(mapping2->GetBase());
+  EXPECT_EQ(50u, mapping2->GetLength());
+  EXPECT_EQ('x', static_cast<char*>(mapping2->GetBase())[0]);
+
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close());
+
+  // Check that we can still read/write to mappings after the dispatcher has
+  // gone away.
+  static_cast<char*>(mapping2->GetBase())[1] = 'y';
+  EXPECT_EQ('y', static_cast<char*>(mapping1->GetBase())[51]);
+}
+
+TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandle) {
+  scoped_refptr<SharedBufferDispatcher> dispatcher1;
+  EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::Create(
+                                platform_support(),
+                                SharedBufferDispatcher::kDefaultCreateOptions,
+                                100, &dispatcher1));
+
+  // Map and write something.
+  scoped_ptr<PlatformSharedBufferMapping> mapping;
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->MapBuffer(
+                                0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping));
+  static_cast<char*>(mapping->GetBase())[0] = 'x';
+  mapping.reset();
+
+  // Duplicate |dispatcher1| and then close it.
+  scoped_refptr<Dispatcher> dispatcher2;
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->DuplicateBufferHandle(
+                                nullptr, &dispatcher2));
+  ASSERT_TRUE(dispatcher2);
+  EXPECT_EQ(Dispatcher::Type::SHARED_BUFFER, dispatcher2->GetType());
+
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->Close());
+
+  // Map |dispatcher2| and read something.
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher2->MapBuffer(
+                                0, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping));
+  EXPECT_EQ('x', static_cast<char*>(mapping->GetBase())[0]);
+
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher2->Close());
+}
+
+TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandleOptionsValid) {
+  scoped_refptr<SharedBufferDispatcher> dispatcher1;
+  EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::Create(
+                                platform_support(),
+                                SharedBufferDispatcher::kDefaultCreateOptions,
+                                100, &dispatcher1));
+
+  MojoDuplicateBufferHandleOptions options[] = {
+      {sizeof(MojoDuplicateBufferHandleOptions),
+       MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE},
+      {sizeof(MojoDuplicateBufferHandleOptionsFlags), ~0u}};
+  for (size_t i = 0; i < MOJO_ARRAYSIZE(options); i++) {
+    scoped_refptr<Dispatcher> dispatcher2;
+    EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->DuplicateBufferHandle(
+                                  &options[i], &dispatcher2));
+    ASSERT_TRUE(dispatcher2);
+    EXPECT_EQ(Dispatcher::Type::SHARED_BUFFER, dispatcher2->GetType());
+    EXPECT_EQ(MOJO_RESULT_OK, dispatcher2->Close());
+  }
+
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->Close());
+}
+
+TEST_F(SharedBufferDispatcherTest, DuplicateBufferHandleOptionsInvalid) {
+  scoped_refptr<SharedBufferDispatcher> dispatcher1;
+  EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::Create(
+                                platform_support(),
+                                SharedBufferDispatcher::kDefaultCreateOptions,
+                                100, &dispatcher1));
+
+  // Invalid |struct_size|.
+  {
+    MojoDuplicateBufferHandleOptions options = {
+        1u, MOJO_DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE};
+    scoped_refptr<Dispatcher> dispatcher2;
+    EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+              dispatcher1->DuplicateBufferHandle(&options, &dispatcher2));
+    EXPECT_FALSE(dispatcher2);
+  }
+
+  // Unknown |flags|.
+  {
+    MojoDuplicateBufferHandleOptions options = {
+        sizeof(MojoDuplicateBufferHandleOptions), ~0u};
+    scoped_refptr<Dispatcher> dispatcher2;
+    EXPECT_EQ(MOJO_RESULT_UNIMPLEMENTED,
+              dispatcher1->DuplicateBufferHandle(&options, &dispatcher2));
+    EXPECT_FALSE(dispatcher2);
+  }
+
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher1->Close());
+}
+
+TEST_F(SharedBufferDispatcherTest, CreateInvalidNumBytes) {
+  // Size too big.
+  scoped_refptr<SharedBufferDispatcher> dispatcher;
+  EXPECT_EQ(
+      MOJO_RESULT_RESOURCE_EXHAUSTED,
+      SharedBufferDispatcher::Create(
+          platform_support(), SharedBufferDispatcher::kDefaultCreateOptions,
+          std::numeric_limits<uint64_t>::max(), &dispatcher));
+  EXPECT_FALSE(dispatcher);
+
+  // Zero size.
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            SharedBufferDispatcher::Create(
+                platform_support(),
+                SharedBufferDispatcher::kDefaultCreateOptions, 0, &dispatcher));
+  EXPECT_FALSE(dispatcher);
+}
+
+TEST_F(SharedBufferDispatcherTest, MapBufferInvalidArguments) {
+  scoped_refptr<SharedBufferDispatcher> dispatcher;
+  EXPECT_EQ(MOJO_RESULT_OK, SharedBufferDispatcher::Create(
+                                platform_support(),
+                                SharedBufferDispatcher::kDefaultCreateOptions,
+                                100, &dispatcher));
+
+  scoped_ptr<PlatformSharedBufferMapping> mapping;
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            dispatcher->MapBuffer(0, 101, MOJO_MAP_BUFFER_FLAG_NONE, &mapping));
+  EXPECT_FALSE(mapping);
+
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            dispatcher->MapBuffer(1, 100, MOJO_MAP_BUFFER_FLAG_NONE, &mapping));
+  EXPECT_FALSE(mapping);
+
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            dispatcher->MapBuffer(0, 0, MOJO_MAP_BUFFER_FLAG_NONE, &mapping));
+  EXPECT_FALSE(mapping);
+
+  EXPECT_EQ(MOJO_RESULT_OK, dispatcher->Close());
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/simple_dispatcher.cc b/mojo/edk/system/simple_dispatcher.cc
new file mode 100644
index 0000000..447fe2e
--- /dev/null
+++ b/mojo/edk/system/simple_dispatcher.cc
@@ -0,0 +1,61 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/simple_dispatcher.h"
+
+#include "base/logging.h"
+
+namespace mojo {
+namespace edk {
+
+SimpleDispatcher::SimpleDispatcher() {
+}
+
+SimpleDispatcher::~SimpleDispatcher() {
+}
+
+void SimpleDispatcher::HandleSignalsStateChangedNoLock() {
+  lock().AssertAcquired();
+  awakable_list_.AwakeForStateChange(GetHandleSignalsStateImplNoLock());
+}
+
+void SimpleDispatcher::CancelAllAwakablesNoLock() {
+  lock().AssertAcquired();
+  awakable_list_.CancelAll();
+}
+
+MojoResult SimpleDispatcher::AddAwakableImplNoLock(
+    Awakable* awakable,
+    MojoHandleSignals signals,
+    uint32_t context,
+    HandleSignalsState* signals_state) {
+  lock().AssertAcquired();
+
+  HandleSignalsState state(GetHandleSignalsStateImplNoLock());
+  if (state.satisfies(signals)) {
+    if (signals_state)
+      *signals_state = state;
+    return MOJO_RESULT_ALREADY_EXISTS;
+  }
+  if (!state.can_satisfy(signals)) {
+    if (signals_state)
+      *signals_state = state;
+    return MOJO_RESULT_FAILED_PRECONDITION;
+  }
+
+  awakable_list_.Add(awakable, signals, context);
+  return MOJO_RESULT_OK;
+}
+
+void SimpleDispatcher::RemoveAwakableImplNoLock(
+    Awakable* awakable,
+    HandleSignalsState* signals_state) {
+  lock().AssertAcquired();
+  awakable_list_.Remove(awakable);
+  if (signals_state)
+    *signals_state = GetHandleSignalsStateImplNoLock();
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/simple_dispatcher.h b/mojo/edk/system/simple_dispatcher.h
new file mode 100644
index 0000000..ccef564
--- /dev/null
+++ b/mojo/edk/system/simple_dispatcher.h
@@ -0,0 +1,51 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_SIMPLE_DISPATCHER_H_
+#define MOJO_EDK_SYSTEM_SIMPLE_DISPATCHER_H_
+
+#include <list>
+
+#include "mojo/edk/system/awakable_list.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// A base class for simple dispatchers. "Simple" means that there's a one-to-one
+// correspondence between handles and dispatchers (see the explanatory comment
+// in core.cc). This class implements the standard waiter-signalling mechanism
+// in that case.
+class MOJO_SYSTEM_IMPL_EXPORT SimpleDispatcher : public Dispatcher {
+ protected:
+  SimpleDispatcher();
+  ~SimpleDispatcher() override;
+
+  // To be called by subclasses when the state changes (so
+  // |GetHandleSignalsStateImplNoLock()| should be checked again). Must be
+  // called under lock.
+  void HandleSignalsStateChangedNoLock();
+
+  // |Dispatcher| protected methods:
+  void CancelAllAwakablesNoLock() override;
+  MojoResult AddAwakableImplNoLock(Awakable* awakable,
+                                   MojoHandleSignals signals,
+                                   uint32_t context,
+                                   HandleSignalsState* signals_state) override;
+  void RemoveAwakableImplNoLock(Awakable* awakable,
+                                HandleSignalsState* signals_state) override;
+
+ private:
+  // Protected by |lock()|:
+  AwakableList awakable_list_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(SimpleDispatcher);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_SIMPLE_DISPATCHER_H_
diff --git a/mojo/edk/system/simple_dispatcher_unittest.cc b/mojo/edk/system/simple_dispatcher_unittest.cc
new file mode 100644
index 0000000..7d7b9c2
--- /dev/null
+++ b/mojo/edk/system/simple_dispatcher_unittest.cc
@@ -0,0 +1,604 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a
+// heavily-loaded system). Sorry. |test::EpsilonDeadline()| may be increased to
+// increase tolerance and reduce observed flakiness (though doing so reduces the
+// meaningfulness of the test).
+
+#include "mojo/edk/system/simple_dispatcher.h"
+
+#include "base/logging.h"
+#include "base/memory/ref_counted.h"
+#include "base/memory/scoped_vector.h"
+#include "base/synchronization/lock.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/edk/system/waiter.h"
+#include "mojo/edk/system/waiter_test_utils.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+class MockSimpleDispatcher final : public SimpleDispatcher {
+ public:
+  MockSimpleDispatcher()
+      : state_(MOJO_HANDLE_SIGNAL_NONE,
+               MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE) {}
+
+  void SetSatisfiedSignals(MojoHandleSignals new_satisfied_signals) {
+    base::AutoLock locker(lock());
+
+    // Any new signals that are set should be satisfiable.
+    CHECK_EQ(new_satisfied_signals & ~state_.satisfied_signals,
+             new_satisfied_signals & ~state_.satisfied_signals &
+                 state_.satisfiable_signals);
+
+    if (new_satisfied_signals == state_.satisfied_signals)
+      return;
+
+    state_.satisfied_signals = new_satisfied_signals;
+    HandleSignalsStateChangedNoLock();
+  }
+
+  void SetSatisfiableSignals(MojoHandleSignals new_satisfiable_signals) {
+    base::AutoLock locker(lock());
+
+    // Satisfied implies satisfiable.
+    CHECK_EQ(new_satisfiable_signals & state_.satisfied_signals,
+             state_.satisfied_signals);
+
+    if (new_satisfiable_signals == state_.satisfiable_signals)
+      return;
+
+    state_.satisfiable_signals = new_satisfiable_signals;
+    HandleSignalsStateChangedNoLock();
+  }
+
+  Type GetType() const override { return Type::UNKNOWN; }
+
+ private:
+  friend class base::RefCountedThreadSafe<MockSimpleDispatcher>;
+  ~MockSimpleDispatcher() override {}
+
+  scoped_refptr<Dispatcher> CreateEquivalentDispatcherAndCloseImplNoLock()
+      override {
+    scoped_refptr<MockSimpleDispatcher> rv(new MockSimpleDispatcher());
+    rv->state_ = state_;
+    return scoped_refptr<Dispatcher>(rv.get());
+  }
+
+  // |Dispatcher| override:
+  HandleSignalsState GetHandleSignalsStateImplNoLock() const override {
+    lock().AssertAcquired();
+    return state_;
+  }
+
+  // Protected by |lock()|:
+  HandleSignalsState state_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MockSimpleDispatcher);
+};
+
+#if defined(OS_WIN)
+// http://crbug.com/396404
+#define MAYBE_Basic DISABLED_Basic
+#else
+#define MAYBE_Basic Basic
+#endif
+TEST(SimpleDispatcherTest, MAYBE_Basic) {
+  test::Stopwatch stopwatch;
+
+  scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+  Waiter w;
+  uint32_t context = 0;
+  HandleSignalsState hss;
+
+  // Try adding a readable waiter when already readable.
+  w.Init();
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  hss = HandleSignalsState();
+  EXPECT_EQ(MOJO_RESULT_ALREADY_EXISTS,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_READABLE, 0, &hss));
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+  // Shouldn't need to remove the waiter (it was not added).
+
+  // Wait (forever) for writable when already writable.
+  w.Init();
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 1, nullptr));
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_OK, w.Wait(MOJO_DEADLINE_INDEFINITE, &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(1u, context);
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+
+  // Wait for zero time for writable when already writable.
+  w.Init();
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, nullptr));
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_OK, w.Wait(0, &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(2u, context);
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+
+  // Wait for non-zero, finite time for writable when already writable.
+  w.Init();
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, nullptr));
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_OK, w.Wait(2 * test::EpsilonDeadline(), &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(3u, context);
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+
+  // Wait for zero time for writable when not writable (will time out).
+  w.Init();
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, nullptr));
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, w.Wait(0, nullptr));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+
+  // Wait for non-zero, finite time for writable when not writable (will time
+  // out).
+  w.Init();
+  d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 5, nullptr));
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            w.Wait(2 * test::EpsilonDeadline(), nullptr));
+  MojoDeadline elapsed = stopwatch.Elapsed();
+  EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+  EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+
+  EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+}
+
+TEST(SimpleDispatcherTest, BasicUnsatisfiable) {
+  test::Stopwatch stopwatch;
+
+  scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+  Waiter w;
+  uint32_t context = 0;
+  HandleSignalsState hss;
+
+  // Try adding a writable waiter when it can never be writable.
+  w.Init();
+  d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  d->SetSatisfiedSignals(0);
+  hss = HandleSignalsState();
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 1, &hss));
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
+  // Shouldn't need to remove the waiter (it was not added).
+
+  // Wait (forever) for writable and then it becomes never writable.
+  w.Init();
+  d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE |
+                           MOJO_HANDLE_SIGNAL_WRITABLE);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, nullptr));
+  d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            w.Wait(MOJO_DEADLINE_INDEFINITE, &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(2u, context);
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
+
+  // Wait for zero time for writable and then it becomes never writable.
+  w.Init();
+  d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE |
+                           MOJO_HANDLE_SIGNAL_WRITABLE);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, nullptr));
+  d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, w.Wait(0, &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(3u, context);
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
+
+  // Wait for non-zero, finite time for writable and then it becomes never
+  // writable.
+  w.Init();
+  d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE |
+                           MOJO_HANDLE_SIGNAL_WRITABLE);
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, nullptr));
+  d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
+            w.Wait(2 * test::EpsilonDeadline(), &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(4u, context);
+  hss = HandleSignalsState();
+  d->RemoveAwakable(&w, &hss);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfiable_signals);
+
+  EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+}
+
+TEST(SimpleDispatcherTest, BasicClosed) {
+  test::Stopwatch stopwatch;
+
+  scoped_refptr<MockSimpleDispatcher> d;
+  Waiter w;
+  uint32_t context = 0;
+  HandleSignalsState hss;
+
+  // Try adding a writable waiter when the dispatcher has been closed.
+  d = new MockSimpleDispatcher();
+  w.Init();
+  EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  hss = HandleSignalsState();
+  EXPECT_EQ(MOJO_RESULT_INVALID_ARGUMENT,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 1, &hss));
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+  // Shouldn't need to remove the waiter (it was not added).
+
+  // Wait (forever) for writable and then the dispatcher is closed.
+  d = new MockSimpleDispatcher();
+  w.Init();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 2, nullptr));
+  EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, w.Wait(MOJO_DEADLINE_INDEFINITE, &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(2u, context);
+  // Don't need to remove waiters from closed dispatchers.
+
+  // Wait for zero time for writable and then the dispatcher is closed.
+  d = new MockSimpleDispatcher();
+  w.Init();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 3, nullptr));
+  EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, w.Wait(0, &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(3u, context);
+  // Don't need to remove waiters from closed dispatchers.
+
+  // Wait for non-zero, finite time for writable and then the dispatcher is
+  // closed.
+  d = new MockSimpleDispatcher();
+  w.Init();
+  ASSERT_EQ(MOJO_RESULT_OK,
+            d->AddAwakable(&w, MOJO_HANDLE_SIGNAL_WRITABLE, 4, nullptr));
+  EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_CANCELLED,
+            w.Wait(2 * test::EpsilonDeadline(), &context));
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_EQ(4u, context);
+  // Don't need to remove waiters from closed dispatchers.
+}
+
+#if defined(OS_WIN)
+// http://crbug.com/396393
+#define MAYBE_BasicThreaded DISABLED_BasicThreaded
+#else
+#define MAYBE_BasicThreaded BasicThreaded
+#endif
+TEST(SimpleDispatcherTest, MAYBE_BasicThreaded) {
+  test::Stopwatch stopwatch;
+  bool did_wait;
+  MojoResult result;
+  uint32_t context;
+  HandleSignalsState hss;
+
+  // Wait for readable (already readable).
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    {
+      d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+      test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
+                                MOJO_DEADLINE_INDEFINITE, 1, &did_wait, &result,
+                                &context, &hss);
+      stopwatch.Start();
+      thread.Start();
+    }  // Joins the thread.
+    // If we closed earlier, then probably we'd get a |MOJO_RESULT_CANCELLED|.
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }
+  EXPECT_LT(stopwatch.Elapsed(), test::EpsilonDeadline());
+  EXPECT_FALSE(did_wait);
+  EXPECT_EQ(MOJO_RESULT_ALREADY_EXISTS, result);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+
+  // Wait for readable and becomes readable after some time.
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    {
+      test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
+                                MOJO_DEADLINE_INDEFINITE, 2, &did_wait, &result,
+                                &context, &hss);
+      stopwatch.Start();
+      thread.Start();
+      test::Sleep(2 * test::EpsilonDeadline());
+      d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+    }  // Joins the thread.
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }
+  MojoDeadline elapsed = stopwatch.Elapsed();
+  EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+  EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  EXPECT_TRUE(did_wait);
+  EXPECT_EQ(MOJO_RESULT_OK, result);
+  EXPECT_EQ(2u, context);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+
+  // Wait for readable and becomes never-readable after some time.
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    {
+      test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
+                                MOJO_DEADLINE_INDEFINITE, 3, &did_wait, &result,
+                                &context, &hss);
+      stopwatch.Start();
+      thread.Start();
+      test::Sleep(2 * test::EpsilonDeadline());
+      d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_NONE);
+    }  // Joins the thread.
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }
+  elapsed = stopwatch.Elapsed();
+  EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+  EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  EXPECT_TRUE(did_wait);
+  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
+  EXPECT_EQ(3u, context);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+
+  // Wait for readable and dispatcher gets closed.
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
+                              MOJO_DEADLINE_INDEFINITE, 4, &did_wait, &result,
+                              &context, &hss);
+    stopwatch.Start();
+    thread.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }  // Joins the thread.
+  elapsed = stopwatch.Elapsed();
+  EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+  EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  EXPECT_TRUE(did_wait);
+  EXPECT_EQ(MOJO_RESULT_CANCELLED, result);
+  EXPECT_EQ(4u, context);
+  EXPECT_EQ(0u, hss.satisfied_signals);
+  EXPECT_EQ(0u, hss.satisfiable_signals);
+
+  // Wait for readable and times out.
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    {
+      test::WaiterThread thread(d, MOJO_HANDLE_SIGNAL_READABLE,
+                                2 * test::EpsilonDeadline(), 5, &did_wait,
+                                &result, &context, &hss);
+      stopwatch.Start();
+      thread.Start();
+      test::Sleep(1 * test::EpsilonDeadline());
+      // Not what we're waiting for.
+      d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_WRITABLE);
+    }  // Joins the thread (after its wait times out).
+    // If we closed earlier, then probably we'd get a |MOJO_RESULT_CANCELLED|.
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }
+  elapsed = stopwatch.Elapsed();
+  EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+  EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  EXPECT_TRUE(did_wait);
+  EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, result);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, hss.satisfied_signals);
+  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE,
+            hss.satisfiable_signals);
+}
+
+#if defined(OS_WIN)
+// http://crbug.com/387124
+#define MAYBE_MultipleWaiters DISABLED_MultipleWaiters
+#else
+#define MAYBE_MultipleWaiters MultipleWaiters
+#endif
+TEST(SimpleDispatcherTest, MAYBE_MultipleWaiters) {
+  static const uint32_t kNumWaiters = 20;
+
+  bool did_wait[kNumWaiters];
+  MojoResult result[kNumWaiters];
+  uint32_t context[kNumWaiters];
+  HandleSignalsState hss[kNumWaiters];
+
+  // All wait for readable and becomes readable after some time.
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    ScopedVector<test::WaiterThread> threads;
+    for (uint32_t i = 0; i < kNumWaiters; i++) {
+      threads.push_back(new test::WaiterThread(
+          d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i,
+          &did_wait[i], &result[i], &context[i], &hss[i]));
+      threads.back()->Start();
+    }
+    test::Sleep(2 * test::EpsilonDeadline());
+    d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }  // Joins the threads.
+  for (uint32_t i = 0; i < kNumWaiters; i++) {
+    EXPECT_TRUE(did_wait[i]) << i;
+    EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i;
+    EXPECT_EQ(i, context[i]) << i;
+    // Since we closed before joining, we can't say much about what each thread
+    // saw as the state.
+  }
+
+  // Some wait for readable, some for writable, and becomes readable after some
+  // time.
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    ScopedVector<test::WaiterThread> threads;
+    for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
+      threads.push_back(new test::WaiterThread(
+          d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i,
+          &did_wait[i], &result[i], &context[i], &hss[i]));
+      threads.back()->Start();
+    }
+    for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
+      threads.push_back(new test::WaiterThread(
+          d, MOJO_HANDLE_SIGNAL_WRITABLE, MOJO_DEADLINE_INDEFINITE, i,
+          &did_wait[i], &result[i], &context[i], &hss[i]));
+      threads.back()->Start();
+    }
+    test::Sleep(2 * test::EpsilonDeadline());
+    d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+    // This will wake up the ones waiting to write.
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }  // Joins the threads.
+  for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
+    EXPECT_TRUE(did_wait[i]) << i;
+    EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i;
+    EXPECT_EQ(i, context[i]) << i;
+    // Since we closed before joining, we can't say much about what each thread
+    // saw as the state.
+  }
+  for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
+    EXPECT_TRUE(did_wait[i]) << i;
+    EXPECT_EQ(MOJO_RESULT_CANCELLED, result[i]) << i;
+    EXPECT_EQ(i, context[i]) << i;
+    // Since we closed before joining, we can't say much about what each thread
+    // saw as the state.
+  }
+
+  // Some wait for readable, some for writable, and becomes readable and
+  // never-writable after some time.
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    ScopedVector<test::WaiterThread> threads;
+    for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
+      threads.push_back(new test::WaiterThread(
+          d, MOJO_HANDLE_SIGNAL_READABLE, MOJO_DEADLINE_INDEFINITE, i,
+          &did_wait[i], &result[i], &context[i], &hss[i]));
+      threads.back()->Start();
+    }
+    for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
+      threads.push_back(new test::WaiterThread(
+          d, MOJO_HANDLE_SIGNAL_WRITABLE, MOJO_DEADLINE_INDEFINITE, i,
+          &did_wait[i], &result[i], &context[i], &hss[i]));
+      threads.back()->Start();
+    }
+    test::Sleep(1 * test::EpsilonDeadline());
+    d->SetSatisfiableSignals(MOJO_HANDLE_SIGNAL_READABLE);
+    test::Sleep(1 * test::EpsilonDeadline());
+    d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }  // Joins the threads.
+  for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
+    EXPECT_TRUE(did_wait[i]) << i;
+    EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i;
+    EXPECT_EQ(i, context[i]) << i;
+    // Since we closed before joining, we can't say much about what each thread
+    // saw as the state.
+  }
+  for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
+    EXPECT_TRUE(did_wait[i]) << i;
+    EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result[i]) << i;
+    EXPECT_EQ(i, context[i]) << i;
+    // Since we closed before joining, we can't say much about what each thread
+    // saw as the state.
+  }
+
+  // Some wait for readable, some for writable, and becomes readable after some
+  // time.
+  {
+    scoped_refptr<MockSimpleDispatcher> d(new MockSimpleDispatcher());
+    ScopedVector<test::WaiterThread> threads;
+    for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
+      threads.push_back(new test::WaiterThread(
+          d, MOJO_HANDLE_SIGNAL_READABLE, 3 * test::EpsilonDeadline(), i,
+          &did_wait[i], &result[i], &context[i], &hss[i]));
+      threads.back()->Start();
+    }
+    for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
+      threads.push_back(new test::WaiterThread(
+          d, MOJO_HANDLE_SIGNAL_WRITABLE, 1 * test::EpsilonDeadline(), i,
+          &did_wait[i], &result[i], &context[i], &hss[i]));
+      threads.back()->Start();
+    }
+    test::Sleep(2 * test::EpsilonDeadline());
+    d->SetSatisfiedSignals(MOJO_HANDLE_SIGNAL_READABLE);
+    // All those waiting for writable should have timed out.
+    EXPECT_EQ(MOJO_RESULT_OK, d->Close());
+  }  // Joins the threads.
+  for (uint32_t i = 0; i < kNumWaiters / 2; i++) {
+    EXPECT_TRUE(did_wait[i]) << i;
+    EXPECT_EQ(MOJO_RESULT_OK, result[i]) << i;
+    EXPECT_EQ(i, context[i]) << i;
+    // Since we closed before joining, we can't say much about what each thread
+    // saw as the state.
+  }
+  for (uint32_t i = kNumWaiters / 2; i < kNumWaiters; i++) {
+    EXPECT_TRUE(did_wait[i]) << i;
+    EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, result[i]) << i;
+    // Since we closed before joining, we can't say much about what each thread
+    // saw as the state.
+  }
+}
+
+// TODO(vtl): Stress test?
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/system_impl_export.h b/mojo/edk/system/system_impl_export.h
new file mode 100644
index 0000000..5bbf005
--- /dev/null
+++ b/mojo/edk/system/system_impl_export.h
@@ -0,0 +1,29 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_SYSTEM_IMPL_EXPORT_H_
+#define MOJO_EDK_SYSTEM_SYSTEM_IMPL_EXPORT_H_
+
+#if defined(COMPONENT_BUILD)
+#if defined(WIN32)
+
+#if defined(MOJO_SYSTEM_IMPL_IMPLEMENTATION)
+#define MOJO_SYSTEM_IMPL_EXPORT __declspec(dllexport)
+#else
+#define MOJO_SYSTEM_IMPL_EXPORT __declspec(dllimport)
+#endif  // defined(MOJO_SYSTEM_IMPL_IMPLEMENTATION)
+
+#else  // defined(WIN32)
+#if defined(MOJO_SYSTEM_IMPL_IMPLEMENTATION)
+#define MOJO_SYSTEM_IMPL_EXPORT __attribute__((visibility("default")))
+#else
+#define MOJO_SYSTEM_IMPL_EXPORT
+#endif
+#endif
+
+#else  // defined(COMPONENT_BUILD)
+#define MOJO_SYSTEM_IMPL_EXPORT
+#endif
+
+#endif  // MOJO_EDK_SYSTEM_SYSTEM_IMPL_EXPORT_H_
diff --git a/mojo/edk/system/test_utils.cc b/mojo/edk/system/test_utils.cc
new file mode 100644
index 0000000..49e346b
--- /dev/null
+++ b/mojo/edk/system/test_utils.cc
@@ -0,0 +1,83 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/test_utils.h"
+
+#include <limits>
+
+#include "base/logging.h"
+#include "base/test/test_timeouts.h"
+#include "base/threading/platform_thread.h"  // For |Sleep()|.
+#include "build/build_config.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+MojoDeadline DeadlineFromMilliseconds(unsigned milliseconds) {
+  return static_cast<MojoDeadline>(milliseconds) * 1000;
+}
+
+MojoDeadline EpsilonDeadline() {
+// Originally, our epsilon timeout was 10 ms, which was mostly fine but flaky on
+// some Windows bots. I don't recall ever seeing flakes on other bots. At 30 ms
+// tests seem reliable on Windows bots, but not at 25 ms. We'd like this timeout
+// to be as small as possible (see the description in the .h file).
+//
+// Currently, |tiny_timeout()| is usually 100 ms (possibly scaled under ASAN,
+// etc.). Based on this, set it to (usually be) 30 ms on Windows and 20 ms
+// elsewhere.
+#if defined(OS_WIN) || defined(OS_ANDROID)
+  return (TinyDeadline() * 3) / 10;
+#else
+  return (TinyDeadline() * 2) / 10;
+#endif
+}
+
+MojoDeadline TinyDeadline() {
+  return static_cast<MojoDeadline>(
+      TestTimeouts::tiny_timeout().InMicroseconds());
+}
+
+MojoDeadline ActionDeadline() {
+  return static_cast<MojoDeadline>(
+      TestTimeouts::action_timeout().InMicroseconds());
+}
+
+void Sleep(MojoDeadline deadline) {
+  CHECK_LE(deadline,
+           static_cast<MojoDeadline>(std::numeric_limits<int64_t>::max()));
+  base::PlatformThread::Sleep(
+      base::TimeDelta::FromMicroseconds(static_cast<int64_t>(deadline)));
+}
+
+Stopwatch::Stopwatch() {
+}
+
+Stopwatch::~Stopwatch() {
+}
+
+void Stopwatch::Start() {
+  start_time_ = base::TimeTicks::Now();
+}
+
+MojoDeadline Stopwatch::Elapsed() {
+  int64_t result = (base::TimeTicks::Now() - start_time_).InMicroseconds();
+  // |DCHECK_GE|, not |CHECK_GE|, since this may be performance-important.
+  DCHECK_GE(result, 0);
+  return static_cast<MojoDeadline>(result);
+}
+
+
+MojoSystemTest::MojoSystemTest()
+    : test_io_thread_(base::TestIOThread::kAutoStart),
+      ipc_support_(test_io_thread_.task_runner()) {
+}
+
+MojoSystemTest::~MojoSystemTest() {
+}
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/test_utils.h b/mojo/edk/system/test_utils.h
new file mode 100644
index 0000000..cf244b3
--- /dev/null
+++ b/mojo/edk/system/test_utils.h
@@ -0,0 +1,78 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_TEST_UTILS_H_
+#define MOJO_EDK_SYSTEM_TEST_UTILS_H_
+
+#include "base/test/test_io_thread.h"
+#include "base/time/time.h"
+#include "mojo/edk/test/scoped_ipc_support.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+MojoDeadline DeadlineFromMilliseconds(unsigned milliseconds);
+
+// A timeout smaller than |TestTimeouts::tiny_timeout()|, as a |MojoDeadline|.
+// Warning: This may lead to flakiness, but this is unavoidable if, e.g., you're
+// trying to ensure that functions with timeouts are reasonably accurate. We
+// want this to be as small as possible without causing too much flakiness.
+MojoDeadline EpsilonDeadline();
+
+// |TestTimeouts::tiny_timeout()|, as a |MojoDeadline|. (Expect this to be on
+// the order of 100 ms.)
+MojoDeadline TinyDeadline();
+
+// |TestTimeouts::action_timeout()|, as a |MojoDeadline|. (Expect this to be on
+// the order of 10 s.)
+MojoDeadline ActionDeadline();
+
+// Sleeps for at least the specified duration.
+void Sleep(MojoDeadline deadline);
+
+// Stopwatch -------------------------------------------------------------------
+
+// A simple "stopwatch" for measuring time elapsed from a given starting point.
+class Stopwatch {
+ public:
+  Stopwatch();
+  ~Stopwatch();
+
+  void Start();
+  // Returns the amount of time elapsed since the last call to |Start()| (in
+  // microseconds).
+  MojoDeadline Elapsed();
+
+ private:
+  base::TimeTicks start_time_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(Stopwatch);
+};
+
+// A base class which initializes and shuts down the necessary objects so that
+// Mojo system calls can be made.
+class MojoSystemTest : public testing::Test {
+ public:
+  MojoSystemTest();
+  ~MojoSystemTest() override;
+
+  base::TestIOThread* test_io_thread() { return &test_io_thread_; }
+
+ private:
+  base::MessageLoop message_loop_;
+  base::TestIOThread test_io_thread_;
+  test::ScopedIPCSupport ipc_support_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MojoSystemTest);
+};
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_TEST_UTILS_H_
diff --git a/mojo/edk/system/transport_data.cc b/mojo/edk/system/transport_data.cc
new file mode 100644
index 0000000..d751511
--- /dev/null
+++ b/mojo/edk/system/transport_data.cc
@@ -0,0 +1,336 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/transport_data.h"
+
+#include "base/logging.h"
+#include "mojo/edk/system/configuration.h"
+#include "mojo/edk/system/message_in_transit.h"
+#include "mojo/edk/system/raw_channel.h"
+
+namespace mojo {
+namespace edk {
+
+// The maximum amount of space needed per platform handle.
+// (|{Channel,RawChannel}::GetSerializedPlatformHandleSize()| should always
+// return a value which is at most this. This is only used to calculate
+// |TransportData::kMaxBufferSize|. This value should be a multiple of the
+// alignment in order to simplify calculations, even though the actual amount of
+// space needed need not be a multiple of the alignment.
+const size_t kMaxSizePerPlatformHandle = 16;
+static_assert(kMaxSizePerPlatformHandle % MessageInTransit::kMessageAlignment ==
+                  0,
+              "kMaxSizePerPlatformHandle not a multiple of alignment");
+
+MOJO_STATIC_CONST_MEMBER_DEFINITION const size_t
+    TransportData::kMaxSerializedDispatcherSize;
+MOJO_STATIC_CONST_MEMBER_DEFINITION const size_t
+    TransportData::kMaxSerializedDispatcherPlatformHandles;
+
+// static
+size_t TransportData::GetMaxBufferSize() {
+  // In additional to the header, for each attached (Mojo) handle there'll be a
+  // handle table entry and serialized dispatcher data.
+  return sizeof(Header) +
+         GetConfiguration().max_message_num_handles *
+             (sizeof(HandleTableEntry) + kMaxSerializedDispatcherSize) +
+         GetMaxPlatformHandles() * kMaxSizePerPlatformHandle;
+}
+
+// static
+size_t TransportData::GetMaxPlatformHandles() {
+  return GetConfiguration().max_message_num_handles *
+         kMaxSerializedDispatcherPlatformHandles;
+}
+
+struct TransportData::PrivateStructForCompileAsserts {
+  static_assert(sizeof(Header) % MessageInTransit::kMessageAlignment == 0,
+                "sizeof(MessageInTransit::Header) not a multiple of alignment");
+  static_assert(kMaxSerializedDispatcherSize %
+                        MessageInTransit::kMessageAlignment ==
+                    0,
+                "kMaxSerializedDispatcherSize not a multiple of alignment");
+  static_assert(sizeof(HandleTableEntry) %
+                        MessageInTransit::kMessageAlignment ==
+                    0,
+                "sizeof(MessageInTransit::HandleTableEntry) not a multiple of "
+                "alignment");
+};
+
+TransportData::TransportData(scoped_ptr<DispatcherVector> dispatchers)
+    : buffer_size_() {
+  DCHECK(dispatchers);
+
+  const size_t num_handles = dispatchers->size();
+  DCHECK_GT(num_handles, 0u);
+
+  // The offset to the start of the (Mojo) handle table.
+  const size_t handle_table_start_offset = sizeof(Header);
+  // The offset to the start of the serialized dispatcher data.
+  const size_t serialized_dispatcher_start_offset =
+      handle_table_start_offset + num_handles * sizeof(HandleTableEntry);
+  // The estimated size of the secondary buffer. We compute this estimate below.
+  // It must be at least as big as the (eventual) actual size.
+  size_t estimated_size = serialized_dispatcher_start_offset;
+  size_t estimated_num_platform_handles = 0;
+#if DCHECK_IS_ON()
+  std::vector<size_t> all_max_sizes(num_handles);
+  std::vector<size_t> all_max_platform_handles(num_handles);
+#endif
+  for (size_t i = 0; i < num_handles; i++) {
+    if (Dispatcher* dispatcher = (*dispatchers)[i].get()) {
+      size_t max_size = 0;
+      size_t max_platform_handles = 0;
+      Dispatcher::TransportDataAccess::StartSerialize(
+          dispatcher, &max_size, &max_platform_handles);
+
+      DCHECK_LE(max_size, kMaxSerializedDispatcherSize);
+      estimated_size += MessageInTransit::RoundUpMessageAlignment(max_size);
+      DCHECK_LE(estimated_size, GetMaxBufferSize());
+
+      DCHECK_LE(max_platform_handles, kMaxSerializedDispatcherPlatformHandles);
+      estimated_num_platform_handles += max_platform_handles;
+      DCHECK_LE(estimated_num_platform_handles, GetMaxPlatformHandles());
+
+#if DCHECK_IS_ON()
+      all_max_sizes[i] = max_size;
+      all_max_platform_handles[i] = max_platform_handles;
+#endif
+    }
+  }
+
+  size_t size_per_platform_handle = 0;
+  if (estimated_num_platform_handles > 0) {
+    size_per_platform_handle = RawChannel::GetSerializedPlatformHandleSize();
+    DCHECK_LE(size_per_platform_handle, kMaxSizePerPlatformHandle);
+    estimated_size += estimated_num_platform_handles * size_per_platform_handle;
+    estimated_size = MessageInTransit::RoundUpMessageAlignment(estimated_size);
+    DCHECK_LE(estimated_size, GetMaxBufferSize());
+  }
+
+  buffer_.reset(static_cast<char*>(
+      base::AlignedAlloc(estimated_size, MessageInTransit::kMessageAlignment)));
+  // Entirely clear out the secondary buffer, since then we won't have to worry
+  // about clearing padding or unused space (e.g., if a dispatcher fails to
+  // serialize).
+  memset(buffer_.get(), 0, estimated_size);
+
+  if (estimated_num_platform_handles > 0) {
+    DCHECK(!platform_handles_);
+    platform_handles_.reset(new PlatformHandleVector());
+  }
+
+  Header* header = reinterpret_cast<Header*>(buffer_.get());
+  header->num_handles = static_cast<uint32_t>(num_handles);
+  // (Okay to leave |platform_handle_table_offset|, |num_platform_handles|, and
+  // |unused| be zero; we'll set the former two later if necessary.)
+
+  HandleTableEntry* handle_table = reinterpret_cast<HandleTableEntry*>(
+      buffer_.get() + handle_table_start_offset);
+  size_t current_offset = serialized_dispatcher_start_offset;
+  for (size_t i = 0; i < num_handles; i++) {
+    Dispatcher* dispatcher = (*dispatchers)[i].get();
+    if (!dispatcher) {
+      static_assert(static_cast<int32_t>(Dispatcher::Type::UNKNOWN) == 0,
+                    "Value of Dispatcher::Type::UNKNOWN must be 0");
+      continue;
+    }
+
+#if DCHECK_IS_ON()
+    size_t old_platform_handles_size =
+        platform_handles_ ? platform_handles_->size() : 0;
+#endif
+
+    void* destination = buffer_.get() + current_offset;
+    size_t actual_size = 0;
+    if (Dispatcher::TransportDataAccess::EndSerializeAndClose(
+            dispatcher, destination, &actual_size,
+            platform_handles_.get())) {
+      handle_table[i].type = static_cast<int32_t>(dispatcher->GetType());
+      handle_table[i].offset = static_cast<uint32_t>(current_offset);
+      handle_table[i].size = static_cast<uint32_t>(actual_size);
+// (Okay to not set |unused| since we cleared the entire buffer.)
+
+#if DCHECK_IS_ON()
+      DCHECK_LE(actual_size, all_max_sizes[i]);
+      DCHECK_LE(platform_handles_
+                    ? (platform_handles_->size() - old_platform_handles_size)
+                    : 0,
+                all_max_platform_handles[i]);
+#endif
+    } else {
+      // Nothing to do on failure, since |buffer_| was cleared, and
+      // |Type::UNKNOWN| is zero. The handle was simply closed.
+      LOG(ERROR) << "Failed to serialize handle to remote message pipe";
+    }
+
+    current_offset += MessageInTransit::RoundUpMessageAlignment(actual_size);
+    DCHECK_LE(current_offset, estimated_size);
+    DCHECK_LE(platform_handles_ ? platform_handles_->size() : 0,
+              estimated_num_platform_handles);
+  }
+
+  if (platform_handles_ && platform_handles_->size() > 0) {
+    header->platform_handle_table_offset =
+        static_cast<uint32_t>(current_offset);
+    header->num_platform_handles =
+        static_cast<uint32_t>(platform_handles_->size());
+    current_offset += platform_handles_->size() * size_per_platform_handle;
+    current_offset = MessageInTransit::RoundUpMessageAlignment(current_offset);
+  }
+
+  // There's no aligned realloc, so it's no good way to release unused space (if
+  // we overshot our estimated space requirements).
+  buffer_size_ = current_offset;
+
+  // |dispatchers_| will be destroyed as it goes out of scope.
+}
+
+TransportData::TransportData(
+    ScopedPlatformHandleVectorPtr platform_handles,
+    size_t serialized_platform_handle_size)
+    : buffer_size_(), platform_handles_(platform_handles.Pass()) {
+  buffer_size_ = MessageInTransit::RoundUpMessageAlignment(
+      sizeof(Header) +
+      platform_handles_->size() * serialized_platform_handle_size);
+  buffer_.reset(static_cast<char*>(
+      base::AlignedAlloc(buffer_size_, MessageInTransit::kMessageAlignment)));
+  memset(buffer_.get(), 0, buffer_size_);
+
+  Header* header = reinterpret_cast<Header*>(buffer_.get());
+  header->platform_handle_table_offset = static_cast<uint32_t>(sizeof(Header));
+  header->num_platform_handles =
+      static_cast<uint32_t>(platform_handles_->size());
+}
+
+TransportData::~TransportData() {
+}
+
+// static
+const char* TransportData::ValidateBuffer(
+    size_t serialized_platform_handle_size,
+    const void* buffer,
+    size_t buffer_size) {
+  DCHECK(buffer);
+  DCHECK_GT(buffer_size, 0u);
+
+  // Always make sure that the buffer size is sane; if it's not, someone's
+  // messing with us.
+  if (buffer_size < sizeof(Header) || buffer_size > GetMaxBufferSize() ||
+      buffer_size % MessageInTransit::kMessageAlignment != 0)
+    return "Invalid message secondary buffer size";
+
+  const Header* header = static_cast<const Header*>(buffer);
+  const size_t num_handles = header->num_handles;
+
+  // Sanity-check |num_handles| (before multiplying it against anything).
+  if (num_handles > GetConfiguration().max_message_num_handles)
+    return "Message handle payload too large";
+
+  if (buffer_size < sizeof(Header) + num_handles * sizeof(HandleTableEntry))
+    return "Message secondary buffer too small";
+
+  if (header->num_platform_handles == 0) {
+    // Then |platform_handle_table_offset| should also be zero.
+    if (header->platform_handle_table_offset != 0) {
+      return "Message has no handles attached, but platform handle table "
+             "present";
+    }
+  } else {
+    if (header->num_platform_handles >
+        GetConfiguration().max_message_num_handles *
+            kMaxSerializedDispatcherPlatformHandles)
+      return "Message has too many platform handles attached";
+
+    static const char kInvalidPlatformHandleTableOffset[] =
+        "Message has invalid platform handle table offset";
+    // This doesn't check that the platform handle table doesn't alias other
+    // stuff, but it doesn't matter, since it's all read-only.
+    if (header->platform_handle_table_offset %
+            MessageInTransit::kMessageAlignment !=
+        0)
+      return kInvalidPlatformHandleTableOffset;
+
+    // ">" instead of ">=" since the size per handle may be zero.
+    if (header->platform_handle_table_offset > buffer_size)
+      return kInvalidPlatformHandleTableOffset;
+
+    // We already checked |platform_handle_table_offset| and
+    // |num_platform_handles|, so the addition and multiplication are okay.
+    if (header->platform_handle_table_offset +
+            header->num_platform_handles * serialized_platform_handle_size >
+        buffer_size)
+      return kInvalidPlatformHandleTableOffset;
+  }
+
+  const HandleTableEntry* handle_table =
+      reinterpret_cast<const HandleTableEntry*>(
+          static_cast<const char*>(buffer) + sizeof(Header));
+  static const char kInvalidSerializedDispatcher[] =
+      "Message contains invalid serialized dispatcher";
+  for (size_t i = 0; i < num_handles; i++) {
+    size_t offset = handle_table[i].offset;
+    if (offset % MessageInTransit::kMessageAlignment != 0)
+      return kInvalidSerializedDispatcher;
+
+    size_t size = handle_table[i].size;
+    if (size > kMaxSerializedDispatcherSize || size > buffer_size)
+      return kInvalidSerializedDispatcher;
+
+    // Note: This is an overflow-safe check for |offset + size > buffer_size|
+    // (we know that |size <= buffer_size| from the previous check).
+    if (offset > buffer_size - size)
+      return kInvalidSerializedDispatcher;
+  }
+
+  return nullptr;
+}
+
+// static
+void TransportData::GetPlatformHandleTable(const void* transport_data_buffer,
+                                           size_t* num_platform_handles,
+                                           const void** platform_handle_table) {
+  DCHECK(transport_data_buffer);
+  DCHECK(num_platform_handles);
+  DCHECK(platform_handle_table);
+
+  const Header* header = static_cast<const Header*>(transport_data_buffer);
+  *num_platform_handles = header->num_platform_handles;
+  *platform_handle_table = static_cast<const char*>(transport_data_buffer) +
+                           header->platform_handle_table_offset;
+}
+
+// static
+scoped_ptr<DispatcherVector> TransportData::DeserializeDispatchers(
+    const void* buffer,
+    size_t buffer_size,
+    ScopedPlatformHandleVectorPtr platform_handles) {
+  DCHECK(buffer);
+  DCHECK_GT(buffer_size, 0u);
+
+  const Header* header = static_cast<const Header*>(buffer);
+  const size_t num_handles = header->num_handles;
+  scoped_ptr<DispatcherVector> dispatchers(new DispatcherVector(num_handles));
+
+  const HandleTableEntry* handle_table =
+      reinterpret_cast<const HandleTableEntry*>(
+          static_cast<const char*>(buffer) + sizeof(Header));
+  for (size_t i = 0; i < num_handles; i++) {
+    size_t offset = handle_table[i].offset;
+    size_t size = handle_table[i].size;
+    // Should already have been checked by |ValidateBuffer()|:
+    DCHECK_EQ(offset % MessageInTransit::kMessageAlignment, 0u);
+    DCHECK_LE(offset, buffer_size);
+    DCHECK_LE(offset + size, buffer_size);
+
+    const void* source = static_cast<const char*>(buffer) + offset;
+    (*dispatchers)[i] = Dispatcher::TransportDataAccess::Deserialize(
+        handle_table[i].type, source, size, platform_handles.get());
+  }
+
+  return dispatchers.Pass();
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/transport_data.h b/mojo/edk/system/transport_data.h
new file mode 100644
index 0000000..7d51ee9
--- /dev/null
+++ b/mojo/edk/system/transport_data.h
@@ -0,0 +1,188 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_
+#define MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+#include "base/memory/aligned_memory.h"
+#include "base/memory/scoped_ptr.h"
+#include "build/build_config.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/embedder/platform_handle_vector.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// This class is used by |MessageInTransit| to represent handles (|Dispatcher|s)
+// in various stages of serialization.
+//
+// The stages are:
+//   - Before reaching |TransportData|: Turn |DispatcherTransport|s into
+//     |Dispatcher|s that are "owned" by (and attached to) a |MessageInTransit|.
+//     This invalidates the handles in the space of the sending application
+//     (and, e.g., if another thread is waiting on such a handle, it'll be
+//     notified of this invalidation).
+//   - Serialize these dispatchers into the |TransportData|: First, for each
+//     attached dispatcher, there's an entry in the |TransportData|'s "handle
+//     table", which points to a segment of (dispatcher-type-dependent) data.
+//   - During the serialization of the dispatchers, |PlatformHandle|s may be
+//     detached from the dispatchers and attached to the |TransportData|.
+//   - Before sending the |MessageInTransit|, including its main buffer and the
+//     |TransportData|'s buffer, the |Channel| sends any |PlatformHandle|s (in a
+//     platform-, and possibly sandbox-situation-, specific way) first. In doing
+//     so, it appends a "platform handle table" to the |TransportData|
+//     containing information about how to deserialize these |PlatformHandle|s.
+//   - Finally, at this point, to send the |MessageInTransit|, there only
+//     remains "inert" data: the |MessageInTransit|'s main buffer and data from
+//     the |TransportData|, consisting of the "handle table" (one entry for each
+//     attached dispatcher), dispatcher-type-specific data (one segment for each
+//     entry in the "handle table"), and the "platform handle table" (one entry
+//     for each attached |PlatformHandle|).
+//
+// To receive a message (|MessageInTransit|), the "reverse" happens:
+//   - On POSIX, receive and buffer |PlatformHandle|s (i.e., FDs), which were
+//     sent before the "inert" data.
+//   - Receive the "inert" data from the |MessageInTransit|. Examine its
+//     "platform handle table". On POSIX, match its entries with the buffered
+//     |PlatformHandle|s, which were previously received. On Windows, do what's
+//     necessary to obtain |PlatformHandle|s (e.g.: i. if the sender is fully
+//     trusted and able to duplicate handle into the receiver, then just pick
+//     out the |HANDLE| value; ii. if the receiver is fully trusted and able to
+//     duplicate handles from the receiver, do the |DuplicateHandle()|; iii.
+//     otherwise, talk to a broker to get handles). Reattach all the
+//     |PlatformHandle|s to the |MessageInTransit|.
+//   - For each entry in the "handle table", use serialized dispatcher data to
+//     reconstitute a dispatcher, taking ownership of associated
+//     |PlatformHandle|s (and detaching them). Attach these dispatchers to the
+//     |MessageInTransit|.
+//   - At this point, the |MessageInTransit| consists of its main buffer
+//     (primarily the data payload) and the attached dispatchers; the
+//     |TransportData| can be discarded.
+//   - When |MojoReadMessage()| is to give data to the application, attach the
+//     dispatchers to the (global, "core") handle table, getting handles; give
+//     the application the data payload and these handles.
+//
+// TODO(vtl): Everything above involving |PlatformHandle|s.
+class MOJO_SYSTEM_IMPL_EXPORT TransportData {
+ public:
+  // The maximum size of a single serialized dispatcher. This must be a multiple
+  // of |kMessageAlignment|.
+  static const size_t kMaxSerializedDispatcherSize = 10000;
+
+  // The maximum number of platform handles to attach for a single serialized
+  // dispatcher.
+  static const size_t kMaxSerializedDispatcherPlatformHandles = 2;
+
+  // The maximum possible size of a valid transport data buffer.
+  static size_t GetMaxBufferSize();
+
+  // The maximum total number of platform handles that may be attached.
+  static size_t GetMaxPlatformHandles();
+
+  explicit TransportData(scoped_ptr<DispatcherVector> dispatchers);
+
+  // This is used for users of |MessageInTransit|/|TransportData|/|RawChannel|
+  // that want to simply transport data and platform handles, and not
+  // |Dispatcher|s. (|Header| will be present, and zero except for
+  // |num_platform_handles|, and |platform_handle_table_offset| if necessary.)
+  explicit TransportData(
+      ScopedPlatformHandleVectorPtr platform_handles,
+      size_t serialized_platform_handle_size);
+
+  ~TransportData();
+
+  const void* buffer() const { return buffer_.get(); }
+  void* buffer() { return buffer_.get(); }
+  size_t buffer_size() const { return buffer_size_; }
+
+  uint32_t platform_handle_table_offset() const {
+    return header()->platform_handle_table_offset;
+  }
+
+  // Gets attached platform-specific handles; this may return null if there are
+  // none. Note that the caller may mutate the set of platform-specific handles.
+  const PlatformHandleVector* platform_handles() const {
+    return platform_handles_.get();
+  }
+  PlatformHandleVector* platform_handles() {
+    return platform_handles_.get();
+  }
+
+  // Receive-side functions:
+
+  // Checks if the given buffer (from the "wire") looks like a valid
+  // |TransportData| buffer. (Should only be called if |buffer_size| is
+  // nonzero.) Returns null if valid, and a pointer to a human-readable error
+  // message (for debug/logging purposes) on error. Note: This checks the
+  // validity of the handle table entries (i.e., does range checking), but does
+  // not check that the validity of the actual serialized dispatcher
+  // information.
+  static const char* ValidateBuffer(size_t serialized_platform_handle_size,
+                                    const void* buffer,
+                                    size_t buffer_size);
+
+  // Gets the platform handle table from a (valid) |TransportData| buffer (which
+  // should have been validated using |ValidateBuffer()| first).
+  static void GetPlatformHandleTable(const void* transport_data_buffer,
+                                     size_t* num_platform_handles,
+                                     const void** platform_handle_table);
+
+  // Deserializes dispatchers from the given (serialized) transport data buffer
+  // (typically from a |MessageInTransit::View|) and vector of platform handles.
+  // |buffer| should be non-null and |buffer_size| should be nonzero.
+  static scoped_ptr<DispatcherVector> DeserializeDispatchers(
+      const void* buffer,
+      size_t buffer_size,
+      ScopedPlatformHandleVectorPtr platform_handles);
+
+ private:
+  // To allow us to make compile-assertions about |Header|, etc. in the .cc
+  // file.
+  struct PrivateStructForCompileAsserts;
+
+  // Header for the "secondary buffer"/"transport data". Must be a multiple of
+  // |MessageInTransit::kMessageAlignment| in size. Must be POD.
+  struct Header {
+    uint32_t num_handles;
+    // TODO(vtl): Not used yet:
+    uint32_t platform_handle_table_offset;
+    uint32_t num_platform_handles;
+    uint32_t unused;
+  };
+
+  struct HandleTableEntry {
+    // TODO(vtl): Should I make |Dispatcher::Type| an |int32_t| enum class?
+    int32_t type;     // From |Dispatcher::Type| (|UNKNOWN| for "invalid").
+    uint32_t offset;  // Relative to the start of the "secondary buffer".
+    uint32_t size;    // (Not including any padding.)
+    uint32_t unused;
+  };
+
+  const Header* header() const {
+    return reinterpret_cast<const Header*>(buffer_.get());
+  }
+
+  size_t buffer_size_;
+  scoped_ptr<char, base::AlignedFreeDeleter> buffer_;  // Never null.
+
+  // Any platform-specific handles attached to this message (for inter-process
+  // transport). The vector (if any) owns the handles that it contains (and is
+  // responsible for closing them).
+  // TODO(vtl): With C++11, change it to a vector of |ScopedPlatformHandle|s.
+  ScopedPlatformHandleVectorPtr platform_handles_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(TransportData);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_TRANSPORT_DATA_H_
diff --git a/mojo/edk/system/waiter.cc b/mojo/edk/system/waiter.cc
new file mode 100644
index 0000000..1a9c0b1
--- /dev/null
+++ b/mojo/edk/system/waiter.cc
@@ -0,0 +1,100 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/waiter.h"
+
+#include <limits>
+
+#include "base/logging.h"
+#include "base/time/time.h"
+
+namespace mojo {
+namespace edk {
+
+Waiter::Waiter()
+    : cv_(&lock_),
+#ifndef NDEBUG
+      initialized_(false),
+#endif
+      awoken_(false),
+      awake_result_(MOJO_RESULT_INTERNAL),
+      awake_context_(static_cast<uint32_t>(-1)) {
+}
+
+Waiter::~Waiter() {
+}
+
+void Waiter::Init() {
+#ifndef NDEBUG
+  initialized_ = true;
+#endif
+  awoken_ = false;
+  // NOTE(vtl): If performance ever becomes an issue, we can disable the setting
+  // of |awake_result_| (except the first one in |Awake()|) in Release builds.
+  awake_result_ = MOJO_RESULT_INTERNAL;
+}
+
+// TODO(vtl): Fast-path the |deadline == 0| case?
+MojoResult Waiter::Wait(MojoDeadline deadline, uint32_t* context) {
+  base::AutoLock locker(lock_);
+
+#ifndef NDEBUG
+  DCHECK(initialized_);
+  // It'll need to be re-initialized after this.
+  initialized_ = false;
+#endif
+
+  // Fast-path the already-awoken case:
+  if (awoken_) {
+    DCHECK_NE(awake_result_, MOJO_RESULT_INTERNAL);
+    if (context)
+      *context = static_cast<uint32_t>(awake_context_);
+    return awake_result_;
+  }
+
+  // |MojoDeadline| is actually a |uint64_t|, but we need a signed quantity.
+  // Treat any out-of-range deadline as "forever" (which is wrong, but okay
+  // since 2^63 microseconds is ~300000 years). Note that this also takes care
+  // of the |MOJO_DEADLINE_INDEFINITE| (= 2^64 - 1) case.
+  if (deadline > static_cast<uint64_t>(std::numeric_limits<int64_t>::max())) {
+    do {
+      cv_.Wait();
+    } while (!awoken_);
+  } else {
+    // NOTE(vtl): This is very inefficient on POSIX, since pthreads condition
+    // variables take an absolute deadline.
+    const base::TimeTicks end_time =
+        base::TimeTicks::Now() +
+        base::TimeDelta::FromMicroseconds(static_cast<int64_t>(deadline));
+    do {
+      base::TimeTicks now_time = base::TimeTicks::Now();
+      if (now_time >= end_time)
+        return MOJO_RESULT_DEADLINE_EXCEEDED;
+
+      cv_.TimedWait(end_time - now_time);
+    } while (!awoken_);
+  }
+
+  DCHECK_NE(awake_result_, MOJO_RESULT_INTERNAL);
+  if (context)
+    *context = static_cast<uint32_t>(awake_context_);
+  return awake_result_;
+}
+
+bool Waiter::Awake(MojoResult result, uintptr_t context) {
+  base::AutoLock locker(lock_);
+
+  if (awoken_)
+    return true;
+
+  awoken_ = true;
+  awake_result_ = result;
+  awake_context_ = context;
+  cv_.Signal();
+  // |cv_.Wait()|/|cv_.TimedWait()| will return after |lock_| is released.
+  return true;
+}
+
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/waiter.h b/mojo/edk/system/waiter.h
new file mode 100644
index 0000000..8e983ec1
--- /dev/null
+++ b/mojo/edk/system/waiter.h
@@ -0,0 +1,79 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_WAITER_H_
+#define MOJO_EDK_SYSTEM_WAITER_H_
+
+#include <stdint.h>
+
+#include "base/synchronization/condition_variable.h"
+#include "base/synchronization/lock.h"
+#include "mojo/edk/system/awakable.h"
+#include "mojo/edk/system/system_impl_export.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+
+// IMPORTANT (all-caps gets your attention, right?): |Waiter| methods are called
+// under other locks, in particular, |Dispatcher::lock_|s, so |Waiter| methods
+// must never call out to other objects (in particular, |Dispatcher|s). This
+// class is thread-safe.
+class MOJO_SYSTEM_IMPL_EXPORT Waiter final : public Awakable {
+ public:
+  Waiter();
+  ~Waiter();
+
+  // A |Waiter| can be used multiple times; |Init()| should be called before
+  // each time it's used.
+  void Init();
+
+  // Waits until a suitable |Awake()| is called. (|context| may be null, in
+  // which case, obviously no context is ever returned.)
+  // Returns:
+  //   - The result given to the first call to |Awake()| (possibly before this
+  //     call to |Wait()|); in this case, |*context| is set to the value passed
+  //     to that call to |Awake()|.
+  //   - |MOJO_RESULT_DEADLINE_EXCEEDED| if the deadline was exceeded; in this
+  //     case |*context| is not modified.
+  //
+  // Usually, the context passed to |Awake()| will be the value passed to
+  // |Dispatcher::AddAwakable()|, which is usually the index to the array of
+  // handles passed to |MojoWaitMany()| (or 0 for |MojoWait()|).
+  //
+  // Typical |Awake()| results are:
+  //   - |MOJO_RESULT_OK| if one of the flags passed to
+  //     |MojoWait()|/|MojoWaitMany()| (hence |Dispatcher::AddAwakable()|) was
+  //     satisfied;
+  //   - |MOJO_RESULT_CANCELLED| if a handle (on which
+  //     |MojoWait()|/|MojoWaitMany()| was called) was closed (hence the
+  //     dispatcher closed); and
+  //   - |MOJO_RESULT_FAILED_PRECONDITION| if one of the set of flags passed to
+  //     |MojoWait()|/|MojoWaitMany()| cannot or can no longer be satisfied by
+  //     the corresponding handle (e.g., if the other end of a message or data
+  //     pipe is closed).
+  MojoResult Wait(MojoDeadline deadline, uint32_t* context);
+
+  // Wake the waiter up with the given result and context (or no-op if it's been
+  // woken up already).
+  bool Awake(MojoResult result, uintptr_t context) override;
+
+ private:
+  base::ConditionVariable cv_;  // Associated to |lock_|.
+  base::Lock lock_;             // Protects the following members.
+#ifndef NDEBUG
+  bool initialized_;
+#endif
+  bool awoken_;
+  MojoResult awake_result_;
+  uintptr_t awake_context_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(Waiter);
+};
+
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_WAITER_H_
diff --git a/mojo/edk/system/waiter_test_utils.cc b/mojo/edk/system/waiter_test_utils.cc
new file mode 100644
index 0000000..bd7f55e
--- /dev/null
+++ b/mojo/edk/system/waiter_test_utils.cc
@@ -0,0 +1,70 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/system/waiter_test_utils.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+SimpleWaiterThread::SimpleWaiterThread(MojoResult* result, uint32_t* context)
+    : base::SimpleThread("waiter_thread"), result_(result), context_(context) {
+  waiter_.Init();
+  *result_ = 5420734;    // Totally invalid result.
+  *context_ = 23489023;  // "Random".
+}
+
+SimpleWaiterThread::~SimpleWaiterThread() {
+  Join();
+}
+
+void SimpleWaiterThread::Run() {
+  *result_ = waiter_.Wait(MOJO_DEADLINE_INDEFINITE, context_);
+}
+
+WaiterThread::WaiterThread(scoped_refptr<Dispatcher> dispatcher,
+                           MojoHandleSignals handle_signals,
+                           MojoDeadline deadline,
+                           uint32_t context,
+                           bool* did_wait_out,
+                           MojoResult* result_out,
+                           uint32_t* context_out,
+                           HandleSignalsState* signals_state_out)
+    : base::SimpleThread("waiter_thread"),
+      dispatcher_(dispatcher),
+      handle_signals_(handle_signals),
+      deadline_(deadline),
+      context_(context),
+      did_wait_out_(did_wait_out),
+      result_out_(result_out),
+      context_out_(context_out),
+      signals_state_out_(signals_state_out) {
+  *did_wait_out_ = false;
+  // Initialize these with invalid results (so that we'll be sure to catch any
+  // case where they're not set).
+  *result_out_ = 8542346;
+  *context_out_ = 89023444;
+  *signals_state_out_ = HandleSignalsState(~0u, ~0u);
+}
+
+WaiterThread::~WaiterThread() {
+  Join();
+}
+
+void WaiterThread::Run() {
+  waiter_.Init();
+
+  *result_out_ = dispatcher_->AddAwakable(&waiter_, handle_signals_, context_,
+                                          signals_state_out_);
+  if (*result_out_ != MOJO_RESULT_OK)
+    return;
+
+  *did_wait_out_ = true;
+  *result_out_ = waiter_.Wait(deadline_, context_out_);
+  dispatcher_->RemoveAwakable(&waiter_, signals_state_out_);
+}
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/system/waiter_test_utils.h b/mojo/edk/system/waiter_test_utils.h
new file mode 100644
index 0000000..a55d5073
--- /dev/null
+++ b/mojo/edk/system/waiter_test_utils.h
@@ -0,0 +1,104 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_
+#define MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_
+
+#include <stdint.h>
+
+#include "base/memory/ref_counted.h"
+#include "base/threading/simple_thread.h"
+#include "mojo/edk/system/dispatcher.h"
+#include "mojo/edk/system/handle_signals_state.h"
+#include "mojo/edk/system/waiter.h"
+#include "mojo/public/c/system/types.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+// This is a very simple thread that has a |Waiter|, on which it waits
+// indefinitely (and records the result). It will create and initialize the
+// |Waiter| on creation, but the caller must start the thread with |Start()|. It
+// will join the thread on destruction.
+//
+// One usually uses it like:
+//
+//    MojoResult result;
+//    {
+//      AwakableList awakable_list;
+//      test::SimpleWaiterThread thread(&result);
+//      awakable_list.Add(thread.waiter(), ...);
+//      thread.Start();
+//      ... some stuff to wake the waiter ...
+//      awakable_list.Remove(thread.waiter());
+//    }  // Join |thread|.
+//    EXPECT_EQ(..., result);
+//
+// There's a bit of unrealism in its use: In this sort of usage, calls such as
+// |Waiter::Init()|, |AddAwakable()|, and |RemoveAwakable()| are done in the
+// main (test) thread, not the waiter thread (as would actually happen in real
+// code). (We accept this unrealism for simplicity, since |AwakableList| is
+// thread-unsafe so making it more realistic would require adding nontrivial
+// synchronization machinery.)
+class SimpleWaiterThread : public base::SimpleThread {
+ public:
+  // For the duration of the lifetime of this object, |*result| belongs to it
+  // (in the sense that it will write to it whenever it wants).
+  SimpleWaiterThread(MojoResult* result, uint32_t* context);
+  ~SimpleWaiterThread() override;  // Joins the thread.
+
+  Waiter* waiter() { return &waiter_; }
+
+ private:
+  void Run() override;
+
+  MojoResult* const result_;
+  uint32_t* const context_;
+  Waiter waiter_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(SimpleWaiterThread);
+};
+
+// This is a more complex and realistic thread that has a |Waiter|, on which it
+// waits for the given deadline (with the given flags). Unlike
+// |SimpleWaiterThread|, it requires the machinery of |Dispatcher|.
+class WaiterThread : public base::SimpleThread {
+ public:
+  // Note: |*did_wait_out|, |*result_out|, |*context_out| and
+  // |*signals_state_out| "belong" to this object (i.e., may be modified by, on
+  // some other thread) while it's alive.
+  WaiterThread(scoped_refptr<Dispatcher> dispatcher,
+               MojoHandleSignals handle_signals,
+               MojoDeadline deadline,
+               uint32_t context,
+               bool* did_wait_out,
+               MojoResult* result_out,
+               uint32_t* context_out,
+               HandleSignalsState* signals_state_out);
+  ~WaiterThread() override;
+
+ private:
+  void Run() override;
+
+  const scoped_refptr<Dispatcher> dispatcher_;
+  const MojoHandleSignals handle_signals_;
+  const MojoDeadline deadline_;
+  const uint32_t context_;
+  bool* const did_wait_out_;
+  MojoResult* const result_out_;
+  uint32_t* const context_out_;
+  HandleSignalsState* const signals_state_out_;
+
+  Waiter waiter_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(WaiterThread);
+};
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_SYSTEM_WAITER_TEST_UTILS_H_
diff --git a/mojo/edk/system/waiter_unittest.cc b/mojo/edk/system/waiter_unittest.cc
new file mode 100644
index 0000000..71d9d8c
--- /dev/null
+++ b/mojo/edk/system/waiter_unittest.cc
@@ -0,0 +1,298 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// NOTE(vtl): Some of these tests are inherently flaky (e.g., if run on a
+// heavily-loaded system). Sorry. |test::EpsilonDeadline()| may be increased to
+// increase tolerance and reduce observed flakiness (though doing so reduces the
+// meaningfulness of the test).
+
+#include "mojo/edk/system/waiter.h"
+
+#include <stdint.h>
+
+#include "base/synchronization/lock.h"
+#include "base/threading/simple_thread.h"
+#include "mojo/edk/system/test_utils.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace mojo {
+namespace edk {
+namespace {
+
+const unsigned kPollTimeMs = 10;
+
+class WaitingThread : public base::SimpleThread {
+ public:
+  explicit WaitingThread(MojoDeadline deadline)
+      : base::SimpleThread("waiting_thread"),
+        deadline_(deadline),
+        done_(false),
+        result_(MOJO_RESULT_UNKNOWN),
+        context_(static_cast<uint32_t>(-1)) {
+    waiter_.Init();
+  }
+
+  ~WaitingThread() override { Join(); }
+
+  void WaitUntilDone(MojoResult* result,
+                     uint32_t* context,
+                     MojoDeadline* elapsed) {
+    for (;;) {
+      {
+        base::AutoLock locker(lock_);
+        if (done_) {
+          *result = result_;
+          *context = context_;
+          *elapsed = elapsed_;
+          break;
+        }
+      }
+
+      test::Sleep(test::DeadlineFromMilliseconds(kPollTimeMs));
+    }
+  }
+
+  Waiter* waiter() { return &waiter_; }
+
+ private:
+  void Run() override {
+    test::Stopwatch stopwatch;
+    MojoResult result;
+    uint32_t context = static_cast<uint32_t>(-1);
+    MojoDeadline elapsed;
+
+    stopwatch.Start();
+    result = waiter_.Wait(deadline_, &context);
+    elapsed = stopwatch.Elapsed();
+
+    {
+      base::AutoLock locker(lock_);
+      done_ = true;
+      result_ = result;
+      context_ = context;
+      elapsed_ = elapsed;
+    }
+  }
+
+  const MojoDeadline deadline_;
+  Waiter waiter_;  // Thread-safe.
+
+  base::Lock lock_;  // Protects the following members.
+  bool done_;
+  MojoResult result_;
+  uint32_t context_;
+  MojoDeadline elapsed_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(WaitingThread);
+};
+
+TEST(WaiterTest, Basic) {
+  MojoResult result;
+  uint32_t context;
+  MojoDeadline elapsed;
+
+  // Finite deadline.
+
+  // Awake immediately after thread start.
+  {
+    WaitingThread thread(10 * test::EpsilonDeadline());
+    thread.Start();
+    thread.waiter()->Awake(MOJO_RESULT_OK, 1);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(MOJO_RESULT_OK, result);
+    EXPECT_EQ(1u, context);
+    EXPECT_LT(elapsed, test::EpsilonDeadline());
+  }
+
+  // Awake before after thread start.
+  {
+    WaitingThread thread(10 * test::EpsilonDeadline());
+    thread.waiter()->Awake(MOJO_RESULT_CANCELLED, 2);
+    thread.Start();
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(MOJO_RESULT_CANCELLED, result);
+    EXPECT_EQ(2u, context);
+    EXPECT_LT(elapsed, test::EpsilonDeadline());
+  }
+
+  // Awake some time after thread start.
+  {
+    WaitingThread thread(10 * test::EpsilonDeadline());
+    thread.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    thread.waiter()->Awake(1, 3);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(1u, result);
+    EXPECT_EQ(3u, context);
+    EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+    EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  }
+
+  // Awake some longer time after thread start.
+  {
+    WaitingThread thread(10 * test::EpsilonDeadline());
+    thread.Start();
+    test::Sleep(5 * test::EpsilonDeadline());
+    thread.waiter()->Awake(2, 4);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(2u, result);
+    EXPECT_EQ(4u, context);
+    EXPECT_GT(elapsed, (5 - 1) * test::EpsilonDeadline());
+    EXPECT_LT(elapsed, (5 + 1) * test::EpsilonDeadline());
+  }
+
+  // Don't awake -- time out (on another thread).
+  {
+    WaitingThread thread(2 * test::EpsilonDeadline());
+    thread.Start();
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, result);
+    EXPECT_EQ(static_cast<uint32_t>(-1), context);
+    EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+    EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  }
+
+  // No (indefinite) deadline.
+
+  // Awake immediately after thread start.
+  {
+    WaitingThread thread(MOJO_DEADLINE_INDEFINITE);
+    thread.Start();
+    thread.waiter()->Awake(MOJO_RESULT_OK, 5);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(MOJO_RESULT_OK, result);
+    EXPECT_EQ(5u, context);
+    EXPECT_LT(elapsed, test::EpsilonDeadline());
+  }
+
+  // Awake before after thread start.
+  {
+    WaitingThread thread(MOJO_DEADLINE_INDEFINITE);
+    thread.waiter()->Awake(MOJO_RESULT_CANCELLED, 6);
+    thread.Start();
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(MOJO_RESULT_CANCELLED, result);
+    EXPECT_EQ(6u, context);
+    EXPECT_LT(elapsed, test::EpsilonDeadline());
+  }
+
+  // Awake some time after thread start.
+  {
+    WaitingThread thread(MOJO_DEADLINE_INDEFINITE);
+    thread.Start();
+    test::Sleep(2 * test::EpsilonDeadline());
+    thread.waiter()->Awake(1, 7);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(1u, result);
+    EXPECT_EQ(7u, context);
+    EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+    EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  }
+
+  // Awake some longer time after thread start.
+  {
+    WaitingThread thread(MOJO_DEADLINE_INDEFINITE);
+    thread.Start();
+    test::Sleep(5 * test::EpsilonDeadline());
+    thread.waiter()->Awake(2, 8);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(2u, result);
+    EXPECT_EQ(8u, context);
+    EXPECT_GT(elapsed, (5 - 1) * test::EpsilonDeadline());
+    EXPECT_LT(elapsed, (5 + 1) * test::EpsilonDeadline());
+  }
+}
+
+TEST(WaiterTest, TimeOut) {
+  test::Stopwatch stopwatch;
+  MojoDeadline elapsed;
+
+  Waiter waiter;
+  uint32_t context = 123;
+
+  waiter.Init();
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED, waiter.Wait(0, &context));
+  elapsed = stopwatch.Elapsed();
+  EXPECT_LT(elapsed, test::EpsilonDeadline());
+  EXPECT_EQ(123u, context);
+
+  waiter.Init();
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            waiter.Wait(2 * test::EpsilonDeadline(), &context));
+  elapsed = stopwatch.Elapsed();
+  EXPECT_GT(elapsed, (2 - 1) * test::EpsilonDeadline());
+  EXPECT_LT(elapsed, (2 + 1) * test::EpsilonDeadline());
+  EXPECT_EQ(123u, context);
+
+  waiter.Init();
+  stopwatch.Start();
+  EXPECT_EQ(MOJO_RESULT_DEADLINE_EXCEEDED,
+            waiter.Wait(5 * test::EpsilonDeadline(), &context));
+  elapsed = stopwatch.Elapsed();
+  EXPECT_GT(elapsed, (5 - 1) * test::EpsilonDeadline());
+  EXPECT_LT(elapsed, (5 + 1) * test::EpsilonDeadline());
+  EXPECT_EQ(123u, context);
+}
+
+// The first |Awake()| should always win.
+TEST(WaiterTest, MultipleAwakes) {
+  MojoResult result;
+  uint32_t context;
+  MojoDeadline elapsed;
+
+  {
+    WaitingThread thread(MOJO_DEADLINE_INDEFINITE);
+    thread.Start();
+    thread.waiter()->Awake(MOJO_RESULT_OK, 1);
+    thread.waiter()->Awake(1, 2);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(MOJO_RESULT_OK, result);
+    EXPECT_EQ(1u, context);
+    EXPECT_LT(elapsed, test::EpsilonDeadline());
+  }
+
+  {
+    WaitingThread thread(MOJO_DEADLINE_INDEFINITE);
+    thread.waiter()->Awake(1, 3);
+    thread.Start();
+    thread.waiter()->Awake(MOJO_RESULT_OK, 4);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(1u, result);
+    EXPECT_EQ(3u, context);
+    EXPECT_LT(elapsed, test::EpsilonDeadline());
+  }
+
+  {
+    WaitingThread thread(MOJO_DEADLINE_INDEFINITE);
+    thread.Start();
+    thread.waiter()->Awake(10, 5);
+    test::Sleep(2 * test::EpsilonDeadline());
+    thread.waiter()->Awake(20, 6);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(10u, result);
+    EXPECT_EQ(5u, context);
+    EXPECT_LT(elapsed, test::EpsilonDeadline());
+  }
+
+  {
+    WaitingThread thread(10 * test::EpsilonDeadline());
+    thread.Start();
+    test::Sleep(1 * test::EpsilonDeadline());
+    thread.waiter()->Awake(MOJO_RESULT_FAILED_PRECONDITION, 7);
+    test::Sleep(2 * test::EpsilonDeadline());
+    thread.waiter()->Awake(MOJO_RESULT_OK, 8);
+    thread.WaitUntilDone(&result, &context, &elapsed);
+    EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION, result);
+    EXPECT_EQ(7u, context);
+    EXPECT_GT(elapsed, (1 - 1) * test::EpsilonDeadline());
+    EXPECT_LT(elapsed, (1 + 1) * test::EpsilonDeadline());
+  }
+}
+
+}  // namespace
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/test/BUILD.gn b/mojo/edk/test/BUILD.gn
new file mode 100644
index 0000000..8789917b
--- /dev/null
+++ b/mojo/edk/test/BUILD.gn
@@ -0,0 +1,154 @@
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("../mojo_edk.gni")
+import("../../public/mojo.gni")
+import("//testing/test.gni")
+
+mojo_edk_source_set("test_support") {
+  testonly = true
+  sources = [
+    "multiprocess_test_helper.cc",
+    "multiprocess_test_helper.h",
+    "scoped_ipc_support.cc",
+    "scoped_ipc_support.h",
+    "test_utils.h",
+    "test_utils_posix.cc",
+    "test_utils_win.cc",
+  ]
+
+  deps = [
+    "//base",
+    "//base/test:test_support",
+    "//mojo/edk/system",
+    "//testing/gtest",
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+}
+
+mojo_edk_source_set("run_all_unittests") {
+  testonly = true
+  sources = [
+    "run_all_unittests.cc",
+  ]
+
+  deps = [
+    ":test_support",
+    ":test_support_impl",
+    "//base",
+    "//base/test:test_support",
+    "//mojo/edk/system",
+    "//testing/gtest",
+    "//third_party/mojo/src/mojo/public/c/test_support",
+
+    # TODO(use_chrome_edk): temporary since the Mojo wrapper primitives are
+    # declared in third party only for now.
+    "//third_party/mojo/src/mojo/edk/system",
+  ]
+}
+
+mojo_edk_source_set("run_all_perftests") {
+  testonly = true
+  deps = [
+    ":test_support_impl",
+    "//base",
+    "//base/test:test_support",
+    "//mojo/edk/system",
+
+    # TODO(use_chrome_edk): temporary since the Mojo wrapper primitives are
+    # declared in third party only for now.
+    "//third_party/mojo/src/mojo/edk/system",
+    "//third_party/mojo/src/mojo/public/c/test_support",
+  ]
+
+  sources = [
+    "run_all_perftests.cc",
+  ]
+}
+
+mojo_edk_source_set("test_support_impl") {
+  testonly = true
+  deps = [
+    "//base",
+    "//base/test:test_support",
+    "//third_party/mojo/src/mojo/public/c/test_support",
+    "//third_party/mojo/src/mojo/public/cpp/system",
+  ]
+
+  sources = [
+    "test_support_impl.cc",
+    "test_support_impl.h",
+  ]
+}
+
+# Public SDK test targets follow. These targets are not defined within the
+# public SDK itself as running the unittests requires the EDK.
+# TODO(vtl): These don't really belong here. (They should be converted to
+# apptests, but even apart from that these targets belong somewhere else.)
+
+group("public_tests") {
+  testonly = true
+  deps = [
+    # TODO(use_chrome_edk): remove "2"
+    ":mojo_public_bindings_unittests2",
+    ":mojo_public_environment_unittests2",
+    ":mojo_public_system_perftests2",
+    ":mojo_public_system_unittests2",
+    ":mojo_public_utility_unittests2",
+  ]
+
+  if (mojo_use_application_in_sdk) {
+    deps += [ ":mojo_public_application_unittests" ]
+  }
+}
+
+if (mojo_use_application_in_sdk) {
+  # TODO(use_chrome_edk): remove "2"
+  test("mojo_public_application_unittests2") {
+    deps = [
+      ":run_all_unittests",
+      "../../../third_party/mojo/src/mojo/public/cpp/application/tests",
+    ]
+  }
+}
+
+# TODO(use_chrome_edk): remove "2"
+test("mojo_public_bindings_unittests2") {
+  deps = [
+    ":run_all_unittests",
+    "../../../third_party/mojo/src/mojo/public/cpp/bindings/tests",
+  ]
+}
+
+# TODO(use_chrome_edk): remove "2"
+test("mojo_public_environment_unittests2") {
+  deps = [
+    ":run_all_unittests",
+    "../../../third_party/mojo/src/mojo/public/cpp/environment/tests",
+  ]
+}
+
+# TODO(use_chrome_edk): remove "2"
+test("mojo_public_system_perftests2") {
+  deps = [
+    ":run_all_perftests",
+    "../../../third_party/mojo/src/mojo/public/c/system/tests:perftests",
+  ]
+}
+
+# TODO(use_chrome_edk): remove "2"
+test("mojo_public_system_unittests2") {
+  deps = [
+    ":run_all_unittests",
+    "../../../third_party/mojo/src/mojo/public/cpp/system/tests",
+  ]
+}
+
+# TODO(use_chrome_edk): remove "2"
+test("mojo_public_utility_unittests2") {
+  deps = [
+    ":run_all_unittests",
+    "../../../third_party/mojo/src/mojo/public/cpp/utility/tests",
+  ]
+}
diff --git a/mojo/edk/test/multiprocess_test_helper.cc b/mojo/edk/test/multiprocess_test_helper.cc
new file mode 100644
index 0000000..10645f9
--- /dev/null
+++ b/mojo/edk/test/multiprocess_test_helper.cc
@@ -0,0 +1,101 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/test/multiprocess_test_helper.h"
+
+#include "base/command_line.h"
+#include "base/logging.h"
+#include "base/process/kill.h"
+#include "base/process/process_handle.h"
+#include "build/build_config.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+MultiprocessTestHelper::MultiprocessTestHelper() {
+  platform_channel_pair_.reset(new PlatformChannelPair());
+  server_platform_handle = platform_channel_pair_->PassServerHandle();
+}
+
+MultiprocessTestHelper::~MultiprocessTestHelper() {
+  CHECK(!test_child_.IsValid());
+  server_platform_handle.reset();
+  platform_channel_pair_.reset();
+}
+
+void MultiprocessTestHelper::StartChild(const std::string& test_child_name) {
+  StartChildWithExtraSwitch(test_child_name, std::string(), std::string());
+}
+
+void MultiprocessTestHelper::StartChildWithExtraSwitch(
+    const std::string& test_child_name,
+    const std::string& switch_string,
+    const std::string& switch_value) {
+  CHECK(platform_channel_pair_);
+  CHECK(!test_child_name.empty());
+  CHECK(!test_child_.IsValid());
+
+  std::string test_child_main = test_child_name + "TestChildMain";
+
+  base::CommandLine command_line(
+      base::GetMultiProcessTestChildBaseCommandLine());
+  HandlePassingInformation handle_passing_info;
+  platform_channel_pair_->PrepareToPassClientHandleToChildProcess(
+      &command_line, &handle_passing_info);
+
+  if (!switch_string.empty()) {
+    CHECK(!command_line.HasSwitch(switch_string));
+    if (!switch_value.empty())
+      command_line.AppendSwitchASCII(switch_string, switch_value);
+    else
+      command_line.AppendSwitch(switch_string);
+  }
+
+  base::LaunchOptions options;
+#if defined(OS_POSIX)
+  options.fds_to_remap = &handle_passing_info;
+#elif defined(OS_WIN)
+  options.start_hidden = true;
+  options.handles_to_inherit = &handle_passing_info;
+#else
+#error "Not supported yet."
+#endif
+
+  test_child_ =
+      base::SpawnMultiProcessTestChild(test_child_main, command_line, options);
+  platform_channel_pair_->ChildProcessLaunched();
+
+  CHECK(test_child_.IsValid());
+}
+
+int MultiprocessTestHelper::WaitForChildShutdown() {
+  CHECK(test_child_.IsValid());
+
+  int rv = -1;
+  CHECK(
+      test_child_.WaitForExitWithTimeout(TestTimeouts::action_timeout(), &rv));
+  test_child_.Close();
+  return rv;
+}
+
+bool MultiprocessTestHelper::WaitForChildTestShutdown() {
+  return WaitForChildShutdown() == 0;
+}
+
+// static
+void MultiprocessTestHelper::ChildSetup() {
+  CHECK(base::CommandLine::InitializedForCurrentProcess());
+  client_platform_handle =
+      PlatformChannelPair::PassClientHandleFromParentProcess(
+          *base::CommandLine::ForCurrentProcess());
+}
+
+// static
+ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle;
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/test/multiprocess_test_helper.h b/mojo/edk/test/multiprocess_test_helper.h
new file mode 100644
index 0000000..3ff8b85
--- /dev/null
+++ b/mojo/edk/test/multiprocess_test_helper.h
@@ -0,0 +1,98 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
+#define MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
+
+#include <string>
+
+#include "base/process/process.h"
+#include "base/test/multiprocess_test.h"
+#include "base/test/test_timeouts.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/public/cpp/system/macros.h"
+#include "testing/multiprocess_func_list.h"
+
+namespace mojo {
+
+namespace edk {
+class PlatformChannelPair;
+
+namespace test {
+
+class MultiprocessTestHelper {
+ public:
+  MultiprocessTestHelper();
+  ~MultiprocessTestHelper();
+
+  // Start a child process and run the "main" function "named" |test_child_name|
+  // declared using |MOJO_MULTIPROCESS_TEST_CHILD_MAIN()| or
+  // |MOJO_MULTIPROCESS_TEST_CHILD_TEST()| (below).
+  void StartChild(const std::string& test_child_name);
+  // Like |StartChild()|, but appends an extra switch (with ASCII value) to the
+  // command line. (The switch must not already be present in the default
+  // command line.)
+  void StartChildWithExtraSwitch(const std::string& test_child_name,
+                                 const std::string& switch_string,
+                                 const std::string& switch_value);
+  // Wait for the child process to terminate.
+  // Returns the exit code of the child process. Note that, though it's declared
+  // to be an |int|, the exit code is subject to mangling by the OS. E.g., we
+  // usually return -1 on error in the child (e.g., if |test_child_name| was not
+  // found), but this is mangled to 255 on Linux. You should only rely on codes
+  // 0-127 being preserved, and -1 being outside the range 0-127.
+  int WaitForChildShutdown();
+
+  // Like |WaitForChildShutdown()|, but returns true on success (exit code of 0)
+  // and false otherwise. You probably want to do something like
+  // |EXPECT_TRUE(WaitForChildTestShutdown());|. Mainly for use with
+  // |MOJO_MULTIPROCESS_TEST_CHILD_TEST()|.
+  bool WaitForChildTestShutdown();
+
+  // For use by |MOJO_MULTIPROCESS_TEST_CHILD_MAIN()| only:
+  static void ChildSetup();
+
+  // For use in the main process:
+  ScopedPlatformHandle server_platform_handle;
+
+  // For use (and only valid) in the child process:
+  static ScopedPlatformHandle client_platform_handle;
+
+ private:
+  scoped_ptr<PlatformChannelPair> platform_channel_pair_;
+
+  // Valid after |StartChild()| and before |WaitForChildShutdown()|.
+  base::Process test_child_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(MultiprocessTestHelper);
+};
+
+// Use this to declare the child process's "main()" function for tests using
+// |MultiprocessTestHelper|. It returns an |int|, which will be the process's
+// exit code (but see the comment about |WaitForChildShutdown()|).
+#define MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) \
+  MULTIPROCESS_TEST_MAIN_WITH_SETUP(                       \
+      test_child_name##TestChildMain,                      \
+      test::MultiprocessTestHelper::ChildSetup)
+
+// Use this (and |WaitForChildTestShutdown()|) for the child process's "main()",
+// if you want to use |EXPECT_...()| or |ASSERT_...()|; it has a |void| return
+// type. (Note that while an |ASSERT_...()| failure will abort the test in the
+// child, it will not abort the test in the parent.)
+#define MOJO_MULTIPROCESS_TEST_CHILD_TEST(test_child_name) \
+  void test_child_name##TestChildTest();                   \
+  MOJO_MULTIPROCESS_TEST_CHILD_MAIN(test_child_name) {     \
+    test_child_name##TestChildTest();                      \
+    return (::testing::Test::HasFatalFailure() ||          \
+            ::testing::Test::HasNonfatalFailure())         \
+               ? 1                                         \
+               : 0;                                        \
+  }                                                        \
+  void test_child_name##TestChildTest()
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_TEST_MULTIPROCESS_TEST_HELPER_H_
diff --git a/mojo/edk/test/multiprocess_test_helper_unittest.cc b/mojo/edk/test/multiprocess_test_helper_unittest.cc
new file mode 100644
index 0000000..b3ae11d
--- /dev/null
+++ b/mojo/edk/test/multiprocess_test_helper_unittest.cc
@@ -0,0 +1,196 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/test/multiprocess_test_helper.h"
+
+#include "base/logging.h"
+#include "build/build_config.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/edk/test/test_utils.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+#if defined(OS_POSIX)
+#include <fcntl.h>
+#endif
+
+namespace mojo {
+namespace edk {
+namespace test {
+namespace {
+
+bool IsNonBlocking(const PlatformHandle& handle) {
+#if defined(OS_WIN)
+  // Haven't figured out a way to query whether a HANDLE was created with
+  // FILE_FLAG_OVERLAPPED.
+  return true;
+#else
+  return fcntl(handle.fd, F_GETFL) & O_NONBLOCK;
+#endif
+}
+
+bool WriteByte(const PlatformHandle& handle, char c) {
+  size_t bytes_written = 0;
+  BlockingWrite(handle, &c, 1, &bytes_written);
+  return bytes_written == 1;
+}
+
+bool ReadByte(const PlatformHandle& handle, char* c) {
+  size_t bytes_read = 0;
+  BlockingRead(handle, c, 1, &bytes_read);
+  return bytes_read == 1;
+}
+
+using MultiprocessTestHelperTest = testing::Test;
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_RunChild DISABLED_RunChild
+#else
+#define MAYBE_RunChild RunChild
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessTestHelperTest, MAYBE_RunChild) {
+  MultiprocessTestHelper helper;
+  EXPECT_TRUE(helper.server_platform_handle.is_valid());
+
+  helper.StartChild("RunChild");
+  EXPECT_EQ(123, helper.WaitForChildShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_MAIN(RunChild) {
+  CHECK(MultiprocessTestHelper::client_platform_handle.is_valid());
+  return 123;
+}
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_TestChildMainNotFound DISABLED_TestChildMainNotFound
+#else
+#define MAYBE_TestChildMainNotFound TestChildMainNotFound
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessTestHelperTest, MAYBE_TestChildMainNotFound) {
+  MultiprocessTestHelper helper;
+  helper.StartChild("NoSuchTestChildMain");
+  int result = helper.WaitForChildShutdown();
+  EXPECT_FALSE(result >= 0 && result <= 127);
+}
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_PassedChannel DISABLED_PassedChannel
+#else
+#define MAYBE_PassedChannel PassedChannel
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessTestHelperTest, MAYBE_PassedChannel) {
+  MultiprocessTestHelper helper;
+  EXPECT_TRUE(helper.server_platform_handle.is_valid());
+  helper.StartChild("PassedChannel");
+
+  // Take ownership of the handle.
+  ScopedPlatformHandle handle = helper.server_platform_handle.Pass();
+
+  // The handle should be non-blocking.
+  EXPECT_TRUE(IsNonBlocking(handle.get()));
+
+  // Write a byte.
+  const char c = 'X';
+  EXPECT_TRUE(WriteByte(handle.get(), c));
+
+  // It'll echo it back to us, incremented.
+  char d = 0;
+  EXPECT_TRUE(ReadByte(handle.get(), &d));
+  EXPECT_EQ(c + 1, d);
+
+  // And return it, incremented again.
+  EXPECT_EQ(c + 2, helper.WaitForChildShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_MAIN(PassedChannel) {
+  CHECK(MultiprocessTestHelper::client_platform_handle.is_valid());
+
+  // Take ownership of the handle.
+  ScopedPlatformHandle handle =
+      MultiprocessTestHelper::client_platform_handle.Pass();
+
+  // The handle should be non-blocking.
+  EXPECT_TRUE(IsNonBlocking(handle.get()));
+
+  // Read a byte.
+  char c = 0;
+  EXPECT_TRUE(ReadByte(handle.get(), &c));
+
+  // Write it back, incremented.
+  c++;
+  EXPECT_TRUE(WriteByte(handle.get(), c));
+
+  // And return it, incremented again.
+  c++;
+  return static_cast<int>(c);
+}
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_ChildTestPasses DISABLED_ChildTestPasses
+#else
+#define MAYBE_ChildTestPasses ChildTestPasses
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessTestHelperTest, MAYBE_ChildTestPasses) {
+  MultiprocessTestHelper helper;
+  EXPECT_TRUE(helper.server_platform_handle.is_valid());
+  helper.StartChild("ChildTestPasses");
+  EXPECT_TRUE(helper.WaitForChildTestShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestPasses) {
+  ASSERT_TRUE(MultiprocessTestHelper::client_platform_handle.is_valid());
+  EXPECT_TRUE(
+      IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get()));
+}
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_ChildTestFailsAssert DISABLED_ChildTestFailsAssert
+#else
+#define MAYBE_ChildTestFailsAssert ChildTestFailsAssert
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessTestHelperTest, MAYBE_ChildTestFailsAssert) {
+  MultiprocessTestHelper helper;
+  EXPECT_TRUE(helper.server_platform_handle.is_valid());
+  helper.StartChild("ChildTestFailsAssert");
+  EXPECT_FALSE(helper.WaitForChildTestShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestFailsAssert) {
+  ASSERT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid())
+      << "DISREGARD: Expected failure in child process";
+  ASSERT_FALSE(
+      IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get()))
+      << "Not reached";
+  CHECK(false) << "Not reached";
+}
+
+#if defined(OS_ANDROID)
+// Android multi-process tests are not executing the new process. This is flaky.
+#define MAYBE_ChildTestFailsExpect DISABLED_ChildTestFailsExpect
+#else
+#define MAYBE_ChildTestFailsExpect ChildTestFailsExpect
+#endif  // defined(OS_ANDROID)
+TEST_F(MultiprocessTestHelperTest, MAYBE_ChildTestFailsExpect) {
+  MultiprocessTestHelper helper;
+  EXPECT_TRUE(helper.server_platform_handle.is_valid());
+  helper.StartChild("ChildTestFailsExpect");
+  EXPECT_FALSE(helper.WaitForChildTestShutdown());
+}
+
+MOJO_MULTIPROCESS_TEST_CHILD_TEST(ChildTestFailsExpect) {
+  EXPECT_FALSE(MultiprocessTestHelper::client_platform_handle.is_valid())
+      << "DISREGARD: Expected failure #1 in child process";
+  EXPECT_FALSE(
+      IsNonBlocking(MultiprocessTestHelper::client_platform_handle.get()))
+      << "DISREGARD: Expected failure #2 in child process";
+}
+
+}  // namespace
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/test/run_all_perftests.cc b/mojo/edk/test/run_all_perftests.cc
new file mode 100644
index 0000000..d700bc3
--- /dev/null
+++ b/mojo/edk/test/run_all_perftests.cc
@@ -0,0 +1,20 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/command_line.h"
+#include "base/test/perf_test_suite.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/test/test_support_impl.h"
+#include "mojo/public/tests/test_support_private.h"
+
+int main(int argc, char** argv) {
+  mojo::edk::Init();
+  mojo::test::TestSupport::Init(new mojo::edk::test::TestSupportImpl());
+
+  // TODO(use_chrome_edk): temporary to force new EDK.
+  base::PerfTestSuite test(argc, argv);
+  base::CommandLine::ForCurrentProcess()->AppendSwitch("--use-new-edk");
+
+  return test.Run();
+}
diff --git a/mojo/edk/test/run_all_unittests.cc b/mojo/edk/test/run_all_unittests.cc
new file mode 100644
index 0000000..23266444
--- /dev/null
+++ b/mojo/edk/test/run_all_unittests.cc
@@ -0,0 +1,43 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <signal.h>
+
+#include "base/bind.h"
+#include "base/test/launcher/unit_test_launcher.h"
+#include "base/test/test_io_thread.h"
+#include "base/test/test_suite.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/test/scoped_ipc_support.h"
+#include "mojo/edk/test/test_support_impl.h"
+#include "mojo/public/tests/test_support_private.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+int main(int argc, char** argv) {
+#if !defined(OS_ANDROID)
+  // Silence death test thread warnings on Linux. We can afford to run our death
+  // tests a little more slowly (< 10 ms per death test on a Z620).
+  // On android, we need to run in the default mode, as the threadsafe mode
+  // relies on execve which is not available.
+  testing::GTEST_FLAG(death_test_style) = "threadsafe";
+#endif
+#if defined(OS_ANDROID)
+  // On android, the test framework has a signal handler that will print a
+  // [ CRASH ] line when the application crashes. This breaks death test has the
+  // test runner will consider the death of the child process a test failure.
+  // Removing the signal handler solves this issue.
+  signal(SIGABRT, SIG_DFL);
+#endif
+
+  base::TestSuite test_suite(argc, argv);
+
+  mojo::edk::Init();
+  mojo::test::TestSupport::Init(new mojo::edk::test::TestSupportImpl());
+  base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
+  mojo::edk::test::ScopedIPCSupport ipc_support(test_io_thread.task_runner());
+
+  return base::LaunchUnitTests(
+      argc, argv,
+      base::Bind(&base::TestSuite::Run, base::Unretained(&test_suite)));
+}
diff --git a/mojo/edk/test/scoped_ipc_support.cc b/mojo/edk/test/scoped_ipc_support.cc
new file mode 100644
index 0000000..c252529b
--- /dev/null
+++ b/mojo/edk/test/scoped_ipc_support.cc
@@ -0,0 +1,59 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/test/scoped_ipc_support.h"
+
+#include "base/message_loop/message_loop.h"
+#include "mojo/edk/embedder/embedder.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+namespace internal {
+
+ScopedIPCSupportHelper::ScopedIPCSupportHelper()
+    : event_(true, false) {  // Manual reset.
+}
+
+ScopedIPCSupportHelper::~ScopedIPCSupportHelper() {
+  if (base::MessageLoop::current() &&
+      base::MessageLoop::current()->task_runner() == io_thread_task_runner_) {
+    ShutdownIPCSupportOnIOThread();
+  } else {
+    ShutdownIPCSupportAndWaitForNoChannels();
+    event_.Wait();
+  }
+}
+
+void ScopedIPCSupportHelper::Init(
+    ProcessDelegate* process_delegate,
+    scoped_refptr<base::TaskRunner> io_thread_task_runner) {
+  io_thread_task_runner_ = io_thread_task_runner;
+  // Note: Run delegate methods on the I/O thread.
+  InitIPCSupport(io_thread_task_runner_, process_delegate,
+                 io_thread_task_runner_);
+}
+
+void ScopedIPCSupportHelper::OnShutdownCompleteImpl() {
+  event_.Signal();
+}
+
+}  // namespace internal
+
+ScopedIPCSupport::ScopedIPCSupport(
+    scoped_refptr<base::TaskRunner> io_thread_task_runner) {
+  helper_.Init(this, io_thread_task_runner.Pass());
+}
+
+ScopedIPCSupport::~ScopedIPCSupport() {
+}
+
+void ScopedIPCSupport::OnShutdownComplete() {
+  helper_.OnShutdownCompleteImpl();
+}
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/test/scoped_ipc_support.h b/mojo/edk/test/scoped_ipc_support.h
new file mode 100644
index 0000000..cff0da76
--- /dev/null
+++ b/mojo/edk/test/scoped_ipc_support.h
@@ -0,0 +1,66 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_
+#define MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_
+
+#include "base/callback.h"
+#include "base/memory/ref_counted.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/task_runner.h"
+#include "mojo/edk/embedder/process_delegate.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+#include "mojo/public/cpp/system/macros.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+namespace internal {
+
+class ScopedIPCSupportHelper {
+ public:
+  ScopedIPCSupportHelper();
+  ~ScopedIPCSupportHelper();
+
+  void Init(ProcessDelegate* process_delegate,
+            scoped_refptr<base::TaskRunner> io_thread_task_runner);
+
+  void OnShutdownCompleteImpl();
+
+ private:
+  scoped_refptr<base::TaskRunner> io_thread_task_runner_;
+
+  // Set after shut down.
+  base::WaitableEvent event_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedIPCSupportHelper);
+};
+
+}  // namespace internal
+
+// A simple class that calls |InitIPCSupport()| on construction and
+// |ShutdownIPCSupport()| on destruction (or |ShutdownIPCSupportOnIOThread()|
+// if destroyed on the I/O thread).
+class ScopedIPCSupport : public ProcessDelegate {
+ public:
+  explicit ScopedIPCSupport(
+      scoped_refptr<base::TaskRunner> io_thread_task_runner);
+  ~ScopedIPCSupport() override;
+
+ private:
+  // |ProcessDelegate| implementation:
+  // Note: Executed on the I/O thread.
+  void OnShutdownComplete() override;
+
+  internal::ScopedIPCSupportHelper helper_;
+
+  MOJO_DISALLOW_COPY_AND_ASSIGN(ScopedIPCSupport);
+};
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_TEST_SCOPED_IPC_SUPPORT_H_
diff --git a/mojo/edk/test/test_support_impl.cc b/mojo/edk/test/test_support_impl.cc
new file mode 100644
index 0000000..c91fcf3
--- /dev/null
+++ b/mojo/edk/test/test_support_impl.cc
@@ -0,0 +1,83 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/test/test_support_impl.h"
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <string>
+
+#include "base/files/file_enumerator.h"
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/logging.h"
+#include "base/path_service.h"
+#include "base/strings/string_split.h"
+#include "base/strings/string_util.h"
+#include "base/strings/stringprintf.h"
+#include "base/test/perf_log.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+namespace {
+
+base::FilePath ResolveSourceRootRelativePath(const char* relative_path) {
+  base::FilePath path;
+  if (!PathService::Get(base::DIR_SOURCE_ROOT, &path))
+    return base::FilePath();
+
+  for (const base::StringPiece& component : base::SplitStringPiece(
+           relative_path, "/", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+    if (!component.empty())
+      path = path.AppendASCII(component);
+  }
+
+  return path;
+}
+
+}  // namespace
+
+TestSupportImpl::TestSupportImpl() {
+}
+
+TestSupportImpl::~TestSupportImpl() {
+}
+
+void TestSupportImpl::LogPerfResult(const char* test_name,
+                                    const char* sub_test_name,
+                                    double value,
+                                    const char* units) {
+  DCHECK(test_name);
+  if (sub_test_name) {
+    std::string name = base::StringPrintf("%s/%s", test_name, sub_test_name);
+    base::LogPerfResult(name.c_str(), value, units);
+  } else {
+    base::LogPerfResult(test_name, value, units);
+  }
+}
+
+FILE* TestSupportImpl::OpenSourceRootRelativeFile(const char* relative_path) {
+  return base::OpenFile(ResolveSourceRootRelativePath(relative_path), "rb");
+}
+
+char** TestSupportImpl::EnumerateSourceRootRelativeDirectory(
+    const char* relative_path) {
+  std::vector<std::string> names;
+  base::FileEnumerator e(ResolveSourceRootRelativePath(relative_path), false,
+                         base::FileEnumerator::FILES);
+  for (base::FilePath name = e.Next(); !name.empty(); name = e.Next())
+    names.push_back(name.BaseName().AsUTF8Unsafe());
+
+  // |names.size() + 1| for null terminator.
+  char** rv = static_cast<char**>(calloc(names.size() + 1, sizeof(char*)));
+  for (size_t i = 0; i < names.size(); ++i)
+    rv[i] = base::strdup(names[i].c_str());
+  return rv;
+}
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/test/test_support_impl.h b/mojo/edk/test/test_support_impl.h
new file mode 100644
index 0000000..e672999b
--- /dev/null
+++ b/mojo/edk/test/test_support_impl.h
@@ -0,0 +1,38 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_TEST_TEST_SUPPORT_IMPL_H_
+#define MOJO_EDK_TEST_TEST_SUPPORT_IMPL_H_
+
+#include <stdio.h>
+
+#include "mojo/public/cpp/system/macros.h"
+#include "mojo/public/tests/test_support_private.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+class TestSupportImpl : public mojo::test::TestSupport {
+ public:
+  TestSupportImpl();
+  ~TestSupportImpl() override;
+
+  void LogPerfResult(const char* test_name,
+                     const char* sub_test_name,
+                     double value,
+                     const char* units) override;
+  FILE* OpenSourceRootRelativeFile(const char* relative_path) override;
+  char** EnumerateSourceRootRelativeDirectory(
+      const char* relative_path) override;
+
+ private:
+  MOJO_DISALLOW_COPY_AND_ASSIGN(TestSupportImpl);
+};
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_TEST_TEST_SUPPORT_IMPL_H_
diff --git a/mojo/edk/test/test_utils.h b/mojo/edk/test/test_utils.h
new file mode 100644
index 0000000..939171b
--- /dev/null
+++ b/mojo/edk/test/test_utils.h
@@ -0,0 +1,55 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_EDK_TEST_TEST_UTILS_H_
+#define MOJO_EDK_TEST_TEST_UTILS_H_
+
+#include <stddef.h>
+#include <stdio.h>
+
+#include <string>
+
+#include "base/files/scoped_file.h"
+#include "mojo/edk/embedder/platform_handle.h"
+#include "mojo/edk/embedder/scoped_platform_handle.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+// On success, |bytes_written| is updated to the number of bytes written;
+// otherwise it is untouched.
+bool BlockingWrite(const PlatformHandle& handle,
+                   const void* buffer,
+                   size_t bytes_to_write,
+                   size_t* bytes_written);
+
+// On success, |bytes_read| is updated to the number of bytes read; otherwise it
+// is untouched.
+bool BlockingRead(const PlatformHandle& handle,
+                  void* buffer,
+                  size_t buffer_size,
+                  size_t* bytes_read);
+
+// If the read is done successfully or would block, the function returns true
+// and updates |bytes_read| to the number of bytes read (0 if the read would
+// block); otherwise it returns false and leaves |bytes_read| untouched.
+// |handle| must already be in non-blocking mode.
+bool NonBlockingRead(const PlatformHandle& handle,
+                     void* buffer,
+                     size_t buffer_size,
+                     size_t* bytes_read);
+
+// Gets a (scoped) |PlatformHandle| from the given (scoped) |FILE|.
+ScopedPlatformHandle PlatformHandleFromFILE(base::ScopedFILE fp);
+
+// Gets a (scoped) |FILE| from a (scoped) |PlatformHandle|.
+base::ScopedFILE FILEFromPlatformHandle(ScopedPlatformHandle h,
+                                        const char* mode);
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
+
+#endif  // MOJO_EDK_TEST_TEST_UTILS_H_
diff --git a/mojo/edk/test/test_utils_posix.cc b/mojo/edk/test/test_utils_posix.cc
new file mode 100644
index 0000000..66a63743
--- /dev/null
+++ b/mojo/edk/test/test_utils_posix.cc
@@ -0,0 +1,93 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/test/test_utils.h"
+
+#include <fcntl.h>
+#include <unistd.h>
+
+#include "base/posix/eintr_wrapper.h"
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+bool BlockingWrite(const PlatformHandle& handle,
+                   const void* buffer,
+                   size_t bytes_to_write,
+                   size_t* bytes_written) {
+  int original_flags = fcntl(handle.fd, F_GETFL);
+  if (original_flags == -1 ||
+      fcntl(handle.fd, F_SETFL, original_flags & (~O_NONBLOCK)) != 0) {
+    return false;
+  }
+
+  ssize_t result = HANDLE_EINTR(write(handle.fd, buffer, bytes_to_write));
+
+  fcntl(handle.fd, F_SETFL, original_flags);
+
+  if (result < 0)
+    return false;
+
+  *bytes_written = result;
+  return true;
+}
+
+bool BlockingRead(const PlatformHandle& handle,
+                  void* buffer,
+                  size_t buffer_size,
+                  size_t* bytes_read) {
+  int original_flags = fcntl(handle.fd, F_GETFL);
+  if (original_flags == -1 ||
+      fcntl(handle.fd, F_SETFL, original_flags & (~O_NONBLOCK)) != 0) {
+    return false;
+  }
+
+  ssize_t result = HANDLE_EINTR(read(handle.fd, buffer, buffer_size));
+
+  fcntl(handle.fd, F_SETFL, original_flags);
+
+  if (result < 0)
+    return false;
+
+  *bytes_read = result;
+  return true;
+}
+
+bool NonBlockingRead(const PlatformHandle& handle,
+                     void* buffer,
+                     size_t buffer_size,
+                     size_t* bytes_read) {
+  ssize_t result = HANDLE_EINTR(read(handle.fd, buffer, buffer_size));
+
+  if (result < 0) {
+    if (errno != EAGAIN && errno != EWOULDBLOCK)
+      return false;
+
+    *bytes_read = 0;
+  } else {
+    *bytes_read = result;
+  }
+
+  return true;
+}
+
+ScopedPlatformHandle PlatformHandleFromFILE(base::ScopedFILE fp) {
+  CHECK(fp);
+  int rv = dup(fileno(fp.get()));
+  PCHECK(rv != -1) << "dup";
+  return ScopedPlatformHandle(PlatformHandle(rv));
+}
+
+base::ScopedFILE FILEFromPlatformHandle(ScopedPlatformHandle h,
+                                        const char* mode) {
+  CHECK(h.is_valid());
+  base::ScopedFILE rv(fdopen(h.release().fd, mode));
+  PCHECK(rv) << "fdopen";
+  return rv.Pass();
+}
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/edk/test/test_utils_win.cc b/mojo/edk/test/test_utils_win.cc
new file mode 100644
index 0000000..57a2550
--- /dev/null
+++ b/mojo/edk/test/test_utils_win.cc
@@ -0,0 +1,114 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/edk/test/test_utils.h"
+
+#include <windows.h>
+#include <fcntl.h>
+#include <io.h>
+#include <string.h>
+
+namespace mojo {
+namespace edk {
+namespace test {
+
+bool BlockingWrite(const PlatformHandle& handle,
+                   const void* buffer,
+                   size_t bytes_to_write,
+                   size_t* bytes_written) {
+  OVERLAPPED overlapped = {0};
+  DWORD bytes_written_dword = 0;
+
+  if (!WriteFile(handle.handle, buffer, static_cast<DWORD>(bytes_to_write),
+                 &bytes_written_dword, &overlapped)) {
+    if (GetLastError() != ERROR_IO_PENDING ||
+        !GetOverlappedResult(handle.handle, &overlapped, &bytes_written_dword,
+                             TRUE)) {
+      return false;
+    }
+  }
+
+  *bytes_written = bytes_written_dword;
+  return true;
+}
+
+bool BlockingRead(const PlatformHandle& handle,
+                  void* buffer,
+                  size_t buffer_size,
+                  size_t* bytes_read) {
+  OVERLAPPED overlapped = {0};
+  DWORD bytes_read_dword = 0;
+
+  if (!ReadFile(handle.handle, buffer, static_cast<DWORD>(buffer_size),
+                &bytes_read_dword, &overlapped)) {
+    if (GetLastError() != ERROR_IO_PENDING ||
+        !GetOverlappedResult(handle.handle, &overlapped, &bytes_read_dword,
+                             TRUE)) {
+      return false;
+    }
+  }
+
+  *bytes_read = bytes_read_dword;
+  return true;
+}
+
+bool NonBlockingRead(const PlatformHandle& handle,
+                     void* buffer,
+                     size_t buffer_size,
+                     size_t* bytes_read) {
+  OVERLAPPED overlapped = {0};
+  DWORD bytes_read_dword = 0;
+
+  if (!ReadFile(handle.handle, buffer, static_cast<DWORD>(buffer_size),
+                &bytes_read_dword, &overlapped)) {
+    if (GetLastError() != ERROR_IO_PENDING)
+      return false;
+
+    CancelIo(handle.handle);
+
+    if (!GetOverlappedResult(handle.handle, &overlapped, &bytes_read_dword,
+                             TRUE)) {
+      *bytes_read = 0;
+      return true;
+    }
+  }
+
+  *bytes_read = bytes_read_dword;
+  return true;
+}
+
+ScopedPlatformHandle PlatformHandleFromFILE(base::ScopedFILE fp) {
+  CHECK(fp);
+
+  HANDLE rv = INVALID_HANDLE_VALUE;
+  PCHECK(DuplicateHandle(
+      GetCurrentProcess(),
+      reinterpret_cast<HANDLE>(_get_osfhandle(_fileno(fp.get()))),
+      GetCurrentProcess(), &rv, 0, TRUE, DUPLICATE_SAME_ACCESS))
+      << "DuplicateHandle";
+  return ScopedPlatformHandle(PlatformHandle(rv));
+}
+
+base::ScopedFILE FILEFromPlatformHandle(ScopedPlatformHandle h,
+                                        const char* mode) {
+  CHECK(h.is_valid());
+  // Microsoft's documentation for |_open_osfhandle()| only discusses these
+  // flags (and |_O_WTEXT|). Hmmm.
+  int flags = 0;
+  if (strchr(mode, 'a'))
+    flags |= _O_APPEND;
+  if (strchr(mode, 'r'))
+    flags |= _O_RDONLY;
+  if (strchr(mode, 't'))
+    flags |= _O_TEXT;
+  base::ScopedFILE rv(_fdopen(
+      _open_osfhandle(reinterpret_cast<intptr_t>(h.release().handle), flags),
+      mode));
+  PCHECK(rv) << "_fdopen";
+  return rv.Pass();
+}
+
+}  // namespace test
+}  // namespace edk
+}  // namespace mojo
diff --git a/mojo/mojo_edk.gyp b/mojo/mojo_edk.gyp
new file mode 100644
index 0000000..a7467dfb
--- /dev/null
+++ b/mojo/mojo_edk.gyp
@@ -0,0 +1,225 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+  'includes': [
+    '../third_party/mojo/mojo_variables.gypi',
+  ],
+  'target_defaults' : {
+    'include_dirs': [
+      '..',
+      '../third_party/mojo/src',
+    ],
+    'direct_dependent_settings': {
+      'include_dirs': [
+        '..',
+      ],
+    },
+  },
+  'targets': [
+    {
+      # GN version: //mojo/edk/system
+      'target_name': 'mojo_system_impl2',
+      'type': 'static_library',
+      # TODO(use_chrome_edk): this should be a component to match third_party,
+      # but since third_party includes it, we either make it a static library
+      # or we have to change the export macros to be different than third_party.
+      #'type': '<(component)',
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
+      ],
+      'defines': [
+        'MOJO_SYSTEM_IMPL_IMPLEMENTATION',
+        'MOJO_SYSTEM_IMPLEMENTATION',
+        'MOJO_USE_SYSTEM_IMPL',
+      ],
+      'sources': [
+        'edk/embedder/configuration.h',
+        'edk/embedder/channel_info_forward.h',
+        'edk/embedder/embedder.cc',
+        'edk/embedder/embedder.h',
+        'edk/embedder/embedder_internal.h',
+        'edk/embedder/entrypoints.cc',
+        'edk/embedder/platform_channel_pair.cc',
+        'edk/embedder/platform_channel_pair.h',
+        'edk/embedder/platform_channel_pair_posix.cc',
+        'edk/embedder/platform_channel_pair_win.cc',
+        'edk/embedder/platform_channel_utils_posix.cc',
+        'edk/embedder/platform_channel_utils_posix.h',
+        'edk/embedder/platform_handle.cc',
+        'edk/embedder/platform_handle.h',
+        'edk/embedder/platform_handle_utils.h',
+        'edk/embedder/platform_handle_utils_posix.cc',
+        'edk/embedder/platform_handle_utils_win.cc',
+        'edk/embedder/platform_handle_vector.h',
+        'edk/embedder/platform_shared_buffer.h',
+        'edk/embedder/platform_support.h',
+        'edk/embedder/scoped_platform_handle.h',
+        'edk/embedder/simple_platform_shared_buffer.cc',
+        'edk/embedder/simple_platform_shared_buffer.h',
+        'edk/embedder/simple_platform_shared_buffer_android.cc',
+        'edk/embedder/simple_platform_shared_buffer_posix.cc',
+        'edk/embedder/simple_platform_shared_buffer_win.cc',
+        'edk/embedder/simple_platform_support.cc',
+        'edk/embedder/simple_platform_support.h',
+        'edk/system/awakable.h',
+        'edk/system/awakable_list.cc',
+        'edk/system/awakable_list.h',
+        'edk/system/async_waiter.cc',
+        'edk/system/async_waiter.h',
+        'edk/system/configuration.cc',
+        'edk/system/configuration.h',
+        'edk/system/core.cc',
+        'edk/system/core.h',
+        'edk/system/data_pipe.cc',
+        'edk/system/data_pipe.h',
+        'edk/system/data_pipe_consumer_dispatcher.cc',
+        'edk/system/data_pipe_consumer_dispatcher.h',
+        'edk/system/data_pipe_producer_dispatcher.cc',
+        'edk/system/data_pipe_producer_dispatcher.h',
+        'edk/system/dispatcher.cc',
+        'edk/system/dispatcher.h',
+        'edk/system/handle_signals_state.h',
+        'edk/system/handle_table.cc',
+        'edk/system/handle_table.h',
+        'edk/system/mapping_table.cc',
+        'edk/system/mapping_table.h',
+        'edk/system/message_in_transit.cc',
+        'edk/system/message_in_transit.h',
+        'edk/system/message_in_transit_queue.cc',
+        'edk/system/message_in_transit_queue.h',
+        'edk/system/message_pipe_dispatcher.cc',
+        'edk/system/message_pipe_dispatcher.h',
+        'edk/system/options_validation.h',
+        'edk/system/platform_handle_dispatcher.cc',
+        'edk/system/platform_handle_dispatcher.h',
+        'edk/system/raw_channel.cc',
+        'edk/system/raw_channel.h',
+        'edk/system/raw_channel_posix.cc',
+        'edk/system/raw_channel_win.cc',
+        'edk/system/shared_buffer_dispatcher.cc',
+        'edk/system/shared_buffer_dispatcher.h',
+        'edk/system/simple_dispatcher.cc',
+        'edk/system/simple_dispatcher.h',
+        'edk/system/transport_data.cc',
+        'edk/system/transport_data.h',
+        'edk/system/waiter.cc',
+        'edk/system/waiter.h',
+        # Test-only code:
+        # TODO(vtl): It's a little unfortunate that these end up in the same
+        # component as non-test-only code. In the static build, this code
+        # should hopefully be dead-stripped.
+        'edk/embedder/test_embedder.cc',
+        'edk/embedder/test_embedder.h',
+      ],
+      'all_dependent_settings': {
+        # Ensures that dependent projects import the core functions on Windows.
+        'defines': ['MOJO_USE_SYSTEM_IMPL'],
+      },
+      'conditions': [
+        ['OS=="android"', {
+          'dependencies': [
+            '../third_party/ashmem/ashmem.gyp:ashmem',
+          ],
+        }],
+        ['OS=="win"', {
+           # Structure was padded due to __declspec(align()), which is
+           # uninteresting.
+          'msvs_disabled_warnings': [ 4324 ],
+        }],
+      ],
+    },
+    {
+      # GN version: //mojo/edk/js
+      # TODO(use_chrome_edk): remove "2"
+      'target_name': 'mojo_js_lib2',
+      'type': 'static_library',
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../gin/gin.gyp:gin',
+        '../v8/tools/gyp/v8.gyp:v8',
+      ],
+      'export_dependent_settings': [
+        '../base/base.gyp:base',
+        '../gin/gin.gyp:gin',
+      ],
+      'sources': [
+        # Sources list duplicated in GN build.
+        'edk/js/core.cc',
+        'edk/js/core.h',
+        'edk/js/drain_data.cc',
+        'edk/js/drain_data.h',
+        'edk/js/handle.cc',
+        'edk/js/handle.h',
+        'edk/js/handle_close_observer.h',
+        'edk/js/mojo_runner_delegate.cc',
+        'edk/js/mojo_runner_delegate.h',
+        'edk/js/support.cc',
+        'edk/js/support.h',
+        'edk/js/threading.cc',
+        'edk/js/threading.h',
+        'edk/js/waiting_callback.cc',
+        'edk/js/waiting_callback.h',
+      ],
+    },
+    {
+      # GN version: //mojo/edk/test:test_support_impl
+      # TODO(use_chrome_edk): remove "2"
+      'target_name': 'mojo_test_support_impl2',
+      'type': 'static_library',
+      'dependencies': [
+        '../base/base.gyp:base',
+      ],
+      'sources': [
+        'edk/test/test_support_impl.cc',
+        'edk/test/test_support_impl.h',
+      ],
+    },
+    {
+      # GN version: //mojo/edk/test:test_support
+      'target_name': 'mojo_common_test_support2',
+      'type': 'static_library',
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../base/base.gyp:test_support_base',
+        '../testing/gtest.gyp:gtest',
+        'mojo_system_impl2',
+      ],
+      'sources': [
+        'edk/test/multiprocess_test_helper.cc',
+        'edk/test/multiprocess_test_helper.h',
+        'edk/test/scoped_ipc_support.cc',
+        'edk/test/scoped_ipc_support.h',
+        'edk/test/test_utils.h',
+        'edk/test/test_utils_posix.cc',
+        'edk/test/test_utils_win.cc',
+      ],
+      'conditions': [
+        ['OS=="ios"', {
+          'sources!': [
+            'edk/test/multiprocess_test_helper.cc',
+          ],
+        }],
+      ],
+    },
+    {
+      # GN version: //mojo/edk/test:run_all_unittests
+      # TODO(use_chrome_edk): remove "2"
+      'target_name': 'mojo_run_all_unittests2',
+      'type': 'static_library',
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../base/base.gyp:test_support_base',
+        '../testing/gtest.gyp:gtest',
+        '../third_party/mojo/mojo_public.gyp:mojo_public_test_support',
+        'mojo_system_impl2',
+        'mojo_test_support_impl2',
+      ],
+      'sources': [
+        'edk/test/run_all_unittests.cc',
+      ],
+    },
+  ],
+}
diff --git a/mojo/mojo_edk_tests.gyp b/mojo/mojo_edk_tests.gyp
new file mode 100644
index 0000000..2b11d07
--- /dev/null
+++ b/mojo/mojo_edk_tests.gyp
@@ -0,0 +1,133 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+  'includes': [
+    '../third_party/mojo/mojo_variables.gypi',
+  ],
+  'targets': [
+    {
+      'target_name': 'mojo_edk_tests',
+      'type': 'none',
+      'dependencies': [
+        # NOTE: If adding a new dependency here, please consider whether it
+        # should also be added to the list of Mojo-related dependencies of
+        # build/all.gyp:All on iOS, as All cannot depend on the mojo_base
+        # target on iOS due to the presence of the js targets, which cause v8
+        # to be built.
+        'mojo_message_pipe_perftests2',
+        'mojo_system_unittests2',
+        'mojo_js_unittests2',
+        'mojo_js_integration_tests2',
+      ],
+    },
+    {
+      # GN version: //mojo/edk/system:mojo_system_unittests
+      'target_name': 'mojo_system_unittests2',
+      'type': 'executable',
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../testing/gtest.gyp:gtest',
+        'mojo_edk.gyp:mojo_common_test_support2',
+        'mojo_edk.gyp:mojo_system_impl2',
+      ],
+      'sources': [
+        'edk/embedder/embedder_unittest.cc',
+        'edk/embedder/platform_channel_pair_posix_unittest.cc',
+        'edk/embedder/simple_platform_shared_buffer_unittest.cc',
+        'edk/system/awakable_list_unittest.cc',
+        'edk/system/core_test_base.cc',
+        'edk/system/core_test_base.h',
+        'edk/system/core_unittest.cc',
+        'edk/system/data_pipe_unittest.cc',
+        'edk/system/dispatcher_unittest.cc',
+        'edk/system/message_in_transit_queue_unittest.cc',
+        'edk/system/message_in_transit_test_utils.cc',
+        'edk/system/message_in_transit_test_utils.h',
+        'edk/system/message_pipe_test_utils.cc',
+        'edk/system/message_pipe_test_utils.h',
+        'edk/system/message_pipe_unittest.cc',
+        'edk/system/multiprocess_message_pipe_unittest.cc',
+        'edk/system/options_validation_unittest.cc',
+        'edk/system/platform_handle_dispatcher_unittest.cc',
+        'edk/system/raw_channel_unittest.cc',
+        'edk/system/run_all_unittests.cc',
+        'edk/system/shared_buffer_dispatcher_unittest.cc',
+        'edk/system/simple_dispatcher_unittest.cc',
+        'edk/system/test_utils.cc',
+        'edk/system/test_utils.h',
+        'edk/system/waiter_test_utils.cc',
+        'edk/system/waiter_test_utils.h',
+        'edk/system/waiter_unittest.cc',
+        'edk/test/multiprocess_test_helper_unittest.cc',
+      ],
+      'conditions': [
+        ['OS=="ios"', {
+          'sources!': [
+            'edk/embedder/embedder_unittest.cc',
+            'edk/system/multiprocess_message_pipe_unittest.cc',
+            'edk/test/multiprocess_test_helper_unittest.cc',
+          ],
+        }],
+      ],
+    },
+    {
+      # GN version: //mojo/edk/system:mojo_message_pipe_perftests
+      'target_name': 'mojo_message_pipe_perftests2',
+      'type': 'executable',
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../base/base.gyp:test_support_base',
+        '../base/base.gyp:test_support_perf',
+        '../testing/gtest.gyp:gtest',
+        'mojo_edk.gyp:mojo_common_test_support2',
+        'mojo_edk.gyp:mojo_system_impl2',
+      ],
+      'sources': [
+        'edk/system/message_pipe_perftest.cc',
+        'edk/system/message_pipe_test_utils.cc',
+        'edk/system/message_pipe_test_utils.h',
+        'edk/system/test_utils.cc',
+        'edk/system/test_utils.h',
+      ],
+    },
+    {
+      # GN version: //mojo/edk/js/test:js_unittests
+      'target_name': 'mojo_js_unittests2',
+      'type': 'executable',
+      'dependencies': [
+        '../gin/gin.gyp:gin_test',
+        '../third_party/mojo/mojo_public.gyp:mojo_environment_standalone',
+        '../third_party/mojo/mojo_public.gyp:mojo_public_test_interfaces',
+        '../third_party/mojo/mojo_public.gyp:mojo_utility',
+        'mojo_edk.gyp:mojo_common_test_support2',
+        'mojo_edk.gyp:mojo_run_all_unittests2',
+        'mojo_edk.gyp:mojo_js_lib2',
+      ],
+      'sources': [
+        'edk/js/handle_unittest.cc',
+        'edk/js/test/run_js_tests.cc',
+      ],
+    },
+    {
+      # GN version: //mojo/edk/js/test:js_integration_tests
+      'target_name': 'mojo_js_integration_tests2',
+      'type': 'executable',
+      'dependencies': [
+        '../base/base.gyp:base',
+        '../gin/gin.gyp:gin_test',
+        '../third_party/mojo/mojo_public.gyp:mojo_environment_standalone',
+        '../third_party/mojo/mojo_public.gyp:mojo_public_test_interfaces',
+        '../third_party/mojo/mojo_public.gyp:mojo_utility',
+        'mojo_edk.gyp:mojo_js_lib2',
+        'mojo_edk.gyp:mojo_run_all_unittests2',
+        'mojo_js_to_cpp_bindings',
+      ],
+      'sources': [
+        'edk/js/test/run_js_integration_tests.cc',
+        'edk/js/tests/js_to_cpp_tests.cc',
+      ],
+    },
+  ],
+}
diff --git a/mojo/runner/child_process.cc b/mojo/runner/child_process.cc
index dc9b59f2..4fb6047 100644
--- a/mojo/runner/child_process.cc
+++ b/mojo/runner/child_process.cc
@@ -20,17 +20,16 @@
 #include "base/thread_task_runner_handle.h"
 #include "base/threading/thread.h"
 #include "base/threading/thread_checker.h"
-#include "mojo/edk/embedder/embedder.h"
-#include "mojo/edk/embedder/platform_channel_pair.h"
-#include "mojo/edk/embedder/process_delegate.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
-#include "mojo/edk/embedder/simple_platform_support.h"
 #include "mojo/message_pump/message_pump_mojo.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "mojo/public/cpp/system/core.h"
 #include "mojo/runner/child_process.mojom.h"
 #include "mojo/runner/native_application_support.h"
 #include "mojo/runner/switches.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
+#include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
+#include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 
 #if defined(OS_LINUX) && !defined(OS_ANDROID)
 #include "base/rand_util.h"
@@ -92,6 +91,8 @@
 class ChildControllerImpl;
 
 // Should be created and initialized on the main thread.
+// TODO(use_chrome_edk)
+//class AppContext : public edk::ProcessDelegate {
 class AppContext : public embedder::ProcessDelegate {
  public:
   AppContext()
@@ -100,7 +101,7 @@
 
   void Init() {
     // Initialize Mojo before starting any threads.
-    embedder::Init(make_scoped_ptr(new embedder::SimplePlatformSupport()));
+    embedder::Init();
 
     // Create and start our I/O thread.
     base::Thread::Options io_thread_options(base::MessageLoop::TYPE_IO, 0);
diff --git a/mojo/runner/child_process_host.cc b/mojo/runner/child_process_host.cc
index f5fe0f5..b470a9b 100644
--- a/mojo/runner/child_process_host.cc
+++ b/mojo/runner/child_process_host.cc
@@ -15,12 +15,12 @@
 #include "base/task_runner.h"
 #include "base/task_runner_util.h"
 #include "base/thread_task_runner_handle.h"
-#include "mojo/edk/embedder/embedder.h"
 #include "mojo/public/cpp/bindings/interface_ptr_info.h"
 #include "mojo/public/cpp/system/core.h"
 #include "mojo/runner/context.h"
 #include "mojo/runner/switches.h"
 #include "mojo/runner/task_runners.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 
 #if defined(OS_LINUX) && !defined(OS_ANDROID)
 #include "sandbox/linux/services/namespace_sandbox.h"
@@ -156,7 +156,8 @@
 void ChildProcessHost::DidCreateChannel(embedder::ChannelInfo* channel_info) {
   DVLOG(2) << "AppChildProcessHost::DidCreateChannel()";
 
-  CHECK(channel_info);
+  DCHECK(channel_info ||
+         base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk"));
   channel_info_ = channel_info;
 }
 
diff --git a/mojo/runner/child_process_host.h b/mojo/runner/child_process_host.h
index 8ab3147..fd6157b 100644
--- a/mojo/runner/child_process_host.h
+++ b/mojo/runner/child_process_host.h
@@ -8,11 +8,11 @@
 #include "base/files/file_path.h"
 #include "base/macros.h"
 #include "base/process/process.h"
-#include "mojo/edk/embedder/channel_info_forward.h"
-#include "mojo/edk/embedder/platform_channel_pair.h"
-#include "mojo/edk/embedder/scoped_platform_handle.h"
 #include "mojo/runner/child_process.mojom.h"
 #include "mojo/runner/child_process_host.h"
+#include "third_party/mojo/src/mojo/edk/embedder/channel_info_forward.h"
+#include "third_party/mojo/src/mojo/edk/embedder/platform_channel_pair.h"
+#include "third_party/mojo/src/mojo/edk/embedder/scoped_platform_handle.h"
 
 namespace mojo {
 namespace runner {
diff --git a/mojo/runner/context.cc b/mojo/runner/context.cc
index c7bda8c9..f1bb1a4 100644
--- a/mojo/runner/context.cc
+++ b/mojo/runner/context.cc
@@ -27,8 +27,6 @@
 #include "mojo/application/public/cpp/application_impl.h"
 #include "mojo/common/trace_controller_impl.h"
 #include "mojo/common/tracing_impl.h"
-#include "mojo/edk/embedder/embedder.h"
-#include "mojo/edk/embedder/simple_platform_support.h"
 #include "mojo/package_manager/package_manager_impl.h"
 #include "mojo/runner/in_process_native_runner.h"
 #include "mojo/runner/out_of_process_native_runner.h"
@@ -40,6 +38,7 @@
 #include "mojo/shell/query_util.h"
 #include "mojo/shell/switches.h"
 #include "mojo/util/filename_util.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "url/gurl.h"
 
 namespace mojo {
@@ -50,7 +49,7 @@
 class Setup {
  public:
   Setup() {
-    embedder::Init(make_scoped_ptr(new embedder::SimplePlatformSupport()));
+    embedder::Init();
   }
 
   ~Setup() {}
diff --git a/mojo/runner/context.h b/mojo/runner/context.h
index 5667385..c6fd5682 100644
--- a/mojo/runner/context.h
+++ b/mojo/runner/context.h
@@ -11,10 +11,10 @@
 #include "base/callback_forward.h"
 #include "base/macros.h"
 #include "base/time/time.h"
-#include "mojo/edk/embedder/process_delegate.h"
 #include "mojo/runner/scoped_user_data_dir.h"
 #include "mojo/runner/task_runners.h"
 #include "mojo/shell/application_manager.h"
+#include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
 #include "url/gurl.h"
 
 namespace mojo {
@@ -26,6 +26,8 @@
 class NativeApplicationLoader;
 
 // The "global" context for the shell's main process.
+// TODO(use_chrome_edk)
+//class Context : public edk::ProcessDelegate {
 class Context : public embedder::ProcessDelegate {
  public:
   explicit Context(const base::FilePath& shell_file_root);
diff --git a/mojo/services/network/public/cpp/BUILD.gn b/mojo/services/network/public/cpp/BUILD.gn
index 030636c3..7a07989 100644
--- a/mojo/services/network/public/cpp/BUILD.gn
+++ b/mojo/services/network/public/cpp/BUILD.gn
@@ -22,10 +22,7 @@
     "//mojo/application/public/cpp",
     "//mojo/environment:chromium",
     "//mojo/message_pump",
-  ]
-
-  mojo_sdk_deps = [
-    "mojo/public/c/system",
-    "mojo/public/cpp/system",
+    "//third_party/mojo/src/mojo/public/c/system",
+    "//third_party/mojo/src/mojo/public/cpp/system",
   ]
 }
diff --git a/net/http/transport_security_state_static.h b/net/http/transport_security_state_static.h
index f185b1c..6fbfee8 100644
--- a/net/http/transport_security_state_static.h
+++ b/net/http/transport_security_state_static.h
@@ -697,2726 +697,2787 @@
 static const uint8 kHSTSHuffmanTree[] = {
     0xf5, 0xe4, 0x00, 0xf2, 0x01, 0x80, 0xb2, 0xf1, 0xb9, 0xb6, 0xb8, 0x04,
     0xb4, 0x05, 0x03, 0x06, 0xb1, 0xb0, 0xb5, 0xb7, 0x09, 0xb3, 0x08, 0x0a,
-    0x0b, 0xea, 0x07, 0x0c, 0xe6, 0x0d, 0x0e, 0xed, 0xe9, 0x0f, 0xf7, 0xae,
+    0x0b, 0xea, 0x07, 0x0c, 0xe6, 0x0d, 0x0e, 0xed, 0xe9, 0x0f, 0xae, 0xf7,
     0x11, 0xe7, 0x12, 0xef, 0x10, 0x13, 0x02, 0x14, 0xeb, 0xe2, 0xe3, 0x16,
-    0xe1, 0x17, 0x18, 0xff, 0xf3, 0xec, 0xe5, 0x1a, 0xfa, 0xf8, 0xf6, 0x1c,
-    0x1d, 0xe8, 0x1e, 0xee, 0xad, 0xf9, 0x20, 0xf0, 0xf4, 0x21, 0x1f, 0x22,
-    0x1b, 0x23, 0x19, 0x24, 0x15, 0x25,
+    0xe1, 0x17, 0x18, 0xff, 0xfa, 0xf8, 0xf6, 0x1a, 0x1b, 0xe8, 0xf3, 0x1c,
+    0xe5, 0x1d, 0xec, 0xee, 0xad, 0xf9, 0x20, 0xf0, 0xf4, 0x21, 0x1f, 0x22,
+    0x1e, 0x23, 0x19, 0x24, 0x15, 0x25,
 };
 
 static const uint8 kPreloadedHSTSData[] = {
-    0xfe, 0x67, 0x36, 0xd7, 0x76, 0x9a, 0x22, 0x5b, 0xd2, 0x15, 0x73, 0xae,
-    0xe7, 0xc7, 0x5f, 0xff, 0x47, 0x62, 0x42, 0xea, 0x73, 0x28, 0xcf, 0x1d,
-    0x73, 0xe8, 0xea, 0x91, 0xfd, 0x04, 0x5d, 0x13, 0xaf, 0xf6, 0x30, 0x31,
-    0xee, 0xa1, 0xd7, 0xff, 0xb4, 0x05, 0xf4, 0x73, 0x9f, 0x0b, 0xf4, 0xeb,
-    0xb3, 0x47, 0x5e, 0x77, 0x69, 0xa2, 0x2d, 0xa9, 0x22, 0x17, 0x12, 0x5a,
-    0x2b, 0x76, 0xf4, 0x75, 0x6c, 0xf1, 0x74, 0x5f, 0x7f, 0xfe, 0x03, 0xf7,
-    0x07, 0x7b, 0xce, 0x65, 0xe4, 0x59, 0xd7, 0xb1, 0xb0, 0x75, 0xfc, 0x11,
-    0x86, 0xac, 0x07, 0x5f, 0xf3, 0x02, 0x9a, 0x41, 0xe6, 0x47, 0x5e, 0x0a,
-    0x4e, 0x75, 0x21, 0xea, 0x39, 0xc5, 0xff, 0xcd, 0xdc, 0x29, 0x03, 0xe5,
-    0x59, 0x56, 0x56, 0x0e, 0xbf, 0xc9, 0xd1, 0x03, 0xa8, 0xd3, 0xaa, 0x11,
-    0x0b, 0x8a, 0x77, 0xff, 0x90, 0x46, 0x39, 0xfb, 0x9b, 0xd6, 0x30, 0x75,
-    0xd9, 0xc9, 0x56, 0x82, 0xad, 0xfe, 0xcd, 0x2f, 0xe2, 0xd7, 0xfb, 0xd9,
-    0xbf, 0xd6, 0x9a, 0x29, 0x93, 0x53, 0x7f, 0x4b, 0xa9, 0xc3, 0x26, 0x3a,
-    0xa0, 0xfc, 0xdd, 0x12, 0xfe, 0xea, 0x36, 0x16, 0x87, 0x5f, 0xe8, 0xfe,
-    0x77, 0x94, 0x2b, 0x9d, 0x61, 0x83, 0xe1, 0x12, 0xbb, 0x32, 0xab, 0x97,
-    0x52, 0x22, 0x13, 0x13, 0x97, 0x64, 0x3e, 0xd4, 0x22, 0x6a, 0xa2, 0x0d,
-    0x76, 0x10, 0x03, 0x0a, 0x5d, 0x10, 0xf1, 0xc6, 0x17, 0xf6, 0x10, 0x37,
-    0xff, 0xff, 0x3a, 0xd9, 0x4d, 0xec, 0x1b, 0xdc, 0x0e, 0x28, 0x9d, 0xee,
-    0x7d, 0x3a, 0xff, 0xf2, 0xac, 0xa3, 0x0a, 0xf3, 0x85, 0x55, 0xf3, 0xe7,
-    0x78, 0xce, 0xbf, 0x6d, 0xae, 0xed, 0x34, 0x54, 0x57, 0xe8, 0xee, 0x6f,
-    0x0e, 0xbf, 0xff, 0x7f, 0x29, 0xd5, 0x68, 0x56, 0xe7, 0x6e, 0xfe, 0x7c,
-    0xef, 0x19, 0xd7, 0xff, 0xe7, 0x90, 0xc6, 0xb3, 0x96, 0x8b, 0xe7, 0x2d,
-    0x3a, 0xcc, 0xc9, 0x37, 0x8c, 0x62, 0x69, 0x9f, 0x49, 0x78, 0x35, 0xdf,
-    0xf8, 0x38, 0xb6, 0x78, 0xf0, 0x53, 0xc7, 0x5e, 0xc6, 0x30, 0xeb, 0xfd,
-    0x99, 0x38, 0x63, 0x02, 0x75, 0xee, 0xc0, 0x4e, 0xbf, 0xd1, 0x08, 0x22,
-    0x05, 0x73, 0xae, 0x70, 0x1d, 0x7d, 0xd4, 0xeb, 0x2a, 0x84, 0x57, 0x28,
-    0x37, 0x31, 0x8f, 0x46, 0xd8, 0x32, 0xbf, 0x6d, 0xae, 0xed, 0x34, 0x57,
-    0xb7, 0xe4, 0xe2, 0x68, 0x27, 0x3a, 0xe8, 0x91, 0xd7, 0x47, 0xe7, 0x59,
-    0x9c, 0x44, 0x4e, 0xcc, 0xdc, 0xaf, 0xf1, 0x5b, 0xff, 0x99, 0x79, 0x33,
-    0x9b, 0x6b, 0xbb, 0x4d, 0x12, 0x35, 0xff, 0xe6, 0x56, 0xf2, 0x67, 0x36,
-    0xd7, 0x76, 0x9a, 0x27, 0x8b, 0xff, 0xcc, 0xad, 0xe4, 0xce, 0x6d, 0xae,
-    0xed, 0x34, 0x4f, 0xf7, 0xff, 0x99, 0x5b, 0xc9, 0x9c, 0xdb, 0x5d, 0xda,
-    0x68, 0xa1, 0xaf, 0xfe, 0x5b, 0xc9, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0xa2,
-    0x2f, 0xfd, 0x26, 0x41, 0xaf, 0x91, 0xa8, 0x91, 0xd4, 0xca, 0x24, 0x61,
-    0x42, 0xff, 0xd3, 0x27, 0x79, 0xcf, 0x07, 0x16, 0x75, 0xfb, 0x6d, 0x77,
-    0x69, 0xa2, 0x91, 0xbf, 0xe8, 0x94, 0x6e, 0x78, 0xdc, 0xe7, 0x5e, 0x79,
-    0x33, 0x87, 0xd8, 0x26, 0x77, 0xf4, 0xb3, 0xbd, 0x79, 0x1d, 0x7f, 0xff,
-    0x60, 0x7b, 0x1f, 0x59, 0xf0, 0xbf, 0xfa, 0xd4, 0x7e, 0x55, 0x99, 0x84,
-    0xd9, 0xd7, 0x0a, 0xbf, 0x19, 0x71, 0x96, 0x5f, 0xb6, 0xd7, 0x76, 0x9a,
-    0x25, 0x0b, 0xff, 0xc2, 0xfe, 0xd7, 0xd1, 0x04, 0x87, 0x16, 0x75, 0xf3,
-    0x2f, 0x26, 0x70, 0xff, 0x16, 0x67, 0x53, 0xb3, 0xcc, 0xa5, 0x3b, 0x0e,
-    0x18, 0x6b, 0xb6, 0x3e, 0xb4, 0x53, 0x57, 0x87, 0x76, 0xe1, 0xe4, 0xb4,
-    0x3e, 0xa8, 0xfe, 0xae, 0xa9, 0x57, 0xd4, 0x3a, 0x01, 0x1c, 0x57, 0x14,
-    0x32, 0x2f, 0xff, 0x32, 0xb7, 0x93, 0x39, 0xb6, 0xbb, 0xb4, 0xd1, 0x39,
-    0xdf, 0xfe, 0x65, 0x6f, 0x26, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x89, 0xbf,
-    0x93, 0x53, 0x49, 0x3f, 0x3a, 0xff, 0x44, 0xff, 0x78, 0xdc, 0x7f, 0x3a,
-    0xf6, 0xe4, 0xcf, 0x4f, 0x9b, 0xe9, 0x75, 0x6d, 0x34, 0xbd, 0x2b, 0x82,
-    0x17, 0xb7, 0xed, 0xb5, 0xdd, 0xa6, 0x88, 0x72, 0xfe, 0x03, 0x76, 0x90,
-    0x27, 0x59, 0x9c, 0x3d, 0xee, 0x99, 0xdf, 0xf4, 0x6f, 0x1b, 0xd8, 0xe6,
-    0x47, 0x5f, 0x35, 0xdd, 0xa6, 0x88, 0xbe, 0xfd, 0x93, 0x49, 0xf4, 0x75,
-    0x6c, 0xf5, 0x3e, 0x96, 0xdf, 0xed, 0x60, 0x7b, 0x9f, 0xb9, 0xd7, 0x0c,
-    0xe7, 0x5f, 0xf7, 0x86, 0x17, 0xf4, 0x3d, 0x83, 0xaa, 0x0f, 0x3d, 0x05,
-    0xae, 0xd7, 0x27, 0x5f, 0x7a, 0x50, 0xa1, 0x54, 0xb3, 0x72, 0xe2, 0xf7,
-    0xe7, 0x9f, 0xd9, 0xd3, 0xac, 0xcc, 0xe9, 0xe8, 0xe4, 0x23, 0x26, 0x24,
-    0xec, 0x20, 0x45, 0x67, 0x8c, 0x82, 0xff, 0xff, 0xf8, 0x5d, 0x9c, 0x02,
-    0xa5, 0x14, 0x4f, 0x77, 0x12, 0x5a, 0xf9, 0x8a, 0x44, 0x8e, 0xbf, 0xf3,
-    0xc9, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0x99, 0x2c, 0xcb, 0x51, 0x98, 0xb8,
-    0x41, 0x5d, 0xd5, 0x9d, 0x7e, 0xdb, 0x5d, 0xda, 0x68, 0xb7, 0xac, 0xc8,
-    0x4f, 0x27, 0x05, 0xaf, 0xff, 0x32, 0xb7, 0x93, 0x39, 0xb6, 0xbb, 0xb4,
-    0xd1, 0x49, 0xdc, 0xac, 0xab, 0x67, 0x5f, 0xd9, 0xe1, 0x88, 0x59, 0xd7,
-    0xf7, 0x3f, 0xfd, 0xdb, 0xfe, 0x75, 0xdd, 0x65, 0x50, 0x7f, 0x9d, 0x20,
-    0x72, 0xaa, 0x85, 0xce, 0x39, 0x47, 0xf3, 0x91, 0x9c, 0x69, 0xe3, 0x81,
-    0x47, 0xd8, 0x69, 0xdf, 0xe6, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x1d, 0xbf,
-    0x6d, 0xae, 0xed, 0x34, 0x4b, 0x17, 0xd9, 0xfa, 0xd0, 0xeb, 0xf3, 0x2b,
-    0x79, 0x33, 0x87, 0xa9, 0xc6, 0x67, 0x7f, 0x99, 0xcd, 0xb5, 0xdd, 0xa6,
-    0x88, 0xc2, 0xf9, 0x99, 0x66, 0x8e, 0xbf, 0xff, 0xe9, 0x69, 0x96, 0xf5,
-    0xe6, 0x6f, 0x73, 0x6a, 0xc7, 0x66, 0x5e, 0x8e, 0xbf, 0x67, 0xbf, 0x86,
-    0x9d, 0x7f, 0xfa, 0x3c, 0x9f, 0xc4, 0x83, 0xd8, 0x16, 0x9d, 0x7e, 0xdb,
-    0x5d, 0xda, 0x68, 0x8f, 0x6f, 0xb4, 0xfc, 0xf0, 0x3a, 0xe9, 0x33, 0x87,
-    0xaf, 0xe3, 0x3b, 0xff, 0xf9, 0xd9, 0x10, 0x67, 0x70, 0x7f, 0xc1, 0xf7,
-    0x70, 0xeb, 0x33, 0xca, 0x77, 0x93, 0x38, 0x6c, 0x9d, 0xe1, 0x3e, 0x25,
-    0xd7, 0xed, 0xb5, 0xdd, 0xa6, 0x8b, 0x0e, 0xff, 0x48, 0x63, 0x35, 0x82,
-    0x75, 0x99, 0xc3, 0xe2, 0xe4, 0xce, 0xff, 0x33, 0x9b, 0x6b, 0xbb, 0x4d,
-    0x17, 0x3d, 0xff, 0xff, 0xff, 0xd0, 0xad, 0x25, 0x3b, 0x7b, 0xf3, 0xe7,
-    0x78, 0xd9, 0x9c, 0x0a, 0x2a, 0xe8, 0x54, 0x73, 0x3c, 0xed, 0x5f, 0xcf,
-    0x9d, 0xe3, 0x3a, 0xa1, 0x73, 0x76, 0x78, 0x49, 0xc9, 0x0d, 0xa7, 0xe9,
-    0x1e, 0xf2, 0xe1, 0x73, 0xe2, 0x9e, 0x23, 0xfb, 0xfc, 0xce, 0x6d, 0xae,
-    0xed, 0x34, 0x43, 0xd7, 0xcd, 0x77, 0x69, 0xa2, 0x26, 0xbf, 0xb3, 0x88,
-    0x0b, 0xc0, 0x9d, 0x7f, 0xbc, 0x07, 0xe7, 0xb1, 0xc0, 0xea, 0xda, 0x24,
-    0x44, 0xb7, 0xc5, 0xf7, 0xf2, 0x7f, 0xaf, 0x98, 0x13, 0xaf, 0xff, 0xd1,
-    0xbf, 0xfb, 0x1c, 0x26, 0x88, 0x5e, 0xb0, 0x27, 0x5f, 0xf7, 0x7b, 0x1c,
-    0x25, 0x9b, 0x83, 0xad, 0xee, 0xa2, 0x41, 0xd5, 0xef, 0xf9, 0x3c, 0x9e,
-    0xcf, 0xe3, 0x67, 0x56, 0x1e, 0xfb, 0x94, 0x5f, 0xff, 0xde, 0xec, 0x6f,
-    0xfd, 0x60, 0x7c, 0x07, 0x6e, 0x6c, 0xeb, 0xbc, 0xb3, 0xaf, 0xff, 0x67,
-    0x7e, 0xcf, 0xa8, 0x4e, 0x7d, 0x0b, 0x3a, 0xff, 0xd3, 0xc4, 0xbe, 0xe6,
-    0xf5, 0x8c, 0x1d, 0x58, 0x8f, 0xee, 0x56, 0xfa, 0x2c, 0x04, 0xcb, 0xef,
-    0x01, 0xfe, 0x9a, 0x21, 0x7b, 0xf7, 0x72, 0x70, 0x09, 0xd7, 0xcf, 0xb8,
-    0xe0, 0x75, 0x04, 0xf2, 0x7f, 0x27, 0xb3, 0x38, 0xad, 0x13, 0x65, 0xfd,
-    0x8c, 0x7b, 0x51, 0x8f, 0x00, 0xf7, 0x83, 0xcd, 0xfd, 0xfe, 0x99, 0xf6,
-    0x80, 0x75, 0xff, 0xf6, 0x24, 0xb4, 0xce, 0x73, 0x27, 0x9f, 0xeb, 0x4e,
-    0xa8, 0x44, 0x1f, 0x4c, 0x2f, 0xca, 0xc6, 0x92, 0x75, 0x41, 0xd7, 0xf2,
-    0xb3, 0xf7, 0xbd, 0xc9, 0xce, 0xb7, 0x4e, 0xa5, 0x64, 0xf1, 0x40, 0x6b,
-    0x7c, 0x1c, 0x19, 0x8e, 0xb9, 0x3c, 0x75, 0xbc, 0x86, 0xdb, 0xa4, 0x37,
-    0xfb, 0x9f, 0x73, 0x20, 0x0a, 0x87, 0x5f, 0xfa, 0x26, 0x1c, 0xe0, 0xeb,
-    0x5a, 0x1d, 0x4e, 0x7e, 0x80, 0x36, 0xbf, 0xff, 0xfb, 0xa0, 0x0a, 0x66,
-    0xe6, 0x1c, 0xe1, 0xdc, 0x0c, 0x6b, 0x50, 0xa1, 0xd7, 0xff, 0x92, 0x69,
-    0x67, 0x32, 0xf8, 0xb7, 0x71, 0x3a, 0xe7, 0xe2, 0x3a, 0xca, 0x8c, 0x4e,
-    0x45, 0x48, 0x4d, 0x34, 0x87, 0xae, 0x6e, 0x97, 0x77, 0x1a, 0x87, 0x5f,
-    0xba, 0xfe, 0x79, 0x1d, 0x7f, 0x26, 0xc7, 0x33, 0x67, 0x5f, 0xe9, 0x6a,
-    0x34, 0xad, 0x55, 0x95, 0x64, 0xeb, 0xff, 0x97, 0xf3, 0x43, 0x9c, 0xc8,
-    0x5e, 0x73, 0xaf, 0x69, 0x3f, 0x3a, 0xb0, 0xf8, 0x91, 0x1a, 0xf3, 0x0c,
-    0x30, 0x55, 0xf9, 0xc7, 0xdd, 0xc2, 0x99, 0x2f, 0xef, 0xcf, 0xe9, 0xb3,
-    0xc7, 0x50, 0x51, 0x37, 0xf9, 0xf8, 0x9a, 0xdf, 0xba, 0x2a, 0xbf, 0x8f,
-    0x88, 0xeb, 0x9d, 0xce, 0xb7, 0x50, 0xf1, 0xdc, 0xce, 0xff, 0xef, 0xd2,
-    0x6f, 0x9d, 0x84, 0xd8, 0x15, 0xce, 0xbf, 0x84, 0x1e, 0x49, 0xe0, 0xeb,
-    0xff, 0x22, 0x90, 0x31, 0xa8, 0x45, 0x9d, 0x7f, 0x67, 0x00, 0x4b, 0x34,
-    0x75, 0xf6, 0x07, 0x27, 0x3a, 0xf9, 0x5f, 0xe4, 0x2b, 0x07, 0x5d, 0xb8,
-    0x3a, 0xb1, 0x5b, 0x6b, 0x49, 0xb9, 0x2a, 0x48, 0xd0, 0x15, 0xdd, 0xe6,
-    0x26, 0x5a, 0x57, 0x4b, 0x04, 0xef, 0xc5, 0xdc, 0x08, 0x78, 0x8a, 0xef,
-    0xcc, 0x46, 0x05, 0x0e, 0xbc, 0x0f, 0x68, 0xeb, 0xff, 0xff, 0xfe, 0xd7,
-    0xce, 0xe4, 0xf0, 0xc7, 0x32, 0xd7, 0xc0, 0x37, 0x7b, 0x8f, 0x93, 0x29,
-    0xcf, 0xcf, 0x9d, 0xe3, 0x3a, 0xb1, 0x1d, 0x8d, 0x26, 0xf0, 0xe5, 0xc0,
-    0xfc, 0xeb, 0xdf, 0x24, 0xd3, 0xaa, 0x0d, 0xaa, 0xc5, 0xef, 0xff, 0xed,
-    0xfc, 0x1c, 0xe1, 0x9b, 0x97, 0xc8, 0x0b, 0xcd, 0xa3, 0xaf, 0xff, 0xfe,
-    0x1e, 0x61, 0x41, 0xc0, 0xf5, 0x26, 0xf9, 0xac, 0xe6, 0x5b, 0xc6, 0x0e,
-    0xac, 0x46, 0xb0, 0xb0, 0x5f, 0x78, 0x11, 0x39, 0xd7, 0xfa, 0x59, 0xdc,
-    0x5c, 0x34, 0xea, 0x43, 0xd3, 0xf1, 0x15, 0xff, 0xfd, 0xcc, 0xb4, 0xbc,
-    0x1f, 0x9c, 0x49, 0xd9, 0xd3, 0x36, 0x75, 0x95, 0xce, 0xac, 0x3f, 0x36,
-    0xb0, 0x5f, 0xff, 0xf9, 0x8f, 0x83, 0x8d, 0xea, 0x0e, 0x03, 0x9f, 0x7c,
-    0x76, 0x31, 0x43, 0xaf, 0xf2, 0x81, 0x04, 0x74, 0x60, 0xeb, 0xfd, 0xcc,
-    0xb4, 0xa0, 0x23, 0x93, 0xaf, 0xf3, 0xb0, 0x09, 0xa3, 0xce, 0x75, 0x42,
-    0x61, 0x98, 0xe2, 0x86, 0x42, 0x6d, 0x7f, 0xe8, 0xd0, 0xe7, 0x0f, 0x92,
-    0x5c, 0x8e, 0xbe, 0xff, 0xc9, 0x39, 0xd7, 0xfb, 0xdd, 0x41, 0xff, 0xea,
-    0xce, 0xbf, 0xd3, 0xc2, 0xc6, 0x39, 0xfc, 0xeb, 0x44, 0x8f, 0xa5, 0xcd,
-    0x6f, 0xfe, 0x7d, 0xcb, 0xe7, 0x86, 0x25, 0x9e, 0x3a, 0xa1, 0x5d, 0x36,
-    0x3a, 0x24, 0x25, 0x37, 0x19, 0x6f, 0x4e, 0x9d, 0x04, 0x61, 0x18, 0x02,
-    0x6b, 0xff, 0xed, 0xa0, 0x15, 0x31, 0xf3, 0x40, 0xfd, 0x79, 0xe3, 0xae,
-    0x04, 0x8e, 0xbf, 0x47, 0xfa, 0x9f, 0xc7, 0x5e, 0x7f, 0x68, 0xeb, 0x81,
-    0x39, 0xd7, 0x87, 0xd3, 0x48, 0xd9, 0x6c, 0x6e, 0xfe, 0x03, 0x7e, 0x07,
-    0x96, 0x0e, 0xa8, 0x3e, 0x54, 0x33, 0xbf, 0xdb, 0x80, 0xc7, 0x62, 0x47,
-    0x5f, 0xff, 0x47, 0xbe, 0x08, 0x38, 0xbe, 0x67, 0xb8, 0xf3, 0xc7, 0x52,
-    0x22, 0x24, 0x06, 0x37, 0xff, 0x76, 0x14, 0xf9, 0xe1, 0x7f, 0x47, 0x8e,
-    0xbf, 0xdf, 0x39, 0x92, 0x74, 0x0b, 0x3a, 0xbf, 0x3f, 0xb1, 0x45, 0xbf,
-    0xfb, 0x38, 0x60, 0x7e, 0x79, 0x44, 0x63, 0x47, 0x5f, 0xfb, 0x73, 0x7c,
-    0xd4, 0x24, 0xef, 0xe3, 0xaa, 0x11, 0x58, 0x12, 0x20, 0x24, 0xdc, 0xff,
-    0x9d, 0x7f, 0xfd, 0xf0, 0x63, 0x51, 0x38, 0xe0, 0x7a, 0x93, 0x1d, 0x7f,
-    0xff, 0xf6, 0xb6, 0x31, 0x37, 0xcf, 0xbe, 0x49, 0x67, 0x3e, 0xce, 0x03,
-    0x9a, 0x3a, 0xb6, 0x8c, 0x71, 0x50, 0xaf, 0x23, 0xfc, 0x10, 0xdd, 0xa3,
-    0xae, 0x9a, 0x47, 0x54, 0x1a, 0x1d, 0x85, 0x5f, 0xfc, 0x3e, 0xd7, 0x04,
-    0xf4, 0x60, 0xcc, 0x75, 0xfb, 0x69, 0xa8, 0xe4, 0xea, 0xc3, 0xeb, 0x74,
-    0x4b, 0xfd, 0x3a, 0xa2, 0x69, 0x27, 0xb4, 0x75, 0xf8, 0x7d, 0xdc, 0xe2,
-    0x3a, 0xfd, 0x36, 0x9f, 0x6a, 0x1d, 0x79, 0xd8, 0xdc, 0x1e, 0x96, 0x14,
-    0xd4, 0x91, 0xba, 0x84, 0x1b, 0x84, 0x5d, 0xff, 0x75, 0x37, 0x37, 0x5f,
-    0x36, 0x75, 0xff, 0xff, 0xfd, 0xfe, 0x87, 0x1f, 0x9f, 0x81, 0xe8, 0x3e,
-    0x0e, 0x73, 0x2c, 0x04, 0xe3, 0x8f, 0xc9, 0xd4, 0xd4, 0x63, 0x21, 0xc5,
-    0xe7, 0x76, 0x9a, 0x29, 0x8a, 0xc3, 0xc9, 0x69, 0x15, 0xff, 0xb0, 0x79,
-    0x96, 0xbd, 0x1b, 0x98, 0xeb, 0xd8, 0x9f, 0x9d, 0x6c, 0x3a, 0xf7, 0x23,
-    0x9f, 0x9a, 0xae, 0x03, 0x74, 0x88, 0x9e, 0x76, 0x9b, 0xfd, 0xbe, 0xbf,
-    0xc5, 0x86, 0x63, 0xaf, 0xf7, 0xce, 0x64, 0x31, 0x9a, 0x3a, 0x90, 0xfa,
-    0x9c, 0xda, 0xff, 0xfd, 0xfa, 0x6b, 0xe7, 0x5f, 0x5e, 0x89, 0xb5, 0xdc,
-    0x3a, 0xfe, 0x4e, 0xba, 0x4f, 0x07, 0x5e, 0x94, 0x72, 0x75, 0xfe, 0x58,
-    0x7b, 0x13, 0xe3, 0x07, 0x56, 0x1f, 0xdf, 0x25, 0x6e, 0x39, 0x7f, 0xff,
-    0x87, 0x1b, 0xef, 0x47, 0xb5, 0x30, 0xe3, 0x1f, 0x21, 0x58, 0x3a, 0xff,
-    0xcd, 0x85, 0xf7, 0x35, 0x88, 0x27, 0x54, 0x22, 0x8b, 0xac, 0xf7, 0xed,
-    0xc7, 0x08, 0xd9, 0xd7, 0xf3, 0x8f, 0xc0, 0xc0, 0x9d, 0x58, 0x7e, 0xc8,
-    0x44, 0x02, 0x8a, 0x86, 0x57, 0x84, 0xea, 0xd2, 0x16, 0x0c, 0x30, 0x14,
-    0x85, 0x4b, 0x63, 0x49, 0xe6, 0x32, 0xe4, 0x49, 0x9a, 0x36, 0x8d, 0xc6,
-    0x86, 0xb8, 0x5f, 0xf6, 0x11, 0x7f, 0x90, 0x0c, 0x34, 0xfd, 0x1a, 0x35,
-    0xff, 0x6d, 0xd8, 0xf8, 0xe1, 0x79, 0xce, 0xbf, 0x9d, 0x89, 0x85, 0x02,
-    0x75, 0xff, 0xfe, 0x0e, 0x4e, 0xe3, 0xed, 0x43, 0x7e, 0x2d, 0x68, 0x2d,
-    0x3a, 0xfe, 0x0e, 0x9e, 0x39, 0x91, 0xd5, 0x08, 0x8e, 0x76, 0x1b, 0xfe,
-    0x89, 0xba, 0x90, 0xb7, 0x09, 0xd4, 0xa2, 0x69, 0xdb, 0x3b, 0x18, 0x5d,
-    0x80, 0x86, 0xfb, 0x05, 0x45, 0x73, 0xaf, 0xff, 0xff, 0xdd, 0x4f, 0x77,
-    0x37, 0x1c, 0x3e, 0x2c, 0x1c, 0x5f, 0x33, 0x99, 0x60, 0x07, 0xfd, 0x1d,
-    0x6f, 0x22, 0x2c, 0x74, 0x49, 0x7f, 0xe8, 0x6f, 0xc1, 0x7d, 0x2e, 0x04,
-    0xeb, 0xff, 0xf6, 0x67, 0x51, 0xbd, 0xcf, 0x9a, 0x07, 0x61, 0x5c, 0xeb,
-    0xff, 0xef, 0x77, 0x3f, 0xf8, 0xb8, 0xcf, 0x07, 0x04, 0xeb, 0xf9, 0xc3,
-    0xbd, 0x82, 0x73, 0xaf, 0xd1, 0x83, 0xee, 0x33, 0xa9, 0xa7, 0xac, 0xb2,
-    0xeb, 0xef, 0x26, 0xf0, 0xeb, 0x73, 0xf0, 0xf0, 0xb0, 0x8a, 0xda, 0xc4,
-    0xc4, 0x9e, 0x1d, 0x14, 0xb4, 0xf5, 0x04, 0xf7, 0xd1, 0xb5, 0x5f, 0xff,
-    0xff, 0x87, 0x39, 0x92, 0x68, 0x73, 0x87, 0x72, 0x6e, 0xc0, 0xcd, 0xf1,
-    0xda, 0x9c, 0x0e, 0xa4, 0x45, 0xe8, 0x0d, 0xaf, 0xff, 0x20, 0x7e, 0x2d,
-    0x3e, 0x40, 0x5e, 0x6d, 0x1d, 0x74, 0xa4, 0x75, 0xb7, 0x07, 0xc7, 0x3a,
-    0x6d, 0xfa, 0x51, 0xcc, 0xb4, 0x75, 0xff, 0xff, 0xff, 0xb0, 0x54, 0xf8,
-    0x9d, 0x03, 0x33, 0x27, 0xa1, 0x62, 0xea, 0x75, 0x19, 0xce, 0xf3, 0xfc,
-    0x04, 0xab, 0xff, 0xff, 0x9a, 0x8c, 0x04, 0x1b, 0xf8, 0x08, 0x9f, 0x4d,
-    0xe8, 0x3b, 0xcb, 0xb0, 0x75, 0xc0, 0x9f, 0x94, 0xd0, 0x10, 0xa3, 0x50,
-    0x9f, 0xa8, 0x5c, 0xe9, 0xec, 0xab, 0x97, 0x84, 0x28, 0xc6, 0xd1, 0x7f,
-    0x9e, 0x58, 0xb7, 0x1f, 0xce, 0xbe, 0xce, 0xc4, 0xc7, 0x5e, 0x5b, 0x7e,
-    0x74, 0xf4, 0x9c, 0xc6, 0xff, 0xff, 0xf6, 0xda, 0x39, 0xc3, 0xe6, 0x93,
-    0x07, 0xff, 0x83, 0x9c, 0x07, 0x35, 0xc0, 0xeb, 0xfe, 0x6e, 0x3a, 0xfe,
-    0x71, 0xc2, 0xce, 0xac, 0x45, 0xd6, 0xdf, 0xaf, 0xff, 0xc8, 0x3e, 0xee,
-    0x71, 0x7a, 0x6c, 0x57, 0x71, 0xfc, 0xeb, 0xf4, 0x31, 0xf3, 0x53, 0x1d,
-    0x7f, 0xe1, 0x9c, 0x73, 0x86, 0x81, 0x1c, 0x9d, 0x7f, 0xe0, 0xf6, 0x39,
-    0xf8, 0xab, 0xf8, 0x7e, 0x87, 0x54, 0x22, 0x2a, 0x74, 0x0a, 0x44, 0xd5,
-    0x34, 0x45, 0xe5, 0xa0, 0x42, 0xd6, 0xff, 0xc3, 0x26, 0xf5, 0x3a, 0x20,
-    0x9c, 0xeb, 0xde, 0xc5, 0x49, 0xd5, 0x07, 0xbb, 0x87, 0xd7, 0xb8, 0xf3,
-    0xa7, 0x5d, 0x81, 0x3a, 0xa7, 0x56, 0x6b, 0x29, 0x48, 0x7a, 0x84, 0xff,
-    0x88, 0x38, 0x0f, 0x5f, 0x93, 0xda, 0xcf, 0xce, 0xbf, 0x77, 0x38, 0x27,
-    0x03, 0xaf, 0x26, 0x7e, 0x75, 0xfc, 0x18, 0x1e, 0xbc, 0x8e, 0xbd, 0x01,
-    0x83, 0xaf, 0xd9, 0xed, 0x3c, 0xdf, 0x0f, 0x15, 0x65, 0x77, 0xf3, 0x1f,
-    0x15, 0xb5, 0x6a, 0xaa, 0x56, 0xce, 0xa9, 0x22, 0x19, 0x10, 0x6f, 0xff,
-    0xdb, 0x06, 0xf7, 0x03, 0x8a, 0x27, 0x7b, 0x9f, 0x4e, 0xbe, 0x03, 0xf3,
-    0xe3, 0xaa, 0x49, 0xe8, 0x84, 0x9d, 0x42, 0xa9, 0xa1, 0xcd, 0xb2, 0x2e,
-    0xab, 0x51, 0xd7, 0xf6, 0x9a, 0xd7, 0x15, 0x0e, 0xa5, 0x58, 0xdb, 0xf8,
-    0x2a, 0xff, 0x0f, 0xce, 0x1c, 0xcb, 0x53, 0x1d, 0x74, 0xfc, 0x9d, 0x7e,
-    0xeb, 0xab, 0xc7, 0xe7, 0x50, 0x4f, 0xed, 0xce, 0x78, 0x86, 0x2f, 0xf6,
-    0xe6, 0x1c, 0xeb, 0xf8, 0xea, 0x84, 0xc1, 0x32, 0x14, 0x28, 0x63, 0x7e,
-    0x4d, 0x87, 0x04, 0xeb, 0xf7, 0xf9, 0xef, 0xb3, 0x9d, 0x7f, 0x98, 0xf6,
-    0x77, 0xe7, 0x3a, 0x3a, 0xa0, 0xf8, 0x9c, 0xae, 0xa4, 0x8d, 0xae, 0x99,
-    0x8c, 0x21, 0xef, 0xfb, 0xdd, 0xc9, 0x38, 0xe7, 0x27, 0x5f, 0xff, 0xf0,
-    0xbf, 0xfa, 0x9f, 0x10, 0x7c, 0x39, 0xc3, 0xe6, 0x98, 0x13, 0xa8, 0x51,
-    0x41, 0xe3, 0x7b, 0xff, 0x26, 0x4d, 0xf3, 0x51, 0xd7, 0x57, 0x3a, 0xff,
-    0xb9, 0xc8, 0xe6, 0x61, 0x85, 0x9d, 0x7f, 0x73, 0xae, 0xe3, 0xec, 0xeb,
-    0xff, 0xff, 0x22, 0xf6, 0x99, 0xc8, 0x83, 0xd1, 0xdf, 0x9c, 0x13, 0xd3,
-    0x41, 0xd4, 0xe8, 0x9c, 0xf1, 0x6d, 0x05, 0x33, 0x9e, 0xa1, 0x7a, 0x1a,
-    0xb7, 0xfd, 0x9b, 0x9e, 0x13, 0x78, 0x27, 0x59, 0x67, 0x7c, 0x36, 0xd7,
-    0x87, 0x02, 0x75, 0x41, 0xbc, 0xe4, 0x8a, 0xfe, 0xe7, 0x59, 0x82, 0xa1,
-    0xd7, 0xcb, 0xfb, 0x1f, 0x9d, 0x7f, 0xfa, 0x70, 0xed, 0xda, 0x39, 0xc3,
-    0x69, 0xa3, 0xab, 0x11, 0x38, 0x85, 0xa0, 0x24, 0xbf, 0xcf, 0xee, 0xbc,
-    0xdf, 0x56, 0x75, 0xe0, 0x73, 0xf9, 0xd5, 0x0a, 0xd0, 0x72, 0x35, 0xb4,
-    0x85, 0x46, 0xe1, 0x7a, 0xe5, 0xc2, 0x6b, 0x7f, 0x79, 0xfb, 0xf0, 0x30,
-    0x75, 0xff, 0xef, 0x6b, 0xee, 0xbe, 0x78, 0x62, 0x59, 0xe3, 0xaf, 0xf7,
-    0x92, 0x7c, 0xe8, 0x3c, 0x75, 0xa6, 0x3a, 0xfe, 0xc0, 0x67, 0x5b, 0x39,
-    0xd7, 0x67, 0x30, 0x6f, 0xb4, 0x23, 0x7f, 0x75, 0xe4, 0xbd, 0xa1, 0xd7,
-    0xff, 0x28, 0xa3, 0xfb, 0x5e, 0x18, 0xe6, 0x47, 0x5f, 0xde, 0x18, 0x96,
-    0x78, 0xea, 0x83, 0xf1, 0x92, 0x35, 0xc9, 0xa3, 0xaf, 0x6f, 0x39, 0x3a,
-    0x82, 0x6c, 0x7f, 0x15, 0xbf, 0xfc, 0xea, 0x79, 0x48, 0x19, 0x67, 0x51,
-    0x67, 0x5f, 0x93, 0x5a, 0x85, 0x9d, 0x48, 0x89, 0x11, 0x22, 0xe0, 0x93,
-    0x50, 0xab, 0x23, 0x0b, 0x94, 0x4d, 0x47, 0x1f, 0xcb, 0x06, 0x13, 0xa0,
-    0x87, 0x1d, 0xf8, 0x28, 0x2e, 0x13, 0xaf, 0xff, 0xd2, 0xee, 0x4d, 0xd8,
-    0x15, 0x07, 0x3d, 0xd0, 0x1d, 0x48, 0x7f, 0x5b, 0x25, 0xbf, 0xff, 0xc9,
-    0x9c, 0xcb, 0x5e, 0xec, 0x2e, 0x10, 0x3f, 0x21, 0x58, 0x3a, 0xff, 0x38,
-    0xfc, 0x6e, 0xbf, 0x09, 0xd7, 0xfe, 0x06, 0xbe, 0x2f, 0xef, 0x5f, 0xb0,
-    0x75, 0xfb, 0x3c, 0x0c, 0xe4, 0xeb, 0xca, 0x67, 0x27, 0x5d, 0x13, 0x7c,
-    0x3c, 0x4f, 0x13, 0xd0, 0xa2, 0xd8, 0x10, 0x86, 0xbf, 0xff, 0xff, 0x00,
-    0x7e, 0x30, 0xfc, 0xcb, 0x6f, 0xff, 0xcd, 0x02, 0x39, 0xee, 0x20, 0xe2,
-    0x87, 0x5f, 0xff, 0x81, 0xbd, 0xe7, 0xb5, 0xd4, 0xcf, 0x9d, 0xfe, 0x0e,
-    0xac, 0x47, 0x07, 0x61, 0x13, 0x7e, 0xc1, 0x6f, 0xd5, 0x9d, 0x7f, 0xf7,
-    0x72, 0x06, 0x61, 0xcf, 0x69, 0xce, 0xb4, 0xbc, 0x7d, 0x3c, 0x45, 0x17,
-    0xff, 0xe0, 0xe2, 0xfe, 0x71, 0x7a, 0x35, 0x34, 0x9f, 0x73, 0x9d, 0x7f,
-    0xff, 0x79, 0x27, 0xc0, 0xfc, 0x5b, 0xcb, 0x69, 0x3b, 0xac, 0xeb, 0xfd,
-    0x3b, 0xac, 0x63, 0x73, 0x1d, 0x7f, 0xdc, 0xe2, 0x9f, 0xaf, 0x3e, 0x6f,
-    0x11, 0x20, 0x8b, 0xb7, 0xfd, 0x83, 0x3f, 0xcf, 0xdd, 0xe6, 0x3a, 0xff,
-    0xb7, 0x3c, 0x4f, 0x38, 0x37, 0x39, 0xd7, 0xfe, 0xf9, 0x37, 0x40, 0xa2,
-    0x60, 0xa8, 0x75, 0xfe, 0x1f, 0x9a, 0x07, 0x18, 0x36, 0x75, 0x61, 0xfd,
-    0x01, 0x0a, 0xa1, 0x1b, 0x1a, 0x85, 0xbd, 0xff, 0xe9, 0xfe, 0x6b, 0xa0,
-    0xf9, 0xed, 0x6a, 0x36, 0x75, 0xff, 0xf7, 0x62, 0x7f, 0x83, 0x9c, 0x1f,
-    0xbd, 0x8e, 0x4e, 0xbf, 0xff, 0xee, 0x74, 0x98, 0xc7, 0xce, 0xe7, 0xb5,
-    0x93, 0xfc, 0xc4, 0x09, 0xd4, 0x14, 0x5f, 0x62, 0x9d, 0xfd, 0x3f, 0xa6,
-    0x18, 0x59, 0xd7, 0xff, 0xf6, 0x4f, 0x88, 0x11, 0x07, 0x7e, 0x40, 0x5e,
-    0x6d, 0x1d, 0x58, 0x9d, 0xd2, 0x46, 0x1c, 0xe4, 0x5a, 0x2e, 0xa9, 0xd7,
-    0xe2, 0x02, 0xcc, 0xa4, 0x3a, 0xdb, 0x18, 0x3f, 0x30, 0x90, 0x42, 0xbd,
-    0xc3, 0xb1, 0x6a, 0x9a, 0x8c, 0x4f, 0xd1, 0xf0, 0xdf, 0xef, 0x0e, 0x7b,
-    0xb9, 0x39, 0xd7, 0xfe, 0x7d, 0xf7, 0x3d, 0x02, 0x9f, 0x9d, 0x7f, 0xfc,
-    0x39, 0x3f, 0xcf, 0xc1, 0xec, 0xc5, 0xfe, 0xc1, 0xd7, 0xd2, 0xf2, 0x4e,
-    0x75, 0xff, 0x63, 0x1c, 0xcb, 0x5f, 0x3c, 0x87, 0x5f, 0xff, 0x4d, 0xd4,
-    0x10, 0xfc, 0xfa, 0xd1, 0xce, 0xe1, 0xd7, 0xfd, 0xd4, 0x5c, 0x60, 0xfb,
-    0x47, 0x5f, 0xff, 0xe0, 0x7b, 0x60, 0x9b, 0xe7, 0xa6, 0xe8, 0x3f, 0xf2,
-    0x67, 0x11, 0xd7, 0xd0, 0xd8, 0x5f, 0xc4, 0x79, 0x35, 0x48, 0x4d, 0xaa,
-    0x15, 0x2c, 0xb4, 0xcb, 0x67, 0x8e, 0xa8, 0x24, 0x5c, 0x51, 0x97, 0x5f,
-    0xff, 0xdb, 0xc7, 0x5f, 0xc5, 0x1f, 0x9e, 0xe7, 0x7b, 0x1e, 0x3a, 0xff,
-    0x42, 0xf3, 0x37, 0x34, 0x8e, 0xbe, 0x4f, 0x24, 0x1d, 0x7f, 0xff, 0xf8,
-    0x51, 0x4e, 0xbc, 0xdf, 0x04, 0x1c, 0x5f, 0x33, 0x99, 0x60, 0x07, 0xfd,
-    0x1d, 0x7e, 0xea, 0x40, 0xce, 0x75, 0xde, 0x85, 0xa2, 0x9b, 0x84, 0x20,
-    0x2a, 0x48, 0xfa, 0x48, 0x62, 0xd4, 0x33, 0x30, 0xb2, 0x7e, 0xa5, 0x25,
-    0x85, 0x6d, 0x7f, 0xab, 0xaf, 0x19, 0x65, 0xfa, 0x07, 0xc9, 0xc0, 0xeb,
-    0xef, 0x69, 0xff, 0x3a, 0xff, 0xee, 0xa7, 0xc4, 0xd8, 0x27, 0x7d, 0xb4,
-    0xeb, 0xe4, 0xeb, 0xce, 0x75, 0xf7, 0x08, 0xf4, 0x1d, 0x7e, 0xd6, 0x79,
-    0x34, 0x75, 0xf8, 0x0a, 0x91, 0x7f, 0x1d, 0x7f, 0x75, 0xe7, 0xf9, 0x2f,
-    0x1d, 0x7e, 0x7d, 0x8f, 0x28, 0x75, 0x42, 0x20, 0x10, 0xab, 0xc6, 0x14,
-    0x14, 0xe9, 0xb0, 0x9d, 0x42, 0x26, 0xa3, 0x21, 0x0c, 0xc4, 0x5e, 0x85,
-    0x35, 0xfe, 0xec, 0x20, 0xbe, 0xd4, 0x3a, 0xfe, 0x84, 0x17, 0xda, 0x87,
-    0x5f, 0xef, 0xdf, 0xfd, 0xed, 0x37, 0xf0, 0xf7, 0x3a, 0x63, 0x6f, 0xce,
-    0xbf, 0xa3, 0x73, 0xc6, 0xe7, 0x3a, 0xf0, 0x1f, 0x47, 0x54, 0x8f, 0x27,
-    0xe9, 0x75, 0xff, 0xfc, 0x9b, 0xf9, 0x89, 0x82, 0xa7, 0x53, 0x17, 0x8d,
-    0x3a, 0xff, 0xff, 0x92, 0x7d, 0xc2, 0xf4, 0x08, 0xf9, 0x1b, 0x80, 0xf6,
-    0x16, 0x75, 0x62, 0x30, 0x36, 0xb3, 0x7e, 0xff, 0x49, 0xcb, 0x07, 0x5f,
-    0xfb, 0x79, 0xcf, 0x79, 0x85, 0xcf, 0x07, 0x5f, 0xff, 0xfe, 0xde, 0xd2,
-    0x7f, 0x9d, 0xcf, 0x0c, 0x4d, 0xdc, 0x9e, 0x39, 0xf0, 0x1a, 0x75, 0xff,
-    0xff, 0xd0, 0xa7, 0x63, 0xe0, 0xe0, 0x14, 0xf9, 0xcc, 0xb4, 0x83, 0xf6,
-    0x27, 0x3a, 0xfd, 0xce, 0x93, 0x04, 0xea, 0xc4, 0x4f, 0x81, 0xe6, 0x91,
-    0x33, 0xde, 0xc6, 0x37, 0x7f, 0xf4, 0xb4, 0x8a, 0x76, 0x12, 0x78, 0x50,
-    0xeb, 0xfe, 0x10, 0x4c, 0x39, 0xd7, 0xf1, 0xd7, 0xfb, 0xb0, 0xc0, 0x7a,
-    0xeb, 0x3a, 0xff, 0x97, 0x9a, 0xf9, 0x30, 0xc2, 0xce, 0xa0, 0x9f, 0x6a,
-    0xcc, 0xef, 0xff, 0xf9, 0xf7, 0xdc, 0xf2, 0x60, 0xcf, 0xa8, 0xc1, 0x0f,
-    0x60, 0xeb, 0xef, 0x7c, 0x9f, 0x67, 0x57, 0x28, 0x87, 0x76, 0x2b, 0xff,
-    0xff, 0x73, 0x93, 0x83, 0x8b, 0xe7, 0x32, 0xf4, 0x31, 0xf3, 0x37, 0xff,
-    0xf0, 0x75, 0xff, 0xe6, 0x1c, 0x67, 0x58, 0x10, 0x28, 0x28, 0x75, 0xfd,
-    0x37, 0x32, 0x04, 0x78, 0xeb, 0xfe, 0xeb, 0xac, 0x73, 0xaf, 0xe3, 0xaf,
-    0xb3, 0x7f, 0xb0, 0x75, 0x42, 0x22, 0x34, 0x5f, 0xe3, 0x6b, 0xfb, 0x3d,
-    0xbd, 0xe4, 0x8e, 0xbf, 0x87, 0x3a, 0x38, 0xd3, 0xaf, 0x87, 0x35, 0xf2,
-    0x63, 0xd6, 0xf1, 0x65, 0xff, 0x62, 0xfb, 0x09, 0xb0, 0x2b, 0x9d, 0x41,
-    0x5d, 0xea, 0xc2, 0x25, 0x0a, 0x9b, 0x1b, 0xef, 0x25, 0x28, 0x8b, 0xb8,
-    0x52, 0x76, 0x15, 0x2e, 0x47, 0xa7, 0x9f, 0x43, 0x43, 0x84, 0x21, 0x7e,
-    0x9d, 0xdf, 0xfb, 0x18, 0x1c, 0x06, 0x29, 0x2f, 0xce, 0xbf, 0xf0, 0xe7,
-    0xcd, 0xe7, 0x47, 0x26, 0x3a, 0xff, 0xff, 0x75, 0xff, 0xd7, 0xc1, 0xce,
-    0x03, 0x9a, 0xc5, 0xc3, 0x4e, 0xa1, 0x45, 0x06, 0x8f, 0xa9, 0x56, 0x64,
-    0x7d, 0xc2, 0xd6, 0x4f, 0x67, 0x73, 0x0d, 0x27, 0x86, 0xfd, 0xfd, 0x9d,
-    0xfa, 0x3c, 0xfe, 0x75, 0xfd, 0xdc, 0x1f, 0x7e, 0x03, 0xaf, 0xc3, 0x0b,
-    0x70, 0x9d, 0x7f, 0xb2, 0x6e, 0xe7, 0xa0, 0x27, 0x5f, 0xc3, 0xe7, 0x5a,
-    0x78, 0xeb, 0x48, 0xea, 0x83, 0x77, 0xe2, 0xbb, 0xc2, 0xd8, 0x3a, 0xff,
-    0xff, 0xfb, 0xb9, 0xed, 0x3c, 0xdf, 0x07, 0x39, 0x96, 0x02, 0x71, 0xc0,
-    0xf5, 0x26, 0x3a, 0xe0, 0x28, 0x75, 0x22, 0x2c, 0x76, 0x35, 0xe8, 0x40,
-    0x5f, 0xd9, 0x38, 0xe7, 0x3a, 0x3a, 0xff, 0xe1, 0xff, 0x8f, 0x3a, 0x90,
-    0xb7, 0x09, 0xd7, 0xff, 0xff, 0xe9, 0x6b, 0x40, 0x8f, 0x20, 0x70, 0x66,
-    0xf8, 0x39, 0xb8, 0x1f, 0x77, 0x38, 0x8e, 0xbf, 0xfb, 0x99, 0x6b, 0x17,
-    0xcc, 0x77, 0xb0, 0x75, 0x72, 0x8c, 0xad, 0xc2, 0x16, 0xda, 0x3a, 0xb1,
-    0x34, 0x80, 0x46, 0x1f, 0xf4, 0xa6, 0xfe, 0xce, 0x65, 0x1f, 0xc1, 0xd7,
-    0xe1, 0xce, 0xbf, 0x8e, 0xb4, 0x72, 0x7a, 0x4b, 0x2d, 0xbe, 0xf8, 0xd9,
-    0xd8, 0x3a, 0xfd, 0x3f, 0xc0, 0x44, 0xc7, 0x5f, 0xff, 0xf0, 0xc7, 0xfc,
-    0xcb, 0x40, 0x8f, 0x0e, 0x05, 0x33, 0x73, 0x1d, 0x4e, 0x89, 0x1f, 0x15,
-    0xd4, 0x2e, 0x7a, 0x04, 0xc1, 0x0b, 0x66, 0x25, 0xeb, 0x6b, 0xc3, 0x44,
-    0x4d, 0x35, 0x1b, 0xa8, 0x21, 0x15, 0xc0, 0xa3, 0xec, 0x2d, 0xef, 0xd2,
-    0x4d, 0xe7, 0x27, 0x5e, 0xd7, 0x70, 0xeb, 0xf6, 0x6a, 0x7c, 0x60, 0xea,
-    0xe4, 0xfa, 0xa6, 0x27, 0xe8, 0xdd, 0xff, 0xf4, 0xf8, 0xd0, 0xf5, 0x31,
-    0x4f, 0x8a, 0x02, 0x0e, 0xbf, 0xef, 0x9f, 0x7c, 0x9c, 0x20, 0x5a, 0x75,
-    0x22, 0x24, 0x3a, 0xa7, 0x7f, 0xfa, 0x39, 0x96, 0xbc, 0xf3, 0xf1, 0x0e,
-    0x72, 0x75, 0xff, 0x76, 0x74, 0xc1, 0xe6, 0x5a, 0x3a, 0xff, 0xb9, 0xee,
-    0x34, 0x70, 0x0a, 0xe7, 0x5a, 0x50, 0x7e, 0x98, 0x73, 0x7f, 0x27, 0x3f,
-    0xed, 0xc2, 0x75, 0xfb, 0x13, 0x37, 0xf9, 0xd5, 0xd3, 0xd4, 0x12, 0xeb,
-    0xee, 0x2f, 0x67, 0x4e, 0xb9, 0x16, 0x75, 0xff, 0xff, 0xb9, 0x93, 0xf3,
-    0xf0, 0x41, 0xc5, 0xf3, 0x39, 0x96, 0x00, 0x7f, 0xd1, 0xd4, 0xb4, 0x45,
-    0xf1, 0x0a, 0xde, 0xe3, 0x45, 0x49, 0xd5, 0xf1, 0x31, 0x89, 0xc8, 0x72,
-    0x15, 0xfc, 0x64, 0xd7, 0xff, 0xff, 0xe8, 0xe7, 0x40, 0x8e, 0x7e, 0x77,
-    0x03, 0xf0, 0x70, 0x0a, 0x7c, 0xd7, 0xff, 0xa7, 0x8e, 0xbf, 0x40, 0xf2,
-    0xf3, 0x9d, 0x7f, 0xff, 0xff, 0xec, 0x6c, 0x76, 0x17, 0xec, 0xd6, 0xa3,
-    0x7b, 0x81, 0xc9, 0xf0, 0x1a, 0x04, 0xc3, 0x0b, 0x3a, 0xf0, 0x36, 0xa1,
-    0xd4, 0xb4, 0x5a, 0x71, 0xc2, 0x5e, 0xfc, 0xff, 0xfd, 0x79, 0xce, 0xac,
-    0x3d, 0x54, 0x2b, 0xbc, 0x9f, 0xc1, 0xd7, 0xf0, 0x47, 0x3a, 0xfe, 0x3a,
-    0xfd, 0xee, 0x64, 0x9b, 0x3a, 0xb0, 0xf4, 0xf4, 0x57, 0x53, 0xa2, 0x3f,
-    0xf6, 0xeb, 0xfd, 0x38, 0x23, 0xcb, 0x4f, 0x1d, 0x7f, 0xe8, 0x53, 0x88,
-    0x18, 0x33, 0x7d, 0x59, 0xd5, 0x87, 0xef, 0xc9, 0x9d, 0xff, 0xb3, 0x3f,
-    0xd7, 0xcd, 0xe8, 0x3a, 0x3a, 0xff, 0x6f, 0x1b, 0xd4, 0xdc, 0xc7, 0x5d,
-    0x9e, 0x09, 0xfa, 0x62, 0x0d, 0xf4, 0xe8, 0x3e, 0x3a, 0xfd, 0x9d, 0xeb,
-    0xc8, 0xeb, 0xfb, 0xc9, 0xb9, 0xf1, 0xa7, 0x54, 0x2f, 0xde, 0xe4, 0x30,
-    0x54, 0x22, 0xe6, 0x18, 0x49, 0x1c, 0x96, 0xd2, 0x17, 0x08, 0xde, 0xc6,
-    0x60, 0xf0, 0xaf, 0x18, 0x4e, 0x6a, 0x12, 0xc0, 0x2c, 0xe3, 0x21, 0xe2,
-    0x26, 0xbc, 0xed, 0xc3, 0xaf, 0xfd, 0x37, 0xcf, 0x0e, 0x31, 0x89, 0xa3,
-    0xa9, 0x54, 0x7b, 0x50, 0x35, 0x47, 0x5f, 0xd8, 0xb8, 0xeb, 0xf4, 0xeb,
-    0xbe, 0x4c, 0x75, 0x7c, 0x3c, 0x40, 0x95, 0xdf, 0xff, 0x73, 0x21, 0x8f,
-    0x8b, 0x18, 0x53, 0xc9, 0x39, 0xd5, 0x08, 0xc4, 0xc4, 0xe4, 0x24, 0xbf,
-    0x6f, 0xe0, 0xf0, 0x60, 0xeb, 0xee, 0xbf, 0xf0, 0x75, 0xee, 0xe6, 0xce,
-    0xa8, 0x3e, 0x87, 0x2c, 0xe2, 0x21, 0xbf, 0xa7, 0x9a, 0x4a, 0xad, 0xce,
-    0x75, 0xf9, 0x68, 0x1c, 0x09, 0xd6, 0x98, 0xeb, 0xa1, 0x67, 0x5b, 0xc7,
-    0x56, 0xcd, 0x2b, 0x8a, 0xd0, 0x4f, 0x5b, 0xa6, 0xd7, 0xde, 0xd3, 0xf2,
-    0x75, 0xd3, 0x39, 0xd7, 0xf3, 0xb1, 0x1e, 0xc9, 0xce, 0xbf, 0x93, 0x7c,
-    0xc8, 0x60, 0xeb, 0xfc, 0x1e, 0xc7, 0x32, 0xcf, 0x1d, 0x5d, 0x3d, 0xff,
-    0x16, 0x52, 0xb2, 0x9d, 0xcc, 0x1a, 0xe3, 0xe2, 0x11, 0x2c, 0x88, 0x45,
-    0x81, 0x08, 0xcb, 0xfc, 0xc6, 0x48, 0x40, 0xfa, 0x3a, 0xfd, 0xcb, 0x0e,
-    0x3f, 0x9d, 0x70, 0xa8, 0x75, 0xb4, 0x86, 0xfc, 0x05, 0x37, 0xff, 0xf4,
-    0x2c, 0x71, 0xbc, 0xf8, 0x5f, 0xab, 0x8c, 0xf1, 0xd7, 0xff, 0xe8, 0xdc,
-    0x37, 0x17, 0x0d, 0x92, 0x68, 0x0b, 0x3a, 0xa1, 0x34, 0x29, 0x9c, 0x7a,
-    0x4d, 0xc6, 0xb1, 0x7f, 0x6f, 0x21, 0x48, 0x13, 0xaf, 0x0b, 0xac, 0xeb,
-    0xbf, 0x83, 0xaa, 0x47, 0xb6, 0x85, 0x62, 0x35, 0x4a, 0xcb, 0xef, 0xae,
-    0xab, 0x6e, 0xca, 0xa8, 0xfb, 0x95, 0xa2, 0xcc, 0x4b, 0x87, 0x9e, 0x3a,
-    0x09, 0x32, 0x06, 0x72, 0x73, 0x29, 0x6d, 0xca, 0x4a, 0x57, 0x6c, 0xee,
-    0xef, 0x32, 0xf5, 0x92, 0x51, 0x64, 0xd2, 0x9d, 0x37, 0x38, 0x2a, 0xb9,
-    0x65, 0x9d, 0xa6, 0xd5, 0x3c, 0xa1, 0x2f, 0xe1, 0x8c, 0x34, 0x94, 0x9d,
-    0x4e, 0xab, 0xfa, 0x91, 0xb0, 0x08, 0xd2, 0x78, 0x43, 0xa5, 0x88, 0x4a,
-    0xf1, 0xc7, 0xd3, 0xf6, 0x3a, 0xde, 0x28, 0x4e, 0x5f, 0xff, 0xc0, 0x6b,
-    0x3c, 0xfb, 0x71, 0x9c, 0xaa, 0x82, 0xee, 0xa1, 0xd4, 0xca, 0xaa, 0x44,
-    0x94, 0x85, 0x7f, 0x95, 0xdd, 0x3d, 0xa4, 0x13, 0xaf, 0xdb, 0x6b, 0xbb,
-    0x4d, 0x14, 0xed, 0xd9, 0xc9, 0xd7, 0xff, 0x80, 0x01, 0x41, 0x8e, 0xa2,
-    0xf3, 0x47, 0x59, 0x98, 0x46, 0x16, 0x19, 0xf2, 0x66, 0xb1, 0x6b, 0xf6,
-    0xda, 0xee, 0xd3, 0x45, 0x47, 0x7f, 0xe7, 0x93, 0x39, 0xb6, 0xbb, 0xb4,
-    0xd1, 0x34, 0x5f, 0x0c, 0x67, 0x27, 0x56, 0x22, 0x75, 0x66, 0x7e, 0x4a,
-    0xbf, 0xdf, 0x5f, 0x83, 0x3e, 0x49, 0xce, 0xa6, 0x4f, 0x9e, 0x0b, 0xef,
-    0xdb, 0x6b, 0xbb, 0x4d, 0x15, 0x7d, 0xfd, 0x9c, 0x20, 0x7a, 0x03, 0xac,
-    0xce, 0x1f, 0x06, 0xcc, 0xef, 0xdb, 0x6b, 0xbb, 0x4d, 0x15, 0xb5, 0xff,
-    0x49, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0x90, 0x6c, 0xce, 0x1f, 0xc3, 0x99,
-    0xdf, 0xfc, 0xcb, 0xc9, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0x90, 0xef, 0xfd,
-    0xa6, 0x73, 0xc8, 0x1c, 0x19, 0x8e, 0xbc, 0xee, 0xd3, 0xc6, 0x07, 0x50,
-    0x7c, 0xad, 0x3e, 0xbb, 0xaa, 0xe7, 0x5f, 0xfa, 0x5d, 0x8f, 0x69, 0x58,
-    0xd2, 0xb6, 0x27, 0x5f, 0xfe, 0x55, 0xca, 0xb9, 0x58, 0xec, 0x2c, 0x5f,
-    0xa9, 0xb3, 0xad, 0xc9, 0xd7, 0x20, 0x9d, 0x7f, 0x40, 0x63, 0xce, 0x13,
-    0xa8, 0x27, 0xa1, 0x30, 0x8f, 0x85, 0x2f, 0xfe, 0x41, 0x9e, 0x14, 0xfb,
-    0xff, 0xf1, 0xc9, 0xd7, 0xec, 0xc1, 0xff, 0x47, 0x5f, 0x9c, 0x3f, 0x60,
-    0x4e, 0xbf, 0xf6, 0xfd, 0xf4, 0x5d, 0xb8, 0x2d, 0x3a, 0xf9, 0xae, 0xed,
-    0x34, 0x58, 0x97, 0x80, 0x32, 0x3a, 0xff, 0x36, 0x33, 0x7f, 0xff, 0xe3,
-    0xaa, 0x74, 0x70, 0xe1, 0x3e, 0xcf, 0xbc, 0x5a, 0x01, 0xbb, 0xf6, 0x6e,
-    0x05, 0x43, 0xaf, 0xdf, 0x78, 0xf3, 0x70, 0x75, 0xed, 0x40, 0x9d, 0x6e,
-    0xc1, 0xe2, 0xa1, 0x5d, 0xff, 0xd1, 0x9a, 0xc1, 0x0a, 0x7f, 0x02, 0x75,
-    0xe1, 0x89, 0xce, 0xa1, 0x3d, 0xb0, 0x20, 0x5f, 0x46, 0xe1, 0x67, 0x54,
-    0x8f, 0x07, 0x44, 0x37, 0x96, 0xfe, 0x3a, 0xe4, 0xfc, 0xea, 0xd9, 0xb1,
-    0xe3, 0x1b, 0xbf, 0x27, 0x00, 0x3e, 0x8e, 0xbf, 0xe0, 0xf7, 0x17, 0x8f,
-    0xb9, 0xce, 0xbf, 0x7b, 0xcf, 0x2d, 0x1d, 0x7f, 0xe0, 0x67, 0x21, 0xe1,
-    0xdc, 0x79, 0x8e, 0xae, 0x4f, 0xa3, 0x81, 0x3d, 0xa4, 0x75, 0xf6, 0x63,
-    0x1a, 0x3a, 0xa0, 0xd8, 0xf8, 0x42, 0xe0, 0x09, 0xd5, 0x09, 0x95, 0xe4,
-    0x28, 0x36, 0xad, 0xa2, 0x0b, 0xfe, 0x8d, 0x7d, 0xcd, 0xe6, 0x4c, 0x75,
-    0xfd, 0xb9, 0x7f, 0x99, 0x31, 0xd7, 0xcf, 0x09, 0xc6, 0x75, 0x61, 0xe8,
-    0x6c, 0xba, 0xfa, 0x5f, 0x7b, 0x07, 0x5e, 0xdc, 0x48, 0xea, 0x73, 0x7d,
-    0xc0, 0x8e, 0xfe, 0x85, 0xe2, 0x6e, 0x63, 0xaf, 0xbe, 0xc7, 0x16, 0x8e,
-    0xbf, 0x60, 0x7b, 0x1d, 0x3a, 0xfb, 0x68, 0xc2, 0xb9, 0xd4, 0x27, 0x97,
-    0xa2, 0x6a, 0x0a, 0x24, 0xb4, 0xe3, 0x50, 0x9b, 0x12, 0x2f, 0xf4, 0x89,
-    0xe1, 0x7d, 0x7f, 0x20, 0xba, 0xe3, 0xa7, 0x5f, 0xfe, 0x85, 0xc4, 0x82,
-    0x31, 0xd7, 0xcd, 0x9d, 0x47, 0x54, 0x8f, 0x43, 0x8d, 0x1a, 0xf7, 0xb3,
-    0xf3, 0xaf, 0xf0, 0x16, 0x9a, 0xd2, 0x04, 0xeb, 0xfc, 0xd1, 0xce, 0x03,
-    0x9a, 0x3a, 0xff, 0xb9, 0x93, 0xe0, 0xe7, 0xb4, 0x75, 0xff, 0xb3, 0x99,
-    0x76, 0x34, 0xa7, 0x60, 0xea, 0x92, 0x72, 0xbc, 0xbd, 0x4c, 0x4b, 0xb1,
-    0xce, 0x99, 0x09, 0x97, 0x11, 0xbd, 0xb8, 0xce, 0xba, 0x5a, 0x3a, 0xcf,
-    0x23, 0x53, 0xc8, 0x9d, 0xf7, 0x90, 0x58, 0x2a, 0xc0, 0x3a, 0xd1, 0x86,
-    0xc7, 0xa4, 0x37, 0xfc, 0xe3, 0xed, 0x73, 0xa7, 0x57, 0x3a, 0x9d, 0x17,
-    0x1f, 0xac, 0x00, 0x96, 0xff, 0xd0, 0xc7, 0xd9, 0xf5, 0x8b, 0x85, 0x73,
-    0xae, 0x76, 0x0e, 0xb6, 0x78, 0xf6, 0xb8, 0x22, 0x5f, 0xfd, 0xd7, 0x4f,
-    0x4b, 0x14, 0x1c, 0xfc, 0xeb, 0xf0, 0xcd, 0x1d, 0x83, 0xaf, 0xd9, 0xde,
-    0x5d, 0x5c, 0xeb, 0xef, 0xf5, 0x02, 0x75, 0xfe, 0xdf, 0x5d, 0x34, 0x9c,
-    0x0e, 0xa8, 0x3d, 0x4c, 0x21, 0xa4, 0x4c, 0x1d, 0xd0, 0xc4, 0x9b, 0x4f,
-    0xd7, 0xf3, 0x11, 0xbd, 0xbc, 0xc7, 0x5f, 0xf0, 0x61, 0xbf, 0x7f, 0xfe,
-    0x39, 0x3a, 0xff, 0x9f, 0x78, 0xb4, 0xe3, 0x85, 0x9d, 0x4d, 0x3f, 0x60,
-    0x1e, 0xdf, 0x7a, 0x39, 0x91, 0xd7, 0xf2, 0x7f, 0xc6, 0x29, 0xf9, 0xd5,
-    0x39, 0xe9, 0x6c, 0x8a, 0xa1, 0x33, 0xbc, 0x85, 0x23, 0xba, 0x5f, 0xdc,
-    0x36, 0xf0, 0x9c, 0x67, 0x5b, 0x0e, 0xa5, 0x9b, 0xf1, 0x30, 0xbf, 0xf7,
-    0x70, 0x21, 0x4e, 0x73, 0x9f, 0x1d, 0x7f, 0x7c, 0x0f, 0xd7, 0xde, 0xce,
-    0xa9, 0xcf, 0xc0, 0x27, 0xf7, 0xcf, 0x09, 0xc6, 0x75, 0xff, 0x42, 0x07,
-    0xc2, 0xfc, 0xe8, 0xea, 0x83, 0xfc, 0x09, 0x18, 0x91, 0x52, 0xb0, 0xcf,
-    0xf1, 0x56, 0xc6, 0x55, 0xaa, 0x44, 0x42, 0xa6, 0x46, 0x01, 0x49, 0xc8,
-    0xc1, 0xd4, 0x4a, 0x6b, 0x5f, 0x30, 0xc2, 0x45, 0x39, 0x89, 0x37, 0x1a,
-    0x9a, 0xd0, 0x7b, 0x1f, 0x5b, 0xc7, 0xab, 0xfc, 0x69, 0x43, 0x08, 0xad,
-    0x46, 0x61, 0xe8, 0xdd, 0x80, 0xe5, 0xf6, 0x30, 0xcb, 0xff, 0xba, 0x91,
-    0xee, 0xba, 0x98, 0x3f, 0x9d, 0x7f, 0x67, 0xa1, 0x17, 0xa3, 0xaf, 0x6b,
-    0xee, 0x8e, 0xbf, 0xfe, 0xce, 0x65, 0xe0, 0x4e, 0xcf, 0x5d, 0x69, 0xa3,
-    0xaf, 0xf8, 0x0f, 0x81, 0x4e, 0x45, 0xce, 0xbd, 0xe1, 0x83, 0xae, 0xeb,
-    0x38, 0x99, 0x74, 0xc8, 0x6e, 0x56, 0x23, 0xda, 0x52, 0xfa, 0x6d, 0x4c,
-    0xab, 0x0e, 0x89, 0x55, 0x37, 0xf6, 0x6d, 0xae, 0xed, 0x34, 0x59, 0xb7,
-    0xfe, 0x8d, 0xff, 0xed, 0x77, 0x10, 0x27, 0x5f, 0x20, 0xbc, 0xe7, 0x57,
-    0x4f, 0x7b, 0x47, 0xd7, 0xcc, 0xf6, 0x3a, 0x75, 0x32, 0x78, 0x9c, 0x44,
-    0x54, 0xca, 0x60, 0x0f, 0x0d, 0xab, 0xfc, 0xb6, 0x61, 0x17, 0xf7, 0x67,
-    0x5d, 0x81, 0x3a, 0xff, 0xcf, 0x26, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x80,
-    0xbf, 0xc8, 0xb8, 0x57, 0xee, 0x4e, 0x75, 0x99, 0xc4, 0x4a, 0x2c, 0x57,
-    0xa9, 0x57, 0xf3, 0xfb, 0x52, 0x4f, 0xce, 0xbf, 0xa4, 0xce, 0x4d, 0x12,
-    0x3a, 0x99, 0x3d, 0xb8, 0x2d, 0xb8, 0x1d, 0x3a, 0xfe, 0xd4, 0x2c, 0x62,
-    0x63, 0xad, 0xd3, 0xaf, 0x7d, 0x19, 0x8e, 0xbb, 0x3d, 0x86, 0xbb, 0xf1,
-    0x0a, 0xfd, 0x10, 0xc2, 0xb5, 0x77, 0xcd, 0x1d, 0x78, 0x01, 0xc3, 0xaf,
-    0xf6, 0x6f, 0xc3, 0x0b, 0xd1, 0xd6, 0xe3, 0x3a, 0x90, 0xf7, 0xfa, 0x37,
-    0xf9, 0x8d, 0xf3, 0x5d, 0xda, 0x68, 0xb7, 0xef, 0x71, 0xbf, 0x8e, 0xbf,
-    0xbe, 0xf9, 0xda, 0xfb, 0x3a, 0xb6, 0x7f, 0x2b, 0x2d, 0xfc, 0x7a, 0xfb,
-    0x05, 0x26, 0x3a, 0xfd, 0xe9, 0x6b, 0xee, 0x8e, 0xbd, 0xae, 0x84, 0xeb,
-    0xf7, 0xdf, 0x0c, 0x7e, 0x75, 0x2c, 0xf1, 0x78, 0x0e, 0x5f, 0xfd, 0xed,
-    0x26, 0xa0, 0x73, 0xdd, 0x43, 0xaf, 0x0e, 0x74, 0xea, 0x59, 0xed, 0xf0,
-    0x41, 0xbf, 0x06, 0x15, 0xc0, 0xb3, 0xaf, 0xf9, 0xf5, 0x18, 0x21, 0xec,
-    0x1d, 0x7f, 0xf6, 0x2f, 0x79, 0xcf, 0x45, 0xd5, 0xe7, 0x3a, 0xed, 0x6b,
-    0x67, 0xf8, 0x26, 0xb5, 0x09, 0xbb, 0x63, 0xfa, 0x12, 0x3c, 0x29, 0xaf,
-    0x9d, 0x07, 0xc7, 0x5e, 0xdc, 0x78, 0xeb, 0xfa, 0x67, 0x0f, 0x51, 0x67,
-    0x5f, 0xde, 0x4c, 0x0c, 0x2c, 0xea, 0xf1, 0xec, 0x30, 0x5b, 0x76, 0x84,
-    0xeb, 0xfb, 0x9d, 0x43, 0x71, 0x67, 0x56, 0xd1, 0xb0, 0xee, 0x7a, 0x23,
-    0x00, 0xad, 0xf7, 0x54, 0x0a, 0xce, 0xbb, 0x24, 0x75, 0x61, 0xb8, 0x12,
-    0x3a, 0x56, 0xd7, 0x77, 0x22, 0x13, 0x92, 0x23, 0x0b, 0xbe, 0x42, 0xa1,
-    0x0c, 0x36, 0x41, 0xd8, 0xf9, 0x7f, 0x3f, 0x18, 0x7b, 0xf9, 0xd2, 0xfe,
-    0x7e, 0x59, 0x5b, 0xf8, 0xea, 0x65, 0x1c, 0x03, 0x0b, 0x2b, 0xf8, 0x2c,
-    0xeb, 0xda, 0xe4, 0xeb, 0x95, 0x95, 0x6c, 0xeb, 0xcb, 0x7e, 0x4e, 0xbb,
-    0x82, 0x1d, 0x7d, 0xbd, 0xe7, 0xd3, 0xaf, 0xda, 0x9f, 0x18, 0x65, 0x58,
-    0x3f, 0x68, 0x20, 0x98, 0x71, 0xc5, 0xea, 0x13, 0x06, 0x48, 0x53, 0x5f,
-    0xff, 0xfe, 0x46, 0xbe, 0xdf, 0xb2, 0xcf, 0x60, 0x74, 0xeb, 0xcd, 0xcf,
-    0x1c, 0x9d, 0x7e, 0xdb, 0x5d, 0xda, 0x68, 0xa5, 0x2f, 0xff, 0x9f, 0xc3,
-    0x93, 0xee, 0x3a, 0x9d, 0xcd, 0x9d, 0x79, 0xe4, 0xcc, 0x23, 0xdb, 0x1d,
-    0xbf, 0x33, 0xbf, 0xe9, 0x33, 0x9b, 0x6b, 0xbb, 0x4d, 0x12, 0x75, 0x99,
-    0x5a, 0x21, 0x9d, 0x06, 0xa2, 0x11, 0x60, 0x53, 0xce, 0x0a, 0x4a, 0x1e,
-    0x01, 0xbe, 0x22, 0x3c, 0x87, 0x73, 0x63, 0x47, 0x48, 0x41, 0x2b, 0xc2,
-    0x82, 0x62, 0x7d, 0xc2, 0xd9, 0x75, 0x99, 0x07, 0x63, 0x2c, 0x72, 0x9f,
-    0xe1, 0x92, 0x30, 0x91, 0xd4, 0xf6, 0xf7, 0xa3, 0x2e, 0xe1, 0x1d, 0x1d,
-    0xfb, 0x6d, 0x77, 0x69, 0xa2, 0x1f, 0xbf, 0xf3, 0xc9, 0x9c, 0xdb, 0x5d,
-    0xda, 0x68, 0x94, 0xec, 0xce, 0x1f, 0xea, 0xcc, 0xef, 0xf3, 0x39, 0xb6,
-    0xbb, 0xb4, 0xd1, 0x13, 0xdf, 0xd3, 0x27, 0xb4, 0x05, 0x9d, 0x7f, 0xf9,
-    0x56, 0x51, 0x85, 0x79, 0xc2, 0xaa, 0xf9, 0xf3, 0xbc, 0x67, 0x5f, 0xb6,
-    0xd7, 0x76, 0x9a, 0x23, 0x1b, 0xff, 0xf7, 0xf2, 0x9d, 0x56, 0x85, 0x6e,
-    0x76, 0xef, 0xe7, 0xce, 0xf1, 0x9d, 0x7c, 0x9c, 0xc9, 0x5b, 0x3a, 0xcc,
-    0xc2, 0x6a, 0xb2, 0x2e, 0xc6, 0x2e, 0x99, 0xf9, 0xae, 0xff, 0xf3, 0x2b,
-    0x79, 0x33, 0x9b, 0x6b, 0xbb, 0x4d, 0x13, 0xcd, 0xfc, 0xcf, 0xf0, 0x32,
-    0xd1, 0xd5, 0x0a, 0xa4, 0x67, 0x28, 0x94, 0x72, 0x9d, 0x50, 0xf2, 0xbd,
-    0xfb, 0x6d, 0x77, 0x69, 0xa2, 0x20, 0xbf, 0xf3, 0xc9, 0x9c, 0xdb, 0x5d,
-    0xda, 0x68, 0x95, 0x2c, 0xce, 0x1f, 0xea, 0xcc, 0xef, 0xf3, 0x39, 0xb6,
-    0xbb, 0xb4, 0xd1, 0x14, 0x5f, 0xe6, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x32,
-    0xbf, 0x6d, 0xae, 0xed, 0x34, 0x4c, 0xb7, 0xe9, 0x67, 0x9d, 0xa7, 0x5f,
-    0x99, 0x5b, 0xc9, 0x9c, 0x3d, 0x9e, 0x4c, 0xef, 0xdb, 0x6b, 0xbb, 0x4d,
-    0x15, 0x25, 0x84, 0xeb, 0x7d, 0x3a, 0xcc, 0xe1, 0xea, 0x2b, 0x99, 0x80,
-    0x3e, 0xff, 0x33, 0x9b, 0x6b, 0xbb, 0x4d, 0x15, 0xd5, 0xfe, 0x67, 0x36,
-    0xd7, 0x76, 0x9a, 0x2c, 0x5b, 0xff, 0x96, 0xf2, 0x67, 0x36, 0xd7, 0x76,
-    0x9a, 0x27, 0xab, 0xfe, 0x61, 0x97, 0x84, 0xe3, 0x4e, 0x23, 0xaf, 0xff,
-    0xd3, 0x0c, 0x2d, 0x9c, 0xd2, 0x30, 0x17, 0x75, 0x0e, 0xbb, 0x5e, 0x3a,
-    0xfc, 0x2e, 0xb1, 0x83, 0xaf, 0xe0, 0x6b, 0xaf, 0x26, 0x55, 0xb3, 0x75,
-    0xf4, 0x5a, 0xfd, 0x9e, 0xd2, 0x2c, 0xeb, 0xff, 0xd1, 0xcf, 0xb2, 0x64,
-    0xdf, 0xb4, 0x05, 0x73, 0xaf, 0x3f, 0x2c, 0x89, 0xfa, 0x78, 0x9a, 0xde,
-    0xc4, 0xe1, 0x37, 0x09, 0x0d, 0x43, 0x02, 0x99, 0x54, 0xa5, 0x0a, 0x09,
-    0x1e, 0x15, 0xf9, 0x3a, 0x2f, 0x31, 0xd7, 0xe9, 0x60, 0x7e, 0x61, 0xd4,
-    0xa8, 0x3c, 0xe8, 0x26, 0xbf, 0x67, 0x90, 0x1a, 0x3a, 0xe5, 0x61, 0x5a,
-    0x9d, 0x4a, 0xd4, 0xf1, 0xd5, 0x62, 0x6b, 0xf2, 0xae, 0x56, 0x35, 0xbf,
-    0x1d, 0x7f, 0xbe, 0x8e, 0x6f, 0x70, 0xd3, 0xa9, 0x58, 0x3e, 0x65, 0x51,
-    0x9d, 0xf6, 0xd7, 0xee, 0x4e, 0xbf, 0x95, 0x85, 0x65, 0x51, 0x12, 0x59,
-    0xd7, 0x9b, 0x9d, 0x2a, 0xf2, 0xe3, 0x47, 0x5e, 0xff, 0x70, 0x75, 0xfd,
-    0x9f, 0xa4, 0xc8, 0xc1, 0xd7, 0xfe, 0x7d, 0x7c, 0xd6, 0xb2, 0x52, 0x83,
-    0xaf, 0xff, 0xc2, 0xea, 0x26, 0xe2, 0x52, 0xcd, 0x7f, 0xfc, 0x1d, 0x41,
-    0x46, 0x12, 0x85, 0xdd, 0x3f, 0xbf, 0xff, 0xb6, 0x9c, 0x4e, 0xb6, 0x63,
-    0x7b, 0x4e, 0x26, 0x82, 0x73, 0xaf, 0x93, 0xbf, 0x56, 0x75, 0xff, 0xe4,
-    0x53, 0xe6, 0x0b, 0xf3, 0xa5, 0x14, 0x73, 0xa9, 0xa7, 0xe0, 0x24, 0x77,
-    0xff, 0x9f, 0x43, 0x9f, 0xb3, 0xd4, 0x6b, 0xec, 0xeb, 0xf8, 0x38, 0xa7,
-    0xb1, 0xa7, 0x5f, 0x76, 0x16, 0xd3, 0xa9, 0xcf, 0x3b, 0xc5, 0xb7, 0xe0,
-    0xa4, 0xc8, 0xc1, 0xd7, 0xff, 0x7c, 0x88, 0x18, 0x5f, 0xcf, 0x9d, 0xe3,
-    0x3a, 0xa0, 0xfc, 0xc4, 0xa2, 0xff, 0xdd, 0xc9, 0xba, 0x9d, 0x8d, 0xc1,
-    0xd7, 0x3f, 0x27, 0x5f, 0xe7, 0xd3, 0xf4, 0x03, 0x39, 0xd4, 0x27, 0x90,
-    0x01, 0x6a, 0x9d, 0x70, 0x3a, 0x43, 0x69, 0x0d, 0xed, 0x98, 0xae, 0x1a,
-    0x5d, 0x21, 0x18, 0x4b, 0xfa, 0x12, 0x9f, 0x48, 0x38, 0xa1, 0x0b, 0x78,
-    0x5f, 0xc7, 0x5e, 0x14, 0xd1, 0xd6, 0x61, 0x50, 0x6d, 0x20, 0x6a, 0xfb,
-    0x7c, 0x1d, 0x67, 0x5f, 0x96, 0x2f, 0xed, 0x1d, 0x7a, 0x33, 0x67, 0x5f,
-    0xfe, 0x6b, 0xed, 0xfc, 0x9a, 0x81, 0x8f, 0xce, 0xb4, 0xba, 0x7c, 0x3f,
-    0x46, 0xab, 0x94, 0x58, 0xee, 0x10, 0xf5, 0x89, 0x94, 0x21, 0x58, 0x21,
-    0xa9, 0x7f, 0xdd, 0x7f, 0x44, 0xda, 0x45, 0x9d, 0x7f, 0xa2, 0x43, 0x9c,
-    0xfb, 0x0e, 0xbd, 0xd0, 0x2c, 0xea, 0x44, 0x42, 0xec, 0xe0, 0x06, 0x37,
-    0xf7, 0xb5, 0x34, 0x0c, 0xe7, 0x5f, 0x85, 0x44, 0xcd, 0x1d, 0x7e, 0x61,
-    0xfc, 0xed, 0x3a, 0xff, 0xec, 0x61, 0xff, 0xc6, 0xf5, 0xff, 0xd1, 0xd7,
-    0xfe, 0xd3, 0xf3, 0x02, 0xe1, 0xc5, 0x0e, 0xa4, 0x46, 0x7f, 0x49, 0x84,
+    0xfe, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x22, 0x5b, 0xbf, 0x01, 0xd7, 0xa4,
+    0x2a, 0xe7, 0x5d, 0xbf, 0x8e, 0xbf, 0xfe, 0x8e, 0xc4, 0x85, 0xd4, 0xde,
+    0x51, 0x9e, 0x3a, 0xe7, 0xd1, 0xd5, 0x23, 0xfa, 0x08, 0xba, 0x27, 0x5f,
+    0xec, 0x64, 0x63, 0xdd, 0x43, 0xaf, 0xff, 0x68, 0x0b, 0xe8, 0xe6, 0xfe,
+    0x17, 0xe9, 0xd7, 0x66, 0x8e, 0xbc, 0xee, 0xd3, 0x44, 0x5b, 0x52, 0x44,
+    0x2e, 0x24, 0xb4, 0x56, 0xee, 0x68, 0xea, 0xe1, 0xe2, 0xe8, 0xbe, 0xff,
+    0xfc, 0x07, 0xee, 0x0f, 0x39, 0x9b, 0xcb, 0xc8, 0xb3, 0xaf, 0x63, 0x60,
+    0xeb, 0xf8, 0x23, 0x0d, 0x58, 0x0e, 0xbf, 0xe6, 0x45, 0x34, 0x83, 0xbc,
+    0x8e, 0xbc, 0x14, 0x9c, 0xea, 0x43, 0xd4, 0x73, 0x8b, 0xff, 0x9b, 0xc8,
+    0x52, 0x07, 0xca, 0xb2, 0xac, 0xac, 0x1d, 0x7f, 0x93, 0xa2, 0x07, 0x51,
+    0xa7, 0x54, 0x22, 0x17, 0x14, 0xef, 0xff, 0x20, 0x8c, 0x6f, 0xf7, 0x39,
+    0xac, 0x64, 0xeb, 0xb3, 0x72, 0xad, 0x05, 0x5b, 0xfe, 0x1a, 0x5f, 0xc5,
+    0xaf, 0xf7, 0xb3, 0x9f, 0xad, 0x34, 0x53, 0x06, 0xa6, 0xfe, 0x97, 0x53,
+    0x66, 0x4c, 0x75, 0x41, 0xf9, 0xba, 0x25, 0xfd, 0xd4, 0x6c, 0x2d, 0x0e,
+    0xbf, 0xd1, 0xfc, 0xef, 0x28, 0x57, 0x3a, 0xc3, 0x07, 0xc2, 0x25, 0x76,
+    0x61, 0x58, 0x5d, 0x5f, 0x55, 0xc2, 0xf1, 0x09, 0x89, 0xcb, 0xb2, 0x1f,
+    0x6a, 0x11, 0x35, 0x51, 0x06, 0xbb, 0x08, 0x01, 0x85, 0x2e, 0x88, 0x76,
+    0xe3, 0x0b, 0xfb, 0x08, 0x1b, 0xff, 0xff, 0x9d, 0x6c, 0x27, 0x38, 0x0e,
+    0x72, 0x07, 0x14, 0x4e, 0xf7, 0x3e, 0x9d, 0x7f, 0xf9, 0x56, 0x51, 0x95,
+    0x79, 0xc2, 0xaa, 0xf9, 0xf3, 0xbb, 0x67, 0x5f, 0xb8, 0xd7, 0x76, 0x9a,
+    0x2a, 0x2b, 0xf4, 0x77, 0x39, 0x87, 0x5f, 0xff, 0xbf, 0x94, 0xea, 0xb4,
+    0x2b, 0x73, 0xb7, 0x9f, 0x3e, 0x77, 0x6c, 0xeb, 0xff, 0xf3, 0xc8, 0x63,
+    0x59, 0xbb, 0x45, 0xf3, 0x76, 0x9d, 0x66, 0x24, 0x9b, 0xc6, 0x31, 0x34,
+    0xcf, 0xa4, 0xbb, 0x1a, 0xef, 0xfc, 0x1c, 0x5b, 0x1b, 0x78, 0x29, 0xe3,
+    0xaf, 0x63, 0x38, 0x75, 0xfe, 0xcc, 0x9c, 0x31, 0x81, 0x3a, 0xf7, 0x60,
+    0x27, 0x5f, 0xe8, 0x84, 0x11, 0x02, 0xb9, 0xd7, 0x38, 0x0e, 0xbe, 0xea,
+    0x75, 0x85, 0x42, 0x2b, 0x94, 0x1b, 0x98, 0xc7, 0xa3, 0x6c, 0x99, 0x5f,
+    0xb8, 0xd7, 0x76, 0x9a, 0x2b, 0xdb, 0xf2, 0x6d, 0x34, 0x13, 0x9d, 0x74,
+    0x48, 0xeb, 0xa3, 0xf3, 0xac, 0xc6, 0x22, 0x27, 0x86, 0x6e, 0x57, 0xf8,
+    0xad, 0xff, 0xcc, 0x3c, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x89, 0x1a, 0xff,
+    0xf3, 0x0b, 0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x13, 0xc5, 0xff, 0xe6,
+    0x16, 0xf2, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x27, 0xfb, 0xff, 0xcc, 0x2d,
+    0xe4, 0xc6, 0x71, 0xae, 0xed, 0x34, 0x50, 0xd7, 0xff, 0x2d, 0xe4, 0xc6,
+    0x71, 0xae, 0xed, 0x34, 0x51, 0x17, 0xfe, 0x93, 0x00, 0xd7, 0xc8, 0xd4,
+    0x48, 0xea, 0x61, 0x12, 0x30, 0xa1, 0x7f, 0xe9, 0x93, 0xbb, 0xe7, 0x83,
+    0x8b, 0x3a, 0xff, 0xc2, 0xec, 0x78, 0x40, 0xf2, 0xd1, 0xd7, 0xee, 0x35,
+    0xdd, 0xa6, 0x8a, 0x46, 0xff, 0xa2, 0x51, 0xc9, 0xe3, 0x93, 0x9d, 0x79,
+    0xe4, 0xc6, 0x1f, 0x60, 0x99, 0xdf, 0xd2, 0xce, 0xf5, 0xe4, 0x75, 0xff,
+    0xfd, 0x81, 0xec, 0x7d, 0x63, 0xc2, 0xff, 0xeb, 0x51, 0xf9, 0x56, 0x62,
+    0x13, 0xa4, 0x69, 0xfa, 0xe1, 0x53, 0xe3, 0x2d, 0xb2, 0xcb, 0xf7, 0x1a,
+    0xee, 0xd3, 0x44, 0xa1, 0x7f, 0xf8, 0x5f, 0xda, 0xfa, 0x20, 0x90, 0xe2,
+    0xce, 0xbe, 0x61, 0xe4, 0xc6, 0x1f, 0xe2, 0xcc, 0xea, 0x76, 0x7d, 0x2c,
+    0xa7, 0x67, 0x83, 0x0e, 0x96, 0xc7, 0xd6, 0x8a, 0x6a, 0xf0, 0xee, 0xe4,
+    0x3c, 0x96, 0x87, 0xd5, 0x1f, 0xd5, 0xd5, 0x2a, 0xfa, 0x87, 0x40, 0x23,
+    0xc7, 0xda, 0x86, 0xad, 0xff, 0xe6, 0x16, 0xf2, 0x63, 0x38, 0xd7, 0x76,
+    0x9a, 0x27, 0x3b, 0xff, 0xcc, 0x2d, 0xe4, 0xc6, 0x71, 0xae, 0xed, 0x34,
+    0x51, 0x37, 0xf2, 0x6a, 0x69, 0x27, 0xe7, 0x5f, 0xe8, 0x9f, 0xee, 0xdb,
+    0x8f, 0xe7, 0x5e, 0xe4, 0x98, 0xe9, 0xf3, 0x7d, 0x2e, 0xae, 0x26, 0x97,
+    0xa5, 0x70, 0x42, 0xf6, 0xfd, 0xc6, 0xbb, 0xb4, 0xd1, 0x0e, 0x5f, 0xc0,
+    0x6f, 0x12, 0x04, 0xeb, 0x31, 0x87, 0xbd, 0xd3, 0x3b, 0xfe, 0x8e, 0x63,
+    0x7b, 0x1b, 0xc8, 0xeb, 0xe6, 0xbb, 0xb4, 0xd1, 0x17, 0xdf, 0xb2, 0x69,
+    0x3e, 0x8e, 0xae, 0x1e, 0xa7, 0xd2, 0xdb, 0xfd, 0xac, 0x0f, 0x73, 0xf7,
+    0x3a, 0xe1, 0x9c, 0xeb, 0xfe, 0xf0, 0xc2, 0xfe, 0x87, 0xb0, 0x75, 0x41,
+    0xe7, 0xa0, 0xb5, 0xda, 0xdc, 0xeb, 0xef, 0x4a, 0x14, 0x2a, 0x96, 0x6e,
+    0x5c, 0x5e, 0xfc, 0xf3, 0xfb, 0x3a, 0x75, 0x98, 0x9d, 0x3d, 0x1c, 0x84,
+    0x64, 0xc4, 0x9d, 0x84, 0x08, 0xac, 0xed, 0x90, 0x5f, 0xff, 0xff, 0x0b,
+    0xb1, 0x80, 0x54, 0xa2, 0x89, 0xee, 0xe2, 0x4b, 0x5f, 0x31, 0x48, 0x91,
+    0xd7, 0xfe, 0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x13, 0x25, 0x98, 0x6a,
+    0x33, 0x17, 0x08, 0x2b, 0xba, 0xb3, 0xaf, 0xdc, 0x6b, 0xbb, 0x4d, 0x16,
+    0xf5, 0x98, 0x09, 0xe4, 0xe0, 0xb5, 0xff, 0xe6, 0x16, 0xf2, 0x63, 0x38,
+    0xd7, 0x76, 0x9a, 0x29, 0x3b, 0x95, 0x95, 0x6c, 0xeb, 0xfb, 0x3c, 0x31,
+    0x0b, 0x3a, 0xfe, 0xdf, 0xff, 0xbc, 0x7f, 0xce, 0xbb, 0xac, 0x2a, 0x0f,
+    0xf3, 0xa4, 0x0e, 0x55, 0x50, 0xb9, 0xc7, 0x28, 0xfe, 0x72, 0x33, 0x8d,
+    0x3c, 0x6c, 0x28, 0xfb, 0x0d, 0x3b, 0xfc, 0xc6, 0x71, 0xae, 0xed, 0x34,
+    0x43, 0xb7, 0xee, 0x35, 0xdd, 0xa6, 0x89, 0x62, 0xfb, 0x3f, 0x5a, 0x1d,
+    0x7e, 0x61, 0x6f, 0x26, 0x30, 0xf5, 0x36, 0xcc, 0xef, 0xf3, 0x19, 0xc6,
+    0xbb, 0xb4, 0xd1, 0x18, 0x5f, 0x31, 0x2c, 0xd1, 0xd7, 0xff, 0xfd, 0x2d,
+    0x30, 0xde, 0xbc, 0xcd, 0xee, 0x71, 0x58, 0xec, 0xcb, 0xd1, 0xd7, 0xec,
+    0xf7, 0xf0, 0xd3, 0xaf, 0xff, 0x47, 0x93, 0xf8, 0x90, 0x7b, 0x02, 0xd3,
+    0xaf, 0xdc, 0x6b, 0xbb, 0x4d, 0x11, 0xed, 0xf6, 0x9f, 0x7d, 0x87, 0x5d,
+    0x26, 0x30, 0xf5, 0xfc, 0x67, 0x7f, 0xff, 0x3b, 0x02, 0x0c, 0xee, 0x0f,
+    0xf8, 0x3e, 0xee, 0x1d, 0x66, 0x37, 0x4e, 0xf2, 0x67, 0x0e, 0x13, 0xbc,
+    0x27, 0xc4, 0xba, 0xfd, 0xc6, 0xbb, 0xb4, 0xd1, 0x61, 0xdf, 0xe9, 0x0c,
+    0x66, 0xb0, 0x4e, 0xb3, 0x18, 0x7c, 0x5b, 0x99, 0xdf, 0xe6, 0x33, 0x8d,
+    0x77, 0x69, 0xa2, 0xe7, 0xbf, 0xff, 0xff, 0xfa, 0x15, 0xa4, 0xa7, 0x6f,
+    0x7e, 0x7c, 0xee, 0xdb, 0x13, 0x81, 0x45, 0x5d, 0x0a, 0x8d, 0xe7, 0x9d,
+    0xab, 0xf9, 0xf3, 0xbb, 0x67, 0x54, 0x2e, 0x6e, 0xcf, 0x09, 0x39, 0x21,
+    0xb4, 0xfd, 0x23, 0xde, 0x5c, 0x2e, 0x7c, 0x53, 0xb4, 0x7f, 0x7f, 0x98,
+    0xce, 0x35, 0xdd, 0xa6, 0x88, 0x7a, 0xf9, 0xae, 0xed, 0x34, 0x44, 0xd7,
+    0xf6, 0x6d, 0x01, 0x78, 0x13, 0xaf, 0xf7, 0x80, 0xfb, 0xf6, 0x36, 0x1d,
+    0x5c, 0x44, 0x88, 0x96, 0xf8, 0xbe, 0xfe, 0x4f, 0xf5, 0xf3, 0x02, 0x75,
+    0xff, 0xfa, 0x39, 0xff, 0x63, 0x64, 0xd1, 0x0b, 0xd6, 0x04, 0xeb, 0xfe,
+    0xef, 0x63, 0x64, 0xb3, 0x90, 0x75, 0xbd, 0xd4, 0x48, 0x3a, 0xbd, 0xff,
+    0x27, 0x93, 0xd9, 0xfc, 0x70, 0xea, 0xc3, 0xdf, 0x72, 0x8b, 0xff, 0xfb,
+    0xdd, 0x8e, 0x7f, 0xac, 0x0f, 0x80, 0xed, 0xce, 0x1d, 0x77, 0x96, 0x75,
+    0xff, 0xec, 0xef, 0xd9, 0xf5, 0x09, 0xbf, 0xa1, 0x67, 0x5f, 0xfa, 0x78,
+    0x97, 0xdc, 0xe6, 0xb1, 0x93, 0xab, 0x11, 0xfd, 0xba, 0xdf, 0x45, 0x80,
+    0x99, 0x7d, 0xe0, 0x3f, 0xd3, 0x44, 0x2f, 0x7e, 0xee, 0x4e, 0x01, 0x3a,
+    0xf9, 0xf9, 0x1b, 0x0e, 0xa0, 0x9e, 0x4f, 0xe4, 0xf6, 0x63, 0x15, 0xa2,
+    0x70, 0xbf, 0xb1, 0x8f, 0x6a, 0x31, 0xe0, 0x1e, 0xec, 0x79, 0xbf, 0xf7,
+    0x01, 0x3e, 0x76, 0x61, 0x80, 0x9d, 0x77, 0x5c, 0xeb, 0x00, 0xea, 0xc3,
+    0x4b, 0xa1, 0x5b, 0xdf, 0xe9, 0x88, 0x44, 0x27, 0x99, 0x2f, 0xff, 0xb1,
+    0x25, 0xa6, 0x33, 0x79, 0x3c, 0xff, 0x5a, 0x75, 0x42, 0x22, 0x7a, 0x6d,
+    0x7e, 0x56, 0x34, 0x93, 0xaa, 0x0e, 0xbf, 0x95, 0x9f, 0xbd, 0xee, 0x4e,
+    0x75, 0xba, 0x75, 0x2b, 0x27, 0x8a, 0x03, 0x5b, 0xe0, 0xe0, 0xcc, 0x75,
+    0xc9, 0xe3, 0xad, 0xe4, 0x36, 0xdd, 0x21, 0xbf, 0xdb, 0xfb, 0x79, 0x00,
+    0x54, 0x3a, 0xff, 0xd1, 0x30, 0xe6, 0xc7, 0x5a, 0xd0, 0xea, 0x73, 0xf4,
+    0x01, 0xb5, 0xff, 0xff, 0xdd, 0x00, 0x53, 0x39, 0x30, 0xe6, 0xce, 0xe0,
+    0x63, 0x5a, 0x85, 0x0e, 0xbf, 0xfc, 0x93, 0x4b, 0x37, 0x97, 0xc5, 0xbb,
+    0x89, 0xd7, 0x3e, 0xd1, 0xd6, 0x54, 0x62, 0x72, 0x2a, 0x42, 0x69, 0xa4,
+    0x3d, 0x73, 0x74, 0xbb, 0xb6, 0xd4, 0x3a, 0xfd, 0xd7, 0xf3, 0xc8, 0xeb,
+    0xf9, 0x38, 0x39, 0x9c, 0x3a, 0xff, 0x4b, 0x51, 0xa5, 0x6a, 0xac, 0xab,
+    0x27, 0x5f, 0xfc, 0xbf, 0x9a, 0x1c, 0xde, 0x42, 0xf3, 0x9d, 0x7b, 0x49,
+    0xf9, 0xd5, 0x87, 0xc4, 0x88, 0xd7, 0x99, 0x65, 0x92, 0xaf, 0xce, 0x3e,
+    0xee, 0x14, 0xc1, 0x7f, 0x7e, 0x7f, 0x4d, 0x9e, 0x3a, 0x82, 0x89, 0xbf,
+    0xcf, 0xc4, 0xd6, 0xfd, 0xd1, 0x55, 0xfb, 0x7b, 0x47, 0x5c, 0xee, 0x75,
+    0xba, 0x87, 0x8e, 0xe6, 0x77, 0xff, 0x7e, 0x93, 0x7c, 0xec, 0x27, 0x00,
+    0xae, 0x75, 0xfc, 0x20, 0xf2, 0x4f, 0x07, 0x5f, 0xf9, 0x14, 0x81, 0x8d,
+    0x42, 0x2c, 0xeb, 0xfb, 0x36, 0x02, 0x59, 0xa3, 0xaf, 0xb0, 0x39, 0x39,
+    0xd7, 0xca, 0xff, 0x21, 0x58, 0x3a, 0xee, 0x41, 0xd5, 0x8a, 0xdb, 0x5a,
+    0x4d, 0xb9, 0x52, 0x46, 0x80, 0xae, 0xef, 0x31, 0x32, 0xd2, 0xba, 0x58,
+    0x27, 0x7e, 0x2e, 0xd8, 0x43, 0xb4, 0x57, 0x7e, 0x66, 0x30, 0x28, 0x75,
+    0xe0, 0x7b, 0x47, 0x5f, 0xff, 0xff, 0xf6, 0xbe, 0x77, 0x27, 0x86, 0x77,
+    0x96, 0xbe, 0x01, 0xbc, 0xe4, 0x7c, 0x99, 0x4d, 0xfe, 0x7c, 0xee, 0xd9,
+    0xd5, 0x88, 0xec, 0x69, 0x37, 0x87, 0x2e, 0x07, 0xe7, 0x5d, 0xb6, 0xac,
+    0x9d, 0x7b, 0xe4, 0x9a, 0x75, 0x41, 0xe9, 0xa8, 0x2e, 0xb1, 0xeb, 0xff,
+    0xfb, 0x9f, 0x07, 0x36, 0x67, 0x25, 0xf2, 0x02, 0xf3, 0x68, 0xeb, 0xff,
+    0xff, 0x87, 0x78, 0x50, 0x70, 0x3d, 0x49, 0xbe, 0x6b, 0x37, 0x97, 0x31,
+    0x93, 0xab, 0x11, 0xac, 0x2c, 0x17, 0xde, 0x04, 0x4e, 0x75, 0xfe, 0x96,
+    0x77, 0x17, 0x0d, 0x3a, 0x90, 0xf4, 0xfc, 0x45, 0x7f, 0xff, 0x6f, 0x2d,
+    0x2f, 0x07, 0xe6, 0xd2, 0x76, 0x74, 0xce, 0x1d, 0x65, 0x73, 0xab, 0x0f,
+    0xcd, 0xac, 0x17, 0xff, 0xfe, 0x67, 0xe0, 0xe3, 0x7a, 0x83, 0x80, 0xdf,
+    0xdf, 0x1d, 0x9c, 0x50, 0xeb, 0xfc, 0xa0, 0x41, 0x1d, 0x18, 0x3a, 0xff,
+    0x6f, 0x2d, 0x28, 0x08, 0xdc, 0xeb, 0xfc, 0xec, 0x82, 0x68, 0xf3, 0x9d,
+    0x50, 0x98, 0x66, 0x38, 0xa1, 0x90, 0x9b, 0x5f, 0xfa, 0x34, 0x39, 0xb3,
+    0xe4, 0x97, 0x23, 0xaf, 0xbf, 0xf2, 0x4e, 0x75, 0xfe, 0xf7, 0x50, 0x7f,
+    0xfa, 0xb3, 0xaf, 0xf4, 0xf0, 0xb1, 0x8d, 0xff, 0x3a, 0xd1, 0x23, 0xe9,
+    0x73, 0x5b, 0xff, 0x9f, 0x92, 0xf9, 0xe1, 0x89, 0x67, 0x8e, 0xa8, 0x57,
+    0x4d, 0x8e, 0x89, 0x09, 0x4e, 0x46, 0x5b, 0xd3, 0xa7, 0x41, 0x18, 0x46,
+    0x00, 0x9a, 0xff, 0xfb, 0x88, 0x05, 0x4c, 0x7c, 0xd0, 0x3f, 0x5e, 0x78,
+    0xeb, 0x81, 0x23, 0xaf, 0xd1, 0xfe, 0xa7, 0xf1, 0xd7, 0x9f, 0xda, 0x3a,
+    0xe0, 0x4e, 0x75, 0xe1, 0xf4, 0xd2, 0x36, 0x5c, 0x1b, 0xbf, 0x80, 0xdf,
+    0x81, 0xdd, 0x93, 0xaa, 0x0f, 0x95, 0x0c, 0xef, 0xf7, 0x20, 0x31, 0xd8,
+    0x91, 0xd7, 0xff, 0xd1, 0xef, 0x82, 0x0d, 0xaf, 0x99, 0xed, 0xbc, 0xf1,
+    0xd4, 0x88, 0x89, 0x01, 0x8d, 0xff, 0xdd, 0x85, 0x3e, 0x78, 0x5f, 0xd1,
+    0xe3, 0xaf, 0xf7, 0xcd, 0xe4, 0x9d, 0x02, 0xce, 0xaf, 0xcf, 0xec, 0x51,
+    0x6f, 0xfe, 0xcd, 0x98, 0x1f, 0x9e, 0x51, 0x19, 0xd1, 0xd7, 0xfe, 0xe4,
+    0xdf, 0x35, 0x09, 0x3b, 0xf8, 0xea, 0x84, 0x56, 0x04, 0x88, 0x09, 0x37,
+    0x3f, 0xe7, 0x5f, 0xff, 0x7c, 0x18, 0xd4, 0x4e, 0x38, 0x1e, 0xa4, 0xc7,
+    0x5f, 0xff, 0xfd, 0xae, 0x0c, 0x4d, 0xf3, 0xef, 0x92, 0x59, 0xbf, 0xb3,
+    0x60, 0xe6, 0x8e, 0xae, 0x23, 0x1c, 0x54, 0x2b, 0xc8, 0xff, 0x04, 0x37,
+    0x68, 0xeb, 0xa6, 0x91, 0xd5, 0x06, 0x87, 0x81, 0x57, 0xff, 0x0f, 0xb5,
+    0xb1, 0x3d, 0x18, 0x33, 0x1d, 0x7e, 0xe2, 0x6a, 0x37, 0x3a, 0xb0, 0xfa,
+    0xdd, 0x12, 0xff, 0x4e, 0xa8, 0x9a, 0x49, 0xed, 0x1d, 0x7e, 0x1f, 0x77,
+    0x36, 0x8e, 0xbf, 0x4d, 0xa7, 0xe2, 0x87, 0x5e, 0x76, 0x79, 0x07, 0xa5,
+    0x85, 0x35, 0x24, 0x6e, 0xa1, 0x07, 0x21, 0x17, 0x7f, 0xdd, 0x4e, 0x4d,
+    0xd7, 0xce, 0x1d, 0x7f, 0xff, 0xff, 0x7f, 0xa1, 0xc7, 0xdf, 0xe0, 0x7a,
+    0x0f, 0x83, 0x9b, 0xcb, 0x01, 0x38, 0xe3, 0xee, 0x75, 0x35, 0x18, 0xc8,
+    0x71, 0x79, 0xdd, 0xa6, 0x8a, 0x62, 0xb0, 0xf2, 0x5a, 0x45, 0x7f, 0xec,
+    0x1d, 0xe5, 0xaf, 0x47, 0x26, 0x3a, 0xf6, 0x27, 0xe7, 0x5b, 0x0e, 0xbd,
+    0xb8, 0xe7, 0xe6, 0xab, 0x60, 0xdd, 0x22, 0x27, 0x9d, 0xa6, 0xff, 0x73,
+    0xaf, 0xf1, 0x61, 0x98, 0xeb, 0xfd, 0xf3, 0x79, 0x0c, 0x66, 0x8e, 0xa4,
+    0x3e, 0xa7, 0x36, 0xbf, 0xff, 0x7e, 0x9a, 0xf9, 0xd7, 0xd7, 0xa2, 0x6d,
+    0x77, 0x0e, 0xbf, 0x93, 0xae, 0x93, 0xc1, 0xd7, 0xa5, 0x1b, 0x9d, 0x7f,
+    0x96, 0x1e, 0xc4, 0xf8, 0xc9, 0xd5, 0x87, 0xf7, 0xb9, 0x5b, 0x8e, 0x5f,
+    0xff, 0xe1, 0xc6, 0xfb, 0xd1, 0xed, 0x4c, 0x38, 0xcf, 0xc8, 0x56, 0x0e,
+    0xbf, 0xf3, 0x61, 0x7d, 0xcd, 0x62, 0x09, 0xd5, 0x08, 0xa2, 0xeb, 0x3d,
+    0xfb, 0x91, 0xb2, 0x38, 0x75, 0xfc, 0xe3, 0xf0, 0x30, 0x27, 0x56, 0x1f,
+    0xb2, 0x11, 0x00, 0xa2, 0xa1, 0x95, 0xe1, 0x3a, 0xb4, 0x85, 0x83, 0x0c,
+    0x05, 0x21, 0x52, 0xd8, 0xd2, 0x77, 0x8c, 0xb9, 0x12, 0x66, 0x8d, 0xa3,
+    0x91, 0xa1, 0xae, 0x17, 0xfd, 0x84, 0x5f, 0xe4, 0x03, 0x0d, 0x3f, 0x46,
+    0x8d, 0x7f, 0xdc, 0x76, 0x7e, 0x38, 0x5e, 0x73, 0xaf, 0xe7, 0x66, 0x61,
+    0x40, 0x9d, 0x7f, 0xff, 0x83, 0x93, 0xb8, 0xfb, 0x50, 0xdf, 0x8b, 0x5a,
+    0x0b, 0x4e, 0xbf, 0x83, 0xa7, 0x8d, 0xe4, 0x75, 0x42, 0x23, 0x9d, 0x86,
+    0xff, 0xa2, 0x6e, 0xa4, 0x2d, 0xc2, 0x75, 0x28, 0x9a, 0x77, 0x0e, 0xc6,
+    0x17, 0x60, 0x21, 0xbe, 0xc1, 0x51, 0x5c, 0xeb, 0xff, 0xff, 0xf7, 0x53,
+    0xdd, 0xce, 0x46, 0xcf, 0x8b, 0x06, 0xd7, 0xcc, 0xde, 0x58, 0x01, 0xff,
+    0x47, 0x5b, 0xc8, 0x8b, 0x1d, 0x12, 0x5f, 0xfa, 0x1b, 0xf0, 0x5f, 0x4b,
+    0x81, 0x3a, 0xff, 0xfd, 0x99, 0xd4, 0x6f, 0x73, 0xe6, 0x81, 0xd8, 0x57,
+    0x3a, 0xff, 0xfb, 0xdd, 0xcf, 0xfe, 0x2e, 0x33, 0xc1, 0xc1, 0x3a, 0xfe,
+    0x70, 0xf3, 0x80, 0x9c, 0xeb, 0xf4, 0x60, 0xfb, 0x6c, 0xea, 0x69, 0xeb,
+    0x2c, 0xba, 0xfb, 0xc9, 0xcc, 0x3a, 0xdb, 0xfc, 0x3c, 0x2c, 0x22, 0xb6,
+    0xb1, 0x31, 0x27, 0x87, 0x45, 0x2d, 0x3d, 0x41, 0x3d, 0xf4, 0x6d, 0x57,
+    0xff, 0xff, 0xe1, 0xcd, 0xe4, 0x9a, 0x1c, 0xd9, 0xdc, 0x9b, 0xb0, 0x33,
+    0x7c, 0x76, 0xa6, 0xc3, 0xa9, 0x11, 0x7a, 0x03, 0x6b, 0xff, 0xc8, 0x1f,
+    0x8b, 0x4f, 0x90, 0x17, 0x9b, 0x47, 0x5d, 0x29, 0x1d, 0x6e, 0x41, 0xf1,
+    0xce, 0x9b, 0x7e, 0x94, 0x6f, 0x2d, 0x1d, 0x7f, 0xff, 0xff, 0xec, 0x15,
+    0x3e, 0x27, 0x40, 0xc4, 0xc9, 0xe8, 0x58, 0xba, 0x9d, 0x46, 0x33, 0xbb,
+    0xff, 0x01, 0x2a, 0xff, 0xff, 0xe6, 0xa3, 0x21, 0x07, 0x3e, 0x02, 0x27,
+    0xd3, 0x7a, 0x0e, 0xee, 0xec, 0x9d, 0x70, 0x27, 0xdd, 0x34, 0x04, 0x28,
+    0xd4, 0x27, 0xea, 0x17, 0x3a, 0x7b, 0x2a, 0xe5, 0xe1, 0x0a, 0x31, 0xb4,
+    0x5f, 0xe7, 0x96, 0x2d, 0xc7, 0xf3, 0xaf, 0xb3, 0xb1, 0x31, 0xd7, 0x96,
+    0xdf, 0x9d, 0x3d, 0x27, 0x31, 0xbf, 0xff, 0xfd, 0xc6, 0x8e, 0x6c, 0xf9,
+    0xa4, 0xc1, 0xff, 0xe0, 0xe6, 0xc1, 0xcd, 0x6c, 0x3a, 0xff, 0x9b, 0x8e,
+    0xbf, 0x9b, 0x70, 0xb3, 0xab, 0x11, 0x75, 0xc7, 0xeb, 0xff, 0xf2, 0x0f,
+    0xbb, 0x9b, 0x5e, 0x9b, 0x15, 0xdc, 0x7f, 0x3a, 0xfd, 0x0c, 0xfc, 0xd4,
+    0xc7, 0x5f, 0xf8, 0x67, 0x1c, 0xd9, 0xa0, 0x46, 0xe7, 0x5f, 0xf8, 0x3d,
+    0x8d, 0xfe, 0x2a, 0xfd, 0x9f, 0xa1, 0xd5, 0x08, 0x8a, 0x9d, 0x02, 0x91,
+    0x35, 0x4d, 0x11, 0x79, 0x68, 0x10, 0xb5, 0xbf, 0xf0, 0xc9, 0xbd, 0x4e,
+    0x88, 0x27, 0x3a, 0xf7, 0xb1, 0x52, 0x75, 0x41, 0xee, 0xe1, 0xf5, 0xed,
+    0xbc, 0xe9, 0xd7, 0x60, 0x4e, 0xa9, 0xd5, 0x9a, 0xca, 0x52, 0x1e, 0xa1,
+    0x3f, 0xe2, 0x0d, 0x83, 0xd7, 0xe4, 0xf6, 0xb3, 0xf3, 0xaf, 0xdd, 0xcd,
+    0x89, 0xb0, 0xeb, 0xc9, 0x9f, 0x9d, 0x7f, 0x06, 0x07, 0xaf, 0x23, 0xaf,
+    0x40, 0x60, 0xeb, 0xf6, 0x7b, 0x4f, 0x37, 0xc3, 0xc5, 0x59, 0x5d, 0xfc,
+    0xcf, 0xc5, 0x6d, 0x5a, 0xaa, 0x95, 0xb3, 0xaa, 0x48, 0x86, 0x44, 0x1b,
+    0xff, 0xf7, 0x01, 0xce, 0x40, 0xe2, 0x89, 0xde, 0xe7, 0xd3, 0xaf, 0x80,
+    0xfb, 0xf8, 0xea, 0x92, 0x7a, 0x21, 0x27, 0x50, 0xaa, 0x68, 0x73, 0x70,
+    0x8b, 0xaa, 0xd4, 0x75, 0xfd, 0xa6, 0xb5, 0xc5, 0x43, 0xa9, 0x56, 0x36,
+    0xfe, 0x0a, 0xbf, 0xc3, 0xf3, 0x66, 0xf2, 0xd4, 0xc7, 0x5d, 0x3e, 0xe7,
+    0x5f, 0xba, 0xea, 0xf1, 0xf9, 0xd4, 0x13, 0xfb, 0x73, 0x9d, 0xa1, 0x8b,
+    0xfd, 0xc9, 0x87, 0x3a, 0xfe, 0x3a, 0xa1, 0x30, 0x4c, 0x85, 0x0a, 0x18,
+    0xdf, 0x93, 0x81, 0xc1, 0x3a, 0xfd, 0xfe, 0x7b, 0xec, 0xe7, 0x5f, 0xe6,
+    0x7d, 0x9d, 0xf9, 0xbe, 0x8e, 0xa8, 0x3e, 0x27, 0x2b, 0xa9, 0x23, 0x6b,
+    0xa6, 0x63, 0x08, 0x7b, 0xfe, 0xf7, 0x72, 0x4e, 0x39, 0xb9, 0xd7, 0xff,
+    0xfc, 0x2f, 0xfe, 0xa7, 0xc4, 0x1f, 0x0e, 0x6c, 0xf9, 0xa6, 0x44, 0xea,
+    0x14, 0x50, 0x78, 0xde, 0xff, 0xc9, 0x93, 0x7c, 0xd4, 0x75, 0xd5, 0xce,
+    0xbf, 0xed, 0xf2, 0x37, 0x98, 0x61, 0x67, 0x5f, 0xdb, 0xeb, 0xb8, 0xfc,
+    0x3a, 0xff, 0xff, 0xc8, 0xbe, 0x26, 0x6e, 0x20, 0xf4, 0x77, 0xe6, 0xc4,
+    0xf4, 0xd0, 0x75, 0x3a, 0x27, 0x3c, 0x5b, 0x41, 0x4c, 0xe7, 0xa8, 0x5e,
+    0x86, 0xad, 0xff, 0x67, 0x27, 0x84, 0xe6, 0x09, 0xd6, 0x59, 0xdf, 0x0d,
+    0xb5, 0xe1, 0xc0, 0x9d, 0x50, 0x6f, 0x37, 0x22, 0xbf, 0xb7, 0xd6, 0x60,
+    0xa8, 0x75, 0xf2, 0xfe, 0xc7, 0xe7, 0x5f, 0xfe, 0x9c, 0x3c, 0x76, 0x8e,
+    0x6c, 0xe2, 0x68, 0xea, 0xc4, 0x4e, 0x21, 0x68, 0x09, 0x2f, 0xf3, 0xfb,
+    0xaf, 0x37, 0xd5, 0x9d, 0x78, 0x1b, 0xfe, 0x75, 0x42, 0xb4, 0x1c, 0x8d,
+    0x6d, 0x21, 0x51, 0xc8, 0x5e, 0xb9, 0x70, 0x9a, 0xdf, 0xde, 0x7e, 0xfc,
+    0x0c, 0x1d, 0x7f, 0xfb, 0xda, 0xfb, 0xaf, 0x9e, 0x18, 0x96, 0x78, 0xeb,
+    0xfd, 0xe4, 0x9f, 0x3a, 0x0f, 0x1d, 0x69, 0x8e, 0xbf, 0xb0, 0x19, 0xd6,
+    0xce, 0x75, 0xd9, 0xbc, 0x1b, 0xed, 0x08, 0xdf, 0xdd, 0x79, 0x2f, 0x88,
+    0x75, 0xff, 0xca, 0x28, 0xfe, 0xd7, 0x86, 0x37, 0x91, 0xd7, 0xf7, 0x86,
+    0x25, 0x9e, 0x3a, 0xa0, 0xfc, 0x64, 0x8d, 0x72, 0x68, 0xeb, 0xdc, 0xcd,
+    0xce, 0xa0, 0x9b, 0x1f, 0xc5, 0x6f, 0xff, 0x3a, 0x9e, 0x52, 0x06, 0x59,
+    0xd4, 0x59, 0xd7, 0xe4, 0xd6, 0xa1, 0x67, 0x52, 0x22, 0x44, 0x48, 0xb6,
+    0x24, 0xd4, 0x2a, 0xc8, 0xc2, 0xe5, 0x13, 0x51, 0xc7, 0xf2, 0xc1, 0x84,
+    0xe8, 0x21, 0xc7, 0x7e, 0x0a, 0x0b, 0x84, 0xeb, 0xff, 0xf4, 0xbb, 0x93,
+    0x76, 0x05, 0x41, 0xcf, 0x74, 0x07, 0x52, 0x1f, 0xd7, 0x09, 0x6f, 0xff,
+    0xf2, 0x66, 0xf2, 0xd7, 0xbb, 0x0b, 0x84, 0x0f, 0xc8, 0x56, 0x0e, 0xbf,
+    0xce, 0x3f, 0x1b, 0xaf, 0xc2, 0x75, 0xff, 0x81, 0xaf, 0x8b, 0xfb, 0xd7,
+    0xec, 0x1d, 0x7e, 0xcf, 0x03, 0x37, 0x3a, 0xf2, 0x99, 0xb9, 0xd7, 0x44,
+    0xdf, 0x0f, 0x13, 0xc4, 0xf4, 0x28, 0xb6, 0x04, 0x21, 0xaf, 0xff, 0xff,
+    0xc0, 0x1f, 0x8c, 0xbe, 0xf2, 0xe3, 0xff, 0xf3, 0x40, 0x8d, 0xfb, 0x88,
+    0x38, 0xa1, 0xd7, 0xff, 0xe0, 0x73, 0x99, 0xed, 0x75, 0x33, 0xe7, 0x7f,
+    0x83, 0xab, 0x11, 0xc1, 0xd8, 0x44, 0xdf, 0xb0, 0x5b, 0xf5, 0x67, 0x5f,
+    0xfd, 0xdc, 0x81, 0x98, 0x73, 0xda, 0x73, 0xad, 0x2f, 0x1f, 0x4e, 0xd1,
+    0x45, 0xff, 0xf8, 0x38, 0xbf, 0x9b, 0x5e, 0x8d, 0x4d, 0x27, 0xe4, 0xe7,
+    0x5f, 0xff, 0xde, 0x49, 0xf0, 0x3f, 0x16, 0xf2, 0xe2, 0x4e, 0xeb, 0x3a,
+    0xff, 0x4e, 0xeb, 0x18, 0xe4, 0xc7, 0x5f, 0xf6, 0xf8, 0xa7, 0xeb, 0xcf,
+    0x9c, 0xc4, 0x48, 0x22, 0xed, 0xff, 0x60, 0xcf, 0xf3, 0xf7, 0x79, 0x8e,
+    0xbf, 0xee, 0x4f, 0x13, 0xce, 0x0e, 0x4e, 0x75, 0xff, 0xbe, 0x4d, 0xd0,
+    0x28, 0x98, 0x2a, 0x1d, 0x7f, 0x87, 0xe6, 0x81, 0xb6, 0x0e, 0x1d, 0x58,
+    0x7f, 0x40, 0x42, 0xa8, 0x46, 0xc6, 0xa1, 0x6f, 0x7f, 0xfa, 0x7f, 0x9a,
+    0xe8, 0x3e, 0x7b, 0x5a, 0x8e, 0x1d, 0x7f, 0xfd, 0xd8, 0x9f, 0xe0, 0xe6,
+    0xc7, 0xef, 0x63, 0x73, 0xaf, 0xff, 0xfb, 0x7d, 0x26, 0x33, 0xf3, 0xb9,
+    0xed, 0x64, 0xff, 0x31, 0x02, 0x75, 0x05, 0x17, 0xd8, 0xa7, 0x7f, 0x4f,
+    0xe9, 0x86, 0x16, 0x75, 0xff, 0xfd, 0x93, 0xe2, 0x04, 0x41, 0xdf, 0x90,
+    0x17, 0x9b, 0x47, 0x56, 0x27, 0x74, 0x91, 0x87, 0x39, 0x16, 0x8b, 0xaa,
+    0x75, 0xf8, 0x80, 0xb3, 0x29, 0x0e, 0xb6, 0xc6, 0x0f, 0xbc, 0x24, 0x10,
+    0xaf, 0x90, 0xec, 0x5a, 0xa6, 0xa3, 0x13, 0xf4, 0x7c, 0x37, 0xfb, 0xc3,
+    0x9e, 0xee, 0x4e, 0x75, 0xff, 0x9f, 0x9d, 0xcf, 0x40, 0xa7, 0xe7, 0x5f,
+    0xff, 0x0e, 0x4f, 0xf3, 0xf0, 0x7b, 0x31, 0x7f, 0xb2, 0x75, 0xf4, 0xbc,
+    0x93, 0x9d, 0x7f, 0xd8, 0xce, 0xf2, 0xd7, 0xcf, 0x21, 0xd7, 0xfe, 0x94,
+    0x67, 0xfd, 0xcc, 0x16, 0x9d, 0x7f, 0xfb, 0xa8, 0x21, 0xf9, 0xf5, 0xa3,
+    0x9d, 0xc3, 0xab, 0x11, 0x0f, 0x31, 0xe5, 0xff, 0x75, 0x17, 0x18, 0x3e,
+    0xd1, 0xd7, 0xff, 0xf8, 0x1e, 0xe0, 0x26, 0xf9, 0xe9, 0xba, 0x0f, 0xfc,
+    0x99, 0xb4, 0x75, 0xf4, 0x36, 0x17, 0xf1, 0x18, 0x6d, 0x23, 0x13, 0x6a,
+    0x85, 0x56, 0x2d, 0x32, 0xe1, 0xe3, 0xaa, 0x09, 0x16, 0xd4, 0x70, 0xd7,
+    0xff, 0xf7, 0x31, 0xd7, 0xf1, 0x47, 0xdf, 0xb9, 0xde, 0xc7, 0x8e, 0xbf,
+    0xd0, 0xbc, 0xce, 0x4d, 0x23, 0xaf, 0x93, 0xc9, 0x07, 0x5f, 0xff, 0xfe,
+    0x14, 0x53, 0xaf, 0x37, 0xc1, 0x06, 0xd7, 0xcc, 0xde, 0x58, 0x01, 0xff,
+    0x47, 0x5f, 0xba, 0x90, 0x33, 0x9d, 0x77, 0xa1, 0x68, 0xa6, 0xd9, 0x08,
+    0x0a, 0x92, 0x3e, 0x92, 0x18, 0xb5, 0x0c, 0xd1, 0xac, 0x9f, 0xa9, 0x49,
+    0x6c, 0x5c, 0x5f, 0xea, 0xeb, 0xc6, 0x59, 0x7e, 0x81, 0xf2, 0x6c, 0x3a,
+    0xfb, 0xda, 0x7f, 0xce, 0xbf, 0xfb, 0xa9, 0xf1, 0x38, 0x09, 0xdf, 0x8d,
+    0x3a, 0xf9, 0x3a, 0xf3, 0x9d, 0x7d, 0xb2, 0x3d, 0x07, 0x5f, 0xb5, 0x9e,
+    0x4d, 0x1d, 0x7e, 0x02, 0xa4, 0x5f, 0xc7, 0x5f, 0xdd, 0x79, 0xfe, 0x4b,
+    0xc7, 0x5f, 0x9f, 0x83, 0xba, 0x1d, 0x50, 0x88, 0x04, 0x2a, 0xf1, 0x85,
+    0x05, 0x3a, 0x6c, 0x27, 0x50, 0x89, 0xa8, 0xc8, 0x43, 0x31, 0x17, 0xa1,
+    0x4d, 0x7f, 0xbb, 0x08, 0x2f, 0xc5, 0x0e, 0xbf, 0xa1, 0x05, 0xf8, 0xa1,
+    0xd7, 0xfb, 0xf7, 0xff, 0x9c, 0x4e, 0x7c, 0x3d, 0xce, 0x98, 0xdb, 0xf3,
+    0xaf, 0xe8, 0xe4, 0xf1, 0xc9, 0xce, 0xbc, 0x07, 0xd1, 0xd5, 0x23, 0xc9,
+    0xfa, 0x5d, 0x7f, 0xff, 0x27, 0x3e, 0x62, 0x60, 0xa9, 0xd4, 0xc5, 0xe3,
+    0x4e, 0xbf, 0xff, 0xe4, 0x9f, 0x90, 0xbd, 0x02, 0x3e, 0x47, 0x20, 0x3d,
+    0x85, 0x9d, 0x58, 0x8c, 0x0e, 0x2c, 0xdf, 0xbf, 0xd2, 0x6e, 0xc9, 0xd7,
+    0xfe, 0xe6, 0x6f, 0xdd, 0xe1, 0x73, 0xc1, 0xd7, 0xff, 0xff, 0xb9, 0xc4,
+    0x9f, 0xe7, 0x73, 0xc3, 0x13, 0x77, 0x27, 0x8d, 0xfc, 0x06, 0x9d, 0x7f,
+    0xff, 0xf4, 0x29, 0xd8, 0xf8, 0x38, 0x05, 0x3e, 0x6f, 0x2d, 0x20, 0xfd,
+    0x89, 0xce, 0xbf, 0x6f, 0xa4, 0xc1, 0x3a, 0xb1, 0x13, 0xe0, 0x79, 0xa4,
+    0x4c, 0xf7, 0xb1, 0x8d, 0xdf, 0xfd, 0x2d, 0x22, 0x9d, 0x84, 0x9e, 0x14,
+    0x3a, 0xff, 0x84, 0x13, 0x0e, 0x75, 0xfc, 0x75, 0xfe, 0xec, 0x32, 0x1e,
+    0xba, 0xce, 0xbf, 0xe5, 0xe6, 0xbe, 0x4c, 0x30, 0xb3, 0xa8, 0x27, 0xda,
+    0xb3, 0x3b, 0xff, 0xfe, 0x7e, 0x77, 0x3c, 0x98, 0x33, 0xea, 0x30, 0x43,
+    0xd8, 0x3a, 0xfb, 0xdf, 0x27, 0xe1, 0xd5, 0xba, 0x21, 0xdd, 0x8a, 0xff,
+    0xff, 0xdb, 0xe4, 0xe0, 0xda, 0xf9, 0xbc, 0xbd, 0x0c, 0xfc, 0xce, 0x7f,
+    0xfc, 0x1d, 0x7f, 0xf9, 0x97, 0x19, 0xd6, 0x04, 0x0a, 0x0a, 0x1d, 0x7f,
+    0x4d, 0xbc, 0x81, 0x1e, 0x3a, 0xff, 0xba, 0xeb, 0x1c, 0xeb, 0xf8, 0xeb,
+    0xec, 0xe7, 0xec, 0x9d, 0x50, 0x88, 0x8d, 0x17, 0xf8, 0xda, 0xfe, 0xcf,
+    0x73, 0x99, 0x23, 0xaf, 0xe1, 0xce, 0x8e, 0x34, 0xeb, 0xe1, 0xcd, 0x7c,
+    0x98, 0xf5, 0xbc, 0x59, 0x7f, 0xd8, 0xbe, 0xc2, 0x70, 0x0a, 0xe7, 0x50,
+    0x57, 0x7a, 0xb0, 0x89, 0x42, 0xa6, 0xc6, 0xfb, 0xb9, 0x4a, 0x22, 0xf2,
+    0x14, 0x9d, 0x85, 0x4b, 0x91, 0xe9, 0xe7, 0xd0, 0xd0, 0xd9, 0x08, 0x5f,
+    0xa7, 0x77, 0xfe, 0xc6, 0x47, 0x01, 0x8a, 0x4b, 0xf3, 0xaf, 0xfc, 0x39,
+    0xf3, 0x99, 0xd1, 0xc9, 0x8e, 0xbf, 0xff, 0xdd, 0x7f, 0xf5, 0xf0, 0x73,
+    0x60, 0xe6, 0xb1, 0x70, 0xd3, 0xa8, 0x51, 0x41, 0xa3, 0xea, 0x55, 0x99,
+    0x1f, 0x70, 0xb5, 0x93, 0xd9, 0xdb, 0xc3, 0x49, 0xe1, 0xbf, 0x7f, 0x67,
+    0x7e, 0x8e, 0xff, 0x9d, 0x7f, 0x77, 0x07, 0xdf, 0x80, 0xeb, 0xf0, 0xc2,
+    0xdc, 0x27, 0x5f, 0xec, 0x9b, 0xb9, 0xe8, 0x09, 0xd7, 0xf0, 0xf9, 0xd6,
+    0x9e, 0x3a, 0xd2, 0x3a, 0xa0, 0xdd, 0xf8, 0xae, 0xf0, 0xb6, 0x0e, 0xbf,
+    0xff, 0xfe, 0xee, 0x7b, 0x4f, 0x37, 0xc1, 0xcd, 0xe5, 0x80, 0x9c, 0x70,
+    0x3d, 0x49, 0x8e, 0xb8, 0x0a, 0x1d, 0x48, 0x8b, 0x1e, 0x0d, 0x7a, 0x10,
+    0x17, 0xf6, 0x4e, 0x39, 0xbe, 0x8e, 0xbf, 0xf8, 0x7f, 0xdb, 0xce, 0xa4,
+    0x2d, 0xc2, 0x75, 0xff, 0xff, 0xfa, 0x5a, 0xd0, 0x23, 0xc8, 0x1c, 0x19,
+    0xbe, 0x0e, 0x72, 0x07, 0xdd, 0xcd, 0xa3, 0xaf, 0xfe, 0xde, 0x5a, 0xc5,
+    0xef, 0x1d, 0xec, 0x1d, 0x5b, 0xa3, 0x2b, 0x90, 0x85, 0xb6, 0x8e, 0xac,
+    0x4d, 0x20, 0x11, 0x87, 0xfd, 0x29, 0xbf, 0xb3, 0x79, 0x47, 0xf0, 0x75,
+    0xf8, 0x73, 0xaf, 0xe3, 0xad, 0x1b, 0x9e, 0x92, 0xcb, 0x6f, 0xbe, 0x36,
+    0x76, 0x4e, 0xbf, 0x4f, 0xf0, 0x11, 0x31, 0xd7, 0xff, 0xfc, 0x31, 0xfe,
+    0xf2, 0xd0, 0x23, 0xc3, 0x81, 0x4c, 0xe4, 0xc7, 0x53, 0xa2, 0x47, 0xc5,
+    0x75, 0x0b, 0x9e, 0x81, 0x30, 0x42, 0xd9, 0x89, 0x7a, 0xda, 0xf0, 0xd1,
+    0x13, 0x4d, 0x46, 0xea, 0x08, 0x45, 0x6c, 0x28, 0xfb, 0x0b, 0x7b, 0xf4,
+    0x93, 0x99, 0xb9, 0xd7, 0xb5, 0xdc, 0x3a, 0xfd, 0x9a, 0x9f, 0x19, 0x3a,
+    0xb7, 0x3e, 0xa9, 0x89, 0xfa, 0x37, 0x7f, 0xfd, 0x3e, 0x34, 0x3d, 0x4c,
+    0x53, 0xe2, 0x80, 0x83, 0xaf, 0xfb, 0xe7, 0xdf, 0x26, 0xc8, 0x16, 0x9d,
+    0x48, 0x89, 0x0e, 0xa9, 0xdf, 0xfe, 0x8d, 0xe5, 0xaf, 0x3c, 0xfb, 0x43,
+    0x9b, 0x9d, 0x7f, 0xdd, 0x9d, 0x30, 0x77, 0x96, 0x8e, 0xbf, 0xed, 0xfb,
+    0x8d, 0x1c, 0x02, 0xb9, 0xd6, 0x94, 0x1f, 0xa6, 0x1c, 0xdf, 0xc9, 0xbf,
+    0xfc, 0x70, 0x9d, 0x7e, 0xc4, 0xce, 0x7e, 0x75, 0x74, 0xf5, 0x04, 0xba,
+    0xfb, 0x6b, 0xd9, 0xd3, 0xae, 0x45, 0x9d, 0x7f, 0xff, 0xed, 0xe4, 0xfb,
+    0xfc, 0x10, 0x6d, 0x7c, 0xcd, 0xe5, 0x80, 0x1f, 0xf4, 0x75, 0x2d, 0x11,
+    0x7b, 0x42, 0xb7, 0xb6, 0xd1, 0x52, 0x75, 0x7c, 0x4c, 0x62, 0x72, 0x1c,
+    0x85, 0x7e, 0xd9, 0x35, 0xff, 0xff, 0xfa, 0x37, 0xd0, 0x23, 0x7f, 0x9d,
+    0xc0, 0xfc, 0x1c, 0x02, 0x9f, 0x35, 0xff, 0xe9, 0xe3, 0xaf, 0xd0, 0x3b,
+    0xbc, 0xe7, 0x5f, 0xff, 0xff, 0xfb, 0x1b, 0x1d, 0x85, 0xfb, 0x35, 0xa8,
+    0xe7, 0x20, 0x72, 0x7c, 0x06, 0x81, 0x30, 0xc2, 0xce, 0xbc, 0x0e, 0x28,
+    0x75, 0x2d, 0x16, 0x9b, 0x70, 0x97, 0xbf, 0x3f, 0xff, 0x5e, 0x73, 0xab,
+    0x0f, 0x55, 0x0a, 0xef, 0x27, 0xf0, 0x75, 0xfc, 0x11, 0xce, 0xbf, 0x8e,
+    0xbf, 0x7b, 0x79, 0x27, 0x0e, 0xac, 0x3d, 0x3d, 0x15, 0xd4, 0xe8, 0x8f,
+    0xfd, 0xba, 0xff, 0x4e, 0x08, 0xf2, 0xd3, 0xc7, 0x5f, 0xfa, 0x14, 0xda,
+    0x06, 0x0c, 0xdf, 0x56, 0x75, 0x61, 0xfb, 0xee, 0x67, 0x7f, 0xec, 0xcf,
+    0xf5, 0xf3, 0x9a, 0x0e, 0x8e, 0xbf, 0xdc, 0xc6, 0xf5, 0x39, 0x31, 0xd7,
+    0x67, 0x82, 0x7e, 0x98, 0x83, 0x7d, 0x3a, 0x0f, 0x8e, 0xbf, 0x67, 0x7a,
+    0xf2, 0x3a, 0xfe, 0xf2, 0x72, 0x7c, 0x69, 0xd5, 0x0b, 0xf7, 0xb9, 0x0c,
+    0x15, 0x08, 0xb7, 0x86, 0x12, 0x47, 0x25, 0xc4, 0x85, 0xc2, 0x37, 0xb1,
+    0x98, 0x3c, 0x2b, 0xc6, 0x13, 0x9a, 0x84, 0xb0, 0x0b, 0x36, 0xc8, 0x76,
+    0x89, 0xaf, 0x3b, 0x70, 0xeb, 0xff, 0x4d, 0xf3, 0xc3, 0x8c, 0xe2, 0x68,
+    0xea, 0x55, 0x1e, 0xd4, 0x0d, 0x51, 0xd7, 0xf6, 0x2e, 0x3a, 0xfd, 0x3a,
+    0xef, 0x93, 0x1d, 0x5f, 0x0f, 0x10, 0x25, 0x77, 0xff, 0xdb, 0xc8, 0x63,
+    0xe2, 0xc6, 0x14, 0xf2, 0x4e, 0x75, 0x42, 0x31, 0x31, 0x39, 0x09, 0x2f,
+    0xdc, 0xf8, 0x3b, 0x19, 0x3a, 0xfb, 0xaf, 0xfc, 0x1d, 0x7b, 0xb9, 0xc3,
+    0xaa, 0x0f, 0xa1, 0xcb, 0x36, 0x88, 0x6f, 0xe9, 0xe6, 0x92, 0xab, 0x93,
+    0x9d, 0x7e, 0x5a, 0x07, 0x02, 0x75, 0xa6, 0x3a, 0xe8, 0x59, 0xd6, 0xf1,
+    0xd5, 0xc3, 0x4a, 0xe2, 0xb4, 0x13, 0xd6, 0xe9, 0xb5, 0xee, 0x44, 0xc7,
+    0x5e, 0xd3, 0xee, 0x75, 0x39, 0xb8, 0xf0, 0xe5, 0xd3, 0x39, 0xd7, 0xf3,
+    0xb3, 0x1e, 0xc9, 0xce, 0xbf, 0x93, 0x9b, 0xc8, 0x60, 0xeb, 0xfc, 0x1e,
+    0xc6, 0xf2, 0xcf, 0x1d, 0x5d, 0x3d, 0xff, 0x16, 0x52, 0xb2, 0x9f, 0x7c,
+    0x1a, 0xe3, 0xe2, 0x2d, 0x2c, 0x80, 0x45, 0x81, 0x08, 0xcb, 0xfc, 0xce,
+    0x48, 0x40, 0xfa, 0x3a, 0xfd, 0xbb, 0x2e, 0x3f, 0x9d, 0x70, 0xa8, 0x75,
+    0xb4, 0x86, 0xfc, 0x05, 0x37, 0xff, 0xf4, 0x2c, 0x71, 0xbb, 0xf8, 0x5f,
+    0xab, 0x8c, 0xf1, 0xd7, 0xff, 0xe8, 0xe4, 0x37, 0x17, 0x0d, 0x92, 0x68,
+    0x0b, 0x3a, 0xa1, 0x34, 0x29, 0x9c, 0x7a, 0x4d, 0xb6, 0xb1, 0x7f, 0x73,
+    0x21, 0x48, 0x13, 0xaf, 0x0b, 0xac, 0xeb, 0xbf, 0x83, 0xaa, 0x47, 0xb6,
+    0x85, 0x62, 0x35, 0x4a, 0xcb, 0xf0, 0x0c, 0x2b, 0x6e, 0xca, 0xa8, 0xfb,
+    0x95, 0xa2, 0xcc, 0x4b, 0x87, 0x9e, 0x3a, 0x09, 0x42, 0x08, 0x33, 0x95,
+    0x79, 0x4b, 0x6e, 0x52, 0x52, 0xbb, 0x67, 0x77, 0x77, 0x97, 0xac, 0x92,
+    0x8b, 0x26, 0x94, 0xe9, 0xc9, 0xc1, 0x55, 0xcb, 0x2c, 0xed, 0x38, 0x09,
+    0xe5, 0x09, 0x7f, 0x0c, 0x61, 0xa4, 0xa4, 0xea, 0x75, 0x5f, 0xd4, 0x8d,
+    0x80, 0x46, 0x93, 0xb2, 0x1d, 0x2c, 0xc2, 0x57, 0x6e, 0x50, 0xff, 0xd8,
+    0xeb, 0x76, 0xa1, 0x39, 0x7f, 0xff, 0x01, 0xac, 0x6f, 0xee, 0x46, 0x6e,
+    0xaa, 0x0b, 0xba, 0x87, 0x53, 0x0a, 0xaa, 0x92, 0x52, 0x45, 0xfe, 0x57,
+    0x74, 0xf6, 0x90, 0x4e, 0xbf, 0x71, 0xae, 0xed, 0x34, 0x53, 0xb7, 0x66,
+    0xe7, 0x5f, 0xfe, 0x00, 0x05, 0x06, 0x3a, 0x8b, 0xcd, 0x1d, 0x66, 0x21,
+    0x18, 0x58, 0x67, 0xb9, 0x9a, 0xc5, 0xaf, 0xdc, 0x6b, 0xbb, 0x4d, 0x15,
+    0x1d, 0xff, 0x9e, 0x4c, 0x67, 0x1a, 0xee, 0xd3, 0x44, 0xd1, 0x7c, 0x31,
+    0x9b, 0x9d, 0x58, 0x89, 0xd5, 0x99, 0xf9, 0x2a, 0xff, 0x7d, 0x7d, 0x8c,
+    0x79, 0x27, 0x3a, 0x98, 0x3e, 0x78, 0x2f, 0xbf, 0x71, 0xae, 0xed, 0x34,
+    0x55, 0xf7, 0xf6, 0x6c, 0x81, 0xe8, 0x0e, 0xb3, 0x18, 0x7c, 0x1c, 0x33,
+    0xbf, 0x71, 0xae, 0xed, 0x34, 0x56, 0xd7, 0xfd, 0x26, 0x33, 0x8d, 0x77,
+    0x69, 0xa2, 0x41, 0xb3, 0x18, 0x7f, 0x0e, 0x67, 0x7f, 0xf3, 0x0f, 0x26,
+    0x33, 0x8d, 0x77, 0x69, 0xa2, 0x43, 0xbf, 0xf6, 0x98, 0xcf, 0x20, 0x70,
+    0x66, 0x3a, 0xf3, 0xbb, 0x4f, 0x18, 0x1d, 0x41, 0xf2, 0xb4, 0xfa, 0xee,
+    0xab, 0x9d, 0x7f, 0xe9, 0x76, 0x3d, 0xa5, 0x63, 0x4a, 0xd8, 0x9d, 0x7f,
+    0xf9, 0x57, 0x2a, 0xe5, 0x63, 0xb0, 0xb1, 0x7e, 0xa7, 0x0e, 0xb6, 0xe7,
+    0x5c, 0x82, 0x75, 0xfd, 0x01, 0x8f, 0x38, 0x4e, 0xa0, 0x9e, 0x84, 0xc2,
+    0x3e, 0x14, 0xbf, 0xf9, 0x06, 0x78, 0x53, 0xef, 0xff, 0xc6, 0xe7, 0x5f,
+    0xb3, 0x07, 0xfd, 0x1d, 0x7e, 0x70, 0xfd, 0x81, 0x3a, 0xff, 0xdc, 0xf7,
+    0xd1, 0x76, 0xe0, 0xb4, 0xeb, 0xe6, 0xbb, 0xb4, 0xd1, 0x62, 0x5e, 0x00,
+    0xc8, 0xeb, 0xfc, 0xd8, 0xce, 0x7f, 0xff, 0x8e, 0xa9, 0xd1, 0xc3, 0x84,
+    0xfc, 0x3e, 0xf1, 0x68, 0x06, 0xef, 0xd9, 0xc8, 0x15, 0x0e, 0xbf, 0x7d,
+    0xdb, 0xce, 0x41, 0xd7, 0xb5, 0x02, 0x75, 0xbb, 0x07, 0x8a, 0x85, 0x77,
+    0xff, 0x46, 0x6b, 0x04, 0x29, 0xfc, 0x09, 0xd7, 0x86, 0x27, 0x3a, 0x84,
+    0xf6, 0xc0, 0x81, 0x7d, 0x1c, 0x85, 0x9d, 0x52, 0x3c, 0x1d, 0x10, 0xde,
+    0x5b, 0xf8, 0xeb, 0x93, 0xf3, 0xab, 0x86, 0xc7, 0x6c, 0x6e, 0xfc, 0x9b,
+    0x00, 0xfa, 0x3a, 0xff, 0x83, 0xdc, 0x5e, 0x3f, 0x27, 0x3a, 0xfd, 0xef,
+    0x3c, 0xb4, 0x75, 0xff, 0x81, 0x9b, 0x87, 0x67, 0x71, 0xe6, 0x3a, 0xb7,
+    0x3e, 0x8d, 0x84, 0xf6, 0x91, 0xd7, 0xd9, 0x8c, 0xe8, 0xea, 0x83, 0x63,
+    0xe1, 0x0b, 0x80, 0x27, 0x54, 0x26, 0x57, 0x90, 0xa0, 0xe2, 0xb6, 0x88,
+    0x2f, 0xfa, 0x35, 0xf7, 0x39, 0x99, 0x31, 0xd7, 0xf7, 0x25, 0xfe, 0x64,
+    0xc7, 0x5f, 0x3c, 0x26, 0xd9, 0xd5, 0x87, 0xa1, 0xc2, 0xeb, 0xe9, 0x7d,
+    0xec, 0x1d, 0x7b, 0x91, 0x23, 0xa9, 0xcd, 0xf6, 0xc2, 0x3b, 0xfa, 0x17,
+    0x89, 0xc9, 0x8e, 0xbe, 0xfb, 0x1b, 0x5a, 0x3a, 0xfd, 0x81, 0xec, 0x74,
+    0xeb, 0xee, 0x23, 0x2a, 0xe7, 0x50, 0x9e, 0x5e, 0x89, 0xa8, 0x28, 0x92,
+    0xd3, 0x8d, 0x42, 0x6c, 0x48, 0xbf, 0xd2, 0x27, 0x85, 0xf5, 0xfc, 0x82,
+    0xeb, 0x8e, 0x9d, 0x7f, 0xfa, 0x17, 0x12, 0x08, 0xc7, 0x5f, 0x38, 0x75,
+    0x1d, 0x52, 0x3d, 0x0d, 0xb4, 0x6b, 0xde, 0xcf, 0xce, 0xbf, 0x96, 0x9a,
+    0xd2, 0x04, 0xeb, 0xcf, 0xc5, 0x0e, 0xa0, 0x1e, 0x43, 0x25, 0x97, 0xf9,
+    0xa3, 0x9b, 0x07, 0x34, 0x75, 0xff, 0x6f, 0x27, 0xc1, 0xcf, 0x68, 0xeb,
+    0xff, 0x66, 0xf2, 0xec, 0x69, 0x4e, 0xc1, 0xd5, 0x24, 0xf3, 0xb7, 0x7a,
+    0x98, 0x97, 0x8c, 0x9d, 0x23, 0x13, 0x2d, 0xa3, 0x7b, 0x6d, 0x9d, 0x74,
+    0xb4, 0x75, 0x9e, 0x46, 0xa7, 0x71, 0x3b, 0xef, 0x20, 0xb2, 0x55, 0x80,
+    0x75, 0xa3, 0x0d, 0x8f, 0x48, 0x6f, 0xf9, 0xc7, 0xda, 0xdf, 0x4e, 0xae,
+    0x75, 0x3a, 0x2e, 0x3f, 0x58, 0x01, 0x2d, 0xfd, 0xd4, 0xd7, 0x39, 0x87,
+    0x5f, 0xfa, 0x19, 0xfb, 0x3e, 0xb1, 0x70, 0xae, 0x75, 0xce, 0xc9, 0xd6,
+    0xc6, 0xa2, 0x1b, 0xc5, 0x9b, 0x11, 0x2f, 0xfe, 0xeb, 0xa7, 0xa5, 0x8a,
+    0x0e, 0x7e, 0x75, 0xf8, 0x66, 0x8e, 0xc1, 0xd7, 0xec, 0xee, 0xee, 0xae,
+    0x75, 0xf7, 0xfa, 0x81, 0x3a, 0xff, 0x73, 0xae, 0x9a, 0x4d, 0x87, 0x54,
+    0x1e, 0xa6, 0x10, 0xd2, 0x26, 0x0e, 0xe8, 0x62, 0x4d, 0xa7, 0xeb, 0xf9,
+    0x98, 0xe7, 0x1e, 0x63, 0xaf, 0xf8, 0x30, 0xdf, 0xbf, 0xff, 0x1b, 0x9d,
+    0x7f, 0xcf, 0xcc, 0x5a, 0x6d, 0xc2, 0xce, 0xa6, 0x9f, 0xb0, 0x0f, 0x6f,
+    0xbd, 0x1b, 0xc8, 0xeb, 0xf9, 0x3f, 0xdb, 0x14, 0xfc, 0xea, 0x9c, 0xf4,
+    0xb8, 0x45, 0x50, 0x99, 0xde, 0x42, 0x91, 0xdd, 0x2f, 0xed, 0x9c, 0x78,
+    0x4d, 0xb3, 0xad, 0x87, 0x52, 0xcd, 0xf8, 0x98, 0x5f, 0xfb, 0xb8, 0x10,
+    0xa6, 0xf9, 0xbf, 0x8e, 0xbf, 0xbe, 0x07, 0xeb, 0xf3, 0x87, 0x54, 0xe7,
+    0xe0, 0x13, 0xfb, 0xe7, 0x84, 0xdb, 0x3a, 0xff, 0xa1, 0x03, 0xe1, 0x7d,
+    0xf4, 0x75, 0x41, 0xfe, 0x04, 0x8c, 0x48, 0xa9, 0x58, 0x6c, 0x19, 0x15,
+    0xb1, 0x95, 0x6a, 0x91, 0x10, 0xa9, 0x91, 0x80, 0x52, 0x72, 0x30, 0x75,
+    0x12, 0x9a, 0xd7, 0xbc, 0x30, 0x91, 0x4e, 0x62, 0x4e, 0x46, 0xa6, 0xb4,
+    0x1e, 0xc7, 0xd6, 0xf2, 0x83, 0xbf, 0x8d, 0x28, 0x61, 0x6d, 0xa8, 0xcf,
+    0xbd, 0x1b, 0xb0, 0x1c, 0xbe, 0xc6, 0x19, 0x7f, 0xf7, 0x52, 0x3d, 0xd7,
+    0x53, 0x07, 0xf3, 0xaf, 0xec, 0xf4, 0x22, 0xf4, 0x75, 0xfe, 0x0c, 0x4b,
+    0x39, 0x9a, 0x3a, 0xf6, 0xbe, 0xe8, 0xeb, 0xff, 0xec, 0xde, 0x5e, 0x04,
+    0xec, 0x75, 0xd6, 0x9a, 0x3a, 0xff, 0x80, 0xf8, 0x14, 0xdc, 0x5c, 0xeb,
+    0xde, 0x18, 0x3a, 0xee, 0xb1, 0x89, 0xaf, 0xcc, 0x86, 0xb2, 0xb7, 0x31,
+    0x11, 0xed, 0x29, 0x7d, 0x36, 0xa6, 0x15, 0xa7, 0x44, 0xad, 0xcb, 0xfb,
+    0x38, 0xd7, 0x76, 0x9a, 0x2c, 0xdb, 0xff, 0x47, 0x3f, 0xf6, 0xbb, 0x88,
+    0x13, 0xaf, 0x90, 0x5e, 0x73, 0xab, 0xa7, 0xbd, 0xa3, 0xeb, 0xe6, 0x3b,
+    0x1d, 0x3a, 0x98, 0x3c, 0x4d, 0xa2, 0x2a, 0x61, 0x30, 0x07, 0x86, 0xd5,
+    0xfe, 0x5b, 0x10, 0x8b, 0xfb, 0xc3, 0xae, 0xc0, 0x9d, 0x7f, 0xe7, 0x93,
+    0x19, 0xc6, 0xbb, 0xb4, 0xd1, 0x40, 0x5f, 0xe4, 0x5c, 0x2b, 0xf7, 0x27,
+    0x3a, 0xcc, 0x62, 0x25, 0x16, 0x2b, 0xd4, 0xab, 0xf9, 0xfd, 0xa9, 0x27,
+    0xe7, 0x5f, 0xd2, 0x63, 0x26, 0x89, 0x1d, 0x4c, 0x1e, 0xdc, 0x16, 0xdc,
+    0x0e, 0x9d, 0x7f, 0x6a, 0x16, 0x31, 0x31, 0xd6, 0xe9, 0xd7, 0xbe, 0x8c,
+    0xc7, 0x5d, 0x9e, 0xc3, 0x5d, 0xf8, 0x85, 0x7e, 0x88, 0x61, 0x5a, 0xbb,
+    0xe6, 0x8e, 0xbc, 0x00, 0xe1, 0xd7, 0xfb, 0x39, 0xe1, 0x85, 0xe8, 0xeb,
+    0x6d, 0x9d, 0x48, 0x7b, 0xfd, 0x1b, 0xfc, 0xc6, 0xf9, 0xae, 0xed, 0x34,
+    0x5b, 0xf7, 0xb6, 0xdf, 0xc7, 0x5f, 0xdf, 0x7c, 0xed, 0x7e, 0x1d, 0x5c,
+    0x3f, 0x95, 0x96, 0xfe, 0x3d, 0x7d, 0x82, 0x93, 0x1d, 0x7e, 0xf4, 0xb5,
+    0xf7, 0x47, 0x5e, 0xd7, 0x42, 0x75, 0xfb, 0xef, 0x86, 0x3f, 0x3a, 0x96,
+    0x78, 0xbb, 0x07, 0x2f, 0xfe, 0xf6, 0x93, 0x50, 0x39, 0xee, 0xa1, 0xd7,
+    0x87, 0x3a, 0x75, 0x2c, 0xf6, 0xf6, 0x20, 0xdf, 0x83, 0x0a, 0xe0, 0x59,
+    0xd7, 0xfc, 0xfa, 0x8c, 0x10, 0xf6, 0x0e, 0xbf, 0xfb, 0x17, 0xcc, 0xdf,
+    0xa2, 0xea, 0xf3, 0x9d, 0x76, 0xb5, 0xc3, 0xfc, 0x13, 0x5a, 0x84, 0xdd,
+    0xb1, 0xfd, 0x09, 0x1e, 0x14, 0xd7, 0xce, 0x83, 0xe3, 0xaf, 0x72, 0x3c,
+    0x75, 0xfd, 0x33, 0x87, 0xa8, 0xb3, 0xaf, 0xef, 0x26, 0x06, 0x16, 0x75,
+    0x78, 0xf6, 0x19, 0x2d, 0xbb, 0x42, 0x75, 0xfd, 0xbe, 0xa1, 0xb8, 0xb3,
+    0xab, 0x88, 0xd8, 0x77, 0x3d, 0x11, 0x80, 0x56, 0xfb, 0xaa, 0x05, 0x67,
+    0x5d, 0x92, 0x3a, 0xb0, 0xdc, 0x09, 0x1d, 0x2b, 0x6b, 0xbb, 0x91, 0x09,
+    0xc9, 0x11, 0x85, 0xdf, 0x21, 0x50, 0x86, 0x1c, 0x20, 0xec, 0x7c, 0xbf,
+    0x9f, 0x8c, 0x3d, 0xfc, 0xe9, 0x7f, 0x3e, 0xec, 0x2d, 0xfc, 0x75, 0x30,
+    0x8e, 0x01, 0x85, 0x95, 0xfc, 0x16, 0x35, 0xed, 0x6e, 0x75, 0xca, 0xca,
+    0xb6, 0x75, 0xe5, 0xbe, 0xe7, 0x5d, 0xb1, 0x0e, 0xbe, 0xe7, 0x33, 0xe9,
+    0xd7, 0xed, 0x4f, 0x8c, 0xb0, 0xac, 0x1f, 0xb4, 0x10, 0x4c, 0x38, 0xe2,
+    0xf5, 0x09, 0x83, 0x24, 0x29, 0xaf, 0xff, 0xff, 0x23, 0x5f, 0x8f, 0xd9,
+    0x67, 0xb0, 0x3a, 0x75, 0xe7, 0x27, 0x8d, 0xce, 0xbf, 0x71, 0xae, 0xed,
+    0x34, 0x52, 0x97, 0xff, 0xcf, 0xe1, 0xc9, 0xf9, 0x1d, 0x4e, 0xe7, 0x0e,
+    0xbc, 0xf2, 0x62, 0x11, 0xed, 0x8e, 0xdf, 0x99, 0xdf, 0xf4, 0x98, 0xce,
+    0x35, 0xdd, 0xa6, 0x89, 0x3a, 0xcc, 0x2d, 0x10, 0xce, 0x83, 0x51, 0x08,
+    0xd0, 0x09, 0xe7, 0x05, 0x25, 0x1b, 0xd0, 0x6f, 0x8b, 0x93, 0x21, 0xdc,
+    0xd8, 0xd1, 0xd2, 0x10, 0x4a, 0xf0, 0xa0, 0x98, 0x9f, 0x90, 0xb6, 0x5d,
+    0x67, 0xa7, 0xd8, 0xcb, 0x1c, 0xa7, 0xf8, 0x64, 0x8c, 0x24, 0x75, 0x3d,
+    0xbd, 0xe8, 0xcb, 0xb6, 0x47, 0x47, 0x7e, 0xe3, 0x5d, 0xda, 0x68, 0x87,
+    0xef, 0xfc, 0xf2, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x25, 0x3b, 0x31, 0x87,
+    0xfa, 0xb3, 0x3b, 0xfc, 0xc6, 0x71, 0xae, 0xed, 0x34, 0x44, 0xf7, 0xf4,
+    0xc9, 0xed, 0x01, 0x67, 0x5f, 0xfe, 0x55, 0x94, 0x65, 0x5e, 0x70, 0xaa,
+    0xbe, 0x7c, 0xee, 0xd9, 0xd7, 0xee, 0x35, 0xdd, 0xa6, 0x88, 0xc6, 0xff,
+    0xfd, 0xfc, 0xa7, 0x55, 0xa1, 0x5b, 0x9d, 0xbc, 0xf9, 0xf3, 0xbb, 0x67,
+    0x5f, 0x26, 0xf2, 0x56, 0xce, 0xb3, 0x10, 0x9a, 0xac, 0x8b, 0xb1, 0x8b,
+    0xa6, 0x7e, 0x6b, 0xbf, 0xfc, 0xc2, 0xde, 0x4c, 0x67, 0x1a, 0xee, 0xd3,
+    0x44, 0xf3, 0x7f, 0x31, 0xfc, 0x0c, 0xb4, 0x75, 0x42, 0xa9, 0x19, 0xca,
+    0x25, 0x1c, 0xa7, 0x54, 0x3c, 0xaf, 0x7e, 0xe3, 0x5d, 0xda, 0x68, 0x88,
+    0x2f, 0xfc, 0xf2, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x25, 0x4b, 0x31, 0x87,
+    0xfa, 0xb3, 0x3b, 0xfc, 0xc6, 0x71, 0xae, 0xed, 0x34, 0x45, 0x17, 0xf9,
+    0x8c, 0xe3, 0x5d, 0xda, 0x68, 0x8c, 0xaf, 0xdc, 0x6b, 0xbb, 0x4d, 0x13,
+    0x2d, 0xfa, 0x59, 0xe7, 0x69, 0xd7, 0xe6, 0x16, 0xf2, 0x63, 0x0f, 0x67,
+    0x73, 0x3b, 0xf7, 0x1a, 0xee, 0xd3, 0x45, 0x49, 0x61, 0x3a, 0xdf, 0x4e,
+    0xb3, 0x18, 0x7a, 0x8a, 0xe6, 0x60, 0x0f, 0xbf, 0xcc, 0x67, 0x1a, 0xee,
+    0xd3, 0x45, 0x75, 0x7f, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x8b, 0x16, 0xff,
+    0xe5, 0xbc, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x89, 0xea, 0xff, 0x99, 0x61,
+    0xe1, 0x36, 0xd3, 0x68, 0xeb, 0xff, 0xf4, 0xc3, 0x0b, 0x63, 0x34, 0x8c,
+    0x85, 0xdd, 0x43, 0xae, 0xd7, 0x8e, 0xbf, 0x0b, 0xac, 0x60, 0xeb, 0xf8,
+    0x1a, 0xeb, 0xc9, 0x85, 0x6c, 0xdd, 0x7d, 0x16, 0xbf, 0x67, 0xb4, 0x8b,
+    0x3a, 0xff, 0xf4, 0x6f, 0xec, 0x99, 0x39, 0xed, 0x01, 0x5c, 0xeb, 0xcf,
+    0xbb, 0x02, 0x7e, 0x9e, 0x26, 0xb7, 0xb1, 0x38, 0x4e, 0x42, 0x43, 0x50,
+    0xc0, 0xa6, 0x15, 0x29, 0x42, 0x82, 0x47, 0x85, 0x7e, 0x4e, 0x8b, 0xcc,
+    0x75, 0xfa, 0x58, 0x1f, 0x98, 0x75, 0x2a, 0x0f, 0x3a, 0x09, 0xaf, 0xd9,
+    0xe4, 0x06, 0x8e, 0xb9, 0x58, 0x56, 0xa7, 0x52, 0xb5, 0x3c, 0x75, 0x58,
+    0x9a, 0xfc, 0xab, 0x95, 0x8d, 0x73, 0xc7, 0x5f, 0xef, 0xa3, 0x9c, 0xe4,
+    0x34, 0xea, 0x56, 0x0f, 0x99, 0x54, 0x67, 0x7d, 0xc5, 0xfb, 0x73, 0xaf,
+    0xe5, 0x61, 0x59, 0x54, 0x44, 0x96, 0x75, 0xe6, 0xe7, 0x4a, 0xbc, 0xb8,
+    0xd1, 0xd7, 0xbf, 0xe4, 0x1d, 0x7f, 0x67, 0xe9, 0x32, 0x32, 0x75, 0xff,
+    0x9f, 0x5f, 0x35, 0xac, 0x94, 0xa0, 0xeb, 0xff, 0xf0, 0xba, 0x89, 0xc8,
+    0x94, 0xb3, 0x5f, 0xff, 0x07, 0x50, 0x51, 0x84, 0xa1, 0x77, 0x4f, 0xef,
+    0xff, 0xee, 0x26, 0xd3, 0xad, 0x88, 0xe7, 0x13, 0x69, 0xa0, 0x9c, 0xeb,
+    0xe4, 0xef, 0xd5, 0x9d, 0x7f, 0xf9, 0x14, 0xf9, 0x82, 0xfb, 0xe9, 0x45,
+    0x1c, 0xea, 0x69, 0xf8, 0x09, 0x1d, 0xff, 0xe7, 0xd0, 0xe7, 0xec, 0x75,
+    0x1a, 0xfc, 0x3a, 0xfe, 0x0e, 0x29, 0xec, 0x69, 0xd7, 0xdd, 0x85, 0xb4,
+    0xea, 0x73, 0xce, 0xf1, 0x6d, 0xf8, 0x29, 0x32, 0x32, 0x75, 0xff, 0xdf,
+    0x22, 0x06, 0x17, 0xf3, 0xe7, 0x76, 0xce, 0xa8, 0x3f, 0x31, 0x28, 0xbf,
+    0xf7, 0x72, 0x6e, 0xa7, 0x63, 0x90, 0x75, 0xcf, 0xb9, 0xd7, 0xf9, 0xf4,
+    0xfd, 0x00, 0xce, 0x75, 0x09, 0xe4, 0x00, 0x5a, 0xa7, 0x5c, 0x0e, 0x90,
+    0xda, 0x43, 0x7b, 0x86, 0x2b, 0x86, 0x97, 0x48, 0x46, 0x12, 0xfe, 0x84,
+    0xa7, 0xd2, 0x0d, 0xa8, 0x42, 0xde, 0x17, 0xf1, 0xd7, 0x85, 0x34, 0x75,
+    0x99, 0x54, 0x1b, 0x48, 0x1a, 0xbe, 0xe6, 0xc7, 0x59, 0xd7, 0xe5, 0x8b,
+    0xfb, 0x47, 0x5e, 0x8c, 0xe1, 0xd7, 0xff, 0x9a, 0xfc, 0x7f, 0x26, 0xa0,
+    0x63, 0xf3, 0xad, 0x2e, 0x9f, 0x0f, 0xd1, 0xaa, 0xdd, 0x16, 0x3c, 0x84,
+    0x3d, 0x62, 0x65, 0x08, 0x56, 0x08, 0x6a, 0x5e, 0xd6, 0xd6, 0xd1, 0xd7,
+    0xfd, 0xd7, 0xf4, 0x4d, 0xa4, 0x59, 0xd7, 0xfa, 0x24, 0x39, 0xbf, 0xb0,
+    0xeb, 0xdd, 0x02, 0xce, 0xac, 0x45, 0x3a, 0x11, 0x70, 0xe0, 0x06, 0x37,
+    0xf7, 0xb5, 0x34, 0x0c, 0xe7, 0x5f, 0x85, 0x44, 0xcd, 0x1d, 0x7e, 0x65,
+    0xfc, 0xed, 0x3a, 0xff, 0xec, 0x65, 0xff, 0xc6, 0xf5, 0xff, 0xd1, 0xd7,
+    0xfe, 0xd3, 0xef, 0x02, 0xe1, 0xc5, 0x0e, 0xa4, 0x46, 0x7f, 0x49, 0x84,
     0x9f, 0xc8, 0xb7, 0x47, 0x4e, 0xb0, 0x4e, 0xa5, 0x9a, 0x51, 0x15, 0xbe,
-    0x10, 0xfc, 0x50, 0xeb, 0xfb, 0x34, 0xc3, 0x8c, 0xe7, 0x56, 0x1f, 0x8b,
+    0x10, 0xfc, 0x50, 0xeb, 0xfb, 0x34, 0xcb, 0x8c, 0xe7, 0x56, 0x1f, 0x8b,
     0x90, 0x09, 0x25, 0xf8, 0x0a, 0x68, 0x30, 0x75, 0xe5, 0xa6, 0x8e, 0xbf,
-    0xa3, 0x99, 0x69, 0x04, 0xea, 0x85, 0x4d, 0x39, 0x0f, 0xd4, 0x86, 0x8f,
-    0x4b, 0x1c, 0xa0, 0x46, 0xef, 0xff, 0x28, 0xf9, 0xcf, 0xbd, 0x19, 0xc1,
-    0x1a, 0x75, 0xfe, 0x1c, 0xd7, 0x9d, 0xc4, 0xea, 0x50, 0xfe, 0xb8, 0x25,
-    0xdf, 0xff, 0xf9, 0x37, 0xb8, 0xfb, 0xe4, 0x10, 0x4b, 0x34, 0x10, 0x3e,
-    0xe4, 0x75, 0xff, 0xfc, 0x38, 0xa6, 0x0f, 0xcd, 0x7b, 0xb8, 0xbf, 0xb1,
-    0xf9, 0xd5, 0x08, 0xca, 0xc6, 0xcb, 0xfc, 0x07, 0xd2, 0x4c, 0x8c, 0x1d,
-    0x48, 0x9a, 0x1f, 0x61, 0xde, 0x24, 0x37, 0xbb, 0x02, 0x75, 0xee, 0x7c,
-    0xb3, 0xa9, 0xa6, 0xdd, 0xc6, 0xaf, 0xd3, 0x87, 0x68, 0xc1, 0xd7, 0xfb,
-    0xeb, 0xf0, 0x49, 0x91, 0x83, 0xaf, 0xfe, 0x41, 0xc0, 0x6e, 0x75, 0xc6,
-    0x78, 0xea, 0x83, 0xf9, 0x09, 0xbd, 0xfc, 0x17, 0xdf, 0xfc, 0x78, 0x75,
-    0xee, 0xfd, 0xe0, 0x75, 0xff, 0x42, 0xc7, 0x1b, 0xb4, 0xfc, 0xea, 0x91,
+    0xa3, 0x79, 0x69, 0x04, 0xea, 0x85, 0x4d, 0x39, 0x0f, 0xd4, 0x86, 0x8f,
+    0x4b, 0x1c, 0xa0, 0x46, 0xef, 0xff, 0x28, 0xf9, 0xbf, 0xbd, 0x19, 0xb1,
+    0x1a, 0x75, 0xfe, 0x1c, 0xd7, 0x9d, 0xc4, 0xea, 0x50, 0xfe, 0xb6, 0x25,
+    0xdf, 0xff, 0xf9, 0x39, 0xc8, 0xfb, 0xe4, 0x10, 0x4b, 0x34, 0x10, 0x3f,
+    0x24, 0x75, 0xff, 0xfc, 0x38, 0xa6, 0x0f, 0xcd, 0x7b, 0xb8, 0xbf, 0xb1,
+    0xf9, 0xd5, 0x08, 0xca, 0xc6, 0xcb, 0xfc, 0x07, 0xd2, 0x4c, 0x8c, 0x9d,
+    0x48, 0x9a, 0x1f, 0x61, 0xde, 0x24, 0x37, 0xbb, 0x02, 0x75, 0xed, 0xfc,
+    0xb3, 0xa9, 0xa6, 0xdd, 0xc6, 0xaf, 0xd3, 0x87, 0x88, 0xc9, 0xd7, 0xfb,
+    0xeb, 0xec, 0x49, 0x91, 0x93, 0xaf, 0xfe, 0x41, 0xc0, 0x72, 0x75, 0xc6,
+    0x78, 0xea, 0x83, 0xf9, 0x09, 0xbd, 0xfc, 0x17, 0xe7, 0xfb, 0x78, 0x75,
+    0xee, 0xfd, 0xd8, 0x75, 0xff, 0x42, 0xc7, 0x1b, 0xc4, 0xfc, 0xea, 0x91,
     0xeb, 0xe8, 0x82, 0xff, 0xa2, 0x58, 0x9a, 0xd0, 0x20, 0xeb, 0xff, 0x7a,
-    0x17, 0xcb, 0x53, 0x9c, 0xd9, 0xd7, 0xee, 0xe6, 0xd3, 0x47, 0x5e, 0x14,
-    0x97, 0x27, 0xcb, 0xe3, 0xfb, 0xff, 0x3e, 0x7f, 0x02, 0xe1, 0xc5, 0x0e,
-    0xa9, 0xd3, 0x0a, 0x94, 0x26, 0xff, 0x33, 0xbf, 0xcf, 0xce, 0xbd, 0xec,
-    0x57, 0x3a, 0xff, 0xf2, 0x6f, 0xaf, 0x8d, 0x0e, 0x6f, 0xf4, 0x3a, 0xfe,
-    0x53, 0xd1, 0x82, 0xd3, 0xaf, 0xff, 0x46, 0x73, 0xee, 0xc7, 0x86, 0x3f,
+    0x17, 0xbb, 0x53, 0x7c, 0xe1, 0xd7, 0xee, 0xe7, 0x13, 0x47, 0x5e, 0x14,
+    0x96, 0xe7, 0xcb, 0xe3, 0xfb, 0xff, 0x3e, 0x7f, 0x02, 0xe1, 0xc5, 0x0e,
+    0xa9, 0xd3, 0x0a, 0x94, 0x26, 0xff, 0x33, 0xbf, 0xcf, 0xbe, 0xbd, 0xec,
+    0x57, 0x3a, 0xff, 0xf2, 0x73, 0xaf, 0x8d, 0x0e, 0x73, 0xf4, 0x3a, 0xfe,
+    0x53, 0xd1, 0x82, 0xd3, 0xaf, 0xff, 0x46, 0x6f, 0xee, 0xc7, 0x86, 0x3f,
     0xd1, 0xd7, 0x47, 0xe7, 0x5d, 0xd5, 0x9d, 0x4d, 0x35, 0x9a, 0x16, 0xa4,
-    0x46, 0x17, 0x8b, 0x00, 0xeb, 0x7a, 0x74, 0xd9, 0xd7, 0xf0, 0x35, 0xed,
-    0x67, 0x8e, 0xbf, 0x80, 0xa9, 0x49, 0x91, 0x83, 0xae, 0xce, 0x9d, 0x79,
-    0x86, 0x18, 0x2a, 0xff, 0xf7, 0x93, 0xda, 0xea, 0x71, 0xfd, 0xdc, 0x48,
-    0xa6, 0x4b, 0xfa, 0x51, 0x30, 0xd4, 0x1c, 0x72, 0xdf, 0x19, 0x00, 0xd2,
-    0xff, 0xff, 0x93, 0xd2, 0x81, 0xcf, 0x75, 0x33, 0xd0, 0xb4, 0xdc, 0x8e,
+    0x46, 0x17, 0x8b, 0x00, 0xeb, 0x7a, 0x74, 0xe1, 0xd7, 0xf0, 0x35, 0xed,
+    0x67, 0x8e, 0xbf, 0x80, 0xa9, 0x49, 0x91, 0x93, 0xae, 0xce, 0x9d, 0x79,
+    0x96, 0x59, 0x2a, 0xff, 0xf7, 0x93, 0xda, 0xea, 0x6d, 0xfd, 0xe4, 0x48,
+    0xa6, 0x0b, 0xfa, 0x51, 0x30, 0xd4, 0x1c, 0x72, 0xdf, 0x19, 0x00, 0xd2,
+    0xff, 0xff, 0x93, 0xd2, 0x81, 0xcf, 0x75, 0x33, 0xd0, 0xb4, 0xe4, 0x8e,
     0xa9, 0x2f, 0x30, 0x85, 0xaf, 0x08, 0x1b, 0x0a, 0x24, 0x21, 0x9a, 0x10,
-    0xfb, 0x8c, 0xb1, 0x67, 0x1d, 0x36, 0x18, 0xc2, 0xbd, 0x19, 0xe7, 0x04,
-    0xab, 0xfe, 0xe6, 0x5a, 0xd6, 0x05, 0xfc, 0x75, 0xb0, 0xeb, 0xed, 0x8b,
-    0xf0, 0x3a, 0xa0, 0xfa, 0x94, 0x39, 0x40, 0xfb, 0x39, 0xd7, 0xa3, 0xba,
-    0x3a, 0xb9, 0x35, 0x48, 0x1f, 0x7f, 0xff, 0x3f, 0x93, 0xae, 0xbf, 0x99,
-    0xa8, 0xcd, 0xe0, 0x9d, 0x7f, 0xf9, 0x1b, 0xa8, 0xe3, 0xcf, 0x4a, 0x59,
-    0xa3, 0xab, 0x68, 0xc4, 0x12, 0x1e, 0x0b, 0x17, 0xdb, 0xee, 0x09, 0xd4,
-    0x87, 0xa2, 0xe6, 0x37, 0xde, 0x8e, 0x58, 0x3a, 0xba, 0x78, 0x6c, 0x10,
-    0x5c, 0xc7, 0x4e, 0xbf, 0xfd, 0x02, 0xdf, 0xbb, 0x7f, 0xd3, 0xdd, 0x83,
-    0xaf, 0xf2, 0x31, 0xac, 0xc1, 0x9c, 0xeb, 0xe8, 0xd4, 0x70, 0x3a, 0xff,
-    0xe8, 0x17, 0xf4, 0xa1, 0x47, 0x63, 0xc7, 0x57, 0x4f, 0x94, 0x04, 0x57,
-    0xbe, 0x3b, 0x4e, 0xa6, 0xa6, 0x6f, 0xf8, 0xbe, 0x92, 0xbd, 0x09, 0x7e,
-    0x22, 0x2b, 0xe5, 0xfd, 0x81, 0x3a, 0xf9, 0x03, 0x8b, 0x3a, 0xf9, 0xdc,
-    0x7f, 0x3a, 0xcc, 0x41, 0xe0, 0x28, 0x41, 0x70, 0x16, 0x75, 0xfe, 0x61,
+    0xfc, 0x8c, 0xb1, 0x67, 0x1d, 0x36, 0x18, 0xc2, 0xbd, 0x19, 0xe6, 0xc4,
+    0xab, 0xfe, 0xde, 0x5a, 0xd6, 0x05, 0xfc, 0x75, 0xb0, 0xeb, 0xee, 0x0b,
+    0xec, 0x3a, 0xa0, 0xfa, 0x94, 0x39, 0x40, 0xfb, 0x39, 0xd7, 0xa3, 0xba,
+    0x3a, 0xb7, 0x35, 0x48, 0x1f, 0x7f, 0xff, 0x3f, 0x93, 0xae, 0xbf, 0x99,
+    0xa8, 0xce, 0x60, 0x9d, 0x7f, 0xf9, 0x1b, 0xa8, 0xdb, 0xcf, 0x4a, 0x59,
+    0xa3, 0xab, 0x88, 0xc4, 0x12, 0x1d, 0x8b, 0x17, 0xdc, 0xee, 0x09, 0xd4,
+    0x87, 0xa2, 0xe6, 0x37, 0xde, 0x8d, 0xd9, 0x3a, 0xba, 0x78, 0x6c, 0x90,
+    0x5c, 0xcf, 0x4e, 0xbf, 0xfd, 0x02, 0xdf, 0xbc, 0x7f, 0xd3, 0xdd, 0x83,
+    0xaf, 0xf2, 0x33, 0xac, 0xc1, 0x9c, 0xeb, 0xe8, 0xd4, 0x6c, 0x3a, 0xff,
+    0xe8, 0x17, 0xf4, 0xa1, 0x47, 0x67, 0xc7, 0x57, 0x4f, 0x94, 0x04, 0x57,
+    0xbe, 0x3b, 0x4e, 0xa6, 0xa6, 0x6f, 0xf8, 0xbe, 0x92, 0xbd, 0x09, 0x7d,
+    0xa2, 0x2b, 0xe5, 0xfd, 0x81, 0x3a, 0xf9, 0x03, 0x8b, 0x3a, 0xf9, 0xdc,
+    0x7f, 0x3a, 0xcc, 0xc1, 0xe0, 0x28, 0x41, 0x70, 0x16, 0x75, 0xfe, 0x65,
     0xe6, 0xc9, 0x42, 0xb9, 0xd4, 0x87, 0xeb, 0xd2, 0x9d, 0x0b, 0x5f, 0xe8,
-    0x7d, 0xf5, 0x87, 0x09, 0x57, 0x30, 0xc1, 0x54, 0x13, 0xca, 0x60, 0xca,
-    0xf7, 0x91, 0x5c, 0xa6, 0x4d, 0x1d, 0xfd, 0xcb, 0x53, 0x5d, 0x43, 0xaf,
+    0x7e, 0x75, 0x97, 0x09, 0x57, 0x32, 0xc9, 0x54, 0x13, 0xca, 0x64, 0xca,
+    0xf7, 0x91, 0x5c, 0xa6, 0x0d, 0x1d, 0xfd, 0xbb, 0x53, 0x5d, 0x43, 0xaf,
     0x81, 0x20, 0x78, 0xea, 0x44, 0xfc, 0x26, 0x86, 0xbe, 0xa1, 0x37, 0xe2,
-    0xfe, 0x32, 0xdb, 0x98, 0xd1, 0xd6, 0xc3, 0xad, 0xce, 0x1a, 0x6f, 0x0b,
-    0xdf, 0x73, 0x25, 0x47, 0x27, 0x5f, 0xfd, 0xad, 0x04, 0x60, 0x3d, 0x8f,
-    0x68, 0xea, 0x84, 0x49, 0x61, 0x38, 0x0a, 0x2f, 0xfd, 0xe4, 0xdb, 0xff,
-    0xc5, 0xec, 0xe9, 0xd7, 0xfc, 0x8c, 0x0e, 0x79, 0x01, 0xf9, 0xd7, 0xf9,
-    0xf7, 0xed, 0x0a, 0x28, 0x75, 0xff, 0xed, 0x62, 0x98, 0x0d, 0xb8, 0x63,
+    0xfd, 0xb2, 0xdb, 0x99, 0xd1, 0xd6, 0xc3, 0xad, 0xbe, 0x1a, 0x6f, 0x0b,
+    0xdf, 0x6f, 0x25, 0x46, 0xe7, 0x5f, 0xfd, 0xad, 0x04, 0x60, 0x3d, 0x8f,
+    0x68, 0xea, 0x84, 0x49, 0x61, 0x38, 0x0a, 0x2f, 0xfd, 0xe4, 0xe3, 0xff,
+    0xb5, 0xec, 0xe9, 0xd7, 0xfc, 0x8c, 0x8e, 0x79, 0x01, 0xf9, 0xd7, 0xf9,
+    0xf9, 0xed, 0x0a, 0x28, 0x75, 0xff, 0xed, 0x62, 0x98, 0x0e, 0x38, 0x63,
     0xb0, 0x75, 0x49, 0x32, 0x14, 0x2e, 0x57, 0x41, 0x73, 0x8d, 0x19, 0x5e,
-    0xc4, 0xd9, 0xd7, 0xfa, 0x48, 0xbe, 0xf2, 0xea, 0xe7, 0x5f, 0x3e, 0xe2,
-    0x47, 0x54, 0xe7, 0xe1, 0xc8, 0xd2, 0xcd, 0xaf, 0xba, 0xae, 0x8b, 0x3a,
-    0xf0, 0xc7, 0xe7, 0x5e, 0x85, 0xe7, 0xc3, 0x7f, 0xa2, 0x4b, 0xff, 0x47,
-    0x3d, 0x85, 0xb7, 0xa9, 0x31, 0xd5, 0x88, 0xe2, 0x47, 0x0d, 0x99, 0xdf,
-    0x9a, 0xf3, 0xe3, 0x07, 0x5f, 0xa3, 0x61, 0xc1, 0x3a, 0x84, 0xf3, 0x7c,
-    0x51, 0x7f, 0xf4, 0x7f, 0x1d, 0x58, 0xba, 0x9d, 0x43, 0xac, 0xaa, 0x3a,
-    0xff, 0x07, 0xb0, 0x2c, 0x3f, 0x27, 0x5f, 0xfc, 0x81, 0xec, 0x36, 0x3f,
-    0x71, 0xfc, 0xeb, 0xff, 0xfe, 0x5b, 0x8f, 0x32, 0x65, 0x8c, 0x4e, 0x18,
-    0x38, 0x17, 0x91, 0xe2, 0xf5, 0xbe, 0xf0, 0x82, 0x73, 0xa9, 0x11, 0x2c,
-    0x2e, 0x95, 0x09, 0xd2, 0xec, 0x85, 0x68, 0x6e, 0x29, 0xa3, 0x30, 0x43,
-    0x66, 0xfa, 0x4a, 0xa5, 0x61, 0x5b, 0x3a, 0xf9, 0x05, 0xc2, 0x75, 0xe9,
-    0xd6, 0x87, 0x50, 0x4d, 0xd8, 0x8f, 0xdf, 0xa5, 0x9c, 0x22, 0x47, 0x5e,
-    0xcd, 0xc1, 0xd5, 0xca, 0x33, 0x51, 0xaf, 0x64, 0x1d, 0x28, 0xbf, 0xfe,
-    0xcf, 0x6b, 0x26, 0xec, 0x70, 0xce, 0xf6, 0x0e, 0xbf, 0xff, 0xff, 0x26,
-    0x73, 0xa4, 0xc6, 0x3e, 0x67, 0x32, 0xd2, 0x7b, 0x49, 0xc8, 0x42, 0x09,
-    0xce, 0xbf, 0xff, 0x20, 0x87, 0xe7, 0xdf, 0x26, 0x9d, 0x04, 0x12, 0x3a,
-    0x85, 0x32, 0xef, 0x28, 0x70, 0x84, 0x45, 0xe0, 0x6e, 0x47, 0x5f, 0xcf,
-    0xef, 0xfe, 0x8c, 0x8e, 0xaf, 0x87, 0x97, 0x38, 0xe5, 0xfe, 0x89, 0x23,
-    0x2c, 0x30, 0xc1, 0x57, 0x94, 0xc0, 0x9d, 0x7f, 0x75, 0xf6, 0xd8, 0xf1,
-    0xd7, 0x38, 0x4e, 0xbf, 0xb6, 0xfa, 0xeb, 0xc8, 0xeb, 0x72, 0x75, 0xc8,
-    0xc1, 0xd7, 0x7d, 0xfc, 0xea, 0x98, 0xd7, 0xfe, 0x2d, 0x7a, 0x4e, 0x13,
-    0xae, 0x61, 0x83, 0xaa, 0x48, 0xd7, 0xc1, 0x56, 0x96, 0x22, 0x06, 0x88,
-    0xd8, 0x1b, 0xbd, 0xef, 0xbf, 0x94, 0xc9, 0xeb, 0x5f, 0xf2, 0x07, 0x16,
-    0x93, 0x23, 0x07, 0x5f, 0xfe, 0x70, 0xe6, 0x0a, 0x9a, 0xd6, 0x0f, 0xe7,
-    0x5f, 0x74, 0x0e, 0xa4, 0x22, 0x01, 0x67, 0x17, 0xff, 0xf4, 0x9f, 0x5a,
-    0x8c, 0x9c, 0x12, 0x0e, 0xc5, 0xd8, 0x3a, 0xef, 0x40, 0x51, 0x2a, 0x87,
-    0x55, 0x25, 0x5d, 0x01, 0x1c, 0xe6, 0x35, 0x94, 0x8d, 0x1a, 0xfd, 0xc3,
-    0xef, 0x53, 0xc7, 0x5f, 0xf6, 0x7b, 0xb1, 0xbf, 0x63, 0x4e, 0xbd, 0x1b,
-    0x98, 0xea, 0x85, 0xdf, 0x9c, 0x8d, 0xad, 0x21, 0x05, 0xd2, 0x57, 0x96,
-    0x3d, 0xfa, 0x58, 0x95, 0xf1, 0x9b, 0xde, 0xd3, 0xcc, 0x75, 0xff, 0xc8,
-    0x17, 0xf2, 0x6b, 0x25, 0x9d, 0x3a, 0xe7, 0xe2, 0x3a, 0xd9, 0xd3, 0xd9,
-    0xf2, 0x0d, 0x72, 0x89, 0xc1, 0x75, 0xbe, 0xce, 0x67, 0xe0, 0x75, 0xff,
-    0x08, 0x70, 0x41, 0x2c, 0xd1, 0xd5, 0xb3, 0xdb, 0x72, 0x5b, 0xfe, 0xea,
-    0x05, 0x15, 0x30, 0x28, 0x75, 0xfe, 0x79, 0x60, 0x77, 0xad, 0x1d, 0x7d,
-    0x19, 0xf4, 0x27, 0x5f, 0xe5, 0x13, 0xcf, 0xd6, 0x15, 0xce, 0xbf, 0xed,
-    0xe4, 0xdd, 0xcd, 0x38, 0x9d, 0x7f, 0xdd, 0xc9, 0x60, 0x15, 0x2e, 0x27,
-    0x5f, 0xff, 0xe4, 0x1c, 0xe7, 0xca, 0x3f, 0xbb, 0x1d, 0xce, 0x0f, 0x23,
-    0xa8, 0x29, 0xae, 0xb4, 0xc9, 0x08, 0xb6, 0x6f, 0xe3, 0x7e, 0x07, 0x57,
-    0xfc, 0x14, 0xdc, 0x70, 0xff, 0x52, 0x3a, 0xe8, 0x59, 0xd6, 0xf4, 0x1e,
-    0x87, 0x4e, 0xef, 0xfd, 0x1a, 0x7e, 0xa0, 0x5a, 0x93, 0x9d, 0x50, 0xaa,
-    0x8f, 0x23, 0x96, 0x78, 0x54, 0x80, 0x9e, 0xf4, 0x0f, 0x8e, 0xbf, 0xc9,
-    0xd4, 0xdc, 0xa6, 0x83, 0xaf, 0xff, 0xc8, 0x06, 0xfd, 0xe7, 0xf7, 0xd3,
-    0xed, 0x39, 0xfc, 0xeb, 0xe7, 0xdc, 0x48, 0xeb, 0xff, 0xf9, 0x05, 0xd0,
-    0x7f, 0xdc, 0x75, 0xd3, 0xd1, 0xd3, 0xa8, 0x4f, 0xdb, 0xc4, 0x17, 0xe4,
-    0xf6, 0x81, 0x39, 0xd7, 0xff, 0xd0, 0x29, 0xff, 0xb9, 0x6a, 0x6f, 0xec,
-    0x04, 0xea, 0x0a, 0x6d, 0x49, 0x0d, 0x05, 0x90, 0xf8, 0xa2, 0xfd, 0xb0,
-    0x37, 0xb0, 0x75, 0xfd, 0xb9, 0xa4, 0x9e, 0xd1, 0xd6, 0x18, 0x3d, 0x5c,
-    0x27, 0xbf, 0xd3, 0x3c, 0xcf, 0xcc, 0xb4, 0x75, 0xfc, 0xf3, 0xa4, 0xc8,
-    0xc1, 0xd5, 0x87, 0xc6, 0xe6, 0xb7, 0xf4, 0xf8, 0x33, 0xe3, 0x07, 0x5f,
-    0xf4, 0x4f, 0xf6, 0x5d, 0x03, 0xce, 0x75, 0x61, 0xf5, 0x6c, 0xba, 0xfd,
-    0x1b, 0xde, 0x74, 0xeb, 0xf8, 0x5d, 0x48, 0x5c, 0x1d, 0x52, 0x3d, 0x10,
-    0x13, 0x5f, 0x44, 0xea, 0x28, 0x75, 0xff, 0xf9, 0x1b, 0x0b, 0xd3, 0xef,
-    0x16, 0x06, 0xbc, 0x8e, 0xb9, 0x38, 0x1d, 0x6e, 0x9d, 0x52, 0x3f, 0xa5,
-    0x75, 0x30, 0x0b, 0xde, 0x0c, 0x2c, 0xeb, 0xfd, 0x9f, 0xe4, 0xd1, 0xce,
-    0x8e, 0xa8, 0x3c, 0xfc, 0x1b, 0xbf, 0xba, 0xf2, 0x8d, 0x48, 0xeb, 0xfe,
-    0xce, 0xa7, 0x3a, 0xe8, 0x34, 0x75, 0xd8, 0x2d, 0x3e, 0x5f, 0xcb, 0x2f,
-    0xe1, 0x7f, 0xc3, 0x82, 0x75, 0xf9, 0x38, 0xf3, 0x6a, 0x1d, 0x72, 0x92,
-    0x3a, 0xfd, 0xd4, 0xe0, 0x8d, 0x3a, 0xec, 0xec, 0x8d, 0xfb, 0x45, 0xe9,
-    0x68, 0x95, 0xe3, 0x69, 0xbc, 0xc3, 0x0c, 0x15, 0x7f, 0xed, 0x88, 0x1f,
-    0xee, 0x4d, 0x0b, 0x39, 0x92, 0xfe, 0xfd, 0xd4, 0x99, 0x18, 0x3a, 0xa0,
-    0xfd, 0xf1, 0x3e, 0xff, 0x40, 0x72, 0x50, 0x2d, 0x3a, 0xa1, 0x7e, 0x42,
-    0x43, 0x59, 0x1c, 0xe2, 0xbc, 0x25, 0xe6, 0x84, 0x46, 0xe1, 0x14, 0xb7,
-    0x2e, 0x91, 0x3c, 0x27, 0x86, 0x10, 0x3a, 0x84, 0x2f, 0x8b, 0x41, 0x0c,
-    0x06, 0x21, 0x79, 0xf4, 0x82, 0xfb, 0x7b, 0xce, 0x9d, 0x7f, 0x75, 0x38,
-    0xb8, 0x80, 0xa1, 0xd5, 0x07, 0xaa, 0xd2, 0x1b, 0x2a, 0x4e, 0xb2, 0x1d,
-    0x7f, 0xde, 0x8d, 0xeb, 0xb0, 0x3e, 0x3a, 0xca, 0x93, 0xaf, 0xfb, 0xd1,
-    0xbd, 0x76, 0x07, 0xc7, 0x5d, 0xa8, 0x3a, 0xf2, 0xc3, 0x07, 0x5f, 0xe1,
-    0xf3, 0xcd, 0xa8, 0xf1, 0xd4, 0x87, 0x9a, 0xe3, 0x77, 0xc8, 0xf8, 0xd3,
-    0xaf, 0xfd, 0x9c, 0x07, 0x35, 0x30, 0xc0, 0x4e, 0xbe, 0x68, 0x62, 0x73,
-    0xae, 0xfe, 0x0e, 0xbd, 0xa4, 0xd9, 0xd5, 0x87, 0xa7, 0xf9, 0x17, 0x85,
-    0xaf, 0xf4, 0xb0, 0x50, 0x38, 0x27, 0x5e, 0xf6, 0x99, 0x84, 0xf6, 0xf0,
-    0x52, 0x63, 0x7e, 0xb1, 0x7e, 0x40, 0x23, 0xfa, 0x84, 0x8f, 0x8b, 0xee,
-    0xd4, 0x1d, 0x79, 0x61, 0x83, 0xaf, 0xf0, 0xf9, 0xe6, 0xd4, 0x78, 0xea,
-    0x43, 0xcd, 0x71, 0xbb, 0xe4, 0x7c, 0x69, 0xd7, 0xfe, 0xce, 0x03, 0x9a,
-    0x98, 0x60, 0x27, 0x5f, 0x34, 0x31, 0x39, 0xd7, 0xf4, 0xdf, 0xa2, 0xbb,
-    0xcc, 0x75, 0xdf, 0xc1, 0xd7, 0xb4, 0x9b, 0x3a, 0xb1, 0x10, 0xad, 0x22,
-    0xfc, 0xcb, 0xc2, 0xd7, 0xfa, 0x58, 0x28, 0x1c, 0x13, 0xaf, 0xe1, 0x70,
-    0xe2, 0x8c, 0xc2, 0xe4, 0x70, 0x45, 0x30, 0x3d, 0xb2, 0x84, 0xa6, 0x84,
-    0x4f, 0x58, 0xbf, 0x20, 0x11, 0xfd, 0x43, 0x0f, 0xc7, 0xb7, 0xff, 0x6e,
-    0x39, 0xd0, 0xc2, 0xf3, 0x9f, 0x1d, 0x7f, 0xfe, 0x70, 0xe6, 0x0a, 0x9f,
-    0x46, 0x06, 0x74, 0xd9, 0xd7, 0x9f, 0x73, 0x9e, 0x41, 0x2b, 0xe9, 0x67,
-    0x32, 0x3c, 0x82, 0x57, 0xb4, 0x81, 0x3c, 0x82, 0x57, 0x30, 0xc1, 0xe4,
-    0x12, 0xa6, 0xa2, 0x96, 0x62, 0x9f, 0x17, 0xb0, 0x51, 0x73, 0xf8, 0xb2,
-    0x09, 0x19, 0x37, 0xf7, 0xf6, 0x77, 0x30, 0x54, 0x3a, 0xf3, 0x8f, 0xff,
-    0x17, 0xd2, 0xe2, 0x72, 0xbf, 0x70, 0xc1, 0x5a, 0x20, 0xc6, 0x71, 0xe3,
-    0x4b, 0xee, 0x3c, 0x7e, 0x9d, 0x6c, 0x57, 0x45, 0x0f, 0xef, 0xd6, 0x91,
-    0xd7, 0xfa, 0x69, 0x02, 0x7f, 0x24, 0xe5, 0x5a, 0x0e, 0xbf, 0xc9, 0x20,
-    0x3e, 0xba, 0x87, 0x5f, 0xd9, 0xc1, 0xd7, 0x9d, 0x3a, 0xd2, 0x2a, 0xf3,
-    0xee, 0x72, 0xa8, 0xaa, 0x83, 0x6c, 0xd1, 0x05, 0x8e, 0x5e, 0x8f, 0xda,
-    0x53, 0x26, 0xb6, 0x96, 0x8b, 0xd1, 0x84, 0x85, 0x42, 0x62, 0xb9, 0x0e,
-    0xeb, 0xff, 0xef, 0xa3, 0x2d, 0x74, 0x39, 0xbf, 0xd6, 0x9a, 0x3a, 0xf8,
-    0x0f, 0xb9, 0x1d, 0x65, 0x9d, 0x76, 0x48, 0x26, 0xc6, 0x62, 0x1b, 0xf3,
-    0x19, 0x32, 0x2c, 0xeb, 0xf9, 0xb1, 0x34, 0xa3, 0xf2, 0xac, 0x87, 0x5f,
-    0xf4, 0xe0, 0x90, 0x7a, 0x07, 0x13, 0xaf, 0xe4, 0x85, 0xcf, 0x8c, 0x1d,
-    0x7e, 0xc9, 0xd7, 0x8b, 0x3a, 0xf6, 0x93, 0x67, 0x50, 0x9e, 0x17, 0x89,
-    0xef, 0xe1, 0x7f, 0xff, 0x06, 0x8e, 0xbf, 0x91, 0x4f, 0xb0, 0xb6, 0x42,
-    0x98, 0x36, 0x07, 0xec, 0xe7, 0x4d, 0xfe, 0x21, 0xac, 0x4f, 0x31, 0x0a,
-    0x06, 0x33, 0x4b, 0xe1, 0xc9, 0xc0, 0x75, 0xff, 0x67, 0xbe, 0x0e, 0x7f,
-    0xf7, 0x93, 0xaa, 0x4b, 0x99, 0x61, 0x2c, 0xc1, 0x0d, 0x9b, 0x76, 0x32,
-    0x4f, 0xc9, 0xc6, 0x10, 0x7a, 0x8f, 0xe7, 0xc6, 0x9c, 0x64, 0x37, 0xff,
-    0xe9, 0xf7, 0xbc, 0x0b, 0xaf, 0xaf, 0xe1, 0x89, 0x8e, 0xbf, 0xff, 0xfc,
-    0x0d, 0x82, 0x61, 0x7f, 0xf5, 0xac, 0x53, 0x01, 0xb7, 0x0c, 0x76, 0x0e,
-    0xbe, 0xe2, 0xe8, 0x3e, 0x9d, 0x79, 0x86, 0x18, 0x2a, 0xe9, 0x41, 0x4c,
-    0x97, 0xf5, 0x09, 0x9c, 0x4e, 0xab, 0xcb, 0xc6, 0xd1, 0xaf, 0xe5, 0x23,
-    0x7b, 0xce, 0x9d, 0x7f, 0x4f, 0x34, 0x95, 0x5b, 0x9c, 0xeb, 0xee, 0xbf,
-    0x2c, 0x1d, 0x7e, 0x9f, 0x69, 0x0b, 0x3a, 0xff, 0xfa, 0x3e, 0xf8, 0x63,
-    0xf7, 0xf7, 0xff, 0x46, 0x47, 0x52, 0xb2, 0x8d, 0x24, 0x35, 0x72, 0x3f,
-    0x13, 0xdf, 0xfc, 0x17, 0xf6, 0x98, 0xce, 0xfe, 0xfe, 0x3a, 0xf7, 0xd0,
-    0xcc, 0x75, 0xe9, 0x20, 0x9d, 0x7d, 0x3f, 0xde, 0x26, 0x0e, 0xbf, 0xe8,
-    0xeb, 0xa7, 0xa6, 0x46, 0x0e, 0xbf, 0xfc, 0xa4, 0x6b, 0x71, 0xd1, 0xcf,
-    0x42, 0xce, 0xbf, 0xed, 0x0e, 0x70, 0x49, 0x91, 0x83, 0xaf, 0xff, 0xe0,
-    0x3c, 0xed, 0x04, 0xfe, 0xce, 0x8e, 0x7b, 0xa8, 0x75, 0xfa, 0x26, 0x10,
-    0x68, 0xea, 0xc4, 0xc1, 0x11, 0x23, 0xa7, 0x5e, 0x5b, 0xb9, 0x04, 0xeb,
-    0xf9, 0xc7, 0xfc, 0xf2, 0x87, 0x54, 0x2a, 0x60, 0x9d, 0x16, 0x43, 0xee,
-    0x34, 0x25, 0x3e, 0x8c, 0xf3, 0x81, 0xe7, 0x18, 0xa5, 0xf7, 0x40, 0xb8,
-    0x3a, 0xe7, 0xd1, 0xd7, 0x01, 0x52, 0x75, 0x39, 0xe8, 0x09, 0x08, 0x05,
-    0x6e, 0x76, 0x55, 0x0f, 0x90, 0x0e, 0xad, 0xb6, 0x2a, 0xa1, 0x26, 0xad,
-    0x0a, 0xd5, 0xa9, 0x1a, 0xae, 0x3b, 0x89, 0xc2, 0x99, 0xe5, 0x03, 0xca,
-    0x17, 0x21, 0x95, 0x31, 0x94, 0x87, 0xc5, 0x23, 0x2e, 0x6c, 0x76, 0x1c,
-    0xc6, 0xb4, 0x92, 0x91, 0x26, 0x94, 0x63, 0xb8, 0xe7, 0x97, 0x28, 0x83,
-    0xb3, 0xe4, 0x2f, 0x19, 0x0f, 0xef, 0xc3, 0x2b, 0x13, 0x53, 0xfa, 0xfe,
-    0xa7, 0x06, 0x02, 0x3d, 0x96, 0x0f, 0xf8, 0xe1, 0xff, 0xf6, 0x55, 0x07,
-    0x14, 0x33, 0x2f, 0xcb, 0xc4, 0x7f, 0xce, 0xbe, 0x6b, 0xbb, 0x4d, 0x14,
-    0x55, 0xff, 0xf9, 0xff, 0x86, 0xf5, 0x35, 0xd4, 0xf7, 0x70, 0x4e, 0xad,
-    0xa2, 0x00, 0x4b, 0x6f, 0xcc, 0xad, 0xe4, 0xcc, 0x23, 0x23, 0x21, 0x4d,
-    0x7f, 0x99, 0xcd, 0xb5, 0xdd, 0xa6, 0x8b, 0xa2, 0xff, 0xe6, 0x5e, 0x4c,
-    0xe6, 0xda, 0xee, 0xd3, 0x44, 0x97, 0x7e, 0xdb, 0x5d, 0xda, 0x68, 0xbc,
-    0xae, 0x7e, 0x07, 0x59, 0x9c, 0x3c, 0xae, 0x33, 0x3a, 0x87, 0xd1, 0x8a,
-    0x9c, 0xa2, 0x47, 0xf9, 0x09, 0x86, 0xc2, 0x56, 0x63, 0x85, 0x9f, 0xf6,
-    0x54, 0x88, 0xde, 0x44, 0x66, 0xa5, 0x8c, 0x79, 0x14, 0x07, 0xfc, 0x21,
-    0x37, 0x7f, 0xf9, 0x95, 0xbc, 0x99, 0xcd, 0xb5, 0xdd, 0xa6, 0x89, 0x66,
-    0xe0, 0x74, 0xeb, 0xfc, 0x81, 0xee, 0x20, 0xa8, 0x75, 0xf7, 0x5f, 0xc0,
-    0x3a, 0xfb, 0xb0, 0xae, 0xb3, 0xaf, 0x01, 0xae, 0x75, 0x49, 0x12, 0x28,
-    0x62, 0xae, 0x43, 0xf4, 0x92, 0xfe, 0x0f, 0x80, 0xf2, 0xd1, 0xd7, 0xbc,
-    0xeb, 0x3a, 0xff, 0xdd, 0x8e, 0xa2, 0x9e, 0xd3, 0xfe, 0x75, 0xf3, 0x5d,
-    0xda, 0x68, 0x8c, 0xef, 0xe4, 0x85, 0xcf, 0x8c, 0x1d, 0x70, 0xc8, 0xeb,
-    0x2c, 0xeb, 0xf2, 0x6f, 0xae, 0xce, 0xcf, 0x49, 0x65, 0xbf, 0x45, 0x6f,
-    0xe7, 0x92, 0x6d, 0xf6, 0x75, 0xff, 0xda, 0x40, 0x6b, 0x04, 0x12, 0xcd,
-    0x1d, 0x7b, 0x51, 0xc9, 0xd5, 0x24, 0xe5, 0x76, 0x7e, 0xb7, 0xf1, 0x4e,
-    0xd1, 0x5f, 0x90, 0xaf, 0xfa, 0x5a, 0xc8, 0xf9, 0x1a, 0x59, 0xd7, 0xec,
-    0xe7, 0xb1, 0xa3, 0xaf, 0xfe, 0xf2, 0x6d, 0xff, 0xf9, 0xcc, 0xa1, 0x67,
-    0x5f, 0x86, 0x25, 0xa7, 0x3a, 0x90, 0xfb, 0x38, 0x23, 0xdf, 0xff, 0xff,
-    0x67, 0xbc, 0x8b, 0xda, 0x67, 0x22, 0x0f, 0x47, 0x7e, 0x70, 0x4f, 0x4d,
-    0x07, 0x5f, 0x94, 0xf7, 0xa1, 0x67, 0x5f, 0xfe, 0xf4, 0x35, 0x3c, 0x8b,
-    0x9b, 0x48, 0x27, 0x5a, 0x47, 0x52, 0x1e, 0xc7, 0xd4, 0x8a, 0x44, 0x51,
-    0xbc, 0x20, 0x2f, 0xff, 0x81, 0xed, 0x73, 0x28, 0x1f, 0xf5, 0xf0, 0x02,
-    0x75, 0xe8, 0xf4, 0x1d, 0x41, 0x3e, 0xde, 0x0a, 0x77, 0xbb, 0x82, 0x75,
-    0x21, 0xbe, 0x01, 0x25, 0xdd, 0x98, 0xeb, 0xfd, 0xce, 0x87, 0x36, 0x18,
-    0x3a, 0x90, 0xf2, 0x5c, 0x5e, 0xfb, 0xdd, 0x07, 0x19, 0xd7, 0xfb, 0x23,
-    0x6f, 0x24, 0xe9, 0xd7, 0xf9, 0x18, 0xd4, 0x75, 0xd5, 0xce, 0xad, 0x9f,
-    0x2f, 0x8c, 0x29, 0x11, 0x58, 0xb8, 0x45, 0x5f, 0xfe, 0x4e, 0x81, 0x5c,
-    0x3d, 0x06, 0xb9, 0x93, 0x9d, 0x58, 0x7e, 0xae, 0x4f, 0x7b, 0xee, 0x2a,
-    0x8e, 0xbf, 0xfc, 0x0f, 0xd6, 0x83, 0x9f, 0x8e, 0x3c, 0xc7, 0x5f, 0xf4,
-    0x27, 0x52, 0x06, 0x60, 0x1d, 0x7f, 0xe0, 0x07, 0x78, 0x0e, 0xc2, 0xf0,
-    0xea, 0xc4, 0x6e, 0xec, 0x87, 0xa9, 0x3a, 0x36, 0xbf, 0xfe, 0xe6, 0x49,
-    0xb0, 0xf4, 0x1b, 0xc6, 0xf7, 0x0e, 0xb9, 0x18, 0x3a, 0xee, 0x2c, 0x3a,
-    0xb4, 0x6b, 0xbc, 0x2d, 0x7f, 0x6a, 0x3d, 0xae, 0xa1, 0xd7, 0xe1, 0xc5,
-    0xef, 0x0e, 0xac, 0x3d, 0x15, 0x96, 0x5f, 0x7e, 0x9c, 0xc8, 0xeb, 0xfd,
-    0x03, 0xe4, 0x9c, 0x60, 0xeb, 0xff, 0xc9, 0xb4, 0x9e, 0x07, 0x3b, 0xb0,
-    0x70, 0x3a, 0xbf, 0x44, 0xe8, 0x91, 0xf8, 0xc2, 0xcc, 0xab, 0x6c, 0xac,
-    0x08, 0x85, 0x3c, 0xe8, 0x21, 0x2d, 0xc8, 0xec, 0x39, 0x57, 0x43, 0x99,
-    0xa1, 0x27, 0xb2, 0x3e, 0xc6, 0x46, 0xf0, 0xd1, 0xfd, 0xa4, 0x63, 0x41,
-    0xd4, 0x3f, 0x7c, 0x79, 0xc1, 0xfb, 0x8d, 0xcb, 0xec, 0x2f, 0xaf, 0xff,
-    0x32, 0xb7, 0x93, 0x39, 0xb6, 0xbb, 0xb4, 0xd1, 0x34, 0xdf, 0xfe, 0x65,
-    0x6f, 0x26, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x71, 0xbf, 0xfc, 0xca, 0xde,
-    0x4c, 0xe6, 0xda, 0xee, 0xd3, 0x45, 0x03, 0x7e, 0xdb, 0x5d, 0xda, 0x68,
-    0xb8, 0x2f, 0xe1, 0xcf, 0x35, 0x34, 0x75, 0xd0, 0x87, 0x5f, 0xe1, 0x94,
-    0x20, 0x71, 0x67, 0x56, 0x22, 0x89, 0x66, 0x7d, 0x2b, 0x00, 0xa5, 0xfa,
-    0x4c, 0xa8, 0xa8, 0x50, 0xea, 0x64, 0xfa, 0xe0, 0xf2, 0xe7, 0xfc, 0xeb,
-    0xf4, 0xd2, 0x81, 0x91, 0xd4, 0x75, 0x61, 0xb1, 0x12, 0x7b, 0xe8, 0xff,
-    0x18, 0x3a, 0xe4, 0x67, 0x68, 0x88, 0x14, 0x7f, 0xa3, 0xf7, 0xfd, 0x26,
-    0x73, 0x6d, 0x77, 0x69, 0xa2, 0x49, 0xb3, 0x3d, 0x44, 0x13, 0x9e, 0xdc,
-    0xc7, 0xe7, 0x5f, 0xe7, 0xf0, 0xe4, 0xee, 0x27, 0x5f, 0xd8, 0x2f, 0xcc,
-    0xb4, 0x75, 0xfd, 0x0b, 0xde, 0x07, 0xc7, 0x5c, 0xec, 0x85, 0x14, 0x0a,
-    0x0c, 0x6c, 0xc3, 0x45, 0x95, 0x3b, 0x61, 0x39, 0x2a, 0x58, 0xbb, 0x63,
-    0x34, 0x99, 0x5f, 0xf5, 0x7d, 0x46, 0xc9, 0xe8, 0xcb, 0x38, 0x43, 0x26,
-    0xff, 0xca, 0x3b, 0x39, 0xb6, 0xbb, 0xb4, 0xd1, 0x6a, 0x5f, 0xf9, 0xe4,
-    0xce, 0x6d, 0xae, 0xed, 0x34, 0x4a, 0xb7, 0x23, 0x07, 0x51, 0xd6, 0x65,
-    0x44, 0x5a, 0xad, 0x2f, 0xc9, 0x5c, 0x42, 0xd7, 0xf6, 0x6d, 0xae, 0xed,
-    0x34, 0x45, 0x37, 0xff, 0x2d, 0x9f, 0x0b, 0xff, 0xaf, 0x63, 0x4e, 0xa6,
-    0x4f, 0xf5, 0xce, 0x2f, 0xf3, 0x39, 0xb6, 0xbb, 0xb4, 0xd1, 0x1a, 0x5c,
-    0x0e, 0x9d, 0x7f, 0xe0, 0xe2, 0xd3, 0x79, 0xa9, 0xa0, 0xeb, 0xff, 0xfe,
-    0x70, 0x6b, 0xb8, 0x1f, 0xbf, 0x74, 0x9f, 0x7c, 0x9a, 0x9b, 0xe9, 0xd7,
-    0x91, 0xd8, 0x3a, 0x91, 0x18, 0xea, 0xe7, 0xab, 0x6f, 0xbe, 0x6b, 0xbb,
-    0x4d, 0x14, 0xfd, 0xde, 0x83, 0xab, 0x67, 0x85, 0xe2, 0xdb, 0xff, 0x7a,
-    0x68, 0xf7, 0x5e, 0x6f, 0x98, 0x75, 0xff, 0xe4, 0x58, 0x83, 0xa9, 0xbc,
-    0xd4, 0xd0, 0x75, 0xff, 0xc0, 0xf6, 0xc1, 0x36, 0x9a, 0xf3, 0x68, 0xeb,
-    0xff, 0xb2, 0x60, 0x0c, 0xfa, 0x6b, 0xcd, 0xa3, 0xac, 0xca, 0xb6, 0xaa,
-    0x26, 0x21, 0xbb, 0x8e, 0x88, 0x44, 0xe8, 0x22, 0x91, 0xe4, 0x7b, 0xff,
-    0xcc, 0xad, 0xe4, 0xce, 0x6d, 0xae, 0xed, 0x34, 0x4d, 0x57, 0xf9, 0x9c,
-    0xdb, 0x5d, 0xda, 0x68, 0xae, 0xef, 0x9a, 0xee, 0xd3, 0x45, 0x7d, 0x79,
-    0x86, 0x18, 0x2a, 0xc2, 0x53, 0x25, 0xfd, 0x6c, 0xfa, 0xd6, 0x99, 0x7a,
-    0x51, 0xc9, 0xd7, 0xa6, 0xce, 0x9d, 0x7f, 0xec, 0xeb, 0x0f, 0xed, 0x46,
-    0x4e, 0x75, 0xbc, 0x75, 0xff, 0x26, 0xf2, 0x74, 0x96, 0x04, 0xea, 0xd9,
-    0xe3, 0xb8, 0x85, 0xfb, 0x9e, 0x2e, 0x83, 0xe9, 0xd6, 0xd9, 0xd4, 0x75,
-    0xba, 0x85, 0xd6, 0xc4, 0x2c, 0xce, 0x26, 0xdb, 0x31, 0x13, 0x8e, 0x08,
-    0xe6, 0xa1, 0x0a, 0x02, 0x1e, 0x34, 0x8b, 0xff, 0xcc, 0xad, 0xe4, 0xce,
-    0x6d, 0xae, 0xed, 0x34, 0x4f, 0x77, 0xee, 0xc7, 0x13, 0xf2, 0x75, 0xfb,
-    0x6d, 0x77, 0x69, 0xa2, 0xe1, 0xb3, 0x30, 0x7b, 0xb8, 0x55, 0x7f, 0xf3,
-    0x2f, 0x26, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x4f, 0xa8, 0x64, 0x16, 0xcf,
-    0x0c, 0x59, 0x11, 0x29, 0x2b, 0x21, 0xae, 0x53, 0x2b, 0xee, 0x50, 0xbf,
-    0x5c, 0xb5, 0x0b, 0x4e, 0x04, 0xf7, 0xf9, 0x9c, 0xdb, 0x5d, 0xda, 0x68,
-    0x8a, 0xaf, 0xdb, 0x6b, 0xbb, 0x4d, 0x14, 0xcd, 0xfc, 0x9d, 0xc7, 0xe7,
-    0xf3, 0xac, 0xce, 0x1f, 0x07, 0x19, 0x9d, 0xff, 0xe6, 0x56, 0xf2, 0x67,
-    0x36, 0xd7, 0x76, 0x9a, 0x26, 0x7b, 0xff, 0xcc, 0xad, 0xe4, 0xce, 0x6d,
-    0xae, 0xed, 0x34, 0x51, 0xb5, 0x3a, 0x6f, 0x01, 0x84, 0xfa, 0x85, 0x7e,
-    0x57, 0xbf, 0xf3, 0xc9, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0x8e, 0xaf, 0xfe,
-    0xdc, 0xec, 0xe8, 0x73, 0xda, 0x85, 0x9d, 0x4c, 0xa2, 0x3e, 0x12, 0xae,
-    0x07, 0x4e, 0xbe, 0x6b, 0x40, 0xd3, 0xaf, 0xd8, 0x21, 0xc9, 0xce, 0xbf,
-    0xd1, 0x0d, 0xcd, 0xef, 0x0e, 0xa4, 0x3d, 0x61, 0x26, 0xbf, 0x66, 0xda,
-    0x05, 0x0e, 0xbf, 0xf0, 0xe2, 0x8f, 0x36, 0xbb, 0x01, 0x3a, 0xf4, 0xcf,
-    0xe3, 0xaf, 0x9a, 0xee, 0xd3, 0x45, 0x35, 0x7e, 0xce, 0x58, 0x7e, 0x9d,
-    0x7f, 0xf6, 0xb0, 0x43, 0x1f, 0x15, 0x7f, 0x0f, 0xd0, 0xea, 0x0a, 0x64,
-    0x88, 0x51, 0x31, 0xf6, 0xc7, 0x04, 0xb7, 0x45, 0x17, 0xff, 0xfd, 0x83,
-    0xed, 0x23, 0x70, 0x74, 0xde, 0xa7, 0x5b, 0xf6, 0x73, 0xaf, 0xfb, 0x4f,
-    0xce, 0x4d, 0x1d, 0xd1, 0xd7, 0x75, 0x05, 0x14, 0x1e, 0x67, 0xbf, 0xfa,
-    0x5d, 0x41, 0x9f, 0x40, 0x8d, 0xcc, 0x75, 0xff, 0x6b, 0x4d, 0x4d, 0xed,
-    0x27, 0x3a, 0xff, 0xc2, 0x0f, 0x77, 0x26, 0x94, 0x72, 0x75, 0xa6, 0x3a,
-    0xfd, 0x9d, 0x71, 0x09, 0xd5, 0x39, 0xb6, 0xfc, 0x46, 0xe8, 0x50, 0xeb,
-    0xf9, 0xff, 0xd2, 0xac, 0xab, 0x2a, 0xc7, 0x5f, 0xc9, 0x0b, 0x9f, 0x18,
-    0x3a, 0xff, 0xfb, 0x3d, 0xdc, 0x96, 0xdc, 0x7d, 0xd7, 0x91, 0xd7, 0x47,
-    0xe7, 0x5f, 0xe7, 0xe6, 0x1a, 0x8d, 0x67, 0x68, 0x90, 0x12, 0xdf, 0xa9,
-    0xb5, 0x89, 0xea, 0xa3, 0xaf, 0x48, 0xc4, 0x5b, 0x50, 0xcd, 0xbf, 0x7b,
-    0xac, 0x3c, 0xe7, 0x59, 0x95, 0x6d, 0x76, 0xfe, 0x05, 0x82, 0xf1, 0x91,
-    0xa2, 0x36, 0x1e, 0xfc, 0x96, 0xed, 0x17, 0xd2, 0x83, 0xbe, 0xa6, 0xdf,
-    0xb6, 0xd7, 0x76, 0x9a, 0x2a, 0xab, 0xff, 0x3c, 0x99, 0xcd, 0xb5, 0xdd,
-    0xa6, 0x89, 0xb6, 0xcc, 0xe1, 0xfe, 0xac, 0xce, 0xff, 0x33, 0x9b, 0x6b,
-    0xbb, 0x4d, 0x15, 0xfd, 0xfb, 0x6d, 0x77, 0x69, 0xa2, 0xc6, 0xbb, 0x8a,
-    0x47, 0x59, 0x9c, 0x3c, 0xc9, 0x8c, 0xef, 0xda, 0x6f, 0x61, 0x43, 0xaf,
-    0xf0, 0x82, 0x59, 0xa7, 0xf1, 0xd7, 0x6f, 0xc7, 0x5f, 0xf6, 0x7b, 0xd9,
-    0xb0, 0xe0, 0x9d, 0x79, 0x49, 0x61, 0xd6, 0x67, 0x11, 0x32, 0xe6, 0x22,
-    0x2d, 0xa3, 0x6b, 0x23, 0x29, 0x81, 0x6e, 0x18, 0x37, 0xed, 0xb5, 0xdd,
-    0xa6, 0x8b, 0x56, 0xff, 0xcf, 0x26, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x82,
-    0xb3, 0x38, 0x7f, 0xab, 0x33, 0xbf, 0xd0, 0x3f, 0xc2, 0xbb, 0xac, 0xeb,
-    0xb7, 0x07, 0x54, 0x8f, 0x27, 0x88, 0xd2, 0xf9, 0xae, 0xed, 0x34, 0x5c,
-    0x57, 0xf0, 0x1f, 0x90, 0xe6, 0xce, 0xad, 0x9e, 0xd6, 0x8b, 0x6f, 0x6e,
-    0x16, 0x75, 0xf3, 0xf1, 0x24, 0xe7, 0x5f, 0xba, 0x05, 0x30, 0x4e, 0xbd,
-    0xc4, 0x8d, 0x3a, 0x82, 0x78, 0xbc, 0x44, 0xf7, 0xf9, 0x6f, 0x2d, 0x20,
-    0x70, 0xeb, 0xfd, 0x0b, 0x7e, 0x11, 0xbe, 0x23, 0xaf, 0xec, 0xdb, 0xf8,
-    0x10, 0x75, 0xff, 0xf3, 0x8c, 0x27, 0x16, 0x93, 0x59, 0xdc, 0xe3, 0x3a,
-    0x82, 0x7f, 0x9c, 0x0a, 0xef, 0xfe, 0x41, 0x04, 0xb3, 0x5a, 0x40, 0xe1,
-    0xd5, 0x31, 0xf2, 0xf8, 0x92, 0xcc, 0xc2, 0xab, 0x5c, 0x7f, 0xd9, 0x17,
-    0x46, 0xdd, 0xa7, 0xf2, 0x5f, 0x18, 0xfd, 0x8c, 0x5e, 0xfc, 0xaa, 0x56,
-    0x9f, 0xa9, 0x07, 0x5f, 0xf9, 0x39, 0x55, 0xb5, 0xbf, 0x9f, 0x3b, 0xc6,
-    0x75, 0xf7, 0x63, 0xcd, 0x3a, 0x95, 0xa9, 0xf6, 0x85, 0x32, 0xff, 0xf2,
-    0xac, 0xa3, 0x0a, 0xf3, 0x85, 0x55, 0xf3, 0xe7, 0x78, 0xce, 0xbf, 0x6d,
-    0xae, 0xed, 0x34, 0x5d, 0x37, 0xe8, 0x17, 0x0c, 0x1d, 0x7a, 0x3d, 0xc4,
-    0x75, 0xf6, 0x07, 0x02, 0x75, 0xff, 0x3f, 0x08, 0xf6, 0x80, 0xd5, 0x49,
-    0xd6, 0x65, 0x56, 0x4f, 0xf6, 0x21, 0x41, 0x22, 0x8c, 0x62, 0x43, 0x3e,
-    0x92, 0x38, 0xf0, 0x90, 0x5f, 0xff, 0x60, 0xf9, 0x17, 0xd8, 0x41, 0x7d,
-    0xa8, 0x75, 0x1d, 0x7f, 0xf4, 0x6f, 0xff, 0x9a, 0xec, 0x2d, 0xc4, 0xeb,
-    0xfd, 0x1b, 0xfb, 0xde, 0xe7, 0xe7, 0x54, 0x8f, 0xeb, 0xa8, 0xb7, 0xf4,
-    0x9e, 0x4e, 0x2d, 0x3a, 0xff, 0xf6, 0x7a, 0x18, 0xfb, 0x3e, 0xb1, 0x70,
-    0xae, 0x75, 0xcb, 0x65, 0x59, 0x4c, 0x83, 0x21, 0x09, 0x31, 0x10, 0x95,
-    0xdf, 0x63, 0x0a, 0xca, 0xce, 0xbf, 0xe4, 0xd8, 0xc7, 0x2b, 0x7f, 0x1d,
-    0x7f, 0xff, 0xc0, 0xdc, 0xb5, 0xd7, 0x4d, 0xef, 0x60, 0xe5, 0x36, 0xfa,
-    0x3a, 0xff, 0xc2, 0xec, 0x7b, 0x3a, 0xf3, 0x39, 0xd7, 0xff, 0xf7, 0x44,
-    0x0e, 0xaf, 0x92, 0xee, 0x29, 0x81, 0x98, 0x07, 0x5c, 0xdc, 0x3a, 0xa0,
-    0xfc, 0xd4, 0x5e, 0xbc, 0xa6, 0xa4, 0x75, 0xff, 0xa5, 0x9b, 0xdb, 0xca,
-    0x7c, 0x60, 0xeb, 0xff, 0xb0, 0x31, 0x28, 0xdc, 0x7d, 0x71, 0x3a, 0xff,
-    0xdc, 0x32, 0x4b, 0x0a, 0x70, 0x80, 0x9d, 0x4b, 0x44, 0x1b, 0xa1, 0x5c,
-    0xec, 0xce, 0xa8, 0xea, 0x66, 0x7d, 0xc2, 0xc3, 0x44, 0x5e, 0x1d, 0xfb,
-    0x0c, 0x2a, 0xea, 0xae, 0x41, 0x94, 0xe3, 0x7f, 0xef, 0x23, 0x50, 0x2e,
-    0x2a, 0x41, 0xd7, 0xfd, 0x1c, 0xf5, 0xf5, 0xe8, 0x60, 0xea, 0x83, 0xf5,
-    0xd9, 0xe5, 0xc0, 0xe9, 0xd7, 0xe1, 0xce, 0xbf, 0x8e, 0xbf, 0xa4, 0xf9,
-    0xc2, 0x02, 0x75, 0x2a, 0x0f, 0x49, 0x57, 0x92, 0xdf, 0x20, 0x25, 0x07,
-    0x5f, 0x9e, 0x69, 0x27, 0x8e, 0xbf, 0xf4, 0x07, 0x71, 0x24, 0xe7, 0xd8,
-    0x75, 0x49, 0x10, 0x9f, 0x90, 0x78, 0x9e, 0xff, 0xff, 0xa0, 0x3d, 0xce,
-    0x7c, 0x2f, 0xdf, 0xdf, 0x5a, 0x7d, 0xb4, 0xeb, 0xfd, 0x99, 0x8a, 0x28,
-    0xf2, 0x3a, 0x94, 0x44, 0xc7, 0x99, 0xaf, 0xdc, 0x13, 0x78, 0x13, 0xaf,
-    0xff, 0xb5, 0xd4, 0xd7, 0xbb, 0x81, 0x4d, 0x60, 0x9d, 0x7b, 0xb0, 0x38,
-    0x7e, 0xa0, 0x28, 0xbf, 0xd0, 0xbc, 0x45, 0xc2, 0xb9, 0xd7, 0xfa, 0x4b,
-    0xd2, 0x0f, 0x32, 0x3a, 0x9a, 0x7c, 0xd3, 0x19, 0xde, 0x77, 0x69, 0xa2,
-    0x4c, 0xbd, 0xc4, 0x9a, 0x3a, 0x9a, 0x78, 0xbc, 0x44, 0xf7, 0xe6, 0xaa,
-    0xca, 0xa5, 0x65, 0x50, 0x75, 0xfe, 0xce, 0x7d, 0xe7, 0x96, 0x8e, 0xa8,
-    0x3e, 0xdd, 0x9d, 0x5f, 0xe1, 0x7f, 0x69, 0xa0, 0x13, 0xaf, 0xff, 0xed,
-    0xe7, 0xe9, 0xfb, 0x18, 0x9c, 0x07, 0x3d, 0xd4, 0x3a, 0xb1, 0x11, 0xa8,
-    0x63, 0x52, 0x54, 0xc1, 0x90, 0x97, 0xdb, 0x42, 0xe1, 0x25, 0xd8, 0x57,
-    0x5f, 0xc1, 0xfd, 0x51, 0xaf, 0xf8, 0xce, 0xbd, 0xa4, 0x09, 0xd7, 0xf0,
-    0xc7, 0x2b, 0x7f, 0x1d, 0x7f, 0xd0, 0xdf, 0x03, 0xbb, 0x86, 0x0e, 0xbf,
-    0xcd, 0x4d, 0xea, 0x68, 0x73, 0xaf, 0xfe, 0x06, 0xba, 0xf2, 0xeb, 0xca,
-    0x04, 0xea, 0xe4, 0xfd, 0x36, 0x65, 0x77, 0x52, 0x64, 0xc5, 0xf6, 0x36,
-    0xb2, 0xcf, 0x42, 0xb6, 0xfb, 0xc8, 0xb7, 0x3a, 0xff, 0x27, 0x75, 0x1e,
-    0x80, 0x9d, 0x58, 0x7a, 0x3e, 0x20, 0xbf, 0xe8, 0xef, 0x92, 0x75, 0xc3,
-    0x4e, 0xbf, 0xff, 0x3b, 0x77, 0x1d, 0x1c, 0xf6, 0x32, 0xc3, 0x0c, 0x15,
-    0x52, 0x45, 0x86, 0x88, 0x7c, 0x71, 0x7f, 0x35, 0xa0, 0x68, 0xc1, 0xd7,
-    0xff, 0xb3, 0x99, 0x0c, 0x4b, 0x71, 0xe7, 0xf1, 0xd7, 0xfe, 0x7f, 0x46,
-    0xf5, 0xd8, 0x1f, 0x1d, 0x7e, 0xc9, 0x23, 0xf0, 0x3a, 0x84, 0xf8, 0xf4,
-    0x79, 0x52, 0x46, 0x60, 0x21, 0x57, 0x7f, 0xf8, 0x62, 0x5b, 0xd8, 0x39,
-    0x4d, 0xbe, 0x8e, 0xbf, 0xfe, 0xd6, 0x28, 0x39, 0xed, 0x64, 0x85, 0xd8,
-    0x3a, 0xee, 0x09, 0xd4, 0x4b, 0xf9, 0x26, 0xfb, 0x8a, 0x3b, 0xa3, 0xaa,
-    0x0f, 0x53, 0x0c, 0x2f, 0xef, 0x08, 0x27, 0xe5, 0x5c, 0xeb, 0xff, 0xd1,
-    0x38, 0xe6, 0x4f, 0xe5, 0x20, 0x64, 0x75, 0xff, 0x9c, 0x67, 0xeb, 0xad,
-    0x34, 0x87, 0x53, 0xa2, 0xdc, 0x4c, 0x98, 0x49, 0xbc, 0xc3, 0x0c, 0x15,
-    0x7d, 0x3a, 0xd3, 0x45, 0x32, 0x5f, 0xdd, 0x01, 0x3a, 0xdb, 0x73, 0xc7,
-    0x13, 0x2b, 0xff, 0xff, 0x80, 0xe2, 0xdd, 0xe7, 0x08, 0x1f, 0x2e, 0x30,
-    0x43, 0x9c, 0xf8, 0xeb, 0xfd, 0x28, 0xdc, 0xf1, 0xb9, 0xce, 0xbf, 0xb5,
-    0xa4, 0xc1, 0xfc, 0xeb, 0xdb, 0xc5, 0x73, 0xaf, 0xfd, 0x0c, 0x7d, 0x9f,
-    0x58, 0xb8, 0x57, 0x3a, 0xb6, 0x88, 0xe5, 0x96, 0x78, 0x7a, 0xa1, 0x1e,
-    0x59, 0x0c, 0x2b, 0xf2, 0x7a, 0x7c, 0x60, 0xeb, 0xfe, 0x86, 0xf4, 0x41,
-    0xe8, 0xd1, 0xd7, 0xff, 0x27, 0x14, 0x36, 0x17, 0x81, 0x75, 0x9d, 0x7f,
-    0xfe, 0xf7, 0x72, 0x5f, 0x1b, 0xd4, 0xf7, 0x2d, 0x4d, 0x9d, 0x5b, 0x47,
-    0xda, 0xca, 0x3a, 0x6e, 0x28, 0x97, 0xfc, 0xb8, 0xdf, 0x0c, 0xdc, 0x4c,
-    0x75, 0xff, 0xb6, 0xd5, 0xc7, 0x3a, 0xce, 0x18, 0x75, 0xfe, 0x1f, 0xf8,
-    0xf0, 0x38, 0xb3, 0xaf, 0xe1, 0xf9, 0xc7, 0x9b, 0x83, 0xaa, 0x11, 0x4b,
-    0x88, 0x0e, 0x6b, 0x7f, 0xd8, 0xff, 0xfc, 0xc0, 0xbc, 0x8e, 0xbf, 0xfc,
-    0xf3, 0xf5, 0x20, 0x72, 0x64, 0xda, 0x1d, 0x58, 0x9e, 0x47, 0xe7, 0x9a,
-    0x86, 0xff, 0x8b, 0x58, 0x39, 0xbf, 0x0e, 0x75, 0xfc, 0x75, 0xff, 0xa5,
-    0x03, 0x3f, 0xdd, 0x88, 0x24, 0x75, 0x2b, 0x9f, 0x2c, 0xc4, 0xb7, 0xde,
-    0x9f, 0x02, 0x75, 0xff, 0x22, 0x9f, 0x77, 0xfa, 0xd3, 0x47, 0x54, 0xc7,
-    0xbd, 0xc6, 0x45, 0x79, 0x86, 0x18, 0x3a, 0xff, 0xfd, 0x8b, 0xf0, 0xc7,
-    0xf8, 0x1d, 0x62, 0xe1, 0xa5, 0x32, 0x5f, 0xdf, 0xec, 0x6f, 0x52, 0x05,
-    0xa7, 0x5f, 0xed, 0xc7, 0x91, 0xa8, 0x13, 0xaf, 0xd2, 0x9b, 0x31, 0xa7,
-    0x5b, 0x67, 0x52, 0xb0, 0x7d, 0x10, 0x63, 0xf4, 0x9e, 0xb1, 0x3f, 0x94,
-    0x84, 0x27, 0x51, 0x45, 0x8f, 0x50, 0x98, 0xbd, 0xe9, 0x74, 0xeb, 0x21,
-    0xd7, 0xf7, 0x63, 0xe3, 0x52, 0x73, 0xaf, 0xed, 0xbe, 0xc6, 0x24, 0x75,
-    0xff, 0xf4, 0x29, 0xae, 0xba, 0x7a, 0x16, 0x2e, 0xa1, 0xd7, 0xfe, 0xce,
-    0x1d, 0x4f, 0x9a, 0xd2, 0x2c, 0xeb, 0x9f, 0xd2, 0x44, 0x7f, 0x53, 0xaf,
-    0xfc, 0x92, 0x4d, 0xf3, 0x03, 0x1a, 0x3a, 0x95, 0xa2, 0x6c, 0x41, 0x0f,
-    0xd9, 0x78, 0xc2, 0xeb, 0xc5, 0xd7, 0x49, 0x95, 0x6d, 0xb4, 0xbe, 0x55,
-    0x34, 0x44, 0x2c, 0x25, 0x0c, 0x9c, 0x95, 0xf2, 0xa2, 0xd3, 0x63, 0x4e,
-    0xe6, 0x35, 0x04, 0x30, 0x9a, 0x1f, 0x1b, 0x8c, 0x4f, 0xb0, 0xd7, 0x78,
-    0x4a, 0xfe, 0x4c, 0x31, 0xb1, 0x6a, 0x57, 0x4f, 0xa5, 0x57, 0xf1, 0xa9,
-    0x7d, 0x8d, 0xfa, 0xff, 0xf6, 0xf1, 0x80, 0xf7, 0x26, 0x1c, 0xdc, 0x8e,
-    0xbd, 0xbc, 0x57, 0x3a, 0xff, 0xd0, 0xc7, 0xd9, 0xf5, 0x8b, 0x85, 0x73,
-    0xab, 0x68, 0xac, 0x5a, 0x57, 0x87, 0xaf, 0xff, 0x9d, 0x71, 0xb6, 0xec,
-    0x0a, 0x6c, 0x0f, 0xa3, 0xab, 0x11, 0x00, 0x03, 0x0b, 0xfd, 0xb6, 0x81,
-    0xc2, 0xb8, 0x3a, 0xff, 0xe8, 0xdf, 0xdf, 0x27, 0xbb, 0x81, 0x43, 0xaf,
-    0xfd, 0xd1, 0x89, 0xfe, 0xf7, 0xae, 0xae, 0x75, 0x42, 0x2e, 0x67, 0x32,
-    0xc4, 0x4b, 0xcf, 0xb9, 0xce, 0xb9, 0x86, 0x0e, 0xbc, 0xed, 0x65, 0xa6,
-    0xd1, 0x81, 0xcb, 0xfa, 0x36, 0xf2, 0x4e, 0x9d, 0x7e, 0xc5, 0xf5, 0xc2,
-    0x75, 0x99, 0x86, 0xfa, 0x93, 0x23, 0x6c, 0x51, 0x51, 0xb2, 0xc2, 0xf7,
-    0x0a, 0x07, 0xad, 0x37, 0xc6, 0x54, 0xbe, 0xa1, 0xb7, 0xc1, 0x8d, 0x83,
-    0x4e, 0x22, 0xba, 0x93, 0xaf, 0x1d, 0x0c, 0xef, 0x17, 0x31, 0x8e, 0xec,
-    0xa1, 0x70, 0x8b, 0xec, 0x65, 0x7f, 0xc2, 0xb3, 0x52, 0xc9, 0xbd, 0x29,
-    0xf4, 0x15, 0xf9, 0x15, 0xfd, 0xa8, 0x9a, 0x49, 0x31, 0xd7, 0xff, 0xa2,
-    0x7c, 0xf4, 0x0a, 0x7f, 0x9c, 0xf8, 0xeb, 0x33, 0xa3, 0xf7, 0xfa, 0x5d,
-    0x7e, 0xdb, 0x5d, 0xda, 0x68, 0x8d, 0x6f, 0x29, 0xce, 0x8e, 0xb3, 0x38,
-    0x7a, 0x3e, 0x33, 0xbf, 0x6d, 0xae, 0xed, 0x34, 0x54, 0xb7, 0x3b, 0x4d,
-    0x10, 0xd5, 0x99, 0xc3, 0xd5, 0x73, 0x3b, 0xf6, 0xda, 0xee, 0xd3, 0x44,
-    0x7d, 0x7f, 0xfc, 0x2f, 0xe9, 0x42, 0x9f, 0x23, 0xda, 0x8f, 0xce, 0xbc,
-    0xf2, 0x67, 0x11, 0x09, 0xf4, 0xce, 0xff, 0xcf, 0x3c, 0x75, 0x36, 0x90,
-    0xb3, 0xaf, 0xf4, 0x6f, 0x07, 0xd9, 0xd3, 0xaf, 0x2f, 0x19, 0xe3, 0x3e,
-    0xcf, 0xa7, 0x94, 0xca, 0x36, 0xe2, 0x14, 0x57, 0xff, 0xfd, 0x20, 0x6d,
-    0x47, 0xd6, 0x06, 0x39, 0xd7, 0xdf, 0x28, 0x8a, 0x1d, 0x7f, 0x03, 0x9e,
-    0x65, 0x9e, 0x3a, 0xff, 0xf2, 0xac, 0xa3, 0x0a, 0xf3, 0x85, 0x55, 0xf3,
-    0xe7, 0x78, 0xce, 0xbf, 0x6d, 0xae, 0xed, 0x34, 0x58, 0xf7, 0x3e, 0x8e,
-    0xbf, 0xa7, 0xfb, 0xbd, 0xe6, 0xce, 0xa9, 0x1e, 0x2b, 0x8a, 0xdf, 0xf0,
-    0xba, 0x9d, 0x48, 0x19, 0xce, 0xbf, 0xff, 0x7f, 0x29, 0xd5, 0x68, 0x56,
-    0xe7, 0x6e, 0xfe, 0x7c, 0xef, 0x19, 0xd7, 0xe4, 0xf7, 0x93, 0xc7, 0x5f,
-    0x6f, 0x79, 0xc6, 0x75, 0x61, 0xe5, 0x39, 0x35, 0xfb, 0x37, 0x99, 0x31,
-    0xd6, 0x66, 0x15, 0x64, 0x4e, 0xd9, 0x22, 0xfc, 0x62, 0x47, 0x89, 0x88,
-    0x7a, 0x6f, 0xa8, 0x5a, 0xfd, 0x20, 0xbc, 0xab, 0x2d, 0x43, 0xaf, 0xe5,
-    0x40, 0xe7, 0x5f, 0xc7, 0x5f, 0xe7, 0xff, 0x4f, 0xef, 0x39, 0xd7, 0x2d,
-    0xa7, 0x50, 0x9e, 0x47, 0x8c, 0xaf, 0xfd, 0x8c, 0x6f, 0x05, 0xf9, 0x96,
-    0x8e, 0xbf, 0x66, 0xba, 0x8c, 0x1d, 0x7d, 0xfa, 0xd3, 0x67, 0x5f, 0xff,
-    0xf4, 0x6c, 0x70, 0x39, 0xde, 0xa3, 0x7a, 0x9e, 0xd3, 0xf2, 0x75, 0x22,
-    0x21, 0xba, 0x45, 0x7f, 0x46, 0xff, 0xe3, 0x07, 0x8e, 0xbf, 0xe8, 0x1f,
-    0x2a, 0x9f, 0xc0, 0x83, 0xaf, 0xff, 0x47, 0x61, 0x6d, 0xea, 0x7b, 0x31,
-    0x67, 0x5f, 0x7f, 0xfa, 0x7d, 0x3a, 0xf3, 0xbb, 0x4d, 0x16, 0x85, 0xff,
-    0x9d, 0x8e, 0x26, 0xbe, 0xe7, 0xc6, 0x0e, 0xbf, 0xbf, 0x81, 0x8f, 0x68,
-    0xea, 0x6a, 0x25, 0xb6, 0x4f, 0xfa, 0x1d, 0xff, 0xff, 0xf2, 0x6f, 0xae,
-    0x29, 0x1e, 0x4e, 0xc6, 0xbb, 0x9a, 0xde, 0x37, 0x3c, 0x75, 0x49, 0x50,
-    0xb0, 0x4c, 0x5a, 0x74, 0x88, 0xfb, 0x85, 0xdf, 0x4c, 0x6e, 0xc5, 0x9d,
-    0x7f, 0xf3, 0xf3, 0xc3, 0xaa, 0xe9, 0xe1, 0x85, 0x9d, 0x5b, 0x3d, 0xd7,
-    0x15, 0xbf, 0xff, 0x27, 0xb4, 0xfc, 0xeb, 0x59, 0xd4, 0xd0, 0x27, 0x3a,
-    0xff, 0xf8, 0x13, 0xed, 0x3d, 0x38, 0x37, 0x2d, 0x2b, 0xa1, 0xd5, 0xd4,
-    0x55, 0x8a, 0xb5, 0xff, 0xf0, 0x37, 0xb8, 0x1c, 0x51, 0x3b, 0xdc, 0xfa,
-    0x75, 0x95, 0x27, 0x5b, 0x7b, 0x3e, 0x40, 0x28, 0x5f, 0xdc, 0x26, 0xee,
-    0x7e, 0xe7, 0x5f, 0x85, 0xaf, 0xa4, 0x3a, 0xff, 0xfe, 0xd8, 0xc4, 0x73,
-    0xf3, 0x5e, 0x18, 0x0f, 0x63, 0xc7, 0x5c, 0x9d, 0x3a, 0xfa, 0x42, 0xff,
-    0x4e, 0xbf, 0xe4, 0x0b, 0xff, 0xbd, 0xbf, 0xe7, 0x54, 0x23, 0xc3, 0x09,
-    0x55, 0xd6, 0xdc, 0x54, 0x04, 0x57, 0x9d, 0x5d, 0x0e, 0xbf, 0xf7, 0xdf,
-    0x28, 0x8a, 0x46, 0x0c, 0x1d, 0x7e, 0xfb, 0xe1, 0x8f, 0xce, 0xae, 0x51,
-    0x0b, 0xb1, 0xde, 0x07, 0xf7, 0xe8, 0xf6, 0x76, 0x0e, 0xbf, 0xff, 0xfd,
-    0xd4, 0x0e, 0x24, 0xfd, 0x88, 0xf9, 0x9c, 0xcb, 0x49, 0xe7, 0x1c, 0x3a,
-    0xff, 0xd9, 0xcc, 0xb5, 0x36, 0xdf, 0xda, 0x3a, 0xff, 0xfb, 0x3d, 0xac,
-    0x9b, 0xb1, 0xc3, 0x3b, 0xd8, 0x3a, 0xff, 0x86, 0x22, 0x6c, 0xe0, 0x9b,
-    0x3a, 0xa7, 0x4d, 0x8d, 0xa4, 0xbf, 0xbb, 0x0a, 0x07, 0x94, 0x2f, 0xdf,
-    0x26, 0x92, 0x4c, 0x75, 0x42, 0xa0, 0xdc, 0x8e, 0x59, 0x13, 0x2f, 0xfe,
-    0xea, 0x7c, 0xc1, 0xc4, 0xdb, 0xf0, 0x3a, 0xff, 0xff, 0x76, 0x07, 0x3f,
-    0xd6, 0x07, 0xb1, 0x3a, 0xc0, 0x21, 0x3a, 0x94, 0x45, 0x27, 0x91, 0x2f,
-    0xff, 0xe8, 0x9b, 0x03, 0xd8, 0xe1, 0xdc, 0xf0, 0xc4, 0x2c, 0xeb, 0xfb,
-    0x9d, 0x7d, 0x9c, 0x02, 0x75, 0xff, 0x43, 0x7a, 0x93, 0x3b, 0xce, 0x75,
-    0x2d, 0x18, 0x6e, 0xb5, 0xf9, 0x8d, 0xfe, 0x94, 0x6e, 0x78, 0xdc, 0xe7,
-    0x5f, 0xf2, 0x00, 0x65, 0xb8, 0xc0, 0x9d, 0x7f, 0xff, 0xdd, 0xc9, 0x37,
-    0xa9, 0xd8, 0xcd, 0xcb, 0xc3, 0x0b, 0xd1, 0xd5, 0xa4, 0x4d, 0x78, 0xda,
-    0xa1, 0x1e, 0x39, 0x0c, 0xeb, 0xfd, 0xb6, 0xcd, 0x89, 0xd0, 0x1d, 0x7f,
-    0x97, 0x0d, 0x17, 0xe7, 0xc7, 0x5f, 0xdb, 0x8f, 0x4f, 0x8c, 0x1d, 0x7f,
-    0xff, 0xfc, 0x80, 0xdf, 0x72, 0x69, 0x9f, 0x73, 0x7b, 0xa0, 0xff, 0x58,
-    0x9c, 0x03, 0x07, 0x5f, 0xbd, 0xd7, 0x15, 0x0e, 0xbf, 0xe1, 0x04, 0xe1,
-    0xee, 0x0c, 0x1d, 0x6c, 0x0a, 0x38, 0x32, 0x10, 0x4d, 0x27, 0xbf, 0xfd,
-    0xbf, 0xdb, 0xf8, 0xe7, 0xb4, 0xee, 0x27, 0x54, 0x27, 0xeb, 0x86, 0x68,
-    0x64, 0x31, 0x87, 0x00, 0xe6, 0xff, 0x67, 0x66, 0x4e, 0xa2, 0xce, 0xbf,
-    0xd2, 0xcd, 0xe8, 0x62, 0x73, 0xaf, 0x71, 0xe4, 0xe7, 0x5e, 0xce, 0xb9,
-    0xd7, 0xe9, 0x82, 0x00, 0x09, 0xd4, 0x13, 0xc2, 0x71, 0xab, 0xfd, 0x8c,
-    0x63, 0x5b, 0x8c, 0x1d, 0x7f, 0xdc, 0xaf, 0x30, 0x7d, 0xc7, 0x87, 0x5e,
-    0x52, 0x40, 0x3a, 0xfd, 0xd8, 0xdc, 0xeb, 0x3a, 0xff, 0x01, 0xc7, 0xb8,
-    0xf3, 0x1d, 0x6e, 0x66, 0x3d, 0x96, 0x0a, 0x29, 0x11, 0x42, 0xee, 0xd5,
-    0x89, 0x97, 0xb9, 0x98, 0xc3, 0x6e, 0xb1, 0x52, 0x47, 0x26, 0x48, 0x64,
-    0xec, 0x3a, 0x8d, 0x42, 0xef, 0x41, 0xd7, 0x3f, 0x8e, 0xad, 0x9a, 0xae,
-    0x8a, 0xdf, 0xf6, 0xf3, 0xb9, 0x3f, 0xc4, 0xd1, 0xd5, 0x87, 0xb6, 0x02,
-    0x1b, 0xf9, 0x04, 0x12, 0xcd, 0x1d, 0x7f, 0xec, 0xf4, 0x73, 0xfb, 0xf7,
-    0xa8, 0x75, 0x96, 0x75, 0xfc, 0x82, 0x09, 0x66, 0xbe, 0x1e, 0x77, 0x03,
-    0xea, 0x51, 0x18, 0x1e, 0x79, 0xb3, 0x2a, 0xdb, 0x66, 0xf0, 0xaa, 0x22,
-    0x87, 0x79, 0xc8, 0x64, 0x7c, 0x18, 0x56, 0xe4, 0xa3, 0x85, 0x21, 0x74,
-    0xd8, 0x66, 0x24, 0x21, 0xa6, 0x28, 0x5c, 0x64, 0x1d, 0x95, 0xb8, 0xf0,
-    0xd9, 0xfe, 0x1c, 0xe3, 0x19, 0x0e, 0xa5, 0x0d, 0xfa, 0x54, 0xaf, 0x1c,
-    0x35, 0x7e, 0xc3, 0x86, 0xfe, 0xe2, 0x40, 0x8c, 0x4c, 0x75, 0xe8, 0x71,
-    0x3a, 0xfb, 0x3a, 0xfe, 0x3a, 0xca, 0x8c, 0x3e, 0x8e, 0x97, 0x88, 0xcd,
-    0xff, 0xff, 0xee, 0xb8, 0xfb, 0x50, 0x92, 0xce, 0x21, 0xf4, 0x76, 0x14,
-    0x04, 0x71, 0x1d, 0x7d, 0x9a, 0xfd, 0x0e, 0xbf, 0x6d, 0xae, 0xed, 0x34,
-    0x5a, 0xd7, 0xf9, 0x68, 0xb7, 0x9b, 0x3a, 0x75, 0xfd, 0x9c, 0x5a, 0x71,
-    0x69, 0xd7, 0xb7, 0x0b, 0x3a, 0xfe, 0xee, 0x6a, 0x27, 0xe2, 0x3a, 0xff,
-    0xa4, 0xce, 0x6d, 0xae, 0xed, 0x34, 0x50, 0x75, 0x87, 0xea, 0xe6, 0x17,
-    0xd9, 0x34, 0x78, 0xeb, 0xfe, 0x89, 0x46, 0xe7, 0x8d, 0xce, 0x75, 0xff,
-    0xfb, 0xda, 0x49, 0xdf, 0x4e, 0x2f, 0xee, 0xc4, 0xc7, 0x59, 0x95, 0x52,
-    0xac, 0x38, 0x37, 0x93, 0xd6, 0x10, 0xa1, 0x9c, 0xc6, 0x5b, 0x2e, 0x5c,
-    0x24, 0x3a, 0x40, 0x24, 0x3f, 0x4e, 0x6f, 0xff, 0x32, 0xb7, 0x93, 0x39,
-    0xb6, 0xbb, 0xb4, 0xd1, 0x45, 0xdf, 0xe6, 0x73, 0x6d, 0x77, 0x69, 0xa2,
-    0xea, 0xa8, 0x6f, 0xd5, 0x24, 0xf8, 0xd7, 0xd4, 0x8e, 0x19, 0x72, 0xbc,
-    0x3b, 0x5a, 0x02, 0xff, 0x39, 0x43, 0xa8, 0x54, 0xf9, 0x5e, 0xfd, 0xb6,
-    0xbb, 0xb4, 0xd1, 0x10, 0xde, 0xee, 0x04, 0xeb, 0xec, 0xe0, 0x9b, 0x3a,
-    0xcc, 0xe1, 0xf8, 0x72, 0x66, 0xae, 0x37, 0x6e, 0x33, 0xaf, 0xa3, 0xb0,
-    0xb3, 0xaf, 0x9a, 0xee, 0xd3, 0x44, 0x6d, 0x4d, 0x3c, 0xdd, 0x90, 0x59,
-    0x90, 0xa2, 0x0b, 0x18, 0x2f, 0xf3, 0x39, 0xb6, 0xbb, 0xb4, 0xd1, 0x4d,
-    0xdf, 0xb6, 0xd7, 0x76, 0x9a, 0x2a, 0x0b, 0xd9, 0xcb, 0x07, 0x59, 0x9c,
-    0x3d, 0x0e, 0x99, 0xdf, 0xe6, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0xa6, 0xbf,
-    0x6d, 0xae, 0xed, 0x34, 0x56, 0x17, 0xe4, 0x60, 0x20, 0xd9, 0xd7, 0xf2,
-    0x71, 0xbc, 0x27, 0x19, 0xd7, 0xf9, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0x8f,
-    0xea, 0x0f, 0xbe, 0x46, 0x17, 0xb2, 0x27, 0x3a, 0xff, 0x67, 0x32, 0x79,
-    0x20, 0x9d, 0x73, 0xf8, 0xeb, 0x33, 0x89, 0xa6, 0x34, 0xcd, 0xe1, 0x2e,
-    0x24, 0x3e, 0x1b, 0xe3, 0x31, 0xbf, 0xfc, 0xca, 0xde, 0x4c, 0xe6, 0xda,
-    0xee, 0xd3, 0x44, 0xdf, 0x7f, 0xf2, 0xde, 0x4c, 0xe6, 0xda, 0xee, 0xd3,
-    0x44, 0xfd, 0x7f, 0x3f, 0x73, 0xd0, 0x13, 0xae, 0x16, 0x9d, 0x7d, 0xa9,
-    0x97, 0xa3, 0xaf, 0xf3, 0x7a, 0x9e, 0xcc, 0x59, 0xd7, 0x70, 0x69, 0xe3,
-    0x02, 0xa8, 0x44, 0x72, 0x0a, 0xe8, 0x8f, 0xc6, 0x37, 0xf9, 0x57, 0x2b,
-    0x03, 0x93, 0xc7, 0x27, 0x5f, 0x95, 0x95, 0x47, 0x1e, 0x72, 0x75, 0xfc,
-    0xac, 0x3c, 0xfd, 0x45, 0x73, 0xaf, 0xca, 0xda, 0x8a, 0x62, 0xb9, 0xd7,
-    0x70, 0x69, 0xe3, 0x01, 0xb7, 0x4e, 0xa5, 0x65, 0x30, 0xd5, 0x60, 0xf9,
-    0x50, 0x68, 0xab, 0x8d, 0x7c, 0x62, 0x02, 0x5b, 0xe5, 0x6f, 0x6f, 0x87,
-    0x5f, 0x2a, 0xa7, 0x5e, 0x8e, 0xbf, 0xff, 0x95, 0xb1, 0x7f, 0x40, 0xb5,
-    0x16, 0x10, 0x3e, 0xe4, 0x75, 0xff, 0x3f, 0x53, 0x83, 0x2c, 0x30, 0xc1,
-    0x57, 0xfb, 0xaf, 0xef, 0x3b, 0xb0, 0x75, 0x2a, 0x91, 0xe8, 0xab, 0xc9,
-    0xd5, 0xaa, 0xea, 0xae, 0x3e, 0xbf, 0xff, 0xca, 0xca, 0xa3, 0x5b, 0x84,
-    0xf7, 0x70, 0x29, 0xac, 0x1f, 0xce, 0xbf, 0x75, 0x1f, 0xf5, 0x5c, 0x75,
-    0x2b, 0x08, 0x95, 0xf3, 0x45, 0xf9, 0x54, 0xad, 0x3f, 0x52, 0x0e, 0xbf,
-    0xfe, 0x88, 0x88, 0x88, 0x88, 0x88, 0xe7, 0x47, 0x5e, 0x4e, 0x70, 0xeb,
-    0xf6, 0xd2, 0x77, 0x59, 0x57, 0x30, 0xc1, 0x55, 0x86, 0xfd, 0x82, 0x7b,
-    0x00, 0xa6, 0x4d, 0x0d, 0x42, 0x39, 0x7f, 0x49, 0xd3, 0xdd, 0xf9, 0xdc,
-    0x63, 0x88, 0xeb, 0xff, 0xdd, 0x89, 0x3e, 0x05, 0x38, 0x6b, 0xf6, 0x9d,
-    0x7f, 0xb6, 0x01, 0x07, 0x81, 0xe3, 0xaf, 0x76, 0x04, 0xeb, 0x42, 0x1e,
-    0x6f, 0x8c, 0xea, 0x11, 0x7d, 0xd8, 0x4c, 0x5e, 0x14, 0x83, 0xaf, 0xd1,
-    0xf5, 0x7d, 0x43, 0xab, 0x67, 0x82, 0x23, 0x37, 0xf4, 0xb5, 0xec, 0x15,
-    0x0e, 0xbc, 0xc3, 0xb0, 0x75, 0xff, 0xef, 0x6d, 0xe7, 0x0f, 0x63, 0x5e,
-    0x07, 0x4e, 0xbb, 0x17, 0xd3, 0xe8, 0xd0, 0xed, 0xf9, 0xdb, 0xd4, 0xd9,
-    0xd7, 0xff, 0xff, 0x85, 0xd4, 0x4d, 0xc4, 0xbe, 0x75, 0x16, 0x18, 0xf9,
-    0xc6, 0x0e, 0xa6, 0xce, 0xbe, 0x79, 0x27, 0x27, 0x5f, 0xfb, 0xa9, 0xec,
-    0xde, 0xc1, 0x3f, 0x03, 0xaf, 0xf9, 0x3d, 0x9b, 0xd8, 0x27, 0xe0, 0x75,
-    0xed, 0x00, 0x7e, 0x1f, 0xe7, 0x50, 0x68, 0x29, 0xd1, 0x6c, 0xb7, 0xa4,
-    0xc2, 0xfb, 0xa8, 0x4e, 0xda, 0x0e, 0xbf, 0xfe, 0x8e, 0x64, 0xe3, 0xff,
-    0xcf, 0xd3, 0x68, 0xa1, 0xd5, 0xc6, 0x7c, 0x5c, 0x41, 0xf7, 0xd3, 0xad,
-    0x24, 0x75, 0xf4, 0x7f, 0xf5, 0x67, 0x5f, 0x08, 0x1e, 0x47, 0x53, 0x4f,
-    0x13, 0x44, 0x97, 0xfb, 0xb0, 0xb6, 0x7f, 0xfe, 0x0e, 0xa8, 0x45, 0xee,
-    0x33, 0x21, 0x15, 0xfd, 0x32, 0x77, 0xd8, 0xd3, 0xab, 0x67, 0xb4, 0xe5,
-    0xb7, 0xfd, 0xc8, 0x7e, 0xc2, 0xbf, 0x41, 0xa3, 0xaf, 0xff, 0xc1, 0xec,
-    0x6d, 0x3f, 0x8f, 0xb1, 0x30, 0xc2, 0xce, 0xbf, 0xca, 0x40, 0xfb, 0x4f,
-    0xd3, 0xa9, 0x11, 0x10, 0xea, 0xd5, 0x08, 0xe8, 0x18, 0x63, 0xdf, 0xee,
-    0xc4, 0xfb, 0x8c, 0x09, 0xd7, 0xff, 0xc3, 0x9c, 0x1a, 0xfb, 0x9d, 0xfc,
-    0xfc, 0xfe, 0x75, 0x42, 0x21, 0x1c, 0xca, 0xff, 0x0b, 0xcf, 0xcc, 0xa3,
-    0x88, 0xeb, 0xfd, 0xae, 0xbf, 0xde, 0xc4, 0x8e, 0xa9, 0xcf, 0xab, 0x93,
-    0x6b, 0xd9, 0x93, 0x1d, 0x7f, 0xd1, 0x21, 0x7f, 0x49, 0x38, 0x1d, 0x7b,
-    0xec, 0x7e, 0x75, 0x74, 0xf5, 0xb4, 0x71, 0x65, 0x73, 0xaf, 0x7a, 0x58,
-    0x75, 0xda, 0xc3, 0xaf, 0xfe, 0xd4, 0x6d, 0xbe, 0x1c, 0x9d, 0xc4, 0xea,
-    0xc4, 0x53, 0xa1, 0x13, 0x89, 0xfe, 0x37, 0xe1, 0x5b, 0xf8, 0x13, 0x03,
-    0xd1, 0xd3, 0xaf, 0xfe, 0x0c, 0x79, 0xf5, 0x9d, 0xea, 0x2c, 0xeb, 0xfd,
-    0x38, 0x61, 0xf7, 0xf8, 0x0e, 0xbd, 0xe4, 0x98, 0xea, 0x84, 0x49, 0x62,
-    0x16, 0x8d, 0x2f, 0xd0, 0xae, 0x8c, 0x34, 0xea, 0x86, 0x54, 0xfc, 0xe6,
-    0x01, 0x87, 0x2e, 0x34, 0x72, 0x42, 0x92, 0x8d, 0xe6, 0x85, 0x8e, 0xe3,
-    0x3f, 0x5c, 0x61, 0x3d, 0x85, 0x53, 0xc2, 0x2f, 0xf2, 0x41, 0x8c, 0x63,
-    0x49, 0x1e, 0x86, 0x07, 0xd2, 0xeb, 0xff, 0xfe, 0x55, 0xea, 0xa8, 0xc5,
-    0x6b, 0xb5, 0x52, 0xad, 0xc1, 0x5d, 0x57, 0x03, 0xe7, 0xce, 0xf1, 0x9d,
-    0x7a, 0x6f, 0xab, 0x3a, 0xff, 0xb3, 0xda, 0xcf, 0x77, 0x3f, 0x3a, 0x9c,
-    0xf5, 0xc4, 0x7e, 0xe7, 0x13, 0xab, 0x66, 0xd1, 0x64, 0x17, 0xd1, 0xec,
-    0x59, 0xd7, 0xef, 0x40, 0xa7, 0xe7, 0x5f, 0xd8, 0xc3, 0xfe, 0xbc, 0x3a,
-    0xbe, 0x1f, 0x9e, 0x10, 0x09, 0x35, 0xfb, 0x73, 0xc7, 0xb4, 0x75, 0xf3,
-    0xed, 0xe4, 0x75, 0xb7, 0x87, 0x90, 0x25, 0x17, 0x98, 0x61, 0x83, 0xaf,
-    0xa7, 0x14, 0x82, 0x99, 0x2f, 0xef, 0xf9, 0x5f, 0xae, 0x32, 0x0c, 0x4e,
-    0x75, 0xdc, 0xc8, 0xeb, 0xfc, 0xa4, 0x7b, 0x5d, 0x70, 0x1d, 0x7e, 0x49,
-    0xf3, 0x9f, 0x1d, 0x72, 0x34, 0xea, 0x84, 0x43, 0xa8, 0x2e, 0xb3, 0x3f,
-    0x14, 0x5f, 0x94, 0x7d, 0x70, 0x91, 0xd5, 0xc9, 0xf3, 0xf8, 0xf6, 0x95,
-    0x65, 0x7d, 0x51, 0x18, 0xf0, 0x61, 0x28, 0x8e, 0xfd, 0x45, 0x73, 0x00,
-    0x46, 0x53, 0x7f, 0xf7, 0x06, 0x33, 0x42, 0x91, 0xbc, 0x9c, 0xeb, 0xff,
-    0xff, 0xff, 0x2b, 0xfc, 0xee, 0x73, 0x2e, 0xaf, 0xe3, 0x7a, 0x0f, 0x7b,
-    0x07, 0xb9, 0xe8, 0x0f, 0xcf, 0x9d, 0xe3, 0x3a, 0xff, 0x83, 0x80, 0x54,
-    0xa7, 0x5d, 0x67, 0x5f, 0xa1, 0x63, 0x93, 0x1d, 0x86, 0xee, 0xf7, 0x0c,
-    0x09, 0xd7, 0xf9, 0x4e, 0xa4, 0x08, 0x20, 0xea, 0xe9, 0xe7, 0x38, 0xed,
-    0x05, 0x14, 0x9a, 0x84, 0x1d, 0xfd, 0x12, 0xec, 0x70, 0x43, 0xaf, 0xcf,
-    0xb0, 0x3e, 0x8e, 0xba, 0x5e, 0x3a, 0xfa, 0x68, 0xf3, 0x9d, 0x7c, 0x0f,
-    0xf0, 0x5a, 0x6d, 0xc0, 0x2d, 0x69, 0x1d, 0x53, 0x9e, 0x47, 0x4e, 0x2f,
-    0xfe, 0x8e, 0xfd, 0x0f, 0x93, 0x26, 0x85, 0x9d, 0x7d, 0x1e, 0x02, 0xce,
-    0xa3, 0x44, 0x1d, 0x7f, 0x3c, 0xff, 0xb8, 0x84, 0x95, 0x83, 0x6d, 0xa6,
-    0x9e, 0x97, 0x18, 0xbd, 0x2d, 0x13, 0xde, 0x73, 0xbf, 0xff, 0x2f, 0x4f,
-    0x2e, 0xa6, 0x7b, 0x5b, 0xc0, 0xe1, 0xd7, 0xfd, 0x1e, 0x1c, 0xe0, 0x39,
-    0xa3, 0xaa, 0x11, 0x5b, 0x84, 0x7a, 0x53, 0xbf, 0x9f, 0xb0, 0xae, 0x09,
-    0x1d, 0x52, 0x55, 0xc4, 0xd2, 0xdd, 0xc2, 0x95, 0x64, 0x7e, 0x8e, 0x43,
-    0x81, 0x75, 0xfd, 0x21, 0xce, 0x7d, 0x87, 0x5f, 0xff, 0xbe, 0xff, 0xfc,
-    0x73, 0x93, 0x85, 0xdd, 0xae, 0x13, 0xaa, 0x11, 0x0b, 0xb2, 0xcb, 0xfc,
-    0xe3, 0xe9, 0x66, 0xf0, 0xeb, 0xf8, 0x53, 0xfd, 0x75, 0x0e, 0xbb, 0x61,
-    0x3a, 0xe6, 0x18, 0x3a, 0xa4, 0x6b, 0x98, 0x16, 0xbd, 0x09, 0xc0, 0xa6,
-    0x4d, 0x15, 0x3a, 0x2a, 0x74, 0xf9, 0x77, 0xfa, 0x3a, 0xfe, 0x4e, 0xa2,
-    0x8a, 0x41, 0xd7, 0x6b, 0xe8, 0x4f, 0x13, 0xc2, 0xf4, 0x88, 0x96, 0xfa,
-    0xcd, 0x79, 0x86, 0x18, 0x2a, 0x8a, 0x64, 0xbf, 0xbe, 0x46, 0x12, 0x62,
-    0xa9, 0xa6, 0xf1, 0x06, 0xaf, 0xd9, 0xb8, 0xe1, 0x87, 0x54, 0x32, 0x06,
-    0xa7, 0x45, 0xc8, 0xe2, 0x52, 0x58, 0x56, 0xe1, 0xd6, 0xb2, 0x2e, 0xc6,
-    0xde, 0x2f, 0xfa, 0x20, 0xbe, 0xdc, 0x81, 0x87, 0x5f, 0xe1, 0xe7, 0xdf,
-    0x7a, 0xff, 0x9d, 0x78, 0x53, 0x47, 0x5f, 0x05, 0xc7, 0xf3, 0xaf, 0xfe,
-    0x81, 0xfc, 0x63, 0x99, 0xa0, 0x7f, 0x3a, 0xb1, 0x16, 0xa8, 0x6d, 0xf8,
-    0xd6, 0x88, 0x6c, 0x87, 0x5f, 0xf3, 0xa8, 0xde, 0xa0, 0x5e, 0x47, 0x5f,
-    0x4f, 0x3b, 0xf2, 0x75, 0xdf, 0xe9, 0x0f, 0xac, 0x43, 0xfe, 0x9c, 0x5f,
-    0xa3, 0x37, 0xd4, 0x3a, 0xff, 0xf3, 0x1f, 0xf7, 0x32, 0x74, 0xce, 0x11,
-    0xc9, 0xd7, 0xff, 0xbf, 0x85, 0xef, 0x71, 0x3f, 0x9d, 0xd4, 0x3a, 0xff,
-    0x4b, 0x3b, 0x8b, 0x86, 0x9d, 0x7b, 0x16, 0xae, 0x75, 0xfe, 0xcd, 0x0e,
-    0x7b, 0xa8, 0x75, 0x04, 0xf3, 0x84, 0x7a, 0xb1, 0x39, 0x99, 0x8f, 0x3a,
-    0x4b, 0xfa, 0x6f, 0x92, 0xf8, 0x3f, 0xdf, 0xde, 0xc9, 0x86, 0x16, 0x78,
-    0x80, 0xaf, 0xce, 0x21, 0xec, 0x1a, 0x20, 0x26, 0x4d, 0xcd, 0xff, 0xc9,
-    0xce, 0x83, 0x83, 0x02, 0x08, 0x3a, 0xff, 0xe0, 0x35, 0x4d, 0xe7, 0x3a,
-    0xfd, 0xfc, 0x75, 0xfa, 0x24, 0xfc, 0xb0, 0x75, 0x62, 0x2c, 0x11, 0x07,
-    0x68, 0xf6, 0x9c, 0xeb, 0xf7, 0xcc, 0x99, 0x16, 0x75, 0xff, 0xe0, 0x47,
-    0xce, 0x2f, 0x26, 0xbb, 0xcb, 0xb0, 0x75, 0x4e, 0x7f, 0x3a, 0x29, 0xbf,
-    0xf6, 0x07, 0xae, 0xcc, 0x76, 0x39, 0x3a, 0x95, 0x08, 0xeb, 0xdc, 0x22,
-    0x96, 0x47, 0x7f, 0xe4, 0x15, 0x36, 0x28, 0xd0, 0x09, 0xd7, 0xff, 0xe7,
-    0xe7, 0x9d, 0x40, 0xfb, 0xec, 0xdd, 0x4f, 0x68, 0xea, 0x84, 0x67, 0x61,
-    0xc8, 0x0f, 0x2f, 0x97, 0x18, 0xb3, 0xaf, 0xfd, 0x8b, 0x86, 0xa7, 0xb6,
-    0x05, 0x9d, 0x79, 0x39, 0xd1, 0xd6, 0x89, 0x1e, 0xcf, 0xe7, 0xb7, 0xfb,
-    0x73, 0x69, 0x07, 0xc8, 0x75, 0xfe, 0xea, 0x73, 0xfe, 0xdc, 0x27, 0x5f,
-    0x73, 0xfe, 0xe0, 0xab, 0x98, 0x60, 0xaa, 0x83, 0x76, 0xc1, 0x1d, 0xc2,
-    0x85, 0x32, 0x68, 0x6f, 0x3e, 0xe5, 0xf1, 0x16, 0xb2, 0x84, 0x85, 0x2b,
-    0x6c, 0x87, 0x58, 0x86, 0xb6, 0x4a, 0x40, 0x48, 0x4a, 0x6e, 0x1e, 0x7d,
-    0x8f, 0x9d, 0xcb, 0x85, 0xe7, 0xc5, 0x00, 0x87, 0x3d, 0xe9, 0xdd, 0x67,
-    0x5e, 0xf2, 0x30, 0x78, 0xc2, 0x2f, 0xbc, 0x07, 0xfa, 0x68, 0x81, 0xf9,
-    0x35, 0x34, 0xe8, 0x86, 0x02, 0x2d, 0xe5, 0x74, 0xfc, 0xeb, 0xa0, 0x07,
-    0x5f, 0x80, 0x3f, 0xfd, 0x91, 0xd7, 0xff, 0xc3, 0x9a, 0xf9, 0xf7, 0xb1,
-    0xfa, 0xde, 0x5f, 0x30, 0xdf, 0xe8, 0x56, 0x80, 0x8c, 0x9e, 0x0b, 0xd7,
-    0xfe, 0xe8, 0x27, 0x8f, 0x91, 0xe8, 0x09, 0xd7, 0x9f, 0x73, 0x9d, 0x73,
-    0x0c, 0x1d, 0x7f, 0xb6, 0x99, 0xc3, 0xec, 0x99, 0x69, 0xb4, 0x60, 0x72,
-    0xff, 0xc8, 0xa7, 0xcd, 0x03, 0xf5, 0xc4, 0x8e, 0xbf, 0xda, 0xcf, 0x3a,
-    0xf0, 0x4e, 0xa0, 0xa6, 0x6b, 0xb7, 0x4e, 0xa7, 0xf9, 0x0a, 0xff, 0xe1,
-    0xc5, 0x3a, 0xf2, 0xfa, 0xfc, 0xc1, 0xd5, 0x08, 0x83, 0xc3, 0xeb, 0xff,
-    0x96, 0xb7, 0x96, 0x6d, 0xae, 0xed, 0x34, 0x43, 0x17, 0xff, 0xff, 0x9f,
-    0x58, 0x38, 0xde, 0xc7, 0x32, 0xe3, 0xce, 0xb5, 0x30, 0x5d, 0x43, 0xab,
-    0x11, 0x8c, 0x04, 0xfa, 0x45, 0x5c, 0xdd, 0x8f, 0x74, 0x61, 0xcf, 0x7f,
-    0x97, 0xd7, 0x9c, 0x62, 0x45, 0x5d, 0xa0, 0x1d, 0x7f, 0x4b, 0xae, 0xe3,
-    0x07, 0x5a, 0x1a, 0x78, 0x1c, 0x8b, 0x5f, 0xb6, 0xd7, 0x76, 0x9a, 0x20,
-    0xab, 0xdd, 0x85, 0x9d, 0x7f, 0xe8, 0x9d, 0xfd, 0xbc, 0x97, 0x1e, 0x1d,
-    0x58, 0x88, 0xe4, 0x33, 0x11, 0xbb, 0xf7, 0x61, 0x60, 0xe4, 0xeb, 0xef,
-    0x6a, 0x3f, 0x2a, 0xf3, 0xee, 0x72, 0xaf, 0x80, 0x2e, 0xa1, 0x57, 0xf9,
-    0x27, 0xcf, 0x6a, 0x3f, 0x2a, 0x8a, 0xbf, 0xb1, 0xb1, 0xd8, 0x59, 0x57,
-    0x30, 0xc1, 0x57, 0xf0, 0xc0, 0xce, 0x9b, 0x2a, 0xb1, 0x30, 0xa6, 0x91,
-    0x2c, 0x73, 0xa4, 0x3f, 0x99, 0x88, 0x53, 0x05, 0x7f, 0x46, 0x2e, 0x4d,
-    0x94, 0xc9, 0xfa, 0x54, 0x93, 0xfa, 0x98, 0xb7, 0xb1, 0xd3, 0x54, 0x2b,
-    0x5a, 0xeb, 0x93, 0xca, 0xb0, 0xbf, 0xb0, 0x74, 0x83, 0x87, 0x5e, 0xe8,
-    0x16, 0x75, 0x74, 0xf1, 0x78, 0x8a, 0x6f, 0xf3, 0x8e, 0x6b, 0x71, 0xa3,
-    0xaf, 0xe0, 0xe0, 0xbf, 0xb4, 0x75, 0xa2, 0x47, 0xb7, 0xa3, 0x0b, 0xf6,
-    0xf9, 0x96, 0x78, 0xeb, 0xff, 0xfe, 0xea, 0x6f, 0x02, 0xeb, 0xc1, 0xf0,
-    0xc3, 0x19, 0xed, 0x1d, 0x68, 0x3a, 0xfd, 0xd8, 0xe0, 0x18, 0x69, 0xf9,
-    0x7e, 0xc7, 0x5b, 0x46, 0xdf, 0xa1, 0x35, 0x7f, 0xb9, 0x97, 0x1c, 0x37,
-    0x16, 0x75, 0xff, 0xff, 0xb7, 0xb8, 0xe6, 0x5c, 0xe9, 0x36, 0xde, 0xe7,
-    0xdd, 0xa4, 0x04, 0xea, 0x84, 0x52, 0xe1, 0xb5, 0xff, 0xf9, 0xaa, 0x3e,
-    0xb3, 0x72, 0x4e, 0xb8, 0xf3, 0x23, 0xaf, 0xfc, 0xd8, 0xf6, 0xb3, 0xc9,
-    0xcb, 0x07, 0x59, 0xf1, 0x12, 0x8a, 0x2a, 0xd4, 0x27, 0x55, 0xd8, 0x66,
-    0x8c, 0x2d, 0x6f, 0x79, 0xff, 0x3a, 0xff, 0xfc, 0xef, 0x27, 0xef, 0xcc,
-    0x9c, 0x1e, 0x03, 0xfd, 0x34, 0x5f, 0x77, 0xfe, 0xd2, 0x0f, 0x32, 0xd8,
-    0x23, 0x47, 0x54, 0xc8, 0xa3, 0xf3, 0x2d, 0xfe, 0x89, 0xfb, 0x93, 0x42,
-    0xb9, 0xd6, 0x69, 0xd7, 0xff, 0xfb, 0xf4, 0xda, 0x9d, 0x85, 0xcd, 0x24,
-    0x1e, 0xc6, 0xe0, 0xeb, 0x7b, 0x0f, 0xc7, 0x42, 0x17, 0xde, 0x1c, 0x91,
-    0xd5, 0x07, 0x8e, 0x84, 0xf7, 0xfe, 0x14, 0x97, 0xbb, 0x9b, 0x4d, 0x1d,
-    0x7f, 0x44, 0x87, 0x32, 0x73, 0xaf, 0xf3, 0x86, 0x3f, 0x86, 0x34, 0x75,
-    0x74, 0xf7, 0x9c, 0xae, 0xfe, 0xe3, 0x56, 0xbf, 0x3e, 0x77, 0x8c, 0xf1,
-    0x00, 0xdf, 0xef, 0x7f, 0xf4, 0x65, 0xdc, 0x3c, 0x40, 0x37, 0x9f, 0x72,
-    0x3c, 0x40, 0x35, 0x87, 0xd4, 0x04, 0x2b, 0x9e, 0x47, 0x88, 0x06, 0xf9,
-    0xc7, 0x99, 0x1e, 0x20, 0x1b, 0xfc, 0x8d, 0xee, 0x7f, 0xfc, 0x1e, 0x20,
-    0x1b, 0xc8, 0x21, 0x3c, 0x40, 0x34, 0x14, 0x5b, 0xac, 0x8b, 0xa5, 0xdc,
-    0x10, 0x2c, 0xa1, 0xe2, 0x01, 0xbd, 0xb8, 0xf1, 0xe2, 0x01, 0xa3, 0xc4,
-    0x03, 0x7b, 0x8d, 0x3f, 0x3c, 0x40, 0x37, 0x42, 0xcf, 0x10, 0x0d, 0x04,
-    0xf9, 0x70, 0x5d, 0x0b, 0x2f, 0x91, 0x61, 0x83, 0xc4, 0x03, 0x7b, 0xce,
-    0xd3, 0xc4, 0x03, 0x7f, 0xe1, 0x79, 0x33, 0xd4, 0x6b, 0xec, 0xf1, 0x00,
-    0xdf, 0xfc, 0xfe, 0x04, 0xe8, 0x3e, 0xeb, 0xc8, 0xf1, 0x00, 0xdc, 0xe1,
-    0x3c, 0x40, 0x37, 0xf8, 0x5d, 0x8d, 0x6a, 0x3f, 0x3c, 0x40, 0x37, 0xe4,
-    0x51, 0xc7, 0xf3, 0xc4, 0x03, 0x72, 0x68, 0xf1, 0x00, 0xd6, 0xcf, 0x5b,
-    0xc6, 0x97, 0xff, 0xba, 0x9e, 0xf6, 0x6b, 0xe6, 0xd2, 0x16, 0x78, 0x80,
-    0x6f, 0xde, 0x18, 0xe6, 0x46, 0x88, 0x06, 0xef, 0xe0, 0xf1, 0x00, 0xb2,
-    0x6d, 0x2f, 0xc9, 0x0b, 0x70, 0x9e, 0x20, 0x1b, 0xe0, 0x38, 0xb4, 0xf1,
-    0x00, 0xde, 0x8d, 0xb4, 0xf1, 0x00, 0xdf, 0xfb, 0x39, 0xd0, 0x63, 0x07,
-    0xfd, 0x1e, 0x20, 0x1b, 0xf0, 0x1e, 0x52, 0x83, 0xc4, 0x03, 0x7e, 0x76,
-    0xf6, 0x39, 0x3c, 0x40, 0x35, 0x88, 0xb2, 0xea, 0x58, 0x0c, 0xee, 0xdf,
-    0xe7, 0x88, 0x06, 0xa4, 0xac, 0x94, 0x24, 0x59, 0x09, 0x66, 0x91, 0x24,
-    0x22, 0xfa, 0x69, 0xf9, 0x96, 0x8b, 0x7d, 0x0d, 0xa0, 0x17, 0xdf, 0xb3,
-    0xda, 0x7e, 0x4f, 0x10, 0x0d, 0xfe, 0x0c, 0x36, 0x6d, 0xc7, 0x8f, 0x10,
-    0x08, 0x4d, 0xa5, 0xed, 0xc3, 0x07, 0x88, 0x06, 0x9a, 0x7f, 0x3b, 0x50,
-    0xbf, 0xc0, 0x79, 0x4a, 0x3e, 0xac, 0xf1, 0x00, 0xdf, 0x20, 0xcb, 0x47,
-    0x88, 0x06, 0xfe, 0x79, 0xa5, 0x9c, 0xc8, 0xf1, 0x00, 0xd6, 0x23, 0x2f,
-    0xa4, 0x5f, 0xa0, 0x80, 0xb6, 0xff, 0xbb, 0x1a, 0x67, 0x40, 0xdf, 0xe7,
-    0x88, 0x06, 0xc8, 0x78, 0x80, 0x6e, 0x79, 0xc2, 0x7c, 0x9d, 0x48, 0xbb,
-    0x7f, 0x9e, 0x20, 0x1b, 0xf3, 0xfb, 0x49, 0xc9, 0xe2, 0x01, 0xbf, 0x90,
-    0x41, 0x2c, 0xd1, 0xe2, 0x01, 0xa8, 0x44, 0x80, 0x92, 0x78, 0xd2, 0xa1,
-    0x94, 0xb0, 0x18, 0x5a, 0xe4, 0x36, 0x10, 0xfe, 0x61, 0xed, 0xc2, 0x37,
-    0xa5, 0xae, 0x5b, 0xf9, 0x40, 0xa5, 0x6a, 0x5b, 0xaf, 0xa5, 0x09, 0xf1,
-    0xc2, 0x87, 0xec, 0x2f, 0xaf, 0x79, 0x18, 0x3c, 0x61, 0x37, 0x9d, 0xda,
-    0x68, 0x80, 0x59, 0x4c, 0x57, 0x98, 0x76, 0x5f, 0x28, 0xad, 0x02, 0xb3,
-    0xae, 0xe1, 0x39, 0xd7, 0xee, 0x03, 0x01, 0xe9, 0xd5, 0x07, 0x82, 0x83,
-    0x37, 0xff, 0x48, 0x71, 0xbd, 0x4f, 0xff, 0x04, 0xc7, 0x5d, 0xfc, 0x15,
-    0x65, 0x0a, 0xbd, 0xd8, 0x9c, 0xeb, 0x98, 0x60, 0xaa, 0x43, 0xdb, 0x57,
-    0x16, 0x98, 0x45, 0x81, 0xcb, 0xcb, 0x4d, 0x14, 0xc9, 0xe0, 0x5e, 0x40,
-    0x78, 0xeb, 0xff, 0xde, 0xd6, 0x28, 0x9b, 0xfb, 0xff, 0xf1, 0xc9, 0xd5,
-    0x3b, 0x3a, 0x62, 0x44, 0x01, 0x84, 0xd3, 0x69, 0x71, 0xc8, 0x9d, 0xb6,
-    0xa7, 0x20, 0xfe, 0x1c, 0x3e, 0x2d, 0xfa, 0x37, 0x7f, 0xf8, 0x7d, 0xc7,
-    0x93, 0x49, 0xf7, 0x38, 0x60, 0xeb, 0xfb, 0xdf, 0x78, 0x70, 0x8d, 0x1d,
-    0x7f, 0xb3, 0x9f, 0x79, 0xe5, 0xa3, 0xaf, 0x0f, 0x32, 0x3c, 0x60, 0x15,
-    0x88, 0xdc, 0x44, 0xdd, 0x99, 0xb9, 0x9d, 0xfa, 0x69, 0x46, 0xe7, 0x3a,
-    0xfa, 0x14, 0x85, 0x9d, 0x5b, 0x3c, 0xa5, 0x94, 0xdf, 0xfa, 0x5a, 0xf8,
-    0x38, 0xb8, 0xda, 0x87, 0x5f, 0xd2, 0x8d, 0xff, 0xf5, 0x67, 0x5f, 0xfd,
-    0xc0, 0x73, 0x5e, 0xc1, 0x96, 0x68, 0xeb, 0xe5, 0xc0, 0x3c, 0x75, 0x61,
-    0xf2, 0x3a, 0x1d, 0xdd, 0x7c, 0x45, 0xa0, 0xc2, 0x52, 0xff, 0xa1, 0xb0,
-    0xb4, 0x5f, 0xe8, 0x75, 0x6c, 0xfa, 0x38, 0x8c, 0x6f, 0xef, 0xac, 0x6d,
-    0x33, 0xa5, 0x5f, 0xfd, 0xf8, 0xa6, 0x73, 0xe9, 0xa4, 0xfb, 0x3a, 0xfa,
-    0x6e, 0xbc, 0xc7, 0x5f, 0x35, 0xf7, 0x39, 0xd7, 0xec, 0x9a, 0x51, 0xc9,
-    0xd7, 0xba, 0x93, 0x1d, 0x78, 0x62, 0x45, 0x5f, 0xf8, 0x7f, 0x4e, 0x2e,
-    0x20, 0x4a, 0x15, 0xce, 0xac, 0x3e, 0x17, 0x1a, 0xae, 0x53, 0x4f, 0xda,
-    0x2f, 0x48, 0xc4, 0x8b, 0xc5, 0x1c, 0x4f, 0xb5, 0x0a, 0xdf, 0x30, 0x89,
-    0x23, 0x5c, 0xe9, 0x2b, 0xc6, 0xfd, 0x7f, 0x73, 0xad, 0xee, 0x3c, 0x75,
-    0xfd, 0x2d, 0x29, 0xb7, 0x69, 0xd7, 0x87, 0xda, 0x3a, 0xfd, 0xa0, 0x08,
-    0x1a, 0x75, 0x41, 0xf8, 0x21, 0x70, 0x06, 0xef, 0xfe, 0xeb, 0x11, 0xbd,
-    0x63, 0x0f, 0xb5, 0x0e, 0xbf, 0x60, 0x43, 0x8b, 0x3a, 0xff, 0xf7, 0xb9,
-    0x6a, 0x77, 0x8e, 0x3d, 0xdf, 0xba, 0x3a, 0xe5, 0x4e, 0x8e, 0xbf, 0x40,
-    0xa7, 0x32, 0x3a, 0xff, 0xbb, 0x1b, 0x86, 0xa0, 0xb4, 0xeb, 0xef, 0x28,
-    0xfa, 0xd9, 0xee, 0x71, 0x13, 0x54, 0x93, 0x6f, 0xda, 0x32, 0xc9, 0x80,
-    0xa0, 0xc3, 0xb5, 0xfb, 0x88, 0x0b, 0xc0, 0x9d, 0x7f, 0xee, 0xe7, 0x13,
-    0x8a, 0x99, 0xcf, 0x8e, 0xbf, 0xec, 0x6f, 0x50, 0x3d, 0x02, 0x87, 0x5e,
-    0xf6, 0x34, 0xea, 0x59, 0xea, 0x68, 0xe6, 0xf4, 0x97, 0xf9, 0xd4, 0xa2,
-    0x35, 0x3f, 0x84, 0xaf, 0x88, 0xaf, 0xf9, 0x47, 0xf9, 0x0b, 0x14, 0x50,
-    0xeb, 0xff, 0x3e, 0x97, 0x09, 0xbd, 0xa3, 0x07, 0x5b, 0x4a, 0x1f, 0xbf,
-    0x4e, 0xaf, 0xfb, 0x3d, 0xe4, 0x53, 0xd8, 0xd3, 0xaf, 0xf0, 0x63, 0x9d,
-    0x67, 0x3e, 0x3a, 0xff, 0xa3, 0xc8, 0xd4, 0x0c, 0x78, 0xeb, 0x68, 0x28,
-    0xa2, 0xc3, 0x8d, 0x9a, 0x57, 0x29, 0x80, 0x7a, 0x19, 0x77, 0xfd, 0xe4,
-    0x9e, 0x39, 0xff, 0x70, 0x75, 0xed, 0x7b, 0x0e, 0xbb, 0x35, 0xf0, 0xf5,
-    0x7e, 0x9d, 0x5f, 0xfd, 0x9e, 0x4e, 0x64, 0x30, 0xaa, 0x55, 0xfc, 0x67,
-    0x5f, 0xb3, 0xdf, 0xbf, 0x8e, 0xa9, 0x1f, 0xbf, 0x1a, 0x85, 0xff, 0xfa,
-    0x3a, 0xf8, 0x31, 0xb5, 0x02, 0x07, 0xdc, 0x8e, 0xa9, 0x26, 0x41, 0xe8,
-    0x54, 0x71, 0x12, 0xd4, 0x2e, 0x68, 0x62, 0x62, 0x43, 0xf9, 0xe3, 0xae,
-    0x04, 0x73, 0xf7, 0xdd, 0x47, 0x91, 0xd7, 0xfd, 0xec, 0x19, 0x66, 0xbe,
-    0xac, 0xeb, 0xfe, 0xde, 0x0f, 0xce, 0xe7, 0x2c, 0x1d, 0x7f, 0xd2, 0x10,
-    0x7f, 0xf1, 0xab, 0xfc, 0xea, 0x9d, 0x1a, 0x32, 0x20, 0xc3, 0x9e, 0x4e,
-    0xef, 0xf8, 0x63, 0x39, 0xf6, 0x6e, 0x0e, 0xa8, 0x3f, 0x47, 0x3e, 0xbf,
-    0x3f, 0x00, 0x86, 0x0e, 0xbb, 0x5a, 0x3a, 0xf3, 0x0c, 0x30, 0x75, 0xdf,
-    0xb9, 0x4c, 0x97, 0xf5, 0xb3, 0xdb, 0xd1, 0xad, 0xff, 0xb3, 0x42, 0xea,
-    0x4c, 0x29, 0x31, 0xd7, 0xf7, 0xf1, 0x2e, 0xfd, 0xd1, 0xd7, 0x9f, 0xfc,
-    0x2a, 0xa4, 0x99, 0x72, 0xe1, 0x07, 0xd2, 0x2f, 0xcf, 0xb8, 0xcc, 0x2f,
-    0xa0, 0x28, 0x13, 0xaf, 0xc1, 0xda, 0x02, 0x73, 0xaf, 0xf3, 0x18, 0x39,
-    0xc1, 0x36, 0x75, 0xfc, 0x39, 0xcf, 0xff, 0x64, 0x75, 0x4c, 0x88, 0xb1,
-    0x28, 0xf1, 0x9d, 0xce, 0xb3, 0xaf, 0xf6, 0x70, 0xc6, 0x58, 0x61, 0x82,
-    0xaf, 0xd3, 0x46, 0x77, 0x47, 0x50, 0x9e, 0xff, 0xd3, 0x8b, 0xfc, 0xa9,
-    0x80, 0x37, 0xa9, 0xb3, 0xaf, 0x2d, 0xfc, 0x75, 0x4c, 0x8e, 0x8e, 0xba,
-    0x00, 0x8f, 0x81, 0xb5, 0xfc, 0x3c, 0x1d, 0x68, 0xb3, 0xaf, 0xd9, 0x34,
-    0xa2, 0x47, 0x5f, 0xd3, 0x86, 0x30, 0x42, 0x75, 0x42, 0xad, 0x79, 0x2a,
-    0x24, 0x2a, 0xde, 0x31, 0x8d, 0x20, 0x78, 0xb7, 0xe9, 0x3d, 0xe7, 0xfd,
-    0x0e, 0xbf, 0xe0, 0x88, 0x35, 0x93, 0xe4, 0xe7, 0x5e, 0x8d, 0x89, 0xd7,
-    0xfb, 0x02, 0x2f, 0xa4, 0x09, 0xd6, 0xe9, 0xd7, 0x80, 0xf3, 0x89, 0xe0,
-    0x68, 0xc2, 0xc9, 0xb4, 0x46, 0xf9, 0x6a, 0x96, 0x98, 0x4b, 0x8d, 0xaa,
-    0x61, 0x8d, 0x7f, 0xfb, 0x02, 0xeb, 0xce, 0x65, 0x9f, 0xe0, 0x4e, 0xbb,
-    0xae, 0x75, 0xd3, 0x68, 0xeb, 0xf6, 0x70, 0x41, 0x0e, 0x1a, 0xcf, 0xa2,
-    0xb7, 0xee, 0xe7, 0x3e, 0x83, 0xaf, 0xdc, 0x4f, 0x3f, 0xd9, 0x1d, 0x5f,
-    0x13, 0x08, 0x65, 0xd7, 0x0f, 0xc0, 0x4f, 0x7c, 0x1c, 0xeb, 0x9d, 0x7f,
-    0xf4, 0x60, 0xcb, 0xb8, 0x23, 0x0c, 0x1d, 0x64, 0xda, 0x28, 0x05, 0x03,
-    0xc4, 0x17, 0xfd, 0x81, 0xc1, 0x81, 0x04, 0x1d, 0x74, 0x30, 0x75, 0x4e,
-    0xec, 0x8a, 0xa5, 0x2f, 0x44, 0x32, 0xe5, 0x71, 0xf1, 0x48, 0x40, 0x36,
-    0x55, 0x67, 0x27, 0x29, 0x0b, 0xf9, 0x89, 0x37, 0x4f, 0x86, 0x5c, 0x70,
-    0x1d, 0x9c, 0x00, 0x75, 0x4f, 0xe1, 0x3c, 0x33, 0xcd, 0x9a, 0x8e, 0x7f,
-    0xd3, 0x84, 0xa0, 0x8d, 0xe7, 0x84, 0x7c, 0x3f, 0x4d, 0x38, 0x8d, 0x2f,
-    0xfb, 0x36, 0x31, 0xe9, 0x67, 0x4e, 0xbf, 0x87, 0xfc, 0x0b, 0xc8, 0xeb,
-    0xff, 0xf0, 0x3d, 0xa6, 0xf5, 0x06, 0x39, 0xd2, 0x2e, 0x0e, 0xbf, 0xcd,
-    0x1c, 0x94, 0x9f, 0x47, 0x5f, 0xce, 0xc6, 0x7f, 0xf7, 0xc7, 0x5f, 0x9e,
-    0x5f, 0x02, 0x87, 0x5e, 0x94, 0x7e, 0x75, 0xfb, 0xec, 0xd2, 0x85, 0x72,
-    0xaa, 0x13, 0x88, 0xc3, 0x65, 0x0b, 0x11, 0x53, 0x66, 0x3d, 0x30, 0xf1,
-    0x47, 0xd1, 0xcb, 0x34, 0xeb, 0xff, 0x94, 0x10, 0x3f, 0xdc, 0xd2, 0x40,
-    0x9d, 0x7b, 0x8d, 0x02, 0x75, 0x6c, 0xf8, 0x56, 0x87, 0x7f, 0xf7, 0x3e,
-    0x02, 0xfb, 0x08, 0x2e, 0x13, 0xaf, 0x94, 0xdb, 0xb0, 0x75, 0xbe, 0x9a,
-    0x20, 0x5b, 0x78, 0xd4, 0x0a, 0x57, 0x8d, 0xe3, 0x03, 0xf5, 0x88, 0x81,
-    0x45, 0xfb, 0xff, 0x27, 0x1f, 0x53, 0xeb, 0x3f, 0xff, 0x05, 0x5f, 0xf0,
-    0xfb, 0x40, 0xe7, 0xc8, 0xc1, 0xd7, 0xf8, 0x0f, 0xac, 0xc1, 0x50, 0xea,
-    0x83, 0xeb, 0xe9, 0xd5, 0xff, 0xe4, 0x53, 0xe0, 0xba, 0x9f, 0x35, 0xff,
-    0xf0, 0x75, 0xfe, 0x7e, 0xf3, 0xa8, 0x1f, 0x1d, 0x5a, 0x44, 0x17, 0x94,
-    0x2f, 0xf9, 0xbd, 0x49, 0xa5, 0x03, 0x23, 0xaf, 0xa5, 0xdc, 0x9c, 0xeb,
-    0xfe, 0x8e, 0x56, 0xfe, 0xce, 0x7c, 0x75, 0x72, 0x7b, 0x62, 0x45, 0x7f,
-    0xd0, 0xdf, 0x03, 0xbb, 0x86, 0x0e, 0xbb, 0x6e, 0x75, 0xff, 0xfd, 0x1b,
-    0xff, 0x38, 0x26, 0xb5, 0x82, 0xd7, 0x1f, 0xce, 0xad, 0x9f, 0x87, 0x45,
-    0x6f, 0xfe, 0xfd, 0xf9, 0xd6, 0x79, 0x16, 0xf2, 0x3a, 0xff, 0xff, 0xe0,
-    0x6b, 0xaf, 0x2d, 0x49, 0x3d, 0xf7, 0x71, 0xd8, 0xf6, 0x9f, 0x93, 0xaf,
-    0xd1, 0x83, 0xee, 0x33, 0xaf, 0xe4, 0xe7, 0xfd, 0xb8, 0x4e, 0xb2, 0xce,
-    0xa5, 0x9f, 0x37, 0x4a, 0x04, 0xba, 0xf4, 0x80, 0x13, 0xae, 0x7e, 0x7e,
-    0x1e, 0x53, 0x97, 0x56, 0xd3, 0x53, 0xd4, 0x64, 0x97, 0xff, 0xf6, 0x0c,
-    0xfa, 0xd4, 0x7f, 0x9d, 0x4d, 0xbb, 0x1e, 0x3a, 0x82, 0xb8, 0xc5, 0xcc,
-    0x28, 0xe6, 0x23, 0xdc, 0x24, 0xd6, 0x45, 0xd8, 0x54, 0xfe, 0x45, 0xe8,
-    0xe5, 0xd8, 0x2a, 0xa8, 0x5d, 0xac, 0x49, 0xd1, 0x2b, 0xff, 0xfe, 0xdc,
-    0xf8, 0x93, 0x3b, 0xcb, 0x50, 0xb0, 0xf6, 0x05, 0xa7, 0x5f, 0x07, 0xa0,
-    0x9c, 0xeb, 0xfc, 0x17, 0x96, 0x4e, 0x01, 0x3a, 0xd3, 0xc1, 0xea, 0xe1,
-    0x1d, 0xca, 0x9c, 0x3a, 0xb0, 0xf0, 0x1c, 0x9e, 0xfe, 0xf7, 0x18, 0x3b,
-    0x8d, 0x3a, 0xff, 0x6e, 0x3c, 0x9f, 0xc4, 0x8e, 0xbd, 0x38, 0xc8, 0xea,
-    0x54, 0x32, 0x3a, 0x21, 0xc5, 0x08, 0x97, 0x0c, 0x4e, 0xce, 0xe6, 0xb9,
-    0x60, 0xc3, 0xeb, 0x44, 0x1e, 0x30, 0x01, 0x95, 0xff, 0x95, 0x1f, 0x61,
-    0x6d, 0xeb, 0xf3, 0xf9, 0xd7, 0xfa, 0x53, 0x60, 0xbf, 0x70, 0xeb, 0xfd,
-    0xc1, 0xe6, 0x0c, 0x0c, 0xe7, 0x5f, 0x40, 0x15, 0x28, 0x75, 0xef, 0x7a,
-    0x0e, 0xbf, 0xc9, 0xb8, 0x9d, 0xf6, 0xd3, 0xad, 0xed, 0x9f, 0x8b, 0x92,
-    0x78, 0x6e, 0xff, 0xf6, 0xda, 0x39, 0xc0, 0x72, 0x37, 0x1a, 0x3a, 0xff,
-    0x3c, 0xdd, 0xc5, 0xe6, 0x8e, 0xac, 0x3f, 0xae, 0x09, 0x17, 0xf2, 0x29,
-    0xec, 0xc5, 0x9d, 0x7e, 0xc0, 0xa6, 0xf4, 0x75, 0xef, 0x7b, 0x93, 0xaf,
-    0xfe, 0xe5, 0xa9, 0xdf, 0x9c, 0x59, 0xd4, 0x59, 0xd5, 0xf9, 0xf3, 0x78,
-    0x76, 0xe0, 0x6c, 0xea, 0xd1, 0xb9, 0xe3, 0x23, 0xb4, 0x4e, 0x8e, 0x96,
-    0x21, 0x8b, 0x50, 0xaa, 0xef, 0x21, 0x4c, 0x90, 0xae, 0xe9, 0x1f, 0xa3,
-    0x15, 0xbf, 0xf0, 0xa7, 0xde, 0x73, 0x87, 0x31, 0xf4, 0xeb, 0xff, 0xc9,
-    0x9b, 0x0c, 0x31, 0x9d, 0x8e, 0x74, 0x75, 0xf7, 0xd8, 0xdf, 0xe7, 0x5c,
-    0xfb, 0x3a, 0xfe, 0xf2, 0x4e, 0xb8, 0x69, 0xd4, 0x13, 0xc2, 0xe8, 0xad,
-    0xd9, 0xc4, 0x75, 0xf7, 0xff, 0x46, 0x47, 0x5d, 0xfb, 0x89, 0xbc, 0xf0,
-    0xc5, 0x42, 0x22, 0x80, 0xbd, 0x77, 0x33, 0x1d, 0x7e, 0xfb, 0xef, 0xd7,
-    0x87, 0x52, 0xcf, 0x0b, 0xf1, 0x8b, 0xcd, 0x8d, 0x1d, 0x7f, 0xd2, 0x7d,
-    0xf8, 0x61, 0x7a, 0x3a, 0xff, 0x40, 0x63, 0x60, 0x8f, 0xce, 0xb9, 0x7a,
-    0x98, 0xfa, 0x56, 0x6f, 0x7f, 0xe8, 0x71, 0xcf, 0x79, 0x18, 0xf1, 0xd5,
-    0x09, 0x89, 0x61, 0x1a, 0x42, 0x10, 0x05, 0xf4, 0xaa, 0x5e, 0xbe, 0x84,
-    0x69, 0x4a, 0xec, 0xc5, 0x96, 0xa2, 0x4c, 0x93, 0xa8, 0x78, 0x7a, 0x37,
-    0x6b, 0xfa, 0x01, 0xca, 0x73, 0xc4, 0x75, 0xfb, 0x18, 0xce, 0x7c, 0x75,
-    0xb7, 0xf0, 0xf6, 0x50, 0xc6, 0xff, 0xf6, 0xb0, 0x40, 0xde, 0xe2, 0xe6,
-    0x76, 0x9d, 0x7f, 0x85, 0x4e, 0xc2, 0xd6, 0x27, 0x5f, 0xca, 0xe9, 0x1c,
-    0x40, 0xf1, 0xd7, 0xe8, 0x9b, 0x31, 0xa7, 0x56, 0x22, 0x29, 0x0c, 0xba,
-    0x65, 0x7f, 0xee, 0xe4, 0xc9, 0x30, 0x38, 0x81, 0xa3, 0xaf, 0x26, 0xd4,
-    0x3a, 0x90, 0xf7, 0xc5, 0x0e, 0xfd, 0x1c, 0x5d, 0x89, 0x8e, 0xa9, 0x1e,
-    0x56, 0x88, 0x2f, 0xfe, 0x04, 0xc9, 0xd8, 0xe6, 0x51, 0x34, 0x1d, 0x7e,
-    0x0b, 0x8c, 0x74, 0xeb, 0xfa, 0x51, 0xcf, 0xb3, 0xa7, 0x5f, 0xfe, 0xf6,
-    0x93, 0xf8, 0x96, 0xb3, 0x39, 0xf1, 0xd5, 0x31, 0xfb, 0xe8, 0xb6, 0xc9,
-    0xd4, 0x5f, 0xb1, 0x09, 0xcb, 0xff, 0xf6, 0xc1, 0xbd, 0xc0, 0xe2, 0x89,
-    0xde, 0xe7, 0xd3, 0xaf, 0xe1, 0x74, 0x0c, 0x09, 0xd7, 0xd3, 0xc7, 0x14,
-    0x1d, 0x7b, 0x80, 0x3a, 0x75, 0xff, 0xc8, 0xb4, 0xd7, 0x61, 0x36, 0x05,
-    0x73, 0xaa, 0x11, 0x0e, 0x84, 0x8e, 0x3d, 0x7f, 0x0e, 0x93, 0x84, 0x04,
-    0xeb, 0xc2, 0x8a, 0x1d, 0x7f, 0x79, 0x36, 0x9e, 0x01, 0xd6, 0x85, 0x9e,
-    0x3f, 0xd1, 0xbb, 0xf8, 0x1f, 0x7b, 0x9c, 0xe8, 0xeb, 0xff, 0xff, 0xf6,
-    0xe3, 0xc2, 0xed, 0x4d, 0x4c, 0x9b, 0x6c, 0x6b, 0xd1, 0xcc, 0x7d, 0xcd,
-    0x1d, 0x7f, 0xbb, 0x9c, 0xc6, 0xd1, 0x67, 0x5f, 0xff, 0xff, 0xfb, 0x5a,
-    0xcf, 0x75, 0xd7, 0xad, 0xed, 0x39, 0xf3, 0xba, 0x99, 0x93, 0x03, 0xd0,
-    0xc7, 0x30, 0x75, 0x42, 0x6a, 0x21, 0x84, 0x1b, 0x99, 0x5f, 0x7e, 0xfc,
-    0xe8, 0xeb, 0x98, 0x60, 0xea, 0xd1, 0xbb, 0x60, 0x8e, 0xfc, 0x9d, 0x7c,
-    0xe9, 0x4c, 0x9a, 0x2b, 0xfe, 0x07, 0xa0, 0x5a, 0xad, 0xfe, 0xb3, 0xaf,
-    0x76, 0x3f, 0x3a, 0x90, 0xf6, 0x9c, 0xfa, 0xff, 0x76, 0x3c, 0x05, 0x83,
-    0xc7, 0x54, 0x2f, 0xf6, 0x48, 0xa4, 0x30, 0xd3, 0xe6, 0x1a, 0xea, 0xe4,
-    0x53, 0x46, 0x09, 0xb2, 0xe5, 0xab, 0x76, 0x16, 0x0e, 0x5b, 0xfb, 0xa2,
-    0xa4, 0xa4, 0x63, 0x81, 0xd4, 0x24, 0x7d, 0x09, 0x0e, 0x22, 0x0b, 0xf4,
-    0xd1, 0x37, 0x60, 0xeb, 0xbe, 0xc1, 0xd7, 0x98, 0x61, 0x82, 0xaf, 0xa5,
-    0xec, 0x69, 0x4c, 0x97, 0xf7, 0xec, 0x0a, 0x7f, 0xa3, 0xdd, 0xfd, 0x5b,
-    0x3e, 0x51, 0x31, 0xa8, 0x47, 0x26, 0xca, 0x1e, 0x13, 0x77, 0x7b, 0x47,
-    0x5f, 0xf7, 0xcf, 0x76, 0x3d, 0xae, 0xa1, 0xd6, 0xd1, 0xd7, 0xfb, 0xdc,
-    0xcb, 0xb0, 0x33, 0x9d, 0x7f, 0xec, 0xe6, 0x49, 0x82, 0x38, 0x13, 0xaf,
-    0xd3, 0xac, 0x1c, 0xf8, 0xea, 0x84, 0x7c, 0xf2, 0x2d, 0xb3, 0xa1, 0x10,
-    0xd1, 0xa7, 0x8e, 0xef, 0xf8, 0x61, 0x8d, 0x20, 0xf3, 0x23, 0xae, 0x86,
-    0x9d, 0x42, 0x79, 0xbc, 0x0e, 0x2f, 0xa7, 0xfb, 0x0a, 0xe7, 0x5f, 0xed,
-    0x04, 0x61, 0x8c, 0x13, 0xab, 0x67, 0xb1, 0xe2, 0x7a, 0x84, 0xd0, 0x12,
-    0x14, 0x6e, 0xf7, 0x7f, 0x0f, 0x3a, 0x9b, 0x3c, 0x75, 0xfc, 0x9e, 0x17,
-    0xff, 0x47, 0x5f, 0xfe, 0xf4, 0xd9, 0xbc, 0x75, 0xc7, 0x50, 0x27, 0x5f,
-    0xc0, 0x5e, 0x77, 0x97, 0x3a, 0x94, 0x45, 0x08, 0x96, 0x69, 0x22, 0xff,
-    0xf2, 0x04, 0x5f, 0x91, 0xcf, 0x62, 0x7e, 0x75, 0xfd, 0x1e, 0xec, 0xb4,
-    0x03, 0xaf, 0x08, 0x1c, 0xeb, 0xfb, 0x70, 0x92, 0x7d, 0x1d, 0x68, 0x9c,
-    0xf1, 0x44, 0x6a, 0xfd, 0x3a, 0xba, 0x67, 0x27, 0x5f, 0x93, 0x51, 0x3a,
-    0xcf, 0x67, 0xed, 0xfa, 0x1f, 0x7f, 0x80, 0xf6, 0x7e, 0xdc, 0xf2, 0x3d,
-    0x9f, 0xb7, 0xc0, 0x96, 0x68, 0xf6, 0x7e, 0xd0, 0x4f, 0x40, 0x48, 0xaf,
-    0xd1, 0x9a, 0xc1, 0x3d, 0x9f, 0xb4, 0x7b, 0x3f, 0x6e, 0x7f, 0x1e, 0xcf,
-    0xd5, 0x96, 0xf6, 0x90, 0x9f, 0xc8, 0x12, 0x2f, 0xb3, 0x8d, 0x3f, 0x3d,
-    0x9f, 0xb4, 0x7b, 0x3f, 0x6e, 0xfe, 0x0f, 0x67, 0xed, 0xff, 0x67, 0xef,
-    0xbc, 0xe1, 0x81, 0x3d, 0x9f, 0xb7, 0xf6, 0x75, 0x34, 0x09, 0xcf, 0x67,
-    0xed, 0x7e, 0x8a, 0x31, 0x23, 0xd2, 0x35, 0xf6, 0xe7, 0x8f, 0x1e, 0xcf,
-    0xda, 0x3d, 0x9f, 0xb8, 0x6b, 0xee, 0x61, 0x83, 0xd9, 0xfb, 0x52, 0x56,
-    0x1c, 0x13, 0x4c, 0x84, 0x27, 0x30, 0x9a, 0xd9, 0x3a, 0xcc, 0x75, 0x0b,
-    0xaf, 0x2f, 0xb0, 0x4d, 0x7d, 0x92, 0x85, 0x0b, 0x67, 0xe9, 0x94, 0x48,
-    0x5f, 0xfb, 0x1a, 0x1c, 0xdb, 0x0f, 0xd9, 0x8e, 0xba, 0x53, 0x95, 0x7d,
-    0x33, 0xbe, 0xce, 0xa9, 0xd1, 0x73, 0xca, 0x10, 0x9f, 0xf1, 0x0b, 0xd6,
-    0xd7, 0x30, 0xde, 0x72, 0x0a, 0xff, 0x2f, 0x43, 0x9e, 0xcf, 0xce, 0xbf,
-    0xe6, 0xc7, 0xe1, 0x03, 0xee, 0x47, 0x5f, 0xf9, 0xde, 0x7c, 0x5b, 0x8f,
-    0x32, 0x3a, 0xfc, 0xc0, 0xba, 0x9a, 0xc3, 0xf6, 0x98, 0xe6, 0xa1, 0x1d,
-    0x0f, 0x0a, 0x8b, 0xd8, 0x16, 0x0e, 0xbf, 0xff, 0x4b, 0x71, 0xc1, 0xe6,
-    0x80, 0xf6, 0x16, 0xf3, 0x1d, 0x7f, 0xb8, 0x9f, 0x49, 0xa9, 0xb0, 0xea,
-    0xe5, 0x11, 0x9b, 0x57, 0xa8, 0x65, 0xa4, 0x4a, 0x53, 0x66, 0x19, 0xa4,
-    0x33, 0xd5, 0xcc, 0x36, 0x8f, 0xd7, 0x27, 0x9c, 0xea, 0x18, 0xc5, 0x74,
-    0x4c, 0x08, 0x54, 0x5f, 0xff, 0xf2, 0x75, 0xfb, 0x12, 0x67, 0x3f, 0x89,
-    0x68, 0x3d, 0x8d, 0x9d, 0x7f, 0xe5, 0x23, 0x91, 0x8e, 0xf4, 0x0d, 0x3a,
-    0xff, 0xf0, 0x77, 0x18, 0x39, 0x24, 0xee, 0x70, 0x3a, 0xfe, 0x17, 0x53,
-    0xaf, 0x23, 0xaf, 0x30, 0xc3, 0x05, 0x5e, 0xfb, 0x1f, 0x94, 0xc9, 0x7f,
-    0x7f, 0xcf, 0x2f, 0xbb, 0xce, 0x0f, 0xb3, 0xaf, 0xff, 0xdd, 0xc9, 0x7d,
-    0x11, 0xc9, 0xe6, 0x94, 0x6e, 0x73, 0xa8, 0x51, 0x27, 0xe3, 0xbb, 0xfe,
-    0xf3, 0x8e, 0x6b, 0x71, 0xa3, 0xaf, 0xa5, 0x1f, 0xf2, 0x75, 0xfd, 0xfc,
-    0x0e, 0x73, 0xe3, 0xae, 0x7f, 0xfe, 0x1e, 0x87, 0xd2, 0x3a, 0x74, 0x5c,
-    0x0c, 0x21, 0xaf, 0x70, 0x8d, 0x9d, 0x52, 0x56, 0x2c, 0x16, 0x6c, 0x3f,
-    0x5a, 0x47, 0xe9, 0x63, 0x0c, 0x1f, 0x43, 0x6b, 0x81, 0x35, 0xc9, 0x39,
-    0xd7, 0xf8, 0x5a, 0x14, 0xe1, 0x01, 0x3a, 0x82, 0x79, 0x20, 0x16, 0xb7,
-    0xe7, 0x5f, 0xf6, 0x42, 0xbf, 0xce, 0xbe, 0x6c, 0xeb, 0xfd, 0xff, 0x1a,
-    0x2c, 0x21, 0xc3, 0xaf, 0xfb, 0xdd, 0xcd, 0x7c, 0xf2, 0x4e, 0x75, 0x41,
-    0xf8, 0xa1, 0xb5, 0xff, 0x0a, 0x01, 0x53, 0xae, 0x38, 0xf1, 0xd5, 0x24,
-    0xc6, 0xe6, 0x11, 0xec, 0x2b, 0x04, 0x82, 0xf3, 0x0c, 0x30, 0x58, 0x84,
-    0x17, 0xcd, 0x77, 0x69, 0x62, 0x10, 0x32, 0x6b, 0x6f, 0x9f, 0x78, 0xc1,
-    0xd5, 0xb3, 0xe0, 0xe0, 0x7f, 0x79, 0x86, 0x18, 0x2c, 0x41, 0xea, 0x2c,
-    0x41, 0xe6, 0x4d, 0x6d, 0xe6, 0x18, 0x60, 0xeb, 0xda, 0x85, 0x0a, 0x64,
-    0xbf, 0xb2, 0xf1, 0x18, 0xad, 0x51, 0xf2, 0x45, 0xff, 0xdd, 0x89, 0x27,
-    0xb3, 0xad, 0x85, 0x9d, 0x50, 0x7e, 0xfc, 0x0d, 0x6f, 0xff, 0x67, 0x53,
-    0x7d, 0x7c, 0xd2, 0x3c, 0xe7, 0x5f, 0x47, 0xa1, 0x67, 0x52, 0xcf, 0x9f,
-    0xc8, 0xf7, 0xf3, 0x0e, 0x10, 0x3f, 0xd3, 0xaf, 0x85, 0x21, 0x43, 0xaf,
-    0x7d, 0x8f, 0xce, 0xa9, 0xcd, 0xf2, 0xc8, 0x2f, 0xcd, 0x8e, 0xc2, 0xca,
-    0xbf, 0x0b, 0x88, 0xe1, 0x57, 0x63, 0x4a, 0xb9, 0x86, 0x0a, 0xac, 0x3f,
-    0x6d, 0x13, 0x78, 0x8d, 0x81, 0x5b, 0xfc, 0x3f, 0x63, 0xfe, 0xe7, 0x11,
-    0x4c, 0x9b, 0xcb, 0xff, 0xd3, 0x87, 0x6e, 0xd1, 0xce, 0x1b, 0x4d, 0x1d,
-    0x50, 0x9f, 0xb6, 0x11, 0x23, 0x6b, 0xc3, 0x50, 0x09, 0x17, 0xff, 0x47,
-    0xfa, 0xcc, 0x0b, 0x8b, 0xa8, 0x75, 0xff, 0xf4, 0xb4, 0xc4, 0x6f, 0xb0,
-    0x9d, 0x81, 0x43, 0xaf, 0xff, 0xb4, 0x39, 0xcf, 0xef, 0xa7, 0xda, 0x73,
-    0xf9, 0xd5, 0xca, 0x27, 0x98, 0x4d, 0xae, 0xa6, 0x0a, 0xf0, 0xe0, 0xbf,
-    0xb5, 0xf4, 0x20, 0x19, 0x1d, 0x7f, 0x23, 0x43, 0x8f, 0xf9, 0xd7, 0xff,
-    0xfe, 0x89, 0xd9, 0xd7, 0xb5, 0xcf, 0xc0, 0xe0, 0x61, 0xf7, 0x83, 0xf9,
-    0xd7, 0xe5, 0xe9, 0x87, 0xe4, 0xeb, 0x68, 0x28, 0x99, 0xfa, 0xe1, 0x7f,
-    0x64, 0xd2, 0x4d, 0xe8, 0xea, 0x86, 0x4a, 0xa8, 0x61, 0x8f, 0x91, 0x9e,
-    0xa4, 0xa0, 0xcd, 0xca, 0x80, 0x78, 0xd4, 0x55, 0x25, 0x02, 0x5f, 0xa8,
-    0x62, 0xf8, 0xae, 0xf3, 0x0c, 0x30, 0x55, 0xf7, 0xee, 0x21, 0x29, 0x92,
-    0xfe, 0xfb, 0xa8, 0xf2, 0x3a, 0xfb, 0x7b, 0x45, 0x9d, 0x7b, 0x51, 0xe3,
-    0xaf, 0x0f, 0xb4, 0x86, 0xf2, 0x62, 0x1b, 0xdf, 0x14, 0xe3, 0x3a, 0xf7,
-    0x9c, 0x27, 0x56, 0xcd, 0xee, 0x88, 0xaf, 0xe6, 0xc7, 0xe9, 0xb5, 0x0e,
-    0xbf, 0xbe, 0xe6, 0xf3, 0x26, 0x3a, 0xfc, 0xfd, 0xf8, 0x18, 0x3a, 0xa4,
-    0x9d, 0x08, 0x4c, 0x71, 0x71, 0x1b, 0xc4, 0x87, 0x45, 0xde, 0x2e, 0xbf,
-    0x3e, 0xf7, 0x9c, 0x9d, 0x7f, 0xfb, 0xdd, 0x47, 0xff, 0x36, 0x18, 0x19,
-    0x1d, 0x7f, 0xfb, 0x9f, 0x9c, 0xff, 0x02, 0xd7, 0x9c, 0x5c, 0xea, 0x84,
-    0x5e, 0x61, 0x38, 0xa4, 0x5f, 0xa3, 0x5f, 0x46, 0x47, 0x5f, 0xff, 0xfc,
-    0xe9, 0xe4, 0xeb, 0x53, 0xe4, 0x93, 0xae, 0x3e, 0x96, 0x6f, 0x0e, 0xbd,
-    0xdc, 0xe2, 0x3a, 0xfd, 0xed, 0x7d, 0xd7, 0xce, 0xa2, 0x35, 0xdb, 0xef,
-    0xe6, 0x35, 0xd7, 0x6c, 0x1d, 0x7f, 0xff, 0xf2, 0x29, 0xcc, 0xbd, 0x83,
-    0xed, 0x7c, 0xd6, 0xb3, 0x78, 0x2f, 0x23, 0xaf, 0xfe, 0x64, 0x23, 0x00,
-    0x6e, 0x28, 0x9b, 0x3a, 0xec, 0x60, 0xeb, 0x64, 0x1e, 0xd6, 0x91, 0x2f,
-    0xf0, 0x7b, 0x13, 0x3b, 0xf2, 0x75, 0xee, 0xff, 0xc0, 0xea, 0xd9, 0xe9,
-    0x71, 0x19, 0xd4, 0x91, 0x3a, 0xef, 0x17, 0xff, 0x66, 0xff, 0x5a, 0x6b,
-    0xee, 0xa3, 0x0e, 0xbc, 0xea, 0xfa, 0x3a, 0xa4, 0x7c, 0x6e, 0x8b, 0x78,
-    0x38, 0xb3, 0xaf, 0xbf, 0xf6, 0x7e, 0x75, 0x21, 0xbe, 0xd8, 0xdd, 0xff,
-    0x37, 0xa3, 0x1c, 0xa4, 0x74, 0xea, 0x85, 0xd1, 0x69, 0x46, 0x3c, 0x12,
-    0xdc, 0x85, 0xaa, 0x22, 0x6c, 0xb5, 0xe3, 0x6a, 0x18, 0x42, 0x81, 0x7f,
-    0xe9, 0x05, 0xff, 0x9d, 0x02, 0x0f, 0x6a, 0x7c, 0x60, 0xeb, 0xf6, 0xb1,
-    0x48, 0xd1, 0xd7, 0xf2, 0xbe, 0x90, 0x79, 0x91, 0xd7, 0xfe, 0x7d, 0xf1,
-    0xa7, 0x71, 0xf9, 0xfc, 0xeb, 0xff, 0xf2, 0x7a, 0x17, 0x9c, 0xfa, 0x17,
-    0xf7, 0x6f, 0xf9, 0xd7, 0xc8, 0x2e, 0x13, 0xaf, 0xfb, 0x51, 0xbf, 0x43,
-    0x21, 0x43, 0xaa, 0x48, 0xae, 0x0a, 0xbe, 0x87, 0xef, 0xff, 0x69, 0x37,
-    0x12, 0xec, 0x4c, 0x20, 0x50, 0xeb, 0x9b, 0xc6, 0x75, 0xfc, 0xa7, 0xa3,
-    0xb1, 0xa3, 0xaf, 0xee, 0xa7, 0x3a, 0x7e, 0x4e, 0xa9, 0x1f, 0xa2, 0x0c,
-    0xfe, 0x5b, 0x7f, 0xe1, 0x79, 0xba, 0xfb, 0xda, 0x04, 0xeb, 0xc1, 0x41,
-    0x3a, 0xfe, 0x8f, 0x2a, 0x1e, 0x39, 0x3a, 0xbe, 0x1e, 0x52, 0x0d, 0x54,
-    0x95, 0x86, 0xe1, 0x3b, 0x4c, 0x12, 0x1d, 0xf3, 0x18, 0x6e, 0x17, 0xcb,
-    0x2f, 0x62, 0x10, 0xf7, 0xe4, 0x5a, 0xac, 0xab, 0xd5, 0xb3, 0xae, 0xff,
-    0xc7, 0x5f, 0x6f, 0x79, 0xa3, 0xae, 0xc9, 0x8e, 0xb4, 0xa7, 0x3c, 0xe7,
-    0x17, 0xfa, 0x43, 0x7e, 0x4f, 0x38, 0xe1, 0xd7, 0xed, 0x87, 0x30, 0x4e,
-    0xbf, 0xf9, 0x5d, 0x33, 0xb1, 0xc3, 0x5d, 0x8e, 0x4e, 0xbf, 0xb9, 0xd8,
-    0x39, 0xf4, 0x8e, 0xa7, 0x44, 0xee, 0x89, 0x40, 0x91, 0x7f, 0xd8, 0x3b,
-    0xcd, 0x62, 0x74, 0xeb, 0xff, 0xe9, 0x78, 0x71, 0xfc, 0x39, 0xef, 0x63,
-    0x07, 0x5e, 0x9f, 0x38, 0x1d, 0x7f, 0xfb, 0xda, 0xc9, 0xbb, 0x1c, 0x33,
-    0xbd, 0x83, 0xaf, 0xee, 0x85, 0x38, 0x40, 0x4e, 0xac, 0x3f, 0x97, 0x4b,
-    0xbe, 0xcf, 0x26, 0x8e, 0xbf, 0x95, 0x89, 0x85, 0x5b, 0x9c, 0x07, 0x56,
-    0x8f, 0x67, 0xc4, 0x15, 0x25, 0x54, 0x81, 0x86, 0x0b, 0x4b, 0xf9, 0x35,
-    0xda, 0x68, 0xc2, 0x5f, 0xcf, 0x37, 0x98, 0xce, 0x9d, 0x7f, 0xb4, 0x8a,
-    0x75, 0xc5, 0x0e, 0xbe, 0x4d, 0x60, 0x5c, 0xf3, 0x7c, 0x39, 0x7f, 0xe7,
-    0x57, 0xfc, 0x1a, 0x41, 0xe6, 0x47, 0x5f, 0xff, 0xde, 0xce, 0xa4, 0x79,
-    0x3f, 0x89, 0x32, 0xc3, 0x0c, 0x15, 0x7f, 0xba, 0x07, 0x58, 0x5d, 0x67,
-    0x50, 0xa2, 0x43, 0xcb, 0xd7, 0xc1, 0xcc, 0x50, 0xab, 0xe7, 0xfd, 0xfc,
-    0x75, 0xff, 0x6d, 0xdb, 0xf3, 0xb1, 0xf4, 0x4e, 0xbc, 0x08, 0xd9, 0xd7,
-    0x7b, 0x41, 0x3d, 0x69, 0x8e, 0xef, 0x48, 0x40, 0x68, 0x86, 0x6f, 0x76,
-    0x27, 0x3a, 0xf3, 0x0c, 0x30, 0x55, 0xec, 0x16, 0x94, 0xc9, 0x7f, 0x7f,
-    0xec, 0x9f, 0x02, 0xf2, 0x18, 0x9c, 0xea, 0xfc, 0xf9, 0xc4, 0xaa, 0xf9,
-    0xc5, 0x5a, 0xaa, 0x8e, 0xb9, 0x5a, 0xab, 0x53, 0xaf, 0xd9, 0xef, 0x02,
-    0x73, 0xad, 0x25, 0x6a, 0x79, 0x42, 0x45, 0x79, 0xd5, 0xe0, 0xeb, 0xf6,
-    0x07, 0xae, 0xae, 0x75, 0x42, 0xab, 0xc9, 0xc8, 0x82, 0x43, 0x8e, 0xfc,
-    0x97, 0xcc, 0x51, 0xb8, 0x51, 0x74, 0x89, 0xdd, 0x00, 0x5b, 0xc0, 0x76,
-    0xff, 0x42, 0xf1, 0x37, 0x34, 0x8e, 0xbd, 0xe4, 0x83, 0xae, 0xc1, 0x3a,
-    0x90, 0xd7, 0x00, 0x6a, 0xff, 0xfd, 0xd7, 0xde, 0xb1, 0x05, 0xfd, 0xa6,
-    0x20, 0x4e, 0xbf, 0x05, 0x37, 0x1e, 0x3a, 0xee, 0x7f, 0x3a, 0xfe, 0x5c,
-    0x6b, 0xf4, 0x69, 0xd7, 0xb5, 0x0a, 0x7e, 0x78, 0xba, 0x18, 0xbf, 0xc0,
-    0xcd, 0xff, 0xfa, 0x09, 0xd7, 0xfe, 0xc5, 0xa0, 0x77, 0x81, 0x75, 0x9d,
-    0x7d, 0x8b, 0xfa, 0x13, 0xab, 0xa7, 0xbe, 0x27, 0x97, 0xff, 0x90, 0x3d,
-    0xfb, 0xac, 0xdb, 0x5d, 0xda, 0x68, 0x83, 0x2f, 0x81, 0xdc, 0x69, 0xd5,
-    0x23, 0xf8, 0xe3, 0x57, 0xbd, 0xd0, 0x2b, 0x9d, 0x7f, 0xfb, 0x6f, 0xc3,
-    0x05, 0xbd, 0x4f, 0xfe, 0xf8, 0xea, 0x84, 0x48, 0xaa, 0x49, 0x40, 0x3f,
-    0x5c, 0xaa, 0x24, 0xe9, 0xae, 0xa1, 0x25, 0xe8, 0xca, 0xaf, 0xff, 0xf9,
-    0x79, 0xef, 0x3e, 0xc6, 0x39, 0x97, 0xdd, 0xfe, 0xb4, 0xd1, 0xd7, 0xfc,
-    0xb4, 0x63, 0x04, 0x3d, 0x83, 0xae, 0xe8, 0x0e, 0xbf, 0xff, 0x49, 0x04,
-    0x3d, 0xce, 0x7e, 0xb8, 0xf8, 0x42, 0x75, 0xe4, 0x61, 0x5c, 0xeb, 0xfd,
-    0x9c, 0x35, 0xef, 0x42, 0xce, 0xad, 0x9e, 0x9f, 0x47, 0xea, 0x13, 0x80,
-    0xc6, 0x94, 0x37, 0x98, 0x5b, 0x50, 0xa8, 0xbf, 0xdc, 0x79, 0xae, 0x3c,
-    0xdc, 0x1d, 0x7f, 0xfc, 0x30, 0xdf, 0x9b, 0xc4, 0x02, 0xa7, 0x38, 0xb0,
-    0xea, 0x92, 0xed, 0x30, 0x48, 0x31, 0x49, 0x25, 0x47, 0xea, 0x3c, 0xbf,
-    0x27, 0x71, 0x1b, 0xdf, 0x0a, 0x71, 0x41, 0xd6, 0x98, 0xeb, 0xfb, 0x58,
-    0x3f, 0xf1, 0xe1, 0xd6, 0xe1, 0x87, 0xc5, 0xf9, 0x16, 0x84, 0x6f, 0xf8,
-    0x1e, 0xfc, 0x0b, 0x8c, 0xf1, 0xd7, 0xff, 0x86, 0x7f, 0x93, 0x20, 0xe0,
-    0x70, 0x54, 0x3a, 0xfe, 0x4e, 0x78, 0xbb, 0x1e, 0x3a, 0xf7, 0xdc, 0x83,
-    0xaa, 0x11, 0x2e, 0xae, 0x96, 0xe6, 0x17, 0xff, 0xfe, 0x70, 0xe0, 0xbf,
-    0xb5, 0x9b, 0xff, 0xf8, 0xce, 0x7d, 0xa4, 0x3a, 0xf4, 0x6e, 0x63, 0xab,
-    0xe3, 0x69, 0xdb, 0x12, 0xd3, 0x27, 0x84, 0x10, 0x61, 0x0b, 0x92, 0xb6,
-    0xdb, 0x0b, 0xde, 0x4d, 0xd2, 0x5c, 0x77, 0x61, 0x42, 0xf3, 0xc0, 0xdf,
-    0xc3, 0x5c, 0x4d, 0xc1, 0x0d, 0x06, 0x0c, 0x78, 0xda, 0xef, 0x73, 0x3f,
-    0x03, 0xaf, 0xf7, 0x3f, 0x1b, 0xd8, 0xe7, 0x88, 0xeb, 0xfb, 0x18, 0xcc,
-    0x15, 0x0e, 0xbe, 0x5b, 0xe6, 0x8e, 0xa4, 0x3c, 0xc7, 0x2c, 0xbf, 0xfe,
-    0x6c, 0x6b, 0x50, 0xbc, 0xf2, 0x6b, 0xae, 0x75, 0xfe, 0x11, 0x89, 0x2e,
-    0x10, 0xeb, 0xfd, 0xe4, 0xe0, 0x9e, 0x94, 0x15, 0x65, 0x9d, 0x7f, 0x60,
-    0xa9, 0xb8, 0x65, 0x0f, 0x0f, 0xe9, 0x9d, 0x62, 0x60, 0xa8, 0x9b, 0xa7,
-    0x2b, 0xed, 0x83, 0x99, 0x1d, 0x7f, 0x86, 0x43, 0x8b, 0x86, 0x9d, 0x79,
-    0x61, 0xc3, 0xaa, 0x0f, 0xbb, 0x08, 0xdc, 0xc2, 0xf7, 0x18, 0x3c, 0x75,
-    0xff, 0xef, 0x42, 0xd0, 0x38, 0x2a, 0x76, 0x16, 0x75, 0x34, 0xf9, 0xfc,
-    0x3f, 0x7f, 0xfc, 0x9e, 0xec, 0x6a, 0x3b, 0x09, 0x3c, 0x28, 0x75, 0xfb,
-    0xde, 0xd3, 0xfe, 0x75, 0xfa, 0x17, 0xec, 0x69, 0xd7, 0x24, 0xe7, 0x54,
-    0x22, 0xc9, 0x13, 0xba, 0x51, 0xe2, 0x6b, 0xf3, 0x08, 0x1e, 0x24, 0x3a,
-    0xff, 0xbb, 0x12, 0x41, 0xc5, 0xc1, 0xd7, 0xfd, 0x9e, 0xee, 0x2c, 0x5f,
-    0xc7, 0x5f, 0xdc, 0x13, 0x7c, 0xc2, 0xb9, 0xd6, 0x10, 0x9f, 0x46, 0x1b,
-    0x5f, 0x97, 0x0d, 0x9c, 0x27, 0x5f, 0x4a, 0x16, 0xe7, 0x5f, 0xb7, 0xfa,
-    0xd3, 0x47, 0x5d, 0xed, 0x61, 0xf8, 0x39, 0x47, 0xd2, 0x0a, 0x84, 0x68,
-    0x82, 0x12, 0xd6, 0xd1, 0xd7, 0xf4, 0x4f, 0x82, 0x8a, 0x1d, 0x5b, 0x37,
-    0x9a, 0x10, 0xbf, 0xfa, 0x05, 0xfb, 0x1f, 0xb3, 0xbd, 0x68, 0xaa, 0x9d,
-    0x51, 0xb0, 0x63, 0x6e, 0xc6, 0x35, 0x90, 0xdf, 0xe7, 0x0e, 0xb5, 0x1b,
-    0x91, 0xd7, 0x02, 0x73, 0xaf, 0xf7, 0x32, 0xe7, 0x49, 0xe8, 0x3a, 0xf2,
-    0x73, 0xa3, 0xab, 0x0f, 0x41, 0x0d, 0x29, 0x11, 0x0f, 0xd6, 0x7b, 0xb1,
-    0xa7, 0x5e, 0xde, 0x68, 0xef, 0x16, 0xb7, 0xff, 0xc1, 0xf8, 0xe9, 0x9a,
-    0x89, 0xf0, 0x51, 0x43, 0xaf, 0xf6, 0xd7, 0x1c, 0xf9, 0xda, 0x75, 0x62,
-    0x20, 0x91, 0x3e, 0xf9, 0x17, 0x13, 0x1d, 0x7d, 0x93, 0x82, 0x47, 0x5a,
-    0x26, 0x3c, 0x36, 0x08, 0x6e, 0xc6, 0x0e, 0xa2, 0xaf, 0xed, 0x7d, 0x8d,
-    0xc2, 0xca, 0xa2, 0xa8, 0xaa, 0x2a, 0x8a, 0xa9, 0x1f, 0x02, 0x05, 0x7e,
-    0x5c, 0x00, 0xae, 0x30, 0xae, 0x20, 0xab, 0xbb, 0x85, 0x5f, 0xce, 0xfe,
-    0x9a, 0x16, 0x57, 0xc2, 0xd6, 0xca, 0x92, 0xa8, 0xaa, 0x2a, 0xa4, 0x5a,
-    0x20, 0x55, 0x15, 0x45, 0x51, 0x54, 0x55, 0x15, 0x45, 0x54, 0xe6, 0xf0,
-    0x21, 0x48, 0x15, 0xf8, 0x56, 0x82, 0xb8, 0x05, 0x51, 0x54, 0x55, 0x48,
-    0xb4, 0xd0, 0x55, 0x15, 0x45, 0x51, 0x54, 0x55, 0x48, 0xd4, 0x7e, 0x15,
-    0xe0, 0xae, 0x20, 0xaa, 0x2a, 0x8a, 0xa2, 0xa8, 0xaa, 0x9c, 0xd4, 0x28,
-    0x15, 0xb0, 0xae, 0x85, 0x59, 0x42, 0xa8, 0xaa, 0x2a, 0x8a, 0xa2, 0xa8,
-    0x26, 0xa3, 0x90, 0xaf, 0xc2, 0x80, 0x15, 0x45, 0x51, 0x54, 0x55, 0xfb,
-    0xb1, 0xfe, 0xb0, 0xaa, 0x2a, 0xa4, 0x79, 0xed, 0x0a, 0xe8, 0x53, 0x85,
-    0x7e, 0x4f, 0x66, 0x95, 0x45, 0x51, 0x54, 0x55, 0x15, 0x52, 0x35, 0x1c,
-    0x85, 0x20, 0x57, 0x00, 0xaa, 0x2a, 0x8a, 0xa2, 0xa8, 0xaa, 0x91, 0xa8,
-    0x08, 0x57, 0x42, 0x84, 0x2a, 0xdd, 0x2a, 0x8a, 0xa2, 0xad, 0x22, 0xa8,
-    0xae, 0x4b, 0x0a, 0x2a, 0x8a, 0xa2, 0xa8, 0xaa, 0x9c, 0xf9, 0xa4, 0x14,
-    0xa0, 0xd3, 0x46, 0xa6, 0x0a, 0xfc, 0x2b, 0xc1, 0x56, 0xc2, 0xa8, 0xaa,
-    0x2a, 0xd2, 0x2a, 0x8a, 0xe4, 0xb0, 0xa2, 0xa8, 0xaa, 0x83, 0xd2, 0x90,
-    0x52, 0x0d, 0x6c, 0x69, 0x61, 0x54, 0x55, 0x15, 0x45, 0x51, 0x54, 0x55,
-    0x41, 0xb2, 0xe4, 0x2b, 0x61, 0x4b, 0x0a, 0x10, 0xaa, 0x2a, 0x8a, 0xa2,
-    0xab, 0x65, 0xf6, 0x82, 0xbc, 0x15, 0x45, 0x51, 0x54, 0x55, 0x2c, 0xbe,
-    0x10, 0xaf, 0x05, 0x59, 0x65, 0x51, 0x54, 0x55, 0x7e, 0x5a, 0x00, 0x2a,
-    0x8a, 0xa2, 0xa8, 0xaa, 0x2a, 0xa0, 0xd4, 0x4c, 0x15, 0xd0, 0xa0, 0x05,
-    0x54, 0x2f, 0xd4, 0xce, 0xe3, 0x23, 0xd0, 0x94, 0x62, 0xdb, 0x5b, 0x39,
-    0x48, 0x46, 0x75, 0x73, 0xd9, 0x8e, 0x77, 0x08, 0xc5, 0xa4, 0xf4, 0xe1,
-    0xd9, 0x7f, 0x3a, 0x17, 0x6d, 0x33, 0xf9, 0x84, 0x0f, 0x3c, 0x19, 0x58,
-    0x4b, 0xe3, 0x2c, 0xfa, 0x49, 0xc4, 0x93, 0x7e, 0x90, 0xc6, 0x68, 0xa6,
-    0x53, 0x56, 0xbc, 0x90, 0xb2, 0xaf, 0x91, 0xaf, 0xb3, 0xaf, 0x20, 0x70,
-    0xeb, 0x33, 0xca, 0x23, 0x76, 0x73, 0xd1, 0xaf, 0x10, 0x5a, 0x38, 0x32,
-    0x91, 0xfe, 0xd2, 0x80, 0xaf, 0xf7, 0x51, 0x80, 0xee, 0x27, 0x3a, 0xf2,
-    0x70, 0x54, 0x9d, 0x5c, 0xa2, 0x3a, 0x63, 0x9f, 0x1a, 0x5f, 0xb3, 0x26,
-    0x7f, 0xa7, 0x5d, 0xfc, 0x1d, 0x7f, 0x6d, 0xc7, 0xec, 0x7e, 0x75, 0xcf,
-    0xb3, 0xac, 0x87, 0x34, 0xb5, 0xb3, 0x4e, 0xb2, 0xce, 0xbb, 0x8d, 0x94,
-    0x44, 0xbe, 0xc5, 0xba, 0x86, 0xe3, 0xdf, 0x44, 0x2f, 0xfb, 0xb0, 0xbc,
-    0x9a, 0x06, 0x73, 0xaf, 0xfe, 0xf8, 0xed, 0x0f, 0x63, 0xfc, 0x1f, 0xce,
-    0xbb, 0xf8, 0x3a, 0xb0, 0xf7, 0x3f, 0x46, 0xac, 0x4c, 0x43, 0xf5, 0xa0,
-    0x42, 0x52, 0xff, 0xe1, 0x18, 0x9c, 0x71, 0x38, 0x47, 0x19, 0xd7, 0xa3,
-    0x9d, 0x1d, 0x4e, 0x7c, 0x3a, 0x45, 0xbc, 0xfb, 0x83, 0xaf, 0xc9, 0xc6,
-    0xe3, 0xf9, 0xd5, 0x23, 0xc3, 0x58, 0xd5, 0xff, 0x7d, 0x70, 0xeb, 0x17,
-    0x0a, 0xe7, 0x5e, 0xce, 0x58, 0x3a, 0xf7, 0x3f, 0xe6, 0xcf, 0x64, 0x4f,
-    0x2f, 0xb8, 0x66, 0xe4, 0x75, 0xe0, 0xb8, 0x9d, 0x48, 0x6f, 0x5c, 0x8e,
-    0xff, 0xfa, 0x3e, 0x3e, 0xf6, 0xff, 0xc3, 0x2c, 0x30, 0xc1, 0xd5, 0x09,
-    0xb0, 0x3b, 0xde, 0x9c, 0x40, 0x3f, 0x4a, 0x86, 0xe1, 0x16, 0x08, 0x27,
-    0x84, 0x34, 0xa3, 0x25, 0x0c, 0x27, 0x72, 0x12, 0x6d, 0x86, 0xa7, 0x27,
-    0x69, 0x29, 0x81, 0x5d, 0x16, 0x68, 0x5c, 0xec, 0xdd, 0x70, 0xac, 0xeb,
-    0x23, 0xd2, 0xbf, 0xbf, 0x32, 0x18, 0xf3, 0xf5, 0x09, 0x7f, 0x47, 0x89,
-    0x7c, 0x82, 0xd8, 0x3a, 0xfe, 0x61, 0xf7, 0xb7, 0xe4, 0xeb, 0xff, 0xf6,
-    0xb7, 0xb4, 0x9b, 0x5b, 0x8f, 0x23, 0x50, 0x27, 0x52, 0xd1, 0x44, 0x23,
-    0xec, 0x17, 0x5f, 0x2f, 0xd1, 0xa3, 0xaf, 0xf7, 0xa0, 0x0d, 0xea, 0x6c,
-    0xeb, 0xfb, 0x1b, 0xd8, 0xe6, 0x47, 0x5f, 0xcb, 0xd2, 0x29, 0xe6, 0x0e,
-    0xbf, 0x47, 0x3d, 0x89, 0x1d, 0x42, 0x8b, 0x5f, 0x19, 0x7d, 0x2d, 0xe2,
-    0x2f, 0xbb, 0x9f, 0x1d, 0x7e, 0xf3, 0x88, 0x30, 0xeb, 0xfd, 0xac, 0x5a,
-    0x7b, 0xae, 0x75, 0xa3, 0x0f, 0xb4, 0x45, 0xfc, 0x4b, 0x7d, 0x2f, 0x8b,
-    0x43, 0xaf, 0x71, 0x6e, 0x0e, 0xbf, 0xdb, 0x49, 0x87, 0x38, 0x39, 0xd7,
-    0x73, 0xaf, 0x87, 0xe9, 0x04, 0x7b, 0x1e, 0xb9, 0xf8, 0x1d, 0x7f, 0x48,
-    0x52, 0x5d, 0xc3, 0xaf, 0xd3, 0xa6, 0xe2, 0x47, 0x54, 0xc7, 0xd3, 0xb1,
-    0x71, 0x2b, 0xbe, 0xc0, 0xa2, 0x87, 0x5f, 0xfe, 0x74, 0xf4, 0x7b, 0x5d,
-    0x74, 0xe8, 0x0e, 0xbf, 0xf7, 0x63, 0x7f, 0x8e, 0x30, 0xff, 0x9d, 0x7b,
-    0x32, 0x63, 0xad, 0x9d, 0x3d, 0xaf, 0xcf, 0xef, 0xe0, 0x6c, 0x0b, 0x71,
-    0x3a, 0xf9, 0x71, 0x93, 0x9d, 0x7e, 0xce, 0x03, 0x1c, 0x9d, 0x48, 0x79,
-    0x3a, 0x21, 0xbe, 0x81, 0xf3, 0x4e, 0xb4, 0x62, 0x79, 0xfb, 0x2f, 0xe9,
-    0x08, 0xc2, 0x87, 0x45, 0x1e, 0x75, 0xe3, 0x21, 0xbf, 0xb5, 0x8b, 0x4e,
-    0xc1, 0xd7, 0xb9, 0x96, 0x8e, 0xae, 0x4f, 0x23, 0x65, 0x77, 0xb5, 0xfb,
-    0x07, 0x54, 0x1e, 0x0e, 0x11, 0xdf, 0x01, 0xf7, 0x23, 0xaf, 0xa0, 0x0a,
-    0x9d, 0x15, 0x7e, 0x93, 0x2c, 0x30, 0xc1, 0xd4, 0x27, 0xa2, 0x02, 0x5b,
-    0xe7, 0xf2, 0xfc, 0x75, 0x05, 0x16, 0x98, 0xe5, 0xf9, 0x0d, 0x42, 0xf6,
-    0x66, 0x18, 0x24, 0x35, 0x97, 0x0a, 0xe7, 0x85, 0x37, 0xf2, 0x9d, 0x46,
-    0x1f, 0x20, 0x86, 0xa5, 0xe5, 0x65, 0x57, 0xaa, 0x0e, 0xbd, 0x21, 0x73,
-    0xad, 0xca, 0xb2, 0x78, 0xb0, 0x57, 0x7f, 0x46, 0xe7, 0x8d, 0xce, 0x75,
-    0xf8, 0x1f, 0xe0, 0xb4, 0xeb, 0xdb, 0x89, 0x8e, 0xbe, 0x41, 0x79, 0x8e,
-    0xbf, 0xde, 0xcf, 0xb1, 0x32, 0x68, 0xea, 0x92, 0x31, 0x76, 0x5c, 0xb2,
-    0x7e, 0x8e, 0x70, 0x20, 0xbf, 0xe8, 0x4e, 0xc2, 0xe7, 0xc6, 0x0e, 0xbf,
-    0xa3, 0xa9, 0x3b, 0x89, 0xd7, 0xfd, 0x38, 0xe4, 0xbb, 0x9f, 0xe8, 0xeb,
-    0xff, 0x60, 0xf3, 0x2d, 0x6c, 0x11, 0xf9, 0xd7, 0xec, 0xf6, 0xb1, 0x43,
-    0xa9, 0x0f, 0x99, 0x67, 0xf7, 0x83, 0x1c, 0x0e, 0xbf, 0xfe, 0xc1, 0x18,
-    0x60, 0x23, 0x1c, 0xc9, 0x04, 0xeb, 0xff, 0xcf, 0xf2, 0x69, 0x46, 0xe7,
-    0xf8, 0xc6, 0x74, 0xea, 0x0a, 0x2e, 0x7a, 0x3a, 0x29, 0x97, 0xfc, 0xbe,
-    0xe7, 0xb0, 0x1b, 0x9c, 0xeb, 0xfe, 0x8f, 0x66, 0xda, 0xee, 0xd3, 0x45,
-    0xf1, 0x7e, 0xcd, 0xc7, 0x32, 0x3a, 0xf7, 0x61, 0x6d, 0x3e, 0xaf, 0x21,
-    0xdf, 0xff, 0x85, 0xbf, 0x3b, 0x09, 0xb4, 0x5a, 0x71, 0xc2, 0xce, 0xbc,
-    0xfb, 0x9c, 0xd1, 0x7f, 0xd4, 0x22, 0xcf, 0x0c, 0xda, 0xaf, 0x7f, 0xff,
-    0xba, 0xfa, 0x48, 0xd7, 0xcf, 0x77, 0x17, 0x8d, 0x7d, 0x9d, 0x74, 0x71,
-    0x1d, 0x7d, 0xad, 0x3a, 0xce, 0xae, 0xa2, 0x67, 0xf6, 0x0f, 0x0c, 0x5f,
-    0xff, 0xd2, 0x70, 0xb7, 0xa8, 0x39, 0xc1, 0xe5, 0xa4, 0x09, 0xd7, 0xfd,
-    0x0b, 0xf8, 0x1c, 0xcf, 0xf4, 0x75, 0xff, 0x26, 0x08, 0x54, 0x4c, 0xd9,
-    0xd4, 0x87, 0xe1, 0xc4, 0x75, 0x7f, 0x3e, 0xf9, 0x96, 0x78, 0xeb, 0xff,
-    0x7b, 0x49, 0xbf, 0x08, 0x1e, 0x47, 0x5f, 0xfe, 0x5c, 0x71, 0xe0, 0x07,
-    0x33, 0x84, 0x72, 0x75, 0xff, 0xa3, 0x37, 0x9b, 0xfd, 0x69, 0xa3, 0xaf,
-    0x3f, 0x3c, 0x47, 0x5f, 0xcf, 0xed, 0x46, 0x4e, 0x75, 0x42, 0x67, 0xd8,
-    0x5a, 0x87, 0xa2, 0x99, 0xc0, 0xf5, 0x81, 0xfb, 0xfe, 0x04, 0x2f, 0x58,
-    0xb8, 0x57, 0x3a, 0xff, 0xed, 0x60, 0xfb, 0x5f, 0x78, 0x46, 0x72, 0x75,
-    0xff, 0x31, 0xf6, 0x7d, 0x62, 0xe1, 0x5c, 0xeb, 0xc9, 0xd4, 0x3a, 0xfa,
-    0x5b, 0x0c, 0x8e, 0xbe, 0x5f, 0x92, 0x73, 0xab, 0x0f, 0x11, 0x08, 0xaf,
-    0xfe, 0xe1, 0xe5, 0x20, 0x65, 0x9d, 0x45, 0x9d, 0x74, 0xfe, 0x3a, 0xff,
-    0x70, 0xeb, 0xca, 0x30, 0x4e, 0xa8, 0x3c, 0x9c, 0x17, 0xbf, 0xb1, 0x8f,
-    0xbd, 0x7f, 0x1d, 0x7f, 0xfe, 0xf7, 0xd9, 0x47, 0x04, 0x1f, 0xf6, 0x90,
-    0xbc, 0x2a, 0xfb, 0xbf, 0x79, 0xf1, 0xd7, 0xec, 0x5e, 0x27, 0x03, 0xaf,
-    0x4f, 0x32, 0xb9, 0xd5, 0x3a, 0x3c, 0xf0, 0xbd, 0xaa, 0xe8, 0x4a, 0x02,
-    0x7b, 0xbd, 0x87, 0x5f, 0xb6, 0x93, 0xba, 0xcd, 0x30, 0x9d, 0xf7, 0x81,
-    0x0e, 0x69, 0x84, 0xee, 0xfe, 0x0d, 0x40, 0x9d, 0xfe, 0x17, 0x53, 0xd1,
-    0xbf, 0xcd, 0x40, 0x9d, 0xfe, 0xd6, 0x75, 0x34, 0x09, 0xcd, 0x30, 0x9d,
-    0xd8, 0x13, 0x4c, 0x27, 0x73, 0x0c, 0x1e, 0x61, 0x3a, 0xc4, 0xd2, 0xf9,
-    0x34, 0x42, 0xd5, 0x91, 0xe9, 0x03, 0x82, 0x03, 0x04, 0x56, 0xf1, 0x66,
-    0x13, 0x32, 0x7c, 0xf6, 0x4e, 0x53, 0xf7, 0x62, 0x3c, 0x7a, 0x85, 0xcc,
-    0xf4, 0x3f, 0xea, 0xf3, 0x90, 0x0c, 0x23, 0xb5, 0x18, 0x9f, 0xa5, 0x20,
-    0x5e, 0x1f, 0xd6, 0x75, 0xff, 0x40, 0x3c, 0x29, 0xc3, 0xea, 0xce, 0xbc,
-    0x39, 0xac, 0x3d, 0x7d, 0x8e, 0x5e, 0x0f, 0xf3, 0x1d, 0x50, 0xcc, 0xe4,
-    0x9e, 0x13, 0xe1, 0x86, 0xd6, 0x17, 0xb6, 0x35, 0x64, 0x86, 0x3c, 0xc6,
-    0x3b, 0x86, 0x57, 0x63, 0x62, 0x15, 0x7d, 0x1d, 0x7a, 0x74, 0x5b, 0x84,
-    0x33, 0x3e, 0x98, 0xdf, 0x83, 0x9b, 0x45, 0x0e, 0xbf, 0xbb, 0x1f, 0x47,
-    0x9f, 0xce, 0xbf, 0x7b, 0x26, 0x45, 0x9d, 0x7e, 0x8e, 0x7f, 0xfe, 0x0e,
-    0xa8, 0x3d, 0x01, 0x27, 0xbf, 0x47, 0x08, 0x1f, 0x1d, 0x7e, 0x4e, 0x1e,
-    0x49, 0xce, 0xbf, 0x3c, 0xbd, 0x8d, 0x3a, 0xfc, 0x39, 0xf7, 0x26, 0x3a,
-    0xff, 0xf6, 0x7f, 0xae, 0xa7, 0xce, 0x65, 0x19, 0x39, 0xd7, 0xfd, 0xd7,
-    0x5f, 0x52, 0x39, 0x91, 0xd7, 0xf7, 0xd1, 0x97, 0x1b, 0xce, 0x75, 0x49,
-    0x16, 0xe8, 0x9b, 0xf9, 0xc5, 0x4e, 0x9d, 0x28, 0x48, 0x1a, 0x4f, 0xb2,
-    0x91, 0x26, 0xf4, 0x37, 0xef, 0xfd, 0x8f, 0xd9, 0x90, 0x7b, 0x9c, 0x9d,
-    0x7f, 0x7f, 0x34, 0xa3, 0xda, 0x3a, 0xff, 0xff, 0xfd, 0x9d, 0xc1, 0xff,
-    0x07, 0xdd, 0xce, 0xc6, 0x4c, 0x9b, 0x9b, 0xa9, 0xcf, 0x8e, 0xbe, 0x18,
-    0xc6, 0x0e, 0xbe, 0x8e, 0x74, 0xe7, 0x54, 0x36, 0x4b, 0xb3, 0xa6, 0x04,
-    0xe3, 0x29, 0xa1, 0xe9, 0x0f, 0x25, 0x72, 0x77, 0x94, 0x4a, 0x2b, 0xbe,
-    0x3d, 0x01, 0x7f, 0x08, 0x41, 0x7d, 0x20, 0xbf, 0xfe, 0x41, 0xc5, 0xc7,
-    0xd1, 0x04, 0x87, 0x16, 0x75, 0xff, 0x05, 0x30, 0x41, 0x2c, 0xd1, 0xd7,
-    0xfd, 0xd4, 0x97, 0x5e, 0x48, 0xb3, 0xaf, 0xfd, 0xa4, 0x1e, 0x65, 0xe4,
-    0xd2, 0x1d, 0x58, 0x7e, 0x9e, 0x37, 0xbf, 0x69, 0x70, 0x18, 0x3a, 0xa4,
-    0x99, 0xf6, 0x26, 0xae, 0x15, 0x5e, 0x21, 0xbf, 0xee, 0xc4, 0x90, 0x44,
-    0x1c, 0x9d, 0x7f, 0xd1, 0x9e, 0xfb, 0xff, 0xf1, 0xc9, 0xd6, 0xde, 0x1f,
-    0x9a, 0xcd, 0xef, 0xff, 0xff, 0x75, 0xd3, 0xd2, 0x00, 0xfb, 0x5d, 0x79,
-    0x7d, 0x18, 0x6e, 0xe2, 0x47, 0x5f, 0xfb, 0x5f, 0x7c, 0x82, 0x09, 0x66,
-    0x8e, 0xa5, 0x74, 0x5b, 0x75, 0xde, 0xff, 0xfe, 0xce, 0x73, 0x4e, 0x3d,
-    0x48, 0xf7, 0x40, 0xeb, 0x3a, 0xa1, 0x35, 0xb7, 0x86, 0xe8, 0x93, 0x5f,
-    0xc2, 0x05, 0xa7, 0x60, 0xeb, 0xff, 0xf3, 0x8f, 0x9d, 0xfa, 0x31, 0xed,
-    0x31, 0x9d, 0x3a, 0xff, 0xd3, 0xb8, 0xeb, 0xdd, 0x48, 0xd1, 0xd7, 0xfd,
-    0x1f, 0xe8, 0x20, 0x7d, 0xc8, 0xeb, 0xdb, 0xd6, 0x8f, 0x10, 0x1d, 0xf3,
-    0x5d, 0xda, 0x68, 0x80, 0xd9, 0x35, 0x37, 0xf6, 0xe3, 0xb1, 0xf3, 0x24,
-    0x8a, 0x0d, 0xb1, 0x53, 0xa6, 0x47, 0xf6, 0x1b, 0xb5, 0xfa, 0x73, 0xfe,
-    0x8d, 0xd6, 0xf7, 0x08, 0xe9, 0xd5, 0x8a, 0x84, 0x92, 0x3c, 0xaf, 0xa5,
-    0x77, 0xba, 0xea, 0xe7, 0x5f, 0x47, 0xfc, 0x78, 0x75, 0x7e, 0x78, 0x5e,
-    0x1e, 0xbe, 0x1f, 0x7e, 0x03, 0xaf, 0xcb, 0x56, 0x55, 0x95, 0x65, 0x58,
-    0x3a, 0xff, 0xfe, 0x96, 0x69, 0x37, 0xb4, 0x5f, 0xdf, 0x77, 0x18, 0xf1,
-    0xd5, 0x88, 0xbb, 0x42, 0x27, 0x3c, 0xbf, 0xfd, 0x2c, 0xe6, 0x5f, 0x63,
-    0xf6, 0x58, 0x61, 0x82, 0xaf, 0xcb, 0x63, 0x13, 0x81, 0xd7, 0xcf, 0x2c,
-    0x19, 0x8f, 0xef, 0xea, 0x95, 0x42, 0x78, 0x1d, 0x86, 0xf0, 0xc2, 0xa2,
-    0xff, 0x90, 0x65, 0xa5, 0x6a, 0xac, 0x2b, 0x2a, 0xc1, 0xd7, 0xd3, 0x6b,
-    0x26, 0x3a, 0xfd, 0xfc, 0x7b, 0x15, 0xce, 0xbf, 0xd1, 0x9b, 0x6b, 0xbb,
-    0x4d, 0x10, 0x4d, 0xff, 0x47, 0xb3, 0x6d, 0x77, 0x69, 0xa2, 0xf9, 0xbc,
-    0x39, 0xa0, 0xa2, 0x01, 0xa7, 0xb4, 0x28, 0xdd, 0xe1, 0x0a, 0xab, 0xff,
-    0xa3, 0xa8, 0xa6, 0x6e, 0x75, 0x83, 0x93, 0xab, 0x13, 0x6f, 0x48, 0xc0,
-    0x3a, 0x53, 0x7f, 0x81, 0xde, 0x3e, 0xa3, 0x7a, 0x75, 0xff, 0xa7, 0x7e,
-    0x78, 0xf3, 0xc2, 0xfc, 0x0e, 0xbf, 0xfe, 0xcf, 0x40, 0xfb, 0x59, 0x8a,
-    0x28, 0xf2, 0x3a, 0xff, 0xd8, 0x18, 0x94, 0x77, 0x3f, 0x73, 0xaf, 0xe7,
-    0x90, 0x24, 0xe1, 0x3a, 0xf3, 0x0c, 0x30, 0x55, 0xfb, 0xb8, 0xd7, 0xd9,
-    0x4c, 0x97, 0xf7, 0xff, 0xfa, 0x6d, 0xc7, 0x0f, 0x8a, 0x3f, 0xcf, 0xb3,
-    0x6b, 0xe6, 0x73, 0xe3, 0xab, 0xc8, 0xa5, 0xfa, 0x6d, 0x7f, 0xf9, 0x36,
-    0x9e, 0x06, 0x79, 0xd7, 0x82, 0x75, 0x4e, 0xa8, 0xa1, 0xa8, 0x6b, 0x4e,
-    0xfc, 0xf0, 0x61, 0xe1, 0xe2, 0x5b, 0xff, 0x2e, 0x39, 0xd0, 0xe4, 0xff,
-    0x64, 0x75, 0xff, 0xfe, 0x4e, 0xb8, 0xf3, 0x2f, 0xb2, 0x81, 0x93, 0xaf,
-    0x02, 0x75, 0xff, 0xec, 0xce, 0x87, 0xb1, 0xac, 0xea, 0x7e, 0x75, 0xfe,
-    0x53, 0xe4, 0xd2, 0x8d, 0xe8, 0xea, 0x9d, 0x32, 0x09, 0x20, 0x85, 0x81,
-    0x12, 0x2f, 0xe5, 0x7c, 0x97, 0x63, 0x67, 0x5f, 0xef, 0x42, 0x75, 0x48,
-    0xe4, 0xeb, 0xff, 0xdc, 0x8f, 0xc6, 0xf5, 0x3f, 0xfe, 0x37, 0x23, 0xaa,
-    0x11, 0x60, 0x85, 0xff, 0x4c, 0xef, 0x95, 0xf5, 0x2e, 0x07, 0x5f, 0xfe,
-    0x89, 0xfe, 0xf6, 0x39, 0xf6, 0x4e, 0x21, 0x3a, 0x9c, 0xfd, 0x04, 0x9e,
-    0xff, 0x46, 0x0f, 0x95, 0x0c, 0x34, 0xeb, 0xfd, 0xdc, 0xe1, 0xf3, 0x52,
-    0x69, 0xd6, 0x06, 0x8f, 0xb7, 0xc6, 0xd7, 0xf9, 0xc7, 0xe7, 0xdd, 0xf5,
-    0xce, 0xbf, 0x66, 0xdf, 0x96, 0x0e, 0xbf, 0xff, 0xd3, 0xe3, 0x03, 0x81,
-    0xda, 0x02, 0x70, 0xf6, 0x06, 0x73, 0xaa, 0x74, 0x45, 0x68, 0xa2, 0xf3,
-    0x0c, 0x30, 0x55, 0xfe, 0xfb, 0xfc, 0x0e, 0x73, 0xe2, 0x99, 0x2f, 0xef,
-    0xff, 0xe5, 0x4f, 0xc6, 0xf5, 0x02, 0x1c, 0x63, 0xe7, 0xb5, 0x93, 0x9d,
-    0x5d, 0x45, 0x50, 0x11, 0x69, 0x13, 0x10, 0x78, 0x76, 0xd4, 0xec, 0xa0,
-    0xb9, 0x47, 0x78, 0x13, 0x54, 0x94, 0xbd, 0xb8, 0xdf, 0xd7, 0x0e, 0xee,
-    0xc2, 0x90, 0x61, 0x1b, 0xa2, 0x8f, 0x47, 0x9f, 0x7f, 0xec, 0x41, 0x9d,
-    0xc7, 0xd8, 0xb3, 0xaf, 0xfd, 0xd4, 0x60, 0x3d, 0xcf, 0x71, 0xe1, 0xd7,
-    0xb0, 0x7f, 0x3a, 0xfb, 0x3d, 0x34, 0x8e, 0xbf, 0xfb, 0x88, 0x63, 0x8b,
-    0x4e, 0x3f, 0x7f, 0xd1, 0xd5, 0xd3, 0xed, 0x72, 0x2b, 0xff, 0x67, 0xa3,
-    0x7a, 0xec, 0x0f, 0x8f, 0x10, 0x45, 0xfe, 0x8c, 0xdb, 0x5d, 0xda, 0x68,
-    0x82, 0x19, 0x3c, 0x9b, 0xf9, 0xfb, 0xbd, 0xa3, 0x07, 0x5f, 0xca, 0xe1,
-    0x61, 0xc6, 0x47, 0x50, 0x9e, 0xe8, 0x0b, 0x6f, 0xff, 0xd0, 0x19, 0xa4,
-    0x83, 0xe8, 0xfe, 0x61, 0x49, 0x8e, 0xa5, 0x15, 0x0a, 0xf6, 0x11, 0x1f,
-    0xb5, 0x0c, 0x2b, 0x38, 0x10, 0xdf, 0xdd, 0xcf, 0x79, 0x16, 0x75, 0xfd,
-    0xef, 0xb9, 0xd7, 0xe4, 0xea, 0xe4, 0xf6, 0xc4, 0xb2, 0xff, 0xf6, 0xb4,
-    0x2f, 0xe7, 0x5f, 0xd8, 0x9f, 0x0e, 0xa8, 0x3e, 0xc0, 0x11, 0x5f, 0xd8,
-    0xdf, 0xbc, 0x3b, 0x87, 0x5d, 0x0a, 0x1d, 0x78, 0x28, 0x27, 0x5e, 0x10,
-    0x4e, 0x75, 0xfb, 0xaf, 0x2c, 0x13, 0xaf, 0xe4, 0xf0, 0xe7, 0x50, 0xeb,
-    0xb3, 0xbf, 0x0f, 0x3e, 0x09, 0x6e, 0x76, 0x3e, 0x23, 0x27, 0x05, 0xba,
-    0x35, 0xe6, 0xba, 0x92, 0x6c, 0x98, 0x42, 0x30, 0xf9, 0xbf, 0xff, 0xbd,
-    0xdc, 0xd6, 0xb3, 0x01, 0xb9, 0xf0, 0x03, 0xe3, 0xaf, 0xfb, 0xb1, 0xbf,
-    0x0c, 0x67, 0x27, 0x5f, 0xff, 0xf2, 0x4f, 0x12, 0xd6, 0xf6, 0x9c, 0xcd,
-    0x27, 0xda, 0xf3, 0x93, 0xaf, 0x77, 0x04, 0x28, 0xa0, 0xe9, 0xbd, 0x22,
-    0x65, 0xbe, 0x87, 0xd5, 0xff, 0x9b, 0xd8, 0xcd, 0xcb, 0x40, 0x59, 0xd7,
-    0x26, 0x8e, 0xbf, 0xec, 0x9d, 0xfd, 0xff, 0xd1, 0x91, 0xd7, 0xf7, 0xd5,
-    0xe9, 0x87, 0xe4, 0xea, 0x84, 0x73, 0xe1, 0x42, 0x87, 0xdb, 0x15, 0xf1,
-    0xdd, 0xed, 0xe7, 0x4e, 0xbd, 0xa4, 0x59, 0xd6, 0x8d, 0x9b, 0x6f, 0x0d,
-    0xdf, 0x24, 0xc8, 0xc1, 0xd7, 0xff, 0x2d, 0xf9, 0xfb, 0xe4, 0xdc, 0x01,
-    0x52, 0x75, 0xff, 0xf8, 0x13, 0x8c, 0x67, 0x59, 0x8f, 0x67, 0x41, 0xb3,
-    0xaf, 0xbd, 0xaf, 0xba, 0x0a, 0x30, 0x70, 0x8b, 0xea, 0x55, 0xfb, 0x4b,
-    0xcf, 0x68, 0xeb, 0xf3, 0xc8, 0x52, 0x0e, 0xbf, 0xa1, 0xc7, 0xd8, 0x27,
-    0x54, 0x93, 0xa6, 0xc8, 0x73, 0xa2, 0x5a, 0xc9, 0xc4, 0x92, 0xfe, 0x6f,
-    0x53, 0x8d, 0x14, 0x3a, 0xff, 0xf2, 0x7f, 0x1a, 0x5c, 0x26, 0xf6, 0x8c,
-    0x1d, 0x7c, 0xaf, 0xdc, 0x9c, 0xeb, 0xfd, 0x01, 0xcf, 0x27, 0x40, 0x75,
-    0x97, 0x07, 0xac, 0x12, 0x5b, 0xff, 0xff, 0x2d, 0xc7, 0xf9, 0x26, 0x80,
-    0xbe, 0xa4, 0x7b, 0xa0, 0x75, 0x9d, 0x7f, 0xfc, 0x20, 0xf4, 0x93, 0xfe,
-    0xba, 0x79, 0xd6, 0x75, 0xdf, 0x15, 0xce, 0xbf, 0xff, 0x3a, 0x79, 0x03,
-    0x81, 0xcf, 0x22, 0xd3, 0x67, 0x5e, 0xdb, 0xeb, 0x11, 0x75, 0xb4, 0xee,
-    0x8d, 0xdc, 0x9e, 0x74, 0xd9, 0x41, 0x19, 0x2d, 0xe7, 0x94, 0x1d, 0x41,
-    0x55, 0x53, 0x86, 0x09, 0x09, 0xf7, 0x8e, 0x30, 0x4d, 0x2f, 0xed, 0xc4,
-    0xe8, 0x3e, 0x3a, 0xf0, 0x7e, 0xac, 0xeb, 0xf0, 0xc0, 0x72, 0x63, 0xaf,
-    0xb4, 0x0d, 0xa8, 0x75, 0xfa, 0x3b, 0xe8, 0x91, 0xd7, 0xc1, 0x07, 0xb5,
-    0x07, 0xdf, 0xc9, 0x37, 0xe4, 0x77, 0xef, 0xf1, 0x71, 0xd3, 0xaf, 0x2a,
-    0x7b, 0x87, 0x50, 0x53, 0x47, 0xc2, 0xc4, 0x84, 0x68, 0xa4, 0x00, 0x9e,
-    0xf6, 0xfe, 0xe8, 0xeb, 0xa1, 0x5a, 0x1d, 0x7f, 0xe7, 0x16, 0xe6, 0xda,
-    0xee, 0xd3, 0x44, 0x23, 0x74, 0xa7, 0x3a, 0xa1, 0x13, 0x1f, 0x8f, 0x00,
-    0x6f, 0x82, 0x45, 0xff, 0xff, 0xee, 0xe0, 0x36, 0xa7, 0x53, 0x98, 0xf0,
-    0x3a, 0x39, 0xcf, 0x80, 0xfa, 0x3a, 0xff, 0xec, 0xe7, 0xef, 0x90, 0x41,
-    0x2c, 0xd1, 0xd7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xec, 0x19, 0xc5, 0xc3,
-    0x03, 0x3c, 0x6c, 0x38, 0x39, 0xed, 0x23, 0x70, 0x7e, 0xcf, 0x9b, 0x8d,
-    0x0b, 0xa9, 0xac, 0x4f, 0xff, 0x07, 0xe2, 0xe1, 0x81, 0x9e, 0x36, 0x75,
-    0x42, 0x69, 0xf8, 0x8b, 0x7f, 0xf7, 0x9c, 0x67, 0xe6, 0x43, 0x19, 0xa3,
-    0xaf, 0xfd, 0xf7, 0x3a, 0xeb, 0x65, 0x86, 0x18, 0x3a, 0xff, 0xfd, 0x8d,
-    0xec, 0x08, 0x45, 0x27, 0xc1, 0x45, 0x0e, 0xb9, 0xde, 0x74, 0x4b, 0x49,
-    0x12, 0xff, 0xfe, 0x98, 0x63, 0xfd, 0x37, 0xa9, 0xb9, 0x86, 0x3f, 0xd1,
-    0xd7, 0xff, 0x7b, 0xa9, 0xc3, 0xaf, 0x2d, 0xc2, 0x87, 0x5f, 0xc0, 0xf2,
-    0x00, 0x54, 0x3a, 0xfe, 0xc6, 0x30, 0x41, 0xf9, 0xd7, 0xe9, 0x67, 0xa3,
-    0xf3, 0xae, 0x85, 0xce, 0x7a, 0x9c, 0x96, 0xdf, 0xff, 0xfd, 0xfa, 0xde,
-    0x5d, 0x74, 0xf2, 0x07, 0x03, 0x9e, 0x45, 0xa6, 0xce, 0xad, 0x22, 0x78,
-    0x05, 0xf7, 0xe9, 0xd7, 0x01, 0x83, 0xaa, 0x4b, 0x9f, 0xa1, 0x8f, 0x23,
-    0x92, 0x29, 0xa1, 0xb3, 0xb2, 0xee, 0xae, 0xe9, 0x1b, 0xd1, 0x8f, 0xfd,
-    0x23, 0xbf, 0xd1, 0xad, 0x44, 0xf8, 0xc1, 0xd7, 0xfb, 0xb8, 0xbc, 0xe8,
-    0x04, 0xea, 0x09, 0xf2, 0x78, 0xce, 0xb1, 0x31, 0xc7, 0x87, 0xd5, 0xe6,
-    0x18, 0x60, 0xab, 0xfe, 0xcf, 0xdf, 0x79, 0xc3, 0x02, 0x53, 0x25, 0xfd,
-    0xcc, 0x30, 0x55, 0xe6, 0x18, 0x60, 0xab, 0xf9, 0xe7, 0x0f, 0x63, 0x45,
-    0x32, 0x5f, 0xd0, 0xa2, 0xf5, 0x84, 0x9e, 0x33, 0x7b, 0xf3, 0x50, 0x3f,
-    0x56, 0x53, 0x26, 0xce, 0xf3, 0x0c, 0x30, 0x55, 0xed, 0x46, 0xca, 0x64,
-    0xbf, 0xbe, 0x71, 0xe7, 0xc7, 0x5b, 0xf4, 0x45, 0x2f, 0x96, 0x58, 0x2b,
-    0xbf, 0x82, 0x31, 0x27, 0x69, 0xd7, 0xed, 0x02, 0x7e, 0x31, 0x3a, 0xfc,
-    0x14, 0xe1, 0x01, 0x3a, 0xfb, 0x07, 0x15, 0xce, 0xad, 0x9e, 0x52, 0xca,
-    0x29, 0x11, 0x2f, 0xf5, 0xd6, 0xff, 0xee, 0xbc, 0x85, 0xd4, 0x98, 0x52,
-    0x63, 0xaf, 0xee, 0xe7, 0x0c, 0xf6, 0x8e, 0xa6, 0x9f, 0x97, 0x91, 0x2b,
-    0x69, 0xbd, 0x76, 0x18, 0x43, 0x09, 0x6b, 0xa7, 0xf1, 0xd5, 0x0a, 0x80,
-    0xb2, 0x3b, 0x11, 0x3a, 0xbd, 0xca, 0xb5, 0x56, 0x0e, 0xbf, 0xfd, 0x8a,
-    0xee, 0x3f, 0xe3, 0x63, 0xb0, 0xb3, 0xaf, 0xe6, 0xa6, 0xba, 0x93, 0x15,
-    0x7f, 0x87, 0x39, 0x96, 0x91, 0x43, 0xaf, 0x9d, 0xf6, 0xa1, 0xd5, 0xf0,
-    0xf5, 0x27, 0x33, 0xbf, 0xec, 0xc6, 0xff, 0x19, 0xcc, 0x8e, 0xbe, 0x87,
-    0x5f, 0x02, 0xaf, 0xfe, 0xea, 0x3f, 0xff, 0xc7, 0xf1, 0xdd, 0x1d, 0x7f,
-    0x77, 0x16, 0xb7, 0x91, 0xd7, 0x98, 0x61, 0x82, 0xaf, 0xf0, 0xfb, 0xa9,
-    0x03, 0x39, 0x4c, 0x97, 0xf7, 0xa3, 0xfc, 0x92, 0x23, 0x31, 0x2e, 0xbc,
-    0x98, 0x27, 0xd8, 0x68, 0xdb, 0x1a, 0x9a, 0x8a, 0xe3, 0x26, 0xbf, 0xd1,
-    0xf7, 0x7b, 0x4f, 0x68, 0xea, 0x85, 0x60, 0x92, 0x28, 0xe5, 0x29, 0x21,
-    0x03, 0x31, 0x2f, 0x63, 0x89, 0x12, 0xfb, 0xf7, 0xf8, 0x9d, 0x50, 0xeb,
-    0xff, 0xec, 0x6c, 0x0b, 0xfb, 0x41, 0x03, 0xee, 0x47, 0x57, 0x27, 0xea,
-    0xb2, 0x8b, 0xcd, 0x8d, 0x1d, 0x7f, 0xf7, 0xd9, 0x67, 0x5f, 0xa9, 0xbd,
-    0xc1, 0xd5, 0x87, 0xbf, 0xf8, 0xdd, 0xfa, 0x3d, 0xae, 0x18, 0x75, 0xf8,
-    0x1b, 0x53, 0xa8, 0x75, 0x42, 0x3d, 0x06, 0x10, 0x5e, 0x22, 0xe3, 0x28,
-    0xbf, 0xfe, 0x4e, 0x18, 0x21, 0x17, 0x63, 0x05, 0xd4, 0x3a, 0xff, 0xff,
-    0x83, 0xd4, 0x63, 0x38, 0x91, 0x6f, 0xed, 0x02, 0x59, 0xcf, 0x8e, 0xac,
-    0x45, 0xc3, 0xa7, 0x5f, 0xf4, 0xcd, 0xea, 0x2e, 0x36, 0xa1, 0xd7, 0xe9,
-    0xfe, 0x02, 0x26, 0x3a, 0xe9, 0x48, 0xea, 0xc3, 0xfb, 0x73, 0xad, 0x15,
-    0xd4, 0x3b, 0x18, 0xb9, 0xe5, 0x08, 0x4a, 0x52, 0x28, 0x65, 0x1d, 0x65,
-    0x29, 0x11, 0x48, 0x5b, 0x34, 0xed, 0x25, 0x2b, 0x4d, 0x2a, 0x13, 0x72,
-    0x92, 0x17, 0x28, 0x97, 0xb2, 0xbd, 0x9e, 0x39, 0xaf, 0xe1, 0xca, 0x33,
-    0xcb, 0x1a, 0x97, 0xbb, 0xe9, 0x67, 0x20, 0x8f, 0x65, 0x88, 0x7d, 0xfd,
-    0x84, 0xe5, 0xee, 0x10, 0x27, 0x5f, 0xff, 0x60, 0xb3, 0xe5, 0x13, 0x9d,
-    0x77, 0x3f, 0x73, 0xaa, 0x47, 0xda, 0x11, 0xcb, 0xfc, 0xe2, 0xdc, 0xf7,
-    0x50, 0xea, 0xe4, 0xf4, 0x96, 0x45, 0x65, 0x68, 0x75, 0xff, 0xca, 0xee,
-    0x3f, 0xfc, 0x08, 0x1f, 0x72, 0x3a, 0x95, 0x79, 0xef, 0xe0, 0xb5, 0xe8,
-    0x19, 0xce, 0xbe, 0x4e, 0xa2, 0xce, 0xb7, 0x50, 0xdd, 0xcc, 0x37, 0x7f,
-    0x43, 0x63, 0x5e, 0x43, 0xaf, 0xfa, 0x3d, 0xd7, 0xfd, 0xf9, 0xd1, 0xd4,
-    0x13, 0xe4, 0x12, 0xbb, 0xd3, 0x03, 0x67, 0x5f, 0xf9, 0xd3, 0x79, 0xcb,
-    0x2c, 0x30, 0xc1, 0xd4, 0xe7, 0xbf, 0xa1, 0xdb, 0xff, 0xe1, 0x89, 0x7c,
-    0xfb, 0xe4, 0x10, 0x4b, 0x34, 0x75, 0x62, 0x6f, 0xad, 0x84, 0x5f, 0x61,
-    0x01, 0xf9, 0x0d, 0xfe, 0x81, 0x90, 0xe6, 0x7e, 0x75, 0xfd, 0x9b, 0xd0,
-    0xc4, 0xe7, 0x5f, 0xcf, 0xee, 0xb8, 0xfe, 0x75, 0xff, 0x9f, 0xd9, 0x33,
-    0xc0, 0xc4, 0xc7, 0x59, 0x36, 0x7d, 0x1d, 0x2c, 0xb9, 0xad, 0x34, 0x60,
-    0x95, 0x24, 0x6f, 0x36, 0x12, 0x9f, 0x93, 0xdd, 0x82, 0x75, 0xff, 0xef,
-    0x40, 0xb7, 0x3d, 0xd4, 0xdf, 0xed, 0x3a, 0x82, 0x7b, 0xb8, 0x29, 0x7f,
-    0xa1, 0x7a, 0xd3, 0x8c, 0xe7, 0x5f, 0x9f, 0x58, 0x3e, 0x3a, 0xf7, 0x9d,
-    0x5c, 0xeb, 0xfd, 0xee, 0xa3, 0x3f, 0xba, 0x1d, 0x41, 0x46, 0x4f, 0x48,
-    0x44, 0xcb, 0xc4, 0xa0, 0x1e, 0xbe, 0xea, 0x3c, 0x8e, 0xbc, 0x17, 0x91,
-    0xd7, 0x03, 0xf8, 0x37, 0x78, 0x41, 0x7f, 0xcd, 0xcf, 0x47, 0x04, 0x1f,
-    0xce, 0xbf, 0xff, 0x81, 0x1e, 0xd6, 0x0f, 0xcd, 0xc2, 0x04, 0x5e, 0x47,
-    0x5f, 0x9b, 0xde, 0x5d, 0x5c, 0xea, 0x44, 0x5e, 0x89, 0xc8, 0x16, 0x6f,
-    0xfe, 0xfd, 0xf7, 0x9c, 0x30, 0x3b, 0x16, 0x0e, 0xbf, 0xff, 0x87, 0x34,
-    0x0f, 0x99, 0xd7, 0x1c, 0x9a, 0x51, 0xc9, 0xd7, 0xed, 0xb5, 0xdd, 0xa6,
-    0x88, 0x1a, 0xfe, 0x79, 0xff, 0x71, 0x09, 0x2b, 0x07, 0xde, 0xcd, 0x03,
-    0x0f, 0xbb, 0x8c, 0xce, 0xf7, 0x5e, 0x5f, 0x11, 0xfc, 0x30, 0xc9, 0xa5,
-    0xa6, 0xfd, 0xe8, 0xd1, 0x2f, 0xf8, 0x7f, 0xf2, 0x4e, 0xb8, 0x69, 0xd7,
-    0xe0, 0xab, 0x6e, 0x15, 0x6c, 0xea, 0x85, 0x48, 0x19, 0x1d, 0x62, 0x15,
-    0x39, 0xcd, 0xfe, 0xce, 0x7c, 0x1c, 0xc5, 0x0e, 0xbf, 0xb3, 0xd0, 0x29,
-    0xf9, 0xd7, 0x9f, 0x73, 0x9a, 0x30, 0x5b, 0xff, 0x3e, 0xf0, 0x7f, 0xd7,
-    0xb5, 0xc9, 0xd7, 0xff, 0xff, 0xf6, 0x7b, 0xae, 0x2a, 0x7c, 0xd6, 0xdd,
-    0xfd, 0xc3, 0x03, 0xf3, 0x16, 0xe3, 0xcc, 0x8f, 0x10, 0x5d, 0xff, 0x9d,
-    0xd4, 0x6b, 0x87, 0xe2, 0x8c, 0x1e, 0x20, 0xbb, 0xff, 0xba, 0x9d, 0x48,
-    0x1f, 0x7c, 0x51, 0x83, 0xc4, 0x17, 0x7f, 0xa1, 0x07, 0xdf, 0x14, 0x60,
-    0xf1, 0x05, 0xdf, 0xcb, 0xc0, 0xfc, 0x51, 0x83, 0xc4, 0x17, 0x7f, 0xff,
-    0xce, 0x22, 0x8b, 0xf9, 0xa6, 0xf5, 0x36, 0x8a, 0x4f, 0x8c, 0x1e, 0x20,
-    0xbb, 0xb9, 0xf8, 0x14, 0xe5, 0xda, 0x9f, 0xb5, 0x37, 0x42, 0x13, 0xea,
-    0x85, 0x59, 0x1d, 0x3f, 0x19, 0x46, 0x37, 0xf9, 0x21, 0x4d, 0x7b, 0x5c,
-    0x9d, 0x7c, 0xfb, 0xfd, 0xce, 0xbf, 0xfb, 0xa9, 0xd4, 0x81, 0xf7, 0xc5,
-    0x18, 0x3c, 0x41, 0x77, 0xfd, 0x36, 0x9a, 0x93, 0xfc, 0x51, 0x83, 0xc4,
-    0x17, 0x7e, 0xf6, 0xa1, 0x7f, 0x1a, 0x89, 0xff, 0xaa, 0x77, 0xff, 0xbe,
-    0x37, 0xa8, 0xd8, 0xf6, 0xbe, 0x28, 0xc1, 0xe2, 0x0b, 0xbf, 0xff, 0xf8,
-    0x45, 0x17, 0xf0, 0x19, 0xf3, 0x4d, 0xea, 0x6d, 0x14, 0x9f, 0x18, 0x3c,
-    0x41, 0x75, 0x89, 0x92, 0x72, 0x88, 0xeb, 0xb7, 0xfd, 0xd4, 0xda, 0x29,
-    0x3e, 0x30, 0x78, 0x82, 0xef, 0xff, 0x9d, 0xf9, 0x96, 0xba, 0x81, 0x0c,
-    0x6e, 0x0a, 0xbf, 0xf6, 0x4a, 0x40, 0xd6, 0xc6, 0x7e, 0x33, 0xc4, 0x17,
-    0x4d, 0x47, 0x26, 0xd1, 0xf4, 0x9d, 0x7f, 0xe6, 0xa6, 0xfc, 0xff, 0xeb,
-    0xe3, 0x07, 0x88, 0x2e, 0xfe, 0xea, 0x77, 0xa9, 0xf9, 0xa0, 0x0b, 0xbf,
-    0x67, 0xff, 0x14, 0x60, 0xf1, 0x05, 0xdd, 0x9e, 0x69, 0xf9, 0xf4, 0xea,
-    0xb9, 0x47, 0x7e, 0xa1, 0x85, 0x7f, 0x2f, 0x03, 0xf1, 0x46, 0x0f, 0x10,
-    0x5d, 0xff, 0x9b, 0xd4, 0xda, 0x29, 0x3e, 0x30, 0x78, 0x82, 0xee, 0xcf,
-    0x8e, 0x88, 0xbd, 0x1f, 0x5f, 0xe0, 0x22, 0xdc, 0x79, 0x91, 0xe2, 0x0b,
-    0xbf, 0xf6, 0x27, 0x0c, 0x1c, 0x0b, 0xc8, 0xf1, 0x05, 0xac, 0xdf, 0xd0,
-    0x57, 0x7f, 0x76, 0x6f, 0xf9, 0xa0, 0xc7, 0xc9, 0xa8, 0xc5, 0x3d, 0x18,
-    0xf8, 0x21, 0x68, 0xc3, 0x75, 0xdf, 0xc1, 0xa2, 0x0b, 0x65, 0x11, 0x97,
-    0x3b, 0x4e, 0xb6, 0x9a, 0xc9, 0xc5, 0xfe, 0x92, 0xf5, 0xe3, 0x6b, 0xa5,
-    0xc4, 0x75, 0xe8, 0x97, 0x11, 0xd5, 0x06, 0xdc, 0x46, 0x6a, 0x76, 0x55,
-    0xe8, 0x4c, 0xff, 0xa4, 0xf8, 0x0b, 0xdd, 0xff, 0xd9, 0x21, 0xcf, 0x75,
-    0x33, 0x9f, 0x1d, 0x7e, 0x8f, 0x6b, 0xa8, 0x75, 0xff, 0xb5, 0x34, 0x80,
-    0x19, 0xa4, 0x00, 0x9d, 0x52, 0x3e, 0x8f, 0x13, 0x5f, 0xee, 0xbc, 0xb8,
-    0xb8, 0x81, 0x39, 0xd7, 0xed, 0xc7, 0x32, 0xd1, 0xd5, 0x23, 0xe2, 0xd9,
-    0xd5, 0xff, 0xdf, 0x83, 0x5c, 0x79, 0xbf, 0xd6, 0x9a, 0x3a, 0xff, 0x7e,
-    0x0f, 0x0c, 0x7b, 0x47, 0x57, 0xe7, 0xf9, 0xa4, 0x9a, 0x84, 0xd1, 0x72,
-    0x10, 0x8f, 0x09, 0xeb, 0xf9, 0xe5, 0x1c, 0x1f, 0xa7, 0x5f, 0x73, 0xa8,
-    0xe4, 0xeb, 0xcb, 0x89, 0x1d, 0x7e, 0xc0, 0xf4, 0x0c, 0x1d, 0x5f, 0x0f,
-    0x99, 0xc8, 0xc4, 0x6e, 0xf0, 0x5f, 0xc7, 0x56, 0xcf, 0x29, 0xcb, 0xef,
-    0x27, 0x1e, 0x1d, 0x79, 0xf7, 0xf9, 0xd6, 0xe6, 0x0d, 0xcf, 0x87, 0x6f,
-    0x98, 0xce, 0xb9, 0xd7, 0xca, 0x6d, 0x18, 0x3a, 0xfd, 0x3b, 0xf6, 0x15,
-    0xce, 0xa5, 0x60, 0xf3, 0x70, 0x8e, 0xa1, 0x3f, 0x24, 0x86, 0xeb, 0xad,
-    0x7e, 0x4e, 0x2d, 0xd7, 0xff, 0x84, 0x62, 0x75, 0xf5, 0x37, 0xb7, 0x91,
-    0xd7, 0xfa, 0x79, 0xe0, 0x79, 0xcf, 0x1d, 0x58, 0x7f, 0x88, 0x91, 0x7f,
-    0xf6, 0xc4, 0x1c, 0xf8, 0x72, 0x77, 0x13, 0xaf, 0x3e, 0xe7, 0x3a, 0xef,
-    0xe0, 0xeb, 0xe4, 0x85, 0xe1, 0xd4, 0x75, 0xfc, 0xea, 0x7a, 0x37, 0xf9,
-    0xd4, 0x13, 0x70, 0x21, 0x57, 0xff, 0xfa, 0x10, 0x23, 0x00, 0x6f, 0xb1,
-    0xa1, 0x86, 0xfd, 0x59, 0xd7, 0x7f, 0x07, 0x5d, 0x0a, 0x1d, 0x7f, 0xd9,
-    0xed, 0x42, 0xfe, 0xe4, 0xc7, 0x5f, 0xed, 0x67, 0x53, 0x40, 0x9c, 0xeb,
-    0x98, 0x60, 0xab, 0xfe, 0x1c, 0xe0, 0xf2, 0xd2, 0x04, 0xea, 0x6a, 0x7e,
-    0x48, 0x39, 0xb1, 0x65, 0xab, 0xf4, 0x83, 0xf6, 0x05, 0x48, 0xb0, 0x8b,
-    0x68, 0xe9, 0x83, 0x3f, 0xa3, 0x17, 0x98, 0x61, 0x82, 0xac, 0xb2, 0x99,
-    0x2f, 0xef, 0xa6, 0x77, 0xd9, 0x4c, 0xa3, 0x7b, 0xec, 0x2f, 0xaa, 0x75,
-    0x6b, 0x6f, 0x2c, 0x4e, 0xfe, 0xf4, 0x67, 0x72, 0x73, 0xae, 0xc5, 0x9d,
-    0x5c, 0x9e, 0x0e, 0x8b, 0x2a, 0x1b, 0xcf, 0x69, 0x42, 0x0b, 0x23, 0xdf,
-    0x51, 0x23, 0x98, 0xc3, 0x92, 0x35, 0xcd, 0xc2, 0x13, 0xb2, 0xca, 0x5e,
-    0x95, 0xfd, 0xfa, 0x58, 0xc7, 0xdf, 0xa9, 0x45, 0x5e, 0x86, 0x48, 0x25,
-    0xbd, 0xf0, 0x6d, 0xbf, 0xb3, 0xff, 0xd3, 0x72, 0x3a, 0xe6, 0xe1, 0xd4,
-    0x13, 0xc3, 0x72, 0xeb, 0xb1, 0x83, 0xae, 0x8f, 0x1d, 0x53, 0x9a, 0xb6,
-    0x8b, 0x59, 0x67, 0x56, 0x1b, 0x2f, 0x11, 0x5f, 0xe9, 0x20, 0xe2, 0xc1,
-    0xd3, 0xaf, 0xfd, 0x9e, 0xd7, 0x51, 0x6f, 0x9b, 0x3a, 0xa0, 0xfb, 0x44,
-    0xc6, 0xfb, 0xe7, 0xa3, 0x81, 0xd7, 0xd8, 0xbc, 0xf1, 0xd7, 0xbc, 0xea,
-    0x1d, 0x7f, 0xff, 0xf3, 0x5e, 0x60, 0x48, 0x0d, 0xf9, 0xd4, 0xf7, 0xa3,
-    0x98, 0x9e, 0x34, 0x75, 0xff, 0xff, 0x2b, 0x8b, 0xbf, 0x08, 0x97, 0x63,
-    0x73, 0xc7, 0xb4, 0xf2, 0x3a, 0xf2, 0x73, 0x31, 0xd7, 0xec, 0xc9, 0xc1,
-    0xa3, 0xaf, 0xb6, 0x29, 0xf9, 0xd7, 0xc8, 0xd7, 0xd9, 0xd7, 0x47, 0xe7,
-    0x5f, 0x02, 0x70, 0x33, 0xd3, 0x6d, 0xf4, 0x82, 0x91, 0x12, 0x9d, 0x57,
-    0xbf, 0xee, 0xbe, 0xba, 0x93, 0xb8, 0x9d, 0x7c, 0xf3, 0xfd, 0x91, 0xd4,
-    0xaa, 0x57, 0x81, 0x0f, 0xd2, 0x84, 0x6e, 0x10, 0x72, 0x4a, 0x84, 0x1b,
-    0x1c, 0x77, 0x6f, 0xda, 0x74, 0x3b, 0xe8, 0x5d, 0xfd, 0x22, 0xe2, 0x37,
-    0xbf, 0x84, 0x01, 0x5b, 0xc8, 0xeb, 0xc9, 0x38, 0x0e, 0xbf, 0x47, 0xe9,
-    0xce, 0x1d, 0x72, 0xf8, 0x1d, 0x60, 0xc1, 0xbf, 0x12, 0x7b, 0xff, 0xd2,
-    0x18, 0xf8, 0xb1, 0x85, 0x3c, 0x93, 0x9d, 0x7e, 0x75, 0xe7, 0x56, 0x75,
-    0x72, 0x7e, 0x3e, 0x4b, 0xbd, 0xed, 0xc1, 0xd7, 0xfb, 0x5e, 0xe1, 0x83,
-    0x81, 0x3a, 0xa1, 0x38, 0xe9, 0x16, 0x62, 0xda, 0x42, 0x59, 0x64, 0x6e,
-    0x37, 0x79, 0xfe, 0x7d, 0x3a, 0xf9, 0x6b, 0x85, 0x9d, 0x7f, 0xfc, 0x32,
-    0xf9, 0x81, 0x4d, 0x73, 0xe0, 0x3e, 0x8e, 0xbf, 0xdf, 0x45, 0xfd, 0x28,
-    0x50, 0xeb, 0xec, 0xce, 0x64, 0x75, 0xed, 0x24, 0xc7, 0x59, 0x41, 0x37,
-    0xba, 0x21, 0xbf, 0xf9, 0xe7, 0x18, 0xe5, 0x02, 0x31, 0x39, 0xd5, 0xb3,
-    0xea, 0x12, 0x7b, 0xf7, 0xce, 0xc6, 0xe4, 0x75, 0x7c, 0x4e, 0xda, 0x07,
-    0xf0, 0x85, 0xaa, 0x2f, 0x0d, 0xb6, 0x08, 0x6f, 0x2f, 0x50, 0x75, 0xfd,
-    0x3c, 0xd2, 0x55, 0x6e, 0x73, 0xaf, 0x97, 0x8f, 0xd3, 0xae, 0x94, 0xe7,
-    0x5e, 0xe8, 0x50, 0xeb, 0xf7, 0x71, 0x25, 0xa3, 0xaf, 0xff, 0xbb, 0x1f,
-    0x59, 0xf0, 0xbf, 0xfa, 0xd4, 0x7e, 0x55, 0xfb, 0x6d, 0x77, 0x69, 0xe2,
-    0x04, 0xbd, 0xa8, 0xe4, 0xeb, 0x7f, 0x87, 0x9f, 0xc9, 0x9d, 0xef, 0x24,
-    0xe7, 0x5e, 0x9d, 0xc4, 0xea, 0x92, 0x65, 0x01, 0x26, 0xdc, 0x28, 0x96,
-    0x53, 0xe1, 0xcb, 0xf8, 0x5a, 0xea, 0x75, 0x0e, 0xbb, 0x8a, 0x47, 0x5f,
-    0x7a, 0x77, 0x13, 0xaf, 0x0b, 0xa8, 0x75, 0xe5, 0x13, 0xc7, 0x5e, 0xd3,
-    0xf8, 0xea, 0x50, 0xdb, 0xf2, 0x39, 0x77, 0xce, 0x9d, 0x7f, 0x2f, 0xc8,
-    0x10, 0x41, 0xd7, 0x97, 0xe6, 0x9d, 0x6f, 0x41, 0xe4, 0x61, 0x65, 0x4e,
-    0x99, 0xae, 0x0c, 0xb4, 0x87, 0xaa, 0x5f, 0x91, 0x8b, 0x05, 0xdb, 0x01,
-    0xd7, 0xf8, 0x5d, 0x8d, 0x6a, 0x3f, 0x3a, 0xf7, 0x1b, 0xa8, 0x75, 0xff,
-    0x42, 0xe5, 0x93, 0xe0, 0x15, 0x27, 0x5f, 0x3f, 0x95, 0x33, 0x9d, 0x58,
-    0x88, 0x14, 0x1f, 0x73, 0xcb, 0xcc, 0x30, 0xc1, 0xea, 0xfa, 0xbc, 0xe2,
-    0x12, 0xd5, 0xf5, 0x64, 0xd6, 0x5f, 0xb2, 0x40, 0x85, 0x0e, 0xa8, 0x4e,
-    0x0c, 0x22, 0xdb, 0x85, 0xa7, 0xeb, 0x3e, 0x39, 0xbf, 0xff, 0x60, 0xa2,
-    0x8c, 0xeb, 0xdd, 0x03, 0xca, 0x50, 0x75, 0x4e, 0x8a, 0x55, 0x14, 0x2f,
-    0xb0, 0x2f, 0x23, 0xaf, 0xce, 0x22, 0x8b, 0x3a, 0xff, 0xba, 0x9b, 0xc4,
-    0x5c, 0x2b, 0x9d, 0x7e, 0x45, 0xb8, 0xe1, 0xd5, 0xf1, 0x7b, 0x05, 0x59,
-    0x1b, 0x83, 0x59, 0x10, 0x04, 0x5f, 0x23, 0x43, 0x51, 0x41, 0x23, 0x61,
-    0x79, 0x50, 0x1f, 0x92, 0x89, 0x00, 0x09, 0x38, 0xce, 0x6f, 0xc9, 0xe8,
-    0xf6, 0x8a, 0xbe, 0x6c, 0x7b, 0x45, 0x5c, 0xc3, 0x05, 0x54, 0x8f, 0x7f,
-    0x09, 0x98, 0x21, 0xbb, 0x18, 0x29, 0x93, 0x5f, 0x7f, 0xfe, 0xcf, 0x43,
-    0x73, 0x07, 0xdd, 0x48, 0x19, 0xce, 0xaf, 0xcf, 0xe1, 0x82, 0x7b, 0xff,
-    0xfd, 0x1c, 0x10, 0x7f, 0xf9, 0xed, 0x63, 0x7a, 0xe3, 0xed, 0x1d, 0x7e,
-    0x97, 0x41, 0x1b, 0x3a, 0xff, 0xe7, 0x5e, 0xe3, 0x82, 0x70, 0x10, 0x68,
-    0xea, 0xe4, 0xfb, 0x7a, 0x4f, 0x7e, 0xc0, 0x2e, 0x34, 0x75, 0x1d, 0x76,
-    0x4d, 0xb3, 0x61, 0xa2, 0x6b, 0xfe, 0x40, 0x2a, 0x7b, 0x1f, 0x46, 0x73,
-    0xaf, 0xfa, 0x27, 0x8e, 0x7c, 0x39, 0x39, 0xd5, 0x88, 0xa4, 0x69, 0x6a,
-    0x1f, 0x5f, 0x9d, 0x63, 0x1c, 0x9d, 0x53, 0x26, 0x97, 0xb8, 0x7b, 0xf4,
-    0xba, 0xfb, 0x3b, 0x93, 0x9d, 0x7a, 0x4f, 0xb3, 0xaf, 0xd2, 0xcf, 0x60,
-    0x4a, 0xbe, 0x81, 0x18, 0x3a, 0xa6, 0x3d, 0xff, 0x0d, 0xfd, 0x26, 0xbe,
-    0xff, 0x4b, 0xd9, 0xd4, 0xa2, 0x35, 0x52, 0x10, 0x1e, 0x32, 0xbf, 0xe1,
-    0xce, 0xe7, 0xce, 0xe4, 0xe7, 0x5f, 0xc0, 0x54, 0xa6, 0xf7, 0x87, 0x5f,
-    0x79, 0x4c, 0xe9, 0xd6, 0xd1, 0xd7, 0x27, 0xe7, 0x5d, 0xd4, 0x3a, 0xe0,
-    0x6b, 0xe1, 0xab, 0x98, 0x5a, 0x9c, 0xfa, 0xff, 0x3b, 0xbb, 0xf8, 0x3a,
-    0xef, 0xe0, 0xeb, 0xf0, 0x25, 0x82, 0xca, 0x1a, 0xcf, 0xc5, 0xaa, 0x13,
-    0x19, 0xfe, 0x11, 0xa2, 0x9d, 0x7f, 0xfd, 0x82, 0xfc, 0xe9, 0x45, 0x1f,
-    0xe3, 0x57, 0xf9, 0xd7, 0xff, 0x7b, 0xb8, 0xbf, 0xb1, 0xfe, 0x73, 0xe3,
-    0xaf, 0xf7, 0x2d, 0x4d, 0xfd, 0x80, 0x9d, 0x7d, 0xfa, 0xde, 0x5f, 0x11,
-    0xa1, 0xa5, 0x4f, 0x23, 0xdf, 0xdf, 0xaf, 0xee, 0xbe, 0xce, 0x75, 0xd9,
-    0xc9, 0xd5, 0xc9, 0xe5, 0x71, 0x9a, 0x5f, 0x7f, 0xb4, 0xd9, 0xd5, 0x08,
-    0xdc, 0x78, 0x4a, 0x30, 0x4d, 0x7d, 0xa0, 0x73, 0xe3, 0xae, 0xc6, 0x0e,
-    0xbf, 0xe8, 0xe7, 0x3f, 0x8e, 0x19, 0x39, 0xd5, 0xb3, 0xd1, 0xfc, 0x5a,
-    0xff, 0xd3, 0x44, 0xfa, 0xde, 0x36, 0x27, 0x3a, 0xfe, 0xc5, 0xe0, 0x51,
-    0x83, 0xae, 0x5c, 0x1d, 0x4b, 0x3c, 0x17, 0x2c, 0xbf, 0x87, 0x26, 0xea,
-    0x78, 0xeb, 0xec, 0xce, 0xe8, 0xea, 0xc4, 0x77, 0x3c, 0x20, 0x7c, 0x43,
-    0xc4, 0x59, 0x79, 0x86, 0x18, 0x2a, 0xfd, 0x8a, 0x08, 0x34, 0x53, 0x25,
-    0xfd, 0xfb, 0x19, 0x61, 0x86, 0x0e, 0xa8, 0x3e, 0x2f, 0x1b, 0xdf, 0xf8,
-    0x73, 0x4d, 0xea, 0x36, 0x04, 0xeb, 0xff, 0xfc, 0xa3, 0x0f, 0xb5, 0x19,
-    0xd6, 0x48, 0x40, 0xfa, 0xc1, 0x3a, 0xb1, 0x13, 0xa8, 0x77, 0x7c, 0xc3,
-    0x8c, 0x8e, 0xbf, 0xef, 0x47, 0x3f, 0xbf, 0x7a, 0x87, 0x5b, 0xa7, 0x56,
-    0x1e, 0x4b, 0x4e, 0x6f, 0x30, 0xc3, 0x05, 0x5f, 0xc8, 0xea, 0x75, 0x3c,
-    0x53, 0x25, 0xfd, 0xf7, 0xb4, 0xfb, 0x3a, 0xf7, 0x60, 0x27, 0x52, 0x1b,
-    0xc7, 0x21, 0xbf, 0x67, 0xf9, 0x93, 0x1d, 0x6d, 0x7c, 0x47, 0xf6, 0xd0,
-    0x3a, 0xf0, 0x23, 0xf7, 0x02, 0x41, 0x4e, 0xb3, 0x23, 0x68, 0xbf, 0x2a,
-    0x7b, 0x13, 0x80, 0xea, 0xea, 0xa2, 0xe1, 0x8f, 0x34, 0x06, 0xb7, 0xa3,
-    0x84, 0x1d, 0x48, 0x7a, 0x62, 0x6f, 0x78, 0x63, 0x81, 0xd7, 0x2a, 0x50,
-    0xeb, 0x93, 0xa7, 0x59, 0xe7, 0x35, 0xdb, 0x19, 0xbe, 0xf6, 0x80, 0xae,
-    0x75, 0xfe, 0x81, 0x90, 0xa4, 0x72, 0x75, 0x43, 0x36, 0x16, 0x44, 0x99,
-    0x28, 0x6d, 0x48, 0xc3, 0x1a, 0x6a, 0x87, 0x3b, 0x8d, 0x27, 0xb1, 0xf0,
-    0xb9, 0xa7, 0xee, 0x83, 0x18, 0x8e, 0xa1, 0x89, 0xe9, 0x67, 0xfc, 0x08,
-    0x38, 0xd2, 0xbe, 0x93, 0xf1, 0x12, 0xdc, 0xac, 0x21, 0xd7, 0xfe, 0x89,
-    0xbd, 0xc5, 0xa8, 0x98, 0x1b, 0x3a, 0xff, 0xec, 0x4e, 0xc0, 0x7a, 0x08,
-    0xe7, 0x47, 0x5e, 0x0a, 0x9f, 0x9d, 0x7e, 0x5e, 0xf6, 0xfe, 0x3a, 0xbe,
-    0x1e, 0x2c, 0x0f, 0x5f, 0xfe, 0x6c, 0xce, 0xde, 0xc4, 0xbc, 0x38, 0xb3,
-    0xaf, 0xff, 0x91, 0x7c, 0xcb, 0x5f, 0x30, 0x47, 0x13, 0xf3, 0xaf, 0x27,
-    0x40, 0x75, 0x2b, 0x29, 0xde, 0x48, 0x6b, 0x68, 0x7d, 0x84, 0x43, 0x91,
-    0xf9, 0x27, 0x82, 0x85, 0x99, 0x56, 0x23, 0x5a, 0x8e, 0x54, 0x42, 0xe5,
-    0x5b, 0x8d, 0x21, 0x54, 0xd8, 0xad, 0x23, 0x19, 0x55, 0xf0, 0xe8, 0x55,
-    0x8a, 0x22, 0x97, 0x6f, 0x3c, 0xe7, 0xd4, 0xa9, 0x12, 0x61, 0xa4, 0x86,
-    0x65, 0xb3, 0x60, 0x52, 0x58, 0x6b, 0x69, 0x2b, 0x5c, 0xcf, 0xaf, 0xa5,
-    0x23, 0x3a, 0x6a, 0x69, 0xbe, 0xe9, 0xa4, 0x8b, 0x9f, 0x88, 0xed, 0x6b,
-    0x1c, 0xf5, 0xca, 0xaf, 0xf4, 0x8b, 0xe5, 0x4c, 0x35, 0x46, 0xb3, 0x4f,
-    0xd5, 0xb3, 0x90, 0xf5, 0x7e, 0x82, 0x09, 0xd1, 0x9e, 0x12, 0x94, 0xd8,
-    0x94, 0x1f, 0xc7, 0x3e, 0x3d, 0xf6, 0x9e, 0xb5, 0xc5, 0x2b, 0x62, 0x99,
-    0x8d, 0x76, 0xde, 0x59, 0xad, 0x6f, 0x5f, 0x99, 0xfd, 0x79, 0xe3, 0xaf,
-    0xf3, 0x39, 0xb6, 0xbb, 0xb4, 0xd1, 0x71, 0xdf, 0xe6, 0x73, 0x6d, 0x77,
-    0x69, 0xa2, 0xeb, 0xbf, 0xf9, 0x97, 0x93, 0x39, 0xb6, 0xbb, 0xb4, 0xd1,
-    0x28, 0xd4, 0x46, 0xc5, 0x97, 0x28, 0x5d, 0x84, 0xa5, 0x48, 0x47, 0xb4,
-    0xa1, 0x23, 0x8b, 0x57, 0x64, 0x7c, 0xd7, 0x83, 0xbf, 0x3b, 0xd1, 0x4f,
-    0x8f, 0xf8, 0x8f, 0xef, 0xff, 0x32, 0xb7, 0x93, 0x39, 0xb6, 0xbb, 0xb4,
-    0xd1, 0x2d, 0x5f, 0xf2, 0xae, 0xea, 0x2b, 0xbc, 0x73, 0xc4, 0x75, 0xfb,
-    0x6d, 0x77, 0x69, 0xa2, 0x37, 0xbf, 0xf3, 0xc9, 0x9c, 0xdb, 0x5d, 0xda,
-    0x68, 0x97, 0xef, 0xe8, 0xf7, 0xde, 0xbf, 0x8e, 0xbf, 0xd9, 0xf7, 0x6a,
-    0x74, 0x1a, 0x3a, 0xcc, 0xab, 0x54, 0xc9, 0x71, 0x11, 0x66, 0x7d, 0x4a,
-    0x12, 0xeb, 0xfc, 0xce, 0x6d, 0xae, 0xed, 0x34, 0x55, 0x77, 0x27, 0x11,
-    0xd7, 0xc8, 0xb7, 0xe0, 0x75, 0x28, 0x6e, 0xbc, 0x31, 0x78, 0x78, 0x98,
-    0x3a, 0xfe, 0x7e, 0xcc, 0x30, 0x13, 0xaf, 0xfe, 0xf7, 0x63, 0x42, 0xe0,
-    0x54, 0xa6, 0xce, 0xbd, 0x12, 0xc3, 0xa8, 0x28, 0x8c, 0xe4, 0xb2, 0x64,
-    0x6b, 0xfe, 0x53, 0x07, 0x39, 0xf3, 0xac, 0xeb, 0x82, 0x87, 0x5f, 0xd9,
-    0xb6, 0xbb, 0xb4, 0xd1, 0x20, 0x57, 0xc3, 0xcd, 0x64, 0x56, 0xfd, 0xa7,
-    0x17, 0xe4, 0xea, 0x91, 0xe5, 0xf2, 0x4b, 0x7f, 0xa5, 0x1b, 0x9e, 0x37,
-    0x39, 0xd7, 0xfb, 0x73, 0xae, 0x06, 0x5a, 0x3a, 0xa0, 0xf9, 0xf0, 0xd2,
-    0xfb, 0x27, 0x70, 0x9d, 0x7f, 0xfb, 0x26, 0xeb, 0xaf, 0xdd, 0x8f, 0x01,
-    0x67, 0x54, 0xea, 0xb9, 0x02, 0x45, 0x90, 0xab, 0x50, 0xc9, 0xe1, 0xa0,
-    0x30, 0x8a, 0xf1, 0x07, 0xd2, 0x1b, 0xff, 0x87, 0x27, 0x67, 0x8e, 0x04,
-    0x73, 0xc7, 0x53, 0x28, 0xc8, 0xdc, 0x20, 0xef, 0xf3, 0x39, 0xb6, 0xbb,
-    0xb4, 0xd1, 0x64, 0x5f, 0xe6, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0xd7, 0xbf,
-    0xfd, 0x9f, 0x62, 0x76, 0x72, 0x6f, 0x06, 0x04, 0xeb, 0xfc, 0xce, 0x6d,
-    0xae, 0xed, 0x34, 0x5c, 0x97, 0xed, 0xb5, 0xdd, 0xa6, 0x8b, 0xb2, 0xff,
-    0xcf, 0x26, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x8e, 0xb3, 0x38, 0x7f, 0xab,
-    0x33, 0xbe, 0x18, 0x92, 0xce, 0xb4, 0x8e, 0xbf, 0x6d, 0xae, 0xed, 0x34,
-    0x52, 0xb7, 0xfc, 0xde, 0xa4, 0xdd, 0x89, 0xf0, 0xeb, 0xff, 0xdd, 0x89,
-    0xe3, 0xa9, 0xc1, 0xc3, 0xd4, 0x39, 0x93, 0x73, 0x74, 0x99, 0xc4, 0x63,
-    0xcc, 0xd9, 0x5c, 0xa6, 0x0e, 0xf0, 0xd7, 0xbf, 0xf3, 0xa7, 0xa4, 0x00,
-    0xb8, 0xfe, 0x75, 0x99, 0x0a, 0x71, 0xab, 0x8c, 0x9f, 0xa5, 0x35, 0x3b,
-    0x26, 0x66, 0x51, 0xbe, 0x72, 0xac, 0x93, 0x84, 0xab, 0x29, 0xfc, 0xfc,
-    0x4f, 0xf4, 0x99, 0xe8, 0x5e, 0x70, 0x8e, 0xd6, 0xff, 0xa4, 0xce, 0x6d,
-    0xae, 0xed, 0x34, 0x47, 0x17, 0xfc, 0x8c, 0xe6, 0xda, 0xee, 0xd3, 0x45,
-    0x6b, 0x66, 0x5d, 0x11, 0x3e, 0x45, 0xbf, 0xfc, 0xca, 0xde, 0x4c, 0xe6,
-    0xda, 0xee, 0xd3, 0x44, 0xb7, 0x78, 0x1b, 0xfc, 0xeb, 0xb3, 0x93, 0xaf,
-    0xf0, 0x71, 0x6b, 0x84, 0xd1, 0xd7, 0xb8, 0x02, 0x47, 0x53, 0x51, 0x05,
-    0xc8, 0xea, 0x0b, 0x70, 0x31, 0xbd, 0xd0, 0xc8, 0xeb, 0xfe, 0xce, 0x47,
-    0x3f, 0xfd, 0xe4, 0x75, 0xcb, 0x69, 0xd5, 0x07, 0x9f, 0x23, 0x9b, 0xe1,
-    0x8e, 0x64, 0x75, 0xff, 0xf9, 0xf9, 0xfc, 0x3d, 0x79, 0x66, 0x84, 0x0f,
-    0xf4, 0xea, 0x69, 0xfc, 0x74, 0x86, 0xfe, 0x4d, 0x8a, 0x7b, 0x47, 0x5f,
-    0xb6, 0xe3, 0x90, 0x75, 0x1a, 0x21, 0xbe, 0x9e, 0x7b, 0x95, 0xdd, 0x02,
-    0x75, 0xfc, 0x82, 0x1c, 0x40, 0x9d, 0x50, 0x6f, 0xa4, 0x29, 0x7d, 0x93,
-    0x4b, 0x0e, 0xbf, 0xf3, 0xc9, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0x98, 0x2f,
-    0xdf, 0xe9, 0xc7, 0xf3, 0xaf, 0xf0, 0x39, 0xda, 0x42, 0xf0, 0xeb, 0xfe,
-    0x89, 0xfc, 0x30, 0x0f, 0x68, 0xeb, 0x7b, 0xa7, 0xd5, 0xc6, 0x65, 0x7d,
-    0xcb, 0x51, 0x43, 0xab, 0x0f, 0x3b, 0xc5, 0x77, 0xfb, 0x49, 0xd4, 0x5e,
-    0x28, 0x75, 0xff, 0xe7, 0x9f, 0xa9, 0x03, 0x93, 0x26, 0xd0, 0xea, 0xf1,
-    0xfc, 0xb0, 0x65, 0x73, 0x70, 0xeb, 0x81, 0xf9, 0x54, 0x86, 0xb3, 0x62,
-    0xb7, 0xfb, 0x02, 0x39, 0xee, 0xe1, 0xd7, 0xf4, 0xff, 0x78, 0xdc, 0x7f,
-    0x3a, 0xfe, 0xcf, 0x7a, 0x37, 0xa3, 0xaf, 0xe7, 0x1f, 0xe7, 0xff, 0xc7,
-    0x54, 0x22, 0x38, 0x4c, 0xf8, 0xcb, 0x2c, 0xcc, 0x2e, 0xc4, 0xce, 0x7e,
-    0x16, 0xbc, 0x84, 0xcb, 0x5c, 0x79, 0x72, 0xd9, 0x02, 0xc8, 0x5d, 0x28,
-    0x61, 0xc1, 0xa8, 0x4d, 0x79, 0x3f, 0x81, 0x07, 0xd8, 0x5f, 0x5e, 0x58,
-    0x36, 0x55, 0xff, 0x9e, 0x4c, 0xe6, 0xda, 0xee, 0xd3, 0x44, 0xc7, 0x7d,
-    0x1b, 0x8e, 0x23, 0xac, 0xca, 0x22, 0x25, 0x63, 0x9d, 0x4a, 0xbe, 0x89,
-    0xe3, 0x67, 0x5f, 0xb2, 0x26, 0x45, 0x9d, 0x48, 0x78, 0xfb, 0x21, 0xbf,
-    0xdd, 0x8d, 0xcf, 0xf4, 0x1f, 0x9d, 0x73, 0xe8, 0xeb, 0xef, 0x9e, 0xce,
-    0x9d, 0x68, 0xe9, 0xb8, 0xd0, 0xad, 0xe8, 0x19, 0xce, 0xbf, 0xff, 0xfe,
-    0x96, 0xbb, 0x80, 0x63, 0x5d, 0xc6, 0xe6, 0xbe, 0x67, 0x32, 0xd2, 0x0a,
-    0x1d, 0x79, 0xdd, 0xa6, 0x8a, 0xc6, 0xf9, 0xfe, 0xc2, 0x87, 0x53, 0x4f,
-    0x2b, 0x64, 0xf7, 0xfe, 0xe3, 0xcf, 0x0e, 0x02, 0x07, 0xc7, 0x52, 0x89,
-    0xb5, 0x34, 0x9b, 0x91, 0xbd, 0xc3, 0x27, 0xc4, 0x57, 0xff, 0x0f, 0x94,
-    0x04, 0x0e, 0x36, 0x36, 0x75, 0xfe, 0xdc, 0xfe, 0xd3, 0xf2, 0xd3, 0xaa,
-    0x0f, 0xdd, 0xd0, 0xaf, 0xe8, 0xe2, 0xf6, 0x73, 0x31, 0xd7, 0xf0, 0x38,
-    0xdb, 0xd4, 0x54, 0x9d, 0x7f, 0x66, 0xb9, 0x94, 0x74, 0xeb, 0xa3, 0x81,
-    0xd6, 0x0f, 0x4f, 0x10, 0x4b, 0x6f, 0xfa, 0x39, 0x94, 0xd2, 0x7d, 0xce,
-    0x75, 0x42, 0x36, 0xb1, 0xe1, 0x09, 0xef, 0x44, 0xbc, 0x75, 0xff, 0xb0,
-    0x3b, 0x40, 0x4f, 0xfe, 0xa4, 0x75, 0xf2, 0xdf, 0x9f, 0x1d, 0x7f, 0xf4,
-    0xf1, 0xef, 0x9f, 0x5b, 0xf7, 0x8b, 0xee, 0x8e, 0xbf, 0xed, 0xc6, 0x9f,
-    0x63, 0x12, 0x3a, 0xb6, 0x88, 0x7e, 0x0a, 0x37, 0xa4, 0xf3, 0x9d, 0x7b,
-    0xe4, 0xeb, 0x3a, 0xe0, 0xf8, 0xea, 0x55, 0x26, 0x3f, 0x90, 0xa9, 0xe4,
-    0x95, 0x07, 0x04, 0x7e, 0xff, 0xc2, 0xe1, 0xec, 0x70, 0xeb, 0x89, 0xd7,
-    0xff, 0xfe, 0x04, 0xf8, 0xdf, 0x82, 0x0e, 0x2f, 0x99, 0xcc, 0xb0, 0x03,
-    0xfe, 0x8e, 0xbf, 0xe7, 0xe4, 0x70, 0x3d, 0x76, 0x0e, 0xa0, 0xa3, 0xa8,
-    0x4f, 0x74, 0xeb, 0x7f, 0x4f, 0x34, 0x95, 0x5b, 0x9c, 0xeb, 0xe1, 0x1c,
-    0xf1, 0xd4, 0xac, 0x9e, 0xa4, 0x1a, 0xdf, 0xd3, 0xfd, 0xe3, 0x71, 0xfc,
-    0xeb, 0xff, 0xa6, 0xeb, 0xaf, 0xdd, 0x8f, 0x01, 0x67, 0x5f, 0xf2, 0x49,
-    0x3a, 0x05, 0xad, 0x0e, 0xa8, 0x45, 0x7e, 0x19, 0xf9, 0x16, 0xf7, 0x51,
-    0x98, 0x64, 0x2b, 0xc8, 0x87, 0x23, 0xd9, 0x6c, 0x32, 0x76, 0x41, 0xd8,
-    0xc2, 0xdc, 0xb4, 0x46, 0xf5, 0x1a, 0xff, 0xa3, 0x3c, 0xe3, 0x84, 0x1f,
-    0xd8, 0x6a, 0xdd, 0x21, 0x3a, 0xfe, 0xde, 0xe0, 0x38, 0xb3, 0xae, 0xfb,
-    0xf9, 0xd7, 0xba, 0x8b, 0x3a, 0xd3, 0x1d, 0x4e, 0x6b, 0x00, 0x37, 0x7e,
-    0x71, 0x9c, 0x1a, 0x3a, 0xff, 0xa0, 0x3d, 0xc0, 0xed, 0xda, 0x75, 0x22,
-    0x3b, 0xff, 0x2c, 0x14, 0x5d, 0x10, 0x78, 0x9e, 0xf6, 0xbe, 0xe8, 0xeb,
-    0xee, 0x67, 0x85, 0x0e, 0xa0, 0x9e, 0x10, 0x07, 0xae, 0xf4, 0x1d, 0x7e,
-    0x5e, 0x0c, 0x48, 0xeb, 0xe0, 0x7b, 0x34, 0x75, 0xf4, 0x6d, 0xc4, 0xeb,
-    0xfc, 0xfb, 0x97, 0xe9, 0xce, 0x8e, 0xbe, 0xd6, 0xa3, 0xf3, 0xaa, 0x11,
-    0x76, 0x84, 0xbd, 0x21, 0x00, 0xfb, 0x06, 0x97, 0xd2, 0xfc, 0x12, 0x3a,
-    0xfb, 0x7f, 0x63, 0xf3, 0xaa, 0x0f, 0x1d, 0x08, 0xef, 0xf2, 0x4e, 0xeb,
-    0xff, 0xf8, 0x3a, 0xff, 0x91, 0xbd, 0xc9, 0x86, 0x02, 0x75, 0xf4, 0xbd,
-    0x9f, 0x4e, 0xbc, 0xd8, 0xfc, 0xeb, 0xdb, 0x85, 0x9d, 0x4e, 0x7b, 0x40,
-    0x23, 0x60, 0x72, 0xfd, 0x13, 0xfd, 0xc9, 0x8e, 0xbd, 0x03, 0x23, 0xaa,
-    0x64, 0xd6, 0x36, 0x41, 0xd3, 0x41, 0x84, 0x8e, 0x8b, 0xfc, 0x55, 0x7f,
-    0xe8, 0xcd, 0x7c, 0x84, 0x0f, 0xd9, 0x1d, 0x7f, 0x23, 0x1a, 0x9f, 0x18,
-    0x3a, 0x84, 0xfb, 0xfc, 0x81, 0x7e, 0x80, 0xfb, 0x1a, 0x75, 0xf7, 0x60,
-    0x5a, 0x75, 0x48, 0xf9, 0xf4, 0x43, 0xe2, 0x6b, 0xe7, 0x17, 0x98, 0xeb,
-    0xf2, 0x78, 0x72, 0x47, 0x5f, 0x43, 0x11, 0x31, 0xd7, 0x7d, 0x59, 0xd7,
-    0xfc, 0x0f, 0x9e, 0x17, 0xff, 0x04, 0xea, 0x9d, 0x17, 0x0a, 0x10, 0x21,
-    0x2f, 0x48, 0x84, 0x62, 0xff, 0x43, 0x01, 0x03, 0xee, 0x47, 0x5f, 0xc9,
-    0xbe, 0x75, 0x12, 0x3a, 0xdc, 0x0e, 0xad, 0x9f, 0x97, 0x4c, 0xf8, 0x8b,
-    0x6f, 0x0a, 0x28, 0x75, 0xf6, 0x05, 0x38, 0x1d, 0x74, 0x2f, 0x0d, 0xeb,
-    0x8d, 0xdb, 0x47, 0x52, 0x1b, 0xa7, 0x2a, 0xbb, 0xf8, 0x2a, 0xe6, 0x18,
-    0x2a, 0x90, 0xd7, 0x30, 0x2d, 0x7f, 0x9e, 0x43, 0x9e, 0xea, 0x14, 0xc9,
-    0xa1, 0xbc, 0xfc, 0xe8, 0xeb, 0xef, 0xbd, 0x7f, 0x1d, 0x41, 0x37, 0xfe,
-    0x1c, 0xbd, 0x03, 0x31, 0xd7, 0x0c, 0x1d, 0x69, 0x8e, 0xa9, 0x8f, 0x03,
-    0x63, 0x6e, 0x29, 0x7f, 0xf2, 0x88, 0x2d, 0xd4, 0x2d, 0xf9, 0xf1, 0xd7,
-    0xbf, 0xce, 0x23, 0xa9, 0x43, 0xe3, 0xda, 0x25, 0xf2, 0xf4, 0x05, 0x9d,
-    0x65, 0x0e, 0xb7, 0x19, 0xd7, 0x6d, 0x43, 0xaa, 0x0f, 0x75, 0x08, 0x80,
-    0x23, 0xf4, 0x4e, 0xff, 0xfb, 0xb9, 0x2d, 0x47, 0xa5, 0x8a, 0xee, 0x3f,
-    0x9d, 0x7f, 0xe9, 0x27, 0xbb, 0x9c, 0xf8, 0x10, 0x75, 0xd9, 0xa3, 0xaa,
-    0x0f, 0x4e, 0x47, 0xd5, 0xa4, 0x62, 0xfa, 0x14, 0x97, 0xe4, 0x85, 0xc2,
-    0xce, 0xb6, 0x1d, 0x48, 0x7b, 0x9a, 0x28, 0xe3, 0x25, 0xa8, 0x56, 0x03,
-    0x8c, 0x29, 0x09, 0x2e, 0xc2, 0x01, 0xe3, 0x5d, 0xbd, 0xa8, 0x98, 0xea,
-    0x3a, 0xcb, 0x3a, 0xbc, 0x5d, 0x70, 0x0a, 0xb9, 0xd4, 0x3a, 0xa6, 0x3e,
-    0xee, 0x9b, 0x09, 0x15, 0xde, 0x83, 0xaf, 0xd1, 0xdc, 0xe0, 0xe7, 0x53,
-    0x9b, 0xcf, 0xc5, 0x6f, 0xe4, 0xf6, 0x75, 0xd4, 0x3a, 0xfe, 0xe8, 0x1e,
-    0x7e, 0xa1, 0xd7, 0x98, 0x61, 0x82, 0xaf, 0xf8, 0x31, 0x3f, 0xdc, 0xeb,
-    0xf2, 0x53, 0x25, 0xfd, 0x05, 0x12, 0xed, 0x4c, 0xbd, 0x0b, 0x43, 0xab,
-    0x0d, 0xeb, 0x48, 0xef, 0x93, 0x7c, 0x41, 0x3a, 0xfd, 0xd8, 0xe5, 0xd5,
-    0xce, 0xbf, 0xfe, 0x8f, 0x68, 0x39, 0xe4, 0xe8, 0x33, 0x9f, 0x1d, 0x5d,
-    0x3f, 0x9f, 0x15, 0x5b, 0x67, 0x5f, 0xec, 0xc6, 0xfd, 0xe1, 0xdc, 0x3a,
-    0xe0, 0x68, 0xeb, 0xff, 0xf6, 0x06, 0x33, 0x9f, 0xbe, 0x41, 0x04, 0xb3,
-    0x47, 0x5c, 0xbf, 0xce, 0xb9, 0xc4, 0xea, 0xe9, 0xab, 0x71, 0x7b, 0xf2,
-    0xd3, 0xdf, 0xb9, 0xd5, 0x3a, 0x7c, 0x39, 0x09, 0xd5, 0x72, 0x29, 0x84,
-    0x1c, 0xd4, 0x45, 0xbd, 0x08, 0x00, 0x10, 0x5f, 0x77, 0xc9, 0x39, 0xd7,
-    0xf9, 0xa9, 0xa1, 0xce, 0x0e, 0x75, 0xf4, 0x4e, 0xf2, 0x3a, 0xec, 0xf1,
-    0xd7, 0xec, 0x9c, 0x73, 0x93, 0xab, 0x11, 0x63, 0xc9, 0x16, 0xcc, 0xba,
-    0x42, 0x22, 0xb7, 0xbb, 0x01, 0x3a, 0xed, 0xe8, 0xea, 0x39, 0x0b, 0x6b,
-    0xfd, 0x03, 0x27, 0x5e, 0x04, 0xeb, 0xef, 0x2d, 0x7b, 0x3a, 0xff, 0xef,
-    0xe0, 0x5a, 0xfe, 0xff, 0xe8, 0xc8, 0xeb, 0xd2, 0x4e, 0x9d, 0x7d, 0xe1,
-    0xc9, 0x1d, 0x7e, 0xc0, 0x2a, 0x74, 0xe7, 0x5f, 0xfe, 0x4d, 0x77, 0x02,
-    0x39, 0xc0, 0x73, 0x47, 0x54, 0x93, 0x45, 0x50, 0xc3, 0x92, 0x29, 0x91,
-    0xb6, 0x36, 0x24, 0x1e, 0x2a, 0xa5, 0x53, 0x67, 0x2f, 0x11, 0x82, 0x4f,
-    0x08, 0xb9, 0x11, 0x06, 0x1a, 0x19, 0x1f, 0x47, 0x31, 0x99, 0xa4, 0x39,
-    0xe6, 0x85, 0xe6, 0xe1, 0x52, 0xb6, 0xee, 0xcb, 0x81, 0x78, 0x63, 0x7e,
-    0xd6, 0xa9, 0x21, 0x18, 0xc0, 0x35, 0x28, 0x07, 0xd1, 0x97, 0xb0, 0x93,
-    0xc6, 0x63, 0xf6, 0x35, 0xdb, 0xfe, 0x67, 0xc9, 0x9c, 0x5a, 0x04, 0x1d,
-    0x7f, 0xff, 0xc0, 0x86, 0x7d, 0xa4, 0xeb, 0xa7, 0xb3, 0x7f, 0xad, 0xe4,
-    0x75, 0x32, 0xa8, 0x76, 0x78, 0xdf, 0x02, 0x77, 0x7e, 0xdb, 0x5d, 0xda,
-    0x68, 0xad, 0xef, 0xfc, 0xf2, 0x67, 0x36, 0xd7, 0x76, 0x9a, 0x27, 0x0b,
-    0x33, 0x87, 0xfa, 0xb3, 0x3b, 0x95, 0x41, 0x3a, 0xdd, 0x3a, 0xda, 0x3a,
-    0x80, 0x68, 0x38, 0xc4, 0x2f, 0x9a, 0xee, 0xd3, 0x45, 0xa3, 0x7f, 0xfb,
-    0x03, 0xd7, 0x52, 0x69, 0x93, 0x40, 0x59, 0xd5, 0xb3, 0xf9, 0xe9, 0x6d,
-    0xf3, 0x5c, 0x7f, 0x3a, 0xff, 0xa6, 0xc5, 0x7d, 0x6f, 0x6f, 0xe3, 0xaf,
-    0xe8, 0x71, 0x00, 0x70, 0xeb, 0x91, 0x43, 0xaf, 0xff, 0xd3, 0xc7, 0xa0,
-    0x3b, 0x8e, 0xbe, 0x87, 0x3f, 0x3a, 0xff, 0xd1, 0xcb, 0xab, 0xf4, 0x5d,
-    0x5e, 0x73, 0xaf, 0xfd, 0x1b, 0xff, 0x13, 0x37, 0xe0, 0x1d, 0x50, 0x8d,
-    0x5e, 0xaa, 0x69, 0x12, 0xd9, 0x32, 0x63, 0x5a, 0x87, 0x5d, 0xfe, 0xef,
-    0x40, 0xa2, 0xe3, 0x47, 0x5f, 0xff, 0x93, 0x43, 0x9c, 0x1f, 0xc3, 0x9a,
-    0xeb, 0xcc, 0x75, 0x62, 0x22, 0x26, 0x34, 0xbe, 0xcf, 0xdf, 0xa7, 0x5d,
-    0xdd, 0x1d, 0x66, 0x55, 0x0a, 0xea, 0xd5, 0xb3, 0xac, 0x84, 0xeb, 0x48,
-    0xa6, 0x21, 0x59, 0xe7, 0x63, 0x44, 0xf4, 0x2d, 0xf8, 0xc8, 0xfe, 0x90,
-    0xdf, 0x35, 0xdd, 0xa6, 0x8b, 0x6a, 0xff, 0xfe, 0x87, 0xf4, 0x76, 0x34,
-    0x89, 0x24, 0xde, 0x04, 0xeb, 0xfb, 0xb0, 0xb8, 0x40, 0x9d, 0x5b, 0x45,
-    0x76, 0x8b, 0x7c, 0xad, 0x7f, 0xee, 0xa0, 0x5e, 0x41, 0xea, 0x2c, 0xeb,
-    0xe8, 0xe1, 0x88, 0x75, 0xff, 0x44, 0xa3, 0x73, 0xc6, 0xe7, 0x3a, 0xff,
-    0xa3, 0x7f, 0x35, 0x1d, 0x74, 0x3a, 0xff, 0x75, 0x1e, 0x5e, 0x49, 0xce,
-    0xac, 0x4c, 0xc5, 0xa6, 0x1b, 0x3d, 0x12, 0x16, 0x0e, 0x78, 0xce, 0x2f,
-    0xe5, 0x1f, 0x61, 0x00, 0x9d, 0x7e, 0x49, 0xd7, 0x0d, 0x3a, 0xfc, 0xfc,
-    0xcb, 0xee, 0x8e, 0xb3, 0x2a, 0x1f, 0xf7, 0x8b, 0x78, 0x13, 0xd3, 0x29,
-    0x88, 0xff, 0x0d, 0x8b, 0x97, 0xd3, 0xaf, 0xdb, 0x6b, 0xbb, 0x4d, 0x17,
-    0x2d, 0x99, 0x09, 0xe4, 0xe0, 0xb5, 0xfb, 0x6d, 0x77, 0x69, 0xa2, 0xed,
-    0xbf, 0xe4, 0x94, 0x90, 0x7f, 0x89, 0x1d, 0x66, 0x70, 0xfa, 0x9c, 0xce,
-    0xa1, 0xd8, 0x5b, 0xce, 0x53, 0x29, 0xe6, 0x20, 0xc6, 0xd0, 0xa5, 0x23,
-    0x51, 0x2b, 0x69, 0x75, 0x78, 0x5b, 0xf6, 0x5e, 0x98, 0xcb, 0xa2, 0xd3,
-    0xa7, 0xa1, 0x25, 0x7f, 0x99, 0xcd, 0xb5, 0xdd, 0xa6, 0x8a, 0x9e, 0xf0,
-    0x67, 0x59, 0xd6, 0xf1, 0xd7, 0xfd, 0x0f, 0x3f, 0xce, 0x75, 0x01, 0x3a,
-    0x90, 0xf2, 0xc4, 0x42, 0xf9, 0xae, 0xed, 0x34, 0x57, 0x37, 0xf9, 0x9c,
-    0xdb, 0x5d, 0xda, 0x68, 0xb3, 0xaf, 0x3b, 0xc8, 0xeb, 0xf9, 0x35, 0x82,
-    0xec, 0x1d, 0x5b, 0x45, 0x8f, 0x4b, 0x44, 0xff, 0xc3, 0x57, 0xff, 0xbd,
-    0x1a, 0xf8, 0x0d, 0x7a, 0x26, 0x99, 0x0e, 0xbf, 0x91, 0x73, 0x83, 0x72,
-    0x3a, 0xff, 0x47, 0x7e, 0x2d, 0x5b, 0x54, 0x78, 0xea, 0xc4, 0x5c, 0xf5,
-    0x37, 0x81, 0x75, 0xfb, 0x79, 0xe4, 0x59, 0xd7, 0xce, 0x30, 0x13, 0xaf,
-    0xec, 0x9a, 0x17, 0x1f, 0x4e, 0xbf, 0x6d, 0xae, 0xed, 0x34, 0x48, 0x57,
-    0xfe, 0xc5, 0xe3, 0xee, 0x7f, 0x9c, 0xac, 0xeb, 0xfe, 0x4e, 0x75, 0xe1,
-    0x85, 0xe8, 0xeb, 0xa4, 0xce, 0x22, 0xb3, 0xa6, 0x7f, 0xa0, 0xdf, 0xfd,
-    0xd4, 0x5e, 0x6b, 0xe7, 0x32, 0xcf, 0x1d, 0x7d, 0x2e, 0xfd, 0xd1, 0xd5,
-    0x07, 0xd5, 0x88, 0xd7, 0xca, 0xdf, 0x61, 0x67, 0x5f, 0xdd, 0xd6, 0xb3,
-    0x73, 0x9d, 0x74, 0x30, 0x75, 0x61, 0xe2, 0x21, 0x75, 0x99, 0x9d, 0x73,
-    0x3c, 0x2d, 0x19, 0x0d, 0x14, 0x87, 0xae, 0xcc, 0x56, 0x4d, 0xd1, 0xf7,
-    0x86, 0xd0, 0xc2, 0x9f, 0x44, 0x1e, 0x6a, 0xbf, 0xf9, 0x9e, 0xbe, 0x87,
-    0x3d, 0xe8, 0xfc, 0xeb, 0xff, 0xcc, 0xad, 0xe4, 0xce, 0x6d, 0xae, 0xed,
-    0x34, 0x4f, 0x94, 0xd5, 0xe5, 0xc5, 0x79, 0xd0, 0xe5, 0xc2, 0xcf, 0xa8,
-    0x97, 0x27, 0x27, 0x5f, 0xff, 0x4a, 0x75, 0x5a, 0x15, 0xb9, 0xdb, 0xbf,
-    0x9f, 0x3b, 0xc6, 0x75, 0x48, 0xfe, 0xbf, 0x16, 0xbf, 0x66, 0xf3, 0x26,
-    0x3a, 0xcc, 0xf4, 0xf2, 0x7e, 0x91, 0xdf, 0xb6, 0xd7, 0x76, 0x9a, 0x2b,
-    0x2b, 0xff, 0x3c, 0x99, 0xcd, 0xb5, 0xdd, 0xa6, 0x89, 0xba, 0xcc, 0xe1,
-    0xfe, 0xac, 0xce, 0x9a, 0x8d, 0x04, 0x85, 0x45, 0xfb, 0x6d, 0x77, 0x69,
-    0xa2, 0x56, 0xbf, 0x0c, 0x05, 0xfa, 0x75, 0xf9, 0x95, 0xbc, 0x99, 0xc3,
-    0xd8, 0x43, 0x3b, 0xff, 0x7b, 0x19, 0xcd, 0xa4, 0xee, 0xb3, 0xaf, 0xff,
-    0x2b, 0x0a, 0xca, 0xa3, 0x58, 0xf2, 0x4c, 0xde, 0x1d, 0x7f, 0xe4, 0xd0,
-    0x16, 0x29, 0xc0, 0x0e, 0x75, 0xfd, 0x02, 0xed, 0x75, 0x73, 0xaa, 0x47,
-    0xd6, 0xb3, 0xeb, 0x83, 0xb3, 0xaf, 0xdb, 0x6b, 0xbb, 0x4d, 0x12, 0xe5,
-    0xff, 0x23, 0xcb, 0xc3, 0x0b, 0xd1, 0xd7, 0xe9, 0x71, 0xa7, 0x5c, 0xeb,
-    0xd1, 0xc7, 0x07, 0x5e, 0x41, 0x83, 0xaa, 0x47, 0xbe, 0x12, 0x9e, 0x03,
-    0xb7, 0xff, 0xe7, 0xf2, 0x02, 0x42, 0x92, 0x8f, 0x08, 0x24, 0x75, 0xfd,
-    0x2e, 0xe0, 0xe3, 0x4e, 0xbd, 0x2e, 0xf8, 0xeb, 0xbb, 0x08, 0x78, 0xfd,
-    0x2b, 0xbf, 0xf8, 0x53, 0xfd, 0x6e, 0x12, 0x4f, 0xa3, 0xab, 0x0f, 0xb9,
-    0x0b, 0x2f, 0x3c, 0x99, 0x55, 0xea, 0xc6, 0x22, 0x18, 0x12, 0x22, 0xc1,
-    0x6e, 0x99, 0xbc, 0x25, 0x74, 0x63, 0xe8, 0xc1, 0xec, 0xca, 0x2b, 0xee,
-    0x5c, 0xb5, 0x6b, 0xff, 0x99, 0x79, 0x33, 0x9b, 0x6b, 0xbb, 0x4d, 0x11,
-    0xdd, 0xff, 0x7b, 0xb9, 0x26, 0x5c, 0x74, 0x75, 0xfc, 0xaa, 0x18, 0x6e,
-    0x09, 0xd7, 0x03, 0xa7, 0x5f, 0xca, 0x81, 0xce, 0xbf, 0x8e, 0xbf, 0xff,
-    0xbd, 0x24, 0x0f, 0x53, 0x87, 0xcc, 0x0e, 0xd0, 0x0d, 0x3a, 0xff, 0x63,
-    0x1a, 0x81, 0xf6, 0x8e, 0xbf, 0xf2, 0x6f, 0xe6, 0x87, 0x17, 0x0d, 0x3a,
-    0xff, 0xd0, 0x20, 0xf2, 0x3f, 0x07, 0x91, 0xd7, 0xcd, 0x77, 0x69, 0xa2,
-    0xa1, 0xbf, 0xec, 0xee, 0x0b, 0xef, 0x68, 0x75, 0x28, 0x8d, 0xd6, 0x9f,
-    0x6c, 0xf7, 0x45, 0xb7, 0x4b, 0x0e, 0xbf, 0xe9, 0x79, 0x36, 0xed, 0x41,
-    0x3a, 0xff, 0xf3, 0xaf, 0x36, 0x38, 0x9c, 0x13, 0x6e, 0x75, 0xff, 0xdd,
-    0x1c, 0x9b, 0xdd, 0xcd, 0xa6, 0x8e, 0xbf, 0x72, 0x28, 0xb4, 0x3a, 0xa1,
-    0x16, 0x18, 0x8e, 0x88, 0x77, 0xfa, 0x3c, 0xfd, 0xf8, 0x18, 0x3a, 0xff,
-    0xc0, 0xf8, 0xe3, 0x9c, 0x5f, 0x3a, 0x03, 0xaf, 0xf4, 0xa3, 0x73, 0xc6,
-    0xe7, 0x3a, 0xff, 0xfa, 0x3f, 0xc1, 0xf8, 0xfe, 0xf9, 0xdc, 0xfd, 0xce,
-    0xb8, 0x67, 0x3a, 0xa1, 0x13, 0x88, 0x68, 0x2a, 0x57, 0xf7, 0x07, 0x5f,
-    0x58, 0x73, 0xaf, 0xff, 0xf2, 0x47, 0x9f, 0xac, 0xeb, 0xb8, 0x3e, 0xf9,
-    0xfc, 0xb4, 0x75, 0xb1, 0x11, 0x24, 0x25, 0xf7, 0xdd, 0xf6, 0x4e, 0x75,
-    0xfb, 0x27, 0x71, 0xe0, 0x75, 0xff, 0xff, 0xfe, 0x89, 0x7c, 0xf7, 0x52,
-    0x35, 0xf3, 0x00, 0xd8, 0xe1, 0xf3, 0x37, 0xbc, 0xe0, 0x07, 0xe9, 0xd7,
-    0xdd, 0x17, 0xe2, 0x3a, 0xb1, 0x30, 0x31, 0x22, 0xd1, 0x47, 0xa1, 0x2d,
-    0x7f, 0xff, 0xc0, 0x75, 0x74, 0x9f, 0xae, 0x9e, 0x8e, 0xa7, 0xb5, 0x81,
-    0x3a, 0xcc, 0xaa, 0x17, 0xba, 0x55, 0xb2, 0xe5, 0x50, 0xb4, 0x17, 0xce,
-    0xbd, 0x91, 0x87, 0xb4, 0xfb, 0x91, 0x5d, 0xc3, 0x99, 0x65, 0xbd, 0x33,
-    0x18, 0x70, 0x6a, 0x17, 0xfe, 0x8c, 0xa7, 0x8d, 0x06, 0xf9, 0xae, 0xed,
-    0x34, 0x55, 0x17, 0xfb, 0x71, 0xc3, 0x99, 0x67, 0x8e, 0xad, 0x9f, 0x10,
-    0x0b, 0x6f, 0xfc, 0xf2, 0x67, 0x36, 0xd7, 0x76, 0x9a, 0x26, 0xbb, 0xcb,
-    0x7f, 0x1d, 0x66, 0x71, 0x10, 0xeb, 0x22, 0x74, 0xab, 0xf6, 0xda, 0xee,
-    0xd3, 0x45, 0x59, 0x7f, 0xd1, 0x28, 0xdc, 0xf1, 0xb9, 0xce, 0xb3, 0x38,
-    0x7d, 0x82, 0x67, 0x7f, 0xe6, 0x7b, 0x1c, 0xfa, 0x3a, 0xea, 0xe7, 0x5f,
-    0xfc, 0xcb, 0xc9, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0x91, 0x2f, 0xdb, 0x6b,
-    0xbb, 0x4d, 0x16, 0x95, 0xff, 0x9e, 0x4c, 0xe6, 0xda, 0xee, 0xd3, 0x44,
-    0xfb, 0x66, 0x70, 0xff, 0x56, 0x67, 0x7f, 0xf9, 0x95, 0xbc, 0x99, 0xcd,
-    0xb5, 0xdd, 0xa6, 0x8a, 0x12, 0xfd, 0xd4, 0x9e, 0x36, 0x75, 0xfb, 0x6d,
-    0x77, 0x69, 0xa2, 0x8f, 0xbf, 0xe8, 0x94, 0x6e, 0x78, 0xdc, 0xe7, 0x5f,
-    0xf8, 0x62, 0x68, 0x18, 0x9b, 0xb0, 0x75, 0xff, 0xfd, 0x81, 0xec, 0x7d,
-    0x67, 0xc2, 0xff, 0xeb, 0x51, 0xf9, 0x57, 0xe6, 0x56, 0xf2, 0x66, 0x13,
-    0x2d, 0xc2, 0x71, 0x33, 0xf1, 0xcf, 0x19, 0xe5, 0x43, 0x63, 0x51, 0x3c,
-    0xe1, 0x6c, 0x8c, 0xb1, 0x45, 0x49, 0xf2, 0x16, 0xc7, 0xd3, 0xcc, 0x28,
-    0x50, 0x9e, 0x64, 0x2e, 0xc3, 0x3b, 0xf2, 0x8f, 0x47, 0x09, 0x7f, 0x99,
-    0xcd, 0xb5, 0xdd, 0xa6, 0x88, 0x8a, 0xfe, 0xcd, 0xb5, 0xdd, 0xa6, 0x88,
-    0xae, 0xff, 0x95, 0xd9, 0xcd, 0xb5, 0xdd, 0xa6, 0x8a, 0xe2, 0x99, 0x44,
-    0x03, 0x9c, 0x5f, 0xfe, 0xfe, 0x05, 0xac, 0xbf, 0xbf, 0xfa, 0x32, 0x3a,
-    0xf9, 0x99, 0xe6, 0x57, 0x3a, 0xc9, 0xc9, 0xfa, 0xfe, 0x9b, 0x7d, 0x9d,
-    0x7f, 0x1d, 0x7f, 0xb1, 0x37, 0xff, 0xe0, 0xd1, 0xd6, 0x54, 0x09, 0xea,
-    0x68, 0x82, 0xff, 0xfe, 0xf6, 0x93, 0xae, 0x92, 0x41, 0xf0, 0x3b, 0xbc,
-    0x3a, 0xfd, 0xb6, 0xbb, 0xb4, 0xd1, 0x4f, 0x5f, 0xe5, 0xa0, 0x40, 0xfb,
-    0x91, 0xd7, 0x2d, 0x0e, 0xa8, 0x3c, 0x76, 0x99, 0x5f, 0xff, 0xdb, 0xd8,
-    0x37, 0xb8, 0x1c, 0x51, 0x3b, 0xdc, 0xfa, 0x75, 0xff, 0xc9, 0x2c, 0x1f,
-    0xe1, 0x69, 0xb9, 0x1d, 0x7f, 0xa5, 0x1b, 0x9e, 0x37, 0x39, 0xd7, 0xdf,
-    0x05, 0xe4, 0x75, 0xf9, 0xf3, 0xa8, 0xb3, 0xab, 0x47, 0x8f, 0xc0, 0x8a,
-    0xa1, 0x13, 0xf8, 0xf7, 0x7f, 0xd0, 0x2d, 0xce, 0x19, 0xed, 0x1d, 0x7e,
-    0x79, 0xe3, 0x60, 0x3a, 0x95, 0x4a, 0xb6, 0xe0, 0xaf, 0x16, 0x1a, 0xf4,
-    0x84, 0x2e, 0xb8, 0x30, 0xe1, 0xe0, 0x43, 0xc6, 0x71, 0x7f, 0xf9, 0xe4,
-    0xc8, 0x45, 0xd8, 0xd6, 0xa3, 0xf3, 0xaf, 0xff, 0x7f, 0xf8, 0x34, 0xcf,
-    0xd1, 0x75, 0x8c, 0x1d, 0x7f, 0xf0, 0xe7, 0xee, 0x3f, 0xb2, 0xb4, 0x59,
-    0xd5, 0xb4, 0x48, 0xf9, 0x36, 0x99, 0x4e, 0x20, 0x30, 0x89, 0x48, 0x6e,
-    0x5c, 0x1c, 0x3a, 0xff, 0xe4, 0x0e, 0xdf, 0x96, 0x77, 0xb8, 0x9c, 0xea,
-    0x64, 0xf6, 0xfa, 0x2b, 0x70, 0x60, 0xeb, 0xff, 0xf7, 0x63, 0x79, 0x24,
-    0x7f, 0x60, 0x50, 0x0d, 0x2a, 0xfd, 0x12, 0xfc, 0x12, 0x3a, 0xf9, 0xae,
-    0xed, 0x34, 0x56, 0x75, 0x31, 0xea, 0xec, 0xa2, 0xfb, 0xc8, 0xbd, 0x1d,
-    0x7f, 0x4e, 0xb8, 0x19, 0x68, 0xeb, 0xf6, 0x7b, 0x5f, 0x74, 0x75, 0xe8,
-    0x9d, 0x0e, 0xbf, 0x7b, 0xff, 0xa3, 0x23, 0xaf, 0x01, 0xf4, 0x75, 0xff,
-    0x64, 0x90, 0x0a, 0xea, 0xdf, 0xeb, 0x3a, 0xfd, 0x93, 0x4e, 0x0f, 0xce,
-    0xb3, 0x30, 0xa8, 0x84, 0x22, 0xb9, 0x0a, 0x7e, 0x48, 0xf6, 0x42, 0xb2,
-    0xde, 0x94, 0xb8, 0xd8, 0x95, 0x68, 0x6f, 0xea, 0x0d, 0xff, 0xba, 0x9e,
-    0x7d, 0xcf, 0x08, 0x13, 0xaf, 0xde, 0x41, 0xc5, 0x9d, 0x7d, 0x27, 0x16,
-    0x70, 0xf8, 0xb8, 0x8f, 0x6f, 0xfc, 0xf2, 0x67, 0x36, 0xd7, 0x76, 0x9a,
-    0x24, 0x5b, 0xff, 0x3f, 0x99, 0x84, 0xda, 0x78, 0x07, 0x53, 0x28, 0x87,
-    0x74, 0xab, 0xfb, 0x36, 0xd7, 0x76, 0x9a, 0x2c, 0x9b, 0xff, 0xde, 0xd7,
-    0xdd, 0x33, 0x93, 0xa0, 0xcb, 0x47, 0x53, 0x28, 0x85, 0xc3, 0x8b, 0xff,
-    0xfc, 0xe9, 0xe0, 0x6d, 0xf4, 0xcb, 0x7a, 0x9b, 0x89, 0x68, 0xeb, 0xfb,
-    0x36, 0xd7, 0x76, 0x9a, 0x2d, 0x8b, 0xff, 0xf9, 0x51, 0xdf, 0x83, 0x9b,
-    0xf6, 0xbb, 0x37, 0xcf, 0x9d, 0xe3, 0x3a, 0xf6, 0xc1, 0xd3, 0xae, 0xf3,
-    0x30, 0x88, 0x6d, 0xb5, 0x53, 0x28, 0xed, 0x48, 0x5f, 0x5e, 0xcd, 0x61,
-    0xd7, 0xcd, 0x77, 0x69, 0xa2, 0xdb, 0xbe, 0xd4, 0xef, 0xb3, 0xab, 0x67,
-    0x9f, 0xe2, 0xdb, 0xf9, 0x3b, 0xe4, 0xfc, 0x07, 0x5f, 0xf4, 0x4a, 0x37,
-    0x3c, 0x6e, 0x73, 0xac, 0xcc, 0x91, 0xe3, 0x8d, 0x33, 0x11, 0x09, 0x6d,
-    0xe5, 0x57, 0x42, 0x75, 0xe9, 0xfa, 0x87, 0x5f, 0xf9, 0x54, 0xaa, 0x56,
-    0x9e, 0xee, 0x0c, 0x7e, 0x75, 0xfd, 0x03, 0x20, 0x81, 0x67, 0x5f, 0x35,
-    0xdd, 0xa6, 0x8b, 0xc2, 0xff, 0xcf, 0xe8, 0xe1, 0xbd, 0xe7, 0x3a, 0x3a,
-    0xb6, 0x7d, 0xa2, 0x5b, 0x7d, 0xee, 0x3c, 0xe9, 0xd7, 0xe5, 0xc0, 0xc9,
-    0xce, 0xbf, 0xd2, 0x81, 0xf7, 0x07, 0x69, 0xd7, 0xfa, 0x3c, 0xfd, 0xf8,
-    0x18, 0x3a, 0xff, 0xdf, 0x57, 0xcc, 0xbd, 0x83, 0xed, 0x1d, 0x76, 0x28,
-    0x75, 0x41, 0xeb, 0xe2, 0x0d, 0xf2, 0x4f, 0x8b, 0x3a, 0xfd, 0x83, 0xff,
-    0x14, 0x1d, 0x7e, 0x8f, 0xa0, 0x7d, 0x1d, 0x7f, 0xf6, 0x77, 0xaf, 0x25,
-    0xa4, 0x6e, 0x47, 0x5d, 0x1f, 0x9d, 0x52, 0x3d, 0x8f, 0x21, 0x52, 0xa1,
-    0x5a, 0xa2, 0xa8, 0x81, 0x57, 0x8e, 0x4e, 0x99, 0x90, 0x99, 0xe4, 0x85,
-    0x09, 0x26, 0x25, 0x59, 0x9f, 0x61, 0x14, 0xe4, 0x1f, 0x90, 0x89, 0x4f,
-    0xa1, 0x01, 0x7f, 0xb9, 0x67, 0x3f, 0x7d, 0xe8, 0xeb, 0xfd, 0xfb, 0x33,
-    0x4a, 0x07, 0xc7, 0x53, 0x29, 0xa4, 0x44, 0x37, 0xb6, 0x6b, 0x79, 0x33,
-    0x93, 0xaf, 0x9a, 0xee, 0xd3, 0x45, 0xe9, 0x7f, 0xe4, 0xf7, 0x45, 0xe5,
-    0xfb, 0xfe, 0x75, 0x6c, 0xfa, 0xd6, 0x5b, 0x79, 0x69, 0xe3, 0xaf, 0xf9,
-    0xfd, 0x28, 0x53, 0xc9, 0x39, 0xd4, 0xb3, 0xd4, 0x11, 0xbb, 0xf6, 0x2f,
-    0xae, 0x13, 0xa8, 0x29, 0xa1, 0xe4, 0x21, 0xbe, 0xbb, 0x71, 0x10, 0xdf,
-    0xff, 0xf2, 0x70, 0xc1, 0x64, 0x38, 0x1e, 0xe2, 0xd6, 0xf2, 0xc1, 0x3a,
-    0x99, 0x45, 0x66, 0x23, 0xd4, 0x36, 0xa6, 0x53, 0xc2, 0xfe, 0x50, 0x98,
-    0xc9, 0xce, 0x06, 0xc2, 0x59, 0x25, 0x22, 0x4d, 0x18, 0x3e, 0xe1, 0x84,
-    0xb8, 0x54, 0x74, 0x8f, 0xf8, 0xd3, 0x46, 0x31, 0x90, 0x4e, 0x6f, 0xb1,
-    0x28, 0x96, 0xe0, 0x74, 0xeb, 0xff, 0x81, 0x13, 0x0e, 0x70, 0x75, 0xad,
-    0x0e, 0xbe, 0xce, 0xbf, 0x8e, 0xbf, 0xd8, 0x9b, 0xff, 0xf0, 0x68, 0xeb,
-    0x2a, 0x14, 0x44, 0xc0, 0xa2, 0x68, 0x82, 0xfb, 0xd1, 0xcc, 0xe7, 0x5f,
-    0xf7, 0xb5, 0x9c, 0xcb, 0xa0, 0x50, 0xea, 0x43, 0xde, 0x12, 0x3b, 0xf6,
-    0xda, 0xee, 0xd3, 0x44, 0x47, 0x7f, 0xfd, 0xd0, 0x6b, 0x58, 0xb1, 0xce,
-    0x1f, 0x21, 0x58, 0x3a, 0xff, 0xa2, 0x7d, 0xe7, 0xbc, 0x9e, 0x3a, 0xf0,
-    0xc7, 0x27, 0x54, 0x8f, 0x4c, 0x27, 0x17, 0xfd, 0x9b, 0xcd, 0x63, 0x8c,
-    0xe7, 0x5e, 0xc0, 0xac, 0xeb, 0xff, 0xfd, 0xd7, 0x4f, 0x47, 0x47, 0x3d,
-    0xd4, 0xee, 0x23, 0x07, 0x5f, 0xff, 0xfe, 0xf7, 0x91, 0x7b, 0x4c, 0xe4,
-    0x41, 0xe8, 0xef, 0xce, 0x09, 0xe9, 0xa0, 0xea, 0x84, 0x6c, 0x62, 0xed,
-    0xfe, 0x75, 0xe6, 0xe5, 0x0b, 0x3a, 0xe9, 0xd6, 0x55, 0xcc, 0x30, 0x55,
-    0xff, 0x99, 0x6f, 0x52, 0x6e, 0xc4, 0xec, 0xfe, 0x6b, 0xd8, 0x17, 0xbe,
-    0xe1, 0x1e, 0x83, 0xaa, 0x47, 0xfa, 0x8b, 0x77, 0xf6, 0x3a, 0xf3, 0x9f,
-    0x1d, 0x7f, 0x9d, 0x9d, 0x26, 0xdf, 0xf3, 0xac, 0xae, 0x75, 0xff, 0x46,
-    0x73, 0x0f, 0x27, 0x91, 0xd4, 0xac, 0x9e, 0x48, 0x44, 0xef, 0xe5, 0x71,
-    0xce, 0xbf, 0x8e, 0xbf, 0xa1, 0x4c, 0x14, 0x50, 0xeb, 0xfb, 0x3d, 0xc5,
-    0xec, 0xe9, 0xd5, 0x88, 0x89, 0x12, 0xed, 0x16, 0x5f, 0xff, 0xcd, 0x67,
-    0x6e, 0x29, 0xe6, 0x77, 0x1e, 0x17, 0xfc, 0xea, 0x56, 0xd7, 0xa3, 0x95,
-    0x50, 0xae, 0x88, 0x4c, 0x61, 0x03, 0x4c, 0xf9, 0x85, 0x52, 0x11, 0x4c,
-    0x6d, 0xb8, 0x79, 0xf4, 0x85, 0xe1, 0xbb, 0xf9, 0x08, 0x96, 0x69, 0xf3,
-    0xd0, 0xb0, 0xe0, 0x5d, 0x77, 0x17, 0x4e, 0xbf, 0x6d, 0xae, 0xed, 0x34,
-    0x45, 0xd7, 0xef, 0x7f, 0xf4, 0x64, 0x55, 0xfb, 0x5e, 0xec, 0x7e, 0x75,
-    0xf9, 0xe7, 0x8d, 0x80, 0xeb, 0x33, 0x3a, 0x31, 0x70, 0x65, 0xcc, 0xc0,
-    0x55, 0xc6, 0x51, 0x4c, 0xaa, 0x1b, 0x94, 0x79, 0x17, 0xff, 0x2d, 0xe4,
-    0xce, 0x6d, 0xae, 0xed, 0x34, 0x4c, 0xd7, 0xf2, 0xac, 0xad, 0x15, 0x1a,
-    0x8f, 0x1d, 0x7b, 0x98, 0xd1, 0xd7, 0x9a, 0x8b, 0x3a, 0xf9, 0x55, 0xe7,
-    0x13, 0xae, 0xe3, 0x56, 0x4e, 0xbb, 0x00, 0x75, 0xff, 0xee, 0xc2, 0xdf,
-    0xd9, 0xcf, 0xeb, 0xfb, 0xd3, 0xaf, 0xef, 0x64, 0xf9, 0xfc, 0xc7, 0x5f,
-    0xef, 0x98, 0x2f, 0xbf, 0xf8, 0xce, 0xbf, 0xff, 0x2d, 0xfb, 0x9c, 0xff,
-    0xd6, 0x1f, 0xb3, 0x74, 0x07, 0x50, 0x51, 0x21, 0x86, 0xf7, 0x6b, 0x0e,
-    0xbb, 0x8b, 0xc7, 0x59, 0x52, 0x75, 0xbf, 0x83, 0x5a, 0x01, 0x9b, 0xff,
-    0xff, 0x20, 0xc3, 0x46, 0x17, 0xf2, 0x37, 0xb4, 0xe1, 0xb7, 0x7f, 0xce,
-    0xa5, 0x65, 0x51, 0xb3, 0x47, 0x90, 0x56, 0x64, 0xde, 0xc2, 0xfd, 0xc8,
-    0xbf, 0x42, 0xf1, 0x3d, 0xfc, 0xc4, 0x08, 0xe7, 0x8e, 0xbe, 0x7e, 0xa4,
-    0xc7, 0x5f, 0x76, 0x68, 0x09, 0xd5, 0x87, 0xdc, 0xd2, 0xb7, 0x21, 0xbf,
-    0xcd, 0x4c, 0x10, 0xf6, 0x0e, 0xa3, 0xaf, 0xdd, 0x7f, 0x4b, 0xf3, 0xaf,
-    0xff, 0x7c, 0xeb, 0xa7, 0xbf, 0x00, 0x8b, 0xc8, 0xea, 0xc4, 0x56, 0x34,
-    0xc1, 0x02, 0x96, 0x51, 0x7f, 0xff, 0xff, 0xff, 0xf9, 0x57, 0xaa, 0x31,
-    0x57, 0xaa, 0x95, 0xa2, 0xb4, 0x6a, 0xa6, 0x15, 0x72, 0xab, 0x73, 0xf1,
-    0x60, 0x02, 0xad, 0x63, 0x8f, 0x9f, 0xbd, 0x55, 0x44, 0x2a, 0x95, 0xd5,
-    0x6f, 0x7c, 0xf9, 0xde, 0x33, 0xaf, 0xff, 0xdf, 0xf3, 0x2e, 0x82, 0x36,
-    0xcf, 0x51, 0xaf, 0xb3, 0xaf, 0xfe, 0xe5, 0x88, 0xf0, 0x51, 0x5f, 0x50,
-    0xb3, 0xaf, 0xff, 0xfc, 0x8b, 0x4d, 0xf4, 0x1a, 0x94, 0x70, 0xdc, 0x0f,
-    0xbb, 0x92, 0x3a, 0xff, 0xc9, 0xe4, 0x6a, 0x07, 0xd8, 0xd3, 0xab, 0x11,
-    0xe1, 0xe4, 0x8e, 0x26, 0xcb, 0xef, 0x71, 0xe7, 0x4e, 0xbf, 0xff, 0xce,
-    0x2d, 0x1c, 0x0f, 0x41, 0xf3, 0xb1, 0x2d, 0xc4, 0xe7, 0x56, 0x22, 0x14,
-    0x04, 0x97, 0xff, 0xf9, 0xd4, 0x1c, 0xfc, 0x1a, 0xf9, 0x24, 0xec, 0x34,
-    0x5c, 0xeb, 0xef, 0x27, 0x50, 0xeb, 0xfe, 0x7d, 0xcb, 0xe6, 0x34, 0x38,
-    0x75, 0x2a, 0x97, 0x01, 0xa2, 0x32, 0xbc, 0x8d, 0x23, 0xb0, 0xb7, 0x72,
-    0x21, 0x61, 0x01, 0x05, 0xb6, 0x75, 0xfd, 0xec, 0x5f, 0x38, 0xb3, 0xad,
-    0xdc, 0x37, 0xa8, 0x21, 0x7f, 0x80, 0x17, 0x96, 0x92, 0x47, 0x5f, 0xff,
-    0x82, 0x83, 0x3e, 0x69, 0x1f, 0xac, 0xb0, 0xc3, 0x05, 0x5f, 0xde, 0xec,
-    0x4f, 0xd0, 0x1d, 0x7f, 0x73, 0x2d, 0x7e, 0x09, 0x8e, 0xbf, 0xe9, 0xf3,
-    0xf0, 0x81, 0xf7, 0x23, 0xaf, 0x3b, 0xb4, 0xd1, 0x67, 0xdf, 0xdf, 0xb8,
-    0xc9, 0x16, 0x75, 0x4e, 0x88, 0xd6, 0x9d, 0x7e, 0x4f, 0x7f, 0xe4, 0xec,
-    0x49, 0x3d, 0x1e, 0xd1, 0xd7, 0xff, 0xb7, 0xd7, 0xf9, 0x9c, 0x07, 0x35,
-    0x82, 0x75, 0xff, 0xda, 0xf2, 0x4c, 0xc3, 0x86, 0x39, 0xd1, 0xd4, 0x88,
-    0x90, 0x02, 0x55, 0xe6, 0x18, 0x60, 0xab, 0xff, 0x3c, 0xb4, 0x38, 0xd0,
-    0xe6, 0xca, 0x64, 0xbf, 0xbf, 0x71, 0x01, 0x78, 0x13, 0xaf, 0xf7, 0xbb,
-    0x9c, 0x3e, 0x49, 0x67, 0x56, 0x1f, 0x08, 0x0a, 0xaf, 0xfd, 0xcc, 0x84,
-    0x1f, 0xfc, 0x6a, 0xff, 0x3a, 0xe8, 0x50, 0xea, 0x83, 0xda, 0x9d, 0x12,
-    0xff, 0x75, 0x02, 0x2e, 0xf3, 0x1d, 0x7f, 0x83, 0xd0, 0x3f, 0xfc, 0x78,
-    0x75, 0x41, 0xf3, 0xa1, 0x8d, 0xff, 0x20, 0x87, 0xe8, 0x41, 0xed, 0x1d,
-    0x52, 0x5c, 0xe5, 0x09, 0x2b, 0x4c, 0xb9, 0x58, 0x98, 0xbb, 0x70, 0xbe,
-    0x59, 0x97, 0x61, 0x99, 0xfa, 0x08, 0xc2, 0xb7, 0x4f, 0x7e, 0x84, 0x4f,
-    0x02, 0x0b, 0xfe, 0xdb, 0xb1, 0xd4, 0x8d, 0xc1, 0xd7, 0xfe, 0xda, 0x6a,
-    0x5f, 0x7b, 0x03, 0x07, 0x5f, 0x6d, 0x21, 0x67, 0x5f, 0xff, 0xbc, 0xa0,
-    0x23, 0x03, 0xdc, 0xd7, 0x32, 0x8e, 0x9d, 0x5b, 0x45, 0xa2, 0xcf, 0x84,
-    0x82, 0xe7, 0x91, 0xd7, 0xff, 0xff, 0xf0, 0xbb, 0x1e, 0xce, 0x8e, 0x78,
-    0x1f, 0xad, 0xe4, 0xe1, 0x81, 0x7d, 0xbc, 0x8e, 0xbf, 0xd9, 0xde, 0x83,
-    0xce, 0x27, 0x5f, 0x2d, 0x26, 0xd1, 0xd6, 0x40, 0xa3, 0xb6, 0x61, 0x5d,
-    0xc2, 0x15, 0x66, 0x37, 0xed, 0xcd, 0xc3, 0x02, 0x75, 0xff, 0xb1, 0x8e,
-    0x2d, 0xe7, 0x10, 0x81, 0x83, 0xaa, 0x13, 0xd3, 0xec, 0x63, 0x8e, 0x90,
-    0x25, 0x57, 0xff, 0xff, 0xdf, 0xeb, 0x30, 0x54, 0xfb, 0xb1, 0x8c, 0xeb,
-    0x3a, 0x1c, 0x9d, 0x78, 0xb3, 0xaf, 0xdf, 0x60, 0x7e, 0xac, 0xea, 0xc4,
-    0x54, 0xf9, 0xfe, 0xfd, 0xc1, 0xfb, 0x1f, 0x4e, 0xac, 0x3c, 0xc4, 0x22,
-    0xbd, 0xa8, 0x9c, 0xeb, 0xfe, 0x8c, 0x6f, 0x53, 0x83, 0xec, 0xeb, 0xb3,
-    0xa7, 0x50, 0x9e, 0x6f, 0x19, 0xc5, 0x49, 0x15, 0xba, 0x20, 0xf3, 0x4d,
-    0xee, 0x81, 0x83, 0xaf, 0x7e, 0x06, 0x9d, 0x7b, 0xd9, 0xf4, 0xeb, 0xfa,
-    0x39, 0xd7, 0xcd, 0xc1, 0xd7, 0x82, 0x06, 0x9d, 0x7c, 0x11, 0x89, 0x1d,
-    0x48, 0x6f, 0x1c, 0x72, 0x82, 0x8e, 0x1e, 0x47, 0x50, 0x75, 0x63, 0xbd,
-    0x6b, 0xbb, 0x1a, 0x75, 0xfd, 0xb4, 0xe1, 0x83, 0xa3, 0xaf, 0xee, 0x7d,
-    0x9d, 0x02, 0xb9, 0xd7, 0xee, 0x8c, 0x66, 0xcc, 0xbf, 0xed, 0xcb, 0x37,
-    0x38, 0x1c, 0x26, 0x88, 0x35, 0x93, 0x4b, 0x50, 0x8a, 0xd4, 0x56, 0xbf,
-    0x3b, 0x51, 0x70, 0x75, 0xfd, 0x2e, 0x8b, 0xf3, 0xe3, 0xad, 0x8d, 0x3d,
-    0x21, 0x25, 0xbf, 0x47, 0xbe, 0x2d, 0x83, 0xaf, 0xf4, 0x91, 0x71, 0xdf,
-    0xa1, 0x3a, 0xff, 0xf4, 0x60, 0xf3, 0xec, 0xda, 0x4e, 0xeb, 0x3a, 0xfc,
-    0xec, 0x7b, 0x3b, 0xa3, 0xfc, 0xf1, 0xa5, 0x2b, 0x6a, 0x9b, 0x60, 0x56,
-    0x50, 0xda, 0xc7, 0x3d, 0x93, 0x0c, 0x29, 0xaf, 0x6b, 0x24, 0x75, 0xf9,
-    0x39, 0x92, 0x09, 0xd7, 0x93, 0xb8, 0x75, 0xd0, 0xbc, 0x3c, 0x06, 0x93,
-    0x5f, 0x07, 0x5d, 0x83, 0xaf, 0xc3, 0xb6, 0x1e, 0x73, 0xab, 0x0f, 0x25,
-    0xc8, 0x6e, 0x00, 0x9d, 0x50, 0x98, 0x2a, 0x2d, 0xed, 0xd7, 0x44, 0x17,
-    0xbb, 0x82, 0x75, 0xff, 0xf3, 0xa9, 0xe8, 0xdf, 0xfb, 0x8f, 0x0b, 0xfe,
-    0x75, 0xff, 0xfc, 0x2e, 0xa7, 0xcf, 0xa2, 0xfe, 0xd2, 0x73, 0xd4, 0x60,
-    0xea, 0xc4, 0x64, 0x88, 0xd0, 0x14, 0x2e, 0xd7, 0x03, 0xaf, 0x90, 0x5c,
-    0x27, 0x5f, 0xf9, 0x79, 0xed, 0x7d, 0xd3, 0xcb, 0x0e, 0xbf, 0x6a, 0x37,
-    0xe8, 0x39, 0x93, 0x7f, 0x41, 0x44, 0xae, 0x97, 0xaf, 0xdf, 0x66, 0x77,
-    0xd9, 0xd7, 0xdd, 0xc4, 0xe0, 0x75, 0xfd, 0xa4, 0xde, 0x03, 0x67, 0x5f,
-    0xff, 0xe8, 0x9b, 0xe2, 0x34, 0x1b, 0xd0, 0x3e, 0x2d, 0x3d, 0xd4, 0x3a,
-    0xb1, 0x3a, 0xc4, 0x85, 0x6a, 0xc8, 0xfa, 0x53, 0xe2, 0x2e, 0x22, 0xcb,
-    0x96, 0xa8, 0x34, 0x5f, 0x97, 0xda, 0xde, 0x61, 0xd7, 0xff, 0x4b, 0xc0,
-    0x94, 0x97, 0xef, 0x42, 0xce, 0xbf, 0xde, 0xd4, 0x4f, 0x9a, 0x09, 0xd7,
-    0x77, 0x0e, 0xbf, 0xfe, 0xec, 0x07, 0x1b, 0xf3, 0x07, 0x03, 0xd8, 0x3a,
-    0xff, 0xe4, 0xc1, 0xcc, 0xd7, 0xc9, 0x69, 0x67, 0x5f, 0xf9, 0xe3, 0x99,
-    0x7c, 0xd7, 0x21, 0x83, 0xa8, 0x29, 0xbf, 0xf2, 0x40, 0x88, 0xaa, 0xe6,
-    0x73, 0x0a, 0xe9, 0x3b, 0xc8, 0x77, 0x94, 0x8d, 0x9d, 0x7f, 0x06, 0x3f,
-    0xde, 0x72, 0x75, 0x32, 0x79, 0x4b, 0x1c, 0xbf, 0xd0, 0xbc, 0x4d, 0xcd,
-    0x23, 0xae, 0x49, 0x8e, 0xbf, 0xfd, 0xe8, 0xe8, 0xbc, 0xf1, 0xbd, 0xbc,
-    0x8e, 0xbd, 0xe4, 0x9c, 0xeb, 0xf7, 0xef, 0xcc, 0x4c, 0x75, 0xe1, 0x86,
-    0x9d, 0x7f, 0xf0, 0x52, 0x6e, 0xc6, 0xf9, 0x94, 0x6c, 0xeb, 0xff, 0x85,
-    0xf9, 0xd6, 0xb3, 0x61, 0xee, 0x1d, 0x7f, 0xfa, 0x1b, 0xf3, 0x78, 0x80,
-    0x54, 0xe7, 0x16, 0x1d, 0x48, 0x89, 0x31, 0x43, 0xaf, 0x89, 0xdb, 0x20,
-    0xb2, 0xd2, 0x1c, 0x70, 0x4a, 0x74, 0x35, 0xc5, 0x0d, 0x8b, 0x41, 0xd7,
-    0xba, 0x9e, 0x3a, 0xdc, 0x30, 0xd5, 0x7d, 0x0f, 0xa8, 0x5d, 0x82, 0x0a,
-    0xf6, 0x47, 0x4c, 0x90, 0xb3, 0xe9, 0x1b, 0xc7, 0xd1, 0xfc, 0x25, 0xaf,
-    0xfb, 0x06, 0x43, 0x8b, 0x86, 0x9d, 0x7e, 0xea, 0x70, 0xc0, 0x9d, 0x7f,
-    0xe0, 0xc0, 0xe0, 0x82, 0x59, 0xa3, 0xaf, 0xce, 0xb4, 0xe2, 0xc3, 0xaf,
-    0x7a, 0x39, 0x3a, 0xb0, 0xf1, 0x1c, 0xa2, 0xf0, 0xab, 0x3c, 0x47, 0x5f,
-    0xff, 0xfa, 0x3a, 0x8b, 0x66, 0x69, 0x3e, 0xfe, 0xf5, 0x39, 0xd3, 0x52,
-    0x73, 0xa8, 0x29, 0xc8, 0x28, 0x6a, 0x85, 0x13, 0x3f, 0x89, 0x07, 0x11,
-    0x1d, 0xfc, 0xfb, 0x8e, 0xfd, 0x09, 0xd7, 0xd0, 0x93, 0xc1, 0xd7, 0xcc,
-    0x3e, 0x68, 0xeb, 0xfe, 0x92, 0xde, 0x5e, 0xd4, 0x28, 0x75, 0x41, 0xed,
-    0x39, 0x0d, 0xed, 0x20, 0x9d, 0x7e, 0x16, 0xfc, 0xd7, 0x27, 0x56, 0x1e,
-    0x23, 0x8d, 0x53, 0xa6, 0x59, 0xf9, 0x70, 0xbd, 0x01, 0x92, 0xe9, 0xe4,
-    0x75, 0xe4, 0xea, 0x1d, 0x5c, 0x9b, 0x1f, 0x0b, 0xdf, 0x7d, 0x03, 0xe8,
-    0xeb, 0xfd, 0x20, 0x0c, 0xfa, 0x4e, 0x4e, 0xbe, 0xff, 0xfc, 0xe4, 0xeb,
-    0xfb, 0x8b, 0xd8, 0xe2, 0xd3, 0xaf, 0xf8, 0x0f, 0x20, 0xe6, 0x7f, 0xa3,
-    0xaf, 0xf7, 0xe9, 0xcf, 0x32, 0xcf, 0x1d, 0x5d, 0x3e, 0xdd, 0x1c, 0x5f,
-    0xb9, 0xd2, 0xd1, 0x5c, 0xeb, 0xff, 0xf6, 0x6b, 0xe7, 0x5d, 0x3d, 0xf8,
-    0x04, 0x5e, 0x47, 0x54, 0x22, 0x00, 0x4a, 0xef, 0xe7, 0x9f, 0xf7, 0x10,
-    0x9d, 0x53, 0x27, 0xc7, 0xb3, 0x4e, 0x92, 0x7a, 0x13, 0x7c, 0x21, 0x45,
-    0xc6, 0x43, 0x7f, 0xdd, 0xfb, 0x0d, 0xe3, 0xcd, 0xc1, 0xd5, 0x0a, 0xaa,
-    0xb2, 0x50, 0x33, 0xb4, 0x5d, 0x30, 0x0e, 0xb2, 0xce, 0xae, 0x4d, 0x3a,
-    0xa4, 0x5e, 0xff, 0xe8, 0xde, 0x70, 0x79, 0x7f, 0x98, 0x13, 0xaf, 0xe7,
-    0xe6, 0x43, 0x01, 0x3a, 0xff, 0xa3, 0x99, 0x20, 0xad, 0xfc, 0x75, 0x39,
-    0xf1, 0x89, 0x65, 0xf9, 0xe5, 0x93, 0xc1, 0xd7, 0xff, 0x46, 0xb5, 0x8b,
-    0xf0, 0xc2, 0xf4, 0x75, 0xff, 0xc9, 0x1a, 0x17, 0x97, 0xcd, 0x66, 0xce,
-    0xbf, 0xff, 0xc9, 0xa9, 0xf1, 0x8c, 0x10, 0x71, 0x43, 0x38, 0x2f, 0xb3,
-    0xaf, 0xf7, 0x32, 0xd4, 0xd2, 0x89, 0xce, 0xa0, 0xa6, 0x86, 0xd2, 0x61,
-    0x42, 0xf2, 0x18, 0x18, 0xaf, 0xff, 0xfd, 0xd4, 0xe7, 0xd9, 0xcf, 0xb7,
-    0xb8, 0xf7, 0xff, 0x46, 0x5d, 0xc3, 0xaf, 0x82, 0x17, 0x13, 0xaf, 0xfd,
-    0x28, 0x1f, 0x6d, 0x38, 0x60, 0x4e, 0xbf, 0xf3, 0xf5, 0xa8, 0xff, 0x34,
-    0xfd, 0x3a, 0xff, 0xfd, 0xa1, 0xf9, 0xd7, 0x4f, 0x7e, 0x01, 0x17, 0x91,
-    0xd7, 0xfb, 0xa8, 0xa7, 0x18, 0x36, 0xa1, 0xd7, 0xfd, 0x0c, 0x2f, 0xb0,
-    0x83, 0x39, 0xd7, 0xff, 0xc3, 0x9a, 0xc5, 0xc3, 0x73, 0xc9, 0xbc, 0x3a,
-    0xd8, 0xd4, 0x5d, 0xf8, 0xe3, 0x81, 0xc5, 0xfd, 0x3e, 0x6d, 0x1b, 0x07,
-    0x5f, 0x08, 0x61, 0x67, 0x5f, 0xb8, 0x60, 0x81, 0xce, 0xbf, 0x9f, 0xfc,
-    0x0b, 0xc8, 0xea, 0x83, 0xf3, 0xc2, 0x04, 0x27, 0xa4, 0x46, 0x5f, 0x61,
-    0x3f, 0x50, 0xbb, 0x7f, 0x39, 0x30, 0x61, 0x4f, 0x91, 0xb1, 0xb5, 0x29,
-    0x1c, 0x26, 0x20, 0xe9, 0xf7, 0xe7, 0xc3, 0x18, 0x87, 0xa3, 0x02, 0xbf,
-    0xfb, 0x07, 0xfc, 0xcd, 0xeb, 0xd1, 0x87, 0x5f, 0xf7, 0x3e, 0xcd, 0xa4,
-    0xee, 0xb3, 0xad, 0x9f, 0x9f, 0xd0, 0xa0, 0xdf, 0xfb, 0x15, 0xdc, 0x7f,
-    0xf8, 0xa9, 0x92, 0x1d, 0x7f, 0x70, 0xea, 0x46, 0xf4, 0x75, 0xff, 0xfa,
-    0x06, 0x59, 0xd4, 0x58, 0x72, 0x68, 0xcd, 0x9d, 0x7e, 0x86, 0xf5, 0x26,
-    0x3a, 0xf3, 0x5f, 0x67, 0x5f, 0xb4, 0xd8, 0xda, 0x87, 0x57, 0x4f, 0x0f,
-    0xf1, 0xbb, 0xfd, 0x92, 0xc4, 0x0f, 0x50, 0xeb, 0xef, 0x49, 0x7d, 0x3a,
-    0xf9, 0x14, 0x46, 0x0e, 0xac, 0x3c, 0x41, 0x22, 0xbb, 0xe6, 0x1d, 0x7d,
-    0xa1, 0x85, 0x9d, 0x50, 0x6d, 0xf9, 0x17, 0xbe, 0xce, 0xc9, 0x67, 0x54,
-    0x2a, 0x87, 0x91, 0x3e, 0x23, 0x28, 0x5d, 0xd5, 0x27, 0x6a, 0x12, 0x3d,
-    0x3a, 0x01, 0x5f, 0x8c, 0x86, 0xf0, 0x56, 0xd3, 0xad, 0xd3, 0xae, 0xd4,
-    0x8e, 0xaf, 0xcd, 0x30, 0x04, 0x2f, 0xe9, 0xe6, 0x92, 0xab, 0x73, 0x9d,
-    0x79, 0xf3, 0x67, 0x5e, 0x1c, 0xf1, 0xd5, 0xd3, 0x68, 0x23, 0x57, 0x78,
-    0x4e, 0xbd, 0x1c, 0xe8, 0xeb, 0xe4, 0x19, 0x61, 0xd7, 0xa7, 0x71, 0x3a,
-    0x82, 0x7a, 0xcb, 0x1c, 0xf0, 0xfd, 0xfb, 0x3d, 0xd4, 0xf1, 0xd7, 0xe7,
-    0xe7, 0x39, 0xf1, 0xd6, 0x53, 0xa7, 0x9d, 0xe2, 0x6b, 0x93, 0x67, 0x5f,
-    0xd3, 0xfc, 0x9d, 0xdf, 0xa7, 0x52, 0xb2, 0x9e, 0xfc, 0x34, 0xc8, 0x83,
-    0x1a, 0xd1, 0xf7, 0xa5, 0x2e, 0x2b, 0x7f, 0xd8, 0x10, 0xa7, 0x39, 0xcf,
-    0x8e, 0xbe, 0x68, 0xc4, 0x8e, 0xae, 0x9e, 0xcb, 0x9c, 0xdf, 0xe8, 0xcf,
-    0x47, 0x5c, 0x27, 0x54, 0xe7, 0xa2, 0x12, 0x1b, 0xff, 0x83, 0x01, 0xdc,
-    0x79, 0x1a, 0x81, 0x3a, 0xfa, 0x68, 0xe2, 0x91, 0xd7, 0xf7, 0x9a, 0x10,
-    0xaf, 0x67, 0x5f, 0xf4, 0xda, 0xe0, 0xe3, 0x38, 0x02, 0x75, 0xf6, 0x7b,
-    0x16, 0x75, 0xc2, 0xa1, 0xd6, 0xd3, 0x9b, 0x60, 0x10, 0x5f, 0xdd, 0x04,
-    0xf3, 0x75, 0x0e, 0xbe, 0x11, 0xcf, 0x1d, 0x50, 0x9c, 0xf0, 0x48, 0xf1,
-    0x09, 0x42, 0x54, 0x2e, 0x99, 0xcb, 0xa4, 0xde, 0x2f, 0xbf, 0xbe, 0x4d,
-    0x1e, 0x1e, 0x07, 0x5f, 0xfe, 0x18, 0xe1, 0xb8, 0xde, 0x27, 0x60, 0x27,
-    0x5e, 0x17, 0x59, 0xd5, 0x24, 0x49, 0xe1, 0x8a, 0x24, 0x59, 0x95, 0x65,
-    0xdc, 0x5b, 0x2b, 0x67, 0x8a, 0xd0, 0x71, 0x5a, 0x8d, 0xc4, 0xa5, 0xa9,
-    0xe1, 0xd7, 0x28, 0x6c, 0x86, 0x71, 0x07, 0x27, 0x66, 0x94, 0x86, 0x6b,
-    0x65, 0x5f, 0x73, 0x1f, 0x1a, 0x46, 0x23, 0x34, 0xab, 0x7d, 0xc6, 0xd4,
-    0xb8, 0xc1, 0x7b, 0x3e, 0xb8, 0xf2, 0x82, 0xbf, 0x8e, 0x1d, 0x52, 0xdc,
-    0x32, 0xb3, 0x35, 0x3c, 0x39, 0xe9, 0x76, 0x40, 0x84, 0x6b, 0x08, 0x5c,
-    0x72, 0x80, 0x7e, 0xca, 0xae, 0xe2, 0x8c, 0x12, 0x99, 0x77, 0x67, 0x7d,
-    0xb7, 0x20, 0xd7, 0xff, 0x99, 0x5b, 0xc9, 0x9c, 0xdb, 0x5d, 0xda, 0x68,
-    0x9b, 0x2f, 0xf3, 0x39, 0xb6, 0xbb, 0xb4, 0xd1, 0x56, 0xdf, 0xe9, 0x48,
-    0x1e, 0x18, 0x91, 0xd7, 0xd9, 0xd7, 0xf1, 0xd6, 0x54, 0x61, 0xe9, 0x09,
-    0x95, 0xff, 0xbb, 0x1d, 0x89, 0xf7, 0x18, 0x13, 0xaf, 0xd1, 0xb5, 0xf4,
-    0x27, 0x5e, 0x0e, 0x09, 0xd7, 0x9d, 0xda, 0x68, 0xad, 0x2f, 0xca, 0x73,
-    0xa0, 0x72, 0x75, 0x34, 0xf4, 0x90, 0x9e, 0xff, 0xf2, 0x7a, 0x50, 0xde,
-    0xa7, 0xb4, 0xfc, 0x9d, 0x5b, 0x3e, 0xae, 0x04, 0x37, 0xff, 0xba, 0x8b,
-    0x86, 0xe2, 0xf0, 0x7d, 0xc6, 0x75, 0xff, 0xf3, 0x63, 0x79, 0xfb, 0xad,
-    0xe5, 0x08, 0xd3, 0xaf, 0xff, 0xa5, 0xac, 0x18, 0x5b, 0xe7, 0xbd, 0x0b,
-    0x3a, 0xef, 0x7a, 0x11, 0x32, 0xe9, 0xb7, 0xff, 0xff, 0xa3, 0x82, 0x7b,
-    0x58, 0xa3, 0x7a, 0x9e, 0xc9, 0x86, 0x17, 0x3e, 0x30, 0x75, 0xfe, 0x8f,
-    0x3f, 0x7e, 0x06, 0x0e, 0xbe, 0x97, 0x92, 0x73, 0xaf, 0xdf, 0x7c, 0x31,
-    0xf9, 0xd5, 0xc9, 0xe5, 0xf0, 0x22, 0xbf, 0xcf, 0x2f, 0x24, 0xfd, 0x43,
-    0xaa, 0x0f, 0x5d, 0x09, 0x6f, 0xd9, 0xd4, 0xc5, 0x9d, 0x7f, 0xf0, 0xba,
-    0x37, 0xae, 0x09, 0xf6, 0x87, 0x54, 0xe7, 0xcf, 0xd2, 0x5b, 0xfd, 0x28,
-    0xdc, 0xf1, 0xb9, 0xce, 0xbd, 0x9b, 0xfc, 0xeb, 0xf4, 0xd8, 0x15, 0xab,
-    0x9d, 0x7f, 0x0c, 0x31, 0xcc, 0xb4, 0x75, 0x21, 0xfa, 0xcc, 0x39, 0xc4,
-    0x57, 0x50, 0x8d, 0xbc, 0x85, 0x4d, 0xff, 0xff, 0xfd, 0x88, 0xdc, 0xf4,
-    0x0f, 0xb5, 0xf2, 0x10, 0x38, 0xbf, 0x9b, 0x84, 0x93, 0xe8, 0xeb, 0xfb,
-    0x3c, 0xe3, 0xf8, 0x0e, 0xbf, 0xbb, 0xf1, 0x27, 0x71, 0x3a, 0xa4, 0x7b,
-    0x58, 0x59, 0x66, 0x55, 0x4b, 0xd2, 0x90, 0x55, 0x39, 0xe8, 0x49, 0xf2,
-    0x1a, 0xcd, 0x24, 0x48, 0x71, 0xec, 0xb5, 0x6f, 0x5d, 0x86, 0xab, 0xc2,
-    0x1c, 0x61, 0xfd, 0xa2, 0x6f, 0x43, 0x86, 0xff, 0x33, 0x9b, 0x6b, 0xbb,
-    0x4d, 0x16, 0x05, 0xfb, 0x6d, 0x77, 0x69, 0xa2, 0x75, 0xbf, 0xff, 0xdd,
-    0x89, 0xc3, 0x8b, 0x67, 0x5a, 0xce, 0xa6, 0x81, 0x39, 0xd7, 0xe6, 0x56,
-    0xf2, 0x67, 0x11, 0x2d, 0x31, 0x9d, 0xfe, 0x96, 0x99, 0x51, 0x48, 0x59,
-    0xd7, 0xed, 0xb5, 0xdd, 0xa6, 0x8b, 0x66, 0xff, 0xff, 0x3c, 0x99, 0xd4,
-    0x26, 0x05, 0x33, 0x59, 0xe1, 0x83, 0xaf, 0xfd, 0xfc, 0x69, 0x9e, 0xa3,
-    0x5f, 0x67, 0x5f, 0xf4, 0x4a, 0x37, 0x3c, 0x6e, 0x73, 0xac, 0xce, 0x26,
-    0x0e, 0xb3, 0x37, 0x5c, 0x13, 0xfb, 0xff, 0xf3, 0xff, 0xf8, 0x34, 0xce,
-    0x6d, 0xf5, 0xd7, 0x91, 0xd7, 0xcd, 0x77, 0x69, 0xa2, 0xe6, 0xb2, 0xce,
-    0xad, 0x9b, 0xd6, 0x0b, 0x6e, 0x99, 0x67, 0x51, 0xd6, 0x67, 0x0f, 0x0d,
-    0x82, 0x2e, 0x31, 0x7b, 0xf6, 0xda, 0xee, 0xd3, 0x45, 0xdf, 0x7f, 0xa4,
-    0xce, 0xb7, 0xb4, 0x60, 0xeb, 0x33, 0x87, 0xd0, 0xe6, 0x77, 0xcc, 0xa8,
-    0x1f, 0xce, 0xa8, 0x7c, 0x85, 0x9c, 0xb7, 0x6c, 0xed, 0x35, 0xe5, 0x5d,
-    0x27, 0xc9, 0x77, 0x0e, 0x75, 0xc3, 0x55, 0xd0, 0xbf, 0x8c, 0xf4, 0x50,
-    0xb5, 0x0d, 0x7f, 0x42, 0x87, 0xe9, 0x3d, 0xff, 0x98, 0x71, 0x9f, 0x48,
-    0x3c, 0xc8, 0xeb, 0xff, 0xb2, 0x7c, 0x63, 0xb9, 0xac, 0x41, 0x3a, 0xe4,
-    0x67, 0xa8, 0x81, 0x13, 0xfb, 0xf6, 0xb4, 0xb7, 0x91, 0xd7, 0xff, 0xff,
-    0xfe, 0xea, 0x75, 0x20, 0x7c, 0x2e, 0xa6, 0x78, 0x1e, 0x4f, 0x6b, 0xa9,
-    0xb8, 0x9d, 0xf6, 0xd3, 0xae, 0xd4, 0x1d, 0x7f, 0xf7, 0x2d, 0x03, 0xf3,
-    0xec, 0xc1, 0x50, 0xeb, 0xc2, 0xec, 0xc2, 0x63, 0x0d, 0x27, 0xd4, 0x25,
-    0xfc, 0x2b, 0x78, 0x0e, 0xb3, 0xaf, 0xd9, 0xc5, 0xe8, 0x50, 0xeb, 0x71,
-    0x1d, 0x53, 0x9b, 0xdc, 0x2a, 0xad, 0x9f, 0xc8, 0xac, 0x5f, 0xfb, 0x4e,
-    0xa7, 0x52, 0x04, 0x10, 0x75, 0xff, 0xba, 0xfe, 0x7e, 0xf3, 0x2c, 0xf1,
-    0xd5, 0x87, 0xf4, 0x87, 0x97, 0x3f, 0xe7, 0x5f, 0xff, 0xfe, 0x17, 0x60,
-    0x73, 0xde, 0xc9, 0xe0, 0x5d, 0x4d, 0x2e, 0x30, 0x42, 0x75, 0x62, 0x22,
-    0xb6, 0x2d, 0x7f, 0xbb, 0x81, 0x4e, 0x1b, 0xc3, 0xaf, 0x3b, 0xb4, 0xd1,
-    0x2b, 0xdf, 0xe5, 0x1c, 0x7f, 0xf6, 0x74, 0xea, 0x69, 0xed, 0x21, 0x3d,
-    0xff, 0xef, 0x77, 0x24, 0xde, 0xa0, 0x60, 0x7c, 0x75, 0x49, 0x1e, 0xdb,
-    0x84, 0x68, 0x90, 0xdd, 0x29, 0xce, 0xbf, 0xf0, 0xbb, 0x01, 0xec, 0x4f,
-    0x8c, 0x1d, 0x7f, 0xfe, 0xc4, 0xff, 0x16, 0x9e, 0xd4, 0x2d, 0xf9, 0xf1,
-    0xd7, 0xfd, 0x0b, 0xf6, 0x4d, 0x24, 0xf1, 0xd5, 0x24, 0x46, 0x79, 0x52,
-    0xf8, 0x0f, 0xb9, 0x1d, 0x7f, 0xd0, 0xd1, 0x89, 0xff, 0x7f, 0x1d, 0x7f,
-    0xff, 0x93, 0xce, 0xb7, 0x1f, 0xfa, 0xc3, 0x8c, 0xed, 0x49, 0xce, 0xa0,
-    0xa2, 0xe9, 0x08, 0x5c, 0xe2, 0xff, 0x81, 0xfa, 0xde, 0x5a, 0xd8, 0x4e,
-    0xbf, 0xff, 0xd8, 0x83, 0xec, 0x1f, 0x82, 0xe1, 0x81, 0x9e, 0x36, 0x75,
-    0xb3, 0xc8, 0x97, 0xe0, 0x75, 0x7f, 0xdc, 0xff, 0x9b, 0xcc, 0xf6, 0x8e,
-    0xa0, 0xaa, 0xd0, 0xc8, 0x65, 0xf6, 0x1b, 0xa3, 0x0c, 0x5f, 0xa5, 0x57,
-    0xfe, 0xf3, 0xcb, 0x5d, 0x8d, 0xfd, 0x09, 0xd7, 0xff, 0x79, 0x38, 0x27,
-    0xa6, 0x94, 0x0f, 0x8e, 0xbf, 0xfc, 0xf9, 0x2e, 0xe2, 0x0e, 0x7f, 0xc7,
-    0x87, 0x5e, 0x79, 0x33, 0x0b, 0xd4, 0x32, 0x84, 0xd8, 0x61, 0x55, 0x91,
-    0x8c, 0x2c, 0xd3, 0x52, 0xb9, 0xfc, 0xb7, 0xf5, 0x03, 0x89, 0x16, 0xff,
-    0xf6, 0x75, 0x91, 0xc0, 0xa0, 0xfb, 0x3a, 0x75, 0xef, 0x40, 0x4a, 0xbf,
-    0xfd, 0xd7, 0x4f, 0x44, 0x93, 0x73, 0x83, 0xf2, 0xaf, 0xf3, 0xb5, 0x90,
-    0xed, 0x52, 0xcc, 0x1f, 0x2e, 0x86, 0xec, 0xc8, 0x59, 0x4b, 0x8d, 0x8d,
-    0x19, 0x73, 0xed, 0xbe, 0x85, 0x6f, 0x08, 0x56, 0x5f, 0xfe, 0x65, 0x6f,
-    0x26, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0x61, 0xbf, 0xff, 0xb3, 0x83, 0x87,
-    0xb0, 0xcf, 0xbb, 0x81, 0x07, 0xb4, 0x75, 0xff, 0xed, 0xbf, 0xec, 0xa9,
-    0xe9, 0x31, 0x1a, 0x91, 0xd7, 0x63, 0x22, 0x8a, 0xbf, 0xab, 0xb7, 0xff,
-    0x2a, 0x33, 0x99, 0x01, 0xfc, 0x31, 0x23, 0xaf, 0xd8, 0xbf, 0x9c, 0xab,
-    0x9d, 0x7f, 0x42, 0xf3, 0xf8, 0xe0, 0x75, 0x04, 0xf6, 0xfa, 0x5b, 0x7e,
-    0xec, 0x05, 0x14, 0x3a, 0x90, 0xf2, 0x78, 0x88, 0xaf, 0xf4, 0x3c, 0xfe,
-    0x51, 0xf6, 0x75, 0xf9, 0xf7, 0x27, 0x59, 0xd4, 0x27, 0xb2, 0x03, 0x3b,
-    0xff, 0xf2, 0x6f, 0xaf, 0xf0, 0x39, 0x2e, 0xc7, 0x00, 0xc1, 0xd7, 0xfc,
-    0xc7, 0xde, 0xc3, 0x7a, 0x93, 0x1d, 0x7c, 0x05, 0xe0, 0x4e, 0xb6, 0x72,
-    0x7b, 0xbc, 0x47, 0x95, 0xd4, 0x6f, 0x8c, 0x2d, 0x2f, 0xe5, 0xc6, 0x0f,
-    0xb8, 0xce, 0xb6, 0x8e, 0xbf, 0x46, 0x0f, 0xb8, 0xce, 0xbf, 0xba, 0x9e,
-    0xd3, 0xf3, 0xf0, 0xf9, 0xa6, 0x2e, 0x58, 0x85, 0xfe, 0x97, 0xa1, 0x7c,
-    0x3f, 0x91, 0xd7, 0xff, 0xf9, 0x8e, 0x2f, 0x67, 0x7e, 0x0e, 0x4e, 0x98,
-    0x3c, 0xcb, 0x47, 0x5f, 0x98, 0xf6, 0x75, 0xa7, 0x58, 0x71, 0x11, 0xce,
-    0xcd, 0x7f, 0xfb, 0xc2, 0xff, 0xf7, 0x10, 0x20, 0xf6, 0x8e, 0xbf, 0xe8,
-    0x9f, 0xec, 0xba, 0x07, 0x9c, 0xea, 0x84, 0x42, 0xed, 0x26, 0xff, 0xec,
-    0xe6, 0x5f, 0x3a, 0xed, 0x81, 0x09, 0xd7, 0xf7, 0x0f, 0xbe, 0x18, 0xfc,
-    0xeb, 0xff, 0xd1, 0xef, 0xe2, 0x59, 0xcf, 0xa7, 0x03, 0x07, 0x54, 0x1f,
-    0xf2, 0x18, 0xdf, 0xcf, 0xfe, 0xf6, 0x9b, 0x3a, 0xf7, 0xbe, 0x61, 0xd5,
-    0xf9, 0xe5, 0x7d, 0x2d, 0xbf, 0xb4, 0x8a, 0x2d, 0xfc, 0x75, 0xff, 0xff,
-    0xb7, 0x9c, 0x20, 0x7d, 0xf3, 0xe8, 0xc7, 0x5d, 0x3d, 0x1e, 0xd1, 0xd7,
-    0xf0, 0xe6, 0xbe, 0x35, 0x54, 0x75, 0x72, 0x8c, 0xdd, 0x96, 0xf0, 0x6e,
-    0xbe, 0xf9, 0xc3, 0x8a, 0x73, 0xab, 0x0f, 0x75, 0x43, 0x3b, 0x2b, 0x9d,
-    0x77, 0xb0, 0xeb, 0xff, 0xca, 0x91, 0x85, 0xba, 0x75, 0xfd, 0xd8, 0x3a,
-    0xa0, 0xf7, 0xc0, 0x2b, 0x7f, 0xba, 0x93, 0x3b, 0x75, 0x23, 0xaf, 0xf4,
-    0x0f, 0x9d, 0x69, 0xe3, 0xaf, 0xfb, 0x13, 0x16, 0x39, 0x3b, 0x9d, 0x7e,
-    0x8f, 0x6b, 0xf0, 0x1d, 0x4a, 0xca, 0x6a, 0x78, 0xe4, 0xd2, 0x1e, 0x99,
-    0x89, 0x87, 0x8d, 0x6f, 0xff, 0xdd, 0x1c, 0xf7, 0x53, 0x39, 0xf6, 0x70,
-    0x8d, 0x1d, 0x7f, 0xf3, 0x8f, 0x61, 0x02, 0x9a, 0xc9, 0x1d, 0x7a, 0x3f,
-    0xfa, 0x75, 0x62, 0x2c, 0xdd, 0x54, 0x50, 0x2f, 0x7d, 0x0e, 0x1d, 0x79,
-    0x53, 0xa5, 0x51, 0xd4, 0xe7, 0x83, 0xa1, 0xdb, 0xfc, 0x2e, 0xc4, 0x7b,
-    0x27, 0x3a, 0xcc, 0xaa, 0x99, 0x53, 0x71, 0x0e, 0xb0, 0xbe, 0xe4, 0x60,
-    0x0d, 0x84, 0x6f, 0x2a, 0xb3, 0x43, 0x13, 0x70, 0xab, 0x59, 0x17, 0x61,
-    0x87, 0xfb, 0x50, 0xc6, 0x9f, 0xa8, 0xdd, 0x7d, 0x18, 0x70, 0x1b, 0xb8,
-    0xc8, 0x6f, 0xff, 0xb6, 0x9c, 0xcb, 0x49, 0xee, 0xc6, 0xfd, 0x07, 0x5f,
-    0xb6, 0xd7, 0x76, 0x9a, 0x2a, 0xeb, 0xdb, 0x85, 0x9d, 0x7f, 0xd2, 0x67,
-    0x36, 0xd7, 0x76, 0x9a, 0x23, 0xcb, 0xfe, 0x89, 0x46, 0xe7, 0x8d, 0xce,
-    0x75, 0xff, 0xa3, 0xc8, 0x05, 0x4e, 0x4a, 0x79, 0x8e, 0xb3, 0x21, 0x4d,
-    0x7b, 0x13, 0xf6, 0x66, 0xe3, 0x62, 0x8b, 0xa3, 0x9b, 0xf6, 0xda, 0xee,
-    0xd3, 0x45, 0x83, 0x79, 0x48, 0x9c, 0xeb, 0xff, 0xf8, 0x40, 0xf3, 0xaf,
-    0x38, 0xc1, 0xbc, 0xdc, 0xbe, 0xc8, 0xeb, 0xf6, 0x0e, 0x7b, 0x47, 0x5f,
-    0xed, 0xba, 0xfe, 0xed, 0xf9, 0x3a, 0xcc, 0xe2, 0x61, 0x4a, 0x19, 0xb4,
-    0x75, 0xd8, 0x3e, 0x92, 0xdf, 0xe6, 0x73, 0x6d, 0x77, 0x69, 0xa2, 0xca,
-    0xbf, 0x6d, 0xae, 0xed, 0x34, 0x5a, 0x77, 0xfc, 0xe1, 0xeb, 0xcd, 0xd4,
-    0x59, 0xd6, 0x67, 0x0f, 0xad, 0x66, 0x77, 0xe5, 0x68, 0xab, 0xd5, 0x95,
-    0x65, 0x5b, 0x3a, 0xff, 0x95, 0x5d, 0x46, 0x02, 0xee, 0xd3, 0xaf, 0xca,
-    0xd1, 0x51, 0xac, 0x83, 0xaf, 0xf7, 0xd5, 0xe7, 0xb4, 0x9a, 0x3a, 0xc8,
-    0x75, 0x2a, 0x8f, 0x0f, 0x8c, 0xd2, 0xff, 0xfe, 0x4e, 0xb8, 0xfa, 0x59,
-    0xbc, 0x81, 0x1c, 0xf1, 0xd7, 0xee, 0x0e, 0x1c, 0x59, 0xd7, 0xcb, 0x8e,
-    0x74, 0x75, 0x49, 0x13, 0xf8, 0xab, 0x31, 0x45, 0xfb, 0xe6, 0xf6, 0x0e,
-    0x9d, 0x7e, 0x45, 0x20, 0x5a, 0x75, 0xb3, 0x47, 0xa1, 0xe2, 0xab, 0xff,
-    0xe1, 0x6f, 0x53, 0xa9, 0xb8, 0x99, 0x8c, 0xe9, 0xd7, 0xff, 0x42, 0xd6,
-    0xf2, 0xe3, 0x07, 0x53, 0x67, 0x54, 0x22, 0x57, 0xa9, 0xf7, 0xd1, 0xf6,
-    0x3a, 0x75, 0xf3, 0x5d, 0xda, 0x68, 0xb7, 0x2f, 0xfd, 0x9b, 0xc1, 0xf9,
-    0xdc, 0xe5, 0x83, 0xaf, 0xc3, 0xfb, 0xf3, 0xa3, 0xaa, 0x0f, 0xa1, 0xd0,
-    0x2b, 0x94, 0x6b, 0xec, 0x8b, 0x50, 0x95, 0xbf, 0xce, 0x3f, 0xcc, 0x30,
-    0xb3, 0xaf, 0x2c, 0x50, 0xeb, 0x09, 0xd7, 0xfd, 0xd0, 0x3e, 0xb3, 0x05,
-    0x43, 0xaf, 0xda, 0x7e, 0x5c, 0x27, 0x59, 0x02, 0x7b, 0xde, 0x37, 0xa8,
-    0x45, 0x76, 0x0d, 0x75, 0xb6, 0xff, 0xa1, 0xc7, 0xb9, 0x82, 0xd3, 0xaf,
-    0xf7, 0xbc, 0x93, 0xae, 0x04, 0xea, 0x91, 0xf3, 0x61, 0xa5, 0xff, 0x40,
-    0x81, 0x71, 0xaf, 0x21, 0xd7, 0xc1, 0x8c, 0xd9, 0xd7, 0xef, 0x9c, 0xe9,
-    0x14, 0x3a, 0xcf, 0x39, 0xe5, 0xf2, 0x41, 0x7f, 0xf4, 0xb3, 0xa9, 0xb0,
-    0xf6, 0x05, 0xa7, 0x5f, 0xee, 0x65, 0x03, 0xec, 0xfc, 0xeb, 0xed, 0x7e,
-    0x9e, 0x3a, 0x9d, 0x18, 0x1a, 0x29, 0x02, 0x17, 0xd3, 0x3b, 0xff, 0xbc,
-    0x9f, 0xc4, 0x83, 0xd8, 0x16, 0x9d, 0x47, 0x5e, 0x03, 0xf8, 0xeb, 0x81,
-    0x07, 0x54, 0x8d, 0x87, 0x86, 0xe8, 0xeb, 0xee, 0x5a, 0x9b, 0x3a, 0xf4,
-    0x2d, 0x9c, 0x44, 0x3f, 0x27, 0x4b, 0x21, 0xf0, 0x55, 0x42, 0x63, 0x29,
-    0x0c, 0xab, 0xc3, 0xee, 0x33, 0xaf, 0xfa, 0x4c, 0xe6, 0xda, 0xee, 0xd3,
-    0x45, 0x0f, 0x48, 0x7c, 0x6e, 0x3d, 0x7e, 0xfe, 0x1b, 0x8b, 0x3a, 0xfa,
-    0x26, 0xc0, 0x9d, 0x5b, 0x3c, 0x8d, 0x13, 0xdf, 0xf9, 0x79, 0x01, 0xec,
-    0x71, 0x44, 0xc7, 0x54, 0x1f, 0x13, 0x91, 0x5f, 0xf9, 0xc3, 0x01, 0xea,
-    0x0a, 0x2c, 0xeb, 0xff, 0xb5, 0x03, 0x36, 0x0f, 0xef, 0xec, 0x3a, 0xff,
-    0x68, 0x0d, 0xcf, 0x0c, 0x1d, 0x4b, 0x45, 0x77, 0x4e, 0xfc, 0x85, 0x7f,
-    0xf0, 0x25, 0xd7, 0xdf, 0x3e, 0x84, 0x9c, 0xeb, 0xfe, 0x89, 0x46, 0xe7,
-    0x8d, 0xce, 0x75, 0xf9, 0x3d, 0xa7, 0x43, 0xaf, 0xfb, 0x7f, 0xed, 0xc7,
-    0xd9, 0xf9, 0xd5, 0xf9, 0xef, 0x00, 0x96, 0xf7, 0xdd, 0xc8, 0xeb, 0xfb,
-    0xef, 0x81, 0x19, 0x39, 0xd5, 0x23, 0xcd, 0x98, 0x7a, 0xff, 0xe6, 0x8c,
-    0x78, 0x73, 0x86, 0x6e, 0x47, 0x5f, 0xf0, 0x05, 0x4f, 0xbd, 0xe8, 0x34,
-    0x75, 0xfe, 0x11, 0x7f, 0x7d, 0x86, 0x9d, 0x7c, 0x3f, 0xcf, 0xf9, 0xd5,
-    0x87, 0xac, 0x86, 0x57, 0xfb, 0x5f, 0x3d, 0xf0, 0x38, 0x27, 0x5b, 0xf3,
-    0xac, 0x9c, 0x9e, 0x3e, 0xcd, 0xaf, 0xcf, 0xce, 0xbc, 0x87, 0x54, 0x27,
-    0x5d, 0x84, 0x68, 0x87, 0xd8, 0x49, 0x0b, 0x3e, 0x8a, 0x2f, 0xce, 0x05,
-    0x23, 0xe9, 0xd7, 0xe5, 0x56, 0x6e, 0x34, 0x75, 0x4c, 0x7a, 0x62, 0x53,
-    0x7f, 0xcf, 0xa8, 0x9b, 0x99, 0x67, 0x03, 0xaf, 0xff, 0xc1, 0xec, 0x7d,
-    0x67, 0xc2, 0xff, 0xeb, 0x51, 0xf9, 0x57, 0x07, 0x0e, 0xbf, 0x4f, 0x13,
-    0xbe, 0x8e, 0xac, 0x44, 0xb2, 0x2c, 0xb8, 0xad, 0xdf, 0x80, 0xeb, 0xf9,
-    0xff, 0x98, 0x60, 0x27, 0x54, 0x1e, 0x27, 0x45, 0xec, 0xca, 0xb0, 0xcf,
-    0xcf, 0x56, 0xd0, 0xd5, 0x79, 0xe2, 0xac, 0xe7, 0x10, 0xc8, 0x94, 0x20,
-    0x03, 0x0b, 0xcc, 0x87, 0xca, 0x86, 0xcd, 0x87, 0x07, 0x30, 0x94, 0x42,
-    0x19, 0xa3, 0x41, 0xdc, 0x6a, 0xeb, 0x84, 0x57, 0x61, 0x94, 0xf0, 0xce,
-    0xfc, 0xc0, 0x51, 0x75, 0x09, 0x7f, 0x4a, 0x1e, 0x04, 0x2b, 0x38, 0x11,
-    0x71, 0xc3, 0x47, 0xeb, 0x8d, 0xfc, 0xcc, 0xf1, 0xb9, 0x2c, 0xeb, 0xfc,
-    0xce, 0x6d, 0xae, 0xed, 0x34, 0x5e, 0x75, 0x0e, 0x8d, 0x06, 0x4d, 0xe1,
-    0x8c, 0x0b, 0x29, 0x59, 0x7c, 0xca, 0x7a, 0xdc, 0x6c, 0xcb, 0x53, 0xec,
-    0x2a, 0x86, 0x9f, 0xef, 0xa8, 0xf0, 0xf8, 0x17, 0xdf, 0xe6, 0x73, 0x6d,
-    0x77, 0x69, 0xa2, 0x96, 0xbf, 0x6d, 0xae, 0xed, 0x34, 0x58, 0x57, 0xff,
-    0xe8, 0xc1, 0x0c, 0x76, 0x39, 0xf6, 0x0b, 0xac, 0xeb, 0xf8, 0x1b, 0x49,
-    0xdd, 0x67, 0x59, 0x9c, 0x45, 0x8a, 0xcc, 0xf8, 0xd4, 0x6f, 0xf3, 0x39,
-    0xb6, 0xbb, 0xb4, 0xd1, 0x65, 0xdd, 0xb5, 0x0e, 0xbe, 0x65, 0x45, 0x59,
-    0x58, 0x3a, 0xf3, 0x3f, 0x56, 0x75, 0x34, 0xf3, 0x40, 0x5d, 0x42, 0x88,
-    0x6d, 0x32, 0x5b, 0xf3, 0xae, 0x52, 0x73, 0xae, 0x7d, 0xc8, 0xd4, 0xe0,
-    0x8d, 0xff, 0x3f, 0x23, 0x9c, 0xfa, 0x14, 0x3a, 0xff, 0x4f, 0xce, 0xa0,
-    0x3e, 0x43, 0xaf, 0xd1, 0x9c, 0x23, 0x47, 0x5a, 0x1c, 0xf6, 0xd8, 0x34,
-    0xa7, 0x45, 0xd8, 0xc2, 0x52, 0xf9, 0xe5, 0x20, 0x9d, 0x7f, 0x3e, 0xe3,
-    0xcf, 0xd3, 0xaf, 0x30, 0xc3, 0x05, 0x5f, 0xf4, 0x4b, 0x9f, 0x6e, 0x33,
-    0x92, 0x99, 0x2f, 0xef, 0xf8, 0x0f, 0xce, 0x79, 0x39, 0x60, 0xeb, 0xa3,
-    0x47, 0x50, 0x53, 0x03, 0xe9, 0x08, 0xa5, 0x69, 0x27, 0x81, 0xd5, 0xfc,
-    0x8f, 0xaf, 0xf4, 0x03, 0xaf, 0xff, 0xee, 0xa7, 0xbb, 0x9a, 0x1c, 0x58,
-    0x35, 0xd7, 0x91, 0xd7, 0xfa, 0x25, 0xe7, 0xeb, 0x84, 0xea, 0xc4, 0x45,
-    0x6d, 0x66, 0xd2, 0x3a, 0xd2, 0x3a, 0xd2, 0x3a, 0xa0, 0xd8, 0x28, 0x20,
-    0x82, 0x17, 0xff, 0xef, 0x69, 0x1b, 0x83, 0xb8, 0x1c, 0x0e, 0x28, 0x75,
-    0xb9, 0x3a, 0xed, 0x00, 0xea, 0xc3, 0xf9, 0xd2, 0x97, 0x84, 0x6e, 0x48,
-    0x3a, 0xfe, 0x18, 0x58, 0xc6, 0x1d, 0x74, 0xa0, 0xea, 0x09, 0xe9, 0x4c,
-    0x28, 0x02, 0x9b, 0xff, 0xff, 0xee, 0xc7, 0xb4, 0x9a, 0xd4, 0x7b, 0xa9,
-    0x1b, 0xfd, 0x6f, 0x29, 0x79, 0x43, 0xae, 0x4e, 0x4e, 0xba, 0x16, 0x75,
-    0xff, 0xfd, 0x28, 0x10, 0x4a, 0x51, 0xee, 0xe2, 0xfe, 0xc7, 0xe7, 0x5c,
-    0xd6, 0x61, 0x78, 0x2a, 0x74, 0xb0, 0xc3, 0x9b, 0x23, 0x29, 0x6a, 0x66,
-    0xe1, 0x6e, 0xea, 0x43, 0x0a, 0x6d, 0x42, 0x03, 0xc6, 0x1c, 0x1f, 0xb8,
-    0xc5, 0xbe, 0x8a, 0xdf, 0xfe, 0x65, 0x6f, 0x26, 0x73, 0x6d, 0x77, 0x69,
-    0xa2, 0x8c, 0xbf, 0x70, 0x8d, 0xc7, 0xe7, 0x5f, 0x85, 0xff, 0x8f, 0xa7,
-    0x5f, 0xfd, 0xcb, 0x53, 0x7d, 0xcc, 0x19, 0x68, 0xeb, 0x33, 0x08, 0x94,
-    0xe9, 0x4f, 0x8a, 0x2a, 0x4c, 0x9f, 0x9d, 0xc3, 0xc1, 0x67, 0x2f, 0x3d,
-    0x9f, 0xa8, 0x70, 0x7a, 0x1d, 0x77, 0xff, 0x32, 0xf2, 0x67, 0x36, 0xd7,
-    0x76, 0x9a, 0x23, 0x9b, 0xff, 0xcc, 0xad, 0xe4, 0xce, 0x6d, 0xae, 0xed,
-    0x34, 0x4e, 0x57, 0xf9, 0x9c, 0xdb, 0x5d, 0xda, 0x68, 0xb3, 0x2f, 0xfa,
-    0x5a, 0x75, 0xb3, 0xdf, 0x7e, 0x75, 0xff, 0x2a, 0xe0, 0xe2, 0xe3, 0x98,
-    0x59, 0xd7, 0xfd, 0xfe, 0xe3, 0xdd, 0x7e, 0x64, 0x75, 0xfe, 0xcd, 0x6f,
-    0x79, 0xce, 0x8e, 0xbb, 0x95, 0x9d, 0x66, 0x55, 0x84, 0x61, 0x41, 0xf4,
-    0x8e, 0xb8, 0xcc, 0xef, 0xf3, 0x39, 0xb6, 0xbb, 0xb4, 0xd1, 0x6e, 0xdf,
-    0xc2, 0xec, 0xee, 0x7e, 0x9d, 0x79, 0x39, 0xfc, 0xeb, 0xf6, 0xda, 0xee,
-    0xd3, 0x45, 0x21, 0x7f, 0xec, 0xea, 0x70, 0xee, 0x60, 0xb4, 0xeb, 0xcf,
-    0x26, 0x70, 0xfc, 0x34, 0x67, 0x66, 0x5a, 0x8e, 0xed, 0x97, 0x2e, 0x11,
-    0xb7, 0xff, 0x32, 0xf2, 0x67, 0x36, 0xd7, 0x76, 0x9a, 0x25, 0x2a, 0x9d,
-    0x5f, 0x4c, 0xca, 0x2b, 0x57, 0x73, 0xff, 0xe1, 0xfa, 0x29, 0x7e, 0x8c,
-    0xb7, 0x88, 0xf2, 0xff, 0x49, 0x07, 0xd8, 0x81, 0x3a, 0xf6, 0x80, 0xb3,
-    0xac, 0xcf, 0x27, 0x98, 0x86, 0x17, 0x85, 0xe4, 0x75, 0xff, 0x9e, 0x4c,
-    0xe6, 0xda, 0xee, 0xd3, 0x44, 0xed, 0x74, 0xea, 0xe7, 0x5f, 0xff, 0x90,
-    0x20, 0x5c, 0x71, 0x38, 0x46, 0x07, 0x1a, 0x75, 0xff, 0x44, 0xa3, 0x73,
-    0xc6, 0xe7, 0x3a, 0xcc, 0xe2, 0x61, 0x6b, 0x1a, 0xea, 0x53, 0x8d, 0x0a,
-    0xa5, 0xff, 0xf3, 0x3f, 0x78, 0xdc, 0x7f, 0xcf, 0x40, 0xa7, 0xe7, 0x5f,
-    0xfc, 0xeb, 0xee, 0x35, 0xfb, 0x1f, 0x64, 0x75, 0xe4, 0x0b, 0x9d, 0x7f,
-    0xf0, 0xe7, 0x5e, 0x7c, 0xd0, 0xbf, 0x27, 0x5d, 0xc6, 0xc8, 0x51, 0x41,
-    0xd4, 0x4d, 0x0d, 0x54, 0x95, 0x5b, 0xae, 0x33, 0x4d, 0x27, 0xf1, 0xc3,
-    0xd2, 0xff, 0xfe, 0x0b, 0xf9, 0x9c, 0xd4, 0x0f, 0x3f, 0xeb, 0x51, 0xf9,
-    0xd7, 0xed, 0xb5, 0xdd, 0xa6, 0x88, 0xb2, 0xff, 0xcf, 0x26, 0x73, 0x6d,
-    0x77, 0x69, 0xa2, 0x5d, 0xbf, 0xff, 0xb0, 0x3d, 0x8f, 0xac, 0xf8, 0x5f,
-    0xfd, 0x6a, 0x3f, 0x2a, 0xcc, 0xe2, 0x36, 0xd6, 0x67, 0xc6, 0x95, 0x7f,
-    0xf9, 0x95, 0xbc, 0x99, 0xcd, 0xb5, 0xdd, 0xa6, 0x89, 0x8a, 0xfd, 0xb6,
-    0xbb, 0xb4, 0xd1, 0x54, 0xdb, 0x0e, 0xac, 0x3c, 0x25, 0x0c, 0xef, 0xff,
-    0xff, 0x6d, 0xfb, 0xcc, 0xb3, 0xcc, 0xf5, 0xf5, 0xb4, 0x63, 0xdd, 0x4d,
-    0xc8, 0xea, 0x65, 0x13, 0x8e, 0x45, 0x7f, 0xf9, 0x95, 0xbc, 0x99, 0xcd,
-    0xb5, 0xdd, 0xa6, 0x89, 0xd2, 0xff, 0x23, 0xee, 0x24, 0xfc, 0x0e, 0xbf,
-    0x4d, 0x13, 0x46, 0x8e, 0xbf, 0x98, 0xc4, 0xe1, 0x82, 0x75, 0x21, 0xea,
-    0xe8, 0xa2, 0xf2, 0x76, 0x0e, 0x64, 0xd0, 0xdf, 0xfc, 0x0d, 0x7a, 0x39,
-    0x64, 0x13, 0x22, 0xce, 0xa5, 0x9f, 0x97, 0x4a, 0xef, 0xfc, 0xf2, 0x67,
-    0x36, 0xd7, 0x76, 0x9a, 0x27, 0x7b, 0xf7, 0x80, 0xeb, 0x42, 0xaf, 0xfc,
-    0x31, 0xec, 0xd6, 0x67, 0x32, 0x3a, 0x82, 0x9f, 0x46, 0x46, 0x34, 0xb2,
-    0x27, 0x4a, 0xf1, 0x35, 0xfd, 0x0c, 0xfe, 0x38, 0x13, 0xa9, 0x93, 0xfc,
-    0x14, 0xfb, 0xff, 0xcc, 0xad, 0xe4, 0xce, 0x6d, 0xae, 0xed, 0x34, 0x50,
-    0xb7, 0xff, 0xff, 0xba, 0x05, 0xad, 0xe4, 0xcb, 0x7a, 0x0f, 0x40, 0xe4,
-    0xea, 0x02, 0x26, 0x3a, 0xfc, 0x0e, 0x7c, 0x8d, 0x3a, 0xfd, 0x9f, 0xe3,
-    0x89, 0xd7, 0xa3, 0xf6, 0x67, 0x3c, 0xd1, 0x28, 0xa4, 0x47, 0xe8, 0xc3,
-    0x22, 0xff, 0xf3, 0x2b, 0x79, 0x33, 0x9b, 0x6b, 0xbb, 0x4d, 0x14, 0x95,
-    0xff, 0xfe, 0xcd, 0x33, 0xf7, 0x26, 0xeb, 0xaf, 0xdd, 0x8f, 0x01, 0x67,
-    0x54, 0x2f, 0xed, 0xcf, 0x19, 0xc4, 0x8e, 0x5b, 0x19, 0xae, 0xc8, 0xd7,
-    0x2a, 0xef, 0xf2, 0x2f, 0x46, 0xa8, 0x02, 0x6e, 0x35, 0x7b, 0xfc, 0xce,
-    0x6d, 0xae, 0xed, 0x34, 0x44, 0x97, 0xff, 0x99, 0x5b, 0xc9, 0x9c, 0xdb,
-    0x5d, 0xda, 0x68, 0x97, 0xaf, 0xb6, 0x0f, 0x68, 0xeb, 0xf6, 0xff, 0x5a,
-    0x68, 0xeb, 0xd0, 0x3c, 0x9d, 0x7e, 0xf7, 0xd5, 0x8c, 0x1d, 0x64, 0xe9,
-    0xe1, 0x88, 0xdd, 0xff, 0xee, 0xf0, 0x81, 0xfd, 0x5f, 0x03, 0x9b, 0xe4,
-    0xeb, 0xa3, 0xc7, 0x5f, 0xfe, 0x00, 0x53, 0x7f, 0x66, 0xe2, 0x03, 0x8c,
-    0xc7, 0x54, 0x91, 0xb4, 0x84, 0xdf, 0xa7, 0xe8, 0x56, 0xff, 0xe7, 0x9b,
-    0x51, 0xc1, 0xfb, 0x1c, 0xcc, 0x75, 0xfb, 0x27, 0xcd, 0x2c, 0xeb, 0xff,
-    0xa6, 0xf9, 0xf4, 0x63, 0x83, 0xf0, 0x89, 0x8e, 0xa3, 0xaf, 0xe9, 0xa4,
-    0xfe, 0x7e, 0x07, 0x54, 0x22, 0x17, 0x13, 0x1c, 0x2a, 0xed, 0xc1, 0xd4,
-    0x15, 0x5b, 0x28, 0x45, 0x34, 0x68, 0xbb, 0x3d, 0x14, 0x7e, 0x10, 0xac,
-    0xe2, 0x2d, 0xb8, 0x3c, 0x9d, 0x7f, 0xc8, 0xe2, 0x0f, 0x4d, 0x0a, 0x1d,
-    0x7f, 0xfc, 0x9b, 0xf9, 0xd8, 0x4f, 0x68, 0x0d, 0x04, 0x1d, 0x7c, 0x93,
-    0xfe, 0xae, 0x75, 0xf3, 0x5d, 0xda, 0x68, 0xa5, 0xef, 0x87, 0xd1, 0xb3,
-    0xaf, 0xfb, 0x36, 0xaf, 0x81, 0xcd, 0xf2, 0x75, 0x21, 0xed, 0xf0, 0x20,
-    0xa5, 0x13, 0x21, 0x99, 0x43, 0x64, 0xdd, 0x84, 0x45, 0xf8, 0x7d, 0x3e,
-    0x30, 0x75, 0xff, 0xa0, 0x63, 0xbf, 0x00, 0x20, 0x69, 0xd7, 0x80, 0xfa,
-    0x3a, 0xfd, 0x1f, 0xbf, 0x3a, 0x3a, 0xf0, 0xa7, 0xe7, 0x5e, 0xcf, 0x68,
-    0xea, 0x83, 0x6d, 0xa1, 0xba, 0x0a, 0x35, 0xe6, 0x3e, 0xfc, 0x6f, 0xcb,
-    0xd7, 0xe5, 0x77, 0x10, 0xf1, 0x1d, 0x7f, 0xdf, 0xeb, 0x71, 0xcc, 0x91,
-    0x67, 0x5e, 0xf3, 0xf0, 0x3a, 0xff, 0x9e, 0x7f, 0x93, 0x82, 0x68, 0x57,
-    0x3a, 0xa1, 0x12, 0xee, 0x74, 0x01, 0xdb, 0xfe, 0x4d, 0x4c, 0x83, 0xe8,
-    0xfc, 0xea, 0x91, 0xf3, 0x2c, 0xba, 0xe7, 0x13, 0xaf, 0xfa, 0x3f, 0xf9,
-    0xd8, 0x5b, 0x89, 0xd6, 0xdf, 0x27, 0x9b, 0xc0, 0x52, 0xa1, 0x3c, 0x3c,
-    0x8c, 0xa5, 0x1b, 0xef, 0x6e, 0x16, 0x75, 0xfd, 0x03, 0x37, 0x91, 0x43,
-    0xaf, 0xfa, 0x59, 0xb9, 0xb0, 0x61, 0x67, 0x5f, 0xbf, 0x86, 0xe2, 0xce,
-    0xa4, 0x3d, 0xed, 0x9b, 0xdd, 0x2c, 0x3a, 0xf4, 0x7f, 0xa3, 0xaa, 0x0f,
-    0x48, 0x24, 0x2c, 0x0a, 0xdf, 0xba, 0x05, 0x30, 0x4e, 0xbf, 0xe8, 0xee,
-    0x9f, 0xd1, 0xbe, 0x23, 0xaf, 0xfc, 0xb7, 0x0f, 0xd9, 0xa5, 0x03, 0xc9,
-    0xd4, 0x13, 0xfb, 0x43, 0xab, 0xed, 0xff, 0xf7, 0x81, 0xd7, 0x91, 0x8f,
-    0x1d, 0x5d, 0x3c, 0x3d, 0x13, 0xd0, 0x53, 0x28, 0xec, 0x28, 0xbc, 0xc9,
-    0x7f, 0xdf, 0xa7, 0x73, 0x6f, 0x36, 0x8e, 0xbf, 0xff, 0x44, 0x86, 0x27,
-    0xfb, 0x36, 0xbb, 0x9c, 0x5b, 0xfc, 0xeb, 0xfb, 0xe2, 0xf3, 0xcf, 0xe3,
-    0xac, 0xd3, 0xae, 0xe7, 0x58, 0x6f, 0x9c, 0xba, 0xb9, 0x47, 0xfa, 0xce,
-    0x5e, 0x13, 0x57, 0xfb, 0x18, 0x92, 0x68, 0x0b, 0x3a, 0xee, 0x1a, 0x3a,
-    0xfd, 0x93, 0xe7, 0x74, 0x75, 0x41, 0xbf, 0x11, 0x8b, 0xd9, 0xbd, 0x1d,
-    0x4d, 0x37, 0x5c, 0x07, 0xef, 0xfb, 0xf8, 0xff, 0xef, 0x08, 0x1e, 0x23,
-    0xaa, 0x13, 0x0f, 0xc8, 0x56, 0x21, 0x1d, 0xff, 0xff, 0xdd, 0x8d, 0xf2,
-    0xd4, 0xe7, 0xe2, 0x8f, 0xf3, 0x5d, 0x76, 0xc0, 0x84, 0xeb, 0xef, 0x0a,
-    0x2c, 0xeb, 0xfc, 0x30, 0xe3, 0xec, 0x13, 0xaf, 0xf7, 0x5e, 0x64, 0xdc,
-    0x4e, 0x75, 0xd8, 0xb3, 0xa8, 0x29, 0x86, 0xe3, 0xba, 0xc8, 0x1c, 0xbb,
-    0x81, 0x9d, 0xfb, 0x89, 0x17, 0x1a, 0x3a, 0xfc, 0xfc, 0x33, 0x7a, 0x3a,
-    0x82, 0x7a, 0x2b, 0x29, 0xbf, 0x75, 0xc5, 0x16, 0x75, 0xf2, 0x93, 0x6a,
-    0x0e, 0xbf, 0xcf, 0xfe, 0xa3, 0xb1, 0xa3, 0xaa, 0x11, 0x39, 0x84, 0x48,
-    0x4a, 0x24, 0x77, 0x7e, 0xd3, 0xad, 0xa3, 0xae, 0x45, 0x34, 0x69, 0xc0,
-    0x2f, 0x7b, 0xf7, 0x69, 0xd7, 0xff, 0xe4, 0x0e, 0x70, 0x7d, 0xcd, 0xf6,
-    0x4f, 0xe7, 0x59, 0xd5, 0x07, 0xe9, 0xb1, 0xcb, 0x33, 0x0c, 0xdc, 0x19,
-    0x3a, 0x84, 0x5f, 0x23, 0x59, 0xe5, 0x15, 0x21, 0xff, 0x34, 0xa0, 0x2d,
-    0x9a, 0x2c, 0x6f, 0xb0, 0xdd, 0x78, 0xd5, 0xff, 0x8c, 0xd4, 0x63, 0x44,
-    0xd4, 0x68, 0x1e, 0x8c, 0xe3, 0x8d, 0x83, 0xec, 0x28, 0x6f, 0xf3, 0x39,
-    0xb6, 0xbb, 0xb4, 0xd1, 0x4e, 0x5f, 0xf9, 0x36, 0xfa, 0xee, 0x60, 0xb4,
-    0xeb, 0xf2, 0xf7, 0xbc, 0xd1, 0xd7, 0xff, 0xee, 0x83, 0xdb, 0x8f, 0x6b,
-    0x1b, 0xa8, 0xdb, 0x4e, 0xbf, 0xc8, 0xb0, 0xc6, 0x80, 0x27, 0x5f, 0xd9,
-    0xee, 0x65, 0x0c, 0x1d, 0x7f, 0xf2, 0x89, 0xce, 0x87, 0x03, 0xd7, 0x60,
-    0xeb, 0xff, 0x67, 0x63, 0x78, 0xcb, 0x0c, 0x30, 0x55, 0xc8, 0xc1, 0xd7,
-    0x4e, 0xc8, 0x53, 0xb2, 0xc3, 0xb6, 0x93, 0xf5, 0x54, 0x4c, 0x7c, 0x5d,
-    0xc6, 0x8b, 0xc4, 0x83, 0x7e, 0xdb, 0x5d, 0xda, 0x68, 0xaf, 0x2f, 0xff,
-    0xec, 0x0f, 0x63, 0xeb, 0x3e, 0x17, 0xff, 0x5a, 0x8f, 0xca, 0xb3, 0x38,
-    0x89, 0x1e, 0x33, 0x3b, 0xff, 0x99, 0x79, 0x33, 0x9b, 0x6b, 0xbb, 0x4d,
-    0x12, 0x3d, 0xe6, 0xe2, 0xce, 0xbc, 0x9f, 0xc1, 0xd7, 0x9b, 0x8b, 0x29,
-    0x92, 0xee, 0xfd, 0xb6, 0xbb, 0xb4, 0xd1, 0x24, 0x5f, 0xff, 0xd0, 0x9b,
-    0x4e, 0x28, 0x19, 0xe3, 0xc9, 0xd7, 0x9c, 0xeb, 0xa4, 0xcc, 0x22, 0xe7,
-    0x0a, 0xfa, 0x67, 0x7e, 0xce, 0xb3, 0x8b, 0x3a, 0xcc, 0xc2, 0x6a, 0x2f,
-    0x0e, 0xff, 0x1d, 0xdf, 0xfc, 0xcb, 0xc9, 0x9c, 0xdb, 0x5d, 0xda, 0x68,
-    0x92, 0xaf, 0xdb, 0x6b, 0xbb, 0x4d, 0x17, 0x8d, 0xff, 0x49, 0x9c, 0xdb,
-    0x5d, 0xda, 0x68, 0x93, 0x6c, 0xce, 0x1f, 0xc3, 0x99, 0xdc, 0xc7, 0x4e,
-    0xbf, 0x27, 0xfa, 0xc1, 0x3a, 0xff, 0xf8, 0x0f, 0xce, 0x62, 0x8a, 0x3c,
-    0xb3, 0x9f, 0x1d, 0x52, 0x3f, 0x7d, 0x13, 0x5d, 0xbf, 0x1d, 0x7a, 0x61,
-    0x9c, 0xeb, 0x09, 0xd7, 0x7d, 0xfa, 0x75, 0x7e, 0x6a, 0x7e, 0x87, 0xdd,
-    0xc6, 0xcc, 0x26, 0x61, 0x90, 0x8e, 0x72, 0x2d, 0x0b, 0x7d, 0x46, 0xa8,
-    0x6e, 0x7b, 0x27, 0x3f, 0x95, 0x61, 0xe2, 0x18, 0xcb, 0x92, 0x3f, 0x19,
-    0xa3, 0x15, 0x59, 0x67, 0x63, 0xa2, 0xf1, 0xd8, 0x21, 0x93, 0xf6, 0x35,
-    0x7a, 0x89, 0x7c, 0xb6, 0xb3, 0xca, 0x46, 0x94, 0xeb, 0xb8, 0x67, 0x52,
-    0xb3, 0x11, 0x71, 0x0a, 0x4e, 0x36, 0xb6, 0xf4, 0x96, 0x79, 0xac, 0x5f,
-    0xd2, 0x92, 0xfa, 0xaf, 0x28, 0x8e, 0x6b, 0x5f, 0xe3, 0xbb, 0x41, 0x28,
-    0xbc, 0xd8, 0xf8, 0x7b, 0x4a, 0x6a, 0x7b, 0x63, 0xd7, 0xfc, 0xf9, 0xaa,
-    0xa6, 0x3e, 0x31, 0xac, 0x89, 0xf5, 0x5b, 0x02, 0x7a, 0xf4, 0x83, 0xc1,
-    0x6b, 0xc0, 0xf8, 0x52, 0xb1, 0xd8, 0x9c, 0x5a, 0xe3, 0x97, 0x0b, 0xf6,
-    0x90, 0x51, 0xc5, 0x5d, 0x4b, 0xd0,
+    0xc4, 0xe1, 0xd7, 0xfa, 0x48, 0xbe, 0xee, 0xea, 0xe7, 0x5f, 0x3f, 0x22,
+    0x47, 0x5f, 0xf3, 0xef, 0xf3, 0x7d, 0x60, 0xa8, 0x75, 0x4e, 0x8a, 0xcd,
+    0xc6, 0x96, 0x6d, 0xe2, 0x0b, 0xee, 0xab, 0xa2, 0xce, 0xbc, 0x31, 0xf9,
+    0xd7, 0xa1, 0x79, 0xf0, 0xdf, 0xe8, 0x92, 0xff, 0xd1, 0xbf, 0x61, 0x6d,
+    0xea, 0x4c, 0x75, 0x62, 0x3c, 0x11, 0xfb, 0x86, 0x77, 0xe6, 0xbc, 0xf8,
+    0xc9, 0xd7, 0xe8, 0xe0, 0x70, 0x4e, 0xa1, 0x3c, 0xdf, 0x14, 0x5f, 0xfd,
+    0x1f, 0xc7, 0x56, 0x2e, 0xa7, 0x50, 0xeb, 0x2a, 0x8e, 0xbf, 0xc1, 0xec,
+    0x0b, 0x2f, 0xb9, 0xd7, 0xff, 0x20, 0x7b, 0x0d, 0x8f, 0xdc, 0x7f, 0x3a,
+    0xff, 0xff, 0x96, 0xe3, 0xbc, 0x98, 0x67, 0x13, 0x66, 0x0e, 0x05, 0xe4,
+    0x78, 0xbd, 0x6f, 0xca, 0x79, 0xdc, 0x4e, 0xbc, 0x20, 0x9c, 0xea, 0x73,
+    0xc2, 0xf1, 0x35, 0x22, 0x35, 0xc6, 0x16, 0xd5, 0x09, 0xf5, 0xf0, 0x85,
+    0x68, 0x6e, 0x29, 0xa3, 0x30, 0x46, 0x35, 0x72, 0xb0, 0xad, 0x9d, 0x79,
+    0x23, 0x87, 0x52, 0xa8, 0xdd, 0x74, 0x82, 0xff, 0xee, 0x22, 0xe1, 0x5c,
+    0x71, 0x7b, 0xc1, 0xd5, 0x23, 0xea, 0x98, 0x96, 0xf9, 0x05, 0xc2, 0x75,
+    0xe9, 0xd6, 0x87, 0x50, 0x4d, 0xd8, 0x8f, 0xdf, 0xa5, 0x9b, 0x22, 0x47,
+    0x5e, 0xce, 0x41, 0xd5, 0xba, 0x30, 0x11, 0x7b, 0x84, 0x1d, 0x28, 0xbf,
+    0xfe, 0xcf, 0x6b, 0x26, 0xec, 0x6c, 0xce, 0xf6, 0x0e, 0xbf, 0xff, 0xff,
+    0x26, 0x6f, 0xa4, 0xc6, 0x7e, 0x66, 0xf2, 0xd2, 0x7b, 0x49, 0xb8, 0x42,
+    0x09, 0xce, 0xbf, 0xff, 0x20, 0x87, 0xe7, 0xdf, 0x26, 0x9d, 0x04, 0x12,
+    0x3a, 0x85, 0x32, 0xef, 0x28, 0x6c, 0x84, 0x45, 0xe0, 0x72, 0x47, 0x5f,
+    0xcf, 0xef, 0xfe, 0x8c, 0x8e, 0xaf, 0x87, 0x97, 0x38, 0xe5, 0xfe, 0x89,
+    0x23, 0x0c, 0xb2, 0xc9, 0x57, 0x94, 0xc0, 0x9d, 0x7f, 0x75, 0xf8, 0xd8,
+    0xf1, 0xd7, 0x38, 0x4e, 0xbf, 0xb8, 0xfa, 0xeb, 0xc8, 0xeb, 0x6e, 0x75,
+    0xc8, 0xc9, 0xd7, 0x7d, 0xfc, 0xea, 0x98, 0xd7, 0xfe, 0x2d, 0x7a, 0x4e,
+    0x13, 0xae, 0x65, 0x93, 0xaa, 0x48, 0xd7, 0xc1, 0x56, 0x96, 0x22, 0x06,
+    0x88, 0xd9, 0x1b, 0xbd, 0xef, 0xbf, 0x94, 0xc1, 0xeb, 0x5f, 0xf2, 0x07,
+    0x16, 0x93, 0x23, 0x27, 0x5f, 0xfe, 0x70, 0xe6, 0x0a, 0x9a, 0xd6, 0x0f,
+    0xe7, 0x5f, 0x74, 0x0e, 0xa4, 0x22, 0x01, 0x67, 0x17, 0xff, 0xf4, 0x9f,
+    0x5a, 0x8c, 0x9c, 0x12, 0x0f, 0x05, 0xd9, 0x3a, 0xef, 0x40, 0x51, 0x2a,
+    0x87, 0x57, 0xed, 0x3c, 0xfa, 0xe9, 0xd5, 0x25, 0x62, 0x01, 0x1c, 0xde,
+    0x35, 0x94, 0x8d, 0x1b, 0xc5, 0xb7, 0xed, 0x9f, 0x7a, 0x9e, 0x3a, 0xff,
+    0xb3, 0xdd, 0x8e, 0x7b, 0x1a, 0x75, 0xe8, 0xe4, 0xc7, 0x54, 0x2f, 0x17,
+    0x64, 0x6d, 0x69, 0x08, 0x2e, 0x92, 0xbc, 0xb4, 0x6f, 0xd6, 0x04, 0xaf,
+    0x6c, 0xde, 0xf6, 0x9e, 0x63, 0xaf, 0xfe, 0x40, 0xbf, 0x93, 0x59, 0x2c,
+    0xe9, 0xd7, 0x3e, 0xd1, 0xd6, 0xce, 0x9e, 0xcf, 0x90, 0x6b, 0x74, 0x4e,
+    0x0b, 0xad, 0xf6, 0x6f, 0x3e, 0xc3, 0xaf, 0xf8, 0x43, 0x82, 0x09, 0x66,
+    0x8e, 0xbf, 0xdf, 0x7c, 0x39, 0x3a, 0x70, 0xeb, 0xef, 0x26, 0x90, 0xea,
+    0xe2, 0x2b, 0xdc, 0x94, 0x4d, 0x80, 0x69, 0x7f, 0xdd, 0x40, 0xa2, 0xa6,
+    0x05, 0x0e, 0xbf, 0xcf, 0x2c, 0x0f, 0x35, 0xa3, 0xaf, 0xa3, 0x3e, 0x84,
+    0xeb, 0xfc, 0xa2, 0x79, 0xfa, 0xca, 0xb9, 0xd7, 0xfd, 0xcc, 0x9b, 0xb9,
+    0xa7, 0x13, 0xaf, 0xfb, 0xb9, 0x2c, 0x02, 0xa5, 0xc4, 0xeb, 0xff, 0xfc,
+    0x83, 0x9b, 0xf9, 0x47, 0xf7, 0x63, 0xb9, 0xb1, 0xe4, 0x75, 0x05, 0x35,
+    0xd6, 0x99, 0x21, 0x17, 0x0d, 0xfc, 0x6f, 0xb0, 0xea, 0xff, 0x82, 0x9c,
+    0x8d, 0x9f, 0xea, 0x47, 0x5d, 0x0b, 0x3a, 0xde, 0x83, 0xd0, 0xe9, 0xdd,
+    0xff, 0xa3, 0x4f, 0xd4, 0x0b, 0x52, 0x73, 0xaa, 0x15, 0x51, 0xe4, 0x72,
+    0xcf, 0x0a, 0x90, 0x13, 0xde, 0x81, 0xf1, 0xd7, 0xf9, 0x3a, 0x9c, 0x94,
+    0xd0, 0x75, 0xff, 0xf9, 0x00, 0xdf, 0xbb, 0xfe, 0xfa, 0x7e, 0x26, 0xff,
+    0x9d, 0x7c, 0xfc, 0x89, 0x1d, 0x7f, 0xff, 0x20, 0xba, 0x0f, 0xfc, 0x8e,
+    0xba, 0x7a, 0x3a, 0x75, 0x09, 0xfb, 0x78, 0x82, 0xfc, 0x9e, 0xd0, 0x27,
+    0x3a, 0xff, 0xfa, 0x05, 0x3f, 0xf6, 0xed, 0x4e, 0x7d, 0x80, 0x9d, 0x41,
+    0x4d, 0xa9, 0x21, 0xa0, 0xb2, 0x1f, 0x14, 0x5f, 0xb8, 0x06, 0xf6, 0x0e,
+    0xbf, 0xb9, 0x34, 0x93, 0xda, 0x3a, 0xc3, 0x07, 0xab, 0x84, 0xf7, 0xfa,
+    0x67, 0x99, 0xf7, 0x96, 0x8e, 0xbf, 0x9e, 0x74, 0x99, 0x19, 0x3a, 0xb0,
+    0xf8, 0xdc, 0xd6, 0xfe, 0x9f, 0x06, 0x7c, 0x64, 0xeb, 0xfe, 0x89, 0xfe,
+    0xcb, 0xa0, 0x79, 0xce, 0xac, 0x3e, 0xae, 0x17, 0x5f, 0xa3, 0x9c, 0xce,
+    0x9d, 0x7f, 0x0b, 0xa9, 0x0b, 0x83, 0xaa, 0x47, 0xa2, 0x02, 0x6b, 0xe8,
+    0x9d, 0x45, 0x0e, 0xbf, 0xff, 0x23, 0x61, 0x7a, 0x7e, 0x62, 0xc0, 0xd7,
+    0x91, 0xd7, 0x26, 0xc3, 0xad, 0xd3, 0xaa, 0x47, 0xf4, 0xae, 0xa6, 0x01,
+    0x7b, 0xc1, 0x85, 0x9d, 0x7f, 0xb3, 0xfc, 0x9a, 0x37, 0xd1, 0xd5, 0x07,
+    0x9f, 0x83, 0x77, 0xf7, 0x5e, 0x51, 0xa9, 0x1d, 0x7f, 0xd9, 0xd4, 0xdf,
+    0x5d, 0x06, 0x8e, 0xbb, 0x05, 0xa7, 0xcb, 0xf9, 0x65, 0xfc, 0x2f, 0xf8,
+    0x70, 0x4e, 0xbf, 0x26, 0xde, 0x71, 0x43, 0xae, 0x52, 0x47, 0x5f, 0xba,
+    0x9b, 0x11, 0xa7, 0x5d, 0x9d, 0x91, 0xbf, 0x68, 0xbd, 0x2d, 0x12, 0xbb,
+    0x6d, 0x37, 0x99, 0x65, 0x92, 0xaf, 0xfd, 0xc1, 0x03, 0xfd, 0xc9, 0xa1,
+    0x67, 0x30, 0x5f, 0xdf, 0xba, 0x93, 0x23, 0x27, 0x54, 0x1f, 0xbe, 0x27,
+    0xdf, 0xe8, 0x0e, 0x4a, 0x05, 0xa7, 0x54, 0x2f, 0xc8, 0x48, 0x6b, 0x23,
+    0x9c, 0x57, 0x84, 0xbc, 0xd0, 0x88, 0xe4, 0x22, 0x96, 0xe5, 0xd2, 0x27,
+    0x84, 0xf0, 0xc2, 0x07, 0x50, 0x85, 0xf1, 0x68, 0x21, 0x80, 0xcc, 0x2f,
+    0x3e, 0x90, 0x5f, 0x73, 0x99, 0xd3, 0xaf, 0xee, 0xa6, 0xd6, 0xd0, 0x14,
+    0x3a, 0xa0, 0xf5, 0x5a, 0x43, 0x65, 0x49, 0xd6, 0x43, 0xaf, 0xfb, 0xd1,
+    0xcd, 0x76, 0x07, 0xc7, 0x59, 0x52, 0x75, 0xff, 0x7a, 0x39, 0xae, 0xc0,
+    0xf8, 0xeb, 0xb5, 0x07, 0x5e, 0x58, 0x60, 0xeb, 0xfc, 0x3e, 0x79, 0xb5,
+    0x1e, 0x3a, 0x90, 0xf3, 0x5c, 0x6e, 0xf9, 0x1f, 0x1a, 0x75, 0xff, 0xb3,
+    0x60, 0xe6, 0xa6, 0x18, 0x09, 0xd7, 0xcd, 0x0c, 0x4e, 0x75, 0xdf, 0xc1,
+    0xd7, 0xb4, 0x9c, 0x3a, 0xb0, 0xf4, 0xff, 0x22, 0xf0, 0xb5, 0xfe, 0x96,
+    0x0a, 0x07, 0x04, 0xeb, 0xde, 0xd3, 0x10, 0x9e, 0xde, 0x0a, 0x4c, 0x6f,
+    0xd6, 0x2f, 0xc8, 0x04, 0x7f, 0x50, 0x91, 0xf1, 0x7d, 0xda, 0x83, 0xaf,
+    0x2c, 0x30, 0x75, 0xfe, 0x1f, 0x3c, 0xda, 0x8f, 0x1d, 0x48, 0x79, 0xae,
+    0x37, 0x7c, 0x8f, 0x8d, 0x3a, 0xff, 0xd9, 0xb0, 0x73, 0x53, 0x0c, 0x04,
+    0xeb, 0xe6, 0x86, 0x27, 0x3a, 0xfe, 0x9b, 0xf4, 0x57, 0x79, 0x8e, 0xbb,
+    0xf8, 0x3a, 0xf6, 0x93, 0x87, 0x56, 0x22, 0x15, 0xa4, 0x5f, 0x99, 0x78,
+    0x5a, 0xff, 0x4b, 0x05, 0x03, 0x82, 0x75, 0xfc, 0x2e, 0x1c, 0x51, 0x88,
+    0x5c, 0x8e, 0x08, 0xa6, 0x07, 0xb6, 0x50, 0x94, 0xd0, 0x89, 0xeb, 0x17,
+    0xe4, 0x02, 0x3f, 0xa8, 0x61, 0xf8, 0xf6, 0xff, 0xee, 0x46, 0xfa, 0x18,
+    0x5e, 0x6f, 0xe3, 0xaf, 0xff, 0xce, 0x1c, 0xc1, 0x53, 0xe8, 0xc0, 0xce,
+    0x9c, 0x3a, 0xf3, 0xf2, 0x73, 0xc8, 0x25, 0x7d, 0x2c, 0xde, 0x47, 0x90,
+    0x4a, 0xf6, 0x90, 0x27, 0x90, 0x4a, 0xe6, 0x59, 0x3c, 0x82, 0x54, 0xd4,
+    0x52, 0xcc, 0x53, 0xe2, 0xf6, 0x4a, 0x2e, 0x7f, 0x16, 0x41, 0x23, 0x06,
+    0xfe, 0xfe, 0xce, 0xe6, 0x0a, 0x87, 0x5e, 0x71, 0xff, 0xe2, 0xfa, 0x5c,
+    0x4e, 0x57, 0xf2, 0x18, 0x2b, 0x44, 0x18, 0xce, 0x3c, 0x69, 0x7d, 0xb7,
+    0x8f, 0xd3, 0xad, 0x8a, 0xe8, 0xa1, 0xfd, 0xfa, 0xd2, 0x3a, 0xff, 0x4d,
+    0x20, 0x4f, 0xe4, 0x9c, 0xab, 0x41, 0xd7, 0xf9, 0x24, 0x07, 0xd7, 0x50,
+    0xeb, 0xfb, 0x36, 0x3a, 0xf3, 0xa7, 0x5a, 0x45, 0x5e, 0x7e, 0x4e, 0x55,
+    0x15, 0x50, 0x6d, 0x9a, 0x20, 0xb1, 0xcb, 0xd1, 0xfb, 0x4a, 0x60, 0xd6,
+    0xd2, 0xd1, 0x7a, 0x30, 0x90, 0xa8, 0x4c, 0x57, 0x21, 0xdd, 0x7f, 0xfd,
+    0xf4, 0x65, 0xae, 0x87, 0x39, 0xfa, 0xd3, 0x47, 0x5f, 0x01, 0xf9, 0x23,
+    0xac, 0xb3, 0xae, 0xc9, 0x04, 0xd8, 0xcc, 0x43, 0x7e, 0x67, 0x26, 0x45,
+    0x9d, 0x7f, 0x36, 0x26, 0x94, 0x7e, 0x55, 0x90, 0xeb, 0xfe, 0x9c, 0x12,
+    0x0f, 0x40, 0xe2, 0x75, 0xfc, 0x90, 0xb9, 0xf1, 0x93, 0xaf, 0xd9, 0x3a,
+    0xf1, 0x67, 0x5e, 0xd2, 0x70, 0xea, 0x13, 0xc2, 0xf1, 0x3d, 0xfc, 0x2f,
+    0xff, 0xe0, 0xd1, 0xd7, 0xf2, 0x29, 0xf6, 0x16, 0xc0, 0x53, 0x06, 0xc0,
+    0xfe, 0x1c, 0xe9, 0xbf, 0xc4, 0x35, 0x89, 0xe6, 0x21, 0x40, 0xc6, 0x69,
+    0x7c, 0x39, 0x38, 0x0e, 0xbf, 0xec, 0xf7, 0xc1, 0xcf, 0xfe, 0xee, 0x75,
+    0x49, 0x73, 0x2c, 0x25, 0x98, 0x21, 0xc3, 0x6e, 0xc6, 0x49, 0xf9, 0x38,
+    0xc2, 0x0f, 0x51, 0xfc, 0xf8, 0xd3, 0x6c, 0x86, 0xff, 0xfd, 0x3f, 0x39,
+    0x81, 0x75, 0xf5, 0xfc, 0x31, 0x31, 0xd7, 0xff, 0xff, 0x81, 0xc0, 0x4c,
+    0x2f, 0xfe, 0xb5, 0x8a, 0x60, 0x38, 0xe1, 0x8e, 0xc1, 0xd7, 0xdb, 0x5d,
+    0x07, 0xd3, 0xaf, 0x32, 0xcb, 0x25, 0x5d, 0x28, 0x29, 0x82, 0xfe, 0xa1,
+    0x33, 0x89, 0xd5, 0x77, 0x78, 0xe2, 0x35, 0xfc, 0xa4, 0x73, 0x99, 0xd3,
+    0xaf, 0xe9, 0xe6, 0x92, 0xab, 0x93, 0x9d, 0x7d, 0xd7, 0xdd, 0x93, 0xaf,
+    0xd3, 0xf1, 0x21, 0x67, 0x5f, 0xff, 0x47, 0xdf, 0x0c, 0x7e, 0xfe, 0xff,
+    0xe8, 0xc8, 0xea, 0x56, 0x51, 0xa4, 0x86, 0xae, 0x47, 0xe2, 0x7b, 0xff,
+    0x3f, 0xb4, 0xce, 0x77, 0xf7, 0xf1, 0xd7, 0xff, 0xfe, 0xcf, 0x43, 0x47,
+    0x30, 0x62, 0x5e, 0xeb, 0xac, 0x73, 0x61, 0xd4, 0x14, 0x53, 0xb2, 0x7f,
+    0x7b, 0xe8, 0x66, 0x3a, 0xf4, 0x90, 0x4e, 0xbe, 0x9f, 0xee, 0xd3, 0x27,
+    0x5f, 0xf4, 0x75, 0xd3, 0xd3, 0x23, 0x27, 0x5f, 0xfe, 0x52, 0x35, 0xc8,
+    0xe8, 0xe7, 0xa1, 0x67, 0x5f, 0xf6, 0x87, 0x36, 0x24, 0xc8, 0xc9, 0xd7,
+    0xff, 0xf0, 0x1e, 0x76, 0x82, 0x7f, 0x67, 0x47, 0x3d, 0xd4, 0x3a, 0xfd,
+    0x13, 0x08, 0x34, 0x75, 0x62, 0x60, 0x88, 0x91, 0xd3, 0xaf, 0x2d, 0xdc,
+    0x82, 0x75, 0xfc, 0xe3, 0xfe, 0x79, 0x43, 0xaa, 0x15, 0x1f, 0xce, 0x49,
+    0x21, 0xf7, 0x1a, 0x12, 0x9f, 0x46, 0x79, 0xb0, 0xf3, 0x6c, 0x52, 0xfb,
+    0xa0, 0x5c, 0x1d, 0x73, 0xe8, 0xeb, 0x80, 0xa9, 0x3a, 0x9c, 0xf4, 0x04,
+    0x84, 0x02, 0xb7, 0x3b, 0x0a, 0x87, 0xca, 0x86, 0x56, 0xdb, 0x15, 0x50,
+    0x93, 0x56, 0x85, 0x6a, 0xd4, 0x8d, 0x57, 0x1d, 0xc4, 0xe1, 0x4c, 0xf2,
+    0x81, 0xe5, 0x0d, 0xb0, 0xca, 0xa4, 0xca, 0x43, 0xe2, 0x91, 0x97, 0x36,
+    0x3b, 0x0d, 0xe3, 0x5a, 0x49, 0x48, 0x93, 0x4a, 0x31, 0xe4, 0x7d, 0x0b,
+    0x94, 0xcd, 0xd9, 0xfe, 0xe7, 0x8c, 0x87, 0xf8, 0x69, 0x0c, 0xad, 0xed,
+    0x4f, 0xeb, 0xfa, 0x9c, 0x18, 0x08, 0xf6, 0x59, 0x3f, 0xdb, 0x87, 0xff,
+    0xd9, 0x64, 0xdb, 0x50, 0xcc, 0xbf, 0x2f, 0x11, 0xff, 0x3a, 0xf9, 0xae,
+    0xed, 0x34, 0x51, 0x57, 0xff, 0xe7, 0xfe, 0x1b, 0xd4, 0xd7, 0x53, 0xdd,
+    0xc1, 0x3a, 0xb8, 0x88, 0x01, 0x2d, 0xbf, 0x30, 0xb7, 0x93, 0x10, 0x8c,
+    0x8c, 0x85, 0x35, 0xfe, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x2e, 0x8b, 0xff,
+    0x98, 0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x12, 0x5d, 0xfb, 0x8d, 0x77,
+    0x69, 0xa2, 0xf2, 0xb9, 0xf6, 0x1d, 0x66, 0x30, 0xf2, 0xb6, 0xcc, 0xea,
+    0x1f, 0x50, 0x3a, 0x72, 0x89, 0x1f, 0xe4, 0x26, 0x1b, 0x09, 0x59, 0x8e,
+    0x16, 0x7f, 0xd9, 0x52, 0x23, 0x79, 0x61, 0x7a, 0x96, 0x3b, 0xe4, 0x50,
+    0x1f, 0xec, 0x84, 0xdd, 0xff, 0xe6, 0x16, 0xf2, 0x63, 0x38, 0xd7, 0x76,
+    0x9a, 0x25, 0x9b, 0x81, 0xd3, 0xaf, 0xf2, 0x07, 0xb8, 0x82, 0xa1, 0xd7,
+    0xdd, 0x7f, 0x00, 0xeb, 0xee, 0xc2, 0xba, 0xce, 0xbc, 0x06, 0xb9, 0xd5,
+    0x24, 0x48, 0xa1, 0x8a, 0xb9, 0x0f, 0xd2, 0x4b, 0xf8, 0x3e, 0x03, 0xcb,
+    0x47, 0x5e, 0xf3, 0xac, 0xeb, 0xff, 0x76, 0x3a, 0x8a, 0x7b, 0x4f, 0xf9,
+    0xd7, 0xf0, 0xfb, 0x90, 0xed, 0x3a, 0xf9, 0xae, 0xed, 0x34, 0x46, 0x77,
+    0xf2, 0x42, 0xe7, 0xc6, 0x4e, 0xb8, 0x64, 0x75, 0x96, 0x75, 0xf9, 0x39,
+    0xd7, 0x63, 0x87, 0xa4, 0xb2, 0xdf, 0xa2, 0xb7, 0xf3, 0xc9, 0x38, 0xfc,
+    0x3a, 0xff, 0xed, 0x20, 0x35, 0x82, 0x09, 0x66, 0x8e, 0xbd, 0xa8, 0xdc,
+    0xea, 0x92, 0x78, 0x18, 0x7f, 0xc2, 0xb5, 0xbf, 0x8a, 0x76, 0x8a, 0xfc,
+    0x85, 0x7f, 0xdc, 0x76, 0x7a, 0x91, 0xc8, 0x3a, 0xff, 0xa5, 0xac, 0x8f,
+    0x91, 0xa5, 0x9d, 0x7d, 0xbf, 0x63, 0x47, 0x5f, 0x6a, 0x3d, 0xa3, 0xab,
+    0x0f, 0x0f, 0x44, 0x57, 0xff, 0x79, 0x38, 0xff, 0xfc, 0xde, 0x50, 0xb3,
+    0xaf, 0xc3, 0x12, 0xd3, 0x9d, 0x48, 0x7d, 0x9b, 0x11, 0xef, 0xff, 0xff,
+    0xb3, 0xde, 0x45, 0xf1, 0x33, 0x71, 0x07, 0xa3, 0xbf, 0x36, 0x27, 0xa6,
+    0x83, 0xaf, 0xf3, 0xcb, 0x5a, 0x71, 0x91, 0xd7, 0xe5, 0x3d, 0xe8, 0x59,
+    0xd7, 0xff, 0xbd, 0x0d, 0x4f, 0x22, 0xe6, 0xd2, 0x09, 0xd6, 0x91, 0xd4,
+    0x87, 0xb1, 0xf5, 0x22, 0xfd, 0xfc, 0x7a, 0x02, 0x75, 0x22, 0x32, 0x9e,
+    0x10, 0x00, 0x23, 0xbf, 0xfe, 0x07, 0xb5, 0xbc, 0xa0, 0x7f, 0xd7, 0xc0,
+    0x09, 0xd7, 0xa3, 0xd0, 0x75, 0x04, 0xfb, 0x76, 0x29, 0xde, 0xee, 0x09,
+    0xd4, 0x86, 0xf8, 0x04, 0x97, 0x76, 0x63, 0xaf, 0xf6, 0xfa, 0x1c, 0xe0,
+    0x60, 0xea, 0x43, 0xc9, 0x71, 0x7b, 0xef, 0x74, 0x1b, 0x67, 0x5f, 0xec,
+    0x8e, 0x3c, 0x93, 0xa7, 0x5f, 0xe4, 0x67, 0x51, 0xd7, 0x57, 0x3a, 0xb8,
+    0x7c, 0xbe, 0x30, 0xa4, 0x45, 0x62, 0xe1, 0x15, 0x7f, 0xf9, 0x3a, 0x05,
+    0x70, 0xf4, 0x1a, 0xde, 0x4e, 0x75, 0x61, 0xfa, 0xb9, 0x3d, 0xef, 0xb8,
+    0xaa, 0x3a, 0xff, 0xf0, 0x3f, 0x5a, 0x0e, 0x7e, 0x38, 0xf3, 0x1d, 0x7f,
+    0xd0, 0x9d, 0x48, 0x19, 0x80, 0x75, 0xff, 0x80, 0x1e, 0x60, 0x3b, 0x0b,
+    0xc3, 0xab, 0x11, 0xbb, 0xc2, 0x1e, 0xa4, 0xe8, 0xda, 0xff, 0xfb, 0x79,
+    0x27, 0x03, 0xd0, 0x73, 0x1b, 0xdc, 0x3a, 0xe4, 0x64, 0xeb, 0xb6, 0xb0,
+    0xea, 0xd1, 0xae, 0xf0, 0xb5, 0xfd, 0xa8, 0xf6, 0xba, 0x87, 0x5f, 0x87,
+    0x17, 0xcc, 0x3a, 0xfb, 0x9b, 0x30, 0x27, 0x56, 0x1f, 0xa2, 0xcb, 0x00,
+    0x4b, 0x7d, 0xfa, 0x6f, 0x23, 0xaf, 0xf4, 0x0f, 0x92, 0x71, 0x83, 0xaf,
+    0xff, 0x27, 0x12, 0x78, 0x1c, 0xef, 0x01, 0xb0, 0xea, 0xfd, 0x13, 0xa2,
+    0x47, 0xe3, 0x0b, 0x30, 0xad, 0xb3, 0x00, 0x22, 0x14, 0xf3, 0xa0, 0x84,
+    0xb7, 0x23, 0xdb, 0x51, 0x8f, 0x73, 0x74, 0x7c, 0x9a, 0x11, 0xbc, 0x23,
+    0x5c, 0x20, 0x3b, 0x0f, 0xb7, 0x86, 0xf7, 0xed, 0x23, 0x1a, 0x0e, 0xa1,
+    0xfb, 0xe3, 0xcd, 0x8f, 0xdb, 0x70, 0x95, 0xfb, 0x0c, 0xbb, 0xff, 0xcc,
+    0x2d, 0xe4, 0xc6, 0x71, 0xae, 0xed, 0x34, 0x4d, 0x37, 0xff, 0x98, 0x5b,
+    0xc9, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0x9c, 0x6f, 0xff, 0x30, 0xb7, 0x93,
+    0x19, 0xc6, 0xbb, 0xb4, 0xd1, 0x40, 0xdf, 0xb8, 0xd7, 0x76, 0x9a, 0x2e,
+    0x0b, 0xf8, 0x73, 0xcd, 0x4d, 0x1d, 0x74, 0x21, 0xd7, 0xf8, 0x65, 0x08,
+    0x1c, 0x59, 0xd5, 0x88, 0xa2, 0x59, 0x9f, 0x4a, 0xc0, 0x29, 0x7e, 0x93,
+    0x0a, 0x2a, 0x14, 0x3a, 0x98, 0x3e, 0xb8, 0x3c, 0xb9, 0xff, 0x3a, 0xfd,
+    0x34, 0xa0, 0x64, 0x75, 0x1d, 0x58, 0x6c, 0x44, 0x9e, 0xfa, 0x3f, 0xc6,
+    0x4e, 0xb9, 0x18, 0xe2, 0x22, 0x05, 0x1f, 0xe8, 0xfd, 0xff, 0x49, 0x8c,
+    0xe3, 0x5d, 0xda, 0x68, 0x92, 0x6c, 0xc7, 0x51, 0x04, 0xe7, 0xb7, 0x33,
+    0xf9, 0xd7, 0xf9, 0xfc, 0x39, 0x3b, 0x89, 0xd7, 0xf6, 0x0b, 0xef, 0x2d,
+    0x1d, 0x7f, 0x42, 0xf9, 0x81, 0xf1, 0xd7, 0x3b, 0x01, 0x45, 0x02, 0x83,
+    0x1c, 0x30, 0xd1, 0x65, 0x4e, 0xd9, 0x00, 0x4a, 0x98, 0xae, 0xd8, 0xd6,
+    0x26, 0x57, 0xfd, 0x5f, 0x51, 0xb2, 0x7a, 0x32, 0xcd, 0x90, 0xc9, 0xbf,
+    0xf2, 0x8e, 0xc6, 0x71, 0xae, 0xed, 0x34, 0x5a, 0x97, 0xfe, 0x79, 0x31,
+    0x9c, 0x6b, 0xbb, 0x4d, 0x12, 0xad, 0xc8, 0xc9, 0xd4, 0x75, 0x98, 0x51,
+    0x16, 0xab, 0x4b, 0xf2, 0x56, 0xd0, 0xb5, 0xfd, 0x9c, 0x6b, 0xbb, 0x4d,
+    0x11, 0x4d, 0xff, 0xcb, 0x63, 0xc2, 0xff, 0xeb, 0xd8, 0xd3, 0xa9, 0x83,
+    0xfd, 0x73, 0x8b, 0xfc, 0xc6, 0x71, 0xae, 0xed, 0x34, 0x46, 0x97, 0x03,
+    0xa7, 0x5f, 0xf8, 0x38, 0xb4, 0xe6, 0x6a, 0x68, 0x3a, 0xff, 0xff, 0x9c,
+    0x1a, 0xee, 0x07, 0xef, 0xdd, 0x27, 0xdf, 0x26, 0xa6, 0xfa, 0x75, 0xe4,
+    0x76, 0x4e, 0xa4, 0x46, 0x3a, 0xb9, 0xea, 0xdb, 0xef, 0x9a, 0xee, 0xd3,
+    0x45, 0x3f, 0x77, 0xa0, 0xea, 0xe1, 0xe1, 0x78, 0xb6, 0xff, 0xde, 0x9a,
+    0x3d, 0xd7, 0x9b, 0xe6, 0x1d, 0x7f, 0xf9, 0x16, 0x20, 0xea, 0x73, 0x35,
+    0x34, 0x1d, 0x7f, 0xf0, 0x3d, 0xc0, 0x4d, 0xa6, 0xbc, 0xda, 0x3a, 0xff,
+    0xec, 0x98, 0x03, 0x3e, 0x9a, 0xf3, 0x68, 0xeb, 0x30, 0xad, 0xaa, 0x89,
+    0x88, 0x6e, 0xe3, 0xa2, 0x11, 0x3a, 0x08, 0xa4, 0x79, 0x1e, 0xff, 0xf3,
+    0x0b, 0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x13, 0x55, 0xfe, 0x63, 0x38,
+    0xd7, 0x76, 0x9a, 0x2b, 0xbb, 0xe6, 0xbb, 0xb4, 0xd1, 0x5f, 0x5e, 0x65,
+    0x96, 0x4a, 0xb0, 0x94, 0xc1, 0x7f, 0x5c, 0x3e, 0xb5, 0xa6, 0x5e, 0x94,
+    0x6e, 0x75, 0xe9, 0xb3, 0xa7, 0x5f, 0xfb, 0x3a, 0xcb, 0xfb, 0x51, 0x93,
+    0x9d, 0x6f, 0x1d, 0x7f, 0xc9, 0xcc, 0x9d, 0x25, 0x81, 0x3a, 0xb8, 0x78,
+    0xee, 0x21, 0x7e, 0xdf, 0x6b, 0xa0, 0xfa, 0x75, 0xb8, 0x75, 0x1d, 0x6e,
+    0xa1, 0x75, 0xc1, 0x0b, 0x31, 0x89, 0xb6, 0xcc, 0x44, 0xe3, 0x82, 0x39,
+    0xa8, 0x42, 0x80, 0x87, 0x6d, 0x22, 0xff, 0xf3, 0x0b, 0x79, 0x31, 0x9c,
+    0x6b, 0xbb, 0x4d, 0x13, 0xdd, 0xfb, 0xb1, 0xb4, 0xfb, 0x9d, 0x7e, 0xe3,
+    0x5d, 0xda, 0x68, 0xb8, 0x6c, 0xc4, 0x1e, 0xee, 0x15, 0x5f, 0xfc, 0xc3,
+    0xc9, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0x93, 0xea, 0x19, 0x05, 0xb3, 0xc3,
+    0x16, 0x44, 0x4a, 0x4a, 0xc8, 0x6b, 0x94, 0xca, 0xfc, 0x94, 0x2f, 0xd7,
+    0x2d, 0x42, 0xd3, 0x61, 0x3d, 0xfe, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x22,
+    0xab, 0xf7, 0x1a, 0xee, 0xd3, 0x45, 0x33, 0x7f, 0x27, 0x71, 0xf7, 0xfc,
+    0xeb, 0x31, 0x87, 0xc1, 0xb6, 0x67, 0x7f, 0xf9, 0x85, 0xbc, 0x98, 0xce,
+    0x35, 0xdd, 0xa6, 0x89, 0x9e, 0xff, 0xf3, 0x0b, 0x79, 0x31, 0x9c, 0x6b,
+    0xbb, 0x4d, 0x14, 0x6d, 0x4e, 0x9b, 0xc0, 0x61, 0x3e, 0xa1, 0x5f, 0x95,
+    0xef, 0xfc, 0xf2, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x23, 0xab, 0xff, 0xb9,
+    0x3b, 0x1a, 0x1c, 0xf6, 0xa1, 0x67, 0x53, 0x08, 0x8f, 0x84, 0xab, 0x81,
+    0xd3, 0xaf, 0x9a, 0xd0, 0x34, 0xeb, 0xf6, 0x08, 0x72, 0x73, 0xaf, 0xf4,
+    0x43, 0x73, 0x9c, 0xc3, 0xa9, 0x0f, 0x58, 0x49, 0xaf, 0xd9, 0xc6, 0x81,
+    0x43, 0xaf, 0xfc, 0x38, 0xa3, 0xcd, 0xae, 0xc0, 0x4e, 0xbd, 0x33, 0xf8,
+    0xeb, 0xe6, 0xbb, 0xb4, 0xd1, 0x4d, 0x5f, 0xb3, 0x76, 0x5f, 0xa7, 0x5f,
+    0xfd, 0xac, 0x10, 0xc7, 0xc5, 0x5f, 0xb3, 0xf4, 0x3a, 0x82, 0x99, 0x22,
+    0x14, 0x4c, 0x7d, 0xc1, 0xc1, 0x2d, 0xd1, 0x45, 0xff, 0xff, 0x60, 0xfb,
+    0x48, 0xdc, 0x1d, 0x37, 0xa9, 0xd6, 0xfd, 0x9c, 0xeb, 0xfe, 0xd3, 0xef,
+    0x93, 0x47, 0x74, 0x75, 0xdd, 0x41, 0x45, 0x07, 0x99, 0xef, 0xfe, 0x97,
+    0x50, 0x67, 0xd0, 0x23, 0x93, 0x1d, 0x7f, 0xda, 0xd3, 0x53, 0x9c, 0x49,
+    0xce, 0xbf, 0xf6, 0x32, 0xff, 0xbf, 0xbd, 0x9d, 0x3a, 0xff, 0xc2, 0x0f,
+    0x77, 0x26, 0x94, 0x6e, 0x75, 0xa6, 0x3a, 0xfd, 0x9d, 0x71, 0x09, 0xd5,
+    0x39, 0xb6, 0xfc, 0x46, 0xe8, 0x50, 0xeb, 0xf9, 0xff, 0xd2, 0xac, 0xab,
+    0x2a, 0xc7, 0x5f, 0xc9, 0x0b, 0x9f, 0x19, 0x3a, 0xff, 0xfb, 0x3d, 0xdc,
+    0x97, 0x1c, 0x7d, 0xd7, 0x91, 0xd7, 0x47, 0xe7, 0x5f, 0xe7, 0xde, 0x1a,
+    0x8d, 0x63, 0x88, 0x90, 0x12, 0xdf, 0xa9, 0xb5, 0x89, 0xea, 0xa3, 0xaf,
+    0x48, 0xc4, 0x5b, 0x50, 0xcd, 0xbf, 0x7b, 0xac, 0xbc, 0xe7, 0x59, 0x85,
+    0x6d, 0x77, 0xf6, 0x05, 0x82, 0xf1, 0x91, 0xa2, 0x36, 0x1e, 0xfb, 0x96,
+    0xf1, 0x14, 0x4e, 0x7d, 0x28, 0x4f, 0xea, 0x6d, 0xfb, 0x8d, 0x77, 0x69,
+    0xa2, 0xaa, 0xbf, 0xf3, 0xc9, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0x9b, 0x6c,
+    0xc6, 0x1f, 0xea, 0xcc, 0xef, 0xf3, 0x19, 0xc6, 0xbb, 0xb4, 0xd1, 0x5f,
+    0xdf, 0xb8, 0xd7, 0x76, 0x9a, 0x2c, 0x6b, 0xb6, 0xa4, 0x75, 0x98, 0xc3,
+    0xcc, 0x98, 0xce, 0xfd, 0xa6, 0xf6, 0x14, 0x3a, 0xff, 0x08, 0x25, 0x9a,
+    0x7f, 0x1d, 0x77, 0x3c, 0x75, 0xff, 0x67, 0xbd, 0x9c, 0x0e, 0x09, 0xd7,
+    0x94, 0x96, 0x1d, 0x66, 0x31, 0x13, 0x2e, 0x62, 0x22, 0xda, 0x36, 0xb2,
+    0x30, 0x98, 0x17, 0x21, 0x83, 0x7e, 0xe3, 0x5d, 0xda, 0x68, 0xb5, 0x6f,
+    0xfc, 0xf2, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x28, 0x2b, 0xf4, 0x33, 0xb7,
+    0x9c, 0x3a, 0xcc, 0x62, 0x29, 0xd6, 0x67, 0xf5, 0x2a, 0xff, 0x40, 0xff,
+    0x0a, 0xee, 0xb3, 0xae, 0xe4, 0x1d, 0x52, 0x3c, 0x9d, 0xa3, 0x4b, 0xe6,
+    0xbb, 0xb4, 0xd1, 0x71, 0x5f, 0xc0, 0x7d, 0xc3, 0x9c, 0x3a, 0xb8, 0x7b,
+    0x5a, 0x2d, 0xbd, 0xc8, 0x59, 0xd7, 0xcf, 0xb4, 0x93, 0x9d, 0x7e, 0xe8,
+    0x14, 0xc1, 0x3a, 0xf6, 0xd2, 0x34, 0xea, 0x09, 0xe2, 0xed, 0x13, 0xdf,
+    0xe5, 0xbc, 0xb4, 0x81, 0xc3, 0xaf, 0xf4, 0x2d, 0xf6, 0x47, 0x36, 0x8e,
+    0xbf, 0xb3, 0x8f, 0xe0, 0x41, 0xd7, 0xff, 0xce, 0x30, 0x9b, 0x5a, 0x4d,
+    0x67, 0x73, 0x6c, 0xea, 0x09, 0xfe, 0x6c, 0x2b, 0xbf, 0xf9, 0x04, 0x12,
+    0xcd, 0x69, 0x03, 0x87, 0x54, 0xc7, 0xcb, 0xe2, 0x4b, 0x31, 0x0a, 0xad,
+    0x71, 0xff, 0x84, 0x5d, 0x1b, 0x76, 0x9f, 0xc9, 0x7c, 0x63, 0xf6, 0x31,
+    0x7b, 0xf2, 0xa9, 0x5a, 0x7e, 0xa4, 0x1d, 0x7f, 0xe4, 0xdd, 0x56, 0xd7,
+    0x3e, 0x7c, 0xee, 0xd9, 0xd7, 0xdd, 0x8f, 0x34, 0xea, 0x56, 0xa7, 0xda,
+    0x14, 0xcb, 0xff, 0xca, 0xb2, 0x8c, 0xab, 0xce, 0x15, 0x57, 0xcf, 0x9d,
+    0xdb, 0x3a, 0xfd, 0xc6, 0xbb, 0xb4, 0xd1, 0x74, 0xdf, 0xa0, 0x5c, 0x30,
+    0x75, 0xe8, 0xf6, 0xd1, 0xd7, 0xd8, 0x1c, 0x09, 0xd7, 0xfc, 0xfb, 0x23,
+    0xda, 0x03, 0x55, 0x27, 0x59, 0x85, 0x59, 0x3f, 0xd8, 0x85, 0x04, 0x8a,
+    0x31, 0x89, 0x0c, 0xfa, 0x48, 0xe3, 0xc2, 0x41, 0x7f, 0xfd, 0x83, 0xe4,
+    0x5f, 0x61, 0x05, 0xf8, 0xa1, 0xd7, 0xf4, 0xf1, 0xe7, 0x50, 0x07, 0x51,
+    0xd7, 0xff, 0x47, 0x3f, 0xf9, 0xae, 0xc2, 0xdc, 0x4e, 0xbf, 0xd1, 0xcf,
+    0xbd, 0xee, 0x7e, 0x75, 0x48, 0xfe, 0xba, 0x8b, 0x7f, 0x49, 0xe4, 0xe2,
+    0xd3, 0xaf, 0xff, 0x67, 0xa1, 0x9f, 0xb3, 0xeb, 0x17, 0x0a, 0xe7, 0x59,
+    0x85, 0x65, 0x32, 0x0c, 0x84, 0x24, 0xc4, 0x42, 0x57, 0x5c, 0x4e, 0x71,
+    0x71, 0xa7, 0x5f, 0x63, 0x2a, 0xca, 0xce, 0xbf, 0xe4, 0xe0, 0xc6, 0xeb,
+    0x7f, 0x1d, 0x7f, 0xff, 0xc0, 0xe4, 0xb5, 0xd7, 0x4e, 0x73, 0x80, 0xdd,
+    0x38, 0xfa, 0x3a, 0xff, 0xc2, 0xec, 0xfb, 0x3a, 0xf3, 0x39, 0xd7, 0xff,
+    0xf7, 0x44, 0x0e, 0xaf, 0x92, 0xee, 0x29, 0x81, 0x98, 0x07, 0x5c, 0xdc,
+    0x3a, 0xa0, 0xfc, 0xd4, 0x5e, 0xbc, 0xa6, 0xa4, 0x75, 0xff, 0xa5, 0x9c,
+    0xe3, 0xca, 0x7c, 0x64, 0xeb, 0xff, 0xb0, 0x31, 0x28, 0xe4, 0x7d, 0x71,
+    0x3a, 0xff, 0xdb, 0x32, 0x4b, 0x0a, 0x6c, 0x80, 0x9d, 0x4b, 0x44, 0x1b,
+    0xa1, 0x5c, 0xec, 0x4e, 0xa8, 0xea, 0x66, 0x7e, 0x42, 0xc3, 0x44, 0x5e,
+    0x1d, 0xfb, 0x0c, 0x2a, 0xea, 0xae, 0x41, 0x94, 0xe3, 0x7f, 0xef, 0x23,
+    0x50, 0x2e, 0x2a, 0x41, 0xd7, 0xfd, 0x1b, 0xf5, 0xf5, 0xe8, 0x64, 0xea,
+    0x83, 0xf5, 0xe1, 0xe5, 0xc0, 0xe9, 0xd7, 0xe1, 0xce, 0xbf, 0x8e, 0xbf,
+    0xa4, 0xf9, 0xb2, 0x02, 0x75, 0x2a, 0x0f, 0x49, 0x57, 0x92, 0xdf, 0x20,
+    0x25, 0x07, 0x5f, 0x9e, 0x69, 0x27, 0x8e, 0xbf, 0xf4, 0x07, 0x91, 0x24,
+    0xdf, 0xd8, 0x75, 0x49, 0x10, 0x9f, 0x90, 0x78, 0x9e, 0xff, 0xff, 0xa0,
+    0x3d, 0xcd, 0xfc, 0x2f, 0xdf, 0xdf, 0x5a, 0x7e, 0x34, 0xeb, 0xfd, 0x99,
+    0x8a, 0x28, 0xf2, 0x3a, 0x94, 0x44, 0xc7, 0x99, 0xaf, 0xdb, 0x13, 0x98,
+    0x13, 0xaf, 0xff, 0xb5, 0xd4, 0xd7, 0xbb, 0x81, 0x4d, 0x60, 0x9d, 0x7b,
+    0xb0, 0x38, 0x7e, 0xa0, 0x28, 0xbf, 0xd0, 0xbc, 0x45, 0xc2, 0xb9, 0xd7,
+    0xfa, 0x4b, 0xd2, 0x0e, 0xf2, 0x3a, 0x9a, 0x7c, 0xd3, 0x19, 0xde, 0x77,
+    0x69, 0xa2, 0x4c, 0xbd, 0xb4, 0x9a, 0x3a, 0x9a, 0x78, 0xbb, 0x44, 0xf7,
+    0xe6, 0xaa, 0xca, 0xa5, 0x65, 0x50, 0x75, 0xfe, 0xcd, 0xfd, 0xe7, 0x96,
+    0x8e, 0xa8, 0x3e, 0xde, 0x1d, 0x5f, 0xe1, 0x7f, 0x69, 0xa0, 0x13, 0xaf,
+    0xff, 0xee, 0x67, 0xe9, 0xfb, 0x38, 0x9b, 0x07, 0x3d, 0xd4, 0x3a, 0xb1,
+    0x11, 0xa8, 0x63, 0x52, 0x54, 0xc1, 0x90, 0x97, 0xe3, 0x42, 0xe1, 0x25,
+    0xd8, 0x57, 0x5f, 0xc1, 0xfd, 0x51, 0xaf, 0xf6, 0xce, 0xbd, 0xa4, 0x09,
+    0xd7, 0xf0, 0xc6, 0xeb, 0x7f, 0x1d, 0x7f, 0xd0, 0xdf, 0x03, 0xbc, 0x86,
+    0x4e, 0xbf, 0xcd, 0x4e, 0x6a, 0x68, 0x73, 0xaf, 0xfe, 0x06, 0xba, 0xf2,
+    0xeb, 0xca, 0x04, 0xea, 0xdc, 0xfd, 0x38, 0x65, 0x77, 0x52, 0x64, 0xc5,
+    0xf8, 0x36, 0xb2, 0xcf, 0x42, 0xb6, 0xfb, 0xc8, 0xb7, 0x3a, 0xff, 0x27,
+    0x75, 0x1e, 0x80, 0x9d, 0x58, 0x7a, 0x3e, 0x20, 0xbf, 0xe8, 0xef, 0x92,
+    0x75, 0xc3, 0x4e, 0xbf, 0xff, 0x3b, 0x79, 0x1d, 0x1c, 0xf6, 0x30, 0xcb,
+    0x2c, 0x95, 0x52, 0x45, 0x86, 0x88, 0x7c, 0x71, 0x7f, 0x35, 0xa0, 0x68,
+    0xc1, 0xd7, 0xff, 0xb3, 0x79, 0x0c, 0x4b, 0x91, 0xe7, 0xf1, 0xd7, 0xfe,
+    0x7f, 0x47, 0x35, 0xd8, 0x1f, 0x1d, 0x7e, 0xc9, 0x23, 0xec, 0x3a, 0x84,
+    0xf8, 0xf4, 0x79, 0x52, 0x46, 0x60, 0x21, 0x57, 0x7f, 0xf8, 0x62, 0x5c,
+    0xe0, 0x37, 0x4e, 0x3e, 0x8e, 0xbf, 0xfe, 0xd6, 0x28, 0x39, 0xed, 0x64,
+    0x85, 0xd9, 0x3a, 0xed, 0x89, 0xd4, 0x4b, 0xf9, 0x26, 0xfb, 0x6a, 0x3b,
+    0xa3, 0xaa, 0x0f, 0x53, 0x0c, 0x2f, 0xef, 0x08, 0x27, 0xdd, 0x5c, 0xeb,
+    0xff, 0xd1, 0x38, 0xe6, 0x4f, 0xe5, 0x20, 0x64, 0x75, 0xff, 0x9c, 0x67,
+    0xeb, 0xad, 0x34, 0x87, 0x53, 0xa2, 0xdc, 0x4c, 0x99, 0x49, 0xbc, 0xcb,
+    0x2c, 0x95, 0x7d, 0x3a, 0xd3, 0x45, 0x30, 0x5f, 0xdd, 0x01, 0x3a, 0xdc,
+    0x73, 0xc7, 0x13, 0x2b, 0xff, 0xff, 0x80, 0xe2, 0xde, 0x66, 0xc8, 0x1f,
+    0x2e, 0x30, 0x43, 0x9b, 0xf8, 0xeb, 0xfd, 0x28, 0xe4, 0xf1, 0xc9, 0xce,
+    0xbf, 0xb5, 0xa4, 0xc1, 0xfc, 0xeb, 0xdc, 0xc5, 0x73, 0xaf, 0xfd, 0x0c,
+    0xfd, 0x9f, 0x58, 0xb8, 0x57, 0x3a, 0xb8, 0x88, 0xe5, 0x96, 0x78, 0x7a,
+    0xa1, 0x1e, 0x59, 0x0c, 0x2b, 0xf2, 0x7a, 0x7c, 0x64, 0xeb, 0xfe, 0x86,
+    0xf4, 0x41, 0xe8, 0xd1, 0xd7, 0xff, 0x26, 0xd4, 0x36, 0x17, 0x81, 0x75,
+    0x9d, 0x7f, 0xfe, 0xf7, 0x72, 0x5f, 0x1b, 0xd4, 0xf6, 0xed, 0x4e, 0x1d,
+    0x5c, 0x47, 0xda, 0xca, 0x3a, 0x6e, 0x28, 0x97, 0xfc, 0xb8, 0xe6, 0xcc,
+    0xe4, 0x4c, 0x75, 0xff, 0xb8, 0xd5, 0xc6, 0xfa, 0xcd, 0x98, 0x75, 0xfe,
+    0x1f, 0xf6, 0xf0, 0x38, 0xb3, 0xaf, 0xe1, 0xf9, 0xb7, 0x9c, 0x83, 0xaa,
+    0x11, 0x4b, 0x88, 0x0e, 0x6b, 0x7f, 0xd8, 0xff, 0xfc, 0xc0, 0xbc, 0x8e,
+    0xbf, 0xfc, 0xf3, 0xf5, 0x20, 0x72, 0x64, 0xe2, 0x1d, 0x58, 0x9e, 0x47,
+    0xe7, 0x9a, 0x86, 0xff, 0x8b, 0x59, 0x39, 0xbf, 0x0e, 0x75, 0xfc, 0x75,
+    0xff, 0xa5, 0x03, 0x3f, 0xde, 0x08, 0x24, 0x75, 0x2b, 0x9f, 0x2c, 0xc4,
+    0xb7, 0xde, 0x9f, 0x02, 0x75, 0xff, 0x22, 0x9f, 0x79, 0xfa, 0xd3, 0x47,
+    0x54, 0xc7, 0xbd, 0xb6, 0x45, 0x79, 0x96, 0x59, 0x3a, 0xff, 0xfd, 0x8b,
+    0xf0, 0xc7, 0xf8, 0x1d, 0x62, 0xe1, 0xa5, 0x30, 0x5f, 0xdf, 0xec, 0x6f,
+    0x52, 0x05, 0xa7, 0x5f, 0xee, 0x47, 0x91, 0xa8, 0x13, 0xaf, 0xd2, 0x9b,
+    0x31, 0xa7, 0x5b, 0x87, 0x52, 0xb0, 0x7d, 0x10, 0x63, 0xf4, 0x9e, 0xb1,
+    0x3f, 0x94, 0x84, 0x27, 0x51, 0x45, 0x8f, 0x50, 0x98, 0xbd, 0xe9, 0x74,
+    0xeb, 0x21, 0xd7, 0xf7, 0x63, 0xe3, 0x52, 0x73, 0xaf, 0xee, 0x3f, 0x06,
+    0x24, 0x75, 0xff, 0xf4, 0x29, 0xae, 0xba, 0x7a, 0x16, 0x2e, 0xa1, 0xd7,
+    0xfe, 0xcd, 0x9d, 0x4f, 0x9a, 0xd2, 0x2c, 0xeb, 0x9f, 0xd2, 0x44, 0x7f,
+    0x53, 0xaf, 0xfc, 0x92, 0x4e, 0x6f, 0x03, 0x1a, 0x3a, 0x95, 0xa2, 0x6c,
+    0x41, 0x0f, 0xe1, 0x78, 0xc2, 0xeb, 0xc5, 0xd7, 0x49, 0x85, 0x6d, 0xb4,
+    0xbe, 0x55, 0x34, 0x44, 0x2c, 0x25, 0x0c, 0x9c, 0x95, 0xf2, 0xa2, 0xd3,
+    0x63, 0x4e, 0xde, 0x35, 0x04, 0x30, 0x9a, 0x1f, 0x1c, 0x8c, 0x4f, 0xb0,
+    0xd7, 0x78, 0x4a, 0xfe, 0x4c, 0x31, 0xb1, 0x6a, 0x57, 0x4f, 0xa5, 0x57,
+    0xed, 0xa9, 0x7d, 0x8d, 0xfa, 0xff, 0xf7, 0x31, 0x90, 0xf7, 0x26, 0x1c,
+    0xe4, 0x8e, 0xbd, 0xcc, 0x57, 0x3a, 0xff, 0xd0, 0xcf, 0xd9, 0xf5, 0x8b,
+    0x85, 0x73, 0xab, 0x88, 0xac, 0x5a, 0x57, 0x87, 0xaf, 0xff, 0x9d, 0x71,
+    0xc6, 0xf0, 0x0a, 0x70, 0x0f, 0xa3, 0xab, 0x11, 0x00, 0x03, 0x0b, 0xfd,
+    0xc6, 0x81, 0xc2, 0xb8, 0x3a, 0xff, 0xe8, 0xe7, 0xdf, 0x27, 0xbb, 0x81,
+    0x43, 0xaf, 0xfd, 0xd1, 0x89, 0xfe, 0xf7, 0xae, 0xae, 0x75, 0x42, 0x2e,
+    0x67, 0x32, 0xc4, 0x4b, 0xcf, 0xc9, 0xce, 0xb9, 0x96, 0x4e, 0xbc, 0xed,
+    0x61, 0xa6, 0xd1, 0x91, 0xcb, 0xfa, 0x38, 0xf2, 0x4e, 0x9d, 0x7e, 0xc5,
+    0xf5, 0xc2, 0x75, 0x98, 0x86, 0xfb, 0xdb, 0x23, 0xe8, 0x50, 0xa9, 0xb2,
+    0xc2, 0xf9, 0x0a, 0x07, 0xad, 0x37, 0xc6, 0x54, 0xbe, 0xa1, 0xb7, 0xb1,
+    0x8d, 0x93, 0x4d, 0xa2, 0xba, 0x93, 0xaf, 0xf3, 0x0c, 0xf1, 0x06, 0xf1,
+    0x94, 0xf0, 0xa1, 0x70, 0x8b, 0xec, 0x65, 0x7f, 0xc3, 0x5b, 0x52, 0xcd,
+    0xbd, 0x29, 0xf4, 0x15, 0xfb, 0xa5, 0xfd, 0xa8, 0x9a, 0x49, 0x31, 0xd7,
+    0xff, 0xa2, 0x7c, 0xf4, 0x0a, 0x7f, 0x9b, 0xf8, 0xeb, 0x31, 0xa3, 0xf7,
+    0xfa, 0x5d, 0x7e, 0xe3, 0x5d, 0xda, 0x68, 0x8d, 0x6f, 0x29, 0xbe, 0x8e,
+    0xb3, 0x18, 0x7a, 0x3e, 0x33, 0xbf, 0x71, 0xae, 0xed, 0x34, 0x54, 0xb7,
+    0x3b, 0x4d, 0x10, 0xd5, 0x98, 0xc3, 0xd5, 0x73, 0x3b, 0xf7, 0x1a, 0xee,
+    0xd3, 0x44, 0x7d, 0x7f, 0xfc, 0x2f, 0xe9, 0x42, 0x9f, 0x23, 0xda, 0x8f,
+    0xce, 0xbc, 0xf2, 0x63, 0x11, 0x09, 0xf4, 0xce, 0xff, 0xcf, 0x3c, 0x75,
+    0x38, 0x90, 0xb3, 0xaf, 0xf4, 0x73, 0x07, 0xd9, 0xd3, 0xaf, 0x2f, 0x18,
+    0xdb, 0x3e, 0xcf, 0xa7, 0x94, 0xc2, 0x36, 0xe2, 0x14, 0x57, 0xff, 0xfd,
+    0x20, 0x71, 0x47, 0xd6, 0x06, 0x37, 0xd7, 0xdf, 0x28, 0x8a, 0x1d, 0x7f,
+    0x03, 0x7d, 0xe5, 0x9e, 0x3a, 0xff, 0xf2, 0xac, 0xa3, 0x2a, 0xf3, 0x85,
+    0x55, 0xf3, 0xe7, 0x76, 0xce, 0xbf, 0x71, 0xae, 0xed, 0x34, 0x58, 0xf7,
+    0x3e, 0x8e, 0xbf, 0xa7, 0xfb, 0xce, 0x67, 0x0e, 0xa9, 0x1e, 0x2b, 0x8a,
+    0xdf, 0xf0, 0xba, 0x9d, 0x48, 0x19, 0xce, 0xbf, 0xff, 0x7f, 0x29, 0xd5,
+    0x68, 0x56, 0xe7, 0x6f, 0x3e, 0x7c, 0xee, 0xd9, 0xd7, 0xe4, 0xf7, 0x93,
+    0xc7, 0x5f, 0x73, 0x99, 0xb6, 0x75, 0x61, 0xe5, 0x39, 0x35, 0xfb, 0x39,
+    0x99, 0x31, 0xd6, 0x62, 0x15, 0x64, 0x4e, 0xd9, 0x22, 0xfc, 0x62, 0x47,
+    0x89, 0x88, 0x7a, 0x6f, 0xa8, 0x5a, 0xfd, 0x20, 0xbc, 0xab, 0x2d, 0x43,
+    0xaf, 0xe5, 0x40, 0xe7, 0x5f, 0xc7, 0x5f, 0xe7, 0xff, 0x4f, 0xef, 0x39,
+    0xd7, 0x2d, 0xa7, 0x50, 0x9e, 0x47, 0x8c, 0xaf, 0xfd, 0x8c, 0xf3, 0x05,
+    0xf7, 0x96, 0x8e, 0xbf, 0x66, 0xba, 0x8c, 0x9d, 0x7d, 0xfa, 0xd3, 0x87,
+    0x5f, 0xff, 0xf4, 0x70, 0x70, 0x39, 0xde, 0xa3, 0x7a, 0x9e, 0xd3, 0xee,
+    0x75, 0x22, 0x21, 0xba, 0x45, 0x7f, 0x47, 0x3f, 0xdb, 0x07, 0x8e, 0xbf,
+    0xe8, 0x1f, 0x2a, 0x9f, 0xc0, 0x83, 0xaf, 0xff, 0x47, 0x61, 0x6d, 0xea,
+    0x7b, 0x31, 0x67, 0x5f, 0x7f, 0xfa, 0x7d, 0x3a, 0xf3, 0xbb, 0x4d, 0x16,
+    0x85, 0xff, 0x9d, 0x9d, 0xa6, 0xbf, 0x27, 0xc6, 0x4e, 0xbf, 0xbf, 0x81,
+    0x8f, 0x68, 0xea, 0x6a, 0x25, 0xb8, 0x4f, 0xfa, 0x1d, 0xff, 0xff, 0xf2,
+    0x73, 0xae, 0x29, 0x1e, 0x4e, 0xc6, 0xbb, 0x9a, 0xe6, 0x37, 0x3c, 0x75,
+    0x49, 0x50, 0xb0, 0x4c, 0x5a, 0x74, 0x88, 0xfc, 0x85, 0xdf, 0x4c, 0x6e,
+    0xc5, 0x9d, 0x7f, 0xf3, 0xef, 0xb3, 0xaa, 0xe9, 0xe1, 0x85, 0x9d, 0x5c,
+    0x3d, 0xd7, 0x15, 0xbf, 0xff, 0x27, 0xb4, 0xfb, 0xeb, 0x59, 0xd4, 0xd0,
+    0x27, 0x3a, 0xff, 0xf8, 0x13, 0xf1, 0x3d, 0x38, 0x39, 0x2d, 0x2b, 0xa1,
+    0xd5, 0xd4, 0x55, 0x8a, 0xb5, 0xff, 0xf0, 0x39, 0xc8, 0x1c, 0x51, 0x3b,
+    0xdc, 0xfa, 0x75, 0x95, 0x27, 0x57, 0x0f, 0x90, 0x0a, 0x17, 0xf9, 0x60,
+    0x1f, 0x68, 0x1c, 0x3a, 0xb8, 0x7a, 0xbb, 0x64, 0x57, 0xf6, 0xc9, 0xbb,
+    0x9f, 0xb9, 0xd7, 0xe1, 0x6b, 0xe9, 0x0e, 0xbf, 0xff, 0xb8, 0x31, 0x1b,
+    0xfc, 0xd7, 0x86, 0x03, 0xd8, 0xf1, 0xd7, 0x27, 0x4e, 0xbe, 0x90, 0xbf,
+    0xd3, 0xaf, 0xf0, 0x5f, 0xfe, 0x71, 0xff, 0x3a, 0xfd, 0x9c, 0x6a, 0xbb,
+    0x27, 0x52, 0x1e, 0xf8, 0x9a, 0x54, 0x26, 0x6d, 0x84, 0xaa, 0xeb, 0x6e,
+    0x2a, 0x08, 0x40, 0xde, 0x75, 0x74, 0x3a, 0xff, 0xdf, 0x7c, 0xa2, 0x29,
+    0x18, 0x30, 0x75, 0xfb, 0xef, 0x86, 0x3f, 0x3a, 0xb7, 0x44, 0x2f, 0x07,
+    0x76, 0x1f, 0xdf, 0xa3, 0xd9, 0xd8, 0x3a, 0xff, 0xff, 0xf7, 0x50, 0x38,
+    0x93, 0xf6, 0x23, 0xe6, 0x6f, 0x2d, 0x27, 0x9c, 0x70, 0xeb, 0xff, 0x66,
+    0xf2, 0xd4, 0xdc, 0x7f, 0x68, 0xeb, 0xff, 0xec, 0xf6, 0xb2, 0x6e, 0xc6,
+    0xcc, 0xef, 0x60, 0xeb, 0xfe, 0x18, 0x89, 0xb3, 0x62, 0x70, 0xea, 0x9d,
+    0x36, 0x36, 0x92, 0xfe, 0xec, 0x28, 0x1e, 0x50, 0xbf, 0x7c, 0x9a, 0x49,
+    0x31, 0xd5, 0x0a, 0x83, 0x72, 0x39, 0x64, 0x4c, 0xbf, 0xfb, 0xa9, 0xf3,
+    0x07, 0x13, 0x8f, 0xb0, 0xeb, 0xff, 0xfd, 0xd8, 0x1c, 0xff, 0x58, 0x1e,
+    0xc4, 0xeb, 0x00, 0x84, 0xea, 0x51, 0x14, 0x9e, 0x44, 0xbf, 0xff, 0xa2,
+    0x6c, 0x0f, 0x63, 0x67, 0x73, 0xc3, 0x10, 0xb3, 0xaf, 0xed, 0xf5, 0xf6,
+    0x70, 0x09, 0xd7, 0xfd, 0x0d, 0xea, 0x4c, 0xef, 0x39, 0xd4, 0xb4, 0x61,
+    0xba, 0xd7, 0xe6, 0x37, 0xfa, 0x51, 0xc9, 0xe3, 0x93, 0x9d, 0x7f, 0xc8,
+    0x01, 0x97, 0x23, 0x02, 0x75, 0xff, 0xff, 0x77, 0x24, 0xde, 0xa7, 0x63,
+    0x39, 0x2f, 0x0c, 0x2f, 0x47, 0x56, 0x91, 0x35, 0xe3, 0x6a, 0x84, 0x78,
+    0xe4, 0x33, 0xaf, 0xf7, 0x1b, 0x36, 0x27, 0x40, 0x75, 0xfe, 0x5c, 0x34,
+    0x5f, 0x7f, 0x1d, 0x7f, 0x72, 0x3d, 0x3e, 0x32, 0x75, 0xff, 0xff, 0xf2,
+    0x03, 0x9d, 0xc9, 0xa6, 0x7e, 0x4d, 0xee, 0x83, 0xfd, 0x62, 0x6c, 0x0c,
+    0x1d, 0x7e, 0xf7, 0x5c, 0x54, 0x3a, 0xff, 0x84, 0x13, 0x87, 0xb8, 0x30,
+    0x75, 0xb0, 0x28, 0xe0, 0xc8, 0x41, 0x34, 0x9e, 0xff, 0xf7, 0x3f, 0x6f,
+    0xe3, 0x9e, 0xd3, 0xb8, 0x9d, 0x50, 0x9f, 0xae, 0x19, 0xa1, 0x90, 0xc6,
+    0x1c, 0x03, 0x9b, 0xfd, 0x9d, 0x99, 0x3a, 0x8b, 0x3a, 0xff, 0x4b, 0x39,
+    0xa1, 0x89, 0xce, 0xbd, 0xb7, 0x93, 0x9d, 0x7b, 0x3a, 0xe7, 0x5f, 0xa6,
+    0x08, 0x00, 0x27, 0x50, 0x4f, 0x09, 0xc6, 0xaf, 0xf6, 0x33, 0x8d, 0x6e,
+    0x32, 0x75, 0xff, 0x6e, 0xbc, 0xc1, 0xf6, 0xde, 0x1d, 0x79, 0x49, 0x00,
+    0xeb, 0xf7, 0x63, 0x93, 0xac, 0xeb, 0xfc, 0x07, 0x1e, 0xe3, 0xcc, 0x75,
+    0xb7, 0x98, 0xf6, 0x59, 0x28, 0xa4, 0x45, 0x0b, 0xbb, 0x56, 0x26, 0x5e,
+    0xe6, 0x63, 0x0d, 0xba, 0xc5, 0x49, 0x1b, 0x99, 0x21, 0x93, 0xb0, 0xea,
+    0x35, 0x0b, 0xbd, 0x07, 0x5c, 0xfe, 0x3a, 0xb8, 0x6a, 0xba, 0x2b, 0x7f,
+    0xdc, 0xce, 0xe4, 0xff, 0x13, 0x47, 0x56, 0x1e, 0xd8, 0x08, 0x6f, 0xe4,
+    0x10, 0x4b, 0x34, 0x75, 0xff, 0xb3, 0xd1, 0xbf, 0xef, 0xde, 0xa1, 0xd6,
+    0x59, 0xd7, 0xf2, 0x08, 0x25, 0x9a, 0xf8, 0x79, 0xdb, 0x0f, 0xa9, 0x44,
+    0x60, 0x79, 0xe6, 0xcc, 0x2b, 0x6d, 0xa0, 0xb2, 0xa8, 0x8a, 0x1d, 0xe7,
+    0x21, 0x91, 0xf0, 0x61, 0x5b, 0x92, 0x8e, 0x14, 0x85, 0xd3, 0x61, 0x98,
+    0x90, 0xdb, 0x98, 0x95, 0x71, 0xb3, 0x76, 0x57, 0x13, 0xc3, 0x67, 0xf8,
+    0x73, 0x8c, 0x64, 0x3a, 0x94, 0x37, 0xe9, 0x52, 0xbb, 0x70, 0xd5, 0xfb,
+    0x0e, 0x1b, 0xfb, 0x69, 0x02, 0x31, 0x31, 0xd7, 0xa1, 0xc4, 0xeb, 0xec,
+    0xeb, 0xf8, 0xeb, 0x2a, 0x30, 0xfa, 0x3a, 0x5e, 0x23, 0x37, 0xff, 0xff,
+    0xba, 0xe3, 0xed, 0x42, 0x4b, 0x36, 0x87, 0xd1, 0xd8, 0x50, 0x11, 0xb4,
+    0x75, 0xf6, 0x6b, 0xf4, 0x3a, 0xfd, 0xc6, 0xbb, 0xb4, 0xd1, 0x6b, 0x5f,
+    0xe5, 0xa2, 0xde, 0x6c, 0xe9, 0xd7, 0xf6, 0x6d, 0x69, 0xc5, 0xa7, 0x5e,
+    0xe4, 0x2c, 0xeb, 0xfb, 0xb9, 0xa8, 0x9f, 0x68, 0xeb, 0xfe, 0x93, 0x19,
+    0xc6, 0xbb, 0xb4, 0xd1, 0x41, 0xd6, 0x1f, 0xab, 0x98, 0x5f, 0x64, 0xd1,
+    0xe3, 0xaf, 0xfa, 0x25, 0x1c, 0x9e, 0x39, 0x39, 0xd7, 0xff, 0xef, 0x69,
+    0x27, 0x7d, 0x38, 0xbf, 0xbb, 0x13, 0x1d, 0x66, 0x15, 0x4a, 0xb0, 0xe0,
+    0xde, 0x4f, 0x58, 0x42, 0x86, 0x73, 0x19, 0x70, 0xb9, 0x70, 0x90, 0xe9,
+    0x00, 0x90, 0xfd, 0x39, 0xbf, 0xfc, 0xc2, 0xde, 0x4c, 0x67, 0x1a, 0xee,
+    0xd3, 0x45, 0x17, 0x7f, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x8b, 0xaa, 0xa1,
+    0xbf, 0xf2, 0x93, 0xe3, 0x5f, 0x52, 0x38, 0x65, 0xca, 0xf0, 0xed, 0x69,
+    0x47, 0xfc, 0xe5, 0x0e, 0xa1, 0x53, 0xe5, 0x7b, 0xf7, 0x1a, 0xee, 0xd3,
+    0x44, 0x43, 0x7b, 0xb8, 0x13, 0xaf, 0xb3, 0x62, 0x70, 0xeb, 0x31, 0x87,
+    0xe1, 0xb9, 0x9a, 0xb8, 0xdd, 0xb6, 0xce, 0xbe, 0x8e, 0xc2, 0xce, 0xbe,
+    0x6b, 0xbb, 0x4d, 0x11, 0xb5, 0x34, 0xf3, 0x78, 0x41, 0x66, 0x02, 0x88,
+    0x2c, 0x60, 0xbf, 0xcc, 0x67, 0x1a, 0xee, 0xd3, 0x45, 0x37, 0x7e, 0xe3,
+    0x5d, 0xda, 0x68, 0xa8, 0x2f, 0x66, 0xec, 0x9d, 0x66, 0x30, 0xf4, 0x3a,
+    0x67, 0x7f, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x8a, 0x9a, 0xfd, 0xc6, 0xbb,
+    0xb4, 0xd1, 0x58, 0x5f, 0x91, 0x90, 0x83, 0x87, 0x5c, 0xbd, 0x1d, 0x7f,
+    0x26, 0xdb, 0xc2, 0x6d, 0x9d, 0x7f, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x88,
+    0xfe, 0xa0, 0xfb, 0xe4, 0x61, 0x7b, 0x22, 0x73, 0xaf, 0xf6, 0x6f, 0x27,
+    0x92, 0x09, 0xd7, 0x3f, 0x8e, 0xb3, 0x18, 0x9b, 0x13, 0x4c, 0xd6, 0x50,
+    0xf0, 0x85, 0x12, 0x1f, 0x0d, 0xed, 0x98, 0xdf, 0xfe, 0x61, 0x6f, 0x26,
+    0x33, 0x8d, 0x77, 0x69, 0xa2, 0x6f, 0xbf, 0xf9, 0x6f, 0x26, 0x33, 0x8d,
+    0x77, 0x69, 0xa2, 0x7e, 0xbf, 0x9f, 0xb9, 0xe8, 0x09, 0xd7, 0x0b, 0x4e,
+    0xbe, 0xd4, 0xcb, 0xd1, 0xd7, 0xf9, 0xbd, 0x4f, 0x66, 0x2c, 0xeb, 0xb6,
+    0x34, 0xf1, 0x81, 0x54, 0x22, 0x39, 0x05, 0x74, 0x47, 0xe3, 0x1b, 0xfc,
+    0xab, 0x95, 0x81, 0xc9, 0xe3, 0x73, 0xaf, 0xca, 0xca, 0xa3, 0x6f, 0x37,
+    0x3a, 0xfe, 0x56, 0x1e, 0x7e, 0xa2, 0xb9, 0xd7, 0xe5, 0x6d, 0x45, 0x31,
+    0x5c, 0xeb, 0xb6, 0x34, 0xf1, 0x80, 0xdb, 0xa7, 0x52, 0xb2, 0x98, 0x6a,
+    0xb0, 0x7c, 0xa8, 0x34, 0x55, 0xc6, 0xbe, 0x31, 0x01, 0x2d, 0xf2, 0xb7,
+    0xc7, 0xc3, 0xaf, 0x95, 0x53, 0xaf, 0x47, 0x5f, 0xff, 0xca, 0xd8, 0xbf,
+    0xa0, 0x5a, 0x8b, 0x08, 0x1f, 0x92, 0x3a, 0xff, 0x9f, 0xa9, 0xb1, 0x86,
+    0x59, 0x64, 0xab, 0xfd, 0xd7, 0xf7, 0x9d, 0xd9, 0x3a, 0x95, 0x48, 0xf4,
+    0x55, 0xe4, 0xea, 0xd5, 0x75, 0x57, 0x1f, 0x5f, 0xff, 0xe5, 0x65, 0x51,
+    0xae, 0x42, 0x7b, 0xb8, 0x14, 0xd6, 0x0f, 0xe7, 0x5f, 0xca, 0xf1, 0xc7,
+    0x79, 0x1d, 0x7e, 0xea, 0x3f, 0xea, 0xb8, 0xea, 0x56, 0x11, 0x86, 0xab,
+    0x34, 0x78, 0xba, 0xce, 0x75, 0xf9, 0x54, 0xad, 0x3f, 0x52, 0x0e, 0xbf,
+    0xfe, 0x88, 0x88, 0x88, 0x88, 0x88, 0xdf, 0x47, 0x5e, 0x4d, 0xf0, 0xeb,
+    0xf7, 0x12, 0x77, 0x59, 0x57, 0x32, 0xc9, 0x55, 0x86, 0xfd, 0x92, 0x7b,
+    0x00, 0xa6, 0x0d, 0x0d, 0x42, 0x39, 0x7f, 0x49, 0xd3, 0xdd, 0xf9, 0xdc,
+    0x63, 0x68, 0xeb, 0xff, 0xc8, 0x38, 0xb8, 0xd6, 0xb2, 0x5b, 0x78, 0x75,
+    0xff, 0xee, 0xc4, 0x9f, 0x02, 0x9b, 0x35, 0xfb, 0x4e, 0xbf, 0xdc, 0x00,
+    0x83, 0xc0, 0xf1, 0xd7, 0xbb, 0x02, 0x75, 0xa1, 0x0f, 0x37, 0xc6, 0x75,
+    0x08, 0xbe, 0xec, 0x26, 0x2f, 0x0a, 0x41, 0xd7, 0xe8, 0xfa, 0xbe, 0xa1,
+    0xd5, 0xc3, 0xc1, 0x11, 0x9b, 0xfa, 0x5a, 0xf6, 0x0a, 0x87, 0x5e, 0x65,
+    0xd9, 0x3a, 0xff, 0xf7, 0xb8, 0xf3, 0x87, 0xb1, 0xaf, 0x03, 0xa7, 0x5d,
+    0x8b, 0xe9, 0xf4, 0x68, 0x76, 0xfc, 0xed, 0xea, 0x70, 0xeb, 0xff, 0xff,
+    0xc2, 0xea, 0x27, 0x22, 0x5f, 0x3a, 0x8b, 0x0c, 0x7c, 0xdb, 0x07, 0x53,
+    0x87, 0x5f, 0x3c, 0x93, 0x73, 0xaf, 0xfd, 0xd4, 0xf6, 0x73, 0x80, 0x9f,
+    0x61, 0xd7, 0xfc, 0x9e, 0xce, 0x70, 0x13, 0xec, 0x3a, 0xf6, 0x80, 0x3f,
+    0x0f, 0xf3, 0xa8, 0x34, 0x14, 0xe8, 0xb8, 0x5b, 0xd2, 0x61, 0x7d, 0xd4,
+    0x27, 0x6d, 0x07, 0x5f, 0xff, 0x46, 0xf2, 0x71, 0xff, 0xe7, 0xe9, 0xc4,
+    0x50, 0xea, 0xdb, 0x3e, 0x2d, 0xa0, 0xfb, 0xe9, 0xd6, 0x92, 0x3a, 0xfa,
+    0x3f, 0xfa, 0xb3, 0xaf, 0x84, 0x0f, 0x23, 0xa9, 0xa7, 0x89, 0xa2, 0x4b,
+    0xfd, 0xd8, 0x5b, 0x1f, 0xff, 0x07, 0x54, 0x22, 0xf7, 0x19, 0x90, 0x8a,
+    0xfe, 0x99, 0x3b, 0xec, 0x69, 0xd5, 0xc3, 0xda, 0x72, 0xdb, 0xfe, 0xdc,
+    0x3f, 0x61, 0x5f, 0xa0, 0xd1, 0xd7, 0xff, 0xe0, 0xf6, 0x38, 0x9f, 0xc7,
+    0xd8, 0x98, 0x61, 0x67, 0x5f, 0xe5, 0x20, 0x7d, 0xa7, 0xe9, 0xd4, 0x88,
+    0x88, 0x75, 0x6a, 0x84, 0x74, 0x0c, 0x31, 0xef, 0xf7, 0x62, 0x7e, 0x46,
+    0x04, 0xeb, 0xff, 0xe1, 0xcd, 0x8d, 0x7e, 0x4e, 0xfe, 0x7d, 0xff, 0x3a,
+    0xa1, 0x10, 0x8e, 0x65, 0x7f, 0x85, 0xe7, 0xde, 0x51, 0xb4, 0x75, 0xfe,
+    0xd7, 0x5f, 0xef, 0x62, 0x47, 0x54, 0xe7, 0xd5, 0xb9, 0xb5, 0xec, 0xc9,
+    0x8e, 0xbf, 0xe8, 0x90, 0xbf, 0xa4, 0x9b, 0x0e, 0xbd, 0xf6, 0x3f, 0x3a,
+    0xba, 0x7a, 0xda, 0x38, 0xb2, 0xb9, 0xd7, 0xbd, 0x2c, 0x3a, 0xed, 0x61,
+    0xd7, 0xff, 0x6a, 0x38, 0xdf, 0x0e, 0x4e, 0xe2, 0x75, 0x62, 0x29, 0xd0,
+    0x89, 0xc4, 0xff, 0x1b, 0xf0, 0xad, 0xfc, 0x09, 0x81, 0xe8, 0xe9, 0xd7,
+    0xff, 0x06, 0x3c, 0xfa, 0xce, 0xf5, 0x16, 0x75, 0xfe, 0x9c, 0x30, 0xfc,
+    0xfc, 0x07, 0x5e, 0xf2, 0x4c, 0x75, 0x42, 0x24, 0xb1, 0x0b, 0x46, 0x97,
+    0xe8, 0x57, 0x46, 0x5a, 0x75, 0x43, 0x2b, 0xa2, 0x73, 0x09, 0x13, 0x86,
+    0x30, 0x7c, 0x68, 0xdc, 0x85, 0x25, 0x1b, 0xcd, 0x0b, 0x1e, 0x46, 0x7e,
+    0xb8, 0xc2, 0x7b, 0x0a, 0xa7, 0x84, 0x5f, 0xe4, 0x83, 0x18, 0xc6, 0x92,
+    0x3d, 0x0c, 0x0f, 0xa5, 0xd7, 0xff, 0xfc, 0xab, 0xd5, 0x51, 0x8a, 0xd7,
+    0x8a, 0xa5, 0x5b, 0x62, 0xba, 0xae, 0x07, 0xcf, 0x9d, 0xdb, 0x3a, 0xf4,
+    0xdf, 0x56, 0x75, 0xff, 0x67, 0xb5, 0x9e, 0xee, 0x7e, 0x75, 0x39, 0xeb,
+    0x88, 0xfd, 0xce, 0x27, 0x57, 0x0d, 0xa2, 0xc8, 0x2f, 0xa3, 0xd8, 0xb3,
+    0xaf, 0xde, 0x81, 0x4f, 0xce, 0xbf, 0xb1, 0x97, 0xfd, 0x78, 0x75, 0x7c,
+    0x3f, 0x3c, 0x20, 0x12, 0x6b, 0xf7, 0x27, 0x8f, 0x68, 0xeb, 0xe7, 0xe3,
+    0xc8, 0xeb, 0x73, 0x0f, 0x20, 0x4a, 0x2f, 0x32, 0xcb, 0x27, 0x5f, 0x4e,
+    0x29, 0x05, 0x30, 0x5f, 0xdf, 0xf2, 0xbf, 0x5c, 0x64, 0x18, 0x9c, 0xeb,
+    0xb7, 0x91, 0xd7, 0xf9, 0x48, 0xf6, 0xba, 0xe0, 0x3a, 0xfc, 0x93, 0xe6,
+    0xfe, 0x3a, 0xe4, 0x69, 0xd5, 0x08, 0x87, 0x50, 0x5d, 0x66, 0x7e, 0x28,
+    0xbf, 0x28, 0xfa, 0xd9, 0x23, 0xab, 0x73, 0xe7, 0xf1, 0xed, 0x2a, 0xca,
+    0xfa, 0xa2, 0x31, 0xe0, 0xc2, 0x51, 0x1d, 0xfa, 0x8a, 0xe6, 0x00, 0x8c,
+    0xa6, 0xff, 0xed, 0x8c, 0xe6, 0x85, 0x23, 0x99, 0x39, 0xd7, 0xff, 0xff,
+    0xfe, 0x57, 0xf9, 0xdc, 0xde, 0x5d, 0x5f, 0xc6, 0xf4, 0x1e, 0xf6, 0x0f,
+    0x73, 0xd0, 0x1f, 0x9f, 0x3b, 0xb6, 0x75, 0xff, 0x07, 0x00, 0xa9, 0x4e,
+    0xba, 0xce, 0xbf, 0x42, 0xc7, 0x26, 0x3b, 0x0d, 0xdd, 0xed, 0x98, 0x13,
+    0xaf, 0xf2, 0x9d, 0x48, 0x10, 0x41, 0xd5, 0xd3, 0xce, 0x71, 0xda, 0x0a,
+    0x29, 0x35, 0x08, 0x3b, 0xfa, 0x25, 0xd8, 0xd8, 0x87, 0x5f, 0x9f, 0x80,
+    0x7d, 0x1d, 0x74, 0xbc, 0x75, 0xf4, 0xd1, 0xe7, 0x3a, 0xf8, 0x1f, 0xe0,
+    0xb4, 0xdb, 0x80, 0x5a, 0xd2, 0x3a, 0xa7, 0x3c, 0x8e, 0x9c, 0x5f, 0xfd,
+    0x1d, 0xfa, 0x1f, 0x26, 0x4d, 0x0b, 0x3a, 0xfa, 0x3c, 0x05, 0x9d, 0x46,
+    0x88, 0x3a, 0xfe, 0x79, 0xff, 0x71, 0x09, 0x2b, 0x06, 0xdb, 0x4d, 0x3d,
+    0x2d, 0xb1, 0x7a, 0x5a, 0x27, 0xbc, 0xe7, 0x7f, 0xfe, 0x5e, 0x9e, 0x5d,
+    0x4c, 0xf6, 0xb9, 0x81, 0xc3, 0xaf, 0xfa, 0x3c, 0x39, 0xb0, 0x73, 0x47,
+    0x54, 0x22, 0xb7, 0x08, 0xf4, 0xa7, 0x7f, 0x3f, 0x61, 0x5c, 0x12, 0x3a,
+    0xa4, 0xab, 0x89, 0xa5, 0xbc, 0x85, 0x2a, 0xc8, 0xfd, 0x1c, 0x86, 0xc2,
+    0xeb, 0xfa, 0x43, 0x9b, 0xfb, 0x0e, 0xbf, 0xff, 0x7d, 0xff, 0xf8, 0xdf,
+    0x27, 0x0b, 0xbb, 0x5c, 0x27, 0x54, 0x22, 0x17, 0x85, 0x97, 0xf9, 0xc7,
+    0xd2, 0xce, 0x61, 0xd7, 0xf0, 0xa7, 0xfa, 0xea, 0x1d, 0x77, 0x02, 0x75,
+    0xcc, 0xb2, 0x75, 0x48, 0xd7, 0x32, 0x2d, 0x7a, 0x13, 0x61, 0x4c, 0x1a,
+    0x2a, 0x74, 0x54, 0xe9, 0xf2, 0xef, 0xf4, 0x75, 0xfc, 0x9d, 0x45, 0x14,
+    0x83, 0xae, 0xd7, 0xd0, 0x9e, 0x27, 0x85, 0xe9, 0x11, 0x2d, 0xf5, 0x9a,
+    0xf3, 0x2c, 0xb2, 0x55, 0x14, 0xc1, 0x7f, 0x7c, 0x8c, 0xa4, 0xc5, 0x53,
+    0x4d, 0xe2, 0x0d, 0x5f, 0xb3, 0x91, 0xb3, 0x0e, 0xa8, 0x64, 0x0d, 0x4e,
+    0x8b, 0x91, 0xc4, 0xa4, 0xb0, 0xae, 0x43, 0xad, 0x64, 0x5d, 0x8d, 0xbc,
+    0x5f, 0xf4, 0x41, 0x7d, 0xc9, 0x03, 0x0e, 0xbf, 0xc3, 0xbf, 0xbe, 0xf5,
+    0xff, 0x3a, 0xf0, 0xa6, 0x8e, 0xbe, 0x0b, 0x8f, 0xe7, 0x5f, 0xfd, 0x03,
+    0xf8, 0xc6, 0xf3, 0x40, 0xfe, 0x75, 0x62, 0x2d, 0x50, 0xdb, 0xf1, 0xad,
+    0x10, 0xd9, 0x0e, 0xbf, 0xe7, 0x51, 0xbd, 0x40, 0xbc, 0x8e, 0xbe, 0x9e,
+    0x77, 0xdc, 0xeb, 0xbf, 0xd2, 0x1f, 0x58, 0x87, 0xfd, 0x38, 0xbf, 0x46,
+    0x73, 0xa8, 0x75, 0xff, 0xe6, 0x7f, 0xee, 0x64, 0xe9, 0x9b, 0x23, 0x73,
+    0xaf, 0xff, 0x7f, 0x0b, 0xe7, 0x22, 0x7f, 0x3b, 0xa8, 0x75, 0xfe, 0x96,
+    0x77, 0x17, 0x0d, 0x3a, 0xf6, 0x2d, 0x5c, 0xeb, 0xfd, 0x9a, 0x1c, 0xf7,
+    0x50, 0xea, 0x09, 0xe7, 0x08, 0xf5, 0x62, 0x73, 0x33, 0x1e, 0x74, 0x97,
+    0xf4, 0xdf, 0x25, 0xec, 0x7f, 0xbf, 0xbd, 0x93, 0x0c, 0x2c, 0xf1, 0x01,
+    0x5f, 0x9c, 0x43, 0xd8, 0x34, 0x40, 0x4c, 0x1b, 0x9b, 0xff, 0x93, 0x7d,
+    0x07, 0x06, 0x04, 0x10, 0x75, 0xff, 0xc0, 0x6a, 0x9c, 0xcd, 0xf5, 0xfb,
+    0xf8, 0xeb, 0xf4, 0x49, 0xf7, 0x64, 0xea, 0xc4, 0x58, 0x22, 0x0f, 0x11,
+    0xed, 0x39, 0xd7, 0xef, 0x99, 0x32, 0x2c, 0xeb, 0xff, 0xc0, 0x8f, 0x9b,
+    0x5e, 0x4d, 0x77, 0x77, 0x64, 0xea, 0x9c, 0xfe, 0x74, 0x53, 0x7f, 0xec,
+    0x0f, 0x5d, 0x88, 0xec, 0x6e, 0x75, 0x2a, 0x11, 0xd7, 0xc8, 0x45, 0x2c,
+    0x8e, 0xff, 0xc8, 0x2a, 0x70, 0x51, 0xa0, 0x13, 0xaf, 0xff, 0xcf, 0xbe,
+    0xfa, 0x81, 0xf7, 0xd9, 0xba, 0x9e, 0xd1, 0xd5, 0x08, 0xce, 0xc3, 0x90,
+    0x1e, 0x5f, 0x2e, 0x31, 0x67, 0x5f, 0xfb, 0x17, 0x0d, 0x4f, 0x70, 0x0b,
+    0x3a, 0xf2, 0x6f, 0xa3, 0xad, 0x12, 0x3d, 0x9f, 0xcf, 0x6f, 0xf7, 0x26,
+    0xd2, 0x0f, 0x90, 0xeb, 0xfd, 0xd4, 0xdf, 0xfe, 0x38, 0x4e, 0xbe, 0xdf,
+    0xfe, 0x41, 0x57, 0x32, 0xc9, 0x55, 0x06, 0xed, 0x92, 0x3b, 0x85, 0x0a,
+    0x60, 0xd0, 0xde, 0x7e, 0x4b, 0xe2, 0x2d, 0x65, 0x09, 0x0a, 0x56, 0xd9,
+    0x0e, 0xb1, 0x0d, 0x6c, 0x94, 0x80, 0x90, 0x94, 0xe4, 0x3c, 0xfb, 0x1f,
+    0x3b, 0x97, 0x0b, 0xcf, 0x8a, 0x01, 0x0e, 0x7b, 0xd3, 0xba, 0xce, 0xbd,
+    0xe4, 0x64, 0xf1, 0x84, 0x5f, 0x78, 0x0f, 0xf4, 0xd1, 0x03, 0xee, 0x6a,
+    0x69, 0xd1, 0x0c, 0x04, 0x5b, 0xca, 0xe9, 0xf9, 0xd7, 0x40, 0x0e, 0xbf,
+    0x00, 0x7f, 0xfb, 0x23, 0xaf, 0xff, 0x87, 0x35, 0xf3, 0xef, 0x63, 0xf5,
+    0xbc, 0xbe, 0x61, 0xbf, 0xd0, 0xad, 0x01, 0x19, 0x3b, 0x17, 0xaf, 0xfd,
+    0xd0, 0x4f, 0x1f, 0x23, 0xd0, 0x13, 0xaf, 0x3f, 0x27, 0x3a, 0xe6, 0x59,
+    0x3a, 0xff, 0x71, 0x33, 0x67, 0xd9, 0x30, 0xd3, 0x68, 0xc8, 0xe5, 0xff,
+    0x91, 0x4f, 0x9a, 0x07, 0xeb, 0x89, 0x1d, 0x7f, 0xb5, 0x9e, 0x75, 0xe0,
+    0x9d, 0x41, 0x4c, 0xd7, 0x8e, 0x9d, 0x4f, 0xf2, 0x15, 0xff, 0xc3, 0x8a,
+    0x75, 0xe5, 0xf5, 0xf7, 0x83, 0xaa, 0x11, 0x07, 0x87, 0xd7, 0xff, 0x2d,
+    0x6f, 0x2c, 0xe3, 0x5d, 0xda, 0x68, 0x86, 0x2f, 0xff, 0xff, 0x3e, 0xb0,
+    0x71, 0xbd, 0x8d, 0xe5, 0xb7, 0x9d, 0x6a, 0x60, 0xba, 0x87, 0x56, 0x23,
+    0x18, 0x09, 0xf4, 0x8a, 0xb9, 0xbb, 0x1e, 0xe8, 0xc3, 0x9e, 0xff, 0x2f,
+    0xaf, 0x38, 0xc4, 0x8a, 0xbb, 0x40, 0x3a, 0xfe, 0x97, 0x5d, 0xc6, 0x0e,
+    0xb4, 0x34, 0xf0, 0x37, 0x16, 0xbf, 0x71, 0xae, 0xed, 0x34, 0x41, 0x57,
+    0xbb, 0x0b, 0x3a, 0xff, 0xd1, 0x3b, 0xfb, 0x99, 0x2d, 0xbc, 0x3a, 0xb1,
+    0x11, 0xc8, 0x66, 0x23, 0x77, 0xee, 0xc2, 0xc1, 0xb9, 0xd7, 0xde, 0xd4,
+    0x7e, 0x55, 0xe7, 0xe4, 0xe5, 0x5f, 0x00, 0x5d, 0x42, 0xaf, 0xf2, 0x4f,
+    0x9e, 0xd4, 0x7e, 0x55, 0x15, 0x7f, 0x63, 0x63, 0xb0, 0xb2, 0xae, 0x65,
+    0x92, 0xaf, 0xe1, 0x81, 0x9d, 0x38, 0x55, 0x62, 0x61, 0x4d, 0x22, 0x58,
+    0xe7, 0x48, 0x7f, 0x33, 0x10, 0xa6, 0x4a, 0xfe, 0x8c, 0x5c, 0x9c, 0x29,
+    0x83, 0xf4, 0xa9, 0x27, 0xf5, 0x31, 0x6f, 0x63, 0xa6, 0xa8, 0x56, 0xb5,
+    0xd7, 0x27, 0x95, 0x61, 0x7f, 0x60, 0xe9, 0x07, 0x0e, 0xbd, 0xd0, 0x2c,
+    0xea, 0xe9, 0xe2, 0xed, 0x14, 0xdf, 0xe7, 0x1c, 0xd7, 0x23, 0x47, 0x5f,
+    0xc1, 0xc1, 0x7f, 0x68, 0xeb, 0x44, 0x8f, 0x6f, 0x46, 0x17, 0xee, 0x6f,
+    0x2c, 0xf1, 0xd7, 0xff, 0xfd, 0xd4, 0xe6, 0x05, 0xd7, 0x83, 0xe1, 0x86,
+    0x73, 0xda, 0x3a, 0xd0, 0x75, 0xfb, 0xb1, 0xb0, 0x30, 0xd3, 0xf2, 0xfd,
+    0x8e, 0xb8, 0x8d, 0xbf, 0x42, 0x6a, 0xff, 0x6f, 0x2d, 0xb8, 0x6e, 0x2c,
+    0xeb, 0xff, 0xff, 0x73, 0x91, 0xbc, 0xb7, 0xd2, 0x71, 0xbd, 0xcf, 0xbc,
+    0x48, 0x09, 0xd5, 0x08, 0xa5, 0xc3, 0x6b, 0xff, 0xf3, 0x54, 0x7d, 0x67,
+    0x24, 0x9d, 0x71, 0xde, 0x47, 0x5f, 0xf9, 0xb1, 0xed, 0x67, 0x93, 0x76,
+    0x4e, 0xb3, 0xe2, 0x25, 0x14, 0x55, 0xa8, 0x4e, 0xab, 0xb0, 0xcd, 0x18,
+    0x5a, 0xde, 0xf3, 0xfe, 0x75, 0xff, 0xf9, 0xde, 0x4f, 0xdf, 0x99, 0x38,
+    0x3c, 0x07, 0xfa, 0x68, 0xbe, 0xef, 0x7f, 0x01, 0x3a, 0xff, 0xda, 0x41,
+    0xde, 0x5c, 0x04, 0x68, 0xea, 0x99, 0x17, 0xfc, 0x65, 0xf0, 0xe5, 0xfe,
+    0x89, 0xfb, 0x93, 0x42, 0xb9, 0xd6, 0x69, 0xd7, 0xff, 0xfb, 0xf4, 0xe2,
+    0x9d, 0x85, 0xcd, 0x24, 0x1e, 0xc7, 0x20, 0xeb, 0x7b, 0x0f, 0xc7, 0x42,
+    0x17, 0xde, 0x1c, 0x91, 0xd5, 0x07, 0x8e, 0x84, 0xf7, 0xfe, 0x14, 0x97,
+    0xbb, 0x9c, 0x4d, 0x1d, 0x7f, 0x44, 0x87, 0x32, 0x73, 0xaf, 0xf3, 0x86,
+    0x3f, 0x86, 0x74, 0x75, 0x74, 0xf7, 0x9c, 0xae, 0xfe, 0xdb, 0x56, 0xbf,
+    0x3e, 0x77, 0x6c, 0xf1, 0x00, 0xdf, 0xef, 0x7f, 0xf4, 0x65, 0xdc, 0x3c,
+    0x40, 0x37, 0x9f, 0x92, 0x3c, 0x40, 0x35, 0x87, 0xd4, 0x04, 0x2b, 0x9e,
+    0x47, 0x88, 0x06, 0xf9, 0xc7, 0x79, 0x1e, 0x20, 0x1b, 0xfc, 0x8d, 0xee,
+    0x7f, 0xfc, 0x1e, 0x20, 0x1b, 0xc8, 0x21, 0x3c, 0x40, 0x34, 0x14, 0x5b,
+    0xac, 0x8b, 0xa5, 0xdb, 0x10, 0x2c, 0xa1, 0xe2, 0x01, 0xbd, 0xc8, 0xf1,
+    0xe2, 0x01, 0xa3, 0xc4, 0x03, 0x7b, 0x6d, 0x3f, 0x3c, 0x40, 0x37, 0x42,
+    0xcf, 0x10, 0x0d, 0x04, 0xf9, 0x70, 0x5d, 0x0b, 0x2f, 0x91, 0x61, 0x83,
+    0xc4, 0x03, 0x7b, 0xce, 0xd3, 0xc4, 0x03, 0x7f, 0xe1, 0x79, 0x31, 0xd4,
+    0x6b, 0xf0, 0xf1, 0x00, 0xdf, 0xfc, 0xfe, 0x04, 0xe8, 0x3e, 0xeb, 0xc8,
+    0xf1, 0x00, 0xdc, 0xe1, 0x3c, 0x40, 0x37, 0xf8, 0x5d, 0x9d, 0x6a, 0x3f,
+    0x3c, 0x40, 0x37, 0xe4, 0x51, 0xc7, 0xf3, 0xc4, 0x03, 0x72, 0x68, 0xf1,
+    0x00, 0xd7, 0x0f, 0x5b, 0xc6, 0x97, 0xff, 0xba, 0x9e, 0xf6, 0x6b, 0xe7,
+    0x12, 0x16, 0x78, 0x80, 0x6f, 0xde, 0x18, 0xde, 0x46, 0x88, 0x06, 0xef,
+    0xe0, 0xf1, 0x00, 0xb0, 0x6d, 0x2f, 0xc9, 0x0b, 0x70, 0x9e, 0x20, 0x1b,
+    0xe0, 0x38, 0xb4, 0xf1, 0x00, 0xde, 0x8e, 0x34, 0xf1, 0x00, 0xdf, 0xfb,
+    0x37, 0xd0, 0x63, 0x07, 0xfd, 0x1e, 0x20, 0x1b, 0xf0, 0x1e, 0x52, 0x83,
+    0xc4, 0x03, 0x7e, 0x76, 0xf6, 0x37, 0x3c, 0x40, 0x35, 0x88, 0xb2, 0xea,
+    0x58, 0x0c, 0xee, 0xe7, 0xe7, 0x88, 0x06, 0xa4, 0xac, 0x94, 0x24, 0x59,
+    0x09, 0x66, 0x91, 0x24, 0x22, 0xfa, 0x69, 0xf9, 0x96, 0x8b, 0x7d, 0x0d,
+    0xa0, 0x17, 0xdf, 0xb3, 0xda, 0x7d, 0xcf, 0x10, 0x0d, 0xfe, 0x0c, 0x36,
+    0x6e, 0x47, 0x8f, 0x10, 0x08, 0x4d, 0xa5, 0xee, 0x43, 0x27, 0x88, 0x06,
+    0x9a, 0x7f, 0x3c, 0x50, 0xbf, 0xc0, 0x79, 0x4a, 0x3e, 0xac, 0xf1, 0x00,
+    0xdf, 0x20, 0xcb, 0x47, 0x88, 0x06, 0xfe, 0x79, 0xa5, 0x9b, 0xc8, 0xf1,
+    0x00, 0xd6, 0x23, 0x2f, 0xa4, 0x5f, 0xa0, 0x80, 0xb6, 0xff, 0xbb, 0x1a,
+    0x63, 0x40, 0xe7, 0xe7, 0x88, 0x06, 0xc8, 0x78, 0x80, 0x6e, 0x79, 0xc2,
+    0x7c, 0x9d, 0x48, 0xbb, 0x9f, 0x9e, 0x20, 0x1b, 0xf3, 0xfb, 0x49, 0xb9,
+    0xe2, 0x01, 0xbf, 0x90, 0x41, 0x2c, 0xd1, 0xe2, 0x01, 0xa8, 0x44, 0x80,
+    0x92, 0x78, 0xd2, 0xa1, 0x94, 0xb0, 0x18, 0x5a, 0xe4, 0x36, 0x10, 0xfe,
+    0x61, 0xee, 0x42, 0x37, 0xa5, 0xae, 0x5b, 0xf9, 0x40, 0xa5, 0x6a, 0x5b,
+    0xaf, 0xa5, 0x09, 0xed, 0xc2, 0x87, 0xec, 0x2f, 0xaf, 0x79, 0x19, 0x3c,
+    0x61, 0x37, 0x9d, 0xda, 0x68, 0x80, 0x58, 0x4c, 0x57, 0x78, 0x76, 0x5f,
+    0x28, 0xad, 0x02, 0xb3, 0xae, 0xd9, 0x39, 0xd7, 0xed, 0x83, 0x01, 0xe9,
+    0xd5, 0x07, 0x82, 0x83, 0x37, 0xff, 0x48, 0x71, 0xbd, 0x4f, 0xff, 0x04,
+    0xc7, 0x5d, 0xfc, 0x15, 0x65, 0x0a, 0xbd, 0xd8, 0x9c, 0xeb, 0x99, 0x64,
+    0xaa, 0x43, 0xdb, 0x57, 0x16, 0x98, 0x45, 0x91, 0xcb, 0xcb, 0x4d, 0x14,
+    0xc1, 0xe0, 0x5e, 0x40, 0x78, 0xeb, 0xff, 0xde, 0xd6, 0x28, 0x9c, 0xfb,
+    0xff, 0xf1, 0xb9, 0xd5, 0x3b, 0x3a, 0x62, 0x44, 0x01, 0x84, 0xd3, 0x69,
+    0x71, 0xc8, 0x9d, 0xc6, 0xa7, 0x20, 0xfe, 0x1c, 0x3e, 0x2d, 0xfa, 0x37,
+    0x7f, 0xf8, 0x7d, 0xb7, 0x93, 0x49, 0xf9, 0x38, 0x60, 0xeb, 0xfb, 0xdf,
+    0x76, 0x6c, 0x8d, 0x1d, 0x7f, 0xb3, 0x7f, 0x79, 0xe5, 0xa3, 0xaf, 0x0e,
+    0xf2, 0x3c, 0x60, 0x15, 0x88, 0xdc, 0x44, 0xde, 0x19, 0xb9, 0x9d, 0xfa,
+    0x69, 0x47, 0x27, 0x3a, 0xfa, 0x14, 0x85, 0x9d, 0x5c, 0x3c, 0xa5, 0x94,
+    0xdf, 0xfa, 0x5a, 0xf8, 0x38, 0xb8, 0xe2, 0x87, 0x5f, 0xd2, 0x8e, 0x7f,
+    0xf5, 0x67, 0x5f, 0xfd, 0xb0, 0x73, 0x5e, 0xc1, 0x96, 0x68, 0xeb, 0xe5,
+    0xc0, 0x3c, 0x75, 0x61, 0xf2, 0x3a, 0x1d, 0xdd, 0x7c, 0x45, 0xa0, 0xc2,
+    0x52, 0xff, 0xa1, 0xb0, 0xb4, 0x5f, 0xe8, 0x75, 0x70, 0xfa, 0x36, 0x8c,
+    0x6f, 0xef, 0xac, 0xf1, 0x33, 0xa5, 0x5f, 0xfd, 0xf8, 0xa6, 0x6f, 0xe9,
+    0xa4, 0xfc, 0x3a, 0xfa, 0x6e, 0xbc, 0xc7, 0x5f, 0x35, 0xf9, 0x39, 0xd7,
+    0xec, 0x9a, 0x51, 0xb9, 0xd7, 0xba, 0x93, 0x1d, 0x78, 0x62, 0x45, 0x5f,
+    0xf8, 0x7f, 0x4d, 0xad, 0xa0, 0x4a, 0x15, 0xce, 0xac, 0x3e, 0x17, 0x1a,
+    0xad, 0xd3, 0x4f, 0xe2, 0x2f, 0x48, 0xc4, 0x8b, 0xc5, 0x1b, 0x4f, 0xb5,
+    0x0a, 0xdf, 0x30, 0x89, 0x23, 0x5c, 0xe9, 0x2b, 0xc6, 0xfd, 0x7f, 0x6f,
+    0xae, 0x72, 0x3c, 0x75, 0xfd, 0x2d, 0x29, 0xc7, 0x69, 0xd7, 0x87, 0xda,
+    0x3a, 0xfd, 0xa0, 0x08, 0x1a, 0x75, 0x41, 0xf8, 0x21, 0x70, 0x06, 0xef,
+    0xfe, 0xeb, 0x31, 0xcd, 0x63, 0x2f, 0xc5, 0x0e, 0xbf, 0x60, 0x43, 0x8b,
+    0x3a, 0xff, 0xf7, 0xb7, 0x6a, 0x77, 0x6e, 0x3d, 0xdf, 0xba, 0x3a, 0xe5,
+    0x4e, 0x8e, 0xbe, 0x14, 0xde, 0x47, 0x5f, 0xf2, 0x6f, 0xdc, 0x0f, 0x1d,
+    0xa7, 0x54, 0x1e, 0xcf, 0x08, 0x6f, 0xfb, 0xb1, 0xc8, 0x6a, 0x0b, 0x4e,
+    0xbe, 0xf2, 0x8f, 0xae, 0x1e, 0xbe, 0xd1, 0x0d, 0x49, 0x3c, 0x3e, 0x23,
+    0x2c, 0x98, 0x0a, 0x0c, 0xc3, 0x2a, 0xfd, 0xb4, 0x05, 0xe0, 0x4e, 0xbf,
+    0xf7, 0x73, 0x69, 0xc5, 0x4c, 0xdf, 0xc7, 0x5f, 0xf6, 0x37, 0xa8, 0x1e,
+    0x81, 0x43, 0xaf, 0x7b, 0x1a, 0x75, 0x2c, 0xf5, 0x34, 0x73, 0x7a, 0x4b,
+    0xfc, 0xea, 0x51, 0x1a, 0x9f, 0xc2, 0x57, 0xc4, 0x57, 0xfc, 0xa3, 0xfc,
+    0x85, 0x8a, 0x28, 0x75, 0xff, 0x9f, 0x4b, 0x84, 0xe7, 0x11, 0x93, 0xad,
+    0xa5, 0x0f, 0xdf, 0xa7, 0x57, 0xfd, 0x9e, 0xf2, 0x29, 0xec, 0x69, 0xd7,
+    0xf8, 0x31, 0xbe, 0xb3, 0x7f, 0x1d, 0x7f, 0xd1, 0xe4, 0x6a, 0x06, 0x3c,
+    0x75, 0xb4, 0x14, 0x51, 0x61, 0xc7, 0x0d, 0x2b, 0x74, 0xc0, 0x3d, 0x0c,
+    0xbb, 0xfe, 0xf2, 0x4f, 0x1b, 0xff, 0xc8, 0x3a, 0xf6, 0xbd, 0x87, 0x5d,
+    0x9a, 0xf8, 0x7a, 0xbf, 0x4e, 0xaf, 0xfe, 0xcf, 0x26, 0xf2, 0x18, 0x55,
+    0x2a, 0xfd, 0xb3, 0xaf, 0xd9, 0xef, 0xdf, 0xc7, 0x54, 0x8f, 0xdf, 0x6d,
+    0x42, 0xff, 0xfd, 0x1d, 0x7c, 0x18, 0xe2, 0x81, 0x03, 0xf2, 0x47, 0x54,
+    0x93, 0x20, 0xf4, 0x2a, 0x36, 0x89, 0x6a, 0x17, 0x35, 0x71, 0x45, 0x21,
+    0xfc, 0xf1, 0xd7, 0x02, 0x39, 0xfb, 0xee, 0xa3, 0xc8, 0xeb, 0xfd, 0x83,
+    0x2c, 0xd7, 0xd5, 0x9d, 0x7e, 0x5e, 0xbf, 0x77, 0x3a, 0xbc, 0x7b, 0x5f,
+    0x4c, 0xef, 0xfb, 0x98, 0x3f, 0x3b, 0x9b, 0xb2, 0x75, 0xff, 0x48, 0x41,
+    0xff, 0xc6, 0xaf, 0xf3, 0xaa, 0x74, 0xc5, 0xa4, 0xf5, 0x84, 0x9b, 0x9d,
+    0xdf, 0xf0, 0xc6, 0x6f, 0xec, 0xe4, 0x1d, 0x50, 0x7e, 0xae, 0x7f, 0x7e,
+    0x7d, 0x81, 0x0c, 0x1d, 0x76, 0xb4, 0x75, 0xe6, 0x59, 0x64, 0xeb, 0xbf,
+    0x72, 0x98, 0x2f, 0xeb, 0x87, 0xb7, 0xa3, 0x5b, 0xff, 0x66, 0x85, 0xd4,
+    0x98, 0x52, 0x63, 0xaf, 0xef, 0xe2, 0x5d, 0xfb, 0xa3, 0xaf, 0x3f, 0xf8,
+    0x55, 0x49, 0x32, 0xe5, 0xc2, 0x0f, 0xa4, 0x5f, 0x9f, 0x6d, 0x98, 0x5f,
+    0x40, 0x50, 0x27, 0x5f, 0x83, 0xc4, 0x04, 0xe7, 0x5f, 0xe6, 0x70, 0x73,
+    0x62, 0x70, 0xeb, 0xf8, 0x73, 0x7f, 0xfe, 0xc8, 0xea, 0x99, 0x11, 0x62,
+    0x51, 0xe3, 0x3b, 0x9d, 0x67, 0x5f, 0xec, 0xd9, 0x8c, 0x32, 0xcb, 0x25,
+    0x5f, 0xa6, 0x8c, 0xee, 0x8e, 0xa1, 0x3d, 0xff, 0xa7, 0x17, 0xf9, 0x53,
+    0x00, 0x6f, 0x53, 0x87, 0x5e, 0x5b, 0xf8, 0xea, 0x99, 0x1d, 0x1d, 0x74,
+    0x01, 0x1e, 0xc3, 0x6b, 0xf8, 0x76, 0x3a, 0xd1, 0x67, 0x5f, 0xb2, 0x69,
+    0x44, 0x8e, 0xbf, 0xa7, 0x0c, 0x60, 0x84, 0xea, 0x85, 0x5a, 0xf2, 0x54,
+    0x48, 0x55, 0xbc, 0x63, 0x1a, 0x40, 0xf1, 0x6f, 0xd2, 0x7b, 0xcf, 0xfa,
+    0x1d, 0x7f, 0xc1, 0x10, 0x6b, 0x27, 0xc9, 0xce, 0xbd, 0x1c, 0x13, 0xaf,
+    0xf6, 0x04, 0x5f, 0x48, 0x13, 0xad, 0xd3, 0xaf, 0x01, 0xe7, 0x13, 0xc0,
+    0xd1, 0x85, 0x93, 0x88, 0x8d, 0xf2, 0xd5, 0x2d, 0x30, 0x97, 0x1b, 0x54,
+    0xc3, 0x1a, 0xff, 0xf6, 0x05, 0xd7, 0x9b, 0xcb, 0x3f, 0xc0, 0x9d, 0x77,
+    0x5c, 0xeb, 0xa6, 0xd1, 0xd7, 0xec, 0xd8, 0x82, 0x1c, 0x35, 0x9f, 0x45,
+    0x6f, 0xdd, 0xcd, 0xfd, 0x07, 0x5f, 0xb6, 0x9e, 0x7f, 0xb2, 0x3a, 0xbe,
+    0x26, 0x10, 0xc3, 0xae, 0x1f, 0x80, 0x9e, 0xf8, 0x39, 0xd7, 0x3a, 0xff,
+    0xe8, 0xc1, 0x97, 0x70, 0x46, 0x19, 0x3a, 0xb8, 0x8a, 0x01, 0x40, 0xf1,
+    0x05, 0xfe, 0xe6, 0xbb, 0x82, 0x9a, 0x3a, 0x90, 0xf8, 0x1c, 0xbe, 0xff,
+    0xb0, 0x38, 0x30, 0x20, 0x83, 0xae, 0x86, 0x4e, 0xa9, 0xdd, 0x99, 0xf4,
+    0xa5, 0xe8, 0x86, 0x5c, 0xae, 0x3e, 0x29, 0x08, 0x06, 0xca, 0xac, 0xdc,
+    0xe5, 0x21, 0xb7, 0x31, 0x8f, 0x29, 0xf0, 0xcb, 0x8e, 0x03, 0xb3, 0x80,
+    0x0e, 0xa9, 0xfc, 0x27, 0x86, 0x7b, 0x17, 0x51, 0xf2, 0xfa, 0x70, 0x94,
+    0x11, 0xbc, 0xec, 0x94, 0x83, 0xf4, 0x83, 0x68, 0xd2, 0xff, 0xb3, 0x83,
+    0x1e, 0x96, 0x74, 0xeb, 0xf8, 0x7f, 0xc0, 0xbc, 0x8e, 0xbf, 0xff, 0x03,
+    0xda, 0x6f, 0x50, 0x63, 0x7d, 0x22, 0xe0, 0xeb, 0xfc, 0xd1, 0xc9, 0x49,
+    0xf4, 0x75, 0xfc, 0xec, 0xe7, 0xff, 0x7c, 0x75, 0xf9, 0xe5, 0xf0, 0x28,
+    0x75, 0xe9, 0x47, 0xe7, 0x5f, 0xbe, 0xcd, 0x28, 0x57, 0x2a, 0xa1, 0x38,
+    0x8c, 0x36, 0x50, 0xb1, 0x15, 0x38, 0x63, 0xd3, 0x0f, 0x14, 0x7d, 0x1c,
+    0xb3, 0x4e, 0xbf, 0xf9, 0x41, 0x03, 0xfd, 0xcd, 0x24, 0x09, 0xd7, 0xb6,
+    0xd0, 0x27, 0x57, 0x0f, 0x85, 0x68, 0x77, 0xff, 0x6f, 0xe0, 0x2f, 0xb0,
+    0x82, 0xe1, 0x3a, 0xf9, 0x4e, 0x3b, 0x27, 0x5b, 0xe9, 0xa2, 0x05, 0xb7,
+    0x8d, 0x40, 0xa5, 0x78, 0xde, 0x32, 0x3f, 0x58, 0x88, 0x14, 0x5f, 0xbf,
+    0xf2, 0x6d, 0xf5, 0x3e, 0xb1, 0xff, 0xf0, 0x55, 0xff, 0x0f, 0xb4, 0x0d,
+    0xfc, 0x8c, 0x9d, 0x7f, 0x80, 0xfa, 0xcc, 0x15, 0x0e, 0xa8, 0x3e, 0xbe,
+    0x9d, 0x5f, 0xfe, 0x45, 0x3e, 0x0b, 0xa9, 0xf3, 0x5f, 0xff, 0x07, 0x5f,
+    0xe7, 0xee, 0xfa, 0x81, 0xf1, 0xd5, 0xa4, 0x41, 0x79, 0x42, 0xff, 0x9b,
+    0xd4, 0x9a, 0x50, 0x32, 0x3a, 0xfa, 0x5d, 0xc9, 0xce, 0xbf, 0xe8, 0xdd,
+    0x6f, 0xec, 0xdf, 0xc7, 0x56, 0xe7, 0xb6, 0x24, 0x57, 0xfd, 0x0d, 0xf0,
+    0x3b, 0xc8, 0x64, 0xeb, 0xb8, 0xe7, 0x5f, 0xff, 0xd1, 0xcf, 0xf3, 0x62,
+    0x6b, 0x58, 0x2d, 0x71, 0xfc, 0xea, 0xe1, 0xf8, 0x74, 0x56, 0xff, 0xcf,
+    0xbe, 0xb3, 0xc8, 0xb7, 0x91, 0xd6, 0xf1, 0xd5, 0xf9, 0xe6, 0xfd, 0x3d,
+    0xbf, 0xff, 0xf8, 0x1a, 0xeb, 0xcb, 0x52, 0x4f, 0x7d, 0xe4, 0x76, 0x3d,
+    0xa7, 0xdc, 0xeb, 0xf4, 0x60, 0xfb, 0x6c, 0xeb, 0xf9, 0x37, 0xff, 0x8e,
+    0x13, 0xac, 0xb3, 0xa9, 0x67, 0xcd, 0xd2, 0x81, 0x2e, 0xbd, 0x20, 0x04,
+    0xeb, 0x9f, 0x7f, 0x87, 0x94, 0xe5, 0xd5, 0xc4, 0xd4, 0xf5, 0x19, 0x25,
+    0xff, 0xfd, 0x83, 0x3e, 0xb5, 0x1f, 0xe7, 0x53, 0x8e, 0xcf, 0x8e, 0xa0,
+    0xae, 0x48, 0x6f, 0x0a, 0x39, 0x88, 0xf9, 0x09, 0x35, 0x91, 0x76, 0x15,
+    0x3f, 0xb7, 0xfa, 0x37, 0x86, 0x4a, 0xaa, 0x17, 0x76, 0x92, 0x75, 0x02,
+    0xff, 0xff, 0xb9, 0x3e, 0x24, 0xce, 0xf2, 0xd4, 0x2c, 0x3d, 0x81, 0x69,
+    0xd7, 0xc1, 0xe8, 0x27, 0x3a, 0xff, 0x05, 0xe5, 0x93, 0x80, 0x4e, 0xb4,
+    0xf0, 0x7a, 0xb8, 0x47, 0x72, 0xa7, 0x0e, 0xac, 0x3c, 0x07, 0x27, 0xbf,
+    0xbd, 0xb6, 0x0e, 0xe3, 0x4e, 0xbf, 0xdc, 0x8f, 0x27, 0xf1, 0x23, 0xaf,
+    0x4e, 0x32, 0x3a, 0x95, 0x0c, 0x91, 0x68, 0x71, 0x42, 0x25, 0xc3, 0x13,
+    0xb3, 0xbf, 0x6e, 0x58, 0x30, 0xfa, 0xd1, 0x07, 0x8c, 0x00, 0x65, 0x7f,
+    0xe5, 0x47, 0xd8, 0x5b, 0x7a, 0xfb, 0xfe, 0x75, 0xfe, 0x94, 0xd8, 0x2f,
+    0xdc, 0x3a, 0xff, 0x6c, 0x79, 0x83, 0x03, 0x39, 0xd7, 0xd0, 0x05, 0x4a,
+    0x1d, 0x7b, 0xde, 0x83, 0xaf, 0xf2, 0x72, 0x27, 0x7e, 0x34, 0xeb, 0x7b,
+    0x87, 0xe2, 0xe4, 0x9e, 0x1b, 0xbf, 0xfd, 0xc6, 0x8e, 0x6c, 0x1c, 0x8e,
+    0x46, 0x8e, 0xbf, 0xcf, 0x37, 0x71, 0x79, 0xa3, 0xab, 0x0f, 0xeb, 0x62,
+    0x45, 0xfc, 0x8a, 0x7b, 0x31, 0x67, 0x5f, 0xb0, 0x29, 0xcd, 0x1d, 0x7b,
+    0xde, 0xdc, 0xeb, 0xff, 0xb7, 0x6a, 0x77, 0xe6, 0xd6, 0x75, 0x16, 0x75,
+    0x7e, 0x7c, 0xde, 0x1d, 0xb8, 0x1c, 0x3a, 0xb4, 0x6e, 0x76, 0xc8, 0xed,
+    0x13, 0xa3, 0xa5, 0x98, 0x62, 0xd4, 0x2a, 0xbb, 0xc8, 0x53, 0x24, 0x2b,
+    0xba, 0x47, 0xe8, 0xc5, 0x6f, 0xfc, 0x29, 0xf7, 0x7c, 0xd9, 0xbc, 0x7d,
+    0x3a, 0xff, 0xf2, 0x67, 0x03, 0x0c, 0xe7, 0x63, 0x7d, 0x1d, 0x7d, 0xf6,
+    0x39, 0xf9, 0xd7, 0x3f, 0x0e, 0xbf, 0xbc, 0x93, 0xae, 0x1a, 0x75, 0x04,
+    0xf0, 0xba, 0x2b, 0x76, 0x6d, 0x1d, 0x7d, 0xff, 0xd1, 0x91, 0xd7, 0x7e,
+    0xe2, 0x6f, 0x3c, 0x31, 0x50, 0x88, 0xa0, 0x2f, 0x5d, 0xbc, 0xc7, 0x5f,
+    0xbe, 0xfb, 0xf5, 0xe1, 0xd4, 0xb3, 0xc2, 0xfc, 0x62, 0xf3, 0x63, 0x47,
+    0x5f, 0xf4, 0x9f, 0x9e, 0x18, 0x5e, 0x8e, 0xbf, 0xd0, 0x18, 0xe0, 0x23,
+    0xf3, 0xae, 0x5e, 0xa6, 0x3e, 0x95, 0x9b, 0xdf, 0xfa, 0x1c, 0x73, 0xde,
+    0x46, 0x7c, 0x75, 0x42, 0x62, 0x58, 0x46, 0x90, 0x84, 0x01, 0x7d, 0x2a,
+    0x97, 0xaf, 0xa1, 0x1a, 0x52, 0xbb, 0x31, 0x65, 0xa8, 0x93, 0x24, 0xea,
+    0x1e, 0x1e, 0x8d, 0xda, 0xfe, 0x80, 0x6e, 0x9b, 0xed, 0x1d, 0x7e, 0xc6,
+    0x73, 0x7f, 0x1d, 0x6e, 0x7c, 0x3d, 0x94, 0x31, 0xbf, 0xfd, 0xac, 0x10,
+    0x37, 0xb8, 0xb9, 0x9d, 0xa7, 0x5f, 0xe1, 0x53, 0xb0, 0xb5, 0x89, 0xd7,
+    0xf2, 0xba, 0x46, 0xd0, 0x3c, 0x75, 0xfa, 0x26, 0xcc, 0x69, 0xd5, 0x88,
+    0x8a, 0x43, 0x2e, 0x99, 0x5f, 0xfb, 0xb9, 0x32, 0x4c, 0x0d, 0xa0, 0x68,
+    0xeb, 0xc9, 0xc5, 0x0e, 0xa4, 0x3d, 0xf1, 0x43, 0xbf, 0x46, 0xd7, 0x62,
+    0x63, 0xaa, 0x47, 0x95, 0xa2, 0x0b, 0xff, 0x81, 0x32, 0x76, 0x37, 0x94,
+    0x4d, 0x07, 0x5f, 0x82, 0xe3, 0x1d, 0x3a, 0xfe, 0x94, 0x6f, 0xec, 0xe9,
+    0xd7, 0xff, 0xbd, 0xa4, 0xfe, 0x25, 0xac, 0xcd, 0xfc, 0x75, 0x4c, 0x7e,
+    0xfa, 0x2d, 0xb2, 0x75, 0x17, 0xec, 0xc2, 0x72, 0xff, 0xfd, 0xc0, 0x73,
+    0x90, 0x38, 0xa2, 0x77, 0xb9, 0xf4, 0xeb, 0xf8, 0x5d, 0x03, 0x02, 0x75,
+    0xf4, 0xf1, 0xb5, 0x07, 0x5e, 0xd8, 0x0e, 0x9d, 0x7f, 0xf2, 0x2d, 0x35,
+    0xd8, 0x4e, 0x01, 0x5c, 0xea, 0x84, 0x43, 0xa1, 0x23, 0x8f, 0x5f, 0xc3,
+    0xa4, 0xd9, 0x01, 0x3a, 0xf0, 0xa2, 0x87, 0x5f, 0xde, 0x4e, 0x27, 0x80,
+    0x75, 0xa1, 0x67, 0x8f, 0xf4, 0x6e, 0xfe, 0x07, 0xde, 0xe6, 0xfa, 0x3a,
+    0xff, 0xff, 0xfd, 0xc8, 0xf0, 0xbb, 0x53, 0x53, 0x27, 0x1b, 0x1a, 0xf4,
+    0x6f, 0x1f, 0x73, 0x47, 0x5f, 0xee, 0xe6, 0xf1, 0xc4, 0x59, 0xd7, 0xff,
+    0xff, 0xfe, 0xd6, 0xb3, 0xdd, 0x75, 0xeb, 0x9c, 0x4d, 0xfc, 0xee, 0xa6,
+    0x64, 0xc0, 0xf4, 0x33, 0xbc, 0x1d, 0x50, 0x9a, 0x88, 0x61, 0x06, 0xe6,
+    0x57, 0xdf, 0xbe, 0xfa, 0x3a, 0xe6, 0x59, 0x3a, 0xb4, 0x6e, 0xd9, 0x23,
+    0xbf, 0x27, 0x5f, 0x3a, 0x53, 0x06, 0x8a, 0xff, 0x81, 0xe8, 0x16, 0xab,
+    0x7f, 0xac, 0xeb, 0xdd, 0x8f, 0xce, 0xa4, 0x3d, 0xa7, 0x3e, 0xbf, 0xdd,
+    0x8f, 0x01, 0x60, 0xf1, 0xd5, 0x0b, 0xfd, 0x92, 0x29, 0x0c, 0x34, 0xf7,
+    0x86, 0xba, 0xb9, 0x14, 0xd1, 0x82, 0x70, 0xb9, 0x6a, 0xdd, 0x85, 0x83,
+    0x96, 0xfe, 0xe8, 0xa9, 0x29, 0x18, 0xe0, 0x75, 0x09, 0x1f, 0x42, 0x43,
+    0x68, 0x82, 0xfd, 0x34, 0x4d, 0xd8, 0x3a, 0xef, 0xb0, 0x75, 0xe6, 0x59,
+    0x64, 0xab, 0xe9, 0x7b, 0x1a, 0x53, 0x05, 0xfd, 0xfb, 0x02, 0x9f, 0xe8,
+    0xf7, 0x7f, 0x57, 0x0f, 0x94, 0x4c, 0x6a, 0x11, 0xc9, 0xc2, 0x87, 0x84,
+    0xdd, 0xde, 0xd1, 0xd7, 0xfd, 0xf3, 0xdd, 0x8f, 0x6b, 0xa8, 0x75, 0xb4,
+    0x75, 0xfe, 0xf6, 0xf2, 0xec, 0x0c, 0xe7, 0x5f, 0xfb, 0x37, 0x92, 0x60,
+    0x8e, 0x04, 0xeb, 0xf4, 0xeb, 0x06, 0xfe, 0x3a, 0xa1, 0x1f, 0x3b, 0x8b,
+    0x70, 0xe8, 0x44, 0x34, 0x69, 0xe3, 0xbb, 0xfe, 0x18, 0x67, 0x48, 0x3b,
+    0xc8, 0xeb, 0xa1, 0xa7, 0x50, 0x9e, 0x6e, 0xc3, 0x8b, 0xe9, 0xfe, 0xc2,
+    0xb9, 0xd7, 0xfb, 0x41, 0x18, 0x67, 0x04, 0xea, 0xe1, 0xec, 0x78, 0x9e,
+    0xa1, 0x34, 0x04, 0x85, 0x1b, 0xbd, 0xdf, 0xc3, 0xbe, 0xa6, 0xcf, 0x1d,
+    0x7f, 0x27, 0x85, 0xff, 0xd1, 0xd7, 0xff, 0xbd, 0x36, 0x73, 0x1d, 0x71,
+    0xd4, 0x09, 0xd7, 0xf0, 0x17, 0x9d, 0xdd, 0xce, 0xa5, 0x11, 0x42, 0x25,
+    0x9a, 0x48, 0xbf, 0xfc, 0x81, 0x17, 0xdc, 0x73, 0xd8, 0x9f, 0x9d, 0x7f,
+    0x47, 0xbb, 0x2d, 0x00, 0xeb, 0xf7, 0x5f, 0x99, 0xc3, 0xae, 0x03, 0x9d,
+    0x4d, 0x37, 0x62, 0x4d, 0x7f, 0x72, 0x12, 0x4f, 0xa3, 0xad, 0x13, 0x9e,
+    0x58, 0x90, 0x5f, 0xa7, 0x57, 0x4c, 0xdc, 0xeb, 0xf2, 0x6a, 0x27, 0x59,
+    0xec, 0xfd, 0xbf, 0x43, 0xf3, 0xf0, 0x1e, 0xcf, 0xdb, 0x9e, 0x47, 0xb3,
+    0xf6, 0xf8, 0x12, 0xcd, 0x1e, 0xcf, 0xda, 0x09, 0xe8, 0x09, 0x15, 0xfa,
+    0x33, 0x58, 0x27, 0xb3, 0xf6, 0x8f, 0x67, 0xed, 0xcf, 0xe3, 0xd9, 0xfa,
+    0xb2, 0xde, 0xd2, 0x13, 0xf9, 0x02, 0x45, 0xf6, 0x6d, 0xa7, 0xe7, 0xb3,
+    0xf6, 0x8f, 0x67, 0xed, 0xdf, 0xc1, 0xec, 0xfd, 0xbf, 0xec, 0xfd, 0xf9,
+    0x9b, 0x30, 0x27, 0xb3, 0xf6, 0xfe, 0xce, 0xa6, 0x81, 0x39, 0xec, 0xfd,
+    0xaf, 0xd1, 0x46, 0x24, 0x7a, 0x46, 0xbe, 0xe4, 0xf1, 0xe3, 0xd9, 0xfb,
+    0x47, 0xb3, 0xf7, 0x0d, 0x7d, 0xcc, 0xb2, 0x7b, 0x3f, 0x6a, 0x4a, 0xc3,
+    0x82, 0x69, 0x90, 0x84, 0xde, 0x13, 0x5c, 0x27, 0x59, 0x8e, 0xa1, 0x75,
+    0xe5, 0xf6, 0x49, 0xaf, 0x4a, 0x14, 0x2d, 0x9f, 0xa6, 0x11, 0x21, 0x7f,
+    0xb5, 0x92, 0x94, 0x7b, 0x73, 0xab, 0x0f, 0xc3, 0x47, 0xb7, 0xfe, 0xc6,
+    0x87, 0x38, 0xcb, 0xf6, 0x63, 0xae, 0x94, 0xe5, 0x5f, 0x4c, 0xef, 0xc3,
+    0xaa, 0x74, 0x4c, 0x6e, 0x42, 0x27, 0xfb, 0x42, 0xf5, 0xc5, 0xd1, 0x27,
+    0x9c, 0xd1, 0xbf, 0xcb, 0xd0, 0xe7, 0xb3, 0xf3, 0xaf, 0xf9, 0xb1, 0xf8,
+    0x40, 0xfc, 0x91, 0xd7, 0xfe, 0x77, 0x9f, 0x16, 0xe3, 0xbc, 0x8e, 0xbf,
+    0x32, 0x2e, 0xa6, 0xb0, 0xfd, 0xa6, 0x39, 0xa8, 0x47, 0x43, 0xc2, 0xa2,
+    0xfc, 0x3e, 0xee, 0x4e, 0x75, 0xc1, 0x64, 0xea, 0x83, 0x7d, 0x84, 0xf7,
+    0xff, 0xe9, 0x72, 0x36, 0x3c, 0xd0, 0x1e, 0xc2, 0xde, 0x63, 0xaf, 0xf6,
+    0xd3, 0xe9, 0x35, 0x36, 0x1d, 0x5b, 0xa2, 0x33, 0x8a, 0xf5, 0x0c, 0xc1,
+    0x99, 0x4a, 0x6c, 0xc3, 0x34, 0x86, 0x7a, 0xb9, 0x87, 0x11, 0xfb, 0x0b,
+    0x37, 0x9d, 0x39, 0x18, 0xc5, 0x74, 0xc8, 0x08, 0x55, 0xdf, 0xff, 0xf2,
+    0x75, 0xfb, 0x12, 0x63, 0x3f, 0x89, 0x68, 0x3d, 0x8e, 0x1d, 0x7f, 0xe5,
+    0x23, 0x71, 0x8e, 0xf4, 0x0d, 0x3a, 0xff, 0xf0, 0x79, 0x18, 0x39, 0x24,
+    0xee, 0x6c, 0x3a, 0xfe, 0x17, 0x53, 0xaf, 0x23, 0xaf, 0x32, 0xcb, 0x25,
+    0x5e, 0xfb, 0x1f, 0x94, 0xc1, 0x7f, 0x7f, 0xcf, 0x2f, 0xbc, 0xcd, 0x8f,
+    0xc3, 0xaf, 0xff, 0xdd, 0xc9, 0x7d, 0x11, 0xc9, 0xe6, 0x94, 0x72, 0x73,
+    0xa8, 0x51, 0x27, 0xe3, 0xbb, 0xfe, 0xf3, 0x8e, 0x6b, 0x91, 0xa3, 0xaf,
+    0xa5, 0x1f, 0xee, 0x75, 0xfd, 0xfc, 0x0e, 0x6f, 0xe3, 0xae, 0x7f, 0xfe,
+    0x1e, 0x87, 0xd2, 0x3a, 0x74, 0x5c, 0x0c, 0x21, 0xaf, 0x6c, 0x8e, 0x1d,
+    0x52, 0x56, 0x2c, 0x16, 0x6c, 0x3f, 0x5a, 0x47, 0xe9, 0x63, 0x0c, 0x1f,
+    0x43, 0x6b, 0x61, 0x35, 0xc9, 0x39, 0xd7, 0xf8, 0x5a, 0x14, 0xd9, 0x01,
+    0x3a, 0x82, 0x79, 0x20, 0x16, 0xb7, 0xe7, 0x5f, 0xf6, 0x42, 0xbf, 0xce,
+    0xbe, 0x70, 0xeb, 0xfd, 0xfe, 0xda, 0x2c, 0x21, 0xc3, 0xaf, 0xfb, 0xdd,
+    0xcd, 0x7c, 0xf2, 0x4e, 0x75, 0x41, 0xf8, 0xa1, 0xb5, 0xff, 0x0a, 0x01,
+    0x53, 0xad, 0xb8, 0xf1, 0xd5, 0x24, 0xc6, 0xe6, 0x11, 0xec, 0x2b, 0x04,
+    0x82, 0xf3, 0x2c, 0xb2, 0x58, 0x84, 0x17, 0xcd, 0x77, 0x69, 0x62, 0x10,
+    0x30, 0x6b, 0x6f, 0x9f, 0x98, 0xc9, 0xd5, 0xc3, 0xe0, 0xd8, 0x7f, 0x79,
+    0x96, 0x59, 0x2c, 0x41, 0xea, 0x2c, 0x41, 0xe6, 0x0d, 0x6d, 0xe6, 0x59,
+    0x64, 0xeb, 0xda, 0x85, 0x0a, 0x60, 0xbf, 0xb2, 0xf1, 0x18, 0xad, 0x51,
+    0xf2, 0x45, 0xff, 0xdd, 0x89, 0x27, 0xb3, 0xad, 0x85, 0x9d, 0x50, 0x7e,
+    0xfb, 0x0d, 0x6f, 0xff, 0x67, 0x53, 0x9d, 0x7c, 0xd2, 0x3c, 0xe7, 0x5f,
+    0x47, 0xa1, 0x67, 0x52, 0xcf, 0x9f, 0xc8, 0xf7, 0xf3, 0x2e, 0x10, 0x3f,
+    0xd3, 0xaf, 0x85, 0x21, 0x43, 0xaf, 0x7d, 0x8f, 0xce, 0xa9, 0xcd, 0xf2,
+    0xc8, 0x2f, 0xcd, 0x8e, 0xc2, 0xca, 0xbf, 0x0b, 0x88, 0xe1, 0x57, 0x63,
+    0x4a, 0xb9, 0x96, 0x4a, 0xac, 0x3f, 0x6d, 0x13, 0x78, 0x8d, 0x91, 0x5b,
+    0xfc, 0x3f, 0x63, 0xfe, 0xe6, 0xd1, 0x4c, 0x1b, 0xcb, 0xff, 0xd3, 0x87,
+    0x8e, 0xd1, 0xcd, 0x9c, 0x4d, 0x1d, 0x50, 0x9f, 0xb6, 0x11, 0x23, 0x6b,
+    0xc3, 0x50, 0x09, 0x17, 0xff, 0x47, 0xfa, 0xcc, 0x0b, 0x8b, 0xa8, 0x75,
+    0xff, 0xf4, 0xb4, 0xcc, 0x73, 0xb0, 0x9d, 0x81, 0x43, 0xaf, 0xff, 0xb4,
+    0x39, 0xbf, 0xef, 0xa7, 0xe2, 0x6f, 0xf9, 0xd5, 0xba, 0x27, 0x99, 0x4d,
+    0xae, 0xa6, 0x0a, 0xf0, 0xe0, 0xbf, 0xb5, 0xf4, 0x20, 0x19, 0x1d, 0x7f,
+    0x23, 0x43, 0x8f, 0xf9, 0xd7, 0xff, 0xfe, 0x89, 0xd8, 0xd7, 0xb5, 0xbf,
+    0xc0, 0xe0, 0x61, 0xf9, 0x83, 0xf9, 0xd7, 0xe5, 0xe9, 0x97, 0xdc, 0xeb,
+    0x68, 0x28, 0x99, 0xfa, 0xe1, 0x7f, 0x64, 0xd2, 0x4e, 0x68, 0xea, 0x86,
+    0x4a, 0xa8, 0x61, 0x8f, 0x91, 0x9e, 0xa4, 0xa0, 0xce, 0x4a, 0x80, 0x78,
+    0xd4, 0x55, 0x25, 0x02, 0x5f, 0xa8, 0x62, 0xf8, 0xae, 0xf3, 0x2c, 0xb2,
+    0x55, 0xf7, 0xee, 0x21, 0x29, 0x82, 0xfe, 0xfb, 0xa8, 0xf2, 0x3a, 0xfb,
+    0x9c, 0x45, 0x9d, 0x7b, 0x51, 0xe3, 0xaf, 0x0f, 0xb4, 0x86, 0xf2, 0x62,
+    0x1b, 0xdf, 0x14, 0xdb, 0x3a, 0xf7, 0x9c, 0x27, 0x57, 0x0d, 0xee, 0x88,
+    0xaf, 0xe6, 0xc7, 0xe9, 0xc5, 0x0e, 0xbf, 0xbe, 0xe7, 0x33, 0x26, 0x3a,
+    0xfc, 0xfd, 0xf8, 0x18, 0x3a, 0xa4, 0x9d, 0x08, 0x4c, 0x71, 0x71, 0x1b,
+    0xc4, 0x87, 0x45, 0xde, 0x2e, 0xbf, 0x3f, 0x39, 0x9b, 0x9d, 0x7f, 0xfb,
+    0xdd, 0x47, 0xff, 0x38, 0x18, 0x19, 0x1d, 0x7f, 0xfb, 0x7f, 0x9b, 0xff,
+    0x02, 0xd7, 0x9c, 0x5c, 0xea, 0x84, 0x5e, 0x61, 0x38, 0xa4, 0x5f, 0xa3,
+    0x5f, 0x46, 0x47, 0x5f, 0xff, 0xfc, 0xe9, 0xe4, 0xeb, 0x53, 0xe4, 0x93,
+    0xae, 0x3e, 0x96, 0x73, 0x0e, 0xbd, 0xdc, 0xda, 0x3a, 0xfd, 0xed, 0x7d,
+    0xd7, 0xce, 0xa2, 0x35, 0xdb, 0xef, 0xe6, 0x75, 0xd7, 0x6c, 0x1d, 0x7f,
+    0xff, 0xf2, 0x29, 0xbc, 0xbd, 0x83, 0xed, 0x7c, 0xd6, 0xb3, 0x98, 0x2f,
+    0x23, 0xaf, 0xfe, 0x60, 0x23, 0x00, 0x6e, 0x28, 0x9c, 0x3a, 0xec, 0x64,
+    0xeb, 0x64, 0x1e, 0xd6, 0x91, 0x2f, 0xf0, 0x7b, 0x13, 0x3b, 0xee, 0x75,
+    0xee, 0xff, 0xb0, 0xea, 0xe1, 0xe9, 0x6d, 0x19, 0xd4, 0x91, 0x3a, 0xef,
+    0x17, 0xff, 0x67, 0x3f, 0x5a, 0x6b, 0xee, 0xa3, 0x0e, 0xbc, 0xea, 0xfa,
+    0x3a, 0xa4, 0x7c, 0x6e, 0x8b, 0x78, 0x38, 0xb3, 0xaf, 0xbf, 0xf6, 0x7e,
+    0x75, 0x21, 0xbe, 0xe0, 0xdd, 0xff, 0x37, 0xa3, 0x1b, 0xa4, 0x74, 0xea,
+    0x85, 0xd1, 0x69, 0x46, 0x3c, 0x12, 0xdc, 0x85, 0xaa, 0x22, 0x70, 0xb5,
+    0xe3, 0x6a, 0x18, 0x42, 0x81, 0x7f, 0xe9, 0x05, 0xff, 0x9d, 0x02, 0x0f,
+    0x6a, 0x7c, 0x64, 0xeb, 0xf6, 0xb1, 0x48, 0xd1, 0xd7, 0xf2, 0xbe, 0x90,
+    0x77, 0x91, 0xd7, 0xfe, 0x7e, 0x6d, 0xa7, 0x71, 0xf7, 0xfc, 0xeb, 0xff,
+    0xf2, 0x7a, 0x17, 0x9b, 0xfa, 0x17, 0xf7, 0x8f, 0xf9, 0xd7, 0xc8, 0x2e,
+    0x13, 0xaf, 0xfb, 0x51, 0xcf, 0x43, 0x01, 0x43, 0xaa, 0x48, 0xae, 0x0a,
+    0xbe, 0x87, 0xef, 0xff, 0x69, 0x39, 0x12, 0xec, 0x4c, 0x20, 0x50, 0xeb,
+    0x9b, 0xb6, 0x75, 0xfc, 0xa7, 0xa3, 0xb1, 0xa3, 0xaf, 0xee, 0xa6, 0xfa,
+    0x7d, 0xce, 0xa9, 0x1f, 0xa2, 0x0c, 0xfe, 0x5b, 0x7f, 0xe1, 0x79, 0xba,
+    0xfc, 0xe2, 0x04, 0xeb, 0xc1, 0x41, 0x3a, 0xfe, 0x8f, 0x2a, 0x1e, 0x37,
+    0x3a, 0xbe, 0x1e, 0x52, 0x0d, 0x54, 0x95, 0x86, 0xe1, 0x3b, 0x4c, 0x12,
+    0x1d, 0xf3, 0x18, 0x72, 0x17, 0xcb, 0x2f, 0x66, 0x10, 0xf7, 0xe4, 0x5a,
+    0xac, 0xab, 0xd5, 0xb3, 0xaf, 0xbe, 0xc3, 0x3a, 0x3a, 0xef, 0xfc, 0x75,
+    0xf7, 0x39, 0x9a, 0x3a, 0xec, 0x98, 0xeb, 0x4b, 0xe1, 0xf9, 0x4e, 0x48,
+    0xe2, 0xff, 0x48, 0x6f, 0xc9, 0xe7, 0x1c, 0x3a, 0xfd, 0xc0, 0xe6, 0x09,
+    0xd7, 0xff, 0x2b, 0xa6, 0x76, 0x36, 0x6b, 0xb1, 0xb9, 0xd7, 0xf6, 0xfc,
+    0x06, 0xfe, 0x91, 0xd4, 0xe8, 0x9d, 0xd1, 0x28, 0x12, 0x2f, 0xfb, 0x07,
+    0x99, 0xac, 0x4e, 0x9d, 0x7f, 0xfd, 0x2f, 0x0e, 0x3f, 0x87, 0x3d, 0xec,
+    0x64, 0xeb, 0xd3, 0xe6, 0xc3, 0xaf, 0xff, 0x7b, 0x59, 0x37, 0x63, 0x66,
+    0x77, 0xb0, 0x75, 0xfd, 0xd0, 0xa6, 0xc8, 0x09, 0xd5, 0x87, 0xf2, 0xe9,
+    0x77, 0xd9, 0xe4, 0xd1, 0xd7, 0xf2, 0xb1, 0x30, 0xab, 0x73, 0x80, 0xea,
+    0xd1, 0xec, 0xf8, 0x82, 0xa4, 0xaa, 0x90, 0x30, 0xc1, 0x69, 0x7e, 0xe6,
+    0xbc, 0x4d, 0x18, 0x4b, 0xf9, 0xe6, 0xf3, 0x39, 0xd3, 0xaf, 0xf6, 0x91,
+    0x4e, 0xb8, 0xa1, 0xd7, 0xc9, 0xac, 0x0b, 0x9e, 0x6f, 0x87, 0x2f, 0xfc,
+    0xea, 0xff, 0x83, 0x48, 0x3b, 0xc8, 0xeb, 0xff, 0xfb, 0xd9, 0xd4, 0x8f,
+    0x27, 0xf1, 0x26, 0x19, 0x65, 0x92, 0xaf, 0xf7, 0x40, 0xeb, 0x0b, 0xac,
+    0xea, 0x14, 0x48, 0x79, 0x7a, 0xf8, 0x39, 0x8a, 0x15, 0x7c, 0xff, 0xbf,
+    0x8e, 0xbf, 0xee, 0x3b, 0x7e, 0x76, 0x3e, 0x89, 0xd7, 0x81, 0x1c, 0x3a,
+    0xef, 0x68, 0x27, 0xad, 0x31, 0xdd, 0xe9, 0x08, 0x0d, 0x10, 0xcd, 0xee,
+    0xc4, 0xe7, 0x5e, 0x65, 0x96, 0x4a, 0xbd, 0x82, 0xd2, 0x98, 0x2f, 0xef,
+    0xfd, 0x93, 0xe0, 0x5e, 0x43, 0x13, 0x9d, 0x5f, 0x9f, 0x38, 0x95, 0x5f,
+    0x38, 0xab, 0x55, 0x51, 0xd7, 0x2b, 0x55, 0x6a, 0x75, 0xfb, 0x3d, 0xe0,
+    0x4e, 0x75, 0xa4, 0xad, 0x4f, 0x28, 0x48, 0xaf, 0x3a, 0xbc, 0x1d, 0x7e,
+    0xc0, 0xf5, 0xd5, 0xce, 0xbf, 0x0e, 0x06, 0x16, 0x75, 0x42, 0xae, 0x19,
+    0xc8, 0x82, 0x43, 0x8e, 0xfb, 0x97, 0xcc, 0x51, 0xc8, 0x51, 0x74, 0x89,
+    0xdd, 0x00, 0x5b, 0xb0, 0x75, 0x92, 0x9b, 0xfd, 0x0b, 0xc4, 0xe4, 0xd2,
+    0x3a, 0xf7, 0x92, 0x0e, 0xbb, 0x04, 0xea, 0x43, 0x5c, 0x01, 0xab, 0xff,
+    0xf7, 0x5f, 0x9a, 0xc4, 0x17, 0xf6, 0x99, 0x81, 0x3a, 0xfc, 0x14, 0xe4,
+    0x78, 0xeb, 0xb7, 0xfc, 0xeb, 0xf9, 0x71, 0xaf, 0xd1, 0xa7, 0x5e, 0xd4,
+    0x29, 0xf9, 0xe2, 0xe8, 0x62, 0xff, 0x03, 0x39, 0xff, 0xe8, 0x27, 0x5f,
+    0xfb, 0x16, 0x81, 0xe6, 0x05, 0xd6, 0x75, 0xf6, 0x2f, 0xe8, 0x4e, 0xae,
+    0x9e, 0xf8, 0x9e, 0x5f, 0xfe, 0x40, 0xf7, 0xee, 0xb3, 0x8d, 0x77, 0x69,
+    0xa2, 0x0c, 0xbe, 0x07, 0x71, 0xa7, 0x54, 0x8f, 0xe3, 0x6d, 0x5e, 0xf7,
+    0x40, 0xae, 0x75, 0xff, 0xee, 0x3e, 0xcc, 0x16, 0xf5, 0x3f, 0xfb, 0xe3,
+    0xaa, 0x11, 0x22, 0xa9, 0x25, 0x00, 0xfd, 0x6e, 0xa8, 0x93, 0xa6, 0xba,
+    0x84, 0x97, 0xa3, 0x2a, 0xbf, 0xdf, 0xa7, 0x7b, 0x9f, 0xb9, 0xd7, 0xff,
+    0xfc, 0xbc, 0xf7, 0x9f, 0x83, 0x1b, 0xcb, 0xef, 0x3f, 0x5a, 0x68, 0xeb,
+    0xfe, 0x5a, 0x33, 0x82, 0x1e, 0xc1, 0xd7, 0x74, 0x07, 0x5f, 0xff, 0xa4,
+    0x82, 0x1e, 0xe6, 0xff, 0x5c, 0x7c, 0x21, 0x3a, 0xf2, 0x32, 0xae, 0x75,
+    0xfe, 0xcd, 0x9a, 0xf7, 0xa1, 0x67, 0x57, 0x0f, 0x4f, 0xa3, 0xf5, 0x09,
+    0xc0, 0x63, 0x4a, 0x1b, 0xcc, 0x2d, 0xa8, 0x54, 0x5f, 0xed, 0xbc, 0xd6,
+    0xde, 0x72, 0x0e, 0xbf, 0xfe, 0x18, 0x6f, 0xce, 0x62, 0x01, 0x53, 0x9b,
+    0x58, 0x75, 0x49, 0x77, 0x64, 0x24, 0x18, 0xa4, 0x92, 0xa3, 0xff, 0x4b,
+    0xd4, 0x76, 0x7e, 0x4e, 0xda, 0x37, 0xbf, 0xda, 0xd6, 0x0f, 0xfb, 0x78,
+    0x75, 0xf0, 0xa6, 0xd4, 0x1d, 0x69, 0x8e, 0xbf, 0xb5, 0x83, 0xfe, 0xde,
+    0x1d, 0x6d, 0x9f, 0x11, 0x2f, 0x86, 0xbf, 0x91, 0x68, 0x46, 0xff, 0x81,
+    0xef, 0xc0, 0xb8, 0xcf, 0x1d, 0x7f, 0xf8, 0x67, 0xf9, 0x32, 0x0e, 0x07,
+    0x05, 0x43, 0xaf, 0xe4, 0xdf, 0x6b, 0xb1, 0xe3, 0xaf, 0x7d, 0xc8, 0x3a,
+    0xa1, 0x12, 0xea, 0xe9, 0x6e, 0x61, 0x7f, 0xff, 0xe7, 0x0e, 0x0b, 0xfb,
+    0x59, 0xcf, 0xff, 0x8c, 0xdf, 0xda, 0x43, 0xaf, 0x47, 0x26, 0x3a, 0xbe,
+    0x36, 0xbb, 0x31, 0x2d, 0x32, 0x78, 0x41, 0x06, 0x15, 0x39, 0x2b, 0xa9,
+    0xb0, 0xbd, 0xdc, 0xdd, 0x25, 0xd9, 0xf6, 0x15, 0xef, 0x3c, 0x73, 0xfc,
+    0x63, 0x42, 0x8e, 0x08, 0x68, 0x32, 0x63, 0xb6, 0xd7, 0x7b, 0x79, 0xf6,
+    0x1d, 0x7f, 0x7c, 0x6f, 0x63, 0x7d, 0xa3, 0xaf, 0x7c, 0xfd, 0x93, 0xab,
+    0x73, 0xd3, 0xf1, 0x9d, 0xfd, 0x8c, 0xe6, 0x0a, 0x87, 0x5f, 0x2d, 0xf3,
+    0x47, 0x52, 0x1e, 0x63, 0x96, 0x5f, 0xff, 0x36, 0x35, 0xa8, 0x5e, 0x79,
+    0x35, 0xd7, 0x3a, 0xff, 0x08, 0xc4, 0x97, 0x08, 0x75, 0xfe, 0xf2, 0x6c,
+    0x4f, 0x4a, 0x0a, 0xb2, 0xce, 0xbf, 0xb0, 0x54, 0xe4, 0x30, 0x87, 0x87,
+    0xf4, 0xce, 0xb1, 0x30, 0x54, 0x4d, 0xd3, 0x95, 0xf7, 0x01, 0xbc, 0x8e,
+    0xbf, 0xc3, 0x21, 0xc5, 0xc3, 0x4e, 0xbc, 0xb0, 0xe1, 0xd5, 0x07, 0xdd,
+    0x84, 0x6e, 0x61, 0x7b, 0x6c, 0x1e, 0x3a, 0xff, 0xf7, 0xa1, 0x68, 0x1c,
+    0x15, 0x3b, 0x0b, 0x3a, 0x9a, 0x7c, 0xfe, 0x1f, 0xbf, 0xfe, 0x4f, 0x76,
+    0x35, 0x1d, 0x84, 0x9e, 0x14, 0x3a, 0xfd, 0xef, 0x69, 0xff, 0x3a, 0xfd,
+    0x0b, 0xf6, 0x34, 0xeb, 0x92, 0x73, 0xaa, 0x11, 0x64, 0x89, 0xdd, 0x28,
+    0xf1, 0x35, 0xf9, 0x94, 0x0e, 0xd2, 0x1d, 0x7f, 0xdd, 0x89, 0x20, 0xe2,
+    0xe0, 0xeb, 0xfe, 0xcf, 0x77, 0x16, 0x2f, 0xe3, 0xaf, 0xed, 0x89, 0xcd,
+    0xe1, 0x5c, 0xeb, 0x08, 0x4f, 0xa3, 0x0d, 0xaf, 0xcb, 0x86, 0xce, 0x13,
+    0xaf, 0xa5, 0x0b, 0x73, 0xaf, 0xdc, 0xfd, 0x69, 0xa3, 0xae, 0xf6, 0xb0,
+    0xfc, 0x1c, 0xa3, 0xe9, 0x05, 0x42, 0x34, 0x41, 0x09, 0x6b, 0x68, 0xeb,
+    0xfa, 0x27, 0xc1, 0x45, 0x0e, 0xae, 0x1b, 0xcd, 0x08, 0x5f, 0xfd, 0x02,
+    0xfd, 0x8f, 0xd8, 0xe6, 0xb4, 0x55, 0x4e, 0xa8, 0xd8, 0x31, 0xb7, 0x63,
+    0x1a, 0xc8, 0x6f, 0xf3, 0x87, 0x5a, 0x8e, 0x48, 0xeb, 0x81, 0x39, 0xd7,
+    0xfb, 0x79, 0x6f, 0xa4, 0xf4, 0x1d, 0x79, 0x37, 0xd1, 0xd5, 0x87, 0xa0,
+    0x86, 0x94, 0x88, 0x87, 0xeb, 0x3d, 0xd8, 0xd3, 0xaf, 0x73, 0x34, 0x77,
+    0x8b, 0x5b, 0xff, 0xe0, 0xfc, 0x74, 0xcd, 0x44, 0xf8, 0x28, 0xa1, 0xd7,
+    0xfb, 0x8b, 0x8d, 0xfc, 0xed, 0x3a, 0xb1, 0x10, 0x48, 0x9f, 0x7c, 0x8b,
+    0x89, 0x8e, 0xbe, 0xc9, 0xc1, 0x23, 0xaa, 0x63, 0xc3, 0x64, 0x86, 0xf8,
+    0x01, 0x0c, 0x1d, 0x50, 0x78, 0xae, 0x49, 0x76, 0x32, 0x75, 0x15, 0x7f,
+    0x6b, 0xec, 0x72, 0x16, 0x55, 0x15, 0x45, 0x51, 0x54, 0x55, 0x48, 0xf8,
+    0x10, 0x2b, 0xf2, 0xe0, 0x05, 0x6d, 0x85, 0x6d, 0x05, 0x5d, 0xdc, 0x2a,
+    0xfe, 0x77, 0xf4, 0xd0, 0xb2, 0xbe, 0x16, 0xb6, 0x54, 0x95, 0x45, 0x51,
+    0x55, 0x22, 0xd1, 0x02, 0xa8, 0xaa, 0x2a, 0x8a, 0xa2, 0xa8, 0xaa, 0x2a,
+    0xa7, 0x37, 0x81, 0x0a, 0x40, 0xaf, 0xc2, 0xb4, 0x15, 0xb0, 0x2a, 0x8a,
+    0xa2, 0xaa, 0x45, 0xa6, 0x82, 0xa8, 0xaa, 0x2a, 0x8a, 0xa2, 0xaa, 0x46,
+    0xa3, 0xf0, 0xaf, 0x05, 0x6d, 0x05, 0x51, 0x54, 0x55, 0x15, 0x45, 0x54,
+    0xe6, 0xa1, 0x40, 0xae, 0x05, 0x74, 0x2a, 0xca, 0x15, 0x45, 0x51, 0x54,
+    0x55, 0x15, 0x41, 0x35, 0x1b, 0x85, 0x7e, 0x14, 0x00, 0xaa, 0x2a, 0x8a,
+    0xa2, 0xaf, 0xdd, 0x8f, 0xf5, 0x85, 0x51, 0x55, 0x23, 0xcf, 0x68, 0x57,
+    0x42, 0x9c, 0x2b, 0xf2, 0x7b, 0x34, 0xaa, 0x2a, 0x8a, 0xa2, 0xa8, 0xaa,
+    0x91, 0xa8, 0xdc, 0x29, 0x02, 0xb6, 0x05, 0x51, 0x54, 0x55, 0x15, 0x45,
+    0x54, 0x8d, 0x40, 0x42, 0xba, 0x14, 0x21, 0x56, 0xe9, 0x54, 0x55, 0x15,
+    0x69, 0x15, 0x45, 0x6e, 0x58, 0x51, 0x54, 0x55, 0x15, 0x45, 0x54, 0xe7,
+    0xcd, 0x20, 0xa5, 0x06, 0x9a, 0x35, 0x30, 0x57, 0xe1, 0x5e, 0x0a, 0xb6,
+    0x15, 0x45, 0x51, 0x56, 0x91, 0x54, 0x56, 0xe5, 0x85, 0x15, 0x45, 0x54,
+    0x1e, 0x94, 0x82, 0x90, 0x6b, 0x83, 0x4b, 0x0a, 0xa2, 0xa8, 0xaa, 0x2a,
+    0x8a, 0xa2, 0xaa, 0x0d, 0x96, 0xe1, 0x5c, 0x0a, 0x58, 0x50, 0x85, 0x51,
+    0x54, 0x55, 0x15, 0x5c, 0x2f, 0xb4, 0x15, 0xe0, 0xaa, 0x2a, 0x8a, 0xa2,
+    0xa9, 0x65, 0xf0, 0x85, 0x78, 0x2a, 0xcb, 0x2a, 0x8a, 0xa2, 0xab, 0xf2,
+    0xd0, 0x01, 0x54, 0x55, 0x15, 0x45, 0x51, 0x55, 0x06, 0xa2, 0x60, 0xae,
+    0x85, 0x00, 0x2a, 0xa1, 0x7e, 0xa6, 0x77, 0x19, 0x1e, 0x84, 0xa3, 0x16,
+    0xda, 0xd9, 0xba, 0x42, 0x33, 0xab, 0x9e, 0xcc, 0x73, 0xc8, 0x46, 0x2d,
+    0x27, 0xa7, 0x0e, 0xcb, 0xf9, 0xd0, 0xbb, 0x69, 0x9f, 0xcc, 0x20, 0x79,
+    0xd8, 0xca, 0xca, 0x5e, 0xd9, 0x67, 0xd2, 0x4d, 0xa4, 0x9b, 0xf4, 0x86,
+    0x33, 0x45, 0x30, 0x9a, 0xb5, 0xe4, 0x85, 0x95, 0x7c, 0x8d, 0x7e, 0x1d,
+    0x79, 0x03, 0x87, 0x59, 0x8d, 0xd1, 0x1b, 0xc3, 0x9e, 0x8d, 0x78, 0x82,
+    0xd1, 0xb1, 0x94, 0x8f, 0xf6, 0x94, 0x05, 0x7f, 0xba, 0x8c, 0x87, 0x91,
+    0x39, 0xd7, 0x93, 0x62, 0xa4, 0xea, 0xdd, 0x11, 0xd3, 0x1c, 0xf8, 0xd2,
+    0xfd, 0x99, 0x33, 0xfd, 0x3a, 0xef, 0xe0, 0xeb, 0xfb, 0x8e, 0x3f, 0x63,
+    0xf3, 0xae, 0x7e, 0x1d, 0x64, 0x39, 0xa5, 0xad, 0x9a, 0x75, 0x96, 0x75,
+    0xdb, 0x6c, 0x22, 0x25, 0xf8, 0x2d, 0xd4, 0x37, 0x1e, 0xfa, 0x21, 0x7f,
+    0xdd, 0x85, 0xe4, 0xd0, 0x33, 0x9d, 0x7f, 0xf7, 0xc7, 0x68, 0x7b, 0x1f,
+    0xe0, 0xfe, 0x75, 0xdf, 0xc1, 0xd5, 0x87, 0xb9, 0xfa, 0x35, 0x62, 0x62,
+    0x1f, 0xad, 0x02, 0x12, 0x97, 0xff, 0x08, 0xc4, 0xe3, 0x89, 0xb2, 0x36,
+    0xce, 0xbd, 0x1b, 0xe8, 0xea, 0x73, 0xe1, 0xd2, 0x2d, 0xe7, 0xe4, 0x1d,
+    0x7e, 0x4d, 0xb7, 0x1f, 0xce, 0xa9, 0x1e, 0x1a, 0xc6, 0xaf, 0xfb, 0xeb,
+    0x87, 0x58, 0xb8, 0x57, 0x3a, 0xf6, 0x6e, 0xc9, 0xd7, 0xb7, 0xff, 0x38,
+    0x7b, 0x22, 0x79, 0x7d, 0xb3, 0x39, 0x23, 0xaf, 0x05, 0xc4, 0xea, 0x43,
+    0x7a, 0xe4, 0x77, 0xff, 0xd1, 0xf1, 0xf9, 0xc7, 0xfe, 0x18, 0x65, 0x96,
+    0x4e, 0xa8, 0x4d, 0x81, 0xde, 0xf4, 0xe2, 0x01, 0xfa, 0x54, 0x37, 0x17,
+    0xb0, 0xe7, 0x3b, 0x7c, 0xa3, 0x25, 0x0c, 0x27, 0x72, 0x12, 0x6d, 0x86,
+    0xa6, 0xe7, 0x69, 0x29, 0x81, 0x5d, 0x16, 0x68, 0x5c, 0xf0, 0xdd, 0x70,
+    0xac, 0xec, 0x2a, 0x5e, 0x95, 0xeb, 0xf9, 0x90, 0xc7, 0x9f, 0xa8, 0x4b,
+    0xfa, 0x3c, 0x4b, 0xe4, 0x16, 0xc1, 0xd7, 0xf3, 0x2f, 0xce, 0x3e, 0xe7,
+    0x5f, 0xff, 0xb5, 0xce, 0x24, 0xda, 0xe4, 0x79, 0x1a, 0x81, 0x3a, 0x96,
+    0x8a, 0x21, 0x1f, 0x64, 0xba, 0xf9, 0x7e, 0x8d, 0x1d, 0x7f, 0xbd, 0x00,
+    0x6f, 0x53, 0x87, 0x5f, 0xd8, 0xde, 0xc6, 0xf2, 0x3a, 0xfe, 0x5e, 0x91,
+    0x4f, 0x32, 0x75, 0xfa, 0x37, 0xec, 0x48, 0xea, 0x14, 0x5a, 0xf8, 0xcb,
+    0xe9, 0x6e, 0xd1, 0x7d, 0xdb, 0xf8, 0xeb, 0xf7, 0x9c, 0x41, 0x87, 0x5f,
+    0xed, 0x62, 0xd3, 0xdd, 0x73, 0xad, 0x18, 0x7d, 0xa2, 0x2f, 0xe2, 0x5b,
+    0xe9, 0x7c, 0x5a, 0x1d, 0x7b, 0x6b, 0x90, 0x75, 0xfe, 0xe2, 0x4c, 0x39,
+    0xb1, 0xce, 0xbb, 0x7d, 0x7c, 0x3f, 0x48, 0x23, 0xe0, 0xf5, 0xff, 0x0c,
+    0x3c, 0xfd, 0x8e, 0x7e, 0x75, 0xcf, 0xb0, 0xeb, 0xfa, 0x42, 0x92, 0xee,
+    0x1d, 0x7e, 0x9d, 0x39, 0x12, 0x3a, 0xa6, 0x3e, 0x9e, 0x0b, 0x89, 0x5d,
+    0xf6, 0x05, 0x14, 0x3a, 0xff, 0xf3, 0xa7, 0xa3, 0xda, 0xeb, 0xa7, 0x40,
+    0x75, 0xf0, 0x88, 0x24, 0x75, 0xff, 0xbb, 0x1c, 0xfc, 0x71, 0x97, 0xfc,
+    0xeb, 0xd9, 0x93, 0x1d, 0x6c, 0xe9, 0xed, 0x7e, 0x7f, 0x7f, 0x03, 0x80,
+    0x5b, 0x89, 0xd7, 0xcb, 0x8c, 0x9c, 0xeb, 0xf6, 0x6c, 0x18, 0xdc, 0xea,
+    0x43, 0xc9, 0xd1, 0x0d, 0xf4, 0x0f, 0x9a, 0x75, 0xa0, 0x2a, 0xa4, 0x32,
+    0x14, 0x3c, 0x2f, 0xe9, 0x0b, 0xa3, 0x8b, 0xd6, 0x8a, 0x3c, 0xeb, 0xb6,
+    0x43, 0x7f, 0x6b, 0x16, 0x9d, 0x83, 0xaf, 0x6f, 0x2d, 0x1d, 0x5b, 0x9e,
+    0x47, 0x0a, 0xef, 0x6b, 0xf6, 0x4e, 0xa8, 0x3c, 0x1c, 0x23, 0xbe, 0x03,
+    0xf2, 0x47, 0x5f, 0x40, 0x15, 0x3a, 0x2a, 0xfd, 0x26, 0x19, 0x65, 0x93,
+    0xa8, 0x4f, 0x44, 0x04, 0xb7, 0xcf, 0xe5, 0xf8, 0xea, 0x0a, 0x2d, 0x31,
+    0xcb, 0xf2, 0x1a, 0x85, 0xf3, 0xec, 0x30, 0x48, 0x6b, 0x2e, 0x15, 0xcf,
+    0x0a, 0x6f, 0xe5, 0x66, 0x8c, 0x62, 0x60, 0x86, 0xa5, 0xe5, 0x65, 0x57,
+    0xaa, 0x0e, 0xbd, 0x21, 0x73, 0xad, 0xba, 0xb2, 0x78, 0xb0, 0x57, 0x7f,
+    0x47, 0x27, 0x8e, 0x4e, 0x75, 0xf8, 0x1f, 0xe0, 0xb4, 0xeb, 0xdc, 0x89,
+    0x8e, 0xbe, 0x41, 0x79, 0x8e, 0xbf, 0xde, 0xcf, 0xb1, 0x32, 0x68, 0xea,
+    0x92, 0x31, 0x78, 0x5c, 0xb2, 0x7e, 0x8e, 0x6c, 0x20, 0xbf, 0xe8, 0x4e,
+    0xc2, 0xe7, 0xc6, 0x4e, 0xbf, 0xa3, 0xa9, 0x3b, 0x89, 0xd7, 0xfd, 0x38,
+    0xe4, 0xbb, 0x9f, 0xe8, 0xeb, 0xff, 0x60, 0xef, 0x2d, 0x70, 0x11, 0xf9,
+    0xd7, 0xec, 0xf6, 0xb1, 0x43, 0xa9, 0x0f, 0x99, 0x67, 0xf7, 0x83, 0x1b,
+    0x0e, 0xbf, 0xfe, 0xc1, 0x18, 0x64, 0x23, 0x1b, 0xc9, 0x04, 0xeb, 0xff,
+    0xcf, 0xf2, 0x69, 0x47, 0x27, 0xf8, 0xce, 0x74, 0xea, 0x0a, 0x2e, 0x7a,
+    0x3a, 0x29, 0x97, 0xfc, 0xbe, 0xe7, 0xb0, 0x1c, 0x9c, 0xeb, 0xfe, 0x8f,
+    0x67, 0x1a, 0xee, 0xd3, 0x45, 0xf1, 0x7e, 0xce, 0x46, 0xf2, 0x3a, 0xf7,
+    0x61, 0x6d, 0x3e, 0xaf, 0x21, 0xdf, 0xff, 0x85, 0xbf, 0x3b, 0x09, 0xc4,
+    0x5a, 0x6d, 0xc2, 0xce, 0xbc, 0xfc, 0x9c, 0xd1, 0x7f, 0xd4, 0x22, 0xcf,
+    0x0c, 0xda, 0xaf, 0x7f, 0xff, 0xba, 0xfa, 0x48, 0xd7, 0xcf, 0x77, 0x17,
+    0x8d, 0x7e, 0x1d, 0x74, 0x6d, 0x1d, 0x7d, 0xad, 0x3a, 0xce, 0xae, 0xa2,
+    0x67, 0xf6, 0x0f, 0x0c, 0x5f, 0xff, 0xd2, 0x70, 0xb7, 0xa8, 0x39, 0xb1,
+    0xe5, 0xa4, 0x09, 0xd7, 0xfd, 0x0b, 0xf8, 0x1c, 0xcf, 0xf4, 0x75, 0xff,
+    0x26, 0x08, 0x54, 0x4c, 0xe1, 0xd4, 0x87, 0xe1, 0xb4, 0x75, 0x7f, 0x3f,
+    0x37, 0x96, 0x78, 0xeb, 0xff, 0x7b, 0x49, 0xcf, 0x08, 0x1e, 0x47, 0x5f,
+    0xfe, 0x5c, 0x6d, 0xe0, 0x07, 0x33, 0x64, 0x6e, 0x75, 0xff, 0xa3, 0x39,
+    0x9c, 0xfd, 0x69, 0xa3, 0xaf, 0x3e, 0xfb, 0x47, 0x5f, 0xcf, 0xed, 0x46,
+    0x4e, 0x75, 0x42, 0x67, 0xd8, 0x5a, 0x87, 0xa2, 0x99, 0xb0, 0xf5, 0x91,
+    0xfb, 0xfe, 0x04, 0x2f, 0x58, 0xb8, 0x57, 0x3a, 0xff, 0xed, 0x60, 0xfb,
+    0x5f, 0x76, 0x46, 0x6e, 0x75, 0xff, 0x33, 0xf6, 0x7d, 0x62, 0xe1, 0x5c,
+    0xeb, 0xc9, 0xd4, 0x3a, 0xfa, 0x5c, 0x0c, 0x8e, 0xbe, 0x5f, 0x92, 0x73,
+    0xab, 0x0f, 0x11, 0x08, 0xaf, 0xfe, 0xd9, 0xe5, 0x20, 0x65, 0x9d, 0x45,
+    0x9d, 0x74, 0xfe, 0x3a, 0xff, 0x6c, 0xeb, 0xca, 0x30, 0x4e, 0xa8, 0x3c,
+    0x9c, 0x17, 0xbf, 0xb1, 0x9f, 0xbd, 0x7f, 0x1d, 0x7f, 0xfe, 0xf7, 0xd9,
+    0x46, 0xc4, 0x1f, 0xf8, 0x90, 0xbc, 0x2a, 0xfb, 0xbf, 0x77, 0xf1, 0xd7,
+    0xec, 0x5e, 0x26, 0xc3, 0xaf, 0x4f, 0x32, 0xb9, 0xd5, 0x3a, 0x3c, 0xf0,
+    0xbd, 0xaa, 0xe8, 0x4a, 0x02, 0x7b, 0xbd, 0x87, 0x5f, 0xb8, 0x93, 0xba,
+    0xcd, 0x30, 0x9d, 0xf7, 0x81, 0x0e, 0x69, 0x84, 0xee, 0xfe, 0x0d, 0x40,
+    0x9d, 0xfe, 0x17, 0x53, 0xd1, 0xcf, 0xcd, 0x40, 0x9d, 0xfe, 0xd6, 0x75,
+    0x34, 0x09, 0xcd, 0x30, 0x9d, 0xd8, 0x13, 0x4c, 0x27, 0x73, 0x2c, 0x9e,
+    0x61, 0x3a, 0xc4, 0xd2, 0xf7, 0x34, 0x42, 0xd5, 0x91, 0xe9, 0x03, 0x62,
+    0x03, 0x24, 0x56, 0xf1, 0x66, 0x13, 0x30, 0x7c, 0xf6, 0x4d, 0xd3, 0xf7,
+    0x66, 0x3c, 0x7a, 0x85, 0xcc, 0xf4, 0x3f, 0xea, 0xf3, 0x90, 0x0c, 0x23,
+    0xb5, 0x18, 0x9f, 0xa5, 0x20, 0x5e, 0x1f, 0xd6, 0x75, 0xff, 0x40, 0x3c,
+    0x29, 0xb3, 0xea, 0xce, 0xbc, 0x39, 0xac, 0x3d, 0x7e, 0x0e, 0x5e, 0x0f,
+    0xf3, 0x1d, 0x50, 0xcc, 0xe4, 0x9e, 0x13, 0xe1, 0x86, 0xd6, 0x17, 0xb6,
+    0x35, 0x64, 0x86, 0x3c, 0xc6, 0x3c, 0x86, 0x57, 0x63, 0x62, 0x15, 0x7d,
+    0x1d, 0x7a, 0x74, 0x5b, 0x64, 0x33, 0x3e, 0x98, 0xdf, 0x83, 0x9c, 0x45,
+    0x0e, 0xbf, 0xbb, 0x1f, 0x47, 0x7f, 0xce, 0xbf, 0x7b, 0x26, 0x45, 0x9d,
+    0x7e, 0x8d, 0xff, 0xfe, 0x0e, 0xa8, 0x3d, 0x01, 0x27, 0xbf, 0x46, 0xc8,
+    0x1f, 0x1d, 0x7e, 0x4d, 0x9e, 0x49, 0xce, 0xbf, 0x3c, 0xbd, 0x8d, 0x3a,
+    0xfc, 0x39, 0xf7, 0x26, 0x3a, 0xff, 0xf6, 0x7f, 0xae, 0xa7, 0xcd, 0xe5,
+    0x19, 0x39, 0xd7, 0xfd, 0xd7, 0x5f, 0x52, 0x37, 0x91, 0xd7, 0xf7, 0xd1,
+    0x96, 0xdb, 0xce, 0x75, 0x49, 0x16, 0xe8, 0x9b, 0xf9, 0xc5, 0x4e, 0x9d,
+    0x28, 0x48, 0x1a, 0x4f, 0xc2, 0x91, 0x26, 0xf4, 0x37, 0xef, 0xfd, 0x8f,
+    0xd9, 0x90, 0x7b, 0x9b, 0x9d, 0x7f, 0x7f, 0x34, 0xa3, 0xda, 0x3a, 0xff,
+    0xff, 0xfd, 0x9d, 0xc1, 0xff, 0x07, 0xdd, 0xce, 0xc6, 0x4c, 0x9c, 0x9b,
+    0xa9, 0xbf, 0x8e, 0xbe, 0x18, 0xc6, 0x4e, 0xbe, 0x8d, 0xf4, 0xe7, 0x54,
+    0x36, 0x4b, 0xb3, 0xa6, 0x04, 0xe3, 0x29, 0xa1, 0xe9, 0x0f, 0x25, 0x72,
+    0x77, 0x94, 0x4a, 0x2b, 0xbe, 0x3d, 0x01, 0x7e, 0xc8, 0x41, 0x7d, 0x20,
+    0xbf, 0xfe, 0x41, 0xc5, 0xc7, 0xd1, 0x04, 0x87, 0x16, 0x75, 0xff, 0x05,
+    0x30, 0x41, 0x2c, 0xd1, 0xd7, 0xfd, 0xd4, 0x97, 0x5e, 0x48, 0xb3, 0xaf,
+    0xfd, 0xa4, 0x1d, 0xe5, 0xe4, 0xd2, 0x1d, 0x58, 0x7e, 0x9e, 0x37, 0xbf,
+    0x69, 0x70, 0x18, 0x3a, 0xa4, 0x99, 0xf6, 0x26, 0xae, 0x15, 0x5e, 0x21,
+    0xbe, 0x18, 0xe4, 0x8e, 0xbf, 0xee, 0xc4, 0x90, 0x44, 0x1b, 0x9d, 0x7f,
+    0xd1, 0x9e, 0xfb, 0xff, 0xf1, 0xb9, 0xd6, 0xe4, 0x22, 0x4f, 0x08, 0x16,
+    0x6f, 0x7f, 0xff, 0xfb, 0xae, 0x9e, 0x90, 0x07, 0xda, 0xeb, 0xcb, 0xe8,
+    0xc3, 0x79, 0x12, 0x3a, 0xff, 0xda, 0xfb, 0xe4, 0x10, 0x4b, 0x34, 0x75,
+    0x2b, 0xa2, 0xdb, 0xae, 0xf7, 0xff, 0xf6, 0x6f, 0x9a, 0x71, 0xea, 0x47,
+    0xba, 0x07, 0x59, 0xd5, 0x09, 0xb4, 0x3c, 0x3a, 0x84, 0x9a, 0xfe, 0x10,
+    0x2d, 0x3b, 0x07, 0x5f, 0xff, 0x9c, 0x7c, 0xef, 0xd1, 0x8f, 0x69, 0x9c,
+    0xe9, 0xd7, 0xfe, 0x9d, 0xc7, 0x5e, 0xea, 0x46, 0x8e, 0xbf, 0xe8, 0xff,
+    0x41, 0x03, 0xf2, 0x47, 0x5e, 0xe6, 0xb4, 0x78, 0x80, 0xef, 0x9a, 0xee,
+    0xd3, 0x44, 0x06, 0xc1, 0xa9, 0xbf, 0xb9, 0x1d, 0x8f, 0x99, 0x24, 0x50,
+    0x71, 0x8a, 0x9d, 0x32, 0x3f, 0xb0, 0xdd, 0xaf, 0xd3, 0x9f, 0xf4, 0x6e,
+    0xb7, 0xb6, 0x47, 0x4e, 0xac, 0x54, 0x24, 0x91, 0xe5, 0x7d, 0x2b, 0xbd,
+    0xd7, 0x57, 0x3a, 0xfa, 0x3f, 0xdb, 0xc3, 0xab, 0xf3, 0xc2, 0xf0, 0xf5,
+    0xf0, 0xfb, 0xf0, 0x1d, 0x7e, 0x5a, 0xb2, 0xac, 0xab, 0x2a, 0xc1, 0xd7,
+    0xff, 0xf4, 0xb3, 0x49, 0xce, 0x22, 0xfe, 0xfb, 0xb8, 0xcf, 0x8e, 0xac,
+    0x45, 0xda, 0x11, 0x39, 0xe5, 0xff, 0xe6, 0x70, 0x7d, 0x83, 0x2c, 0xd7,
+    0xd5, 0x9d, 0x7f, 0xfa, 0x59, 0xbc, 0xbe, 0xc7, 0xec, 0x32, 0xcb, 0x25,
+    0x5f, 0x96, 0xce, 0x26, 0xc3, 0xaf, 0x4b, 0x06, 0x63, 0xfb, 0xfa, 0xa5,
+    0x50, 0x8f, 0xa7, 0x86, 0x2d, 0x42, 0xa2, 0xbe, 0xc3, 0x78, 0x63, 0x27,
+    0xbf, 0xe4, 0x19, 0x69, 0x5a, 0xab, 0x0a, 0xca, 0xb0, 0x75, 0xf4, 0xda,
+    0xc9, 0x8e, 0xbf, 0x7f, 0x1e, 0xc5, 0x73, 0xaf, 0xf4, 0x67, 0x1a, 0xee,
+    0xd3, 0x44, 0x13, 0x7f, 0xd1, 0xec, 0xe3, 0x5d, 0xda, 0x68, 0xbe, 0x6f,
+    0x0e, 0x68, 0x28, 0x80, 0x69, 0xed, 0x0a, 0x37, 0x76, 0x42, 0xaa, 0xff,
+    0xe8, 0xea, 0x29, 0x9c, 0x9d, 0x60, 0xdc, 0xea, 0xc4, 0xdb, 0xd2, 0x30,
+    0x0e, 0x94, 0xdf, 0xe0, 0x77, 0x6f, 0xa8, 0xde, 0x9d, 0x7f, 0xe9, 0xdf,
+    0x7d, 0xbc, 0xf0, 0xbe, 0xc3, 0xaf, 0xff, 0xb3, 0xd0, 0x3e, 0xd6, 0x62,
+    0x8a, 0x3c, 0x8e, 0xbf, 0xf6, 0x06, 0x25, 0x1d, 0xcf, 0xdc, 0xeb, 0xf9,
+    0xe4, 0x09, 0x38, 0x4e, 0xbc, 0xcb, 0x2c, 0x95, 0x7e, 0xee, 0x35, 0xf8,
+    0x53, 0x05, 0xfd, 0xff, 0xfe, 0x9b, 0x91, 0xb3, 0xe2, 0x8f, 0xf3, 0xec,
+    0xda, 0xf9, 0x9b, 0xf8, 0xea, 0xf2, 0x29, 0x7e, 0x9b, 0x5f, 0xfe, 0x4e,
+    0x27, 0x81, 0x9e, 0x75, 0xe0, 0x9d, 0x53, 0xaa, 0x28, 0x6a, 0x1a, 0xd3,
+    0xbf, 0x3c, 0x18, 0x78, 0x78, 0x96, 0xff, 0xcb, 0x8d, 0xf4, 0x39, 0x3f,
+    0xd9, 0x1d, 0x7f, 0xff, 0x93, 0xae, 0x3b, 0xcb, 0xec, 0xa0, 0x64, 0xeb,
+    0xc0, 0x9d, 0x7f, 0xfb, 0x33, 0xa1, 0xec, 0x6b, 0x3a, 0x9f, 0x9d, 0x7f,
+    0x94, 0xf9, 0x34, 0xa3, 0x9a, 0x3a, 0xa7, 0x4c, 0x82, 0x48, 0x21, 0x60,
+    0x44, 0x8b, 0xf9, 0x5f, 0x25, 0xd8, 0xe1, 0xd7, 0xfb, 0xd0, 0x9d, 0x52,
+    0x37, 0x3a, 0xff, 0xf6, 0xe3, 0xf1, 0xbd, 0x4f, 0xff, 0x8e, 0x48, 0xea,
+    0x84, 0x58, 0x21, 0x7f, 0xd3, 0x3b, 0xe5, 0x7d, 0x4b, 0x61, 0xd7, 0xff,
+    0xa2, 0x7f, 0xbd, 0x8d, 0xfd, 0x93, 0x88, 0x4e, 0xa7, 0x3f, 0x41, 0x27,
+    0xbf, 0xd1, 0x83, 0xe5, 0x43, 0x2d, 0x3a, 0xff, 0x77, 0x36, 0x7c, 0xd4,
+    0x9a, 0x75, 0x81, 0xa3, 0xed, 0xf1, 0xb5, 0xfe, 0x71, 0xf9, 0xf7, 0x9d,
+    0x73, 0xaf, 0xd9, 0xc7, 0xdd, 0x93, 0xaf, 0xff, 0xf4, 0xf8, 0xc8, 0xe0,
+    0x78, 0x80, 0x9c, 0x3d, 0x81, 0x9c, 0xea, 0x9d, 0x11, 0x5a, 0x28, 0xbc,
+    0xcb, 0x2c, 0x95, 0x7f, 0xbe, 0xff, 0x03, 0x9b, 0xf8, 0xa6, 0x0b, 0xfb,
+    0xff, 0xf9, 0x53, 0xf1, 0xbd, 0x40, 0x87, 0x19, 0xf9, 0xed, 0x64, 0xe7,
+    0x57, 0x51, 0x54, 0x04, 0x5a, 0x44, 0xc4, 0x1e, 0x1d, 0xb5, 0x3b, 0x28,
+    0x2e, 0x51, 0xde, 0x04, 0xd5, 0x25, 0x2f, 0x72, 0x37, 0xf5, 0xc3, 0xbb,
+    0xb0, 0xa4, 0x18, 0x46, 0xe8, 0xa3, 0xd1, 0xe7, 0xdf, 0xfb, 0x10, 0x67,
+    0x71, 0xf6, 0x2c, 0xeb, 0xff, 0x75, 0x19, 0x0f, 0x73, 0xdb, 0x78, 0x75,
+    0xec, 0x1f, 0xce, 0xbe, 0xcf, 0x4d, 0x23, 0xaf, 0xfe, 0xda, 0x18, 0xda,
+    0xd3, 0x8f, 0xdf, 0xf4, 0x75, 0x74, 0xfb, 0x5c, 0x8a, 0xff, 0xd9, 0xe8,
+    0xe6, 0xbb, 0x03, 0xe3, 0xc4, 0x11, 0x7f, 0xa3, 0x38, 0xd7, 0x76, 0x9a,
+    0x20, 0x86, 0x0f, 0x26, 0xfe, 0x7e, 0xf3, 0x88, 0xc9, 0xd7, 0xf2, 0xb8,
+    0x59, 0x71, 0x91, 0xd4, 0x27, 0xba, 0x02, 0xdb, 0xff, 0xf4, 0x06, 0x69,
+    0x20, 0xfa, 0x3f, 0x98, 0x52, 0x63, 0xa9, 0x45, 0x42, 0xbd, 0x84, 0x47,
+    0xed, 0x43, 0x0a, 0xcd, 0x84, 0x37, 0xf7, 0x73, 0xde, 0x45, 0x9d, 0x7f,
+    0x7b, 0xee, 0x75, 0xf7, 0x3a, 0xb7, 0x3d, 0xb1, 0x2c, 0xbf, 0xfd, 0xad,
+    0x0b, 0xf9, 0xd7, 0xf6, 0x27, 0xc3, 0xaa, 0x0f, 0xb0, 0x04, 0x57, 0xf6,
+    0x37, 0xee, 0xce, 0xe1, 0xd7, 0x42, 0x87, 0x5e, 0x0a, 0x09, 0xd7, 0x84,
+    0x13, 0x9d, 0x7e, 0xeb, 0xcb, 0x04, 0xeb, 0xf9, 0x3c, 0x39, 0xd4, 0x3a,
+    0xec, 0xef, 0xc3, 0xcf, 0x82, 0x5b, 0x9d, 0x9f, 0x88, 0xc9, 0xc1, 0x6e,
+    0x8d, 0x79, 0xae, 0xa4, 0x9b, 0x26, 0x10, 0x8c, 0x3e, 0x6f, 0xff, 0xef,
+    0x77, 0x35, 0xac, 0xc0, 0x72, 0x7c, 0x00, 0xf8, 0xeb, 0xfe, 0xec, 0x73,
+    0xc3, 0x19, 0xb9, 0xd7, 0xff, 0xfc, 0x93, 0xc4, 0xb5, 0xce, 0x26, 0xf3,
+    0x49, 0xf8, 0xbc, 0xdc, 0xeb, 0xdd, 0xc1, 0x0a, 0x28, 0x3a, 0x6f, 0x48,
+    0x99, 0x6f, 0xa1, 0xf5, 0x7f, 0xe6, 0xf6, 0x33, 0x92, 0xd0, 0x16, 0x75,
+    0xc9, 0xa3, 0xaf, 0xfb, 0x27, 0x7f, 0x7f, 0xf4, 0x64, 0x75, 0xfd, 0xf5,
+    0x7a, 0x65, 0xf7, 0x3a, 0xa1, 0x1c, 0xf8, 0x50, 0xa1, 0xf7, 0x05, 0x7c,
+    0x77, 0x7b, 0x99, 0xd3, 0xaf, 0x69, 0x16, 0x75, 0xa3, 0x86, 0xdb, 0xc3,
+    0x77, 0xc9, 0x32, 0x32, 0x75, 0xff, 0xcb, 0x7d, 0xfe, 0xf9, 0x39, 0x00,
+    0x54, 0x9d, 0x7f, 0xfe, 0x04, 0xe3, 0x19, 0xd6, 0x23, 0xd9, 0xd0, 0x70,
+    0xeb, 0xef, 0x6b, 0xee, 0x82, 0x8c, 0x1c, 0x22, 0xfa, 0x95, 0x7e, 0xd2,
+    0xf3, 0xda, 0x3a, 0xfc, 0xf2, 0x14, 0x83, 0xaf, 0xe8, 0x71, 0xf6, 0x09,
+    0xd5, 0x24, 0xe9, 0xb2, 0x1c, 0xe8, 0x96, 0xb2, 0x71, 0x24, 0xbf, 0x9b,
+    0xd4, 0xdb, 0x45, 0x0e, 0xbf, 0xfc, 0x9f, 0xc6, 0x97, 0x09, 0xce, 0x23,
+    0x27, 0x5f, 0x2b, 0xf7, 0x27, 0x3a, 0xff, 0x40, 0x73, 0xc9, 0xd0, 0x1d,
+    0x65, 0xc1, 0xeb, 0x04, 0x96, 0xff, 0xff, 0xcb, 0x71, 0xfe, 0x49, 0xa0,
+    0x2f, 0xa9, 0x1e, 0xe8, 0x1d, 0x67, 0x5f, 0xff, 0x08, 0x3d, 0x24, 0xff,
+    0xae, 0x9e, 0x75, 0x9d, 0x77, 0xc5, 0x73, 0xaf, 0xff, 0xce, 0x9e, 0x40,
+    0xe0, 0x73, 0xc8, 0xb4, 0xe1, 0xd7, 0xb8, 0xfa, 0xc4, 0x5d, 0x71, 0x3b,
+    0xa3, 0x77, 0x27, 0x9d, 0x36, 0x50, 0x46, 0x4b, 0x74, 0xa0, 0xeb, 0xff,
+    0xd3, 0x87, 0xb1, 0xdc, 0xdf, 0xfc, 0xf6, 0x8e, 0xa7, 0x3e, 0x10, 0x0a,
+    0xd0, 0x55, 0x88, 0xe1, 0x82, 0x42, 0x7d, 0xe3, 0x8c, 0x18, 0x4a, 0xdf,
+    0xdc, 0x89, 0xd0, 0x7c, 0x75, 0xe0, 0xfd, 0x59, 0xd7, 0xe1, 0x80, 0xe4,
+    0xc7, 0x5f, 0x68, 0x1c, 0x50, 0xeb, 0xf4, 0x77, 0xd1, 0x23, 0xaf, 0x82,
+    0x0f, 0x6a, 0x0f, 0xbf, 0x72, 0x6f, 0xc8, 0xef, 0xdf, 0xe2, 0xe3, 0xa7,
+    0x5e, 0x54, 0xf7, 0x0e, 0xa0, 0xa6, 0x8f, 0x85, 0x89, 0x08, 0xd1, 0x48,
+    0x01, 0x3d, 0xee, 0x7d, 0xd1, 0xd7, 0x42, 0xb4, 0x3a, 0xff, 0xce, 0x2d,
+    0xce, 0x35, 0xdd, 0xa6, 0x88, 0x46, 0xe9, 0x4e, 0x75, 0x42, 0x26, 0x3f,
+    0x1e, 0x00, 0xde, 0xc4, 0x8b, 0xff, 0xff, 0xdd, 0xc0, 0x71, 0x4e, 0xa6,
+    0xf1, 0xe0, 0x74, 0x73, 0x7f, 0x01, 0xf4, 0x75, 0xff, 0xd9, 0xbf, 0xdf,
+    0x20, 0x82, 0x59, 0xa3, 0xaf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xd8, 0x33,
+    0x8b, 0x86, 0x06, 0x78, 0xe0, 0x70, 0x73, 0xda, 0x46, 0xe0, 0xfd, 0x9f,
+    0x39, 0x1a, 0x17, 0x53, 0x58, 0x9f, 0xfe, 0x0f, 0xc5, 0xc3, 0x03, 0x3c,
+    0x70, 0xea, 0x84, 0xd3, 0xf1, 0x16, 0xff, 0xef, 0x38, 0xcf, 0xbc, 0x86,
+    0x33, 0x47, 0x5f, 0xfb, 0xee, 0x75, 0xd6, 0xc3, 0x2c, 0xb2, 0x75, 0xff,
+    0xfb, 0x1b, 0xd8, 0x10, 0x8a, 0x4f, 0x82, 0x8a, 0x1d, 0x73, 0xbc, 0xe8,
+    0x96, 0x92, 0x25, 0xff, 0xfd, 0x30, 0xc7, 0xfa, 0x6f, 0x53, 0x93, 0x0c,
+    0x7f, 0xa3, 0xaf, 0xfe, 0xf7, 0x53, 0x67, 0x5e, 0x5c, 0x85, 0x0e, 0xbf,
+    0x81, 0xe4, 0x00, 0xa8, 0x75, 0xfd, 0x8c, 0xe0, 0x83, 0xf3, 0xaf, 0xd2,
+    0xcf, 0x47, 0xe7, 0x5d, 0x0b, 0x9c, 0xf5, 0x37, 0x2d, 0xbf, 0xff, 0xfb,
+    0xf5, 0xbc, 0xba, 0xe9, 0xe4, 0x0e, 0x07, 0x3c, 0x8b, 0x4e, 0x1d, 0x5a,
+    0x44, 0xf0, 0x0b, 0xef, 0xd3, 0xae, 0x03, 0x07, 0x54, 0x97, 0x3f, 0x43,
+    0x1e, 0x46, 0xe4, 0x53, 0x43, 0x67, 0x85, 0xdd, 0x5d, 0xd2, 0x37, 0xa3,
+    0x1f, 0xfa, 0x47, 0x7f, 0xa3, 0x5a, 0x89, 0xf1, 0x93, 0xaf, 0xf7, 0x71,
+    0x79, 0xd0, 0x09, 0xd4, 0x13, 0xe4, 0xf1, 0x9d, 0x62, 0x63, 0x8f, 0x0f,
+    0xab, 0xcc, 0xb2, 0xc9, 0x57, 0xfd, 0x9f, 0xbf, 0x33, 0x66, 0x04, 0xa6,
+    0x0b, 0xfb, 0x99, 0x64, 0xab, 0xcc, 0xb2, 0xc9, 0x57, 0xf3, 0xce, 0x1e,
+    0xc6, 0x8a, 0x60, 0xbf, 0xa1, 0x45, 0xeb, 0x29, 0x3b, 0x66, 0xf7, 0xe6,
+    0xa0, 0x7e, 0xac, 0xa6, 0x0d, 0x9d, 0xe6, 0x59, 0x64, 0xab, 0xda, 0x8e,
+    0x14, 0xc1, 0x7f, 0x7c, 0xe3, 0xbf, 0x8e, 0xb7, 0xe8, 0x8a, 0x5f, 0x2c,
+    0xb2, 0x57, 0x7f, 0x04, 0x62, 0x4e, 0xd3, 0xaf, 0xda, 0x04, 0xfb, 0x62,
+    0x75, 0xf8, 0x29, 0xb2, 0x02, 0x75, 0xf6, 0x0e, 0x2b, 0x9d, 0x5c, 0x3c,
+    0xa5, 0x94, 0x52, 0x22, 0x5f, 0xeb, 0xad, 0xff, 0xdd, 0x79, 0x0b, 0xa9,
+    0x30, 0xa4, 0xc7, 0x5f, 0xfd, 0x9c, 0x9e, 0x37, 0xd2, 0x0e, 0x7e, 0x75,
+    0xfd, 0xdc, 0xd9, 0x9e, 0xd1, 0xd4, 0xd4, 0x5b, 0x7e, 0x89, 0xe4, 0x4a,
+    0xe2, 0x79, 0xbd, 0x86, 0x10, 0xc3, 0x6a, 0xe9, 0xfc, 0x75, 0x42, 0xa5,
+    0x5c, 0x94, 0x08, 0x27, 0x57, 0xb7, 0x56, 0xaa, 0xc1, 0xd7, 0xff, 0xb1,
+    0x5d, 0xc7, 0xfc, 0x6c, 0x76, 0x16, 0x75, 0xf6, 0xba, 0x93, 0x15, 0x7f,
+    0xcf, 0xbf, 0xb2, 0x60, 0x71, 0x43, 0xac, 0xd4, 0x3d, 0xd0, 0x11, 0x5f,
+    0xe1, 0xcd, 0xe5, 0xa4, 0x50, 0xeb, 0xe7, 0x7e, 0x28, 0x75, 0x7c, 0x3d,
+    0x49, 0xcc, 0xef, 0xfb, 0x31, 0xbf, 0xc6, 0x6f, 0x23, 0xaf, 0xa1, 0xd7,
+    0xb0, 0xab, 0xff, 0xba, 0x8f, 0xff, 0xf1, 0xfc, 0x77, 0x47, 0x5f, 0xdd,
+    0xc5, 0xad, 0xe4, 0x75, 0xe6, 0x59, 0x64, 0xab, 0xfc, 0x3e, 0xea, 0x40,
+    0xce, 0x53, 0x05, 0xfd, 0xe8, 0xff, 0x24, 0x88, 0xcc, 0x4b, 0xaf, 0x26,
+    0x09, 0xf6, 0x1a, 0x36, 0xc6, 0xa6, 0xa2, 0xb8, 0xc9, 0xaf, 0xf4, 0x7d,
+    0xe7, 0x13, 0xda, 0x3a, 0xa1, 0x5a, 0xdc, 0x8a, 0x37, 0x85, 0x3a, 0x3d,
+    0xcc, 0x4b, 0xd8, 0xe2, 0x44, 0xbe, 0xfd, 0xfe, 0x27, 0x54, 0x3a, 0xff,
+    0xfb, 0x1b, 0x02, 0xfe, 0xd0, 0x40, 0xfc, 0x91, 0xd5, 0xb9, 0xfa, 0xac,
+    0xa2, 0xf3, 0x63, 0x47, 0x5f, 0xfd, 0xf6, 0x59, 0xd7, 0xea, 0x73, 0x90,
+    0x75, 0x61, 0xef, 0xfe, 0x37, 0x7e, 0x8f, 0x6b, 0x66, 0x1d, 0x7e, 0x07,
+    0x14, 0xea, 0x1d, 0x50, 0x8f, 0x41, 0x84, 0x17, 0x88, 0xb6, 0xca, 0x2f,
+    0xff, 0x93, 0x66, 0x08, 0x45, 0xd9, 0xc1, 0x75, 0x0e, 0xbf, 0xff, 0xe0,
+    0xf5, 0x19, 0xcd, 0xa4, 0x5b, 0xfb, 0x40, 0x96, 0x6f, 0xe3, 0xab, 0x11,
+    0x70, 0xe9, 0xd7, 0xfd, 0x33, 0x7a, 0x8b, 0x8e, 0x28, 0x75, 0xfa, 0x7f,
+    0x80, 0x89, 0x8e, 0xb4, 0x8e, 0xbd, 0xf4, 0x66, 0x3a, 0xa4, 0x6b, 0xbf,
+    0x10, 0xac, 0x45, 0xab, 0x9d, 0x69, 0x66, 0xa1, 0xd9, 0xbc, 0x4f, 0x28,
+    0xf6, 0x52, 0x91, 0x43, 0x2a, 0x97, 0x29, 0x48, 0xca, 0x42, 0xd9, 0xa7,
+    0x69, 0x29, 0x5a, 0x69, 0x50, 0x9c, 0x94, 0x90, 0xb9, 0x44, 0xbd, 0x96,
+    0xbc, 0xf1, 0xcf, 0xff, 0x0e, 0x51, 0x9e, 0x58, 0xd4, 0xe1, 0x87, 0xa5,
+    0xc8, 0x82, 0x3d, 0x96, 0x61, 0xf7, 0xf6, 0x1a, 0xd7, 0xb6, 0x40, 0x9d,
+    0x7f, 0xfd, 0x82, 0xc7, 0x94, 0x4d, 0xf5, 0xdc, 0xfd, 0xce, 0xa9, 0x1f,
+    0x68, 0x47, 0x2f, 0xf3, 0x8b, 0x73, 0xdd, 0x43, 0xab, 0x73, 0xd2, 0x59,
+    0x15, 0x95, 0xa1, 0xd7, 0xfe, 0x71, 0xff, 0xe0, 0x40, 0xfc, 0x91, 0xd7,
+    0xc8, 0x33, 0xc1, 0xd4, 0xae, 0x7c, 0x1c, 0x40, 0xa5, 0x5e, 0x89, 0xbc,
+    0x76, 0xbd, 0x03, 0x39, 0xd7, 0xc9, 0xd4, 0x59, 0xd6, 0xea, 0x1b, 0xb9,
+    0x86, 0xef, 0xe8, 0x6c, 0x6b, 0xc8, 0x75, 0xff, 0x47, 0xba, 0xff, 0xbe,
+    0xfa, 0x3a, 0x82, 0x7c, 0x82, 0x57, 0x7f, 0xee, 0x7f, 0xf3, 0xa8, 0xd0,
+    0x73, 0xf3, 0xaf, 0x4c, 0x0e, 0x1d, 0x7f, 0xe7, 0x4e, 0x66, 0xec, 0x32,
+    0xcb, 0x27, 0x54, 0x22, 0x89, 0xd0, 0xf4, 0x3b, 0x7f, 0xfc, 0x31, 0x2f,
+    0x9f, 0x7c, 0x82, 0x09, 0x66, 0x8e, 0xac, 0x4f, 0x35, 0xb0, 0x8b, 0xec,
+    0x30, 0xff, 0x2e, 0xbf, 0xd0, 0x32, 0x1c, 0xcf, 0xce, 0xbf, 0xb3, 0x9a,
+    0x18, 0x9c, 0xeb, 0xf9, 0xfd, 0xd7, 0x1f, 0xce, 0xbf, 0xf3, 0xfb, 0x26,
+    0x78, 0x18, 0x98, 0xeb, 0x27, 0x0f, 0xa3, 0xa5, 0x97, 0x35, 0xa6, 0x8c,
+    0x12, 0xa4, 0x8d, 0xe6, 0xc2, 0x53, 0xf2, 0x7b, 0xb0, 0x4e, 0xbf, 0xfd,
+    0xe8, 0x16, 0xe7, 0xba, 0x9c, 0xfd, 0xa7, 0x50, 0x4f, 0x77, 0x05, 0x2f,
+    0xf4, 0x2f, 0x5a, 0x71, 0x9c, 0xeb, 0xed, 0x60, 0xf8, 0xeb, 0xdb, 0x51,
+    0xc3, 0xa9, 0xcd, 0xf0, 0x08, 0x2f, 0x79, 0xd5, 0xce, 0xbf, 0xde, 0xea,
+    0x31, 0xfb, 0xa1, 0xd4, 0x14, 0xc0, 0xba, 0x42, 0x2e, 0x1e, 0x20, 0x00,
+    0xf5, 0xf7, 0x51, 0xe4, 0x75, 0xe0, 0xbc, 0x8e, 0xb8, 0x1f, 0xc1, 0xbb,
+    0xc2, 0x0b, 0xfe, 0x6e, 0x7a, 0x36, 0x20, 0xfe, 0x75, 0xff, 0xfc, 0x08,
+    0xf6, 0xb0, 0x7e, 0x72, 0x10, 0x22, 0xf2, 0x3a, 0xfc, 0xde, 0xee, 0xea,
+    0xe7, 0x5f, 0xfc, 0x81, 0x10, 0x7b, 0x50, 0x31, 0xa3, 0xa9, 0x11, 0xfc,
+    0x27, 0x20, 0x59, 0xd8, 0x57, 0x7f, 0xf7, 0xef, 0xcc, 0xd9, 0x81, 0xe0,
+    0xb2, 0x75, 0xff, 0xfc, 0x39, 0xa0, 0x7c, 0xce, 0xb8, 0xe4, 0xd2, 0x8d,
+    0xce, 0xbf, 0x71, 0xae, 0xed, 0x34, 0x40, 0xd7, 0xf3, 0xcf, 0xfb, 0x88,
+    0x49, 0x58, 0x3e, 0xf6, 0x68, 0x18, 0x7d, 0xdb, 0x66, 0x77, 0xba, 0xf2,
+    0xf8, 0x8f, 0xe1, 0x86, 0x4d, 0x2d, 0x37, 0xef, 0x46, 0x89, 0x7f, 0xc3,
+    0xff, 0x92, 0x75, 0xc3, 0x4e, 0xbf, 0x05, 0x5b, 0x70, 0xab, 0x67, 0x54,
+    0x2a, 0x4f, 0xc8, 0xee, 0xd0, 0xa9, 0xce, 0x6f, 0xf6, 0x6f, 0xe0, 0xe6,
+    0x28, 0x75, 0xfd, 0x9e, 0x81, 0x4f, 0xce, 0xbc, 0xfc, 0x9c, 0xd1, 0x82,
+    0xdf, 0xf9, 0xf9, 0x83, 0xfe, 0xbd, 0xad, 0xce, 0xbf, 0xff, 0xff, 0xb3,
+    0xdd, 0x71, 0x53, 0xe6, 0xb8, 0xef, 0xed, 0x98, 0x1f, 0x98, 0xb7, 0x1d,
+    0xe4, 0x78, 0x82, 0xef, 0xfc, 0xee, 0xa3, 0x5c, 0x3f, 0x14, 0x64, 0xf1,
+    0x05, 0xdf, 0xfd, 0xd4, 0xea, 0x40, 0xfb, 0xe2, 0x8c, 0x9e, 0x20, 0xbb,
+    0xfd, 0x08, 0x3e, 0xf8, 0xa3, 0x27, 0x88, 0x2e, 0xfe, 0x5e, 0x07, 0xe2,
+    0x8c, 0x9e, 0x20, 0xbb, 0xff, 0xfe, 0x71, 0x14, 0x5f, 0xcd, 0x37, 0xa9,
+    0xc4, 0x52, 0x7c, 0x64, 0xf1, 0x05, 0xdd, 0xbf, 0xc0, 0xa7, 0x2e, 0xd4,
+    0xfe, 0x29, 0xba, 0x10, 0x9f, 0x54, 0x2a, 0xc8, 0xe9, 0xf8, 0xca, 0x31,
+    0xbf, 0xc9, 0x0a, 0x6b, 0xda, 0xdc, 0xeb, 0xe7, 0xe7, 0xee, 0x75, 0xff,
+    0xdd, 0x4e, 0xa4, 0x0f, 0xbe, 0x28, 0xc9, 0xe2, 0x0b, 0xbf, 0xe9, 0xb4,
+    0xd4, 0x9f, 0xe2, 0x8c, 0x9e, 0x20, 0xbb, 0xf7, 0xb5, 0x0b, 0xf8, 0xd4,
+    0x4f, 0xfd, 0x53, 0xbf, 0xfd, 0xf1, 0xbd, 0x46, 0xc7, 0xb5, 0xf1, 0x46,
+    0x4f, 0x10, 0x5d, 0xff, 0xff, 0xc2, 0x28, 0xbf, 0x80, 0xcf, 0x9a, 0x6f,
+    0x53, 0x88, 0xa4, 0xf8, 0xc9, 0xe2, 0x0b, 0xac, 0x4c, 0x93, 0x74, 0x47,
+    0x5d, 0xbf, 0xee, 0xa7, 0x11, 0x49, 0xf1, 0x93, 0xc4, 0x17, 0x7f, 0xfc,
+    0xef, 0xbc, 0xb5, 0xd4, 0x08, 0x63, 0x90, 0x55, 0xff, 0xb2, 0x52, 0x06,
+    0xb8, 0x33, 0xed, 0x9e, 0x20, 0xba, 0x6a, 0x39, 0x38, 0x8f, 0xa4, 0xeb,
+    0xff, 0x35, 0x39, 0xe7, 0xff, 0x5f, 0x19, 0x3c, 0x41, 0x77, 0xf7, 0x53,
+    0xbd, 0x4f, 0xcd, 0x00, 0x5d, 0xfb, 0x3f, 0xf8, 0xa3, 0x27, 0x88, 0x2e,
+    0xec, 0xf3, 0x4f, 0xcf, 0xa7, 0x55, 0xba, 0x3b, 0xf5, 0x0c, 0x2b, 0xf9,
+    0x78, 0x1f, 0x8a, 0x32, 0x78, 0x82, 0xef, 0xfc, 0xde, 0xa7, 0x11, 0x49,
+    0xf1, 0x93, 0xc4, 0x17, 0x76, 0x7c, 0x74, 0x45, 0xe8, 0xfa, 0xff, 0x01,
+    0x16, 0xe3, 0xbc, 0x8f, 0x10, 0x5d, 0xff, 0xb1, 0x36, 0x60, 0xe0, 0x5e,
+    0x47, 0x88, 0x2d, 0x66, 0xfe, 0x82, 0xbb, 0xfb, 0xc3, 0x7f, 0xcd, 0x06,
+    0x3e, 0x4d, 0x46, 0x29, 0xe8, 0xc7, 0xc1, 0x0b, 0x46, 0x5b, 0xae, 0xfe,
+    0x0d, 0x10, 0x5b, 0x08, 0x8c, 0xb9, 0xda, 0x75, 0xb4, 0xd6, 0x4e, 0x2f,
+    0xf4, 0x97, 0xaf, 0x1b, 0x5d, 0x2d, 0xa3, 0xaf, 0x44, 0xb6, 0x8e, 0xa8,
+    0x36, 0xe2, 0x33, 0x53, 0xb2, 0xaf, 0x42, 0x67, 0xfd, 0x27, 0xc0, 0x5e,
+    0xef, 0xfe, 0xc9, 0x0e, 0x7b, 0xa9, 0x9b, 0xf8, 0xeb, 0xf4, 0x7b, 0x5d,
+    0x43, 0xaf, 0xfd, 0xa9, 0xa4, 0x00, 0xcd, 0x20, 0x04, 0xea, 0x91, 0xf4,
+    0x78, 0x9a, 0xff, 0xe8, 0xde, 0x5f, 0x57, 0xaf, 0x46, 0xec, 0x9d, 0x7e,
+    0x96, 0xd6, 0xd0, 0x27, 0x3a, 0xdd, 0x43, 0xf8, 0x74, 0x9b, 0xf7, 0x23,
+    0x79, 0x68, 0xea, 0x91, 0xe7, 0x70, 0x9a, 0xff, 0xef, 0xc1, 0xad, 0xbc,
+    0xe7, 0xeb, 0x4d, 0x1d, 0x7f, 0xbf, 0x07, 0x86, 0x3d, 0xa3, 0xab, 0xf3,
+    0xfc, 0xd2, 0x4d, 0x42, 0x75, 0x39, 0x0e, 0x87, 0x84, 0xf5, 0xfc, 0xf2,
+    0x8d, 0x8f, 0xd3, 0xaf, 0xb7, 0xd4, 0x6e, 0x75, 0xe5, 0xc4, 0x8e, 0xbf,
+    0x60, 0x7a, 0x06, 0x4e, 0xaf, 0x87, 0xcc, 0xe4, 0x62, 0x37, 0x78, 0x2f,
+    0xe3, 0xab, 0x87, 0x94, 0xe5, 0xf7, 0x93, 0x6f, 0x0e, 0xbc, 0xfc, 0xfc,
+    0xeb, 0x6f, 0x06, 0xe7, 0xc3, 0xb7, 0xcc, 0xe7, 0x5c, 0xeb, 0xe5, 0x38,
+    0x8c, 0x9d, 0x7e, 0x9d, 0xfb, 0x0a, 0xe7, 0x52, 0xb0, 0x79, 0xb8, 0x47,
+    0x50, 0x9f, 0x92, 0x43, 0x75, 0xd6, 0xbf, 0x27, 0x16, 0xeb, 0xff, 0xc2,
+    0x31, 0x3a, 0xfa, 0x9c, 0xe3, 0xc8, 0xeb, 0xfd, 0x3c, 0xf0, 0x3b, 0xe7,
+    0x8e, 0xac, 0x3f, 0xc4, 0x48, 0xbf, 0xfb, 0x82, 0x0d, 0xfc, 0x39, 0x3b,
+    0x89, 0xd7, 0x9f, 0x93, 0x9d, 0x77, 0xf0, 0x75, 0xf2, 0x42, 0xf0, 0xea,
+    0x3a, 0xfe, 0x75, 0x3d, 0x1c, 0xfc, 0xea, 0x09, 0xb8, 0x10, 0xab, 0xff,
+    0xfd, 0x08, 0x11, 0x80, 0x37, 0xd8, 0xd0, 0xc3, 0x7e, 0xac, 0xeb, 0xbf,
+    0x83, 0xae, 0x85, 0x0e, 0xbf, 0xec, 0xf6, 0xa1, 0x7f, 0x72, 0x63, 0xaf,
+    0xf6, 0xb3, 0xa9, 0xa0, 0x4e, 0x75, 0xcc, 0xb2, 0x55, 0xff, 0x0e, 0x6c,
+    0x79, 0x69, 0x02, 0x75, 0x35, 0x3f, 0x24, 0x1c, 0xe0, 0xb2, 0xd5, 0xfa,
+    0x41, 0xfb, 0x02, 0xa4, 0x58, 0x45, 0xb4, 0x74, 0xc9, 0x9f, 0xd1, 0x8b,
+    0xcc, 0xb2, 0xc9, 0x56, 0x59, 0x4c, 0x17, 0xf7, 0xd3, 0x3b, 0xf0, 0xa6,
+    0x11, 0xbd, 0xf6, 0x17, 0xd5, 0x3a, 0xb5, 0xb7, 0x96, 0x27, 0x7f, 0x7a,
+    0x33, 0xb9, 0x39, 0xd7, 0x62, 0xce, 0xad, 0xcf, 0x07, 0x45, 0x95, 0x0d,
+    0xf3, 0x8c, 0xa1, 0x7d, 0x92, 0x8c, 0x14, 0x48, 0xde, 0x30, 0xe4, 0x8e,
+    0x57, 0x90, 0x85, 0xec, 0xb7, 0x97, 0xa5, 0x7f, 0x7e, 0x96, 0x32, 0x94,
+    0xf5, 0x28, 0xab, 0xd0, 0xc9, 0x04, 0xb7, 0xbd, 0x8d, 0xb7, 0xf6, 0x7f,
+    0xfa, 0x72, 0x47, 0x5c, 0xdc, 0x3a, 0x82, 0x78, 0x6e, 0x5d, 0x76, 0x32,
+    0x75, 0xd1, 0xe3, 0xaa, 0x73, 0x56, 0xd1, 0x6b, 0x2c, 0xea, 0xc3, 0x65,
+    0xe2, 0x2b, 0xfd, 0x24, 0x1c, 0x58, 0x3a, 0x75, 0xff, 0xb3, 0xda, 0xea,
+    0x2d, 0xf3, 0x87, 0x54, 0x1f, 0x68, 0x98, 0xdf, 0x7c, 0xf4, 0x6c, 0x3a,
+    0xfb, 0x17, 0x9e, 0x3a, 0xf7, 0x9d, 0x43, 0xaf, 0xff, 0xfe, 0x6b, 0xcc,
+    0x09, 0x01, 0xbf, 0x3a, 0x9e, 0xf4, 0x6f, 0x13, 0xc6, 0x8e, 0xbf, 0xff,
+    0xe5, 0x71, 0x77, 0xd9, 0x12, 0xec, 0x72, 0x78, 0xf6, 0x9e, 0x47, 0x5e,
+    0x4d, 0xe6, 0x3a, 0xfd, 0x99, 0x38, 0x34, 0x75, 0xf7, 0x05, 0x3f, 0x3a,
+    0xf9, 0x1a, 0xfc, 0x3a, 0xe8, 0xfc, 0xeb, 0xe0, 0x4e, 0x06, 0x3a, 0x6d,
+    0xbe, 0x90, 0x52, 0x22, 0x53, 0xaa, 0xf7, 0xfd, 0xd7, 0xd7, 0x52, 0x77,
+    0x13, 0xaf, 0x9e, 0x7f, 0xb2, 0x3a, 0x95, 0x4a, 0xf0, 0x21, 0xfa, 0x50,
+    0x8d, 0xc2, 0x0d, 0xc9, 0x50, 0x83, 0x83, 0x8e, 0xed, 0xfb, 0x4e, 0x87,
+    0x7d, 0x0b, 0xbf, 0xa4, 0x5b, 0x46, 0xf7, 0xf0, 0x80, 0x2b, 0x79, 0x1d,
+    0x79, 0x27, 0x01, 0xd7, 0xe8, 0xfd, 0x37, 0xc3, 0xae, 0x5e, 0xc3, 0xac,
+    0x18, 0x37, 0xe2, 0x4f, 0x7f, 0xfa, 0x43, 0x1f, 0x16, 0x30, 0xa7, 0x92,
+    0x73, 0xaf, 0xce, 0xbc, 0xea, 0xce, 0xad, 0xcf, 0xc7, 0xc9, 0x77, 0xbd,
+    0xc8, 0x3a, 0xff, 0x6b, 0xdb, 0x30, 0x70, 0x27, 0x54, 0x27, 0x1d, 0x22,
+    0xcc, 0x5b, 0x48, 0x4b, 0x2c, 0x8d, 0xc6, 0xef, 0x3f, 0xcf, 0xa7, 0x5f,
+    0x2d, 0x70, 0xb3, 0xaf, 0xff, 0x86, 0x5f, 0x30, 0x29, 0xad, 0xfc, 0x07,
+    0xd1, 0xd7, 0xfb, 0xe8, 0xbf, 0xa5, 0x0a, 0x1d, 0x7d, 0x99, 0xbc, 0x8e,
+    0xbd, 0xa4, 0x98, 0xeb, 0x28, 0x26, 0xf7, 0x44, 0x37, 0xff, 0x3c, 0xe3,
+    0x1b, 0xa0, 0x46, 0x27, 0x3a, 0xb8, 0x7d, 0x42, 0x4f, 0x7e, 0xf9, 0xd8,
+    0xe4, 0x8e, 0xaf, 0x89, 0xdb, 0x40, 0xfe, 0x10, 0xb5, 0x45, 0xe1, 0xb6,
+    0xc9, 0x0d, 0xe5, 0xea, 0x0e, 0xbf, 0xa7, 0x9a, 0x4a, 0xae, 0x4e, 0x75,
+    0xf2, 0xf1, 0xfa, 0x75, 0xd2, 0x9c, 0xeb, 0xdd, 0x0a, 0x1d, 0x7e, 0xee,
+    0x24, 0xb4, 0x75, 0xff, 0xf7, 0x63, 0xeb, 0x1e, 0x17, 0xff, 0x5a, 0x8f,
+    0xca, 0xbf, 0x71, 0xae, 0xed, 0x3c, 0x40, 0x97, 0xb5, 0x1b, 0x9d, 0x6f,
+    0xf0, 0xf3, 0xf7, 0x33, 0xbd, 0xe4, 0x9c, 0xeb, 0xd3, 0xb8, 0x9d, 0x52,
+    0x4c, 0xa0, 0x24, 0xdc, 0x85, 0x12, 0xca, 0x7c, 0x39, 0x7f, 0x0b, 0x5d,
+    0x4e, 0xa1, 0xd7, 0x6d, 0x48, 0xeb, 0xef, 0x4e, 0xe2, 0x75, 0xe1, 0x75,
+    0x0e, 0xbc, 0xa2, 0x78, 0xeb, 0xda, 0x7f, 0x1d, 0x4a, 0x1b, 0x7d, 0xc7,
+    0x2e, 0xf9, 0xd3, 0xaf, 0xe5, 0xf9, 0x02, 0x08, 0x3a, 0xf2, 0xfc, 0xd3,
+    0xad, 0xe8, 0x3c, 0x8c, 0x2c, 0xa9, 0xd3, 0x35, 0xc1, 0x96, 0x90, 0xf5,
+    0x4b, 0xf2, 0x31, 0x60, 0xbb, 0x80, 0x3a, 0xff, 0x0b, 0xb3, 0xad, 0x47,
+    0xe7, 0x5e, 0xdb, 0x75, 0x0e, 0xbf, 0xe8, 0x5c, 0xb2, 0x7c, 0x02, 0xa4,
+    0xeb, 0xe7, 0xf2, 0xa6, 0x73, 0xab, 0x11, 0x02, 0x83, 0xee, 0x79, 0x79,
+    0x96, 0x59, 0x3d, 0x5f, 0x57, 0x9c, 0x42, 0x5a, 0xbe, 0xac, 0x1a, 0xcb,
+    0xf6, 0x48, 0x10, 0xa1, 0xd5, 0x09, 0xc1, 0x84, 0x5b, 0x90, 0xb4, 0xfd,
+    0x67, 0xc7, 0x37, 0xff, 0xec, 0x14, 0x51, 0x8d, 0x7b, 0xa0, 0x79, 0x4a,
+    0x0e, 0xa9, 0xd1, 0x4a, 0xa2, 0x85, 0xf6, 0x05, 0xe4, 0x75, 0xf9, 0xc4,
+    0x51, 0x67, 0x5f, 0xf7, 0x53, 0x98, 0x8b, 0x85, 0x73, 0xaf, 0xc8, 0xb7,
+    0x1c, 0x3a, 0xbe, 0x2f, 0x60, 0xab, 0x23, 0x70, 0x6b, 0x22, 0x00, 0x8b,
+    0xe4, 0x68, 0x6a, 0x28, 0x24, 0x6c, 0x2f, 0x2a, 0x03, 0xf2, 0x51, 0x20,
+    0x01, 0x26, 0xd9, 0xcd, 0xf9, 0x3d, 0x1e, 0xd1, 0x57, 0xcd, 0x8f, 0x68,
+    0xab, 0x99, 0x64, 0xaa, 0x91, 0xef, 0xe1, 0x33, 0x24, 0x37, 0x63, 0x25,
+    0x30, 0x6b, 0xef, 0xff, 0xbd, 0x0d, 0xcc, 0x1f, 0x75, 0x20, 0x67, 0x3a,
+    0x8e, 0xac, 0x3d, 0x6d, 0x26, 0x57, 0xe8, 0x9e, 0x65, 0xf6, 0xff, 0xff,
+    0x46, 0xc4, 0x1f, 0xfe, 0x7b, 0x58, 0xde, 0xb8, 0xfb, 0x47, 0x5f, 0xa5,
+    0xd0, 0x47, 0x0e, 0xbf, 0xf9, 0xd7, 0xc8, 0xd8, 0x9b, 0x04, 0x1a, 0x3a,
+    0xb7, 0x3e, 0xde, 0x93, 0xdf, 0xb0, 0x0b, 0x8d, 0x1d, 0x47, 0x5d, 0x93,
+    0x70, 0xd8, 0x68, 0x9a, 0xff, 0x90, 0x0a, 0x9e, 0xc7, 0xd1, 0x9c, 0xeb,
+    0xfe, 0x89, 0xe3, 0x7f, 0x0e, 0x4e, 0x75, 0x62, 0x29, 0x1a, 0x5a, 0x87,
+    0xd7, 0xe7, 0x58, 0xc6, 0xe7, 0x54, 0xc9, 0xa5, 0xf2, 0x1e, 0xfd, 0x2e,
+    0xbe, 0xce, 0xe4, 0xe7, 0x5e, 0x93, 0xf0, 0xeb, 0xf4, 0xb3, 0xd8, 0x12,
+    0xaf, 0xa0, 0x46, 0x0e, 0xa9, 0x8f, 0x7f, 0xc3, 0x7f, 0x49, 0xaf, 0xbf,
+    0xd2, 0xf8, 0x75, 0x28, 0x8d, 0x54, 0x84, 0x07, 0x8c, 0xaf, 0xf8, 0x73,
+    0xb9, 0xf3, 0xb9, 0x39, 0xd7, 0xf0, 0x15, 0x29, 0xce, 0x61, 0xd7, 0xde,
+    0x53, 0x3a, 0x75, 0xb4, 0x75, 0xc9, 0xf9, 0xd7, 0x75, 0x0e, 0xb8, 0x1a,
+    0xf8, 0x6a, 0xe6, 0x16, 0xa7, 0x3e, 0xbf, 0xce, 0xee, 0xfe, 0x0e, 0xbb,
+    0xf8, 0x3a, 0xfc, 0x09, 0x60, 0xb0, 0x86, 0xb3, 0xf1, 0x6a, 0x84, 0xc6,
+    0x7f, 0x84, 0x68, 0xa7, 0x5f, 0xff, 0x60, 0xbe, 0xfa, 0x51, 0x47, 0xf8,
+    0xd5, 0xfe, 0x75, 0xff, 0xde, 0xee, 0x2f, 0xec, 0x7f, 0x9b, 0xf8, 0xeb,
+    0xfd, 0xbb, 0x53, 0x9f, 0x60, 0x27, 0x5f, 0x7e, 0xb7, 0x97, 0xc4, 0x68,
+    0x69, 0x53, 0xc8, 0xf7, 0xf7, 0xeb, 0xfb, 0xaf, 0xb3, 0x9d, 0x76, 0x6e,
+    0x75, 0x6e, 0x79, 0x5b, 0x66, 0x97, 0xdf, 0xf1, 0x38, 0x75, 0x42, 0x37,
+    0x1e, 0x12, 0x8c, 0x93, 0x5f, 0x68, 0x1b, 0xf8, 0xeb, 0xb1, 0x93, 0xaf,
+    0xfa, 0x37, 0xcf, 0xe3, 0x66, 0x4e, 0x75, 0x70, 0xf4, 0x7f, 0x16, 0xbf,
+    0xf4, 0xd1, 0x3e, 0xb9, 0x8d, 0x89, 0xce, 0xbf, 0xb1, 0x78, 0x14, 0x64,
+    0xeb, 0x97, 0x07, 0x52, 0xcf, 0x05, 0xcb, 0x2f, 0xe1, 0xc9, 0xba, 0x9e,
+    0x3a, 0xfb, 0x33, 0xba, 0x3a, 0xb1, 0x1d, 0xcf, 0x08, 0x1f, 0x10, 0xed,
+    0x16, 0x5e, 0x65, 0x96, 0x4a, 0xbf, 0x62, 0x82, 0x0d, 0x14, 0xc1, 0x7f,
+    0x7e, 0xc6, 0x19, 0x65, 0x93, 0xaa, 0x0f, 0x8b, 0xc6, 0xf7, 0xfd, 0xae,
+    0x40, 0x3c, 0x29, 0xb0, 0xeb, 0xff, 0x0e, 0x69, 0xbd, 0x46, 0xc0, 0x9d,
+    0x7f, 0xff, 0x94, 0x65, 0xf8, 0xa3, 0x1a, 0xc9, 0x08, 0x1f, 0x58, 0x27,
+    0x54, 0x23, 0x5b, 0x0e, 0x50, 0xee, 0xf9, 0x97, 0x19, 0x1d, 0x7f, 0xde,
+    0x8d, 0xff, 0x7e, 0xf5, 0x0e, 0xb7, 0x4e, 0xac, 0x3c, 0x96, 0x9c, 0xde,
+    0x65, 0x96, 0x4a, 0xbf, 0x91, 0xd4, 0xea, 0x78, 0xa6, 0x0b, 0xfb, 0xef,
+    0x69, 0xf8, 0x75, 0xee, 0xc0, 0x4e, 0xa4, 0x37, 0x8e, 0x43, 0x7e, 0xcf,
+    0xf3, 0x26, 0x3a, 0xda, 0xf8, 0x8f, 0xee, 0x20, 0x75, 0xe0, 0x47, 0xee,
+    0x04, 0x82, 0x9d, 0x66, 0x46, 0xd1, 0x7e, 0x54, 0xf6, 0x27, 0x01, 0xd5,
+    0xd5, 0x47, 0x43, 0x1e, 0xc8, 0x0d, 0x6f, 0x46, 0xc8, 0x3a, 0x90, 0xf4,
+    0xc4, 0xde, 0xf0, 0xc6, 0xc3, 0xae, 0x54, 0xa1, 0xd7, 0x27, 0x4e, 0xb3,
+    0xce, 0x6b, 0xb8, 0x33, 0x7d, 0xed, 0x01, 0x5c, 0xeb, 0xfd, 0x03, 0x21,
+    0x48, 0xdc, 0xea, 0x86, 0x6e, 0x5c, 0x89, 0x72, 0x50, 0xda, 0x91, 0x86,
+    0x34, 0xd5, 0x0e, 0x79, 0x1a, 0x4f, 0x63, 0xe1, 0x73, 0x4f, 0xdd, 0x06,
+    0x31, 0x1d, 0x43, 0x13, 0xd2, 0xe1, 0x36, 0x10, 0x6d, 0xa5, 0x7d, 0x27,
+    0xda, 0x25, 0xb9, 0x58, 0x43, 0xaf, 0xfd, 0x13, 0x7b, 0x6b, 0x51, 0x30,
+    0x38, 0x75, 0xff, 0xd8, 0x9d, 0x80, 0xf4, 0x11, 0xbe, 0x8e, 0xbc, 0x15,
+    0x3f, 0x3a, 0xfc, 0xbe, 0x71, 0xfc, 0x75, 0x7c, 0x3c, 0x58, 0x1e, 0xbf,
+    0xfc, 0xd9, 0x9d, 0xbd, 0x89, 0x78, 0x71, 0x67, 0x5f, 0xff, 0x22, 0xf7,
+    0x96, 0xbe, 0x60, 0x8e, 0x27, 0xe7, 0x5e, 0x4e, 0x80, 0xea, 0x56, 0x53,
+    0xbc, 0x90, 0xd7, 0x10, 0xfb, 0x08, 0x87, 0x23, 0xf2, 0x4e, 0xc5, 0x0b,
+    0x30, 0xac, 0x46, 0xc5, 0xf8, 0xa8, 0x85, 0xca, 0xb7, 0x1a, 0x42, 0xa9,
+    0xb1, 0x5a, 0x46, 0x32, 0xab, 0xe3, 0x16, 0x56, 0xa7, 0x4a, 0xb0, 0x7c,
+    0x53, 0x00, 0x27, 0x9d, 0x08, 0x95, 0x22, 0x4c, 0x34, 0x90, 0xcc, 0xb6,
+    0x8e, 0x8a, 0x4b, 0x0e, 0x6d, 0x26, 0x23, 0x79, 0xf5, 0xf4, 0xa4, 0x67,
+    0x4d, 0x4e, 0x08, 0xe5, 0x34, 0xa5, 0x73, 0xf1, 0x1d, 0xad, 0x9e, 0x9e,
+    0xb9, 0xce, 0xfe, 0x92, 0x60, 0xa9, 0x86, 0xb0, 0xd6, 0x69, 0xfa, 0xb6,
+    0xaf, 0xbe, 0xb4, 0x17, 0xa0, 0x9d, 0x1b, 0xd9, 0x29, 0x4d, 0x99, 0x41,
+    0xfb, 0x73, 0xe3, 0xdf, 0x69, 0xf8, 0xdb, 0x52, 0xb6, 0x29, 0x88, 0xd9,
+    0x8e, 0xa5, 0x9b, 0x1a, 0x65, 0xf9, 0x8f, 0xd7, 0x9e, 0x3a, 0xff, 0x31,
+    0x9c, 0x6b, 0xbb, 0x4d, 0x17, 0x1d, 0xfe, 0x63, 0x38, 0xd7, 0x76, 0x9a,
+    0x2e, 0xbb, 0xff, 0x98, 0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x12, 0x8d,
+    0x44, 0x6d, 0x6e, 0x32, 0x85, 0xd8, 0x4a, 0x54, 0x84, 0x7b, 0x4a, 0x12,
+    0x3a, 0x15, 0x77, 0x17, 0xcd, 0x9a, 0x47, 0xf3, 0xbd, 0x14, 0xf8, 0xff,
+    0x68, 0xfe, 0xff, 0xf3, 0x0b, 0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x12,
+    0xd5, 0xff, 0x2a, 0xee, 0xa2, 0xbb, 0xc6, 0xfb, 0x47, 0x5f, 0xb8, 0xd7,
+    0x76, 0x9a, 0x23, 0x7b, 0xff, 0x3c, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x89,
+    0x7e, 0xfe, 0x8f, 0x7d, 0xeb, 0xf8, 0xeb, 0xfd, 0x9f, 0x78, 0xa7, 0x41,
+    0xa3, 0xac, 0xc2, 0xb5, 0x4c, 0x97, 0x11, 0x16, 0x67, 0xd4, 0xa1, 0x2e,
+    0xbf, 0xcc, 0x67, 0x1a, 0xee, 0xd3, 0x45, 0x57, 0x72, 0x6d, 0x1d, 0x7c,
+    0x8b, 0x7d, 0x87, 0x52, 0x86, 0xeb, 0xc3, 0x17, 0x87, 0x69, 0x93, 0xaf,
+    0xe7, 0xec, 0xc3, 0x01, 0x3a, 0xff, 0xef, 0x76, 0x34, 0x2e, 0x05, 0x4a,
+    0x70, 0xeb, 0xd1, 0x2c, 0x3a, 0x82, 0x88, 0xcd, 0xcb, 0x26, 0x46, 0xbf,
+    0xe5, 0x30, 0x73, 0x7f, 0x3a, 0xce, 0xb8, 0x28, 0x75, 0xfd, 0x9c, 0x6b,
+    0xbb, 0x4d, 0x12, 0x05, 0x7c, 0x3c, 0xd6, 0x05, 0x6f, 0xda, 0x71, 0x7d,
+    0xce, 0xb8, 0x10, 0x75, 0x48, 0xf8, 0x37, 0x25, 0xe1, 0x35, 0xfe, 0x94,
+    0x72, 0x78, 0xe4, 0xe7, 0x5f, 0xee, 0x4e, 0xb8, 0x19, 0x68, 0xea, 0x83,
+    0xe7, 0xc3, 0x4b, 0xec, 0x9d, 0xc2, 0x75, 0xff, 0xec, 0x9b, 0xae, 0xbf,
+    0x76, 0x3c, 0x05, 0x9d, 0x53, 0xab, 0x06, 0x09, 0x16, 0x42, 0xad, 0x43,
+    0x27, 0x87, 0x28, 0xc2, 0x5f, 0xc4, 0x1f, 0x48, 0x6f, 0xfe, 0x1c, 0x9d,
+    0x8d, 0xb8, 0x11, 0xcf, 0x1d, 0x4c, 0x23, 0x23, 0x90, 0x83, 0xbf, 0xcc,
+    0x67, 0x1a, 0xee, 0xd3, 0x45, 0x91, 0x7f, 0x98, 0xce, 0x35, 0xdd, 0xa6,
+    0x8b, 0x5e, 0xff, 0xf6, 0x7d, 0x89, 0xd8, 0xc9, 0xbc, 0x18, 0x13, 0xaf,
+    0xf3, 0x19, 0xc6, 0xbb, 0xb4, 0xd1, 0x72, 0x5f, 0xb8, 0xd7, 0x76, 0x9a,
+    0x2e, 0xcb, 0xff, 0x3c, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x8a, 0x3a, 0xcc,
+    0x61, 0xfe, 0xac, 0xce, 0xf8, 0x62, 0x4b, 0x3a, 0xd2, 0x3a, 0xfd, 0xc6,
+    0xbb, 0xb4, 0xd1, 0x4a, 0xdf, 0xf3, 0x7a, 0x93, 0x76, 0x27, 0xc3, 0xaf,
+    0xff, 0x76, 0x27, 0x8e, 0xa6, 0xc7, 0x0f, 0x50, 0xe6, 0x0d, 0xcd, 0xd2,
+    0x63, 0x11, 0x8f, 0x33, 0x65, 0x6e, 0x98, 0x3b, 0xc3, 0x5e, 0xff, 0xce,
+    0x9e, 0x90, 0x02, 0xe3, 0xf9, 0xd6, 0x60, 0x29, 0xc6, 0xae, 0x32, 0x7e,
+    0x94, 0xd4, 0xec, 0x9b, 0xb9, 0x46, 0xf9, 0xba, 0xb2, 0x4e, 0x23, 0xac,
+    0xa7, 0xf3, 0xf1, 0x3f, 0xd2, 0x67, 0xa1, 0x79, 0xb2, 0x3b, 0x5b, 0xfe,
+    0x93, 0x19, 0xc6, 0xbb, 0xb4, 0xd1, 0x1c, 0x5f, 0xf2, 0x31, 0x9c, 0x6b,
+    0xbb, 0x4d, 0x15, 0xad, 0x98, 0x74, 0x44, 0xf9, 0x16, 0xff, 0xf3, 0x0b,
+    0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x12, 0xdd, 0xe0, 0x73, 0xf3, 0xae,
+    0xcd, 0xce, 0xbf, 0xc1, 0xc5, 0xae, 0x13, 0x47, 0x5e, 0xd8, 0x09, 0x1d,
+    0x4d, 0x44, 0x16, 0xe3, 0xa8, 0x2d, 0xb0, 0xc6, 0xf7, 0x43, 0x23, 0xaf,
+    0xfb, 0x37, 0x1c, 0xff, 0xf7, 0x91, 0xd7, 0x2d, 0xa7, 0x54, 0x1e, 0x7c,
+    0x8e, 0x6f, 0x86, 0x37, 0x91, 0xd7, 0xff, 0xe7, 0xdf, 0xf0, 0xf5, 0xe5,
+    0x9a, 0x10, 0x3f, 0xd3, 0xa9, 0xa7, 0xf1, 0xd2, 0x1b, 0xf9, 0x38, 0x29,
+    0xed, 0x1d, 0x7e, 0xe3, 0x8e, 0x41, 0xd4, 0x68, 0x86, 0xfa, 0x79, 0xee,
+    0x57, 0x74, 0x09, 0xd7, 0xf2, 0x08, 0x71, 0x02, 0x75, 0x41, 0xbe, 0x90,
+    0xa5, 0xf6, 0x4d, 0x2c, 0x3a, 0xff, 0xcf, 0x26, 0x33, 0x8d, 0x77, 0x69,
+    0xa2, 0x60, 0xbf, 0x7f, 0xa7, 0x1f, 0xce, 0xbf, 0xc0, 0xdf, 0x89, 0x0b,
+    0xc3, 0xaf, 0xfa, 0x27, 0xf0, 0xc0, 0x3d, 0xa3, 0xad, 0xee, 0x9f, 0x56,
+    0xd9, 0x95, 0xf6, 0xed, 0x45, 0x0e, 0xac, 0x3c, 0xef, 0x15, 0xdf, 0xed,
+    0x27, 0x51, 0x78, 0xa1, 0xd7, 0xff, 0x9e, 0x7e, 0xa4, 0x0e, 0x4c, 0x9c,
+    0x43, 0xab, 0xc7, 0xf2, 0xc9, 0x95, 0xcd, 0xc3, 0xae, 0x07, 0xe5, 0x52,
+    0x1a, 0xce, 0x0a, 0xdf, 0xec, 0x08, 0xe7, 0xbb, 0x87, 0x5f, 0xd3, 0xfd,
+    0xdb, 0x71, 0xfc, 0xeb, 0xfb, 0x3d, 0xe8, 0xe6, 0x8e, 0xbf, 0x9c, 0x7f,
+    0x9f, 0xff, 0x1d, 0x50, 0x88, 0xe1, 0x33, 0xdb, 0x2c, 0xb3, 0x10, 0xbb,
+    0x13, 0x39, 0xf8, 0x5a, 0xf2, 0x13, 0x2d, 0x71, 0xdd, 0xcb, 0x84, 0x0b,
+    0x21, 0x74, 0xa1, 0x87, 0x06, 0xa1, 0x35, 0xe4, 0xfd, 0x84, 0x1f, 0x61,
+    0x7d, 0x79, 0x60, 0xe1, 0x57, 0xfe, 0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d,
+    0x13, 0x1d, 0xf4, 0x72, 0x36, 0x8e, 0xb3, 0x08, 0x88, 0x95, 0x8e, 0x75,
+    0x2a, 0xfa, 0x27, 0x8e, 0x1d, 0x7e, 0xc8, 0x99, 0x16, 0x75, 0x21, 0xe3,
+    0xf0, 0x86, 0xff, 0x76, 0x39, 0x3f, 0xd0, 0x7e, 0x75, 0xcf, 0xa3, 0xaf,
+    0xbe, 0x7b, 0x3a, 0x75, 0xa3, 0xa6, 0xe3, 0x42, 0xb7, 0xa0, 0x67, 0x3a,
+    0xff, 0xff, 0xfa, 0x5a, 0xee, 0x01, 0x9d, 0x77, 0x1b, 0x9a, 0xf9, 0x9b,
+    0xcb, 0x48, 0x28, 0x75, 0xe7, 0x76, 0x9a, 0x2b, 0x1b, 0xe7, 0xfb, 0x0a,
+    0x1d, 0x4d, 0x3c, 0xae, 0x13, 0xdf, 0xfb, 0x6f, 0x3c, 0x38, 0x08, 0x1f,
+    0x1d, 0x4a, 0x26, 0xd4, 0xd2, 0x6d, 0xc6, 0xf9, 0x0c, 0x9f, 0x11, 0x5f,
+    0xfc, 0x3e, 0x50, 0x10, 0x38, 0xd8, 0xe1, 0xd7, 0xfb, 0x93, 0xfb, 0x4f,
+    0xbb, 0x4e, 0xa8, 0x3f, 0x77, 0x42, 0xbf, 0xa3, 0x6b, 0xd9, 0xbc, 0xc7,
+    0x5f, 0xc0, 0xdb, 0x6f, 0x51, 0x52, 0x75, 0xfd, 0x9a, 0xde, 0x51, 0xd3,
+    0xae, 0x8d, 0x87, 0x58, 0x3d, 0x3c, 0x41, 0x2d, 0xbf, 0xe8, 0xde, 0x53,
+    0x49, 0xf9, 0x39, 0xd5, 0x08, 0xda, 0xc7, 0x84, 0x27, 0xbd, 0x12, 0xf1,
+    0xd7, 0xfe, 0xc0, 0xf1, 0x01, 0x3f, 0xfa, 0x91, 0xd7, 0xcb, 0x7d, 0xfc,
+    0x75, 0xff, 0xd3, 0xc7, 0xbe, 0x7d, 0x6f, 0xdd, 0xaf, 0xba, 0x3a, 0xff,
+    0xb9, 0x1a, 0x7e, 0x0c, 0x48, 0xea, 0xe2, 0x21, 0xf6, 0x28, 0xde, 0x93,
+    0xce, 0x75, 0xef, 0x93, 0xac, 0xeb, 0x83, 0xe3, 0xa9, 0x54, 0x98, 0xfe,
+    0x42, 0xa7, 0x72, 0x54, 0x1c, 0x11, 0xfb, 0xff, 0x0b, 0x87, 0xb1, 0xb3,
+    0xae, 0x27, 0x5f, 0xff, 0xf8, 0x13, 0xe3, 0x7e, 0x08, 0x36, 0xbe, 0x66,
+    0xf2, 0xc0, 0x0f, 0xfa, 0x3a, 0xff, 0x9f, 0x71, 0xc0, 0xf5, 0xd9, 0x3a,
+    0x82, 0x8e, 0xa1, 0x3d, 0xd3, 0xad, 0xfd, 0x3c, 0xd2, 0x55, 0x72, 0x73,
+    0xaf, 0x84, 0x73, 0xc7, 0x52, 0xb2, 0x7a, 0x90, 0x6b, 0x7f, 0x4f, 0xf7,
+    0x6d, 0xc7, 0xf3, 0xaf, 0xfe, 0x9b, 0xae, 0xbf, 0x76, 0x3c, 0x05, 0x9d,
+    0x7f, 0xc9, 0x24, 0xe8, 0x16, 0xb4, 0x3a, 0xa1, 0x15, 0xf8, 0x67, 0xe4,
+    0x5b, 0xdd, 0x46, 0x21, 0x90, 0xaf, 0x22, 0x1c, 0x8f, 0x65, 0xb0, 0xc9,
+    0xe1, 0x07, 0x63, 0x0b, 0x72, 0xd1, 0x1b, 0xd4, 0x6b, 0xfe, 0x8c, 0xf3,
+    0x6e, 0x10, 0x7f, 0x61, 0xab, 0x74, 0x84, 0xeb, 0xfb, 0x9c, 0x80, 0xe2,
+    0xce, 0xbb, 0xef, 0xe7, 0x5e, 0xea, 0x2c, 0xeb, 0x4c, 0x75, 0x39, 0xac,
+    0x00, 0xdd, 0xf9, 0xc6, 0x70, 0x68, 0xeb, 0xfe, 0x80, 0xf7, 0x03, 0xc7,
+    0x69, 0xd4, 0x88, 0xef, 0xfc, 0xb0, 0x51, 0x74, 0x41, 0xe2, 0x7b, 0xda,
+    0xfb, 0xa3, 0xaf, 0xb7, 0x9e, 0x14, 0x3a, 0x82, 0x78, 0x40, 0x1e, 0xbb,
+    0xd0, 0x75, 0xf9, 0x78, 0x31, 0x23, 0xaf, 0x81, 0xec, 0xd1, 0xd7, 0xd1,
+    0xc7, 0x13, 0xaf, 0xf3, 0xf2, 0x5f, 0xa6, 0xfa, 0x3a, 0xfb, 0x5a, 0x8f,
+    0xce, 0xa8, 0x45, 0xda, 0x12, 0xf4, 0x84, 0x03, 0xec, 0x9a, 0x5f, 0x4b,
+    0xf0, 0x48, 0xeb, 0xee, 0x7d, 0x8f, 0xce, 0xa8, 0x3c, 0x74, 0x23, 0xbf,
+    0xc9, 0x3b, 0xaf, 0xff, 0xe0, 0xeb, 0xfe, 0x46, 0xf7, 0x26, 0x18, 0x09,
+    0xd7, 0xd2, 0xf6, 0x7d, 0x3a, 0xf3, 0x63, 0xf3, 0xaf, 0x72, 0x16, 0x75,
+    0x39, 0xed, 0x00, 0x8d, 0x91, 0xcb, 0xf4, 0x4f, 0xf7, 0x26, 0x3a, 0xf4,
+    0x0c, 0x8e, 0xa9, 0x93, 0x58, 0xe1, 0x07, 0x4d, 0x06, 0x12, 0x3a, 0x2f,
+    0xf1, 0x55, 0xff, 0xa3, 0x35, 0xf2, 0x10, 0x3f, 0x64, 0x75, 0xfc, 0x8c,
+    0xea, 0x7c, 0x64, 0xea, 0x13, 0xef, 0xf2, 0x05, 0xfa, 0x03, 0xec, 0x69,
+    0xd7, 0xdd, 0x81, 0x69, 0xd5, 0x23, 0xe7, 0xd1, 0x0f, 0x89, 0xaf, 0x9c,
+    0x5e, 0x63, 0xaf, 0xc9, 0xe1, 0xc9, 0x1d, 0x7d, 0x0c, 0xc4, 0xc7, 0x5d,
+    0xf5, 0x67, 0x5f, 0xf0, 0x3e, 0x78, 0x5f, 0xfc, 0x13, 0xaa, 0x74, 0x5c,
+    0x28, 0x40, 0x84, 0xbd, 0x22, 0x11, 0x8b, 0xfd, 0x0c, 0x84, 0x0f, 0xc9,
+    0x1d, 0x7f, 0x27, 0x37, 0xd4, 0x48, 0xeb, 0x6c, 0x3a, 0xb8, 0x7e, 0x5d,
+    0x33, 0xda, 0x2d, 0xbc, 0x28, 0xa1, 0xd7, 0xd8, 0x14, 0xd8, 0x75, 0xd0,
+    0xbc, 0x37, 0xae, 0x37, 0x6d, 0x1d, 0x48, 0x6e, 0x9c, 0xaa, 0xef, 0xe0,
+    0xab, 0x99, 0x64, 0xaa, 0x43, 0x5c, 0xc8, 0xb5, 0xfe, 0x79, 0x0e, 0x7b,
+    0xa8, 0x53, 0x06, 0x86, 0xf3, 0xef, 0xa3, 0xaf, 0xbe, 0xf5, 0xfc, 0x75,
+    0x04, 0xdf, 0xf8, 0x72, 0xf4, 0x0c, 0xc7, 0x5c, 0x30, 0x75, 0xa6, 0x3a,
+    0xa6, 0x3c, 0x0e, 0x0d, 0xb8, 0xa5, 0xff, 0xca, 0x20, 0xb7, 0x50, 0xb7,
+    0xdf, 0xc7, 0x5e, 0xff, 0x36, 0x8e, 0xa5, 0x0f, 0x8f, 0x88, 0x97, 0xcb,
+    0xd0, 0x16, 0x75, 0x94, 0x3a, 0xdb, 0x67, 0x5d, 0xc5, 0x0e, 0xa8, 0x3d,
+    0xd4, 0x22, 0x00, 0x8f, 0xd1, 0x3b, 0xff, 0xee, 0xe4, 0xb5, 0x1e, 0x96,
+    0x2b, 0xb8, 0xfe, 0x75, 0xff, 0xa4, 0x9e, 0xee, 0x6f, 0xe0, 0x41, 0xd7,
+    0x66, 0x8e, 0xa8, 0x3d, 0x39, 0x1f, 0x56, 0x91, 0x8b, 0xe8, 0x52, 0x5f,
+    0x92, 0x17, 0x0b, 0x3a, 0xd8, 0x75, 0x21, 0xee, 0x68, 0xa3, 0x6c, 0x96,
+    0xa1, 0x58, 0x0e, 0x30, 0xa4, 0x24, 0xbb, 0x08, 0x07, 0x8d, 0x76, 0xf6,
+    0xa2, 0x63, 0xa8, 0xeb, 0x2c, 0xea, 0xf1, 0x75, 0xb0, 0x2a, 0xfd, 0xfa,
+    0x71, 0x14, 0x3a, 0xe7, 0x50, 0xea, 0x99, 0x12, 0xdd, 0x36, 0xfc, 0x88,
+    0x4a, 0x2e, 0xf4, 0x1d, 0x7e, 0x8e, 0xe6, 0xc7, 0x3a, 0x9c, 0xde, 0x7e,
+    0x2b, 0x7f, 0x27, 0xb3, 0xae, 0xa1, 0xd7, 0xf7, 0x40, 0xf3, 0xf5, 0x0e,
+    0xbc, 0xcb, 0x2c, 0x95, 0x7f, 0xc1, 0x89, 0xfe, 0xe7, 0x5f, 0x72, 0x98,
+    0x2f, 0xee, 0xc9, 0xce, 0xa0, 0xa2, 0xb5, 0xa9, 0x88, 0x97, 0x7a, 0x16,
+    0x87, 0x56, 0x1e, 0x4b, 0x4b, 0xef, 0x93, 0x9b, 0x41, 0x3a, 0xfd, 0xd8,
+    0xdd, 0xd5, 0xce, 0xbf, 0xfe, 0x8f, 0x68, 0x39, 0xe4, 0xe8, 0x33, 0x7f,
+    0x1d, 0x5d, 0x3f, 0x9f, 0x15, 0x5b, 0x87, 0x5f, 0xec, 0xc6, 0xfd, 0xd9,
+    0xdc, 0x3a, 0xe0, 0x68, 0xeb, 0xff, 0xf6, 0x06, 0x33, 0x7f, 0xbe, 0x41,
+    0x04, 0xb3, 0x47, 0x5c, 0xbf, 0xce, 0xb9, 0xc4, 0xea, 0xe9, 0xab, 0x71,
+    0x7b, 0xf2, 0xd3, 0xdf, 0xb9, 0xd5, 0x3a, 0x7c, 0x39, 0x09, 0xd5, 0x72,
+    0x29, 0x84, 0x1c, 0xd4, 0x45, 0xbd, 0x08, 0x00, 0x10, 0x5f, 0x77, 0xc9,
+    0x39, 0xd7, 0xf9, 0xa9, 0xa1, 0xcd, 0x8e, 0x75, 0xf4, 0x4e, 0xf2, 0x3a,
+    0xec, 0xf1, 0xd7, 0xec, 0x9c, 0x73, 0x73, 0xab, 0x11, 0x63, 0xb9, 0x17,
+    0x0c, 0xba, 0x42, 0x22, 0xb7, 0xbb, 0x01, 0x3a, 0xee, 0x68, 0xea, 0x39,
+    0x0b, 0x6b, 0xfd, 0x03, 0x27, 0x5e, 0x04, 0xeb, 0xef, 0x2d, 0x7c, 0x3a,
+    0xff, 0xef, 0xe0, 0x5a, 0xfe, 0xff, 0xe8, 0xc8, 0xeb, 0xd2, 0x4e, 0x9d,
+    0x7d, 0xe1, 0xc9, 0x1d, 0x7e, 0xc0, 0x2a, 0x74, 0xe7, 0x5f, 0xfe, 0x4d,
+    0x77, 0x02, 0x39, 0xb0, 0x73, 0x47, 0x54, 0x93, 0x45, 0x50, 0xc3, 0x72,
+    0x29, 0x91, 0xb8, 0x36, 0x24, 0x1e, 0x2a, 0xa5, 0x53, 0x67, 0xe3, 0x11,
+    0x82, 0x4f, 0x08, 0xb9, 0x11, 0x06, 0x1a, 0x19, 0x1f, 0x46, 0xf1, 0x99,
+    0xa4, 0x39, 0xe6, 0x85, 0xe7, 0x21, 0x52, 0xb6, 0xee, 0xcb, 0x81, 0x78,
+    0x77, 0x7e, 0xf4, 0xa9, 0x21, 0x18, 0xc8, 0xb5, 0x28, 0x0b, 0xd1, 0x97,
+    0xb2, 0x93, 0xb6, 0x63, 0xf6, 0x35, 0xdb, 0xfe, 0x63, 0xc9, 0x9b, 0x5a,
+    0x04, 0x1d, 0x7f, 0xff, 0xc0, 0x86, 0x3d, 0xa4, 0xeb, 0xa7, 0xb3, 0x9f,
+    0xad, 0xe4, 0x75, 0x30, 0xa8, 0x76, 0x78, 0xdf, 0x02, 0x77, 0x7e, 0xe3,
+    0x5d, 0xda, 0x68, 0xad, 0xef, 0xfc, 0xf2, 0x63, 0x38, 0xd7, 0x76, 0x9a,
+    0x27, 0x0b, 0x31, 0x87, 0xfa, 0xb3, 0x3b, 0x95, 0x41, 0x3a, 0xdd, 0x3a,
+    0xda, 0x3a, 0x80, 0x68, 0x36, 0xc4, 0x2f, 0x9a, 0xee, 0xd3, 0x45, 0xa3,
+    0x7f, 0xfb, 0x03, 0xd7, 0x52, 0x69, 0x93, 0x40, 0x59, 0xd5, 0xc3, 0xf9,
+    0xe9, 0x6d, 0xf3, 0x5c, 0x7f, 0x3a, 0xff, 0xa6, 0xc5, 0x7d, 0x73, 0x8f,
+    0xe3, 0xaf, 0xe8, 0x71, 0x00, 0x70, 0xeb, 0x91, 0x43, 0xaf, 0xff, 0xd3,
+    0xc7, 0xa0, 0x3c, 0x8e, 0xbe, 0x87, 0x3f, 0x3a, 0xff, 0xd1, 0xbb, 0xab,
+    0xf4, 0x5d, 0x5e, 0x73, 0xaf, 0xfd, 0x1c, 0xff, 0x13, 0x39, 0xe0, 0x1d,
+    0x50, 0x8d, 0x5e, 0xaa, 0x69, 0x12, 0xd9, 0x32, 0x63, 0x5a, 0x87, 0x5d,
+    0xfe, 0xef, 0x40, 0xa2, 0xe3, 0x47, 0x5f, 0xff, 0x93, 0x43, 0x9b, 0x1f,
+    0xc3, 0x9a, 0xeb, 0xcc, 0x75, 0x62, 0x22, 0x26, 0x34, 0xbe, 0xcf, 0xdf,
+    0xa7, 0x5d, 0xdd, 0x1d, 0x66, 0x15, 0x0a, 0xea, 0xd5, 0xb3, 0xac, 0x84,
+    0xeb, 0x48, 0xa6, 0x21, 0x59, 0xe7, 0x63, 0x44, 0xf4, 0x2d, 0xf6, 0xc8,
+    0xfe, 0x90, 0xdf, 0x35, 0xdd, 0xa6, 0x8b, 0x6a, 0xff, 0xfe, 0x87, 0xf4,
+    0x76, 0x34, 0x89, 0x24, 0xe6, 0x04, 0xeb, 0xfb, 0xb0, 0xb8, 0x40, 0x9d,
+    0x5c, 0x45, 0x76, 0x8b, 0x7c, 0xad, 0x7f, 0xee, 0xa0, 0x5e, 0x41, 0xea,
+    0x2c, 0xeb, 0xe8, 0xd9, 0x88, 0x75, 0xff, 0x44, 0xa3, 0x93, 0xc7, 0x27,
+    0x3a, 0xff, 0xa3, 0x9f, 0x35, 0x1d, 0x74, 0x3a, 0xff, 0x75, 0x1e, 0x5e,
+    0x49, 0xce, 0xac, 0x4c, 0xc5, 0xa6, 0x1c, 0x3d, 0x12, 0x16, 0x4e, 0x76,
+    0xce, 0x2f, 0xe5, 0x1f, 0x81, 0x00, 0x9d, 0x7f, 0x0e, 0xda, 0x73, 0x14,
+    0x3a, 0xfc, 0x93, 0xae, 0x1a, 0x75, 0xf9, 0xf7, 0x97, 0xdd, 0x1d, 0x66,
+    0x14, 0x45, 0x68, 0x96, 0xf8, 0xbf, 0x61, 0x3d, 0x30, 0x9a, 0x6f, 0xf1,
+    0x83, 0xdc, 0xbe, 0x9d, 0x7e, 0xe3, 0x5d, 0xda, 0x68, 0xb9, 0x6c, 0xc0,
+    0x4f, 0x27, 0x05, 0xaf, 0xdc, 0x6b, 0xbb, 0x4d, 0x17, 0x6d, 0xff, 0x24,
+    0xa4, 0x83, 0xfc, 0x48, 0xeb, 0x31, 0x87, 0xd4, 0xe6, 0x75, 0x0e, 0xc5,
+    0x3a, 0x72, 0x99, 0x4f, 0x31, 0x06, 0x36, 0x85, 0x29, 0x1a, 0x89, 0x5b,
+    0x78, 0xab, 0xc2, 0xdf, 0xb2, 0xf4, 0xc6, 0x5e, 0xf6, 0x9d, 0x7d, 0x09,
+    0x2b, 0xfc, 0xc6, 0x71, 0xae, 0xed, 0x34, 0x54, 0xf7, 0x83, 0x3a, 0xce,
+    0xb7, 0x8e, 0xbf, 0xe8, 0x79, 0xfe, 0x6f, 0xa8, 0x09, 0xd4, 0x87, 0x96,
+    0x22, 0x17, 0xcd, 0x77, 0x69, 0xa2, 0xb9, 0xbf, 0xcc, 0x67, 0x1a, 0xee,
+    0xd3, 0x45, 0x9d, 0x79, 0xde, 0x47, 0x5f, 0xc9, 0xac, 0x17, 0x64, 0xea,
+    0xe2, 0x2c, 0x7a, 0x5a, 0x27, 0xfe, 0x1a, 0xbf, 0xfd, 0xe8, 0xd7, 0xc0,
+    0x6b, 0xd1, 0x34, 0xc8, 0x75, 0xfc, 0x8b, 0x9c, 0x1c, 0x91, 0xd7, 0xfa,
+    0x3b, 0xf1, 0x6a, 0xda, 0xa3, 0xc7, 0x56, 0x22, 0xe7, 0xa9, 0xbb, 0x0b,
+    0xaf, 0xdc, 0xcf, 0x22, 0xce, 0xbe, 0x71, 0x80, 0x9d, 0x7f, 0x64, 0xd0,
+    0xb8, 0xfa, 0x75, 0xfb, 0x8d, 0x77, 0x69, 0xa2, 0x42, 0xbf, 0xf6, 0x2f,
+    0x1f, 0x93, 0xfc, 0xdd, 0x67, 0x5f, 0xf2, 0x6f, 0xaf, 0x0c, 0x2f, 0x47,
+    0x5d, 0x26, 0x31, 0x15, 0x9d, 0x33, 0xfd, 0x06, 0xff, 0xee, 0xa2, 0xf3,
+    0x5f, 0x37, 0x96, 0x78, 0xeb, 0xe9, 0x77, 0xee, 0x8e, 0xa8, 0x3e, 0xac,
+    0x46, 0xbe, 0x56, 0xfb, 0x0b, 0x3a, 0xfe, 0xee, 0xb5, 0x9c, 0x9c, 0xeb,
+    0xa1, 0x93, 0xab, 0x0f, 0x11, 0x0b, 0xac, 0xc4, 0xeb, 0x99, 0xe1, 0x68,
+    0xc8, 0x68, 0xa4, 0x3d, 0x78, 0x62, 0xb2, 0x6e, 0x8f, 0xbc, 0x36, 0x86,
+    0x14, 0xfa, 0x20, 0xf3, 0x55, 0xff, 0xcc, 0x75, 0xf4, 0x39, 0xef, 0x47,
+    0xe7, 0x5f, 0xfe, 0x61, 0x6f, 0x26, 0x33, 0x8d, 0x77, 0x69, 0xa2, 0x7c,
+    0xa6, 0xaf, 0x2e, 0x2b, 0xce, 0x87, 0x2e, 0x16, 0x7d, 0x44, 0xb9, 0x37,
+    0x3a, 0xff, 0xfa, 0x53, 0xaa, 0xd0, 0xad, 0xce, 0xde, 0x7c, 0xf9, 0xdd,
+    0xb3, 0xaa, 0x47, 0xf5, 0xf8, 0xb5, 0xfb, 0x39, 0x99, 0x31, 0xd6, 0x63,
+    0xa7, 0x93, 0xf4, 0x8e, 0xfd, 0xc6, 0xbb, 0xb4, 0xd1, 0x59, 0x5f, 0xf9,
+    0xe4, 0xc6, 0x71, 0xae, 0xed, 0x34, 0x4d, 0xd6, 0x63, 0x0f, 0xf5, 0x66,
+    0x74, 0xd4, 0x68, 0x24, 0x2a, 0x2f, 0xdc, 0x6b, 0xbb, 0x4d, 0x12, 0xb5,
+    0xf8, 0x60, 0x2f, 0xd3, 0xaf, 0xcc, 0x2d, 0xe4, 0xc6, 0x1e, 0xc2, 0x19,
+    0xdf, 0xfb, 0xd8, 0xc6, 0x71, 0x27, 0x75, 0x9d, 0x7f, 0xf9, 0x58, 0x56,
+    0x55, 0x1a, 0xc7, 0x92, 0x67, 0x30, 0xeb, 0xff, 0x26, 0x80, 0xb1, 0x4d,
+    0x80, 0x73, 0xaf, 0xe8, 0x17, 0x6b, 0xab, 0x9d, 0x52, 0x3e, 0xb5, 0x9f,
+    0x5c, 0x1e, 0x1d, 0x7e, 0xe3, 0x5d, 0xda, 0x68, 0x97, 0x2f, 0xf9, 0x1e,
+    0x5e, 0x18, 0x5e, 0x8e, 0xbf, 0x4b, 0x6d, 0x3a, 0xe7, 0x5e, 0x8d, 0xb8,
+    0x3a, 0xf2, 0x0c, 0x1d, 0x52, 0x3d, 0xf0, 0x94, 0xec, 0x1d, 0xbf, 0xff,
+    0x3f, 0x90, 0x12, 0x14, 0x94, 0x78, 0x41, 0x23, 0xaf, 0xe9, 0x77, 0x07,
+    0x1a, 0x75, 0xe9, 0x77, 0xc7, 0x5d, 0xd8, 0x43, 0xc7, 0xe9, 0x5d, 0xff,
+    0xc2, 0x9f, 0xeb, 0x90, 0x92, 0x7d, 0x1d, 0x58, 0x7d, 0xc8, 0x59, 0x79,
+    0xe4, 0xc2, 0xaf, 0x56, 0x31, 0x10, 0xc0, 0x91, 0x16, 0x0b, 0x74, 0xcd,
+    0xe1, 0x2b, 0xa3, 0x1f, 0x46, 0x0f, 0x66, 0x11, 0x5f, 0x72, 0xe5, 0xab,
+    0x5f, 0xfc, 0xc3, 0xc9, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0x8e, 0xef, 0xfb,
+    0xdd, 0xc9, 0x30, 0xe3, 0xa3, 0xaf, 0xe5, 0x50, 0xc3, 0x70, 0x4e, 0xb8,
+    0x1d, 0x3a, 0xfe, 0x54, 0x0e, 0x75, 0xfc, 0x75, 0xff, 0xfd, 0xe9, 0x20,
+    0x7a, 0x9b, 0x3e, 0x60, 0x78, 0x80, 0x69, 0xd7, 0xfb, 0x19, 0xd4, 0x0f,
+    0xb4, 0x75, 0xfe, 0x71, 0xfd, 0xf8, 0xff, 0x4e, 0xbf, 0xf2, 0x73, 0xe6,
+    0x87, 0x17, 0x0d, 0x3a, 0xff, 0xd0, 0x20, 0xf2, 0x3e, 0xc7, 0x91, 0xd7,
+    0xcd, 0x77, 0x69, 0xa2, 0xa1, 0xbf, 0xec, 0xee, 0x0b, 0xf3, 0x88, 0x75,
+    0x28, 0x8d, 0xd6, 0x9f, 0x70, 0xf7, 0x45, 0xb7, 0x4b, 0x0e, 0xbf, 0xe9,
+    0x79, 0x38, 0xed, 0x41, 0x3a, 0xff, 0xf3, 0xaf, 0x38, 0x38, 0x9b, 0x13,
+    0x8e, 0x75, 0xff, 0xdd, 0x1c, 0x9b, 0xdd, 0xce, 0x26, 0x8e, 0xbf, 0x6e,
+    0x28, 0xb4, 0x3a, 0xa1, 0x16, 0x18, 0x8e, 0x88, 0x77, 0xfa, 0x3c, 0xfd,
+    0xf8, 0x18, 0x3a, 0xff, 0xc0, 0xf8, 0xe3, 0x9b, 0x5f, 0x3a, 0x03, 0xaf,
+    0xf4, 0xa3, 0x93, 0xc7, 0x27, 0x3a, 0xff, 0xed, 0x6b, 0x07, 0xda, 0xc9,
+    0x27, 0x4e, 0xbf, 0xfe, 0x8f, 0xf0, 0x7e, 0x3f, 0xbe, 0x77, 0x3f, 0x73,
+    0xae, 0x19, 0xce, 0xa8, 0x46, 0xf6, 0x1a, 0x22, 0x10, 0xa9, 0x5f, 0xdb,
+    0x1d, 0x7d, 0x65, 0xce, 0xbf, 0xff, 0xc9, 0x1e, 0x7e, 0xb1, 0xae, 0xe0,
+    0xfb, 0xe7, 0xf2, 0xd1, 0xd6, 0xc4, 0x44, 0x90, 0x97, 0xdf, 0x77, 0xd9,
+    0x39, 0xd7, 0xec, 0x9d, 0xc7, 0x61, 0xd7, 0xff, 0xff, 0xfa, 0x25, 0xf3,
+    0xdd, 0x48, 0xd7, 0xcc, 0x03, 0x63, 0x67, 0xcc, 0xe7, 0x33, 0x60, 0x1f,
+    0xa7, 0x5f, 0x74, 0x5f, 0x68, 0xea, 0xc4, 0xc0, 0xc4, 0x8b, 0x45, 0x1e,
+    0x84, 0xb5, 0xff, 0xff, 0x01, 0xd5, 0xd2, 0x7e, 0xba, 0x7a, 0x3a, 0x9e,
+    0xd6, 0x04, 0xeb, 0x30, 0xa8, 0x5f, 0x6a, 0x56, 0xcb, 0x95, 0x42, 0xd0,
+    0x5f, 0x3a, 0xf0, 0x4c, 0xb2, 0x31, 0x06, 0x9f, 0x6e, 0x2b, 0xc8, 0x73,
+    0x2c, 0xb7, 0xa6, 0x63, 0x19, 0x16, 0xa1, 0x97, 0xe8, 0xca, 0x76, 0xd0,
+    0x6f, 0x9a, 0xee, 0xd3, 0x45, 0x51, 0x7f, 0xb9, 0x1b, 0x37, 0x96, 0x78,
+    0xea, 0xe1, 0xf1, 0x00, 0xb6, 0xff, 0xcf, 0x26, 0x33, 0x8d, 0x77, 0x69,
+    0xa2, 0x6b, 0xbc, 0xb7, 0xf1, 0xd6, 0x63, 0x11, 0x0e, 0xb2, 0x27, 0x4a,
+    0xbf, 0x71, 0xae, 0xed, 0x34, 0x55, 0x97, 0xfd, 0x12, 0x8e, 0x4f, 0x1c,
+    0x9c, 0xeb, 0x31, 0x87, 0xd8, 0x26, 0x77, 0xfe, 0x63, 0xb1, 0xbf, 0xa3,
+    0xae, 0xae, 0x75, 0xff, 0xcc, 0x3c, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x89,
+    0x12, 0xfd, 0xc6, 0xbb, 0xb4, 0xd1, 0x69, 0x5f, 0xf9, 0xe4, 0xc6, 0x71,
+    0xae, 0xed, 0x34, 0x4f, 0xb6, 0x63, 0x0f, 0xf5, 0x66, 0x77, 0xff, 0x98,
+    0x5b, 0xc9, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0xa1, 0x2f, 0xdd, 0x49, 0xe3,
+    0x87, 0x5f, 0xb8, 0xd7, 0x76, 0x9a, 0x28, 0xfb, 0xfe, 0x89, 0x47, 0x27,
+    0x8e, 0x4e, 0x75, 0xff, 0x86, 0x26, 0x81, 0x89, 0xbb, 0x07, 0x5f, 0xff,
+    0xd8, 0x1e, 0xc7, 0xd6, 0x3c, 0x2f, 0xfe, 0xb5, 0x1f, 0x95, 0x7e, 0x61,
+    0x6f, 0x26, 0x21, 0x32, 0xdc, 0x27, 0x13, 0x3f, 0x1c, 0xed, 0x9e, 0x54,
+    0x36, 0x46, 0xf3, 0xce, 0x16, 0xc8, 0xcb, 0x14, 0x54, 0x9f, 0xa2, 0x6c,
+    0x7e, 0xfb, 0xc2, 0x85, 0x09, 0xe6, 0x42, 0xec, 0x33, 0xbf, 0x28, 0xf4,
+    0x70, 0x97, 0xf9, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0x88, 0xaf, 0xec, 0xe3,
+    0x5d, 0xda, 0x68, 0x8a, 0xef, 0xf9, 0x5d, 0x8c, 0xe3, 0x5d, 0xda, 0x68,
+    0xae, 0x29, 0x84, 0x40, 0x39, 0xc5, 0xff, 0xef, 0xe0, 0x5a, 0xc3, 0xfb,
+    0xff, 0xa3, 0x23, 0xaf, 0x98, 0x9e, 0x65, 0x73, 0xac, 0x9b, 0x9f, 0xaf,
+    0xe9, 0xb7, 0xd9, 0xd7, 0xf1, 0xd7, 0xfb, 0x13, 0x9f, 0xfe, 0x0d, 0x1d,
+    0x65, 0x40, 0x9e, 0xa6, 0x88, 0x2f, 0xff, 0xef, 0x69, 0x3a, 0xe9, 0x24,
+    0x1f, 0x03, 0xbc, 0xc3, 0xaf, 0xdc, 0x6b, 0xbb, 0x4d, 0x14, 0xf5, 0xfe,
+    0x5a, 0x04, 0x0f, 0xc9, 0x1d, 0x72, 0xd0, 0xea, 0x83, 0xc7, 0x69, 0x95,
+    0xff, 0xfe, 0x94, 0x7b, 0x40, 0x5b, 0x53, 0xf8, 0xce, 0xa0, 0x1a, 0x75,
+    0xff, 0xfd, 0xce, 0x03, 0x9c, 0x81, 0xc5, 0x13, 0xbd, 0xcf, 0xa7, 0x5f,
+    0xfc, 0x92, 0xc1, 0xfe, 0x16, 0x9c, 0x91, 0xd7, 0xfa, 0x51, 0xc9, 0xe3,
+    0x93, 0x9d, 0x7d, 0xf0, 0x5e, 0x47, 0x5f, 0x9f, 0x3a, 0x8b, 0x3a, 0xb4,
+    0x78, 0xfb, 0x08, 0xaa, 0x11, 0x3f, 0x8f, 0x77, 0xfd, 0x02, 0xdc, 0xd9,
+    0x9e, 0xd1, 0xd7, 0xe7, 0x9e, 0x38, 0x03, 0xa9, 0x54, 0xac, 0xee, 0x0a,
+    0xf1, 0x61, 0xaf, 0x5b, 0x90, 0xa3, 0x03, 0xae, 0x0c, 0x38, 0x76, 0x10,
+    0xed, 0x9c, 0x5f, 0xfe, 0x79, 0x30, 0x11, 0x76, 0x75, 0xa8, 0xfc, 0xeb,
+    0xff, 0xdf, 0xfe, 0x0d, 0x31, 0xf4, 0x5d, 0x63, 0x07, 0x5f, 0xfc, 0x39,
+    0xfb, 0x8f, 0xec, 0x2d, 0x16, 0x75, 0x71, 0x12, 0x3e, 0x4d, 0xa6, 0x13,
+    0x96, 0x0c, 0x25, 0xd2, 0x1b, 0x97, 0x07, 0x0e, 0xbf, 0xf9, 0x03, 0xc7,
+    0xdd, 0x8e, 0x72, 0x27, 0x3a, 0x98, 0x3d, 0xbe, 0x8a, 0xdc, 0x18, 0x3a,
+    0xff, 0xfd, 0xd8, 0xe6, 0x49, 0x1f, 0xd8, 0x14, 0x03, 0x4a, 0xbf, 0x44,
+    0xbf, 0x04, 0x8e, 0xbe, 0x6b, 0xbb, 0x4d, 0x15, 0x9d, 0x4c, 0x7a, 0xbc,
+    0x28, 0xbe, 0xf2, 0x2f, 0x47, 0x5f, 0xd3, 0xae, 0x06, 0x5a, 0x3a, 0xfd,
+    0x9e, 0xd7, 0xdd, 0x1d, 0x7a, 0x27, 0x43, 0xaf, 0xde, 0xff, 0xe8, 0xc8,
+    0xeb, 0xc0, 0x7d, 0x1d, 0x7f, 0xd9, 0x24, 0x02, 0xba, 0xb7, 0xfa, 0xce,
+    0xbf, 0x64, 0xd3, 0x83, 0xf3, 0xac, 0xc4, 0x2a, 0x21, 0x08, 0xae, 0x42,
+    0x9f, 0x72, 0x3e, 0x10, 0xac, 0xb7, 0xa5, 0x2e, 0x36, 0x25, 0x5a, 0x1b,
+    0xfa, 0x83, 0x7f, 0xee, 0xa7, 0x9f, 0x93, 0xc2, 0x04, 0xeb, 0xf7, 0x90,
+    0x71, 0x67, 0x5f, 0x49, 0xc5, 0x8c, 0x3e, 0x2d, 0xa3, 0xdb, 0xff, 0x3c,
+    0x98, 0xce, 0x35, 0xdd, 0xa6, 0x89, 0x16, 0xff, 0xcf, 0xe6, 0x21, 0x38,
+    0x9e, 0x01, 0xd4, 0xc2, 0x21, 0xdd, 0x2a, 0xfe, 0xce, 0x35, 0xdd, 0xa6,
+    0x8b, 0x26, 0xff, 0xf7, 0xb5, 0xf7, 0x4c, 0x64, 0xe8, 0x32, 0xd1, 0xd4,
+    0xc2, 0x21, 0x70, 0xe2, 0xff, 0xff, 0x3a, 0x78, 0x1c, 0x7d, 0x30, 0xde,
+    0xa7, 0x22, 0x5a, 0x3a, 0xfe, 0xce, 0x35, 0xdd, 0xa6, 0x8b, 0x62, 0xff,
+    0xfe, 0x54, 0x77, 0xe0, 0xe7, 0x3d, 0xae, 0xcd, 0xf3, 0xe7, 0x76, 0xce,
+    0xbd, 0xc0, 0x74, 0xeb, 0xbc, 0xc4, 0x22, 0x1b, 0x8d, 0x54, 0xc2, 0x3b,
+    0x52, 0x17, 0xd7, 0xb3, 0x58, 0x75, 0xf3, 0x5d, 0xda, 0x68, 0xb6, 0xef,
+    0xb5, 0x3b, 0xf0, 0xea, 0xe1, 0xe7, 0xf8, 0xb6, 0xfe, 0x4e, 0xf9, 0x3f,
+    0x01, 0xd7, 0xfd, 0x12, 0x8e, 0x4f, 0x1c, 0x9c, 0xeb, 0x31, 0x24, 0x78,
+    0xe3, 0x4c, 0xc4, 0x42, 0x5b, 0x7f, 0xfb, 0x07, 0xf6, 0x16, 0xe1, 0xcc,
+    0x15, 0x0e, 0xbc, 0xaa, 0xe8, 0x4e, 0xbd, 0x3f, 0x50, 0xeb, 0xff, 0x2a,
+    0x95, 0x4a, 0xd3, 0xdd, 0xc1, 0x8f, 0xce, 0xbf, 0xa0, 0x64, 0x10, 0x2c,
+    0xeb, 0xe6, 0xbb, 0xb4, 0xd1, 0x78, 0x5f, 0xf9, 0xfd, 0x1b, 0x39, 0xcc,
+    0xdf, 0x47, 0x57, 0x0f, 0xb4, 0x4b, 0x6f, 0xbd, 0xb7, 0x9d, 0x3a, 0xfc,
+    0xb8, 0x19, 0x39, 0xd7, 0xfa, 0x50, 0x3e, 0xd8, 0xed, 0x3a, 0xff, 0x47,
+    0x9f, 0xbf, 0x03, 0x07, 0x5f, 0xfb, 0xea, 0xf7, 0x97, 0xb0, 0x7d, 0xa3,
+    0xae, 0xc5, 0x0e, 0xa8, 0x3d, 0x7c, 0x41, 0xbe, 0x49, 0xf1, 0x67, 0x5f,
+    0xb0, 0x7f, 0xda, 0x83, 0xaf, 0xd1, 0xf4, 0x0f, 0xa3, 0xaf, 0xff, 0x62,
+    0xe1, 0xbf, 0x30, 0x41, 0x2c, 0xd1, 0xd7, 0xff, 0x67, 0x7a, 0xf2, 0x5a,
+    0x47, 0x24, 0x75, 0xd1, 0xf9, 0xd5, 0x23, 0xd8, 0xf2, 0x15, 0x2a, 0x15,
+    0xce, 0xaa, 0x88, 0x15, 0x78, 0xe4, 0xe9, 0x99, 0x09, 0x9d, 0xc8, 0x50,
+    0x92, 0x62, 0x55, 0x99, 0xf6, 0x11, 0x4e, 0x41, 0xf9, 0x08, 0x94, 0xe8,
+    0xa3, 0xd0, 0xa1, 0xbf, 0xdb, 0xb1, 0x9f, 0xbf, 0x34, 0x75, 0xfe, 0xfd,
+    0x89, 0xa5, 0x03, 0xe3, 0xa9, 0x84, 0xd5, 0x62, 0x1d, 0x7c, 0x35, 0xbc,
+    0x99, 0xb9, 0xd7, 0xcd, 0x77, 0x69, 0xa2, 0xf4, 0xbf, 0xf2, 0x7b, 0xa2,
+    0xf2, 0xfd, 0xff, 0x3a, 0xb8, 0x7d, 0x6b, 0x2d, 0xbc, 0xb4, 0xf1, 0xd7,
+    0xfc, 0xfe, 0x94, 0x29, 0xe4, 0x9c, 0xea, 0x59, 0xea, 0x08, 0xdd, 0xfb,
+    0x17, 0xd7, 0x09, 0xd4, 0x14, 0xd0, 0xf2, 0x10, 0xdf, 0x5d, 0xb6, 0x88,
+    0x6f, 0xff, 0xf9, 0x36, 0x60, 0xb0, 0x1c, 0x0f, 0x71, 0x6b, 0x79, 0x60,
+    0x9d, 0x4c, 0x22, 0xb3, 0x11, 0xea, 0x1b, 0x63, 0xf9, 0xe1, 0x7f, 0x28,
+    0x4c, 0x64, 0xea, 0x73, 0x61, 0x2c, 0x92, 0x91, 0x26, 0x8c, 0x1f, 0x90,
+    0xc2, 0x5c, 0x2a, 0x3a, 0x47, 0xfc, 0x69, 0xa3, 0x18, 0xce, 0x90, 0xc1,
+    0x3a, 0x76, 0xcc, 0xa2, 0x5b, 0x81, 0xd3, 0xaf, 0xfe, 0x04, 0x4c, 0x39,
+    0xb1, 0xd6, 0xb4, 0x3a, 0xfb, 0x3a, 0xfe, 0x3a, 0xff, 0x62, 0x73, 0xff,
+    0xc1, 0xa3, 0xac, 0xa8, 0x51, 0x13, 0x02, 0x89, 0xa2, 0x0b, 0xef, 0x46,
+    0xf3, 0x9d, 0x7f, 0xde, 0xd6, 0x6f, 0x2e, 0x81, 0x43, 0xa9, 0x0f, 0x78,
+    0x48, 0xef, 0xa3, 0x64, 0x48, 0xeb, 0xf7, 0x1a, 0xee, 0xd3, 0x44, 0x47,
+    0x7f, 0xfd, 0xd0, 0x6b, 0x58, 0xb1, 0xcd, 0x9f, 0x21, 0x58, 0x3a, 0xff,
+    0xa2, 0x7e, 0x67, 0xbc, 0x9e, 0x3a, 0xf0, 0xc6, 0xe7, 0x54, 0x8f, 0x4c,
+    0x27, 0x17, 0xfd, 0x9c, 0xcd, 0x63, 0x8c, 0xe7, 0x5e, 0xc0, 0xac, 0xeb,
+    0xff, 0xfd, 0xd7, 0x4f, 0x47, 0x47, 0x3d, 0xd4, 0xee, 0x23, 0x27, 0x5f,
+    0xff, 0xfe, 0xf7, 0x91, 0x7c, 0x4c, 0xdc, 0x41, 0xe8, 0xef, 0xcd, 0x89,
+    0xe9, 0xa0, 0xea, 0x84, 0x6c, 0x62, 0xed, 0xfe, 0x75, 0xe7, 0x25, 0x0b,
+    0x3a, 0xe9, 0xd6, 0x55, 0xcc, 0xb2, 0x55, 0xff, 0x98, 0x6f, 0x52, 0x6e,
+    0xc4, 0xec, 0x7e, 0x6b, 0xd9, 0x17, 0xbe, 0xd9, 0x1e, 0x83, 0xaa, 0x47,
+    0xfa, 0x8b, 0x77, 0xf6, 0x3a, 0xf3, 0x7f, 0x1d, 0x7f, 0x9d, 0x8d, 0x27,
+    0x1f, 0xf3, 0xac, 0xae, 0x75, 0xff, 0x46, 0x6f, 0x0f, 0x27, 0x91, 0xd4,
+    0xac, 0x9e, 0x48, 0x44, 0xef, 0xe5, 0x71, 0xce, 0xbf, 0x8e, 0xbf, 0xa1,
+    0x4c, 0x14, 0x50, 0xeb, 0xfb, 0x3d, 0xb5, 0xec, 0xe9, 0xd5, 0x88, 0x89,
+    0x12, 0xed, 0x16, 0x5f, 0xff, 0xcd, 0x63, 0x8e, 0x29, 0xe6, 0x39, 0x1e,
+    0x17, 0xfc, 0xea, 0x56, 0xd7, 0xac, 0x15, 0x50, 0xae, 0x88, 0x4c, 0x48,
+    0x83, 0x08, 0x9a, 0x67, 0xbc, 0x2a, 0x90, 0x8a, 0x63, 0x6e, 0x43, 0xcf,
+    0xa4, 0x2f, 0x0d, 0xdf, 0xc8, 0x44, 0xb3, 0x4f, 0x9e, 0x85, 0x86, 0xc2,
+    0xeb, 0xb6, 0xba, 0x75, 0xfb, 0x8d, 0x77, 0x69, 0xa2, 0x2e, 0xbf, 0x7b,
+    0xff, 0xa3, 0x22, 0xaf, 0xda, 0xf7, 0x63, 0xf3, 0xaf, 0xcf, 0x3c, 0x70,
+    0x07, 0x59, 0x89, 0xd1, 0x8b, 0x83, 0x2e, 0x66, 0x02, 0xad, 0xb2, 0x8a,
+    0x61, 0x51, 0x44, 0xa3, 0xd5, 0xbf, 0xf9, 0x6f, 0x26, 0x33, 0x8d, 0x77,
+    0x69, 0xa2, 0x66, 0xbf, 0x95, 0x65, 0x68, 0xa8, 0xd4, 0x78, 0xeb, 0xdb,
+    0xc6, 0x8e, 0xbc, 0xd4, 0x59, 0xd7, 0xca, 0xaf, 0x38, 0x9d, 0x76, 0xda,
+    0xb2, 0x75, 0xd8, 0x03, 0xaf, 0xff, 0x76, 0x16, 0xfe, 0xcd, 0xff, 0x5f,
+    0xde, 0x9d, 0x7f, 0x7b, 0x27, 0xcf, 0xe6, 0x3a, 0xff, 0x7c, 0xc1, 0x7e,
+    0x7f, 0xb6, 0x75, 0xff, 0xf9, 0x6f, 0xdc, 0xdf, 0xfe, 0xb2, 0xfd, 0x9b,
+    0xa0, 0x3a, 0x82, 0x89, 0x0c, 0x37, 0xbb, 0x58, 0x75, 0xdb, 0x5e, 0x3a,
+    0xca, 0x93, 0xad, 0xfc, 0x1a, 0xd0, 0x0c, 0xdf, 0xff, 0xf9, 0x06, 0x1a,
+    0x30, 0xbf, 0x91, 0xce, 0x26, 0xce, 0x3b, 0xfe, 0x75, 0x2b, 0x2a, 0x8d,
+    0x9a, 0x3c, 0x82, 0xb3, 0x26, 0xf6, 0x17, 0xee, 0x45, 0xfa, 0x17, 0x89,
+    0xef, 0xe6, 0x60, 0x47, 0x3c, 0x75, 0xf3, 0xf5, 0x26, 0x3a, 0xfb, 0xb3,
+    0x40, 0x4e, 0xac, 0x3e, 0xe6, 0x95, 0xb9, 0x0d, 0xfe, 0x6a, 0x60, 0x87,
+    0xb0, 0x75, 0x1d, 0x7e, 0xeb, 0xfa, 0x5f, 0x9d, 0x7f, 0xfb, 0xe7, 0x5d,
+    0x3d, 0xf8, 0x04, 0x5e, 0x47, 0x56, 0x22, 0xb1, 0xa6, 0x08, 0x14, 0xb2,
+    0x8b, 0xff, 0xff, 0xff, 0xff, 0xca, 0xbd, 0x51, 0x8a, 0xbd, 0x54, 0xad,
+    0x15, 0xa3, 0x55, 0x30, 0xab, 0x95, 0x5c, 0x9f, 0x6b, 0x00, 0x15, 0x6b,
+    0x1b, 0x7b, 0xfd, 0xea, 0xaa, 0x21, 0x54, 0xae, 0xab, 0x7b, 0xe7, 0xce,
+    0xed, 0x9d, 0x7f, 0xfe, 0xff, 0x79, 0x74, 0x11, 0xc6, 0x3a, 0x8d, 0x7e,
+    0x1d, 0x7f, 0xf6, 0xec, 0xc7, 0x82, 0x8a, 0xfa, 0x85, 0x9d, 0x7f, 0xff,
+    0xe4, 0x5a, 0x73, 0xa0, 0xd4, 0xa3, 0x67, 0x20, 0x7d, 0xdc, 0x91, 0xd7,
+    0xfe, 0x4f, 0x23, 0x50, 0x3e, 0xc6, 0x9d, 0x58, 0x8f, 0x0f, 0x24, 0x6d,
+    0x36, 0x5f, 0x7b, 0x6f, 0x3a, 0x75, 0xff, 0xfe, 0x71, 0x68, 0xe0, 0x7a,
+    0x0f, 0x9d, 0x89, 0x72, 0x27, 0x3a, 0xb1, 0x10, 0xa0, 0x24, 0xbf, 0xff,
+    0xce, 0xa0, 0xe7, 0xe0, 0xd7, 0xc9, 0x27, 0x61, 0xa2, 0xe7, 0x5f, 0x79,
+    0x3a, 0x87, 0x5f, 0xf3, 0xf2, 0x5f, 0x31, 0xa1, 0xc3, 0xa9, 0x54, 0xb8,
+    0x0d, 0x11, 0x95, 0xe4, 0x69, 0x1d, 0x85, 0xbb, 0x91, 0x0b, 0x08, 0x08,
+    0x2d, 0xc3, 0xaf, 0xef, 0x62, 0xf7, 0xc5, 0x9d, 0x6e, 0xe1, 0xbd, 0x41,
+    0x0b, 0xfc, 0x00, 0xbc, 0xb4, 0x92, 0x3a, 0xff, 0xfc, 0x14, 0x19, 0xf3,
+    0x48, 0xfd, 0x61, 0x96, 0x59, 0x2a, 0xfe, 0xf7, 0x62, 0x7e, 0x80, 0xeb,
+    0xfb, 0x79, 0x6b, 0xf0, 0x4c, 0x75, 0xff, 0x4f, 0x9f, 0x84, 0x0f, 0xc9,
+    0x1d, 0x79, 0xdd, 0xa6, 0x8b, 0x3e, 0xfe, 0xfd, 0xc6, 0x48, 0xb3, 0xaa,
+    0x74, 0x46, 0xb4, 0xeb, 0xf2, 0x7b, 0xff, 0x27, 0x62, 0x49, 0xe8, 0xf6,
+    0x8e, 0xbf, 0xfd, 0xce, 0xbf, 0xcc, 0xd8, 0x39, 0xac, 0x13, 0xaf, 0xfe,
+    0xd7, 0x92, 0x66, 0x5c, 0x31, 0xbe, 0x8e, 0xa4, 0x44, 0x80, 0x12, 0xaf,
+    0x32, 0xcb, 0x25, 0x5f, 0xf9, 0xe5, 0xa1, 0xc6, 0x87, 0x38, 0x53, 0x05,
+    0xfd, 0xfb, 0x68, 0x0b, 0xc0, 0x9d, 0x7f, 0xbd, 0xdc, 0xd9, 0xf2, 0x4b,
+    0x3a, 0xb0, 0xf8, 0x40, 0x55, 0x7f, 0xed, 0xe4, 0x20, 0xff, 0xe3, 0x57,
+    0xf9, 0xd7, 0x42, 0x87, 0x54, 0x1e, 0xd4, 0xe8, 0x97, 0xfb, 0xa8, 0x11,
+    0x77, 0x98, 0xeb, 0xfc, 0x1e, 0x81, 0xff, 0xdb, 0xc3, 0xaa, 0x0f, 0x9d,
+    0x0c, 0x6f, 0xf9, 0x04, 0x3f, 0x42, 0x0f, 0x68, 0xeb, 0xd0, 0x2a, 0x1d,
+    0x52, 0x5d, 0x00, 0x09, 0x2b, 0x4c, 0xb7, 0x58, 0x98, 0xbb, 0x90, 0xbe,
+    0x59, 0x97, 0x61, 0x99, 0xfa, 0x08, 0xc2, 0xb7, 0x4f, 0x7e, 0x84, 0x4e,
+    0xc2, 0x0f, 0xa7, 0x57, 0xfd, 0xc7, 0x67, 0xa9, 0x1c, 0x83, 0xaf, 0xfd,
+    0xc4, 0xd4, 0xbe, 0xf6, 0x06, 0x0e, 0xbe, 0xe2, 0x42, 0xce, 0xbf, 0xff,
+    0x79, 0x40, 0x46, 0x07, 0xb9, 0xad, 0xe5, 0x1d, 0x3a, 0xb8, 0x8b, 0x45,
+    0x9f, 0x09, 0x05, 0xcf, 0x23, 0xaf, 0xff, 0xff, 0xe1, 0x76, 0x7d, 0x9d,
+    0x1c, 0xf0, 0x3f, 0x5b, 0xc9, 0xc3, 0x02, 0xfc, 0x79, 0x1d, 0x7f, 0xb3,
+    0xbd, 0x07, 0x9c, 0x4e, 0xbe, 0x5a, 0x4d, 0xa3, 0xac, 0x81, 0x47, 0x6c,
+    0xc2, 0xbc, 0x84, 0x2a, 0xcc, 0x6f, 0xdc, 0x9b, 0x66, 0x04, 0xeb, 0xff,
+    0x63, 0x3b, 0x5c, 0xcd, 0xa1, 0x03, 0x27, 0x54, 0x27, 0xa7, 0xd8, 0xc7,
+    0x1d, 0x20, 0x4a, 0xaf, 0xff, 0xff, 0xbf, 0xd6, 0x60, 0xa9, 0xf7, 0x83,
+    0x19, 0xd6, 0x34, 0x39, 0x3a, 0xf1, 0x67, 0x5f, 0xbe, 0xc0, 0xfd, 0x59,
+    0xd5, 0x88, 0xa9, 0xf3, 0xfd, 0xfb, 0x63, 0xf6, 0x3e, 0x9d, 0x58, 0x79,
+    0x88, 0x45, 0x7b, 0x51, 0x39, 0xd7, 0xfd, 0x18, 0xde, 0xa6, 0xc7, 0xe1,
+    0xd7, 0x67, 0x4e, 0xa1, 0x3c, 0xdd, 0xb3, 0x8a, 0x92, 0x2b, 0x74, 0x41,
+    0xe6, 0x9b, 0xdd, 0x03, 0x27, 0x5e, 0xfc, 0x0d, 0x3a, 0xf7, 0xb3, 0xe9,
+    0xd7, 0xf4, 0x6f, 0xaf, 0x9c, 0x83, 0xaf, 0x04, 0x0d, 0x3a, 0xf8, 0x23,
+    0x12, 0x3a, 0x90, 0xde, 0x38, 0xe5, 0x05, 0x1c, 0x3b, 0x8e, 0xa0, 0xea,
+    0xc7, 0x7a, 0xd7, 0x76, 0x34, 0xeb, 0xfb, 0x89, 0xb3, 0x07, 0x47, 0x5f,
+    0xdb, 0xfb, 0x3a, 0x05, 0x73, 0xaf, 0xee, 0x67, 0x7a, 0x0f, 0x1d, 0x7e,
+    0xe8, 0xc6, 0x70, 0xcb, 0xfb, 0x39, 0x38, 0x1c, 0x26, 0x88, 0x35, 0x83,
+    0x4b, 0x6e, 0x4e, 0x89, 0xd9, 0x29, 0x54, 0x23, 0xe1, 0x21, 0x9d, 0x7e,
+    0x76, 0xa2, 0xe0, 0xeb, 0xfa, 0x5d, 0x17, 0xdf, 0xc7, 0x5b, 0x1a, 0x7a,
+    0x42, 0x4b, 0x7e, 0x8f, 0x7c, 0x5b, 0x27, 0x5f, 0xe9, 0x22, 0xe3, 0xbf,
+    0x42, 0x75, 0xff, 0xe8, 0xc1, 0xdf, 0xd9, 0xc4, 0x9d, 0xd6, 0x75, 0xf9,
+    0xd9, 0xf6, 0x77, 0x47, 0xf9, 0xe3, 0x4a, 0x56, 0xd5, 0x5e, 0xc0, 0xac,
+    0xa3, 0x25, 0xc7, 0x8e, 0x13, 0x0c, 0x29, 0xaf, 0x6b, 0x24, 0x75, 0xf9,
+    0x37, 0x92, 0x09, 0xd7, 0x93, 0xb8, 0x75, 0xd0, 0xbc, 0x3c, 0x06, 0x93,
+    0x5f, 0x07, 0x5d, 0x83, 0xaf, 0xc3, 0xc6, 0x5e, 0x73, 0xab, 0x0f, 0x25,
+    0xc8, 0x6e, 0x00, 0x9d, 0x50, 0x98, 0x2a, 0x2d, 0xf1, 0xd7, 0x44, 0x17,
+    0xbb, 0x82, 0x75, 0xfe, 0x9a, 0x27, 0x5b, 0xcd, 0x07, 0x5f, 0xff, 0x3a,
+    0x9e, 0x8e, 0x7f, 0xc8, 0xf0, 0xbf, 0xe7, 0x5f, 0xff, 0xc2, 0xea, 0x7c,
+    0xfa, 0x2f, 0xed, 0x26, 0xfd, 0x46, 0x4e, 0xac, 0x47, 0xeb, 0x8d, 0x09,
+    0xa0, 0x14, 0x2e, 0xd6, 0xc3, 0xaf, 0x90, 0x5c, 0x27, 0x5f, 0xf9, 0x79,
+    0xed, 0x7d, 0xd3, 0xcb, 0x0e, 0xbf, 0x6a, 0x39, 0xe8, 0x39, 0x83, 0x7f,
+    0x41, 0x44, 0xae, 0x97, 0xaf, 0xdf, 0x66, 0x77, 0xe1, 0xd7, 0xdd, 0xc4,
+    0xd8, 0x75, 0xfd, 0xa4, 0xe6, 0x03, 0x87, 0x5f, 0xff, 0xe8, 0x9b, 0xe2,
+    0x34, 0x1c, 0xd0, 0x3e, 0x2d, 0x3d, 0xd4, 0x3a, 0xb1, 0x3a, 0xc4, 0x85,
+    0x6a, 0xc8, 0xfa, 0x53, 0xe2, 0x2d, 0xa2, 0xcb, 0x96, 0xa8, 0x34, 0x5f,
+    0x97, 0xda, 0xe6, 0x61, 0xd7, 0xff, 0x4b, 0xc0, 0x94, 0x97, 0xef, 0x42,
+    0xce, 0xbf, 0xde, 0xd4, 0x4f, 0x9a, 0x09, 0xd7, 0x77, 0x0e, 0xbf, 0xfe,
+    0xec, 0x07, 0x1b, 0xf3, 0x07, 0x03, 0xd8, 0x3a, 0xff, 0xe4, 0xc1, 0xcc,
+    0xd7, 0xc9, 0x69, 0x67, 0x5f, 0xf9, 0xe3, 0x79, 0x7c, 0xd6, 0xe1, 0x83,
+    0xa8, 0x29, 0xbf, 0xee, 0x40, 0x88, 0xaa, 0xe6, 0x73, 0x0a, 0xe9, 0x3b,
+    0xc8, 0x77, 0x94, 0x8e, 0x1d, 0x7f, 0x06, 0x3f, 0xe6, 0x6e, 0x75, 0x30,
+    0x79, 0x4b, 0x1c, 0xbf, 0xd0, 0xbc, 0x4e, 0x4d, 0x23, 0xae, 0x49, 0x8e,
+    0xbf, 0xfd, 0xe8, 0xe8, 0xbc, 0xf1, 0xce, 0x3c, 0x8e, 0xbd, 0xe4, 0x9c,
+    0xeb, 0xf7, 0xef, 0xbc, 0x4c, 0x75, 0xe1, 0x86, 0x9d, 0x7f, 0xf0, 0x52,
+    0x6e, 0xc7, 0x37, 0x94, 0x70, 0xeb, 0xff, 0x85, 0xf7, 0xd6, 0xb3, 0x81,
+    0xee, 0x1d, 0x7f, 0xfa, 0x1b, 0xf3, 0x98, 0x80, 0x54, 0xe6, 0xd6, 0x1d,
+    0x48, 0x89, 0x31, 0x43, 0xaf, 0x89, 0xdb, 0x20, 0xb2, 0xd2, 0x1c, 0x70,
+    0x4a, 0x74, 0x35, 0xb5, 0x0d, 0x8b, 0x41, 0xd7, 0xba, 0x9e, 0x3a, 0xdb,
+    0x30, 0xd5, 0x7d, 0x0f, 0xa8, 0x5d, 0x82, 0x0a, 0xf6, 0x47, 0x4c, 0x90,
+    0xb3, 0xe9, 0x1b, 0xc7, 0xd1, 0xfc, 0x25, 0xaf, 0xfb, 0x06, 0x43, 0x8b,
+    0x86, 0x9d, 0x7e, 0xea, 0x6c, 0xc0, 0x9d, 0x7f, 0xe0, 0xc0, 0xe0, 0x82,
+    0x59, 0xa3, 0xaf, 0xce, 0xb4, 0xda, 0xc3, 0xaf, 0x7a, 0x37, 0x3a, 0xb0,
+    0xf1, 0x1c, 0xa2, 0xf4, 0x24, 0xc7, 0x5e, 0x15, 0x67, 0x68, 0xeb, 0xf6,
+    0x4e, 0xb8, 0xd1, 0xd7, 0xff, 0xfe, 0x8e, 0xa2, 0xd8, 0x9a, 0x4f, 0xcf,
+    0xbd, 0x4d, 0xf4, 0xd4, 0x9c, 0xea, 0x0a, 0x7a, 0x4a, 0x1a, 0xa1, 0x44,
+    0xcf, 0xfd, 0x20, 0x11, 0xbd, 0x11, 0xed, 0x13, 0xdf, 0xcf, 0xc8, 0xef,
+    0xd0, 0x9d, 0x7d, 0x09, 0x3c, 0x1d, 0x7c, 0xcb, 0xe6, 0x8e, 0xbf, 0xe9,
+    0x2d, 0xe5, 0xed, 0x42, 0x87, 0x54, 0x1e, 0xd3, 0x90, 0xde, 0xd2, 0x09,
+    0xd7, 0xe1, 0x6f, 0xcd, 0x6e, 0x75, 0x61, 0xe2, 0x38, 0xd5, 0x3a, 0x65,
+    0x9f, 0x97, 0x0b, 0xd0, 0x19, 0x2e, 0x9e, 0x47, 0x5e, 0x4e, 0xa1, 0xd5,
+    0xb9, 0xb1, 0xf0, 0xbd, 0xf7, 0xd0, 0x3e, 0x8e, 0xbf, 0xd2, 0x00, 0xcf,
+    0xa4, 0xdc, 0xeb, 0xef, 0xff, 0xcd, 0xce, 0xbf, 0xb6, 0xbd, 0x8e, 0x2d,
+    0x3a, 0xff, 0x80, 0xf2, 0x0e, 0x67, 0xfa, 0x3a, 0xff, 0x7e, 0x9b, 0xef,
+    0x2c, 0xf1, 0xd5, 0xd3, 0xed, 0xd1, 0xc5, 0xfb, 0x7d, 0x2d, 0x15, 0xce,
+    0xbf, 0xff, 0x66, 0xbe, 0x75, 0xd3, 0xdf, 0x80, 0x45, 0xe4, 0x75, 0x42,
+    0x20, 0x04, 0xae, 0xfe, 0x79, 0xff, 0x71, 0x09, 0xd5, 0x32, 0x7c, 0x7c,
+    0x34, 0xe9, 0x27, 0xa1, 0x37, 0xb2, 0x14, 0x5b, 0x64, 0x37, 0xfd, 0xdf,
+    0xb0, 0xdd, 0xbc, 0xe4, 0x1d, 0x50, 0xaa, 0xab, 0x25, 0x03, 0x3b, 0x45,
+    0xd3, 0x00, 0xeb, 0x2c, 0xea, 0xdc, 0xd3, 0xaa, 0x45, 0xef, 0xfe, 0x8e,
+    0x66, 0xc7, 0x97, 0xf9, 0x81, 0x3a, 0xfe, 0x7d, 0xe4, 0x30, 0x13, 0xaf,
+    0xfa, 0x37, 0x92, 0x0a, 0xdf, 0xc7, 0x53, 0x9f, 0x18, 0x96, 0x5f, 0x9e,
+    0x59, 0x3c, 0x1d, 0x7f, 0xf4, 0x6b, 0x58, 0xbf, 0x0c, 0x2f, 0x47, 0x5f,
+    0xfc, 0x91, 0xa1, 0x79, 0x7c, 0xd6, 0x70, 0xeb, 0xff, 0xfc, 0x9a, 0x9f,
+    0x19, 0xc1, 0x06, 0xd4, 0x31, 0x82, 0xfc, 0x3a, 0xff, 0x6f, 0x2d, 0x4d,
+    0x28, 0x9c, 0xea, 0x0a, 0x68, 0x6d, 0x26, 0x14, 0x2f, 0x21, 0x81, 0x8a,
+    0xff, 0xff, 0xdd, 0x4d, 0xfd, 0x9b, 0xfb, 0x9c, 0x8f, 0x7f, 0xf4, 0x65,
+    0xdc, 0x3a, 0xf8, 0x21, 0x71, 0x3a, 0xff, 0xd2, 0x81, 0xf7, 0x13, 0x66,
+    0x04, 0xeb, 0xff, 0x3f, 0x5a, 0x8f, 0xf3, 0x4f, 0xd3, 0xaf, 0xff, 0xda,
+    0x1f, 0x9d, 0x74, 0xf7, 0xe0, 0x11, 0x79, 0x1d, 0x7f, 0xba, 0x8a, 0x6d,
+    0x83, 0x8a, 0x1d, 0x7f, 0xd0, 0xca, 0xfb, 0x08, 0x33, 0x9d, 0x7f, 0xfc,
+    0x39, 0xac, 0x5c, 0x37, 0x3c, 0x9c, 0xc3, 0xad, 0x8d, 0x45, 0xdf, 0x8e,
+    0x36, 0x1c, 0x5f, 0xd3, 0xe7, 0x11, 0xb0, 0x75, 0xf0, 0x86, 0x16, 0x75,
+    0xfb, 0x66, 0x08, 0x1c, 0xeb, 0xf9, 0xff, 0xc0, 0xbc, 0x8e, 0xa8, 0x3f,
+    0x3c, 0x20, 0x42, 0x7a, 0x44, 0x65, 0xf6, 0x13, 0xf5, 0x0b, 0xb7, 0xf3,
+    0x93, 0x06, 0x14, 0xf9, 0x1b, 0x1b, 0x52, 0x91, 0xc2, 0x62, 0x0e, 0x9f,
+    0x7e, 0x7c, 0x31, 0x88, 0x7a, 0x30, 0x2b, 0xff, 0xb0, 0x7f, 0xcc, 0xe6,
+    0xbd, 0x18, 0x75, 0xff, 0x6f, 0xec, 0xe2, 0x4e, 0xeb, 0x3a, 0xd9, 0xf9,
+    0xfd, 0x0a, 0x0d, 0xe5, 0x4c, 0x90, 0xeb, 0xe8, 0x17, 0x91, 0xd7, 0xec,
+    0x57, 0x71, 0xff, 0xe1, 0xbe, 0xe0, 0xfd, 0xfd, 0xb3, 0xa9, 0x1c, 0xd1,
+    0xd7, 0xff, 0xe8, 0x19, 0x67, 0x51, 0x61, 0xc9, 0xa3, 0x38, 0x75, 0xf3,
+    0x7a, 0x93, 0x1d, 0x7f, 0xfe, 0x1c, 0x51, 0x44, 0x0f, 0x52, 0x6e, 0xa6,
+    0xfe, 0x3a, 0xa0, 0xfe, 0x70, 0x8a, 0xf3, 0x5f, 0x87, 0x5f, 0xb4, 0xd8,
+    0xe2, 0x87, 0x57, 0x4f, 0x0f, 0xf1, 0xbb, 0xfd, 0x92, 0xc4, 0x0f, 0x50,
+    0xeb, 0xef, 0x49, 0x7d, 0x3a, 0xf9, 0x14, 0x46, 0x4e, 0xac, 0x3c, 0x41,
+    0x22, 0xbb, 0xe6, 0x1d, 0x7d, 0xa1, 0x85, 0x9d, 0x50, 0x6d, 0xf7, 0x17,
+    0xbe, 0xce, 0xc9, 0x67, 0x54, 0x2b, 0x33, 0x93, 0x2e, 0x21, 0x28, 0x5d,
+    0xd8, 0x65, 0xbb, 0x18, 0x91, 0xe9, 0xd0, 0x0a, 0xfb, 0x64, 0x37, 0x82,
+    0xb6, 0x9d, 0x6e, 0x9d, 0x76, 0xa4, 0x75, 0x7e, 0x69, 0x80, 0x21, 0x7f,
+    0x4f, 0x34, 0x95, 0x5c, 0x9c, 0xeb, 0xcf, 0x9c, 0x3a, 0xf0, 0xe7, 0x8e,
+    0xae, 0x9b, 0x41, 0x1a, 0xbb, 0xc2, 0x75, 0xe8, 0xdf, 0x47, 0x5f, 0x20,
+    0xcb, 0x0e, 0xbd, 0x3b, 0x89, 0xd4, 0x13, 0xd6, 0x58, 0xe7, 0x87, 0xef,
+    0xd9, 0xee, 0xa7, 0x8e, 0xbf, 0x3e, 0xf9, 0xbf, 0x8e, 0xb2, 0x9d, 0x3c,
+    0xef, 0x13, 0x5c, 0x9c, 0x3a, 0xfe, 0x9f, 0xe4, 0xee, 0xfd, 0x3a, 0x95,
+    0x94, 0xf7, 0xe1, 0xa6, 0x44, 0x18, 0xd6, 0x8f, 0xbd, 0x29, 0x71, 0x5b,
+    0xfe, 0xc0, 0x85, 0x37, 0xcd, 0xfc, 0x75, 0xf3, 0x46, 0x24, 0x75, 0x74,
+    0xf6, 0x5c, 0xe6, 0xff, 0x46, 0x7a, 0x3a, 0xe1, 0x3a, 0xa7, 0x3d, 0x10,
+    0x90, 0xdf, 0xfc, 0x18, 0x0f, 0x23, 0xc8, 0xd4, 0x09, 0xd7, 0xd3, 0x46,
+    0xd4, 0x8e, 0xbf, 0xbc, 0xd0, 0x85, 0x7c, 0x3a, 0xff, 0xa6, 0xd6, 0xc7,
+    0x19, 0xc0, 0x13, 0xaf, 0xb3, 0xd8, 0xb3, 0xae, 0x15, 0x0e, 0xb6, 0x9c,
+    0xdb, 0x00, 0x82, 0xfe, 0xe8, 0x27, 0x9b, 0xa8, 0x75, 0xf0, 0x8e, 0x78,
+    0xea, 0x84, 0xe7, 0x82, 0x47, 0x88, 0x4a, 0x12, 0xa1, 0x74, 0xce, 0x5d,
+    0x26, 0xf1, 0x7d, 0xfd, 0xf2, 0x68, 0xf0, 0xec, 0x3a, 0xff, 0xf0, 0xc6,
+    0xce, 0x47, 0x31, 0x3b, 0x01, 0x3a, 0xf0, 0xba, 0xce, 0xa9, 0x22, 0x4f,
+    0x0c, 0x51, 0x22, 0xcc, 0x2b, 0x2e, 0xe9, 0xf9, 0x5b, 0x3c, 0x56, 0x83,
+    0x8a, 0xd4, 0x6e, 0x25, 0x2d, 0x4f, 0x0e, 0xb9, 0x43, 0x64, 0x33, 0x88,
+    0x39, 0x3b, 0x6a, 0xa4, 0x37, 0x1b, 0x2a, 0xfb, 0x78, 0xf8, 0xd2, 0x31,
+    0x19, 0xa5, 0x83, 0xf2, 0x36, 0xb5, 0xc6, 0x73, 0xd9, 0xf6, 0x87, 0x94,
+    0x99, 0xfc, 0x74, 0x2a, 0x96, 0xe1, 0x95, 0x99, 0xa9, 0xe1, 0xcf, 0x4e,
+    0x2f, 0x02, 0x12, 0x4c, 0xa1, 0x6d, 0xca, 0x01, 0xfb, 0x2a, 0xbb, 0x6a,
+    0x30, 0x4a, 0x61, 0xde, 0x82, 0x76, 0xdd, 0x67, 0x5f, 0xfe, 0x61, 0x6f,
+    0x26, 0x33, 0x8d, 0x77, 0x69, 0xa2, 0x6c, 0xbf, 0xcc, 0x67, 0x1a, 0xee,
+    0xd3, 0x45, 0x5b, 0x7f, 0xa5, 0x20, 0x78, 0x62, 0x47, 0x5f, 0x67, 0x5f,
+    0xc7, 0x59, 0x51, 0x87, 0xa4, 0x26, 0x57, 0xfb, 0x98, 0xd8, 0xff, 0xea,
+    0xce, 0xbf, 0xe8, 0xec, 0x4f, 0xc8, 0xc0, 0x9d, 0x5c, 0x3e, 0xce, 0x9a,
+    0xdf, 0xa3, 0x8b, 0xe8, 0x4e, 0xbc, 0x1c, 0x13, 0xaf, 0x3b, 0xb4, 0xd1,
+    0x5a, 0x5f, 0x94, 0xdf, 0x40, 0xdc, 0xea, 0x69, 0xe9, 0x21, 0x3d, 0xff,
+    0xe4, 0xf4, 0xa1, 0xbd, 0x4f, 0x69, 0xf7, 0x3a, 0xb8, 0x7d, 0x5b, 0x08,
+    0x6f, 0xff, 0x75, 0x17, 0x0d, 0xc5, 0xe0, 0xfb, 0x6c, 0xeb, 0xff, 0xe6,
+    0xc7, 0x33, 0xf7, 0x5b, 0xca, 0x11, 0xa7, 0x5f, 0xff, 0x4b, 0x58, 0x30,
+    0xb7, 0xcf, 0x7a, 0x16, 0x75, 0xde, 0xf4, 0x22, 0x65, 0xd3, 0x6f, 0xff,
+    0xff, 0x46, 0xc4, 0xf6, 0xb1, 0x46, 0xf5, 0x3d, 0x93, 0x0c, 0x2e, 0x7c,
+    0x64, 0xeb, 0xfd, 0x1e, 0x7e, 0xfc, 0x0c, 0x1d, 0x7d, 0x2f, 0x24, 0xe7,
+    0x5f, 0xbe, 0xf8, 0x63, 0xf3, 0xab, 0x73, 0xcb, 0xd8, 0x45, 0x7f, 0x9e,
+    0x5e, 0x49, 0xfa, 0x87, 0x54, 0x1e, 0xba, 0x12, 0xdf, 0xb3, 0xa9, 0x8b,
+    0x3a, 0xff, 0xe1, 0x74, 0x6f, 0x5c, 0x13, 0xf1, 0x0e, 0xa9, 0xcf, 0x9f,
+    0xa4, 0xb7, 0xfa, 0x51, 0xc9, 0xe3, 0x93, 0x9d, 0x7b, 0x39, 0xf9, 0xd7,
+    0xe9, 0xb0, 0x2b, 0x57, 0x3a, 0xfe, 0x18, 0x67, 0x79, 0x68, 0xea, 0x43,
+    0xf5, 0x98, 0x73, 0x68, 0xae, 0xa1, 0x1b, 0x79, 0x0a, 0x9b, 0xff, 0xff,
+    0xfb, 0x11, 0xb9, 0xe8, 0x1f, 0x6b, 0xe4, 0x20, 0x71, 0x7f, 0x39, 0x09,
+    0x27, 0xd1, 0xd7, 0xf6, 0x79, 0xc7, 0xf0, 0x1d, 0x7f, 0x77, 0xe2, 0x4e,
+    0xe2, 0x75, 0x48, 0xf6, 0xb0, 0xb2, 0xcc, 0x2a, 0x97, 0xb9, 0x62, 0x12,
+    0xd3, 0x91, 0x04, 0x9f, 0x21, 0xac, 0xd2, 0x44, 0x87, 0x1f, 0x0b, 0x56,
+    0xf5, 0xd8, 0x6a, 0xbc, 0x21, 0xc6, 0x1f, 0xda, 0x26, 0xf4, 0x38, 0x6f,
+    0xf3, 0x19, 0xc6, 0xbb, 0xb4, 0xd1, 0x60, 0x5f, 0xb8, 0xd7, 0x76, 0x9a,
+    0x27, 0x5b, 0xff, 0xfd, 0xd8, 0x9c, 0x38, 0xb6, 0x35, 0xac, 0xea, 0x68,
+    0x13, 0x9d, 0x7e, 0x61, 0x6f, 0x26, 0x31, 0x12, 0xd3, 0x19, 0xdf, 0xe9,
+    0x69, 0x85, 0x14, 0x85, 0x9d, 0x7e, 0xe3, 0x5d, 0xda, 0x68, 0xb6, 0x6f,
+    0xff, 0xf3, 0xc9, 0x8d, 0x42, 0x60, 0x53, 0x35, 0x9e, 0x18, 0x3a, 0xff,
+    0xdf, 0xc6, 0x98, 0xea, 0x35, 0xf8, 0x75, 0xff, 0x44, 0xa3, 0x93, 0xc7,
+    0x27, 0x3a, 0xcc, 0x62, 0x60, 0xeb, 0x33, 0x75, 0xc1, 0x3f, 0xbf, 0xff,
+    0x3f, 0xff, 0x83, 0x4c, 0x67, 0x1f, 0x5d, 0x79, 0x1d, 0x7c, 0xd7, 0x76,
+    0x9a, 0x2e, 0x6b, 0x2c, 0xea, 0xe1, 0xbd, 0x64, 0xb6, 0xff, 0x70, 0x73,
+    0x7f, 0xd2, 0x47, 0x5d, 0x32, 0xce, 0xa3, 0xac, 0xc6, 0x1f, 0xb2, 0x11,
+    0x32, 0x67, 0xb6, 0x2f, 0x7e, 0xe3, 0x5d, 0xda, 0x68, 0xbb, 0xef, 0xf4,
+    0x98, 0xd7, 0x38, 0x8c, 0x9d, 0x66, 0x30, 0xfa, 0x1c, 0xce, 0xf9, 0x85,
+    0x03, 0xf9, 0xd5, 0x0f, 0x95, 0x6f, 0x96, 0xf4, 0xc1, 0xa6, 0xbb, 0xab,
+    0xa4, 0xfb, 0xb7, 0x21, 0xd8, 0xb8, 0x6a, 0xba, 0x17, 0xf1, 0x9e, 0x8a,
+    0x16, 0xa3, 0x0a, 0xf4, 0x2b, 0x7e, 0x93, 0xdf, 0xf9, 0x97, 0x19, 0xf4,
+    0x83, 0xbc, 0x8e, 0xbf, 0xfb, 0x27, 0xc6, 0x7b, 0x9a, 0xc4, 0x13, 0xae,
+    0x46, 0x3a, 0x88, 0x11, 0x3f, 0xbf, 0x6b, 0x4b, 0x79, 0x1d, 0x7f, 0xff,
+    0xff, 0xee, 0xa7, 0x52, 0x07, 0xc2, 0xea, 0x67, 0x81, 0xe4, 0xf6, 0xba,
+    0x9c, 0x89, 0xdf, 0x8d, 0x3a, 0xed, 0x41, 0xd7, 0xff, 0x6e, 0xd0, 0x3e,
+    0xfe, 0xcc, 0x15, 0x0e, 0xbc, 0x2e, 0xc4, 0x26, 0x30, 0xd2, 0x7d, 0x42,
+    0x5f, 0xc2, 0xb7, 0x80, 0xeb, 0x3a, 0xfd, 0x9b, 0x5e, 0x85, 0x0e, 0xb6,
+    0xd1, 0xd5, 0x39, 0xbd, 0xc2, 0xaa, 0xe1, 0xfc, 0x8a, 0xc5, 0xff, 0xb4,
+    0xea, 0x75, 0x20, 0x41, 0x07, 0x5f, 0xfb, 0xaf, 0xe7, 0xee, 0xf2, 0xcf,
+    0x1d, 0x58, 0x7f, 0x48, 0x79, 0x73, 0xfe, 0x75, 0xff, 0xff, 0xe1, 0x76,
+    0x47, 0x3d, 0xec, 0x9e, 0x05, 0xd4, 0xd2, 0xe3, 0x04, 0x27, 0x56, 0x22,
+    0x2b, 0x82, 0xd7, 0xfb, 0xb8, 0x14, 0xd9, 0xcc, 0x3a, 0xf3, 0xbb, 0x4d,
+    0x12, 0xbd, 0xfe, 0x51, 0xc7, 0xff, 0x67, 0x4e, 0xa6, 0x9e, 0xd2, 0x13,
+    0xdf, 0xfe, 0xf7, 0x72, 0x4d, 0xea, 0x06, 0x07, 0xc7, 0x54, 0x91, 0xed,
+    0xc8, 0x46, 0x89, 0x0d, 0xd2, 0x9c, 0xeb, 0xff, 0x0b, 0xb2, 0x1e, 0xc4,
+    0xf8, 0xc9, 0xd7, 0xff, 0xec, 0x4f, 0xf1, 0x69, 0xed, 0x42, 0xdf, 0x7f,
+    0x1d, 0x7f, 0xd0, 0xbf, 0x64, 0xd2, 0x4f, 0x1d, 0x52, 0x44, 0x67, 0x95,
+    0x2f, 0x80, 0xfc, 0x91, 0xd7, 0xfd, 0x0d, 0x18, 0x9f, 0xf7, 0xf1, 0xd7,
+    0xff, 0xf9, 0x3c, 0xeb, 0x71, 0xff, 0xac, 0xb8, 0xce, 0xd4, 0x9c, 0xea,
+    0x0a, 0x2e, 0x90, 0x85, 0xce, 0x2f, 0xf8, 0x1f, 0xad, 0xe5, 0xae, 0x04,
+    0xeb, 0xff, 0xfd, 0x88, 0x3e, 0xc1, 0xf8, 0x2e, 0x18, 0x19, 0xe3, 0x87,
+    0x5b, 0x3c, 0x89, 0x7d, 0x87, 0x57, 0xfd, 0xbf, 0xf9, 0xcc, 0xcf, 0x68,
+    0xea, 0x0a, 0xad, 0x0c, 0x86, 0x5f, 0x61, 0xba, 0x30, 0xc5, 0xfa, 0x55,
+    0x7f, 0xef, 0x3c, 0xb5, 0xd8, 0xe7, 0xd0, 0x9d, 0x7f, 0xf7, 0x93, 0x62,
+    0x7a, 0x69, 0x40, 0xf8, 0xeb, 0xff, 0xcf, 0x92, 0xee, 0x20, 0xe7, 0xfb,
+    0x78, 0x75, 0xe7, 0x93, 0x10, 0xbd, 0x43, 0x28, 0x4d, 0x86, 0x15, 0x59,
+    0x18, 0xc2, 0xcd, 0x35, 0x2b, 0x9f, 0xcb, 0x7f, 0x50, 0x36, 0x91, 0x6f,
+    0xff, 0x67, 0x58, 0x1c, 0x0a, 0x0f, 0xb3, 0xa7, 0x5e, 0xf4, 0x04, 0xab,
+    0xff, 0xdd, 0x74, 0xf4, 0x49, 0x39, 0x38, 0x3f, 0x2a, 0xff, 0x3b, 0x58,
+    0x0f, 0x15, 0x2c, 0x41, 0xf2, 0xe8, 0x6e, 0xcc, 0x05, 0x94, 0xb8, 0xd8,
+    0xd1, 0x97, 0x3e, 0xdb, 0xe8, 0x56, 0xec, 0x85, 0x65, 0xff, 0xe6, 0x16,
+    0xf2, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x26, 0x1b, 0xff, 0xfb, 0x36, 0x38,
+    0x7b, 0x0c, 0x7b, 0xb8, 0x10, 0x7b, 0x47, 0x5f, 0xfe, 0xe3, 0xfe, 0xc2,
+    0x9e, 0x93, 0x31, 0xa9, 0x1d, 0x76, 0x30, 0x28, 0xab, 0xfa, 0xbb, 0x7f,
+    0xf2, 0xa3, 0x37, 0x90, 0x1f, 0xc3, 0x12, 0x3a, 0xfd, 0x8b, 0xf9, 0xba,
+    0xb9, 0xd7, 0xf4, 0x2f, 0x3f, 0x8d, 0x87, 0x50, 0x4f, 0x6f, 0xa5, 0xb7,
+    0xfb, 0x98, 0xd8, 0xff, 0xea, 0xce, 0xbf, 0x76, 0x02, 0x8a, 0x1d, 0x48,
+    0x7f, 0xdc, 0x22, 0xda, 0x35, 0xbf, 0xd0, 0xf3, 0xf9, 0x47, 0xe1, 0xd7,
+    0xe7, 0xe4, 0x9d, 0x67, 0x50, 0x9e, 0xc8, 0x0c, 0xef, 0xff, 0xc9, 0xce,
+    0xbf, 0xc0, 0xe4, 0xbb, 0x1b, 0x03, 0x07, 0x5f, 0xf3, 0x3f, 0x7b, 0x0d,
+    0xea, 0x4c, 0x75, 0xf0, 0x17, 0x81, 0x3a, 0xd9, 0xb9, 0xee, 0xed, 0x1e,
+    0x57, 0x51, 0xbe, 0x30, 0xb4, 0xbf, 0x97, 0x18, 0x3e, 0xdb, 0x3a, 0xda,
+    0x3a, 0xfd, 0x18, 0x3e, 0xdb, 0x3a, 0xfe, 0xea, 0x7b, 0x4f, 0xbf, 0xc3,
+    0xe6, 0x98, 0xb9, 0x62, 0x17, 0xfa, 0x5e, 0x85, 0xec, 0xfe, 0x47, 0x5f,
+    0xff, 0xe6, 0x76, 0xbd, 0x9d, 0xf8, 0x39, 0x3a, 0x60, 0xef, 0x2d, 0x1d,
+    0x7e, 0x67, 0xd9, 0xd6, 0x9d, 0x61, 0xc4, 0x47, 0x3b, 0x35, 0xff, 0xef,
+    0x0b, 0xff, 0xdc, 0x40, 0x83, 0xda, 0x3a, 0xff, 0xa2, 0x7f, 0xb2, 0xe8,
+    0x1e, 0x73, 0xaa, 0x11, 0x0b, 0xc4, 0x9b, 0xff, 0xb3, 0x79, 0x7c, 0xeb,
+    0xb6, 0x04, 0x27, 0x5f, 0xdb, 0x3e, 0xf8, 0x63, 0xf3, 0xaf, 0xff, 0x47,
+    0xbf, 0x89, 0x66, 0xfe, 0x9c, 0x0c, 0x9d, 0x50, 0x7f, 0xc8, 0x63, 0x7f,
+    0x3f, 0xfc, 0xe2, 0x70, 0xeb, 0xde, 0xf9, 0x87, 0x57, 0xe7, 0x95, 0xf4,
+    0xb6, 0xfe, 0xd2, 0x28, 0xb7, 0xf1, 0xd7, 0xff, 0xfe, 0xe6, 0x6c, 0x81,
+    0xf7, 0xcf, 0xa3, 0x1d, 0x74, 0xf4, 0x7b, 0x47, 0x5f, 0xc3, 0x9a, 0xf8,
+    0xd5, 0x51, 0xd5, 0xba, 0x33, 0x78, 0x5b, 0xb1, 0xba, 0xfb, 0xe6, 0xcd,
+    0xa9, 0xce, 0xac, 0x3d, 0xd5, 0x0c, 0xec, 0xae, 0x75, 0xde, 0xc3, 0xaf,
+    0xff, 0x2a, 0x46, 0x16, 0xe9, 0xd7, 0xf7, 0x60, 0xea, 0x83, 0xdf, 0x00,
+    0xad, 0xfe, 0xea, 0x4c, 0xed, 0xd4, 0x8e, 0xbf, 0xd0, 0x3e, 0x75, 0xa7,
+    0x8e, 0xbf, 0xec, 0x4c, 0x58, 0xe4, 0xee, 0x75, 0xfa, 0x3d, 0xaf, 0xc0,
+    0x75, 0x2b, 0x29, 0xa9, 0xe3, 0x93, 0x48, 0x7a, 0x66, 0x26, 0x1e, 0x35,
+    0xbf, 0xff, 0x74, 0x73, 0xdd, 0x4c, 0xdf, 0xd9, 0xb2, 0x34, 0x75, 0xff,
+    0xce, 0x3d, 0x84, 0x0a, 0x6b, 0x24, 0x75, 0xe8, 0xff, 0xe9, 0xd5, 0x88,
+    0xb3, 0x75, 0x51, 0x40, 0xbd, 0xf4, 0x38, 0x75, 0xe5, 0x4e, 0x95, 0x47,
+    0x53, 0x9e, 0x0e, 0x87, 0x6f, 0xf0, 0xbb, 0x31, 0xec, 0x9c, 0xeb, 0x30,
+    0xaa, 0x65, 0x6e, 0xc4, 0x64, 0x01, 0x84, 0x56, 0x46, 0x00, 0xd8, 0x46,
+    0xee, 0xab, 0x34, 0x31, 0x39, 0x0a, 0xb5, 0x91, 0x76, 0x18, 0x7f, 0xb5,
+    0x0c, 0x69, 0xfa, 0x8d, 0xd7, 0xd1, 0x87, 0x01, 0xbb, 0x6c, 0x86, 0xff,
+    0xfb, 0x89, 0xbc, 0xb4, 0x9e, 0xec, 0x73, 0xd0, 0x75, 0xfb, 0x8d, 0x77,
+    0x69, 0xa2, 0xae, 0xbd, 0xc8, 0x59, 0xd7, 0xfd, 0x26, 0x33, 0x8d, 0x77,
+    0x69, 0xa2, 0x3c, 0xbf, 0xe8, 0x94, 0x72, 0x78, 0xe4, 0xe7, 0x5f, 0xfa,
+    0x3c, 0x80, 0x54, 0xe4, 0xa7, 0x98, 0xeb, 0x30, 0x14, 0xd7, 0xb1, 0x3f,
+    0x86, 0x6e, 0x36, 0x28, 0xba, 0x39, 0xbf, 0x71, 0xae, 0xed, 0x34, 0x58,
+    0x37, 0x94, 0x89, 0xce, 0xbf, 0xff, 0x84, 0x0f, 0x3a, 0xf3, 0x6c, 0x1c,
+    0xce, 0x4b, 0xec, 0x8e, 0xbf, 0x60, 0xe7, 0xb4, 0x75, 0xfe, 0xe3, 0xaf,
+    0xef, 0x1f, 0x73, 0xac, 0xc6, 0x26, 0x14, 0xa1, 0x9b, 0x47, 0x5d, 0x83,
+    0xe9, 0x2d, 0xfe, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x2c, 0xab, 0xf7, 0x1a,
+    0xee, 0xd3, 0x45, 0xa7, 0x7f, 0xce, 0x1e, 0xbc, 0xdd, 0x45, 0x9d, 0x66,
+    0x30, 0xfa, 0xd6, 0x67, 0x7e, 0x56, 0x8a, 0xbd, 0x59, 0x56, 0x55, 0xb3,
+    0xaf, 0xf9, 0x55, 0xd4, 0x64, 0x2e, 0xed, 0x3a, 0xfc, 0xad, 0x15, 0x1a,
+    0xc8, 0x3a, 0xff, 0x7d, 0x5e, 0x7b, 0x49, 0xa3, 0xac, 0x87, 0x52, 0xa8,
+    0xf0, 0xf6, 0xcd, 0x2f, 0xff, 0xe4, 0xeb, 0x8f, 0xa5, 0x9c, 0xc8, 0x11,
+    0xcf, 0x1d, 0x7e, 0xd8, 0xe1, 0xc5, 0x9d, 0x7c, 0xb8, 0xdf, 0x47, 0x54,
+    0x91, 0x3f, 0x8a, 0xb3, 0x14, 0x5f, 0xbe, 0x73, 0x80, 0xe9, 0xd7, 0xe4,
+    0x52, 0x05, 0xa7, 0x5b, 0x34, 0x7a, 0x1e, 0x2a, 0xbf, 0xfe, 0x16, 0xf5,
+    0x3a, 0x9c, 0x89, 0x99, 0xce, 0x9d, 0x7f, 0xe5, 0xad, 0xe5, 0xb6, 0x0e,
+    0xa7, 0x0e, 0xbf, 0x3e, 0xbd, 0x01, 0x3a, 0xa0, 0xf9, 0xc0, 0x83, 0x50,
+    0x8d, 0x7e, 0xc2, 0xda, 0xfa, 0x3e, 0xc7, 0x4e, 0xbe, 0x6b, 0xbb, 0x4d,
+    0x16, 0xe5, 0xff, 0xb3, 0x98, 0x3f, 0x3b, 0x9b, 0xb2, 0x75, 0xf8, 0x7f,
+    0x7d, 0xf4, 0x75, 0x41, 0xf4, 0x3a, 0x05, 0x6e, 0x8d, 0x7e, 0x11, 0x6a,
+    0x12, 0xb7, 0xf9, 0xc7, 0xf9, 0x86, 0x16, 0x75, 0xe5, 0x8a, 0x1d, 0x61,
+    0x3a, 0xff, 0xba, 0x07, 0xd6, 0x60, 0xa8, 0x75, 0xfb, 0x4f, 0xbb, 0x84,
+    0xeb, 0x20, 0x4f, 0x7b, 0xc6, 0xf5, 0x08, 0xae, 0xc1, 0xae, 0xb6, 0xdf,
+    0xf4, 0x38, 0xf7, 0x30, 0x5a, 0x75, 0xfe, 0xf7, 0x92, 0x75, 0xc0, 0x9d,
+    0x52, 0x3e, 0x6c, 0x34, 0xbf, 0xe8, 0x10, 0x2e, 0x35, 0xe4, 0x3a, 0xf8,
+    0x31, 0x9c, 0x3a, 0xfd, 0xf3, 0x7d, 0x22, 0x87, 0x59, 0xe7, 0x3c, 0xbd,
+    0xc8, 0x2f, 0xfe, 0x96, 0x75, 0x38, 0x1e, 0xc0, 0xb4, 0xeb, 0xfd, 0xbc,
+    0xa0, 0x7d, 0x9f, 0x9d, 0x7d, 0xaf, 0xd3, 0xc7, 0x53, 0xa3, 0x03, 0x45,
+    0x20, 0x42, 0xfa, 0x67, 0x7f, 0xf7, 0x93, 0xf8, 0x90, 0x7b, 0x02, 0xd3,
+    0xa8, 0xeb, 0xc0, 0x7f, 0x1d, 0x70, 0x20, 0xea, 0x91, 0xb0, 0xf0, 0xdd,
+    0x1d, 0x7d, 0xbb, 0x53, 0x87, 0x5e, 0x85, 0xb1, 0x88, 0x87, 0xdc, 0xe9,
+    0x64, 0x3e, 0x0a, 0xa8, 0x4c, 0x65, 0x21, 0x95, 0x78, 0x7d, 0xb6, 0x75,
+    0xff, 0x49, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0xa1, 0xe9, 0x0f, 0x8d, 0xc7,
+    0xaf, 0xdf, 0xc3, 0x71, 0x67, 0x5f, 0x44, 0xd8, 0x13, 0xab, 0x87, 0x91,
+    0xa2, 0x7b, 0xfe, 0xc8, 0x0f, 0x63, 0x6a, 0x26, 0x3a, 0xff, 0x7e, 0x9d,
+    0xee, 0x7e, 0xe7, 0x52, 0xcf, 0xb7, 0xf3, 0xaa, 0x84, 0x59, 0x3c, 0x23,
+    0xef, 0xfc, 0xe1, 0x80, 0xf5, 0x05, 0x16, 0x75, 0xff, 0xda, 0x81, 0x9b,
+    0x07, 0xf7, 0xf6, 0x1d, 0x7f, 0xb4, 0x06, 0xe7, 0x86, 0x0e, 0xa5, 0xa2,
+    0xbb, 0xa7, 0x7e, 0x42, 0xbf, 0xf8, 0x12, 0xeb, 0xf3, 0x7f, 0x42, 0x4e,
+    0x75, 0xff, 0x44, 0xa3, 0x93, 0xc7, 0x27, 0x3a, 0xfc, 0x9e, 0xd3, 0xa1,
+    0xd7, 0xfd, 0xcf, 0xf8, 0xe3, 0xec, 0xfc, 0xea, 0xfc, 0xf7, 0x80, 0x4b,
+    0x7b, 0xef, 0x24, 0x75, 0xfd, 0xf7, 0xc0, 0x8c, 0x9c, 0xea, 0x91, 0xe6,
+    0xcc, 0x3d, 0x7f, 0xf3, 0x46, 0x3c, 0x39, 0xb3, 0x39, 0x23, 0xaf, 0xf8,
+    0x02, 0xa7, 0xde, 0xf4, 0x1a, 0x3a, 0xff, 0x08, 0xbf, 0xbe, 0xc3, 0x4e,
+    0xbe, 0x1f, 0xe7, 0xfc, 0xea, 0xc3, 0xd6, 0x43, 0x2b, 0xfd, 0xaf, 0x9e,
+    0xf8, 0x1c, 0x13, 0xad, 0xf9, 0xd6, 0x4d, 0xcf, 0x1f, 0x86, 0xd7, 0xe7,
+    0xdf, 0x5e, 0x43, 0xaa, 0x13, 0xae, 0xc2, 0x34, 0x43, 0xec, 0x24, 0x85,
+    0x9f, 0x45, 0x17, 0xe7, 0x02, 0x91, 0xf4, 0xeb, 0xf2, 0xab, 0x39, 0x1a,
+    0x3a, 0xa6, 0x3d, 0x31, 0x29, 0xbf, 0xe7, 0xd4, 0x4d, 0xbc, 0xb3, 0x61,
+    0xd7, 0xff, 0xe0, 0xf6, 0x3e, 0xb1, 0xe1, 0x7f, 0xf5, 0xa8, 0xfc, 0xab,
+    0x83, 0x87, 0x5f, 0xa7, 0x89, 0xdf, 0x47, 0x56, 0x22, 0x59, 0x16, 0x5c,
+    0x56, 0xef, 0xc0, 0x75, 0xfc, 0xff, 0xcc, 0x30, 0x13, 0xaa, 0x0f, 0x13,
+    0xa2, 0xf6, 0x61, 0x58, 0x6c, 0x1b, 0x15, 0xb4, 0x35, 0x5e, 0x78, 0xab,
+    0x39, 0xc4, 0x32, 0x25, 0x08, 0x00, 0xc3, 0xfb, 0x21, 0xfc, 0xa1, 0xb3,
+    0x61, 0xc1, 0xbc, 0x25, 0x10, 0x86, 0x68, 0xd0, 0x79, 0x1a, 0xba, 0xe1,
+    0x15, 0xd8, 0xc6, 0x9e, 0x1a, 0x9f, 0x98, 0x0a, 0x2e, 0xa1, 0x2f, 0xe9,
+    0x43, 0xc0, 0x85, 0x66, 0xc2, 0x2d, 0xb8, 0x68, 0xfd, 0x71, 0xbf, 0x98,
+    0x9e, 0x39, 0x25, 0x9d, 0x7f, 0x98, 0xce, 0x35, 0xdd, 0xa6, 0x8b, 0xce,
+    0xa1, 0xd2, 0x14, 0x49, 0xbc, 0x31, 0x81, 0x65, 0x2c, 0x37, 0x79, 0x50,
+    0x1c, 0x8d, 0x99, 0x6a, 0x7d, 0x85, 0x50, 0xd6, 0x12, 0x9a, 0x8f, 0x17,
+    0x61, 0x7d, 0xfe, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x29, 0x6b, 0xf7, 0x1a,
+    0xee, 0xd3, 0x45, 0x85, 0x7f, 0xfe, 0x8c, 0x10, 0xc7, 0x63, 0x7f, 0x60,
+    0xba, 0xce, 0xbf, 0x81, 0xc4, 0x9d, 0xd6, 0x75, 0x98, 0xc4, 0x58, 0xac,
+    0xcf, 0x6d, 0x46, 0xff, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x16, 0x5d, 0xdc,
+    0x50, 0xeb, 0xe6, 0x14, 0x55, 0x95, 0x83, 0xaf, 0x31, 0xf5, 0x67, 0x53,
+    0x4f, 0x34, 0x05, 0xd4, 0x28, 0x86, 0xd3, 0x25, 0xbf, 0x3a, 0xe5, 0x27,
+    0x3a, 0xe7, 0xe4, 0x8d, 0x4e, 0x08, 0xdf, 0xf3, 0xee, 0x39, 0xbf, 0xa1,
+    0x43, 0xaf, 0xf4, 0xfb, 0xea, 0x03, 0xe4, 0x3a, 0xfd, 0x19, 0xb2, 0x34,
+    0x75, 0xa1, 0xcf, 0x6d, 0x93, 0x4a, 0x74, 0x5d, 0x8c, 0x25, 0x2f, 0x9e,
+    0x52, 0x09, 0xd7, 0xf3, 0xf2, 0x3c, 0xfd, 0x3a, 0xf3, 0x2c, 0xb2, 0x55,
+    0xff, 0x44, 0xb7, 0xf7, 0x23, 0x37, 0x29, 0x82, 0xfe, 0xff, 0x80, 0xfb,
+    0xe7, 0x93, 0x76, 0x4e, 0xba, 0x34, 0x75, 0x05, 0x30, 0x3e, 0x90, 0x8a,
+    0x56, 0x92, 0x76, 0x1d, 0x5f, 0xc8, 0xfa, 0xff, 0x40, 0x3a, 0xff, 0xfe,
+    0xea, 0x7b, 0xb9, 0xa1, 0xc5, 0x83, 0x5d, 0x79, 0x1d, 0x7f, 0xa2, 0x5e,
+    0x7e, 0xb8, 0x4e, 0xac, 0x44, 0x57, 0x16, 0x6d, 0x23, 0xad, 0x23, 0xad,
+    0x23, 0xaa, 0x0d, 0x82, 0x82, 0x08, 0x21, 0x7f, 0xfe, 0xf6, 0x91, 0xb8,
+    0x3c, 0x81, 0xc0, 0xe2, 0x87, 0x5b, 0x73, 0xae, 0xd0, 0x0e, 0xac, 0x3f,
+    0x9d, 0x29, 0x78, 0x46, 0xe4, 0x83, 0xaf, 0xe1, 0x85, 0x8c, 0x61, 0xd7,
+    0x4a, 0x0e, 0xa0, 0x9e, 0x94, 0xc2, 0x80, 0x29, 0xbf, 0xff, 0xfe, 0xec,
+    0x7b, 0x49, 0xad, 0x47, 0xba, 0x91, 0xcf, 0xd6, 0xf2, 0x97, 0x94, 0x3a,
+    0xe4, 0xdc, 0xeb, 0xa1, 0x67, 0x5f, 0xff, 0xd2, 0x81, 0x04, 0xa5, 0x1e,
+    0xee, 0x2f, 0xec, 0x7e, 0x75, 0xcd, 0x62, 0x17, 0x82, 0xa7, 0x4b, 0x0c,
+    0x39, 0xb2, 0x32, 0x96, 0xa6, 0x72, 0x16, 0xee, 0xa4, 0x30, 0xa6, 0xd4,
+    0x20, 0x3c, 0x61, 0xb1, 0xfb, 0x6c, 0x5b, 0xe8, 0xad, 0xff, 0xe6, 0x16,
+    0xf2, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x28, 0xcb, 0xf6, 0xc8, 0xe4, 0x7e,
+    0x75, 0xf8, 0x5f, 0xf8, 0xfa, 0x75, 0xff, 0xdb, 0xb5, 0x39, 0xdc, 0xc1,
+    0x96, 0x8e, 0xb3, 0x10, 0x89, 0x4e, 0x94, 0xf8, 0xa2, 0xa4, 0xc9, 0xf9,
+    0xe4, 0x3c, 0x16, 0x72, 0xf3, 0xd9, 0xfa, 0x87, 0x07, 0xa1, 0xd7, 0x7f,
+    0xf3, 0x0f, 0x26, 0x33, 0x8d, 0x77, 0x69, 0xa2, 0x39, 0xbf, 0xfc, 0xc2,
+    0xde, 0x4c, 0x67, 0x1a, 0xee, 0xd3, 0x44, 0xe5, 0x7f, 0x98, 0xce, 0x35,
+    0xdd, 0xa6, 0x8b, 0x32, 0xff, 0xa5, 0xa7, 0x5b, 0x1d, 0xf7, 0xe7, 0x5f,
+    0xf2, 0xae, 0x0e, 0x2e, 0x37, 0x85, 0x9d, 0x7f, 0xdf, 0xf2, 0x3d, 0xd7,
+    0xde, 0x47, 0x5f, 0xec, 0xd7, 0x39, 0x9b, 0xe8, 0xeb, 0xfb, 0x8d, 0xeb,
+    0xa2, 0xa4, 0xeb, 0xb7, 0x59, 0xd6, 0x61, 0x58, 0x47, 0x94, 0x1f, 0x48,
+    0xe8, 0x06, 0x7b, 0x66, 0x17, 0xf9, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0xb7,
+    0x6f, 0xe1, 0x76, 0x39, 0x3f, 0x4e, 0xbc, 0x9b, 0xfe, 0x75, 0xfb, 0x8d,
+    0x77, 0x69, 0xa2, 0x90, 0xbf, 0xf6, 0x75, 0x36, 0x77, 0x30, 0x5a, 0x75,
+    0xe7, 0x93, 0x18, 0x7e, 0x1a, 0x33, 0xb3, 0x0d, 0x47, 0x77, 0x0b, 0x97,
+    0x08, 0xdb, 0xff, 0x98, 0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x12, 0x95,
+    0x4e, 0xb8, 0x4d, 0x32, 0x8a, 0xd5, 0xdc, 0xff, 0xf8, 0xcb, 0x45, 0x63,
+    0xd1, 0x96, 0xed, 0x1e, 0x5f, 0xe9, 0x20, 0xfb, 0x10, 0x27, 0x5e, 0xd0,
+    0x16, 0x75, 0x98, 0xdc, 0xf3, 0x10, 0xc2, 0xf0, 0xbc, 0x8e, 0xbf, 0xf3,
+    0xc9, 0x8c, 0xe3, 0x5d, 0xda, 0x68, 0x9d, 0xae, 0x9d, 0x5c, 0xeb, 0xff,
+    0xf2, 0x04, 0x0b, 0x8d, 0xa7, 0x08, 0xc0, 0xe3, 0x4e, 0xbf, 0xe8, 0x94,
+    0x72, 0x78, 0xe4, 0xe7, 0x59, 0x8c, 0x4c, 0x2d, 0x63, 0x5d, 0x4a, 0x71,
+    0xa1, 0x54, 0xbf, 0xfe, 0x63, 0xee, 0xdb, 0x8f, 0xf9, 0xe8, 0x14, 0xfc,
+    0xeb, 0xff, 0x9d, 0x7d, 0xc6, 0xbf, 0x63, 0xec, 0x8e, 0xbc, 0x81, 0x73,
+    0xaf, 0xfe, 0x1c, 0xeb, 0xcf, 0x9a, 0x17, 0xdc, 0xeb, 0xb6, 0xd8, 0x0a,
+    0x28, 0x3a, 0x89, 0xa1, 0xaa, 0x92, 0xab, 0x75, 0xc6, 0x69, 0xa4, 0xfd,
+    0xb8, 0x7a, 0x5f, 0xff, 0xc1, 0x7f, 0x31, 0x9a, 0x81, 0xdf, 0xfd, 0x6a,
+    0x3f, 0x3a, 0xfd, 0xc6, 0xbb, 0xb4, 0xd1, 0x16, 0x5f, 0xf9, 0xe4, 0xc6,
+    0x71, 0xae, 0xed, 0x34, 0x4b, 0xb7, 0xff, 0xf6, 0x07, 0xb1, 0xf5, 0x8f,
+    0x0b, 0xff, 0xad, 0x47, 0xe5, 0x59, 0x8c, 0x46, 0xda, 0xcc, 0xf6, 0xd2,
+    0xaf, 0xff, 0x30, 0xb7, 0x93, 0x19, 0xc6, 0xbb, 0xb4, 0xd1, 0x31, 0x5f,
+    0xb8, 0xd7, 0x76, 0x9a, 0x2a, 0x9b, 0x61, 0xd5, 0x87, 0x84, 0xa1, 0x9d,
+    0xff, 0xff, 0xee, 0x3f, 0x77, 0x96, 0x79, 0x8e, 0xbe, 0xb8, 0x8c, 0xfb,
+    0xa9, 0xc9, 0x1d, 0x4c, 0x22, 0x71, 0xc8, 0xaf, 0xff, 0x30, 0xb7, 0x93,
+    0x19, 0xc6, 0xbb, 0xb4, 0xd1, 0x3a, 0x5f, 0xe4, 0x7e, 0x44, 0x9f, 0x61,
+    0xd7, 0xe9, 0xa2, 0x68, 0xd1, 0xd7, 0xf3, 0x38, 0x9b, 0x30, 0x4e, 0xa4,
+    0x3d, 0x5d, 0x14, 0x5e, 0x4e, 0xc1, 0xcc, 0x1a, 0x1b, 0xff, 0x81, 0xaf,
+    0x46, 0xec, 0x02, 0x64, 0x59, 0xd4, 0xb3, 0xf2, 0xe9, 0x5d, 0xff, 0x9e,
+    0x4c, 0x67, 0x1a, 0xee, 0xd3, 0x44, 0xef, 0x7e, 0xf0, 0x1d, 0x68, 0x55,
+    0xff, 0x86, 0x3d, 0x9a, 0xcc, 0xde, 0x47, 0x50, 0x53, 0xe8, 0xc8, 0xc6,
+    0x96, 0x44, 0xe9, 0x5e, 0x26, 0xbf, 0xa1, 0x8f, 0xc7, 0x02, 0x75, 0x30,
+    0x7f, 0x82, 0x9f, 0x7f, 0xf9, 0x85, 0xbc, 0x98, 0xce, 0x35, 0xdd, 0xa6,
+    0x8a, 0x16, 0xff, 0xff, 0xf7, 0x40, 0xb5, 0xbc, 0x98, 0x6f, 0x41, 0xe8,
+    0x1c, 0x9d, 0x40, 0x44, 0xc7, 0x5f, 0x81, 0xbf, 0x91, 0xa7, 0x5f, 0xb3,
+    0xfc, 0x71, 0x3a, 0xf4, 0x7e, 0xc4, 0xe7, 0x9a, 0x25, 0x14, 0x88, 0xfd,
+    0x18, 0x64, 0x5f, 0xfe, 0x61, 0x6f, 0x26, 0x33, 0x8d, 0x77, 0x69, 0xa2,
+    0x92, 0xbf, 0xff, 0xd9, 0xa6, 0x3e, 0xe4, 0xdd, 0x75, 0xfb, 0xb1, 0xe0,
+    0x2c, 0xea, 0x85, 0xfd, 0xb9, 0xe3, 0x38, 0x91, 0xcb, 0x63, 0x35, 0xe1,
+    0x1a, 0xe5, 0x5d, 0xfe, 0x45, 0xe8, 0xd5, 0x00, 0x4d, 0xb6, 0xaf, 0x7f,
+    0x98, 0xce, 0x35, 0xdd, 0xa6, 0x88, 0x92, 0xff, 0xf3, 0x0b, 0x79, 0x31,
+    0x9c, 0x6b, 0xbb, 0x4d, 0x12, 0xf5, 0xf7, 0x01, 0xed, 0x1d, 0x7e, 0xe7,
+    0xeb, 0x4d, 0x1d, 0x7a, 0x07, 0x73, 0xaf, 0xde, 0xfa, 0xb1, 0x83, 0xac,
+    0x9d, 0x3c, 0x31, 0x1b, 0xbf, 0xfd, 0xdd, 0x90, 0x3f, 0xab, 0xe0, 0x73,
+    0x9b, 0x9d, 0x74, 0x78, 0xeb, 0xff, 0xc0, 0x0a, 0x73, 0xec, 0xdb, 0x40,
+    0x71, 0x98, 0xea, 0x92, 0x36, 0x90, 0x9b, 0xf4, 0xfd, 0x0a, 0xdf, 0xfc,
+    0xf3, 0x6a, 0x36, 0x3f, 0x63, 0x79, 0x8e, 0xbf, 0x64, 0xf9, 0xa5, 0x9d,
+    0x7f, 0xf4, 0xdf, 0x3e, 0x8c, 0x6c, 0x7d, 0x91, 0x31, 0xd4, 0x75, 0xfd,
+    0x34, 0x9f, 0xcf, 0xb0, 0xea, 0x84, 0x42, 0xe2, 0x63, 0x85, 0x5d, 0xc8,
+    0x3a, 0x82, 0xab, 0x65, 0x08, 0xa6, 0x8d, 0x17, 0x87, 0xa2, 0x8f, 0xb2,
+    0x15, 0x9b, 0x45, 0xb7, 0x83, 0x82, 0x75, 0xc1, 0xdc, 0xeb, 0xfe, 0x47,
+    0x10, 0x7a, 0x68, 0x50, 0xeb, 0xff, 0xe4, 0xe7, 0xce, 0xc2, 0x7b, 0x40,
+    0x68, 0x20, 0xeb, 0xe4, 0x9f, 0xf5, 0x73, 0xaf, 0x9a, 0xee, 0xd3, 0x45,
+    0x2f, 0x7c, 0x3e, 0x8e, 0x1d, 0x7f, 0xd9, 0xc5, 0x7c, 0x0e, 0x73, 0x73,
+    0xa9, 0x0f, 0x6f, 0x61, 0x05, 0x28, 0x99, 0x0c, 0xca, 0x1c, 0x26, 0xec,
+    0x22, 0x2f, 0xc3, 0xe9, 0xf1, 0x93, 0xaf, 0xfd, 0x03, 0x1d, 0xf8, 0x01,
+    0x03, 0x4e, 0xbc, 0x07, 0xd1, 0xd7, 0xe8, 0xfd, 0xf7, 0xd1, 0xd7, 0x85,
+    0x3f, 0x3a, 0xf6, 0x7b, 0x47, 0x54, 0x1b, 0x6d, 0x0d, 0xd0, 0x51, 0xaf,
+    0x31, 0xf7, 0xe3, 0x7e, 0x5e, 0xbf, 0x2b, 0xb8, 0x87, 0x68, 0xeb, 0xfe,
+    0xff, 0x5c, 0x8d, 0xe4, 0x8b, 0x3a, 0xf7, 0x9f, 0x61, 0xd7, 0xfc, 0xf3,
+    0xfc, 0x9c, 0x13, 0x42, 0xb9, 0xd5, 0x08, 0x97, 0x73, 0xa0, 0x0e, 0xdf,
+    0xf2, 0x6a, 0x64, 0x1f, 0x47, 0xe7, 0x54, 0x8f, 0x99, 0x65, 0xd7, 0x38,
+    0x9d, 0x7f, 0xd1, 0xff, 0xce, 0xc2, 0xdc, 0x4e, 0xb7, 0x37, 0x3c, 0xdd,
+    0x82, 0x95, 0x09, 0xe1, 0xe4, 0x65, 0x28, 0xdf, 0x7b, 0x90, 0xb3, 0xaf,
+    0xe8, 0x19, 0xbc, 0x8a, 0x1d, 0x7f, 0xd2, 0xce, 0x4d, 0x83, 0x0b, 0x3a,
+    0xfd, 0xfc, 0x37, 0x16, 0x75, 0x21, 0xef, 0x70, 0xde, 0xe9, 0x61, 0xd7,
+    0xa3, 0xfd, 0x1d, 0x50, 0x7a, 0x41, 0x21, 0x64, 0x56, 0xfd, 0xd0, 0x29,
+    0x82, 0x75, 0xff, 0x47, 0x74, 0xfe, 0x8e, 0x6d, 0x1d, 0x7f, 0xe5, 0xb8,
+    0x7e, 0xcd, 0x28, 0x1d, 0xce, 0xa0, 0x9f, 0xda, 0x1d, 0x5f, 0x73, 0xff,
+    0xbb, 0x0e, 0xbc, 0x8c, 0xf8, 0xea, 0xe9, 0xe1, 0xe8, 0x9e, 0x82, 0x99,
+    0x47, 0x61, 0x45, 0xe6, 0x4b, 0xfe, 0xfd, 0x3b, 0x9c, 0x79, 0xb4, 0x75,
+    0xff, 0xfa, 0x24, 0x31, 0x3f, 0xd9, 0xb5, 0xdc, 0xda, 0xe7, 0xe7, 0x5f,
+    0xdf, 0x17, 0x9e, 0x7f, 0x1d, 0x66, 0x9d, 0x76, 0xfa, 0xc3, 0x7c, 0xe5,
+    0xd5, 0xba, 0x3f, 0xd6, 0x72, 0xf0, 0x9a, 0xbf, 0xd8, 0xcc, 0x93, 0x40,
+    0x59, 0xd7, 0x6c, 0xd1, 0xd7, 0xec, 0x9f, 0x3b, 0xa3, 0xaa, 0x0d, 0xf8,
+    0x8c, 0x5e, 0xce, 0x68, 0xea, 0x69, 0xba, 0xd8, 0x3f, 0x7f, 0xdf, 0xc7,
+    0xff, 0x76, 0x40, 0xed, 0x1d, 0x50, 0x98, 0x7e, 0x42, 0xb1, 0x08, 0xef,
+    0xff, 0xfe, 0xec, 0x73, 0x76, 0xa6, 0xff, 0x14, 0x7f, 0x9a, 0xeb, 0xb6,
+    0x04, 0x27, 0x5f, 0x78, 0x51, 0x67, 0x5f, 0xe1, 0x87, 0x1f, 0x60, 0x9d,
+    0x7f, 0xba, 0xf3, 0x27, 0x22, 0x73, 0xae, 0xc5, 0x9d, 0x41, 0x4c, 0x37,
+    0x1d, 0xd6, 0x40, 0xe5, 0xdb, 0x0c, 0xef, 0xdb, 0x48, 0xb8, 0xd1, 0xd7,
+    0xe7, 0xd9, 0x9c, 0xd1, 0xd4, 0x13, 0xd1, 0x59, 0x4d, 0xfb, 0xae, 0x28,
+    0xb3, 0xaf, 0x94, 0x9b, 0x50, 0x75, 0xfe, 0x7f, 0xf5, 0x1d, 0x8d, 0x1d,
+    0x50, 0x89, 0xcc, 0x22, 0x42, 0x51, 0x23, 0xbb, 0xf6, 0x9d, 0x6d, 0x1d,
+    0x72, 0x29, 0xa3, 0x4e, 0x01, 0x7b, 0xdf, 0xbb, 0x4e, 0xbf, 0xff, 0x20,
+    0x73, 0x63, 0xf2, 0x6f, 0xb2, 0x7f, 0x3a, 0xce, 0xa8, 0x3f, 0x4e, 0x0e,
+    0x59, 0x88, 0x66, 0xed, 0xce, 0xeb, 0x21, 0xa0, 0x8b, 0xe4, 0x6b, 0x3b,
+    0xa2, 0xa4, 0x3f, 0xe6, 0x94, 0x05, 0xc3, 0x45, 0x8d, 0xf6, 0x1b, 0xaf,
+    0x1a, 0xbf, 0xf1, 0x9a, 0x8c, 0x68, 0x9a, 0x8d, 0x03, 0xd1, 0x9c, 0x6d,
+    0xb0, 0x7d, 0x85, 0x0d, 0xfe, 0x63, 0x38, 0xd7, 0x76, 0x9a, 0x29, 0xcb,
+    0xff, 0x27, 0x1f, 0x5d, 0xcc, 0x16, 0x9d, 0x7e, 0x5f, 0x39, 0x9a, 0x3a,
+    0xff, 0xfd, 0xd0, 0x7b, 0x91, 0xed, 0x63, 0x75, 0x1c, 0x69, 0xd7, 0xf9,
+    0x16, 0x18, 0xd0, 0x04, 0xeb, 0xfb, 0x3d, 0xbc, 0xa1, 0x93, 0xaf, 0xfe,
+    0x51, 0x37, 0xd0, 0xe0, 0x7a, 0xec, 0x9d, 0x7f, 0xec, 0xec, 0x73, 0x18,
+    0x65, 0x96, 0x4a, 0xb9, 0x19, 0x3a, 0xe9, 0xd8, 0x0a, 0x76, 0x58, 0x76,
+    0xd2, 0x7e, 0xaa, 0x89, 0x8f, 0x8b, 0xb6, 0xd1, 0x76, 0x90, 0x6f, 0xdc,
+    0x6b, 0xbb, 0x4d, 0x15, 0xe5, 0xff, 0xfd, 0x81, 0xec, 0x7d, 0x63, 0xc2,
+    0xff, 0xeb, 0x51, 0xf9, 0x56, 0x63, 0x11, 0x23, 0xb6, 0x67, 0x7f, 0xf3,
+    0x0f, 0x26, 0x33, 0x8d, 0x77, 0x69, 0xa2, 0x47, 0xbc, 0xdc, 0x59, 0xd7,
+    0x93, 0xf8, 0x3a, 0xf3, 0x71, 0x65, 0x30, 0x5d, 0xdf, 0xb8, 0xd7, 0x76,
+    0x9a, 0x24, 0x8b, 0xff, 0xfa, 0x13, 0x89, 0xb5, 0x03, 0x3c, 0x79, 0x3a,
+    0xf3, 0x9d, 0x74, 0x98, 0x84, 0x5c, 0xe1, 0x5f, 0x4c, 0xef, 0xd9, 0xd6,
+    0x31, 0x67, 0x59, 0x88, 0x4d, 0x45, 0xe1, 0xdf, 0xe3, 0xbb, 0xff, 0x98,
+    0x79, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x12, 0x55, 0xfb, 0x8d, 0x77, 0x69,
+    0xa2, 0xf1, 0xbf, 0xe9, 0x31, 0x9c, 0x6b, 0xbb, 0x4d, 0x12, 0x6d, 0x98,
+    0xc3, 0xf8, 0x73, 0x3b, 0x99, 0xe9, 0xd7, 0xe4, 0xff, 0x58, 0x27, 0x5f,
+    0xff, 0x01, 0xf7, 0xcc, 0x51, 0x47, 0x96, 0x6f, 0xe3, 0xaa, 0x47, 0xef,
+    0xa2, 0x6b, 0xdf, 0x46, 0x73, 0xae, 0xe7, 0x8e, 0xbd, 0x30, 0xce, 0x75,
+    0x84, 0xeb, 0xbe, 0xfd, 0x3a, 0xbf, 0x35, 0x3f, 0x43, 0xee, 0xdb, 0x62,
+    0x13, 0x4e, 0xc8, 0x47, 0x74, 0x89, 0xc7, 0xb4, 0x2d, 0xf5, 0x1a, 0xa1,
+    0xba, 0x3f, 0x9c, 0xfe, 0x55, 0x88, 0x58, 0x63, 0x3c, 0x48, 0xfc, 0x66,
+    0x8c, 0x55, 0x65, 0x9d, 0x8e, 0x8b, 0xc7, 0x60, 0x86, 0x4f, 0xd8, 0xdd,
+    0x6a, 0x25, 0xfe, 0x10, 0x4f, 0x29, 0x1a, 0x53, 0xae, 0xe1, 0x9d, 0x4a,
+    0xcc, 0x46, 0xc3, 0x29, 0x38, 0xdc, 0xdb, 0xd4, 0xdd, 0xde, 0xb2, 0xe3,
+    0x4a, 0x4b, 0xea, 0xbc, 0xa2, 0x39, 0xad, 0x86, 0x3f, 0x2d, 0x09, 0x92,
+    0xf3, 0x6c, 0x87, 0xed, 0x2a, 0x31, 0xed, 0x94, 0x17, 0xf3, 0xe6, 0xaa,
+    0x98, 0xf8, 0xc6, 0xb2, 0xb6, 0xd5, 0x6e, 0x23, 0xeb, 0xd4, 0xa9, 0x05,
+    0xaf, 0xeb, 0xd9, 0x4a, 0xc8, 0x66, 0x72, 0x5f, 0x6e, 0x5c, 0x3f, 0xda,
+    0x41, 0x46, 0xd5, 0x75, 0xd5, 0x40,
 };
 
-static const unsigned kPreloadedHSTSBits = 259916;
+static const unsigned kPreloadedHSTSBits = 265770;
 
-static const unsigned kHSTSRootPosition = 259303;
+static const unsigned kHSTSRootPosition = 265157;
 
 #endif // NET_HTTP_TRANSPORT_SECURITY_STATE_STATIC_H_
diff --git a/net/http/transport_security_state_static.json b/net/http/transport_security_state_static.json
index 1b87eb11..4bff1ea 100644
--- a/net/http/transport_security_state_static.json
+++ b/net/http/transport_security_state_static.json
@@ -3764,7 +3764,95 @@
     { "name": "xtremegaming.it", "include_subdomains": true, "mode": "force-https" },
     { "name": "xunn.io", "include_subdomains": true, "mode": "force-https" },
     { "name": "zdrojak.cz", "include_subdomains": true, "mode": "force-https" },
-    { "name": "zera.com.au", "include_subdomains": true, "mode": "force-https" }
+    { "name": "zera.com.au", "include_subdomains": true, "mode": "force-https" },
+    { "name": "0xfc.de", "include_subdomains": true, "mode": "force-https" },
+    { "name": "abrilect.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "adduono.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "ahmerjamilkhan.org", "include_subdomains": true, "mode": "force-https" },
+    { "name": "akombakom.net", "include_subdomains": true, "mode": "force-https" },
+    { "name": "alainwolf.ch", "include_subdomains": true, "mode": "force-https" },
+    { "name": "aulo.in", "include_subdomains": true, "mode": "force-https" },
+    { "name": "beier.io", "include_subdomains": true, "mode": "force-https" },
+    { "name": "bentrask.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "bryn.xyz", "include_subdomains": true, "mode": "force-https" },
+    { "name": "cavac.at", "include_subdomains": true, "mode": "force-https" },
+    { "name": "cipherli.st", "include_subdomains": true, "mode": "force-https" },
+    { "name": "claralabs.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "coolaj86.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "coralproject.net", "include_subdomains": true, "mode": "force-https" },
+    { "name": "crosscom.ch", "include_subdomains": true, "mode": "force-https" },
+    { "name": "curroapp.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "daplie.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "darknebula.space", "include_subdomains": true, "mode": "force-https" },
+    { "name": "datapun.ch", "include_subdomains": true, "mode": "force-https" },
+    { "name": "datsound.ru", "include_subdomains": true, "mode": "force-https" },
+    { "name": "devlux.ch", "include_subdomains": true, "mode": "force-https" },
+    { "name": "ellsinger.me", "include_subdomains": true, "mode": "force-https" },
+    { "name": "excessamerica.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "express-vpn.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "felixrr.pro", "include_subdomains": true, "mode": "force-https" },
+    { "name": "filippo.io", "include_subdomains": true, "mode": "force-https" },
+    { "name": "flowlo.me", "include_subdomains": true, "mode": "force-https" },
+    { "name": "flukethoughts.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "fraye.net", "include_subdomains": true, "mode": "force-https" },
+    { "name": "freedom.press", "include_subdomains": true, "mode": "force-https" },
+    { "name": "fresh-hotel.org", "include_subdomains": true, "mode": "force-https" },
+    { "name": "goaltree.ch", "include_subdomains": true, "mode": "force-https" },
+    { "name": "goldenhillsoftware.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "greenpeace-magazin.de", "include_subdomains": true, "mode": "force-https" },
+    { "name": "guineapigmustach.es", "include_subdomains": true, "mode": "force-https" },
+    { "name": "htaccessbook.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "isitup.org", "include_subdomains": true, "mode": "force-https" },
+    { "name": "kaloix.de", "include_subdomains": true, "mode": "force-https" },
+    { "name": "kiano.net", "include_subdomains": true, "mode": "force-https" },
+    { "name": "krypsys.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "lainchan.org", "include_subdomains": true, "mode": "force-https" },
+    { "name": "lazurit.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "lelongbank.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "lexway.pk", "include_subdomains": true, "mode": "force-https" },
+    { "name": "libertyrp.org", "include_subdomains": true, "mode": "force-https" },
+    { "name": "lustrumxi.nl", "include_subdomains": true, "mode": "force-https" },
+    { "name": "maderwin.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "mypagella.eu", "include_subdomains": true, "mode": "force-https" },
+    { "name": "mypagella.it", "include_subdomains": true, "mode": "force-https" },
+    { "name": "mysecretrewards.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "nettopower.dk", "include_subdomains": true, "mode": "force-https" },
+    { "name": "nicestresser.fr", "include_subdomains": true, "mode": "force-https" },
+    { "name": "nsboston.org", "include_subdomains": true, "mode": "force-https" },
+    { "name": "o7.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "onet.space", "include_subdomains": true, "mode": "force-https" },
+    { "name": "oopsmycase.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "opennippon.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "opennippon.ru", "include_subdomains": true, "mode": "force-https" },
+    { "name": "perishablepress.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "planboardapp.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "plugin-planet.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "qionglu.pw", "include_subdomains": true, "mode": "force-https" },
+    { "name": "redb.cz", "include_subdomains": true, "mode": "force-https" },
+    { "name": "rootforum.org", "include_subdomains": true, "mode": "force-https" },
+    { "name": "sambeso.net", "include_subdomains": true, "mode": "force-https" },
+    { "name": "sarasturdivant.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "scourt.org.ua", "include_subdomains": true, "mode": "force-https" },
+    { "name": "secure-games.us", "include_subdomains": true, "mode": "force-https" },
+    { "name": "selecadm.name", "include_subdomains": true, "mode": "force-https" },
+    { "name": "sirenslove.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "smm.im", "include_subdomains": true, "mode": "force-https" },
+    { "name": "stassi.ch", "include_subdomains": true, "mode": "force-https" },
+    { "name": "stephenandburns.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "sway-cdn.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "sway.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "thinkindifferent.net", "include_subdomains": true, "mode": "force-https" },
+    { "name": "tunnelblick.net", "include_subdomains": true, "mode": "force-https" },
+    { "name": "typing.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "ufotable.uk", "include_subdomains": true, "mode": "force-https" },
+    { "name": "up1.ca", "include_subdomains": true, "mode": "force-https" },
+    { "name": "vermontcareergateway.org", "include_subdomains": true, "mode": "force-https" },
+    { "name": "virtualsanity.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "whatsmychaincert.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "wjglerum.nl", "include_subdomains": true, "mode": "force-https" },
+    { "name": "wp-tao.com", "include_subdomains": true, "mode": "force-https" },
+    { "name": "yoloprod.fr", "include_subdomains": true, "mode": "force-https" },
+    { "name": "zzsec.org", "include_subdomains": true, "mode": "force-https" }
   ],
 
   // |ReportUMAOnPinFailure| uses these to report which domain was associated
diff --git a/net/proxy/proxy_config_service_linux.cc b/net/proxy/proxy_config_service_linux.cc
index e6c0bcd..dc4f3d0 100644
--- a/net/proxy/proxy_config_service_linux.cc
+++ b/net/proxy/proxy_config_service_linux.cc
@@ -885,7 +885,8 @@
         // KDE3 always uses .kde for its configuration.
         base::FilePath kde_path = base::FilePath(home).Append(".kde");
         kde_config_dir_ = KDEHomeToConfigPath(kde_path);
-      } else {
+      } else if (base::nix::GetDesktopEnvironment(env_var_getter) ==
+                 base::nix::DESKTOP_ENVIRONMENT_KDE4) {
         // Some distributions patch KDE4 to use .kde4 instead of .kde, so that
         // both can be installed side-by-side. Sadly they don't all do this, and
         // they don't always do this: some distributions have started switching
@@ -917,6 +918,9 @@
         } else {
           kde_config_dir_ = KDEHomeToConfigPath(kde3_path);
         }
+      } else {
+        // KDE 5 migrated to ~/.config for storing kioslaverc.
+        kde_config_dir_ = base::FilePath(home).Append(".config");
       }
     }
   }
@@ -1551,6 +1555,7 @@
       break;
     case base::nix::DESKTOP_ENVIRONMENT_KDE3:
     case base::nix::DESKTOP_ENVIRONMENT_KDE4:
+    case base::nix::DESKTOP_ENVIRONMENT_KDE5:
       setting_getter_.reset(new SettingGetterImplKDE(env_var_getter));
       break;
     case base::nix::DESKTOP_ENVIRONMENT_XFCE:
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index 63fb92c..9a70d14 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -36,6 +36,7 @@
   // environment variable name exactly.
   const char *DESKTOP_SESSION, *HOME,
       *KDEHOME, *KDE_SESSION_VERSION,
+      *XDG_CURRENT_DESKTOP,
       *auto_proxy, *all_proxy,
       *http_proxy, *https_proxy, *ftp_proxy,
       *SOCKS_SERVER, *SOCKS_VERSION,
@@ -91,6 +92,7 @@
     ENTRY(HOME);
     ENTRY(KDEHOME);
     ENTRY(KDE_SESSION_VERSION);
+    ENTRY(XDG_CURRENT_DESKTOP);
     ENTRY(auto_proxy);
     ENTRY(all_proxy);
     ENTRY(http_proxy);
@@ -354,6 +356,7 @@
     // Set up a temporary KDE home directory.
     std::string prefix("ProxyConfigServiceLinuxTest_user_home");
     base::CreateNewTempDirectory(prefix, &user_home_);
+    config_home_ = user_home_.Append(FILE_PATH_LITERAL(".config"));
     kde_home_ = user_home_.Append(FILE_PATH_LITERAL(".kde"));
     base::FilePath path = kde_home_.Append(FILE_PATH_LITERAL("share"));
     path = path.Append(FILE_PATH_LITERAL("config"));
@@ -364,6 +367,8 @@
     path = kde4_home_.Append(FILE_PATH_LITERAL("share"));
     kde4_config_ = path.Append(FILE_PATH_LITERAL("config"));
     kioslaverc4_ = kde4_config_.Append(FILE_PATH_LITERAL("kioslaverc"));
+    // Set up paths for KDE 5
+    kioslaverc5_ = config_home_.Append(FILE_PATH_LITERAL("kioslaverc"));
   }
 
   void TearDown() override {
@@ -373,6 +378,7 @@
   }
 
   base::FilePath user_home_;
+  base::FilePath config_home_;
   // KDE3 paths.
   base::FilePath kde_home_;
   base::FilePath kioslaverc_;
@@ -380,6 +386,8 @@
   base::FilePath kde4_home_;
   base::FilePath kde4_config_;
   base::FilePath kioslaverc4_;
+  // KDE5 paths.
+  base::FilePath kioslaverc5_;
 };
 
 // Builds an identifier for each test in an array.
@@ -719,6 +727,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         NULL,  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -740,6 +749,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         "",    // auto_proxy
         NULL,  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -761,6 +771,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         "http://wpad/wpad.dat",  // auto_proxy
         NULL,  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -782,6 +793,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         "wpad.dat",  // auto_proxy
         NULL,  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -803,6 +815,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         "www.google.com",  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -826,6 +839,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         "www.google.com:99",  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -849,6 +863,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         "http://www.google.com:99",  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -872,6 +887,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         NULL,  // all_proxy
         "www.google.com:80", "www.foo.com:110", "ftp.foo.com:121",  // per-proto
@@ -897,6 +913,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         "",  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -920,6 +937,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         "",  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -943,6 +961,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         "",  // all_proxy
         NULL, NULL, NULL,  // per-proto proxies
@@ -966,6 +985,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         "www.google.com",  // all_proxy
         NULL, NULL, NULL,  // per-proto
@@ -1465,6 +1485,7 @@
         NULL,  // HOME
         NULL,  // KDEHOME
         NULL,  // KDE_SESSION_VERSION
+        NULL,  // XDG_CURRENT_DESKTOP
         NULL,  // auto_proxy
         NULL,  // all_proxy
         "www.normal.com",  // http_proxy
@@ -1521,6 +1542,14 @@
   std::string slaverc4 = "[Proxy Settings]\nProxyType=2\n"
                              "Proxy Config Script=http://wpad/wpad.dat\n";
   GURL slaverc4_pac_url("http://wpad/wpad.dat");
+  // Basic HTTP proxy setting.
+  std::string slaverc5 =
+      "[Proxy Settings]\nProxyType=1\nhttpProxy=www.google.com 80\n";
+  ProxyRulesExpectation slaverc5_rules =
+      ProxyRulesExpectation::PerScheme("www.google.com:80",  // http
+                                       "",                   // https
+                                       "",                   // ftp
+                                       "");                  // bypass rules
 
   // Overwrite the .kde kioslaverc file.
   base::WriteFile(kioslaverc_, slaverc3.c_str(), slaverc3.length());
@@ -1609,6 +1638,26 @@
     EXPECT_TRUE(config.auto_detect());
     EXPECT_EQ(GURL(), config.pac_url());
   }
+
+  // For KDE 5 create ${HOME}/.config and put a kioslaverc in the directory.
+  base::CreateDirectory(config_home_);
+  base::WriteFile(kioslaverc5_, slaverc5.c_str(), slaverc5.length());
+  CHECK(base::PathExists(kioslaverc5_));
+
+  {
+    SCOPED_TRACE("KDE5, .kde and .kde4 present, use .config");
+    MockEnvironment* env = new MockEnvironment;
+    env->values.XDG_CURRENT_DESKTOP = "KDE";
+    env->values.KDE_SESSION_VERSION = "5";
+    env->values.HOME = user_home_.value().c_str();
+    SynchConfigGetter sync_config_getter(new ProxyConfigServiceLinux(env));
+    ProxyConfig config;
+    sync_config_getter.SetupAndInitialFetch();
+    EXPECT_EQ(ProxyConfigService::CONFIG_VALID,
+              sync_config_getter.SyncGetLatestProxyConfig(&config));
+    EXPECT_FALSE(config.auto_detect());
+    EXPECT_TRUE(slaverc5_rules.Matches(config.proxy_rules()));
+  }
 }
 
 }  // namespace
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index bb94cac..f27151c 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -3138,7 +3138,7 @@
       SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
   server_options.bulk_ciphers =
       SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
-  server_options.enable_npn = true;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
   SSLConfig client_config;
   client_config.next_protos.push_back(kProtoHTTP11);
   ASSERT_NO_FATAL_FAILURE(
@@ -3165,7 +3165,7 @@
       SpawnedTestServer::SSLOptions::KEY_EXCHANGE_RSA;
   server_options.bulk_ciphers =
       SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
-  server_options.enable_npn = true;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
   SSLConfig client_config;
   client_config.next_protos.push_back(kProtoHTTP11);
   ASSERT_NO_FATAL_FAILURE(
@@ -3179,7 +3179,7 @@
       SpawnedTestServer::SSLOptions::KEY_EXCHANGE_DHE_RSA;
   server_options.bulk_ciphers =
       SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
-  server_options.enable_npn = true;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
   SSLConfig client_config;
   client_config.next_protos.push_back(kProtoHTTP11);
   ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false));
@@ -3192,7 +3192,7 @@
       SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
   server_options.bulk_ciphers =
       SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128;
-  server_options.enable_npn = true;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
   SSLConfig client_config;
   client_config.next_protos.push_back(kProtoHTTP11);
   ASSERT_NO_FATAL_FAILURE(TestFalseStart(server_options, client_config, false));
@@ -3206,7 +3206,7 @@
       SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
   server_options.bulk_ciphers =
       SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
-  server_options.enable_npn = true;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
   SSLConfig client_config;
   client_config.next_protos.push_back(kProtoHTTP11);
 
@@ -3239,7 +3239,7 @@
       SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
   server_options.bulk_ciphers =
       SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
-  server_options.enable_npn = true;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
   ASSERT_TRUE(StartTestServer(server_options));
 
   SSLConfig client_config;
@@ -3297,7 +3297,7 @@
       SpawnedTestServer::SSLOptions::KEY_EXCHANGE_ECDHE_RSA;
   server_options.bulk_ciphers =
       SpawnedTestServer::SSLOptions::BULK_CIPHER_AES128GCM;
-  server_options.enable_npn = true;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
   ASSERT_TRUE(StartTestServer(server_options));
 
   SSLConfig client_config;
@@ -3418,4 +3418,96 @@
   EXPECT_FALSE(sock_->IsConnected());
 }
 
+TEST_F(SSLClientSocketTest, NPN) {
+  SpawnedTestServer::SSLOptions server_options;
+  server_options.npn_protocols.push_back(std::string("spdy/3.1"));
+  server_options.npn_protocols.push_back(std::string("h2"));
+  ASSERT_TRUE(ConnectToTestServer(server_options));
+
+  SSLConfig client_config;
+  client_config.next_protos.push_back(kProtoHTTP2);
+  client_config.next_protos.push_back(kProtoHTTP11);
+
+  int rv;
+  ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
+  EXPECT_EQ(OK, rv);
+
+  std::string proto;
+  EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto));
+  EXPECT_EQ("h2", proto);
+}
+
+// In case of no overlap between client and server list, SSLClientSocket should
+// fall back to first one on the client list.
+TEST_F(SSLClientSocketTest, NPNNoOverlap) {
+  SpawnedTestServer::SSLOptions server_options;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
+  ASSERT_TRUE(ConnectToTestServer(server_options));
+
+  SSLConfig client_config;
+  client_config.next_protos.push_back(kProtoHTTP2);
+  client_config.next_protos.push_back(kProtoSPDY31);
+
+  int rv;
+  ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
+  EXPECT_EQ(OK, rv);
+
+  std::string proto;
+  EXPECT_EQ(SSLClientSocket::kNextProtoNoOverlap, sock_->GetNextProto(&proto));
+  EXPECT_EQ("h2", proto);
+}
+
+// Server preference should be respected.  The list is in decreasing order of
+// preference.
+TEST_F(SSLClientSocketTest, NPNServerPreference) {
+  SpawnedTestServer::SSLOptions server_options;
+  server_options.npn_protocols.push_back(std::string("spdy/3.1"));
+  server_options.npn_protocols.push_back(std::string("h2"));
+  ASSERT_TRUE(ConnectToTestServer(server_options));
+
+  SSLConfig client_config;
+  client_config.next_protos.push_back(kProtoHTTP2);
+  client_config.next_protos.push_back(kProtoSPDY31);
+
+  int rv;
+  ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
+  EXPECT_EQ(OK, rv);
+
+  std::string proto;
+  EXPECT_EQ(SSLClientSocket::kNextProtoNegotiated, sock_->GetNextProto(&proto));
+  EXPECT_EQ("spdy/3.1", proto);
+}
+
+TEST_F(SSLClientSocketTest, NPNClientDisabled) {
+  SpawnedTestServer::SSLOptions server_options;
+  server_options.npn_protocols.push_back(std::string("http/1.1"));
+  ASSERT_TRUE(ConnectToTestServer(server_options));
+
+  SSLConfig client_config;
+
+  int rv;
+  ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
+  EXPECT_EQ(OK, rv);
+
+  std::string proto;
+  EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported,
+            sock_->GetNextProto(&proto));
+}
+
+TEST_F(SSLClientSocketTest, NPNServerDisabled) {
+  SpawnedTestServer::SSLOptions server_options;
+  ASSERT_TRUE(ConnectToTestServer(server_options));
+
+  SSLConfig client_config;
+  client_config.next_protos.push_back(kProtoHTTP11);
+
+  int rv;
+  ASSERT_TRUE(CreateAndConnectSSLClientSocket(client_config, &rv));
+  EXPECT_EQ(OK, rv);
+
+  std::string proto;
+  EXPECT_EQ(SSLClientSocket::kNextProtoUnsupported,
+            sock_->GetNextProto(&proto));
+}
+
 }  // namespace net
diff --git a/net/test/run_all_unittests.cc b/net/test/run_all_unittests.cc
index 535fa07..87f757a 100644
--- a/net/test/run_all_unittests.cc
+++ b/net/test/run_all_unittests.cc
@@ -25,7 +25,7 @@
 #endif
 
 #if !defined(OS_ANDROID) && !defined(OS_IOS)
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #endif
 
 using net::internal::ClientSocketPoolBaseHelper;
@@ -68,7 +68,7 @@
   net::EnableSSLServerSockets();
 
 #if !defined(OS_ANDROID) && !defined(OS_IOS)
-  mojo::embedder::test::InitWithSimplePlatformSupport();
+  mojo::embedder::Init();
 #endif
 
   return base::LaunchUnitTests(
diff --git a/net/test/spawned_test_server/base_test_server.cc b/net/test/spawned_test_server/base_test_server.cc
index 393426ff..d245cc2 100644
--- a/net/test/spawned_test_server/base_test_server.cc
+++ b/net/test/spawned_test_server/base_test_server.cc
@@ -134,7 +134,6 @@
       fallback_scsv_enabled(false),
       staple_ocsp_response(false),
       ocsp_server_unavailable(false),
-      enable_npn(false),
       alert_after_handshake(false),
       disable_channel_id(false),
       disable_extended_master_secret(false) {}
@@ -153,7 +152,6 @@
       fallback_scsv_enabled(false),
       staple_ocsp_response(false),
       ocsp_server_unavailable(false),
-      enable_npn(false),
       alert_after_handshake(false),
       disable_channel_id(false),
       disable_extended_master_secret(false) {}
@@ -554,8 +552,13 @@
       arguments->Set("ocsp-server-unavailable",
                      base::Value::CreateNullValue());
     }
-    if (ssl_options_.enable_npn)
-      arguments->Set("enable-npn", base::Value::CreateNullValue());
+    if (!ssl_options_.npn_protocols.empty()) {
+      scoped_ptr<base::ListValue> npn_protocols(new base::ListValue());
+      for (const std::string& proto : ssl_options_.npn_protocols) {
+        npn_protocols->Append(new base::StringValue(proto));
+      }
+      arguments->Set("npn-protocols", npn_protocols.Pass());
+    }
     if (ssl_options_.alert_after_handshake)
       arguments->Set("alert-after-handshake", base::Value::CreateNullValue());
 
diff --git a/net/test/spawned_test_server/base_test_server.h b/net/test/spawned_test_server/base_test_server.h
index 5a5cc82..3ea2506 100644
--- a/net/test/spawned_test_server/base_test_server.h
+++ b/net/test/spawned_test_server/base_test_server.h
@@ -218,8 +218,10 @@
     // stapled OCSP response.
     bool ocsp_server_unavailable;
 
-    // Whether to enable NPN support.
-    bool enable_npn;
+    // List of protocols to advertise in NPN extension.  NPN is not supported if
+    // list is empty.  Note that regardless of what protocol is negotiated, the
+    // test server will continue to speak HTTP/1.1.
+    std::vector<std::string> npn_protocols;
 
     // Whether to send a fatal alert immediately after completing the handshake.
     bool alert_after_handshake;
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 99684c8..7919f87 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -154,7 +154,7 @@
 
   def __init__(self, server_address, request_hander_class, pem_cert_and_key,
                ssl_client_auth, ssl_client_cas, ssl_client_cert_types,
-               ssl_bulk_ciphers, ssl_key_exchanges, enable_npn,
+               ssl_bulk_ciphers, ssl_key_exchanges, npn_protocols,
                record_resume_info, tls_intolerant,
                tls_intolerance_type, signed_cert_timestamps,
                fallback_scsv_enabled, ocsp_response,
@@ -172,10 +172,7 @@
     self.ssl_client_auth = ssl_client_auth
     self.ssl_client_cas = []
     self.ssl_client_cert_types = []
-    if enable_npn:
-      self.next_protos = ['http/1.1']
-    else:
-      self.next_protos = None
+    self.npn_protocols = npn_protocols
     self.signed_cert_timestamps = signed_cert_timestamps
     self.fallback_scsv_enabled = fallback_scsv_enabled
     self.ocsp_response = ocsp_response
@@ -234,7 +231,7 @@
                                     settings=self.ssl_handshake_settings,
                                     reqCAs=self.ssl_client_cas,
                                     reqCertTypes=self.ssl_client_cert_types,
-                                    nextProtos=self.next_protos,
+                                    nextProtos=self.npn_protocols,
                                     signedCertTimestamps=
                                     self.signed_cert_timestamps,
                                     fallbackSCSV=self.fallback_scsv_enabled,
@@ -2056,7 +2053,7 @@
                              self.options.ssl_client_cert_type,
                              self.options.ssl_bulk_cipher,
                              self.options.ssl_key_exchange,
-                             self.options.enable_npn,
+                             self.options.npn_protocols,
                              self.options.record_resume,
                              self.options.tls_intolerant,
                              self.options.tls_intolerance_type,
@@ -2285,12 +2282,10 @@
                                   'multiple times, indicating multiple '
                                   'algorithms should be enabled.');
     # TODO(davidben): Add ALPN support to tlslite.
-    self.option_parser.add_option('--enable-npn', dest='enable_npn',
-                                  default=False, const=True,
-                                  action='store_const',
-                                  help='Enable server support for the NPN '
-                                  'extension. The server will advertise '
-                                  'support for exactly one protocol, http/1.1')
+    self.option_parser.add_option('--npn-protocols', action='append',
+                                  help='Specify the list of protocols sent in'
+                                  'an NPN response.  The server will not'
+                                  'support NPN if the list is empty.')
     self.option_parser.add_option('--file-root-url', default='/files/',
                                   help='Specify a root URL for files served.')
     # TODO(ricea): Generalize this to support basic auth for HTTP too.
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 221c7e8..369aa20 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -591,7 +591,12 @@
 }  // namespace
 
 bool InitializeSDK() {
-  FPDF_InitLibrary();
+  FPDF_LIBRARY_CONFIG config;
+  config.version = 2;
+  config.m_pUserFontPaths = nullptr;
+  config.m_pIsolate = v8::Isolate::GetCurrent();
+  config.m_v8EmbedderSlot = gin::kEmbedderPDFium;
+  FPDF_InitLibraryWithConfig(&config);
 
 #if defined(OS_LINUX)
   // Font loading doesn't work in the renderer sandbox in Linux.
@@ -690,7 +695,7 @@
   FPDF_FORMFILLINFO::FFI_GotoURL = Form_GotoURL;
   FPDF_FORMFILLINFO::FFI_GetLanguage = Form_GetLanguage;
 #endif  // PDF_USE_XFA
-  IPDF_JSPLATFORM::version = 2;
+  IPDF_JSPLATFORM::version = 3;
   IPDF_JSPLATFORM::app_alert = Form_Alert;
   IPDF_JSPLATFORM::app_beep = Form_Beep;
   IPDF_JSPLATFORM::app_response = Form_Response;
@@ -700,8 +705,6 @@
   IPDF_JSPLATFORM::Doc_submitForm = Form_SubmitForm;
   IPDF_JSPLATFORM::Doc_gotoPage = Form_GotoPage;
   IPDF_JSPLATFORM::Field_browse = Form_Browse;
-  IPDF_JSPLATFORM::m_isolate = v8::Isolate::GetCurrent();
-  IPDF_JSPLATFORM::m_v8EmbedderSlot = gin::kEmbedderPDFium;
 
   IFSDK_PAUSE::version = 1;
   IFSDK_PAUSE::user = NULL;
diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi
index 55e1ff2..ea7ccbb 100644
--- a/ppapi/ppapi_sources.gypi
+++ b/ppapi/ppapi_sources.gypi
@@ -513,6 +513,8 @@
     #
     'test_nacl_source_files': [
       # Test cases (PLEASE KEEP THIS SECTION IN ALPHABETICAL ORDER)
+      'tests/test_nacl_irt_stack_alignment.cc',
+      'tests/test_nacl_irt_stack_alignment.h',
       'tests/test_tcp_server_socket_private_disallowed.cc',
       'tests/test_tcp_socket_private_disallowed.cc',
       'tests/test_udp_socket_private_disallowed.cc',
diff --git a/ppapi/tests/test_nacl_irt_stack_alignment.cc b/ppapi/tests/test_nacl_irt_stack_alignment.cc
new file mode 100644
index 0000000..5b379c4
--- /dev/null
+++ b/ppapi/tests/test_nacl_irt_stack_alignment.cc
@@ -0,0 +1,85 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/tests/test_nacl_irt_stack_alignment.h"
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/c/ppb_var.h"
+#include "ppapi/cpp/instance.h"
+#include "ppapi/cpp/module.h"
+#include "ppapi/cpp/var.h"
+#include "ppapi/tests/testing_instance.h"
+
+// This whole test is really only meant for x86-32 NaCl (not PNaCl).
+//
+// This is a regression test for the IRT code being sensitive to stack
+// alignment.  The de jure ABI is that the stack should be aligned to
+// 16 bytes at call sites.  However, the de facto ABI is that the IRT
+// worked in the past when called with misaligned stack.  NaCl code is
+// now compiled to expect the proper 16-byte alignment, but the IRT
+// code must remain compatible with old binaries that failed to do so.
+
+#if defined(__i386__)
+
+REGISTER_TEST_CASE(NaClIRTStackAlignment);
+
+bool TestNaClIRTStackAlignment::Init() {
+  var_interface_ = static_cast<const PPB_Var*>(
+      pp::Module::Get()->GetBrowserInterface(PPB_VAR_INTERFACE));
+  return var_interface_ && CheckTestingInterface();
+}
+
+void TestNaClIRTStackAlignment::RunTests(const std::string& filter) {
+  RUN_TEST(MisalignedCallVarAddRef, filter);
+}
+
+// This calls the given function with the stack explicitly misaligned.
+// If the function (in the IRT) was compiled wrongly, it will crash.
+void MisalignedCall(void (*func)(PP_Var), const PP_Var* arg)
+    asm("MisalignedCall") __attribute__((regparm(2)));
+
+// regparm(2) means: First argument in %eax, second argument in %edx.
+// Writing this with an inline asm would require explaining all the
+// call-clobbers register behavior in the asm clobber list, which is a
+// lot with all the SSE and FPU state.  It's far simpler just to make
+// it a function call the compiler knows is a function call, and then
+// write the function itself in pure assembly.
+asm("MisalignedCall:\n"
+    // Use an SSE register to copy the 16 bytes of memory.
+    // Note this instruction does not care about alignment.
+    // The pointer is not necessarily aligned to 16 bytes.
+    "movups (%edx), %xmm0\n"
+    // Set up a frame so we can recover the stack pointer after alignment.
+    "push %ebp\n"
+    "mov %esp, %ebp\n"
+    // Align the stack properly to 16 bytes.
+    "andl $-16, %esp\n"
+    // Now make space for the 16 bytes of argument data,
+    // plus another 4 bytes so the stack pointer is misaligned.
+    "subl $20, %esp\n"
+    // Copy the argument onto the (misaligned) top of stack.
+    "movups %xmm0, (%esp)\n"
+    // Now call into the IRT, and hilarity ensues.
+    "naclcall %eax\n"
+    // Standard epilogue.
+    "mov %ebp, %esp\n"
+    "pop %ebp\n"
+    "naclret");
+
+std::string TestNaClIRTStackAlignment::TestMisalignedCallVarAddRef() {
+  PP_Var var;
+  var.type = PP_VARTYPE_INT32;
+  var.padding = 0;
+  var.value.as_int = 23;
+
+  ASSERT_EQ(sizeof(var), static_cast<size_t>(16));
+
+  // This will crash if the test fails.
+  MisalignedCall(var_interface_->AddRef, &var);
+  MisalignedCall(var_interface_->Release, &var);
+
+  PASS();
+}
+
+#endif  // defined(__i386__)
diff --git a/ppapi/tests/test_nacl_irt_stack_alignment.h b/ppapi/tests/test_nacl_irt_stack_alignment.h
new file mode 100644
index 0000000..61de76f
--- /dev/null
+++ b/ppapi/tests/test_nacl_irt_stack_alignment.h
@@ -0,0 +1,30 @@
+// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_TEST_TEST_NACL_IRT_STACK_ALIGNMENT_H_
+#define PPAPI_TEST_TEST_NACL_IRT_STACK_ALIGNMENT_H_
+
+#include <string>
+
+#include "ppapi/c/ppb_var.h"
+#include "ppapi/cpp/var.h"
+#include "ppapi/tests/test_case.h"
+
+class TestNaClIRTStackAlignment : public TestCase {
+ public:
+  explicit TestNaClIRTStackAlignment(TestingInstance* instance)
+      : TestCase(instance) {}
+
+ private:
+  // TestCase implementation.
+  virtual bool Init();
+  virtual void RunTests(const std::string& filter);
+
+  std::string TestMisalignedCallVarAddRef();
+
+  // Used by the tests that access the C API directly.
+  const PPB_Var* var_interface_;
+};
+
+#endif  // PPAPI_TEST_TEST_NACL_IRT_STACK_ALIGNMENT_H_
diff --git a/remoting/android/java/src/org/chromium/chromoting/ChromotingUtil.java b/remoting/android/java/src/org/chromium/chromoting/ChromotingUtil.java
index a094cbec..f35298c 100644
--- a/remoting/android/java/src/org/chromium/chromoting/ChromotingUtil.java
+++ b/remoting/android/java/src/org/chromium/chromoting/ChromotingUtil.java
@@ -10,6 +10,8 @@
 import android.util.TypedValue;
 import android.view.Menu;
 
+import org.chromium.base.ApiCompatibilityUtils;
+
 /** Utility methods for chromoting code. */
 public abstract class ChromotingUtil {
     /**
@@ -21,7 +23,7 @@
     public static void tintMenuIcons(Context context, Menu menu) {
         TypedValue typedValue = new TypedValue();
         context.getTheme().resolveAttribute(R.attr.colorControlNormal, typedValue, true);
-        int color = context.getResources().getColor(typedValue.resourceId);
+        int color = ApiCompatibilityUtils.getColor(context.getResources(), typedValue.resourceId);
         int items = menu.size();
         for (int i = 0; i < items; i++) {
             Drawable icon = menu.getItem(i).getIcon();
diff --git a/remoting/protocol/libjingle_transport_factory.cc b/remoting/protocol/libjingle_transport_factory.cc
index 7dc8e74..7a7422d 100644
--- a/remoting/protocol/libjingle_transport_factory.cc
+++ b/remoting/protocol/libjingle_transport_factory.cc
@@ -413,8 +413,9 @@
     return;
   }
 
-  if (base::TimeTicks::Now() - last_jingle_info_update_time_ >
-      base::TimeDelta::FromSeconds(kJingleInfoUpdatePeriodSeconds)) {
+  if (last_jingle_info_update_time_.is_null() ||
+      base::TimeTicks::Now() - last_jingle_info_update_time_ >
+          base::TimeDelta::FromSeconds(kJingleInfoUpdatePeriodSeconds)) {
     jingle_info_request_.reset(new JingleInfoRequest(signal_strategy_));
     jingle_info_request_->Send(base::Bind(
         &LibjingleTransportFactory::OnJingleInfo, base::Unretained(this)));
diff --git a/remoting/protocol/performance_tracker.cc b/remoting/protocol/performance_tracker.cc
index 3ee1a4ab..c0372dd 100644
--- a/remoting/protocol/performance_tracker.cc
+++ b/remoting/protocol/performance_tracker.cc
@@ -27,6 +27,7 @@
     "Chromoting.Video.EncodePendingLatency";
 const char kSendPendingLatencyHistogram[] =
     "Chromoting.Video.SendPendingLatency";
+const char kNetworkLatencyHistogram[] = "Chromoting.Video.NetworkLatency";
 
 // Custom count and custom time histograms are log-scaled by default. This
 // results in fine-grained buckets at lower values and wider-ranged buckets
@@ -76,6 +77,9 @@
 namespace remoting {
 namespace protocol {
 
+PerformanceTracker::FrameTimestamps::FrameTimestamps() {}
+PerformanceTracker::FrameTimestamps::~FrameTimestamps() {}
+
 PerformanceTracker::PerformanceTracker()
     : video_bandwidth_(base::TimeDelta::FromSeconds(kStatsUpdatePeriodSeconds)),
       video_frame_rate_(
@@ -131,6 +135,20 @@
     }
   }
 
+  // If the host didn't specify any of the latency fields then set
+  // |total_host_latency| to Max, to indicate that the latency is unknown.
+  timestamps.total_host_latency = base::TimeDelta::Max();
+  if (packet.has_capture_time_ms() && packet.has_encode_time_ms() &&
+      packet.has_capture_pending_time_ms() &&
+      packet.has_capture_overhead_time_ms() &&
+      packet.has_encode_pending_time_ms() &&
+      packet.has_send_pending_time_ms()) {
+    timestamps.total_host_latency = base::TimeDelta::FromMilliseconds(
+        packet.capture_time_ms() + packet.encode_time_ms() +
+        packet.capture_pending_time_ms() + packet.capture_overhead_time_ms() +
+        packet.encode_pending_time_ms() + packet.send_pending_time_ms());
+  }
+
   // If the packet is empty, there are no other stats to update.
   if (!packet.data().size()) {
     // Record the RTT, even for empty packets, otherwise input events that
@@ -239,6 +257,18 @@
   uma_custom_times_updater_.Run(
       kRoundTripLatencyHistogram, round_trip_latency.InMilliseconds(),
       kLatencyHistogramMinMs, kLatencyHistogramMaxMs, kLatencyHistogramBuckets);
+
+  if (!timestamps.total_host_latency.is_max()) {
+    // Calculate total processing time on host and client.
+    base::TimeDelta total_processing_latency =
+        timestamps.total_host_latency + (now - timestamps.time_received);
+    base::TimeDelta network_latency =
+        round_trip_latency - total_processing_latency;
+    uma_custom_times_updater_.Run(
+        kNetworkLatencyHistogram, network_latency.InMilliseconds(),
+        kVideoActionsHistogramsMinMs, kVideoActionsHistogramsMaxMs,
+        kVideoActionsHistogramsBuckets);
+  }
 }
 
 void PerformanceTracker::UploadRateStatsToUma() {
diff --git a/remoting/protocol/performance_tracker.h b/remoting/protocol/performance_tracker.h
index fefb1697..95b365b9 100644
--- a/remoting/protocol/performance_tracker.h
+++ b/remoting/protocol/performance_tracker.h
@@ -73,9 +73,15 @@
 
  private:
   struct FrameTimestamps {
+    FrameTimestamps();
+    ~FrameTimestamps();
+
     // Set to null for frames that were not sent after a fresh input event.
     base::TimeTicks latest_event_timestamp;
 
+    // Set to TimeDelta::Max() when unknown.
+    base::TimeDelta total_host_latency;
+
     base::TimeTicks time_received;
     base::TimeTicks time_decoded;
   };
diff --git a/remoting/webapp/base/js/client_plugin_impl.js b/remoting/webapp/base/js/client_plugin_impl.js
index 892de83..f115a7e 100644
--- a/remoting/webapp/base/js/client_plugin_impl.js
+++ b/remoting/webapp/base/js/client_plugin_impl.js
@@ -66,10 +66,8 @@
    * @private {Array<remoting.ClientSession.Capability>}
    */
   this.hostCapabilities_ = null;
-  /** @private {boolean} */
-  this.helloReceived_ = false;
   /** @private {base.Deferred} */
-  this.onInitializedDeferred_ = null;
+  this.onInitializedDeferred_ = new base.Deferred();
   /** @private {function(string, string):void} */
   this.onPairingComplete_ = function(clientId, sharedSecret) {};
   /** @private {remoting.ClientSession.PerfStats} */
@@ -82,8 +80,9 @@
     new base.DomEventHook(
       this.plugin_, 'message', this.handleMessage_.bind(this), false),
     new base.DomEventHook(
-      this.plugin_, 'crash', this.onPluginCrashed_.bind(this), false));
-
+      this.plugin_, 'crash', this.onPluginCrashed_.bind(this), false),
+    new base.DomEventHook(
+      this.plugin_, 'error', this.onPluginLoadError_.bind(this), false));
   /** @private */
   this.hostDesktop_ = new remoting.ClientPlugin.HostDesktopImpl(
       this, this.postMessage_.bind(this));
@@ -179,6 +178,13 @@
   console.error('Plugin crashed.');
 };
 
+/** @private */
+remoting.ClientPluginImpl.prototype.onPluginLoadError_ = function() {
+  console.error('Failed to load plugin : ' + this.plugin_.lastError);
+  this.onInitializedDeferred_.reject(
+      new remoting.Error(remoting.Error.Tag.MISSING_PLUGIN));
+};
+
 /**
  * @param {remoting.ClientPluginMessage}
  *    message Parsed message from the plugin.
@@ -247,12 +253,7 @@
   }
 
   if (message.method == 'hello') {
-    this.helloReceived_ = true;
-    if (this.onInitializedDeferred_ != null) {
-      this.onInitializedDeferred_.resolve(true);
-      this.onInitializedDeferred_ = null;
-    }
-
+    this.onInitializedDeferred_.resolve();
   } else if (message.method == 'onDesktopSize') {
     this.hostDesktop_.onSizeUpdated(message);
   } else if (message.method == 'onDesktopShape') {
@@ -366,28 +367,15 @@
 };
 
 /**
- * @return {Promise}  A promise that resolves to true if the plugin initializes.
+ * @override {remoting.ClientPlugin}
  */
 remoting.ClientPluginImpl.prototype.initialize = function() {
-  // 99.9 percentile of plugin initialize time from our stats is 141 seconds.
-  var PLUGIN_INTIALIZE_TIMEOUT = 150 * 1000;
-
+  // If Nacl is disabled, we won't receive any error events, rejecting the
+  // promise immediately.
   if (!base.isNaclEnabled()) {
     return Promise.reject(new remoting.Error(remoting.Error.Tag.NACL_DISABLED));
   }
-
-  if (this.helloReceived_) {
-    return Promise.resolve(true);
-  }
-
-  if (!this.onInitializedDeferred_) {
-    this.onInitializedDeferred_ = new base.Deferred();
-  }
-
-  return base.Promise.rejectAfterTimeout(
-      this.onInitializedDeferred_.promise(),
-      PLUGIN_INTIALIZE_TIMEOUT,
-      new remoting.Error(remoting.Error.Tag.MISSING_PLUGIN));
+  return this.onInitializedDeferred_.promise();
 };
 
 /**
diff --git a/remoting/webapp/js_proto/dom_proto.js b/remoting/webapp/js_proto/dom_proto.js
index de12493..c47c990 100644
--- a/remoting/webapp/js_proto/dom_proto.js
+++ b/remoting/webapp/js_proto/dom_proto.js
@@ -212,3 +212,11 @@
 
 /** @type {string} */
 chrome.ConsoleMessageBrowserEvent.prototype.sourceId;
+
+/**
+ * The last error of the NaCL embed element.
+ * https://developer.chrome.com/native-client/devguide/coding/progress-events
+ *
+ * @type {string}
+ */
+HTMLEmbedElement.prototype.lastError;
diff --git a/sandbox/linux/BUILD.gn b/sandbox/linux/BUILD.gn
index 566735a..e734324 100644
--- a/sandbox/linux/BUILD.gn
+++ b/sandbox/linux/BUILD.gn
@@ -360,17 +360,6 @@
   ]
 }
 
-# We make this its own target so that it does not interfere with our tests.
-source_set("libc_urandom_override") {
-  sources = [
-    "services/libc_urandom_override.cc",
-    "services/libc_urandom_override.h",
-  ]
-  deps = [
-    "//base",
-  ]
-}
-
 if (compile_suid_client) {
   component("suid_sandbox_client") {
     sources = [
diff --git a/sandbox/linux/sandbox_linux.gypi b/sandbox/linux/sandbox_linux.gypi
index 15cb0fc..4df0f1b 100644
--- a/sandbox/linux/sandbox_linux.gypi
+++ b/sandbox/linux/sandbox_linux.gypi
@@ -315,23 +315,6 @@
       ],
     },
     {
-      # We make this its own target so that it does not interfere
-      # with our tests, and so that it may be selectively included
-      # in ports which need it.
-      'target_name': 'libc_urandom_override',
-      'type': 'static_library',
-      'sources': [
-        'services/libc_urandom_override.cc',
-        'services/libc_urandom_override.h',
-      ],
-      'dependencies': [
-        '../base/base.gyp:base',
-      ],
-      'include_dirs': [
-        '..',
-      ],
-    },
-    {
       'target_name': 'suid_sandbox_client',
       'type': '<(component)',
       'sources': [
diff --git a/sandbox/linux/services/libc_urandom_override.cc b/sandbox/linux/services/libc_urandom_override.cc
deleted file mode 100644
index 33bb25d..0000000
--- a/sandbox/linux/services/libc_urandom_override.cc
+++ /dev/null
@@ -1,236 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "sandbox/linux/services/libc_urandom_override.h"
-
-#include <dlfcn.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <unistd.h>
-
-#include "base/logging.h"
-#include "base/posix/eintr_wrapper.h"
-#include "base/rand_util.h"
-
-// Note: this file is used by the zygote and nacl_helper.
-
-#if !defined(HAVE_XSTAT) && defined(LIBC_GLIBC)
-#define HAVE_XSTAT 1
-#endif
-
-namespace sandbox {
-
-static bool g_override_urandom = false;
-
-// TODO(sergeyu): Currently InitLibcUrandomOverrides() doesn't work properly
-// under ASan or MSan - it crashes content_unittests. Make sure it works
-// properly and enable it here. http://crbug.com/123263
-#if !(defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER))
-static void InitLibcFileIOFunctions();
-static pthread_once_t g_libc_file_io_funcs_guard = PTHREAD_ONCE_INIT;
-#endif
-
-void InitLibcUrandomOverrides() {
-  // Make sure /dev/urandom is open.
-  base::GetUrandomFD();
-  g_override_urandom = true;
-
-#if !(defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER))
-  CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard,
-                           InitLibcFileIOFunctions));
-#endif
-}
-
-#if !(defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER))
-
-static const char kUrandomDevPath[] = "/dev/urandom";
-
-typedef FILE* (*FopenFunction)(const char* path, const char* mode);
-
-static FopenFunction g_libc_fopen = NULL;
-static FopenFunction g_libc_fopen64 = NULL;
-
-#if HAVE_XSTAT
-typedef int (*XstatFunction)(int version, const char *path, struct stat *buf);
-typedef int (*Xstat64Function)(int version, const char *path,
-                               struct stat64 *buf);
-
-static XstatFunction g_libc_xstat = NULL;
-static Xstat64Function g_libc_xstat64 = NULL;
-#else
-typedef int (*StatFunction)(const char *path, struct stat *buf);
-typedef int (*Stat64Function)(const char *path, struct stat64 *buf);
-
-static StatFunction g_libc_stat = NULL;
-static Stat64Function g_libc_stat64 = NULL;
-#endif  // HAVE_XSTAT
-
-// Find the libc's real fopen* and *stat* functions. This should only be
-// called once, and should be guarded by g_libc_file_io_funcs_guard.
-static void InitLibcFileIOFunctions() {
-  g_libc_fopen = reinterpret_cast<FopenFunction>(
-      dlsym(RTLD_NEXT, "fopen"));
-  g_libc_fopen64 = reinterpret_cast<FopenFunction>(
-      dlsym(RTLD_NEXT, "fopen64"));
-
-  if (!g_libc_fopen) {
-    LOG(FATAL) << "Failed to get fopen() from libc.";
-  } else if (!g_libc_fopen64) {
-#if !defined(OS_OPENBSD) && !defined(OS_FREEBSD)
-    LOG(WARNING) << "Failed to get fopen64() from libc. Using fopen() instead.";
-#endif  // !defined(OS_OPENBSD) && !defined(OS_FREEBSD)
-    g_libc_fopen64 = g_libc_fopen;
-  }
-
-#if HAVE_XSTAT
-  g_libc_xstat = reinterpret_cast<XstatFunction>(
-      dlsym(RTLD_NEXT, "__xstat"));
-  g_libc_xstat64 = reinterpret_cast<Xstat64Function>(
-      dlsym(RTLD_NEXT, "__xstat64"));
-
-  if (!g_libc_xstat) {
-    LOG(FATAL) << "Failed to get __xstat() from libc.";
-  }
-  if (!g_libc_xstat64) {
-    LOG(FATAL) << "Failed to get __xstat64() from libc.";
-  }
-#else
-  g_libc_stat = reinterpret_cast<StatFunction>(
-      dlsym(RTLD_NEXT, "stat"));
-  g_libc_stat64 = reinterpret_cast<Stat64Function>(
-      dlsym(RTLD_NEXT, "stat64"));
-
-  if (!g_libc_stat) {
-    LOG(FATAL) << "Failed to get stat() from libc.";
-  }
-  if (!g_libc_stat64) {
-    LOG(FATAL) << "Failed to get stat64() from libc.";
-  }
-#endif  // HAVE_XSTAT
-}
-
-// fopen() and fopen64() are intercepted here so that NSS can open
-// /dev/urandom to seed its random number generator. NSS is used by
-// remoting in the sendbox.
-
-// fopen() call may be redirected to fopen64() in stdio.h using
-// __REDIRECT(), which sets asm name for fopen() to "fopen64". This
-// means that we cannot override fopen() directly here. Instead the
-// the code below defines fopen_override() function with asm name
-// "fopen", so that all references to fopen() will resolve to this
-// function.
-__attribute__ ((__visibility__("default")))
-FILE* fopen_override(const char* path, const char* mode)  __asm__ ("fopen");
-
-__attribute__ ((__visibility__("default")))
-FILE* fopen_override(const char* path, const char* mode) {
-  if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
-    int fd = HANDLE_EINTR(dup(base::GetUrandomFD()));
-    if (fd < 0) {
-      PLOG(ERROR) << "dup() failed.";
-      return NULL;
-    }
-    return fdopen(fd, mode);
-  } else {
-    CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard,
-                             InitLibcFileIOFunctions));
-    return g_libc_fopen(path, mode);
-  }
-}
-
-__attribute__ ((__visibility__("default")))
-FILE* fopen64(const char* path, const char* mode) {
-  if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
-    int fd = HANDLE_EINTR(dup(base::GetUrandomFD()));
-    if (fd < 0) {
-      PLOG(ERROR) << "dup() failed.";
-      return NULL;
-    }
-    return fdopen(fd, mode);
-  } else {
-    CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard,
-                             InitLibcFileIOFunctions));
-    return g_libc_fopen64(path, mode);
-  }
-}
-
-// The stat() family of functions are subject to the same problem as
-// fopen(), so we have to use the same trick to override them.
-
-#if HAVE_XSTAT
-
-__attribute__ ((__visibility__("default")))
-int xstat_override(int version,
-                   const char *path,
-                   struct stat *buf)  __asm__ ("__xstat");
-
-__attribute__ ((__visibility__("default")))
-int xstat_override(int version, const char *path, struct stat *buf) {
-  if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
-    int result = __fxstat(version, base::GetUrandomFD(), buf);
-    return result;
-  } else {
-    CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard,
-                             InitLibcFileIOFunctions));
-    return g_libc_xstat(version, path, buf);
-  }
-}
-
-__attribute__ ((__visibility__("default")))
-int xstat64_override(int version,
-                     const char *path,
-                     struct stat64 *buf)  __asm__ ("__xstat64");
-
-__attribute__ ((__visibility__("default")))
-int xstat64_override(int version, const char *path, struct stat64 *buf) {
-  if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
-    int result = __fxstat64(version, base::GetUrandomFD(), buf);
-    return result;
-  } else {
-    CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard,
-                             InitLibcFileIOFunctions));
-    return g_libc_xstat64(version, path, buf);
-  }
-}
-
-#else
-
-__attribute__ ((__visibility__("default")))
-int stat_override(const char *path,
-                  struct stat *buf)  __asm__ ("stat");
-
-__attribute__ ((__visibility__("default")))
-int stat_override(const char *path, struct stat *buf) {
-  if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
-    int result = fstat(base::GetUrandomFD(), buf);
-    return result;
-  } else {
-    CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard,
-                             InitLibcFileIOFunctions));
-    return g_libc_stat(path, buf);
-  }
-}
-
-__attribute__ ((__visibility__("default")))
-int stat64_override(const char *path,
-                    struct stat64 *buf)  __asm__ ("stat64");
-
-__attribute__ ((__visibility__("default")))
-int stat64_override(const char *path, struct stat64 *buf) {
-  if (g_override_urandom && strcmp(path, kUrandomDevPath) == 0) {
-    int result = fstat64(base::GetUrandomFD(), buf);
-    return result;
-  } else {
-    CHECK_EQ(0, pthread_once(&g_libc_file_io_funcs_guard,
-                             InitLibcFileIOFunctions));
-    return g_libc_stat64(path, buf);
-  }
-}
-
-#endif  // HAVE_XSTAT
-
-#endif  // !(defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER))
-
-}  // namespace content
diff --git a/sandbox/linux/services/libc_urandom_override.h b/sandbox/linux/services/libc_urandom_override.h
deleted file mode 100644
index 86212f8..0000000
--- a/sandbox/linux/services/libc_urandom_override.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef SANDBOX_LINUX_SERVICES_LIBC_URANDOM_OVERRIDE_H_
-#define SANDBOX_LINUX_SERVICES_LIBC_URANDOM_OVERRIDE_H_
-
-namespace sandbox {
-
-void InitLibcUrandomOverrides();
-
-}  // namespace sandbox
-
-#endif  // SANDBOX_LINUX_SERVICES_LIBC_URANDOM_OVERRIDE_H_
diff --git a/sql/sql.gyp b/sql/sql.gyp
index 018b287ce..115a93bd 100644
--- a/sql/sql.gyp
+++ b/sql/sql.gyp
@@ -139,6 +139,25 @@
           'includes': [ '../build/apk_test.gypi' ],
         },
       ],
+      'conditions': [
+        ['test_isolation_mode != "noop"', {
+          'targets': [
+            {
+              'target_name': 'sql_unittests_apk_run',
+              'type': 'none',
+              'dependencies': [
+                'sql_unittests_apk',
+              ],
+              'includes': [
+                '../build/isolate.gypi',
+              ],
+              'sources': [
+                'sql_unittests_apk.isolate',
+              ],
+            },
+          ]
+        }],
+      ]
     }],
     ['test_isolation_mode != "noop"', {
       'targets': [
diff --git a/sql/sql_unittests_apk.isolate b/sql/sql_unittests_apk.isolate
new file mode 100644
index 0000000..7788b5c
--- /dev/null
+++ b/sql/sql_unittests_apk.isolate
@@ -0,0 +1,23 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+{
+  'includes': [
+    '../build/android/android.isolate',
+    'sql_unittests.isolate',
+  ],
+  'variables': {
+    'command': [
+      '<(PRODUCT_DIR)/bin/run_sql_unittests',
+    ],
+    'files': [
+      '../base/base.isolate',
+      '../build/config/',
+      '../third_party/icu/icu.isolate',
+      '../third_party/instrumented_libraries/instrumented_libraries.isolate',
+      '<(PRODUCT_DIR)/bin/run_sql_unittests',
+      '<(PRODUCT_DIR)/sql_unittests_apk/',
+      'sql_unittests.isolate',
+    ]
+  },
+}
diff --git a/sync/android/java/src/org/chromium/sync/signin/AccountManagerDelegate.java b/sync/android/java/src/org/chromium/sync/signin/AccountManagerDelegate.java
index cfbab3e..4cc32a1 100644
--- a/sync/android/java/src/org/chromium/sync/signin/AccountManagerDelegate.java
+++ b/sync/android/java/src/org/chromium/sync/signin/AccountManagerDelegate.java
@@ -15,8 +15,21 @@
  * Wrapper around the Android account manager, to facilitate dependency injection during testing.
  */
 public interface AccountManagerDelegate {
+    /**
+     * A callback class that can be used to allow asynchronous methods.
+     */
+    interface Callback<T> {
+        void gotResult(T value);
+    }
+
+    /**
+     * Use the asynchronous getAccountsByType(String, Callback<Account[]>) instead.
+     */
+    @Deprecated
     Account[] getAccountsByType(String type);
 
+    void getAccountsByType(String type, Callback<Account[]> callback);
+
     AccountManagerFuture<Bundle> getAuthToken(Account account, String authTokenType,
             boolean notifyAuthFailure, AccountManagerCallback<Bundle> callback, Handler handler);
 
@@ -24,6 +37,5 @@
 
     AuthenticatorDescription[] getAuthenticatorTypes();
 
-    AccountManagerFuture<Boolean> hasFeatures(Account account, String[] features,
-            AccountManagerCallback<Boolean> callback, Handler handler);
+    void hasFeatures(Account account, String[] features, Callback<Boolean> callback);
 }
diff --git a/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java b/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
index 7c10267..ce696aa8 100644
--- a/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
+++ b/sync/android/java/src/org/chromium/sync/signin/AccountManagerHelper.java
@@ -8,7 +8,6 @@
 import android.Manifest;
 import android.accounts.Account;
 import android.accounts.AccountManager;
-import android.accounts.AccountManagerCallback;
 import android.accounts.AccountManagerFuture;
 import android.accounts.AuthenticatorDescription;
 import android.accounts.AuthenticatorException;
@@ -166,16 +165,8 @@
         return mAccountManager.getAccountsByType(GOOGLE_ACCOUNT_TYPE);
     }
 
-    /**
-     * Convenience method to get the single Google account on the device. Should only be
-     * called if it has been determined that there is exactly one account.
-     *
-     * @return The single account to sign into.
-     */
-    public Account getSingleGoogleAccount() {
-        Account[] googleAccounts = getGoogleAccounts();
-        assert googleAccounts.length == 1;
-        return googleAccounts[0];
+    public void getGoogleAccounts(AccountManagerDelegate.Callback<Account[]> callback) {
+        mAccountManager.getAccountsByType(GOOGLE_ACCOUNT_TYPE, callback);
     }
 
     public boolean hasGoogleAccounts() {
@@ -382,9 +373,9 @@
         }
     }
 
-    public AccountManagerFuture<Boolean> checkChildAccount(
-            Account account, AccountManagerCallback<Boolean> callback) {
+    public void checkChildAccount(
+            Account account, AccountManagerDelegate.Callback<Boolean> callback) {
         String[] features = {FEATURE_IS_CHILD_ACCOUNT_KEY};
-        return mAccountManager.hasFeatures(account, features, callback, null /* handler */);
+        mAccountManager.hasFeatures(account, features, callback);
     }
 }
diff --git a/sync/android/java/src/org/chromium/sync/signin/SystemAccountManagerDelegate.java b/sync/android/java/src/org/chromium/sync/signin/SystemAccountManagerDelegate.java
index 07aabac..8688314 100644
--- a/sync/android/java/src/org/chromium/sync/signin/SystemAccountManagerDelegate.java
+++ b/sync/android/java/src/org/chromium/sync/signin/SystemAccountManagerDelegate.java
@@ -12,11 +12,13 @@
 import android.accounts.AuthenticatorException;
 import android.accounts.OperationCanceledException;
 import android.content.Context;
+import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.StrictMode;
 import android.os.SystemClock;
 
+import org.chromium.base.Log;
 import org.chromium.base.ThreadUtils;
 import org.chromium.base.library_loader.LibraryLoader;
 import org.chromium.base.metrics.RecordHistogram;
@@ -32,6 +34,7 @@
 
     private final AccountManager mAccountManager;
     private final Context mApplicationContext;
+    private static final String TAG = "Auth";
 
     public SystemAccountManagerDelegate(Context context) {
         mApplicationContext = context.getApplicationContext();
@@ -51,6 +54,21 @@
     }
 
     @Override
+    public void getAccountsByType(final String type, final Callback<Account[]> callback) {
+        new AsyncTask<Void, Void, Account[]>() {
+            @Override
+            protected Account[] doInBackground(Void... params) {
+                return getAccountsByType(type);
+            }
+
+            @Override
+            protected void onPostExecute(Account[] accounts) {
+                callback.gotResult(accounts);
+            }
+        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+    }
+
+    @Override
     public AccountManagerFuture<Bundle> getAuthToken(Account account, String authTokenType,
             boolean notifyAuthFailure, AccountManagerCallback<Bundle> callback, Handler handler) {
         return mAccountManager.getAuthToken(account, authTokenType, null, notifyAuthFailure,
@@ -75,19 +93,32 @@
     }
 
     @Override
-    public AccountManagerFuture<Boolean> hasFeatures(Account account, String[] features,
-            final AccountManagerCallback<Boolean> callback, Handler handler) {
+    public void hasFeatures(Account account, String[] features,
+            final AccountManagerDelegate.Callback<Boolean> callback) {
         if (!AccountManagerHelper.get(mApplicationContext).hasGetAccountsPermission()) {
-            final FakeFalseAccountManagerFuture future = new FakeFalseAccountManagerFuture();
             ThreadUtils.postOnUiThread(new Runnable() {
                 @Override
                 public void run() {
-                    callback.run(future);
+                    callback.gotResult(false);
                 }
             });
-            return future;
+            return;
         }
-        return mAccountManager.hasFeatures(account, features, callback, handler);
+        mAccountManager.hasFeatures(account, features, new AccountManagerCallback<Boolean>() {
+            @Override
+            public void run(AccountManagerFuture<Boolean> future) {
+                assert future.isDone();
+                boolean hasFeatures = false;
+                try {
+                    hasFeatures = future.getResult();
+                } catch (AuthenticatorException | IOException e) {
+                    Log.e(TAG, "Error while checking features: ", e);
+                } catch (OperationCanceledException e) {
+                    Log.e(TAG, "Checking features was cancelled. This should not happen.");
+                }
+                callback.gotResult(hasFeatures);
+            }
+        }, null /* handler */);
     }
 
     /**
@@ -102,34 +133,4 @@
         if (!LibraryLoader.isInitialized()) return;
         RecordHistogram.recordTimesHistogram(histogramName, elapsedMs, TimeUnit.MILLISECONDS);
     }
-
-    private static final class FakeFalseAccountManagerFuture
-            implements AccountManagerFuture<Boolean> {
-        @Override
-        public boolean cancel(boolean mayInterruptIfRunning) {
-            return false;
-        }
-
-        @Override
-        public boolean isCancelled() {
-            return false;
-        }
-
-        @Override
-        public boolean isDone() {
-            return true;
-        }
-
-        @Override
-        public Boolean getResult()
-                throws OperationCanceledException, IOException, AuthenticatorException {
-            return false;
-        }
-
-        @Override
-        public Boolean getResult(long timeout, TimeUnit unit)
-                throws OperationCanceledException, IOException, AuthenticatorException {
-            return getResult();
-        }
-    }
 }
diff --git a/sync/sync_tests.gypi b/sync/sync_tests.gypi
index ea44901..6ea7b6c 100644
--- a/sync/sync_tests.gypi
+++ b/sync/sync_tests.gypi
@@ -504,6 +504,25 @@
           'includes': [ '../build/apk_test.gypi' ],
         },
       ],
+      'conditions': [
+        ['test_isolation_mode != "noop"', {
+          'targets': [
+            {
+              'target_name': 'sync_unit_tests_apk_run',
+              'type': 'none',
+              'dependencies': [
+                'sync_unit_tests_apk',
+              ],
+              'includes': [
+                '../build/isolate.gypi',
+              ],
+              'sources': [
+                'sync_unit_tests_apk.isolate',
+              ],
+            },
+          ],
+        }],
+      ],
     }],
     ['test_isolation_mode != "noop"', {
       'targets': [
diff --git a/sync/sync_unit_tests_apk.isolate b/sync/sync_unit_tests_apk.isolate
new file mode 100644
index 0000000..c1ddf75f
--- /dev/null
+++ b/sync/sync_unit_tests_apk.isolate
@@ -0,0 +1,23 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+{
+  'includes': [
+    '../build/android/android.isolate',
+    'sync_unit_tests.isolate',
+  ],
+  'variables': {
+    'command': [
+      '<(PRODUCT_DIR)/bin/run_sync_unit_tests',
+    ],
+    'files': [
+      '../base/base.isolate',
+      '../build/config/',
+      '../third_party/icu/icu.isolate',
+      '../third_party/instrumented_libraries/instrumented_libraries.isolate',
+      '<(PRODUCT_DIR)/bin/run_sync_unit_tests',
+      '<(PRODUCT_DIR)/sync_unit_tests_apk/',
+      'sync_unit_tests.isolate',
+    ]
+  },
+}
diff --git a/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java b/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
index 532abe1..ada8a64 100644
--- a/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
+++ b/sync/test/android/javatests/src/org/chromium/sync/test/util/MockAccountManager.java
@@ -70,7 +70,7 @@
  */
 public class MockAccountManager implements AccountManagerDelegate {
 
-    private static final String TAG = "cr.MockAccountManager";
+    private static final String TAG = "MockAccountManager";
 
     private static final long WAIT_TIME_FOR_GRANT_BROADCAST_MS = scaleTimeout(20000);
 
@@ -136,6 +136,22 @@
         }
     }
 
+    @Override
+    public void getAccountsByType(
+            final String type, final AccountManagerDelegate.Callback<Account[]> callback) {
+        new AsyncTask<Void, Void, Account[]>() {
+            @Override
+            protected Account[] doInBackground(Void... params) {
+                return getAccountsByType(type);
+            }
+
+            @Override
+            protected void onPostExecute(Account[] accounts) {
+                callback.gotResult(accounts);
+            }
+        }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
+    }
+
     @VisibleForTesting
     public boolean addAccountHolderExplicitly(AccountHolder accountHolder) {
         return addAccountHolderExplicitly(accountHolder, false);
@@ -265,25 +281,23 @@
     }
 
     @Override
-    public AccountManagerFuture<Boolean> hasFeatures(Account account, final String[] features,
-            AccountManagerCallback<Boolean> callback, Handler handler) {
+    public void hasFeatures(Account account, final String[] features,
+            final AccountManagerDelegate.Callback<Boolean> callback) {
         final AccountHolder accountHolder = getAccountHolder(account);
-        AccountManagerTask<Boolean> accountManagerTask =
-                new AccountManagerTask<Boolean>(handler, callback, new Callable<Boolean>() {
-                    @Override
-                    public Boolean call() throws Exception {
-                        Set<String> accountFeatures = accountHolder.getFeatures();
-                        for (String feature : features) {
-                            if (!accountFeatures.contains(feature)) {
-                                Log.d(TAG, accountFeatures + " does not contain " + feature);
-                                return false;
-                            }
-                        }
-                        return true;
+        accountHolder.addFeaturesCallback(new Runnable() {
+            @Override
+            public void run() {
+                Set<String> accountFeatures = accountHolder.getFeatures();
+                boolean hasAllFeatures = true;
+                for (String feature : features) {
+                    if (!accountFeatures.contains(feature)) {
+                        Log.d(TAG, accountFeatures + " does not contain " + feature);
+                        hasAllFeatures = false;
                     }
-                });
-        accountHolder.addFeaturesCallback(accountManagerTask);
-        return accountManagerTask;
+                }
+                callback.gotResult(hasAllFeatures);
+            }
+        });
     }
 
     public void notifyFeaturesFetched(Account account, Set<String> features) {
diff --git a/testing/OWNERS b/testing/OWNERS
index 72e8ffc..d048dc6 100644
--- a/testing/OWNERS
+++ b/testing/OWNERS
@@ -1 +1,2 @@
-*
+phajdan.jr@chromium.org
+dpranke@chromium.org
diff --git a/testing/android/native_test/java/AndroidManifest.xml b/testing/android/native_test/java/AndroidManifest.xml
index 6de21b1..a50ffcd 100644
--- a/testing/android/native_test/java/AndroidManifest.xml
+++ b/testing/android/native_test/java/AndroidManifest.xml
@@ -11,6 +11,7 @@
       android:versionName="1.0">
 
     <uses-sdk android:minSdkVersion="16" android:targetSdkVersion="23" />
+    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.BLUETOOTH"/>
     <uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
     <uses-permission android:name="android.permission.CAMERA" />
diff --git a/testing/buildbot/chromium.linux.json b/testing/buildbot/chromium.linux.json
index 5dc8479ae..bf429393 100644
--- a/testing/buildbot/chromium.linux.json
+++ b/testing/buildbot/chromium.linux.json
@@ -656,7 +656,8 @@
   },
   "Linux Tests": {
     "additional_compile_targets": [
-      "blimp_tests"
+      "blimp_tests",
+      "mandoline:all"
     ],
     "gtest_tests": [
       {
@@ -1048,7 +1049,8 @@
   },
   "Linux Tests (dbg)(1)": {
     "additional_compile_targets": [
-      "blimp_tests"
+      "blimp_tests",
+      "mandoline:all"
     ],
     "gtest_tests": [
       {
diff --git a/third_party/WebKit/LayoutTests/TestExpectations b/third_party/WebKit/LayoutTests/TestExpectations
index d371688..07f799fb 100644
--- a/third_party/WebKit/LayoutTests/TestExpectations
+++ b/third_party/WebKit/LayoutTests/TestExpectations
@@ -24,11 +24,6 @@
 crbug.com/524236 virtual/spv2/paint/invalidation/spv2/updating-scrolling-content-as-text.html [ Failure ]
 crbug.com/524236 virtual/spv2/paint/invalidation/spv2/scrolling-without-painting-as-text.html [ Failure ]
 
-crbug.com/524134 virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent.html [ NeedsRebaseline ]
-crbug.com/524134 virtual/spv2/paint/invalidation/spv2/selection-within-composited-scroller.html [ NeedsRebaseline ]
-crbug.com/524134 virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container.html [ NeedsRebaseline ]
-crbug.com/524134 virtual/spv2/paint/invalidation/spv2/image-resize.html [ NeedsRebaseline ]
-
 crbug.com/527242 virtual/spv2/paint/invalidation/spv2/cached-cell-append.html [ ImageOnlyFailure ]
 crbug.com/527242 virtual/spv2/paint/invalidation/spv2/cached-cell-remove.html [ ImageOnlyFailure ]
 crbug.com/527242 virtual/spv2/paint/invalidation/spv2/cached-change-cell-border-width.html [ ImageOnlyFailure ]
@@ -46,6 +41,9 @@
 crbug.com/504613 crbug.com/524248 virtual/spv2/paint/images/image-backgrounds-not-antialiased.html [ Skip ]
 crbug.com/502531 fast/borders/border-antialiasing.html [ ImageOnlyFailure ]
 
+crbug.com/538697 [ Win7 Debug ] virtual/threaded/printing/webgl-oversized-printing.html [ Crash ]
+crbug.com/538697 [ Win7 Debug ] printing/webgl-oversized-printing.html [ Crash ]
+
 crbug.com/417782 [ Linux Win ] virtual/rootlayerscrolls/fast/scrolling/fractional-scroll-offset-fixed-position-non-composited.html [ ImageOnlyFailure ]
 crbug.com/492664 [ Linux XP ] imported/csswg-test/css-writing-modes-3/box-offsets-rel-pos-vlr-005.xht [ ImageOnlyFailure ]
 crbug.com/492664 [ Linux XP ] imported/csswg-test/css-writing-modes-3/box-offsets-rel-pos-vrl-004.xht [ ImageOnlyFailure ]
@@ -68,18 +66,8 @@
 crbug.com/463358 [ Mac Linux Debug ] svg/W3C-SVG-1.1/paths-data-02-t.svg [ ImageOnlyFailure ]
 crbug.com/463358 [ Mac Linux Debug ] css3/masking/clip-path-polygon.html [ ImageOnlyFailure ]
 
-crbug.com/534763 css3/filters/effect-reference-hw.html [ NeedsRebaseline ]
-crbug.com/534763 css3/filters/effect-reference-subregion-hw.html [ NeedsRebaseline ]
-crbug.com/534763 css3/filters/effect-reference-subregion.html [ NeedsRebaseline ]
-crbug.com/534763 css3/filters/effect-reference-tile-hw.html [ NeedsRebaseline ]
-crbug.com/534763 css3/filters/effect-reference-tile.html [ NeedsRebaseline ]
-crbug.com/534763 css3/filters/effect-reference.html [ NeedsRebaseline ]
-crbug.com/534763 svg/filters/feColorMatrix-invalid-animation.svg [ NeedsRebaseline ]
-
 crbug.com/267206 [ Mac ] virtual/rootlayerscrolls/fast/scrolling/scrollbar-tickmarks-hittest.html [ Timeout ]
 
-crbug.com/535141 fast/text/international/combining-marks-position.html [ NeedsRebaseline ]
-
 crbug.com/280342 [ Linux Win ] http/tests/media/progress-events-generated-correctly.html [ Failure ]
 
 crbug.com/520739 [ Mac ] http/tests/websocket/close-code-and-reason.html [ Failure Pass Timeout ]
@@ -141,8 +129,6 @@
 crbug.com/339597 http/tests/navigation/back-to-redirect-with-frame.php [ Pass Timeout ]
 crbug.com/473718 http/tests/navigation/beacon-cross-origin-redirect.html [ Failure Pass ]
 
-crbug.com/535102 fast/text/midword-break-before-surrogate-pair.html [ NeedsRebaseline ]
-
 crbug.com/410974 fast/scroll-behavior/scroll-customization/scrollstate-basic.html [ Pass Failure ]
 crbug.com/410974 fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas.html [ Pass Failure ]
 crbug.com/410974 fast/scroll-behavior/scroll-customization/scrollstate-consume-deltas-throw.html [ Pass Failure ]
@@ -176,11 +162,6 @@
 crbug.com/526594 [ Win10 ] plugins/webview-plugin-lifecycle.html [ ImageOnlyFailure ]
 crbug.com/518999 [ Win7 Debug ] plugins/webview-plugin-lifecycle.html [ ImageOnlyFailure Pass ]
 
-crbug.com/530331 fast/text/selection-painting-hidpi.html [ NeedsRebaseline ]
-crbug.com/530331 virtual/spv2/paint/selection/text-selection-newline-br.html [ NeedsRebaseline ]
-crbug.com/530331 paint/selection/text-selection-newline-br.html [ NeedsRebaseline ]
-crbug.com/530331 editing/selection/transformed-selection-rects.html [ NeedsRebaseline ]
-
 crbug.com/519001 storage/indexeddb/pending-version-change-stuck-works-with-terminate.html [ Pass Timeout ]
 crbug.com/519002 storage/indexeddb/pending-version-change-stuck.html [ Pass Timeout ]
 crbug.com/519003 [ Mac ] svg/batik/text/xmlSpace.svg [ Failure Pass ]
@@ -388,7 +369,6 @@
 crbug.com/490511 imported/web-platform-tests/html/semantics/document-metadata/styling/LinkStyle.html [ Failure Pass ]
 crbug.com/525896 imported/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-represent-nothing-01.html [ ImageOnlyFailure ]
 crbug.com/508725 imported/web-platform-tests/html/semantics/forms/textfieldselection/textfieldselection-setRangeText.html [ Failure Timeout ]
-crbug.com/490511 [ Win ] imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity.html [ NeedsRebaseline ]
 crbug.com/490511 imported/web-platform-tests/html/semantics/embedded-content/media-elements/interfaces/HTMLElement/HTMLTrackElement/src.html [ Failure ]
 crbug.com/526920 imported/web-platform-tests/html/semantics/embedded-content/media-elements/location-of-the-media-resource/currentSrc.html [ Failure ]
 crbug.com/525889 imported/web-platform-tests/html/webappapis/scripting/processing-model-2/compile-error-in-setInterval.html [ Failure ]
@@ -967,18 +947,6 @@
 
 crbug.com/506312 imported/csswg-test/css-pseudo-4/first-letter-001.html [ ImageOnlyFailure ]
 
-crbug.com/536234 css3/flexbox/flexbox-baseline-margins.html [ NeedsRebaseline ]
-crbug.com/536234 [ Android Linux Win SnowLeopard Lion MountainLion Retina Mavericks ] fast/forms/basic-textareas-quirks.html [ NeedsRebaseline ]
-crbug.com/536234 [ Android Linux Win SnowLeopard Lion MountainLion Retina Mavericks ] fast/forms/basic-textareas.html [ NeedsRebaseline ]
-crbug.com/536234 [ Android Linux Win SnowLeopard Lion MountainLion Retina Mavericks ] fast/forms/select/menulist-appearance-basic.html [ NeedsRebaseline ]
-crbug.com/536234 fast/forms/textarea-scrolled-focus-ring.html [ NeedsRebaseline ]
-crbug.com/536234 fast/layers/scroll-rect-to-visible.html [ NeedsRebaseline ]
-crbug.com/536234 [ Android Linux Win SnowLeopard Lion MountainLion Retina Mavericks ] fast/overflow/overflow-x-y.html [ NeedsRebaseline ]
-crbug.com/536234 [ Android Linux Win SnowLeopard Lion MountainLion Retina Mavericks ] fast/parser/open-comment-in-textarea.html [ NeedsRebaseline ]
-crbug.com/536234 [ Android Linux Win SnowLeopard Lion MountainLion Retina Mavericks ] fast/replaced/width100percent-textarea.html [ NeedsRebaseline ]
-
-crbug.com/534265 fast/forms/select/listbox-appearance-basic.html [ NeedsRebaseline ]
-
 crbug.com/510002 [ Win ] http/tests/cachestorage/window/cache-match.html [ Pass Failure ]
 crbug.com/510002 [ Win ] http/tests/cachestorage/window/cache-put.html [ Pass Failure Timeout ]
 crbug.com/510002 [ Win ] http/tests/cachestorage/window/cache-storage-match.html [ Pass Failure Timeout ]
@@ -1133,156 +1101,7 @@
 # Unclear semantics of ToString (actually ToPrimitive) across iframes.
 crbug.com/532469 http/tests/security/cross-frame-access-custom.html [ NeedsManualRebaseline ]
 
-crbug.com/474759 svg/text/foreignObject-text-clipping-bug.xml [ NeedsRebaseline ]
-crbug.com/474759 paint/invalidation/invalidate-after-composited-scroll.html [ NeedsRebaseline ]
-crbug.com/474759 paint/selection/selection-within-composited-scroller.html [ NeedsRebaseline ]
-crbug.com/474759 fast/backgrounds/selection-background-color-of-image-list-style.html [ NeedsRebaseline ]
-crbug.com/474759 fast/backgrounds/selection-background-color-of-list-style.html [ NeedsRebaseline ]
 crbug.com/474759 fast/block/line-layout/selection-highlight-overlap.html [ ImageOnlyFailure ]
-crbug.com/474759 fast/forms/form-added-to-table.html [ NeedsRebaseline ]
-crbug.com/474759 fast/lists/markers-in-selection.html [ NeedsRebaseline ]
-crbug.com/474759 fast/overflow/image-selection-highlight.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/delete-into-nested-block.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/japanese-rl-selection-clear.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/japanese-rl-selection-repaint.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/overflow-move-after-scroll.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/overflow-scroll-after-move.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/selection-after-delete.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/selection-after-remove.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/selection-change-in-iframe-with-relative-parent.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/selection-clear.html [ NeedsRebaseline ]
-crbug.com/474759 fast/repaint/selection-partial-invalidation-between-blocks.html [ NeedsRebaseline ]
-crbug.com/474759 fast/ruby/select-ruby.html [ NeedsRebaseline ]
-crbug.com/474759 fast/text/emphasis.html [ NeedsRebaseline ]
-crbug.com/474759 fast/text/selection-hard-linebreak.html [ NeedsRebaseline ]
-crbug.com/474759 fast/text/selection-painted-separately.html [ NeedsRebaseline ]
-crbug.com/474759 fast/text/selection-rect-rounding.html [ NeedsRebaseline ]
-crbug.com/474759 fast/text/shaping/shaping-selection-rect.html [ NeedsRebaseline ]
-crbug.com/474759 fast/text/whitespace/pre-wrap-overflow-selection.html [ NeedsRebaseline ]
-crbug.com/474759 fast/text/whitespace/select-new-line-with-line-break-normal.html [ NeedsRebaseline ]
-crbug.com/474759 fast/writing-mode/horizontal-bt-replaced-selection.html [ NeedsRebaseline ]
-crbug.com/474759 fast/writing-mode/japanese-lr-selection.html [ NeedsRebaseline ]
-crbug.com/474759 fast/writing-mode/japanese-rl-selection.html [ NeedsRebaseline ]
-crbug.com/474759 fast/writing-mode/vertical-lr-replaced-selection.html [ NeedsRebaseline ]
-crbug.com/474759 fast/writing-mode/vertical-rl-replaced-selection.html [ NeedsRebaseline ]
-crbug.com/474759 editing/deleting/delete-to-select-table.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/3690703.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/3690703-2.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/3690719.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/4818145.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/4947387.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/5057506-2.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/5057506.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/5232159.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/7152-1.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/7152-2.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/doubleclick-crash.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/extend-by-character-002.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/extend-by-character-003.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/extend-inside-transforms-backward.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/extend-inside-transforms-forward.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/image-before-linebreak.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/linux_selection_color.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/mixed-editability-6.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/mixed-editability-7.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/node-removal-2.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/paragraph-granularity.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/range-between-block-and-inline.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/replaced-boundaries-3.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/select-all-001.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/select-all-002.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/select-all-003.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/select-all-004.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/select-all-005.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/select-all-006.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/select-missing-image.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/selection-actions.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/selection-button-text.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-lr-ltr-extend-line-backward-br.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-lr-ltr-extend-line-forward-br.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-ltr-extend-line-backward-br.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-ltr-extend-line-backward-p.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-ltr-extend-line-backward-wrap.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-ltr-extend-line-forward-br.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-ltr-extend-line-forward-p.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-ltr-extend-line-forward-wrap.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-rtl-extend-line-backward-br.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-rtl-extend-line-backward-p.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-rtl-extend-line-forward-br.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/vertical-rl-rtl-extend-line-forward-p.html [ NeedsRebaseline ]
-crbug.com/474759 editing/selection/word-granularity.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/5017613-1.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/5017613-2.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/5046875-1.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/5228141.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/5279521.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/apple-style-editable-mix.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/block-style-003.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/create-block-for-style-005.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/create-block-for-style-006.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/create-block-for-style-010.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/create-block-for-style-011.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/create-block-for-style-012.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/relative-font-size-change-001.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/relative-font-size-change-002.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/style-3998892-fix.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/style-boundary-004.html [ NeedsRebaseline ]
-crbug.com/474759 editing/style/table-selection.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/4916541.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/5136770.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/5142012-1.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/5142012-2.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/5190926.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/5481523.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/indent-selection.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/remove-list-from-range-selection.html [ NeedsRebaseline ]
-crbug.com/474759 editing/execCommand/selectAll.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/layer-creation/fixed-position-in-fixed-overflow.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/clear-scroll-parent.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/composited-scrolling-paint-phases.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/content-gains-scrollbars.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/overflow-scrollbar-layers.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/reparented-scrollbars-non-sc-anc.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/scroll-parent-absolute.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/scrolling-content-clip-to-viewport.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/scrolling-without-painting.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/selection-gaps-after-removing-scrolling-contents.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/selection-gaps-toggling-with-scrolling-contents.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/selection-gaps-toggling.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/textarea-scroll-touch.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/universal-accelerated-overflow-scroll.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/overflow/updating-scrolling-content.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/repaint/should-not-clip-composited-overflow-scrolling-layer.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/scrollbars/nested-overlay-scrollbars.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/squashing/composited-bounds-for-negative-z.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/squashing/selection-repaint-with-gaps.html [ NeedsRebaseline ]
-crbug.com/474759 compositing/update-paint-phases.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch.html [ NeedsRebaseline ]
-crbug.com/474759 virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle.html [ NeedsRebaseline ]
 
 # Win10 specific failures that still need triaging.
 crbug.com/521730 [ Win10 ] fast/dom/Window/property-access-on-cached-properties-after-frame-navigated.html [ Failure ]
@@ -1658,26 +1477,6 @@
 crbug.com/521764 [ Win10 ] virtual/display_list_2d_canvas/fast/canvas/canvas-resize-reset.html [ Pass Timeout ]
 crbug.com/521764 [ Win10 ] transitions/equivalent-background-image-no-transition.html [ Pass Timeout ]
 
-crbug.com/535051 [ Linux Win ] compositing/force-compositing-mode/overflow-iframe-enter-compositing.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/force-compositing-mode/overflow-iframe-layer.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/become-overlapped-iframe.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/composited-parent-iframe.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/connect-compositing-iframe-delayed.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/connect-compositing-iframe.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/connect-compositing-iframe2.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/connect-compositing-iframe3.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/enter-compositing-iframe.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/iframe-resize.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/iframe-size-from-zero.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/invisible-nested-iframe-show.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/overlapped-iframe.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/resizer.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/iframes/scrolling-iframe.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/rtl/rtl-iframe-absolute-overflow-scrolled.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/rtl/rtl-iframe-absolute-overflow.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/rtl/rtl-iframe-fixed-overflow-scrolled.html [ NeedsRebaseline ]
-crbug.com/535051 [ Linux Win ] compositing/rtl/rtl-iframe-fixed-overflow.html [ NeedsRebaseline ]
-
 # GrGLConvolutionEffect optimization causes blink layout test image differences
 crbug.com/505086 css3/filters/effect-blur-hw.html [ NeedsManualRebaseline ]
 crbug.com/505086 css3/filters/effect-brightness-clamping-hw.html [ NeedsManualRebaseline ]
@@ -1746,8 +1545,6 @@
 
 crbug.com/526752 [ Win10 ] fast/css/fontfaceset-check-platform-fonts.html [ Failure Pass ]
 
-crbug.com/534429 paint/selection/text-selection-drag.html [ NeedsRebaseline ]
-
 # This test has different results in Debug and Release.
 crbug.com/529038 [ Debug ] virtual/gpu/fast/canvas/canvas-composite-repaint-by-all-imagesource.html [ Failure ]
 
@@ -1780,318 +1577,7 @@
 
 crbug.com/538522 css3/filters/effect-reference-colorspace-hw.html [ ImageOnlyFailure ]
 
-crbug.com/524646 [ Yosemite ] css3/selectors3/html/css3-modsel-161.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/html/css3-modsel-19b.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/html/css3-modsel-23.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/html/css3-modsel-24.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/html/css3-modsel-64.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/html/css3-modsel-68.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/html/css3-modsel-69.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xhtml/css3-modsel-161.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xhtml/css3-modsel-19b.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xhtml/css3-modsel-23.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xhtml/css3-modsel-24.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xhtml/css3-modsel-64.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xhtml/css3-modsel-68.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xhtml/css3-modsel-69.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xml/css3-modsel-161.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xml/css3-modsel-19b.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xml/css3-modsel-23.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xml/css3-modsel-24.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xml/css3-modsel-64.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xml/css3-modsel-68.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] css3/selectors3/xml/css3-modsel-69.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/input/caret-at-the-edge-of-input.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/input/reveal-caret-of-multiline-input.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/pasteboard/4641033.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/pasteboard/drop-text-without-selection.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/pasteboard/pasting-tabs.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/4397952.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/4975120.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/5240265.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/caret-before-select.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/select-across-readonly-input-1.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/select-across-readonly-input-2.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/select-across-readonly-input-3.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/select-across-readonly-input-4.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/selection/select-across-readonly-input-5.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] editing/spelling/input-type-text.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/block/float/float-avoidance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/block/margin-collapse/103.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/block/positioning/inline-block-relposition.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/css/continuationCrash.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/css/input-search-padding.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/css/line-height.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/css/margin-top-bottom-dynamic.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/css/text-overflow-input.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/dom/HTMLInputElement/input-image-alt-text.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/dom/HTMLTableColElement/resize-table-using-col-width.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/dom/HTMLTextAreaElement/reset-textarea.html [ NeedsRebaseline ]
 crbug.com/524646 [ Yosemite ] fast/dom/shadow/shadowdom-for-button.html [ ImageOnlyFailure ]
-crbug.com/524646 [ Yosemite ] fast/dynamic/008.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/events/autoscroll.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/events/context-no-deselect.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/files/file-in-input-display.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/001.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/002.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/003.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/004.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/005.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/HTMLOptionElement_label01.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/HTMLOptionElement_label02.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/HTMLOptionElement_label03.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/HTMLOptionElement_label04.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/HTMLOptionElement_label05.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/basic-buttons.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/basic-inputs.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/basic-selects.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/basic-textareas-quirks.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/basic-textareas.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/blankbuttons.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-align.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-cannot-be-nested.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-default-title.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-positioned.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-sizes.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-style-color.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-table-styles.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-text-transform.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button-white-space.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/button/button-reset-focus-by-mouse-then-keydown.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/calendar-picker-appearance-minimum-date.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/calendar-picker-appearance-required.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/calendar-picker-appearance-ru.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/calendar-picker-appearance-step.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/calendar-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/month-picker-appearance-step.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/month-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/week-picker-appearance-step.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/calendar-picker/week-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/color/color-suggestion-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/color/color-suggestion-picker-one-row-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/color/color-suggestion-picker-two-row-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/color/color-suggestion-picker-with-scrollbar-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/control-clip-overflow.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/control-clip.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/control-restrict-line-height.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/disabled-select-change-index.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/file/file-input-direction.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/file/file-input-disabled.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/file/file-input-pressed-state.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/file/input-file-re-render.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/floating-textfield-relayout.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/form-element-geometry.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/formmove3.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-align.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-bkcolor.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-default-bkcolor.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-disabled.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-focus.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-height.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-preventDefault.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-readonly.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-selection.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-visibility.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-appearance-width.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-button-sizes.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-disabled-color.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-double-click-selection-gap-bug.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-field-text-truncated.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-first-letter.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-placeholder-paint-order.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-placeholder-visibility-1.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-placeholder-visibility-3.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-readonly-autoscroll.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-readonly-dimmed.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-spaces.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-table.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-text-double-click.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-text-drag-down.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-text-option-delete.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-text-scroll-left-on-blur.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-text-word-wrap.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-type-text-min-width.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/input-value.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/listbox-bidi-align.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/listbox-hit-test-zoomed.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/listbox-scrollbar-incremental-load.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/listbox-width-change.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/menulist-deselect-update.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/menulist-narrow-width.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/menulist-no-overflow.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/menulist-option-wrap.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/menulist-restrict-line-height.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/menulist-style-color.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/menulist-width-change.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/minWidthPercent.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/number/number-appearance-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/number/number-appearance-spinbutton-disabled-readonly.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/number/number-appearance-spinbutton-layer.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/onselect-textarea.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/option-script.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/option-strip-whitespace.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/option-text-clip.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/placeholder-appearance-textarea.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/placeholder-position.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/placeholder-pseudo-style.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/plaintext-mode-2.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/search-cancel-button-style-sharing.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/search-display-none-cancel-button.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/search-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/search-vertical-alignment.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/search/search-appearance-basic.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/searchfield-heights.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-align.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-baseline.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-block-background.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-change-listbox-size.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-change-listbox-to-popup.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-change-popup-to-listbox.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-dirty-parent-pref-widths.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-disabled-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-empty-option-height.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-initial-position.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-item-background-clip.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-list-box-with-height.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-listbox-multiple-no-focusring.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-multiple-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-overflow-scroll-inherited.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-overflow-scroll.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-selected.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-size.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-style.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select-writing-direction-natural.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/listbox-appearance-separator.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/listbox-with-display-none-option.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/menulist-appearance-basic.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/optgroup-rendering.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/popup-menu-appearance-many.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/popup-menu-appearance-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/popup-menu-appearance-single-option.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/popup-menu-appearance-styled.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/popup-menu-appearance-texttransform.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/popup-menu-appearance-transform.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/popup-menu-appearance-zoom.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/select/popup-menu-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/stuff-on-my-optgroup.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/submit/submit-appearance-basic.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/submit/submit-focus-by-mouse-then-keydown.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/date-suggestion-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/month-suggestion-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/time-suggestion-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/suggestion-picker/week-suggestion-picker-appearance.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/tabbing-input-iframe.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/targeted-frame-submission.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/text-style-color.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/text/text-appearance-basic.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textAreaLineHeight.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea-align.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea-placeholder-pseudo-style.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea-placeholder-visibility-1.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea-placeholder-visibility-2.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea-scroll-height.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea-scrolled-type.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea-setinnerhtml.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea/textarea-appearance-basic.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textarea/textarea-placeholder-paint-order.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textfield-outline.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/forms/textfield-overflow-by-value-update.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/html/details-replace-summary-child.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/html/details-replace-text.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/html/keygen.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/images/12-55.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/images/182.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/images/2-dht.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/images/23-55.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/images/55.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/lists/dynamic-marker-crash.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/multicol/multicol-with-child-renderLayer-for-input.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/overflow/overflow-x-y.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/overflow/scroll-nested-positioned-layer-in-overflow.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/parser/document-write-option.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/parser/entity-comment-in-textarea.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/parser/open-comment-in-textarea.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/repaint/caret-invalidation-in-overflow-scroll.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/repaint/change-text-content-and-background-color.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/repaint/control-clip.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/repaint/multi-layout-one-frame.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/repaint/search-field-cancel.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/repaint/subtree-root-skipped.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/replaced/replaced-breaking-mixture.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/replaced/replaced-breaking.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/replaced/width100percent-button.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/replaced/width100percent-menulist.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/replaced/width100percent-searchfield.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/replaced/width100percent-textarea.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/replaced/width100percent-textfield.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/selectors/064.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/spatial-navigation/snav-multiple-select-focusring.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/table/append-cells2.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/table/remove-td-display-none.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/table/spanOverlapRepaint.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/table/text-field-baseline.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/text/international/bidi-listbox.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/text/international/bidi-menulist.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/text/international/pop-up-button-text-alignment-and-direction.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/text/international/unicode-bidi-plaintext-in-textarea.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] fast/text/textIteratorNilRenderer.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] http/tests/filesystem/input-display.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] http/tests/webfont/popup-menu-load-webfont-after-open.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] plugins/mouse-click-plugin-clears-selection.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] svg/custom/inline-svg-in-xhtml.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] svg/hixie/mixed/003.xml [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug1188.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug1318.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug138725.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug18359.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug194024.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug2479-2.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug2479-3.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug2479-4.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug26178.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug28928.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug29326.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug30559.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug30692.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug33855.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug39209.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug4382.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug4429.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug44505.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug46368-1.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug46368-2.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug51037.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug51727.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug52505.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug52506.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug59354.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug60749.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug68912.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug7342.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/bugs/bug96334.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/collapsing_borders/bug41262-4.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/core/margins.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/dom/tableDom.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla/other/move_row.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla_expected_failures/bugs/bug1725.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla_expected_failures/bugs/bug2479-5.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla_expected_failures/bugs/bug58402-2.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla_expected_failures/collapsing_borders/bug41262-5.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] tables/mozilla_expected_failures/collapsing_borders/bug41262-6.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] transforms/2d/zoom-menulist.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] virtual/pointerevent/fast/events/autoscroll.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents.html [ NeedsRebaseline ]
-crbug.com/524646 [ Yosemite ] virtual/trustedeventsdefaultaction/fast/events/autoscroll.html [ NeedsRebaseline ]
+
+crbug.com/538717 [ Win ] http/tests/permissions/chromium/test-request-multiple-window.html [ Failure Pass ]
+crbug.com/538717 [ Win ] http/tests/permissions/chromium/test-request-multiple-worker.html [ Failure Pass ]
diff --git a/third_party/WebKit/LayoutTests/animations/inline-element-animation-end-hit-test-expected.txt b/third_party/WebKit/LayoutTests/animations/inline-element-animation-end-hit-test-expected.txt
index 055715f..7dea6df 100644
--- a/third_party/WebKit/LayoutTests/animations/inline-element-animation-end-hit-test-expected.txt
+++ b/third_party/WebKit/LayoutTests/animations/inline-element-animation-end-hit-test-expected.txt
@@ -1,4 +1,4 @@
-Tests that when a LayoutObject loses its DeprecatedPaintLayer due to completion of an animation of an inline statically positioned element, we correctly update the locations of descendent layers.
+Tests that when a LayoutObject loses its PaintLayer due to completion of an animation of an inline statically positioned element, we correctly update the locations of descendent layers.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
diff --git a/third_party/WebKit/LayoutTests/animations/inline-element-animation-end-hit-test.html b/third_party/WebKit/LayoutTests/animations/inline-element-animation-end-hit-test.html
index b571b92..52465118 100644
--- a/third_party/WebKit/LayoutTests/animations/inline-element-animation-end-hit-test.html
+++ b/third_party/WebKit/LayoutTests/animations/inline-element-animation-end-hit-test.html
@@ -28,7 +28,7 @@
 
 jsTestIsAsync = true;
 
-description("Tests that when a LayoutObject loses its DeprecatedPaintLayer " +
+description("Tests that when a LayoutObject loses its PaintLayer " +
     "due to completion of an animation of an inline statically positioned " +
     "element, we correctly update the locations of descendent layers.");
 
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/force-compositing-mode/overflow-iframe-enter-compositing-expected.txt b/third_party/WebKit/LayoutTests/compositing/force-compositing-mode/overflow-iframe-enter-compositing-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/force-compositing-mode/overflow-iframe-enter-compositing-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/force-compositing-mode/overflow-iframe-enter-compositing-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/force-compositing-mode/overflow-iframe-layer-expected.txt b/third_party/WebKit/LayoutTests/compositing/force-compositing-mode/overflow-iframe-layer-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/force-compositing-mode/overflow-iframe-layer-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/force-compositing-mode/overflow-iframe-layer-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/become-overlapped-iframe-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/become-overlapped-iframe-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/become-overlapped-iframe-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/become-overlapped-iframe-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/composited-parent-iframe-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/composited-parent-iframe-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/composited-parent-iframe-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/composited-parent-iframe-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/connect-compositing-iframe-delayed-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/connect-compositing-iframe-delayed-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/connect-compositing-iframe-delayed-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/connect-compositing-iframe-delayed-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/connect-compositing-iframe-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/connect-compositing-iframe-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/connect-compositing-iframe-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/connect-compositing-iframe-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/connect-compositing-iframe2-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/connect-compositing-iframe2-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/connect-compositing-iframe2-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/connect-compositing-iframe2-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/connect-compositing-iframe3-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/connect-compositing-iframe3-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/connect-compositing-iframe3-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/connect-compositing-iframe3-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/enter-compositing-iframe-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/enter-compositing-iframe-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/enter-compositing-iframe-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/enter-compositing-iframe-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/iframe-resize-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/iframe-resize-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/iframe-resize-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/iframe-resize-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/iframe-size-from-zero-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/iframe-size-from-zero-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/iframe-size-from-zero-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/iframe-size-from-zero-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/invisible-nested-iframe-show-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/invisible-nested-iframe-show-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/invisible-nested-iframe-show-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/invisible-nested-iframe-show-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/overlapped-iframe-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/overlapped-iframe-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/overlapped-iframe-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/overlapped-iframe-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/resizer-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/resizer-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/resizer-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/resizer-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/scrolling-iframe-expected.txt b/third_party/WebKit/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/iframes/scrolling-iframe-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/iframes/scrolling-iframe-expected.txt
diff --git a/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt b/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
new file mode 100644
index 0000000..425e6792
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
@@ -0,0 +1,47 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 13],
+          "bounds": [800, 600],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [785, 600],
+              "children": [
+                {
+                  "bounds": [785, 1000],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true,
+                  "children": [
+                    {
+                      "position": [192, 0],
+                      "bounds": [100, 100],
+                      "contentsOpaque": true,
+                      "drawsContent": true,
+                      "backgroundColor": "#FFFF00"
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [785, 0],
+                  "bounds": [15, 600]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt b/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
new file mode 100644
index 0000000..0c6b662
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
@@ -0,0 +1,57 @@
+Even though the fixed-position element's container is nonscrollable, it should still be composited because one of its ancestors is scrolling.
+
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 68],
+          "bounds": [302, 302],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [1, 1],
+              "bounds": [285, 285],
+              "children": [
+                {
+                  "bounds": [285, 800],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [1, 286],
+                  "bounds": [285, 15]
+                },
+                {
+                  "position": [286, 1],
+                  "bounds": [15, 285]
+                },
+                {
+                  "position": [286, 286],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [10, 100],
+          "bounds": [100, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#00FF00"
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
new file mode 100644
index 0000000..068faec
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
@@ -0,0 +1,87 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [200, 200],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [200, 200],
+              "shouldFlattenTransform": false,
+              "transform": [
+                [1, 0, 0, 0],
+                [0, 1, 0, 0],
+                [0, 0, 1, -0.01],
+                [0, 0, 0, 1]
+              ],
+              "children": [
+                {
+                  "bounds": [185, 185],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [185, 265],
+                      "shouldFlattenTransform": false,
+                      "children": [
+                        {
+                          "position": [0, 65],
+                          "bounds": [60, 200],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#008000",
+                          "transform": [
+                            [1, 0, 0, 0],
+                            [0, 1, 0, 0],
+                            [0, 0, 1, 0],
+                            [0, 0, 10, 1]
+                          ]
+                        },
+                        {
+                          "position": [65, 65],
+                          "bounds": [60, 200],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#0000FF",
+                          "transform": [
+                            [1, 0, 0, 0],
+                            [0, 1, 0, 0],
+                            [0, 0, 1, 0],
+                            [0, 0, 20, 1]
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 185],
+                  "bounds": [185, 15]
+                },
+                {
+                  "position": [185, 0],
+                  "bounds": [15, 185]
+                },
+                {
+                  "position": [185, 185],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/clear-scroll-parent-expected.txt
new file mode 100644
index 0000000..5a12c16
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/clear-scroll-parent-expected.txt
@@ -0,0 +1,84 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [308, 208],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [4, 4],
+              "bounds": [285, 200],
+              "children": [
+                {
+                  "bounds": [285, 530],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [289, 4],
+                  "bounds": [15, 185]
+                },
+                {
+                  "position": [289, 189],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [50, 200],
+          "bounds": [200, 200],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [12, 12],
+          "bounds": [80, 80],
+          "shouldFlattenTransform": false,
+          "hasScrollParent": true,
+          "children": [
+            {
+              "position": [10, 10],
+              "bounds": [100, 100],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#FF0000"
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "hasScrollParent": true,
+          "children": [
+            {
+              "position": [22, 102],
+              "bounds": [100, 100],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [22, 212],
+              "bounds": [100, 320],
+              "drawsContent": true
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/composited-scrolling-paint-phases-expected.txt
new file mode 100644
index 0000000..deaa07a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/composited-scrolling-paint-phases-expected.txt
@@ -0,0 +1,122 @@
+{
+  "bounds": [800, 600],
+  "paintingPhases": [
+    "GraphicsLayerPaintBackground",
+    "GraphicsLayerPaintForeground",
+    "GraphicsLayerPaintMask"
+  ],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "paintingPhases": [
+        "GraphicsLayerPaintBackground",
+        "GraphicsLayerPaintForeground",
+        "GraphicsLayerPaintMask"
+      ],
+      "children": [
+        {
+          "bounds": [800, 242],
+          "drawsContent": true,
+          "paintingPhases": [
+            "GraphicsLayerPaintBackground",
+            "GraphicsLayerPaintMask"
+          ],
+          "children": [
+            {
+              "position": [29, 31],
+              "bounds": [80, 10],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#008000",
+              "paintingPhases": [
+                "GraphicsLayerPaintBackground",
+                "GraphicsLayerPaintForeground",
+                "GraphicsLayerPaintMask"
+              ]
+            },
+            {
+              "bounds": [800, 242],
+              "drawsContent": true,
+              "paintingPhases": [
+                "GraphicsLayerPaintForeground"
+              ]
+            },
+            {
+              "position": [28, 20],
+              "bounds": [202, 202],
+              "drawsContent": true,
+              "paintingPhases": [
+                "GraphicsLayerPaintBackground",
+                "GraphicsLayerPaintMask",
+                "GraphicsLayerPaintCompositedScroll"
+              ],
+              "children": [
+                {
+                  "position": [1, 1],
+                  "bounds": [185, 185],
+                  "paintingPhases": [
+                    "GraphicsLayerPaintBackground",
+                    "GraphicsLayerPaintForeground",
+                    "GraphicsLayerPaintMask"
+                  ],
+                  "children": [
+                    {
+                      "bounds": [185, 715],
+                      "shouldFlattenTransform": false,
+                      "drawsContent": true,
+                      "paintingPhases": [
+                        "GraphicsLayerPaintForeground",
+                        "GraphicsLayerPaintOverflowContents",
+                        "GraphicsLayerPaintCompositedScroll"
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "paintingPhases": [
+                    "GraphicsLayerPaintBackground",
+                    "GraphicsLayerPaintForeground",
+                    "GraphicsLayerPaintMask"
+                  ],
+                  "children": [
+                    {
+                      "position": [1, 186],
+                      "bounds": [185, 15],
+                      "paintingPhases": [
+                        "GraphicsLayerPaintBackground",
+                        "GraphicsLayerPaintForeground",
+                        "GraphicsLayerPaintMask"
+                      ]
+                    },
+                    {
+                      "position": [186, 1],
+                      "bounds": [15, 185],
+                      "paintingPhases": [
+                        "GraphicsLayerPaintBackground",
+                        "GraphicsLayerPaintForeground",
+                        "GraphicsLayerPaintMask"
+                      ]
+                    },
+                    {
+                      "position": [186, 186],
+                      "bounds": [15, 15],
+                      "drawsContent": true,
+                      "paintingPhases": [
+                        "GraphicsLayerPaintBackground",
+                        "GraphicsLayerPaintForeground",
+                        "GraphicsLayerPaintMask"
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/content-gains-scrollbars-expected.txt
new file mode 100644
index 0000000..183c7e49
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/content-gains-scrollbars-expected.txt
@@ -0,0 +1,133 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [85, 100],
+              "children": [
+                {
+                  "bounds": [85, 200],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [10, 200]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [85, 0],
+                  "bounds": [15, 100]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [100, 85],
+              "children": [
+                {
+                  "bounds": [200, 85],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [200, 10]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 85],
+                  "bounds": [100, 15]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [200, 200],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [200, 200]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 85],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [85, 0],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [100, 100],
+              "children": [
+                {
+                  "bounds": [10, 10]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scrollbar-layers-expected.txt
new file mode 100644
index 0000000..183c7e49
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/overflow-scrollbar-layers-expected.txt
@@ -0,0 +1,133 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [85, 100],
+              "children": [
+                {
+                  "bounds": [85, 200],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [10, 200]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [85, 0],
+                  "bounds": [15, 100]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [100, 85],
+              "children": [
+                {
+                  "bounds": [200, 85],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [200, 10]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 85],
+                  "bounds": [100, 15]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [200, 200],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [200, 200]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 85],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [85, 0],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [100, 100],
+              "children": [
+                {
+                  "bounds": [10, 10]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
new file mode 100644
index 0000000..df0bc6e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
@@ -0,0 +1,71 @@
+{
+  "bounds": [1208, 821],
+  "children": [
+    {
+      "bounds": [1208, 821],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [1200, 800],
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "bounds": [1200, 800],
+              "drawsContent": true,
+              "children": [
+                {
+                  "bounds": [1200, 800],
+                  "children": [
+                    {
+                      "bounds": [1200, 1000],
+                      "shouldFlattenTransform": false,
+                      "children": [
+                        {
+                          "bounds": [1200, 1000],
+                          "drawsContent": true,
+                          "children": [
+                            {
+                              "bounds": [1200, 1000],
+                              "children": [
+                                {
+                                  "bounds": [1200, 10000],
+                                  "shouldFlattenTransform": false,
+                                  "drawsContent": true
+                                }
+                              ]
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 10008],
+          "bounds": [1200, 0]
+        },
+        {
+          "position": [8, 8],
+          "bounds": [1200, 1000],
+          "children": [
+            {
+              "children": [
+                {
+                  "position": [1193, 0],
+                  "bounds": [7, 1000]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-absolute-expected.txt
new file mode 100644
index 0000000..1159b1a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-absolute-expected.txt
@@ -0,0 +1,75 @@
+{
+  "bounds": [785, 5516],
+  "children": [
+    {
+      "bounds": [785, 5516],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [8, 8],
+              "bounds": [500, 500],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF",
+              "children": [
+                {
+                  "bounds": [485, 485],
+                  "children": [
+                    {
+                      "bounds": [485, 5000],
+                      "shouldFlattenTransform": false,
+                      "drawsContent": true
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [0, 485],
+                      "bounds": [485, 15]
+                    },
+                    {
+                      "position": [485, 0],
+                      "bounds": [15, 485]
+                    },
+                    {
+                      "position": [485, 485],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [8, 8],
+              "bounds": [400, 400],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [8, 8],
+          "bounds": [300, 300],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backfaceVisibility": "hidden",
+          "backgroundColor": "#FFFF00"
+        },
+        {
+          "position": [8, 8],
+          "bounds": [20, 5000],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#FA8072",
+          "hasScrollParent": true
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
new file mode 100644
index 0000000..fe87f95
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
@@ -0,0 +1,72 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [98, 90],
+          "bounds": [300, 300],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backfaceVisibility": "hidden",
+          "backgroundColor": "#FFEFD5",
+          "children": [
+            {
+              "bounds": [102, 102],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [1, 1],
+                  "bounds": [100, 100],
+                  "children": [
+                    {
+                      "bounds": [100, 180],
+                      "shouldFlattenTransform": false
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [60, 60],
+          "bounds": [80, 80],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [103, 95],
+              "bounds": [60, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [103, 139],
+              "bounds": [60, 128],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [98, 90],
+          "children": [
+            {
+              "position": [94, 1],
+              "bounds": [7, 100]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
new file mode 100644
index 0000000..d7459347
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
@@ -0,0 +1,52 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "bounds": [320, 340],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [305, 325],
+              "children": [
+                {
+                  "bounds": [305, 1224],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 325],
+                  "bounds": [305, 15]
+                },
+                {
+                  "position": [305, 0],
+                  "bounds": [15, 325]
+                },
+                {
+                  "position": [305, 325],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [10, 10],
+          "bounds": [284, 1204],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#C0C0C0"
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
new file mode 100644
index 0000000..1137062
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
@@ -0,0 +1,945 @@
+{
+  "bounds": [785, 2016],
+  "children": [
+    {
+      "bounds": [785, 2016],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [10, 10],
+              "bounds": [104, 104],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [2, 2],
+                  "bounds": [85, 85],
+                  "children": [
+                    {
+                      "bounds": [85, 144],
+                      "shouldFlattenTransform": false,
+                      "drawsContent": true
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [2, 87],
+                      "bounds": [85, 15]
+                    },
+                    {
+                      "position": [87, 2],
+                      "bounds": [15, 85]
+                    },
+                    {
+                      "position": [87, 87],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [35, 75],
+              "bounds": [80, 40],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, -15],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 41],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [130, 10],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [105, 144],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [157, 18],
+              "bounds": [80, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#800080"
+            },
+            {
+              "position": [136, -15],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [250, 10],
+              "bounds": [104, 104],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [2, 2],
+                  "bounds": [85, 85],
+                  "children": [
+                    {
+                      "bounds": [85, 144],
+                      "shouldFlattenTransform": false
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [2, 87],
+                      "bounds": [85, 15]
+                    },
+                    {
+                      "position": [87, 2],
+                      "bounds": [15, 85]
+                    },
+                    {
+                      "position": [87, 87],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [275, 75],
+              "bounds": [80, 40],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, -15],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 41],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [370, 10],
+              "bounds": [104, 104],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [2, 2],
+                  "bounds": [85, 85],
+                  "children": [
+                    {
+                      "bounds": [85, 144],
+                      "shouldFlattenTransform": false,
+                      "drawsContent": true
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [2, 87],
+                      "bounds": [85, 15]
+                    },
+                    {
+                      "position": [87, 2],
+                      "bounds": [15, 85]
+                    },
+                    {
+                      "position": [87, 87],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [395, 75],
+              "bounds": [80, 40],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, -15],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 41],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [10, 130],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [105, 144],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [37, 138],
+              "bounds": [80, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#800080"
+            },
+            {
+              "position": [16, 105],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [130, 130],
+              "bounds": [104, 104],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [2, 2],
+                  "bounds": [85, 85],
+                  "children": [
+                    {
+                      "bounds": [85, 144],
+                      "shouldFlattenTransform": false
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [2, 87],
+                      "bounds": [85, 15]
+                    },
+                    {
+                      "position": [87, 2],
+                      "bounds": [15, 85]
+                    },
+                    {
+                      "position": [87, 87],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [155, 195],
+              "bounds": [80, 40],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, 105],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 161],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [250, 130],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [105, 144],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [277, 138],
+              "bounds": [80, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#800080"
+            },
+            {
+              "position": [256, 105],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [370, 130],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [105, 144],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [397, 138],
+              "bounds": [80, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#800080"
+            },
+            {
+              "position": [376, 105],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [10, 250],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [85, 144],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [35, 315],
+          "bounds": [80, 40],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#800080"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, 225],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 281],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [130, 250],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [85, 144],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [155, 315],
+          "bounds": [80, 40],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#800080"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, 225],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 281],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [250, 250],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [85, 144],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [275, 315],
+          "bounds": [80, 40],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#800080"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, 225],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 281],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [370, 250],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [85, 144],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [395, 315],
+          "bounds": [80, 40],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#800080"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, 225],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 281],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [375, 20],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [15, 140],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [135, 140],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [255, 140],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [15, 260],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [135, 260],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, -43],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 13],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, -43],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 13],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, -43],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 13],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, -43],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 13],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, 77],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 133],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, 77],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 133],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, 77],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 133],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, 77],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 133],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, 197],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 253],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, 197],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 253],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, 197],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 253],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, 197],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 253],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/rtl/rtl-iframe-absolute-overflow-expected.txt b/third_party/WebKit/LayoutTests/compositing/rtl/rtl-iframe-absolute-overflow-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/rtl/rtl-iframe-absolute-overflow-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/rtl/rtl-iframe-absolute-overflow-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.txt b/third_party/WebKit/LayoutTests/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/rtl/rtl-iframe-fixed-overflow-expected.txt b/third_party/WebKit/LayoutTests/compositing/rtl/rtl-iframe-fixed-overflow-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/rtl/rtl-iframe-fixed-overflow-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/rtl/rtl-iframe-fixed-overflow-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.txt b/third_party/WebKit/LayoutTests/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/mac/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.txt
rename to third_party/WebKit/LayoutTests/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.txt
diff --git a/third_party/WebKit/LayoutTests/compositing/scrollbars/nested-overlay-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
new file mode 100644
index 0000000..dcb7f4d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
@@ -0,0 +1,94 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [404, 404],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [400, 400],
+              "children": [
+                {
+                  "bounds": [400, 704],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true,
+                  "children": [
+                    {
+                      "position": [0, 500],
+                      "bounds": [204, 204],
+                      "drawsContent": true,
+                      "children": [
+                        {
+                          "position": [2, 2],
+                          "bounds": [200, 200],
+                          "children": [
+                            {
+                              "bounds": [5000, 9000],
+                              "shouldFlattenTransform": false,
+                              "drawsContent": true
+                            }
+                          ]
+                        }
+                      ]
+                    },
+                    {
+                      "shouldFlattenTransform": false,
+                      "children": [
+                        {
+                          "position": [2, 502],
+                          "bounds": [100, 800],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#808080"
+                        },
+                        {
+                          "position": [2, 2502],
+                          "bounds": [5000, 1000],
+                          "drawsContent": true
+                        }
+                      ]
+                    },
+                    {
+                      "position": [2, 502],
+                      "children": [
+                        {
+                          "position": [2, 195],
+                          "bounds": [193, 7]
+                        },
+                        {
+                          "position": [195, 2],
+                          "bounds": [7, 193]
+                        },
+                        {
+                          "position": [195, 195],
+                          "bounds": [7, 7],
+                          "drawsContent": true
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [395, 2],
+                  "bounds": [7, 400]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/squashing/composited-bounds-for-negative-z-expected.txt b/third_party/WebKit/LayoutTests/compositing/squashing/composited-bounds-for-negative-z-expected.txt
new file mode 100644
index 0000000..ab80f81
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/squashing/composited-bounds-for-negative-z-expected.txt
@@ -0,0 +1,67 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "children": [
+        {
+          "bounds": [800, 408],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [8, 100],
+              "bounds": [10, 10],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#FF0000"
+            },
+            {
+              "bounds": [800, 408],
+              "drawsContent": true
+            },
+            {
+              "position": [108, 100],
+              "bounds": [300, 300],
+              "drawsContent": true,
+              "children": [
+                {
+                  "bounds": [285, 300],
+                  "children": [
+                    {
+                      "bounds": [285, 1000],
+                      "shouldFlattenTransform": false
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [285, 0],
+                      "bounds": [15, 300]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "shouldFlattenTransform": false,
+              "children": [
+                {
+                  "position": [108, 100],
+                  "bounds": [285, 1000]
+                },
+                {
+                  "position": [108, 100],
+                  "bounds": [285, 1000],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/compositing/update-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/compositing/update-paint-phases-expected.txt
new file mode 100644
index 0000000..2d56195
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/update-paint-phases-expected.txt
@@ -0,0 +1,93 @@
+{
+  "bounds": [800, 600],
+  "paintingPhases": [
+    "GraphicsLayerPaintBackground",
+    "GraphicsLayerPaintForeground",
+    "GraphicsLayerPaintMask"
+  ],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "paintingPhases": [
+        "GraphicsLayerPaintBackground",
+        "GraphicsLayerPaintForeground",
+        "GraphicsLayerPaintMask"
+      ],
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [102, 102],
+          "drawsContent": true,
+          "paintingPhases": [
+            "GraphicsLayerPaintBackground",
+            "GraphicsLayerPaintMask",
+            "GraphicsLayerPaintCompositedScroll"
+          ],
+          "children": [
+            {
+              "position": [1, 1],
+              "bounds": [85, 85],
+              "paintingPhases": [
+                "GraphicsLayerPaintBackground",
+                "GraphicsLayerPaintForeground",
+                "GraphicsLayerPaintMask"
+              ],
+              "children": [
+                {
+                  "bounds": [85, 120],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true,
+                  "paintingPhases": [
+                    "GraphicsLayerPaintForeground",
+                    "GraphicsLayerPaintOverflowContents",
+                    "GraphicsLayerPaintCompositedScroll"
+                  ]
+                }
+              ]
+            },
+            {
+              "paintingPhases": [
+                "GraphicsLayerPaintBackground",
+                "GraphicsLayerPaintForeground",
+                "GraphicsLayerPaintMask"
+              ],
+              "children": [
+                {
+                  "position": [1, 86],
+                  "bounds": [85, 15],
+                  "paintingPhases": [
+                    "GraphicsLayerPaintBackground",
+                    "GraphicsLayerPaintForeground",
+                    "GraphicsLayerPaintMask"
+                  ]
+                },
+                {
+                  "position": [86, 1],
+                  "bounds": [15, 85],
+                  "paintingPhases": [
+                    "GraphicsLayerPaintBackground",
+                    "GraphicsLayerPaintForeground",
+                    "GraphicsLayerPaintMask"
+                  ]
+                },
+                {
+                  "position": [86, 86],
+                  "bounds": [15, 15],
+                  "drawsContent": true,
+                  "paintingPhases": [
+                    "GraphicsLayerPaintBackground",
+                    "GraphicsLayerPaintForeground",
+                    "GraphicsLayerPaintMask"
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-content-alignment-and-self-alignment-expected.txt b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-content-alignment-and-self-alignment-expected.txt
new file mode 100644
index 0000000..e7c4fbd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-content-alignment-and-self-alignment-expected.txt
@@ -0,0 +1,50 @@
+This test checks that Content Distribution alignment works fine in combination with Self Alignmet and items span more than one track.
+
+direction: LTR | distribution: 'space-between' | self-alignment: center
+
+PASS
+direction: LTR | distribution: 'space-between' | self-alignment: end
+
+PASS
+direction: LTR | distribution: 'space-around' | self-alignment: center
+
+PASS
+direction: LTR | distribution: 'space-around' | self-alignment: end
+
+PASS
+direction: LTR | distribution: 'space-evenly' | self-alignment: center
+
+PASS
+direction: LTR | distribution: 'space-evenly' | self-alignment: end
+
+PASS
+direction: LTR | distribution: 'stretch' | self-alignment: center
+
+PASS
+direction: LTR | distribution: 'stretch' | self-alignment: end
+
+PASS
+direction: RTL | distribution: 'space-between' | self-alignment: center
+
+PASS
+direction: RTL | distribution: 'space-between' | self-alignment: end
+
+PASS
+direction: RTL | distribution: 'space-around' | self-alignment: center
+
+PASS
+direction: RTL | distribution: 'space-around' | self-alignment: end
+
+PASS
+direction: RTL | distribution: 'space-evenly' | self-alignment: center
+
+PASS
+direction: RTL | distribution: 'space-evenly' | self-alignment: end
+
+PASS
+direction: RTL | distribution: 'stretch' | self-alignment: center
+
+PASS
+direction: RTL | distribution: 'stretch' | self-alignment: end
+
+PASS
diff --git a/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-content-alignment-and-self-alignment.html b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-content-alignment-and-self-alignment.html
new file mode 100644
index 0000000..5ed39f0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-content-alignment-and-self-alignment.html
@@ -0,0 +1,245 @@
+<!DOCTYPE html>
+<html>
+<head>
+<link href="resources/grid.css" rel="stylesheet">
+<script src="../../resources/check-layout.js"></script>
+<style>
+body {
+    margin: 0px;
+}
+
+.grid {
+    grid-auto-columns: 20px;
+    grid-auto-rows: 40px;
+    grid-template-areas: "a a b"
+                         "c d b";
+    position: relative;
+    width: 300px;
+    height: 200px;
+}
+.a {
+    grid-area: a;
+    background-color: blue;
+}
+.b {
+    grid-area: b;
+    background-color: lime;
+}
+.c {
+    grid-area: c;
+    background-color: purple;
+}
+.d {
+    grid-area: d;
+    background-color: orange;
+}
+.stretchedGrid {
+    grid-auto-columns: minmax(20px, auto);
+    grid-auto-rows: minmax(40px, auto);
+}
+
+.spaceBetween {
+    justify-content: space-between;
+    align-content: space-between;
+}
+
+.spaceAround {
+    justify-content: space-around;
+    align-content: space-around;
+}
+
+.spaceEvenly {
+    justify-content: space-evenly;
+    align-content: space-evenly;
+}
+
+.stretch {
+    justify-content: stretch;
+    align-content: stretch;
+}
+
+.cell {
+    width: 20px;
+    height: 40px;
+}
+.justifyCenter {
+    justify-self: center;
+}
+.alignCenter {
+    align-self: center;
+}
+.justifyEnd {
+    justify-self: end;
+}
+.alignEnd {
+    align-self: end;
+}
+</style>
+</head>
+<body onload="checkLayout('.grid')">
+
+<p>This test checks that Content Distribution alignment works fine in combination with Self Alignmet and items span more than one track.</p>
+
+<div style="position: relative">
+    <p>direction: LTR | distribution: 'space-between' | self-alignment: center</p>
+    <div class="grid spaceBetween" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyCenter" data-offset-x="70" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignCenter" data-offset-x="280" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="0" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: LTR | distribution: 'space-between' | self-alignment: end</p>
+    <div class="grid spaceBetween" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyEnd" data-offset-x="140" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignEnd" data-offset-x="280" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="0" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: LTR | distribution: 'space-around' | self-alignment: center</p>
+    <div class="grid spaceAround" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyCenter" data-offset-x="90" data-offset-y="30" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignCenter" data-offset-x="240" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="40" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: LTR | distribution: 'space-around' | self-alignment: end</p>
+    <div class="grid spaceAround" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyEnd" data-offset-x="140" data-offset-y="30" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignEnd" data-offset-x="240" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="40" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: LTR | distribution: 'space-evenly' | self-alignment: center</p>
+    <div class="grid spaceEvenly" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyCenter" data-offset-x="100" data-offset-y="40" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignCenter" data-offset-x="220" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="60" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: LTR | distribution: 'space-evenly' | self-alignment: end</p>
+    <div class="grid spaceEvenly" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyEnd" data-offset-x="140" data-offset-y="40" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignEnd" data-offset-x="220" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="60" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: LTR | distribution: 'stretch' | self-alignment: center</p>
+    <div class="grid stretchedGrid stretch" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyCenter alignCenter" data-offset-x="90" data-offset-y="30" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell justifyCenter alignCenter" data-offset-x="240" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="0" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
+        <div class="d" data-offset-x="100" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: LTR | distribution: 'stretch' | self-alignment: end</p>
+    <div class="grid stretchedGrid stretch" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyEnd alignEnd" data-offset-x="180" data-offset-y="60" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell justifyEnd alignEnd" data-offset-x="280" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="0" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
+        <div class="d" data-offset-x="100" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
+    </div>
+</div>
+
+<!-- RTL direction. -->
+<div style="position: relative">
+    <p>direction: RTL | distribution: 'space-between' | self-alignment: center</p>
+    <div class="grid spaceBetween directionRTL" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyCenter" data-offset-x="210" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignCenter" data-offset-x="0" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="280" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: RTL | distribution: 'space-between' | self-alignment: end</p>
+    <div class="grid spaceBetween directionRTL" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyEnd" data-offset-x="140" data-offset-y="0" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignEnd" data-offset-x="0" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="280" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: RTL | distribution: 'space-around' | self-alignment: center</p>
+    <div class="grid spaceAround directionRTL" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyCenter" data-offset-x="190" data-offset-y="30" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignCenter" data-offset-x="40" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="240" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: RTL | distribution: 'space-around' | self-alignment: end</p>
+    <div class="grid spaceAround directionRTL" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyEnd" data-offset-x="140" data-offset-y="30" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignEnd" data-offset-x="40" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="240" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="130" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: RTL | distribution: 'space-evenly' | self-alignment: center</p>
+    <div class="grid spaceEvenly directionRTL" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyCenter" data-offset-x="180" data-offset-y="40" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignCenter" data-offset-x="60" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="220" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: RTL | distribution: 'space-evenly' | self-alignment: end</p>
+    <div class="grid spaceEvenly directionRTL" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyEnd" data-offset-x="140" data-offset-y="40" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell alignEnd" data-offset-x="60" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="220" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+        <div class="d" data-offset-x="140" data-offset-y="120" data-expected-width="20" data-expected-height="40"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: RTL | distribution: 'stretch' | self-alignment: center</p>
+    <div class="grid stretchedGrid stretch directionRTL" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyCenter alignCenter" data-offset-x="190" data-offset-y="30" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell justifyCenter alignCenter" data-offset-x="40" data-offset-y="80" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="200" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
+        <div class="d" data-offset-x="100" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
+    </div>
+</div>
+
+<div style="position: relative">
+    <p>direction: RTL | distribution: 'stretch' | self-alignment: end</p>
+    <div class="grid stretchedGrid stretch directionRTL" data-expected-width="300" data-expected-height="200">
+        <div class="a cell justifyEnd alignEnd" data-offset-x="100" data-offset-y="60" data-expected-width="20" data-expected-height="40"></div>
+        <div class="b cell justifyEnd alignEnd" data-offset-x="0" data-offset-y="160" data-expected-width="20" data-expected-height="40"></div>
+        <div class="c" data-offset-x="200" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
+        <div class="d" data-offset-x="100" data-offset-y="100" data-expected-width="100" data-expected-height="100"></div>
+    </div>
+</div>
+
+</body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt
index c83b254d..1186a5d 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-navigated-expected.txt
@@ -47,8 +47,8 @@
 PASS window.cached_navigator.vendorSub is ''
 PASS window.cached_navigator_connection.onchange is null
 PASS window.cached_navigator_connection.ontypechange is null
+PASS window.cached_navigator_presentation.connection is null
 PASS window.cached_navigator_presentation.defaultRequest is null
-PASS window.cached_navigator_presentation.session is null
 PASS window.cached_navigator_serviceWorker.controller is null
 PASS window.cached_navigator_serviceWorker.oncontrollerchange is null
 PASS window.cached_navigator_serviceWorker.onmessage is null
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt
index 6dc1307e..f8455f8 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-and-gced-expected.txt
@@ -47,8 +47,8 @@
 PASS window.cached_navigator.vendorSub is ''
 PASS window.cached_navigator_connection.onchange is null
 PASS window.cached_navigator_connection.ontypechange is null
+PASS window.cached_navigator_presentation.connection is null
 PASS window.cached_navigator_presentation.defaultRequest is null
-PASS window.cached_navigator_presentation.session is null
 PASS window.cached_navigator_serviceWorker.controller is null
 PASS window.cached_navigator_serviceWorker.oncontrollerchange is null
 PASS window.cached_navigator_serviceWorker.onmessage is null
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt
index 08d429ff..ed3ca6a 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-properties-after-frame-removed-expected.txt
@@ -47,8 +47,8 @@
 PASS window.cached_navigator.vendorSub is ''
 PASS window.cached_navigator_connection.onchange is null
 PASS window.cached_navigator_connection.ontypechange is null
+PASS window.cached_navigator_presentation.connection is null
 PASS window.cached_navigator_presentation.defaultRequest is null
-PASS window.cached_navigator_presentation.session is null
 PASS window.cached_navigator_serviceWorker.controller is null
 PASS window.cached_navigator_serviceWorker.oncontrollerchange is null
 PASS window.cached_navigator_serviceWorker.onmessage is null
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
index 5aaa248..a3ee1ff 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-navigated-expected.txt
@@ -54,8 +54,8 @@
 PASS oldChildWindow.navigator.maxTouchPoints is newChildWindow.navigator.maxTouchPoints
 PASS oldChildWindow.navigator.onLine is newChildWindow.navigator.onLine
 PASS oldChildWindow.navigator.platform is newChildWindow.navigator.platform
+PASS oldChildWindow.navigator.presentation.connection is newChildWindow.navigator.presentation.connection
 PASS oldChildWindow.navigator.presentation.defaultRequest is newChildWindow.navigator.presentation.defaultRequest
-PASS oldChildWindow.navigator.presentation.session is newChildWindow.navigator.presentation.session
 PASS oldChildWindow.navigator.product is newChildWindow.navigator.product
 PASS oldChildWindow.navigator.productSub is newChildWindow.navigator.productSub
 PASS oldChildWindow.navigator.serviceWorker.controller is newChildWindow.navigator.serviceWorker.controller
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt
index c2ac97b..409ee6c 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-and-gced-expected.txt
@@ -54,8 +54,8 @@
 PASS childWindow.navigator.maxTouchPoints is 0
 PASS childWindow.navigator.onLine is window.navigator.onLine
 PASS childWindow.navigator.platform is window.navigator.platform
+FAIL childWindow.navigator.presentation.connection should be null. Threw exception TypeError: Cannot read property 'connection' of null
 FAIL childWindow.navigator.presentation.defaultRequest should be null. Threw exception TypeError: Cannot read property 'defaultRequest' of null
-FAIL childWindow.navigator.presentation.session should be null. Threw exception TypeError: Cannot read property 'session' of null
 PASS childWindow.navigator.product is window.navigator.product
 PASS childWindow.navigator.productSub is window.navigator.productSub
 FAIL childWindow.navigator.serviceWorker.controller should be null. Threw exception TypeError: Cannot read property 'controller' of null
diff --git a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt
index 0c5e63a..2624c0c 100644
--- a/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/dom/Window/property-access-on-cached-window-after-frame-removed-expected.txt
@@ -53,8 +53,8 @@
 PASS childWindow.navigator.maxTouchPoints is 0
 PASS childWindow.navigator.onLine is window.navigator.onLine
 PASS childWindow.navigator.platform is window.navigator.platform
+FAIL childWindow.navigator.presentation.connection should be null. Threw exception TypeError: Cannot read property 'connection' of null
 FAIL childWindow.navigator.presentation.defaultRequest should be null. Threw exception TypeError: Cannot read property 'defaultRequest' of null
-FAIL childWindow.navigator.presentation.session should be null. Threw exception TypeError: Cannot read property 'session' of null
 PASS childWindow.navigator.product is window.navigator.product
 PASS childWindow.navigator.productSub is window.navigator.productSub
 FAIL childWindow.navigator.serviceWorker.controller should be null. Threw exception TypeError: Cannot read property 'controller' of null
diff --git a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-in-iframe-to-rect-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/scroll-element-in-iframe-to-rect-expected.txt
deleted file mode 100644
index 16a021e..0000000
--- a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-in-iframe-to-rect-expected.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-
-Tests that scrolling to rect works for an element inside an iframe.
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-Scrolled element to rect.
-PASS rect.left is computedLeft
-PASS rect.top is computedTop
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-in-iframe-to-rect.html b/third_party/WebKit/LayoutTests/fast/dom/scroll-element-in-iframe-to-rect.html
deleted file mode 100644
index 58e7235..0000000
--- a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-in-iframe-to-rect.html
+++ /dev/null
@@ -1,37 +0,0 @@
-<!DOCTYPE html>
-<div style="width: 1600px; height:100px; background-color: red;"></div>
-<iframe id="iframe" style="width:820px; height:820px;"
-  src="data:text/html,<body><div style='position: relative; width: 800px; height: 800px; background-color: green;'><div style='position:absolute; left: 400px; top: 400px;'> <input id='textbox' type='text'></div></div></body>"></iframe>
-
-<div id="console"></div>
-
-<script src="../../resources/js-test.js"></script>
-<script>
-  description('Tests that scrolling to rect works for an element inside an iframe.');
-
-  window.jsTestIsAsync = true;
-  if (window.testRunner)
-    testRunner.waitUntilDone();
-
-  onload = function() {
-    var iframe = document.getElementById('iframe');
-    var frameDoc = iframe.contentWindow.document;
-    var box = frameDoc.getElementById('textbox');
-
-    if (window.internals) {
-      window.internals.scrollElementToRect(box, 0, 100, 300, 300);
-      window.internals.scrollElementToRect(box, 0, 0, 300, 300);
-      debug('Scrolled element to rect.');
-    } else {
-      debug('This test requires window.internals API to be available.');
-    }
-
-    window.rect = window.internals.boundsInViewportSpace(box);
-    window.computedLeft = Math.floor((300 - rect.width) / 2);
-    window.computedTop = Math.floor((300 - rect.height) / 2);
-    shouldBe('rect.left', 'computedLeft');
-    shouldBe('rect.top', 'computedTop');
-
-    finishJSTest();
-  };
-</script>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-centered-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-centered-expected.txt
deleted file mode 100644
index 872311c7..0000000
--- a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-centered-expected.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Scrolled element to rect
-PASS rect.left is computedLeft
-PASS rect.top is computedTop
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-centered.html b/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-centered.html
deleted file mode 100644
index 27642db1..0000000
--- a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-centered.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<html>
-  <head>
-    <body>
-      <div id="console"></div>
-      <div style="position: relative; width: 2400px; height: 2400px; background-color: white;">
-        <div style="position:fixed; left: 50px; top: 30px; width: 200px; height: 250px; background-color: green;"></div>
-        <div style="position:absolute; left: 600px; top: 800px;"> <input id="textbox" type="text"></div>
-      </div>
-    </body>
-    <script src="../../resources/js-test.js"></script>
-    <script>
-      var box = document.getElementById('textbox');
-      if (window.internals)
-        window.internals.scrollElementToRect(box, 50, 30, 200, 250);
-
-      var rect = box.getBoundingClientRect();
-      var computedLeft = 50 + Math.floor((200 - rect.width) / 2);
-      var computedTop = 30 + Math.floor((250 - rect.height) / 2);
-      debug("Scrolled element to rect");
-      shouldBe("rect.left", "computedLeft");
-      shouldBe("rect.top", "computedTop");
-      if (window.testRunner) {
-        testRunner.dumpAsText();
-      }
-    </script>
-    </script>
-  </head>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-expected.txt b/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-expected.txt
deleted file mode 100644
index 872311c7..0000000
--- a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect-expected.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-Scrolled element to rect
-PASS rect.left is computedLeft
-PASS rect.top is computedTop
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
diff --git a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect.html b/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect.html
deleted file mode 100644
index 2acc2189..0000000
--- a/third_party/WebKit/LayoutTests/fast/dom/scroll-element-to-rect.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<html>
-  <head>
-    <body>
-      <div id="console"></div>
-      <div style="position: relative; width: 1600px; height: 2400px; background-color: green;">
-        <div style="position:absolute; left: 600px; top: 800px;"> <input id="textbox" type="text"></div>
-      </div>
-    </body>
-    <script src="../../resources/js-test.js"></script>
-    <script>
-	  var box = document.getElementById('textbox');
-      if (window.internals) {
-        window.internals.scrollElementToRect(box, 0, 100, 300, 300);
-        window.internals.scrollElementToRect(box, 0, 0, 300, 300);
-      }
-
-      var rect = box.getBoundingClientRect();
-      var computedLeft = Math.floor((300 - rect.width) / 2);
-      var computedTop = Math.floor((300 - rect.height) / 2);
-      debug("Scrolled element to rect");
-      shouldBe("rect.left", "computedLeft");
-      shouldBe("rect.top", "computedTop");
-      if (window.testRunner) {
-        testRunner.dumpAsText();
-      }
-    </script>
-  </head>
-</html>
diff --git a/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/constructed-events.html b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/constructed-events.html
new file mode 100644
index 0000000..949bb1a9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/constructed-events.html
@@ -0,0 +1,16 @@
+<!DOCTYPE html>
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+'use strict';
+for (let eventType of [MouseEvent, KeyboardEvent, WheelEvent, GamepadEvent, FocusEvent]) {
+    test(function() {
+        let before = performance.now();
+        let e = new eventType('test');
+        let after = performance.now();
+        assert_greater_than_equal(e.timeStamp, before, "Event timestamp should be greate that performance.now() timestamp taken before its creation");
+        assert_less_than_equal(e.timeStamp, after, "Event timestamp should be less that performance.now() timestamp taken after its creation");
+    }, `Constructed ${eventType.prototype.constructor.name} timestamp should be high resolution and have the same time origin as performance.now()`);
+}
+</script>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/input-events.html b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/input-events.html
new file mode 100644
index 0000000..297b4eb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/input-events.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+'use strict';
+
+let testCases = {
+    'mousedown': () => eventSender.mouseDown(),
+    'keydown': () => eventSender.keyDown('x'),
+    'touchstart': () => {
+        eventSender.addTouchPoint(1, 1);
+        eventSender.touchStart();
+    },
+    'click': () => eventSender.gestureTap(1, 1)
+};
+
+for (let eventName in testCases)
+    createTest(eventName, testCases[eventName]);
+
+function createTest(eventName, dispatchEventFn) {
+    async_test(function(t) {
+        document.addEventListener(eventName, t.step_func(function(e) {
+            let platformTimestamp = eventSender.lastEventTimestamp(); // in seconds
+            let expectedTimestamp = internals.monotonicTimeToZeroBasedDocumentTime(platformTimestamp) * 1000; // in milliseconds
+            assert_approx_equals(e.timeStamp, expectedTimestamp, 0.005);
+            t.done();
+        }));
+        dispatchEventFn();
+    }, "Event timestamp should be equal to the timestamp provided by the platform for " + eventName);
+}
+</script>
diff --git a/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/safe-resolution.html b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/safe-resolution.html
new file mode 100644
index 0000000..bc3d519e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/hr-timestamp/safe-resolution.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<script type="text/javascript">
+'use strict';
+
+test(function() {
+    let e1 = new MouseEvent('test1');
+    let e2 = new MouseEvent('test2');
+    
+    while (e1.timeStamp == e2.timeStamp)
+        e2 = new MouseEvent('test2');
+
+    let expectedResolutionMilliseconds = 0.005;
+    let integerMultipleOfResolution = (e2.timeStamp - e1.timeStamp) / expectedResolutionMilliseconds;
+    let shouldBeNearZeroOrOne = integerMultipleOfResolution % 1;
+    assert_true(shouldBeNearZeroOrOne < 1e-10 || Math.abs(shouldBeNearZeroOrOne - 1) < 1e-10);
+}, 'Event timestamp should not have a resolution better that 5 microseconds');
+</script>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/fast/parser/strip-script-attrs-on-input-expected.txt b/third_party/WebKit/LayoutTests/fast/parser/strip-script-attrs-on-input-expected.txt
new file mode 100644
index 0000000..26318e9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/parser/strip-script-attrs-on-input-expected.txt
@@ -0,0 +1 @@
+PASS: if no OOB access detected in ASAN.
diff --git a/third_party/WebKit/LayoutTests/fast/parser/strip-script-attrs-on-input.html b/third_party/WebKit/LayoutTests/fast/parser/strip-script-attrs-on-input.html
new file mode 100644
index 0000000..feba9ac
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/parser/strip-script-attrs-on-input.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<body>
+<div contenteditable="true" id="target">
+    <!-- Blink will remove javascript url attrs when copy&pasted. -->
+    <input onblur="javascript:false;" onclick="javascript:false;" type="text"/>
+</div>
+<script>
+if (window.testRunner) {
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+}
+
+requestAnimationFrame(function() {
+    var target = document.getElementById("target");
+    var selection = window.getSelection();
+    var range = document.createRange();
+    range.selectNodeContents(target);
+    selection.addRange(range);
+
+    // Invoke HTML parser with ParserContentPolicy disabling scripting content.
+    document.execCommand("Cut");
+    document.execCommand("Paste");
+
+    target.innerHTML = '';
+    testRunner.notifyDone();
+});
+</script>
+<p>PASS: if no OOB access detected in ASAN.</p>
+</body>
diff --git a/third_party/WebKit/LayoutTests/fast/repaint/selection-change-in-iframe-with-relative-parent-expected.txt b/third_party/WebKit/LayoutTests/fast/repaint/selection-change-in-iframe-with-relative-parent-expected.txt
index 049d6af7..4f8eac7 100644
--- a/third_party/WebKit/LayoutTests/fast/repaint/selection-change-in-iframe-with-relative-parent-expected.txt
+++ b/third_party/WebKit/LayoutTests/fast/repaint/selection-change-in-iframe-with-relative-parent-expected.txt
@@ -6,10 +6,14 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
+        [58, 238, 10, 10],
+        [48, 218, 10, 10],
+        [48, 198, 10, 10],
         [18, 238, 40, 10],
+        [18, 228, 10, 10],
         [18, 218, 30, 10],
-        [18, 198, 30, 10],
-        [8, 8, 284, 50]
+        [18, 208, 10, 10],
+        [18, 198, 30, 10]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow HTML",
diff --git a/third_party/WebKit/LayoutTests/fast/table/colspan-with-empty-cells-needing-extra-width-expected.txt b/third_party/WebKit/LayoutTests/fast/table/colspan-with-empty-cells-needing-extra-width-expected.txt
new file mode 100644
index 0000000..6461d2b1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/table/colspan-with-empty-cells-needing-extra-width-expected.txt
@@ -0,0 +1,4 @@
+crbug.com/534830: Don't deduct the min-width of empty cells from the available table width. There should be no red.
+
+TestTestTest
+PASS
diff --git a/third_party/WebKit/LayoutTests/fast/table/colspan-with-empty-cells-needing-extra-width.html b/third_party/WebKit/LayoutTests/fast/table/colspan-with-empty-cells-needing-extra-width.html
new file mode 100644
index 0000000..a8c5ce5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/table/colspan-with-empty-cells-needing-extra-width.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<style>
+table td {
+    padding: 0;
+}
+</style>
+<p>crbug.com/534830: Don't deduct the min-width of empty cells from the available table width. There should be no red. </p>
+<table style="width: 400px; background-color: red; border-spacing: 0px;">
+    <tr>
+        <td style="background-color:black; width: 10px; height:20px;"></td>
+        <td style="background-color:blue;"></td>
+    </tr>
+    <tr>
+        <td id="colspan" colspan="2" style="background-color:yellow;" data-expected-width=400>
+            TestTestTest
+        </td>
+    </tr>
+</table>
+<div id="test-output"></div>
+<script src="../../resources/check-layout.js"></script>
+<script>
+    window.checkLayout("#colspan", document.getElementById("test-output"));
+</script>
diff --git a/third_party/WebKit/LayoutTests/http/tests/dom/resources/promise-rejection-events.js b/third_party/WebKit/LayoutTests/http/tests/dom/resources/promise-rejection-events.js
index 21c69f77..7e329070 100644
--- a/third_party/WebKit/LayoutTests/http/tests/dom/resources/promise-rejection-events.js
+++ b/third_party/WebKit/LayoutTests/http/tests/dom/resources/promise-rejection-events.js
@@ -271,7 +271,7 @@
    'a promise created from returning a Promise.reject-created promise in a fulfillment handler');
 
 //
-// Negative unhandledrejection/rejectionhandled tests with delayed attachment
+// Negative unhandledrejection/rejectionhandled tests with microtask-delayed attachment
 //
 
 async_test(function(t) {
@@ -449,6 +449,90 @@
 }, 'microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, ' +
    'all inside a setTimeout');
 
+
+// For workers, postMessageTask() involves posting tasks to other threads, so
+// the following tests don't work there.
+
+if ('document' in self) {
+  //
+  // Negative unhandledrejection/rejectionhandled tests with task-delayed attachment
+  //
+
+  async_test(function(t) {
+    var e = new Error();
+    var p;
+
+    onUnhandledFail(t, function() { return p; });
+
+    var _reject;
+    p = new Promise(function(_, reject) {
+      _reject = reject;
+    });
+    _reject(e);
+    postMessageTask(function() {
+      var unreached = t.unreached_func('promise should not be fulfilled');
+      p.then(unreached, function() {});
+    });
+  }, 'delayed handling: a task delay before attaching a handler prevents unhandledrejection');
+
+  async_test(function(t) {
+    var e = new Error();
+    var p;
+
+    onUnhandledFail(t, function() { return p; });
+
+    p = Promise.reject(e);
+    postMessageTask(function() {
+      Promise.resolve().then(function() {
+        p.catch(function() {});
+      });
+    });
+  }, 'delayed handling: postMessageTask after promise creation/rejection, plus promise microtasks, is not too late to ' +
+     'attach a rejection handler');
+
+  async_test(function(t) {
+    var e = new Error();
+    var p;
+
+    onUnhandledFail(t, function() { return p; });
+
+    postMessageTask(function() {
+      Promise.resolve().then(function() {
+        Promise.resolve().then(function() {
+          Promise.resolve().then(function() {
+            Promise.resolve().then(function() {
+              p.catch(function() {});
+            });
+          });
+        });
+      });
+    });
+    p = Promise.reject(e);
+  }, 'delayed handling: postMessageTask before promise creation/rejection, plus many promise microtasks, is not too ' +
+     'late to attach a rejection handler');
+
+  async_test(function(t) {
+    var e = new Error();
+    var p;
+
+    onUnhandledFail(t, function() { return p; });
+
+    p = Promise.reject(e);
+    postMessageTask(function() {
+      Promise.resolve().then(function() {
+        Promise.resolve().then(function() {
+          Promise.resolve().then(function() {
+            Promise.resolve().then(function() {
+              p.catch(function() {});
+            });
+          });
+        });
+      });
+    });
+  }, 'delayed handling: postMessageTask after promise creation/rejection, plus many promise microtasks, is not too ' +
+     'late to attach a rejection handler');
+}
+
 //
 // Positive unhandledrejection/rejectionhandled tests with delayed attachment
 //
@@ -465,10 +549,75 @@
   });
   _reject(e);
   postMessageTask(function() {
-    var unreached = t.unreached_func('promise should not be fulfilled');
-    p.then(unreached, function() {});
+    postMessageTask(function() {
+      var unreached = t.unreached_func('promise should not be fulfilled');
+      p.then(unreached, function() {});
+    });
   });
-}, 'delayed handling: a task delay before attaching a handler does not prevent unhandledrejection');
+}, 'delayed handling: a nested-task delay before attaching a handler causes unhandledrejection');
+
+async_test(function(t) {
+  var e = new Error();
+  var p;
+
+  onUnhandledSucceed(t, e, function() { return p; });
+
+  p = Promise.reject(e);
+  postMessageTask(function() {
+    postMessageTask(function() {
+      Promise.resolve().then(function() {
+        p.catch(function() {});
+      });
+    });
+  });
+}, 'delayed handling: a nested-postMessageTask after promise creation/rejection, plus promise microtasks, is too ' +
+   'late to attach a rejection handler');
+
+async_test(function(t) {
+  var e = new Error();
+  var p;
+
+  onUnhandledSucceed(t, e, function() { return p; });
+
+  postMessageTask(function() {
+    postMessageTask(function() {
+      Promise.resolve().then(function() {
+        Promise.resolve().then(function() {
+          Promise.resolve().then(function() {
+            Promise.resolve().then(function() {
+              p.catch(function() {});
+            });
+          });
+        });
+      });
+    });
+  });
+  p = Promise.reject(e);
+}, 'delayed handling: a nested-postMessageTask before promise creation/rejection, plus many promise microtasks, is ' +
+   'too late to attach a rejection handler');
+
+async_test(function(t) {
+  var e = new Error();
+  var p;
+
+  onUnhandledSucceed(t, e, function() { return p; });
+
+  p = Promise.reject(e);
+  postMessageTask(function() {
+    postMessageTask(function() {
+      Promise.resolve().then(function() {
+        Promise.resolve().then(function() {
+          Promise.resolve().then(function() {
+            Promise.resolve().then(function() {
+              p.catch(function() {});
+            });
+          });
+        });
+      });
+    });
+  });
+}, 'delayed handling: a nested-postMessageTask after promise creation/rejection, plus many promise microtasks, is ' +
+   'too late to attach a rejection handler');
 
 async_test(function(t) {
   var unhandledPromises = [];
@@ -510,62 +659,6 @@
   }, 10);
 }, 'delayed handling: delaying handling by setTimeout(,10) will cause both events to fire');
 
-async_test(function(t) {
-  var e = new Error();
-  var p;
-
-  onUnhandledSucceed(t, e, function() { return p; });
-
-  p = Promise.reject(e);
-  postMessageTask(function() {
-    Promise.resolve().then(function() {
-      p.catch(function() {});
-    });
-  });
-}, 'delayed handling: postMessageTask after promise creation/rejection, plus promise microtasks, is too late to ' +
-   'attach a rejection handler');
-
-async_test(function(t) {
-  var e = new Error();
-  var p;
-
-  onUnhandledSucceed(t, e, function() { return p; });
-  postMessageTask(function() {
-    Promise.resolve().then(function() {
-      Promise.resolve().then(function() {
-        Promise.resolve().then(function() {
-          Promise.resolve().then(function() {
-            p.catch(function() {});
-          });
-        });
-      });
-    });
-  });
-  p = Promise.reject(e);
-}, 'delayed handling: postMessageTask before promise creation/rejection, plus many promise microtasks, is too late ' +
-   'to attach a rejection handler');
-
-async_test(function(t) {
-  var e = new Error();
-  var p;
-
-  onUnhandledSucceed(t, e, function() { return p; });
-
-  p = Promise.reject(e);
-  postMessageTask(function() {
-    Promise.resolve().then(function() {
-      Promise.resolve().then(function() {
-        Promise.resolve().then(function() {
-          Promise.resolve().then(function() {
-            p.catch(function() {});
-          });
-        });
-      });
-    });
-  });
-}, 'delayed handling: postMessageTask after promise creation/rejection, plus many promise microtasks, is too late ' +
-   'to attach a rejection handler');
-
 //
 // Miscellaneous tests about integration with the rest of the platform
 //
@@ -590,6 +683,135 @@
   Promise.reject(e);
 }, 'mutationObserverMicrotask vs. postMessageTask ordering is not disturbed inside unhandledrejection events');
 
+// For workers, postMessageTask() involves posting tasks to other threads, so
+// the following tests don't work there.
+
+if ('document' in self) {
+
+  // For the next two see https://github.com/domenic/unhandled-rejections-browser-spec/issues/2#issuecomment-121121695
+  // and the following comments.
+
+  async_test(function(t) {
+    var sequenceOfEvents = [];
+
+    addEventListener('unhandledrejection', l);
+    ensureCleanup(t, l);
+
+    var p1 = Promise.reject();
+    var p2;
+    postMessageTask(function() {
+      p2 = Promise.reject();
+      postMessageTask(function() {
+        sequenceOfEvents.push('postMessageTask');
+        checkSequence();
+      });
+    });
+
+    function l(ev) {
+      if (ev.promise === p1 || ev.promise === p2) {
+        sequenceOfEvents.push(ev.promise);
+        checkSequence();
+      }
+    }
+
+    function checkSequence() {
+      if (sequenceOfEvents.length === 3) {
+        t.step(function() {
+          assert_array_equals(sequenceOfEvents, [p1, 'postMessageTask', p2]);
+        });
+        t.done();
+      }
+    }
+  }, 'postMessageTask ordering vs. the task queued for unhandled rejection notification (1)');
+
+  async_test(function(t) {
+    var sequenceOfEvents = [];
+
+    addEventListener('unhandledrejection', l);
+    ensureCleanup(t, l);
+
+    var p2;
+    postMessageTask(function() {
+      p2 = Promise.reject();
+      postMessageTask(function() {
+        sequenceOfEvents.push('postMessageTask');
+        checkSequence();
+      });
+    });
+
+    function l(ev) {
+      if (ev.promise == p2) {
+        sequenceOfEvents.push(ev.promise);
+        checkSequence();
+      }
+    }
+
+    function checkSequence() {
+      if (sequenceOfEvents.length === 2) {
+        t.step(function() {
+          assert_array_equals(sequenceOfEvents, ['postMessageTask', p2]);
+        });
+        t.done();
+      }
+    }
+  }, 'postMessageTask ordering vs. the task queued for unhandled rejection notification (2)');
+
+  async_test(function(t) {
+    var sequenceOfEvents = [];
+
+
+    addEventListener('unhandledrejection', unhandled);
+    addEventListener('rejectionhandled', handled);
+    ensureCleanup(t, unhandled, handled);
+
+    var p = Promise.reject();
+
+    setTimeout(function() {
+      postMessageTask(function() {
+        sequenceOfEvents.push('task before catch');
+        checkSequence();
+      });
+
+      p.catch(function() {
+        sequenceOfEvents.push('catch');
+        checkSequence();
+      });
+
+      postMessageTask(function() {
+        sequenceOfEvents.push('task after catch');
+        checkSequence();
+      });
+
+      sequenceOfEvents.push('after catch');
+      checkSequence();
+    }, 10);
+
+    function unhandled(ev) {
+      if (ev.promise === p) {
+        sequenceOfEvents.push('unhandled');
+        checkSequence();
+      }
+    }
+
+    function handled(ev) {
+      if (ev.promise === p) {
+        sequenceOfEvents.push('handled');
+        checkSequence();
+      }
+    }
+
+    function checkSequence() {
+      if (sequenceOfEvents.length === 6) {
+        t.step(function() {
+          assert_array_equals(sequenceOfEvents,
+            ['unhandled', 'after catch', 'catch', 'task before catch', 'handled', 'task after catch']);
+        });
+        t.done();
+      }
+    }
+  }, 'rejectionhandled is dispatched from a queued task, and not immediately');
+}
+
 //
 // HELPERS
 //
@@ -646,12 +868,16 @@
 function onUnhandledFail(t, expectedPromiseGetter) {
   var unhandled = function(evt) {
     if (evt.promise === expectedPromiseGetter()) {
-      t.unreached_func('unhandledrejection event is not supposed to be triggered');
+      t.step(function() {
+        assert_unreached('unhandledrejection event is not supposed to be triggered');
+      });
     }
   };
   var handled = function(evt) {
     if (evt.promise === expectedPromiseGetter()) {
-      t.unreached_func('rejectionhandled event is not supposed to be triggered');
+      t.step(function() {
+        assert_unreached('rejectionhandled event is not supposed to be triggered');
+      });
     }
   };
   addEventListener('unhandledrejection', unhandled);
diff --git a/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/resources/test-request-multiple.js b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/resources/test-request-multiple.js
new file mode 100644
index 0000000..5ae4119
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/resources/test-request-multiple.js
@@ -0,0 +1,235 @@
+if (self.importScripts) {
+    importScripts('../../resources/helpers.js');
+    importScripts('testrunner-helpers.js');
+
+    if (get_current_scope() == 'ServiceWorker')
+        importScripts('../../../serviceworker/resources/worker-testharness.js');
+    else
+        importScripts('../../../resources/testharness.js');
+}
+
+var tests = [
+{
+    test: async_test('Test empty array in ' + get_current_scope() + ' scope.'),
+    fn: function(callback) {
+        navigator.permissions.request([]).then(function(result) {
+            assert_array_equals(result, []);
+            callback();
+        }, function(error) {
+            assert_unreached(error);
+            callback();
+        });
+    }
+}, {
+    test: async_test('Test single permission with update in ' + get_current_scope() + ' scope.'),
+    fn: function(callback) {
+        navigator.permissions.request([{name:'geolocation'}]).then(function(result) {
+            assert_equals(result.length, 1);
+            assert_true(result[0] instanceof PermissionStatus);
+            assert_equals(result[0].state, 'denied');
+            return setPermission('geolocation', 'granted', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'geolocation'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 1);
+            assert_true(result[0] instanceof PermissionStatus);
+            assert_equals(result[0].state, 'granted');
+            // Set back to denied to cleanup.
+            return setPermission('geolocation', 'denied', location.origin, location.origin);
+        })
+        .then(callback)
+        .catch(function(error) {
+            assert_unreached(error);
+            callback();
+        });
+    }
+}, {
+    test: async_test('Test two permissions with update in ' + get_current_scope() + ' scope.'),
+    fn: function(callback) {
+        navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}]).then(function(result) {
+            assert_equals(result.length, 2);
+            for (var i = 0; i < result.length; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'denied');
+            }
+            return setPermission('geolocation', 'granted', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 2);
+            for (var i = 0; i < result.length; i++)
+                assert_true(result[i] instanceof PermissionStatus);
+            assert_equals(result[0].state, 'granted');
+            assert_equals(result[1].state, 'denied');
+            return setPermission('notifications', 'prompt', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 2);
+            for (var i = 0; i < result.length; i++)
+                assert_true(result[i] instanceof PermissionStatus);
+            assert_equals(result[0].state, 'granted');
+            assert_equals(result[1].state, 'prompt');
+            // Set back to denied to cleanup.
+            return setPermission('geolocation', 'denied', location.origin, location.origin);
+        }).then(function() {
+            return setPermission('notifications', 'denied', location.origin, location.origin);
+        })
+        .then(callback)
+        .catch(function(error) {
+            assert_unreached(error);
+            callback();
+        });
+    }
+}, {
+    test: async_test('Test two permissions (inverted) with update in ' + get_current_scope() + ' scope.'),
+    fn: function(callback) {
+        navigator.permissions.request([{name:'notifications'}, {name:'geolocation'}]).then(function(result) {
+            assert_equals(result.length, 2);
+            for (var i = 0; i < result.length; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'denied');
+            }
+            return setPermission('notifications', 'granted', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'notifications'}, {name:'geolocation'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 2);
+            for (var i = 0; i < result.length; i++)
+                assert_true(result[i] instanceof PermissionStatus);
+            assert_equals(result[0].state, 'granted');
+            assert_equals(result[1].state, 'denied');
+            return setPermission('geolocation', 'prompt', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'notifications'}, {name:'geolocation'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 2);
+            for (var i = 0; i < result.length; i++)
+                assert_true(result[i] instanceof PermissionStatus);
+            assert_equals(result[0].state, 'granted');
+            assert_equals(result[1].state, 'prompt');
+            // Set back to denied to cleanup.
+            return setPermission('geolocation', 'denied', location.origin, location.origin);
+        }).then(function() {
+            return setPermission('notifications', 'denied', location.origin, location.origin);
+        })
+        .then(callback)
+        .catch(function(error) {
+            assert_unreached(error);
+            callback();
+        });
+    }
+}, {
+    test: async_test('Test duplicate permissions with update in ' + get_current_scope() + ' scope.'),
+    fn: function(callback) {
+        navigator.permissions.request([{name:'geolocation'}, {name:'geolocation'}]).then(function(result) {
+            assert_equals(result.length, 2);
+            for (var i = 0; i < result.length; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'denied');
+            }
+            return setPermission('geolocation', 'granted', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'geolocation'}, {name:'geolocation'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 2);
+            for (var i = 0; i < result.length; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'granted');
+            }
+            // Set back to denied to cleanup.
+            return setPermission('geolocation', 'denied', location.origin, location.origin);
+        })
+        .then(callback)
+        .catch(function(error) {
+            assert_unreached(error);
+            callback();
+        });
+    }
+}, {
+    test: async_test('Test duplicate permissions (2) with update in ' + get_current_scope() + ' scope.'),
+    fn: function(callback) {
+        navigator.permissions.request([{name:'geolocation'}, {name:'geolocation'}, {name:'notifications'}, {name:'notifications'}]).then(function(result) {
+            assert_equals(result.length, 4);
+            for (var i = 0; i < result.length; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'denied');
+            }
+            return setPermission('geolocation', 'granted', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'geolocation'}, {name:'geolocation'}, {name:'notifications'}, {name:'notifications'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 4);
+            for (var i = 0; i < 2; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'granted');
+            }
+            for (var i = 2; i < 4; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'denied');
+            }
+            // Set back to denied to cleanup.
+            return setPermission('geolocation', 'denied', location.origin, location.origin);
+        })
+        .then(callback)
+        .catch(function(error) {
+            assert_unreached(error);
+            callback();
+        });
+    }
+}, {
+    test: async_test('Test duplicate permissions (3) with update in ' + get_current_scope() + ' scope.'),
+    fn: function(callback) {
+        navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}, {name:'geolocation'}, {name:'notifications'}]).then(function(result) {
+            assert_equals(result.length, 4);
+            for (var i = 0; i < result.length; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'denied');
+            }
+            return setPermission('geolocation', 'granted', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}, {name:'geolocation'}, {name:'notifications'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 4);
+            for (var i = 0; i < result.length; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+            }
+            assert_equals(result[0].state, 'granted');
+            assert_equals(result[1].state, 'denied');
+            assert_equals(result[2].state, 'granted');
+            assert_equals(result[3].state, 'denied');
+            return setPermission('notifications', 'granted', location.origin, location.origin);
+        }).then(function() {
+            return navigator.permissions.request([{name:'geolocation'}, {name:'notifications'}, {name:'geolocation'}, {name:'notifications'}]);
+        }).then(function(result) {
+            assert_equals(result.length, 4);
+            for (var i = 0; i < result.length; i++) {
+                assert_true(result[i] instanceof PermissionStatus);
+                assert_equals(result[i].state, 'granted');
+            }
+            // Set back to denied to cleanup.
+            return setPermission('geolocation', 'denied', location.origin, location.origin);
+        }).then(function() {
+            return setPermission('notifications', 'denied', location.origin, location.origin);
+        })
+        .then(callback)
+        .catch(function(error) {
+            assert_unreached(error);
+            callback();
+        });
+    }
+}];
+
+function runTest(i) {
+  tests[i].test.step(function() {
+      tests[i].fn(function() {
+          tests[i].test.done();
+          if (i + 1 < tests.length) {
+              runTest(i + 1);
+          } else {
+              done();
+          }
+      });
+  });
+}
+runTest(0);
diff --git a/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-sharedworker.html b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-sharedworker.html
new file mode 100644
index 0000000..4349aac
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-sharedworker.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Permissions API: test .request([]) method (for multiple permissions).</title>
+    <script src="../../resources/testharness.js"></script>
+    <script src="../../resources/testharnessreport.js"></script>
+    <script src="../../serviceworker/resources/test-helpers.js"></script>
+    <script src="../resources/helpers.js"></script>
+    <script src="resources/testrunner-helpers.js"></script>
+  </head>
+  <body>
+  <script>
+    var shared_worker = new SharedWorker('resources/test-request-multiple.js');
+    shared_worker.port.addEventListener('message', window_message_handler);
+    shared_worker.port.start();
+    fetch_tests_from_worker(shared_worker);
+  </script>
+  </body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-window.html b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-window.html
new file mode 100644
index 0000000..80376c6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-window.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Permissions API: test .request([]) method (for multiple permissions).</title>
+    <script src="../../resources/testharness.js"></script>
+    <script src="../../resources/testharnessreport.js"></script>
+    <script src="../../serviceworker/resources/test-helpers.js"></script>
+    <script src="../resources/helpers.js"></script>
+    <script src="resources/testrunner-helpers.js"></script>
+  </head>
+  <body>
+  <script>
+    var script_element = document.createElement('script');
+    script_element.src = 'resources/test-request-multiple.js';
+    document.body.appendChild(script_element);
+  </script>
+  </body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-worker.html b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-worker.html
new file mode 100644
index 0000000..702cfcb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/permissions/chromium/test-request-multiple-worker.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+  <head>
+    <title>Permissions API: test .request([]) method (for multiple permissions).</title>
+    <script src="../../resources/testharness.js"></script>
+    <script src="../../resources/testharnessreport.js"></script>
+    <script src="../../serviceworker/resources/test-helpers.js"></script>
+    <script src="../resources/helpers.js"></script>
+    <script src="resources/testrunner-helpers.js"></script>
+  </head>
+  <body>
+  <script>
+    var worker = new Worker('resources/test-request-multiple.js');
+    worker.addEventListener('message', window_message_handler);
+    fetch_tests_from_worker(worker);
+  </script>
+  </body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/http/tests/push_messaging/subscribe-encryption-public-key.html b/third_party/WebKit/LayoutTests/http/tests/push_messaging/subscribe-encryption-public-key.html
index 06ae806..72e98d4e 100644
--- a/third_party/WebKit/LayoutTests/http/tests/push_messaging/subscribe-encryption-public-key.html
+++ b/third_party/WebKit/LayoutTests/http/tests/push_messaging/subscribe-encryption-public-key.html
@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html>
     <head>
-        <title>Subscribing should provide a P-256 ECDH public key.</title>
+        <title>Subscribing should provide a Curve25519 ECDH public key.</title>
         <link rel="manifest" href="resources/push_manifest.json">
         <script src="../resources/testharness.js"></script>
         <script src="../resources/testharnessreport.js"></script>
@@ -16,14 +16,14 @@
             }
 
             // When running this test manually, grant permission when prompted.
-            // This test verifies that push subscriptions get an ECDH P-256 key
-            // that can be used on the application server to encrypt payloads.
+            // This test verifies that push subscriptions get an ECDH Curve25519
+            // key that can be used on the application server to encrypt payloads.
             async_test(function(test) {
                 var workerUrl = 'resources/empty_worker.js';
                 var workerScope = 'resources/scope/' + location.pathname;
                 var swRegistration, encryptionKey;
 
-                // Size of an ECDH p256 public key, in bytes.
+                // Size of an ECDH curve25519 public key, in bytes.
                 var EXPECTED_KEY_LENGTH = 32;
 
                 service_worker_unregister_and_register(test, workerUrl, workerScope)
@@ -39,27 +39,27 @@
                     })
                     .then(function(pushSubscription) {
                         assert_own_property(PushSubscription.prototype, 'getKey');
-                        assert_not_equals(pushSubscription.getKey('p256dh'), null);
-                        assert_equals(pushSubscription.getKey('p256dh').byteLength, EXPECTED_KEY_LENGTH);
+                        assert_not_equals(pushSubscription.getKey('curve25519dh'), null);
+                        assert_equals(pushSubscription.getKey('curve25519dh').byteLength, EXPECTED_KEY_LENGTH);
 
                         // The returned ArrayBuffers are expected to be the same.
-                        assert_equals(pushSubscription.getKey('p256dh'), pushSubscription.getKey('p256dh'));
+                        assert_equals(pushSubscription.getKey('curve25519dh'), pushSubscription.getKey('curve25519dh'));
 
                         // Getting a key with an unsupported algorithm should throw an exception.
                         assert_throws(TypeError(), () => pushSubscription.getKey('petercurve9001'));
 
-                        encryptionKey = SerializeArrayBuffer(pushSubscription.getKey('p256dh'));
+                        encryptionKey = SerializeArrayBuffer(pushSubscription.getKey('curve25519dh'));
 
                         return swRegistration.pushManager.getSubscription();
                     })
                     .then(function(pushSubscription) {
-                        assert_equals(SerializeArrayBuffer(pushSubscription.getKey('p256dh')), encryptionKey);
+                        assert_equals(SerializeArrayBuffer(pushSubscription.getKey('curve25519dh')), encryptionKey);
 
                         return service_worker_unregister_and_done(test, workerScope);
                     })
                     .catch(unreached_rejection(test));
 
-            }, 'Subscribing should provide a P-256 ECDH public key');
+            }, 'Subscribing should provide a Curve25519 ECDH public key');
         </script>
     </body>
 </html>
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php b/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php
index 2486820..6a18bca 100644
--- a/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/ServiceWorkerGlobalScope/resources/update-worker.php
@@ -1,7 +1,7 @@
 <?php
-// Force the browser to cache this script. update() should always bypass this
-// cache and fetch a new version.
-header('Cache-Control: max-age=86400');
+// update() does not bypass cache so set the max-age to 0 such that update()
+// can find a new version in the network.
+header('Cache-Control: max-age=0');
 
 // Return a different script for each access.
 header('Content-Type:application/javascript');
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/update-served-from-cache-worker.php b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/update-served-from-cache-worker.php
new file mode 100644
index 0000000..c137159
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/resources/update-served-from-cache-worker.php
@@ -0,0 +1,7 @@
+<?php
+// Set max-age to non-zero value so the next update will be served from cache.
+header('Cache-Control: max-age=3600');
+header('Content-Type:application/javascript');
+// Return a different script for each access.
+echo '// ' . microtime();
+?>
diff --git a/third_party/WebKit/LayoutTests/http/tests/serviceworker/update-served-from-cache.html b/third_party/WebKit/LayoutTests/http/tests/serviceworker/update-served-from-cache.html
new file mode 100644
index 0000000..d6f77e7b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/serviceworker/update-served-from-cache.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<title>Service Worker: Registration update() served from cache</title>
+<script src="../resources/testharness.js"></script>
+<script src="../resources/testharnessreport.js"></script>
+<script src="resources/test-helpers.js"></script>
+<script>
+promise_test(function(t) {
+    var scope = 'resources/scope/update-served-from-cache';
+    var worker_url = 'resources/update-served-from-cache-worker.php';
+    var registration;
+
+    return service_worker_unregister_and_register(t, worker_url, scope)
+      .then(function(r) {
+          // The script resource for this register() having a non-zero max-age
+          // value was cached.
+          registration = r;
+          return wait_for_state(t, registration.installing, 'activated');
+        })
+      .then(function() {
+          // update() should consult the cache. The returned promise should
+          // resolve when the script is retrieved from the cache.
+          return registration.update();
+        })
+      .then(function() {
+          // installing should be null as update() does not trigger install.
+          assert_equals(
+              registration.installing, 
+              null,
+              'installing should be null as the script was served from cache.');
+          return service_worker_unregister_and_done(t, scope);
+        });
+  }, 'Update a registration served from cache.');
+</script>
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-scopes-expected.txt b/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-scopes-expected.txt
index ee3d0a13..843ce624 100644
--- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-scopes-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-async/async-callstack-scopes-expected.txt
@@ -25,7 +25,7 @@
     innerFunctionLocalVar: 202
     this: Window
     x: 200
-Closure (makeClosure)
+Closure
     callback: innerTimeout2()
     makeClosureLocalVar: "local.2"
     n: 2
@@ -47,7 +47,7 @@
 Local
     localInInnerTimeout1: "innerTimeout1"
     this: Window
-Closure (timeout1)
+Closure
     localInTimeout1: "timeout1"
 WindowGlobal
     <section collapsed>
@@ -59,7 +59,7 @@
     innerFunctionLocalVar: 102
     this: Window
     x: 100
-Closure (makeClosure)
+Closure
     callback: innerTimeout1()
     makeClosureLocalVar: "local.1"
     n: 1
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/debugger-expand-scope-expected.txt b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/debugger-expand-scope-expected.txt
index 19c6f29c..7e52b32 100644
--- a/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/debugger-expand-scope-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger-ui/debugger-expand-scope-expected.txt
@@ -15,7 +15,7 @@
     negZero: -0
     this: Window
     x: 2010
-Closure (makeClosure)
+Closure
     makeClosureLocalVar: "local.TextParam"
     n: "TextParam"
 WindowGlobal
diff --git a/third_party/WebKit/LayoutTests/inspector/sources/debugger/debugger-es6-harmony-scopes-expected.txt b/third_party/WebKit/LayoutTests/inspector/sources/debugger/debugger-es6-harmony-scopes-expected.txt
index 8af7f7b..06d1d3eb 100644
--- a/third_party/WebKit/LayoutTests/inspector/sources/debugger/debugger-es6-harmony-scopes-expected.txt
+++ b/third_party/WebKit/LayoutTests/inspector/sources/debugger/debugger-es6-harmony-scopes-expected.txt
@@ -24,7 +24,7 @@
     x: 2014
 Block
     makeClosureDeeperBlockVar: "block.deep.TextParam"
-Closure (makeClosure)
+Closure
     makeClosureBlockVar: "block.TextParam"
     makeClosureDeeperLocalVar: "local.deep.TextParam"
     makeClosureLocalVar: "local.TextParam"
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/caret-color-expected.html b/third_party/WebKit/LayoutTests/paint/invalidation/caret-color-expected.html
new file mode 100644
index 0000000..775e3e6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/caret-color-expected.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+Tests color of caret changes with the 'color' style. Passes if caret is always in the came color as the text.
+<input id="target" type="text" value="SAMPLE" style="color: green; font-size: 30px; width: 200px">
+<script>
+target.focus();
+</script>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/caret-color.html b/third_party/WebKit/LayoutTests/paint/invalidation/caret-color.html
new file mode 100644
index 0000000..716f67ae
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/caret-color.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+Tests color of caret changes with the 'color' style. Passes if caret is always in the came color as the text.
+<input id="target" type="text" value="SAMPLE" style="color: red; font-size: 30px; width: 200px">
+<script src="../../resources/run-after-layout-and-paint.js"></script>
+<script>
+target.focus();
+if (window.testRunner) {
+  testRunner.waitUntilDone();
+  runAfterLayoutAndPaint(function() {
+    target.style.color = 'green';
+    testRunner.notifyDone();
+  });
+} else {
+  // For manual testing.
+  setInterval(function() {
+    target.style.color = target.style.color == 'green' ? 'red' : 'green';
+  }, 1300);
+}
+</script>
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/unavailable-plugin-crash-expected.txt b/third_party/WebKit/LayoutTests/paint/invalidation/unavailable-plugin-crash-expected.txt
new file mode 100644
index 0000000..741672c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/unavailable-plugin-crash-expected.txt
@@ -0,0 +1,2 @@
+Tests invalidation of unavailable plugin. Passes if no crash.
+
diff --git a/third_party/WebKit/LayoutTests/paint/invalidation/unavailable-plugin-crash.html b/third_party/WebKit/LayoutTests/paint/invalidation/unavailable-plugin-crash.html
new file mode 100644
index 0000000..bb40111
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/paint/invalidation/unavailable-plugin-crash.html
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<script>
+if (window.testRunner)
+  testRunner.dumpAsText();
+onload = function() {
+  // Trigger a repaint of the frame.
+  document.getElementById('text').style.color = 'green';
+};
+</script>
+<div id="text">Tests invalidation of unavailable plugin. Passes if no crash.</div>
+<embed type="application/x-unavailable" style="border: 1px solid black">
diff --git a/third_party/WebKit/LayoutTests/paint/selection/text-selection-drag-expected.png b/third_party/WebKit/LayoutTests/paint/selection/text-selection-drag-expected.png
index 23179258..e0196c4 100644
--- a/third_party/WebKit/LayoutTests/paint/selection/text-selection-drag-expected.png
+++ b/third_party/WebKit/LayoutTests/paint/selection/text-selection-drag-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/android/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/win/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
rename to third_party/WebKit/LayoutTests/platform/android/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/android/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/linux/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
rename to third_party/WebKit/LayoutTests/platform/android/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/android/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/linux/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
rename to third_party/WebKit/LayoutTests/platform/android/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/filters/effect-reference-tile-expected.txt b/third_party/WebKit/LayoutTests/platform/android/css3/filters/effect-reference-tile-expected.txt
new file mode 100644
index 0000000..60b528f9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/filters/effect-reference-tile-expected.txt
@@ -0,0 +1,41 @@
+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
+      LayoutSVGRoot {svg} at (8,118) size 0x0
+        LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
+          LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feTile]
+              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+                [SourceGraphic]
+          LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feTile]
+              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+                [SourceGraphic]
+          LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feTile]
+              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+                [SourceGraphic]
+          LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feTile]
+              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+                [SourceGraphic]
+      LayoutText {#text} at (0,95) size 4x19
+        text run at (0,95) width 4: " "
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutText {#text} at (184,95) size 4x19
+        text run at (184,95) width 4: " "
+      LayoutText {#text} at (368,95) size 4x19
+        text run at (368,95) width 4: " "
+      LayoutText {#text} at (552,95) size 4x19
+        text run at (552,95) width 4: " "
+      LayoutText {#text} at (0,0) size 0x0
+layer at (22,18) size 160x90
+  LayoutImage {IMG} at (14,10) size 160x90
+layer at (206,18) size 160x90
+  LayoutImage {IMG} at (198,10) size 160x90
+layer at (390,18) size 160x90
+  LayoutImage {IMG} at (382,10) size 160x90
+layer at (574,18) size 160x90
+  LayoutImage {IMG} at (566,10) size 160x90
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-hw-expected.png b/third_party/WebKit/LayoutTests/platform/android/css3/filters/effect-reference-tile-hw-expected.png
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-hw-expected.png
rename to third_party/WebKit/LayoutTests/platform/android/css3/filters/effect-reference-tile-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/filters/effect-reference-tile-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/android/css3/filters/effect-reference-tile-hw-expected.txt
new file mode 100644
index 0000000..60b528f9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/filters/effect-reference-tile-hw-expected.txt
@@ -0,0 +1,41 @@
+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
+      LayoutSVGRoot {svg} at (8,118) size 0x0
+        LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
+          LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feTile]
+              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+                [SourceGraphic]
+          LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feTile]
+              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+                [SourceGraphic]
+          LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feTile]
+              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+                [SourceGraphic]
+          LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+            [feTile]
+              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+                [SourceGraphic]
+      LayoutText {#text} at (0,95) size 4x19
+        text run at (0,95) width 4: " "
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutText {#text} at (184,95) size 4x19
+        text run at (184,95) width 4: " "
+      LayoutText {#text} at (368,95) size 4x19
+        text run at (368,95) width 4: " "
+      LayoutText {#text} at (552,95) size 4x19
+        text run at (552,95) width 4: " "
+      LayoutText {#text} at (0,0) size 0x0
+layer at (22,18) size 160x90
+  LayoutImage {IMG} at (14,10) size 160x90
+layer at (206,18) size 160x90
+  LayoutImage {IMG} at (198,10) size 160x90
+layer at (390,18) size 160x90
+  LayoutImage {IMG} at (382,10) size 160x90
+layer at (574,18) size 160x90
+  LayoutImage {IMG} at (566,10) size 160x90
diff --git a/third_party/WebKit/LayoutTests/platform/android/css3/flexbox/flexbox-baseline-margins-expected.png b/third_party/WebKit/LayoutTests/platform/android/css3/flexbox/flexbox-baseline-margins-expected.png
new file mode 100644
index 0000000..c509f90
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/css3/flexbox/flexbox-baseline-margins-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-textareas-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-textareas-expected.png
new file mode 100644
index 0000000..ff18dbe
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-textareas-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-textareas-quirks-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-textareas-quirks-expected.png
new file mode 100644
index 0000000..058fceb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/basic-textareas-quirks-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/forms/textarea-scrolled-focus-ring-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/forms/textarea-scrolled-focus-ring-expected.png
new file mode 100644
index 0000000..5e284471
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/forms/textarea-scrolled-focus-ring-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/layers/scroll-rect-to-visible-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/layers/scroll-rect-to-visible-expected.png
new file mode 100644
index 0000000..4bc65a4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/layers/scroll-rect-to-visible-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/overflow/overflow-x-y-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/overflow/overflow-x-y-expected.png
new file mode 100644
index 0000000..d5fa9a9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/overflow/overflow-x-y-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/parser/open-comment-in-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/parser/open-comment-in-textarea-expected.png
new file mode 100644
index 0000000..7c35b86f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/parser/open-comment-in-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/repaint/delete-into-nested-block-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/repaint/delete-into-nested-block-expected.txt
new file mode 100644
index 0000000..3051fab
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/repaint/delete-into-nested-block-expected.txt
@@ -0,0 +1,57 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [8, 167, 784, 21],
+        [8, 167, 30, 20],
+        [8, 147, 784, 41],
+        [8, 147, 784, 21],
+        [8, 147, 23, 20],
+        [8, 127, 784, 40],
+        [8, 127, 784, 21],
+        [8, 127, 30, 20],
+        [8, 127, 22, 20],
+        [7, 126, 786, 103],
+        [7, 126, 3, 22]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow HTML",
+        "InlineTextBox 'one'",
+        "LayoutText #text",
+        "RootInlineBox",
+        "InlineTextBox 'two'",
+        "LayoutText #text",
+        "RootInlineBox",
+        "LayoutBlockFlow DIV",
+        "InlineTextBox 'three'",
+        "LayoutText #text",
+        "RootInlineBox",
+        "InlineTextBox '\n'",
+        "LayoutBR BR",
+        "RootInlineBox",
+        "LayoutBlockFlow DIV",
+        "LayoutBlockFlow DIV id='two'",
+        "InlineTextBox '\n'",
+        "RootInlineBox",
+        "InlineTextBox '\n'",
+        "LayoutBR BR",
+        "InlineTextBox 'three'",
+        "RootInlineBox",
+        "InlineTextBox 'three'",
+        "LayoutText #text",
+        "LayoutInline SPAN",
+        "RootInlineBox",
+        "LayoutBlockFlow DIV",
+        "LayoutBlockFlow DIV id='one'",
+        "LayoutText #text",
+        "InlineTextBox 'three'",
+        "LayoutBlockFlow DIV id='one'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/repaint/selection-after-remove-expected.txt b/third_party/WebKit/LayoutTests/platform/android/fast/repaint/selection-after-remove-expected.txt
new file mode 100644
index 0000000..be49fcdf
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/repaint/selection-after-remove-expected.txt
@@ -0,0 +1,57 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [71, 79, 35, 19],
+        [67, 159, 39, 19],
+        [39, 79, 142, 99],
+        [39, 79, 32, 19],
+        [38, 100, 152, 80],
+        [38, 99, 152, 81],
+        [38, 79, 152, 99],
+        [8, 79, 784, 99],
+        [8, 79, 784, 99]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow HTML",
+        "InlineTextBox 'world hello world'",
+        "InlineTextBox ' '",
+        "InlineTextBox 'hello world hello world'",
+        "InlineTextBox ' '",
+        "InlineTextBox 'hello world hello world'",
+        "InlineTextBox ' '",
+        "InlineTextBox 'hello world hello world'",
+        "InlineTextBox ' '",
+        "InlineTextBox 'hello'",
+        "LayoutText #text",
+        "LayoutInline SPAN id='removeme'",
+        "InlineTextBox 'hello '",
+        "RootInlineBox",
+        "RootInlineBox",
+        "RootInlineBox",
+        "RootInlineBox",
+        "InlineTextBox ' world'",
+        "InlineTextBox '\n'",
+        "RootInlineBox",
+        "LayoutBlockFlow HTML",
+        "LayoutBlockFlow BODY",
+        "LayoutBlockFlow DIV id='test'",
+        "LayoutBlockFlow DIV id='test'",
+        "LayoutBlockFlow DIV id='test'",
+        "LayoutText #text",
+        "InlineTextBox 'hello '",
+        "LayoutText #text",
+        "InlineTextBox 'world'",
+        "LayoutText #text",
+        "InlineTextBox 'world'",
+        "LayoutBR BR",
+        "InlineTextBox '\n'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-textarea-expected.png
new file mode 100644
index 0000000..61ff19ec
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/replaced/width100percent-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/android/fast/text/midword-break-before-surrogate-pair-expected.png
new file mode 100644
index 0000000..2c94a37c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/paint/selection/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/platform/android/paint/selection/selection-within-composited-scroller-expected.txt
new file mode 100644
index 0000000..6e6942a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/paint/selection/selection-within-composited-scroller-expected.txt
@@ -0,0 +1,78 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "paintInvalidationClients": [
+        "LayoutBlockFlow HTML",
+        "LayoutBlockFlow BODY"
+      ],
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [200, 200],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#D3D3D3",
+          "repaintRects": [
+            [0, 160, 21, 19]
+          ],
+          "paintInvalidationClients": [
+            "LayoutBlockFlow DIV id='scroller'",
+            "LayoutBlockFlow DIV id='target'",
+            "LayoutText #text",
+            "InlineTextBox 'test'"
+          ],
+          "children": [
+            {
+              "bounds": [185, 185],
+              "children": [
+                {
+                  "bounds": [200, 1620],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true,
+                  "repaintRects": [
+                    [0, 610, 21, 19]
+                  ],
+                  "paintInvalidationClients": [
+                    "LayoutBlockFlow DIV id='scroller'",
+                    "LayoutBlockFlow DIV id='target'",
+                    "LayoutText #text",
+                    "InlineTextBox 'test'"
+                  ],
+                  "children": [
+                    {
+                      "shouldFlattenTransform": false
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 185],
+                  "bounds": [185, 15],
+                  "drawsContent": true
+                },
+                {
+                  "position": [185, 0],
+                  "bounds": [15, 185],
+                  "drawsContent": true
+                },
+                {
+                  "position": [185, 185],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/android/paint/selection/text-selection-drag-expected.png b/third_party/WebKit/LayoutTests/platform/android/paint/selection/text-selection-drag-expected.png
new file mode 100644
index 0000000..23179258
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/paint/selection/text-selection-drag-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/paint/selection/text-selection-newline-br-expected.png b/third_party/WebKit/LayoutTests/platform/android/paint/selection/text-selection-newline-br-expected.png
new file mode 100644
index 0000000..ae94bee
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/paint/selection/text-selection-newline-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/svg/filters/feColorMatrix-invalid-animation-expected.txt b/third_party/WebKit/LayoutTests/platform/android/svg/filters/feColorMatrix-invalid-animation-expected.txt
new file mode 100644
index 0000000..c54d5c8a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/svg/filters/feColorMatrix-invalid-animation-expected.txt
@@ -0,0 +1,7 @@
+CONSOLE WARNING: SVG's SMIL animations (<animate>, <set>, etc.) are deprecated and will be removed. Please use CSS animations or Web animations instead.
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  LayoutSVGRoot {svg} at (0,0) size 100x100
+    LayoutSVGResourceFilter {filter} [id=""] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+    LayoutSVGRect {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/android/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
rename to third_party/WebKit/LayoutTests/platform/android/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.txt b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.txt
new file mode 100644
index 0000000..afda414
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.txt
@@ -0,0 +1,2 @@
+["LayoutBlockFlow (positioned) DIV",
+ "LayoutImage (positioned) IMG"]
\ No newline at end of file
diff --git a/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png
new file mode 100644
index 0000000..20c2d53
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.txt b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.txt
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.txt
@@ -0,0 +1 @@
+
diff --git a/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-within-composited-scroller-expected.txt
new file mode 100644
index 0000000..9daeafb9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/invalidation/spv2/selection-within-composited-scroller-expected.txt
@@ -0,0 +1 @@
+test
diff --git a/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/selection/text-selection-newline-br-expected.png b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/selection/text-selection-newline-br-expected.png
new file mode 100644
index 0000000..ae94bee
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/android/virtual/spv2/paint/selection/text-selection-newline-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux-x86/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/linux-x86/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
deleted file mode 100644
index 82f0392..0000000
--- a/third_party/WebKit/LayoutTests/platform/linux-x86/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux-x86/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/linux-x86/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
deleted file mode 100644
index 82f0392..0000000
--- a/third_party/WebKit/LayoutTests/platform/linux-x86/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/iframes/invisible-nested-iframe-show-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/iframes/invisible-nested-iframe-show-expected.txt
index 2593df88..4dbc934 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/iframes/invisible-nested-iframe-show-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/iframes/invisible-nested-iframe-show-expected.txt
@@ -79,8 +79,7 @@
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
+                  "bounds": [15, 150]
                 }
               ]
             }
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
index d888fc7..ff2a18fd 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
@@ -20,12 +20,7 @@
                 {
                   "bounds": [285, 800],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -33,13 +28,11 @@
               "children": [
                 {
                   "position": [1, 286],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [286, 1],
-                  "bounds": [15, 285],
-                  "drawsContent": true
+                  "bounds": [15, 285]
                 },
                 {
                   "position": [286, 286],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 920c00cce..058b91a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -47,13 +42,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -143,10 +136,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2658],
+  "bounds": [785, 2546],
   "children": [
     {
-      "bounds": [785, 2658],
+      "bounds": [785, 2546],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -163,12 +156,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -176,13 +164,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -272,10 +258,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4722],
+  "bounds": [785, 4498],
   "children": [
     {
-      "bounds": [785, 4722],
+      "bounds": [785, 4498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,15 +275,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -305,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -401,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6786],
+  "bounds": [785, 6402],
   "children": [
     {
-      "bounds": [785, 6786],
+      "bounds": [785, 6402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -418,14 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -433,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-expected.txt
index 10b4bbd..6f74aec 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2610],
+  "bounds": [785, 2498],
   "children": [
     {
-      "bounds": [785, 2610],
+      "bounds": [785, 2498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -157,15 +150,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -173,13 +158,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +252,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4674],
+  "bounds": [785, 4402],
   "children": [
     {
-      "bounds": [785, 4674],
+      "bounds": [785, 4402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -286,14 +269,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -301,13 +277,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 64ad064..2c91562 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2610],
+  "bounds": [785, 2498],
   "children": [
     {
-      "bounds": [785, 2610],
+      "bounds": [785, 2498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -160,12 +153,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -173,13 +161,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +255,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4674],
+  "bounds": [785, 4450],
   "children": [
     {
-      "bounds": [785, 4674],
+      "bounds": [785, 4450],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,12 +275,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -302,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -398,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6738],
+  "bounds": [785, 6402],
   "children": [
     {
-      "bounds": [785, 6738],
+      "bounds": [785, 6402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -415,15 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -431,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/textarea-scroll-touch-expected.txt
index 380b605..f9ac3308 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 328],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -34,8 +29,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
@@ -60,12 +54,7 @@
                 {
                   "bounds": [189, 328],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -73,8 +62,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
index 9010262c..08f6211 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='content'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -43,23 +38,15 @@
                 {
                   "position": [0, 485],
                   "bounds": [485, 15],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 485, 15]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
                   "position": [485, 0],
                   "bounds": [15, 485],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 485]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/linux/compositing/squashing/selection-repaint-with-gaps-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/compositing/squashing/selection-repaint-with-gaps-expected.txt
index e8a6a74..8f7d7ce1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/compositing/squashing/selection-repaint-with-gaps-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/compositing/squashing/selection-repaint-with-gaps-expected.txt
@@ -19,8 +19,7 @@
               "bounds": [100, 210],
               "drawsContent": true,
               "repaintRects": [
-                [34, 80, 6, 19],
-                [0, 80, 35, 39]
+                [0, 80, 38, 39]
               ]
             }
           ]
@@ -49,12 +48,8 @@
               "bounds": [100, 210],
               "drawsContent": true,
               "repaintRects": [
-                [34, 160, 6, 19],
-                [34, 80, 6, 39],
-                [34, 80, 6, 19],
-                [0, 160, 35, 39],
-                [0, 80, 100, 50],
-                [0, 80, 35, 39]
+                [0, 160, 38, 39],
+                [0, 80, 39, 39]
               ]
             }
           ]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-expected.txt
index 2c4545a2..66ffdf7f 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-expected.txt
@@ -61,7 +61,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-hw-expected.png b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-hw-expected.png
index 90547ba..522a240 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-hw-expected.txt
index c3a369e..185942a7 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-hw-expected.txt
@@ -61,7 +61,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-expected.txt
index 5165fe7..b7ba329 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-expected.txt
@@ -59,7 +59,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-hw-expected.png b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-hw-expected.png
index 79b5f7d..6b6ba9a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-hw-expected.txt
index 5165fe7..b7ba329 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-subregion-hw-expected.txt
@@ -59,7 +59,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-expected.txt
index 60b528f9..72301b7 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-expected.txt
@@ -7,19 +7,19 @@
         LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
           LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
       LayoutText {#text} at (0,95) size 4x19
         text run at (0,95) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-hw-expected.txt
index 60b528f9..72301b7 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/filters/effect-reference-tile-hw-expected.txt
@@ -7,19 +7,19 @@
         LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
           LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
       LayoutText {#text} at (0,95) size 4x19
         text run at (0,95) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/flexbox-baseline-margins-expected.png b/third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/flexbox-baseline-margins-expected.png
index c509f90..9dd50bc 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/flexbox-baseline-margins-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/css3/flexbox/flexbox-baseline-margins-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/deleting/delete-to-select-table-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/deleting/delete-to-select-table-expected.png
index 4794a69864..8e6f4b3 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/deleting/delete-to-select-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/deleting/delete-to-select-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/4916541-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/4916541-expected.png
index 0ef45731..71f7ced 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/4916541-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/4916541-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5136770-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5136770-expected.png
index a5cc583..d4ea74a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5136770-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5136770-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5142012-1-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5142012-1-expected.png
index 9b37d26e..cadcd446 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5142012-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5142012-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5190926-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5190926-expected.png
index f2bff53f..0fe8efd 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5190926-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5190926-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5481523-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5481523-expected.png
index 91045e2..19a4f2e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5481523-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/5481523-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/indent-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/indent-selection-expected.png
index ecf7bac..6a50a81 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/indent-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/indent-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/remove-list-from-range-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/remove-list-from-range-selection-expected.png
index bd2e11a..92ae20e3 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/remove-list-from-range-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/remove-list-from-range-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/selectAll-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/selectAll-expected.png
index f31625a4..1582aa6 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/selectAll-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/execCommand/selectAll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690703-2-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690703-2-expected.png
index 8829de4..2ef154bf 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690703-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690703-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690703-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690703-expected.png
index 6d1cdcd..fe3f347 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690703-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690703-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690719-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690719-expected.png
index 6d1cdcd..fe3f347 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690719-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/3690719-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/4818145-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/4818145-expected.png
index 7c8e6c9..f91fb81 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/4818145-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/4818145-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/4947387-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/4947387-expected.png
index 74644851..e0852f1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/4947387-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/4947387-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5057506-2-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5057506-2-expected.png
index 772f1e7..33e7e4a5fd1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5057506-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5057506-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5057506-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5057506-expected.png
index 0644321..c525e8a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5057506-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5057506-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5232159-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5232159-expected.png
index 7bc9e6f4..5ca3cd2 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5232159-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/5232159-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/7152-1-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/7152-1-expected.png
index 8ea14ae6..a94b8343 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/7152-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/7152-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/7152-2-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/7152-2-expected.png
index e8459d0..4655a05 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/7152-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/7152-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/doubleclick-crash-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/doubleclick-crash-expected.png
index 0286c35..6d3f567 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/doubleclick-crash-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/doubleclick-crash-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/doubleclick-crash-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/doubleclick-crash-expected.txt
new file mode 100644
index 0000000..dd3ea8c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/doubleclick-crash-expected.txt
@@ -0,0 +1,19 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 (0,0) size 800x587
+      LayoutBlockFlow {PRE} at (0,0) size 800x80
+        LayoutText {#text} at (0,0) size 40x64
+          text run at (0,0) width 40: "Test."
+          text run at (40,0) width 0: " "
+          text run at (0,16) width 40: "Test."
+          text run at (40,16) width 0: " "
+          text run at (0,32) width 0: " "
+          text run at (0,48) width 0: " "
+        LayoutText {#text} at (0,64) size 0x16
+          text run at (0,64) width 0: " "
+selection start: position 5 of child 0 {#text} of child 1 {PRE} of body
+selection end:   position 6 of child 0 {#text} of child 1 {PRE} of body
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-by-character-002-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-by-character-002-expected.png
index 6b80f8e..628bf76 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-by-character-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-by-character-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-by-character-003-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-by-character-003-expected.png
index d2481be..bb0a353a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-by-character-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-by-character-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-inside-transforms-backward-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-inside-transforms-backward-expected.png
index 0b17bcf..084a416 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-inside-transforms-backward-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-inside-transforms-backward-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-inside-transforms-forward-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-inside-transforms-forward-expected.png
index c858555b..7f72eea 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-inside-transforms-forward-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/extend-inside-transforms-forward-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/image-before-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/image-before-linebreak-expected.png
index a8002b0..61f5cad 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/image-before-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/image-before-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/linux_selection_color-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/linux_selection_color-expected.png
index aa4183c..5744951 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/linux_selection_color-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/linux_selection_color-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-6-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-6-expected.png
index 8894989..d435e3b 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-6-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-6-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-7-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-7-expected.png
index b2cdbc8..97b0b96 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-7-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/mixed-editability-7-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/node-removal-2-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/node-removal-2-expected.png
index d937a65b..301eedd 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/node-removal-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/node-removal-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/paragraph-granularity-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/paragraph-granularity-expected.png
index 29ce2f5..8254c294 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/paragraph-granularity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/paragraph-granularity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/range-between-block-and-inline-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/range-between-block-and-inline-expected.png
index 8d43ce2..6028aebaf3 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/range-between-block-and-inline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/range-between-block-and-inline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/replaced-boundaries-3-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/replaced-boundaries-3-expected.png
index 29e4ebc..4e2b3e8 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/replaced-boundaries-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/replaced-boundaries-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-001-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-001-expected.png
index 3cde902..61c93b2 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-002-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-002-expected.png
index 5ad4c87e..cd9bf3e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-003-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-003-expected.png
index d9da869c..70db71e1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-004-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-004-expected.png
index 98d0878..18e4965 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-all-004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-missing-image-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-missing-image-expected.png
index 3f36b60..4ebe2fa 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-missing-image-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/select-missing-image-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.png
index 0c522505..ff416aa 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-actions-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-button-text-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-button-text-expected.png
index 902b5ccb..256f1cd 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-button-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/selection-button-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/transformed-selection-rects-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/transformed-selection-rects-expected.png
index 6f907691f..83bdb19f 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/transformed-selection-rects-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/transformed-selection-rects-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
index 6fbc7d0..d181dc5d 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
index bd1df714c..121f72a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
index 2070dc35..139cdae8 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
index 2a4ade3..95d2224 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
index 0c7f1cf..139cdae8 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
index 26db023b..72a4337 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
index 1c5edcc..91099c5 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
index e6a51a8..72a4337 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
index 3d45014..4843f09a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
index 9284b50f8..f3c5f964 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
index 3d45014..4843f09a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
index 9284b50f8..f3c5f964 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/word-granularity-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/word-granularity-expected.png
index 606b85c..c3c3d0e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/selection/word-granularity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/selection/word-granularity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5017613-1-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5017613-1-expected.png
index b135ac0..595aa43 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5017613-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5017613-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5017613-2-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5017613-2-expected.png
index e3e2119..3677cbb 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5017613-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5017613-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5046875-1-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5046875-1-expected.png
index 105a15bb..32ab144 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5046875-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5046875-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5228141-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5228141-expected.png
index c459fa85..f7a8de78 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5228141-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5228141-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5279521-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5279521-expected.png
index 138115c..d13b1d9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/5279521-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/5279521-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/apple-style-editable-mix-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/apple-style-editable-mix-expected.png
index 05372f65..3d789031d9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/apple-style-editable-mix-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/apple-style-editable-mix-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/block-style-003-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/block-style-003-expected.png
index 83070a4..778cda71 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/block-style-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/block-style-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-005-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-005-expected.png
index 9288d38..deede97 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-006-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-006-expected.png
index 94526c2..e18e93e8 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-006-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-006-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-010-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-010-expected.png
index 7fd89a9..526110e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-010-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-010-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-011-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-011-expected.png
index 7c6462a..a68823e6 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-011-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-011-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-012-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-012-expected.png
index e138d06..3348ee6 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-012-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/create-block-for-style-012-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/relative-font-size-change-001-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/relative-font-size-change-001-expected.png
index fc0081a..525d35a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/relative-font-size-change-001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/relative-font-size-change-001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/relative-font-size-change-002-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/relative-font-size-change-002-expected.png
index 6d09334..35c50aa 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/relative-font-size-change-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/relative-font-size-change-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/style-3998892-fix-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/style-3998892-fix-expected.png
index 6b9b365..281f899 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/style-3998892-fix-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/style-3998892-fix-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/style-boundary-004-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/style-boundary-004-expected.png
index 40fb429..6515284 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/style-boundary-004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/style-boundary-004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/editing/style/table-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/editing/style/table-selection-expected.png
index 49e9847..87640df 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/editing/style/table-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/editing/style/table-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/selection-background-color-of-image-list-style-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
index 207757f..939ba43 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/selection-background-color-of-list-style-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/selection-background-color-of-list-style-expected.png
index f788ecda..8abb42c 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/selection-background-color-of-list-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/backgrounds/selection-background-color-of-list-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-textareas-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-textareas-expected.png
index ff18dbe..1bbbdfd 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-textareas-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-textareas-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-textareas-quirks-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-textareas-quirks-expected.png
index 058fceb..b757be3 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-textareas-quirks-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/basic-textareas-quirks-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/form-added-to-table-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/form-added-to-table-expected.png
index 25f8511..c044461 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/form-added-to-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/form-added-to-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.png
index 9f414af..018a2a0 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.txt
index 1adbdc72..828317e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/listbox-appearance-basic-expected.txt
@@ -5,20 +5,20 @@
     LayoutBlockFlow {BODY} at (8,8) size 769x611
       LayoutText {#text} at (46,59) size 4x19
         text run at (46,59) width 4: " "
-      LayoutText {#text} at (97,59) size 4x19
-        text run at (97,59) width 4: " "
+      LayoutText {#text} at (129,59) size 4x19
+        text run at (129,59) width 4: " "
       LayoutText {#text} at (0,0) size 0x0
-      LayoutText {#text} at (148,59) size 4x19
-        text run at (148,59) width 4: " "
-      LayoutText {#text} at (218,59) size 4x19
-        text run at (218,59) width 4: " "
-      LayoutText {#text} at (275,59) size 4x19
-        text run at (275,59) width 4: " "
-      LayoutText {#text} at (332,59) size 4x19
-        text run at (332,59) width 4: " "
-      LayoutText {#text} at (389,59) size 4x19
-        text run at (389,59) width 4: " "
-      LayoutBR {BR} at (393,59) size 0x19
+      LayoutText {#text} at (180,59) size 4x19
+        text run at (180,59) width 4: " "
+      LayoutText {#text} at (250,59) size 4x19
+        text run at (250,59) width 4: " "
+      LayoutText {#text} at (307,59) size 4x19
+        text run at (307,59) width 4: " "
+      LayoutText {#text} at (364,59) size 4x19
+        text run at (364,59) width 4: " "
+      LayoutText {#text} at (421,59) size 4x19
+        text run at (421,59) width 4: " "
+      LayoutBR {BR} at (425,59) size 0x19
       LayoutText {#text} at (50,142) size 4x19
         text run at (50,142) width 4: " "
       LayoutText {#text} at (100,142) size 4x19
@@ -49,24 +49,27 @@
     LayoutBlockFlow {OPTION} at (1,1) size 21x17
       LayoutText {#text} at (2,0) size 17x16
         text run at (2,0) width 17: "foo"
-layer at (62,12) size 39x70 clip at (63,13) size 22x68
-  LayoutListBox {SELECT} at (54,4) size 39x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
-    LayoutBlockFlow {OPTION} at (1,1) size 22x17 [color=#FFFFCC] [bgcolor=#0000FF]
+layer at (62,12) size 71x70 clip at (63,13) size 54x68
+  LayoutListBox {SELECT} at (54,4) size 71x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+    LayoutBlockFlow {OPTION} at (1,1) size 54x17 [color=#FFFFCC] [bgcolor=#0000FF]
       LayoutText {#text} at (2,0) size 17x16
         text run at (2,0) width 17: "foo"
-    LayoutBlockFlow {OPTION} at (1,18) size 22x17
+    LayoutBlockFlow {OPTION} at (1,18) size 54x17
       LayoutText {#text} at (2,0) size 18x16
         text run at (2,0) width 18: "bar"
-layer at (113,12) size 39x70 clip at (114,13) size 22x68
-  LayoutListBox {SELECT} at (105,4) size 39x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+    LayoutBlockFlow {OPTION} at (1,35) size 54x17 [color=#808080] [bgcolor=#999999]
+      LayoutText {#text} at (2,0) size 50x16
+        text run at (2,0) width 50: "Disabled"
+layer at (145,12) size 39x70 clip at (146,13) size 22x68
+  LayoutListBox {SELECT} at (137,4) size 39x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 22x17 [color=#FFFFFF] [bgcolor=#999999]
       LayoutText {#text} at (2,0) size 17x16
         text run at (2,0) width 17: "foo"
     LayoutBlockFlow {OPTION} at (1,18) size 22x17 [color=#808080] [bgcolor=#999999]
       LayoutText {#text} at (2,0) size 18x16
         text run at (2,0) width 18: "bar"
-layer at (164,12) size 58x70 clip at (165,13) size 41x68
-  LayoutListBox {SELECT} at (156,4) size 58x70 [color=#808080] [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+layer at (196,12) size 58x70 clip at (197,13) size 41x68
+  LayoutListBox {SELECT} at (188,4) size 58x70 [color=#808080] [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 41x17 [bgcolor=#999999]
       LayoutText {#text} at (2,0) size 17x16
         text run at (2,0) width 17: "foo"
@@ -81,8 +84,8 @@
             text run at (2,0) width 16: "    "
         LayoutText {#text} at (18,0) size 21x16
           text run at (18,0) width 21: "baz"
-layer at (234,63) size 45x19 clip at (235,64) size 28x17 scrollHeight 68
-  LayoutListBox {SELECT} at (226,55) size 45x19 [bgcolor=#C0C0C0] [border: (1px solid #A9A9A9)]
+layer at (266,63) size 45x19 clip at (267,64) size 28x17 scrollHeight 68
+  LayoutListBox {SELECT} at (258,55) size 45x19 [bgcolor=#C0C0C0] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo1"
@@ -95,8 +98,8 @@
     LayoutBlockFlow {OPTION} at (1,52) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo4"
-layer at (291,46) size 45x36 clip at (292,47) size 28x34 scrollHeight 68
-  LayoutListBox {SELECT} at (283,38) size 45x36 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+layer at (323,46) size 45x36 clip at (324,47) size 28x34 scrollHeight 68
+  LayoutListBox {SELECT} at (315,38) size 45x36 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo1"
@@ -109,8 +112,8 @@
     LayoutBlockFlow {OPTION} at (1,52) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo4"
-layer at (348,29) size 45x53 clip at (349,30) size 28x51 scrollHeight 68
-  LayoutListBox {SELECT} at (340,21) size 45x53 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+layer at (380,29) size 45x53 clip at (381,30) size 28x51 scrollHeight 68
+  LayoutListBox {SELECT} at (372,21) size 45x53 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo1"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/menulist-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/menulist-appearance-basic-expected.png
index 5762ce37..eea35ac 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/menulist-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/select/menulist-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/textarea-scrolled-focus-ring-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/textarea-scrolled-focus-ring-expected.png
index 5e284471..4f375670 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/forms/textarea-scrolled-focus-ring-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/forms/textarea-scrolled-focus-ring-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/layers/scroll-rect-to-visible-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/layers/scroll-rect-to-visible-expected.png
index 4bc65a4..743b9db 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/layers/scroll-rect-to-visible-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/layers/scroll-rect-to-visible-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/lists/markers-in-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/lists/markers-in-selection-expected.png
index 376ef30e..a795e3e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/lists/markers-in-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/lists/markers-in-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/image-selection-highlight-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/image-selection-highlight-expected.png
index e94f8b4b..d0822f52 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/image-selection-highlight-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/image-selection-highlight-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/overflow-x-y-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/overflow-x-y-expected.png
index d5fa9a9..b4ef7e20 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/overflow-x-y-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/overflow/overflow-x-y-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/parser/open-comment-in-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/parser/open-comment-in-textarea-expected.png
index 7c35b86f..96155120 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/parser/open-comment-in-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/parser/open-comment-in-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/delete-into-nested-block-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/delete-into-nested-block-expected.txt
index 3051fab..877fc43 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/delete-into-nested-block-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/delete-into-nested-block-expected.txt
@@ -11,7 +11,6 @@
         [8, 147, 784, 41],
         [8, 147, 784, 21],
         [8, 147, 23, 20],
-        [8, 127, 784, 40],
         [8, 127, 784, 21],
         [8, 127, 30, 20],
         [8, 127, 22, 20],
@@ -19,7 +18,6 @@
         [7, 126, 3, 22]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'one'",
         "LayoutText #text",
         "RootInlineBox",
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/japanese-rl-selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/japanese-rl-selection-clear-expected.txt
index 062be43..fc073db 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/japanese-rl-selection-clear-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/japanese-rl-selection-clear-expected.txt
@@ -6,11 +6,9 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [442, 123, 335, 399],
-        [442, 23, 335, 554]
+        [442, 123, 335, 399]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "LayoutText #text",
         "InlineTextBox '\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B'",
         "InlineTextBox '\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B'",
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/japanese-rl-selection-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/japanese-rl-selection-repaint-expected.txt
index 15065e95..dc8b6475 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/japanese-rl-selection-repaint-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/japanese-rl-selection-repaint-expected.txt
@@ -6,7 +6,6 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [562, 569, 215, 8],
         [538, 23, 239, 551]
       ],
       "paintInvalidationClients": [
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-after-delete-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-after-delete-expected.txt
index 0ba4132..c6d7ce9 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-after-delete-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-after-delete-expected.txt
@@ -10,8 +10,7 @@
         [38, 100, 152, 80],
         [38, 99, 152, 81],
         [38, 79, 152, 99],
-        [38, 78, 3, 21],
-        [8, 79, 784, 99]
+        [38, 78, 3, 21]
       ],
       "paintInvalidationClients": [
         "InlineTextBox 'hello world hello world'",
@@ -24,7 +23,6 @@
         "InlineTextBox ' '",
         "InlineTextBox 'hello'",
         "LayoutText #text",
-        "LayoutBlockFlow HTML",
         "RootInlineBox",
         "RootInlineBox",
         "RootInlineBox",
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-after-remove-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-after-remove-expected.txt
index be49fcdf..a4161be 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-after-remove-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-after-remove-expected.txt
@@ -12,12 +12,9 @@
         [39, 79, 32, 19],
         [38, 100, 152, 80],
         [38, 99, 152, 81],
-        [38, 79, 152, 99],
-        [8, 79, 784, 99],
-        [8, 79, 784, 99]
+        [38, 79, 152, 99]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'world hello world'",
         "InlineTextBox ' '",
         "InlineTextBox 'hello world hello world'",
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-clear-expected.txt
index af80b83..37d3098 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-clear-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-clear-expected.txt
@@ -8,16 +8,12 @@
       "repaintRects": [
         [8, 208, 100, 100],
         [8, 108, 100, 100],
-        [8, 48, 784, 160],
-        [8, 48, 784, 160],
-        [8, 48, 784, 60],
         [8, 48, 90, 119],
         [8, 48, 4, 19],
         [8, 8, 100, 200],
         [8, 8, 100, 100]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'FAIL: Test did'",
         "InlineTextBox 'not run'",
         "LayoutText #text",
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
index d8071f3..d7cb92a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
@@ -6,10 +6,9 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [11, 35, 70, 19],
-        [11, 34, 778, 22],
-        [11, 11, 51, 19],
-        [11, 10, 778, 22]
+        [11, 35, 74, 19],
+        [11, 11, 55, 19],
+        [11, 11, 51, 19]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow HTML",
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textarea-expected.png
index 61ff19ec..527148b 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/replaced/width100percent-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/ruby/select-ruby-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/ruby/select-ruby-expected.png
index 09843244e..8644f9b 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/ruby/select-ruby-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/ruby/select-ruby-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/midword-break-before-surrogate-pair-expected.png
index 2c94a37c..c4a0006 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/midword-break-before-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/midword-break-before-surrogate-pair-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/text/midword-break-before-surrogate-pair-expected.txt
index edd3b1fe..f0b8475 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/midword-break-before-surrogate-pair-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/midword-break-before-surrogate-pair-expected.txt
@@ -3,7 +3,19 @@
 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 186x92 [border: (3px solid #0000FF)]
-        LayoutText {#text} at (3,4) size 168x84
-          text run at (3,4) width 168: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
-          text run at (3,47) width 112: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,0) size 784x40
+        LayoutText {#text} at (0,0) size 768x39
+          text run at (0,0) width 768: "The following box should break the sequence of symbols at the 5 character mark and not overflow the blue box. This is because"
+          text run at (0,20) width 188: "U+1D49 is a number category "
+          text run at (188,20) width 279: "unicode character, for which break-all applies."
+      LayoutBlockFlow {DIV} at (0,56) size 186x104 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,3) size 175x98
+          text run at (3,3) width 175: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+          text run at (3,52) width 75: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,176) size 784x20
+        LayoutText {#text} at (0,0) size 732x19
+          text run at (0,0) width 505: "The following box should not break the sequence of symbols since U+1F1EF is not "
+          text run at (505,0) width 227: "a letter or number category character."
+      LayoutBlockFlow {DIV} at (0,212) size 186x55 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,3) size 464x49
+          text run at (3,3) width 464: "\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}"
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-hard-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-hard-linebreak-expected.png
index 6574c88..322e778 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-hard-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-hard-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-painting-hidpi-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-painting-hidpi-expected.png
new file mode 100644
index 0000000..984bed32
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-painting-hidpi-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-painting-hidpi-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-painting-hidpi-expected.txt
new file mode 100644
index 0000000..5f74367
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-painting-hidpi-expected.txt
@@ -0,0 +1,50 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x36
+  LayoutBlockFlow {HTML} at (0,0) size 800x36
+    LayoutBlockFlow {BODY} at (8,8) size 784x20
+      LayoutBlockFlow {DIV} at (0,0) size 285x20
+        LayoutInline {SPAN} at (0,0) size 35x19
+          LayoutText {#text} at (0,0) size 35x19
+            text run at (0,0) width 35: "There"
+        LayoutText {#text} at (35,0) size 4x19
+          text run at (35,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 39x19
+          LayoutText {#text} at (39,0) size 39x19
+            text run at (39,0) width 39: "should"
+        LayoutText {#text} at (78,0) size 4x19
+          text run at (78,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 15x19
+          LayoutText {#text} at (82,0) size 15x19
+            text run at (82,0) width 15: "be"
+        LayoutText {#text} at (97,0) size 4x19
+          text run at (97,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 15x19
+          LayoutText {#text} at (101,0) size 15x19
+            text run at (101,0) width 15: "no"
+        LayoutText {#text} at (116,0) size 4x19
+          text run at (116,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 32x19
+          LayoutText {#text} at (120,0) size 32x19
+            text run at (120,0) width 32: "white"
+        LayoutText {#text} at (152,0) size 4x19
+          text run at (152,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 28x19
+          LayoutText {#text} at (156,0) size 28x19
+            text run at (156,0) width 28: "gaps"
+        LayoutText {#text} at (184,0) size 4x19
+          text run at (184,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 51x19
+          LayoutText {#text} at (188,0) size 51x19
+            text run at (188,0) width 51: "between"
+        LayoutText {#text} at (239,0) size 4x19
+          text run at (239,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 38x19
+          LayoutText {#text} at (243,0) size 38x19
+            text run at (243,0) width 38: "words"
+        LayoutText {#text} at (281,0) size 4x19
+          text run at (281,0) width 4: "."
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutText {#text} at (0,0) size 0x0
+selection start: position 0 of child 0 {#text} of child 1 {SPAN} of child 1 {DIV} of body
+selection end:   position 1 of child 16 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-rect-rounding-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-rect-rounding-expected.png
index a5331c3..1ef7c2a3 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-rect-rounding-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/selection-rect-rounding-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/shaping/shaping-selection-rect-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/shaping/shaping-selection-rect-expected.png
index 62cfae95..3db7ef72 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/shaping/shaping-selection-rect-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/shaping/shaping-selection-rect-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/whitespace/pre-wrap-overflow-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
index 3d50a79d..aa73817 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
index b54a204b..b02d3c2 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/horizontal-bt-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
index 6bbb775..79987f13 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/japanese-lr-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/japanese-lr-selection-expected.png
index 2bef8e4..dca7d414c 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/japanese-lr-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/japanese-lr-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/japanese-rl-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/japanese-rl-selection-expected.png
index 3d1a158..e67ae06 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/japanese-rl-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/japanese-rl-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/vertical-lr-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/vertical-lr-replaced-selection-expected.png
index e47bbd5d..3efda2a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/vertical-lr-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/vertical-lr-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/vertical-rl-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/vertical-rl-replaced-selection-expected.png
index fe4354e..a250f06 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/vertical-rl-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/fast/writing-mode/vertical-rl-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/paint/selection/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/paint/selection/selection-within-composited-scroller-expected.txt
index 6e6942a..56f7d2e 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/paint/selection/selection-within-composited-scroller-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/paint/selection/selection-within-composited-scroller-expected.txt
@@ -41,11 +41,6 @@
                     "LayoutBlockFlow DIV id='target'",
                     "LayoutText #text",
                     "InlineTextBox 'test'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -54,13 +49,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/svg/text/foreignObject-text-clipping-bug-expected.png b/third_party/WebKit/LayoutTests/platform/linux/svg/text/foreignObject-text-clipping-bug-expected.png
index 7633aa6..e6169a3 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/svg/text/foreignObject-text-clipping-bug-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/linux/svg/text/foreignObject-text-clipping-bug-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 920c00cce..058b91a 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -47,13 +42,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -143,10 +136,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2658],
+  "bounds": [785, 2546],
   "children": [
     {
-      "bounds": [785, 2658],
+      "bounds": [785, 2546],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -163,12 +156,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -176,13 +164,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -272,10 +258,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4722],
+  "bounds": [785, 4498],
   "children": [
     {
-      "bounds": [785, 4722],
+      "bounds": [785, 4498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,15 +275,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -305,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -401,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6786],
+  "bounds": [785, 6402],
   "children": [
     {
-      "bounds": [785, 6786],
+      "bounds": [785, 6402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -418,14 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -433,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
index 10b4bbd..6f74aec 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2610],
+  "bounds": [785, 2498],
   "children": [
     {
-      "bounds": [785, 2610],
+      "bounds": [785, 2498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -157,15 +150,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -173,13 +158,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +252,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4674],
+  "bounds": [785, 4402],
   "children": [
     {
-      "bounds": [785, 4674],
+      "bounds": [785, 4402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -286,14 +269,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -301,13 +277,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 64ad064..2c91562 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2610],
+  "bounds": [785, 2498],
   "children": [
     {
-      "bounds": [785, 2610],
+      "bounds": [785, 2498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -160,12 +153,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -173,13 +161,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +255,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4674],
+  "bounds": [785, 4450],
   "children": [
     {
-      "bounds": [785, 4674],
+      "bounds": [785, 4450],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,12 +275,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -302,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -398,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6738],
+  "bounds": [785, 6402],
   "children": [
     {
-      "bounds": [785, 6738],
+      "bounds": [785, 6402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -415,15 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -431,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
index 7b4a438..1abe5f1 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
@@ -193,11 +193,6 @@
                     "InlineTextBox '\n'",
                     "InlineTextBox '  Text'",
                     "InlineTextBox '\n'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -206,13 +201,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
index 59761dc..d0973db 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
@@ -74,11 +74,6 @@
                     "InlineTextBox 'Findme in a typewriter!'",
                     "LayoutSVGInlineText #text",
                     "InlineTextBox 'Findme on a path! Did you findme?'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -87,13 +82,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [785, 15],
-                  "drawsContent": true
+                  "bounds": [785, 15]
                 },
                 {
                   "position": [785, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [785, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
index 380b605..f9ac3308 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 328],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -34,8 +29,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
@@ -60,12 +54,7 @@
                 {
                   "bounds": [189, 328],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -73,8 +62,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
index 93f12ef..ce6d6bd 100644
--- a/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
@@ -103,11 +103,6 @@
                     "InlineTextBox 'CONTENT'",
                     "LayoutText #text",
                     "InlineTextBox 'CONTENT'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -116,13 +111,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png
new file mode 100644
index 0000000..fac21c3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt b/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt
new file mode 100644
index 0000000..dd184de6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt
@@ -0,0 +1 @@
+["LayoutImage (positioned) IMG"]
diff --git a/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png b/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png
new file mode 100644
index 0000000..a4b8a61
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/linux/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
deleted file mode 100644
index 7508985..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
deleted file mode 100644
index 7508985..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690703-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690703-2-expected.png
index 9306ef7..4f61e20 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690703-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690703-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690703-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690703-expected.png
index 65dd8457..5247aef 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690703-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690703-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690719-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690719-expected.png
index 65dd8457..5247aef 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690719-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/3690719-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/replaced-boundaries-3-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/replaced-boundaries-3-expected.png
index 2da3c964..edae342 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/replaced-boundaries-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/replaced-boundaries-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/selection-button-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/selection-button-text-expected.png
index 0f9cd56..469b9aa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/selection-button-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/editing/selection/selection-button-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/forms/select/listbox-appearance-basic-expected.png
index 9a0c7f9..f6f559c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/forms/select/listbox-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/forms/select/listbox-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/emphasis-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/emphasis-expected.png
index d182026..882e0a260 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/emphasis-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/emphasis-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/midword-break-before-surrogate-pair-expected.png
index 07429a544..20b2ed2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/midword-break-before-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/selection-hard-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/selection-hard-linebreak-expected.png
index 95a2342..b7221325 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/selection-hard-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/selection-hard-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/selection-painting-hidpi-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/selection-painting-hidpi-expected.png
new file mode 100644
index 0000000..1cc2290
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/selection-painting-hidpi-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/shaping/shaping-selection-rect-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/shaping/shaping-selection-rect-expected.png
index c2cbd91..ef02652 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/shaping/shaping-selection-rect-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/shaping/shaping-selection-rect-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/whitespace/pre-wrap-overflow-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
index 97f4ce4..84bde01 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
index 6cb138b6..fadc230 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-lion/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/compositing/overflow/textarea-scroll-touch-expected.txt
index 6c77462..a473b6cf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 308],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -59,12 +54,7 @@
                 {
                   "bounds": [189, 308],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/pasteboard/4641033-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/pasteboard/4641033-expected.txt
new file mode 100644
index 0000000..cd9249cb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/pasteboard/4641033-expected.txt
@@ -0,0 +1,33 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
+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 {P} at (0,0) size 784x36
+        LayoutText {#text} at (0,0) size 783x36
+          text run at (0,0) width 673: "This tests for a bug when creating markup for a selection that contained unrendered nodes with children. "
+          text run at (672,0) width 111: "You should see a"
+          text run at (0,18) width 253: "picture of abe followed by a select box."
+      LayoutBlockFlow {DIV} at (0,52) size 784x108
+        LayoutImage {IMG} at (0,0) size 76x103
+        LayoutText {#text} at (76,89) size 4x18
+          text run at (76,89) width 4: " "
+        LayoutMenuList {SELECT} at (80,90) size 52x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 52x18
+            LayoutText (anonymous) at (8,2) size 7x13
+              text run at (8,2) width 7: "1"
+      LayoutBlockFlow (anonymous) at (0,160) size 784x108
+        LayoutImage {IMG} at (0,0) size 76x103
+        LayoutText {#text} at (76,89) size 4x18
+          text run at (76,89) width 4: " "
+        LayoutMenuList {SELECT} at (80,90) size 52x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 52x18
+            LayoutText (anonymous) at (8,2) size 7x13
+              text run at (8,2) width 7: "1"
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutText {#text} at (0,0) size 0x0
+caret: position 1 of child 2 {SELECT} of child 2 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690703-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690703-2-expected.png
index 66d967c..b513e40 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690703-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690703-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690703-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690703-expected.png
index 32ecabe3..9f3d77c5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690703-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690703-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690719-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690719-expected.png
index 32ecabe3..9f3d77c5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690719-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/3690719-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/caret-before-select-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/caret-before-select-expected.txt
new file mode 100644
index 0000000..68a7c15
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/caret-before-select-expected.txt
@@ -0,0 +1,13 @@
+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 784x93 [border: (5px solid #FF0000)]
+        LayoutMenuList {SELECT} at (37,38) size 53x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 53x18
+            LayoutText (anonymous) at (8,2) size 22x13
+              text run at (8,2) width 22: "One"
+        LayoutText {#text} at (90,37) size 27x18
+          text run at (90,37) width 27: "blaa"
+caret: position 0 of child 0 {SELECT} of child 0 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/replaced-boundaries-3-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/replaced-boundaries-3-expected.png
index e45d859..29c1eb9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/replaced-boundaries-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/replaced-boundaries-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/replaced-boundaries-3-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/replaced-boundaries-3-expected.txt
new file mode 100644
index 0000000..93b55fc6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/replaced-boundaries-3-expected.txt
@@ -0,0 +1,24 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 {P} at (0,0) size 784x36
+        LayoutText {#text} at (0,0) size 777x36
+          text run at (0,0) width 777: "This tests that when a selection that ends at [replaced element, 0] is painted, the replaced element doesn't appear selected."
+          text run at (0,18) width 329: "This test uses a select box for the replaced element."
+      LayoutBlockFlow {DIV} at (0,52) size 784x36
+        LayoutText {#text} at (0,0) size 23x18
+          text run at (0,0) width 23: "abc"
+        LayoutBR {BR} at (22,14) size 1x0
+        LayoutMenuList {SELECT} at (0,18) size 226x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 226x18
+            LayoutText (anonymous) at (8,2) size 195x13
+              text run at (8,2) width 195: "this select box shouldn't be selected"
+        LayoutText {#text} at (0,0) size 0x0
+selection start: position 1 of child 0 {#text} of child 3 {DIV} of body
+selection end:   position 1 of child 1 {BR} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/selection-button-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/selection-button-text-expected.png
index cf8a851..01f7317 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/selection-button-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/selection-button-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
index 19a485f..22b784b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
index 057b650e3..bafff698 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
index 0bb8c06..81bac5f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
index 4b12c7c..e8ae425d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
index a744e8cb..81bac5f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
index 788c303..81fb350 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
index 81e0500..c45a2e53 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
index ad2b874..81fb350 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/spelling/input-type-text-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/spelling/input-type-text-expected.txt
new file mode 100644
index 0000000..1295c1a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/editing/spelling/input-type-text-expected.txt
@@ -0,0 +1,13 @@
+Spell check selects the misspelled word on context click in an input field. To test manually, type 'wellcome home.' and context-click on 'wellcome'. The test succeeds when 'wellcome' is selected after the context click.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.getSelection().toString() is "wellcome"
+PASS window.getSelection().toString() is ""
+PASS window.getSelection().toString() is "wellcome"
+PASS window.getSelection().toString() is "home"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/002-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/002-expected.txt
new file mode 100644
index 0000000..b38ed0e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/002-expected.txt
@@ -0,0 +1,15 @@
+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 (floating) {DIV} at (0,0) size 156x24 [border: (2px solid #FF0000)]
+        LayoutBlockFlow {INPUT} at (2,2) size 152x20
+        LayoutText {#text} at (0,0) size 0x0
+layer at (10,10) size 152x20 clip at (11,11) size 150x18
+  LayoutBlockFlow {DIV} at (0,0) size 152x20 [border: (1px solid #C0C0C0)]
+    LayoutImage (floating) {IMG} at (2,2) size 16x16
+layer at (28,12) size 132x13
+  LayoutBlockFlow {DIV} at (18,2) size 132x13
+    LayoutText {#text} at (0,0) size 38x13
+      text run at (0,0) width 38: "Submit"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/005-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/005-expected.txt
new file mode 100644
index 0000000..9c0fb69
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/005-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
+      LayoutTable {TABLE} at (0,0) size 44x54
+        LayoutTableSection {TBODY} at (0,0) size 44x54
+          LayoutTableRow {TR} at (0,0) size 44x54
+            LayoutTableCell {TD} at (0,0) size 44x54 [r=0 c=0 rs=1 cs=1]
+              LayoutBlockFlow {INPUT} at (2,2) size 40x50
+              LayoutText {#text} at (0,0) size 0x0
+layer at (10,10) size 40x50 clip at (11,11) size 38x48
+  LayoutBlockFlow {DIV} at (0,0) size 40x50 [border: (1px solid #C0C0C0)]
+layer at (12,12) size 36x13 scrollWidth 37
+  LayoutBlockFlow {DIV} at (2,2) size 36x13
+    LayoutText {#text} at (0,0) size 38x13
+      text run at (0,0) width 38: "Submit"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.txt
deleted file mode 100644
index 6d9f499..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.txt
+++ /dev/null
@@ -1,21 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "repaintRects": [
-        [3, 4, 55, 29]
-      ],
-      "paintInvalidationClients": [
-        "LayoutButton BUTTON",
-        "LayoutBlockFlow (anonymous)",
-        "LayoutText #text",
-        "InlineTextBox 'Reset'",
-        "LayoutButton BUTTON"
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/floating-textfield-relayout-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/floating-textfield-relayout-expected.txt
new file mode 100644
index 0000000..89e89a0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/floating-textfield-relayout-expected.txt
@@ -0,0 +1,26 @@
+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 {P} at (0,0) size 784x36
+        LayoutText {#text} at (0,0) size 108x18
+          text run at (0,0) width 108: "This is a test for "
+        LayoutInline {I} at (0,0) size 764x36
+          LayoutInline {A} at (0,0) size 354x18 [color=#0000EE]
+            LayoutText {#text} at (107,0) size 354x18
+              text run at (107,0) width 354: "http://bugzilla.opendarwin.org/show_bug.cgi?id=9316"
+          LayoutText {#text} at (460,0) size 764x36
+            text run at (460,0) width 5: " "
+            text run at (464,0) width 300: "REGRESSION: text field width shrinks on first"
+            text run at (0,18) width 61: "keystroke"
+        LayoutText {#text} at (60,18) size 5x18
+          text run at (60,18) width 5: "."
+      LayoutBlockFlow {HR} at (0,52) size 784x2 [border: (1px inset #EEEEEE)]
+layer at (8,70) size 784x0
+  LayoutBlockFlow (relative positioned) {DIV} at (0,62) size 784x0
+    LayoutTextControl (floating) {INPUT} at (0,0) size 392x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+layer at (11,73) size 386x13
+  LayoutBlockFlow {DIV} at (3,3) size 386x13
+    LayoutText {#text} at (0,0) size 18x13
+      text run at (0,0) width 18: "foo"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/menulist-narrow-width-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/menulist-narrow-width-expected.png
new file mode 100644
index 0000000..56d01c6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/menulist-narrow-width-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/menulist-narrow-width-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/menulist-narrow-width-expected.txt
new file mode 100644
index 0000000..91bb6f86
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/menulist-narrow-width-expected.txt
@@ -0,0 +1,18 @@
+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
+      LayoutText {#text} at (0,0) size 511x18
+        text run at (0,0) width 511: "This tests that select elements with a narrow width (1px) are rendered correctly."
+      LayoutBR {BR} at (510,14) size 1x0
+      LayoutMenuList {SELECT} at (0,18) size 1x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 31x18
+          LayoutText (anonymous) at (8,2) size 20x13
+            text run at (8,2) width 20: "test"
+      LayoutBR {BR} at (1,31) size 0x0
+      LayoutMenuList {SELECT} at (0,36) size 2x18 [bgcolor=#0000FF] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 29x16
+          LayoutText (anonymous) at (8,1) size 20x13
+            text run at (8,1) width 20: "test"
+      LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/fast/forms/onselect-textarea-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/onselect-textarea-expected.txt
similarity index 100%
rename from third_party/WebKit/LayoutTests/fast/forms/onselect-textarea-expected.txt
rename to third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/onselect-textarea-expected.txt
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-dirty-parent-pref-widths-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-dirty-parent-pref-widths-expected.txt
new file mode 100644
index 0000000..baea997b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-dirty-parent-pref-widths-expected.txt
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x87
+  LayoutBlockFlow {HTML} at (0,0) size 800x87
+    LayoutBlockFlow {BODY} at (8,8) size 784x63
+      LayoutTable {TABLE} at (0,0) size 61x29 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 59x27
+          LayoutTableRow {TR} at (0,2) size 59x23
+            LayoutTableCell {TD} at (2,2) size 55x23 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutMenuList {SELECT} at (2,3) size 51x18 [bgcolor=#F8F8F8]
+                LayoutBlockFlow (anonymous) at (0,0) size 51x18
+                  LayoutText (anonymous) at (8,2) size 20x13
+                    text run at (8,2) width 20: "test"
+      LayoutBlockFlow {P} at (0,45) size 784x18
+        LayoutText {#text} at (0,0) size 459x18
+          text run at (0,0) width 459: "The select element in the table above must not spill outside of the table."
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-size-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-size-expected.txt
new file mode 100644
index 0000000..0472196
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-size-expected.txt
@@ -0,0 +1,14 @@
+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
+      LayoutText {#text} at (0,0) size 782x36
+        text run at (0,0) width 782: "This tests that a malformed size attribute will be parsed and corrected so that the right size attribute value is used to match"
+        text run at (0,18) width 441: "the style rule that determines whether to use a menu list or a list box."
+      LayoutBR {BR} at (440,32) size 1x0
+      LayoutMenuList {SELECT} at (0,36) size 51x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 51x18
+          LayoutText (anonymous) at (8,2) size 20x13
+            text run at (8,2) width 20: "test"
+      LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-style-expected.txt
new file mode 100644
index 0000000..3fe3f1f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select-style-expected.txt
@@ -0,0 +1,73 @@
+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
+      LayoutText {#text} at (0,0) size 566x18
+        text run at (0,0) width 256: "This tests that styled popups look right. "
+        text run at (255,0) width 311: "(Aqua for now- later, we will honor the styling)."
+      LayoutBR {BR} at (565,14) size 1x0
+      LayoutMenuList {SELECT} at (0,19) size 51x18 [bgcolor=#FF0000] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 49x16
+          LayoutText (anonymous) at (8,1) size 20x13
+            text run at (8,1) width 20: "test"
+      LayoutText {#text} at (51,18) size 4x18
+        text run at (51,18) width 4: " "
+      LayoutBR {BR} at (55,32) size 0x0
+      LayoutText {#text} at (0,37) size 541x18
+        text run at (0,37) width 541: "This tests that background color is white by default regardless of the parent element."
+      LayoutBR {BR} at (540,51) size 1x0
+      LayoutInline {SPAN} at (0,0) size 65x28 [bgcolor=#FF0000]
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutMenuList {SELECT} at (5,56) size 51x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 51x18
+            LayoutText (anonymous) at (8,2) size 20x13
+              text run at (8,2) width 20: "test"
+        LayoutText {#text} at (56,55) size 4x18
+          text run at (56,55) width 4: " "
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutBR {BR} at (0,0) size 0x0
+      LayoutText {#text} at (0,74) size 642x18
+        text run at (0,74) width 642: "This tests that background color is inherited from the parent if background-color:inherit is specified."
+      LayoutBR {BR} at (641,88) size 1x0
+      LayoutInline {SPAN} at (0,0) size 65x28 [bgcolor=#FF0000]
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutMenuList {SELECT} at (5,93) size 51x18 [border: (1px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (1,1) size 49x16
+            LayoutText (anonymous) at (8,1) size 20x13
+              text run at (8,1) width 20: "test"
+        LayoutText {#text} at (56,92) size 4x18
+          text run at (56,92) width 4: " "
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutBR {BR} at (0,0) size 0x0
+      LayoutText {#text} at (0,111) size 653x18
+        text run at (0,111) width 653: "This tests that background color is the same as the parent if background-color:transparent is specified."
+      LayoutBR {BR} at (652,125) size 1x0
+      LayoutInline {SPAN} at (0,0) size 65x28 [bgcolor=#FF0000]
+        LayoutText {#text} at (0,0) size 0x0
+        LayoutMenuList {SELECT} at (5,130) size 51x18 [border: (1px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (1,1) size 49x16
+            LayoutText (anonymous) at (8,1) size 20x13
+              text run at (8,1) width 20: "test"
+        LayoutText {#text} at (56,129) size 4x18
+          text run at (56,129) width 4: " "
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutBR {BR} at (0,0) size 0x0
+      LayoutText {#text} at (0,148) size 509x18
+        text run at (0,148) width 509: "This tests that background is white if only background-image:none is specified."
+      LayoutBR {BR} at (508,162) size 1x0
+      LayoutMenuList {SELECT} at (0,167) size 51x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 51x18
+          LayoutText (anonymous) at (8,2) size 20x13
+            text run at (8,2) width 20: "test"
+      LayoutText {#text} at (51,166) size 4x18
+        text run at (51,166) width 4: " "
+      LayoutBR {BR} at (55,180) size 0x0
+      LayoutText {#text} at (0,185) size 430x18
+        text run at (0,185) width 430: "This tests that the image specified for background-image is visible."
+      LayoutBR {BR} at (429,199) size 1x0
+      LayoutMenuList {SELECT} at (0,203) size 51x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 49x16
+          LayoutText (anonymous) at (8,1) size 20x13
+            text run at (8,1) width 20: "test"
+      LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select/listbox-appearance-basic-expected.png
index 82e4c635..3c118cd 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select/listbox-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select/listbox-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select/listbox-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select/listbox-appearance-basic-expected.txt
index 938bb43..6398f04 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select/listbox-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/select/listbox-appearance-basic-expected.txt
@@ -5,20 +5,20 @@
     LayoutBlockFlow {BODY} at (8,8) size 784x535
       LayoutText {#text} at (42,49) size 5x18
         text run at (42,49) width 5: " "
-      LayoutText {#text} at (89,49) size 5x18
-        text run at (89,49) width 5: " "
+      LayoutText {#text} at (117,49) size 5x18
+        text run at (117,49) width 5: " "
       LayoutText {#text} at (0,0) size 0x0
-      LayoutText {#text} at (135,49) size 5x18
-        text run at (135,49) width 5: " "
-      LayoutText {#text} at (197,49) size 5x18
-        text run at (197,49) width 5: " "
-      LayoutText {#text} at (251,49) size 5x18
-        text run at (251,49) width 5: " "
-      LayoutText {#text} at (304,49) size 5x18
-        text run at (304,49) width 5: " "
-      LayoutText {#text} at (358,49) size 5x18
-        text run at (358,49) width 5: " "
-      LayoutBR {BR} at (362,49) size 1x18
+      LayoutText {#text} at (164,49) size 5x18
+        text run at (164,49) width 5: " "
+      LayoutText {#text} at (226,49) size 5x18
+        text run at (226,49) width 5: " "
+      LayoutText {#text} at (280,49) size 5x18
+        text run at (280,49) width 5: " "
+      LayoutText {#text} at (333,49) size 5x18
+        text run at (333,49) width 5: " "
+      LayoutText {#text} at (387,49) size 5x18
+        text run at (387,49) width 5: " "
+      LayoutBR {BR} at (391,49) size 1x18
       LayoutText {#text} at (46,120) size 5x18
         text run at (46,120) width 5: " "
       LayoutText {#text} at (93,120) size 5x18
@@ -49,24 +49,27 @@
     LayoutBlockFlow {OPTION} at (1,1) size 21.56x14.19
       LayoutText {#text} at (2,0) size 18x13
         text run at (2,0) width 18: "foo"
-layer at (59,12) size 34x59 clip at (60,13) size 21x57 scrollHeight 56
-  LayoutListBox {SELECT} at (50.56,4.25) size 34.56x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 21.56x14.19 [color=#FFFFFF] [bgcolor=#3875D7]
+layer at (59,12) size 63x59 clip at (60,13) size 50x57 scrollHeight 56
+  LayoutListBox {SELECT} at (50.56,4.25) size 63.27x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 50.27x14.19 [color=#FFFFFF] [bgcolor=#3875D7]
       LayoutText {#text} at (2,0) size 18x13
         text run at (2,0) width 18: "foo"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 21.56x14.19
+    LayoutBlockFlow {OPTION} at (1,15.19) size 50.27x14.19
       LayoutText {#text} at (2,0) size 18x13
         text run at (2,0) width 18: "bar"
-layer at (105,12) size 35x59 clip at (106,13) size 22x57 scrollHeight 56
-  LayoutListBox {SELECT} at (97.13,4.25) size 34.56x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,29.38) size 50.27x14.19 [color=#808080] [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 47x13
+        text run at (2,0) width 47: "Disabled"
+layer at (134,12) size 34x59 clip at (135,13) size 21x57 scrollHeight 56
+  LayoutListBox {SELECT} at (125.83,4.25) size 34.56x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 21.56x14.19 [bgcolor=#D4D4D4]
       LayoutText {#text} at (2,0) size 18x13
         text run at (2,0) width 18: "foo"
     LayoutBlockFlow {OPTION} at (1,15.19) size 21.56x14.19 [color=#808080] [bgcolor=#D4D4D4]
       LayoutText {#text} at (2,0) size 18x13
         text run at (2,0) width 18: "bar"
-layer at (152,12) size 50x59 clip at (153,13) size 37x57 scrollHeight 56
-  LayoutListBox {SELECT} at (143.69,4.25) size 50.23x58.75 [color=#7F7F7F] [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+layer at (180,12) size 51x59 clip at (181,13) size 38x57 scrollHeight 56
+  LayoutListBox {SELECT} at (172.39,4.25) size 50.23x58.75 [color=#7F7F7F] [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 37.23x14.19 [color=#808080] [bgcolor=#D4D4D4]
       LayoutText {#text} at (2,0) size 18x13
         text run at (2,0) width 18: "foo"
@@ -81,8 +84,8 @@
             text run at (2,0) width 14: "    "
         LayoutText {#text} at (15,0) size 21x13
           text run at (15,0) width 21: "baz"
-layer at (214,55) size 41x16 clip at (215,56) size 28x14 scrollHeight 56
-  LayoutListBox {SELECT} at (205.92,46.81) size 41.52x16.19 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+layer at (243,55) size 41x16 clip at (244,56) size 28x14 scrollHeight 56
+  LayoutListBox {SELECT} at (234.63,46.81) size 41.52x16.19 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 28.52x14.19
       LayoutText {#text} at (2,0) size 25x13
         text run at (2,0) width 25: "foo1"
@@ -95,8 +98,8 @@
     LayoutBlockFlow {OPTION} at (1,43.56) size 28.52x14.19
       LayoutText {#text} at (2,0) size 25x13
         text run at (2,0) width 25: "foo4"
-layer at (267,41) size 42x30 clip at (268,42) size 29x28 scrollHeight 56
-  LayoutListBox {SELECT} at (259.44,32.63) size 41.52x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+layer at (296,41) size 42x30 clip at (297,42) size 29x28 scrollHeight 56
+  LayoutListBox {SELECT} at (288.14,32.63) size 41.52x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 28.52x14.19
       LayoutText {#text} at (2,0) size 25x13
         text run at (2,0) width 25: "foo1"
@@ -109,8 +112,8 @@
     LayoutBlockFlow {OPTION} at (1,43.56) size 28.52x14.19
       LayoutText {#text} at (2,0) size 25x13
         text run at (2,0) width 25: "foo4"
-layer at (321,26) size 41x45 clip at (322,27) size 28x43 scrollHeight 56
-  LayoutListBox {SELECT} at (312.95,18.44) size 41.52x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+layer at (350,26) size 41x45 clip at (351,27) size 28x43 scrollHeight 56
+  LayoutListBox {SELECT} at (341.66,18.44) size 41.52x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 28.52x14.19
       LayoutText {#text} at (2,0) size 25x13
         text run at (2,0) width 25: "foo1"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.txt
new file mode 100644
index 0000000..f48b2d7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.txt
@@ -0,0 +1,21 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [3, 4, 64, 29]
+      ],
+      "paintInvalidationClients": [
+        "LayoutButton INPUT",
+        "LayoutBlockFlow (anonymous)",
+        "LayoutText #text",
+        "InlineTextBox 'Submit'",
+        "LayoutButton INPUT"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/textarea-scroll-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/textarea-scroll-height-expected.txt
new file mode 100644
index 0000000..8c50160
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/forms/textarea-scroll-height-expected.txt
@@ -0,0 +1,68 @@
+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
+      LayoutText {#text} at (200,186) size 4x18
+        text run at (200,186) width 4: " "
+      LayoutText {#text} at (204,186) size 52x18
+        text run at (204,186) width 52: "183 316"
+layer at (8,8) size 200x200 clip at (9,9) size 183x198 scrollHeight 316
+  LayoutTextControl {TEXTAREA} at (0,0) size 200x200 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 179x312
+      LayoutText {#text} at (0,0) size 84x13
+        text run at (0,0) width 84: "Lots of content."
+      LayoutBR {BR} at (83,11) size 1x0
+      LayoutText {#text} at (0,13) size 84x13
+        text run at (0,13) width 84: "Lots of content."
+      LayoutBR {BR} at (83,24) size 1x0
+      LayoutText {#text} at (0,26) size 84x13
+        text run at (0,26) width 84: "Lots of content."
+      LayoutBR {BR} at (83,37) size 1x0
+      LayoutText {#text} at (0,39) size 84x13
+        text run at (0,39) width 84: "Lots of content."
+      LayoutBR {BR} at (83,50) size 1x0
+      LayoutBR {BR} at (0,52) size 0x13
+      LayoutText {#text} at (0,65) size 84x13
+        text run at (0,65) width 84: "Lots of content."
+      LayoutBR {BR} at (83,76) size 1x0
+      LayoutText {#text} at (0,78) size 84x13
+        text run at (0,78) width 84: "Lots of content."
+      LayoutBR {BR} at (83,89) size 1x0
+      LayoutBR {BR} at (0,91) size 0x13
+      LayoutText {#text} at (0,104) size 84x13
+        text run at (0,104) width 84: "Lots of content."
+      LayoutBR {BR} at (83,115) size 1x0
+      LayoutText {#text} at (0,117) size 84x13
+        text run at (0,117) width 84: "Lots of content."
+      LayoutBR {BR} at (83,128) size 1x0
+      LayoutBR {BR} at (0,130) size 0x13
+      LayoutText {#text} at (0,143) size 84x13
+        text run at (0,143) width 84: "Lots of content."
+      LayoutBR {BR} at (83,154) size 1x0
+      LayoutText {#text} at (0,156) size 84x13
+        text run at (0,156) width 84: "Lots of content."
+      LayoutBR {BR} at (83,167) size 1x0
+      LayoutBR {BR} at (0,169) size 0x13
+      LayoutText {#text} at (0,182) size 84x13
+        text run at (0,182) width 84: "Lots of content."
+      LayoutBR {BR} at (83,193) size 1x0
+      LayoutText {#text} at (0,195) size 84x13
+        text run at (0,195) width 84: "Lots of content."
+      LayoutBR {BR} at (83,206) size 1x0
+      LayoutBR {BR} at (0,208) size 0x13
+      LayoutText {#text} at (0,221) size 84x13
+        text run at (0,221) width 84: "Lots of content."
+      LayoutBR {BR} at (83,232) size 1x0
+      LayoutText {#text} at (0,234) size 84x13
+        text run at (0,234) width 84: "Lots of content."
+      LayoutBR {BR} at (83,245) size 1x0
+      LayoutBR {BR} at (0,247) size 0x13
+      LayoutText {#text} at (0,260) size 84x13
+        text run at (0,260) width 84: "Lots of content."
+      LayoutBR {BR} at (83,271) size 1x0
+      LayoutText {#text} at (0,273) size 84x13
+        text run at (0,273) width 84: "Lots of content."
+      LayoutBR {BR} at (83,284) size 1x0
+      LayoutBR {BR} at (0,286) size 0x13
+      LayoutBR {BR} at (0,299) size 0x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
new file mode 100644
index 0000000..be036f0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -0,0 +1,19 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [407, 10, 4, 15],
+        [404, 10, 4, 15]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow DIV id='inner-editor'",
+        "LayoutBlockFlow DIV id='inner-editor'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/japanese-rl-selection-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/japanese-rl-selection-repaint-expected.txt
index 4b3c520..20d342c4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/japanese-rl-selection-repaint-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/repaint/japanese-rl-selection-repaint-expected.txt
@@ -6,7 +6,6 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [453, 556, 319, 21],
         [420, 23, 352, 541]
       ],
       "paintInvalidationClients": [
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/text/emphasis-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/text/emphasis-expected.png
index f5d7646..0b61a2f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/text/emphasis-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/text/emphasis-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/text/international/bidi-menulist-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/text/international/bidi-menulist-expected.txt
deleted file mode 100644
index 63cad0e61..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/text/international/bidi-menulist-expected.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-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 {P} at (0,0) size 784x54
-        LayoutText {#text} at (0,0) size 458x18
-          text run at (0,0) width 458: "This tests that bidirectional text is correctly rendered in popup controls."
-        LayoutBR {BR} at (457,14) size 1x0
-        LayoutText {#text} at (0,18) size 773x36
-          text run at (0,18) width 773: "The order of the text below each popup button should match the order of the select's option text, and the order of the text"
-          text run at (0,36) width 124: "in the popup menu."
-      LayoutBlockFlow (anonymous) at (0,70) size 784x36
-        LayoutText {#text} at (0,0) size 286x18
-          text run at (0,0) width 286: "1) direction: rtl; -webkit-rtl-ordering: logical"
-        LayoutBR {BR} at (285,14) size 1x0
-        LayoutMenuList {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (17,2) size 60x13
-              text run at (17,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-              text run at (58,2) width 19: "abc"
-        LayoutBR {BR} at (100,31) size 0x0
-      LayoutBlockFlow {DIV} at (0,106) size 100x19
-        LayoutText {#text} at (0,1) size 82x18
-          text run at (0,1) width 23: "abc"
-          text run at (22,1) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-      LayoutBlockFlow (anonymous) at (0,125) size 784x54
-        LayoutBR {BR} at (0,0) size 0x18
-        LayoutText {#text} at (0,18) size 118x18
-          text run at (0,18) width 118: "2) text-align: right"
-        LayoutBR {BR} at (117,32) size 1x0
-        LayoutMenuList {SELECT} at (0,36) size 200x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 200x18
-            LayoutText (anonymous) at (8,2) size 60x13
-              text run at (8,2) width 19: "abc"
-              text run at (26,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-        LayoutBR {BR} at (200,49) size 0x0
-      LayoutBlockFlow {DIV} at (0,179) size 200x19
-        LayoutText {#text} at (0,1) size 82x18
-          text run at (0,1) width 23: "abc"
-          text run at (22,1) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-      LayoutBlockFlow (anonymous) at (0,198) size 784x54
-        LayoutBR {BR} at (0,0) size 0x18
-        LayoutText {#text} at (0,18) size 72x18
-          text run at (0,18) width 72: "3) No style"
-        LayoutBR {BR} at (71,32) size 1x0
-        LayoutMenuList {SELECT} at (0,36) size 100x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 60x13
-              text run at (8,2) width 19: "abc"
-              text run at (26,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-        LayoutBR {BR} at (100,49) size 0x0
-      LayoutBlockFlow {DIV} at (0,252) size 100x19
-        LayoutText {#text} at (0,1) size 82x18
-          text run at (0,1) width 23: "abc"
-          text run at (22,1) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-      LayoutBlockFlow (anonymous) at (0,271) size 784x18
-        LayoutBR {BR} at (0,0) size 0x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-lr-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-lr-selection-expected.png
new file mode 100644
index 0000000..9c9f99f2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-lr-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-lr-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-lr-selection-expected.txt
new file mode 100644
index 0000000..cc7c7d4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-lr-selection-expected.txt
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 541x600
+  LayoutBlockFlow {HTML} at (0,0) size 541x600 [border: (10px solid #800000)]
+    LayoutBlockFlow {BODY} at (18,18) size 505x564 [border: (5px solid #000000)]
+      LayoutBlockFlow {DIV} at (5,105) size 495x400
+        LayoutText {#text} at (5,0) size 484x392
+          text run at (5,0) width 384: "\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}"
+          text run at (38,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
+          text run at (71,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
+          text run at (104,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
+          text run at (137,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
+          text run at (170,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
+          text run at (203,0) width 392: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
+          text run at (236,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+          text run at (269,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
+          text run at (302,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
+          text run at (335,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
+          text run at (368,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
+          text run at (401,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
+          text run at (434,0) width 392: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
+          text run at (467,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+selection start: position 5 of child 0 {#text} of child 1 {DIV} of body
+selection end:   position 203 of child 0 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-rl-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-rl-selection-expected.png
new file mode 100644
index 0000000..5a2db32c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-rl-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-rl-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-rl-selection-expected.txt
new file mode 100644
index 0000000..0352946
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/fast/writing-mode/japanese-rl-selection-expected.txt
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (259,0) size 541x600
+  LayoutBlockFlow {HTML} at (0,0) size 541x600 [border: (10px solid #800000)]
+    LayoutBlockFlow {BODY} at (18,18) size 505x564 [border: (5px solid #000000)]
+      LayoutBlockFlow {DIV} at (5,105) size 495x400
+        LayoutText {#text} at (5,0) size 484x392
+          text run at (5,0) width 384: "\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}"
+          text run at (38,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
+          text run at (71,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
+          text run at (104,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
+          text run at (137,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
+          text run at (170,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
+          text run at (203,0) width 392: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
+          text run at (236,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+          text run at (269,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
+          text run at (302,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
+          text run at (335,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
+          text run at (368,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
+          text run at (401,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
+          text run at (434,0) width 392: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
+          text run at (467,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+selection start: position 5 of child 0 {#text} of child 1 {DIV} of body
+selection end:   position 203 of child 0 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug194024-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug194024-expected.txt
new file mode 100644
index 0000000..47cb4dd8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug194024-expected.txt
@@ -0,0 +1,146 @@
+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 (anonymous) at (0,0) size 784x18
+        LayoutText {#text} at (0,0) size 287x18
+          text run at (0,0) width 287: "border=\"0\" cellspacing=\"0\" cellpadding=\"0\""
+      LayoutTable {TABLE} at (0,18) size 784x32 [bgcolor=#DDDD33]
+        LayoutTableSection {TBODY} at (0,0) size 784x32
+          LayoutTableRow {TR} at (0,0) size 784x32
+            LayoutTableCell {TD} at (0,16) size 12x0 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (12,0) size 760x32 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (772,16) size 12x0 [r=0 c=2 rs=1 cs=1]
+      LayoutBlockFlow (anonymous) at (0,50) size 784x18
+        LayoutText {#text} at (0,0) size 211x18
+          text run at (0,0) width 211: "cellspacing=\"0\" cellpadding=\"0\""
+      LayoutTable {TABLE} at (0,68) size 784x32 [bgcolor=#CCCCFF]
+        LayoutTableSection {TBODY} at (0,0) size 784x32
+          LayoutTableRow {TR} at (0,0) size 784x32
+            LayoutTableCell {TD} at (0,16) size 12x0 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (12,0) size 760x32 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (772,16) size 12x0 [r=0 c=2 rs=1 cs=1]
+      LayoutBlockFlow (anonymous) at (0,100) size 784x18
+        LayoutText {#text} at (0,0) size 105x18
+          text run at (0,0) width 105: "cellpadding=\"0\""
+      LayoutTable {TABLE} at (0,118) size 784x36 [bgcolor=#FF9999]
+        LayoutTableSection {TBODY} at (0,0) size 784x36
+          LayoutTableRow {TR} at (0,2) size 784x32
+            LayoutTableCell {TD} at (2,18) size 12x0 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (16,2) size 752x32 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (770,18) size 12x0 [r=0 c=2 rs=1 cs=1]
+      LayoutBlockFlow (anonymous) at (0,154) size 784x18
+        LayoutText {#text} at (0,0) size 181x18
+          text run at (0,0) width 181: "border=\"0\" cellpadding=\"0\""
+      LayoutTable {TABLE} at (0,172) size 784x36 [bgcolor=#AAEEBB]
+        LayoutTableSection {TBODY} at (0,0) size 784x36
+          LayoutTableRow {TR} at (0,2) size 784x32
+            LayoutTableCell {TD} at (2,18) size 12x0 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (16,2) size 752x32 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (770,18) size 12x0 [r=0 c=2 rs=1 cs=1]
+      LayoutBlockFlow (anonymous) at (0,208) size 784x18
+        LayoutInline {FONT} at (0,0) size 31x18 [color=#0000FF]
+          LayoutText {#text} at (0,0) size 31x18
+            text run at (0,0) width 31: "right"
+        LayoutText {#text} at (30,0) size 77x18
+          text run at (30,0) width 77: " border=\"0\""
+      LayoutTable {TABLE} at (0,226) size 784x38 [bgcolor=#FFCCEE]
+        LayoutTableSection {TBODY} at (0,0) size 784x38
+          LayoutTableRow {TR} at (0,2) size 784x34
+            LayoutTableCell {TD} at (2,18) size 14x2 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (18,2) size 748x34 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (768,18) size 14x2 [r=0 c=2 rs=1 cs=1]
+      LayoutBlockFlow (anonymous) at (0,264) size 784x18
+        LayoutInline {FONT} at (0,0) size 31x18 [color=#0000FF]
+          LayoutText {#text} at (0,0) size 31x18
+            text run at (0,0) width 31: "right"
+        LayoutText {#text} at (30,0) size 109x18
+          text run at (30,0) width 109: " cellpadding=\"1\""
+      LayoutTable {TABLE} at (0,282) size 784x38 [bgcolor=#66DDFF]
+        LayoutTableSection {TBODY} at (0,0) size 784x38
+          LayoutTableRow {TR} at (0,2) size 784x34
+            LayoutTableCell {TD} at (2,18) size 14x2 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (18,2) size 748x34 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (768,18) size 14x2 [r=0 c=2 rs=1 cs=1]
+      LayoutBlockFlow (anonymous) at (0,320) size 784x18
+        LayoutInline {FONT} at (0,0) size 31x18 [color=#0000FF]
+          LayoutText {#text} at (0,0) size 31x18
+            text run at (0,0) width 31: "right"
+        LayoutText {#text} at (30,0) size 291x18
+          text run at (30,0) width 291: " border=\"1\" cellspacing=\"0\" cellpadding=\"0\""
+      LayoutTable {TABLE} at (0,338) size 784x36 [bgcolor=#EEEEEE] [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 782x34
+          LayoutTableRow {TR} at (0,0) size 782x34
+            LayoutTableCell {TD} at (0,16) size 14x2 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (14,0) size 754x34 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (768,16) size 14x2 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+      LayoutBlockFlow (anonymous) at (0,374) size 784x18
+        LayoutInline {FONT} at (0,0) size 31x18 [color=#0000FF]
+          LayoutText {#text} at (0,0) size 31x18
+            text run at (0,0) width 31: "right"
+        LayoutText {#text} at (30,0) size 183x18
+          text run at (30,0) width 183: " border=\"1\" cellspacing=\"0\""
+      LayoutTable {TABLE} at (0,392) size 784x38 [bgcolor=#FFCC66] [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 782x36
+          LayoutTableRow {TR} at (0,0) size 782x36
+            LayoutTableCell {TD} at (0,16) size 16x4 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (16,0) size 750x36 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (766,16) size 16x4 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+      LayoutBlockFlow (anonymous) at (0,430) size 784x18
+        LayoutInline {FONT} at (0,0) size 31x18 [color=#0000FF]
+          LayoutText {#text} at (0,0) size 31x18
+            text run at (0,0) width 31: "right"
+        LayoutText {#text} at (30,0) size 77x18
+          text run at (30,0) width 77: " border=\"1\""
+      LayoutTable {TABLE} at (0,448) size 784x42 [bgcolor=#CCFF33] [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 782x40
+          LayoutTableRow {TR} at (0,2) size 782x36
+            LayoutTableCell {TD} at (2,18) size 16x4 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (20,2) size 742x36 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (764,18) size 16x4 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+layer at (20,26) size 760x32 clip at (21,27) size 758x30
+  LayoutTextControl {TEXTAREA} at (0,0) size 760x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 754x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
+layer at (20,76) size 760x32 clip at (21,77) size 758x30
+  LayoutTextControl {TEXTAREA} at (0,0) size 760x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 754x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
+layer at (24,128) size 752x32 clip at (25,129) size 750x30
+  LayoutTextControl {TEXTAREA} at (0,0) size 752x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 746x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
+layer at (24,182) size 752x32 clip at (25,183) size 750x30
+  LayoutTextControl {TEXTAREA} at (0,0) size 752x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 746x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
+layer at (27,237) size 746x32 clip at (28,238) size 744x30
+  LayoutTextControl {TEXTAREA} at (1,1) size 746x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 740x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
+layer at (27,293) size 746x32 clip at (28,294) size 744x30
+  LayoutTextControl {TEXTAREA} at (1,1) size 746x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 740x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
+layer at (24,348) size 752x32 clip at (25,349) size 750x30
+  LayoutTextControl {TEXTAREA} at (1,1) size 752x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 746x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
+layer at (27,403) size 746x32 clip at (28,404) size 744x30
+  LayoutTextControl {TEXTAREA} at (2,2) size 746x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 740x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
+layer at (31,461) size 738x32 clip at (32,462) size 736x30
+  LayoutTextControl {TEXTAREA} at (2,2) size 738x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 732x13
+      LayoutText {#text} at (0,0) size 20x13
+        text run at (0,0) width 20: "test"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug29326-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug29326-expected.txt
new file mode 100644
index 0000000..d8e9be2a4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug29326-expected.txt
@@ -0,0 +1,15 @@
+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
+      LayoutTable {TABLE} at (192,0) size 400x44 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 398x42
+          LayoutTableRow {TR} at (0,2) size 398x38
+            LayoutTableCell {TD} at (2,2) size 394x38 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutBlockFlow {FORM} at (2,2) size 390x18
+                LayoutMenuList {SELECT} at (0,0) size 54x18 [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 54x18
+                    LayoutText (anonymous) at (8,2) size 23x13
+                      text run at (8,2) width 23: "Test"
+                LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug44505-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug44505-expected.txt
new file mode 100644
index 0000000..6226b50c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/bugs/bug44505-expected.txt
@@ -0,0 +1,201 @@
+layer at (0,0) size 800x600 scrollHeight 604
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x604 backgroundClip at (0,0) size 800x600 clip at (0,0) size 800x600
+  LayoutBlockFlow {HTML} at (0,0) size 800x604
+    LayoutBlockFlow {BODY} at (8,8) size 784x588 [bgcolor=#FFFFFF]
+      LayoutTable {TABLE} at (0,0) size 308x52 [border: (1px outset #808080)]
+        LayoutTableCol {COLGROUP} at (0,0) size 0x0
+          LayoutTableCol {COL} at (0,0) size 0x0
+          LayoutTableCol {COL} at (0,0) size 0x0
+        LayoutTableSection {TBODY} at (1,1) size 306x50
+          LayoutTableRow {TR} at (0,2) size 306x22
+          LayoutTableRow {TR} at (0,26) size 306x22
+      LayoutTable {TABLE} at (0,52) size 308x52 [border: (1px outset #808080)]
+        LayoutTableCol {COLGROUP} at (0,0) size 0x0
+          LayoutTableCol {COL} at (0,0) size 0x0
+          LayoutTableCol {COL} at (0,0) size 0x0
+        LayoutTableSection {TBODY} at (1,1) size 306x50
+          LayoutTableRow {TR} at (0,2) size 306x22
+          LayoutTableRow {TR} at (0,26) size 306x22
+      LayoutTable {TABLE} at (0,104) size 300x52 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 298x50
+          LayoutTableRow {TR} at (0,2) size 298x22
+          LayoutTableRow {TR} at (0,26) size 298x22
+      LayoutTable {TABLE} at (0,156) size 300x52 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 298x50
+          LayoutTableRow {TR} at (0,2) size 298x22
+          LayoutTableRow {TR} at (0,26) size 298x22
+      LayoutTable {TABLE} at (0,208) size 300x53 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 298x51
+          LayoutTableRow {TR} at (0,2) size 298x23
+          LayoutTableRow {TR} at (0,27) size 298x22
+      LayoutTable {TABLE} at (0,261) size 300x53 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 298x51
+          LayoutTableRow {TR} at (0,2) size 298x23
+          LayoutTableRow {TR} at (0,27) size 298x22
+      LayoutTable {TABLE} at (0,314) size 300x94 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 298x92
+          LayoutTableRow {TR} at (0,2) size 298x46
+          LayoutTableRow {TR} at (0,50) size 298x40
+      LayoutTable {TABLE} at (0,498) size 300x90 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 298x88
+          LayoutTableRow {TR} at (0,2) size 298x60
+          LayoutTableRow {TR} at (0,64) size 298x22
+layer at (11,11) size 200x22 clip at (12,12) size 198x20
+  LayoutTableCell {TD} at (2,2) size 200x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (213,11) size 100x22 clip at (214,12) size 98x20
+  LayoutTableCell {TD} at (204,2) size 100x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,35) size 200x22 clip at (12,36) size 198x20
+  LayoutTableCell {TD} at (2,26) size 200x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (213,35) size 100x22 clip at (214,36) size 98x20
+  LayoutTableCell {TD} at (204,26) size 100x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,63) size 200x22 clip at (12,64) size 198x20
+  LayoutTableCell {TD} at (2,2) size 200x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (213,63) size 100x22 clip at (214,64) size 98x20
+  LayoutTableCell {TD} at (204,2) size 100x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,87) size 200x22 clip at (12,88) size 198x20
+  LayoutTableCell {TD} at (2,26) size 200x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (213,87) size 100x22 clip at (214,88) size 98x20
+  LayoutTableCell {TD} at (204,26) size 100x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,115) size 233x22 clip at (12,116) size 231x20
+  LayoutTableCell {TD} at (2,2) size 233x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (246,115) size 59x22 clip at (247,116) size 57x20
+  LayoutTableCell {TD} at (237,2) size 59x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,139) size 233x22 clip at (12,140) size 231x20
+  LayoutTableCell {TD} at (2,26) size 233x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (246,139) size 59x22 clip at (247,140) size 57x20
+  LayoutTableCell {TD} at (237,26) size 59x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,167) size 154x22 clip at (12,168) size 152x20
+  LayoutTableCell {TD} at (2,2) size 154x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (167,167) size 138x22 clip at (168,168) size 136x20
+  LayoutTableCell {TD} at (158,2) size 138x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,191) size 154x22 clip at (12,192) size 152x20
+  LayoutTableCell {TD} at (2,26) size 154x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (167,191) size 138x22 clip at (168,192) size 136x20
+  LayoutTableCell {TD} at (158,26) size 138x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,219) size 154x23 clip at (12,220) size 152x21 scrollWidth 201
+  LayoutTableCell {TD} at (2,2) size 154x23 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutBlockFlow {FORM} at (2,2) size 150x19
+      LayoutButton {BUTTON} at (0,1) size 200x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 184x13
+          LayoutText {#text} at (74,0) size 36x13
+            text run at (74,0) width 36: "button"
+layer at (167,219) size 138x23 clip at (168,220) size 136x21
+  LayoutTableCell {TD} at (158,2) size 138x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,244) size 154x22 clip at (12,245) size 152x20
+  LayoutTableCell {TD} at (2,27) size 154x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (167,244) size 138x22 clip at (168,245) size 136x20
+  LayoutTableCell {TD} at (158,27) size 138x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,272) size 280x23 clip at (12,273) size 278x21
+  LayoutTableCell {TD} at (2,2) size 280x23 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutBlockFlow {FORM} at (2,2) size 276x19
+      LayoutButton {BUTTON} at (0,1) size 200x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 184x13
+          LayoutText {#text} at (74,0) size 36x13
+            text run at (74,0) width 36: "button"
+layer at (293,272) size 12x23 clip at (294,273) size 10x21
+  LayoutTableCell {TD} at (284,2) size 12x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,297) size 280x22 clip at (12,298) size 278x20
+  LayoutTableCell {TD} at (2,27) size 280x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (293,297) size 12x22 clip at (294,298) size 10x20
+  LayoutTableCell {TD} at (284,27) size 12x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,325) size 172x46 clip at (12,326) size 170x44 scrollWidth 216
+  LayoutTableCell {TD} at (2,2) size 172x46 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutBlockFlow {DIV} at (11,11) size 206x24 [border: (3px solid #000000)]
+      LayoutText {#text} at (3,3) size 21x18
+        text run at (3,3) width 21: "div"
+layer at (185,325) size 120x46 clip at (186,326) size 118x44
+  LayoutTableCell {TD} at (176,5) size 120x40 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (11,11) size 4x18
+      text run at (11,11) width 4: " "
+layer at (11,373) size 172x40 clip at (12,374) size 170x38
+  LayoutTableCell {TD} at (2,50) size 172x40 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (11,11) size 4x18
+      text run at (11,11) width 4: " "
+layer at (185,373) size 120x40 clip at (186,374) size 118x38
+  LayoutTableCell {TD} at (176,50) size 120x40 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (11,11) size 4x18
+      text run at (11,11) width 4: " "
+layer at (8,416) size 300x90 clip at (9,417) size 298x88
+  LayoutTable {TABLE} at (0,408) size 300x90 [border: (1px outset #808080)]
+    LayoutTableSection {TBODY} at (1,1) size 298x88
+      LayoutTableRow {TR} at (0,2) size 298x60
+      LayoutTableRow {TR} at (0,64) size 298x22
+layer at (11,419) size 154x60 clip at (12,420) size 152x58 scrollWidth 207
+  LayoutTableCell {TD} at (2,2) size 154x60 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutBlockFlow {P} at (2,18) size 206x24 [border: (3px solid #000000)]
+      LayoutText {#text} at (3,3) size 28x18
+        text run at (3,3) width 28: "para"
+layer at (167,419) size 138x60 clip at (168,420) size 136x58
+  LayoutTableCell {TD} at (158,21) size 138x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,481) size 154x22 clip at (12,482) size 152x20
+  LayoutTableCell {TD} at (2,64) size 154x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (167,481) size 138x22 clip at (168,482) size 136x20
+  LayoutTableCell {TD} at (158,64) size 138x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,509) size 254x60 clip at (12,510) size 252x58
+  LayoutTableCell {TD} at (2,2) size 254x60 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+    LayoutBlockFlow {P} at (2,18) size 206x24 [border: (3px solid #000000)]
+      LayoutText {#text} at (3,3) size 28x18
+        text run at (3,3) width 28: "para"
+layer at (267,509) size 38x60 clip at (268,510) size 36x58
+  LayoutTableCell {TD} at (258,21) size 38x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (11,571) size 254x22 clip at (12,572) size 252x20
+  LayoutTableCell {TD} at (2,64) size 254x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
+layer at (267,571) size 38x22 clip at (268,572) size 36x20
+  LayoutTableCell {TD} at (258,64) size 38x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=1 c=1 rs=1 cs=1]
+    LayoutText {#text} at (2,2) size 4x18
+      text run at (2,2) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/core/margins-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/core/margins-expected.txt
new file mode 100644
index 0000000..17fdcb0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/tables/mozilla/core/margins-expected.txt
@@ -0,0 +1,105 @@
+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 (anonymous) at (0,0) size 784x18
+        LayoutText {#text} at (0,0) size 191x18
+          text run at (0,0) width 191: "outer width=400 align=center"
+      LayoutTable {TABLE} at (192,18) size 400x44 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 398x42
+          LayoutTableRow {TR} at (0,2) size 398x38
+            LayoutTableCell {TD} at (2,2) size 394x38 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutBlockFlow {FORM} at (2,2) size 390x18
+                LayoutMenuList {SELECT} at (0,0) size 54x18 [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 54x18
+                    LayoutText (anonymous) at (8,2) size 23x13
+                      text run at (8,2) width 23: "Test"
+                LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow (anonymous) at (0,62) size 784x18
+        LayoutText {#text} at (0,0) size 301x18
+          text run at (0,0) width 301: "outer width=400 inner width=200 align=center"
+      LayoutTable {TABLE} at (0,80) size 400x40 [border: (2px outset #808080)]
+        LayoutTableSection {TBODY} at (2,2) size 396x36
+          LayoutTableRow {TR} at (0,2) size 396x32
+            LayoutTableCell {TD} at (2,2) size 392x32 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (96,2) size 200x28 [border: (1px outset #808080)]
+                LayoutTableSection {TBODY} at (1,1) size 198x26
+                  LayoutTableRow {TR} at (0,2) size 198x22
+                    LayoutTableCell {TD} at (2,2) size 194x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      LayoutText {#text} at (2,2) size 22x18
+                        text run at (2,2) width 22: "foo"
+      LayoutBlockFlow (anonymous) at (0,120) size 784x18
+        LayoutText {#text} at (0,0) size 186x18
+          text run at (0,0) width 186: "outer auto inner align=center"
+      LayoutTable {TABLE} at (0,138) size 44x40 [border: (2px outset #808080)]
+        LayoutTableSection {TBODY} at (2,2) size 40x36
+          LayoutTableRow {TR} at (0,2) size 40x32
+            LayoutTableCell {TD} at (2,2) size 36x32 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (2,2) size 32x28 [border: (1px outset #808080)]
+                LayoutTableSection {TBODY} at (1,1) size 30x26
+                  LayoutTableRow {TR} at (0,2) size 30x22
+                    LayoutTableCell {TD} at (2,2) size 26x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      LayoutText {#text} at (2,2) size 22x18
+                        text run at (2,2) width 22: "foo"
+      LayoutBlockFlow (anonymous) at (0,178) size 784x18
+        LayoutText {#text} at (0,0) size 220x18
+          text run at (0,0) width 220: "outer width=50 inner align=center"
+      LayoutTable {TABLE} at (0,196) size 44x40 [border: (2px outset #808080)]
+        LayoutTableSection {TBODY} at (2,2) size 40x36
+          LayoutTableRow {TR} at (0,2) size 40x32
+            LayoutTableCell {TD} at (2,2) size 36x32 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (2,2) size 32x28 [border: (1px outset #808080)]
+                LayoutTableSection {TBODY} at (1,1) size 30x26
+                  LayoutTableRow {TR} at (0,2) size 30x22
+                    LayoutTableCell {TD} at (2,2) size 26x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      LayoutText {#text} at (2,2) size 22x18
+                        text run at (2,2) width 22: "foo"
+      LayoutBlockFlow (anonymous) at (0,236) size 784x18
+        LayoutText {#text} at (0,0) size 232x18
+          text run at (0,0) width 232: "outer width=50 inner margin-left:50"
+      LayoutTable {TABLE} at (0,254) size 94x40 [border: (2px outset #808080)]
+        LayoutTableSection {TBODY} at (2,2) size 90x36
+          LayoutTableRow {TR} at (0,2) size 90x32
+            LayoutTableCell {TD} at (2,2) size 86x32 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (52,2) size 32x28 [border: (1px outset #808080)]
+                LayoutTableSection {TBODY} at (1,1) size 30x26
+                  LayoutTableRow {TR} at (0,2) size 30x22
+                    LayoutTableCell {TD} at (2,2) size 26x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      LayoutText {#text} at (2,2) size 22x18
+                        text run at (2,2) width 22: "foo"
+      LayoutBlockFlow (anonymous) at (0,294) size 784x18
+        LayoutText {#text} at (0,0) size 228x18
+          text run at (0,0) width 228: "outer width=400 inner align=center"
+      LayoutTable {TABLE} at (0,312) size 400x40 [border: (2px outset #808080)]
+        LayoutTableSection {TBODY} at (2,2) size 396x36
+          LayoutTableRow {TR} at (0,2) size 396x32
+            LayoutTableCell {TD} at (2,2) size 117x32 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (42.50,2) size 32x28 [border: (1px outset #808080)]
+                LayoutTableSection {TBODY} at (1,1) size 30x26
+                  LayoutTableRow {TR} at (0,2) size 30x22
+                    LayoutTableCell {TD} at (2,2) size 26x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      LayoutText {#text} at (2,2) size 22x18
+                        text run at (2,2) width 22: "foo"
+            LayoutTableCell {TD} at (121,7) size 273x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+              LayoutText {#text} at (2,2) size 80x18
+                text run at (2,2) width 80: "x x x x x x x"
+      LayoutBlockFlow (anonymous) at (0,352) size 784x18
+        LayoutText {#text} at (0,0) size 228x18
+          text run at (0,0) width 228: "outer width=400 inner align=center"
+      LayoutTable {TABLE} at (0,370) size 400x40 [border: (2px outset #808080)]
+        LayoutTableSection {TBODY} at (2,2) size 396x36
+          LayoutTableRow {TR} at (0,2) size 396x32
+            LayoutTableCell {TD} at (2,2) size 168x32 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (54,2) size 60x28 [border: (1px outset #808080)]
+                LayoutTableSection {TBODY} at (1,1) size 58x26
+                  LayoutTableRow {TR} at (0,2) size 58x22
+                    LayoutTableCell {TD} at (2,2) size 54x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      LayoutText {#text} at (2,2) size 16x18
+                        text run at (2,2) width 16: "50"
+            LayoutTableCell {TD} at (172,7) size 222x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+              LayoutText {#text} at (2,2) size 80x18
+                text run at (2,2) width 80: "x x x x x x x"
+      LayoutBlockFlow (anonymous) at (0,410) size 784x18
+        LayoutText {#text} at (0,0) size 20x18
+          text run at (0,0) width 20: "-->"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
index 6c77462..a473b6cf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 308],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -59,12 +54,7 @@
                 {
                   "bounds": [189, 308],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt
new file mode 100644
index 0000000..dd184de6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt
@@ -0,0 +1 @@
+["LayoutImage (positioned) IMG"]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.png
new file mode 100644
index 0000000..78ae71a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mavericks/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mountainlion/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mountainlion/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
deleted file mode 100644
index 7508985..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-mountainlion/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mountainlion/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mountainlion/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
deleted file mode 100644
index 7508985..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-mountainlion/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-mountainlion/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/mac-mountainlion/fast/text/midword-break-before-surrogate-pair-expected.png
new file mode 100644
index 0000000..8518245
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-mountainlion/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
deleted file mode 100644
index 7508985..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-retina/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-retina/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/mac-retina/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
deleted file mode 100644
index 7508985..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac-retina/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
index 1930fc2..d02628e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
@@ -20,16 +20,11 @@
                   "drawsContent": true,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "position": [192, 0],
-                          "bounds": [100, 100],
-                          "contentsOpaque": true,
-                          "drawsContent": true,
-                          "backgroundColor": "#FFFF00"
-                        }
-                      ]
+                      "position": [192, 0],
+                      "bounds": [100, 100],
+                      "contentsOpaque": true,
+                      "drawsContent": true,
+                      "backgroundColor": "#FFFF00"
                     }
                   ]
                 }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
index b0200a5..f100ff5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
@@ -20,12 +20,7 @@
                 {
                   "bounds": [285, 800],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
index eebf566..6f8531a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
@@ -30,34 +30,29 @@
                       "shouldFlattenTransform": false,
                       "children": [
                         {
-                          "shouldFlattenTransform": false,
-                          "children": [
-                            {
-                              "position": [0, 65],
-                              "bounds": [60, 200],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#008000",
-                              "transform": [
-                                [1, 0, 0, 0],
-                                [0, 1, 0, 0],
-                                [0, 0, 1, 0],
-                                [0, 0, 10, 1]
-                              ]
-                            },
-                            {
-                              "position": [65, 65],
-                              "bounds": [60, 200],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#0000FF",
-                              "transform": [
-                                [1, 0, 0, 0],
-                                [0, 1, 0, 0],
-                                [0, 0, 1, 0],
-                                [0, 0, 20, 1]
-                              ]
-                            }
+                          "position": [0, 65],
+                          "bounds": [60, 200],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#008000",
+                          "transform": [
+                            [1, 0, 0, 0],
+                            [0, 1, 0, 0],
+                            [0, 0, 1, 0],
+                            [0, 0, 10, 1]
+                          ]
+                        },
+                        {
+                          "position": [65, 65],
+                          "bounds": [60, 200],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#0000FF",
+                          "transform": [
+                            [1, 0, 0, 0],
+                            [0, 1, 0, 0],
+                            [0, 0, 1, 0],
+                            [0, 0, 20, 1]
                           ]
                         }
                       ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/clear-scroll-parent-expected.txt
index ab91040..9897bf2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/clear-scroll-parent-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/clear-scroll-parent-expected.txt
@@ -18,12 +18,7 @@
                 {
                   "bounds": [285, 530],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/composited-scrolling-paint-phases-expected.txt
index 143d38a..95b24d1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/composited-scrolling-paint-phases-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/composited-scrolling-paint-phases-expected.txt
@@ -69,16 +69,6 @@
                         "GraphicsLayerPaintForeground",
                         "GraphicsLayerPaintOverflowContents",
                         "GraphicsLayerPaintCompositedScroll"
-                      ],
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false,
-                          "paintingPhases": [
-                            "GraphicsLayerPaintForeground",
-                            "GraphicsLayerPaintOverflowContents",
-                            "GraphicsLayerPaintCompositedScroll"
-                          ]
-                        }
                       ]
                     }
                   ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/content-gains-scrollbars-expected.txt
index 6d6689b..444bcb4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/content-gains-scrollbars-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/content-gains-scrollbars-expected.txt
@@ -19,12 +19,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
+                      "bounds": [10, 200]
                     }
                   ]
                 }
@@ -54,12 +49,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
+                      "bounds": [200, 10]
                     }
                   ]
                 }
@@ -89,12 +79,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
+                      "bounds": [200, 200]
                     }
                   ]
                 }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/overflow-scrollbar-layers-expected.txt
index 6d6689b..444bcb4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/overflow-scrollbar-layers-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/overflow-scrollbar-layers-expected.txt
@@ -19,12 +19,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
+                      "bounds": [10, 200]
                     }
                   ]
                 }
@@ -54,12 +49,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
+                      "bounds": [200, 10]
                     }
                   ]
                 }
@@ -89,12 +79,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
+                      "bounds": [200, 200]
                     }
                   ]
                 }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
index c0deec5..1331fea 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
@@ -32,12 +32,7 @@
                                 {
                                   "bounds": [1200, 10000],
                                   "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
+                                  "drawsContent": true
                                 }
                               ]
                             }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scroll-parent-absolute-expected.txt
index c15c2d1..87b5990 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scroll-parent-absolute-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scroll-parent-absolute-expected.txt
@@ -22,12 +22,7 @@
                     {
                       "bounds": [485, 5000],
                       "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "drawsContent": true
                     }
                   ]
                 },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
index 7f2c9bc..dfc3b5c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
@@ -24,12 +24,7 @@
                   "children": [
                     {
                       "bounds": [100, 180],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "shouldFlattenTransform": false
                     }
                   ]
                 }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
index 28eef39..99f929a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
@@ -15,12 +15,7 @@
               "children": [
                 {
                   "bounds": [305, 1224],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scrolling-without-painting-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scrolling-without-painting-expected.txt
index a8931a2..92078e8a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scrolling-without-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/scrolling-without-painting-expected.txt
@@ -18,12 +18,7 @@
                 {
                   "bounds": [185, 1025],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index f7902a27..7c2197f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -143,10 +138,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2541],
+  "bounds": [785, 2466],
   "children": [
     {
-      "bounds": [785, 2541],
+      "bounds": [785, 2466],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -163,12 +158,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -272,10 +262,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4476],
+  "bounds": [785, 4326],
   "children": [
     {
-      "bounds": [785, 4476],
+      "bounds": [785, 4326],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,15 +279,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -401,10 +383,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6411],
+  "bounds": [785, 6141],
   "children": [
     {
-      "bounds": [785, 6411],
+      "bounds": [785, 6141],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -418,14 +400,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-toggling-expected.txt
index 371d02e..2d3f1d6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -140,10 +135,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2478],
+  "bounds": [785, 2403],
   "children": [
     {
-      "bounds": [785, 2478],
+      "bounds": [785, 2403],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -157,15 +152,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -269,10 +256,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4413],
+  "bounds": [785, 4218],
   "children": [
     {
-      "bounds": [785, 4413],
+      "bounds": [785, 4218],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -286,14 +273,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 3c0e072..9ccd40d7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -140,10 +135,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2496],
+  "bounds": [785, 2421],
   "children": [
     {
-      "bounds": [785, 2496],
+      "bounds": [785, 2421],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -160,12 +155,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -269,10 +259,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4431],
+  "bounds": [785, 4281],
   "children": [
     {
-      "bounds": [785, 4431],
+      "bounds": [785, 4281],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,12 +279,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -398,10 +383,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6366],
+  "bounds": [785, 6141],
   "children": [
     {
-      "bounds": [785, 6366],
+      "bounds": [785, 6141],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -415,15 +400,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/textarea-scroll-touch-expected.txt
index 5088f64..d77a2aa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 308],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -60,12 +55,7 @@
                 {
                   "bounds": [189, 308],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
index cf78466..f30493ed 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
@@ -21,12 +21,7 @@
                     {
                       "bounds": [85, 144],
                       "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "drawsContent": true
                     }
                   ]
                 },
@@ -87,12 +82,7 @@
                 {
                   "bounds": [105, 144],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -148,12 +138,7 @@
                   "children": [
                     {
                       "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "shouldFlattenTransform": false
                     }
                   ]
                 },
@@ -217,12 +202,7 @@
                     {
                       "bounds": [85, 144],
                       "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "drawsContent": true
                     }
                   ]
                 },
@@ -283,12 +263,7 @@
                 {
                   "bounds": [105, 144],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -344,12 +319,7 @@
                   "children": [
                     {
                       "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "shouldFlattenTransform": false
                     }
                   ]
                 },
@@ -409,12 +379,7 @@
               "children": [
                 {
                   "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -467,12 +432,7 @@
               "children": [
                 {
                   "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -526,12 +486,7 @@
                 {
                   "bounds": [85, 144],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -591,12 +546,7 @@
               "children": [
                 {
                   "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -657,12 +607,7 @@
                 {
                   "bounds": [85, 144],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -722,12 +667,7 @@
               "children": [
                 {
                   "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/updating-scrolling-content-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/updating-scrolling-content-expected.txt
index 44ed023..032b61b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/updating-scrolling-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/overflow/updating-scrolling-content-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='indicator'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
index 4fb693e..97858d7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='content'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/scrollbars/nested-overlay-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
index ef656a16..767a7a5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
@@ -21,67 +21,57 @@
                   "drawsContent": true,
                   "children": [
                     {
+                      "position": [0, 500],
+                      "bounds": [204, 204],
+                      "drawsContent": true,
+                      "children": [
+                        {
+                          "position": [2, 2],
+                          "bounds": [200, 200],
+                          "children": [
+                            {
+                              "bounds": [5000, 9000],
+                              "shouldFlattenTransform": false,
+                              "drawsContent": true
+                            }
+                          ]
+                        }
+                      ]
+                    },
+                    {
                       "shouldFlattenTransform": false,
                       "children": [
                         {
-                          "position": [0, 500],
-                          "bounds": [204, 204],
-                          "drawsContent": true,
-                          "children": [
-                            {
-                              "position": [2, 2],
-                              "bounds": [200, 200],
-                              "children": [
-                                {
-                                  "bounds": [5000, 9000],
-                                  "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
-                                }
-                              ]
-                            }
-                          ]
-                        },
-                        {
-                          "shouldFlattenTransform": false,
-                          "children": [
-                            {
-                              "position": [2, 502],
-                              "bounds": [100, 800],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#808080"
-                            },
-                            {
-                              "position": [2, 2502],
-                              "bounds": [5000, 1000],
-                              "drawsContent": true
-                            }
-                          ]
-                        },
-                        {
                           "position": [2, 502],
-                          "children": [
-                            {
-                              "position": [2, 195],
-                              "bounds": [193, 7],
-                              "drawsContent": true
-                            },
-                            {
-                              "position": [195, 2],
-                              "bounds": [7, 193],
-                              "drawsContent": true
-                            },
-                            {
-                              "position": [195, 195],
-                              "bounds": [7, 7],
-                              "drawsContent": true
-                            }
-                          ]
+                          "bounds": [100, 800],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#808080"
+                        },
+                        {
+                          "position": [2, 2502],
+                          "bounds": [5000, 1000],
+                          "drawsContent": true
+                        }
+                      ]
+                    },
+                    {
+                      "position": [2, 502],
+                      "children": [
+                        {
+                          "position": [2, 195],
+                          "bounds": [193, 7],
+                          "drawsContent": true
+                        },
+                        {
+                          "position": [195, 2],
+                          "bounds": [7, 193],
+                          "drawsContent": true
+                        },
+                        {
+                          "position": [195, 195],
+                          "bounds": [7, 7],
+                          "drawsContent": true
                         }
                       ]
                     }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/squashing/composited-bounds-for-negative-z-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/squashing/composited-bounds-for-negative-z-expected.txt
index 8dc812d..6554d17 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/squashing/composited-bounds-for-negative-z-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/squashing/composited-bounds-for-negative-z-expected.txt
@@ -30,12 +30,7 @@
                   "children": [
                     {
                       "bounds": [285, 1000],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "shouldFlattenTransform": false
                     }
                   ]
                 },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/update-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/update-paint-phases-expected.txt
index 9ba6603..267c8e1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/update-paint-phases-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/compositing/update-paint-phases-expected.txt
@@ -43,16 +43,6 @@
                     "GraphicsLayerPaintForeground",
                     "GraphicsLayerPaintOverflowContents",
                     "GraphicsLayerPaintCompositedScroll"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintOverflowContents",
-                        "GraphicsLayerPaintCompositedScroll"
-                      ]
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690703-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690703-2-expected.png
index a04307e..aad21a3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690703-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690703-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690703-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690703-expected.png
index d93afdd..41fdf6d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690703-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690703-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690719-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690719-expected.png
index d93afdd..41fdf6d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690719-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/3690719-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/replaced-boundaries-3-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/replaced-boundaries-3-expected.png
index 9129fc6..8cf52467 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/replaced-boundaries-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/replaced-boundaries-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/selection-button-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/selection-button-text-expected.png
index fc069dc..cbc045a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/selection-button-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/editing/selection/selection-button-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/forms/select/listbox-appearance-basic-expected.png
index dbc85bc..dc19c505 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/forms/select/listbox-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/forms/select/listbox-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/overflow-move-after-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/overflow-move-after-scroll-expected.txt
index 9cc556c4..bb9e25f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/overflow-move-after-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/overflow-move-after-scroll-expected.txt
@@ -31,11 +31,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow (positioned) DIV id='block'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/overflow-scroll-after-move-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/overflow-scroll-after-move-expected.txt
index 11760d2..6e4e696 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/overflow-scroll-after-move-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/overflow-scroll-after-move-expected.txt
@@ -31,11 +31,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow (positioned) DIV id='block'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/selection-change-in-iframe-with-relative-parent-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/selection-change-in-iframe-with-relative-parent-expected.txt
new file mode 100644
index 0000000..5bb39cb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/repaint/selection-change-in-iframe-with-relative-parent-expected.txt
@@ -0,0 +1,41 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [98, 238, 11, 10],
+        [61, 218, 11, 10],
+        [48, 198, 10, 10],
+        [18, 238, 81, 10],
+        [18, 228, 10, 10],
+        [18, 218, 44, 10],
+        [18, 208, 10, 10],
+        [18, 198, 30, 10]
+      ],
+      "paintInvalidationClients": [
+        "LayoutBlockFlow HTML",
+        "LayoutBlockFlow BODY",
+        "LayoutText #text",
+        "InlineTextBox 'Foo'",
+        "LayoutBR BR",
+        "InlineTextBox '\n'",
+        "LayoutBR BR",
+        "InlineTextBox '\n'",
+        "LayoutText #text",
+        "InlineTextBox 'Bar'",
+        "LayoutBR BR",
+        "InlineTextBox '\n'",
+        "LayoutBR BR",
+        "InlineTextBox '\n'",
+        "LayoutText #text",
+        "InlineTextBox 'Bazz'",
+        "LayoutBR BR",
+        "InlineTextBox '\n'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/emphasis-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/emphasis-expected.png
index cb9ce57..c32a627e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/emphasis-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/emphasis-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/midword-break-before-surrogate-pair-expected.png
index b85eeb8ce..cc725b6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/midword-break-before-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/midword-break-before-surrogate-pair-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/midword-break-before-surrogate-pair-expected.txt
index b3e0b55d..9b5f4529 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/midword-break-before-surrogate-pair-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/midword-break-before-surrogate-pair-expected.txt
@@ -3,7 +3,19 @@
 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 186x88 [border: (3px solid #0000FF)]
-        LayoutText {#text} at (3,3) size 156x82
-          text run at (3,3) width 156: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
-          text run at (3,44) width 104: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,0) size 784x36
+        LayoutText {#text} at (0,0) size 765x36
+          text run at (0,0) width 765: "The following box should break the sequence of symbols at the 5 character mark and not overflow the blue box. This is"
+          text run at (0,18) width 253: "because U+1D49 is a number category "
+          text run at (252,18) width 298: "unicode character, for which break-all applies."
+      LayoutBlockFlow {DIV} at (0,52) size 186x104 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,3) size 173x98
+          text run at (3,3) width 173: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+          text run at (3,52) width 74: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,172) size 784x18
+        LayoutText {#text} at (0,0) size 779x18
+          text run at (0,0) width 539: "The following box should not break the sequence of symbols since U+1F1EF is not "
+          text run at (538,0) width 241: "a letter or number category character."
+      LayoutBlockFlow {DIV} at (0,206) size 186x55 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,3) size 461x49
+          text run at (3,3) width 461: "\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}"
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/selection-hard-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/selection-hard-linebreak-expected.png
index 151e0782..ae31309d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/selection-hard-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/selection-hard-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/selection-painting-hidpi-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/selection-painting-hidpi-expected.png
new file mode 100644
index 0000000..e041b8d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/selection-painting-hidpi-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/shaping/shaping-selection-rect-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/shaping/shaping-selection-rect-expected.png
index 603fbf1..742ac811 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/shaping/shaping-selection-rect-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/shaping/shaping-selection-rect-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/whitespace/pre-wrap-overflow-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
index 2ea7effa..0679d4a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
index cf8e01a..efc0e66 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/invalidation/invalidate-after-composited-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/invalidation/invalidate-after-composited-scroll-expected.txt
index dcba9001..a7ac9351 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/invalidation/invalidate-after-composited-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/invalidation/invalidate-after-composited-scroll-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='target'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/selection/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/selection/selection-within-composited-scroller-expected.txt
index fb63bfd..12311fac 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/selection/selection-within-composited-scroller-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/selection/selection-within-composited-scroller-expected.txt
@@ -41,11 +41,6 @@
                     "LayoutBlockFlow DIV id='target'",
                     "LayoutText #text",
                     "InlineTextBox 'test'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/selection/text-selection-drag-expected.png b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/selection/text-selection-drag-expected.png
new file mode 100644
index 0000000..e9e005ce
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/paint/selection/text-selection-drag-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
index eebf566..6f8531a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
@@ -30,34 +30,29 @@
                       "shouldFlattenTransform": false,
                       "children": [
                         {
-                          "shouldFlattenTransform": false,
-                          "children": [
-                            {
-                              "position": [0, 65],
-                              "bounds": [60, 200],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#008000",
-                              "transform": [
-                                [1, 0, 0, 0],
-                                [0, 1, 0, 0],
-                                [0, 0, 1, 0],
-                                [0, 0, 10, 1]
-                              ]
-                            },
-                            {
-                              "position": [65, 65],
-                              "bounds": [60, 200],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#0000FF",
-                              "transform": [
-                                [1, 0, 0, 0],
-                                [0, 1, 0, 0],
-                                [0, 0, 1, 0],
-                                [0, 0, 20, 1]
-                              ]
-                            }
+                          "position": [0, 65],
+                          "bounds": [60, 200],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#008000",
+                          "transform": [
+                            [1, 0, 0, 0],
+                            [0, 1, 0, 0],
+                            [0, 0, 1, 0],
+                            [0, 0, 10, 1]
+                          ]
+                        },
+                        {
+                          "position": [65, 65],
+                          "bounds": [60, 200],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#0000FF",
+                          "transform": [
+                            [1, 0, 0, 0],
+                            [0, 1, 0, 0],
+                            [0, 0, 1, 0],
+                            [0, 0, 20, 1]
                           ]
                         }
                       ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
index ab91040..9897bf2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
@@ -18,12 +18,7 @@
                 {
                   "bounds": [285, 530],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
index 143d38a..95b24d1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
@@ -69,16 +69,6 @@
                         "GraphicsLayerPaintForeground",
                         "GraphicsLayerPaintOverflowContents",
                         "GraphicsLayerPaintCompositedScroll"
-                      ],
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false,
-                          "paintingPhases": [
-                            "GraphicsLayerPaintForeground",
-                            "GraphicsLayerPaintOverflowContents",
-                            "GraphicsLayerPaintCompositedScroll"
-                          ]
-                        }
                       ]
                     }
                   ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
index 6d6689b..444bcb4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
@@ -19,12 +19,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
+                      "bounds": [10, 200]
                     }
                   ]
                 }
@@ -54,12 +49,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
+                      "bounds": [200, 10]
                     }
                   ]
                 }
@@ -89,12 +79,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
+                      "bounds": [200, 200]
                     }
                   ]
                 }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
index 91dc218..44d7f9b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
@@ -17,12 +17,7 @@
                 {
                   "bounds": [1000, 1000],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
index 91dc218..44d7f9b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
@@ -17,12 +17,7 @@
                 {
                   "bounds": [1000, 1000],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
index 91dc218..44d7f9b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
@@ -17,12 +17,7 @@
                 {
                   "bounds": [1000, 1000],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
index 6d6689b..444bcb4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
@@ -19,12 +19,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
+                      "bounds": [10, 200]
                     }
                   ]
                 }
@@ -54,12 +49,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
+                      "bounds": [200, 10]
                     }
                   ]
                 }
@@ -89,12 +79,7 @@
                   "shouldFlattenTransform": false,
                   "children": [
                     {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
+                      "bounds": [200, 200]
                     }
                   ]
                 }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
index c0deec5..1331fea 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
@@ -32,12 +32,7 @@
                                 {
                                   "bounds": [1200, 10000],
                                   "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
+                                  "drawsContent": true
                                 }
                               ]
                             }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
index c15c2d1..87b5990 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
@@ -22,12 +22,7 @@
                     {
                       "bounds": [485, 5000],
                       "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "drawsContent": true
                     }
                   ]
                 },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
index 7f2c9bc..dfc3b5c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
@@ -24,12 +24,7 @@
                   "children": [
                     {
                       "bounds": [100, 180],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "shouldFlattenTransform": false
                     }
                   ]
                 }
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
index 28eef39..99f929a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
@@ -15,12 +15,7 @@
               "children": [
                 {
                   "bounds": [305, 1224],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
index a8931a2..92078e8a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
@@ -18,12 +18,7 @@
                 {
                   "bounds": [185, 1025],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index f7902a27..7c2197f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -143,10 +138,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2541],
+  "bounds": [785, 2466],
   "children": [
     {
-      "bounds": [785, 2541],
+      "bounds": [785, 2466],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -163,12 +158,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -272,10 +262,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4476],
+  "bounds": [785, 4326],
   "children": [
     {
-      "bounds": [785, 4476],
+      "bounds": [785, 4326],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,15 +279,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -401,10 +383,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6411],
+  "bounds": [785, 6141],
   "children": [
     {
-      "bounds": [785, 6411],
+      "bounds": [785, 6141],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -418,14 +400,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
index 371d02e..2d3f1d6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -140,10 +135,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2478],
+  "bounds": [785, 2403],
   "children": [
     {
-      "bounds": [785, 2478],
+      "bounds": [785, 2403],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -157,15 +152,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -269,10 +256,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4413],
+  "bounds": [785, 4218],
   "children": [
     {
-      "bounds": [785, 4413],
+      "bounds": [785, 4218],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -286,14 +273,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 3c0e072..9ccd40d7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -140,10 +135,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2496],
+  "bounds": [785, 2421],
   "children": [
     {
-      "bounds": [785, 2496],
+      "bounds": [785, 2421],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -160,12 +155,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -269,10 +259,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4431],
+  "bounds": [785, 4281],
   "children": [
     {
-      "bounds": [785, 4431],
+      "bounds": [785, 4281],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,12 +279,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -398,10 +383,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6366],
+  "bounds": [785, 6141],
   "children": [
     {
-      "bounds": [785, 6366],
+      "bounds": [785, 6141],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -415,15 +400,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
index d876f5c..f335c902 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
@@ -193,11 +193,6 @@
                     "InlineTextBox '\n'",
                     "InlineTextBox '  Text'",
                     "InlineTextBox '\n'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
index 2ac8fbd..fb48616 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
@@ -74,11 +74,6 @@
                     "InlineTextBox 'Findme in a typewriter!'",
                     "LayoutSVGInlineText #text",
                     "InlineTextBox 'Findme on a path! Did you findme?'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
index 5088f64..d77a2aa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 308],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -60,12 +55,7 @@
                 {
                   "bounds": [189, 308],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
index cf78466..f30493ed 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
@@ -21,12 +21,7 @@
                     {
                       "bounds": [85, 144],
                       "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "drawsContent": true
                     }
                   ]
                 },
@@ -87,12 +82,7 @@
                 {
                   "bounds": [105, 144],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -148,12 +138,7 @@
                   "children": [
                     {
                       "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "shouldFlattenTransform": false
                     }
                   ]
                 },
@@ -217,12 +202,7 @@
                     {
                       "bounds": [85, 144],
                       "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "drawsContent": true
                     }
                   ]
                 },
@@ -283,12 +263,7 @@
                 {
                   "bounds": [105, 144],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -344,12 +319,7 @@
                   "children": [
                     {
                       "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
+                      "shouldFlattenTransform": false
                     }
                   ]
                 },
@@ -409,12 +379,7 @@
               "children": [
                 {
                   "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -467,12 +432,7 @@
               "children": [
                 {
                   "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -526,12 +486,7 @@
                 {
                   "bounds": [85, 144],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -591,12 +546,7 @@
               "children": [
                 {
                   "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -657,12 +607,7 @@
                 {
                   "bounds": [85, 144],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -722,12 +667,7 @@
               "children": [
                 {
                   "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
index 1cb453f..f6f49afd 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
@@ -103,11 +103,6 @@
                     "InlineTextBox 'CONTENT'",
                     "LayoutText #text",
                     "InlineTextBox 'CONTENT'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
index 6f166e1f..ac34cdd4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
@@ -30,11 +30,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='container'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
index 44ed023..032b61b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac-snowleopard/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='indicator'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
deleted file mode 100644
index 7c8d8a5..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [800, 600],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [785, 600],
-              "children": [
-                {
-                  "bounds": [785, 1000],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "position": [192, 0],
-                          "bounds": [100, 100],
-                          "contentsOpaque": true,
-                          "drawsContent": true,
-                          "backgroundColor": "#FFFF00"
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [785, 0],
-                  "bounds": [15, 600]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
deleted file mode 100644
index f507549..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-Even though the fixed-position element's container is nonscrollable, it should still be composited because one of its ancestors is scrolling.
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 68],
-          "bounds": [302, 302],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [1, 1],
-              "bounds": [285, 285],
-              "children": [
-                {
-                  "bounds": [285, 800],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [1, 286],
-                  "bounds": [285, 15]
-                },
-                {
-                  "position": [286, 1],
-                  "bounds": [15, 285]
-                },
-                {
-                  "position": [286, 286],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [10, 100],
-          "bounds": [100, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#00FF00"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
deleted file mode 100644
index ce54543..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [200, 200],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [200, 200],
-              "shouldFlattenTransform": false,
-              "transform": [
-                [1, 0, 0, 0],
-                [0, 1, 0, 0],
-                [0, 0, 1, -0.01],
-                [0, 0, 0, 1]
-              ],
-              "children": [
-                {
-                  "bounds": [185, 185],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "bounds": [185, 265],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false,
-                          "children": [
-                            {
-                              "position": [0, 65],
-                              "bounds": [60, 200],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#008000",
-                              "transform": [
-                                [1, 0, 0, 0],
-                                [0, 1, 0, 0],
-                                [0, 0, 1, 0],
-                                [0, 0, 10, 1]
-                              ]
-                            },
-                            {
-                              "position": [65, 65],
-                              "bounds": [60, 200],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#0000FF",
-                              "transform": [
-                                [1, 0, 0, 0],
-                                [0, 1, 0, 0],
-                                [0, 0, 1, 0],
-                                [0, 0, 20, 1]
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 185],
-                  "bounds": [185, 15]
-                },
-                {
-                  "position": [185, 0],
-                  "bounds": [15, 185]
-                },
-                {
-                  "position": [185, 185],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/clear-scroll-parent-expected.txt
deleted file mode 100644
index 3639926..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/clear-scroll-parent-expected.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [308, 208],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [4, 4],
-              "bounds": [285, 200],
-              "children": [
-                {
-                  "bounds": [285, 530],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [289, 4],
-                  "bounds": [15, 185]
-                },
-                {
-                  "position": [289, 189],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [50, 200],
-          "bounds": [200, 200],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [12, 12],
-          "bounds": [80, 80],
-          "shouldFlattenTransform": false,
-          "hasScrollParent": true,
-          "children": [
-            {
-              "position": [10, 10],
-              "bounds": [100, 100],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#FF0000"
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "hasScrollParent": true,
-          "children": [
-            {
-              "position": [22, 102],
-              "bounds": [100, 100],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [22, 212],
-              "bounds": [100, 320],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/composited-scrolling-paint-phases-expected.txt
deleted file mode 100644
index ffcafae5..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/composited-scrolling-paint-phases-expected.txt
+++ /dev/null
@@ -1,132 +0,0 @@
-{
-  "bounds": [800, 600],
-  "paintingPhases": [
-    "GraphicsLayerPaintBackground",
-    "GraphicsLayerPaintForeground",
-    "GraphicsLayerPaintMask"
-  ],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "paintingPhases": [
-        "GraphicsLayerPaintBackground",
-        "GraphicsLayerPaintForeground",
-        "GraphicsLayerPaintMask"
-      ],
-      "children": [
-        {
-          "bounds": [800, 242],
-          "drawsContent": true,
-          "paintingPhases": [
-            "GraphicsLayerPaintBackground",
-            "GraphicsLayerPaintMask"
-          ],
-          "children": [
-            {
-              "position": [29, 31],
-              "bounds": [80, 10],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#008000",
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintForeground",
-                "GraphicsLayerPaintMask"
-              ]
-            },
-            {
-              "bounds": [800, 242],
-              "drawsContent": true,
-              "paintingPhases": [
-                "GraphicsLayerPaintForeground"
-              ]
-            },
-            {
-              "position": [28, 20],
-              "bounds": [202, 202],
-              "drawsContent": true,
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintMask",
-                "GraphicsLayerPaintCompositedScroll"
-              ],
-              "children": [
-                {
-                  "position": [1, 1],
-                  "bounds": [185, 185],
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ],
-                  "children": [
-                    {
-                      "bounds": [185, 715],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintOverflowContents",
-                        "GraphicsLayerPaintCompositedScroll"
-                      ],
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false,
-                          "paintingPhases": [
-                            "GraphicsLayerPaintForeground",
-                            "GraphicsLayerPaintOverflowContents",
-                            "GraphicsLayerPaintCompositedScroll"
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ],
-                  "children": [
-                    {
-                      "position": [1, 186],
-                      "bounds": [185, 15],
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    },
-                    {
-                      "position": [186, 1],
-                      "bounds": [15, 185],
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    },
-                    {
-                      "position": [186, 186],
-                      "bounds": [15, 15],
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/content-gains-scrollbars-expected.txt
deleted file mode 100644
index e34bb0c8..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/content-gains-scrollbars-expected.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 100],
-              "children": [
-                {
-                  "bounds": [85, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 100]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 85],
-              "children": [
-                {
-                  "bounds": [200, 85],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [100, 15]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [200, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 100],
-              "children": [
-                {
-                  "bounds": [10, 10]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/overflow-scrollbar-layers-expected.txt
deleted file mode 100644
index e34bb0c8..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/overflow-scrollbar-layers-expected.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 100],
-              "children": [
-                {
-                  "bounds": [85, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 100]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 85],
-              "children": [
-                {
-                  "bounds": [200, 85],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [100, 15]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [200, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 100],
-              "children": [
-                {
-                  "bounds": [10, 10]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
deleted file mode 100644
index 25a29071..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-{
-  "bounds": [1208, 821],
-  "children": [
-    {
-      "bounds": [1208, 821],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [1200, 800],
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "bounds": [1200, 800],
-              "drawsContent": true,
-              "children": [
-                {
-                  "bounds": [1200, 800],
-                  "children": [
-                    {
-                      "bounds": [1200, 1000],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [1200, 1000],
-                          "drawsContent": true,
-                          "children": [
-                            {
-                              "bounds": [1200, 1000],
-                              "children": [
-                                {
-                                  "bounds": [1200, 10000],
-                                  "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 10008],
-          "bounds": [1200, 0]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [1200, 1000],
-          "children": [
-            {
-              "children": [
-                {
-                  "position": [1193, 0],
-                  "bounds": [7, 1000]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scroll-parent-absolute-expected.txt
deleted file mode 100644
index b391a74..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scroll-parent-absolute-expected.txt
+++ /dev/null
@@ -1,80 +0,0 @@
-{
-  "bounds": [785, 5516],
-  "children": [
-    {
-      "bounds": [785, 5516],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [8, 8],
-              "bounds": [500, 500],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF",
-              "children": [
-                {
-                  "bounds": [485, 485],
-                  "children": [
-                    {
-                      "bounds": [485, 5000],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [0, 485],
-                      "bounds": [485, 15]
-                    },
-                    {
-                      "position": [485, 0],
-                      "bounds": [15, 485]
-                    },
-                    {
-                      "position": [485, 485],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [8, 8],
-              "bounds": [400, 400],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backfaceVisibility": "hidden",
-          "backgroundColor": "#FFFF00"
-        },
-        {
-          "position": [8, 8],
-          "bounds": [20, 5000],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#FA8072",
-          "hasScrollParent": true
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
deleted file mode 100644
index d3f96465..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [98, 90],
-          "bounds": [300, 300],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backfaceVisibility": "hidden",
-          "backgroundColor": "#FFEFD5",
-          "children": [
-            {
-              "bounds": [102, 102],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [1, 1],
-                  "bounds": [100, 100],
-                  "children": [
-                    {
-                      "bounds": [100, 180],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [60, 60],
-          "bounds": [80, 80],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [103, 95],
-              "bounds": [60, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [103, 139],
-              "bounds": [60, 128],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [98, 90],
-          "children": [
-            {
-              "position": [94, 1],
-              "bounds": [7, 100]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
deleted file mode 100644
index 82f793e..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "bounds": [320, 340],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [305, 325],
-              "children": [
-                {
-                  "bounds": [305, 1224],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 325],
-                  "bounds": [305, 15]
-                },
-                {
-                  "position": [305, 0],
-                  "bounds": [15, 325]
-                },
-                {
-                  "position": [305, 325],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [10, 10],
-          "bounds": [284, 1204],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#C0C0C0"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scrolling-without-painting-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scrolling-without-painting-expected.txt
index 5bb4b2d6..2f93caa5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scrolling-without-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/scrolling-without-painting-expected.txt
@@ -18,12 +18,7 @@
                 {
                   "bounds": [185, 1025],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 41b46cb..d956378 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -141,10 +136,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2511],
+  "bounds": [785, 2436],
   "children": [
     {
-      "bounds": [785, 2511],
+      "bounds": [785, 2436],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -161,12 +156,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -268,10 +258,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4416],
+  "bounds": [785, 4266],
   "children": [
     {
-      "bounds": [785, 4416],
+      "bounds": [785, 4266],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -285,15 +275,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -395,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6321],
+  "bounds": [785, 6051],
   "children": [
     {
-      "bounds": [785, 6321],
+      "bounds": [785, 6051],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -412,14 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-toggling-expected.txt
index c3d9d853..655e094 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -138,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2448],
+  "bounds": [785, 2373],
   "children": [
     {
-      "bounds": [785, 2448],
+      "bounds": [785, 2373],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -155,15 +150,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -265,10 +252,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4353],
+  "bounds": [785, 4158],
   "children": [
     {
-      "bounds": [785, 4353],
+      "bounds": [785, 4158],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -282,14 +269,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index a523eab7..595a6d3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -138,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2466],
+  "bounds": [785, 2391],
   "children": [
     {
-      "bounds": [785, 2466],
+      "bounds": [785, 2391],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -158,12 +153,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -265,10 +255,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4371],
+  "bounds": [785, 4221],
   "children": [
     {
-      "bounds": [785, 4371],
+      "bounds": [785, 4221],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -285,12 +275,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -392,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6276],
+  "bounds": [785, 6051],
   "children": [
     {
-      "bounds": [785, 6276],
+      "bounds": [785, 6051],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -409,15 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/textarea-scroll-touch-expected.txt
index 6562a91..0ef5bac 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 270],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -59,12 +54,7 @@
                 {
                   "bounds": [189, 270],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
deleted file mode 100644
index 7ca7dcf..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
+++ /dev/null
@@ -1,1005 +0,0 @@
-{
-  "bounds": [785, 2016],
-  "children": [
-    {
-      "bounds": [785, 2016],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [10, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15]
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85]
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [35, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [130, 10],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [157, 18],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [136, -15],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [250, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15]
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85]
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [275, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [370, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15]
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85]
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [395, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [10, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [37, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [16, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [130, 130],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15]
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85]
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [155, 195],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 105],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 161],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [250, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [277, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [256, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [370, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [397, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [376, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [10, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [35, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [130, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [155, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [250, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [275, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [370, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [395, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [375, 20],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [15, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [135, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [255, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [15, 260],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [135, 260],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/updating-scrolling-content-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/updating-scrolling-content-expected.txt
index c7895ce..4b9345a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/updating-scrolling-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/overflow/updating-scrolling-content-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='indicator'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
index 072bfee..334af7a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='content'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/scrollbars/nested-overlay-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
deleted file mode 100644
index 1ac3074..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
+++ /dev/null
@@ -1,104 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [404, 404],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [400, 400],
-              "children": [
-                {
-                  "bounds": [400, 704],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "position": [0, 500],
-                          "bounds": [204, 204],
-                          "drawsContent": true,
-                          "children": [
-                            {
-                              "position": [2, 2],
-                              "bounds": [200, 200],
-                              "children": [
-                                {
-                                  "bounds": [5000, 9000],
-                                  "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
-                                }
-                              ]
-                            }
-                          ]
-                        },
-                        {
-                          "shouldFlattenTransform": false,
-                          "children": [
-                            {
-                              "position": [2, 502],
-                              "bounds": [100, 800],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#808080"
-                            },
-                            {
-                              "position": [2, 2502],
-                              "bounds": [5000, 1000],
-                              "drawsContent": true
-                            }
-                          ]
-                        },
-                        {
-                          "position": [2, 502],
-                          "children": [
-                            {
-                              "position": [2, 195],
-                              "bounds": [193, 7]
-                            },
-                            {
-                              "position": [195, 2],
-                              "bounds": [7, 193]
-                            },
-                            {
-                              "position": [195, 195],
-                              "bounds": [7, 7],
-                              "drawsContent": true
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [395, 2],
-                  "bounds": [7, 400]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/squashing/composited-bounds-for-negative-z-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/squashing/composited-bounds-for-negative-z-expected.txt
deleted file mode 100644
index 718c3e1e..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/squashing/composited-bounds-for-negative-z-expected.txt
+++ /dev/null
@@ -1,72 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "children": [
-        {
-          "bounds": [800, 408],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [8, 100],
-              "bounds": [10, 10],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#FF0000"
-            },
-            {
-              "bounds": [800, 408],
-              "drawsContent": true
-            },
-            {
-              "position": [108, 100],
-              "bounds": [300, 300],
-              "drawsContent": true,
-              "children": [
-                {
-                  "bounds": [285, 300],
-                  "children": [
-                    {
-                      "bounds": [285, 1000],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [285, 0],
-                      "bounds": [15, 300]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "shouldFlattenTransform": false,
-              "children": [
-                {
-                  "position": [108, 100],
-                  "bounds": [285, 1000]
-                },
-                {
-                  "position": [108, 100],
-                  "bounds": [285, 1000],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/squashing/selection-repaint-with-gaps-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/squashing/selection-repaint-with-gaps-expected.txt
index 518556f..dd86e67 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/squashing/selection-repaint-with-gaps-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/compositing/squashing/selection-repaint-with-gaps-expected.txt
@@ -19,8 +19,7 @@
               "bounds": [100, 210],
               "drawsContent": true,
               "repaintRects": [
-                [37, 80, 3, 18],
-                [0, 80, 40, 36]
+                [0, 80, 42, 36]
               ]
             }
           ]
@@ -49,12 +48,8 @@
               "bounds": [100, 210],
               "drawsContent": true,
               "repaintRects": [
-                [37, 160, 3, 18],
-                [37, 80, 3, 36],
-                [37, 80, 3, 18],
-                [0, 160, 40, 36],
-                [0, 80, 100, 50],
-                [0, 80, 40, 36]
+                [0, 160, 42, 36],
+                [0, 80, 44, 36]
               ]
             }
           ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/compositing/update-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/compositing/update-paint-phases-expected.txt
deleted file mode 100644
index 664852e..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/compositing/update-paint-phases-expected.txt
+++ /dev/null
@@ -1,103 +0,0 @@
-{
-  "bounds": [800, 600],
-  "paintingPhases": [
-    "GraphicsLayerPaintBackground",
-    "GraphicsLayerPaintForeground",
-    "GraphicsLayerPaintMask"
-  ],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "paintingPhases": [
-        "GraphicsLayerPaintBackground",
-        "GraphicsLayerPaintForeground",
-        "GraphicsLayerPaintMask"
-      ],
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [102, 102],
-          "drawsContent": true,
-          "paintingPhases": [
-            "GraphicsLayerPaintBackground",
-            "GraphicsLayerPaintMask",
-            "GraphicsLayerPaintCompositedScroll"
-          ],
-          "children": [
-            {
-              "position": [1, 1],
-              "bounds": [85, 85],
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintForeground",
-                "GraphicsLayerPaintMask"
-              ],
-              "children": [
-                {
-                  "bounds": [85, 120],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "paintingPhases": [
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintOverflowContents",
-                    "GraphicsLayerPaintCompositedScroll"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintOverflowContents",
-                        "GraphicsLayerPaintCompositedScroll"
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintForeground",
-                "GraphicsLayerPaintMask"
-              ],
-              "children": [
-                {
-                  "position": [1, 86],
-                  "bounds": [85, 15],
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ]
-                },
-                {
-                  "position": [86, 1],
-                  "bounds": [15, 85],
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ]
-                },
-                {
-                  "position": [86, 86],
-                  "bounds": [15, 15],
-                  "drawsContent": true,
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-expected.txt
index f0e0c7d..ad4d7c1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-expected.txt
@@ -61,7 +61,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-hw-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-hw-expected.png
index 6f12dc5..1ff35c89 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-hw-expected.txt
index af948d03..9300dac4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-hw-expected.txt
@@ -61,7 +61,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-expected.txt
index a1d8c656..1a1bf86 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-expected.txt
@@ -59,7 +59,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-hw-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-hw-expected.png
index c926577..0baa4ba 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-hw-expected.txt
index a1d8c656..1a1bf86 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-subregion-hw-expected.txt
@@ -59,7 +59,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-expected.txt
index 86d67a9..ca8b9b9d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-expected.txt
@@ -7,19 +7,19 @@
         LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
           LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
       LayoutText {#text} at (0,96) size 4x18
         text run at (0,96) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-hw-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-hw-expected.png
index b6a54c1..48c392c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-hw-expected.txt
index 86d67a9..ca8b9b9d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/filters/effect-reference-tile-hw-expected.txt
@@ -7,19 +7,19 @@
         LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
           LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
       LayoutText {#text} at (0,96) size 4x18
         text run at (0,96) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-161-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-161-expected.png
index 848d3a39a7..64a1bac 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-161-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-161-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-161-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-161-expected.txt
index f6aff119..8db38ab 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-161-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-161-expected.txt
@@ -9,10 +9,10 @@
       LayoutBlockFlow {P} at (0,34) size 784x37 [bgcolor=#00FF00]
         LayoutText {#text} at (0,0) size 705x18
           text run at (0,0) width 705: "UAs may render the following element as a pop up menu. If so, please ensure the menu is unstyled (or green)."
-        LayoutMenuList {SELECT} at (0,19) size 100x18 [border: (1px solid #A6A6A6)]
-          LayoutBlockFlow (anonymous) at (1,1) size 98x16
-            LayoutText (anonymous) at (8,1) size 61x13
-              text run at (8,1) width 61: "This should"
+        LayoutMenuList {SELECT} at (0,19) size 96x18 [border: (1px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (1,1) size 94x16
+            LayoutText (anonymous) at (8,1) size 58x13
+              text run at (8,1) width 58: "This should"
         LayoutText {#text} at (0,0) size 0x0
       LayoutTable {TABLE} at (0,87) size 438x24 [bgcolor=#00FF00]
         LayoutTableSection {TBODY} at (0,0) size 438x24
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-19b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-19b-expected.png
index 71d33db..e31eb997 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-19b-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-19b-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-19b-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-19b-expected.txt
index ea88a90..e7819e2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-19b-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-19b-expected.txt
@@ -4,7 +4,7 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x51
     LayoutBlockFlow {BODY} at (8,16) size 784x19
       LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutButton {BUTTON} at (0,1) size 480.44x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 464.44x13
-            LayoutText {#text} at (0,0) size 465x13
-              text run at (0,0) width 465: "Activating (e.g. holding the mouse button down on) this button should make it go green."
+        LayoutButton {BUTTON} at (0,1) size 454.19x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 438.19x13
+            LayoutText {#text} at (0,0) size 439x13
+              text run at (0,0) width 439: "Activating (e.g. holding the mouse button down on) this button should make it go green."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-23-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-23-expected.png
index 157c19b..6fbd40e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-23-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-23-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-23-expected.txt
index 6c485ca..f6495ffc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-23-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x73
     LayoutBlockFlow {BODY} at (8,16) size 784x41
       LayoutBlockFlow {P} at (0,0) size 784x41
-        LayoutButton {BUTTON} at (0,0) size 238.25x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,4) size 222.25x13
-            LayoutText {#text} at (0,0) size 223x13
-              text run at (0,0) width 223: "A button (enabled) with green background"
-        LayoutText {#text} at (238,1) size 5x18
-          text run at (238,1) width 5: " "
+        LayoutButton {BUTTON} at (0,0) size 226.17x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,4) size 210.17x13
+            LayoutText {#text} at (0,0) size 211x13
+              text run at (0,0) width 211: "A button (enabled) with green background"
+        LayoutText {#text} at (226,1) size 5x18
+          text run at (226,1) width 5: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 227x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 221x13 scrollWidth 233
+layer at (11,41) size 221x13
   LayoutBlockFlow {DIV} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 234x13
-      text run at (0,0) width 234: "a text area (enabled) with green background"
+    LayoutText {#text} at (0,0) size 221x13
+      text run at (0,0) width 221: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-24-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-24-expected.png
index 1f878cff..abb6112 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-24-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-24-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-24-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-24-expected.txt
index ff842d68..171b172e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-24-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-24-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x73
     LayoutBlockFlow {BODY} at (8,16) size 784x41
       LayoutBlockFlow {P} at (0,0) size 784x41
-        LayoutButton {BUTTON} at (0,0) size 241.03x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,4) size 225.03x13
-            LayoutText {#text} at (0,0) size 226x13
-              text run at (0,0) width 226: "A button (disabled) with green background"
-        LayoutText {#text} at (241,1) size 5x18
-          text run at (241,1) width 5: " "
+        LayoutButton {BUTTON} at (0,0) size 228.66x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,4) size 212.66x13
+            LayoutText {#text} at (0,0) size 213x13
+              text run at (0,0) width 213: "A button (disabled) with green background"
+        LayoutText {#text} at (228,1) size 5x18
+          text run at (228,1) width 5: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 227x19 [color=#545454] [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 221x13 scrollWidth 236
+layer at (11,41) size 221x13 scrollWidth 223
   LayoutBlockFlow {DIV} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 236x13
-      text run at (0,0) width 236: "a text area (disabled) with green background"
+    LayoutText {#text} at (0,0) size 223x13
+      text run at (0,0) width 223: "a text area (disabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-64-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-64-expected.png
index 962e93e..7aca891f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-64-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-64-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-64-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-64-expected.txt
index 29179ce..885bde0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-64-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-64-expected.txt
@@ -10,8 +10,8 @@
               text run at (0,0) width 286: "This text should turn green while it is active."
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {P} at (0,34) size 784x19 [color=#00FF00]
-          LayoutButton {BUTTON} at (0,1) size 248.63x18 [color=#000000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 232.63x13
-              LayoutText {#text} at (0,0) size 233x13
-                text run at (0,0) width 233: "This text should turn green while it is active."
+          LayoutButton {BUTTON} at (0,1) size 234.44x18 [color=#000000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 218.44x13
+              LayoutText {#text} at (0,0) size 219x13
+                text run at (0,0) width 219: "This text should turn green while it is active."
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-68-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-68-expected.png
index 1f878cff..abb6112 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-68-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-68-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-68-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-68-expected.txt
index ff842d68..171b172e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-68-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-68-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x73
     LayoutBlockFlow {BODY} at (8,16) size 784x41
       LayoutBlockFlow {P} at (0,0) size 784x41
-        LayoutButton {BUTTON} at (0,0) size 241.03x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,4) size 225.03x13
-            LayoutText {#text} at (0,0) size 226x13
-              text run at (0,0) width 226: "A button (disabled) with green background"
-        LayoutText {#text} at (241,1) size 5x18
-          text run at (241,1) width 5: " "
+        LayoutButton {BUTTON} at (0,0) size 228.66x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,4) size 212.66x13
+            LayoutText {#text} at (0,0) size 213x13
+              text run at (0,0) width 213: "A button (disabled) with green background"
+        LayoutText {#text} at (228,1) size 5x18
+          text run at (228,1) width 5: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 227x19 [color=#545454] [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 221x13 scrollWidth 236
+layer at (11,41) size 221x13 scrollWidth 223
   LayoutBlockFlow {DIV} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 236x13
-      text run at (0,0) width 236: "a text area (disabled) with green background"
+    LayoutText {#text} at (0,0) size 223x13
+      text run at (0,0) width 223: "a text area (disabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-69-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-69-expected.png
index 157c19b..6fbd40e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-69-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-69-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-69-expected.txt
index 6c485ca..f6495ffc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/html/css3-modsel-69-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x73
     LayoutBlockFlow {BODY} at (8,16) size 784x41
       LayoutBlockFlow {P} at (0,0) size 784x41
-        LayoutButton {BUTTON} at (0,0) size 238.25x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,4) size 222.25x13
-            LayoutText {#text} at (0,0) size 223x13
-              text run at (0,0) width 223: "A button (enabled) with green background"
-        LayoutText {#text} at (238,1) size 5x18
-          text run at (238,1) width 5: " "
+        LayoutButton {BUTTON} at (0,0) size 226.17x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,4) size 210.17x13
+            LayoutText {#text} at (0,0) size 211x13
+              text run at (0,0) width 211: "A button (enabled) with green background"
+        LayoutText {#text} at (226,1) size 5x18
+          text run at (226,1) width 5: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutTextControl {INPUT} at (0,22) size 227x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 221x13 scrollWidth 233
+layer at (11,41) size 221x13
   LayoutBlockFlow {DIV} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 234x13
-      text run at (0,0) width 234: "a text area (enabled) with green background"
+    LayoutText {#text} at (0,0) size 221x13
+      text run at (0,0) width 221: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-161-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-161-expected.png
index 848d3a39a7..64a1bac 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-161-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-161-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-161-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-161-expected.txt
index ffbc7df..48fc12c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-161-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-161-expected.txt
@@ -9,10 +9,10 @@
       LayoutBlockFlow {p} at (0,34) size 784x37 [bgcolor=#00FF00]
         LayoutText {#text} at (0,0) size 705x18
           text run at (0,0) width 705: "UAs may render the following element as a pop up menu. If so, please ensure the menu is unstyled (or green)."
-        LayoutMenuList {select} at (0,19) size 100x18 [border: (1px solid #A6A6A6)]
-          LayoutBlockFlow (anonymous) at (1,1) size 98x16
-            LayoutText (anonymous) at (8,1) size 61x13
-              text run at (8,1) width 61: "This should"
+        LayoutMenuList {select} at (0,19) size 96x18 [border: (1px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (1,1) size 94x16
+            LayoutText (anonymous) at (8,1) size 58x13
+              text run at (8,1) width 58: "This should"
         LayoutText {#text} at (0,0) size 0x0
       LayoutTable {table} at (0,87) size 438x24 [bgcolor=#00FF00]
         LayoutTableSection (anonymous) at (0,0) size 438x24
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-19b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-19b-expected.png
index 71d33db..e31eb997 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-19b-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-19b-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-19b-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-19b-expected.txt
index d7eca60..4c799e1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-19b-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-19b-expected.txt
@@ -4,7 +4,7 @@
   LayoutBlockFlow {html} at (0,0) size 800x51
     LayoutBlockFlow {body} at (8,16) size 784x19
       LayoutBlockFlow {p} at (0,0) size 784x19
-        LayoutButton {button} at (0,1) size 480.44x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 464.44x13
-            LayoutText {#text} at (0,0) size 465x13
-              text run at (0,0) width 465: "Activating (e.g. holding the mouse button down on) this button should make it go green."
+        LayoutButton {button} at (0,1) size 454.19x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 438.19x13
+            LayoutText {#text} at (0,0) size 439x13
+              text run at (0,0) width 439: "Activating (e.g. holding the mouse button down on) this button should make it go green."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-23-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-23-expected.png
index 157c19b..6fbd40e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-23-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-23-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-23-expected.txt
index 9128617..4f59598 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-23-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {html} at (0,0) size 800x73
     LayoutBlockFlow {body} at (8,16) size 784x41
       LayoutBlockFlow {p} at (0,0) size 784x41
-        LayoutButton {button} at (0,0) size 238.25x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,4) size 222.25x13
-            LayoutText {#text} at (0,0) size 223x13
-              text run at (0,0) width 223: "A button (enabled) with green background"
-        LayoutText {#text} at (238,1) size 5x18
-          text run at (238,1) width 5: " "
+        LayoutButton {button} at (0,0) size 226.17x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,4) size 210.17x13
+            LayoutText {#text} at (0,0) size 211x13
+              text run at (0,0) width 211: "A button (enabled) with green background"
+        LayoutText {#text} at (226,1) size 5x18
+          text run at (226,1) width 5: " "
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 227x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 221x13 scrollWidth 233
+layer at (11,41) size 221x13
   LayoutBlockFlow {div} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 234x13
-      text run at (0,0) width 234: "a text area (enabled) with green background"
+    LayoutText {#text} at (0,0) size 221x13
+      text run at (0,0) width 221: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-24-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-24-expected.png
index 1f878cff..abb6112 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-24-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-24-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-24-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-24-expected.txt
index fb3f16d..82e5a5e5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-24-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-24-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {html} at (0,0) size 800x73
     LayoutBlockFlow {body} at (8,16) size 784x41
       LayoutBlockFlow {p} at (0,0) size 784x41
-        LayoutButton {button} at (0,0) size 241.03x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,4) size 225.03x13
-            LayoutText {#text} at (0,0) size 226x13
-              text run at (0,0) width 226: "A button (disabled) with green background"
-        LayoutText {#text} at (241,1) size 5x18
-          text run at (241,1) width 5: " "
+        LayoutButton {button} at (0,0) size 228.66x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,4) size 212.66x13
+            LayoutText {#text} at (0,0) size 213x13
+              text run at (0,0) width 213: "A button (disabled) with green background"
+        LayoutText {#text} at (228,1) size 5x18
+          text run at (228,1) width 5: " "
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 227x19 [color=#545454] [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 221x13 scrollWidth 236
+layer at (11,41) size 221x13 scrollWidth 223
   LayoutBlockFlow {div} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 236x13
-      text run at (0,0) width 236: "a text area (disabled) with green background"
+    LayoutText {#text} at (0,0) size 223x13
+      text run at (0,0) width 223: "a text area (disabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-64-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-64-expected.png
index 962e93e..7aca891f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-64-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-64-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-64-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-64-expected.txt
index 20b12f07..539cdc5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-64-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-64-expected.txt
@@ -10,8 +10,8 @@
               text run at (0,0) width 286: "This text should turn green while it is active."
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {p} at (0,34) size 784x19 [color=#00FF00]
-          LayoutButton {button} at (0,1) size 248.63x18 [color=#000000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 232.63x13
-              LayoutText {#text} at (0,0) size 233x13
-                text run at (0,0) width 233: "This text should turn green while it is active."
+          LayoutButton {button} at (0,1) size 234.44x18 [color=#000000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 218.44x13
+              LayoutText {#text} at (0,0) size 219x13
+                text run at (0,0) width 219: "This text should turn green while it is active."
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-68-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-68-expected.png
index 1f878cff..abb6112 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-68-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-68-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-68-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-68-expected.txt
index fb3f16d..82e5a5e5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-68-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-68-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {html} at (0,0) size 800x73
     LayoutBlockFlow {body} at (8,16) size 784x41
       LayoutBlockFlow {p} at (0,0) size 784x41
-        LayoutButton {button} at (0,0) size 241.03x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,4) size 225.03x13
-            LayoutText {#text} at (0,0) size 226x13
-              text run at (0,0) width 226: "A button (disabled) with green background"
-        LayoutText {#text} at (241,1) size 5x18
-          text run at (241,1) width 5: " "
+        LayoutButton {button} at (0,0) size 228.66x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,4) size 212.66x13
+            LayoutText {#text} at (0,0) size 213x13
+              text run at (0,0) width 213: "A button (disabled) with green background"
+        LayoutText {#text} at (228,1) size 5x18
+          text run at (228,1) width 5: " "
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 227x19 [color=#545454] [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 221x13 scrollWidth 236
+layer at (11,41) size 221x13 scrollWidth 223
   LayoutBlockFlow {div} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 236x13
-      text run at (0,0) width 236: "a text area (disabled) with green background"
+    LayoutText {#text} at (0,0) size 223x13
+      text run at (0,0) width 223: "a text area (disabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-69-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-69-expected.png
index 157c19b..6fbd40e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-69-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-69-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-69-expected.txt
index 9128617..4f59598 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xhtml/css3-modsel-69-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {html} at (0,0) size 800x73
     LayoutBlockFlow {body} at (8,16) size 784x41
       LayoutBlockFlow {p} at (0,0) size 784x41
-        LayoutButton {button} at (0,0) size 238.25x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,4) size 222.25x13
-            LayoutText {#text} at (0,0) size 223x13
-              text run at (0,0) width 223: "A button (enabled) with green background"
-        LayoutText {#text} at (238,1) size 5x18
-          text run at (238,1) width 5: " "
+        LayoutButton {button} at (0,0) size 226.17x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,4) size 210.17x13
+            LayoutText {#text} at (0,0) size 211x13
+              text run at (0,0) width 211: "A button (enabled) with green background"
+        LayoutText {#text} at (226,1) size 5x18
+          text run at (226,1) width 5: " "
         LayoutBR {br} at (0,0) size 0x0
         LayoutTextControl {input} at (0,22) size 227x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,41) size 221x13 scrollWidth 233
+layer at (11,41) size 221x13
   LayoutBlockFlow {div} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 234x13
-      text run at (0,0) width 234: "a text area (enabled) with green background"
+    LayoutText {#text} at (0,0) size 221x13
+      text run at (0,0) width 221: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-161-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-161-expected.png
index 1f3fef1..2fda977 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-161-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-161-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-161-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-161-expected.txt
index 1a09bf5..f3e4ce2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-161-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-161-expected.txt
@@ -8,10 +8,10 @@
     LayoutBlockFlow {p} at (0,50) size 800x37 [bgcolor=#00FF00]
       LayoutText {#text} at (0,0) size 705x18
         text run at (0,0) width 705: "UAs may render the following element as a pop up menu. If so, please ensure the menu is unstyled (or green)."
-      LayoutMenuList {select} at (0,19) size 100x18 [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 98x16
-          LayoutText (anonymous) at (8,1) size 61x13
-            text run at (8,1) width 61: "This should"
+      LayoutMenuList {select} at (0,19) size 96x18 [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 94x16
+          LayoutText (anonymous) at (8,1) size 58x13
+            text run at (8,1) width 58: "This should"
       LayoutText {#text} at (0,0) size 0x0
     LayoutTable {table} at (0,103) size 438x24 [bgcolor=#00FF00]
       LayoutTableSection (anonymous) at (0,0) size 438x24
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-19b-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-19b-expected.png
index 7b0d563..c4be3c4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-19b-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-19b-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-19b-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-19b-expected.txt
index 67dd190..db5faa1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-19b-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-19b-expected.txt
@@ -3,7 +3,7 @@
 layer at (0,0) size 800x51
   LayoutBlockFlow {test} at (0,0) size 800x51
     LayoutBlockFlow {p} at (0,16) size 800x19
-      LayoutButton {button} at (0,1) size 480.44x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 464.44x13
-          LayoutText {#text} at (0,0) size 465x13
-            text run at (0,0) width 465: "Activating (e.g. holding the mouse button down on) this button should make it go green."
+      LayoutButton {button} at (0,1) size 454.19x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 438.19x13
+          LayoutText {#text} at (0,0) size 439x13
+            text run at (0,0) width 439: "Activating (e.g. holding the mouse button down on) this button should make it go green."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-23-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-23-expected.png
index edbd79c..6d17aa68 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-23-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-23-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-23-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-23-expected.txt
index 70871f4..76fd0aa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-23-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-23-expected.txt
@@ -3,16 +3,16 @@
 layer at (0,0) size 800x73
   LayoutBlockFlow {test} at (0,0) size 800x73
     LayoutBlockFlow {p} at (0,16) size 800x41
-      LayoutButton {button} at (0,0) size 238.25x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 222.25x13
-          LayoutText {#text} at (0,0) size 223x13
-            text run at (0,0) width 223: "A button (enabled) with green background"
-      LayoutText {#text} at (238,1) size 5x18
-        text run at (238,1) width 5: " "
+      LayoutButton {button} at (0,0) size 226.17x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 210.17x13
+          LayoutText {#text} at (0,0) size 211x13
+            text run at (0,0) width 211: "A button (enabled) with green background"
+      LayoutText {#text} at (226,1) size 5x18
+        text run at (226,1) width 5: " "
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 227x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (3,41) size 221x13 scrollWidth 233
+layer at (3,41) size 221x13
   LayoutBlockFlow {div} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 234x13
-      text run at (0,0) width 234: "a text area (enabled) with green background"
+    LayoutText {#text} at (0,0) size 221x13
+      text run at (0,0) width 221: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-24-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-24-expected.png
index c6ff5a4..0e7ed934 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-24-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-24-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-24-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-24-expected.txt
index 69db2b1..29d9c8e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-24-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-24-expected.txt
@@ -3,16 +3,16 @@
 layer at (0,0) size 800x73
   LayoutBlockFlow {test} at (0,0) size 800x73
     LayoutBlockFlow {p} at (0,16) size 800x41
-      LayoutButton {button} at (0,0) size 241.03x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 225.03x13
-          LayoutText {#text} at (0,0) size 226x13
-            text run at (0,0) width 226: "A button (disabled) with green background"
-      LayoutText {#text} at (241,1) size 5x18
-        text run at (241,1) width 5: " "
+      LayoutButton {button} at (0,0) size 228.66x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 212.66x13
+          LayoutText {#text} at (0,0) size 213x13
+            text run at (0,0) width 213: "A button (disabled) with green background"
+      LayoutText {#text} at (228,1) size 5x18
+        text run at (228,1) width 5: " "
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 227x19 [color=#545454] [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (3,41) size 221x13 scrollWidth 236
+layer at (3,41) size 221x13 scrollWidth 223
   LayoutBlockFlow {div} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 236x13
-      text run at (0,0) width 236: "a text area (disabled) with green background"
+    LayoutText {#text} at (0,0) size 223x13
+      text run at (0,0) width 223: "a text area (disabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-64-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-64-expected.png
index a230c292..dcbf1df 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-64-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-64-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-64-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-64-expected.txt
index a6f9e3c..850591e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-64-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-64-expected.txt
@@ -9,8 +9,8 @@
             text run at (0,0) width 286: "This text should turn green while it is active."
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {p} at (0,34) size 800x19 [color=#00FF00]
-        LayoutButton {button} at (0,1) size 248.63x18 [color=#000000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 232.63x13
-            LayoutText {#text} at (0,0) size 233x13
-              text run at (0,0) width 233: "This text should turn green while it is active."
+        LayoutButton {button} at (0,1) size 234.44x18 [color=#000000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 218.44x13
+            LayoutText {#text} at (0,0) size 219x13
+              text run at (0,0) width 219: "This text should turn green while it is active."
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-68-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-68-expected.png
index c6ff5a4..0e7ed934 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-68-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-68-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-68-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-68-expected.txt
index 69db2b1..29d9c8e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-68-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-68-expected.txt
@@ -3,16 +3,16 @@
 layer at (0,0) size 800x73
   LayoutBlockFlow {test} at (0,0) size 800x73
     LayoutBlockFlow {p} at (0,16) size 800x41
-      LayoutButton {button} at (0,0) size 241.03x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 225.03x13
-          LayoutText {#text} at (0,0) size 226x13
-            text run at (0,0) width 226: "A button (disabled) with green background"
-      LayoutText {#text} at (241,1) size 5x18
-        text run at (241,1) width 5: " "
+      LayoutButton {button} at (0,0) size 228.66x22 [color=#7F7F7F] [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 212.66x13
+          LayoutText {#text} at (0,0) size 213x13
+            text run at (0,0) width 213: "A button (disabled) with green background"
+      LayoutText {#text} at (228,1) size 5x18
+        text run at (228,1) width 5: " "
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 227x19 [color=#545454] [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (3,41) size 221x13 scrollWidth 236
+layer at (3,41) size 221x13 scrollWidth 223
   LayoutBlockFlow {div} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 236x13
-      text run at (0,0) width 236: "a text area (disabled) with green background"
+    LayoutText {#text} at (0,0) size 223x13
+      text run at (0,0) width 223: "a text area (disabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-69-expected.png b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-69-expected.png
index edbd79c..6d17aa68 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-69-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-69-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-69-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-69-expected.txt
index 70871f4..76fd0aa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-69-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/css3/selectors3/xml/css3-modsel-69-expected.txt
@@ -3,16 +3,16 @@
 layer at (0,0) size 800x73
   LayoutBlockFlow {test} at (0,0) size 800x73
     LayoutBlockFlow {p} at (0,16) size 800x41
-      LayoutButton {button} at (0,0) size 238.25x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 222.25x13
-          LayoutText {#text} at (0,0) size 223x13
-            text run at (0,0) width 223: "A button (enabled) with green background"
-      LayoutText {#text} at (238,1) size 5x18
-        text run at (238,1) width 5: " "
+      LayoutButton {button} at (0,0) size 226.17x22 [bgcolor=#00FF00] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 210.17x13
+          LayoutText {#text} at (0,0) size 211x13
+            text run at (0,0) width 211: "A button (enabled) with green background"
+      LayoutText {#text} at (226,1) size 5x18
+        text run at (226,1) width 5: " "
       LayoutBR {br} at (0,0) size 0x0
       LayoutTextControl {input} at (0,22) size 227x19 [bgcolor=#00FF00] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (3,41) size 221x13 scrollWidth 233
+layer at (3,41) size 221x13
   LayoutBlockFlow {div} at (3,3) size 221x13
-    LayoutText {#text} at (0,0) size 234x13
-      text run at (0,0) width 234: "a text area (enabled) with green background"
+    LayoutText {#text} at (0,0) size 221x13
+      text run at (0,0) width 221: "a text area (enabled) with green background"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/deleting/delete-to-select-table-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/deleting/delete-to-select-table-expected.png
index 803d6de..71e700b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/deleting/delete-to-select-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/deleting/delete-to-select-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/4916541-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/4916541-expected.png
index 48c292f..86209b57 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/4916541-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/4916541-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5136770-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5136770-expected.png
index 8cb7e07..aa651b4bd 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5136770-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5136770-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5142012-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5142012-1-expected.png
index c8830e32..1f0113be 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5142012-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5142012-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5142012-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5142012-2-expected.png
index 348619f..c0bf3cf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5142012-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5142012-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5190926-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5190926-expected.png
index 97527223..8741004 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5190926-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5190926-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5481523-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5481523-expected.png
index c622c37..983c70e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5481523-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/5481523-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/indent-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/indent-selection-expected.png
index 3f4eec23..29c197b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/indent-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/indent-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/remove-list-from-range-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/remove-list-from-range-selection-expected.png
index 64ec928..a0bf7406 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/remove-list-from-range-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/remove-list-from-range-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/selectAll-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/selectAll-expected.png
index 37aab6e..7d81582 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/selectAll-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/execCommand/selectAll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.png
index 9b0dfbaa..933207e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt
index 9256ed2..010473a6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/input/caret-at-the-edge-of-input-expected.txt
@@ -10,8 +10,8 @@
         LayoutTextControl {INPUT} at (0,0) size 71x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,29) size 65x13 scrollX 33.00 scrollWidth 274
+layer at (11,29) size 65x13 scrollX 36.00 scrollWidth 261
   LayoutBlockFlow {DIV} at (3,3) size 65x13
-    LayoutText {#text} at (0,0) size 274x13
-      text run at (0,0) width 274: "012345678901012345678901234567890123456789"
+    LayoutText {#text} at (0,0) size 262x13
+      text run at (0,0) width 262: "012345678901012345678901234567890123456789"
 caret: position 12 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 3 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.png
index d06528b2..eff2edb1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.txt
index cb05a6b6..1a3b154 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/input/reveal-caret-of-multiline-input-expected.txt
@@ -12,98 +12,98 @@
 layer at (8,26) size 81x136 clip at (9,27) size 64x134 scrollY 98.00 scrollHeight 420
   LayoutTextControl {TEXTAREA} at (0,0) size 81x136 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 60x416
-      LayoutText {#text} at (0,0) size 14x13
-        text run at (0,0) width 14: "00"
-      LayoutBR {BR} at (13,0) size 1x13
-      LayoutText {#text} at (0,13) size 14x13
-        text run at (0,13) width 14: "01"
-      LayoutBR {BR} at (13,13) size 1x13
-      LayoutText {#text} at (0,26) size 14x13
-        text run at (0,26) width 14: "02"
-      LayoutBR {BR} at (13,26) size 1x13
-      LayoutText {#text} at (0,39) size 14x13
-        text run at (0,39) width 14: "03"
-      LayoutBR {BR} at (13,39) size 1x13
-      LayoutText {#text} at (0,52) size 14x13
-        text run at (0,52) width 14: "04"
-      LayoutBR {BR} at (13,52) size 1x13
-      LayoutText {#text} at (0,65) size 14x13
-        text run at (0,65) width 14: "05"
-      LayoutBR {BR} at (13,65) size 1x13
-      LayoutText {#text} at (0,78) size 14x13
-        text run at (0,78) width 14: "06"
-      LayoutBR {BR} at (13,78) size 1x13
-      LayoutText {#text} at (0,91) size 14x13
-        text run at (0,91) width 14: "07"
-      LayoutBR {BR} at (13,91) size 1x13
-      LayoutText {#text} at (0,104) size 14x13
-        text run at (0,104) width 14: "08"
-      LayoutBR {BR} at (13,104) size 1x13
-      LayoutText {#text} at (0,117) size 14x13
-        text run at (0,117) width 14: "09"
-      LayoutBR {BR} at (13,117) size 1x13
-      LayoutText {#text} at (0,130) size 14x13
-        text run at (0,130) width 14: "10"
-      LayoutBR {BR} at (13,130) size 1x13
-      LayoutText {#text} at (0,143) size 14x13
-        text run at (0,143) width 14: "11"
-      LayoutBR {BR} at (13,143) size 1x13
-      LayoutText {#text} at (0,156) size 21x13
-        text run at (0,156) width 21: ">12"
-      LayoutBR {BR} at (20,156) size 1x13
-      LayoutText {#text} at (0,169) size 14x13
-        text run at (0,169) width 14: "13"
-      LayoutBR {BR} at (13,169) size 1x13
-      LayoutText {#text} at (0,182) size 14x13
-        text run at (0,182) width 14: "14"
-      LayoutBR {BR} at (13,182) size 1x13
-      LayoutText {#text} at (0,195) size 14x13
-        text run at (0,195) width 14: "15"
-      LayoutBR {BR} at (13,195) size 1x13
-      LayoutText {#text} at (0,208) size 14x13
-        text run at (0,208) width 14: "16"
-      LayoutBR {BR} at (13,208) size 1x13
-      LayoutText {#text} at (0,221) size 14x13
-        text run at (0,221) width 14: "17"
-      LayoutBR {BR} at (13,221) size 1x13
-      LayoutText {#text} at (0,234) size 14x13
-        text run at (0,234) width 14: "18"
-      LayoutBR {BR} at (13,234) size 1x13
-      LayoutText {#text} at (0,247) size 14x13
-        text run at (0,247) width 14: "19"
-      LayoutBR {BR} at (13,247) size 1x13
-      LayoutText {#text} at (0,260) size 14x13
-        text run at (0,260) width 14: "20"
-      LayoutBR {BR} at (13,260) size 1x13
-      LayoutText {#text} at (0,273) size 14x13
-        text run at (0,273) width 14: "21"
-      LayoutBR {BR} at (13,273) size 1x13
-      LayoutText {#text} at (0,286) size 14x13
-        text run at (0,286) width 14: "22"
-      LayoutBR {BR} at (13,286) size 1x13
-      LayoutText {#text} at (0,299) size 14x13
-        text run at (0,299) width 14: "23"
-      LayoutBR {BR} at (13,299) size 1x13
-      LayoutText {#text} at (0,312) size 14x13
-        text run at (0,312) width 14: "24"
-      LayoutBR {BR} at (13,312) size 1x13
-      LayoutText {#text} at (0,325) size 14x13
-        text run at (0,325) width 14: "25"
-      LayoutBR {BR} at (13,325) size 1x13
-      LayoutText {#text} at (0,338) size 14x13
-        text run at (0,338) width 14: "26"
-      LayoutBR {BR} at (13,338) size 1x13
-      LayoutText {#text} at (0,351) size 14x13
-        text run at (0,351) width 14: "27"
-      LayoutBR {BR} at (13,351) size 1x13
-      LayoutText {#text} at (0,364) size 14x13
-        text run at (0,364) width 14: "28"
-      LayoutBR {BR} at (13,364) size 1x13
-      LayoutText {#text} at (0,377) size 14x13
-        text run at (0,377) width 14: "29"
-      LayoutBR {BR} at (13,377) size 1x13
-      LayoutText {#text} at (0,390) size 14x13
-        text run at (0,390) width 14: "30"
-      LayoutBR {BR} at (13,390) size 1x13
+      LayoutText {#text} at (0,0) size 13x13
+        text run at (0,0) width 13: "00"
+      LayoutBR {BR} at (12,0) size 1x13
+      LayoutText {#text} at (0,13) size 13x13
+        text run at (0,13) width 13: "01"
+      LayoutBR {BR} at (12,13) size 1x13
+      LayoutText {#text} at (0,26) size 13x13
+        text run at (0,26) width 13: "02"
+      LayoutBR {BR} at (12,26) size 1x13
+      LayoutText {#text} at (0,39) size 13x13
+        text run at (0,39) width 13: "03"
+      LayoutBR {BR} at (12,39) size 1x13
+      LayoutText {#text} at (0,52) size 13x13
+        text run at (0,52) width 13: "04"
+      LayoutBR {BR} at (12,52) size 1x13
+      LayoutText {#text} at (0,65) size 13x13
+        text run at (0,65) width 13: "05"
+      LayoutBR {BR} at (12,65) size 1x13
+      LayoutText {#text} at (0,78) size 13x13
+        text run at (0,78) width 13: "06"
+      LayoutBR {BR} at (12,78) size 1x13
+      LayoutText {#text} at (0,91) size 13x13
+        text run at (0,91) width 13: "07"
+      LayoutBR {BR} at (12,91) size 1x13
+      LayoutText {#text} at (0,104) size 13x13
+        text run at (0,104) width 13: "08"
+      LayoutBR {BR} at (12,104) size 1x13
+      LayoutText {#text} at (0,117) size 13x13
+        text run at (0,117) width 13: "09"
+      LayoutBR {BR} at (12,117) size 1x13
+      LayoutText {#text} at (0,130) size 13x13
+        text run at (0,130) width 13: "10"
+      LayoutBR {BR} at (12,130) size 1x13
+      LayoutText {#text} at (0,143) size 13x13
+        text run at (0,143) width 13: "11"
+      LayoutBR {BR} at (12,143) size 1x13
+      LayoutText {#text} at (0,156) size 20x13
+        text run at (0,156) width 20: ">12"
+      LayoutBR {BR} at (19,156) size 1x13
+      LayoutText {#text} at (0,169) size 13x13
+        text run at (0,169) width 13: "13"
+      LayoutBR {BR} at (12,169) size 1x13
+      LayoutText {#text} at (0,182) size 13x13
+        text run at (0,182) width 13: "14"
+      LayoutBR {BR} at (12,182) size 1x13
+      LayoutText {#text} at (0,195) size 13x13
+        text run at (0,195) width 13: "15"
+      LayoutBR {BR} at (12,195) size 1x13
+      LayoutText {#text} at (0,208) size 13x13
+        text run at (0,208) width 13: "16"
+      LayoutBR {BR} at (12,208) size 1x13
+      LayoutText {#text} at (0,221) size 13x13
+        text run at (0,221) width 13: "17"
+      LayoutBR {BR} at (12,221) size 1x13
+      LayoutText {#text} at (0,234) size 13x13
+        text run at (0,234) width 13: "18"
+      LayoutBR {BR} at (12,234) size 1x13
+      LayoutText {#text} at (0,247) size 13x13
+        text run at (0,247) width 13: "19"
+      LayoutBR {BR} at (12,247) size 1x13
+      LayoutText {#text} at (0,260) size 13x13
+        text run at (0,260) width 13: "20"
+      LayoutBR {BR} at (12,260) size 1x13
+      LayoutText {#text} at (0,273) size 13x13
+        text run at (0,273) width 13: "21"
+      LayoutBR {BR} at (12,273) size 1x13
+      LayoutText {#text} at (0,286) size 13x13
+        text run at (0,286) width 13: "22"
+      LayoutBR {BR} at (12,286) size 1x13
+      LayoutText {#text} at (0,299) size 13x13
+        text run at (0,299) width 13: "23"
+      LayoutBR {BR} at (12,299) size 1x13
+      LayoutText {#text} at (0,312) size 13x13
+        text run at (0,312) width 13: "24"
+      LayoutBR {BR} at (12,312) size 1x13
+      LayoutText {#text} at (0,325) size 13x13
+        text run at (0,325) width 13: "25"
+      LayoutBR {BR} at (12,325) size 1x13
+      LayoutText {#text} at (0,338) size 13x13
+        text run at (0,338) width 13: "26"
+      LayoutBR {BR} at (12,338) size 1x13
+      LayoutText {#text} at (0,351) size 13x13
+        text run at (0,351) width 13: "27"
+      LayoutBR {BR} at (12,351) size 1x13
+      LayoutText {#text} at (0,364) size 13x13
+        text run at (0,364) width 13: "28"
+      LayoutBR {BR} at (12,364) size 1x13
+      LayoutText {#text} at (0,377) size 13x13
+        text run at (0,377) width 13: "29"
+      LayoutBR {BR} at (12,377) size 1x13
+      LayoutText {#text} at (0,390) size 13x13
+        text run at (0,390) width 13: "30"
+      LayoutBR {BR} at (12,390) size 1x13
       LayoutBR {BR} at (0,403) size 0x13
 caret: position 1 of child 24 {#text} of child 0 {DIV} of {#document-fragment} of child 3 {TEXTAREA} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/4641033-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/4641033-expected.png
index 11b970b..a3d0e148 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/4641033-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/4641033-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/4641033-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/4641033-expected.txt
index cd9249cb..4bb1f9b4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/4641033-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/4641033-expected.txt
@@ -16,16 +16,16 @@
         LayoutImage {IMG} at (0,0) size 76x103
         LayoutText {#text} at (76,89) size 4x18
           text run at (76,89) width 4: " "
-        LayoutMenuList {SELECT} at (80,90) size 52x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 52x18
+        LayoutMenuList {SELECT} at (80,90) size 50x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 50x18
             LayoutText (anonymous) at (8,2) size 7x13
               text run at (8,2) width 7: "1"
       LayoutBlockFlow (anonymous) at (0,160) size 784x108
         LayoutImage {IMG} at (0,0) size 76x103
         LayoutText {#text} at (76,89) size 4x18
           text run at (76,89) width 4: " "
-        LayoutMenuList {SELECT} at (80,90) size 52x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 52x18
+        LayoutMenuList {SELECT} at (80,90) size 50x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 50x18
             LayoutText (anonymous) at (8,2) size 7x13
               text run at (8,2) width 7: "1"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/drop-text-without-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/drop-text-without-selection-expected.png
index 9019d92..a4e42741 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/drop-text-without-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/drop-text-without-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/drop-text-without-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/drop-text-without-selection-expected.txt
index b38409c..b69d338 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/drop-text-without-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/drop-text-without-selection-expected.txt
@@ -35,7 +35,7 @@
         LayoutText {#text} at (0,0) size 0x0
 layer at (11,107) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 113x13
-      text run at (0,0) width 113: "http://www.ibm.com/"
+    LayoutText {#text} at (0,0) size 107x13
+      text run at (0,0) width 107: "http://www.ibm.com/"
 selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
 selection end:   position 19 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/pasting-tabs-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/pasting-tabs-expected.png
index 03c64c5..82e7c12 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/pasting-tabs-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/pasting-tabs-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/pasting-tabs-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/pasting-tabs-expected.txt
index 6d4a991..19329b83 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/pasting-tabs-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/pasteboard/pasting-tabs-expected.txt
@@ -26,6 +26,6 @@
 layer at (8,60) size 141x32 clip at (9,61) size 139x30
   LayoutTextControl {TEXTAREA} at (0,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 87x13
-        text run at (0,0) width 87: "Tab->\x{9}<-Tab"
+      LayoutText {#text} at (0,0) size 80x13
+        text run at (0,0) width 80: "Tab->\x{9}<-Tab"
 caret: position 5 of child 2 {#text} of child 4 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-2-expected.png
index eb71b46..f8210ed 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-2-expected.txt
index a20ce13..c5e1ad17 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-2-expected.txt
@@ -81,14 +81,14 @@
                 LayoutTableCell {TD} at (170,1) size 342x37 [r=0 c=1 rs=1 cs=1]
                   LayoutTextControl {INPUT} at (0.50,0) size 341x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                   LayoutBR {BR} at (341,14) size 1x0
-                  LayoutButton {INPUT} at (69.41,19) size 94.45x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 78.45x13
-                      LayoutText {#text} at (0,0) size 79x13
-                        text run at (0,0) width 79: "Google Search"
-                  LayoutButton {INPUT} at (163.86,19) size 108.73x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 92.73x13
-                      LayoutText {#text} at (0,0) size 93x13
-                        text run at (0,0) width 93: "I'm Feeling Lucky"
+                  LayoutButton {INPUT} at (73.92,19) size 90.53x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 74.53x13
+                      LayoutText {#text} at (0,0) size 75x13
+                        text run at (0,0) width 75: "Google Search"
+                  LayoutButton {INPUT} at (164.45,19) size 103.61x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 87.61x13
+                      LayoutText {#text} at (0,0) size 88x13
+                        text run at (0,0) width 88: "I'm Feeling Lucky"
                 LayoutTableCell {TD} at (512,0) size 170x39 [r=0 c=2 rs=1 cs=1]
                   LayoutInline {FONT} at (0,0) size 76x39
                     LayoutText {#text} at (0,0) size 5x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-expected.png
index 26e3ae4..4a86466 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-expected.txt
index d95136a..541f03ad 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690703-expected.txt
@@ -83,14 +83,14 @@
                 LayoutTableCell {TD} at (170,1) size 342x37 [r=0 c=1 rs=1 cs=1]
                   LayoutTextControl {INPUT} at (0.50,0) size 341x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                   LayoutBR {BR} at (341,14) size 1x0
-                  LayoutButton {INPUT} at (69.41,19) size 94.45x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 78.45x13
-                      LayoutText {#text} at (0,0) size 79x13
-                        text run at (0,0) width 79: "Google Search"
-                  LayoutButton {INPUT} at (163.86,19) size 108.73x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 92.73x13
-                      LayoutText {#text} at (0,0) size 93x13
-                        text run at (0,0) width 93: "I'm Feeling Lucky"
+                  LayoutButton {INPUT} at (73.92,19) size 90.53x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 74.53x13
+                      LayoutText {#text} at (0,0) size 75x13
+                        text run at (0,0) width 75: "Google Search"
+                  LayoutButton {INPUT} at (164.45,19) size 103.61x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 87.61x13
+                      LayoutText {#text} at (0,0) size 88x13
+                        text run at (0,0) width 88: "I'm Feeling Lucky"
                 LayoutTableCell {TD} at (512,0) size 170x39 [r=0 c=2 rs=1 cs=1]
                   LayoutInline {FONT} at (0,0) size 76x39
                     LayoutText {#text} at (0,0) size 5x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690719-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690719-expected.png
index 26e3ae4..4a86466 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690719-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690719-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690719-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690719-expected.txt
index 3ca355c..a0ecdefd 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690719-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/3690719-expected.txt
@@ -74,14 +74,14 @@
                 LayoutTableCell {TD} at (170,1) size 342x37 [r=0 c=1 rs=1 cs=1]
                   LayoutTextControl {INPUT} at (0.50,0) size 341x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                   LayoutBR {BR} at (341,14) size 1x0
-                  LayoutButton {INPUT} at (69.41,19) size 94.45x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 78.45x13
-                      LayoutText {#text} at (0,0) size 79x13
-                        text run at (0,0) width 79: "Google Search"
-                  LayoutButton {INPUT} at (163.86,19) size 108.73x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 92.73x13
-                      LayoutText {#text} at (0,0) size 93x13
-                        text run at (0,0) width 93: "I'm Feeling Lucky"
+                  LayoutButton {INPUT} at (73.92,19) size 90.53x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 74.53x13
+                      LayoutText {#text} at (0,0) size 75x13
+                        text run at (0,0) width 75: "Google Search"
+                  LayoutButton {INPUT} at (164.45,19) size 103.61x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 87.61x13
+                      LayoutText {#text} at (0,0) size 88x13
+                        text run at (0,0) width 88: "I'm Feeling Lucky"
                 LayoutTableCell {TD} at (512,0) size 170x39 [r=0 c=2 rs=1 cs=1]
                   LayoutInline {FONT} at (0,0) size 76x39
                     LayoutText {#text} at (0,0) size 5x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4397952-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4397952-expected.png
index 2fe948e..2e91b93 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4397952-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4397952-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4397952-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4397952-expected.txt
index c36ed05..2a76b79d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4397952-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4397952-expected.txt
@@ -11,13 +11,13 @@
           text run at (0,0) width 271: "This tests caret movement across buttons. "
           text run at (270,0) width 308: "The caret should be just after the second button."
       LayoutBlockFlow {DIV} at (0,34) size 784x18
-        LayoutButton {INPUT} at (0,0) size 36.16x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 20.16x13
-            LayoutText {#text} at (0,0) size 21x13
-              text run at (0,0) width 21: "Foo"
-        LayoutButton {INPUT} at (36.16,0) size 34.30x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 18.30x13
-            LayoutText {#text} at (0,0) size 19x13
-              text run at (0,0) width 19: "Bar"
+        LayoutButton {INPUT} at (0,0) size 35.25x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 19.25x13
+            LayoutText {#text} at (0,0) size 20x13
+              text run at (0,0) width 20: "Foo"
+        LayoutButton {INPUT} at (35.25,0) size 33.39x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 17.39x13
+            LayoutText {#text} at (0,0) size 18x13
+              text run at (0,0) width 18: "Bar"
         LayoutText {#text} at (0,0) size 0x0
 caret: position 1 of child 2 {INPUT} of child 2 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4818145-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4818145-expected.png
index 1f0ae40..d4d34ed 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4818145-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4818145-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4947387-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4947387-expected.png
index 2837d99..9e57524 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4947387-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4947387-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4975120-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4975120-expected.png
index d50e660..c6fa905 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4975120-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4975120-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4975120-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4975120-expected.txt
index 27727d0..455c99f8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4975120-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/4975120-expected.txt
@@ -16,8 +16,8 @@
         LayoutText {#text} at (0,0) size 0x0
 layer at (11,81) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (8,97) size 304x154
   LayoutIFrame {IFRAME} at (0,19) size 304x154 [border: (2px inset #EEEEEE)]
     layer at (0,0) size 300x150
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5057506-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5057506-2-expected.png
index 5b5d3f0..894aa4de 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5057506-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5057506-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5057506-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5057506-expected.png
index fca94d30..27a71d1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5057506-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5057506-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5232159-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5232159-expected.png
index 5e4fc67c..cc18763 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5232159-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5232159-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5240265-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5240265-expected.png
index 0072058b..b2a889b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5240265-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5240265-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5240265-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5240265-expected.txt
index 8d914c3..6a38f0d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5240265-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/5240265-expected.txt
@@ -10,10 +10,10 @@
           text run at (478,18) width 297: "The editable region should not be focused, but"
           text run at (0,36) width 246: "the text inside of it should be selected."
       LayoutBlockFlow (anonymous) at (0,70) size 784x18
-        LayoutButton {INPUT} at (0,0) size 78.55x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 62.55x13
-            LayoutText {#text} at (0,0) size 63x13
-              text run at (0,0) width 63: "Click on me"
+        LayoutButton {INPUT} at (0,0) size 75.23x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 59.23x13
+            LayoutText {#text} at (0,0) size 60x13
+              text run at (0,0) width 60: "Click on me"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,88) size 784x18
         LayoutText {#text} at (0,0) size 182x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/7152-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/7152-1-expected.png
index 841d5312..1e54800a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/7152-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/7152-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/7152-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/7152-2-expected.png
index ca94bb9..b5b679a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/7152-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/7152-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/caret-before-select-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/caret-before-select-expected.png
index 0b62dcd..2183d110 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/caret-before-select-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/caret-before-select-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/caret-before-select-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/caret-before-select-expected.txt
index 68a7c15..ae59da1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/caret-before-select-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/caret-before-select-expected.txt
@@ -4,10 +4,10 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
       LayoutBlockFlow {DIV} at (0,0) size 784x93 [border: (5px solid #FF0000)]
-        LayoutMenuList {SELECT} at (37,38) size 53x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 53x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
-        LayoutText {#text} at (90,37) size 27x18
-          text run at (90,37) width 27: "blaa"
+        LayoutMenuList {SELECT} at (37,38) size 52x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 52x18
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
+        LayoutText {#text} at (89,37) size 27x18
+          text run at (89,37) width 27: "blaa"
 caret: position 0 of child 0 {SELECT} of child 0 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/doubleclick-crash-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/doubleclick-crash-expected.png
index 6200457..2762278 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/doubleclick-crash-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/doubleclick-crash-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-by-character-002-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-by-character-002-expected.png
index a81d9066..5185f021 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-by-character-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-by-character-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-by-character-003-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-by-character-003-expected.png
index 22b31c8..0441d0d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-by-character-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-by-character-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-inside-transforms-backward-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-inside-transforms-backward-expected.png
index ed10d99d..2f2e5b9f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-inside-transforms-backward-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-inside-transforms-backward-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-inside-transforms-forward-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-inside-transforms-forward-expected.png
index 69393c5..f7db9b0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-inside-transforms-forward-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/extend-inside-transforms-forward-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/image-before-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/image-before-linebreak-expected.png
index b8bfb0d..3e7cbaab 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/image-before-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/image-before-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-6-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-6-expected.png
index da02992d6..6b62594 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-6-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-6-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-7-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-7-expected.png
index cac9c480..731e9cf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-7-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/mixed-editability-7-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/node-removal-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/node-removal-2-expected.png
index a5f6f89..60475b24 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/node-removal-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/node-removal-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/paragraph-granularity-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/paragraph-granularity-expected.png
index e361e9e0..7f2fb01 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/paragraph-granularity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/paragraph-granularity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/range-between-block-and-inline-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/range-between-block-and-inline-expected.png
index 720ea6b..1e52a64 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/range-between-block-and-inline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/range-between-block-and-inline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/replaced-boundaries-3-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/replaced-boundaries-3-expected.png
index 61c025e..a51d0b5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/replaced-boundaries-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/replaced-boundaries-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/replaced-boundaries-3-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/replaced-boundaries-3-expected.txt
index 93b55fc6..cfac4ec 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/replaced-boundaries-3-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/replaced-boundaries-3-expected.txt
@@ -15,10 +15,10 @@
         LayoutText {#text} at (0,0) size 23x18
           text run at (0,0) width 23: "abc"
         LayoutBR {BR} at (22,14) size 1x0
-        LayoutMenuList {SELECT} at (0,18) size 226x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 226x18
-            LayoutText (anonymous) at (8,2) size 195x13
-              text run at (8,2) width 195: "this select box shouldn't be selected"
+        LayoutMenuList {SELECT} at (0,18) size 215x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 215x18
+            LayoutText (anonymous) at (8,2) size 184x13
+              text run at (8,2) width 184: "this select box shouldn't be selected"
         LayoutText {#text} at (0,0) size 0x0
 selection start: position 1 of child 0 {#text} of child 3 {DIV} of body
 selection end:   position 1 of child 1 {BR} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-1-expected.png
index cb5c3af8..be50fe1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-2-expected.png
index 0f27c2c..9c5218e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-3-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-3-expected.png
index ea3672a..669e0c6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-4-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-4-expected.png
index 0fe1e49..da6104e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-4-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-4-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-4-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-4-expected.txt
index cbe1de4f..555fc06 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-4-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-4-expected.txt
@@ -26,9 +26,9 @@
   LayoutBlockFlow {DIV} at (3,3) size 52.84x18
     LayoutText {#text} at (0,0) size 35x18
       text run at (0,0) width 35: "hello"
-layer at (115,115) size 53x18 scrollWidth 54
+layer at (115,115) size 53x18
   LayoutBlockFlow {DIV} at (3,3) size 52.84x18
-    LayoutText {#text} at (0,0) size 54x18
-      text run at (0,0) width 54: "WebKit"
+    LayoutText {#text} at (0,0) size 53x18
+      text run at (0,0) width 53: "WebKit"
 selection start: position 4 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 5 {DIV} of body
 selection end:   position 5 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 5 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-5-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-5-expected.png
index 5737e0b..03a757b0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-5-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-5-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-5-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-5-expected.txt
index fab4f17..5d1f430 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-5-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-across-readonly-input-5-expected.txt
@@ -26,9 +26,9 @@
   LayoutBlockFlow {DIV} at (3,3) size 52.84x18
     LayoutText {#text} at (0,0) size 35x18
       text run at (0,0) width 35: "hello"
-layer at (115,115) size 53x18 scrollWidth 54
+layer at (115,115) size 53x18
   LayoutBlockFlow {DIV} at (3,3) size 52.84x18
-    LayoutText {#text} at (0,0) size 54x18
-      text run at (0,0) width 54: "WebKit"
+    LayoutText {#text} at (0,0) size 53x18
+      text run at (0,0) width 53: "WebKit"
 selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 5 {INPUT} of child 5 {DIV} of body
 selection end:   position 2 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 5 {INPUT} of child 5 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-001-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-001-expected.png
index ec3aa6a..272a82e8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-002-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-002-expected.png
index 08ebf144..8218bf4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-003-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-003-expected.png
index 22f87462..966bbf3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-004-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-004-expected.png
index 809b463..a7cdcb7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-005-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-005-expected.png
index 6832613..1407be7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-006-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-006-expected.png
index 6832613..1407be7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-006-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-all-006-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-missing-image-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-missing-image-expected.png
index de199ca..511831d1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-missing-image-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/select-missing-image-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.png
index 85bb755..84c07bc3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-actions-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-button-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-button-text-expected.png
index c552e26..ec5cede 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-button-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-button-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-button-text-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-button-text-expected.txt
index fd3827c..31c3007 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-button-text-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/selection-button-text-expected.txt
@@ -13,21 +13,21 @@
           LayoutBR {BR} at (49,0) size 1x18
           LayoutText {#text} at (0,18) size 61x18
             text run at (0,18) width 61: "with text "
-          LayoutButton {INPUT} at (60.44,19) size 58.98x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 42.98x13
-              LayoutText {#text} at (0,0) size 43x13
-                text run at (0,0) width 43: "too little"
-          LayoutText {#text} at (119,18) size 59x18
-            text run at (119,18) width 59: " too little"
+          LayoutButton {INPUT} at (60.44,19) size 55.97x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 39.97x13
+              LayoutText {#text} at (0,0) size 40x13
+                text run at (0,0) width 40: "too little"
+          LayoutText {#text} at (116,18) size 59x18
+            text run at (116,18) width 59: " too little"
         LayoutBlockFlow {DIV} at (0,37) size 784x19
           LayoutText {#text} at (0,0) size 56x18
             text run at (0,0) width 56: "and text "
-          LayoutButton {INPUT} at (55.09,1) size 65.86x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 49.86x13
-              LayoutText {#text} at (0,0) size 50x13
-                text run at (0,0) width 50: "too much"
-          LayoutText {#text} at (120,0) size 65x18
-            text run at (120,0) width 65: " too much"
+          LayoutButton {INPUT} at (55.09,1) size 63.44x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 47.44x13
+              LayoutText {#text} at (0,0) size 48x13
+                text run at (0,0) width 48: "too much"
+          LayoutText {#text} at (118,0) size 65x18
+            text run at (118,0) width 65: " too much"
         LayoutBlockFlow (anonymous) at (0,56) size 784x18
           LayoutText {#text} at (0,0) size 250x18
             text run at (0,0) width 250: "Should not be selected in the selection."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/transformed-selection-rects-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/transformed-selection-rects-expected.png
index 8ac2d7c..7cd2102 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/transformed-selection-rects-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/transformed-selection-rects-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
index 6c5de2c..90169357 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
index d607a21..e99fb9e2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
index 6420954e..955f55f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
index c2815ef..14379000 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
index f62a2072..955f55f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
index 6765c0c..118e328c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
index 81784cc..55c2ff8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
index aaea857..118e328c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
index c4b669d..a5440cf0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
index e7d14896..4477d9d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
index 9ed9b54..2d60633 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
index f1c5f05d..2e964ef 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/word-granularity-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/word-granularity-expected.png
index eede7bb..389eb6d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/selection/word-granularity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/selection/word-granularity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/spelling/input-type-text-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/editing/spelling/input-type-text-expected.txt
new file mode 100644
index 0000000..0a7de16
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/spelling/input-type-text-expected.txt
@@ -0,0 +1,13 @@
+Spell check selects the misspelled word on context click in an input field. To test manually, type 'wellcome home.' and context-click on 'wellcome'. The test succeeds when 'wellcome' is selected after the context click.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS window.getSelection().toString() is "wellcome"
+PASS window.getSelection().toString() is ""
+PASS window.getSelection().toString() is "wellcome"
+FAIL window.getSelection().toString() should be home. Was ..
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5017613-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5017613-1-expected.png
index 54229c6c..8ebbe86 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5017613-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5017613-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5017613-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5017613-2-expected.png
index d87f2609..ab76062 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5017613-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5017613-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5046875-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5046875-1-expected.png
index 216d26e6..26e26c2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5046875-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5046875-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5228141-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5228141-expected.png
index 3e54e03..bb2e7dd 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5228141-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5228141-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5279521-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5279521-expected.png
index 5fcce9a6..849023e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/5279521-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/5279521-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/apple-style-editable-mix-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/apple-style-editable-mix-expected.png
index 49eeed08..e02433a5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/apple-style-editable-mix-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/apple-style-editable-mix-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/block-style-003-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/block-style-003-expected.png
index 4d46781..a213568 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/block-style-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/block-style-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-005-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-005-expected.png
index 48634b0..831f7bb4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-006-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-006-expected.png
index e7857e5..7382337 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-006-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-006-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-010-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-010-expected.png
index ff98b35..88f5931 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-010-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-010-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-011-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-011-expected.png
index 3752e19e2..a78546c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-011-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-011-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-012-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-012-expected.png
index d525e6e..0f5f9554a3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-012-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/create-block-for-style-012-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/relative-font-size-change-001-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/relative-font-size-change-001-expected.png
index 1004e32..9eb0bbce 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/relative-font-size-change-001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/relative-font-size-change-001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/relative-font-size-change-002-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/relative-font-size-change-002-expected.png
index 41f14bbd..f7783091 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/relative-font-size-change-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/relative-font-size-change-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/style-3998892-fix-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/style-3998892-fix-expected.png
index b97d4a0..f2380fe 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/style-3998892-fix-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/style-3998892-fix-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/style-boundary-004-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/style-boundary-004-expected.png
index d3941b5..9b2a44b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/style-boundary-004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/style-boundary-004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/editing/style/table-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/editing/style/table-selection-expected.png
index 40ce4bc..784455e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/editing/style/table-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/editing/style/table-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/selection-background-color-of-image-list-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
index 281b9fa..9840e3e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/selection-background-color-of-list-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/selection-background-color-of-list-style-expected.png
index 6c5fb0bf..25b7195 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/selection-background-color-of-list-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/backgrounds/selection-background-color-of-list-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/float-avoidance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/float-avoidance-expected.png
index 078d31571..639727e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/float-avoidance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/float-avoidance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/float-avoidance-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/float-avoidance-expected.txt
index 2f056a2a..585f5ed 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/float-avoidance-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/float/float-avoidance-expected.txt
@@ -18,8 +18,8 @@
         LayoutBR {BR} at (69,24) size 1x0
         LayoutMenuList (floating) {SELECT} at (10,28) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,0) size 0x0
         LayoutButton {INPUT} at (10,46) size 200x18 [bgcolor=#C0C0C0]
           LayoutBlockFlow (anonymous) at (8,2) size 184x13
@@ -35,8 +35,8 @@
         LayoutBR {BR} at (69,24) size 1x0
         LayoutMenuList (floating) {SELECT} at (10,28) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,0) size 0x0
         LayoutButton (floating) {INPUT} at (110,28) size 100x18 [bgcolor=#C0C0C0]
           LayoutBlockFlow (anonymous) at (8,2) size 84x13
@@ -54,13 +54,13 @@
           LayoutBR {BR} at (59,14) size 1x0
           LayoutMenuList (floating) {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 100x18
-              LayoutText (anonymous) at (8,2) size 22x13
-                text run at (8,2) width 22: "One"
+              LayoutText (anonymous) at (8,2) size 21x13
+                text run at (8,2) width 21: "One"
           LayoutText {#text} at (0,0) size 0x0
-        LayoutButton {INPUT} at (110,28) size 27.17x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 11.17x13
-            LayoutText {#text} at (0,0) size 12x13
-              text run at (0,0) width 12: "Hi"
+        LayoutButton {INPUT} at (110,28) size 26.56x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 10.56x13
+            LayoutText {#text} at (0,0) size 11x13
+              text run at (0,0) width 11: "Hi"
         LayoutBlockFlow (anonymous) at (10,46) size 200x18
           LayoutBR {BR} at (0,0) size 0x18
       LayoutBlockFlow (anonymous) at (0,408) size 769x18
@@ -73,8 +73,8 @@
           LayoutBR {BR} at (59,14) size 1x0
           LayoutMenuList (floating) {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 100x18
-              LayoutText (anonymous) at (8,2) size 22x13
-                text run at (8,2) width 22: "One"
+              LayoutText (anonymous) at (8,2) size 21x13
+                text run at (8,2) width 21: "One"
           LayoutText {#text} at (0,0) size 0x0
         LayoutButton {INPUT} at (110,28) size 100x18 [bgcolor=#C0C0C0]
           LayoutBlockFlow (anonymous) at (8,2) size 84x13
@@ -91,8 +91,8 @@
         LayoutBR {BR} at (69,24) size 1x0
         LayoutMenuList (floating) {SELECT} at (10,28) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,0) size 0x0
         LayoutTable (floating) {TABLE} at (110,28) size 100x30 [border: (2px outset #808080)]
           LayoutTableSection {TBODY} at (2,2) size 96x26
@@ -112,8 +112,8 @@
         LayoutBR {BR} at (69,24) size 1x0
         LayoutMenuList (floating) {SELECT} at (10,28) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,0) size 0x0
         LayoutTable (floating) {TABLE} at (10,46) size 200x66 [border: (2px outset #808080)]
           LayoutTableSection {TBODY} at (2,2) size 196x62
@@ -136,8 +136,8 @@
           LayoutBR {BR} at (59,14) size 1x0
           LayoutMenuList (floating) {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 100x18
-              LayoutText (anonymous) at (8,2) size 22x13
-                text run at (8,2) width 22: "One"
+              LayoutText (anonymous) at (8,2) size 21x13
+                text run at (8,2) width 21: "One"
           LayoutText {#text} at (0,0) size 0x0
         LayoutTable {TABLE} at (10,46) size 200x66 [border: (2px outset #808080)]
           LayoutTableSection {TBODY} at (2,2) size 196x62
@@ -160,8 +160,8 @@
           LayoutBR {BR} at (59,14) size 1x0
           LayoutMenuList (floating) {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 100x18
-              LayoutText (anonymous) at (8,2) size 22x13
-                text run at (8,2) width 22: "One"
+              LayoutText (anonymous) at (8,2) size 21x13
+                text run at (8,2) width 21: "One"
           LayoutText {#text} at (0,0) size 0x0
         LayoutTable {TABLE} at (110,28) size 100x138 [border: (2px outset #808080)]
           LayoutTableSection {TBODY} at (2,2) size 96x134
@@ -186,8 +186,8 @@
         LayoutBR {BR} at (69,24) size 1x0
         LayoutMenuList (floating) {SELECT} at (10,28) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
         LayoutBR {BR} at (210,28) size 0x18
@@ -201,8 +201,8 @@
         LayoutBR {BR} at (69,24) size 1x0
         LayoutMenuList (floating) {SELECT} at (10,28) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
         LayoutBR {BR} at (110,28) size 0x18
@@ -216,8 +216,8 @@
           LayoutBR {BR} at (59,14) size 1x0
           LayoutMenuList (floating) {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 100x18
-              LayoutText (anonymous) at (8,2) size 22x13
-                text run at (8,2) width 22: "One"
+              LayoutText (anonymous) at (8,2) size 21x13
+                text run at (8,2) width 21: "One"
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow (anonymous) at (10,136) size 200x18
           LayoutBR {BR} at (0,0) size 0x18
@@ -233,8 +233,8 @@
           LayoutBR {BR} at (59,14) size 1x0
           LayoutMenuList (floating) {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 100x18
-              LayoutText (anonymous) at (8,2) size 22x13
-                text run at (8,2) width 22: "One"
+              LayoutText (anonymous) at (8,2) size 21x13
+                text run at (8,2) width 21: "One"
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow (anonymous) at (10,136) size 200x18
           LayoutBR {BR} at (0,0) size 0x18
@@ -247,8 +247,8 @@
         LayoutBR {BR} at (69,24) size 1x0
         LayoutMenuList (floating) {SELECT} at (10,28) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow (floating) {HR} at (112,30) size 82x2 [border: (1px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
@@ -263,8 +263,8 @@
         LayoutBR {BR} at (69,24) size 1x0
         LayoutMenuList (floating) {SELECT} at (10,28) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow (floating) {HR} at (112,30) size 2x2 [border: (1px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
@@ -279,8 +279,8 @@
           LayoutBR {BR} at (59,14) size 1x0
           LayoutMenuList (floating) {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 100x18
-              LayoutText (anonymous) at (8,2) size 22x13
-                text run at (8,2) width 22: "One"
+              LayoutText (anonymous) at (8,2) size 21x13
+                text run at (8,2) width 21: "One"
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {HR} at (10,46) size 202x2 [border: (1px inset #EEEEEE)]
         LayoutBlockFlow (anonymous) at (10,56) size 200x18
@@ -296,8 +296,8 @@
           LayoutBR {BR} at (59,14) size 1x0
           LayoutMenuList (floating) {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 100x18
-              LayoutText (anonymous) at (8,2) size 22x13
-                text run at (8,2) width 22: "One"
+              LayoutText (anonymous) at (8,2) size 21x13
+                text run at (8,2) width 21: "One"
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {HR} at (110,36) size 100x2 [border: (1px inset #EEEEEE)]
         LayoutBlockFlow (anonymous) at (10,46) size 200x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.png
index b0fa49d1..6604564 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.txt
index 52b21f5..30fdc75 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/margin-collapse/103-expected.txt
@@ -39,22 +39,22 @@
                 text run at (0,2) width 131: "Your degree program*"
             LayoutMenuList {SELECT} at (325,64) size 180x18 [bgcolor=#F8F8F8]
               LayoutBlockFlow (anonymous) at (0,0) size 180x18
-                LayoutText (anonymous) at (8,2) size 88x13
-                  text run at (8,2) width 88: "Program options"
+                LayoutText (anonymous) at (8,2) size 84x13
+                  text run at (8,2) width 84: "Program options"
             LayoutBlockFlow (floating) {SPAN} at (0,86) size 325x20 [color=#333333]
               LayoutText {#text} at (0,2) size 115x16
                 text run at (0,2) width 115: "Your year of study*"
             LayoutMenuList {SELECT} at (325,82) size 180x18 [bgcolor=#F8F8F8]
               LayoutBlockFlow (anonymous) at (0,0) size 180x18
-                LayoutText (anonymous) at (8,2) size 125x13
-                  text run at (8,2) width 125: "Years you've been here"
+                LayoutText (anonymous) at (8,2) size 118x13
+                  text run at (8,2) width 118: "Years you've been here"
             LayoutBlockFlow (floating) {SPAN} at (0,106) size 325x20 [color=#333333]
               LayoutText {#text} at (0,2) size 157x16
                 text run at (0,2) width 157: "Shakespeare classes taken"
             LayoutMenuList {SELECT} at (325,100) size 180x18 [bgcolor=#F8F8F8]
               LayoutBlockFlow (anonymous) at (0,0) size 180x18
-                LayoutText (anonymous) at (8,2) size 75x13
-                  text run at (8,2) width 75: "Number taken"
+                LayoutText (anonymous) at (8,2) size 71x13
+                  text run at (8,2) width 71: "Number taken"
             LayoutBlockFlow {P} at (0,131.33) size 560x20 [color=#333333]
               LayoutText {#text} at (0,2) size 161x16
                 text run at (0,2) width 161: "* indicates a required field"
@@ -67,16 +67,16 @@
                 text run at (0,22) width 42: "online?"
             LayoutMenuList {SELECT} at (325,202.33) size 180x18 [bgcolor=#F8F8F8]
               LayoutBlockFlow (anonymous) at (0,0) size 180x18
-                LayoutText (anonymous) at (8,2) size 106x13
-                  text run at (8,2) width 106: "Percentages of time"
+                LayoutText (anonymous) at (8,2) size 101x13
+                  text run at (8,2) width 101: "Percentages of time"
             LayoutBlockFlow (floating) {SPAN} at (0,222.33) size 325x20 [color=#333333]
               LayoutText {#text} at (0,2) size 308x36
                 text run at (0,2) width 308: "What is holding you back from doing more research"
                 text run at (0,22) width 42: "online?"
             LayoutMenuList {SELECT} at (325,220.33) size 180x18 [bgcolor=#F8F8F8]
               LayoutBlockFlow (anonymous) at (0,0) size 180x18
-                LayoutText (anonymous) at (8,2) size 46x13
-                  text run at (8,2) width 46: "Reasons"
+                LayoutText (anonymous) at (8,2) size 44x13
+                  text run at (8,2) width 44: "Reasons"
             LayoutBlockFlow (floating) {SPAN} at (0,242.33) size 325x20 [color=#333333]
               LayoutText {#text} at (0,2) size 228x16
                 text run at (0,2) width 228: "Your research is primarily focused on:"
@@ -115,15 +115,15 @@
                 text run at (0,2) width 282: "Which area of the ISE did you find most useful?"
             LayoutMenuList {SELECT} at (325,415.98) size 180x18 [bgcolor=#F8F8F8]
               LayoutBlockFlow (anonymous) at (0,0) size 180x18
-                LayoutText (anonymous) at (8,2) size 101x13
-                  text run at (8,2) width 101: "Sections of the ISE"
+                LayoutText (anonymous) at (8,2) size 96x13
+                  text run at (8,2) width 96: "Sections of the ISE"
             LayoutBlockFlow (floating) {SPAN} at (0,435.97) size 325x20 [color=#333333]
               LayoutText {#text} at (0,2) size 257x16
                 text run at (0,2) width 257: "How did you find the navigation of the ISE?"
             LayoutMenuList {SELECT} at (325,433.98) size 180x18 [bgcolor=#F8F8F8]
               LayoutBlockFlow (anonymous) at (0,0) size 180x18
-                LayoutText (anonymous) at (8,2) size 90x13
-                  text run at (8,2) width 90: "Level of difficulty"
+                LayoutText (anonymous) at (8,2) size 85x13
+                  text run at (8,2) width 85: "Level of difficulty"
             LayoutBlockFlow (floating) {SPAN} at (0,455.95) size 325x20 [color=#333333]
               LayoutText {#text} at (0,2) size 213x16
                 text run at (0,2) width 213: "Please describe your use of the ISE."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/positioning/inline-block-relposition-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/block/positioning/inline-block-relposition-expected.png
index 85292fa38..c48339f1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/positioning/inline-block-relposition-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/positioning/inline-block-relposition-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/block/positioning/inline-block-relposition-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/block/positioning/inline-block-relposition-expected.txt
index c72e0e0b..2b1ef5f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/block/positioning/inline-block-relposition-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/block/positioning/inline-block-relposition-expected.txt
@@ -7,9 +7,9 @@
 layer at (8,8) size 100x18
   LayoutButton (relative positioned) {BUTTON} at (0,0) size 100x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
     LayoutBlockFlow (anonymous) at (8,2) size 84x13
-      LayoutText {#text} at (18,0) size 48x13
-        text run at (18,0) width 48: "Click Me"
-layer at (87,23) size 24x13
-  LayoutBlockFlow (positioned) {DIV} at (79.13,15) size 23.88x13
-    LayoutText {#text} at (0,0) size 24x13
-      text run at (0,0) width 24: "Now"
+      LayoutText {#text} at (20,0) size 44x13
+        text run at (20,0) width 44: "Click Me"
+layer at (88,23) size 23x13
+  LayoutBlockFlow (positioned) {DIV} at (80.03,15) size 22.97x13
+    LayoutText {#text} at (0,0) size 23x13
+      text run at (0,0) width 23: "Now"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/continuationCrash-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/continuationCrash-expected.png
index c02e83c..47bc366 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/continuationCrash-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/continuationCrash-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/continuationCrash-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/css/continuationCrash-expected.txt
index cefdd08..7310b77 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/continuationCrash-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/continuationCrash-expected.txt
@@ -47,20 +47,20 @@
           LayoutText {#text} at (0,0) size 206x18
             text run at (0,0) width 206: "2. 3. will not crash Safari either."
         LayoutBlockFlow (anonymous) at (40,144) size 744x19
-          LayoutButton {INPUT} at (0,1) size 133.94x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 117.94x13
-              LayoutText {#text} at (0,0) size 118x13
-                text run at (0,0) width 118: "1. Set outline property"
-          LayoutText {#text} at (133,0) size 5x18
-            text run at (133,0) width 5: " "
-          LayoutButton {INPUT} at (137.94,1) size 136x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 120x13
-              LayoutText {#text} at (0,0) size 120x13
-                text run at (0,0) width 120: "2. Set display property"
-          LayoutText {#text} at (273,0) size 5x18
-            text run at (273,0) width 5: " "
-          LayoutButton {INPUT} at (277.94,1) size 147.81x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 131.81x13
-              LayoutText {#text} at (0,0) size 132x13
-                text run at (0,0) width 132: "3. Replace span-element"
+          LayoutButton {INPUT} at (0,1) size 126.98x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 110.98x13
+              LayoutText {#text} at (0,0) size 111x13
+                text run at (0,0) width 111: "1. Set outline property"
+          LayoutText {#text} at (126,0) size 5x18
+            text run at (126,0) width 5: " "
+          LayoutButton {INPUT} at (130.98,1) size 129.06x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 113.06x13
+              LayoutText {#text} at (0,0) size 114x13
+                text run at (0,0) width 114: "2. Set display property"
+          LayoutText {#text} at (260,0) size 5x18
+            text run at (260,0) width 5: " "
+          LayoutButton {INPUT} at (264.05,1) size 140.88x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 124.88x13
+              LayoutText {#text} at (0,0) size 125x13
+                text run at (0,0) width 125: "3. Replace span-element"
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/input-search-padding-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/input-search-padding-expected.png
index eb329b8..56b22ec 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/input-search-padding-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/input-search-padding-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/input-search-padding-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/css/input-search-padding-expected.txt
index fd20e8d..227cc21 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/input-search-padding-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/input-search-padding-expected.txt
@@ -10,23 +10,23 @@
       LayoutBR {BR} at (444,42) size 0x0
       LayoutTextControl {INPUT} at (0,82) size 444x82 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutBR {BR} at (444,124) size 0x0
-      LayoutTextControl {INPUT} at (0,164) size 221x25 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-        LayoutFlexibleBox {DIV} at (6,1) size 209x23
+      LayoutTextControl {INPUT} at (0,164) size 240x25 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutFlexibleBox {DIV} at (6,1) size 228x23
           LayoutBlockFlow {DIV} at (0,11.50) size 6x0
-          LayoutBlockFlow {DIV} at (6,0) size 188x23
+          LayoutBlockFlow {DIV} at (6,0) size 207x23
 layer at (17,11) size 417x47
   LayoutBlockFlow {DIV} at (0,0) size 417x47
-    LayoutText {#text} at (0,0) size 369x47
-      text run at (0,0) width 369: "value jgq not clipped"
+    LayoutText {#text} at (0,0) size 379x47
+      text run at (0,0) width 379: "value jgq not clipped"
 layer at (11,93) size 438x47
   LayoutBlockFlow {DIV} at (3,3) size 438x47
-    LayoutText {#text} at (0,0) size 369x47
-      text run at (0,0) width 369: "value jgq not clipped"
-layer at (20,173) size 188x23
-  LayoutBlockFlow {DIV} at (0,0) size 188x23
-    LayoutText {#text} at (0,0) size 119x23
-      text run at (0,0) width 119: "Sample Input"
+    LayoutText {#text} at (0,0) size 379x47
+      text run at (0,0) width 379: "value jgq not clipped"
+layer at (20,173) size 207x23
+  LayoutBlockFlow {DIV} at (0,0) size 207x23
+    LayoutText {#text} at (0,0) size 121x23
+      text run at (0,0) width 121: "Sample Input"
 layer at (435,28) size 14x14 transparent
   LayoutBlockFlow {DIV} at (424,16.50) size 14x14
-layer at (209,178) size 14x14 transparent
-  LayoutBlockFlow {DIV} at (195,4.50) size 14x14
+layer at (228,178) size 14x14 transparent
+  LayoutBlockFlow {DIV} at (214,4.50) size 14x14
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/line-height-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/line-height-expected.png
index 5509746..6f6e73a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/line-height-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/line-height-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/css/line-height-expected.txt
index 090e826f..2bcd4fe 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/line-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/line-height-expected.txt
@@ -20,5 +20,5 @@
           text run at (0,18) width 65: "vertically."
 layer at (11,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 70x13
-      text run at (0,0) width 70: "Lorem Ipsum"
+    LayoutText {#text} at (0,0) size 66x13
+      text run at (0,0) width 66: "Lorem Ipsum"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/margin-top-bottom-dynamic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/margin-top-bottom-dynamic-expected.png
index 7510ee1..b9a414fa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/margin-top-bottom-dynamic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/margin-top-bottom-dynamic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/margin-top-bottom-dynamic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/css/margin-top-bottom-dynamic-expected.txt
index e52f2da..72e445f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/margin-top-bottom-dynamic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/margin-top-bottom-dynamic-expected.txt
@@ -35,16 +35,16 @@
             text run at (1,1) width 86: "Lorem ipsum"
       LayoutBlockFlow (anonymous) at (0,270) size 784x37
         LayoutBR {BR} at (0,0) size 0x18
-        LayoutButton {INPUT} at (0,19) size 102.11x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 86.11x13
-            LayoutText {#text} at (0,0) size 87x13
-              text run at (0,0) width 87: "Negative margin"
-        LayoutText {#text} at (102,18) size 5x18
-          text run at (102,18) width 5: " "
-        LayoutButton {INPUT} at (106.11,19) size 97.34x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 81.34x13
+        LayoutButton {INPUT} at (0,19) size 97.58x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 81.58x13
             LayoutText {#text} at (0,0) size 82x13
-              text run at (0,0) width 82: "Positive margin"
+              text run at (0,0) width 82: "Negative margin"
+        LayoutText {#text} at (97,18) size 5x18
+          text run at (97,18) width 5: " "
+        LayoutButton {INPUT} at (101.58,19) size 92.81x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 76.81x13
+            LayoutText {#text} at (0,0) size 77x13
+              text run at (0,0) width 77: "Positive margin"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,323) size 784x18
         LayoutText {#text} at (0,0) size 458x18
@@ -58,14 +58,14 @@
             text run at (1,1) width 86: "Lorem ipsum"
       LayoutBlockFlow (anonymous) at (0,429) size 784x37
         LayoutBR {BR} at (0,0) size 0x18
-        LayoutButton {INPUT} at (0,19) size 102.11x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 86.11x13
-            LayoutText {#text} at (0,0) size 87x13
-              text run at (0,0) width 87: "Negative margin"
-        LayoutText {#text} at (102,18) size 5x18
-          text run at (102,18) width 5: " "
-        LayoutButton {INPUT} at (106.11,19) size 97.34x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 81.34x13
+        LayoutButton {INPUT} at (0,19) size 97.58x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 81.58x13
             LayoutText {#text} at (0,0) size 82x13
-              text run at (0,0) width 82: "Positive margin"
+              text run at (0,0) width 82: "Negative margin"
+        LayoutText {#text} at (97,18) size 5x18
+          text run at (97,18) width 5: " "
+        LayoutButton {INPUT} at (101.58,19) size 92.81x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 76.81x13
+            LayoutText {#text} at (0,0) size 77x13
+              text run at (0,0) width 77: "Positive margin"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.png
index 810443f4..0e9eb53 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt
index 72e8151..fde7aaa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/css/text-overflow-input-expected.txt
@@ -116,122 +116,122 @@
         LayoutText {#text} at (535,37) size 5x18
           text run at (535,37) width 5: " "
         LayoutBR {BR} at (0,0) size 0x0
-layer at (11,71) size 125x13 scrollWidth 291
+layer at (11,71) size 125x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (11,71) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (152,71) size 108x13 scrollWidth 291
+layer at (152,71) size 108x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (9,3) size 108x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (152,71) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-layer at (283,71) size 125x13 scrollWidth 291
+layer at (283,71) size 125x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (424,71) size 108x13 scrollWidth 291
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (424,71) size 108x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (555,71) size 125x13 scrollWidth 361
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (555,71) size 125x13 scrollWidth 344
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 361x13
-      text run at (0,0) width 361: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
-layer at (11,90) size 125x13 scrollX 165.00 scrollWidth 291
+    LayoutText {#text} at (0,0) size 345x13
+      text run at (0,0) width 345: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (11,90) size 125x13 scrollX 149.00 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (-165,0) size 291x13
-      text run at (-165,0) width 290: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (-149,0) size 275x13
+      text run at (-149,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (11,90) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (152,90) size 108x13 scrollX 182.00 scrollWidth 291
+layer at (152,90) size 108x13 scrollX 166.00 scrollWidth 274
   LayoutBlockFlow {DIV} at (9,3) size 108x13 [color=#A9A9A9]
-    LayoutText {#text} at (-182,0) size 291x13
-      text run at (-182,0) width 290: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (-166,0) size 275x13
+      text run at (-166,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (152,90) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-layer at (283,90) size 125x13 scrollX 165.00 scrollWidth 291
+layer at (283,90) size 125x13 scrollX 149.00 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (-165,0) size 291x13
-      text run at (-165,0) width 290: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (424,90) size 108x13 scrollX 182.00 scrollWidth 291
+    LayoutText {#text} at (-149,0) size 275x13
+      text run at (-149,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (424,90) size 108x13 scrollX 166.00 scrollWidth 274
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (-182,0) size 291x13
-      text run at (-182,0) width 290: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (555,90) size 125x13 scrollX 235.00 scrollWidth 361
+    LayoutText {#text} at (-166,0) size 275x13
+      text run at (-166,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (555,90) size 125x13 scrollX 219.00 scrollWidth 344
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (-235,0) size 361x13
-      text run at (-235,0) width 360 RTL: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
-layer at (11,143) size 125x13 scrollWidth 291
+    LayoutText {#text} at (-219,0) size 345x13
+      text run at (-219,0) width 344 RTL: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (11,143) size 125x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (11,143) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (152,143) size 108x13 scrollWidth 291
+layer at (152,143) size 108x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (9,3) size 108x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (152,143) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-layer at (283,143) size 125x13 scrollWidth 291
+layer at (283,143) size 125x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (424,143) size 108x13 scrollWidth 291
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (424,143) size 108x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (555,143) size 125x13 scrollWidth 361
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (555,143) size 125x13 scrollWidth 344
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 361x13
-      text run at (0,0) width 361: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
-layer at (11,162) size 125x13 scrollX 165.00 scrollWidth 291
+    LayoutText {#text} at (0,0) size 345x13
+      text run at (0,0) width 345: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (11,162) size 125x13 scrollX 149.00 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (-165,0) size 291x13
-      text run at (-165,0) width 290: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (-149,0) size 275x13
+      text run at (-149,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (11,162) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (152,162) size 108x13 scrollX 182.00 scrollWidth 291
+layer at (152,162) size 108x13 scrollX 166.00 scrollWidth 274
   LayoutBlockFlow {DIV} at (9,3) size 108x13 [color=#A9A9A9]
-    LayoutText {#text} at (-182,0) size 291x13
-      text run at (-182,0) width 290: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (-166,0) size 275x13
+      text run at (-166,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (152,162) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-layer at (283,162) size 125x13 scrollX 165.00 scrollWidth 291
+layer at (283,162) size 125x13 scrollX 149.00 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (-165,0) size 291x13
-      text run at (-165,0) width 290: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (424,162) size 108x13 scrollX 182.00 scrollWidth 291
+    LayoutText {#text} at (-149,0) size 275x13
+      text run at (-149,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (424,162) size 108x13 scrollX 166.00 scrollWidth 274
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (-182,0) size 291x13
-      text run at (-182,0) width 290: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (555,162) size 125x13 scrollX 235.00 scrollWidth 361
+    LayoutText {#text} at (-166,0) size 275x13
+      text run at (-166,0) width 274: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (555,162) size 125x13 scrollX 219.00 scrollWidth 344
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (-235,0) size 361x13
-      text run at (-235,0) width 360 RTL: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
-layer at (257,215) size 125x13 scrollWidth 291
+    LayoutText {#text} at (-219,0) size 345x13
+      text run at (-219,0) width 344 RTL: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (257,215) size 125x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (257,215) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (392,215) size 125x13 scrollWidth 291
+layer at (392,215) size 125x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
-layer at (281,234) size 125x13 scrollWidth 291
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+layer at (281,234) size 125x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (281,234) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (416,234) size 125x13 scrollWidth 291
+layer at (416,234) size 125x13 scrollWidth 274
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 291x13
-      text run at (0,0) width 291: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
+    LayoutText {#text} at (0,0) size 275x13
+      text run at (0,0) width 275: "Lorem ipsum dolor sit amet, consectetur adipiscing elit"
 layer at (261,72) size 11x11 transparent
   LayoutBlockFlow {DIV} at (114,1) size 11x11
 layer at (533,72) size 11x11 transparent
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.png
index 28305f9e..37b6d97 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt
index 2a197e4..9ca01da 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLInputElement/input-image-alt-text-expected.txt
@@ -10,21 +10,21 @@
           text run at (0,18) width 229: "twice, followed by a blue rectangle."
       LayoutBlockFlow {P} at (0,52) size 784x0
       LayoutBlockFlow {FORM} at (0,52) size 784x94
-        LayoutBlockFlow {INPUT} at (0,0) size 48.77x17
-        LayoutBR {BR} at (48,17) size 1x0
+        LayoutBlockFlow {INPUT} at (0,0) size 46.66x17
+        LayoutBR {BR} at (46,17) size 1x0
         LayoutBlockFlow {INPUT} at (0,17) size 102x52 [border: (1px solid #000000)]
         LayoutBR {BR} at (102,68) size 0x0
         LayoutImage {INPUT} at (0,69) size 75x25
         LayoutBR {BR} at (75,94) size 0x0
-layer at (8,60) size 49x17 clip at (9,61) size 47x15
-  LayoutBlockFlow {DIV} at (0,0) size 48.77x17 [border: (1px solid #C0C0C0)]
-layer at (10,62) size 45x13
-  LayoutBlockFlow {DIV} at (2,2) size 44.77x13
-    LayoutText {#text} at (0,0) size 45x13
-      text run at (0,0) width 45: "Success"
+layer at (8,60) size 47x17 clip at (9,61) size 45x15
+  LayoutBlockFlow {DIV} at (0,0) size 46.66x17 [border: (1px solid #C0C0C0)]
+layer at (10,62) size 43x13
+  LayoutBlockFlow {DIV} at (2,2) size 42.66x13
+    LayoutText {#text} at (0,0) size 43x13
+      text run at (0,0) width 43: "Success"
 layer at (9,78) size 100x50 clip at (10,79) size 98x48
   LayoutBlockFlow {DIV} at (1,1) size 100x50 [border: (1px solid #C0C0C0)]
 layer at (11,80) size 96x13
   LayoutBlockFlow {DIV} at (2,2) size 96x13
-    LayoutText {#text} at (0,0) size 45x13
-      text run at (0,0) width 45: "Success"
+    LayoutText {#text} at (0,0) size 43x13
+      text run at (0,0) width 43: "Success"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTableColElement/resize-table-using-col-width-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTableColElement/resize-table-using-col-width-expected.png
index 78dc8e6..f04c0ea1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTableColElement/resize-table-using-col-width-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTableColElement/resize-table-using-col-width-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTableColElement/resize-table-using-col-width-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTableColElement/resize-table-using-col-width-expected.txt
index bc61fc7..12026b7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTableColElement/resize-table-using-col-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTableColElement/resize-table-using-col-width-expected.txt
@@ -30,9 +30,9 @@
               LayoutText {#text} at (2,2) size 73x18
                 text run at (2,2) width 73: "col 3 row 3"
       LayoutBlockFlow (anonymous) at (0,52) size 784x18
-        LayoutButton {BUTTON} at (0,0) size 363.22x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 347.22x13
-            LayoutText {#text} at (0,0) size 348x13
-              text run at (0,0) width 348: "Click me to test manually. The first column should grow to 500px."
+        LayoutButton {BUTTON} at (0,0) size 343.59x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 327.59x13
+            LayoutText {#text} at (0,0) size 328x13
+              text run at (0,0) width 328: "Click me to test manually. The first column should grow to 500px."
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTextAreaElement/reset-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTextAreaElement/reset-textarea-expected.png
index 9ed46a5d..a885df3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTextAreaElement/reset-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTextAreaElement/reset-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTextAreaElement/reset-textarea-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTextAreaElement/reset-textarea-expected.txt
index 25a6010..2d99623b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTextAreaElement/reset-textarea-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dom/HTMLTextAreaElement/reset-textarea-expected.txt
@@ -8,10 +8,10 @@
           text run at (141,18) width 4: " "
         LayoutText {#text} at (286,18) size 4x18
           text run at (286,18) width 4: " "
-        LayoutButton {INPUT} at (290,19) size 46.30x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 30.30x13
-            LayoutText {#text} at (0,0) size 31x13
-              text run at (0,0) width 31: "Reset"
+        LayoutButton {INPUT} at (290,19) size 44.78x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 28.78x13
+            LayoutText {#text} at (0,0) size 29x13
+              text run at (0,0) width 29: "Reset"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,53) size 784x72
         LayoutText {#text} at (0,0) size 369x18
@@ -31,5 +31,5 @@
 layer at (153,8) size 141x32 clip at (154,9) size 139x30
   LayoutTextControl {TEXTAREA} at (145,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 64x13
-        text run at (0,0) width 64: "Default Text"
+      LayoutText {#text} at (0,0) size 61x13
+        text run at (0,0) width 61: "Default Text"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/008-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/008-expected.png
index 99d18bf6..f062501 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/008-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/008-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/008-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/008-expected.txt
index 2dd27df..3c9d53b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/008-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/dynamic/008-expected.txt
@@ -8,5 +8,5 @@
 layer at (8,8) size 261x656 backgroundClip at (8,8) size 261x592 clip at (9,9) size 259x591
   LayoutTextControl {TEXTAREA} at (0,0) size 261x656 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 255x13
-      LayoutText {#text} at (0,0) size 64x13
-        text run at (0,0) width 64: "Sample text"
+      LayoutText {#text} at (0,0) size 60x13
+        text run at (0,0) width 60: "Sample text"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/events/autoscroll-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/events/autoscroll-expected.png
index 02c37bd..836f265f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/events/autoscroll-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/events/autoscroll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/events/autoscroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/events/autoscroll-expected.txt
index 6cb5fbd6..cf79a4e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/events/autoscroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/events/autoscroll-expected.txt
@@ -24,8 +24,8 @@
           text run at (0,0) width 412: "If the bug does not occur, you'll be left down here at the bottom."
 layer at (11,3097) size 125x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 124x13
-      text run at (0,0) width 124: "select some of this text"
-selection start: position 1 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
-selection end:   position 17 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
+    LayoutText {#text} at (0,0) size 116x13
+      text run at (0,0) width 116: "select some of this text"
+selection start: position 2 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
+selection end:   position 18 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
 scrolled to 0,2563
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/events/context-no-deselect-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/events/context-no-deselect-expected.png
index 35e61e2c..62e128e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/events/context-no-deselect-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/events/context-no-deselect-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/events/context-no-deselect-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/events/context-no-deselect-expected.txt
index 563a6ba..c2b1ef0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/events/context-no-deselect-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/events/context-no-deselect-expected.txt
@@ -8,7 +8,7 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,11) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 94x13
-      text run at (0,0) width 94: "some sample text"
+    LayoutText {#text} at (0,0) size 89x13
+      text run at (0,0) width 89: "some sample text"
 selection start: position 5 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
 selection end:   position 15 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/files/file-in-input-display-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/files/file-in-input-display-expected.png
index 7ec1c51..32c6fe8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/files/file-in-input-display-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/files/file-in-input-display-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/files/file-in-input-display-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/files/file-in-input-display-expected.txt
index ff1ff60..45dc3f03 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/files/file-in-input-display-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/files/file-in-input-display-expected.txt
@@ -7,9 +7,9 @@
       LayoutBlockFlow {DIV} at (0,0) size 102x102 [border: (1px solid #000000)]
       LayoutBlockFlow {FORM} at (0,152) size 784x18
         LayoutBlockFlow {P} at (0,0) size 784x18
-          LayoutFileUploadControl {INPUT} at (0,0) size 222x18 "hello.txt"
-            LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-              LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                LayoutText {#text} at (0,0) size 63x13
-                  text run at (0,0) width 63: "Choose File"
+          LayoutFileUploadControl {INPUT} at (0,0) size 212x18 "hello.txt"
+            LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+              LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                LayoutText {#text} at (0,0) size 60x13
+                  text run at (0,0) width 60: "Choose File"
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/001-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/001-expected.png
index 5f09b2f8..5404602 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/001-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/001-expected.txt
index f238425f..5c767a8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/001-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/001-expected.txt
@@ -9,12 +9,12 @@
       LayoutTable {TABLE} at (0,58.44) size 784x86 [border: (2px outset #808080)]
         LayoutTableSection {TBODY} at (2,2) size 780x82
           LayoutTableRow {TR} at (0,0) size 780x82
-            LayoutTableCell {TD} at (0,0) size 132x82 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-              LayoutMenuList {SELECT} at (1,1) size 130x80 [bgcolor=#F8F8F8] [border: (40px solid #FF0000)]
-                LayoutBlockFlow (anonymous) at (40,40) size 50x16
-                  LayoutText (anonymous) at (8,1) size 21x13
-                    text run at (8,1) width 21: "Foo"
-            LayoutTableCell {TD} at (132,40) size 648x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (0,0) size 131x82 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutMenuList {SELECT} at (1,1) size 129x80 [bgcolor=#F8F8F8] [border: (40px solid #FF0000)]
+                LayoutBlockFlow (anonymous) at (40,40) size 49x16
+                  LayoutText (anonymous) at (8,1) size 20x13
+                    text run at (8,1) width 20: "Foo"
+            LayoutTableCell {TD} at (131,40) size 649x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
       LayoutBlockFlow {P} at (0,160.44) size 784x24
         LayoutTable {TABLE} at (0,0) size 784x24 [border: (2px outset #808080)]
           LayoutTableSection {TBODY} at (2,2) size 780x20
@@ -33,33 +33,33 @@
         LayoutTable {TABLE} at (0,0) size 784x24 [border: (2px outset #808080)]
           LayoutTableSection {TBODY} at (2,2) size 780x20
             LayoutTableRow {TR} at (0,0) size 780x20
-              LayoutTableCell {TD} at (0,0) size 39x20 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-                LayoutButton {INPUT} at (1,1) size 36.16x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 20.16x13
-                    LayoutText {#text} at (0,0) size 21x13
-                      text run at (0,0) width 21: "Foo"
-              LayoutTableCell {TD} at (39,9) size 741x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (0,0) size 38x20 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                LayoutButton {INPUT} at (1,1) size 35.25x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 19.25x13
+                    LayoutText {#text} at (0,0) size 20x13
+                      text run at (0,0) width 20: "Foo"
+              LayoutTableCell {TD} at (38,9) size 742x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
       LayoutBlockFlow {P} at (0,280.44) size 784x267
         LayoutTable {TABLE} at (0,0) size 784x91 [border: (2px outset #808080)]
           LayoutTableSection {TBODY} at (2,2) size 780x87
             LayoutTableRow {TR} at (0,0) size 780x87
-              LayoutTableCell {TD} at (0,0) size 115x87 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-                LayoutButton {INPUT} at (1,1) size 112.16x85 [bgcolor=#C0C0C0] [border: (40px solid #FF0000)]
-                  LayoutBlockFlow (anonymous) at (46,42) size 20.16x13
-                    LayoutText {#text} at (0,0) size 21x13
-                      text run at (0,0) width 21: "Foo"
-              LayoutTableCell {TD} at (115,42) size 665x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (0,0) size 114x87 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                LayoutButton {INPUT} at (1,1) size 111.25x85 [bgcolor=#C0C0C0] [border: (40px solid #FF0000)]
+                  LayoutBlockFlow (anonymous) at (46,42) size 19.25x13
+                    LayoutText {#text} at (0,0) size 20x13
+                      text run at (0,0) width 20: "Foo"
+              LayoutTableCell {TD} at (114,42) size 666x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
         LayoutTable {TABLE} at (0,91) size 784x91 [border: (2px outset #808080)]
           LayoutTableSection {TBODY} at (2,2) size 780x87
             LayoutTableRow {TR} at (0,0) size 780x87
-              LayoutTableCell {TD} at (0,0) size 165x87 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-                LayoutButton {INPUT} at (1,1) size 162.73x85 [bgcolor=#C0C0C0] [border: (40px solid #FF0000)]
-                  LayoutBlockFlow (anonymous) at (46,42) size 70.73x13
-                    LayoutText {#text} at (0,0) size 71x13
-                      text run at (0,0) width 71: "Submit a bug"
-              LayoutTableCell {TD} at (165,42) size 615x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (0,0) size 162x87 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                LayoutButton {INPUT} at (1,1) size 159.11x85 [bgcolor=#C0C0C0] [border: (40px solid #FF0000)]
+                  LayoutBlockFlow (anonymous) at (46,42) size 67.11x13
+                    LayoutText {#text} at (0,0) size 68x13
+                      text run at (0,0) width 68: "Submit a bug"
+              LayoutTableCell {TD} at (162,42) size 618x2 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
         LayoutBlockFlow (anonymous) at (0,182) size 784x85
-          LayoutButton {INPUT} at (0,0) size 112.16x85 [bgcolor=#C0C0C0] [border: (40px solid #FF0000)]
-            LayoutBlockFlow (anonymous) at (46,42) size 20.16x13
-              LayoutText {#text} at (0,0) size 21x13
-                text run at (0,0) width 21: "Foo"
+          LayoutButton {INPUT} at (0,0) size 111.25x85 [bgcolor=#C0C0C0] [border: (40px solid #FF0000)]
+            LayoutBlockFlow (anonymous) at (46,42) size 19.25x13
+              LayoutText {#text} at (0,0) size 20x13
+                text run at (0,0) width 20: "Foo"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/002-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/002-expected.png
index 28ec750..a320f15 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/002-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/002-expected.txt
index b38ed0e..0e549f9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/002-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/002-expected.txt
@@ -11,5 +11,5 @@
     LayoutImage (floating) {IMG} at (2,2) size 16x16
 layer at (28,12) size 132x13
   LayoutBlockFlow {DIV} at (18,2) size 132x13
-    LayoutText {#text} at (0,0) size 38x13
-      text run at (0,0) width 38: "Submit"
+    LayoutText {#text} at (0,0) size 36x13
+      text run at (0,0) width 36: "Submit"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/003-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/003-expected.png
index 95b3d15b..76c034b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/003-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/003-expected.txt
index 1f53d7f..c66cc5e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/003-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/003-expected.txt
@@ -3,10 +3,10 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,0) size 58x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 58x18
-          LayoutText (anonymous) at (8,2) size 27x13
-            text run at (8,2) width 27: "Hello"
+      LayoutMenuList {SELECT} at (0,0) size 57x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 57x18
+          LayoutText (anonymous) at (8,2) size 26x13
+            text run at (8,2) width 26: "Hello"
       LayoutBlockFlow (anonymous) at (0,18) size 784x18
         LayoutText {#text} at (0,0) size 297x18
           text run at (0,0) width 297: "This text should be *below* the select widget."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/004-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/004-expected.png
index 611c1139..a704f850 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/004-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/004-expected.txt
index 1bdd23e..6cbbfd3a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/004-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/004-expected.txt
@@ -3,14 +3,14 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,1) size 58x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 58x18
-          LayoutText (anonymous) at (8,2) size 27x13
-            text run at (8,2) width 27: "Hello"
-      LayoutText {#text} at (58,0) size 4x18
-        text run at (58,0) width 4: " "
-      LayoutMenuList {SELECT} at (62,1) size 80x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 80x18
-          LayoutText (anonymous) at (8,2) size 49x13
-            text run at (8,2) width 49: "Goodbye"
+      LayoutMenuList {SELECT} at (0,1) size 57x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 57x18
+          LayoutText (anonymous) at (8,2) size 26x13
+            text run at (8,2) width 26: "Hello"
+      LayoutText {#text} at (57,0) size 4x18
+        text run at (57,0) width 4: " "
+      LayoutMenuList {SELECT} at (61,1) size 78x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 78x18
+          LayoutText (anonymous) at (8,2) size 47x13
+            text run at (8,2) width 47: "Goodbye"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/005-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/005-expected.png
index b058f46..71ed3a37 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/005-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/005-expected.txt
index 9c0fb69..0555dd3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/005-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/005-expected.txt
@@ -11,7 +11,7 @@
               LayoutText {#text} at (0,0) size 0x0
 layer at (10,10) size 40x50 clip at (11,11) size 38x48
   LayoutBlockFlow {DIV} at (0,0) size 40x50 [border: (1px solid #C0C0C0)]
-layer at (12,12) size 36x13 scrollWidth 37
+layer at (12,12) size 36x13
   LayoutBlockFlow {DIV} at (2,2) size 36x13
-    LayoutText {#text} at (0,0) size 38x13
-      text run at (0,0) width 38: "Submit"
+    LayoutText {#text} at (0,0) size 36x13
+      text run at (0,0) width 36: "Submit"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label01-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label01-expected.png
index 97bf86a..c98df3da 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label01-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label01-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label01-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label01-expected.txt
index e10aa346..1e913fd 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label01-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label01-expected.txt
@@ -6,8 +6,8 @@
       LayoutText {#text} at (0,0) size 687x18
         text run at (0,0) width 687: "In the selection list below, the text 'The label for this element is \"1\"' should appear, and not the character '1'"
       LayoutBR {BR} at (686,14) size 1x0
-      LayoutMenuList {SELECT} at (0,18) size 194x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 194x18
-          LayoutText (anonymous) at (8,2) size 163x13
-            text run at (8,2) width 163: "the label for this element is \"1\""
+      LayoutMenuList {SELECT} at (0,18) size 184x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 184x18
+          LayoutText (anonymous) at (8,2) size 153x13
+            text run at (8,2) width 153: "the label for this element is \"1\""
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label02-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label02-expected.png
index a1cc017..3c6313e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label02-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label02-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label02-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label02-expected.txt
index 35b45b60..6f86928 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label02-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label02-expected.txt
@@ -6,8 +6,8 @@
       LayoutText {#text} at (0,0) size 308x18
         text run at (0,0) width 308: "With the label empty, the enclosing text is used."
       LayoutBR {BR} at (307,14) size 1x0
-      LayoutMenuList {SELECT} at (0,18) size 306x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 306x18
-          LayoutText (anonymous) at (8,2) size 275x13
-            text run at (8,2) width 275: "empty label should display empty string to match IE"
+      LayoutMenuList {SELECT} at (0,18) size 290x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 290x18
+          LayoutText (anonymous) at (8,2) size 259x13
+            text run at (8,2) width 259: "empty label should display empty string to match IE"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label03-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label03-expected.png
index 082bf9a..8c0fe2d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label03-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label03-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label03-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label03-expected.txt
index 5f7a288d..aaea74c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label03-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label03-expected.txt
@@ -6,8 +6,8 @@
       LayoutText {#text} at (0,0) size 445x18
         text run at (0,0) width 445: "When the label contains only white space, the containing text is used."
       LayoutBR {BR} at (444,14) size 1x0
-      LayoutMenuList {SELECT} at (0,18) size 336x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 336x18
-          LayoutText (anonymous) at (8,2) size 305x13
-            text run at (8,2) width 305: "white space label should display empty string to match IE"
+      LayoutMenuList {SELECT} at (0,18) size 319x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 319x18
+          LayoutText (anonymous) at (8,2) size 288x13
+            text run at (8,2) width 288: "white space label should display empty string to match IE"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label04-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label04-expected.png
index 47b7397..b85f199 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label04-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label04-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label04-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label04-expected.txt
index 19be57d..85ba844 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label04-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label04-expected.txt
@@ -6,8 +6,8 @@
       LayoutText {#text} at (0,0) size 610x18
         text run at (0,0) width 610: "The label attribute appears, but is missing the equals value piece, so the containing text is used."
       LayoutBR {BR} at (609,14) size 1x0
-      LayoutMenuList {SELECT} at (0,18) size 456x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 456x18
-          LayoutText (anonymous) at (8,2) size 425x13
-            text run at (8,2) width 425: "the label attribute is mentioned but no value is specified; this text should appear"
+      LayoutMenuList {SELECT} at (0,18) size 431x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 431x18
+          LayoutText (anonymous) at (8,2) size 400x13
+            text run at (8,2) width 400: "the label attribute is mentioned but no value is specified; this text should appear"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label05-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label05-expected.png
index 55fe4d9..9a0d474 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label05-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label05-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label05-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label05-expected.txt
index 2006bc5..a2c6c684 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label05-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/HTMLOptionElement_label05-expected.txt
@@ -7,8 +7,8 @@
         text run at (0,0) width 681: "In the list box below, the text \"This text should appear\" should be shown as the first entry into the list box."
       LayoutBR {BR} at (680,14) size 1x0
       LayoutText {#text} at (0,0) size 0x0
-layer at (8,26) size 141x73 clip at (9,27) size 128x71 scrollHeight 70
-  LayoutListBox {SELECT} at (0,18.06) size 141.34x72.94 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 128.34x14.19
-      LayoutText {#text} at (2,0) size 125x13
-        text run at (2,0) width 125: "This text should appear"
+layer at (8,26) size 134x73 clip at (9,27) size 121x71 scrollHeight 70
+  LayoutListBox {SELECT} at (0,18.06) size 134.41x72.94 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 121.41x14.19
+      LayoutText {#text} at (2,0) size 118x13
+        text run at (2,0) width 118: "This text should appear"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-buttons-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-buttons-expected.png
index 31d522c..5f62ea0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-buttons-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-buttons-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-buttons-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-buttons-expected.txt
index b8db85a5..d482b20 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-buttons-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-buttons-expected.txt
@@ -44,13 +44,13 @@
               LayoutText {#text} at (1,1) size 106x18
                 text run at (1,1) width 106: "(18, 26) (18, 22)"
             LayoutTableCell {TD} at (392,20) size 135x21 [r=1 c=3 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,2) size 33.06x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-                  LayoutText {#text} at (0,0) size 18x13
-                    text run at (0,0) width 18: "foo"
+              LayoutButton {INPUT} at (1,2) size 32.16x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+                  LayoutText {#text} at (0,0) size 17x13
+                    text run at (0,0) width 17: "foo"
             LayoutTableCell {TD} at (527,20) size 170x20 [r=1 c=4 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 106x18
-                text run at (1,1) width 106: "(18, 33) (18, 33)"
+                text run at (1,1) width 106: "(18, 32) (18, 32)"
           LayoutTableRow {TR} at (0,41) size 697x21
             LayoutTableCell {TD} at (0,41) size 170x20 [r=2 c=0 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 68x18
@@ -63,13 +63,13 @@
               LayoutText {#text} at (1,1) size 106x18
                 text run at (1,1) width 106: "(15, 14) (15, 10)"
             LayoutTableCell {TD} at (392,41) size 135x21 [r=2 c=3 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,2) size 33.06x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-                  LayoutText {#text} at (0,0) size 18x13
-                    text run at (0,0) width 18: "foo"
+              LayoutButton {INPUT} at (1,2) size 32.16x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+                  LayoutText {#text} at (0,0) size 17x13
+                    text run at (0,0) width 17: "foo"
             LayoutTableCell {TD} at (527,41) size 170x20 [r=2 c=4 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 106x18
-                text run at (1,1) width 106: "(18, 33) (18, 33)"
+                text run at (1,1) width 106: "(18, 32) (18, 32)"
           LayoutTableRow {TR} at (0,62) size 697x26
             LayoutTableCell {TD} at (0,65) size 170x20 [r=3 c=0 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 90x18
@@ -82,13 +82,13 @@
               LayoutText {#text} at (1,1) size 106x18
                 text run at (1,1) width 106: "(25, 26) (25, 22)"
             LayoutTableCell {TD} at (392,64) size 135x21 [r=3 c=3 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,2) size 33.06x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-                  LayoutText {#text} at (0,0) size 18x13
-                    text run at (0,0) width 18: "foo"
+              LayoutButton {INPUT} at (1,2) size 32.16x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+                  LayoutText {#text} at (0,0) size 17x13
+                    text run at (0,0) width 17: "foo"
             LayoutTableCell {TD} at (527,65) size 170x20 [r=3 c=4 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 106x18
-                text run at (1,1) width 106: "(18, 33) (18, 33)"
+                text run at (1,1) width 106: "(18, 32) (18, 32)"
           LayoutTableRow {TR} at (0,88) size 697x21
             LayoutTableCell {TD} at (0,88) size 170x20 [r=4 c=0 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 84x18
@@ -101,13 +101,13 @@
               LayoutText {#text} at (1,1) size 106x18
                 text run at (1,1) width 106: "(17, 18) (17, 14)"
             LayoutTableCell {TD} at (392,88) size 135x21 [r=4 c=3 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,2) size 33.06x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-                  LayoutText {#text} at (0,0) size 18x13
-                    text run at (0,0) width 18: "foo"
+              LayoutButton {INPUT} at (1,2) size 32.16x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+                  LayoutText {#text} at (0,0) size 17x13
+                    text run at (0,0) width 17: "foo"
             LayoutTableCell {TD} at (527,88) size 170x20 [r=4 c=4 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 106x18
-                text run at (1,1) width 106: "(18, 33) (18, 33)"
+                text run at (1,1) width 106: "(18, 32) (18, 32)"
           LayoutTableRow {TR} at (0,109) size 697x21
             LayoutTableCell {TD} at (0,109) size 170x20 [r=5 c=0 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 168x18
@@ -120,13 +120,13 @@
               LayoutText {#text} at (1,1) size 106x18
                 text run at (1,1) width 106: "(18, 26) (18, 22)"
             LayoutTableCell {TD} at (392,109) size 135x21 [r=5 c=3 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,2) size 33.06x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-                  LayoutText {#text} at (0,0) size 18x13
-                    text run at (0,0) width 18: "foo"
+              LayoutButton {INPUT} at (1,2) size 32.16x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+                  LayoutText {#text} at (0,0) size 17x13
+                    text run at (0,0) width 17: "foo"
             LayoutTableCell {TD} at (527,109) size 170x20 [r=5 c=4 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 106x18
-                text run at (1,1) width 106: "(18, 33) (18, 33)"
+                text run at (1,1) width 106: "(18, 32) (18, 32)"
           LayoutTableRow {TR} at (0,130) size 697x21
             LayoutTableCell {TD} at (0,130) size 170x20 [r=6 c=0 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 112x18
@@ -139,13 +139,13 @@
               LayoutText {#text} at (1,1) size 106x18
                 text run at (1,1) width 106: "(19, 28) (19, 24)"
             LayoutTableCell {TD} at (392,130) size 135x21 [r=6 c=3 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,2) size 33.06x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-                  LayoutText {#text} at (0,0) size 18x13
-                    text run at (0,0) width 18: "foo"
+              LayoutButton {INPUT} at (1,2) size 32.16x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+                  LayoutText {#text} at (0,0) size 17x13
+                    text run at (0,0) width 17: "foo"
             LayoutTableCell {TD} at (527,130) size 170x20 [r=6 c=4 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 106x18
-                text run at (1,1) width 106: "(18, 33) (18, 33)"
+                text run at (1,1) width 106: "(18, 32) (18, 32)"
           LayoutTableRow {TR} at (0,151) size 697x55
             LayoutTableCell {TD} at (0,168) size 170x20 [r=7 c=0 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 92x18
@@ -158,10 +158,10 @@
               LayoutText {#text} at (1,1) size 106x18
                 text run at (1,1) width 106: "(53, 54) (53, 50)"
             LayoutTableCell {TD} at (392,168) size 135x21 [r=7 c=3 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,2) size 33.06x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-                  LayoutText {#text} at (0,0) size 18x13
-                    text run at (0,0) width 18: "foo"
+              LayoutButton {INPUT} at (1,2) size 32.16x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+                  LayoutText {#text} at (0,0) size 17x13
+                    text run at (0,0) width 17: "foo"
             LayoutTableCell {TD} at (527,168) size 170x20 [r=7 c=4 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 106x18
-                text run at (1,1) width 106: "(18, 33) (18, 33)"
+                text run at (1,1) width 106: "(18, 32) (18, 32)"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.png
index 9a6126c6..a4ff172 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.txt
index ef7c98e..affa92e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-inputs-expected.txt
@@ -66,19 +66,19 @@
         LayoutBlockFlow {INPUT} at (65.59,4) size 12x13 [color=#545454]
         LayoutText {#text} at (80,1) size 9x18
           text run at (80,1) width 9: "b"
-layer at (29,328) size 125x13 scrollWidth 160
+layer at (29,328) size 125x13 scrollWidth 151
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 160x13
-      text run at (0,0) width 160: "foobarbazfoobarbazfoobarbaz"
+    LayoutText {#text} at (0,0) size 152x13
+      text run at (0,0) width 152: "foobarbazfoobarbazfoobarbaz"
 layer at (188,328) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (338,328) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 20x13
-      text run at (0,0) width 20: "\x{2022}\x{2022}\x{2022}"
+    LayoutText {#text} at (0,0) size 19x13
+      text run at (0,0) width 19: "\x{2022}\x{2022}\x{2022}"
 layer at (86,347) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 20x13
-      text run at (0,0) width 20: "\x{2022}\x{2022}\x{2022}"
+    LayoutText {#text} at (0,0) size 19x13
+      text run at (0,0) width 19: "\x{2022}\x{2022}\x{2022}"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-selects-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-selects-expected.png
index 7be6824d..7797010 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-selects-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-selects-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-selects-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-selects-expected.txt
index a565ff7e..ca028d1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-selects-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-selects-expected.txt
@@ -6,169 +6,169 @@
       LayoutBlockFlow {DIV} at (0,0) size 784x430 [border: (1px solid #FF0000)]
         LayoutText {#text} at (1,0) size 169x18
           text run at (1,0) width 169: "Whitespace in option text:"
-        LayoutMenuList {SELECT} at (169.39,1) size 55x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 55x18
-            LayoutText (anonymous) at (8,2) size 24x13
-              text run at (8,2) width 24: "f o o"
-        LayoutText {#text} at (224,0) size 8x18
-          text run at (224,0) width 8: "a"
-        LayoutMenuList {SELECT} at (231.48,1) size 55x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 55x18
-            LayoutText (anonymous) at (8,2) size 24x13
-              text run at (8,2) width 24: "f o o"
-        LayoutText {#text} at (286,0) size 9x18
-          text run at (286,0) width 9: "b"
-        LayoutBR {BR} at (294,0) size 1x18
+        LayoutMenuList {SELECT} at (169.39,1) size 54x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 54x18
+            LayoutText (anonymous) at (8,2) size 23x13
+              text run at (8,2) width 23: "f o o"
+        LayoutText {#text} at (223,0) size 8x18
+          text run at (223,0) width 8: "a"
+        LayoutMenuList {SELECT} at (230.48,1) size 54x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 54x18
+            LayoutText (anonymous) at (8,2) size 23x13
+              text run at (8,2) width 23: "f o o"
+        LayoutText {#text} at (284,0) size 9x18
+          text run at (284,0) width 9: "b"
+        LayoutBR {BR} at (292,0) size 1x18
         LayoutBR {BR} at (1,18) size 0x18
         LayoutText {#text} at (1,34) size 140x18
           text run at (1,34) width 140: "Simple select control:"
-        LayoutMenuList {SELECT} at (140.52,35) size 49x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "foo"
-        LayoutText {#text} at (189,34) size 8x18
-          text run at (189,34) width 8: "a"
-        LayoutMenuList {SELECT} at (196.61,35) size 49x18 [color=#808080] [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "foo"
-        LayoutText {#text} at (245,34) size 9x18
-          text run at (245,34) width 9: "b"
-        LayoutBR {BR} at (253,34) size 1x18
+        LayoutMenuList {SELECT} at (140.52,35) size 48x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "foo"
+        LayoutText {#text} at (188,34) size 8x18
+          text run at (188,34) width 8: "a"
+        LayoutMenuList {SELECT} at (195.61,35) size 48x18 [color=#808080] [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "foo"
+        LayoutText {#text} at (243,34) size 9x18
+          text run at (243,34) width 9: "b"
+        LayoutBR {BR} at (251,34) size 1x18
         LayoutBR {BR} at (1,52) size 0x18
         LayoutText {#text} at (1,68) size 198x18
           text run at (1,68) width 198: "Line-height should be ignored:"
-        LayoutMenuList {SELECT} at (198.73,69) size 49x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "foo"
-        LayoutText {#text} at (247,68) size 8x18
-          text run at (247,68) width 8: "a"
-        LayoutMenuList {SELECT} at (254.83,69) size 49x18 [color=#808080] [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "bar"
-        LayoutText {#text} at (303,68) size 9x18
-          text run at (303,68) width 9: "b"
-        LayoutBR {BR} at (311,68) size 1x18
+        LayoutMenuList {SELECT} at (198.73,69) size 48x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "foo"
+        LayoutText {#text} at (246,68) size 8x18
+          text run at (246,68) width 8: "a"
+        LayoutMenuList {SELECT} at (253.83,69) size 48x18 [color=#808080] [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "bar"
+        LayoutText {#text} at (301,68) size 9x18
+          text run at (301,68) width 9: "b"
+        LayoutBR {BR} at (309,68) size 1x18
         LayoutBR {BR} at (1,86) size 0x18
         LayoutText {#text} at (1,102) size 441x18
           text run at (1,102) width 441: "Padding should be respected, the arrow button shouldn't change size:"
-        LayoutMenuList {SELECT} at (442,103) size 49x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "foo"
-        LayoutText {#text} at (491,102) size 8x18
-          text run at (491,102) width 8: "a"
-        LayoutMenuList {SELECT} at (498.09,103) size 49x18 [color=#808080] [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "foo"
-        LayoutText {#text} at (547,102) size 9x18
-          text run at (547,102) width 9: "b"
-        LayoutBR {BR} at (555,102) size 1x18
+        LayoutMenuList {SELECT} at (442,103) size 48x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "foo"
+        LayoutText {#text} at (490,102) size 8x18
+          text run at (490,102) width 8: "a"
+        LayoutMenuList {SELECT} at (497.09,103) size 48x18 [color=#808080] [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "foo"
+        LayoutText {#text} at (545,102) size 9x18
+          text run at (545,102) width 9: "b"
+        LayoutBR {BR} at (553,102) size 1x18
         LayoutBR {BR} at (1,120) size 0x18
         LayoutText {#text} at (1,143) size 180x18
           text run at (1,143) width 180: "Border should be respected:"
-        LayoutMenuList {SELECT} at (180.05,137) size 63x32 [bgcolor=#F8F8F8] [border: (8px solid #33CCFF)]
-          LayoutBlockFlow (anonymous) at (8,8) size 47x16
-            LayoutText (anonymous) at (8,1) size 18x13
-              text run at (8,1) width 18: "foo"
-        LayoutText {#text} at (243,143) size 8x18
-          text run at (243,143) width 8: "a"
-        LayoutMenuList {SELECT} at (250.14,137) size 63x32 [color=#7F7F7F] [bgcolor=#F8F8F8] [border: (8px solid #33CCFF)]
-          LayoutBlockFlow (anonymous) at (8,8) size 47x16
-            LayoutText (anonymous) at (8,1) size 18x13
-              text run at (8,1) width 18: "foo"
-        LayoutText {#text} at (313,143) size 9x18
-          text run at (313,143) width 9: "b"
-        LayoutBR {BR} at (321,143) size 1x18
+        LayoutMenuList {SELECT} at (180.05,137) size 62x32 [bgcolor=#F8F8F8] [border: (8px solid #33CCFF)]
+          LayoutBlockFlow (anonymous) at (8,8) size 46x16
+            LayoutText (anonymous) at (8,1) size 17x13
+              text run at (8,1) width 17: "foo"
+        LayoutText {#text} at (242,143) size 8x18
+          text run at (242,143) width 8: "a"
+        LayoutMenuList {SELECT} at (249.14,137) size 62x32 [color=#7F7F7F] [bgcolor=#F8F8F8] [border: (8px solid #33CCFF)]
+          LayoutBlockFlow (anonymous) at (8,8) size 46x16
+            LayoutText (anonymous) at (8,1) size 17x13
+              text run at (8,1) width 17: "foo"
+        LayoutText {#text} at (311,143) size 9x18
+          text run at (311,143) width 9: "b"
+        LayoutBR {BR} at (319,143) size 1x18
         LayoutBR {BR} at (1,168) size 0x18
         LayoutText {#text} at (1,187) size 118x18
           text run at (1,187) width 118: "Border + padding:"
-        LayoutMenuList {SELECT} at (118.44,185) size 55x24 [bgcolor=#F8F8F8] [border: (4px solid #33CCFF)]
-          LayoutBlockFlow (anonymous) at (4,4) size 47x16
-            LayoutText (anonymous) at (8,1) size 18x13
-              text run at (8,1) width 18: "foo"
-        LayoutText {#text} at (173,187) size 8x18
-          text run at (173,187) width 8: "a"
-        LayoutMenuList {SELECT} at (180.53,185) size 55x24 [color=#7F7F7F] [bgcolor=#F8F8F8] [border: (4px solid #33CCFF)]
-          LayoutBlockFlow (anonymous) at (4,4) size 47x16
-            LayoutText (anonymous) at (8,1) size 18x13
-              text run at (8,1) width 18: "foo"
-        LayoutText {#text} at (235,187) size 9x18
-          text run at (235,187) width 9: "b"
-        LayoutBR {BR} at (243,187) size 1x18
+        LayoutMenuList {SELECT} at (118.44,185) size 54x24 [bgcolor=#F8F8F8] [border: (4px solid #33CCFF)]
+          LayoutBlockFlow (anonymous) at (4,4) size 46x16
+            LayoutText (anonymous) at (8,1) size 17x13
+              text run at (8,1) width 17: "foo"
+        LayoutText {#text} at (172,187) size 8x18
+          text run at (172,187) width 8: "a"
+        LayoutMenuList {SELECT} at (179.53,185) size 54x24 [color=#7F7F7F] [bgcolor=#F8F8F8] [border: (4px solid #33CCFF)]
+          LayoutBlockFlow (anonymous) at (4,4) size 46x16
+            LayoutText (anonymous) at (8,1) size 17x13
+              text run at (8,1) width 17: "foo"
+        LayoutText {#text} at (233,187) size 9x18
+          text run at (233,187) width 9: "b"
+        LayoutBR {BR} at (241,187) size 1x18
         LayoutBR {BR} at (1,208) size 0x18
         LayoutText {#text} at (1,224) size 492x18
           text run at (1,224) width 492: "Height larger than font-size, button should grow, text baseline should center:"
-        LayoutMenuList {SELECT} at (492.42,225) size 49x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "foo"
-        LayoutText {#text} at (541,224) size 8x18
-          text run at (541,224) width 8: "a"
-        LayoutMenuList {SELECT} at (548.52,225) size 49x18 [color=#808080] [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "foo"
-        LayoutText {#text} at (597,224) size 9x18
-          text run at (597,224) width 9: "b"
-        LayoutBR {BR} at (605,224) size 1x18
+        LayoutMenuList {SELECT} at (492.42,225) size 48x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "foo"
+        LayoutText {#text} at (540,224) size 8x18
+          text run at (540,224) width 8: "a"
+        LayoutMenuList {SELECT} at (547.52,225) size 48x18 [color=#808080] [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "foo"
+        LayoutText {#text} at (595,224) size 9x18
+          text run at (595,224) width 9: "b"
+        LayoutBR {BR} at (603,224) size 1x18
         LayoutBR {BR} at (1,242) size 0x18
         LayoutText {#text} at (1,258) size 498x18
           text run at (1,258) width 498: "Height smaller than font-size, whole select shrinks but baseline is unchanged:"
-        LayoutMenuList {SELECT} at (498.20,259) size 49x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "foo"
-        LayoutText {#text} at (547,258) size 8x18
-          text run at (547,258) width 8: "a"
-        LayoutMenuList {SELECT} at (554.30,259) size 49x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 49x18
-            LayoutText (anonymous) at (8,2) size 18x13
-              text run at (8,2) width 18: "bar"
-        LayoutText {#text} at (603,258) size 9x18
-          text run at (603,258) width 9: "b"
-        LayoutBR {BR} at (611,258) size 1x18
+        LayoutMenuList {SELECT} at (498.20,259) size 48x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "foo"
+        LayoutText {#text} at (546,258) size 8x18
+          text run at (546,258) width 8: "a"
+        LayoutMenuList {SELECT} at (553.30,259) size 48x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 48x18
+            LayoutText (anonymous) at (8,2) size 17x13
+              text run at (8,2) width 17: "bar"
+        LayoutText {#text} at (601,258) size 9x18
+          text run at (601,258) width 9: "b"
+        LayoutBR {BR} at (609,258) size 1x18
         LayoutBR {BR} at (1,276) size 0x18
         LayoutText {#text} at (1,292) size 173x18
           text run at (1,292) width 173: "select control with size=0: "
         LayoutBR {BR} at (173,292) size 1x18
-        LayoutMenuList {SELECT} at (1,309) size 197x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 197x18
-            LayoutText (anonymous) at (8,2) size 71x13
-              text run at (8,2) width 71: "Future Series"
-        LayoutText {#text} at (198,308) size 4x18
-          text run at (198,308) width 4: " "
+        LayoutMenuList {SELECT} at (1,309) size 188x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 188x18
+            LayoutText (anonymous) at (8,2) size 67x13
+              text run at (8,2) width 67: "Future Series"
+        LayoutText {#text} at (189,308) size 4x18
+          text run at (189,308) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutText {#text} at (1,326) size 173x18
           text run at (1,326) width 173: "select control with size=1: "
         LayoutBR {BR} at (173,326) size 1x18
-        LayoutMenuList {SELECT} at (1,343) size 197x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 197x18
-            LayoutText (anonymous) at (8,2) size 71x13
-              text run at (8,2) width 71: "Future Series"
-        LayoutText {#text} at (198,342) size 4x18
-          text run at (198,342) width 4: " "
+        LayoutMenuList {SELECT} at (1,343) size 188x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 188x18
+            LayoutText (anonymous) at (8,2) size 67x13
+              text run at (8,2) width 67: "Future Series"
+        LayoutText {#text} at (189,342) size 4x18
+          text run at (189,342) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutText {#text} at (1,360) size 170x18
           text run at (1,360) width 170: "Non-styled select control: "
         LayoutBR {BR} at (170,360) size 1x18
-        LayoutMenuList {SELECT} at (1,377) size 197x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
-          LayoutBlockFlow (anonymous) at (1,1) size 195x16
-            LayoutText (anonymous) at (8,1) size 71x13
-              text run at (8,1) width 71: "Future Series"
-        LayoutText {#text} at (198,376) size 4x18
-          text run at (198,376) width 4: " "
+        LayoutMenuList {SELECT} at (1,377) size 188x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (1,1) size 186x16
+            LayoutText (anonymous) at (8,1) size 67x13
+              text run at (8,1) width 67: "Future Series"
+        LayoutText {#text} at (189,376) size 4x18
+          text run at (189,376) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutText {#text} at (1,394) size 298x18
           text run at (1,394) width 298: "Styled select control with large border-radius: "
         LayoutBR {BR} at (298,394) size 1x18
-        LayoutMenuList {SELECT} at (1,411) size 197x18 [bgcolor=#33CCFF] [border: (1px solid #A6A6A6)]
-          LayoutBlockFlow (anonymous) at (1,1) size 195x16
-            LayoutText (anonymous) at (8,1) size 71x13
-              text run at (8,1) width 71: "Future Series"
-        LayoutText {#text} at (198,410) size 4x18
-          text run at (198,410) width 4: " "
+        LayoutMenuList {SELECT} at (1,411) size 188x18 [bgcolor=#33CCFF] [border: (1px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (1,1) size 186x16
+            LayoutText (anonymous) at (8,1) size 67x13
+              text run at (8,1) width 67: "Future Series"
+        LayoutText {#text} at (189,410) size 4x18
+          text run at (189,410) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.png
index 93d2b8e..b92f2b0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.txt
index f6990a82..6dbde0f6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-expected.txt
@@ -218,456 +218,454 @@
     layer at (1,77) size 141x32 clip at (2,78) size 139x30
       LayoutTextControl {TEXTAREA} at (1,15) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x13
-          LayoutText {#text} at (0,0) size 100x13
-            text run at (0,0) width 100: "Lorem ipsum dolor"
+          LayoutText {#text} at (0,0) size 95x13
+            text run at (0,0) width 95: "Lorem ipsum dolor"
     layer at (144,77) size 141x32 clip at (145,78) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,15) size 141x32 [color=#545454] [bgcolor=#FFFFFF] [border: (1px solid #545454)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (287,61) size 157x48 clip at (288,62) size 140x46 scrollHeight 85
       LayoutTextControl {TEXTAREA} at (1,29) size 157x48 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (11,11) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (446,81) size 137x28 clip at (447,82) size 120x26 scrollHeight 65
       LayoutTextControl {TEXTAREA} at (1,29) size 137x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (1,1) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (595,67) size 141x32 clip at (596,68) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (11,39) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (1,192) size 141x32 clip at (2,193) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (144,192) size 66x32 clip at (145,193) size 49x30 scrollHeight 147
       LayoutTextControl {TEXTAREA} at (1,29) size 66x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 45x143
           LayoutText {#text} at (0,0) size 45x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 44: "abcdefg"
-            text run at (0,117) width 45: "hijklmno"
-            text run at (0,130) width 40: "pqrstuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 45: "ABCDEF"
+            text run at (0,52) width 39: "GHIJKL"
+            text run at (0,65) width 43: "MNOPQ"
+            text run at (0,78) width 37: "RSTUV"
+            text run at (0,91) width 32: "WXYZ"
+            text run at (31,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (226,156) size 102x68 clip at (227,157) size 85x66 scrollHeight 183
       LayoutTextControl {TEXTAREA} at (1,43) size 102x68 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (21,21) size 45x143
           LayoutText {#text} at (0,0) size 45x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 44: "abcdefg"
-            text run at (0,117) width 45: "hijklmno"
-            text run at (0,130) width 40: "pqrstuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 45: "ABCDEF"
+            text run at (0,52) width 39: "GHIJKL"
+            text run at (0,65) width 43: "MNOPQ"
+            text run at (0,78) width 37: "RSTUV"
+            text run at (0,91) width 32: "WXYZ"
+            text run at (31,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (330,196) size 62x28 clip at (331,197) size 45x26 scrollHeight 143
       LayoutTextControl {TEXTAREA} at (1,43) size 62x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (1,1) size 45x143
           LayoutText {#text} at (0,0) size 45x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 44: "abcdefg"
-            text run at (0,117) width 45: "hijklmno"
-            text run at (0,130) width 40: "pqrstuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 45: "ABCDEF"
+            text run at (0,52) width 39: "GHIJKL"
+            text run at (0,65) width 43: "MNOPQ"
+            text run at (0,78) width 37: "RSTUV"
+            text run at (0,91) width 32: "WXYZ"
+            text run at (31,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (412,158) size 141x66 clip at (413,159) size 139x64
       LayoutTextControl {TEXTAREA} at (1,29) size 141x66 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x52
-          LayoutText {#text} at (0,0) size 131x52
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-            text run at (0,26) width 71: "RSTUVWXYZ"
-            text run at (70,26) width 4: " "
-            text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 133x52
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+            text run at (0,26) width 60: "STUVWXYZ"
+            text run at (59,26) width 4: " "
+            text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
     layer at (555,158) size 66x66 clip at (556,159) size 49x64 scrollHeight 147
       LayoutTextControl {TEXTAREA} at (1,43) size 66x66 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 45x143
           LayoutText {#text} at (0,0) size 45x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 44: "abcdefg"
-            text run at (0,117) width 45: "hijklmno"
-            text run at (0,130) width 40: "pqrstuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 45: "ABCDEF"
+            text run at (0,52) width 39: "GHIJKL"
+            text run at (0,65) width 43: "MNOPQ"
+            text run at (0,78) width 37: "RSTUV"
+            text run at (0,91) width 32: "WXYZ"
+            text run at (31,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (637,192) size 141x32 clip at (638,193) size 139x30 scrollHeight 56
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x52
-          LayoutText {#text} at (0,0) size 131x52
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-            text run at (0,26) width 71: "RSTUVWXYZ"
-            text run at (70,26) width 4: " "
-            text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 133x52
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+            text run at (0,26) width 60: "STUVWXYZ"
+            text run at (59,26) width 4: " "
+            text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
     layer at (1,304) size 141x47 clip at (2,305) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (144,285) size 66x66 clip at (145,286) size 64x64 scrollHeight 134
       LayoutTextControl {TEXTAREA} at (1,57) size 66x66 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 60x130
-          LayoutText {#text} at (0,0) size 60x130
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 55: "ABCDEFG"
-            text run at (0,52) width 60: "HIJKLMNO"
-            text run at (0,65) width 55: "PQRSTUV"
-            text run at (0,78) width 33: "WXYZ"
-            text run at (32,78) width 4: " "
-            text run at (0,91) width 56: "abcdefghij"
-            text run at (0,104) width 60: "klmnopqrst"
-            text run at (0,117) width 13: "uv"
+          LayoutText {#text} at (0,0) size 58x130
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 53: "ABCDEFG"
+            text run at (0,52) width 57: "HIJKLMNO"
+            text run at (0,65) width 52: "PQRSTUV"
+            text run at (0,78) width 32: "WXYZ"
+            text run at (31,78) width 4: " "
+            text run at (0,91) width 58: "abcdefghijk"
+            text run at (0,104) width 57: "lmnopqrstu"
+            text run at (0,117) width 6: "v"
     layer at (226,285) size 66x66 clip at (227,286) size 49x49 scrollHeight 147
       LayoutTextControl {TEXTAREA} at (1,57) size 66x66 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 45x143
           LayoutText {#text} at (0,0) size 45x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 44: "abcdefg"
-            text run at (0,117) width 45: "hijklmno"
-            text run at (0,130) width 40: "pqrstuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 45: "ABCDEF"
+            text run at (0,52) width 39: "GHIJKL"
+            text run at (0,65) width 43: "MNOPQ"
+            text run at (0,78) width 37: "RSTUV"
+            text run at (0,91) width 32: "WXYZ"
+            text run at (31,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (308,285) size 66x66 clip at (309,286) size 49x64 scrollHeight 147
       LayoutTextControl {TEXTAREA} at (1,43) size 66x66 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 45x143
           LayoutText {#text} at (0,0) size 45x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 44: "abcdefg"
-            text run at (0,117) width 45: "hijklmno"
-            text run at (0,130) width 40: "pqrstuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 45: "ABCDEF"
+            text run at (0,52) width 39: "GHIJKL"
+            text run at (0,65) width 43: "MNOPQ"
+            text run at (0,78) width 37: "RSTUV"
+            text run at (0,91) width 32: "WXYZ"
+            text run at (31,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (390,285) size 66x66 clip at (391,286) size 49x64 scrollHeight 147
       LayoutTextControl {TEXTAREA} at (1,43) size 66x66 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 45x143
           LayoutText {#text} at (0,0) size 45x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 44: "abcdefg"
-            text run at (0,117) width 45: "hijklmno"
-            text run at (0,130) width 40: "pqrstuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 45: "ABCDEF"
+            text run at (0,52) width 39: "GHIJKL"
+            text run at (0,65) width 43: "MNOPQ"
+            text run at (0,78) width 37: "RSTUV"
+            text run at (0,91) width 32: "WXYZ"
+            text run at (31,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (472,285) size 66x66 clip at (473,286) size 49x64 scrollHeight 147
       LayoutTextControl {TEXTAREA} at (1,57) size 66x66 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 45x143
           LayoutText {#text} at (0,0) size 45x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 44: "abcdefg"
-            text run at (0,117) width 45: "hijklmno"
-            text run at (0,130) width 40: "pqrstuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 45: "ABCDEF"
+            text run at (0,52) width 39: "GHIJKL"
+            text run at (0,65) width 43: "MNOPQ"
+            text run at (0,78) width 37: "RSTUV"
+            text run at (0,91) width 32: "WXYZ"
+            text run at (31,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (554,319) size 39x32 clip at (555,320) size 22x30 scrollHeight 381
       LayoutTextControl {TEXTAREA} at (1,15) size 39x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 18x377
           LayoutText {#text} at (0,0) size 18x377
-            text run at (0,0) width 18: "Lor"
-            text run at (0,13) width 17: "em"
-            text run at (16,13) width 2: " "
-            text run at (0,26) width 16: "ips"
-            text run at (0,39) width 17: "um"
+            text run at (0,0) width 17: "Lor"
+            text run at (0,13) width 16: "em"
+            text run at (15,13) width 3: " "
+            text run at (0,26) width 15: "ips"
+            text run at (0,39) width 16: "um"
             text run at (0,52) width 7: "  "
-            text run at (0,65) width 17: "dol"
+            text run at (0,65) width 16: "dol"
             text run at (0,78) width 11: "or"
-            text run at (10,78) width 5: " "
-            text run at (0,91) width 16: "AB"
-            text run at (0,104) width 17: "CD"
+            text run at (10,78) width 4: " "
+            text run at (0,91) width 15: "AB"
+            text run at (0,104) width 16: "CD"
             text run at (0,117) width 14: "EF"
-            text run at (0,130) width 18: "GH"
-            text run at (0,143) width 18: "IJK"
-            text run at (0,156) width 17: "LM"
-            text run at (0,169) width 18: "NO"
-            text run at (0,182) width 17: "PQ"
-            text run at (0,195) width 16: "RS"
-            text run at (0,208) width 16: "TU"
+            text run at (0,130) width 17: "GH"
+            text run at (0,143) width 17: "IJK"
+            text run at (0,156) width 16: "LM"
+            text run at (0,169) width 17: "NO"
+            text run at (0,182) width 16: "PQ"
+            text run at (0,195) width 15: "RS"
+            text run at (0,208) width 15: "TU"
             text run at (0,221) width 18: "VW"
             text run at (0,234) width 15: "XY"
-            text run at (0,247) width 8: "Z"
-            text run at (7,247) width 4: " "
-            text run at (0,260) width 14: "ab"
-            text run at (0,273) width 14: "cd"
-            text run at (0,286) width 17: "efg"
-            text run at (0,299) width 13: "hij"
-            text run at (0,312) width 9: "kl"
-            text run at (0,325) width 17: "mn"
-            text run at (0,338) width 14: "op"
-            text run at (0,351) width 17: "qrs"
-            text run at (0,364) width 17: "tuv"
+            text run at (0,247) width 7: "Z"
+            text run at (6,247) width 4: " "
+            text run at (0,260) width 13: "ab"
+            text run at (0,273) width 13: "cd"
+            text run at (0,286) width 16: "efg"
+            text run at (0,299) width 17: "hijk"
+            text run at (0,312) width 13: "lm"
+            text run at (0,325) width 13: "no"
+            text run at (0,338) width 17: "pqr"
+            text run at (0,351) width 16: "stu"
+            text run at (0,364) width 6: "v"
     layer at (636,306) size 141x45 clip at (637,307) size 124x43 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,15) size 141x45 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
-    layer at (1,435) size 63x32 clip at (2,436) size 46x30 scrollHeight 160
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
+    layer at (1,435) size 63x32 clip at (2,436) size 46x30 scrollHeight 147
       LayoutTextControl {TEXTAREA} at (1,15) size 63x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-        LayoutBlockFlow {DIV} at (3,3) size 42x156
-          LayoutText {#text} at (0,0) size 42x156
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 3: " "
-            text run at (0,104) width 37: "abcdef"
-            text run at (0,117) width 38: "ghijklm"
-            text run at (0,130) width 41: "nopqrst"
-            text run at (0,143) width 13: "uv"
+        LayoutBlockFlow {DIV} at (3,3) size 42x143
+          LayoutText {#text} at (0,0) size 42x143
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 40: "FGHIJK"
+            text run at (0,65) width 40: "LMNOP"
+            text run at (0,78) width 38: "QRSTU"
+            text run at (0,91) width 39: "VWXYZ"
+            text run at (38,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (83,370) size 141x97 clip at (84,371) size 139x95
       LayoutTextControl {TEXTAREA} at (1,15) size 141x97 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x52
-          LayoutText {#text} at (0,0) size 131x52
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-            text run at (0,26) width 71: "RSTUVWXYZ"
-            text run at (70,26) width 4: " "
-            text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
-    layer at (226,409) size 51x58 clip at (227,410) size 34x56 scrollHeight 251
+          LayoutText {#text} at (0,0) size 133x52
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+            text run at (0,26) width 60: "STUVWXYZ"
+            text run at (59,26) width 4: " "
+            text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
+    layer at (226,409) size 51x58 clip at (227,410) size 34x56 scrollHeight 238
       LayoutTextControl {TEXTAREA} at (1,29) size 51x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-        LayoutBlockFlow {DIV} at (3,3) size 30x247
-          LayoutText {#text} at (0,0) size 30x247
-            text run at (0,0) width 24: "Lore"
+        LayoutBlockFlow {DIV} at (3,3) size 30x234
+          LayoutText {#text} at (0,0) size 30x234
+            text run at (0,0) width 23: "Lore"
             text run at (0,13) width 10: "m"
-            text run at (9,13) width 5: " "
-            text run at (0,26) width 23: "ipsu"
+            text run at (9,13) width 4: " "
+            text run at (0,26) width 21: "ipsu"
             text run at (0,39) width 10: "m"
-            text run at (9,39) width 8: "  "
-            text run at (0,52) width 28: "dolor"
-            text run at (27,52) width 3: " "
-            text run at (0,65) width 24: "ABC"
-            text run at (0,78) width 23: "DEF"
-            text run at (0,91) width 27: "GHIJ"
-            text run at (0,104) width 25: "KLM"
-            text run at (0,117) width 25: "NOP"
-            text run at (0,130) width 25: "QRS"
-            text run at (0,143) width 23: "TUV"
-            text run at (0,156) width 26: "WXY"
-            text run at (0,169) width 8: "Z"
-            text run at (7,169) width 4: " "
-            text run at (0,182) width 27: "abcd"
-            text run at (0,195) width 29: "efghij"
-            text run at (0,208) width 26: "klmn"
-            text run at (0,221) width 25: "opqr"
-            text run at (0,234) width 23: "stuv"
-    layer at (308,420) size 141x47 clip at (309,421) size 139x30 scrollWidth 439
+            text run at (9,39) width 7: "  "
+            text run at (0,52) width 26: "dolor"
+            text run at (25,52) width 4: " "
+            text run at (0,65) width 23: "ABC"
+            text run at (0,78) width 30: "DEFG"
+            text run at (0,91) width 25: "HIJK"
+            text run at (0,104) width 25: "LMN"
+            text run at (0,117) width 25: "OPQ"
+            text run at (0,130) width 30: "RSTU"
+            text run at (0,143) width 24: "VWX"
+            text run at (0,156) width 15: "YZ"
+            text run at (14,156) width 4: " "
+            text run at (0,169) width 26: "abcd"
+            text run at (0,182) width 27: "efghij"
+            text run at (0,195) width 25: "klmn"
+            text run at (0,208) width 29: "opqrs"
+            text run at (0,221) width 16: "tuv"
+    layer at (308,420) size 141x47 clip at (309,421) size 139x30 scrollWidth 419
       LayoutTextControl {TEXTAREA} at (1,15) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x13
-          LayoutText {#text} at (0,0) size 438x13
-            text run at (0,0) width 438: "Lorem ipsum  dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 417x13
+            text run at (0,0) width 417: "Lorem ipsum  dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
     layer at (451,435) size 141x32 clip at (452,436) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,15) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (594,435) size 141x32 clip at (595,436) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,15) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (1,500) size 141x32 clip at (2,501) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 73: "Lorem ipsum "
-            text run at (72,0) width 28: "dolor"
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 69: "Lorem ipsum "
+            text run at (68,0) width 27: "dolor"
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (144,500) size 141x32 clip at (145,501) size 124x30 scrollHeight 56
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x52
-          LayoutText {#text} at (0,0) size 119x52
-            text run at (0,0) width 114: "Lorem ipsum  dolor A"
-            text run at (0,13) width 114: "BCDEFGHIJKLMNOP"
-            text run at (0,26) width 119: "QRSTUVWXYZ abcdef"
-            text run at (0,39) width 91: "ghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 118x52
+            text run at (0,0) width 116: "Lorem ipsum  dolor AB"
+            text run at (0,13) width 118: "CDEFGHIJKLMNOPQR"
+            text run at (0,26) width 116: "STUVWXYZ abcdefghij"
+            text run at (0,39) width 69: "klmnopqrstuv"
     layer at (287,500) size 141x32 clip at (288,501) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
-    layer at (430,500) size 141x32 clip at (431,501) size 124x15 scrollWidth 436 scrollHeight 17
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
+    layer at (430,500) size 141x32 clip at (431,501) size 124x15 scrollWidth 415 scrollHeight 17
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x13
-          LayoutText {#text} at (0,0) size 434x13
-            text run at (0,0) width 73: "Lorem ipsum "
-            text run at (72,0) width 362: "dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 414x13
+            text run at (0,0) width 69: "Lorem ipsum "
+            text run at (68,0) width 346: "dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
     layer at (573,500) size 141x32 clip at (574,501) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 73: "Lorem ipsum "
-            text run at (72,0) width 28: "dolor"
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
-    layer at (1,593) size 141x47 clip at (2,594) size 124x30 scrollWidth 202 scrollHeight 43
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 69: "Lorem ipsum "
+            text run at (68,0) width 27: "dolor"
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
+    layer at (1,593) size 141x47 clip at (2,594) size 124x30 scrollWidth 195 scrollHeight 43
       LayoutTextControl {TEXTAREA} at (1,29) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x39
-          LayoutText {#text} at (0,0) size 201x39
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 201: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-            text run at (0,26) width 131: " abcdefghijklmnopqrstuv"
-    layer at (144,593) size 141x47 clip at (145,594) size 124x30 scrollWidth 202 scrollHeight 43
+          LayoutText {#text} at (0,0) size 193x39
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 193: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+            text run at (0,26) width 124: " abcdefghijklmnopqrstuv"
+    layer at (144,593) size 141x47 clip at (145,594) size 124x30 scrollWidth 195 scrollHeight 43
       LayoutTextControl {TEXTAREA} at (1,57) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x39
-          LayoutText {#text} at (0,0) size 201x39
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 201: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-            text run at (0,26) width 131: " abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 193x39
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 193: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+            text run at (0,26) width 124: " abcdefghijklmnopqrstuv"
 layer at (0,644) size 785x620 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
   LayoutIFrame {IFRAME} at (0,644) size 785x620
     layer at (0,0) size 785x620
@@ -882,92 +880,92 @@
     layer at (1,77) size 141x32 clip at (2,78) size 139x30
       LayoutTextControl {TEXTAREA} at (1,1) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x13
-          LayoutText {#text} at (0,0) size 100x13
-            text run at (0,0) width 100: "Lorem ipsum dolor"
+          LayoutText {#text} at (0,0) size 95x13
+            text run at (0,0) width 95: "Lorem ipsum dolor"
     layer at (144,77) size 141x32 clip at (145,78) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,15) size 141x32 [color=#545454] [bgcolor=#FFFFFF] [border: (1px solid #545454)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (287,61) size 157x48 clip at (288,62) size 140x46 scrollHeight 85
       LayoutTextControl {TEXTAREA} at (1,29) size 157x48 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (11,11) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (446,81) size 137x28 clip at (447,82) size 120x26 scrollHeight 65
       LayoutTextControl {TEXTAREA} at (1,29) size 137x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (1,1) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (595,67) size 141x32 clip at (596,68) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (11,39) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (1,189) size 141x32 clip at (2,190) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (144,189) size 60x32 clip at (145,190) size 43x30 scrollHeight 173
       LayoutTextControl {TEXTAREA} at (1,29) size 60x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 39x169
           LayoutText {#text} at (0,0) size 39x169
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 33: "ABCD"
-            text run at (0,52) width 35: "EFGHI"
-            text run at (0,65) width 39: "JKLMN"
-            text run at (0,78) width 34: "OPQR"
-            text run at (0,91) width 30: "STUV"
-            text run at (0,104) width 33: "WXYZ"
-            text run at (32,104) width 4: " "
-            text run at (0,117) width 37: "abcdef"
-            text run at (0,130) width 38: "ghijklm"
-            text run at (0,143) width 37: "nopqrs"
-            text run at (0,156) width 17: "tuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 32: "FGHIJ"
+            text run at (0,65) width 32: "KLMN"
+            text run at (0,78) width 32: "OPQR"
+            text run at (0,91) width 39: "STUVW"
+            text run at (0,104) width 21: "XYZ"
+            text run at (20,104) width 4: " "
+            text run at (0,117) width 35: "abcdef"
+            text run at (0,130) width 36: "ghijklm"
+            text run at (0,143) width 39: "nopqrst"
+            text run at (0,156) width 12: "uv"
     layer at (226,153) size 60x68 clip at (227,154) size 43x66 scrollHeight 924
       LayoutTextControl {TEXTAREA} at (1,43) size 60x68 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (21,21) size 3x884
           LayoutText {#text} at (0,0) size 11x884
             text run at (0,0) width 7: "L"
             text run at (0,13) width 7: "o"
-            text run at (0,26) width 5: "r"
-            text run at (0,39) width 7: "e"
+            text run at (0,26) width 4: "r"
+            text run at (0,39) width 6: "e"
             text run at (0,52) width 10: "m"
             text run at (0,65) width 3: " "
             text run at (0,78) width 3: "i"
@@ -981,21 +979,21 @@
             text run at (0,182) width 7: "o"
             text run at (0,195) width 3: "l"
             text run at (0,208) width 7: "o"
-            text run at (0,221) width 5: "r"
+            text run at (0,221) width 4: "r"
             text run at (0,234) width 3: " "
             text run at (0,247) width 8: "A"
             text run at (0,260) width 8: "B"
             text run at (0,273) width 9: "C"
-            text run at (0,286) width 9: "D"
-            text run at (0,299) width 8: "E"
+            text run at (0,286) width 8: "D"
+            text run at (0,299) width 7: "E"
             text run at (0,312) width 7: "F"
             text run at (0,325) width 9: "G"
             text run at (0,338) width 9: "H"
-            text run at (0,351) width 4: "I"
-            text run at (0,364) width 7: "J"
+            text run at (0,351) width 3: "I"
+            text run at (0,364) width 6: "J"
             text run at (0,377) width 8: "K"
             text run at (0,390) width 7: "L"
-            text run at (0,403) width 11: "M"
+            text run at (0,403) width 10: "M"
             text run at (0,416) width 9: "N"
             text run at (0,429) width 9: "O"
             text run at (0,442) width 8: "P"
@@ -1004,398 +1002,394 @@
             text run at (0,481) width 8: "S"
             text run at (0,494) width 7: "T"
             text run at (0,507) width 9: "U"
-            text run at (0,520) width 8: "V"
+            text run at (0,520) width 7: "V"
             text run at (0,533) width 11: "W"
-            text run at (0,546) width 8: "X"
+            text run at (0,546) width 7: "X"
             text run at (0,559) width 8: "Y"
-            text run at (0,572) width 8: "Z"
+            text run at (0,572) width 7: "Z"
             text run at (0,585) width 3: " "
-            text run at (0,598) width 7: "a"
+            text run at (0,598) width 6: "a"
             text run at (0,611) width 7: "b"
-            text run at (0,624) width 7: "c"
+            text run at (0,624) width 6: "c"
             text run at (0,637) width 7: "d"
-            text run at (0,650) width 7: "e"
+            text run at (0,650) width 6: "e"
             text run at (0,663) width 4: "f"
             text run at (0,676) width 7: "g"
             text run at (0,689) width 7: "h"
             text run at (0,702) width 3: "i"
             text run at (0,715) width 3: "j"
-            text run at (0,728) width 7: "k"
+            text run at (0,728) width 6: "k"
             text run at (0,741) width 3: "l"
             text run at (0,754) width 10: "m"
             text run at (0,767) width 7: "n"
             text run at (0,780) width 7: "o"
             text run at (0,793) width 7: "p"
             text run at (0,806) width 7: "q"
-            text run at (0,819) width 5: "r"
+            text run at (0,819) width 4: "r"
             text run at (0,832) width 6: "s"
             text run at (0,845) width 4: "t"
             text run at (0,858) width 7: "u"
             text run at (0,871) width 6: "v"
-    layer at (308,193) size 60x28 clip at (309,194) size 43x26 scrollHeight 156
+    layer at (308,193) size 60x28 clip at (309,194) size 43x26 scrollHeight 143
       LayoutTextControl {TEXTAREA} at (1,43) size 60x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-        LayoutBlockFlow {DIV} at (1,1) size 43x156
-          LayoutText {#text} at (0,0) size 43x156
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 4: " "
-            text run at (0,104) width 37: "abcdef"
-            text run at (0,117) width 38: "ghijklm"
-            text run at (0,130) width 41: "nopqrst"
-            text run at (0,143) width 13: "uv"
+        LayoutBlockFlow {DIV} at (1,1) size 43x143
+          LayoutText {#text} at (0,0) size 42x143
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 40: "FGHIJK"
+            text run at (0,65) width 40: "LMNOP"
+            text run at (0,78) width 38: "QRSTU"
+            text run at (0,91) width 39: "VWXYZ"
+            text run at (38,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (390,161) size 141x60 clip at (391,162) size 139x58
       LayoutTextControl {TEXTAREA} at (1,29) size 141x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x52
-          LayoutText {#text} at (0,0) size 131x52
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-            text run at (0,26) width 71: "RSTUVWXYZ"
-            text run at (70,26) width 4: " "
-            text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 133x52
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+            text run at (0,26) width 60: "STUVWXYZ"
+            text run at (59,26) width 4: " "
+            text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
     layer at (533,161) size 60x60 clip at (534,162) size 43x58 scrollHeight 173
       LayoutTextControl {TEXTAREA} at (1,43) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 39x169
           LayoutText {#text} at (0,0) size 39x169
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 33: "ABCD"
-            text run at (0,52) width 35: "EFGHI"
-            text run at (0,65) width 39: "JKLMN"
-            text run at (0,78) width 34: "OPQR"
-            text run at (0,91) width 30: "STUV"
-            text run at (0,104) width 33: "WXYZ"
-            text run at (32,104) width 4: " "
-            text run at (0,117) width 37: "abcdef"
-            text run at (0,130) width 38: "ghijklm"
-            text run at (0,143) width 37: "nopqrs"
-            text run at (0,156) width 17: "tuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 32: "FGHIJ"
+            text run at (0,65) width 32: "KLMN"
+            text run at (0,78) width 32: "OPQR"
+            text run at (0,91) width 39: "STUVW"
+            text run at (0,104) width 21: "XYZ"
+            text run at (20,104) width 4: " "
+            text run at (0,117) width 35: "abcdef"
+            text run at (0,130) width 36: "ghijklm"
+            text run at (0,143) width 39: "nopqrst"
+            text run at (0,156) width 12: "uv"
     layer at (615,189) size 141x32 clip at (616,190) size 139x30 scrollHeight 56
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x52
-          LayoutText {#text} at (0,0) size 131x52
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-            text run at (0,26) width 71: "RSTUVWXYZ"
-            text run at (70,26) width 4: " "
-            text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 133x52
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+            text run at (0,26) width 60: "STUVWXYZ"
+            text run at (59,26) width 4: " "
+            text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
     layer at (1,292) size 141x47 clip at (2,293) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
-    layer at (144,279) size 60x60 clip at (145,280) size 58x58 scrollHeight 147
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
+    layer at (144,279) size 60x60 clip at (145,280) size 58x58 scrollHeight 134
       LayoutTextControl {TEXTAREA} at (1,57) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-        LayoutBlockFlow {DIV} at (3,3) size 54x143
-          LayoutText {#text} at (0,0) size 53x143
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 46: "ABCDEF"
-            text run at (0,52) width 51: "GHIJKLM"
-            text run at (0,65) width 50: "NOPQRS"
-            text run at (0,78) width 48: "TUVWXY"
-            text run at (0,91) width 8: "Z"
-            text run at (7,91) width 4: " "
-            text run at (0,104) width 53: "abcdefghi"
-            text run at (0,117) width 53: "jklmnopqr"
-            text run at (0,130) width 23: "stuv"
+        LayoutBlockFlow {DIV} at (3,3) size 54x130
+          LayoutText {#text} at (0,0) size 54x130
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 53: "ABCDEFG"
+            text run at (0,52) width 49: "HIJKLMN"
+            text run at (0,65) width 54: "OPQRSTU"
+            text run at (0,78) width 39: "VWXYZ"
+            text run at (38,78) width 4: " "
+            text run at (0,91) width 53: "abcdefghij"
+            text run at (0,104) width 54: "klmnopqrs"
+            text run at (0,117) width 16: "tuv"
     layer at (226,279) size 60x60 clip at (227,280) size 43x43 scrollHeight 173
       LayoutTextControl {TEXTAREA} at (1,57) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 39x169
           LayoutText {#text} at (0,0) size 39x169
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 33: "ABCD"
-            text run at (0,52) width 35: "EFGHI"
-            text run at (0,65) width 39: "JKLMN"
-            text run at (0,78) width 34: "OPQR"
-            text run at (0,91) width 30: "STUV"
-            text run at (0,104) width 33: "WXYZ"
-            text run at (32,104) width 4: " "
-            text run at (0,117) width 37: "abcdef"
-            text run at (0,130) width 38: "ghijklm"
-            text run at (0,143) width 37: "nopqrs"
-            text run at (0,156) width 17: "tuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 32: "FGHIJ"
+            text run at (0,65) width 32: "KLMN"
+            text run at (0,78) width 32: "OPQR"
+            text run at (0,91) width 39: "STUVW"
+            text run at (0,104) width 21: "XYZ"
+            text run at (20,104) width 4: " "
+            text run at (0,117) width 35: "abcdef"
+            text run at (0,130) width 36: "ghijklm"
+            text run at (0,143) width 39: "nopqrst"
+            text run at (0,156) width 12: "uv"
     layer at (308,279) size 60x60 clip at (309,280) size 43x58 scrollHeight 173
       LayoutTextControl {TEXTAREA} at (1,43) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 39x169
           LayoutText {#text} at (0,0) size 39x169
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 33: "ABCD"
-            text run at (0,52) width 35: "EFGHI"
-            text run at (0,65) width 39: "JKLMN"
-            text run at (0,78) width 34: "OPQR"
-            text run at (0,91) width 30: "STUV"
-            text run at (0,104) width 33: "WXYZ"
-            text run at (32,104) width 4: " "
-            text run at (0,117) width 37: "abcdef"
-            text run at (0,130) width 38: "ghijklm"
-            text run at (0,143) width 37: "nopqrs"
-            text run at (0,156) width 17: "tuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 32: "FGHIJ"
+            text run at (0,65) width 32: "KLMN"
+            text run at (0,78) width 32: "OPQR"
+            text run at (0,91) width 39: "STUVW"
+            text run at (0,104) width 21: "XYZ"
+            text run at (20,104) width 4: " "
+            text run at (0,117) width 35: "abcdef"
+            text run at (0,130) width 36: "ghijklm"
+            text run at (0,143) width 39: "nopqrst"
+            text run at (0,156) width 12: "uv"
     layer at (390,279) size 60x60 clip at (391,280) size 43x58 scrollHeight 173
       LayoutTextControl {TEXTAREA} at (1,43) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 39x169
           LayoutText {#text} at (0,0) size 39x169
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 33: "ABCD"
-            text run at (0,52) width 35: "EFGHI"
-            text run at (0,65) width 39: "JKLMN"
-            text run at (0,78) width 34: "OPQR"
-            text run at (0,91) width 30: "STUV"
-            text run at (0,104) width 33: "WXYZ"
-            text run at (32,104) width 4: " "
-            text run at (0,117) width 37: "abcdef"
-            text run at (0,130) width 38: "ghijklm"
-            text run at (0,143) width 37: "nopqrs"
-            text run at (0,156) width 17: "tuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 32: "FGHIJ"
+            text run at (0,65) width 32: "KLMN"
+            text run at (0,78) width 32: "OPQR"
+            text run at (0,91) width 39: "STUVW"
+            text run at (0,104) width 21: "XYZ"
+            text run at (20,104) width 4: " "
+            text run at (0,117) width 35: "abcdef"
+            text run at (0,130) width 36: "ghijklm"
+            text run at (0,143) width 39: "nopqrst"
+            text run at (0,156) width 12: "uv"
     layer at (472,279) size 60x60 clip at (473,280) size 43x58 scrollHeight 173
       LayoutTextControl {TEXTAREA} at (1,57) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 39x169
           LayoutText {#text} at (0,0) size 39x169
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 33: "ABCD"
-            text run at (0,52) width 35: "EFGHI"
-            text run at (0,65) width 39: "JKLMN"
-            text run at (0,78) width 34: "OPQR"
-            text run at (0,91) width 30: "STUV"
-            text run at (0,104) width 33: "WXYZ"
-            text run at (32,104) width 4: " "
-            text run at (0,117) width 37: "abcdef"
-            text run at (0,130) width 38: "ghijklm"
-            text run at (0,143) width 37: "nopqrs"
-            text run at (0,156) width 17: "tuv"
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 32: "FGHIJ"
+            text run at (0,65) width 32: "KLMN"
+            text run at (0,78) width 32: "OPQR"
+            text run at (0,91) width 39: "STUVW"
+            text run at (0,104) width 21: "XYZ"
+            text run at (20,104) width 4: " "
+            text run at (0,117) width 35: "abcdef"
+            text run at (0,130) width 36: "ghijklm"
+            text run at (0,143) width 39: "nopqrst"
+            text run at (0,156) width 12: "uv"
     layer at (554,307) size 39x32 clip at (555,308) size 22x30 scrollHeight 381
       LayoutTextControl {TEXTAREA} at (1,15) size 39x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 18x377
           LayoutText {#text} at (0,0) size 18x377
-            text run at (0,0) width 18: "Lor"
-            text run at (0,13) width 17: "em"
-            text run at (16,13) width 2: " "
-            text run at (0,26) width 16: "ips"
-            text run at (0,39) width 17: "um"
+            text run at (0,0) width 17: "Lor"
+            text run at (0,13) width 16: "em"
+            text run at (15,13) width 3: " "
+            text run at (0,26) width 15: "ips"
+            text run at (0,39) width 16: "um"
             text run at (0,52) width 7: "  "
-            text run at (0,65) width 17: "dol"
+            text run at (0,65) width 16: "dol"
             text run at (0,78) width 11: "or"
-            text run at (10,78) width 5: " "
-            text run at (0,91) width 16: "AB"
-            text run at (0,104) width 17: "CD"
+            text run at (10,78) width 4: " "
+            text run at (0,91) width 15: "AB"
+            text run at (0,104) width 16: "CD"
             text run at (0,117) width 14: "EF"
-            text run at (0,130) width 18: "GH"
-            text run at (0,143) width 18: "IJK"
-            text run at (0,156) width 17: "LM"
-            text run at (0,169) width 18: "NO"
-            text run at (0,182) width 17: "PQ"
-            text run at (0,195) width 16: "RS"
-            text run at (0,208) width 16: "TU"
+            text run at (0,130) width 17: "GH"
+            text run at (0,143) width 17: "IJK"
+            text run at (0,156) width 16: "LM"
+            text run at (0,169) width 17: "NO"
+            text run at (0,182) width 16: "PQ"
+            text run at (0,195) width 15: "RS"
+            text run at (0,208) width 15: "TU"
             text run at (0,221) width 18: "VW"
             text run at (0,234) width 15: "XY"
-            text run at (0,247) width 8: "Z"
-            text run at (7,247) width 4: " "
-            text run at (0,260) width 14: "ab"
-            text run at (0,273) width 14: "cd"
-            text run at (0,286) width 17: "efg"
-            text run at (0,299) width 13: "hij"
-            text run at (0,312) width 9: "kl"
-            text run at (0,325) width 17: "mn"
-            text run at (0,338) width 14: "op"
-            text run at (0,351) width 17: "qrs"
-            text run at (0,364) width 17: "tuv"
+            text run at (0,247) width 7: "Z"
+            text run at (6,247) width 4: " "
+            text run at (0,260) width 13: "ab"
+            text run at (0,273) width 13: "cd"
+            text run at (0,286) width 16: "efg"
+            text run at (0,299) width 17: "hijk"
+            text run at (0,312) width 13: "lm"
+            text run at (0,325) width 13: "no"
+            text run at (0,338) width 17: "pqr"
+            text run at (0,351) width 16: "stu"
+            text run at (0,364) width 6: "v"
     layer at (636,294) size 141x45 clip at (637,295) size 124x43 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,15) size 141x45 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
-    layer at (1,420) size 63x32 clip at (2,421) size 46x30 scrollHeight 160
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
+    layer at (1,420) size 63x32 clip at (2,421) size 46x30 scrollHeight 147
       LayoutTextControl {TEXTAREA} at (1,15) size 63x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-        LayoutBlockFlow {DIV} at (3,3) size 42x156
-          LayoutText {#text} at (0,0) size 42x156
-            text run at (0,0) width 34: "Lorem"
-            text run at (33,0) width 4: " "
-            text run at (0,13) width 32: "ipsum"
-            text run at (31,13) width 8: "  "
-            text run at (0,26) width 28: "dolor"
-            text run at (27,26) width 4: " "
-            text run at (0,39) width 40: "ABCDE"
-            text run at (0,52) width 41: "FGHIJK"
-            text run at (0,65) width 42: "LMNOP"
-            text run at (0,78) width 40: "QRSTU"
-            text run at (0,91) width 40: "VWXYZ"
-            text run at (39,91) width 3: " "
-            text run at (0,104) width 37: "abcdef"
-            text run at (0,117) width 38: "ghijklm"
-            text run at (0,130) width 41: "nopqrst"
-            text run at (0,143) width 13: "uv"
+        LayoutBlockFlow {DIV} at (3,3) size 42x143
+          LayoutText {#text} at (0,0) size 42x143
+            text run at (0,0) width 32: "Lorem"
+            text run at (31,0) width 4: " "
+            text run at (0,13) width 31: "ipsum"
+            text run at (30,13) width 7: "  "
+            text run at (0,26) width 26: "dolor"
+            text run at (25,26) width 4: " "
+            text run at (0,39) width 38: "ABCDE"
+            text run at (0,52) width 40: "FGHIJK"
+            text run at (0,65) width 40: "LMNOP"
+            text run at (0,78) width 38: "QRSTU"
+            text run at (0,91) width 39: "VWXYZ"
+            text run at (38,91) width 4: " "
+            text run at (0,104) width 41: "abcdefg"
+            text run at (0,117) width 42: "hijklmno"
+            text run at (0,130) width 38: "pqrstuv"
     layer at (83,355) size 141x97 clip at (84,356) size 139x95
       LayoutTextControl {TEXTAREA} at (1,15) size 141x97 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x52
-          LayoutText {#text} at (0,0) size 131x52
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-            text run at (0,26) width 71: "RSTUVWXYZ"
-            text run at (70,26) width 4: " "
-            text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
-    layer at (226,394) size 51x58 clip at (227,395) size 34x56 scrollHeight 251
+          LayoutText {#text} at (0,0) size 133x52
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+            text run at (0,26) width 60: "STUVWXYZ"
+            text run at (59,26) width 4: " "
+            text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
+    layer at (226,394) size 51x58 clip at (227,395) size 34x56 scrollHeight 238
       LayoutTextControl {TEXTAREA} at (1,29) size 51x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-        LayoutBlockFlow {DIV} at (3,3) size 30x247
-          LayoutText {#text} at (0,0) size 30x247
-            text run at (0,0) width 24: "Lore"
+        LayoutBlockFlow {DIV} at (3,3) size 30x234
+          LayoutText {#text} at (0,0) size 30x234
+            text run at (0,0) width 23: "Lore"
             text run at (0,13) width 10: "m"
-            text run at (9,13) width 5: " "
-            text run at (0,26) width 23: "ipsu"
+            text run at (9,13) width 4: " "
+            text run at (0,26) width 21: "ipsu"
             text run at (0,39) width 10: "m"
-            text run at (9,39) width 8: "  "
-            text run at (0,52) width 28: "dolor"
-            text run at (27,52) width 3: " "
-            text run at (0,65) width 24: "ABC"
-            text run at (0,78) width 23: "DEF"
-            text run at (0,91) width 27: "GHIJ"
-            text run at (0,104) width 25: "KLM"
-            text run at (0,117) width 25: "NOP"
-            text run at (0,130) width 25: "QRS"
-            text run at (0,143) width 23: "TUV"
-            text run at (0,156) width 26: "WXY"
-            text run at (0,169) width 8: "Z"
-            text run at (7,169) width 4: " "
-            text run at (0,182) width 27: "abcd"
-            text run at (0,195) width 29: "efghij"
-            text run at (0,208) width 26: "klmn"
-            text run at (0,221) width 25: "opqr"
-            text run at (0,234) width 23: "stuv"
-    layer at (308,405) size 141x47 clip at (309,406) size 139x30 scrollWidth 439
+            text run at (9,39) width 7: "  "
+            text run at (0,52) width 26: "dolor"
+            text run at (25,52) width 4: " "
+            text run at (0,65) width 23: "ABC"
+            text run at (0,78) width 30: "DEFG"
+            text run at (0,91) width 25: "HIJK"
+            text run at (0,104) width 25: "LMN"
+            text run at (0,117) width 25: "OPQ"
+            text run at (0,130) width 30: "RSTU"
+            text run at (0,143) width 24: "VWX"
+            text run at (0,156) width 15: "YZ"
+            text run at (14,156) width 4: " "
+            text run at (0,169) width 26: "abcd"
+            text run at (0,182) width 27: "efghij"
+            text run at (0,195) width 25: "klmn"
+            text run at (0,208) width 29: "opqrs"
+            text run at (0,221) width 16: "tuv"
+    layer at (308,405) size 141x47 clip at (309,406) size 139x30 scrollWidth 419
       LayoutTextControl {TEXTAREA} at (1,15) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x13
-          LayoutText {#text} at (0,0) size 438x13
-            text run at (0,0) width 438: "Lorem ipsum  dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 417x13
+            text run at (0,0) width 417: "Lorem ipsum  dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
     layer at (451,420) size 141x32 clip at (452,421) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,15) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (594,420) size 141x32 clip at (595,421) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,15) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (1,482) size 141x32 clip at (2,483) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 73: "Lorem ipsum "
-            text run at (72,0) width 28: "dolor"
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 69: "Lorem ipsum "
+            text run at (68,0) width 27: "dolor"
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
     layer at (144,482) size 141x32 clip at (145,483) size 124x30 scrollHeight 56
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x52
-          LayoutText {#text} at (0,0) size 119x52
-            text run at (0,0) width 114: "Lorem ipsum  dolor A"
-            text run at (0,13) width 114: "BCDEFGHIJKLMNOP"
-            text run at (0,26) width 119: "QRSTUVWXYZ abcdef"
-            text run at (0,39) width 91: "ghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 118x52
+            text run at (0,0) width 116: "Lorem ipsum  dolor AB"
+            text run at (0,13) width 118: "CDEFGHIJKLMNOPQR"
+            text run at (0,26) width 116: "STUVWXYZ abcdefghij"
+            text run at (0,39) width 69: "klmnopqrstuv"
     layer at (287,482) size 141x32 clip at (288,483) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (86,26) width 4: " "
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
-    layer at (430,482) size 141x32 clip at (431,483) size 124x15 scrollWidth 436 scrollHeight 17
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (75,26) width 5: " "
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
+    layer at (430,482) size 141x32 clip at (431,483) size 124x15 scrollWidth 415 scrollHeight 17
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x13
-          LayoutText {#text} at (0,0) size 434x13
-            text run at (0,0) width 73: "Lorem ipsum "
-            text run at (72,0) width 362: "dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 414x13
+            text run at (0,0) width 69: "Lorem ipsum "
+            text run at (68,0) width 346: "dolor ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuv"
     layer at (573,482) size 141x32 clip at (574,483) size 124x30 scrollHeight 69
       LayoutTextControl {TEXTAREA} at (1,29) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 120x65
-          LayoutText {#text} at (0,0) size 115x65
-            text run at (0,0) width 73: "Lorem ipsum "
-            text run at (72,0) width 28: "dolor"
-            text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-            text run at (0,26) width 87: "PQRSTUVWXYZ"
-            text run at (0,39) width 115: "abcdefghijklmnopqrst"
-            text run at (0,52) width 13: "uv"
-    layer at (1,572) size 141x47 clip at (2,573) size 124x30 scrollWidth 202 scrollHeight 43
+          LayoutText {#text} at (0,0) size 117x65
+            text run at (0,0) width 69: "Lorem ipsum "
+            text run at (68,0) width 27: "dolor"
+            text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+            text run at (0,26) width 76: "QRSTUVWXYZ"
+            text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+            text run at (0,52) width 6: "v"
+    layer at (1,572) size 141x47 clip at (2,573) size 124x30 scrollWidth 195 scrollHeight 43
       LayoutTextControl {TEXTAREA} at (1,29) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x39
-          LayoutText {#text} at (0,0) size 201x39
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 201: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-            text run at (0,26) width 131: " abcdefghijklmnopqrstuv"
-    layer at (144,572) size 141x47 clip at (145,573) size 124x30 scrollWidth 202 scrollHeight 43
+          LayoutText {#text} at (0,0) size 193x39
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 193: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+            text run at (0,26) width 124: " abcdefghijklmnopqrstuv"
+    layer at (144,572) size 141x47 clip at (145,573) size 124x30 scrollWidth 195 scrollHeight 43
       LayoutTextControl {TEXTAREA} at (1,57) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
         LayoutBlockFlow {DIV} at (3,3) size 135x39
-          LayoutText {#text} at (0,0) size 201x39
-            text run at (0,0) width 103: "Lorem ipsum  dolor"
-            text run at (102,0) width 5: " "
-            text run at (0,13) width 201: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-            text run at (0,26) width 131: " abcdefghijklmnopqrstuv"
+          LayoutText {#text} at (0,0) size 193x39
+            text run at (0,0) width 98: "Lorem ipsum  dolor"
+            text run at (97,0) width 4: " "
+            text run at (0,13) width 193: "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+            text run at (0,26) width 124: " abcdefghijklmnopqrstuv"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.png
index e96e4f0c..bb697dc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.txt
index 06860c0..8d03d34 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/basic-textareas-quirks-expected.txt
@@ -227,217 +227,214 @@
 layer at (24,24) size 141x32 clip at (25,25) size 139x30
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 100x13
-        text run at (0,0) width 100: "Lorem ipsum dolor"
+      LayoutText {#text} at (0,0) size 95x13
+        text run at (0,0) width 95: "Lorem ipsum dolor"
 layer at (24,75) size 141x32 clip at (25,76) size 124x30 scrollHeight 69
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 120x65
-      LayoutText {#text} at (0,0) size 115x65
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-        text run at (0,26) width 87: "PQRSTUVWXYZ"
-        text run at (86,26) width 4: " "
-        text run at (0,39) width 115: "abcdefghijklmnopqrst"
-        text run at (0,52) width 13: "uv"
-        text run at (12,52) width 4: " "
+      LayoutText {#text} at (0,0) size 117x65
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+        text run at (0,26) width 76: "QRSTUVWXYZ"
+        text run at (75,26) width 5: " "
+        text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+        text run at (0,52) width 6: "v"
+        text run at (5,52) width 4: " "
 layer at (24,126) size 141x32 clip at (25,127) size 124x30 scrollHeight 69
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x32 [color=#545454] [bgcolor=#FFFFFF] [border: (1px solid #545454)]
     LayoutBlockFlow {DIV} at (3,3) size 120x65
-      LayoutText {#text} at (0,0) size 115x65
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-        text run at (0,26) width 87: "PQRSTUVWXYZ"
-        text run at (86,26) width 4: " "
-        text run at (0,39) width 115: "abcdefghijklmnopqrst"
-        text run at (0,52) width 13: "uv"
-        text run at (12,52) width 4: " "
+      LayoutText {#text} at (0,0) size 117x65
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+        text run at (0,26) width 76: "QRSTUVWXYZ"
+        text run at (75,26) width 5: " "
+        text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+        text run at (0,52) width 6: "v"
+        text run at (5,52) width 4: " "
 layer at (24,177) size 157x48 clip at (25,178) size 140x46 scrollHeight 85
   LayoutTextControl {TEXTAREA} at (14.61,1) size 157x48 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (11,11) size 120x65
-      LayoutText {#text} at (0,0) size 115x65
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-        text run at (0,26) width 87: "PQRSTUVWXYZ"
-        text run at (86,26) width 4: " "
-        text run at (0,39) width 115: "abcdefghijklmnopqrst"
-        text run at (0,52) width 13: "uv"
-        text run at (12,52) width 4: " "
+      LayoutText {#text} at (0,0) size 117x65
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+        text run at (0,26) width 76: "QRSTUVWXYZ"
+        text run at (75,26) width 5: " "
+        text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+        text run at (0,52) width 6: "v"
+        text run at (5,52) width 4: " "
 layer at (24,244) size 137x28 clip at (25,245) size 120x26 scrollHeight 65
   LayoutTextControl {TEXTAREA} at (14.61,1) size 137x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (1,1) size 120x65
-      LayoutText {#text} at (0,0) size 115x65
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-        text run at (0,26) width 87: "PQRSTUVWXYZ"
-        text run at (86,26) width 4: " "
-        text run at (0,39) width 115: "abcdefghijklmnopqrst"
-        text run at (0,52) width 13: "uv"
-        text run at (12,52) width 4: " "
+      LayoutText {#text} at (0,0) size 117x65
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+        text run at (0,26) width 76: "QRSTUVWXYZ"
+        text run at (75,26) width 5: " "
+        text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+        text run at (0,52) width 6: "v"
+        text run at (5,52) width 4: " "
 layer at (34,301) size 141x32 clip at (35,302) size 124x30 scrollHeight 69
   LayoutTextControl {TEXTAREA} at (24.61,11) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 120x65
-      LayoutText {#text} at (0,0) size 115x65
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-        text run at (0,26) width 87: "PQRSTUVWXYZ"
-        text run at (86,26) width 4: " "
-        text run at (0,39) width 115: "abcdefghijklmnopqrst"
-        text run at (0,52) width 13: "uv"
-        text run at (12,52) width 4: " "
+      LayoutText {#text} at (0,0) size 117x65
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+        text run at (0,26) width 76: "QRSTUVWXYZ"
+        text run at (75,26) width 5: " "
+        text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+        text run at (0,52) width 6: "v"
+        text run at (5,52) width 4: " "
 layer at (24,362) size 141x32 clip at (25,363) size 124x30 scrollHeight 69
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 120x65
-      LayoutText {#text} at (0,0) size 115x65
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-        text run at (0,26) width 87: "PQRSTUVWXYZ"
-        text run at (86,26) width 4: " "
-        text run at (0,39) width 115: "abcdefghijklmnopqrst"
-        text run at (0,52) width 13: "uv"
-        text run at (12,52) width 4: " "
-layer at (24,413) size 39x32 clip at (25,414) size 22x30 scrollHeight 381
+      LayoutText {#text} at (0,0) size 117x65
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+        text run at (0,26) width 76: "QRSTUVWXYZ"
+        text run at (75,26) width 5: " "
+        text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+        text run at (0,52) width 6: "v"
+        text run at (5,52) width 4: " "
+layer at (24,413) size 39x32 clip at (25,414) size 22x30 scrollHeight 368
   LayoutTextControl {TEXTAREA} at (14.61,1) size 39x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (3,3) size 18x377
-      LayoutText {#text} at (0,0) size 18x377
-        text run at (0,0) width 18: "Lor"
-        text run at (0,13) width 17: "em"
-        text run at (16,13) width 2: " "
-        text run at (0,26) width 16: "ips"
-        text run at (0,39) width 17: "um"
-        text run at (16,39) width 2: " "
-        text run at (0,52) width 17: "dol"
+    LayoutBlockFlow {DIV} at (3,3) size 18x364
+      LayoutText {#text} at (0,0) size 18x364
+        text run at (0,0) width 17: "Lor"
+        text run at (0,13) width 16: "em"
+        text run at (15,13) width 3: " "
+        text run at (0,26) width 15: "ips"
+        text run at (0,39) width 16: "um"
+        text run at (15,39) width 3: " "
+        text run at (0,52) width 16: "dol"
         text run at (0,65) width 11: "or"
-        text run at (10,65) width 5: " "
-        text run at (0,78) width 16: "AB"
-        text run at (0,91) width 17: "CD"
+        text run at (10,65) width 4: " "
+        text run at (0,78) width 15: "AB"
+        text run at (0,91) width 16: "CD"
         text run at (0,104) width 14: "EF"
-        text run at (0,117) width 18: "GH"
-        text run at (0,130) width 18: "IJK"
-        text run at (0,143) width 17: "LM"
-        text run at (0,156) width 18: "NO"
-        text run at (0,169) width 17: "PQ"
-        text run at (0,182) width 16: "RS"
-        text run at (0,195) width 16: "TU"
+        text run at (0,117) width 17: "GH"
+        text run at (0,130) width 17: "IJK"
+        text run at (0,143) width 16: "LM"
+        text run at (0,156) width 17: "NO"
+        text run at (0,169) width 16: "PQ"
+        text run at (0,182) width 15: "RS"
+        text run at (0,195) width 15: "TU"
         text run at (0,208) width 18: "VW"
         text run at (0,221) width 15: "XY"
-        text run at (0,234) width 8: "Z"
-        text run at (7,234) width 4: " "
-        text run at (0,247) width 14: "ab"
-        text run at (0,260) width 14: "cd"
-        text run at (0,273) width 17: "efg"
-        text run at (0,286) width 13: "hij"
-        text run at (0,299) width 9: "kl"
-        text run at (0,312) width 17: "mn"
-        text run at (0,325) width 14: "op"
-        text run at (0,338) width 17: "qrs"
-        text run at (0,351) width 17: "tuv"
-        text run at (0,364) width 4: " "
+        text run at (0,234) width 7: "Z"
+        text run at (6,234) width 4: " "
+        text run at (0,247) width 13: "ab"
+        text run at (0,260) width 13: "cd"
+        text run at (0,273) width 16: "efg"
+        text run at (0,286) width 17: "hijk"
+        text run at (0,299) width 13: "lm"
+        text run at (0,312) width 13: "no"
+        text run at (0,325) width 17: "pqr"
+        text run at (0,338) width 16: "stu"
+        text run at (0,351) width 6: "v"
+        text run at (5,351) width 4: " "
 layer at (24,464) size 141x45 clip at (25,465) size 124x43 scrollHeight 69
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x45 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 120x65
-      LayoutText {#text} at (0,0) size 115x65
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-        text run at (0,26) width 87: "PQRSTUVWXYZ"
-        text run at (86,26) width 4: " "
-        text run at (0,39) width 115: "abcdefghijklmnopqrst"
-        text run at (0,52) width 13: "uv"
-        text run at (12,52) width 4: " "
-layer at (24,528) size 81x32 clip at (25,529) size 64x30 scrollHeight 134
+      LayoutText {#text} at (0,0) size 117x65
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+        text run at (0,26) width 76: "QRSTUVWXYZ"
+        text run at (75,26) width 5: " "
+        text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+        text run at (0,52) width 6: "v"
+        text run at (5,52) width 4: " "
+layer at (24,528) size 81x32 clip at (25,529) size 64x30 scrollHeight 121
   LayoutTextControl {TEXTAREA} at (14.61,1) size 81x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (3,3) size 60x130
-      LayoutText {#text} at (0,0) size 60x130
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 55: "ABCDEFG"
-        text run at (0,52) width 60: "HIJKLMNO"
-        text run at (0,65) width 55: "PQRSTUV"
-        text run at (0,78) width 33: "WXYZ"
-        text run at (32,78) width 4: " "
-        text run at (0,91) width 56: "abcdefghij"
-        text run at (0,104) width 60: "klmnopqrst"
-        text run at (0,117) width 13: "uv"
-        text run at (12,117) width 4: " "
+    LayoutBlockFlow {DIV} at (3,3) size 60x117
+      LayoutText {#text} at (0,0) size 60x117
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 60: "ipsum dolor"
+        text run at (59,13) width 1: " "
+        text run at (0,26) width 53: "ABCDEFG"
+        text run at (0,39) width 57: "HIJKLMNO"
+        text run at (0,52) width 52: "PQRSTUV"
+        text run at (0,65) width 32: "WXYZ"
+        text run at (31,65) width 4: " "
+        text run at (0,78) width 58: "abcdefghijk"
+        text run at (0,91) width 57: "lmnopqrstu"
+        text run at (0,104) width 6: "v"
+        text run at (5,104) width 4: " "
 layer at (24,579) size 141x136 backgroundClip at (24,579) size 141x21 clip at (25,580) size 139x20
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x136 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x52
-      LayoutText {#text} at (0,0) size 131x52
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-        text run at (0,26) width 71: "RSTUVWXYZ"
-        text run at (70,26) width 4: " "
-        text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
-        text run at (127,39) width 4: " "
-layer at (24,734) size 51x58 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 251
+      LayoutText {#text} at (0,0) size 133x52
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+        text run at (0,26) width 60: "STUVWXYZ"
+        text run at (59,26) width 4: " "
+        text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
+        text run at (120,39) width 4: " "
+layer at (24,734) size 51x58 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 238
   LayoutTextControl {TEXTAREA} at (14.61,1) size 51x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (3,3) size 30x247
-      LayoutText {#text} at (0,0) size 30x247
-        text run at (0,0) width 24: "Lore"
+    LayoutBlockFlow {DIV} at (3,3) size 30x234
+      LayoutText {#text} at (0,0) size 30x234
+        text run at (0,0) width 23: "Lore"
         text run at (0,13) width 10: "m"
-        text run at (9,13) width 5: " "
-        text run at (0,26) width 23: "ipsu"
+        text run at (9,13) width 4: " "
+        text run at (0,26) width 21: "ipsu"
         text run at (0,39) width 10: "m"
-        text run at (9,39) width 5: " "
-        text run at (0,52) width 28: "dolor"
-        text run at (27,52) width 3: " "
-        text run at (0,65) width 24: "ABC"
-        text run at (0,78) width 23: "DEF"
-        text run at (0,91) width 27: "GHIJ"
-        text run at (0,104) width 25: "KLM"
-        text run at (0,117) width 25: "NOP"
-        text run at (0,130) width 25: "QRS"
-        text run at (0,143) width 23: "TUV"
-        text run at (0,156) width 26: "WXY"
-        text run at (0,169) width 8: "Z"
-        text run at (7,169) width 4: " "
-        text run at (0,182) width 27: "abcd"
-        text run at (0,195) width 29: "efghij"
-        text run at (0,208) width 26: "klmn"
-        text run at (0,221) width 25: "opqr"
-        text run at (0,234) width 23: "stuv"
-        text run at (22,234) width 4: " "
+        text run at (9,39) width 4: " "
+        text run at (0,52) width 26: "dolor"
+        text run at (25,52) width 4: " "
+        text run at (0,65) width 23: "ABC"
+        text run at (0,78) width 30: "DEFG"
+        text run at (0,91) width 25: "HIJK"
+        text run at (0,104) width 25: "LMN"
+        text run at (0,117) width 25: "OPQ"
+        text run at (0,130) width 30: "RSTU"
+        text run at (0,143) width 24: "VWX"
+        text run at (0,156) width 15: "YZ"
+        text run at (14,156) width 4: " "
+        text run at (0,169) width 26: "abcd"
+        text run at (0,182) width 27: "efghij"
+        text run at (0,195) width 25: "klmn"
+        text run at (0,208) width 29: "opqrs"
+        text run at (0,221) width 16: "tuv"
+        text run at (15,221) width 4: " "
 layer at (376,24) size 60x32 clip at (377,25) size 43x30 scrollHeight 173
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 39x169
       LayoutText {#text} at (0,0) size 39x169
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 33: "ABCD"
-        text run at (0,52) width 35: "EFGHI"
-        text run at (0,65) width 39: "JKLMN"
-        text run at (0,78) width 34: "OPQR"
-        text run at (0,91) width 30: "STUV"
-        text run at (0,104) width 33: "WXYZ"
-        text run at (32,104) width 4: " "
-        text run at (0,117) width 37: "abcdef"
-        text run at (0,130) width 38: "ghijklm"
-        text run at (0,143) width 37: "nopqrs"
-        text run at (0,156) width 17: "tuv"
-        text run at (16,156) width 4: " "
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 31: "ipsum"
+        text run at (30,13) width 4: " "
+        text run at (0,26) width 26: "dolor"
+        text run at (25,26) width 4: " "
+        text run at (0,39) width 38: "ABCDE"
+        text run at (0,52) width 32: "FGHIJ"
+        text run at (0,65) width 32: "KLMN"
+        text run at (0,78) width 32: "OPQR"
+        text run at (0,91) width 39: "STUVW"
+        text run at (0,104) width 21: "XYZ"
+        text run at (20,104) width 4: " "
+        text run at (0,117) width 35: "abcdef"
+        text run at (0,130) width 36: "ghijklm"
+        text run at (0,143) width 39: "nopqrst"
+        text run at (0,156) width 12: "uv"
+        text run at (11,156) width 4: " "
 layer at (376,75) size 60x68 clip at (377,76) size 43x66 scrollHeight 924
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x68 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (21,21) size 3x884
       LayoutText {#text} at (0,0) size 11x884
         text run at (0,0) width 7: "L"
         text run at (0,13) width 7: "o"
-        text run at (0,26) width 5: "r"
-        text run at (0,39) width 7: "e"
+        text run at (0,26) width 4: "r"
+        text run at (0,39) width 6: "e"
         text run at (0,52) width 10: "m"
         text run at (0,65) width 3: " "
         text run at (0,78) width 3: "i"
@@ -450,21 +447,21 @@
         text run at (0,169) width 7: "o"
         text run at (0,182) width 3: "l"
         text run at (0,195) width 7: "o"
-        text run at (0,208) width 5: "r"
+        text run at (0,208) width 4: "r"
         text run at (0,221) width 3: " "
         text run at (0,234) width 8: "A"
         text run at (0,247) width 8: "B"
         text run at (0,260) width 9: "C"
-        text run at (0,273) width 9: "D"
-        text run at (0,286) width 8: "E"
+        text run at (0,273) width 8: "D"
+        text run at (0,286) width 7: "E"
         text run at (0,299) width 7: "F"
         text run at (0,312) width 9: "G"
         text run at (0,325) width 9: "H"
-        text run at (0,338) width 4: "I"
-        text run at (0,351) width 7: "J"
+        text run at (0,338) width 3: "I"
+        text run at (0,351) width 6: "J"
         text run at (0,364) width 8: "K"
         text run at (0,377) width 7: "L"
-        text run at (0,390) width 11: "M"
+        text run at (0,390) width 10: "M"
         text run at (0,403) width 9: "N"
         text run at (0,416) width 9: "O"
         text run at (0,429) width 8: "P"
@@ -473,267 +470,265 @@
         text run at (0,468) width 8: "S"
         text run at (0,481) width 7: "T"
         text run at (0,494) width 9: "U"
-        text run at (0,507) width 8: "V"
+        text run at (0,507) width 7: "V"
         text run at (0,520) width 11: "W"
-        text run at (0,533) width 8: "X"
+        text run at (0,533) width 7: "X"
         text run at (0,546) width 8: "Y"
-        text run at (0,559) width 8: "Z"
+        text run at (0,559) width 7: "Z"
         text run at (0,572) width 3: " "
-        text run at (0,585) width 7: "a"
+        text run at (0,585) width 6: "a"
         text run at (0,598) width 7: "b"
-        text run at (0,611) width 7: "c"
+        text run at (0,611) width 6: "c"
         text run at (0,624) width 7: "d"
-        text run at (0,637) width 7: "e"
+        text run at (0,637) width 6: "e"
         text run at (0,650) width 4: "f"
         text run at (0,663) width 7: "g"
         text run at (0,676) width 7: "h"
         text run at (0,689) width 3: "i"
         text run at (0,702) width 3: "j"
-        text run at (0,715) width 7: "k"
+        text run at (0,715) width 6: "k"
         text run at (0,728) width 3: "l"
         text run at (0,741) width 10: "m"
         text run at (0,754) width 7: "n"
         text run at (0,767) width 7: "o"
         text run at (0,780) width 7: "p"
         text run at (0,793) width 7: "q"
-        text run at (0,806) width 5: "r"
+        text run at (0,806) width 4: "r"
         text run at (0,819) width 6: "s"
         text run at (0,832) width 4: "t"
         text run at (0,845) width 7: "u"
         text run at (0,858) width 6: "v"
         text run at (0,871) width 3: " "
-layer at (376,162) size 60x28 clip at (377,163) size 43x26 scrollHeight 156
+layer at (376,162) size 60x28 clip at (377,163) size 43x26 scrollHeight 143
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x28 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (1,1) size 43x156
-      LayoutText {#text} at (0,0) size 43x156
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 40: "ABCDE"
-        text run at (0,52) width 41: "FGHIJK"
-        text run at (0,65) width 42: "LMNOP"
-        text run at (0,78) width 40: "QRSTU"
-        text run at (0,91) width 40: "VWXYZ"
-        text run at (39,91) width 4: " "
-        text run at (0,104) width 37: "abcdef"
-        text run at (0,117) width 38: "ghijklm"
-        text run at (0,130) width 41: "nopqrst"
-        text run at (0,143) width 13: "uv"
-        text run at (12,143) width 4: " "
+    LayoutBlockFlow {DIV} at (1,1) size 43x143
+      LayoutText {#text} at (0,0) size 42x143
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 31: "ipsum"
+        text run at (30,13) width 4: " "
+        text run at (0,26) width 26: "dolor"
+        text run at (25,26) width 4: " "
+        text run at (0,39) width 38: "ABCDE"
+        text run at (0,52) width 40: "FGHIJK"
+        text run at (0,65) width 40: "LMNOP"
+        text run at (0,78) width 38: "QRSTU"
+        text run at (0,91) width 39: "VWXYZ"
+        text run at (38,91) width 4: " "
+        text run at (0,104) width 41: "abcdefg"
+        text run at (0,117) width 42: "hijklmno"
+        text run at (0,130) width 38: "pqrstuv"
+        text run at (37,130) width 4: " "
 layer at (376,209) size 141x60 clip at (377,210) size 139x58
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x52
-      LayoutText {#text} at (0,0) size 131x52
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-        text run at (0,26) width 71: "RSTUVWXYZ"
-        text run at (70,26) width 4: " "
-        text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
-        text run at (127,39) width 4: " "
+      LayoutText {#text} at (0,0) size 133x52
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+        text run at (0,26) width 60: "STUVWXYZ"
+        text run at (59,26) width 4: " "
+        text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
+        text run at (120,39) width 4: " "
 layer at (376,288) size 60x60 clip at (377,289) size 43x58 scrollHeight 173
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 39x169
       LayoutText {#text} at (0,0) size 39x169
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 33: "ABCD"
-        text run at (0,52) width 35: "EFGHI"
-        text run at (0,65) width 39: "JKLMN"
-        text run at (0,78) width 34: "OPQR"
-        text run at (0,91) width 30: "STUV"
-        text run at (0,104) width 33: "WXYZ"
-        text run at (32,104) width 4: " "
-        text run at (0,117) width 37: "abcdef"
-        text run at (0,130) width 38: "ghijklm"
-        text run at (0,143) width 37: "nopqrs"
-        text run at (0,156) width 17: "tuv"
-        text run at (16,156) width 4: " "
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 31: "ipsum"
+        text run at (30,13) width 4: " "
+        text run at (0,26) width 26: "dolor"
+        text run at (25,26) width 4: " "
+        text run at (0,39) width 38: "ABCDE"
+        text run at (0,52) width 32: "FGHIJ"
+        text run at (0,65) width 32: "KLMN"
+        text run at (0,78) width 32: "OPQR"
+        text run at (0,91) width 39: "STUVW"
+        text run at (0,104) width 21: "XYZ"
+        text run at (20,104) width 4: " "
+        text run at (0,117) width 35: "abcdef"
+        text run at (0,130) width 36: "ghijklm"
+        text run at (0,143) width 39: "nopqrst"
+        text run at (0,156) width 12: "uv"
+        text run at (11,156) width 4: " "
 layer at (376,367) size 141x32 clip at (377,368) size 139x30 scrollHeight 56
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x52
-      LayoutText {#text} at (0,0) size 131x52
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 131: "ABCDEFGHIJKLMNOPQ"
-        text run at (0,26) width 71: "RSTUVWXYZ"
-        text run at (70,26) width 4: " "
-        text run at (0,39) width 128: "abcdefghijklmnopqrstuv"
-        text run at (127,39) width 4: " "
+      LayoutText {#text} at (0,0) size 133x52
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 133: "ABCDEFGHIJKLMNOPQR"
+        text run at (0,26) width 60: "STUVWXYZ"
+        text run at (59,26) width 4: " "
+        text run at (0,39) width 121: "abcdefghijklmnopqrstuv"
+        text run at (120,39) width 4: " "
 layer at (376,418) size 141x47 clip at (377,419) size 124x30 scrollHeight 69
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 120x65
-      LayoutText {#text} at (0,0) size 115x65
-        text run at (0,0) width 100: "Lorem ipsum dolor"
-        text run at (99,0) width 4: " "
-        text run at (0,13) width 114: "ABCDEFGHIJKLMNO"
-        text run at (0,26) width 87: "PQRSTUVWXYZ"
-        text run at (86,26) width 4: " "
-        text run at (0,39) width 115: "abcdefghijklmnopqrst"
-        text run at (0,52) width 13: "uv"
-        text run at (12,52) width 4: " "
-layer at (376,484) size 60x60 clip at (377,485) size 58x58 scrollHeight 147
+      LayoutText {#text} at (0,0) size 117x65
+        text run at (0,0) width 95: "Lorem ipsum dolor"
+        text run at (94,0) width 4: " "
+        text run at (0,13) width 117: "ABCDEFGHIJKLMNOP"
+        text run at (0,26) width 76: "QRSTUVWXYZ"
+        text run at (75,26) width 5: " "
+        text run at (0,39) width 115: "abcdefghijklmnopqrstu"
+        text run at (0,52) width 6: "v"
+        text run at (5,52) width 4: " "
+layer at (376,484) size 60x60 clip at (377,485) size 58x58 scrollHeight 134
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (3,3) size 54x143
-      LayoutText {#text} at (0,0) size 53x143
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 46: "ABCDEF"
-        text run at (0,52) width 51: "GHIJKLM"
-        text run at (0,65) width 50: "NOPQRS"
-        text run at (0,78) width 48: "TUVWXY"
-        text run at (0,91) width 8: "Z"
-        text run at (7,91) width 4: " "
-        text run at (0,104) width 53: "abcdefghi"
-        text run at (0,117) width 53: "jklmnopqr"
-        text run at (0,130) width 23: "stuv"
-        text run at (22,130) width 4: " "
+    LayoutBlockFlow {DIV} at (3,3) size 54x130
+      LayoutText {#text} at (0,0) size 54x130
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 31: "ipsum"
+        text run at (30,13) width 4: " "
+        text run at (0,26) width 26: "dolor"
+        text run at (25,26) width 4: " "
+        text run at (0,39) width 53: "ABCDEFG"
+        text run at (0,52) width 49: "HIJKLMN"
+        text run at (0,65) width 54: "OPQRSTU"
+        text run at (0,78) width 39: "VWXYZ"
+        text run at (38,78) width 4: " "
+        text run at (0,91) width 53: "abcdefghij"
+        text run at (0,104) width 54: "klmnopqrs"
+        text run at (0,117) width 16: "tuv"
+        text run at (15,117) width 4: " "
 layer at (376,563) size 60x60 backgroundClip at (376,563) size 60x37 clip at (377,564) size 43x36 scrollHeight 173
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 39x169
       LayoutText {#text} at (0,0) size 39x169
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 33: "ABCD"
-        text run at (0,52) width 35: "EFGHI"
-        text run at (0,65) width 39: "JKLMN"
-        text run at (0,78) width 34: "OPQR"
-        text run at (0,91) width 30: "STUV"
-        text run at (0,104) width 33: "WXYZ"
-        text run at (32,104) width 4: " "
-        text run at (0,117) width 37: "abcdef"
-        text run at (0,130) width 38: "ghijklm"
-        text run at (0,143) width 37: "nopqrs"
-        text run at (0,156) width 17: "tuv"
-        text run at (16,156) width 4: " "
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 31: "ipsum"
+        text run at (30,13) width 4: " "
+        text run at (0,26) width 26: "dolor"
+        text run at (25,26) width 4: " "
+        text run at (0,39) width 38: "ABCDE"
+        text run at (0,52) width 32: "FGHIJ"
+        text run at (0,65) width 32: "KLMN"
+        text run at (0,78) width 32: "OPQR"
+        text run at (0,91) width 39: "STUVW"
+        text run at (0,104) width 21: "XYZ"
+        text run at (20,104) width 4: " "
+        text run at (0,117) width 35: "abcdef"
+        text run at (0,130) width 36: "ghijklm"
+        text run at (0,143) width 39: "nopqrst"
+        text run at (0,156) width 12: "uv"
+        text run at (11,156) width 4: " "
 layer at (376,642) size 60x60 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 173
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 39x169
       LayoutText {#text} at (0,0) size 39x169
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 33: "ABCD"
-        text run at (0,52) width 35: "EFGHI"
-        text run at (0,65) width 39: "JKLMN"
-        text run at (0,78) width 34: "OPQR"
-        text run at (0,91) width 30: "STUV"
-        text run at (0,104) width 33: "WXYZ"
-        text run at (32,104) width 4: " "
-        text run at (0,117) width 37: "abcdef"
-        text run at (0,130) width 38: "ghijklm"
-        text run at (0,143) width 37: "nopqrs"
-        text run at (0,156) width 17: "tuv"
-        text run at (16,156) width 4: " "
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 31: "ipsum"
+        text run at (30,13) width 4: " "
+        text run at (0,26) width 26: "dolor"
+        text run at (25,26) width 4: " "
+        text run at (0,39) width 38: "ABCDE"
+        text run at (0,52) width 32: "FGHIJ"
+        text run at (0,65) width 32: "KLMN"
+        text run at (0,78) width 32: "OPQR"
+        text run at (0,91) width 39: "STUVW"
+        text run at (0,104) width 21: "XYZ"
+        text run at (20,104) width 4: " "
+        text run at (0,117) width 35: "abcdef"
+        text run at (0,130) width 36: "ghijklm"
+        text run at (0,143) width 39: "nopqrst"
+        text run at (0,156) width 12: "uv"
+        text run at (11,156) width 4: " "
 layer at (376,721) size 60x60 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 173
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 39x169
       LayoutText {#text} at (0,0) size 39x169
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 33: "ABCD"
-        text run at (0,52) width 35: "EFGHI"
-        text run at (0,65) width 39: "JKLMN"
-        text run at (0,78) width 34: "OPQR"
-        text run at (0,91) width 30: "STUV"
-        text run at (0,104) width 33: "WXYZ"
-        text run at (32,104) width 4: " "
-        text run at (0,117) width 37: "abcdef"
-        text run at (0,130) width 38: "ghijklm"
-        text run at (0,143) width 37: "nopqrs"
-        text run at (0,156) width 17: "tuv"
-        text run at (16,156) width 4: " "
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 31: "ipsum"
+        text run at (30,13) width 4: " "
+        text run at (0,26) width 26: "dolor"
+        text run at (25,26) width 4: " "
+        text run at (0,39) width 38: "ABCDE"
+        text run at (0,52) width 32: "FGHIJ"
+        text run at (0,65) width 32: "KLMN"
+        text run at (0,78) width 32: "OPQR"
+        text run at (0,91) width 39: "STUVW"
+        text run at (0,104) width 21: "XYZ"
+        text run at (20,104) width 4: " "
+        text run at (0,117) width 35: "abcdef"
+        text run at (0,130) width 36: "ghijklm"
+        text run at (0,143) width 39: "nopqrst"
+        text run at (0,156) width 12: "uv"
+        text run at (11,156) width 4: " "
 layer at (376,800) size 60x60 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 173
   LayoutTextControl {TEXTAREA} at (14.61,1) size 60x60 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 39x169
       LayoutText {#text} at (0,0) size 39x169
-        text run at (0,0) width 34: "Lorem"
-        text run at (33,0) width 4: " "
-        text run at (0,13) width 32: "ipsum"
-        text run at (31,13) width 5: " "
-        text run at (0,26) width 28: "dolor"
-        text run at (27,26) width 4: " "
-        text run at (0,39) width 33: "ABCD"
-        text run at (0,52) width 35: "EFGHI"
-        text run at (0,65) width 39: "JKLMN"
-        text run at (0,78) width 34: "OPQR"
-        text run at (0,91) width 30: "STUV"
-        text run at (0,104) width 33: "WXYZ"
-        text run at (32,104) width 4: " "
-        text run at (0,117) width 37: "abcdef"
-        text run at (0,130) width 38: "ghijklm"
-        text run at (0,143) width 37: "nopqrs"
-        text run at (0,156) width 17: "tuv"
-        text run at (16,156) width 4: " "
-layer at (376,879) size 141x47 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollWidth 187 scrollHeight 212
+        text run at (0,0) width 32: "Lorem"
+        text run at (31,0) width 4: " "
+        text run at (0,13) width 31: "ipsum"
+        text run at (30,13) width 4: " "
+        text run at (0,26) width 26: "dolor"
+        text run at (25,26) width 4: " "
+        text run at (0,39) width 38: "ABCDE"
+        text run at (0,52) width 32: "FGHIJ"
+        text run at (0,65) width 32: "KLMN"
+        text run at (0,78) width 32: "OPQR"
+        text run at (0,91) width 39: "STUVW"
+        text run at (0,104) width 21: "XYZ"
+        text run at (20,104) width 4: " "
+        text run at (0,117) width 35: "abcdef"
+        text run at (0,130) width 36: "ghijklm"
+        text run at (0,143) width 39: "nopqrst"
+        text run at (0,156) width 12: "uv"
+        text run at (11,156) width 4: " "
+layer at (376,879) size 141x47 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollWidth 176 scrollHeight 212
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 120x208
       LayoutText {#text} at (0,0) size 4x13
         text run at (0,0) width 4: " "
       LayoutBR {BR} at (3,11) size 1x0
-      LayoutText {#text} at (0,13) size 186x13
-        text run at (0,13) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,13) size 175x13
+        text run at (0,13) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,26) size 186x13
-        text run at (0,26) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,26) size 175x13
+        text run at (0,26) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,39) size 186x13
-        text run at (0,39) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,39) size 175x13
+        text run at (0,39) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,52) size 186x13
-        text run at (0,52) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,52) size 175x13
+        text run at (0,52) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,65) size 186x13
-        text run at (0,65) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,65) size 175x13
+        text run at (0,65) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,78) size 186x13
-        text run at (0,78) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,78) size 175x13
+        text run at (0,78) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,91) size 186x13
-        text run at (0,91) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,91) size 175x13
+        text run at (0,91) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,104) size 186x13
-        text run at (0,104) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,104) size 175x13
+        text run at (0,104) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,117) size 186x13
-        text run at (0,117) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,117) size 175x13
+        text run at (0,117) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,130) size 186x13
-        text run at (0,130) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,130) size 175x13
+        text run at (0,130) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,143) size 186x13
-        text run at (0,143) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,143) size 175x13
+        text run at (0,143) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,156) size 186x13
-        text run at (0,156) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,156) size 175x13
+        text run at (0,156) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,169) size 186x13
-        text run at (0,169) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,169) size 175x13
+        text run at (0,169) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutText {#text} at (0,182) size 186x13
-        text run at (0,182) width 186: "This is a text area with wrap=\"soft\""
+      LayoutText {#text} at (0,182) size 175x13
+        text run at (0,182) width 175: "This is a text area with wrap=\"soft\""
       LayoutBR {BR} at (0,0) size 0x0
       LayoutBR {BR} at (0,195) size 0x13
 layer at (376,945) size 141x32 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 394
@@ -742,76 +737,76 @@
       LayoutText {#text} at (0,0) size 4x13
         text run at (0,0) width 4: " "
       LayoutBR {BR} at (3,11) size 1x0
-      LayoutText {#text} at (0,13) size 120x26
-        text run at (0,13) width 119: "This is a text area with"
-        text run at (118,13) width 2: " "
-        text run at (0,26) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,37) size 1x0
-      LayoutText {#text} at (0,39) size 120x26
-        text run at (0,39) width 119: "This is a text area with"
-        text run at (118,39) width 2: " "
-        text run at (0,52) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,63) size 1x0
-      LayoutText {#text} at (0,65) size 120x26
-        text run at (0,65) width 119: "This is a text area with"
-        text run at (118,65) width 2: " "
-        text run at (0,78) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,89) size 1x0
-      LayoutText {#text} at (0,91) size 120x26
-        text run at (0,91) width 119: "This is a text area with"
-        text run at (118,91) width 2: " "
-        text run at (0,104) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,115) size 1x0
-      LayoutText {#text} at (0,117) size 120x26
-        text run at (0,117) width 119: "This is a text area with"
-        text run at (118,117) width 2: " "
-        text run at (0,130) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,141) size 1x0
-      LayoutText {#text} at (0,143) size 120x26
-        text run at (0,143) width 119: "This is a text area with"
-        text run at (118,143) width 2: " "
-        text run at (0,156) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,167) size 1x0
-      LayoutText {#text} at (0,169) size 120x26
-        text run at (0,169) width 119: "This is a text area with"
-        text run at (118,169) width 2: " "
-        text run at (0,182) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,193) size 1x0
-      LayoutText {#text} at (0,195) size 120x26
-        text run at (0,195) width 119: "This is a text area with"
-        text run at (118,195) width 2: " "
-        text run at (0,208) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,219) size 1x0
-      LayoutText {#text} at (0,221) size 120x26
-        text run at (0,221) width 119: "This is a text area with"
-        text run at (118,221) width 2: " "
-        text run at (0,234) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,245) size 1x0
-      LayoutText {#text} at (0,247) size 120x26
-        text run at (0,247) width 119: "This is a text area with"
-        text run at (118,247) width 2: " "
-        text run at (0,260) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,271) size 1x0
-      LayoutText {#text} at (0,273) size 120x26
-        text run at (0,273) width 119: "This is a text area with"
-        text run at (118,273) width 2: " "
-        text run at (0,286) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,297) size 1x0
-      LayoutText {#text} at (0,299) size 120x26
-        text run at (0,299) width 119: "This is a text area with"
-        text run at (118,299) width 2: " "
-        text run at (0,312) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,323) size 1x0
-      LayoutText {#text} at (0,325) size 120x26
-        text run at (0,325) width 119: "This is a text area with"
-        text run at (118,325) width 2: " "
-        text run at (0,338) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,349) size 1x0
-      LayoutText {#text} at (0,351) size 120x26
-        text run at (0,351) width 119: "This is a text area with"
-        text run at (118,351) width 2: " "
-        text run at (0,364) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,375) size 1x0
+      LayoutText {#text} at (0,13) size 115x26
+        text run at (0,13) width 112: "This is a text area with"
+        text run at (111,13) width 4: " "
+        text run at (0,26) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,37) size 1x0
+      LayoutText {#text} at (0,39) size 115x26
+        text run at (0,39) width 112: "This is a text area with"
+        text run at (111,39) width 4: " "
+        text run at (0,52) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,63) size 1x0
+      LayoutText {#text} at (0,65) size 115x26
+        text run at (0,65) width 112: "This is a text area with"
+        text run at (111,65) width 4: " "
+        text run at (0,78) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,89) size 1x0
+      LayoutText {#text} at (0,91) size 115x26
+        text run at (0,91) width 112: "This is a text area with"
+        text run at (111,91) width 4: " "
+        text run at (0,104) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,115) size 1x0
+      LayoutText {#text} at (0,117) size 115x26
+        text run at (0,117) width 112: "This is a text area with"
+        text run at (111,117) width 4: " "
+        text run at (0,130) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,141) size 1x0
+      LayoutText {#text} at (0,143) size 115x26
+        text run at (0,143) width 112: "This is a text area with"
+        text run at (111,143) width 4: " "
+        text run at (0,156) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,167) size 1x0
+      LayoutText {#text} at (0,169) size 115x26
+        text run at (0,169) width 112: "This is a text area with"
+        text run at (111,169) width 4: " "
+        text run at (0,182) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,193) size 1x0
+      LayoutText {#text} at (0,195) size 115x26
+        text run at (0,195) width 112: "This is a text area with"
+        text run at (111,195) width 4: " "
+        text run at (0,208) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,219) size 1x0
+      LayoutText {#text} at (0,221) size 115x26
+        text run at (0,221) width 112: "This is a text area with"
+        text run at (111,221) width 4: " "
+        text run at (0,234) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,245) size 1x0
+      LayoutText {#text} at (0,247) size 115x26
+        text run at (0,247) width 112: "This is a text area with"
+        text run at (111,247) width 4: " "
+        text run at (0,260) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,271) size 1x0
+      LayoutText {#text} at (0,273) size 115x26
+        text run at (0,273) width 112: "This is a text area with"
+        text run at (111,273) width 4: " "
+        text run at (0,286) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,297) size 1x0
+      LayoutText {#text} at (0,299) size 115x26
+        text run at (0,299) width 112: "This is a text area with"
+        text run at (111,299) width 4: " "
+        text run at (0,312) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,323) size 1x0
+      LayoutText {#text} at (0,325) size 115x26
+        text run at (0,325) width 112: "This is a text area with"
+        text run at (111,325) width 4: " "
+        text run at (0,338) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,349) size 1x0
+      LayoutText {#text} at (0,351) size 115x26
+        text run at (0,351) width 112: "This is a text area with"
+        text run at (111,351) width 4: " "
+        text run at (0,364) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,375) size 1x0
       LayoutBR {BR} at (0,377) size 0x13
 layer at (376,996) size 141x32 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 394
   LayoutTextControl {TEXTAREA} at (14.61,1) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
@@ -819,74 +814,74 @@
       LayoutText {#text} at (0,0) size 4x13
         text run at (0,0) width 4: " "
       LayoutBR {BR} at (3,11) size 1x0
-      LayoutText {#text} at (0,13) size 120x26
-        text run at (0,13) width 119: "This is a text area with"
-        text run at (118,13) width 2: " "
-        text run at (0,26) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,37) size 1x0
-      LayoutText {#text} at (0,39) size 120x26
-        text run at (0,39) width 119: "This is a text area with"
-        text run at (118,39) width 2: " "
-        text run at (0,52) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,63) size 1x0
-      LayoutText {#text} at (0,65) size 120x26
-        text run at (0,65) width 119: "This is a text area with"
-        text run at (118,65) width 2: " "
-        text run at (0,78) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,89) size 1x0
-      LayoutText {#text} at (0,91) size 120x26
-        text run at (0,91) width 119: "This is a text area with"
-        text run at (118,91) width 2: " "
-        text run at (0,104) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,115) size 1x0
-      LayoutText {#text} at (0,117) size 120x26
-        text run at (0,117) width 119: "This is a text area with"
-        text run at (118,117) width 2: " "
-        text run at (0,130) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,141) size 1x0
-      LayoutText {#text} at (0,143) size 120x26
-        text run at (0,143) width 119: "This is a text area with"
-        text run at (118,143) width 2: " "
-        text run at (0,156) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,167) size 1x0
-      LayoutText {#text} at (0,169) size 120x26
-        text run at (0,169) width 119: "This is a text area with"
-        text run at (118,169) width 2: " "
-        text run at (0,182) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,193) size 1x0
-      LayoutText {#text} at (0,195) size 120x26
-        text run at (0,195) width 119: "This is a text area with"
-        text run at (118,195) width 2: " "
-        text run at (0,208) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,219) size 1x0
-      LayoutText {#text} at (0,221) size 120x26
-        text run at (0,221) width 119: "This is a text area with"
-        text run at (118,221) width 2: " "
-        text run at (0,234) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,245) size 1x0
-      LayoutText {#text} at (0,247) size 120x26
-        text run at (0,247) width 119: "This is a text area with"
-        text run at (118,247) width 2: " "
-        text run at (0,260) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,271) size 1x0
-      LayoutText {#text} at (0,273) size 120x26
-        text run at (0,273) width 119: "This is a text area with"
-        text run at (118,273) width 2: " "
-        text run at (0,286) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,297) size 1x0
-      LayoutText {#text} at (0,299) size 120x26
-        text run at (0,299) width 119: "This is a text area with"
-        text run at (118,299) width 2: " "
-        text run at (0,312) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,323) size 1x0
-      LayoutText {#text} at (0,325) size 120x26
-        text run at (0,325) width 119: "This is a text area with"
-        text run at (118,325) width 2: " "
-        text run at (0,338) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,349) size 1x0
-      LayoutText {#text} at (0,351) size 120x26
-        text run at (0,351) width 119: "This is a text area with"
-        text run at (118,351) width 2: " "
-        text run at (0,364) width 64: "wrap=\"soft\""
-      LayoutBR {BR} at (63,375) size 1x0
+      LayoutText {#text} at (0,13) size 115x26
+        text run at (0,13) width 112: "This is a text area with"
+        text run at (111,13) width 4: " "
+        text run at (0,26) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,37) size 1x0
+      LayoutText {#text} at (0,39) size 115x26
+        text run at (0,39) width 112: "This is a text area with"
+        text run at (111,39) width 4: " "
+        text run at (0,52) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,63) size 1x0
+      LayoutText {#text} at (0,65) size 115x26
+        text run at (0,65) width 112: "This is a text area with"
+        text run at (111,65) width 4: " "
+        text run at (0,78) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,89) size 1x0
+      LayoutText {#text} at (0,91) size 115x26
+        text run at (0,91) width 112: "This is a text area with"
+        text run at (111,91) width 4: " "
+        text run at (0,104) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,115) size 1x0
+      LayoutText {#text} at (0,117) size 115x26
+        text run at (0,117) width 112: "This is a text area with"
+        text run at (111,117) width 4: " "
+        text run at (0,130) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,141) size 1x0
+      LayoutText {#text} at (0,143) size 115x26
+        text run at (0,143) width 112: "This is a text area with"
+        text run at (111,143) width 4: " "
+        text run at (0,156) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,167) size 1x0
+      LayoutText {#text} at (0,169) size 115x26
+        text run at (0,169) width 112: "This is a text area with"
+        text run at (111,169) width 4: " "
+        text run at (0,182) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,193) size 1x0
+      LayoutText {#text} at (0,195) size 115x26
+        text run at (0,195) width 112: "This is a text area with"
+        text run at (111,195) width 4: " "
+        text run at (0,208) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,219) size 1x0
+      LayoutText {#text} at (0,221) size 115x26
+        text run at (0,221) width 112: "This is a text area with"
+        text run at (111,221) width 4: " "
+        text run at (0,234) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,245) size 1x0
+      LayoutText {#text} at (0,247) size 115x26
+        text run at (0,247) width 112: "This is a text area with"
+        text run at (111,247) width 4: " "
+        text run at (0,260) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,271) size 1x0
+      LayoutText {#text} at (0,273) size 115x26
+        text run at (0,273) width 112: "This is a text area with"
+        text run at (111,273) width 4: " "
+        text run at (0,286) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,297) size 1x0
+      LayoutText {#text} at (0,299) size 115x26
+        text run at (0,299) width 112: "This is a text area with"
+        text run at (111,299) width 4: " "
+        text run at (0,312) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,323) size 1x0
+      LayoutText {#text} at (0,325) size 115x26
+        text run at (0,325) width 112: "This is a text area with"
+        text run at (111,325) width 4: " "
+        text run at (0,338) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,349) size 1x0
+      LayoutText {#text} at (0,351) size 115x26
+        text run at (0,351) width 112: "This is a text area with"
+        text run at (111,351) width 4: " "
+        text run at (0,364) width 60: "wrap=\"soft\""
+      LayoutBR {BR} at (59,375) size 1x0
       LayoutBR {BR} at (0,377) size 0x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/blankbuttons-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/blankbuttons-expected.png
index e770e79..519ba4f8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/blankbuttons-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/blankbuttons-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/blankbuttons-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/blankbuttons-expected.txt
index 5a00d26..07b4cf1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/blankbuttons-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/blankbuttons-expected.txt
@@ -3,13 +3,13 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutButton {INPUT} at (0,0) size 53.45x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 37.45x13
-          LayoutText {#text} at (0,0) size 38x13
-            text run at (0,0) width 38: "Submit"
-      LayoutBR {BR} at (53,13) size 1x0
-      LayoutButton {INPUT} at (0,18) size 46.30x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 30.30x13
-          LayoutText {#text} at (0,0) size 31x13
-            text run at (0,0) width 31: "Reset"
-      LayoutBR {BR} at (46,31) size 1x0
+      LayoutButton {INPUT} at (0,0) size 51.64x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 35.64x13
+          LayoutText {#text} at (0,0) size 36x13
+            text run at (0,0) width 36: "Submit"
+      LayoutBR {BR} at (51,13) size 1x0
+      LayoutButton {INPUT} at (0,18) size 44.78x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 28.78x13
+          LayoutText {#text} at (0,0) size 29x13
+            text run at (0,0) width 29: "Reset"
+      LayoutBR {BR} at (44,31) size 1x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-align-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-align-expected.png
index 9d5b42e..8b877232 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-align-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-align-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-align-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-align-expected.txt
index 6a2e3c6..0781bd4a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-align-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-align-expected.txt
@@ -9,33 +9,33 @@
       LayoutBlockFlow (anonymous) at (0,34) size 784x75
         LayoutButton {BUTTON} at (0,1) size 300x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,2) size 284x13
-            LayoutText {#text} at (54,0) size 176x13
-              text run at (54,0) width 176: "This is should be center justified."
+            LayoutText {#text} at (60,0) size 164x13
+              text run at (60,0) width 164: "This is should be center justified."
         LayoutText {#text} at (300,0) size 4x18
           text run at (300,0) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutButton {BUTTON} at (0,20) size 300x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,2) size 284x13
-            LayoutText {#text} at (54,0) size 176x13
-              text run at (54,0) width 176: "This is should be center justified."
+            LayoutText {#text} at (60,0) size 164x13
+              text run at (60,0) width 164: "This is should be center justified."
         LayoutText {#text} at (300,19) size 4x18
           text run at (300,19) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutButton {BUTTON} at (0,39) size 300x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,2) size 284x13
-            LayoutText {#text} at (54,0) size 176x13
-              text run at (54,0) width 176: "This is should be center justified."
+            LayoutText {#text} at (60,0) size 164x13
+              text run at (60,0) width 164: "This is should be center justified."
         LayoutText {#text} at (300,38) size 4x18
           text run at (300,38) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutButton {BUTTON} at (0,57) size 300x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,2) size 284x13
-            LayoutText {#text} at (54,0) size 176x13
-              text run at (54,0) width 176: "This is should be center justified."
+            LayoutText {#text} at (60,0) size 164x13
+              text run at (60,0) width 164: "This is should be center justified."
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,109) size 784x18
         LayoutButton {BUTTON} at (0,0) size 300x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,2) size 284x13
-            LayoutText {#text} at (54,0) size 176x13
-              text run at (54,0) width 176: "This is should be center justified."
+            LayoutText {#text} at (60,0) size 164x13
+              text run at (60,0) width 164: "This is should be center justified."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-cannot-be-nested-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-cannot-be-nested-expected.png
index ae4bfddf..c4a5107 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-cannot-be-nested-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-cannot-be-nested-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-cannot-be-nested-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-cannot-be-nested-expected.txt
index 62bbf3d..662d187b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-cannot-be-nested-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-cannot-be-nested-expected.txt
@@ -10,14 +10,14 @@
         LayoutText {#text} at (62,0) size 379x18
           text run at (62,0) width 379: " REGRESSION: button after unclosed button gives trouble"
       LayoutBlockFlow {P} at (0,34) size 784x19
-        LayoutButton {BUTTON} at (0,1) size 35.84x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 19.84x13
-            LayoutText {#text} at (0,0) size 20x13
-              text run at (0,0) width 20: "test"
-        LayoutButton {BUTTON} at (35.84,1) size 42.38x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 26.38x13
-            LayoutText {#text} at (0,0) size 27x13
-              text run at (0,0) width 27: "test2"
+        LayoutButton {BUTTON} at (0,1) size 34.64x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 18.64x13
+            LayoutText {#text} at (0,0) size 19x13
+              text run at (0,0) width 19: "test"
+        LayoutButton {BUTTON} at (34.64,1) size 40.86x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 24.86x13
+            LayoutText {#text} at (0,0) size 25x13
+              text run at (0,0) width 25: "test2"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,69) size 784x18
         LayoutText {#text} at (0,0) size 613x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-default-title-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-default-title-expected.png
index 96a98362..5b3cbdf3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-default-title-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-default-title-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-default-title-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-default-title-expected.txt
index 7faad7e..b068812f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-default-title-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-default-title-expected.txt
@@ -12,8 +12,8 @@
       LayoutBlockFlow (anonymous) at (0,74.72) size 769x21
         LayoutButton {INPUT} at (0,0) size 80x21 [bgcolor=#008000] [border: (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,4) size 64x13
-            LayoutText {#text} at (13,0) size 38x13
-              text run at (13,0) width 38: "Submit"
+            LayoutText {#text} at (14,0) size 36x13
+              text run at (14,0) width 36: "Submit"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,111.72) size 769x18
         LayoutText {#text} at (0,0) size 300x18
@@ -21,8 +21,8 @@
       LayoutBlockFlow (anonymous) at (0,145.72) size 769x21
         LayoutButton {INPUT} at (0,0) size 80x21 [bgcolor=#008000] [border: (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,4) size 64x13
-            LayoutText {#text} at (21,0) size 22x13
-              text run at (21,0) width 22: "Foo"
+            LayoutText {#text} at (22,0) size 20x13
+              text run at (22,0) width 20: "Foo"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,182.72) size 769x18
         LayoutText {#text} at (0,0) size 316x18
@@ -48,8 +48,8 @@
       LayoutBlockFlow (anonymous) at (0,402.16) size 769x21
         LayoutButton {INPUT} at (0,0) size 80x21 [bgcolor=#008000] [border: (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,4) size 64x13
-            LayoutText {#text} at (16,0) size 32x13
-              text run at (16,0) width 32: "Reset"
+            LayoutText {#text} at (17,0) size 30x13
+              text run at (17,0) width 30: "Reset"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,439.16) size 769x18
         LayoutText {#text} at (0,0) size 300x18
@@ -57,8 +57,8 @@
       LayoutBlockFlow (anonymous) at (0,473.16) size 769x21
         LayoutButton {INPUT} at (0,0) size 80x21 [bgcolor=#008000] [border: (2px outset #C0C0C0)]
           LayoutBlockFlow (anonymous) at (8,4) size 64x13
-            LayoutText {#text} at (21,0) size 22x13
-              text run at (21,0) width 22: "Foo"
+            LayoutText {#text} at (22,0) size 20x13
+              text run at (22,0) width 20: "Foo"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,510.16) size 769x18
         LayoutText {#text} at (0,0) size 316x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-positioned-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-positioned-expected.png
index 756533c..a504fb53 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-positioned-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-positioned-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-positioned-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-positioned-expected.txt
index 98d1030..4fa8213 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-positioned-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-positioned-expected.txt
@@ -3,13 +3,13 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-layer at (8,8) size 150x18
-  LayoutButton (positioned) {BUTTON} at (8,8) size 149.97x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-    LayoutBlockFlow (anonymous) at (8,2) size 133.97x13
-      LayoutText {#text} at (0,0) size 134x13
-        text run at (0,0) width 134: "This button is positioned."
-layer at (8,8) size 172x18
-  LayoutButton (positioned) {INPUT} at (8,8) size 171.66x18 [bgcolor=#C0C0C0]
-    LayoutBlockFlow (anonymous) at (8,2) size 155.66x13
-      LayoutText {#text} at (0,0) size 156x13
-        text run at (0,0) width 156: "This button is also positioned"
+layer at (8,8) size 142x18
+  LayoutButton (positioned) {BUTTON} at (8,8) size 142.11x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+    LayoutBlockFlow (anonymous) at (8,2) size 126.11x13
+      LayoutText {#text} at (0,0) size 127x13
+        text run at (0,0) width 127: "This button is positioned."
+layer at (8,8) size 163x18
+  LayoutButton (positioned) {INPUT} at (8,8) size 162.61x18 [bgcolor=#C0C0C0]
+    LayoutBlockFlow (anonymous) at (8,2) size 146.61x13
+      LayoutText {#text} at (0,0) size 147x13
+        text run at (0,0) width 147: "This button is also positioned"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-sizes-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-sizes-expected.png
index a41efca..63786ae 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-sizes-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-sizes-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-sizes-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-sizes-expected.txt
index d623287..c215d964 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-sizes-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-sizes-expected.txt
@@ -3,110 +3,110 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutButton {BUTTON} at (0,6) size 46.92x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 30.92x6
-          LayoutText {#text} at (0,0) size 31x6
-            text run at (0,0) width 31: "Test Button"
-      LayoutText {#text} at (46,1) size 5x18
-        text run at (46,1) width 5: " "
-      LayoutButton {BUTTON} at (50.92,6) size 53.11x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,3.50) size 37.11x7
-          LayoutText {#text} at (0,0) size 38x7
+      LayoutButton {BUTTON} at (0,7) size 42.45x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 26.45x6
+          LayoutText {#text} at (0,0) size 27x6
+            text run at (0,0) width 27: "Test Button"
+      LayoutText {#text} at (42,2) size 5x18
+        text run at (42,2) width 5: " "
+      LayoutButton {BUTTON} at (46.45,7) size 47.75x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,3.50) size 31.75x7
+          LayoutText {#text} at (0,0) size 32x7
+            text run at (0,0) width 32: "Test Button"
+      LayoutText {#text} at (94,2) size 5x18
+        text run at (94,2) width 5: " "
+      LayoutButton {BUTTON} at (98.20,6) size 53.03x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,3) size 37.03x8
+          LayoutText {#text} at (0,0) size 38x8
             text run at (0,0) width 38: "Test Button"
-      LayoutText {#text} at (104,1) size 5x18
-        text run at (104,1) width 5: " "
-      LayoutButton {BUTTON} at (108.03,5) size 58.20x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,3) size 42.20x8
-          LayoutText {#text} at (0,0) size 43x8
+      LayoutText {#text} at (151,2) size 5x18
+        text run at (151,2) width 5: " "
+      LayoutButton {BUTTON} at (155.23,6) size 58.33x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 42.33x10
+          LayoutText {#text} at (0,0) size 43x10
             text run at (0,0) width 43: "Test Button"
-      LayoutText {#text} at (166,1) size 5x18
-        text run at (166,1) width 5: " "
-      LayoutButton {BUTTON} at (170.23,5) size 63.06x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 47.06x10
-          LayoutText {#text} at (0,0) size 48x10
+      LayoutText {#text} at (213,2) size 5x18
+        text run at (213,2) width 5: " "
+      LayoutButton {BUTTON} at (217.56,5) size 63.61x16 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 47.61x11
+          LayoutText {#text} at (0,0) size 48x11
             text run at (0,0) width 48: "Test Button"
-      LayoutText {#text} at (233,1) size 5x18
-        text run at (233,1) width 5: " "
-      LayoutButton {BUTTON} at (237.30,4) size 67.64x16 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 51.64x11
-          LayoutText {#text} at (0,0) size 52x11
-            text run at (0,0) width 52: "Test Button"
-      LayoutText {#text} at (304,1) size 5x18
-        text run at (304,1) width 5: " "
-      LayoutButton {BUTTON} at (308.94,3) size 72.25x17 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 56.25x12
-          LayoutText {#text} at (0,0) size 57x12
-            text run at (0,0) width 57: "Test Button"
-      LayoutText {#text} at (381,1) size 5x18
-        text run at (381,1) width 5: " "
-      LayoutButton {BUTTON} at (385.19,2) size 77.52x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (462,1) size 5x18
-        text run at (462,1) width 5: " "
-      LayoutButton {INPUT} at (466.70,2) size 77.52x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (544,1) size 5x18
-        text run at (544,1) width 5: " "
-      LayoutButton {BUTTON} at (548.22,1) size 82.70x20 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 66.70x15
-          LayoutText {#text} at (0,0) size 67x15
-            text run at (0,0) width 67: "Test Button"
-      LayoutText {#text} at (630,1) size 5x18
-        text run at (630,1) width 5: " "
-      LayoutButton {BUTTON} at (634.92,0) size 87.67x21 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 71.67x16
-          LayoutText {#text} at (0,0) size 72x16
-            text run at (0,0) width 72: "Test Button"
-      LayoutText {#text} at (722,1) size 5x18
-        text run at (722,1) width 5: " "
-      LayoutButton {BUTTON} at (0,26) size 92.25x22 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 76.25x17
-          LayoutText {#text} at (0,0) size 77x17
-            text run at (0,0) width 77: "Test Button"
-      LayoutText {#text} at (92,28) size 5x18
-        text run at (92,28) width 5: " "
-      LayoutButton {BUTTON} at (96.25,26) size 97.03x22 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 81.03x17
-          LayoutText {#text} at (0,0) size 82x17
-            text run at (0,0) width 82: "Test Button"
-      LayoutText {#text} at (193,28) size 5x18
-        text run at (193,28) width 5: " "
-      LayoutButton {BUTTON} at (197.28,25) size 102.08x23 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 86.08x18
-          LayoutText {#text} at (0,0) size 87x18
-            text run at (0,0) width 87: "Test Button"
-      LayoutText {#text} at (299,28) size 5x18
-        text run at (299,28) width 5: " "
-      LayoutButton {BUTTON} at (303.36,24) size 107.08x25 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 91.08x20
-          LayoutText {#text} at (0,0) size 92x20
-            text run at (0,0) width 92: "Test Button"
-      LayoutText {#text} at (410,28) size 5x18
-        text run at (410,28) width 5: " "
-      LayoutButton {BUTTON} at (414.44,23) size 111.22x26 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+      LayoutText {#text} at (281,2) size 5x18
+        text run at (281,2) width 5: " "
+      LayoutButton {BUTTON} at (285.17,4) size 68.91x17 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 52.91x12
+          LayoutText {#text} at (0,0) size 53x12
+            text run at (0,0) width 53: "Test Button"
+      LayoutText {#text} at (354,2) size 5x18
+        text run at (354,2) width 5: " "
+      LayoutButton {BUTTON} at (358.08,3) size 74.19x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (432,2) size 5x18
+        text run at (432,2) width 5: " "
+      LayoutButton {INPUT} at (436.27,3) size 74.19x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (510,2) size 5x18
+        text run at (510,2) width 5: " "
+      LayoutButton {BUTTON} at (514.45,2) size 79.48x20 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 63.48x15
+          LayoutText {#text} at (0,0) size 64x15
+            text run at (0,0) width 64: "Test Button"
+      LayoutText {#text} at (593,2) size 5x18
+        text run at (593,2) width 5: " "
+      LayoutButton {BUTTON} at (597.94,1) size 84.77x21 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 68.77x16
+          LayoutText {#text} at (0,0) size 69x16
+            text run at (0,0) width 69: "Test Button"
+      LayoutText {#text} at (682,2) size 5x18
+        text run at (682,2) width 5: " "
+      LayoutButton {BUTTON} at (686.70,0) size 90.06x22 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 74.06x17
+          LayoutText {#text} at (0,0) size 75x17
+            text run at (0,0) width 75: "Test Button"
+      LayoutText {#text} at (776,2) size 5x18
+        text run at (776,2) width 5: " "
+      LayoutButton {BUTTON} at (0,27) size 95.36x22 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 79.36x17
+          LayoutText {#text} at (0,0) size 80x17
+            text run at (0,0) width 80: "Test Button"
+      LayoutText {#text} at (95,29) size 5x18
+        text run at (95,29) width 5: " "
+      LayoutButton {BUTTON} at (99.36,26) size 100.64x23 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 84.64x18
+          LayoutText {#text} at (0,0) size 85x18
+            text run at (0,0) width 85: "Test Button"
+      LayoutText {#text} at (200,29) size 4x18
+        text run at (200,29) width 4: " "
+      LayoutButton {BUTTON} at (204,25) size 105.94x25 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 89.94x20
+          LayoutText {#text} at (0,0) size 90x20
+            text run at (0,0) width 90: "Test Button"
+      LayoutText {#text} at (309,29) size 5x18
+        text run at (309,29) width 5: " "
+      LayoutButton {BUTTON} at (313.94,24) size 111.22x26 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
         LayoutBlockFlow (anonymous) at (8,2) size 95.22x21
           LayoutText {#text} at (0,0) size 96x21
             text run at (0,0) width 96: "Test Button"
-      LayoutText {#text} at (525,28) size 5x18
-        text run at (525,28) width 5: " "
-      LayoutButton {BUTTON} at (529.66,22) size 115.66x27 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 99.66x22
-          LayoutText {#text} at (0,0) size 100x22
-            text run at (0,0) width 100: "Test Button"
-      LayoutText {#text} at (645,28) size 5x18
-        text run at (645,28) width 5: " "
-      LayoutButton {BUTTON} at (649.31,21) size 120.02x28 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 104.02x23
-          LayoutText {#text} at (0,0) size 104x23
-            text run at (0,0) width 104: "Test Button"
-      LayoutText {#text} at (769,28) size 5x18
-        text run at (769,28) width 5: " "
-      LayoutButton {BUTTON} at (0,49) size 124.75x29 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 108.75x24
-          LayoutText {#text} at (0,0) size 109x24
-            text run at (0,0) width 109: "Test Button"
+      LayoutText {#text} at (425,29) size 5x18
+        text run at (425,29) width 5: " "
+      LayoutButton {BUTTON} at (429.16,23) size 116.52x27 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 100.52x22
+          LayoutText {#text} at (0,0) size 101x22
+            text run at (0,0) width 101: "Test Button"
+      LayoutText {#text} at (545,29) size 5x18
+        text run at (545,29) width 5: " "
+      LayoutButton {BUTTON} at (549.67,22) size 121.80x28 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 105.80x23
+          LayoutText {#text} at (0,0) size 106x23
+            text run at (0,0) width 106: "Test Button"
+      LayoutText {#text} at (671,29) size 5x18
+        text run at (671,29) width 5: " "
+      LayoutButton {BUTTON} at (0,50) size 127.09x29 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 111.09x24
+          LayoutText {#text} at (0,0) size 112x24
+            text run at (0,0) width 112: "Test Button"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-style-color-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-style-color-expected.png
index 7c06d07..a73e1aca 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-style-color-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-style-color-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-style-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-style-color-expected.txt
index f62cb7b..143b387 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-style-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-style-color-expected.txt
@@ -3,50 +3,50 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutButton {BUTTON} at (0,2) size 77.52x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (77,1) size 5x18
-        text run at (77,1) width 5: " "
-      LayoutButton {BUTTON} at (81.52,2) size 77.52x18 [color=#FF0000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (159,1) size 5x18
-        text run at (159,1) width 5: " "
-      LayoutButton {BUTTON} at (163.03,0) size 77.52x22 [bgcolor=#008000] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (240,1) size 5x18
-        text run at (240,1) width 5: " "
-      LayoutButton {BUTTON} at (244.55,0) size 77.52x22 [color=#FF0000] [bgcolor=#008000] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (322,1) size 5x18
-        text run at (322,1) width 5: " "
-      LayoutButton {INPUT} at (326.06,2) size 77.52x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (403,1) size 5x18
-        text run at (403,1) width 5: " "
-      LayoutButton {INPUT} at (407.58,2) size 77.52x18 [color=#FF0000] [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (485,1) size 5x18
-        text run at (485,1) width 5: " "
-      LayoutButton {INPUT} at (489.09,0) size 77.52x22 [bgcolor=#008000] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (566,1) size 5x18
-        text run at (566,1) width 5: " "
-      LayoutButton {INPUT} at (570.61,0) size 77.52x22 [color=#FF0000] [bgcolor=#008000] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
+      LayoutButton {BUTTON} at (0,2) size 74.19x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (74,1) size 5x18
+        text run at (74,1) width 5: " "
+      LayoutButton {BUTTON} at (78.19,2) size 74.19x18 [color=#FF0000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (152,1) size 5x18
+        text run at (152,1) width 5: " "
+      LayoutButton {BUTTON} at (156.38,0) size 74.19x22 [bgcolor=#008000] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (230,1) size 5x18
+        text run at (230,1) width 5: " "
+      LayoutButton {BUTTON} at (234.56,0) size 74.19x22 [color=#FF0000] [bgcolor=#008000] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (308,1) size 5x18
+        text run at (308,1) width 5: " "
+      LayoutButton {INPUT} at (312.75,2) size 74.19x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (386,1) size 5x18
+        text run at (386,1) width 5: " "
+      LayoutButton {INPUT} at (390.94,2) size 74.19x18 [color=#FF0000] [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (465,1) size 5x18
+        text run at (465,1) width 5: " "
+      LayoutButton {INPUT} at (469.13,0) size 74.19x22 [bgcolor=#008000] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (543,1) size 5x18
+        text run at (543,1) width 5: " "
+      LayoutButton {INPUT} at (547.31,0) size 74.19x22 [color=#FF0000] [bgcolor=#008000] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-table-styles-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-table-styles-expected.png
index e46efc2..f2a2ff0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-table-styles-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-table-styles-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-table-styles-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-table-styles-expected.txt
index 5905c0f..9b87fd2f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-table-styles-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-table-styles-expected.txt
@@ -7,137 +7,137 @@
         LayoutText {#text} at (0,0) size 351x18
           text run at (0,0) width 351: "This tests that buttons don't honor table display styles. "
         LayoutBR {BR} at (350,14) size 1x0
-      LayoutButton {INPUT} at (0,18) size 86.48x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 70.48x13
-          LayoutText {#text} at (0,0) size 71x13
-            text run at (0,0) width 71: "display: table"
-      LayoutButton {INPUT} at (0,36) size 86.48x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 70.48x13
-          LayoutText {#text} at (0,0) size 71x13
-            text run at (0,0) width 71: "display: table"
+      LayoutButton {INPUT} at (0,18) size 82.27x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 66.27x13
+          LayoutText {#text} at (0,0) size 67x13
+            text run at (0,0) width 67: "display: table"
+      LayoutButton {INPUT} at (0,36) size 82.27x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 66.27x13
+          LayoutText {#text} at (0,0) size 67x13
+            text run at (0,0) width 67: "display: table"
       LayoutBlockFlow (anonymous) at (0,54) size 784x351
         LayoutBR {BR} at (0,0) size 0x18
         LayoutBR {BR} at (0,18) size 0x18
-        LayoutButton {INPUT} at (0,37) size 118.83x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 102.83x13
-            LayoutText {#text} at (0,0) size 103x13
-              text run at (0,0) width 103: "display: inline-table"
-        LayoutText {#text} at (118,36) size 5x18
-          text run at (118,36) width 5: " "
-        LayoutButton {INPUT} at (122.83,37) size 118.83x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 102.83x13
-            LayoutText {#text} at (0,0) size 103x13
-              text run at (0,0) width 103: "display: inline-table"
-        LayoutText {#text} at (241,36) size 5x18
-          text run at (241,36) width 5: " "
-        LayoutBR {BR} at (245,50) size 1x0
+        LayoutButton {INPUT} at (0,37) size 112.50x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 96.50x13
+            LayoutText {#text} at (0,0) size 97x13
+              text run at (0,0) width 97: "display: inline-table"
+        LayoutText {#text} at (112,36) size 5x18
+          text run at (112,36) width 5: " "
+        LayoutButton {INPUT} at (116.50,37) size 112.50x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 96.50x13
+            LayoutText {#text} at (0,0) size 97x13
+              text run at (0,0) width 97: "display: inline-table"
+        LayoutText {#text} at (229,36) size 4x18
+          text run at (229,36) width 4: " "
+        LayoutBR {BR} at (233,50) size 0x0
         LayoutBR {BR} at (0,55) size 0x18
-        LayoutButton {INPUT} at (0,74) size 146.22x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 130.22x13
-            LayoutText {#text} at (0,0) size 131x13
-              text run at (0,0) width 131: "display: table-row-group"
-        LayoutText {#text} at (146,73) size 5x18
-          text run at (146,73) width 5: " "
-        LayoutButton {INPUT} at (150.22,74) size 146.22x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 130.22x13
-            LayoutText {#text} at (0,0) size 131x13
-              text run at (0,0) width 131: "display: table-row-group"
-        LayoutText {#text} at (296,73) size 5x18
-          text run at (296,73) width 5: " "
-        LayoutBR {BR} at (300,87) size 1x0
+        LayoutButton {INPUT} at (0,74) size 138.97x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 122.97x13
+            LayoutText {#text} at (0,0) size 123x13
+              text run at (0,0) width 123: "display: table-row-group"
+        LayoutText {#text} at (138,73) size 5x18
+          text run at (138,73) width 5: " "
+        LayoutButton {INPUT} at (142.97,74) size 138.97x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 122.97x13
+            LayoutText {#text} at (0,0) size 123x13
+              text run at (0,0) width 123: "display: table-row-group"
+        LayoutText {#text} at (281,73) size 5x18
+          text run at (281,73) width 5: " "
+        LayoutBR {BR} at (285,87) size 1x0
         LayoutBR {BR} at (0,92) size 0x18
-        LayoutButton {INPUT} at (0,111) size 163.09x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 147.09x13
-            LayoutText {#text} at (0,0) size 148x13
-              text run at (0,0) width 148: "display: table-header-group"
-        LayoutText {#text} at (163,110) size 5x18
-          text run at (163,110) width 5: " "
-        LayoutButton {INPUT} at (167.09,111) size 163.09x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 147.09x13
-            LayoutText {#text} at (0,0) size 148x13
-              text run at (0,0) width 148: "display: table-header-group"
-        LayoutText {#text} at (330,110) size 5x18
-          text run at (330,110) width 5: " "
-        LayoutBR {BR} at (334,124) size 1x0
+        LayoutButton {INPUT} at (0,111) size 154.94x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 138.94x13
+            LayoutText {#text} at (0,0) size 139x13
+              text run at (0,0) width 139: "display: table-header-group"
+        LayoutText {#text} at (154,110) size 5x18
+          text run at (154,110) width 5: " "
+        LayoutButton {INPUT} at (158.94,111) size 154.94x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 138.94x13
+            LayoutText {#text} at (0,0) size 139x13
+              text run at (0,0) width 139: "display: table-header-group"
+        LayoutText {#text} at (313,110) size 5x18
+          text run at (313,110) width 5: " "
+        LayoutBR {BR} at (317,124) size 1x0
         LayoutBR {BR} at (0,129) size 0x18
-        LayoutButton {INPUT} at (0,148) size 157.91x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 141.91x13
-            LayoutText {#text} at (0,0) size 142x13
-              text run at (0,0) width 142: "display: table-footer-group"
-        LayoutText {#text} at (157,147) size 5x18
-          text run at (157,147) width 5: " "
-        LayoutButton {INPUT} at (161.91,148) size 157.91x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 141.91x13
-            LayoutText {#text} at (0,0) size 142x13
-              text run at (0,0) width 142: "display: table-footer-group"
-        LayoutText {#text} at (319,147) size 5x18
-          text run at (319,147) width 5: " "
-        LayoutBR {BR} at (323,161) size 1x0
+        LayoutButton {INPUT} at (0,148) size 149.75x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 133.75x13
+            LayoutText {#text} at (0,0) size 134x13
+              text run at (0,0) width 134: "display: table-footer-group"
+        LayoutText {#text} at (149,147) size 5x18
+          text run at (149,147) width 5: " "
+        LayoutButton {INPUT} at (153.75,148) size 149.75x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 133.75x13
+            LayoutText {#text} at (0,0) size 134x13
+              text run at (0,0) width 134: "display: table-footer-group"
+        LayoutText {#text} at (303,147) size 5x18
+          text run at (303,147) width 5: " "
+        LayoutBR {BR} at (307,161) size 1x0
         LayoutBR {BR} at (0,166) size 0x18
-        LayoutButton {INPUT} at (0,185) size 110.66x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 94.66x13
-            LayoutText {#text} at (0,0) size 95x13
-              text run at (0,0) width 95: "display: table-row"
-        LayoutText {#text} at (110,184) size 5x18
-          text run at (110,184) width 5: " "
-        LayoutButton {INPUT} at (114.66,185) size 110.66x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 94.66x13
-            LayoutText {#text} at (0,0) size 95x13
-              text run at (0,0) width 95: "display: table-row"
-        LayoutText {#text} at (225,184) size 5x18
-          text run at (225,184) width 5: " "
-        LayoutBR {BR} at (229,198) size 1x0
+        LayoutButton {INPUT} at (0,185) size 105.22x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 89.22x13
+            LayoutText {#text} at (0,0) size 90x13
+              text run at (0,0) width 90: "display: table-row"
+        LayoutText {#text} at (105,184) size 5x18
+          text run at (105,184) width 5: " "
+        LayoutButton {INPUT} at (109.22,185) size 105.22x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 89.22x13
+            LayoutText {#text} at (0,0) size 90x13
+              text run at (0,0) width 90: "display: table-row"
+        LayoutText {#text} at (214,184) size 5x18
+          text run at (214,184) width 5: " "
+        LayoutBR {BR} at (218,198) size 1x0
         LayoutBR {BR} at (0,203) size 0x18
-        LayoutButton {INPUT} at (0,222) size 165.38x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 149.38x13
-            LayoutText {#text} at (0,0) size 150x13
-              text run at (0,0) width 150: "display: table-column-group"
-        LayoutText {#text} at (165,221) size 5x18
-          text run at (165,221) width 5: " "
-        LayoutButton {INPUT} at (169.38,222) size 165.38x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 149.38x13
-            LayoutText {#text} at (0,0) size 150x13
-              text run at (0,0) width 150: "display: table-column-group"
-        LayoutText {#text} at (334,221) size 5x18
-          text run at (334,221) width 5: " "
-        LayoutBR {BR} at (338,235) size 1x0
+        LayoutButton {INPUT} at (0,222) size 157.23x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 141.23x13
+            LayoutText {#text} at (0,0) size 142x13
+              text run at (0,0) width 142: "display: table-column-group"
+        LayoutText {#text} at (157,221) size 5x18
+          text run at (157,221) width 5: " "
+        LayoutButton {INPUT} at (161.23,222) size 157.23x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 141.23x13
+            LayoutText {#text} at (0,0) size 142x13
+              text run at (0,0) width 142: "display: table-column-group"
+        LayoutText {#text} at (318,221) size 5x18
+          text run at (318,221) width 5: " "
+        LayoutBR {BR} at (322,235) size 1x0
         LayoutBR {BR} at (0,240) size 0x18
-        LayoutButton {INPUT} at (0,259) size 129.81x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 113.81x13
-            LayoutText {#text} at (0,0) size 114x13
-              text run at (0,0) width 114: "display: table-column"
-        LayoutText {#text} at (129,258) size 5x18
-          text run at (129,258) width 5: " "
-        LayoutButton {INPUT} at (133.81,259) size 129.81x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 113.81x13
-            LayoutText {#text} at (0,0) size 114x13
-              text run at (0,0) width 114: "display: table-column"
-        LayoutText {#text} at (263,258) size 5x18
-          text run at (263,258) width 5: " "
-        LayoutBR {BR} at (267,272) size 1x0
+        LayoutButton {INPUT} at (0,259) size 123.48x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 107.48x13
+            LayoutText {#text} at (0,0) size 108x13
+              text run at (0,0) width 108: "display: table-column"
+        LayoutText {#text} at (123,258) size 5x18
+          text run at (123,258) width 5: " "
+        LayoutButton {INPUT} at (127.48,259) size 123.48x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 107.48x13
+            LayoutText {#text} at (0,0) size 108x13
+              text run at (0,0) width 108: "display: table-column"
+        LayoutText {#text} at (250,258) size 5x18
+          text run at (250,258) width 5: " "
+        LayoutBR {BR} at (254,272) size 1x0
         LayoutBR {BR} at (0,277) size 0x18
-        LayoutButton {INPUT} at (0,296) size 109.31x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 93.31x13
-            LayoutText {#text} at (0,0) size 94x13
-              text run at (0,0) width 94: "display: table-cell"
-        LayoutText {#text} at (109,295) size 5x18
-          text run at (109,295) width 5: " "
-        LayoutButton {INPUT} at (113.31,296) size 109.31x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 93.31x13
-            LayoutText {#text} at (0,0) size 94x13
-              text run at (0,0) width 94: "display: table-cell"
-        LayoutText {#text} at (222,295) size 5x18
-          text run at (222,295) width 5: " "
-        LayoutBR {BR} at (226,309) size 1x0
+        LayoutButton {INPUT} at (0,296) size 103.58x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 87.58x13
+            LayoutText {#text} at (0,0) size 88x13
+              text run at (0,0) width 88: "display: table-cell"
+        LayoutText {#text} at (103,295) size 5x18
+          text run at (103,295) width 5: " "
+        LayoutButton {INPUT} at (107.58,296) size 103.58x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 87.58x13
+            LayoutText {#text} at (0,0) size 88x13
+              text run at (0,0) width 88: "display: table-cell"
+        LayoutText {#text} at (211,295) size 5x18
+          text run at (211,295) width 5: " "
+        LayoutBR {BR} at (215,309) size 1x0
         LayoutBR {BR} at (0,314) size 0x18
-        LayoutButton {INPUT} at (0,333) size 130.53x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 114.53x13
-            LayoutText {#text} at (0,0) size 115x13
-              text run at (0,0) width 115: "display: table-caption"
-        LayoutText {#text} at (130,332) size 5x18
-          text run at (130,332) width 5: " "
-        LayoutButton {INPUT} at (134.53,333) size 130.53x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 114.53x13
-            LayoutText {#text} at (0,0) size 115x13
-              text run at (0,0) width 115: "display: table-caption"
+        LayoutButton {INPUT} at (0,333) size 123.89x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 107.89x13
+            LayoutText {#text} at (0,0) size 108x13
+              text run at (0,0) width 108: "display: table-caption"
+        LayoutText {#text} at (123,332) size 5x18
+          text run at (123,332) width 5: " "
+        LayoutButton {INPUT} at (127.89,333) size 123.89x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 107.89x13
+            LayoutText {#text} at (0,0) size 108x13
+              text run at (0,0) width 108: "display: table-caption"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-text-transform-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-text-transform-expected.png
index 27a509d..9e44552 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-text-transform-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-text-transform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-text-transform-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-text-transform-expected.txt
index cbd2c0b3..23cd5fa9d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-text-transform-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-text-transform-expected.txt
@@ -17,38 +17,38 @@
         LayoutText {#text} at (106,18) size 5x18
           text run at (106,18) width 5: "."
       LayoutBlockFlow {P} at (0,52) size 784x19
-        LayoutButton {BUTTON} at (0,1) size 85.16x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 69.16x13
-            LayoutText {#text} at (0,0) size 70x13
-              text run at (0,0) width 70: "UPPERCASE"
-        LayoutText {#text} at (85,0) size 5x18
-          text run at (85,0) width 5: " "
-        LayoutButton {BUTTON} at (89.16,1) size 69.42x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 53.42x13
-            LayoutText {#text} at (0,0) size 54x13
-              text run at (0,0) width 54: "lowercase"
-        LayoutText {#text} at (158,0) size 5x18
-          text run at (158,0) width 5: " "
-        LayoutButton {BUTTON} at (162.58,1) size 68.06x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 52.06x13
-            LayoutText {#text} at (0,0) size 53x13
-              text run at (0,0) width 53: "Capitalize"
+        LayoutButton {BUTTON} at (0,1) size 82.44x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 66.44x13
+            LayoutText {#text} at (0,0) size 67x13
+              text run at (0,0) width 67: "UPPERCASE"
+        LayoutText {#text} at (82,0) size 5x18
+          text run at (82,0) width 5: " "
+        LayoutButton {BUTTON} at (86.44,1) size 66.70x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 50.70x13
+            LayoutText {#text} at (0,0) size 51x13
+              text run at (0,0) width 51: "lowercase"
+        LayoutText {#text} at (153,0) size 5x18
+          text run at (153,0) width 5: " "
+        LayoutButton {BUTTON} at (157.14,1) size 65.05x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 49.05x13
+            LayoutText {#text} at (0,0) size 50x13
+              text run at (0,0) width 50: "Capitalize"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,87) size 784x19
-        LayoutButton {INPUT} at (0,1) size 85.16x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 69.16x13
-            LayoutText {#text} at (0,0) size 70x13
-              text run at (0,0) width 70: "UPPERCASE"
-        LayoutText {#text} at (85,0) size 5x18
-          text run at (85,0) width 5: " "
-        LayoutButton {INPUT} at (89.16,1) size 69.42x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 53.42x13
-            LayoutText {#text} at (0,0) size 54x13
-              text run at (0,0) width 54: "lowercase"
-        LayoutText {#text} at (158,0) size 5x18
-          text run at (158,0) width 5: " "
-        LayoutButton {INPUT} at (162.58,1) size 68.06x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 52.06x13
-            LayoutText {#text} at (0,0) size 53x13
-              text run at (0,0) width 53: "Capitalize"
+        LayoutButton {INPUT} at (0,1) size 82.44x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 66.44x13
+            LayoutText {#text} at (0,0) size 67x13
+              text run at (0,0) width 67: "UPPERCASE"
+        LayoutText {#text} at (82,0) size 5x18
+          text run at (82,0) width 5: " "
+        LayoutButton {INPUT} at (86.44,1) size 66.70x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 50.70x13
+            LayoutText {#text} at (0,0) size 51x13
+              text run at (0,0) width 51: "lowercase"
+        LayoutText {#text} at (153,0) size 5x18
+          text run at (153,0) width 5: " "
+        LayoutButton {INPUT} at (157.14,1) size 65.05x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 49.05x13
+            LayoutText {#text} at (0,0) size 50x13
+              text run at (0,0) width 50: "Capitalize"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-white-space-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-white-space-expected.png
index e748ae23..10ea658 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-white-space-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-white-space-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-white-space-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-white-space-expected.txt
index 3ea1dab..4195e86 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-white-space-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button-white-space-expected.txt
@@ -13,51 +13,51 @@
       LayoutBlockFlow {DIV} at (0,52) size 784x18
         LayoutText {#text} at (0,0) size 365x18
           text run at (0,0) width 365: "Buttons should appear next to each other in a single row:"
-      LayoutTable {TABLE} at (0,70) size 189x25
-        LayoutTableSection {TBODY} at (0,0) size 189x25
-          LayoutTableRow {TR} at (0,2) size 189x21
-            LayoutTableCell {TD} at (2,2) size 185x21 [r=0 c=0 rs=1 cs=1]
-              LayoutButton {BUTTON} at (1,2) size 78.33x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-                LayoutBlockFlow (anonymous) at (8,2) size 62.33x13
-                  LayoutText {#text} at (0,0) size 63x13
-                    text run at (0,0) width 63: "Search Mail"
-              LayoutText {#text} at (79,1) size 5x18
-                text run at (79,1) width 5: " "
-              LayoutButton {BUTTON} at (83.33,2) size 100.36x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-                LayoutBlockFlow (anonymous) at (8,2) size 84.36x13
-                  LayoutText {#text} at (0,0) size 85x13
-                    text run at (0,0) width 85: "Search the Web"
+      LayoutTable {TABLE} at (0,70) size 182x25
+        LayoutTableSection {TBODY} at (0,0) size 182x25
+          LayoutTableRow {TR} at (0,2) size 182x21
+            LayoutTableCell {TD} at (2,2) size 178x21 [r=0 c=0 rs=1 cs=1]
+              LayoutButton {BUTTON} at (1,2) size 75.02x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+                LayoutBlockFlow (anonymous) at (8,2) size 59.02x13
+                  LayoutText {#text} at (0,0) size 59x13
+                    text run at (0,0) width 59: "Search Mail"
+              LayoutText {#text} at (76,1) size 5x18
+                text run at (76,1) width 5: " "
+              LayoutButton {BUTTON} at (80.02,2) size 96.14x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+                LayoutBlockFlow (anonymous) at (8,2) size 80.14x13
+                  LayoutText {#text} at (0,0) size 81x13
+                    text run at (0,0) width 81: "Search the Web"
               LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,95) size 784x18
         LayoutText {#text} at (0,0) size 193x18
           text run at (0,0) width 193: "Buttons should look identical:"
       LayoutBlockFlow {DIV} at (0,113) size 784x18
-        LayoutButton {BUTTON} at (0,0) size 73.59x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 57.59x13
-            LayoutText {#text} at (0,0) size 58x13
-              text run at (0,0) width 58: "test button"
+        LayoutButton {BUTTON} at (0,0) size 70.27x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 54.27x13
+            LayoutText {#text} at (0,0) size 55x13
+              text run at (0,0) width 55: "test button"
       LayoutBlockFlow {DIV} at (0,131) size 784x18
-        LayoutButton {BUTTON} at (0,0) size 73.58x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 57.58x13
-            LayoutText {#text} at (0,0) size 58x13
-              text run at (0,0) width 24: "test "
-              text run at (23,0) width 35: "button"
+        LayoutButton {BUTTON} at (0,0) size 70.27x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 54.27x13
+            LayoutText {#text} at (0,0) size 55x13
+              text run at (0,0) width 22: "test "
+              text run at (21,0) width 34: "button"
       LayoutBlockFlow {DIV} at (0,149) size 784x18
         LayoutText {#text} at (0,0) size 353x18
           text run at (0,0) width 353: "Buttons should look identical (ignore vertical spacing):"
       LayoutBlockFlow {DIV} at (0,167) size 784x18
-        LayoutButton {BUTTON} at (0,0) size 90.64x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 74.64x13
-            LayoutText {#text} at (0,0) size 75x13
-              text run at (0,0) width 75: "  test  button  "
+        LayoutButton {BUTTON} at (0,0) size 85.81x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 69.81x13
+            LayoutText {#text} at (0,0) size 70x13
+              text run at (0,0) width 70: "  test  button  "
       LayoutBlockFlow {DIV} at (0,185) size 784x18
-        LayoutButton {BUTTON} at (0,0) size 90.64x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 74.64x13
-            LayoutText {#text} at (0,0) size 75x13
-              text run at (0,0) width 75: "  test  button  "
+        LayoutButton {BUTTON} at (0,0) size 85.81x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 69.81x13
+            LayoutText {#text} at (0,0) size 70x13
+              text run at (0,0) width 70: "  test  button  "
       LayoutBlockFlow {DIV} at (0,216) size 784x18
         LayoutBlockFlow {PRE} at (0,0) size 784x18
-          LayoutButton {BUTTON} at (0,0) size 90.64x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 74.64x13
-              LayoutText {#text} at (0,0) size 75x13
-                text run at (0,0) width 75: "  test  button  "
+          LayoutButton {BUTTON} at (0,0) size 85.81x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 69.81x13
+              LayoutText {#text} at (0,0) size 70x13
+                text run at (0,0) width 70: "  test  button  "
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.png
index 4b4f05f1..ab2589a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.txt
index d6f0e4c..6d9f499 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/button/button-reset-focus-by-mouse-then-keydown-expected.txt
@@ -6,7 +6,7 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [3, 4, 57, 29]
+        [3, 4, 55, 29]
       ],
       "paintInvalidationClients": [
         "LayoutButton BUTTON",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-expected.png
index c0bda3e..3695317 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-minimum-date-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-minimum-date-expected.png
index e068ef1..46888d5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-minimum-date-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-minimum-date-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-required-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-required-expected.png
index 9adfc12..4dd5a7f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-required-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-required-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-ru-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-ru-expected.png
index d6cb56c..3a11be60 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-ru-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-ru-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-step-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-step-expected.png
index 3e0961af..954e6371 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-step-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/calendar-picker-appearance-step-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/month-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/month-picker-appearance-expected.png
index 6c0e960b..718d7dc9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/month-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/month-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/month-picker-appearance-step-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/month-picker-appearance-step-expected.png
index d30a80d7..16cd9a9f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/month-picker-appearance-step-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/month-picker-appearance-step-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/week-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/week-picker-appearance-expected.png
index 60637c0..6482210 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/week-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/week-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/week-picker-appearance-step-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/week-picker-appearance-step-expected.png
index 2a5bb26..c0d25cbc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/week-picker-appearance-step-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/calendar-picker/week-picker-appearance-step-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-appearance-expected.png
index ef52f3c..f20c0932 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-one-row-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-one-row-appearance-expected.png
index d50d9258e..3d278170 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-one-row-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-one-row-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-two-row-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-two-row-appearance-expected.png
index 1e614ab..90adac7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-two-row-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-two-row-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-with-scrollbar-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-with-scrollbar-appearance-expected.png
index 2bba781..43f72f8e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-with-scrollbar-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/color/color-suggestion-picker-with-scrollbar-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-expected.png
index 3193b4044..34c2eb41 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-expected.txt
index a7054a8..9a0a0be5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-expected.txt
@@ -15,29 +15,29 @@
           LayoutBlockFlow (anonymous) at (12,12) size 76x204
             LayoutBlockFlow {DIV} at (0,0) size 74x204 [bgcolor=#008080] [border: (2px solid #800080)]
               LayoutBlockFlow (floating) {DIV} at (52,2) size 20x100 [bgcolor=#006400]
-              LayoutText {#text} at (13,2) size 36x52
-                text run at (13,2) width 28: "short"
-                text run at (10,15) width 34: "words"
+              LayoutText {#text} at (14,2) size 34x52
+                text run at (14,2) width 26: "short"
+                text run at (11,15) width 32: "words"
                 text run at (16,28) width 22: "only"
-                text run at (9,41) width 36: "please"
+                text run at (10,41) width 34: "please"
         LayoutText {#text} at (0,0) size 0x0
       LayoutButton {BUTTON} at (0,134) size 100x50 [bgcolor=#C0C0C0] [border: (2px outset #FFFF00)]
         LayoutBlockFlow (anonymous) at (12,12) size 76x204
           LayoutBlockFlow {DIV} at (0,0) size 74x204 [bgcolor=#008080] [border: (2px solid #800080)]
             LayoutBlockFlow (floating) {DIV} at (52,2) size 20x100 [bgcolor=#006400]
-            LayoutText {#text} at (13,2) size 36x52
-              text run at (13,2) width 28: "short"
-              text run at (10,15) width 34: "words"
+            LayoutText {#text} at (14,2) size 34x52
+              text run at (14,2) width 26: "short"
+              text run at (11,15) width 32: "words"
               text run at (16,28) width 22: "only"
-              text run at (9,41) width 36: "please"
+              text run at (10,41) width 34: "please"
       LayoutBlockFlow {P} at (0,200) size 784x0
 layer at (8,208) size 100x50
   LayoutButton (positioned) {BUTTON} at (8,208) size 100x50 [bgcolor=#C0C0C0] [border: (2px outset #FFFF00)]
     LayoutBlockFlow (anonymous) at (12,12) size 76x204
       LayoutBlockFlow {DIV} at (0,0) size 74x204 [bgcolor=#008080] [border: (2px solid #800080)]
         LayoutBlockFlow (floating) {DIV} at (52,2) size 20x100 [bgcolor=#006400]
-        LayoutText {#text} at (13,2) size 36x52
-          text run at (13,2) width 28: "short"
-          text run at (10,15) width 34: "words"
+        LayoutText {#text} at (14,2) size 34x52
+          text run at (14,2) width 26: "short"
+          text run at (11,15) width 32: "words"
           text run at (16,28) width 22: "only"
-          text run at (9,41) width 36: "please"
+          text run at (10,41) width 34: "please"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-overflow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-overflow-expected.png
index b3091bd..972c7d05 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-overflow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-overflow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-overflow-expected.txt
index ae9d9a5..7d5fe75 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-overflow-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-clip-overflow-expected.txt
@@ -24,13 +24,13 @@
   LayoutBlockFlow {DIV} at (0,86) size 100x50
     LayoutMenuList {SELECT} at (0,0) size 80x18 [bgcolor=#F8F8F8]
       LayoutBlockFlow (anonymous) at (0,0) size 80x18
-        LayoutText (anonymous) at (8,2) size 145x13
-          text run at (8,2) width 145: "Lorem ipsum dolor sit amet"
+        LayoutText (anonymous) at (8,2) size 138x13
+          text run at (8,2) width 138: "Lorem ipsum dolor sit amet"
     LayoutText {#text} at (0,0) size 0x0
-layer at (8,164) size 100x50 clip at (8,164) size 100x35 scrollWidth 153
+layer at (8,164) size 100x50 clip at (8,164) size 100x35 scrollWidth 145
   LayoutBlockFlow {DIV} at (0,156) size 100x50
     LayoutButton {BUTTON} at (0,0) size 80x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
       LayoutBlockFlow (anonymous) at (8,2) size 64x13
-        LayoutText {#text} at (0,0) size 145x13
-          text run at (0,0) width 145: "Lorem ipsum dolor sit amet"
+        LayoutText {#text} at (0,0) size 138x13
+          text run at (0,0) width 138: "Lorem ipsum dolor sit amet"
     LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.png
index 511c419..0f947d1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt
index 5071eca..5d54a107 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/control-restrict-line-height-expected.txt
@@ -6,28 +6,28 @@
       LayoutText {#text} at (0,0) size 533x18
         text run at (0,0) width 533: "This tests that we don't honor line-height for controls that have restricted font size. "
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutMenuList {SELECT} at (0,19) size 303x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 303x18
-          LayoutText (anonymous) at (8,2) size 272x13
-            text run at (8,2) width 272: "This text should be centered vertically in the button"
-      LayoutText {#text} at (303,18) size 4x18
-        text run at (303,18) width 4: " "
+      LayoutMenuList {SELECT} at (0,19) size 287x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 287x18
+          LayoutText (anonymous) at (8,2) size 256x13
+            text run at (8,2) width 256: "This text should be centered vertically in the button"
+      LayoutText {#text} at (287,18) size 4x18
+        text run at (287,18) width 4: " "
       LayoutBR {BR} at (0,0) size 0x0
-      LayoutButton {INPUT} at (0,38) size 287.52x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 271.52x13
-          LayoutText {#text} at (0,0) size 272x13
-            text run at (0,0) width 272: "This text should be centered vertically in the button"
-      LayoutText {#text} at (287,37) size 5x18
-        text run at (287,37) width 5: " "
+      LayoutButton {INPUT} at (0,38) size 271.52x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 255.52x13
+          LayoutText {#text} at (0,0) size 256x13
+            text run at (0,0) width 256: "This text should be centered vertically in the button"
+      LayoutText {#text} at (271,37) size 5x18
+        text run at (271,37) width 5: " "
       LayoutBR {BR} at (0,0) size 0x0
       LayoutTextControl {INPUT} at (0,56) size 133x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutFlexibleBox {DIV} at (4,3) size 125x13
           LayoutBlockFlow {DIV} at (0,6.50) size 5x0
           LayoutBlockFlow {DIV} at (5,0) size 108x13
       LayoutText {#text} at (0,0) size 0x0
-layer at (17,67) size 108x13 scrollWidth 272
+layer at (17,67) size 108x13 scrollWidth 256
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 272x13
-      text run at (0,0) width 272: "This text should be centered vertically in the button"
+    LayoutText {#text} at (0,0) size 256x13
+      text run at (0,0) width 256: "This text should be centered vertically in the button"
 layer at (126,68) size 11x11 transparent
   LayoutBlockFlow {DIV} at (114,1) size 11x11
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/disabled-select-change-index-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/disabled-select-change-index-expected.png
index d8c7d40..b1177e7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/disabled-select-change-index-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/disabled-select-change-index-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/disabled-select-change-index-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/disabled-select-change-index-expected.txt
index 207fa157..51bbada 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/disabled-select-change-index-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/disabled-select-change-index-expected.txt
@@ -3,30 +3,30 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,0) size 62x18 [color=#808080] [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 62x18
-          LayoutText (anonymous) at (8,2) size 31x13
-            text run at (8,2) width 31: "PASS"
-      LayoutBR {BR} at (62,13) size 0x0
-      LayoutMenuList {SELECT} at (0,18) size 62x18 [color=#808080] [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 62x18
-          LayoutText (anonymous) at (8,2) size 31x13
-            text run at (8,2) width 31: "PASS"
-      LayoutBR {BR} at (62,31) size 0x0
-      LayoutMenuList {SELECT} at (0,36) size 62x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 62x18
-          LayoutText (anonymous) at (8,2) size 31x13
-            text run at (8,2) width 31: "PASS"
-      LayoutBR {BR} at (62,49) size 0x0
-      LayoutMenuList {SELECT} at (0,54) size 62x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 62x18
-          LayoutText (anonymous) at (8,2) size 31x13
-            text run at (8,2) width 31: "PASS"
-      LayoutBR {BR} at (62,67) size 0x0
-      LayoutBR {BR} at (47,98) size 1x0
-      LayoutBR {BR} at (47,128) size 1x0
-      LayoutBR {BR} at (47,158) size 1x0
-      LayoutBR {BR} at (47,188) size 1x0
+      LayoutMenuList {SELECT} at (0,0) size 60x18 [color=#808080] [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 60x18
+          LayoutText (anonymous) at (8,2) size 29x13
+            text run at (8,2) width 29: "PASS"
+      LayoutBR {BR} at (60,13) size 0x0
+      LayoutMenuList {SELECT} at (0,18) size 60x18 [color=#808080] [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 60x18
+          LayoutText (anonymous) at (8,2) size 29x13
+            text run at (8,2) width 29: "PASS"
+      LayoutBR {BR} at (60,31) size 0x0
+      LayoutMenuList {SELECT} at (0,36) size 60x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 60x18
+          LayoutText (anonymous) at (8,2) size 29x13
+            text run at (8,2) width 29: "PASS"
+      LayoutBR {BR} at (60,49) size 0x0
+      LayoutMenuList {SELECT} at (0,54) size 60x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 60x18
+          LayoutText (anonymous) at (8,2) size 29x13
+            text run at (8,2) width 29: "PASS"
+      LayoutBR {BR} at (60,67) size 0x0
+      LayoutBR {BR} at (45,98) size 1x0
+      LayoutBR {BR} at (45,128) size 1x0
+      LayoutBR {BR} at (45,158) size 1x0
+      LayoutBR {BR} at (45,188) size 1x0
       LayoutText {#text} at (0,192) size 497x18
         text run at (0,192) width 497: "PASS: sel1 correctly set to selectedIndex 1 by sel1.options[1].selected = true."
       LayoutBR {BR} at (496,206) size 1x0
@@ -51,35 +51,35 @@
       LayoutText {#text} at (0,318) size 447x18
         text run at (0,318) width 447: "PASS: sel8 correctly set to selectedIndex 1 by sel8.selectedIndex = 1."
       LayoutBR {BR} at (446,332) size 1x0
-layer at (8,80) size 47x30 clip at (9,81) size 34x28
-  LayoutListBox {SELECT} at (0,71.63) size 47.19x30.38 [color=#7F7F7F] [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 34.19x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "FAIL"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 34.19x14.19 [color=#808080] [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 31x13
-        text run at (2,0) width 31: "PASS"
-layer at (8,110) size 47x30 clip at (9,111) size 34x28
-  LayoutListBox {SELECT} at (0,101.63) size 47.19x30.38 [color=#7F7F7F] [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 34.19x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "FAIL"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 34.19x14.19 [color=#808080] [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 31x13
-        text run at (2,0) width 31: "PASS"
-layer at (8,140) size 47x30 clip at (9,141) size 34x28
-  LayoutListBox {SELECT} at (0,131.63) size 47.19x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 34.19x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "FAIL"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 34.19x14.19 [color=#808080] [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 31x13
-        text run at (2,0) width 31: "PASS"
-layer at (8,170) size 47x30 clip at (9,171) size 34x28
-  LayoutListBox {SELECT} at (0,161.63) size 47.19x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 34.19x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "FAIL"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 34.19x14.19 [color=#808080] [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 31x13
-        text run at (2,0) width 31: "PASS"
+layer at (8,80) size 46x30 clip at (9,81) size 33x28
+  LayoutListBox {SELECT} at (0,71.63) size 45.98x30.38 [color=#7F7F7F] [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 32.98x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "FAIL"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 32.98x14.19 [color=#808080] [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "PASS"
+layer at (8,110) size 46x30 clip at (9,111) size 33x28
+  LayoutListBox {SELECT} at (0,101.63) size 45.98x30.38 [color=#7F7F7F] [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 32.98x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "FAIL"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 32.98x14.19 [color=#808080] [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "PASS"
+layer at (8,140) size 46x30 clip at (9,141) size 33x28
+  LayoutListBox {SELECT} at (0,131.63) size 45.98x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 32.98x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "FAIL"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 32.98x14.19 [color=#808080] [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "PASS"
+layer at (8,170) size 46x30 clip at (9,171) size 33x28
+  LayoutListBox {SELECT} at (0,161.63) size 45.98x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 32.98x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "FAIL"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 32.98x14.19 [color=#808080] [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "PASS"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-direction-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-direction-expected.png
index 0ee82a8..cf6a51c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-direction-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-direction-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-direction-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-direction-expected.txt
index f9f06deb..e981d59 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-direction-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-direction-expected.txt
@@ -1,101 +1,101 @@
-layer at (0,0) size 800x600 scrollWidth 1010
+layer at (0,0) size 800x600 scrollWidth 970
   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
-      LayoutTable {TABLE} at (0,0) size 1002x96
-        LayoutTableSection {TBODY} at (0,0) size 1002x96
-          LayoutTableRow {TR} at (0,2) size 1002x20
+      LayoutTable {TABLE} at (0,0) size 962x96
+        LayoutTableSection {TBODY} at (0,0) size 962x96
+          LayoutTableRow {TR} at (0,2) size 962x20
             LayoutTableCell {TH} at (2,11) size 86x2 [r=0 c=0 rs=1 cs=1]
-            LayoutTableCell {TH} at (90,11) size 226x2 [r=0 c=1 rs=1 cs=1]
-            LayoutTableCell {TH} at (318,2) size 226x20 [r=0 c=2 rs=1 cs=1]
-              LayoutText {#text} at (66,1) size 94x18
-                text run at (66,1) width 94: "text-align:left"
-            LayoutTableCell {TH} at (546,2) size 226x20 [r=0 c=3 rs=1 cs=1]
-              LayoutText {#text} at (56,1) size 114x18
-                text run at (56,1) width 114: "text-align:center"
-            LayoutTableCell {TH} at (774,2) size 226x20 [r=0 c=4 rs=1 cs=1]
-              LayoutText {#text} at (61,1) size 104x18
-                text run at (61,1) width 104: "text-align:right"
-          LayoutTableRow {TR} at (0,24) size 1002x22
+            LayoutTableCell {TH} at (90,11) size 216x2 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TH} at (308,2) size 216x20 [r=0 c=2 rs=1 cs=1]
+              LayoutText {#text} at (61,1) size 94x18
+                text run at (61,1) width 94: "text-align:left"
+            LayoutTableCell {TH} at (526,2) size 216x20 [r=0 c=3 rs=1 cs=1]
+              LayoutText {#text} at (51,1) size 114x18
+                text run at (51,1) width 114: "text-align:center"
+            LayoutTableCell {TH} at (744,2) size 216x20 [r=0 c=4 rs=1 cs=1]
+              LayoutText {#text} at (56,1) size 104x18
+                text run at (56,1) width 104: "text-align:right"
+          LayoutTableRow {TR} at (0,24) size 962x22
             LayoutTableCell {TH} at (2,34) size 86x2 [r=1 c=0 rs=1 cs=1]
-            LayoutTableCell {TD} at (90,24) size 226x22 [border: (1px solid #000000)] [r=1 c=1 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (318,24) size 226x22 [border: (1px solid #000000)] [r=1 c=2 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (546,24) size 226x22 [border: (1px solid #000000)] [r=1 c=3 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (774,24) size 226x22 [border: (1px solid #000000)] [r=1 c=4 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-          LayoutTableRow {TR} at (0,48) size 1002x22
+            LayoutTableCell {TD} at (90,24) size 216x22 [border: (1px solid #000000)] [r=1 c=1 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (308,24) size 216x22 [border: (1px solid #000000)] [r=1 c=2 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (526,24) size 216x22 [border: (1px solid #000000)] [r=1 c=3 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (744,24) size 216x22 [border: (1px solid #000000)] [r=1 c=4 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+          LayoutTableRow {TR} at (0,48) size 962x22
             LayoutTableCell {TH} at (2,49) size 86x20 [r=2 c=0 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 84x18
                 text run at (1,1) width 84: "direction:ltr"
-            LayoutTableCell {TD} at (90,48) size 226x22 [border: (1px solid #000000)] [r=2 c=1 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (318,48) size 226x22 [border: (1px solid #000000)] [r=2 c=2 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (546,48) size 226x22 [border: (1px solid #000000)] [r=2 c=3 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (774,48) size 226x22 [border: (1px solid #000000)] [r=2 c=4 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-          LayoutTableRow {TR} at (0,72) size 1002x22
+            LayoutTableCell {TD} at (90,48) size 216x22 [border: (1px solid #000000)] [r=2 c=1 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (308,48) size 216x22 [border: (1px solid #000000)] [r=2 c=2 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (526,48) size 216x22 [border: (1px solid #000000)] [r=2 c=3 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (744,48) size 216x22 [border: (1px solid #000000)] [r=2 c=4 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+          LayoutTableRow {TR} at (0,72) size 962x22
             LayoutTableCell {TH} at (2,73) size 86x20 [r=3 c=0 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 84x18
                 text run at (1,1) width 84: "direction:rtl"
-            LayoutTableCell {TD} at (90,72) size 226x22 [border: (1px solid #000000)] [r=3 c=1 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (143.47,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (318,72) size 226x22 [border: (1px solid #000000)] [r=3 c=2 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (143.47,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (546,72) size 226x22 [border: (1px solid #000000)] [r=3 c=3 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (143.47,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (774,72) size 226x22 [border: (1px solid #000000)] [r=3 c=4 rs=1 cs=1]
-              LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                LayoutButton {INPUT} at (143.47,0) size 78.53x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                    LayoutText {#text} at (0,0) size 63x13
-                      text run at (0,0) width 63: "Choose File"
+            LayoutTableCell {TD} at (90,72) size 216x22 [border: (1px solid #000000)] [r=3 c=1 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (136.78,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (308,72) size 216x22 [border: (1px solid #000000)] [r=3 c=2 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (136.78,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (526,72) size 216x22 [border: (1px solid #000000)] [r=3 c=3 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (136.78,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (744,72) size 216x22 [border: (1px solid #000000)] [r=3 c=4 rs=1 cs=1]
+              LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                LayoutButton {INPUT} at (136.78,0) size 75.22x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                    LayoutText {#text} at (0,0) size 60x13
+                      text run at (0,0) width 60: "Choose File"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-disabled-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-disabled-expected.png
index 07d1baf..1545cd8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-disabled-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-disabled-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-disabled-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-disabled-expected.txt
index 8aaca95..8569bfc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-disabled-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-disabled-expected.txt
@@ -13,10 +13,10 @@
           LayoutBR {BR} at (0,19) size 0x18
           LayoutText {#text} at (0,37) size 89x18
             text run at (0,37) width 89: "  Select File:  "
-          LayoutFileUploadControl {INPUT} at (88.42,38) size 222x18 "No file chosen" [color=#545454]
-            LayoutButton {INPUT} at (0,0) size 78.53x18 [color=#7F7F7F] [bgcolor=#C0C0C0]
-              LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                LayoutText {#text} at (0,0) size 63x13
-                  text run at (0,0) width 63: "Choose File"
-          LayoutBR {BR} at (310,51) size 1x0
+          LayoutFileUploadControl {INPUT} at (88.42,38) size 212x18 "No file chosen" [color=#545454]
+            LayoutButton {INPUT} at (0,0) size 75.22x18 [color=#7F7F7F] [bgcolor=#C0C0C0]
+              LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                LayoutText {#text} at (0,0) size 60x13
+                  text run at (0,0) width 60: "Choose File"
+          LayoutBR {BR} at (300,51) size 1x0
         LayoutTable {TABLE} at (0,56) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-pressed-state-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-pressed-state-expected.png
index 3e0cea9..b2e85e15 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-pressed-state-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/file-input-pressed-state-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/input-file-re-render-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/input-file-re-render-expected.png
index 5857eb4..64b04361 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/input-file-re-render-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/input-file-re-render-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/input-file-re-render-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/input-file-re-render-expected.txt
index 63f9cd0..516f47e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/input-file-re-render-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/file/input-file-re-render-expected.txt
@@ -4,11 +4,11 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x77
     LayoutBlockFlow {BODY} at (8,8) size 784x53
       LayoutBlockFlow {FORM} at (0,0) size 784x19
-        LayoutFileUploadControl {INPUT} at (0,1) size 222x18 "2 files"
-          LayoutButton {INPUT} at (0,0) size 84.42x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 68.42x13
-              LayoutText {#text} at (0,0) size 69x13
-                text run at (0,0) width 69: "Choose Files"
+        LayoutFileUploadControl {INPUT} at (0,1) size 212x18 "2 files"
+          LayoutButton {INPUT} at (0,0) size 80.80x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 64.80x13
+              LayoutText {#text} at (0,0) size 65x13
+                text run at (0,0) width 65: "Choose Files"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,35) size 784x18
         LayoutText {#text} at (0,0) size 451x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/floating-textfield-relayout-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/floating-textfield-relayout-expected.png
index 3aa39da..4770196 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/floating-textfield-relayout-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/floating-textfield-relayout-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/floating-textfield-relayout-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/floating-textfield-relayout-expected.txt
index 89e89a0..916b813 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/floating-textfield-relayout-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/floating-textfield-relayout-expected.txt
@@ -22,5 +22,5 @@
     LayoutTextControl (floating) {INPUT} at (0,0) size 392x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
 layer at (11,73) size 386x13
   LayoutBlockFlow {DIV} at (3,3) size 386x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-added-to-table-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-added-to-table-expected.png
index 17325fb6..9ff3a61 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-added-to-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-added-to-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.png
index fbfd6c1..6011480 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.txt
index 48a481c..7476312 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/form-element-geometry-expected.txt
@@ -12,158 +12,158 @@
       LayoutBlockFlow {H2} at (0,96.34) size 784x28
         LayoutText {#text} at (0,0) size 167x28
           text run at (0,0) width 167: "Bounding Boxes"
-      LayoutTable {TABLE} at (0,144.25) size 170x28
-        LayoutTableSection {TBODY} at (0,0) size 170x28
-          LayoutTableRow {TR} at (0,2) size 170x24
-            LayoutTableCell {TD} at (2,2) size 57x24 [r=0 c=0 rs=1 cs=1]
-              LayoutBlockFlow {DIV} at (1,1) size 55x22 [border: (2px solid #0000FF)]
-                LayoutInline {FONT} at (0,0) size 51x28
-                  LayoutButton {INPUT} at (2,2) size 50.34x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 34.34x13
-                      LayoutText {#text} at (0,0) size 35x13
-                        text run at (0,0) width 35: "button"
-            LayoutTableCell {TD} at (61,2) size 67x24 [r=0 c=1 rs=1 cs=1]
-              LayoutBlockFlow {DIV} at (1,1) size 65x22 [border: (2px solid #0000FF)]
-                LayoutInline {FONT} at (0,0) size 61x28
-                  LayoutMenuList {SELECT} at (2,2) size 61x18 [bgcolor=#F8F8F8]
-                    LayoutBlockFlow (anonymous) at (0,0) size 61x18
-                      LayoutText (anonymous) at (8,2) size 30x13
-                        text run at (8,2) width 30: "menu"
-            LayoutTableCell {TD} at (130,4) size 18x19 [r=0 c=2 rs=1 cs=1]
+      LayoutTable {TABLE} at (0,144.25) size 166x28
+        LayoutTableSection {TBODY} at (0,0) size 166x28
+          LayoutTableRow {TR} at (0,2) size 166x24
+            LayoutTableCell {TD} at (2,2) size 55x24 [r=0 c=0 rs=1 cs=1]
+              LayoutBlockFlow {DIV} at (1,1) size 53x22 [border: (2px solid #0000FF)]
+                LayoutInline {FONT} at (0,0) size 49x28
+                  LayoutButton {INPUT} at (2,2) size 48.53x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 32.53x13
+                      LayoutText {#text} at (0,0) size 33x13
+                        text run at (0,0) width 33: "button"
+            LayoutTableCell {TD} at (59,2) size 65x24 [r=0 c=1 rs=1 cs=1]
+              LayoutBlockFlow {DIV} at (1,1) size 63x22 [border: (2px solid #0000FF)]
+                LayoutInline {FONT} at (0,0) size 59x28
+                  LayoutMenuList {SELECT} at (2,2) size 59x18 [bgcolor=#F8F8F8]
+                    LayoutBlockFlow (anonymous) at (0,0) size 59x18
+                      LayoutText (anonymous) at (8,2) size 28x13
+                        text run at (8,2) width 28: "menu"
+            LayoutTableCell {TD} at (126,4) size 18x19 [r=0 c=2 rs=1 cs=1]
               LayoutBlockFlow {DIV} at (1,1) size 16x17 [border: (2px solid #0000FF)]
                 LayoutInline {FONT} at (0,0) size 12x28
                   LayoutBlockFlow {INPUT} at (2,2) size 12x13
-            LayoutTableCell {TD} at (150,5) size 18x18 [r=0 c=3 rs=1 cs=1]
+            LayoutTableCell {TD} at (146,5) size 18x18 [r=0 c=3 rs=1 cs=1]
               LayoutBlockFlow {DIV} at (1,1) size 16x16 [border: (2px solid #0000FF)]
                 LayoutInline {FONT} at (0,0) size 12x28
                   LayoutBlockFlow {INPUT} at (2,2) size 12x12
-      LayoutTable {TABLE} at (0,172.25) size 170x28
-        LayoutTableSection {TBODY} at (0,0) size 170x28
-          LayoutTableRow {TR} at (0,2) size 170x24
-            LayoutTableCell {TD} at (2,2) size 57x24 [r=0 c=0 rs=1 cs=1]
-              LayoutBlockFlow {DIV} at (1,1) size 55x22 [border: (2px solid #0000FF)]
-                LayoutButton {INPUT} at (2,2) size 50.34x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 34.34x13
-                    LayoutText {#text} at (0,0) size 35x13
-                      text run at (0,0) width 35: "button"
-            LayoutTableCell {TD} at (61,2) size 67x24 [r=0 c=1 rs=1 cs=1]
-              LayoutBlockFlow {DIV} at (1,1) size 65x22 [border: (2px solid #0000FF)]
-                LayoutMenuList {SELECT} at (2,2) size 61x18 [bgcolor=#F8F8F8]
-                  LayoutBlockFlow (anonymous) at (0,0) size 61x18
-                    LayoutText (anonymous) at (8,2) size 30x13
-                      text run at (8,2) width 30: "menu"
-            LayoutTableCell {TD} at (130,4) size 18x19 [r=0 c=2 rs=1 cs=1]
+      LayoutTable {TABLE} at (0,172.25) size 166x28
+        LayoutTableSection {TBODY} at (0,0) size 166x28
+          LayoutTableRow {TR} at (0,2) size 166x24
+            LayoutTableCell {TD} at (2,2) size 55x24 [r=0 c=0 rs=1 cs=1]
+              LayoutBlockFlow {DIV} at (1,1) size 53x22 [border: (2px solid #0000FF)]
+                LayoutButton {INPUT} at (2,2) size 48.53x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 32.53x13
+                    LayoutText {#text} at (0,0) size 33x13
+                      text run at (0,0) width 33: "button"
+            LayoutTableCell {TD} at (59,2) size 65x24 [r=0 c=1 rs=1 cs=1]
+              LayoutBlockFlow {DIV} at (1,1) size 63x22 [border: (2px solid #0000FF)]
+                LayoutMenuList {SELECT} at (2,2) size 59x18 [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 59x18
+                    LayoutText (anonymous) at (8,2) size 28x13
+                      text run at (8,2) width 28: "menu"
+            LayoutTableCell {TD} at (126,4) size 18x19 [r=0 c=2 rs=1 cs=1]
               LayoutBlockFlow {DIV} at (1,1) size 16x17 [border: (2px solid #0000FF)]
                 LayoutBlockFlow {INPUT} at (2,2) size 12x13
-            LayoutTableCell {TD} at (150,5) size 18x18 [r=0 c=3 rs=1 cs=1]
+            LayoutTableCell {TD} at (146,5) size 18x18 [r=0 c=3 rs=1 cs=1]
               LayoutBlockFlow {DIV} at (1,1) size 16x16 [border: (2px solid #0000FF)]
                 LayoutBlockFlow {INPUT} at (2,2) size 12x12
-      LayoutTable {TABLE} at (0,200.25) size 170x28
-        LayoutTableSection {TBODY} at (0,0) size 170x28
-          LayoutTableRow {TR} at (0,2) size 170x24
-            LayoutTableCell {TD} at (2,2) size 57x24 [r=0 c=0 rs=1 cs=1]
-              LayoutBlockFlow {DIV} at (1,1) size 55x22 [border: (2px solid #0000FF)]
-                LayoutInline {FONT} at (0,0) size 51x13
-                  LayoutButton {INPUT} at (2,2) size 50.34x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 34.34x13
-                      LayoutText {#text} at (0,0) size 35x13
-                        text run at (0,0) width 35: "button"
-            LayoutTableCell {TD} at (61,2) size 67x24 [r=0 c=1 rs=1 cs=1]
-              LayoutBlockFlow {DIV} at (1,1) size 65x22 [border: (2px solid #0000FF)]
-                LayoutInline {FONT} at (0,0) size 61x13
-                  LayoutMenuList {SELECT} at (2,2) size 61x18 [bgcolor=#F8F8F8]
-                    LayoutBlockFlow (anonymous) at (0,0) size 61x18
-                      LayoutText (anonymous) at (8,2) size 30x13
-                        text run at (8,2) width 30: "menu"
-            LayoutTableCell {TD} at (130,4) size 18x19 [r=0 c=2 rs=1 cs=1]
+      LayoutTable {TABLE} at (0,200.25) size 166x28
+        LayoutTableSection {TBODY} at (0,0) size 166x28
+          LayoutTableRow {TR} at (0,2) size 166x24
+            LayoutTableCell {TD} at (2,2) size 55x24 [r=0 c=0 rs=1 cs=1]
+              LayoutBlockFlow {DIV} at (1,1) size 53x22 [border: (2px solid #0000FF)]
+                LayoutInline {FONT} at (0,0) size 49x13
+                  LayoutButton {INPUT} at (2,2) size 48.53x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 32.53x13
+                      LayoutText {#text} at (0,0) size 33x13
+                        text run at (0,0) width 33: "button"
+            LayoutTableCell {TD} at (59,2) size 65x24 [r=0 c=1 rs=1 cs=1]
+              LayoutBlockFlow {DIV} at (1,1) size 63x22 [border: (2px solid #0000FF)]
+                LayoutInline {FONT} at (0,0) size 59x13
+                  LayoutMenuList {SELECT} at (2,2) size 59x18 [bgcolor=#F8F8F8]
+                    LayoutBlockFlow (anonymous) at (0,0) size 59x18
+                      LayoutText (anonymous) at (8,2) size 28x13
+                        text run at (8,2) width 28: "menu"
+            LayoutTableCell {TD} at (126,4) size 18x19 [r=0 c=2 rs=1 cs=1]
               LayoutBlockFlow {DIV} at (1,1) size 16x17 [border: (2px solid #0000FF)]
                 LayoutInline {FONT} at (0,0) size 12x13
                   LayoutBlockFlow {INPUT} at (2,2) size 12x13
-            LayoutTableCell {TD} at (150,5) size 18x18 [r=0 c=3 rs=1 cs=1]
+            LayoutTableCell {TD} at (146,5) size 18x18 [r=0 c=3 rs=1 cs=1]
               LayoutBlockFlow {DIV} at (1,1) size 16x16 [border: (2px solid #0000FF)]
                 LayoutInline {FONT} at (0,0) size 12x13
                   LayoutBlockFlow {INPUT} at (2,2) size 12x12
-      LayoutTable {TABLE} at (0,228.25) size 501x68
-        LayoutTableSection {TBODY} at (0,0) size 501x68
-          LayoutTableRow {TR} at (0,2) size 501x64
+      LayoutTable {TABLE} at (0,228.25) size 490x68
+        LayoutTableSection {TBODY} at (0,0) size 490x68
+          LayoutTableRow {TR} at (0,2) size 490x64
             LayoutTableCell {TD} at (2,2) size 77x25 [r=0 c=0 rs=1 cs=1]
               LayoutBlockFlow {DIV} at (1,1) size 75x23 [border: (2px solid #0000FF)]
                 LayoutTextControl {INPUT} at (2,2) size 71x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-            LayoutTableCell {TD} at (81,2) size 39x64 [r=0 c=1 rs=1 cs=1]
-              LayoutBlockFlow {DIV} at (1,1) size 37x62 [border: (2px solid #0000FF)]
-            LayoutTableCell {TD} at (122,2) size 228x24 [r=0 c=2 rs=1 cs=1]
-              LayoutBlockFlow {DIV} at (1,1) size 226x22 [border: (2px solid #0000FF)]
-                LayoutFileUploadControl {INPUT} at (2,2) size 222x18 "No file chosen"
-                  LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                      LayoutText {#text} at (0,0) size 63x13
-                        text run at (0,0) width 63: "Choose File"
-            LayoutTableCell {TD} at (352,2) size 147x38 [r=0 c=3 rs=1 cs=1]
+            LayoutTableCell {TD} at (81,2) size 38x64 [r=0 c=1 rs=1 cs=1]
+              LayoutBlockFlow {DIV} at (1,1) size 36x62 [border: (2px solid #0000FF)]
+            LayoutTableCell {TD} at (121,2) size 218x24 [r=0 c=2 rs=1 cs=1]
+              LayoutBlockFlow {DIV} at (1,1) size 216x22 [border: (2px solid #0000FF)]
+                LayoutFileUploadControl {INPUT} at (2,2) size 212x18 "No file chosen"
+                  LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                      LayoutText {#text} at (0,0) size 60x13
+                        text run at (0,0) width 60: "Choose File"
+            LayoutTableCell {TD} at (341,2) size 147x38 [r=0 c=3 rs=1 cs=1]
               LayoutBlockFlow {DIV} at (1,1) size 145x36 [border: (2px solid #0000FF)]
       LayoutBlockFlow {H2} at (0,316.16) size 784x28
         LayoutText {#text} at (0,0) size 200x28
           text run at (0,0) width 200: "Baseline Alignment"
       LayoutBlockFlow {DIV} at (0,364.06) size 784x28
-        LayoutInline {FONT} at (0,0) size 207x28
+        LayoutInline {FONT} at (0,0) size 204x28
           LayoutText {#text} at (0,0) size 42x28
             text run at (0,0) width 42: "text "
-          LayoutButton {INPUT} at (41.98,9) size 50.34x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 34.34x13
-              LayoutText {#text} at (0,0) size 35x13
-                text run at (0,0) width 35: "button"
-          LayoutText {#text} at (92,0) size 7x28
-            text run at (92,0) width 7: " "
-          LayoutMenuList {SELECT} at (98.33,9) size 61x18 [bgcolor=#F8F8F8]
-            LayoutBlockFlow (anonymous) at (0,0) size 61x18
-              LayoutText (anonymous) at (8,2) size 30x13
-                text run at (8,2) width 30: "menu"
-          LayoutText {#text} at (159,0) size 7x28
-            text run at (159,0) width 7: " "
-          LayoutBlockFlow {INPUT} at (168.20,11) size 12x13
-          LayoutText {#text} at (183,0) size 7x28
-            text run at (183,0) width 7: " "
-          LayoutBlockFlow {INPUT} at (191.95,12) size 12x12
+          LayoutButton {INPUT} at (41.98,9) size 48.53x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 32.53x13
+              LayoutText {#text} at (0,0) size 33x13
+                text run at (0,0) width 33: "button"
+          LayoutText {#text} at (90,0) size 7x28
+            text run at (90,0) width 7: " "
+          LayoutMenuList {SELECT} at (96.52,9) size 59x18 [bgcolor=#F8F8F8]
+            LayoutBlockFlow (anonymous) at (0,0) size 59x18
+              LayoutText (anonymous) at (8,2) size 28x13
+                text run at (8,2) width 28: "menu"
+          LayoutText {#text} at (155,0) size 7x28
+            text run at (155,0) width 7: " "
+          LayoutBlockFlow {INPUT} at (164.39,11) size 12x13
+          LayoutText {#text} at (179,0) size 7x28
+            text run at (179,0) width 7: " "
+          LayoutBlockFlow {INPUT} at (188.14,12) size 12x12
           LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,392.06) size 784x19
         LayoutText {#text} at (0,0) size 28x18
           text run at (0,0) width 28: "text "
-        LayoutButton {INPUT} at (27.98,1) size 50.34x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 34.34x13
-            LayoutText {#text} at (0,0) size 35x13
-              text run at (0,0) width 35: "button"
-        LayoutText {#text} at (78,0) size 5x18
-          text run at (78,0) width 5: " "
-        LayoutMenuList {SELECT} at (82.33,1) size 61x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 61x18
-            LayoutText (anonymous) at (8,2) size 30x13
-              text run at (8,2) width 30: "menu"
-        LayoutText {#text} at (143,0) size 5x18
-          text run at (143,0) width 5: " "
-        LayoutBlockFlow {INPUT} at (150.20,3) size 12x13
-        LayoutText {#text} at (165,0) size 5x18
-          text run at (165,0) width 5: " "
-        LayoutBlockFlow {INPUT} at (171.95,4) size 12x12
+        LayoutButton {INPUT} at (27.98,1) size 48.53x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 32.53x13
+            LayoutText {#text} at (0,0) size 33x13
+              text run at (0,0) width 33: "button"
+        LayoutText {#text} at (76,0) size 5x18
+          text run at (76,0) width 5: " "
+        LayoutMenuList {SELECT} at (80.52,1) size 59x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 59x18
+            LayoutText (anonymous) at (8,2) size 28x13
+              text run at (8,2) width 28: "menu"
+        LayoutText {#text} at (139,0) size 5x18
+          text run at (139,0) width 5: " "
+        LayoutBlockFlow {INPUT} at (146.39,3) size 12x13
+        LayoutText {#text} at (161,0) size 5x18
+          text run at (161,0) width 5: " "
+        LayoutBlockFlow {INPUT} at (168.14,4) size 12x12
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,411.06) size 784x19
-        LayoutInline {FONT} at (0,0) size 172x13
+        LayoutInline {FONT} at (0,0) size 169x13
           LayoutText {#text} at (0,4) size 18x13
             text run at (0,4) width 18: "text "
-          LayoutButton {INPUT} at (17.48,1) size 50.34x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 34.34x13
-              LayoutText {#text} at (0,0) size 35x13
-                text run at (0,0) width 35: "button"
-          LayoutText {#text} at (67,4) size 4x13
-            text run at (67,4) width 4: " "
-          LayoutMenuList {SELECT} at (70.33,1) size 61x18 [bgcolor=#F8F8F8]
-            LayoutBlockFlow (anonymous) at (0,0) size 61x18
-              LayoutText (anonymous) at (8,2) size 30x13
-                text run at (8,2) width 30: "menu"
-          LayoutText {#text} at (131,4) size 3x13
-            text run at (131,4) width 3: " "
-          LayoutBlockFlow {INPUT} at (136.70,3) size 12x13
-          LayoutText {#text} at (151,4) size 4x13
-            text run at (151,4) width 4: " "
-          LayoutBlockFlow {INPUT} at (156.95,4) size 12x12
+          LayoutButton {INPUT} at (17.48,1) size 48.53x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 32.53x13
+              LayoutText {#text} at (0,0) size 33x13
+                text run at (0,0) width 33: "button"
+          LayoutText {#text} at (66,4) size 3x13
+            text run at (66,4) width 3: " "
+          LayoutMenuList {SELECT} at (68.52,1) size 59x18 [bgcolor=#F8F8F8]
+            LayoutBlockFlow (anonymous) at (0,0) size 59x18
+              LayoutText (anonymous) at (8,2) size 28x13
+                text run at (8,2) width 28: "menu"
+          LayoutText {#text} at (127,4) size 4x13
+            text run at (127,4) width 4: " "
+          LayoutBlockFlow {INPUT} at (132.89,3) size 12x13
+          LayoutText {#text} at (147,4) size 4x13
+            text run at (147,4) width 4: " "
+          LayoutBlockFlow {INPUT} at (153.14,4) size 12x12
           LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,430.06) size 784x37
         LayoutText {#text} at (0,18) size 28x18
@@ -171,19 +171,19 @@
         LayoutTextControl {INPUT} at (27.98,18) size 71x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (98,18) size 5x18
           text run at (98,18) width 5: " "
-        LayoutFileUploadControl {INPUT} at (102.98,19) size 222x18 "No file chosen"
-          LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-              LayoutText {#text} at (0,0) size 63x13
-                text run at (0,0) width 63: "Choose File"
-        LayoutText {#text} at (324,18) size 5x18
-          text run at (324,18) width 5: " "
+        LayoutFileUploadControl {INPUT} at (102.98,19) size 212x18 "No file chosen"
+          LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+              LayoutText {#text} at (0,0) size 60x13
+                text run at (0,0) width 60: "Choose File"
+        LayoutText {#text} at (314,18) size 5x18
+          text run at (314,18) width 5: " "
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {H2} at (0,486.97) size 784x28
         LayoutText {#text} at (0,0) size 198x28
           text run at (0,0) width 198: "Pop-up Menu Sizes"
       LayoutBlockFlow {DIV} at (0,534.88) size 784x28
-        LayoutInline {FONT} at (0,0) size 164x28
+        LayoutInline {FONT} at (0,0) size 162x28
           LayoutText {#text} at (0,0) size 0x0
           LayoutMenuList {SELECT} at (0,9) size 36x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 36x18
@@ -197,10 +197,10 @@
                 text run at (8,2) width 3: "|"
           LayoutText {#text} at (78,0) size 6x28
             text run at (78,0) width 6: " "
-          LayoutMenuList {SELECT} at (84,9) size 80x18 [bgcolor=#F8F8F8]
-            LayoutBlockFlow (anonymous) at (0,0) size 80x18
-              LayoutText (anonymous) at (8,2) size 49x13
-                text run at (8,2) width 49: "xxxxxxxx"
+          LayoutMenuList {SELECT} at (84,9) size 78x18 [bgcolor=#F8F8F8]
+            LayoutBlockFlow (anonymous) at (0,0) size 78x18
+              LayoutText (anonymous) at (8,2) size 47x13
+                text run at (8,2) width 47: "xxxxxxxx"
           LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,562.88) size 784x19
         LayoutMenuList {SELECT} at (0,1) size 36x18 [bgcolor=#F8F8F8]
@@ -215,13 +215,13 @@
               text run at (8,2) width 3: "|"
         LayoutText {#text} at (76,0) size 4x18
           text run at (76,0) width 4: " "
-        LayoutMenuList {SELECT} at (80,1) size 80x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 80x18
-            LayoutText (anonymous) at (8,2) size 49x13
-              text run at (8,2) width 49: "xxxxxxxx"
+        LayoutMenuList {SELECT} at (80,1) size 78x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 78x18
+            LayoutText (anonymous) at (8,2) size 47x13
+              text run at (8,2) width 47: "xxxxxxxx"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,581.88) size 784x18
-        LayoutInline {FONT} at (0,0) size 157x13
+        LayoutInline {FONT} at (0,0) size 155x13
           LayoutText {#text} at (0,0) size 0x0
           LayoutMenuList {SELECT} at (0,0) size 36x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 36x18
@@ -235,43 +235,43 @@
                 text run at (8,2) width 3: "|"
           LayoutText {#text} at (74,3) size 3x13
             text run at (74,3) width 3: " "
-          LayoutMenuList {SELECT} at (77,0) size 80x18 [bgcolor=#F8F8F8]
-            LayoutBlockFlow (anonymous) at (0,0) size 80x18
-              LayoutText (anonymous) at (8,2) size 49x13
-                text run at (8,2) width 49: "xxxxxxxx"
+          LayoutMenuList {SELECT} at (77,0) size 78x18 [bgcolor=#F8F8F8]
+            LayoutBlockFlow (anonymous) at (0,0) size 78x18
+              LayoutText (anonymous) at (8,2) size 47x13
+                text run at (8,2) width 47: "xxxxxxxx"
           LayoutText {#text} at (0,0) size 0x0
 layer at (16,244) size 65x13
   LayoutBlockFlow {DIV} at (3,3) size 65x13
-    LayoutText {#text} at (0,0) size 46x13
-      text run at (0,0) width 46: "text field"
-layer at (92,242) size 32x59 clip at (93,243) size 19x56 scrollHeight 70
-  LayoutListBox {SELECT} at (2,2.25) size 32.30x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 19.30x14.19
-      LayoutText {#text} at (2,0) size 16x13
-        text run at (2,0) width 16: "list"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 19.30x14.19
+    LayoutText {#text} at (0,0) size 43x13
+      text run at (0,0) width 43: "text field"
+layer at (92,242) size 31x59 clip at (93,243) size 18x56 scrollHeight 70
+  LayoutListBox {SELECT} at (2,2.25) size 31.08x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 18.08x14.19
+      LayoutText {#text} at (2,0) size 15x13
+        text run at (2,0) width 15: "list"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 18.08x14.19
       LayoutText {#text} at (2,0) size 7x13
         text run at (2,0) width 7: "2"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 19.30x14.19
+    LayoutBlockFlow {OPTION} at (1,29.38) size 18.08x14.19
       LayoutText {#text} at (2,0) size 7x13
         text run at (2,0) width 7: "3"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 19.30x14.19
+    LayoutBlockFlow {OPTION} at (1,43.56) size 18.08x14.19
       LayoutText {#text} at (2,0) size 7x13
         text run at (2,0) width 7: "4"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 19.30x14.19
+    LayoutBlockFlow {OPTION} at (1,57.75) size 18.08x14.19
       LayoutText {#text} at (2,0) size 7x13
         text run at (2,0) width 7: "5"
-layer at (363,241) size 141x32 clip at (364,242) size 139x30
+layer at (352,241) size 141x32 clip at (353,242) size 139x30
   LayoutTextControl {TEXTAREA} at (2,2) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 43x13
-        text run at (0,0) width 43: "textarea"
+      LayoutText {#text} at (0,0) size 41x13
+        text run at (0,0) width 41: "textarea"
 layer at (39,459) size 65x13
   LayoutBlockFlow {DIV} at (3,3) size 65x13
-    LayoutText {#text} at (0,0) size 46x13
-      text run at (0,0) width 46: "text field"
-layer at (337,438) size 141x32 clip at (338,439) size 139x30
-  LayoutTextControl {TEXTAREA} at (328.98,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutText {#text} at (0,0) size 43x13
+      text run at (0,0) width 43: "text field"
+layer at (327,438) size 141x32 clip at (328,439) size 139x30
+  LayoutTextControl {TEXTAREA} at (318.98,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 43x13
-        text run at (0,0) width 43: "textarea"
+      LayoutText {#text} at (0,0) size 41x13
+        text run at (0,0) width 41: "textarea"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/formmove3-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/formmove3-expected.png
index 5622336..ec456be8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/formmove3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/formmove3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/formmove3-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/formmove3-expected.txt
index e8a437a..c8c3846 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/formmove3-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/formmove3-expected.txt
@@ -11,15 +11,15 @@
           LayoutInline {A} at (0,0) size 0x0
             LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow (anonymous) at (0,0) size 784x24
-          LayoutTable {TABLE} at (0,0) size 64x24
-            LayoutTableSection {TBODY} at (0,0) size 64x24
-              LayoutTableRow {TR} at (0,2) size 64x20
+          LayoutTable {TABLE} at (0,0) size 62x24
+            LayoutTableSection {TBODY} at (0,0) size 62x24
+              LayoutTableRow {TR} at (0,2) size 62x20
                 LayoutTableCell {TD} at (2,11) size 2x2 [r=0 c=0 rs=1 cs=1]
-                LayoutTableCell {TD} at (6,2) size 56x20 [r=0 c=1 rs=1 cs=1]
-                  LayoutButton {INPUT} at (1,1) size 53.02x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 37.02x13
-                      LayoutText {#text} at (0,0) size 37x13
-                        text run at (0,0) width 37: "Search"
+                LayoutTableCell {TD} at (6,2) size 54x20 [r=0 c=1 rs=1 cs=1]
+                  LayoutButton {INPUT} at (1,1) size 51.20x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 35.20x13
+                      LayoutText {#text} at (0,0) size 36x13
+                        text run at (0,0) width 36: "Search"
         LayoutBlockFlow (anonymous) at (0,24) size 784x0
           LayoutInline {A} at (0,0) size 0x0
           LayoutInline {A} at (0,0) size 0x0 [color=#0000EE]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-align-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-align-expected.png
index 87ecf77..ebfa963 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-align-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-align-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-align-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-align-expected.txt
index 6b15b40a..44d0480 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-align-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-align-expected.txt
@@ -27,21 +27,21 @@
         LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
 layer at (11,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 99x13
-      text run at (0,0) width 99: "The quick brown..."
+    LayoutText {#text} at (0,0) size 93x13
+      text run at (0,0) width 93: "The quick brown..."
 layer at (11,64) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 99x13
-      text run at (0,0) width 99: "The quick brown..."
+    LayoutText {#text} at (0,0) size 93x13
+      text run at (0,0) width 93: "The quick brown..."
 layer at (11,83) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 99x13
-      text run at (0,0) width 99: "The quick brown..."
+    LayoutText {#text} at (0,0) size 93x13
+      text run at (0,0) width 93: "The quick brown..."
 layer at (11,102) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 99x13
-      text run at (0,0) width 99: "The quick brown..."
+    LayoutText {#text} at (0,0) size 93x13
+      text run at (0,0) width 93: "The quick brown..."
 layer at (11,121) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 99x13
-      text run at (0,0) width 99: "The quick brown..."
+    LayoutText {#text} at (0,0) size 93x13
+      text run at (0,0) width 93: "The quick brown..."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-bkcolor-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-bkcolor-expected.png
index 374cf38..e6809eb 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-bkcolor-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-bkcolor-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-bkcolor-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-bkcolor-expected.txt
index 2cfe5d2..3f8c491 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-bkcolor-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-bkcolor-expected.txt
@@ -14,7 +14,7 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 107x13
-      text run at (0,0) width 107: "This should be pink."
+    LayoutText {#text} at (0,0) size 101x13
+      text run at (0,0) width 101: "This should be pink."
 layer at (11,48) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-default-bkcolor-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-default-bkcolor-expected.png
index 72953352c..6a0ec3a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-default-bkcolor-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-default-bkcolor-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-default-bkcolor-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-default-bkcolor-expected.txt
index 89338e4..555752e2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-default-bkcolor-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-default-bkcolor-expected.txt
@@ -10,5 +10,5 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 113x13
-      text run at (0,0) width 113: "This should be white."
+    LayoutText {#text} at (0,0) size 106x13
+      text run at (0,0) width 106: "This should be white."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-disabled-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-disabled-expected.png
index 54696cb..176731a5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-disabled-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-disabled-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-disabled-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-disabled-expected.txt
index 115fe25e..e8fb8d7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-disabled-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-disabled-expected.txt
@@ -10,5 +10,5 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 66x13
-      text run at (0,0) width 66: "Test Passed"
+    LayoutText {#text} at (0,0) size 62x13
+      text run at (0,0) width 62: "Test Passed"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-focus-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-focus-expected.png
index 8be049b..c138eb3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-focus-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-focus-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-focus-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-focus-expected.txt
index e3554f8..b5ccf097 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-focus-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-focus-expected.txt
@@ -25,10 +25,10 @@
       LayoutBlockFlow {P} at (0,157) size 784x0
 layer at (11,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 82x13
-      text run at (0,0) width 82: "My Text Field 1"
+    LayoutText {#text} at (0,0) size 77x13
+      text run at (0,0) width 77: "My Text Field 1"
 layer at (146,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 82x13
-      text run at (0,0) width 82: "My Text Field 2"
+    LayoutText {#text} at (0,0) size 77x13
+      text run at (0,0) width 77: "My Text Field 2"
 caret: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 3 {INPUT} of child 1 {P} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.png
index b8871f2..16c7c23 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt
index e00e7f65..0060695 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-height-expected.txt
@@ -27,14 +27,14 @@
         LayoutBR {BR} at (87,52) size 1x0
         LayoutText {#text} at (0,57) size 26x18
           text run at (0,57) width 26: "file "
-        LayoutFileUploadControl {INPUT} at (25.31,58) size 222x18 "No file chosen"
-          LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-              LayoutText {#text} at (0,0) size 63x13
-                text run at (0,0) width 63: "Choose File"
-        LayoutText {#text} at (247,57) size 5x18
-          text run at (247,57) width 5: " "
-        LayoutBR {BR} at (251,71) size 1x0
+        LayoutFileUploadControl {INPUT} at (25.31,58) size 212x18 "No file chosen"
+          LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+              LayoutText {#text} at (0,0) size 60x13
+                text run at (0,0) width 60: "Choose File"
+        LayoutText {#text} at (237,57) size 5x18
+          text run at (237,57) width 5: " "
+        LayoutBR {BR} at (241,71) size 1x0
         LayoutText {#text} at (0,76) size 44x18
           text run at (0,76) width 44: "image "
         LayoutImage {INPUT} at (43.09,89) size 10x1
@@ -58,22 +58,22 @@
         LayoutBR {BR} at (176,130) size 1x0
         LayoutText {#text} at (0,134) size 35x18
           text run at (0,134) width 35: "reset "
-        LayoutButton {INPUT} at (34.20,135) size 46.30x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 30.30x13
-            LayoutText {#text} at (0,0) size 31x13
-              text run at (0,0) width 31: "Reset"
-        LayoutText {#text} at (80,134) size 5x18
-          text run at (80,134) width 5: " "
-        LayoutBR {BR} at (84,148) size 1x0
+        LayoutButton {INPUT} at (34.20,135) size 44.78x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 28.78x13
+            LayoutText {#text} at (0,0) size 29x13
+              text run at (0,0) width 29: "Reset"
+        LayoutText {#text} at (78,134) size 5x18
+          text run at (78,134) width 5: " "
+        LayoutBR {BR} at (82,148) size 1x0
         LayoutText {#text} at (0,153) size 48x18
           text run at (0,153) width 48: "submit "
-        LayoutButton {INPUT} at (47.56,154) size 53.45x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 37.45x13
-            LayoutText {#text} at (0,0) size 38x13
-              text run at (0,0) width 38: "Submit"
-        LayoutText {#text} at (101,153) size 5x18
-          text run at (101,153) width 5: " "
-        LayoutBR {BR} at (105,167) size 1x0
+        LayoutButton {INPUT} at (47.56,154) size 51.64x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 35.64x13
+            LayoutText {#text} at (0,0) size 36x13
+              text run at (0,0) width 36: "Submit"
+        LayoutText {#text} at (99,153) size 5x18
+          text run at (99,153) width 5: " "
+        LayoutBR {BR} at (103,167) size 1x0
         LayoutText {#text} at (0,172) size 51x18
           text run at (0,172) width 51: "isindex "
         LayoutTextControl {INPUT} at (50.22,172) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.png
index 6fe8c88..38de1c7f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.txt
index 0d0a150..1a71c64 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-preventDefault-expected.txt
@@ -10,10 +10,10 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (10,50) size 131x19
   LayoutTextControl (positioned) {INPUT} at (10,50) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-layer at (13,53) size 125x13 scrollWidth 127
+layer at (13,53) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 128x13
-      text run at (0,0) width 128: "No caret should be here"
+    LayoutText {#text} at (0,0) size 121x13
+      text run at (0,0) width 121: "No caret should be here"
 layer at (10,70) size 328x36
   LayoutBlockFlow (positioned) {DIV} at (10,70) size 327.92x36
     LayoutBR {BR} at (0,0) size 0x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-readonly-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-readonly-expected.png
index 54efa6d..816e8ee6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-readonly-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-readonly-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-readonly-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-readonly-expected.txt
index b341851..77ad5d7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-readonly-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-readonly-expected.txt
@@ -10,6 +10,6 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 66x13
-      text run at (0,0) width 66: "Test Passed"
+    LayoutText {#text} at (0,0) size 62x13
+      text run at (0,0) width 62: "Test Passed"
 caret: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 2 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.png
index 9506683..f26ca1a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.txt
index 6d47b30..1c53e2a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-selection-expected.txt
@@ -74,9 +74,9 @@
           text run at (0,468) width 48: "Passed."
         LayoutBR {BR} at (47,482) size 1x0
       LayoutBlockFlow {P} at (0,571) size 784x0
-layer at (11,45) size 125x13 scrollWidth 134
+layer at (11,45) size 125x13 scrollWidth 128
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 135x13
-      text run at (0,0) width 135: "123456789 ABCDEFGHIJ"
+    LayoutText {#text} at (0,0) size 129x13
+      text run at (0,0) width 129: "123456789 ABCDEFGHIJ"
 selection start: position 3 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 1 {P} of body
 selection end:   position 12 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 1 {P} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-visibility-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-visibility-expected.png
index 2151f68..33a67404 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-visibility-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-visibility-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-visibility-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-visibility-expected.txt
index c15a592..57f135a5d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-visibility-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-visibility-expected.txt
@@ -13,5 +13,5 @@
       LayoutBlockFlow {P} at (0,69) size 784x0
 layer at (11,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 66x13
-      text run at (0,0) width 66: "Test Passed"
+    LayoutText {#text} at (0,0) size 62x13
+      text run at (0,0) width 62: "Test Passed"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-width-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-width-expected.png
index e09a37a..5d423a2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-width-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-width-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-width-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-width-expected.txt
index 395b03e6..0cfbafc3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-appearance-width-expected.txt
@@ -20,17 +20,17 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (11,48) size 194x13
   LayoutBlockFlow {DIV} at (3,3) size 194x13
-    LayoutText {#text} at (0,0) size 100x13
-      text run at (0,0) width 100: "styled width 200px"
+    LayoutText {#text} at (0,0) size 95x13
+      text run at (0,0) width 95: "styled width 200px"
 layer at (11,67) size 305x13
   LayoutBlockFlow {DIV} at (3,3) size 305x13
-    LayoutText {#text} at (0,0) size 38x13
-      text run at (0,0) width 38: "size 50"
+    LayoutText {#text} at (0,0) size 35x13
+      text run at (0,0) width 35: "size 50"
 layer at (11,86) size 194x13
   LayoutBlockFlow {DIV} at (3,3) size 194x13
-    LayoutText {#text} at (0,0) size 155x13
-      text run at (0,0) width 155: "styled width 200px & size=10"
+    LayoutText {#text} at (0,0) size 147x13
+      text run at (0,0) width 147: "styled width 200px & size=10"
 layer at (11,105) size 65x13
   LayoutBlockFlow {DIV} at (3,3) size 65x13
-    LayoutText {#text} at (0,0) size 38x13
-      text run at (0,0) width 38: "size 10"
+    LayoutText {#text} at (0,0) size 35x13
+      text run at (0,0) width 35: "size 10"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-button-sizes-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-button-sizes-expected.png
index 1e2d9d7..2bae52ce 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-button-sizes-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-button-sizes-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-button-sizes-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-button-sizes-expected.txt
index 8797c9c..cb105b7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-button-sizes-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-button-sizes-expected.txt
@@ -3,104 +3,104 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutButton {INPUT} at (0,3) size 67.64x15 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 51.64x11
-          LayoutText {#text} at (0,0) size 52x11
-            text run at (0,0) width 52: "Test Button"
-      LayoutText {#text} at (67,0) size 5x18
-        text run at (67,0) width 5: " "
-      LayoutButton {INPUT} at (71.64,3) size 67.64x15 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 51.64x11
-          LayoutText {#text} at (0,0) size 52x11
-            text run at (0,0) width 52: "Test Button"
-      LayoutText {#text} at (139,0) size 5x18
-        text run at (139,0) width 5: " "
-      LayoutButton {INPUT} at (143.28,3) size 67.64x15 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 51.64x11
-          LayoutText {#text} at (0,0) size 52x11
-            text run at (0,0) width 52: "Test Button"
-      LayoutText {#text} at (210,0) size 5x18
-        text run at (210,0) width 5: " "
-      LayoutButton {INPUT} at (214.92,3) size 67.64x15 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 51.64x11
-          LayoutText {#text} at (0,0) size 52x11
-            text run at (0,0) width 52: "Test Button"
-      LayoutText {#text} at (282,0) size 5x18
-        text run at (282,0) width 5: " "
-      LayoutButton {INPUT} at (286.56,3) size 67.64x15 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 51.64x11
-          LayoutText {#text} at (0,0) size 52x11
-            text run at (0,0) width 52: "Test Button"
-      LayoutText {#text} at (354,0) size 5x18
-        text run at (354,0) width 5: " "
-      LayoutButton {INPUT} at (358.20,3) size 67.64x15 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 51.64x11
-          LayoutText {#text} at (0,0) size 52x11
-            text run at (0,0) width 52: "Test Button"
-      LayoutText {#text} at (425,0) size 5x18
-        text run at (425,0) width 5: " "
-      LayoutButton {INPUT} at (429.84,1) size 77.52x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (507,0) size 5x18
-        text run at (507,0) width 5: " "
-      LayoutButton {INPUT} at (511.36,1) size 77.52x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (588,0) size 5x18
-        text run at (588,0) width 5: " "
-      LayoutButton {INPUT} at (592.88,1) size 77.52x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (670,0) size 5x18
-        text run at (670,0) width 5: " "
-      LayoutButton {INPUT} at (674.39,1) size 77.52x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (751,0) size 5x18
-        text run at (751,0) width 5: " "
-      LayoutButton {INPUT} at (0,21) size 77.52x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 61.52x13
-          LayoutText {#text} at (0,0) size 62x13
-            text run at (0,0) width 62: "Test Button"
-      LayoutText {#text} at (77,20) size 5x18
-        text run at (77,20) width 5: " "
-      LayoutButton {INPUT} at (81.52,19) size 87.67x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 71.67x16
-          LayoutText {#text} at (0,0) size 72x16
-            text run at (0,0) width 72: "Test Button"
-      LayoutText {#text} at (169,20) size 5x18
-        text run at (169,20) width 5: " "
-      LayoutButton {INPUT} at (173.19,19) size 87.67x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 71.67x16
-          LayoutText {#text} at (0,0) size 72x16
-            text run at (0,0) width 72: "Test Button"
-      LayoutText {#text} at (260,20) size 5x18
-        text run at (260,20) width 5: " "
-      LayoutButton {INPUT} at (264.86,19) size 87.67x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 71.67x16
-          LayoutText {#text} at (0,0) size 72x16
-            text run at (0,0) width 72: "Test Button"
-      LayoutText {#text} at (352,20) size 5x18
-        text run at (352,20) width 5: " "
-      LayoutButton {INPUT} at (356.53,19) size 87.67x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 71.67x16
-          LayoutText {#text} at (0,0) size 72x16
-            text run at (0,0) width 72: "Test Button"
-      LayoutText {#text} at (444,20) size 5x18
-        text run at (444,20) width 5: " "
-      LayoutButton {INPUT} at (448.20,19) size 87.67x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 71.67x16
-          LayoutText {#text} at (0,0) size 72x16
-            text run at (0,0) width 72: "Test Button"
-      LayoutText {#text} at (535,20) size 5x18
-        text run at (535,20) width 5: " "
-      LayoutButton {INPUT} at (539.88,19) size 87.67x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 71.67x16
-          LayoutText {#text} at (0,0) size 72x16
-            text run at (0,0) width 72: "Test Button"
+      LayoutButton {INPUT} at (0,3) size 63.61x15 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 47.61x11
+          LayoutText {#text} at (0,0) size 48x11
+            text run at (0,0) width 48: "Test Button"
+      LayoutText {#text} at (63,0) size 5x18
+        text run at (63,0) width 5: " "
+      LayoutButton {INPUT} at (67.61,3) size 63.61x15 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 47.61x11
+          LayoutText {#text} at (0,0) size 48x11
+            text run at (0,0) width 48: "Test Button"
+      LayoutText {#text} at (131,0) size 5x18
+        text run at (131,0) width 5: " "
+      LayoutButton {INPUT} at (135.22,3) size 63.61x15 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 47.61x11
+          LayoutText {#text} at (0,0) size 48x11
+            text run at (0,0) width 48: "Test Button"
+      LayoutText {#text} at (198,0) size 5x18
+        text run at (198,0) width 5: " "
+      LayoutButton {INPUT} at (202.83,3) size 63.61x15 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 47.61x11
+          LayoutText {#text} at (0,0) size 48x11
+            text run at (0,0) width 48: "Test Button"
+      LayoutText {#text} at (266,0) size 5x18
+        text run at (266,0) width 5: " "
+      LayoutButton {INPUT} at (270.44,3) size 63.61x15 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 47.61x11
+          LayoutText {#text} at (0,0) size 48x11
+            text run at (0,0) width 48: "Test Button"
+      LayoutText {#text} at (334,0) size 5x18
+        text run at (334,0) width 5: " "
+      LayoutButton {INPUT} at (338.05,3) size 63.61x15 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 47.61x11
+          LayoutText {#text} at (0,0) size 48x11
+            text run at (0,0) width 48: "Test Button"
+      LayoutText {#text} at (401,0) size 5x18
+        text run at (401,0) width 5: " "
+      LayoutButton {INPUT} at (405.66,1) size 74.19x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (479,0) size 5x18
+        text run at (479,0) width 5: " "
+      LayoutButton {INPUT} at (483.84,1) size 74.19x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (558,0) size 5x18
+        text run at (558,0) width 5: " "
+      LayoutButton {INPUT} at (562.03,1) size 74.19x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (636,0) size 5x18
+        text run at (636,0) width 5: " "
+      LayoutButton {INPUT} at (640.22,1) size 74.19x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (714,0) size 5x18
+        text run at (714,0) width 5: " "
+      LayoutButton {INPUT} at (0,21) size 74.19x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 58.19x13
+          LayoutText {#text} at (0,0) size 59x13
+            text run at (0,0) width 59: "Test Button"
+      LayoutText {#text} at (74,20) size 5x18
+        text run at (74,20) width 5: " "
+      LayoutButton {INPUT} at (78.19,19) size 84.77x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 68.77x16
+          LayoutText {#text} at (0,0) size 69x16
+            text run at (0,0) width 69: "Test Button"
+      LayoutText {#text} at (162,20) size 5x18
+        text run at (162,20) width 5: " "
+      LayoutButton {INPUT} at (166.95,19) size 84.77x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 68.77x16
+          LayoutText {#text} at (0,0) size 69x16
+            text run at (0,0) width 69: "Test Button"
+      LayoutText {#text} at (251,20) size 5x18
+        text run at (251,20) width 5: " "
+      LayoutButton {INPUT} at (255.72,19) size 84.77x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 68.77x16
+          LayoutText {#text} at (0,0) size 69x16
+            text run at (0,0) width 69: "Test Button"
+      LayoutText {#text} at (340,20) size 5x18
+        text run at (340,20) width 5: " "
+      LayoutButton {INPUT} at (344.48,19) size 84.77x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 68.77x16
+          LayoutText {#text} at (0,0) size 69x16
+            text run at (0,0) width 69: "Test Button"
+      LayoutText {#text} at (429,20) size 5x18
+        text run at (429,20) width 5: " "
+      LayoutButton {INPUT} at (433.25,19) size 84.77x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 68.77x16
+          LayoutText {#text} at (0,0) size 69x16
+            text run at (0,0) width 69: "Test Button"
+      LayoutText {#text} at (518,20) size 5x18
+        text run at (518,20) width 5: " "
+      LayoutButton {INPUT} at (522.02,19) size 84.77x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 68.77x16
+          LayoutText {#text} at (0,0) size 69x16
+            text run at (0,0) width 69: "Test Button"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.png
index 32b8d3a..856555f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt
index 9b93a32..9cb03b9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-disabled-color-expected.txt
@@ -71,107 +71,107 @@
         text run at (131,246) width 4: " "
       LayoutTextControl {INPUT} at (135,246) size 131x19 [color=#FF0000] [border: (2px inset #EEEEEE)]
       LayoutBR {BR} at (266,260) size 0x0
-layer at (11,29) size 125x13 scrollWidth 347
+layer at (11,29) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,29) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,29) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,48) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,48) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,48) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,48) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,67) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,67) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,67) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,67) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,86) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,86) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,86) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,86) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,105) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,105) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,105) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,105) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,124) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,124) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,124) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,124) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,143) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,143) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,143) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,143) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,162) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,162) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,162) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,162) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,181) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,181) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,181) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,181) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,200) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,200) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,200) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,200) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,219) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,219) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,219) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,219) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,238) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,238) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,238) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,238) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
-layer at (11,257) size 125x13 scrollWidth 347
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
+layer at (11,257) size 125x13 scrollWidth 327
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 348x13
-      text run at (0,0) width 348: "The text in this disabled field should displayed as dimmed or grey"
-layer at (146,257) size 125x13 scrollWidth 152
+    LayoutText {#text} at (0,0) size 328x13
+      text run at (0,0) width 328: "The text in this disabled field should displayed as dimmed or grey"
+layer at (146,257) size 125x13 scrollWidth 143
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 152x13
-      text run at (0,0) width 152: "This text field is not disabled"
+    LayoutText {#text} at (0,0) size 143x13
+      text run at (0,0) width 143: "This text field is not disabled"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.png
index 7695ea61..b13018e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.txt
index 91cc8004..d20c700 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-double-click-selection-gap-bug-expected.txt
@@ -21,11 +21,11 @@
               LayoutText {#text} at (0,0) size 0x0
 layer at (33,165) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 38x13
-      text run at (0,0) width 38: "foo bar"
+    LayoutText {#text} at (0,0) size 36x13
+      text run at (0,0) width 36: "foo bar"
 layer at (33,409) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 38x13
-      text run at (0,0) width 38: "foo bar"
+    LayoutText {#text} at (0,0) size 36x13
+      text run at (0,0) width 36: "foo bar"
 selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 3 {TABLE} of body
 selection end:   position 7 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 3 {TABLE} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-field-text-truncated-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-field-text-truncated-expected.png
index 47bd762..292c8257 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-field-text-truncated-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-field-text-truncated-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-field-text-truncated-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-field-text-truncated-expected.txt
index 4e4b05d..ac83b7e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-field-text-truncated-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-field-text-truncated-expected.txt
@@ -12,5 +12,5 @@
         LayoutText {#text} at (0,0) size 0x0
 layer at (11,48) size 294x15
   LayoutBlockFlow {DIV} at (3,3) size 294x15
-    LayoutText {#text} at (0,0) size 96x15
-      text run at (0,0) width 96: "something gjpqy"
+    LayoutText {#text} at (0,0) size 92x15
+      text run at (0,0) width 92: "something gjpqy"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-first-letter-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-first-letter-expected.png
index d816110..3fcfe10 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-first-letter-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-first-letter-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-first-letter-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-first-letter-expected.txt
index 8f89b9d75..a79c29a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-first-letter-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-first-letter-expected.txt
@@ -6,8 +6,8 @@
       LayoutText {#text} at (0,0) size 601x18
         text run at (0,0) width 601: "This test passes if it doesn't crash and if the Submit button does not honor the first-letter style."
       LayoutBR {BR} at (601,14) size 0x0
-      LayoutButton {INPUT} at (0,18) size 53.45x22 [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 37.45x13
-          LayoutText {#text} at (0,0) size 38x13
-            text run at (0,0) width 38: "Submit"
+      LayoutButton {INPUT} at (0,18) size 51.64x22 [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 35.64x13
+          LayoutText {#text} at (0,0) size 36x13
+            text run at (0,0) width 36: "Submit"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-paint-order-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-paint-order-expected.png
index 5ef7a571..d2bfe9c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-paint-order-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-paint-order-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.png
index 011b9ce..006501e6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.txt
index e14bb52..af4eb7f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-1-expected.txt
@@ -12,8 +12,8 @@
         LayoutText {#text} at (0,0) size 0x0
 layer at (11,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 63x13
-      text run at (0,0) width 63: "Placeholder"
+    LayoutText {#text} at (0,0) size 60x13
+      text run at (0,0) width 60: "Placeholder"
 layer at (11,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 caret: position 0 of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.png
index ff5dc68..b7c75d3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.txt
index 669c527..fa8b956 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-placeholder-visibility-3-expected.txt
@@ -12,8 +12,8 @@
         LayoutText {#text} at (0,0) size 0x0
 layer at (11,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 63x13
-      text run at (0,0) width 63: "Placeholder"
+    LayoutText {#text} at (0,0) size 60x13
+      text run at (0,0) width 60: "Placeholder"
 layer at (11,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 caret: position 0 of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.png
index 1790940..bbdddfa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.txt
index 10231ab2..cbc694d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-autoscroll-expected.txt
@@ -19,11 +19,11 @@
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,87) size 784x18
         LayoutText {#text} at (0,0) size 90x18
-          text run at (0,0) width 90: "ScrollLeft: 29"
+          text run at (0,0) width 90: "ScrollLeft: 21"
         LayoutBR {BR} at (89,14) size 1x0
-layer at (11,79) size 125x13 scrollX 29.00 scrollWidth 154
+layer at (11,79) size 125x13 scrollX 21.00 scrollWidth 146
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 154x13
-      text run at (0,0) width 154: "abcdefghijklmnopqrstuvwxyz"
+    LayoutText {#text} at (0,0) size 146x13
+      text run at (0,0) width 146: "abcdefghijklmnopqrstuvwxyz"
 selection start: position 1 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 5 {INPUT} of body
 selection end:   position 26 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 5 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-dimmed-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-dimmed-expected.png
index fdfa673..7a45b12b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-dimmed-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-dimmed-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-dimmed-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-dimmed-expected.txt
index 01c5941..613ba81 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-dimmed-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-readonly-dimmed-expected.txt
@@ -8,7 +8,7 @@
       LayoutBR {BR} at (465,14) size 1x0
       LayoutTextControl {INPUT} at (0,18) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (11,29) size 125x13 scrollWidth 162
+layer at (11,29) size 125x13 scrollWidth 153
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 162x13
-      text run at (0,0) width 162: "This border should be dimmed"
+    LayoutText {#text} at (0,0) size 154x13
+      text run at (0,0) width 154: "This border should be dimmed"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-spaces-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-spaces-expected.png
index 2328a1c..db13393 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-spaces-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-spaces-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-spaces-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-spaces-expected.txt
index 2ee812514..ba8974ec 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-spaces-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-spaces-expected.txt
@@ -11,5 +11,5 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,47) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 59x13
-      text run at (0,0) width 59: "   foo bar   "
+    LayoutText {#text} at (0,0) size 55x13
+      text run at (0,0) width 55: "   foo bar   "
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-table-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-table-expected.png
index 0a63831..8be935a4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-table-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-table-expected.txt
index 7d3437b..e66b9566 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-table-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-table-expected.txt
@@ -86,13 +86,13 @@
   LayoutBlockFlow {DIV} at (3,3) size 24x13
 layer at (20,414) size 194x13
   LayoutBlockFlow {DIV} at (3,3) size 194x13
-    LayoutText {#text} at (0,0) size 64x13
-      text run at (0,0) width 64: "width 100%"
+    LayoutText {#text} at (0,0) size 61x13
+      text run at (0,0) width 61: "width 100%"
 layer at (20,529) size 64x13
   LayoutBlockFlow {DIV} at (3,3) size 64x13
-    LayoutText {#text} at (0,0) size 52x13
-      text run at (0,0) width 52: "max 70px"
+    LayoutText {#text} at (0,0) size 50x13
+      text run at (0,0) width 50: "max 70px"
 layer at (20,616) size 125x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 89x13
-      text run at (0,0) width 89: "min-width 100px"
+    LayoutText {#text} at (0,0) size 85x13
+      text run at (0,0) width 85: "min-width 100px"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-double-click-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-double-click-expected.png
index 1b3fc79..1475547 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-double-click-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-double-click-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-double-click-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-double-click-expected.txt
index 8654222..882cf3d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-double-click-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-double-click-expected.txt
@@ -11,7 +11,7 @@
           text run at (0,0) width 576: "Tests double-clicking on a word. If the test succeeds, the word \"word\" should be selected."
 layer at (11,11) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 71x13
-      text run at (0,0) width 71: "word another"
+    LayoutText {#text} at (0,0) size 67x13
+      text run at (0,0) width 67: "word another"
 selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 0 {INPUT} of body
 selection end:   position 4 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 0 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-drag-down-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-drag-down-expected.png
index b43067b1c..78586a1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-drag-down-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-drag-down-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-drag-down-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-drag-down-expected.txt
index a6a85a3..d3e0aa8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-drag-down-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-drag-down-expected.txt
@@ -11,7 +11,7 @@
           text run at (0,0) width 750: "Tests drag-selecting down. If the test succeeds, the text from the center to the end of the text field should be selected."
 layer at (11,11) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 121x13
-      text run at (0,0) width 121: "This is a bunch of text."
-selection start: position 8 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 0 {INPUT} of body
+    LayoutText {#text} at (0,0) size 114x13
+      text run at (0,0) width 114: "This is a bunch of text."
+selection start: position 9 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 0 {INPUT} of body
 selection end:   position 24 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 0 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-option-delete-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-option-delete-expected.png
index 97e9a82..82128cf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-option-delete-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-option-delete-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-option-delete-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-option-delete-expected.txt
index df552db..b51de67 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-option-delete-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-option-delete-expected.txt
@@ -11,6 +11,6 @@
           text run at (0,0) width 655: "Tests option-deleting a word. If the test succeeds, the word \"word\" should end up with a space after it."
 layer at (11,11) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 30x13
-      text run at (0,0) width 30: "word "
+    LayoutText {#text} at (0,0) size 29x13
+      text run at (0,0) width 29: "word "
 caret: position 5 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 0 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.png
index 492e5580..bd82f0f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt
index df97a19..8539a4f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-scroll-left-on-blur-expected.txt
@@ -16,16 +16,16 @@
         LayoutText {#text} at (0,0) size 768x36
           text run at (0,0) width 768: "Tests scrolling back to the beginning when a text field blurs. The first field should be scrolled to the left, the second and"
           text run at (0,18) width 164: "third scrolled to the right."
-layer at (11,11) size 125x13 scrollWidth 308
+layer at (11,11) size 125x13 scrollWidth 288
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 308x13
-      text run at (0,0) width 308: "this text field has a lot of text in it so that it needs to scroll"
-layer at (146,11) size 125x13 scrollX 183.00 scrollWidth 308
+    LayoutText {#text} at (0,0) size 288x13
+      text run at (0,0) width 288: "this text field has a lot of text in it so that it needs to scroll"
+layer at (146,11) size 125x13 scrollX 163.00 scrollWidth 288
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (-182,0) size 308x13
-      text run at (-182,0) width 307: "this text field has a lot of text in it so that it needs to scroll"
-layer at (281,11) size 125x13 scrollX 183.00 scrollWidth 308
+    LayoutText {#text} at (-163,0) size 288x13
+      text run at (-163,0) width 288: "this text field has a lot of text in it so that it needs to scroll"
+layer at (281,11) size 125x13 scrollX 163.00 scrollWidth 288
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 308x13
-      text run at (0,0) width 308: "this text field has a lot of text in it so that it needs to scroll"
+    LayoutText {#text} at (0,0) size 288x13
+      text run at (0,0) width 288: "this text field has a lot of text in it so that it needs to scroll"
 caret: position 66 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 4 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.png
index 4c4db09d..a3968c7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.txt
index 4d3d5d1..4db487ee 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-text-word-wrap-expected.txt
@@ -14,7 +14,7 @@
       LayoutBlockFlow (anonymous) at (0,34) size 784x33
         LayoutTextControl {INPUT} at (0,0) size 131x33 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (11,52) size 125x13 scrollWidth 257
+layer at (11,52) size 125x13 scrollWidth 242
   LayoutBlockFlow {DIV} at (3,10) size 125x13
-    LayoutText {#text} at (0,0) size 257x13
-      text run at (0,0) width 257: "This sentence should not wrap into the next line."
+    LayoutText {#text} at (0,0) size 242x13
+      text run at (0,0) width 242: "This sentence should not wrap into the next line."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-type-text-min-width-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-type-text-min-width-expected.txt
index 24a74c5d..5a00315 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-type-text-min-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-type-text-min-width-expected.txt
@@ -9,7 +9,7 @@
       LayoutBR {BR} at (670,32) size 1x0
       LayoutTextControl {INPUT} at (0,36) size 17x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (11,47) size 11x13 scrollWidth 39
+layer at (11,47) size 11x13 scrollWidth 37
   LayoutBlockFlow {DIV} at (3,3) size 11x13
-    LayoutText {#text} at (0,0) size 40x13
-      text run at (0,0) width 40: "198765"
+    LayoutText {#text} at (0,0) size 38x13
+      text run at (0,0) width 38: "198765"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-value-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-value-expected.png
index 83f8971..be91fd9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-value-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-value-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-value-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-value-expected.txt
index b86a7efb..26ae197d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-value-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/input-value-expected.txt
@@ -12,217 +12,217 @@
           text run at (0,0) width 728: "Results that match Gecko are like WinIE, but with \"before\" for the attribute in the first two rows and the last row."
       LayoutBlockFlow {HR} at (0,86) size 784x2 [border: (1px inset #EEEEEE)]
       LayoutBlockFlow {FORM} at (0,96) size 784x338
-        LayoutTable {TABLE} at (0,0) size 752x338
-          LayoutTableSection {THEAD} at (0,0) size 752x24
-            LayoutTableRow {TR} at (0,2) size 752x20
+        LayoutTable {TABLE} at (0,0) size 742x338
+          LayoutTableSection {THEAD} at (0,0) size 742x24
+            LayoutTableRow {TR} at (0,2) size 742x20
               LayoutTableCell {TH} at (2,2) size 392x20 [r=0 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 57x18
                   text run at (1,1) width 57: "test case"
-              LayoutTableCell {TH} at (396,2) size 224x20 [r=0 c=1 rs=1 cs=1]
+              LayoutTableCell {TH} at (396,2) size 214x20 [r=0 c=1 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 92x18
                   text run at (1,1) width 92: "form element"
-              LayoutTableCell {TH} at (622,2) size 63x20 [r=0 c=2 rs=1 cs=1]
+              LayoutTableCell {TH} at (612,2) size 63x20 [r=0 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 61x18
                   text run at (1,1) width 61: "property"
-              LayoutTableCell {TH} at (687,2) size 63x20 [r=0 c=3 rs=1 cs=1]
+              LayoutTableCell {TH} at (677,2) size 63x20 [r=0 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 61x18
                   text run at (1,1) width 61: "attribute"
-          LayoutTableSection {TBODY} at (0,24) size 752x314
-            LayoutTableRow {TR} at (0,0) size 752x21
+          LayoutTableSection {TBODY} at (0,24) size 742x314
+            LayoutTableRow {TR} at (0,0) size 742x21
               LayoutTableCell {TD} at (2,0) size 392x20 [r=0 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 211x18
                   text run at (1,1) width 211: "text with value property changed"
-              LayoutTableCell {TD} at (396,0) size 224x21 [r=0 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,0) size 214x21 [r=0 c=1 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-              LayoutTableCell {TD} at (622,0) size 63x20 [r=0 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,0) size 63x20 [r=0 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,0) size 63x20 [r=0 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,0) size 63x20 [r=0 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 41x18
                   text run at (1,1) width 41: "before"
-            LayoutTableRow {TR} at (0,23) size 752x21
+            LayoutTableRow {TR} at (0,23) size 742x21
               LayoutTableCell {TD} at (2,23) size 392x20 [r=1 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 248x18
                   text run at (1,1) width 248: "password with value property changed"
-              LayoutTableCell {TD} at (396,23) size 224x21 [r=1 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,23) size 214x21 [r=1 c=1 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-              LayoutTableCell {TD} at (622,23) size 63x20 [r=1 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,23) size 63x20 [r=1 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,23) size 63x20 [r=1 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,23) size 63x20 [r=1 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 41x18
                   text run at (1,1) width 41: "before"
-            LayoutTableRow {TR} at (0,46) size 752x20
+            LayoutTableRow {TR} at (0,46) size 742x20
               LayoutTableCell {TD} at (2,46) size 392x20 [r=2 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 252x18
                   text run at (1,1) width 252: "check box with value property changed"
-              LayoutTableCell {TD} at (396,46) size 224x20 [r=2 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,46) size 214x20 [r=2 c=1 rs=1 cs=1]
                 LayoutBlockFlow {INPUT} at (3.88,4) size 12x12
-              LayoutTableCell {TD} at (622,46) size 63x20 [r=2 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,46) size 63x20 [r=2 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,46) size 63x20 [r=2 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,46) size 63x20 [r=2 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,68) size 752x20
+            LayoutTableRow {TR} at (0,68) size 742x20
               LayoutTableCell {TD} at (2,68) size 392x20 [r=3 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 231x18
                   text run at (1,1) width 231: "hidden with value property changed"
-              LayoutTableCell {TD} at (396,77) size 224x2 [r=3 c=1 rs=1 cs=1]
-              LayoutTableCell {TD} at (622,68) size 63x20 [r=3 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,77) size 214x2 [r=3 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,68) size 63x20 [r=3 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,68) size 63x20 [r=3 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,68) size 63x20 [r=3 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,90) size 752x20
+            LayoutTableRow {TR} at (0,90) size 742x20
               LayoutTableCell {TD} at (2,90) size 392x20 [r=4 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 228x18
                   text run at (1,1) width 228: "button with value property changed"
-              LayoutTableCell {TD} at (396,90) size 224x20 [r=4 c=1 rs=1 cs=1]
-                LayoutButton {INPUT} at (1,1) size 40.08x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 24.08x13
-                    LayoutText {#text} at (0,0) size 25x13
-                      text run at (0,0) width 25: "after"
-              LayoutTableCell {TD} at (622,90) size 63x20 [r=4 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,90) size 214x20 [r=4 c=1 rs=1 cs=1]
+                LayoutButton {INPUT} at (1,1) size 38.56x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 22.56x13
+                    LayoutText {#text} at (0,0) size 23x13
+                      text run at (0,0) width 23: "after"
+              LayoutTableCell {TD} at (612,90) size 63x20 [r=4 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,90) size 63x20 [r=4 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,90) size 63x20 [r=4 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,112) size 752x20
+            LayoutTableRow {TR} at (0,112) size 742x20
               LayoutTableCell {TD} at (2,112) size 392x20 [r=5 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 226x18
                   text run at (1,1) width 226: "image with value property changed"
-              LayoutTableCell {TD} at (396,112) size 224x19 [r=5 c=1 rs=1 cs=1]
-                LayoutBlockFlow {INPUT} at (1,1) size 37.91x17
-              LayoutTableCell {TD} at (622,112) size 63x20 [r=5 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,112) size 214x19 [r=5 c=1 rs=1 cs=1]
+                LayoutBlockFlow {INPUT} at (1,1) size 36.09x17
+              LayoutTableCell {TD} at (612,112) size 63x20 [r=5 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,112) size 63x20 [r=5 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,112) size 63x20 [r=5 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,134) size 752x21
+            LayoutTableRow {TR} at (0,134) size 742x21
               LayoutTableCell {TD} at (2,134) size 392x20 [r=6 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 220x18
                   text run at (1,1) width 220: "radio with value property changed"
-              LayoutTableCell {TD} at (396,134) size 224x21 [r=6 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,134) size 214x21 [r=6 c=1 rs=1 cs=1]
                 LayoutBlockFlow {INPUT} at (3.88,4) size 12x13
-              LayoutTableCell {TD} at (622,134) size 63x20 [r=6 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,134) size 63x20 [r=6 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,134) size 63x20 [r=6 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,134) size 63x20 [r=6 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,157) size 752x21
+            LayoutTableRow {TR} at (0,157) size 742x21
               LayoutTableCell {TD} at (2,157) size 392x20 [r=7 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 210x18
                   text run at (1,1) width 210: "text with value attribute changed"
-              LayoutTableCell {TD} at (396,157) size 224x21 [r=7 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,157) size 214x21 [r=7 c=1 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-              LayoutTableCell {TD} at (622,157) size 63x20 [r=7 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,157) size 63x20 [r=7 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,157) size 63x20 [r=7 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,157) size 63x20 [r=7 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,180) size 752x20
+            LayoutTableRow {TR} at (0,180) size 742x20
               LayoutTableCell {TD} at (2,180) size 392x20 [r=8 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 252x18
                   text run at (1,1) width 252: "check box with value attribute changed"
-              LayoutTableCell {TD} at (396,180) size 224x20 [r=8 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,180) size 214x20 [r=8 c=1 rs=1 cs=1]
                 LayoutBlockFlow {INPUT} at (3.88,4) size 12x12
-              LayoutTableCell {TD} at (622,180) size 63x20 [r=8 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,180) size 63x20 [r=8 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,180) size 63x20 [r=8 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,180) size 63x20 [r=8 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,202) size 752x20
+            LayoutTableRow {TR} at (0,202) size 742x20
               LayoutTableCell {TD} at (2,202) size 392x20 [r=9 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 390x18
                   text run at (1,1) width 390: "text with value property changed, then turned into check box"
-              LayoutTableCell {TD} at (396,202) size 224x20 [r=9 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,202) size 214x20 [r=9 c=1 rs=1 cs=1]
                 LayoutBlockFlow {INPUT} at (3.88,4) size 12x12
-              LayoutTableCell {TD} at (622,202) size 63x20 [r=9 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,202) size 63x20 [r=9 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,202) size 63x20 [r=9 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,202) size 63x20 [r=9 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,224) size 752x21
+            LayoutTableRow {TR} at (0,224) size 742x21
               LayoutTableCell {TD} at (2,224) size 392x20 [r=10 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 390x18
                   text run at (1,1) width 390: "check box with value property changed, then turned into text"
-              LayoutTableCell {TD} at (396,224) size 224x21 [r=10 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,224) size 214x21 [r=10 c=1 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-              LayoutTableCell {TD} at (622,224) size 63x20 [r=10 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,224) size 63x20 [r=10 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,224) size 63x20 [r=10 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,224) size 63x20 [r=10 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,247) size 752x20
+            LayoutTableRow {TR} at (0,247) size 742x20
               LayoutTableCell {TD} at (2,247) size 392x20 [r=11 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 389x18
                   text run at (1,1) width 389: "text with value attribute changed, then turned into check box"
-              LayoutTableCell {TD} at (396,247) size 224x20 [r=11 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,247) size 214x20 [r=11 c=1 rs=1 cs=1]
                 LayoutBlockFlow {INPUT} at (3.88,4) size 12x12
-              LayoutTableCell {TD} at (622,247) size 63x20 [r=11 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,247) size 63x20 [r=11 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,247) size 63x20 [r=11 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,247) size 63x20 [r=11 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,269) size 752x21
+            LayoutTableRow {TR} at (0,269) size 742x21
               LayoutTableCell {TD} at (2,269) size 392x20 [r=12 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 389x18
                   text run at (1,1) width 389: "check box with value attribute changed, then turned into text"
-              LayoutTableCell {TD} at (396,269) size 224x21 [r=12 c=1 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,269) size 214x21 [r=12 c=1 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-              LayoutTableCell {TD} at (622,269) size 63x20 [r=12 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (612,269) size 63x20 [r=12 c=2 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-              LayoutTableCell {TD} at (687,269) size 63x20 [r=12 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,269) size 63x20 [r=12 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 30x18
                   text run at (1,1) width 30: "after"
-            LayoutTableRow {TR} at (0,292) size 752x20
+            LayoutTableRow {TR} at (0,292) size 742x20
               LayoutTableCell {TD} at (2,292) size 392x20 [r=13 c=0 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 208x18
                   text run at (1,1) width 208: "file with value property changed"
-              LayoutTableCell {TD} at (396,292) size 224x20 [r=13 c=1 rs=1 cs=1]
-                LayoutFileUploadControl {INPUT} at (1,1) size 222x18 "No file chosen"
-                  LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                      LayoutText {#text} at (0,0) size 63x13
-                        text run at (0,0) width 63: "Choose File"
-              LayoutTableCell {TD} at (622,301) size 63x2 [r=13 c=2 rs=1 cs=1]
-              LayoutTableCell {TD} at (687,292) size 63x20 [r=13 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (396,292) size 214x20 [r=13 c=1 rs=1 cs=1]
+                LayoutFileUploadControl {INPUT} at (1,1) size 212x18 "No file chosen"
+                  LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                      LayoutText {#text} at (0,0) size 60x13
+                        text run at (0,0) width 60: "Choose File"
+              LayoutTableCell {TD} at (612,301) size 63x2 [r=13 c=2 rs=1 cs=1]
+              LayoutTableCell {TD} at (677,292) size 63x20 [r=13 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 41x18
                   text run at (1,1) width 41: "before"
 layer at (408,132) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 34x13
-      text run at (0,0) width 34: "before"
+    LayoutText {#text} at (0,0) size 33x13
+      text run at (0,0) width 33: "before"
 layer at (408,155) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 40x13
-      text run at (0,0) width 40: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
-layer at (405,241) size 38x17 clip at (406,242) size 36x15
-  LayoutBlockFlow {DIV} at (0,0) size 37.91x17 [border: (1px solid #C0C0C0)]
-layer at (407,243) size 34x13
-  LayoutBlockFlow {DIV} at (2,2) size 33.91x13
-    LayoutText {#text} at (0,0) size 34x13
-      text run at (0,0) width 34: "before"
+    LayoutText {#text} at (0,0) size 38x13
+      text run at (0,0) width 38: "\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}\x{2022}"
+layer at (405,241) size 36x17 clip at (406,242) size 34x15
+  LayoutBlockFlow {DIV} at (0,0) size 36.09x17 [border: (1px solid #C0C0C0)]
+layer at (407,243) size 32x13
+  LayoutBlockFlow {DIV} at (2,2) size 32.09x13
+    LayoutText {#text} at (0,0) size 33x13
+      text run at (0,0) width 33: "before"
 layer at (408,289) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 25x13
-      text run at (0,0) width 25: "after"
+    LayoutText {#text} at (0,0) size 23x13
+      text run at (0,0) width 23: "after"
 layer at (408,356) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 25x13
-      text run at (0,0) width 25: "after"
+    LayoutText {#text} at (0,0) size 23x13
+      text run at (0,0) width 23: "after"
 layer at (408,401) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 25x13
-      text run at (0,0) width 25: "after"
+    LayoutText {#text} at (0,0) size 23x13
+      text run at (0,0) width 23: "after"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-bidi-align-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-bidi-align-expected.png
index 1d1edb5..2851419 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-bidi-align-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-bidi-align-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-bidi-align-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-bidi-align-expected.txt
index cbe03c2..189b62b02 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-bidi-align-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-bidi-align-expected.txt
@@ -9,266 +9,266 @@
         LayoutBR {BR} at (614,0) size 1x18
         LayoutText {#text} at (0,18) size 438x18
           text run at (0,18) width 438: "All the items in the following select elements should be left-aligned."
-      LayoutTable {TABLE} at (0,36) size 646x100
-        LayoutTableSection {TBODY} at (0,0) size 646x100
-          LayoutTableRow {TR} at (0,2) size 646x47
-            LayoutTableCell {TD} at (2,2) size 154x47 [r=0 c=0 rs=1 cs=1]
-            LayoutTableCell {TD} at (158,2) size 164x47 [r=0 c=1 rs=1 cs=1]
-            LayoutTableCell {TD} at (324,2) size 154x47 [r=0 c=2 rs=1 cs=1]
-            LayoutTableCell {TD} at (480,2) size 164x47 [r=0 c=3 rs=1 cs=1]
-          LayoutTableRow {TR} at (0,51) size 646x47
-            LayoutTableCell {TD} at (2,51) size 154x47 [r=1 c=0 rs=1 cs=1]
-            LayoutTableCell {TD} at (158,51) size 164x47 [r=1 c=1 rs=1 cs=1]
+      LayoutTable {TABLE} at (0,36) size 628x100
+        LayoutTableSection {TBODY} at (0,0) size 628x100
+          LayoutTableRow {TR} at (0,2) size 628x47
+            LayoutTableCell {TD} at (2,2) size 146x47 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (150,2) size 163x47 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (315,2) size 146x47 [r=0 c=2 rs=1 cs=1]
+            LayoutTableCell {TD} at (463,2) size 163x47 [r=0 c=3 rs=1 cs=1]
+          LayoutTableRow {TR} at (0,51) size 628x47
+            LayoutTableCell {TD} at (2,51) size 146x47 [r=1 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (150,51) size 163x47 [r=1 c=1 rs=1 cs=1]
       LayoutBlockFlow (anonymous) at (0,136) size 784x18
         LayoutText {#text} at (0,0) size 447x18
           text run at (0,0) width 447: "All the items in the following select elements should be right-aligned."
-      LayoutTable {TABLE} at (0,154) size 638x100
-        LayoutTableSection {TBODY} at (0,0) size 638x100
-          LayoutTableRow {TR} at (0,2) size 638x47
-            LayoutTableCell {TD} at (2,2) size 162x47 [r=0 c=0 rs=1 cs=1]
-            LayoutTableCell {TD} at (166,2) size 152x47 [r=0 c=1 rs=1 cs=1]
-            LayoutTableCell {TD} at (320,2) size 162x47 [r=0 c=2 rs=1 cs=1]
-            LayoutTableCell {TD} at (484,2) size 152x47 [r=0 c=3 rs=1 cs=1]
-          LayoutTableRow {TR} at (0,51) size 638x47
-            LayoutTableCell {TD} at (2,51) size 162x47 [r=1 c=0 rs=1 cs=1]
-            LayoutTableCell {TD} at (166,51) size 152x47 [r=1 c=1 rs=1 cs=1]
+      LayoutTable {TABLE} at (0,154) size 616x100
+        LayoutTableSection {TBODY} at (0,0) size 616x100
+          LayoutTableRow {TR} at (0,2) size 616x47
+            LayoutTableCell {TD} at (2,2) size 153x47 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (157,2) size 150x47 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (309,2) size 153x47 [r=0 c=2 rs=1 cs=1]
+            LayoutTableCell {TD} at (464,2) size 150x47 [r=0 c=3 rs=1 cs=1]
+          LayoutTableRow {TR} at (0,51) size 616x47
+            LayoutTableCell {TD} at (2,51) size 153x47 [r=1 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (157,51) size 150x47 [r=1 c=1 rs=1 cs=1]
       LayoutBlockFlow (anonymous) at (0,254) size 784x18
         LayoutText {#text} at (0,0) size 456x18
           text run at (0,0) width 456: "All the items in the following select elements should be center-aligned."
-      LayoutTable {TABLE} at (0,272) size 676x51
-        LayoutTableSection {TBODY} at (0,0) size 676x51
-          LayoutTableRow {TR} at (0,2) size 676x47
-            LayoutTableCell {TD} at (2,2) size 171x47 [r=0 c=0 rs=1 cs=1]
-            LayoutTableCell {TD} at (175,2) size 162x47 [r=0 c=1 rs=1 cs=1]
-            LayoutTableCell {TD} at (339,2) size 171x47 [r=0 c=2 rs=1 cs=1]
-            LayoutTableCell {TD} at (512,2) size 162x47 [r=0 c=3 rs=1 cs=1]
+      LayoutTable {TABLE} at (0,272) size 656x51
+        LayoutTableSection {TBODY} at (0,0) size 656x51
+          LayoutTableRow {TR} at (0,2) size 656x47
+            LayoutTableCell {TD} at (2,2) size 162x47 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (166,2) size 161x47 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (329,2) size 162x47 [r=0 c=2 rs=1 cs=1]
+            LayoutTableCell {TD} at (493,2) size 161x47 [r=0 c=3 rs=1 cs=1]
       LayoutBlockFlow (anonymous) at (0,323) size 784x18
         LayoutText {#text} at (0,0) size 296x18
           text run at (0,0) width 296: "The following tables check mixed alignments."
-      LayoutTable {TABLE} at (0,341) size 724x51
-        LayoutTableSection {TBODY} at (0,0) size 724x51
-          LayoutTableRow {TR} at (0,2) size 724x47
-            LayoutTableCell {TD} at (2,2) size 166x47 [r=0 c=0 rs=1 cs=1]
-            LayoutTableCell {TD} at (170,2) size 166x47 [r=0 c=1 rs=1 cs=1]
-            LayoutTableCell {TD} at (338,2) size 191x47 [r=0 c=2 rs=1 cs=1]
-            LayoutTableCell {TD} at (531,2) size 191x47 [r=0 c=3 rs=1 cs=1]
-layer at (11,47) size 152x45 clip at (12,48) size 139x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 151.67x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 116x13
-        text run at (2,0) width 116: "This is an English text"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 135x13
-        text run at (2,0) width 135: "It needs to be left aligned"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 85x13
-        text run at (2,0) width 85: "Some more text"
-layer at (167,47) size 161x45 clip at (168,48) size 148x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 161.30x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 148.30x14.19
+      LayoutTable {TABLE} at (0,341) size 702x51
+        LayoutTableSection {TBODY} at (0,0) size 702x51
+          LayoutTableRow {TR} at (0,2) size 702x47
+            LayoutTableCell {TD} at (2,2) size 157x47 [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (161,2) size 157x47 [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (320,2) size 189x47 [r=0 c=2 rs=1 cs=1]
+            LayoutTableCell {TD} at (511,2) size 189x47 [r=0 c=3 rs=1 cs=1]
+layer at (11,47) size 144x45 clip at (12,48) size 131x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 143.52x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 109x13
+        text run at (2,0) width 109: "This is an English text"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 127x13
+        text run at (2,0) width 127: "It needs to be left aligned"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 80x13
+        text run at (2,0) width 80: "Some more text"
+layer at (159,47) size 160x45 clip at (160,48) size 147x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 160.09x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 147.09x14.19
       LayoutText {#text} at (2,0) size 86x13
         text run at (2,0) width 86 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 148.30x14.19
-      LayoutText {#text} at (2,0) size 145x13
-        text run at (2,0) width 145 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 148.30x14.19
+    LayoutBlockFlow {OPTION} at (1,15.19) size 147.09x14.19
+      LayoutText {#text} at (2,0) size 144x13
+        text run at (2,0) width 144 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 147.09x14.19
       LayoutText {#text} at (2,0) size 80x13
         text run at (2,0) width 80 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
-layer at (333,47) size 152x45 clip at (345,48) size 139x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 151.67x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 116x13
-        text run at (2,0) width 116: "This is an English text"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 135x13
-        text run at (2,0) width 135: "It needs to be left aligned"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 85x13
-        text run at (2,0) width 85: "Some more text"
-layer at (489,47) size 161x45 clip at (501,48) size 148x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 161.30x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 148.30x14.19
+layer at (324,47) size 144x45 clip at (336,48) size 131x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 143.52x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 109x13
+        text run at (2,0) width 109: "This is an English text"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 127x13
+        text run at (2,0) width 127: "It needs to be left aligned"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 80x13
+        text run at (2,0) width 80: "Some more text"
+layer at (472,47) size 160x45 clip at (484,48) size 147x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 160.09x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 147.09x14.19
       LayoutText {#text} at (2,0) size 86x13
         text run at (2,0) width 86 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 148.30x14.19
-      LayoutText {#text} at (2,0) size 145x13
-        text run at (2,0) width 145 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 148.30x14.19
+    LayoutBlockFlow {OPTION} at (12,15.19) size 147.09x14.19
+      LayoutText {#text} at (2,0) size 144x13
+        text run at (2,0) width 144 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 147.09x14.19
       LayoutText {#text} at (2,0) size 80x13
         text run at (2,0) width 80 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
-layer at (11,96) size 152x45 clip at (12,97) size 139x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 151.67x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 116x13
-        text run at (2,0) width 116: "This is an English text"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 135x13
-        text run at (2,0) width 135: "It needs to be left aligned"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 138.67x14.19
-      LayoutText {#text} at (2,0) size 85x13
-        text run at (2,0) width 85: "Some more text"
-layer at (167,96) size 161x45 clip at (168,97) size 148x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 161.30x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 148.30x14.19
+layer at (11,96) size 144x45 clip at (12,97) size 131x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 143.52x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 109x13
+        text run at (2,0) width 109: "This is an English text"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 127x13
+        text run at (2,0) width 127: "It needs to be left aligned"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 130.52x14.19
+      LayoutText {#text} at (2,0) size 80x13
+        text run at (2,0) width 80: "Some more text"
+layer at (159,96) size 160x45 clip at (160,97) size 147x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 160.09x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 147.09x14.19
       LayoutText {#text} at (2,0) size 86x13
         text run at (2,0) width 86 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 148.30x14.19
-      LayoutText {#text} at (2,0) size 145x13
-        text run at (2,0) width 145 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 148.30x14.19
+    LayoutBlockFlow {OPTION} at (1,15.19) size 147.09x14.19
+      LayoutText {#text} at (2,0) size 144x13
+        text run at (2,0) width 144 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 147.09x14.19
       LayoutText {#text} at (2,0) size 80x13
         text run at (2,0) width 80 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
-layer at (11,165) size 159x45 clip at (23,166) size 146x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 159.02x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 146.02x14.19
-      LayoutText {#text} at (28,0) size 117x13
-        text run at (28,0) width 117: "This is an English text"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 146.02x14.19
+layer at (11,165) size 151x45 clip at (23,166) size 138x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 150.56x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 137.56x14.19
+      LayoutText {#text} at (27,0) size 109x13
+        text run at (27,0) width 109: "This is an English text"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 137.56x14.19
+      LayoutText {#text} at (2,0) size 134x13
+        text run at (2,0) width 134: "It needs to be right aligned"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 137.56x14.19
+      LayoutText {#text} at (55,0) size 81x13
+        text run at (55,0) width 81: "Some more text"
+layer at (166,165) size 148x45 clip at (178,166) size 135x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 147.83x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 134.83x14.19
+      LayoutText {#text} at (47,0) size 86x13
+        text run at (47,0) width 86 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 134.83x14.19
+      LayoutText {#text} at (2,0) size 131x13
+        text run at (2,0) width 131 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 134.83x14.19
+      LayoutText {#text} at (53,0) size 80x13
+        text run at (53,0) width 80 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
+layer at (318,165) size 151x45 clip at (330,166) size 138x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 150.56x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 137.56x14.19
+      LayoutText {#text} at (27,0) size 109x13
+        text run at (27,0) width 109: "This is an English text"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 137.56x14.19
+      LayoutText {#text} at (2,0) size 134x13
+        text run at (2,0) width 134: "It needs to be right aligned"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 137.56x14.19
+      LayoutText {#text} at (55,0) size 81x13
+        text run at (55,0) width 81: "Some more text"
+layer at (473,165) size 148x45 clip at (485,166) size 135x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 147.83x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 134.83x14.19
+      LayoutText {#text} at (47,0) size 86x13
+        text run at (47,0) width 86 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 134.83x14.19
+      LayoutText {#text} at (2,0) size 131x13
+        text run at (2,0) width 131 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 134.83x14.19
+      LayoutText {#text} at (53,0) size 80x13
+        text run at (53,0) width 80 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
+layer at (11,214) size 151x45 clip at (12,215) size 138x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 150.56x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 137.56x14.19
+      LayoutText {#text} at (27,0) size 109x13
+        text run at (27,0) width 109: "This is an English text"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 137.56x14.19
+      LayoutText {#text} at (2,0) size 134x13
+        text run at (2,0) width 134: "It needs to be right aligned"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 137.56x14.19
+      LayoutText {#text} at (55,0) size 81x13
+        text run at (55,0) width 81: "Some more text"
+layer at (166,214) size 148x45 clip at (167,215) size 135x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 147.83x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 134.83x14.19
+      LayoutText {#text} at (47,0) size 86x13
+        text run at (47,0) width 86 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 134.83x14.19
+      LayoutText {#text} at (2,0) size 131x13
+        text run at (2,0) width 131 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 134.83x14.19
+      LayoutText {#text} at (53,0) size 80x13
+        text run at (53,0) width 80 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
+layer at (11,283) size 160x45 clip at (23,284) size 147x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 159.67x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 146.67x14.19
+      LayoutText {#text} at (19,0) size 109x13
+        text run at (19,0) width 109: "This is an English text"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 146.67x14.19
       LayoutText {#text} at (2,0) size 143x13
-        text run at (2,0) width 143: "It needs to be right aligned"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 146.02x14.19
-      LayoutText {#text} at (59,0) size 86x13
-        text run at (59,0) width 86: "Some more text"
-layer at (175,165) size 149x45 clip at (187,166) size 136x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 149.05x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 136.05x14.19
-      LayoutText {#text} at (48,0) size 87x13
-        text run at (48,0) width 87 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 136.05x14.19
-      LayoutText {#text} at (2,0) size 133x13
-        text run at (2,0) width 133 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 136.05x14.19
-      LayoutText {#text} at (54,0) size 81x13
-        text run at (54,0) width 81 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
-layer at (329,165) size 159x45 clip at (341,166) size 146x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 159.02x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 146.02x14.19
-      LayoutText {#text} at (28,0) size 117x13
-        text run at (28,0) width 117: "This is an English text"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 146.02x14.19
-      LayoutText {#text} at (2,0) size 143x13
-        text run at (2,0) width 143: "It needs to be right aligned"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 146.02x14.19
-      LayoutText {#text} at (59,0) size 86x13
-        text run at (59,0) width 86: "Some more text"
-layer at (493,165) size 149x45 clip at (505,166) size 136x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 149.05x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 136.05x14.19
-      LayoutText {#text} at (48,0) size 87x13
-        text run at (48,0) width 87 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 136.05x14.19
-      LayoutText {#text} at (2,0) size 133x13
-        text run at (2,0) width 133 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 136.05x14.19
-      LayoutText {#text} at (54,0) size 81x13
-        text run at (54,0) width 81 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
-layer at (11,214) size 159x45 clip at (12,215) size 146x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 159.02x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 146.02x14.19
-      LayoutText {#text} at (28,0) size 117x13
-        text run at (28,0) width 117: "This is an English text"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 146.02x14.19
-      LayoutText {#text} at (2,0) size 143x13
-        text run at (2,0) width 143: "It needs to be right aligned"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 146.02x14.19
-      LayoutText {#text} at (59,0) size 86x13
-        text run at (59,0) width 86: "Some more text"
-layer at (175,214) size 149x45 clip at (176,215) size 136x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 149.05x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 136.05x14.19
-      LayoutText {#text} at (48,0) size 87x13
-        text run at (48,0) width 87 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 136.05x14.19
-      LayoutText {#text} at (2,0) size 133x13
-        text run at (2,0) width 133 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 136.05x14.19
-      LayoutText {#text} at (54,0) size 81x13
-        text run at (54,0) width 81 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
-layer at (11,283) size 168x45 clip at (23,284) size 155x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 168.42x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 155.42x14.19
-      LayoutText {#text} at (20,0) size 116x13
-        text run at (20,0) width 116: "This is an English text"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 155.42x14.19
-      LayoutText {#text} at (2,0) size 152x13
-        text run at (2,0) width 152: "It needs to be center aligned"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 155.42x14.19
-      LayoutText {#text} at (35,0) size 85x13
-        text run at (35,0) width 85: "Some more text"
-layer at (184,283) size 159x45 clip at (196,284) size 146x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 159.44x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 146.44x14.19
-      LayoutText {#text} at (30,0) size 87x13
-        text run at (30,0) width 87 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 146.44x14.19
-      LayoutText {#text} at (2,0) size 143x13
-        text run at (2,0) width 143 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D0}\x{5DE}\x{5E6}\x{5E2}"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 146.44x14.19
+        text run at (2,0) width 143: "It needs to be center aligned"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 146.67x14.19
       LayoutText {#text} at (33,0) size 81x13
-        text run at (33,0) width 81 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
-layer at (348,283) size 168x45 clip at (349,284) size 155x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 168.42x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 155.42x14.19
-      LayoutText {#text} at (20,0) size 116x13
-        text run at (20,0) width 116: "This is an English text"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 155.42x14.19
-      LayoutText {#text} at (2,0) size 152x13
-        text run at (2,0) width 152: "It needs to be center aligned"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 155.42x14.19
-      LayoutText {#text} at (35,0) size 85x13
-        text run at (35,0) width 85: "Some more text"
-layer at (521,283) size 159x45 clip at (522,284) size 146x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 159.44x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 146.44x14.19
-      LayoutText {#text} at (30,0) size 87x13
-        text run at (30,0) width 87 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 146.44x14.19
+        text run at (33,0) width 81: "Some more text"
+layer at (175,283) size 158x45 clip at (187,284) size 145x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 158.22x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 145.22x14.19
+      LayoutText {#text} at (30,0) size 86x13
+        text run at (30,0) width 86 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 145.22x14.19
+      LayoutText {#text} at (2,0) size 142x13
+        text run at (2,0) width 142 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D0}\x{5DE}\x{5E6}\x{5E2}"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 145.22x14.19
+      LayoutText {#text} at (32,0) size 81x13
+        text run at (32,0) width 81 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
+layer at (338,283) size 160x45 clip at (339,284) size 147x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 159.67x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 146.67x14.19
+      LayoutText {#text} at (19,0) size 109x13
+        text run at (19,0) width 109: "This is an English text"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 146.67x14.19
       LayoutText {#text} at (2,0) size 143x13
-        text run at (2,0) width 143 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D0}\x{5DE}\x{5E6}\x{5E2}"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 146.44x14.19
+        text run at (2,0) width 143: "It needs to be center aligned"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 146.67x14.19
       LayoutText {#text} at (33,0) size 81x13
-        text run at (33,0) width 81 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
-layer at (11,352) size 163x45 clip at (23,353) size 150x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 163.36x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 150.36x14.19
-      LayoutText {#text} at (2,0) size 147x13
-        text run at (2,0) width 147: "This should be right aligned"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 150.36x14.19
-      LayoutText {#text} at (2,0) size 139x13
-        text run at (2,0) width 139: "This should be left aligned"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 150.36x14.19
-      LayoutText {#text} at (36,0) size 78x13
-        text run at (36,0) width 78: "Center aligned"
-layer at (179,352) size 163x45 clip at (180,353) size 150x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 163.36x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 150.36x14.19
-      LayoutText {#text} at (2,0) size 139x13
-        text run at (2,0) width 139: "This should be left aligned"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 150.36x14.19
-      LayoutText {#text} at (2,0) size 147x13
-        text run at (2,0) width 147: "This should be right aligned"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 150.36x14.19
-      LayoutText {#text} at (36,0) size 78x13
-        text run at (36,0) width 78: "Center aligned"
-layer at (347,352) size 188x45 clip at (359,353) size 175x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 188.19x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 175.19x14.19
-      LayoutText {#text} at (14,0) size 160x13
-        text run at (14,0) width 160 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D6}\x{5D4} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
-    LayoutBlockFlow {OPTION} at (12,15.19) size 175.19x14.19
-      LayoutText {#text} at (2,0) size 172x13
-        text run at (2,0) width 172 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D6}\x{5D4} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
-    LayoutBlockFlow {OPTION} at (12,29.38) size 175.19x14.19
-      LayoutText {#text} at (53,0) size 69x13
-        text run at (53,0) width 69 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5DE}\x{5DE}\x{5D5}\x{5E8}\x{5DB}\x{5D6}"
-layer at (540,352) size 188x45 clip at (541,353) size 175x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,1.44) size 188.19x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 175.19x14.19
-      LayoutText {#text} at (2,0) size 172x13
-        text run at (2,0) width 172 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D6}\x{5D4} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 175.19x14.19
-      LayoutText {#text} at (14,0) size 160x13
-        text run at (14,0) width 160 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D6}\x{5D4} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 175.19x14.19
-      LayoutText {#text} at (53,0) size 69x13
-        text run at (53,0) width 69 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5DE}\x{5DE}\x{5D5}\x{5E8}\x{5DB}\x{5D6}"
+        text run at (33,0) width 81: "Some more text"
+layer at (502,283) size 158x45 clip at (503,284) size 145x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 158.22x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 145.22x14.19
+      LayoutText {#text} at (30,0) size 86x13
+        text run at (30,0) width 86 RTL: "\x{5D6}\x{5D4} \x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D1}\x{5E2}\x{5D1}\x{5E8}\x{5D9}\x{5EA}"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 145.22x14.19
+      LayoutText {#text} at (2,0) size 142x13
+        text run at (2,0) width 142 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D0}\x{5DE}\x{5E6}\x{5E2}"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 145.22x14.19
+      LayoutText {#text} at (32,0) size 81x13
+        text run at (32,0) width 81 RTL: "\x{5D9}\x{5E9}\x{5E8}\x{5D0}\x{5DC} \x{5DE}\x{5EA}\x{5D9}\x{5D9}\x{5D1}\x{5E9}\x{5EA}"
+layer at (11,352) size 155x45 clip at (23,353) size 142x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 154.91x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 141.91x14.19
+      LayoutText {#text} at (2,0) size 138x13
+        text run at (2,0) width 138: "This should be right aligned"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 141.91x14.19
+      LayoutText {#text} at (2,0) size 131x13
+        text run at (2,0) width 131: "This should be left aligned"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 141.91x14.19
+      LayoutText {#text} at (34,0) size 74x13
+        text run at (34,0) width 74: "Center aligned"
+layer at (170,352) size 155x45 clip at (171,353) size 142x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 154.91x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 141.91x14.19
+      LayoutText {#text} at (2,0) size 131x13
+        text run at (2,0) width 131: "This should be left aligned"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 141.91x14.19
+      LayoutText {#text} at (2,0) size 138x13
+        text run at (2,0) width 138: "This should be right aligned"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 141.91x14.19
+      LayoutText {#text} at (34,0) size 74x13
+        text run at (34,0) width 74: "Center aligned"
+layer at (329,352) size 187x45 clip at (341,353) size 174x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 186.67x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 173.67x14.19
+      LayoutText {#text} at (14,0) size 158x13
+        text run at (14,0) width 158 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D6}\x{5D4} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
+    LayoutBlockFlow {OPTION} at (12,15.19) size 173.67x14.19
+      LayoutText {#text} at (2,0) size 170x13
+        text run at (2,0) width 170 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D6}\x{5D4} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
+    LayoutBlockFlow {OPTION} at (12,29.38) size 173.67x14.19
+      LayoutText {#text} at (53,0) size 68x13
+        text run at (53,0) width 68 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5DE}\x{5DE}\x{5D5}\x{5E8}\x{5DB}\x{5D6}"
+layer at (520,352) size 187x45 clip at (521,353) size 174x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,1.44) size 186.67x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 173.67x14.19
+      LayoutText {#text} at (2,0) size 170x13
+        text run at (2,0) width 170 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D6}\x{5D4} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5E9}\x{5DE}\x{5D0}\x{5DC}"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 173.67x14.19
+      LayoutText {#text} at (14,0) size 158x13
+        text run at (14,0) width 158 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5D6}\x{5D4} \x{5E6}\x{5E8}\x{5D9}\x{5DA} \x{5DC}\x{5D4}\x{5D9}\x{5D5}\x{5EA} \x{5DE}\x{5D9}\x{5D5}\x{5E9}\x{5E8} \x{5DC}\x{5D9}\x{5DE}\x{5D9}\x{5DF}"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 173.67x14.19
+      LayoutText {#text} at (53,0) size 68x13
+        text run at (53,0) width 68 RTL: "\x{5D8}\x{5E7}\x{5E1}\x{5D8} \x{5DE}\x{5DE}\x{5D5}\x{5E8}\x{5DB}\x{5D6}"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-hit-test-zoomed-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-hit-test-zoomed-expected.png
index 8719f47..49e8ff51 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-hit-test-zoomed-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-hit-test-zoomed-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-hit-test-zoomed-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-hit-test-zoomed-expected.txt
index fe4cc55..40dc1ca 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-hit-test-zoomed-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-hit-test-zoomed-expected.txt
@@ -14,56 +14,56 @@
         LayoutBR {BR} at (104,39) size 1x0
         LayoutText {#text} at (0,44) size 105x22
           text run at (0,44) width 105: "Test 2 Passed"
-layer at (10,10) size 127x162 clip at (22,22) size 92x138 scrollHeight 316
-  LayoutListBox {SELECT} at (0,0) size 127.33x162 [bgcolor=#FFFFFF] [border: (12px solid #000000)]
-    LayoutBlockFlow {OPTION} at (24,24) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 24x16
-        text run at (2,0) width 24: "one"
-    LayoutBlockFlow {OPTION} at (24,41.19) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 24x16
-        text run at (2,0) width 24: "two"
-    LayoutBlockFlow {OPTION} at (24,58.38) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 33x16
-        text run at (2,0) width 33: "three"
-    LayoutBlockFlow {OPTION} at (24,75.56) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 25x16
-        text run at (2,0) width 25: "four"
-    LayoutBlockFlow {OPTION} at (24,92.75) size 68.33x17.19
+layer at (10,10) size 125x162 clip at (22,22) size 90x138 scrollHeight 316
+  LayoutListBox {SELECT} at (0,0) size 125.16x162 [bgcolor=#FFFFFF] [border: (12px solid #000000)]
+    LayoutBlockFlow {OPTION} at (24,24) size 66.16x17.19
       LayoutText {#text} at (2,0) size 23x16
-        text run at (2,0) width 23: "five"
-    LayoutBlockFlow {OPTION} at (24,109.94) size 68.33x17.19
+        text run at (2,0) width 23: "one"
+    LayoutBlockFlow {OPTION} at (24,41.19) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 23x16
+        text run at (2,0) width 23: "two"
+    LayoutBlockFlow {OPTION} at (24,58.38) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 31x16
+        text run at (2,0) width 31: "three"
+    LayoutBlockFlow {OPTION} at (24,75.56) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 24x16
+        text run at (2,0) width 24: "four"
+    LayoutBlockFlow {OPTION} at (24,92.75) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 22x16
+        text run at (2,0) width 22: "five"
+    LayoutBlockFlow {OPTION} at (24,109.94) size 66.16x17.19
       LayoutText {#text} at (2,0) size 18x16
         text run at (2,0) width 18: "six"
-    LayoutBlockFlow {OPTION} at (24,127.13) size 68.33x17.19 [color=#FFFFFF] [bgcolor=#0069D9]
-      LayoutText {#text} at (2,0) size 37x16
-        text run at (2,0) width 37: "seven"
-    LayoutBlockFlow {OPTION} at (24,144.31) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 32x16
-        text run at (2,0) width 32: "eight"
-    LayoutBlockFlow {OPTION} at (24,161.50) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 27x16
-        text run at (2,0) width 27: "nine"
-    LayoutBlockFlow {OPTION} at (24,178.69) size 68.33x17.19
+    LayoutBlockFlow {OPTION} at (24,127.13) size 66.16x17.19 [color=#FFFFFF] [bgcolor=#0069D9]
+      LayoutText {#text} at (2,0) size 36x16
+        text run at (2,0) width 36: "seven"
+    LayoutBlockFlow {OPTION} at (24,144.31) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 30x16
+        text run at (2,0) width 30: "eight"
+    LayoutBlockFlow {OPTION} at (24,161.50) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 26x16
+        text run at (2,0) width 26: "nine"
+    LayoutBlockFlow {OPTION} at (24,178.69) size 66.16x17.19
       LayoutText {#text} at (2,0) size 20x16
         text run at (2,0) width 20: "ten"
-    LayoutBlockFlow {OPTION} at (24,195.88) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 41x16
-        text run at (2,0) width 41: "eleven"
-    LayoutBlockFlow {OPTION} at (24,213.06) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 41x16
-        text run at (2,0) width 41: "twelve"
-    LayoutBlockFlow {OPTION} at (24,230.25) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 48x16
-        text run at (2,0) width 48: "thirteen"
-    LayoutBlockFlow {OPTION} at (24,247.44) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 52x16
-        text run at (2,0) width 52: "fourteen"
-    LayoutBlockFlow {OPTION} at (24,264.63) size 68.33x17.19
+    LayoutBlockFlow {OPTION} at (24,195.88) size 66.16x17.19
       LayoutText {#text} at (2,0) size 40x16
-        text run at (2,0) width 40: "fifteen"
-    LayoutBlockFlow {OPTION} at (24,281.81) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 45x16
-        text run at (2,0) width 45: "sixteen"
-    LayoutBlockFlow {OPTION} at (24,299) size 68.33x17.19
-      LayoutText {#text} at (2,0) size 64x16
-        text run at (2,0) width 64: "seventeen"
+        text run at (2,0) width 40: "eleven"
+    LayoutBlockFlow {OPTION} at (24,213.06) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 39x16
+        text run at (2,0) width 39: "twelve"
+    LayoutBlockFlow {OPTION} at (24,230.25) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 46x16
+        text run at (2,0) width 46: "thirteen"
+    LayoutBlockFlow {OPTION} at (24,247.44) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 51x16
+        text run at (2,0) width 51: "fourteen"
+    LayoutBlockFlow {OPTION} at (24,264.63) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 38x16
+        text run at (2,0) width 38: "fifteen"
+    LayoutBlockFlow {OPTION} at (24,281.81) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 44x16
+        text run at (2,0) width 44: "sixteen"
+    LayoutBlockFlow {OPTION} at (24,299) size 66.16x17.19
+      LayoutText {#text} at (2,0) size 62x16
+        text run at (2,0) width 62: "seventeen"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-scrollbar-incremental-load-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-scrollbar-incremental-load-expected.png
index 4705f16..7212258 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-scrollbar-incremental-load-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-scrollbar-incremental-load-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-scrollbar-incremental-load-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-scrollbar-incremental-load-expected.txt
index bcf45576..2f967d2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-scrollbar-incremental-load-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-scrollbar-incremental-load-expected.txt
@@ -24,26 +24,26 @@
           text run at (154,18) width 89: "to reflect this."
       LayoutBlockFlow (anonymous) at (0,104) size 784x58
         LayoutText {#text} at (0,0) size 0x0
-layer at (8,112) size 50x59 clip at (9,113) size 37x57 scrollY 43.00 scrollHeight 99
-  LayoutListBox {SELECT} at (0,0.25) size 49.58x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 36.58x14.19
+layer at (8,112) size 48x59 clip at (9,113) size 35x57 scrollY 43.00 scrollHeight 99
+  LayoutListBox {SELECT} at (0,0.25) size 48.06x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 35.06x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 36.58x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 35.06x14.19
       LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "Four"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "Five"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 17x13
-        text run at (2,0) width 17: "Six"
-    LayoutBlockFlow {OPTION} at (1,86.13) size 36.58x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
+        text run at (2,0) width 23: "Four"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "Five"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 16x13
+        text run at (2,0) width 16: "Six"
+    LayoutBlockFlow {OPTION} at (1,86.13) size 35.06x14.19 [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-width-change-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-width-change-expected.png
index b252959..b2812ac 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-width-change-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-width-change-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-width-change-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-width-change-expected.txt
index d838ffc..d5a13650 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-width-change-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/listbox-width-change-expected.txt
@@ -7,8 +7,8 @@
         text run at (0,0) width 665: "This tests that when a list box's options get updated, the list box will recalculate its width, and relayout. "
       LayoutBR {BR} at (0,0) size 0x0
       LayoutText {#text} at (0,0) size 0x0
-layer at (8,26) size 189x59 clip at (9,27) size 176x57 scrollHeight 56
-  LayoutListBox {SELECT} at (0,18.25) size 189.38x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 176.38x14.19
-      LayoutText {#text} at (2,0) size 173x13
-        text run at (2,0) width 173: "This text should fit in the list box"
+layer at (8,26) size 179x59 clip at (9,27) size 166x57 scrollHeight 56
+  LayoutListBox {SELECT} at (0,18.25) size 178.52x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 165.52x14.19
+      LayoutText {#text} at (2,0) size 162x13
+        text run at (2,0) width 162: "This text should fit in the list box"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-deselect-update-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-deselect-update-expected.png
index 47d332452..b66ebf653 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-deselect-update-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-deselect-update-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-deselect-update-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-deselect-update-expected.txt
index 03654ce2..6643386f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-deselect-update-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-deselect-update-expected.txt
@@ -5,9 +5,9 @@
     LayoutBlockFlow {BODY} at (8,8) size 784x584
       LayoutText {#text} at (0,0) size 76x18
         text run at (0,0) width 76: "Test result: "
-      LayoutMenuList {SELECT} at (75.53,1) size 62x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 62x18
-          LayoutText (anonymous) at (8,2) size 31x13
-            text run at (8,2) width 31: "PASS"
+      LayoutMenuList {SELECT} at (75.53,1) size 60x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 60x18
+          LayoutText (anonymous) at (8,2) size 29x13
+            text run at (8,2) width 29: "PASS"
       LayoutText {#text} at (0,0) size 0x0
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-narrow-width-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-narrow-width-expected.png
index 56d01c6..53659643 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-narrow-width-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-narrow-width-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-narrow-width-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-narrow-width-expected.txt
index 91bb6f86..e9be40a5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-narrow-width-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-narrow-width-expected.txt
@@ -8,11 +8,11 @@
       LayoutBR {BR} at (510,14) size 1x0
       LayoutMenuList {SELECT} at (0,18) size 1x18 [bgcolor=#F8F8F8]
         LayoutBlockFlow (anonymous) at (0,0) size 31x18
-          LayoutText (anonymous) at (8,2) size 20x13
-            text run at (8,2) width 20: "test"
+          LayoutText (anonymous) at (8,2) size 19x13
+            text run at (8,2) width 19: "test"
       LayoutBR {BR} at (1,31) size 0x0
       LayoutMenuList {SELECT} at (0,36) size 2x18 [bgcolor=#0000FF] [border: (1px solid #A6A6A6)]
         LayoutBlockFlow (anonymous) at (1,1) size 29x16
-          LayoutText (anonymous) at (8,1) size 20x13
-            text run at (8,1) width 20: "test"
+          LayoutText (anonymous) at (8,1) size 19x13
+            text run at (8,1) width 19: "test"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-no-overflow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-no-overflow-expected.png
index 1bd24c1..37be1c6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-no-overflow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-no-overflow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-no-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-no-overflow-expected.txt
index f886971..e935468 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-no-overflow-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-no-overflow-expected.txt
@@ -3,8 +3,8 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,0) size 249x15 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 249x16
-          LayoutText (anonymous) at (10,2) size 217x11
-            text run at (10,2) width 217: "No overflow should be allowed on popup menus!"
+      LayoutMenuList {SELECT} at (0,0) size 233x15 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 233x16
+          LayoutText (anonymous) at (10,2) size 201x11
+            text run at (10,2) width 201: "No overflow should be allowed on popup menus!"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-option-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-option-wrap-expected.png
index 55738d4..e06d6ed 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-option-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-option-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-option-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-option-wrap-expected.txt
index 5e962ca5..6f8a8124 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-option-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-option-wrap-expected.txt
@@ -25,8 +25,8 @@
           text run at (98,0) width 9: ": "
         LayoutMenuList {SELECT} at (106.83,2) size 100x15 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
           LayoutBlockFlow (anonymous) at (1,1) size 98x13
-            LayoutText (anonymous) at (0,0) size 174x13
-              text run at (0,0) width 174: "Very long option that does not fit"
+            LayoutText (anonymous) at (0,0) size 164x13
+              text run at (0,0) width 164: "Very long option that does not fit"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,68) size 784x18
         LayoutText {#text} at (0,0) size 57x18
@@ -38,6 +38,6 @@
           text run at (87,0) width 10: ": "
         LayoutMenuList {SELECT} at (96.08,2) size 100x15 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
           LayoutBlockFlow (anonymous) at (1,1) size 98x13
-            LayoutText (anonymous) at (0,0) size 174x13
-              text run at (0,0) width 174: "Very long option that does not fit"
+            LayoutText (anonymous) at (0,0) size 164x13
+              text run at (0,0) width 164: "Very long option that does not fit"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-restrict-line-height-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-restrict-line-height-expected.png
index 3babf4e..5e77416 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-restrict-line-height-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-restrict-line-height-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-restrict-line-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-restrict-line-height-expected.txt
index 9409a79..799bf164 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-restrict-line-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-restrict-line-height-expected.txt
@@ -6,7 +6,7 @@
       LayoutText {#text} at (0,0) size 426x18
         text run at (0,0) width 426: "This tests that we don't honor line-height for styled popup buttons."
       LayoutBR {BR} at (425,14) size 1x0
-      LayoutMenuList {SELECT} at (0,18) size 199x18 [bgcolor=#ADD8E6] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 197x16
-          LayoutText (anonymous) at (8,1) size 168x13
-            text run at (8,1) width 168: "This text should not be clipped."
+      LayoutMenuList {SELECT} at (0,18) size 189x18 [bgcolor=#ADD8E6] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 187x16
+          LayoutText (anonymous) at (8,1) size 158x13
+            text run at (8,1) width 158: "This text should not be clipped."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-style-color-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-style-color-expected.png
index fe27133..11a3f2fa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-style-color-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-style-color-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-style-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-style-color-expected.txt
index fea6b0c..22da1f7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-style-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-style-color-expected.txt
@@ -3,26 +3,26 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,1) size 69x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 69x18
-          LayoutText (anonymous) at (8,2) size 38x13
-            text run at (8,2) width 38: "Default"
-      LayoutText {#text} at (69,0) size 4x18
-        text run at (69,0) width 4: " "
-      LayoutMenuList {SELECT} at (73,1) size 53x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 53x18
-          LayoutText (anonymous) at (8,2) size 22x13
-            text run at (8,2) width 22: "Red"
-      LayoutText {#text} at (126,0) size 4x18
-        text run at (126,0) width 4: " "
-      LayoutMenuList {SELECT} at (130,1) size 119x18 [bgcolor=#008000] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 117x16
-          LayoutText (anonymous) at (8,1) size 88x13
-            text run at (8,1) width 88: "Default on green"
-      LayoutText {#text} at (249,0) size 4x18
-        text run at (249,0) width 4: " "
-      LayoutMenuList {SELECT} at (253,1) size 103x18 [color=#FF0000] [bgcolor=#008000] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 101x16
-          LayoutText (anonymous) at (8,1) size 72x13
-            text run at (8,1) width 72: "Red on green"
+      LayoutMenuList {SELECT} at (0,1) size 67x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 67x18
+          LayoutText (anonymous) at (8,2) size 36x13
+            text run at (8,2) width 36: "Default"
+      LayoutText {#text} at (67,0) size 4x18
+        text run at (67,0) width 4: " "
+      LayoutMenuList {SELECT} at (71,1) size 52x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 52x18
+          LayoutText (anonymous) at (8,2) size 21x13
+            text run at (8,2) width 21: "Red"
+      LayoutText {#text} at (123,0) size 4x18
+        text run at (123,0) width 4: " "
+      LayoutMenuList {SELECT} at (127,1) size 114x18 [bgcolor=#008000] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 112x16
+          LayoutText (anonymous) at (8,1) size 83x13
+            text run at (8,1) width 83: "Default on green"
+      LayoutText {#text} at (241,0) size 4x18
+        text run at (241,0) width 4: " "
+      LayoutMenuList {SELECT} at (245,1) size 99x18 [color=#FF0000] [bgcolor=#008000] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 97x16
+          LayoutText (anonymous) at (8,1) size 68x13
+            text run at (8,1) width 68: "Red on green"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-width-change-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-width-change-expected.png
index 4ee14a7..2dc5d57 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-width-change-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-width-change-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-width-change-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-width-change-expected.txt
index 9420c01..c4ea616 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-width-change-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/menulist-width-change-expected.txt
@@ -10,9 +10,9 @@
         LayoutText {#text} at (0,18) size 375x18
           text run at (0,18) width 375: "that the select automatically recalculates the correct width."
         LayoutBR {BR} at (374,32) size 1x0
-        LayoutMenuList {SELECT} at (0,36) size 136x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 136x18
-            LayoutText (anonymous) at (8,2) size 29x13
-              text run at (8,2) width 29: "Short"
+        LayoutMenuList {SELECT} at (0,36) size 130x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 130x18
+            LayoutText (anonymous) at (8,2) size 28x13
+              text run at (8,2) width 28: "Short"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,54) size 784x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/minWidthPercent-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/minWidthPercent-expected.png
index 2673d0b..6519147 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/minWidthPercent-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/minWidthPercent-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/minWidthPercent-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/minWidthPercent-expected.txt
index 5561b5ad..80fcb4c4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/minWidthPercent-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/minWidthPercent-expected.txt
@@ -10,7 +10,7 @@
               LayoutTableCell {TD} at (2,2) size 115x21 [r=0 c=0 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 113x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                 LayoutText {#text} at (0,0) size 0x0
-layer at (14,14) size 107x13 scrollWidth 112
+layer at (14,14) size 107x13
   LayoutBlockFlow {DIV} at (3,3) size 107x13
-    LayoutText {#text} at (0,0) size 113x13
-      text run at (0,0) width 113: "Should fit in blue box"
+    LayoutText {#text} at (0,0) size 106x13
+      text run at (0,0) width 106: "Should fit in blue box"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-rtl-expected.png
index 8387ccf..992335c6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-rtl-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-rtl-expected.txt
index b0c9183..aea6993 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-rtl-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-rtl-expected.txt
@@ -61,8 +61,8 @@
       text run at (105,0) width 7: "3"
 layer at (24,124) size 112x13
   LayoutBlockFlow {DIV} at (0,0) size 112x13
-    LayoutText {#text} at (85,0) size 27x13
-      text run at (85,0) width 27: "1234"
+    LayoutText {#text} at (87,0) size 25x13
+      text run at (87,0) width 25: "1234"
 layer at (11,159) size 112x13
   LayoutBlockFlow {DIV} at (0,0) size 112x13
     LayoutText {#text} at (0,0) size 7x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.png
index dee10c0b..91fed96 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.txt
index 9a344bf5..73e9330 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-disabled-readonly-expected.txt
@@ -8,41 +8,41 @@
           text run at (0,0) width 763: "Test appearances of spin buttons. Disabled state and read-only state should have appearances different from the normal"
           text run at (0,18) width 34: "state."
       LayoutBlockFlow {DIV} at (0,52) size 784x29
-        LayoutInline {LABEL} at (0,0) size 302x18
-          LayoutTextControl {INPUT} at (0,0) size 215x29 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-            LayoutFlexibleBox {DIV} at (3,3) size 209x23
-              LayoutBlockFlow {DIV} at (0,0) size 196x23
-              LayoutBlockFlow {DIV} at (196,4) size 13x15
-          LayoutText {#text} at (215,8) size 87x18
-            text run at (215,8) width 87: " Normal state"
+        LayoutInline {LABEL} at (0,0) size 321x18
+          LayoutTextControl {INPUT} at (0,0) size 234x29 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutFlexibleBox {DIV} at (3,3) size 228x23
+              LayoutBlockFlow {DIV} at (0,0) size 215x23
+              LayoutBlockFlow {DIV} at (215,4) size 13x15
+          LayoutText {#text} at (234,8) size 87x18
+            text run at (234,8) width 87: " Normal state"
       LayoutBlockFlow {DIV} at (0,81) size 784x29
-        LayoutInline {LABEL} at (0,0) size 310x18
-          LayoutTextControl {INPUT} at (0,0) size 215x29 [color=#545454] [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-            LayoutFlexibleBox {DIV} at (3,3) size 209x23
-              LayoutBlockFlow {DIV} at (0,0) size 196x23
-          LayoutText {#text} at (215,8) size 95x18
-            text run at (215,8) width 95: " Disabled state"
+        LayoutInline {LABEL} at (0,0) size 329x18
+          LayoutTextControl {INPUT} at (0,0) size 234x29 [color=#545454] [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutFlexibleBox {DIV} at (3,3) size 228x23
+              LayoutBlockFlow {DIV} at (0,0) size 215x23
+          LayoutText {#text} at (234,8) size 95x18
+            text run at (234,8) width 95: " Disabled state"
       LayoutBlockFlow {DIV} at (0,110) size 784x29
-        LayoutInline {LABEL} at (0,0) size 319x18
-          LayoutTextControl {INPUT} at (0,0) size 215x29 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-            LayoutFlexibleBox {DIV} at (3,3) size 209x23
-              LayoutBlockFlow {DIV} at (0,0) size 196x23
-          LayoutText {#text} at (215,8) size 104x18
-            text run at (215,8) width 104: " Read-only state"
-layer at (11,63) size 196x23
-  LayoutBlockFlow {DIV} at (0,0) size 196x23
+        LayoutInline {LABEL} at (0,0) size 338x18
+          LayoutTextControl {INPUT} at (0,0) size 234x29 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutFlexibleBox {DIV} at (3,3) size 228x23
+              LayoutBlockFlow {DIV} at (0,0) size 215x23
+          LayoutText {#text} at (234,8) size 104x18
+            text run at (234,8) width 104: " Read-only state"
+layer at (11,63) size 215x23
+  LayoutBlockFlow {DIV} at (0,0) size 215x23
     LayoutText {#text} at (0,0) size 12x23
       text run at (0,0) width 12: "0"
-layer at (11,92) size 196x23
-  LayoutBlockFlow {DIV} at (0,0) size 196x23
+layer at (11,92) size 215x23
+  LayoutBlockFlow {DIV} at (0,0) size 215x23
     LayoutText {#text} at (0,0) size 12x23
       text run at (0,0) width 12: "0"
-layer at (11,121) size 196x23
-  LayoutBlockFlow {DIV} at (0,0) size 196x23
+layer at (11,121) size 215x23
+  LayoutBlockFlow {DIV} at (0,0) size 215x23
     LayoutText {#text} at (0,0) size 12x23
       text run at (0,0) width 12: "0"
-layer at (207,96) size 13x15 transparent
-  LayoutBlockFlow {DIV} at (196,4) size 13x15
-layer at (207,125) size 13x15 transparent
-  LayoutBlockFlow {DIV} at (196,4) size 13x15
+layer at (226,96) size 13x15 transparent
+  LayoutBlockFlow {DIV} at (215,4) size 13x15
+layer at (226,125) size 13x15 transparent
+  LayoutBlockFlow {DIV} at (215,4) size 13x15
 caret: position 0 of child 0 {#text} of child 0 {DIV} of child 0 {DIV} of child 0 {DIV} of {#document-fragment} of child 0 {INPUT} of child 0 {LABEL} of child 9 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-layer-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-layer-expected.txt
index 77e0016f..a5dbe99 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-layer-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/number/number-appearance-spinbutton-layer-expected.txt
@@ -10,16 +10,16 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,30) size 112x13
   LayoutBlockFlow {DIV} at (0,0) size 112x13
-    LayoutText {#text} at (0,0) size 14x13
-      text run at (0,0) width 14: "10"
+    LayoutText {#text} at (0,0) size 13x13
+      text run at (0,0) width 13: "10"
 layer at (8,8) size 131x19 transparent
   LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
     LayoutFlexibleBox {DIV} at (3,3) size 125x13
       LayoutBlockFlow {DIV} at (0,0) size 112x13
 layer at (11,11) size 112x13
   LayoutBlockFlow {DIV} at (0,0) size 112x13
-    LayoutText {#text} at (0,0) size 14x13
-      text run at (0,0) width 14: "10"
+    LayoutText {#text} at (0,0) size 13x13
+      text run at (0,0) width 13: "10"
 layer at (123,10) size 13x15 transparent
   LayoutBlockFlow {DIV} at (112,-1) size 13x15
 layer at (123,29) size 13x15 transparent
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/onselect-textarea-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/onselect-textarea-expected.txt
new file mode 100644
index 0000000..653a1bf3b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/onselect-textarea-expected.txt
@@ -0,0 +1,20 @@
+
+This tests onSelect for textareas. 
+This also makes sure that the correct selection is restored when the element regains focus.
+
+Calling focus on textarea
+After focus: textarea selection start: 0 end: 0
+
+Calling setSelectionRange on textarea
+After setSelectionRange(5, 10): textarea selection start: 5 end: 10
+
+Double clicking to make selection for textarea
+onselect fired for textarea
+After double clicking: textarea selection start: 13 end: 14
+
+Calling blur on textarea
+After blur: textarea selection start: 13 end: 14
+
+Calling focus on textarea
+After focus: textarea selection start: 13 end: 14
+
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-script-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-script-expected.png
index 862b7a9a..3a0e920 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-script-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-script-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-script-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-script-expected.txt
index 71f6fd2b..1be0a80 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-script-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-script-expected.txt
@@ -11,8 +11,8 @@
         text run at (0,18) width 108: "TEST FAILED: "
         text run at (107,18) width 321: "If the popup menu says \"document.write('Text')\". "
       LayoutBR {BR} at (427,32) size 1x0
-      LayoutMenuList {SELECT} at (0,36) size 54x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 54x18
-          LayoutText (anonymous) at (8,2) size 23x13
-            text run at (8,2) width 23: "Text"
+      LayoutMenuList {SELECT} at (0,36) size 53x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 53x18
+          LayoutText (anonymous) at (8,2) size 22x13
+            text run at (8,2) width 22: "Text"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-strip-whitespace-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-strip-whitespace-expected.png
index 5c27861..1cb0b03 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-strip-whitespace-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-strip-whitespace-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-strip-whitespace-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-strip-whitespace-expected.txt
index 9b56e56..6950dda0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-strip-whitespace-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-strip-whitespace-expected.txt
@@ -9,42 +9,42 @@
       LayoutBlockFlow (anonymous) at (0,34) size 784x247
         LayoutText {#text} at (0,41) size 72x18
           text run at (0,41) width 72: "Five Tabs: "
-        LayoutBR {BR} at (139,55) size 1x0
+        LayoutBR {BR} at (137,55) size 1x0
         LayoutBR {BR} at (0,59) size 0x18
         LayoutText {#text} at (0,118) size 86x18
           text run at (0,118) width 86: "Five Spaces: "
-        LayoutBR {BR} at (153,132) size 1x0
+        LayoutBR {BR} at (150,132) size 1x0
         LayoutBR {BR} at (0,136) size 0x18
         LayoutText {#text} at (0,154) size 306x18
           text run at (0,154) width 306: "Five Spaces (with leading/trailing whitespace): "
-        LayoutMenuList {SELECT} at (305.25,155) size 96x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 96x18
-            LayoutText (anonymous) at (8,2) size 65x13
-              text run at (8,2) width 65: "Five Spaces"
-        LayoutBR {BR} at (401,168) size 1x0
+        LayoutMenuList {SELECT} at (305.25,155) size 93x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 93x18
+            LayoutText (anonymous) at (8,2) size 62x13
+              text run at (8,2) width 62: "Five Spaces"
+        LayoutBR {BR} at (398,168) size 1x0
         LayoutBR {BR} at (0,173) size 0x18
         LayoutText {#text} at (0,191) size 292x18
           text run at (0,191) width 292: "Five Tabs (with leading/trailing whitespace): "
-        LayoutMenuList {SELECT} at (291.92,192) size 82x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 82x18
-            LayoutText (anonymous) at (8,2) size 51x13
-              text run at (8,2) width 51: "Five Tabs"
-        LayoutBR {BR} at (373,205) size 1x0
+        LayoutMenuList {SELECT} at (291.92,192) size 80x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 80x18
+            LayoutText (anonymous) at (8,2) size 49x13
+              text run at (8,2) width 49: "Five Tabs"
+        LayoutBR {BR} at (371,205) size 1x0
         LayoutBR {BR} at (0,210) size 0x18
         LayoutText {#text} at (0,228) size 129x18
           text run at (0,228) width 129: "Mixed Whitespace: "
-        LayoutMenuList {SELECT} at (128.84,229) size 82x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 82x18
-            LayoutText (anonymous) at (8,2) size 51x13
-              text run at (8,2) width 51: "Five Tabs"
+        LayoutMenuList {SELECT} at (128.84,229) size 80x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 80x18
+            LayoutText (anonymous) at (8,2) size 49x13
+              text run at (8,2) width 49: "Five Tabs"
         LayoutText {#text} at (0,0) size 0x0
-layer at (80,42) size 68x59 clip at (81,43) size 55x57 scrollHeight 56
-  LayoutListBox {SELECT} at (71.98,0.25) size 67.97x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 54.97x14.19
-      LayoutText {#text} at (2,0) size 51x13
-        text run at (2,0) width 51: "Five Tabs"
-layer at (93,119) size 68x59 clip at (94,120) size 55x57 scrollHeight 56
-  LayoutListBox {SELECT} at (85.31,77.25) size 67.97x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 54.97x14.19
-      LayoutText {#text} at (2,0) size 51x13
-        text run at (2,0) width 51: "Five Tabs"
+layer at (80,42) size 65x59 clip at (81,43) size 52x57 scrollHeight 56
+  LayoutListBox {SELECT} at (71.98,0.25) size 65.25x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 52.25x14.19
+      LayoutText {#text} at (2,0) size 49x13
+        text run at (2,0) width 49: "Five Tabs"
+layer at (93,119) size 66x59 clip at (94,120) size 53x57 scrollHeight 56
+  LayoutListBox {SELECT} at (85.31,77.25) size 65.25x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 52.25x14.19
+      LayoutText {#text} at (2,0) size 49x13
+        text run at (2,0) width 49: "Five Tabs"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-text-clip-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-text-clip-expected.png
index 2a3b186..2269cccb 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-text-clip-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-text-clip-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-text-clip-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-text-clip-expected.txt
index 241524ae..ed92ab5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-text-clip-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/option-text-clip-expected.txt
@@ -8,6 +8,6 @@
       LayoutBR {BR} at (717,14) size 1x0
       LayoutMenuList {SELECT} at (0,18) size 150x18 [bgcolor=#F8F8F8]
         LayoutBlockFlow (anonymous) at (0,0) size 150x18
-          LayoutText (anonymous) at (8,2) size 132x13
-            text run at (8,2) width 132: "12345 6789 ABCD EFGH"
+          LayoutText (anonymous) at (8,2) size 126x13
+            text run at (8,2) width 126: "12345 6789 ABCD EFGH"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-appearance-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-appearance-textarea-expected.png
index f9233ec..4b3064b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-appearance-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-appearance-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-appearance-textarea-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-appearance-textarea-expected.txt
index ede5e10..bdbe2615 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-appearance-textarea-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-appearance-textarea-expected.txt
@@ -9,10 +9,10 @@
 layer at (8,8) size 141x32 clip at (9,9) size 139x30
   LayoutTextControl {TEXTAREA} at (0,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x26 [color=#A9A9A9]
-      LayoutText {#text} at (0,0) size 39x26
-        text run at (0,0) width 24: "first \x{D}"
-        text run at (23,0) width 1: " "
-        text run at (0,13) width 39: "second"
+      LayoutText {#text} at (0,0) size 37x26
+        text run at (0,0) width 22: "first \x{D}"
+        text run at (21,0) width 1: " "
+        text run at (0,13) width 37: "second"
     LayoutBlockFlow {DIV} at (3,3) size 135x13
 layer at (8,40) size 141x32 clip at (9,41) size 139x30
   LayoutTextControl {TEXTAREA} at (0,32) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.png
index 08abc3c..fa5121b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.txt
index 6e1b1a1e..e80660f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-position-expected.txt
@@ -46,76 +46,76 @@
       LayoutBR {BR} at (131,303) size 0x0
 layer at (17,11) size 108x13
   LayoutBlockFlow {DIV} at (9,3) size 108x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 62x13
-      text run at (0,0) width 62: "placeholder"
+    LayoutText {#text} at (0,0) size 59x13
+      text run at (0,0) width 59: "placeholder"
 layer at (17,11) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
 layer at (11,30) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 62x13
-      text run at (0,0) width 62: "placeholder"
+    LayoutText {#text} at (0,0) size 59x13
+      text run at (0,0) width 59: "placeholder"
 layer at (11,30) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (17,49) size 108x13
   LayoutBlockFlow {DIV} at (9,3) size 108x13 [color=#A9A9A9]
-    LayoutText {#text} at (46,0) size 62x13
-      text run at (46,0) width 62: "placeholder"
+    LayoutText {#text} at (49,0) size 59x13
+      text run at (49,0) width 59: "placeholder"
 layer at (17,49) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
 layer at (28,68) size 97x13
   LayoutBlockFlow {DIV} at (20,3) size 97x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 62x13
-      text run at (0,0) width 62: "placeholder"
+    LayoutText {#text} at (0,0) size 59x13
+      text run at (0,0) width 59: "placeholder"
 layer at (28,68) size 97x13
   LayoutBlockFlow {DIV} at (0,0) size 97x13
 layer at (8,84) size 141x32 clip at (9,85) size 139x30
   LayoutTextControl {TEXTAREA} at (0,76) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13 [color=#A9A9A9]
-      LayoutText {#text} at (0,0) size 62x13
-        text run at (0,0) width 62: "placeholder"
+      LayoutText {#text} at (0,0) size 59x13
+        text run at (0,0) width 59: "placeholder"
     LayoutBlockFlow {DIV} at (3,3) size 135x13
 layer at (11,119) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 62x13
-      text run at (0,0) width 62: "placeholder"
+    LayoutText {#text} at (0,0) size 59x13
+      text run at (0,0) width 59: "placeholder"
 layer at (11,119) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (8,149) size 141x45 clip at (9,150) size 139x43
   LayoutTextControl {TEXTAREA} at (0,141) size 141x45 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,16) size 135x13 [color=#A9A9A9]
-      LayoutText {#text} at (0,0) size 62x13
-        text run at (0,0) width 62: "placeholder"
+      LayoutText {#text} at (0,0) size 59x13
+        text run at (0,0) width 59: "placeholder"
     LayoutBlockFlow {DIV} at (3,16) size 135x13
 layer at (19,205) size 166x17
   LayoutBlockFlow {DIV} at (6,6) size 166x17 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 82x17
-      text run at (0,0) width 82: "placeholder"
+    LayoutText {#text} at (0,0) size 80x17
+      text run at (0,0) width 80: "placeholder"
 layer at (19,205) size 166x17
   LayoutBlockFlow {DIV} at (6,6) size 166x17
 layer at (11,236) size 125x25
   LayoutBlockFlow {DIV} at (3,3) size 125x25
-    LayoutText {#text} at (0,6) size 30x13
-      text run at (0,6) width 30: "Value"
+    LayoutText {#text} at (0,6) size 28x13
+      text run at (0,6) width 28: "Value"
 layer at (146,236) size 125x25
   LayoutBlockFlow {DIV} at (3,3) size 125x25 [color=#A9A9A9]
-    LayoutText {#text} at (0,6) size 62x13
-      text run at (0,6) width 62: "placeholder"
+    LayoutText {#text} at (0,6) size 59x13
+      text run at (0,6) width 59: "placeholder"
 layer at (146,236) size 125x25
   LayoutBlockFlow {DIV} at (3,3) size 125x25
 layer at (11,267) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (47,0) size 31x13
-      text run at (47,0) width 31: "Value"
+    LayoutText {#text} at (48,0) size 29x13
+      text run at (48,0) width 29: "Value"
 layer at (146,267) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (31,0) size 63x13
-      text run at (31,0) width 63: "placeholder"
+    LayoutText {#text} at (33,0) size 59x13
+      text run at (33,0) width 59: "placeholder"
 layer at (146,267) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (281,267) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (31,0) size 63x13
-      text run at (31,0) width 63: "placeholder"
+    LayoutText {#text} at (33,0) size 59x13
+      text run at (33,0) width 59: "placeholder"
 layer at (281,267) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (126,12) size 11x11 transparent
@@ -128,7 +128,7 @@
   LayoutTextControl {INPUT} at (0,275) size 131x33 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
 layer at (11,300) size 125x13
   LayoutBlockFlow {DIV} at (3,17) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 62x13
-      text run at (0,0) width 62: "placeholder"
+    LayoutText {#text} at (0,0) size 59x13
+      text run at (0,0) width 59: "placeholder"
 layer at (11,300) size 125x13
   LayoutBlockFlow {DIV} at (3,17) size 125x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.png
index be7dc13..cb0f6cc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt
index cf3bb706..b3b63f7b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/placeholder-pseudo-style-expected.txt
@@ -28,38 +28,38 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#640000]
-    LayoutText {#text} at (0,0) size 21x13
-      text run at (0,0) width 21: "text"
+    LayoutText {#text} at (0,0) size 19x13
+      text run at (0,0) width 19: "text"
 layer at (11,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (152,29) size 108x13
   LayoutBlockFlow {DIV} at (9,3) size 108x13 [color=#640000]
-    LayoutText {#text} at (0,0) size 36x13
-      text run at (0,0) width 36: "search"
+    LayoutText {#text} at (0,0) size 34x13
+      text run at (0,0) width 34: "search"
 layer at (152,29) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
 layer at (283,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#640000]
-    LayoutText {#text} at (0,0) size 52x13
-      text run at (0,0) width 52: "password"
+    LayoutText {#text} at (0,0) size 50x13
+      text run at (0,0) width 50: "password"
 layer at (283,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (418,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#640000]
-    LayoutText {#text} at (0,0) size 69x13
-      text run at (0,0) width 69: "disabled text"
+    LayoutText {#text} at (0,0) size 65x13
+      text run at (0,0) width 65: "disabled text"
 layer at (418,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (553,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 37x13
-      text run at (0,0) width 37: "default"
+    LayoutText {#text} at (0,0) size 35x13
+      text run at (0,0) width 35: "default"
 layer at (553,29) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (11,48) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13 [color=#A9A9A9]
-    LayoutText {#text} at (0,0) size 85x13
-      text run at (0,0) width 85: "default disabled"
+    LayoutText {#text} at (0,0) size 80x13
+      text run at (0,0) width 80: "default disabled"
 layer at (11,48) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (261,30) size 11x11 transparent
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/plaintext-mode-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/plaintext-mode-2-expected.png
index 722b382..52b0fe24 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/plaintext-mode-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/plaintext-mode-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/plaintext-mode-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/plaintext-mode-2-expected.txt
index 7fde34ca..c2bed491 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/plaintext-mode-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/plaintext-mode-2-expected.txt
@@ -36,6 +36,6 @@
             text run at (0,0) width 331: "Success: document.execCommand(\"Paste\") == true"
 layer at (11,11) size 594x13
   LayoutBlockFlow {DIV} at (3,3) size 594x13
-    LayoutText {#text} at (0,0) size 468x13
-      text run at (0,0) width 468: "This styled text, and link will be pasted into the textfield. All richness should be stripped."
+    LayoutText {#text} at (0,0) size 440x13
+      text run at (0,0) width 440: "This styled text, and link will be pasted into the textfield. All richness should be stripped."
 caret: position 94 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 0 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.png
index de5692d..db5725e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.txt
index 01e7f4e..ebe5b430 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-cancel-button-style-sharing-expected.txt
@@ -24,8 +24,8 @@
   LayoutBlockFlow {DIV} at (0,0) size 108x13
 layer at (154,45) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 42x13
-      text run at (0,0) width 42: "this one"
+    LayoutText {#text} at (0,0) size 40x13
+      text run at (0,0) width 40: "this one"
 layer at (126,46) size 11x11 transparent
   LayoutBlockFlow {DIV} at (114,1) size 11x11
 caret: position 0 of child 0 {#text} of child 0 {DIV} of child 1 {DIV} of child 0 {DIV} of {#document-fragment} of child 4 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.png
index d783d59..419829c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.txt
index ec5f571e..2806351c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-display-none-cancel-button-expected.txt
@@ -13,5 +13,5 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (17,29) size 120x13
   LayoutBlockFlow {DIV} at (0,0) size 120x13
-    LayoutText {#text} at (0,0) size 20x13
-      text run at (0,0) width 20: "test"
+    LayoutText {#text} at (0,0) size 19x13
+      text run at (0,0) width 19: "test"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-rtl-expected.png
index 6b4f8aac..6e207ef 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-rtl-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-rtl-expected.txt
index ebb01b2..68b4f3d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-rtl-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-rtl-expected.txt
@@ -38,21 +38,21 @@
       LayoutBlockFlow {P} at (0,107) size 784x18
         LayoutText {#text} at (0,0) size 39x18
           text run at (0,0) width 39: "PASS"
-layer at (28,45) size 97x13 scrollX 36.00 scrollWidth 134
+layer at (28,45) size 97x13 scrollX 33.00 scrollWidth 130
   LayoutBlockFlow {DIV} at (0,0) size 97x13
-    LayoutText {#text} at (-36,0) size 134x13
-      text run at (-36,0) width 22 RTL: " \x{5D5}\x{5D6}\x{5D4}\x{5D5}"
-      text run at (-14,0) width 19: "she"
-      text run at (4,0) width 44 RTL: " \x{5D5}\x{5D4}\x{5D9}\x{5D0} \x{5D6}\x{5D4} "
-      text run at (47,0) width 14: "he"
+    LayoutText {#text} at (-33,0) size 131x13
+      text run at (-33,0) width 22 RTL: " \x{5D5}\x{5D6}\x{5D4}\x{5D5}"
+      text run at (-11,0) width 18: "she"
+      text run at (6,0) width 43 RTL: " \x{5D5}\x{5D4}\x{5D9}\x{5D0} \x{5D6}\x{5D4} "
+      text run at (48,0) width 13: "he"
       text run at (60,0) width 37 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5D6}\x{5D4} "
 layer at (28,64) size 157x13
   LayoutBlockFlow {DIV} at (0,0) size 157x13
-    LayoutText {#text} at (23,0) size 134x13
-      text run at (23,0) width 23 RTL: " \x{5D5}\x{5D6}\x{5D4}\x{5D5}"
-      text run at (45,0) width 20: "she"
-      text run at (64,0) width 44 RTL: " \x{5D5}\x{5D4}\x{5D9}\x{5D0} \x{5D6}\x{5D4} "
-      text run at (107,0) width 14: "he"
+    LayoutText {#text} at (26,0) size 131x13
+      text run at (26,0) width 23 RTL: " \x{5D5}\x{5D6}\x{5D4}\x{5D5}"
+      text run at (48,0) width 19: "she"
+      text run at (66,0) width 43 RTL: " \x{5D5}\x{5D4}\x{5D9}\x{5D0} \x{5D6}\x{5D4} "
+      text run at (108,0) width 13: "he"
       text run at (120,0) width 37 RTL: "\x{5D4}\x{5D5}\x{5D0} \x{5D6}\x{5D4} "
 layer at (28,83) size 97x13
   LayoutBlockFlow {DIV} at (0,0) size 97x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.png
index dc5fc92..112ae4e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.txt
index 2f6d4cc0..223b1a2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search-vertical-alignment-expected.txt
@@ -39,28 +39,28 @@
         LayoutText {#text} at (0,0) size 0x0
 layer at (27,76) size 97x13
   LayoutBlockFlow {DIV} at (0,0) size 97x13
-    LayoutText {#text} at (0,0) size 23x13
-      text run at (0,0) width 23: "Text"
+    LayoutText {#text} at (0,0) size 22x13
+      text run at (0,0) width 22: "Text"
 layer at (146,76) size 125x13
   LayoutBlockFlow {DIV} at (3,16) size 125x13
-    LayoutText {#text} at (0,0) size 23x13
-      text run at (0,0) width 23: "Text"
+    LayoutText {#text} at (0,0) size 22x13
+      text run at (0,0) width 22: "Text"
 layer at (27,125) size 97x13
   LayoutBlockFlow {DIV} at (0,0) size 97x13
-    LayoutText {#text} at (0,0) size 23x13
-      text run at (0,0) width 23: "Text"
+    LayoutText {#text} at (0,0) size 22x13
+      text run at (0,0) width 22: "Text"
 layer at (146,125) size 125x13
   LayoutBlockFlow {DIV} at (3,1.50) size 125x13
-    LayoutText {#text} at (0,0) size 23x13
-      text run at (0,0) width 23: "Text"
+    LayoutText {#text} at (0,0) size 22x13
+      text run at (0,0) width 22: "Text"
 layer at (27,158) size 97x6 scrollHeight 13
   LayoutBlockFlow {DIV} at (0,0) size 97x6
-    LayoutText {#text} at (0,0) size 23x13
-      text run at (0,0) width 23: "Text"
+    LayoutText {#text} at (0,0) size 22x13
+      text run at (0,0) width 22: "Text"
 layer at (146,158) size 125x6 scrollHeight 13
   LayoutBlockFlow {DIV} at (3,3) size 125x6
-    LayoutText {#text} at (0,0) size 23x13
-      text run at (0,0) width 23: "Text"
+    LayoutText {#text} at (0,0) size 22x13
+      text run at (0,0) width 22: "Text"
 layer at (125,77) size 11x11 transparent
   LayoutBlockFlow {DIV} at (114,14) size 11x11
 layer at (125,126) size 11x11 transparent
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 f044ebe1..5e2bbf3 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/search/search-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-appearance-basic-expected.txt
index de5ea97..f3527f4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/search/search-appearance-basic-expected.txt
@@ -88,26 +88,26 @@
             LayoutBlockFlow {DIV} at (5,0) size 164.50x19
         LayoutText {#text} at (208,105) size 4x18
           text run at (208,105) width 4: " "
-        LayoutTextControl {INPUT} at (220,92) size 242x38 [bgcolor=#FFFFFF] [border: (4px inset #EEEEEE)]
-          LayoutFlexibleBox {DIV} at (6,6) size 230x26
+        LayoutTextControl {INPUT} at (220,92) size 261x38 [bgcolor=#FFFFFF] [border: (4px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (6,6) size 249x26
             LayoutBlockFlow {DIV} at (0,13) size 5x0
-            LayoutBlockFlow {DIV} at (5,0) size 201x26
-        LayoutText {#text} at (470,105) size 4x18
-          text run at (470,105) width 4: " "
-        LayoutBR {BR} at (474,105) size 0x18
+            LayoutBlockFlow {DIV} at (5,0) size 220x26
+        LayoutText {#text} at (489,105) size 4x18
+          text run at (489,105) width 4: " "
+        LayoutBR {BR} at (493,105) size 0x18
         LayoutTextControl {INPUT} at (6,153) size 196x28 [bgcolor=#FFFFFF] [border: (3px inset #EEEEEE)]
           LayoutFlexibleBox {DIV} at (4.50,4.50) size 187x19
             LayoutBlockFlow {DIV} at (0,0) size 24x19
             LayoutBlockFlow {DIV} at (24,0) size 145.50x19
         LayoutText {#text} at (208,159) size 4x18
           text run at (208,159) width 4: " "
-        LayoutTextControl {INPUT} at (220,146) size 242x38 [bgcolor=#FFFFFF] [border: (4px inset #EEEEEE)]
-          LayoutFlexibleBox {DIV} at (6,6) size 230x26
+        LayoutTextControl {INPUT} at (220,146) size 261x38 [bgcolor=#FFFFFF] [border: (4px inset #EEEEEE)]
+          LayoutFlexibleBox {DIV} at (6,6) size 249x26
             LayoutBlockFlow {DIV} at (0,0) size 32x26
-            LayoutBlockFlow {DIV} at (32,0) size 174x26
-        LayoutText {#text} at (470,159) size 4x18
-          text run at (470,159) width 4: " "
-        LayoutBR {BR} at (474,159) size 0x18
+            LayoutBlockFlow {DIV} at (32,0) size 193x26
+        LayoutText {#text} at (489,159) size 4x18
+          text run at (489,159) width 4: " "
+        LayoutBR {BR} at (493,159) size 0x18
         LayoutTextControl {INPUT} at (4,196) size 166x21 [bgcolor=#FFFFFF] [border: (1px solid #BDC7D8)]
           LayoutFlexibleBox {DIV} at (18,4) size 144x13
             LayoutBlockFlow {DIV} at (0,0) size 16x13
@@ -116,40 +116,40 @@
         LayoutText {#text} at (0,0) size 0x0
 layer at (21,15) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (166,15) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (21,42) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (166,42) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (21,70) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (165,70) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (27,103) size 110x13
   LayoutBlockFlow {DIV} at (0,0) size 110x13
-    LayoutText {#text} at (0,0) size 60x13
-      text run at (0,0) width 60: "default text"
+    LayoutText {#text} at (0,0) size 57x13
+      text run at (0,0) width 57: "default text"
 layer at (20,143) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (20,170) size 108x13
   LayoutBlockFlow {DIV} at (0,0) size 108x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (23,197) size 125x16
   LayoutBlockFlow {DIV} at (0,0) size 125x16
     LayoutText {#text} at (0,0) size 20x16
@@ -166,18 +166,18 @@
   LayoutBlockFlow {DIV} at (0,0) size 164.50x19
     LayoutText {#text} at (0,0) size 25x19
       text run at (0,0) width 25: "foo"
-layer at (239,234) size 201x26
-  LayoutBlockFlow {DIV} at (0,0) size 201x26
-    LayoutText {#text} at (0,0) size 32x26
-      text run at (0,0) width 32: "foo"
+layer at (239,234) size 220x26
+  LayoutBlockFlow {DIV} at (0,0) size 220x26
+    LayoutText {#text} at (0,0) size 33x26
+      text run at (0,0) width 33: "foo"
 layer at (43,294) size 146x19 backgroundClip at (43,294) size 145x19 clip at (43,294) size 145x19
   LayoutBlockFlow {DIV} at (0,0) size 145.50x19
     LayoutText {#text} at (0,0) size 25x19
       text run at (0,0) width 25: "foo"
-layer at (266,288) size 174x26
-  LayoutBlockFlow {DIV} at (0,0) size 174x26
-    LayoutText {#text} at (0,0) size 32x26
-      text run at (0,0) width 32: "foo"
+layer at (266,288) size 193x26
+  LayoutBlockFlow {DIV} at (0,0) size 193x26
+    LayoutText {#text} at (0,0) size 33x26
+      text run at (0,0) width 33: "foo"
 layer at (46,336) size 116x13
   LayoutBlockFlow {DIV} at (34,4) size 116x13 [color=#A9A9A9]
     LayoutText {#text} at (0,0) size 92x13
@@ -208,12 +208,12 @@
   LayoutBlockFlow {DIV} at (132,1) size 14x14
 layer at (190,241) size 16x16 transparent
   LayoutBlockFlow {DIV} at (171,1.50) size 16x16
-layer at (442,236) size 22x22 transparent
-  LayoutBlockFlow {DIV} at (208,2) size 22x22
+layer at (461,236) size 22x22 transparent
+  LayoutBlockFlow {DIV} at (227,2) size 22x22
 layer at (190,295) size 16x16 transparent
   LayoutBlockFlow {DIV} at (171,1.50) size 16x16
-layer at (442,290) size 22x22 transparent
-  LayoutBlockFlow {DIV} at (208,2) size 22x22
+layer at (461,290) size 22x22 transparent
+  LayoutBlockFlow {DIV} at (227,2) size 22x22
 layer at (163,337) size 11x11 transparent
   LayoutBlockFlow {DIV} at (133,1) size 11x11
 caret: position 0 of child 0 {#text} of child 0 {DIV} of child 1 {DIV} of child 0 {DIV} of {#document-fragment} of child 10 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.png
index 6c808c7..c08ba0e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.txt
index 3660c31b..0a5ccae 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/searchfield-heights-expected.txt
@@ -25,16 +25,16 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (25,33) size 80x11
   LayoutBlockFlow {DIV} at (0,0) size 80x11
-    LayoutText {#text} at (0,0) size 19x11
-      text run at (0,0) width 19: "mini"
+    LayoutText {#text} at (0,0) size 17x11
+      text run at (0,0) width 17: "mini"
 layer at (142,31) size 97x13
   LayoutBlockFlow {DIV} at (0,0) size 97x13
-    LayoutText {#text} at (0,0) size 28x13
-      text run at (0,0) width 28: "small"
+    LayoutText {#text} at (0,0) size 27x13
+      text run at (0,0) width 27: "small"
 layer at (279,29) size 116x16
   LayoutBlockFlow {DIV} at (0,0) size 116x16
-    LayoutText {#text} at (0,0) size 43x16
-      text run at (0,0) width 43: "regular"
+    LayoutText {#text} at (0,0) size 41x16
+      text run at (0,0) width 41: "regular"
 layer at (106,34) size 9x9 transparent
   LayoutBlockFlow {DIV} at (95,1) size 9x9
 layer at (240,32) size 11x11 transparent
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-align-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-align-expected.png
index 38f9360..3476d85 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-align-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-align-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-align-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-align-expected.txt
index 9a722c383..db89c91d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-align-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-align-expected.txt
@@ -9,40 +9,40 @@
       LayoutBlockFlow (anonymous) at (0,34) size 784x94
         LayoutMenuList {SELECT} at (0,1) size 300x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 300x18
-            LayoutText (anonymous) at (8,2) size 158x13
-              text run at (8,2) width 158: "This is should be left justified."
+            LayoutText (anonymous) at (8,2) size 148x13
+              text run at (8,2) width 148: "This is should be left justified."
         LayoutText {#text} at (300,0) size 4x18
           text run at (300,0) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutMenuList {SELECT} at (0,20) size 300x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 300x18
-            LayoutText (anonymous) at (8,2) size 158x13
-              text run at (8,2) width 158: "This is should be left justified."
+            LayoutText (anonymous) at (8,2) size 148x13
+              text run at (8,2) width 148: "This is should be left justified."
         LayoutText {#text} at (300,19) size 4x18
           text run at (300,19) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutMenuList {SELECT} at (0,39) size 300x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 300x18
-            LayoutText (anonymous) at (8,2) size 158x13
-              text run at (8,2) width 158: "This is should be left justified."
+            LayoutText (anonymous) at (8,2) size 148x13
+              text run at (8,2) width 148: "This is should be left justified."
         LayoutText {#text} at (300,38) size 4x18
           text run at (300,38) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutMenuList {SELECT} at (0,58) size 300x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 300x18
-            LayoutText (anonymous) at (8,2) size 158x13
-              text run at (8,2) width 158: "This is should be left justified."
+            LayoutText (anonymous) at (8,2) size 148x13
+              text run at (8,2) width 148: "This is should be left justified."
         LayoutText {#text} at (300,57) size 4x18
           text run at (300,57) width 4: " "
         LayoutBR {BR} at (0,0) size 0x0
         LayoutMenuList {SELECT} at (0,76) size 300x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 300x18
-            LayoutText (anonymous) at (8,2) size 158x13
-              text run at (8,2) width 158: "This is should be left justified."
+            LayoutText (anonymous) at (8,2) size 148x13
+              text run at (8,2) width 148: "This is should be left justified."
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,128) size 784x18
         LayoutMenuList {SELECT} at (0,0) size 300x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 300x18
-            LayoutText (anonymous) at (8,2) size 158x13
-              text run at (8,2) width 158: "This is should be left justified."
+            LayoutText (anonymous) at (8,2) size 148x13
+              text run at (8,2) width 148: "This is should be left justified."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-baseline-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-baseline-expected.png
index 8cee2b5..69b4f75e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-baseline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-baseline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-baseline-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-baseline-expected.txt
index 80e4de0..080cfb0d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-baseline-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-baseline-expected.txt
@@ -12,38 +12,38 @@
             text run at (8,2) width 4: " "
       LayoutText {#text} at (36,19) size 31x18
         text run at (36,19) width 31: " test "
-      LayoutMenuList {SELECT} at (66.22,20) size 51x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 51x18
-          LayoutText (anonymous) at (8,2) size 20x13
-            text run at (8,2) width 20: "test"
-      LayoutText {#text} at (117,19) size 5x18
-        text run at (117,19) width 5: " "
-      LayoutMenuList {SELECT} at (121.22,20) size 36x18 [color=#00008B] [bgcolor=#ADD8E6] [border: (1px solid #A6A6A6)]
+      LayoutMenuList {SELECT} at (66.22,20) size 50x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 50x18
+          LayoutText (anonymous) at (8,2) size 19x13
+            text run at (8,2) width 19: "test"
+      LayoutText {#text} at (116,19) size 5x18
+        text run at (116,19) width 5: " "
+      LayoutMenuList {SELECT} at (120.22,20) size 36x18 [color=#00008B] [bgcolor=#ADD8E6] [border: (1px solid #A6A6A6)]
         LayoutBlockFlow (anonymous) at (1,1) size 34x16
           LayoutText (anonymous) at (8,1) size 4x13
             text run at (8,1) width 4: " "
-      LayoutText {#text} at (157,19) size 31x18
-        text run at (157,19) width 31: " test "
-      LayoutMenuList {SELECT} at (187.44,20) size 51x18 [color=#00008B] [bgcolor=#ADD8E6] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 49x16
-          LayoutText (anonymous) at (8,1) size 20x13
-            text run at (8,1) width 20: "test"
-      LayoutText {#text} at (238,19) size 5x18
-        text run at (238,19) width 5: " "
-      LayoutButton {BUTTON} at (242.44,21) size 16x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-      LayoutText {#text} at (258,19) size 5x18
-        text run at (258,19) width 5: " "
-      LayoutButton {BUTTON} at (262.44,20) size 35.84x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,2) size 19.84x13
-          LayoutText {#text} at (0,0) size 20x13
-            text run at (0,0) width 20: "test"
-      LayoutText {#text} at (298,19) size 5x18
-        text run at (298,19) width 5: " "
-      LayoutButton {BUTTON} at (302.28,29) size 16x9 [color=#00008B] [bgcolor=#ADD8E6] [border: (2px outset #C0C0C0)]
-      LayoutText {#text} at (318,19) size 5x18
-        text run at (318,19) width 5: " "
-      LayoutButton {BUTTON} at (322.28,18) size 35.84x22 [color=#00008B] [bgcolor=#ADD8E6] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 19.84x13
-          LayoutText {#text} at (0,0) size 20x13
-            text run at (0,0) width 20: "test"
+      LayoutText {#text} at (156,19) size 31x18
+        text run at (156,19) width 31: " test "
+      LayoutMenuList {SELECT} at (186.44,20) size 50x18 [color=#00008B] [bgcolor=#ADD8E6] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 48x16
+          LayoutText (anonymous) at (8,1) size 19x13
+            text run at (8,1) width 19: "test"
+      LayoutText {#text} at (236,19) size 5x18
+        text run at (236,19) width 5: " "
+      LayoutButton {BUTTON} at (240.44,21) size 16x15 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+      LayoutText {#text} at (256,19) size 5x18
+        text run at (256,19) width 5: " "
+      LayoutButton {BUTTON} at (260.44,20) size 34.64x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,2) size 18.64x13
+          LayoutText {#text} at (0,0) size 19x13
+            text run at (0,0) width 19: "test"
+      LayoutText {#text} at (295,19) size 5x18
+        text run at (295,19) width 5: " "
+      LayoutButton {BUTTON} at (299.08,29) size 16x9 [color=#00008B] [bgcolor=#ADD8E6] [border: (2px outset #C0C0C0)]
+      LayoutText {#text} at (315,19) size 5x18
+        text run at (315,19) width 5: " "
+      LayoutButton {BUTTON} at (319.08,18) size 34.64x22 [color=#00008B] [bgcolor=#ADD8E6] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 18.64x13
+          LayoutText {#text} at (0,0) size 19x13
+            text run at (0,0) width 19: "test"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-block-background-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-block-background-expected.png
index 1c08d14..744ea71 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-block-background-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-block-background-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-block-background-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-block-background-expected.txt
index f66ecf9..e8a73fd1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-block-background-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-block-background-expected.txt
@@ -7,8 +7,8 @@
         LayoutText {#text} at (0,0) size 551x18
           text run at (0,0) width 551: "This tests that backgrounds for list box items draw correctly when a list box is a block"
         LayoutBR {BR} at (551,14) size 0x0
-layer at (8,26) size 47x59 clip at (9,27) size 34x57 scrollHeight 56
-  LayoutListBox {SELECT} at (0,18) size 46.69x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 33.69x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Item1"
+layer at (8,26) size 45x59 clip at (9,27) size 32x57 scrollHeight 56
+  LayoutListBox {SELECT} at (0,18) size 45.17x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 32.17x14.19 [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Item1"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-size-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-size-expected.png
index eb3b3eb..abac4fc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-size-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-size-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-size-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-size-expected.txt
index d96e85c..0d05eba6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-size-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-size-expected.txt
@@ -22,23 +22,23 @@
       LayoutBlockFlow (anonymous) at (0,86) size 784x87
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (8,94) size 47x87 clip at (9,95) size 34x85
-  LayoutListBox {SELECT} at (0,-0.13) size 46.88x87.13 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 33.88x14.19
+layer at (8,94) size 45x87 clip at (9,95) size 32x85
+  LayoutListBox {SELECT} at (0,-0.13) size 45.38x87.13 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 32.38x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 32.38x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 33.88x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 32.38x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 32.38x14.19
       LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 33.88x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 33.88x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "Four"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 33.88x14.19
-      LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "Five"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 33.88x14.19
-      LayoutText {#text} at (2,0) size 17x13
-        text run at (2,0) width 17: "Six"
+        text run at (2,0) width 23: "Four"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 32.38x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "Five"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 32.38x14.19
+      LayoutText {#text} at (2,0) size 16x13
+        text run at (2,0) width 16: "Six"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-to-popup-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-to-popup-expected.png
index e76b1f4a..da76c49b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-to-popup-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-to-popup-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-to-popup-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-to-popup-expected.txt
index 09b6418..29190594 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-to-popup-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-listbox-to-popup-expected.txt
@@ -6,8 +6,8 @@
       LayoutText {#text} at (0,0) size 450x18
         text run at (0,0) width 450: "This tests that you can dynamically change a list box to a popup menu"
       LayoutBR {BR} at (449,14) size 1x0
-      LayoutMenuList {SELECT} at (0,18) size 219x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 219x18
-          LayoutText (anonymous) at (8,2) size 188x13
-            text run at (8,2) width 188: "This should turn into a popup menu"
+      LayoutMenuList {SELECT} at (0,18) size 209x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 209x18
+          LayoutText (anonymous) at (8,2) size 178x13
+            text run at (8,2) width 178: "This should turn into a popup menu"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-popup-to-listbox-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-popup-to-listbox-expected.png
index 777fb9b2..bc518a70 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-popup-to-listbox-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-popup-to-listbox-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-popup-to-listbox-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-popup-to-listbox-expected.txt
index e0948e4..e78798b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-popup-to-listbox-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-change-popup-to-listbox-expected.txt
@@ -7,8 +7,8 @@
         text run at (0,0) width 458: "This tests that you can dynamically change a popup menu to a list box. "
       LayoutBR {BR} at (457,14) size 1x0
       LayoutText {#text} at (0,0) size 0x0
-layer at (8,26) size 177x73 clip at (9,27) size 164x71 scrollHeight 70
-  LayoutListBox {SELECT} at (0,18.06) size 176.78x72.94 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 163.78x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 160x13
-        text run at (2,0) width 160: "This should turn into a list box"
+layer at (8,26) size 167x73 clip at (9,27) size 154x71 scrollHeight 70
+  LayoutListBox {SELECT} at (0,18.06) size 167.13x72.94 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 154.13x14.19 [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 151x13
+        text run at (2,0) width 151: "This should turn into a list box"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-dirty-parent-pref-widths-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-dirty-parent-pref-widths-expected.png
index 29f86f06..5466223 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-dirty-parent-pref-widths-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-dirty-parent-pref-widths-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-dirty-parent-pref-widths-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-dirty-parent-pref-widths-expected.txt
index baea997b..64db214 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-dirty-parent-pref-widths-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-dirty-parent-pref-widths-expected.txt
@@ -3,14 +3,14 @@
 layer at (0,0) size 800x87
   LayoutBlockFlow {HTML} at (0,0) size 800x87
     LayoutBlockFlow {BODY} at (8,8) size 784x63
-      LayoutTable {TABLE} at (0,0) size 61x29 [border: (1px outset #808080)]
-        LayoutTableSection {TBODY} at (1,1) size 59x27
-          LayoutTableRow {TR} at (0,2) size 59x23
-            LayoutTableCell {TD} at (2,2) size 55x23 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-              LayoutMenuList {SELECT} at (2,3) size 51x18 [bgcolor=#F8F8F8]
-                LayoutBlockFlow (anonymous) at (0,0) size 51x18
-                  LayoutText (anonymous) at (8,2) size 20x13
-                    text run at (8,2) width 20: "test"
+      LayoutTable {TABLE} at (0,0) size 60x29 [border: (1px outset #808080)]
+        LayoutTableSection {TBODY} at (1,1) size 58x27
+          LayoutTableRow {TR} at (0,2) size 58x23
+            LayoutTableCell {TD} at (2,2) size 54x23 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+              LayoutMenuList {SELECT} at (2,3) size 50x18 [bgcolor=#F8F8F8]
+                LayoutBlockFlow (anonymous) at (0,0) size 50x18
+                  LayoutText (anonymous) at (8,2) size 19x13
+                    text run at (8,2) width 19: "test"
       LayoutBlockFlow {P} at (0,45) size 784x18
         LayoutText {#text} at (0,0) size 459x18
           text run at (0,0) width 459: "The select element in the table above must not spill outside of the table."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-disabled-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-disabled-appearance-expected.png
index 41ff50d..a7012612 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-disabled-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-disabled-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-disabled-appearance-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-disabled-appearance-expected.txt
index 8423af5..c01b4d40 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-disabled-appearance-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-disabled-appearance-expected.txt
@@ -16,14 +16,14 @@
         LayoutText {#text} at (713,0) size 5x18
           text run at (713,0) width 5: "."
       LayoutBlockFlow {P} at (0,34) size 784x18
-        LayoutMenuList {SELECT} at (0,0) size 159x18 [color=#808080] [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 159x18
-            LayoutText (anonymous) at (8,2) size 128x13
-              text run at (8,2) width 128: "This text should be gray"
+        LayoutMenuList {SELECT} at (0,0) size 151x18 [color=#808080] [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 151x18
+            LayoutText (anonymous) at (8,2) size 120x13
+              text run at (8,2) width 120: "This text should be gray"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {P} at (0,68) size 784x18
-        LayoutMenuList {SELECT} at (0,0) size 164x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 164x18
-            LayoutText (anonymous) at (8,2) size 133x13
-              text run at (8,2) width 133: "This text should be black"
+        LayoutMenuList {SELECT} at (0,0) size 157x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 157x18
+            LayoutText (anonymous) at (8,2) size 126x13
+              text run at (8,2) width 126: "This text should be black"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-empty-option-height-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-empty-option-height-expected.png
index fd9d0af..0d7296f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-empty-option-height-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-empty-option-height-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-empty-option-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-empty-option-height-expected.txt
index 19e5e28..8d0ec6b8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-empty-option-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-empty-option-height-expected.txt
@@ -3,8 +3,8 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,0) size 24x15 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 22x13
+      LayoutMenuList {SELECT} at (0,0) size 23x15 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 21x13
           LayoutText (anonymous) at (0,0) size 4x13
             text run at (0,0) width 4: " "
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-initial-position-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-initial-position-expected.png
index 895566f..a3d3813 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-initial-position-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-initial-position-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-initial-position-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-initial-position-expected.txt
index 5b58ed7..941761a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-initial-position-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-initial-position-expected.txt
@@ -6,162 +6,162 @@
       LayoutText {#text} at (0,0) size 98x18
         text run at (0,0) width 98: "initial selected:"
       LayoutBR {BR} at (97,14) size 1x0
-      LayoutText {#text} at (139,59) size 5x18
-        text run at (139,59) width 5: " "
-      LayoutBR {BR} at (143,73) size 1x0
+      LayoutText {#text} at (132,59) size 5x18
+        text run at (132,59) width 5: " "
+      LayoutBR {BR} at (136,73) size 1x0
       LayoutText {#text} at (0,77) size 165x18
         text run at (0,77) width 165: "dynamic selected change:"
       LayoutBR {BR} at (164,91) size 1x0
-      LayoutText {#text} at (139,136) size 5x18
-        text run at (139,136) width 5: " "
+      LayoutText {#text} at (132,136) size 5x18
+        text run at (132,136) width 5: " "
       LayoutText {#text} at (0,0) size 0x0
       LayoutBR {BR} at (0,0) size 0x0
       LayoutText {#text} at (0,154) size 217x18
         text run at (0,154) width 217: "dynamic insert of selected option:"
       LayoutBR {BR} at (216,168) size 1x0
-      LayoutText {#text} at (139,213) size 5x18
-        text run at (139,213) width 5: " "
-      LayoutBR {BR} at (143,227) size 1x0
+      LayoutText {#text} at (132,213) size 5x18
+        text run at (132,213) width 5: " "
+      LayoutBR {BR} at (136,227) size 1x0
       LayoutText {#text} at (0,231) size 98x18
         text run at (0,231) width 98: "initial selected:"
       LayoutBR {BR} at (97,245) size 1x0
-      LayoutMenuList {SELECT} at (0,250) size 154x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 154x18
-          LayoutText (anonymous) at (8,2) size 123x13
-            text run at (8,2) width 123: "this should be selected"
-      LayoutText {#text} at (154,249) size 4x18
-        text run at (154,249) width 4: " "
-      LayoutBR {BR} at (158,263) size 0x0
+      LayoutMenuList {SELECT} at (0,250) size 147x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 147x18
+          LayoutText (anonymous) at (8,2) size 116x13
+            text run at (8,2) width 116: "this should be selected"
+      LayoutText {#text} at (147,249) size 4x18
+        text run at (147,249) width 4: " "
+      LayoutBR {BR} at (151,263) size 0x0
       LayoutText {#text} at (0,268) size 165x18
         text run at (0,268) width 165: "dynamic selected change:"
       LayoutBR {BR} at (164,282) size 1x0
-      LayoutMenuList {SELECT} at (0,287) size 154x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 154x18
-          LayoutText (anonymous) at (8,2) size 123x13
-            text run at (8,2) width 123: "this should be selected"
-      LayoutText {#text} at (154,286) size 4x18
-        text run at (154,286) width 4: " "
+      LayoutMenuList {SELECT} at (0,287) size 147x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 147x18
+          LayoutText (anonymous) at (8,2) size 116x13
+            text run at (8,2) width 116: "this should be selected"
+      LayoutText {#text} at (147,286) size 4x18
+        text run at (147,286) width 4: " "
       LayoutText {#text} at (0,0) size 0x0
       LayoutBR {BR} at (0,0) size 0x0
       LayoutText {#text} at (0,305) size 217x18
         text run at (0,305) width 217: "dynamic insert of selected option:"
       LayoutBR {BR} at (216,319) size 1x0
-      LayoutMenuList {SELECT} at (0,323) size 154x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 154x18
-          LayoutText (anonymous) at (8,2) size 123x13
-            text run at (8,2) width 123: "this should be selected"
+      LayoutMenuList {SELECT} at (0,323) size 147x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 147x18
+          LayoutText (anonymous) at (8,2) size 116x13
+            text run at (8,2) width 116: "this should be selected"
       LayoutText {#text} at (0,0) size 0x0
-layer at (8,26) size 140x59 clip at (9,27) size 127x57 scrollY 99.00 scrollHeight 198
-  LayoutListBox {SELECT} at (0,18.25) size 139.50x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,86.13) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,100.31) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,114.50) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,128.69) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,142.88) size 126.50x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 123x13
-        text run at (2,0) width 123: "this should be selected"
-    LayoutBlockFlow {OPTION} at (1,157.06) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,171.25) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,185.44) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-layer at (8,103) size 140x59 clip at (9,104) size 127x57 scrollY 99.00 scrollHeight 198
-  LayoutListBox {SELECT} at (0,95.25) size 139.50x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,86.13) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,100.31) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,114.50) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,128.69) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,142.88) size 126.50x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 123x13
-        text run at (2,0) width 123: "this should be selected"
-    LayoutBlockFlow {OPTION} at (1,157.06) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,171.25) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,185.44) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-layer at (8,180) size 140x59 clip at (9,181) size 127x57 scrollY 43.00 scrollHeight 113
-  LayoutListBox {SELECT} at (0,172.25) size 139.50x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
-    LayoutBlockFlow {OPTION} at (1,86.13) size 126.50x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 123x13
-        text run at (2,0) width 123: "this should be selected"
-    LayoutBlockFlow {OPTION} at (1,100.31) size 126.50x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "opt"
+layer at (8,26) size 133x59 clip at (9,27) size 120x57 scrollY 99.00 scrollHeight 198
+  LayoutListBox {SELECT} at (0,18.25) size 132.55x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,86.13) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,100.31) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,114.50) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,128.69) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,142.88) size 119.55x14.19 [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 116x13
+        text run at (2,0) width 116: "this should be selected"
+    LayoutBlockFlow {OPTION} at (1,157.06) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,171.25) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,185.44) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+layer at (8,103) size 133x59 clip at (9,104) size 120x57 scrollY 99.00 scrollHeight 198
+  LayoutListBox {SELECT} at (0,95.25) size 132.55x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,86.13) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,100.31) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,114.50) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,128.69) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,142.88) size 119.55x14.19 [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 116x13
+        text run at (2,0) width 116: "this should be selected"
+    LayoutBlockFlow {OPTION} at (1,157.06) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,171.25) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,185.44) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+layer at (8,180) size 133x59 clip at (9,181) size 120x57 scrollY 43.00 scrollHeight 113
+  LayoutListBox {SELECT} at (0,172.25) size 132.55x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
+    LayoutBlockFlow {OPTION} at (1,86.13) size 119.55x14.19 [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 116x13
+        text run at (2,0) width 116: "this should be selected"
+    LayoutBlockFlow {OPTION} at (1,100.31) size 119.55x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "opt"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-item-background-clip-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-item-background-clip-expected.png
index 4f091cb4..e622f44 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-item-background-clip-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-item-background-clip-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-item-background-clip-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-item-background-clip-expected.txt
index 391e348..843a3a4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-item-background-clip-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-item-background-clip-expected.txt
@@ -19,17 +19,17 @@
       LayoutBlockFlow (anonymous) at (0,52) size 784x59
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (8,60) size 54x59 clip at (11,63) size 37x53 scrollHeight 62
-  LayoutListBox {SELECT} at (0,-0.50) size 53.98x59.50 [bgcolor=#FFFFFF] [border: (3px solid #0000FF)]
-    LayoutBlockFlow {OPTION} at (6,6) size 30.98x14.19
+layer at (8,60) size 52x59 clip at (11,63) size 35x53 scrollHeight 62
+  LayoutListBox {SELECT} at (0,-0.50) size 52.47x59.50 [bgcolor=#FFFFFF] [border: (3px solid #0000FF)]
+    LayoutBlockFlow {OPTION} at (6,6) size 29.47x14.19
+      LayoutText {#text} at (2,0) size 19x13
+        text run at (2,0) width 19: "one"
+    LayoutBlockFlow {OPTION} at (6,20.19) size 29.47x14.19
+      LayoutText {#text} at (2,0) size 19x13
+        text run at (2,0) width 19: "two"
+    LayoutBlockFlow {OPTION} at (6,34.38) size 29.47x14.19
+      LayoutText {#text} at (2,0) size 26x13
+        text run at (2,0) width 26: "three"
+    LayoutBlockFlow {OPTION} at (6,48.56) size 29.47x14.19 [bgcolor=#800080]
       LayoutText {#text} at (2,0) size 20x13
-        text run at (2,0) width 20: "one"
-    LayoutBlockFlow {OPTION} at (6,20.19) size 30.98x14.19
-      LayoutText {#text} at (2,0) size 20x13
-        text run at (2,0) width 20: "two"
-    LayoutBlockFlow {OPTION} at (6,34.38) size 30.98x14.19
-      LayoutText {#text} at (2,0) size 27x13
-        text run at (2,0) width 27: "three"
-    LayoutBlockFlow {OPTION} at (6,48.56) size 30.98x14.19 [bgcolor=#800080]
-      LayoutText {#text} at (2,0) size 21x13
-        text run at (2,0) width 21: "four"
+        text run at (2,0) width 20: "four"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-list-box-with-height-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-list-box-with-height-expected.png
index 4878eec..b0d0148 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-list-box-with-height-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-list-box-with-height-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-list-box-with-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-list-box-with-height-expected.txt
index 33568ffa..7f5ec44 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-list-box-with-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-list-box-with-height-expected.txt
@@ -8,44 +8,44 @@
           text run at (0,0) width 372: "The select below has a size of 3, but a much larger height."
       LayoutBlockFlow (anonymous) at (0,34) size 784x250
         LayoutText {#text} at (0,0) size 0x0
-layer at (8,42) size 57x250 clip at (9,43) size 44x248
-  LayoutListBox {SELECT} at (0,0) size 57.11x250 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 20x13
-        text run at (2,0) width 20: "one"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 20x13
-        text run at (2,0) width 20: "two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 27x13
-        text run at (2,0) width 27: "three"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 21x13
-        text run at (2,0) width 21: "four"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 44.11x14.19
+layer at (8,42) size 55x250 clip at (9,43) size 42x248
+  LayoutListBox {SELECT} at (0,0) size 54.69x250 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 41.69x14.19
       LayoutText {#text} at (2,0) size 19x13
-        text run at (2,0) width 19: "five"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 15x13
-        text run at (2,0) width 15: "six"
-    LayoutBlockFlow {OPTION} at (1,86.13) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 31x13
-        text run at (2,0) width 31: "seven"
-    LayoutBlockFlow {OPTION} at (1,100.31) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 27x13
-        text run at (2,0) width 27: "eight"
-    LayoutBlockFlow {OPTION} at (1,114.50) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "nine"
-    LayoutBlockFlow {OPTION} at (1,128.69) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 17x13
-        text run at (2,0) width 17: "ten"
-    LayoutBlockFlow {OPTION} at (1,142.88) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 35x13
-        text run at (2,0) width 35: "eleven"
-    LayoutBlockFlow {OPTION} at (1,157.06) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "twelve"
-    LayoutBlockFlow {OPTION} at (1,171.25) size 44.11x14.19
-      LayoutText {#text} at (2,0) size 41x13
-        text run at (2,0) width 41: "thirteen"
+        text run at (2,0) width 19: "one"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 19x13
+        text run at (2,0) width 19: "two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 26x13
+        text run at (2,0) width 26: "three"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 20x13
+        text run at (2,0) width 20: "four"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 18x13
+        text run at (2,0) width 18: "five"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 14x13
+        text run at (2,0) width 14: "six"
+    LayoutBlockFlow {OPTION} at (1,86.13) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 30x13
+        text run at (2,0) width 30: "seven"
+    LayoutBlockFlow {OPTION} at (1,100.31) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 25x13
+        text run at (2,0) width 25: "eight"
+    LayoutBlockFlow {OPTION} at (1,114.50) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "nine"
+    LayoutBlockFlow {OPTION} at (1,128.69) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 16x13
+        text run at (2,0) width 16: "ten"
+    LayoutBlockFlow {OPTION} at (1,142.88) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 33x13
+        text run at (2,0) width 33: "eleven"
+    LayoutBlockFlow {OPTION} at (1,157.06) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 33x13
+        text run at (2,0) width 33: "twelve"
+    LayoutBlockFlow {OPTION} at (1,171.25) size 41.69x14.19
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "thirteen"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-listbox-multiple-no-focusring-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-listbox-multiple-no-focusring-expected.png
index b1168ab4..5bffb7f7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-listbox-multiple-no-focusring-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-listbox-multiple-no-focusring-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-listbox-multiple-no-focusring-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-listbox-multiple-no-focusring-expected.txt
index 193c11be..1f903d6c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-listbox-multiple-no-focusring-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-listbox-multiple-no-focusring-expected.txt
@@ -5,11 +5,11 @@
     LayoutBlockFlow {BODY} at (8,8) size 784x59
       LayoutText {#text} at (0,0) size 0x0
       LayoutText {#text} at (0,0) size 0x0
-layer at (8,8) size 350x59 clip at (9,9) size 337x57 scrollHeight 56
-  LayoutListBox {SELECT} at (0,0.25) size 350.27x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 337.27x14.19 [color=#FFFFFF] [bgcolor=#0069D9]
-      LayoutText {#text} at (2,0) size 334x13
-        text run at (2,0) width 334: "make-the-item-long-enough-to-make-a-difference-in-pixel-test"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 337.27x14.19
+layer at (8,8) size 332x59 clip at (9,9) size 319x57 scrollHeight 56
+  LayoutListBox {SELECT} at (0,0.25) size 332.16x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 319.16x14.19 [color=#FFFFFF] [bgcolor=#0069D9]
+      LayoutText {#text} at (2,0) size 316x13
+        text run at (2,0) width 316: "make-the-item-long-enough-to-make-a-difference-in-pixel-test"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 319.16x14.19
       LayoutText {#text} at (2,0) size 7x13
         text run at (2,0) width 7: "b"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-multiple-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-multiple-rtl-expected.png
index 838ae83b..2e2bddd 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-multiple-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-multiple-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-multiple-rtl-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-multiple-rtl-expected.txt
index c272aa4..59c6e69e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-multiple-rtl-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-multiple-rtl-expected.txt
@@ -13,17 +13,17 @@
 layer at (592,26) size 200x87 clip at (604,27) size 187x85
   LayoutListBox {SELECT} at (584,-0.13) size 200x87.13 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (12,1) size 187x14.19
-      LayoutText {#text} at (152,0) size 33x13
-        text run at (152,0) width 33: "Test 1"
+      LayoutText {#text} at (154,0) size 31x13
+        text run at (154,0) width 31: "Test 1"
     LayoutBlockFlow {OPTION} at (12,15.19) size 187x14.19
-      LayoutText {#text} at (152,0) size 33x13
-        text run at (152,0) width 33: "Test 2"
+      LayoutText {#text} at (154,0) size 31x13
+        text run at (154,0) width 31: "Test 2"
     LayoutBlockFlow {OPTION} at (12,29.38) size 187x14.19
-      LayoutText {#text} at (152,0) size 33x13
-        text run at (152,0) width 33: "Test 3"
+      LayoutText {#text} at (154,0) size 31x13
+        text run at (154,0) width 31: "Test 3"
     LayoutBlockFlow {OPTION} at (12,43.56) size 187x14.19
-      LayoutText {#text} at (152,0) size 33x13
-        text run at (152,0) width 33: "Test 4"
+      LayoutText {#text} at (154,0) size 31x13
+        text run at (154,0) width 31: "Test 4"
     LayoutBlockFlow {OPTION} at (12,57.75) size 187x14.19
-      LayoutText {#text} at (152,0) size 33x13
-        text run at (152,0) width 33: "Test 5"
+      LayoutText {#text} at (154,0) size 31x13
+        text run at (154,0) width 31: "Test 5"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-expected.png
index 0cc3eba..62b10a1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-expected.txt
index 0a37340c..ae99a94 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-expected.txt
@@ -4,35 +4,35 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
       LayoutText {#text} at (0,0) size 0x0
-layer at (8,8) size 50x115 clip at (9,9) size 37x102 scrollHeight 141
-  LayoutListBox {SELECT} at (0,-0.50) size 49.58x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 36.58x14.19
+layer at (8,8) size 48x115 clip at (9,9) size 35x102 scrollHeight 141
+  LayoutListBox {SELECT} at (0,-0.50) size 48.06x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 35.06x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 36.58x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 35.06x14.19
       LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "Four"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "Five"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 17x13
-        text run at (2,0) width 17: "Six"
-    LayoutBlockFlow {OPTION} at (1,86.13) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
-    LayoutBlockFlow {OPTION} at (1,100.31) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 27x13
-        text run at (2,0) width 27: "Eight"
-    LayoutBlockFlow {OPTION} at (1,114.50) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "Nine"
-    LayoutBlockFlow {OPTION} at (1,128.69) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 20x13
-        text run at (2,0) width 20: "Ten"
+        text run at (2,0) width 23: "Four"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "Five"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 16x13
+        text run at (2,0) width 16: "Six"
+    LayoutBlockFlow {OPTION} at (1,86.13) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
+    LayoutBlockFlow {OPTION} at (1,100.31) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 26x13
+        text run at (2,0) width 26: "Eight"
+    LayoutBlockFlow {OPTION} at (1,114.50) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "Nine"
+    LayoutBlockFlow {OPTION} at (1,128.69) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 19x13
+        text run at (2,0) width 19: "Ten"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-inherited-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-inherited-expected.png
index b4fecf0..5df8ac3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-inherited-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-inherited-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-inherited-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-inherited-expected.txt
index 31f36e1..783739b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-inherited-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-overflow-scroll-inherited-expected.txt
@@ -6,35 +6,35 @@
 layer at (8,8) size 784x130 clip at (8,8) size 769x115
   LayoutBlockFlow {DIV} at (0,0) size 784x130
     LayoutText {#text} at (0,0) size 0x0
-layer at (8,8) size 50x115 clip at (9,9) size 37x102 scrollHeight 141
-  LayoutListBox {SELECT} at (0,-0.50) size 49.58x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 36.58x14.19
+layer at (8,8) size 48x115 clip at (9,9) size 35x102 scrollHeight 141
+  LayoutListBox {SELECT} at (0,-0.50) size 48.06x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 35.06x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 36.58x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 35.06x14.19
       LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "Four"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "Five"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 17x13
-        text run at (2,0) width 17: "Six"
-    LayoutBlockFlow {OPTION} at (1,86.13) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
-    LayoutBlockFlow {OPTION} at (1,100.31) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 27x13
-        text run at (2,0) width 27: "Eight"
-    LayoutBlockFlow {OPTION} at (1,114.50) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "Nine"
-    LayoutBlockFlow {OPTION} at (1,128.69) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 20x13
-        text run at (2,0) width 20: "Ten"
+        text run at (2,0) width 23: "Four"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "Five"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 16x13
+        text run at (2,0) width 16: "Six"
+    LayoutBlockFlow {OPTION} at (1,86.13) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
+    LayoutBlockFlow {OPTION} at (1,100.31) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 26x13
+        text run at (2,0) width 26: "Eight"
+    LayoutBlockFlow {OPTION} at (1,114.50) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "Nine"
+    LayoutBlockFlow {OPTION} at (1,128.69) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 19x13
+        text run at (2,0) width 19: "Ten"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-selected-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-selected-expected.png
index ce6d86d..7d6b281 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-selected-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-selected-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-selected-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-selected-expected.txt
index c878595..7989365 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-selected-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-selected-expected.txt
@@ -3,8 +3,8 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,0) size 260x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 260x18
-          LayoutText (anonymous) at (8,2) size 165x13
-            text run at (8,2) width 165: "should see this option selected"
+      LayoutMenuList {SELECT} at (0,0) size 247x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 247x18
+          LayoutText (anonymous) at (8,2) size 156x13
+            text run at (8,2) width 156: "should see this option selected"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-size-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-size-expected.png
index 24f09ab..a327040 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-size-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-size-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-size-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-size-expected.txt
index 0472196..e1a593bf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-size-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-size-expected.txt
@@ -7,8 +7,8 @@
         text run at (0,0) width 782: "This tests that a malformed size attribute will be parsed and corrected so that the right size attribute value is used to match"
         text run at (0,18) width 441: "the style rule that determines whether to use a menu list or a list box."
       LayoutBR {BR} at (440,32) size 1x0
-      LayoutMenuList {SELECT} at (0,36) size 51x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 51x18
-          LayoutText (anonymous) at (8,2) size 20x13
-            text run at (8,2) width 20: "test"
+      LayoutMenuList {SELECT} at (0,36) size 50x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 50x18
+          LayoutText (anonymous) at (8,2) size 19x13
+            text run at (8,2) width 19: "test"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-style-expected.png
index c4e4777..2fc3e74 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-style-expected.txt
index 3fe3f1f..264b81e8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-style-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-style-expected.txt
@@ -7,67 +7,67 @@
         text run at (0,0) width 256: "This tests that styled popups look right. "
         text run at (255,0) width 311: "(Aqua for now- later, we will honor the styling)."
       LayoutBR {BR} at (565,14) size 1x0
-      LayoutMenuList {SELECT} at (0,19) size 51x18 [bgcolor=#FF0000] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 49x16
-          LayoutText (anonymous) at (8,1) size 20x13
-            text run at (8,1) width 20: "test"
-      LayoutText {#text} at (51,18) size 4x18
-        text run at (51,18) width 4: " "
-      LayoutBR {BR} at (55,32) size 0x0
+      LayoutMenuList {SELECT} at (0,19) size 50x18 [bgcolor=#FF0000] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 48x16
+          LayoutText (anonymous) at (8,1) size 19x13
+            text run at (8,1) width 19: "test"
+      LayoutText {#text} at (50,18) size 4x18
+        text run at (50,18) width 4: " "
+      LayoutBR {BR} at (54,32) size 0x0
       LayoutText {#text} at (0,37) size 541x18
         text run at (0,37) width 541: "This tests that background color is white by default regardless of the parent element."
       LayoutBR {BR} at (540,51) size 1x0
-      LayoutInline {SPAN} at (0,0) size 65x28 [bgcolor=#FF0000]
+      LayoutInline {SPAN} at (0,0) size 64x28 [bgcolor=#FF0000]
         LayoutText {#text} at (0,0) size 0x0
-        LayoutMenuList {SELECT} at (5,56) size 51x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 51x18
-            LayoutText (anonymous) at (8,2) size 20x13
-              text run at (8,2) width 20: "test"
-        LayoutText {#text} at (56,55) size 4x18
-          text run at (56,55) width 4: " "
+        LayoutMenuList {SELECT} at (5,56) size 50x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 50x18
+            LayoutText (anonymous) at (8,2) size 19x13
+              text run at (8,2) width 19: "test"
+        LayoutText {#text} at (55,55) size 4x18
+          text run at (55,55) width 4: " "
       LayoutText {#text} at (0,0) size 0x0
       LayoutBR {BR} at (0,0) size 0x0
       LayoutText {#text} at (0,74) size 642x18
         text run at (0,74) width 642: "This tests that background color is inherited from the parent if background-color:inherit is specified."
       LayoutBR {BR} at (641,88) size 1x0
-      LayoutInline {SPAN} at (0,0) size 65x28 [bgcolor=#FF0000]
+      LayoutInline {SPAN} at (0,0) size 64x28 [bgcolor=#FF0000]
         LayoutText {#text} at (0,0) size 0x0
-        LayoutMenuList {SELECT} at (5,93) size 51x18 [border: (1px solid #A6A6A6)]
-          LayoutBlockFlow (anonymous) at (1,1) size 49x16
-            LayoutText (anonymous) at (8,1) size 20x13
-              text run at (8,1) width 20: "test"
-        LayoutText {#text} at (56,92) size 4x18
-          text run at (56,92) width 4: " "
+        LayoutMenuList {SELECT} at (5,93) size 50x18 [border: (1px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (1,1) size 48x16
+            LayoutText (anonymous) at (8,1) size 19x13
+              text run at (8,1) width 19: "test"
+        LayoutText {#text} at (55,92) size 4x18
+          text run at (55,92) width 4: " "
       LayoutText {#text} at (0,0) size 0x0
       LayoutBR {BR} at (0,0) size 0x0
       LayoutText {#text} at (0,111) size 653x18
         text run at (0,111) width 653: "This tests that background color is the same as the parent if background-color:transparent is specified."
       LayoutBR {BR} at (652,125) size 1x0
-      LayoutInline {SPAN} at (0,0) size 65x28 [bgcolor=#FF0000]
+      LayoutInline {SPAN} at (0,0) size 64x28 [bgcolor=#FF0000]
         LayoutText {#text} at (0,0) size 0x0
-        LayoutMenuList {SELECT} at (5,130) size 51x18 [border: (1px solid #A6A6A6)]
-          LayoutBlockFlow (anonymous) at (1,1) size 49x16
-            LayoutText (anonymous) at (8,1) size 20x13
-              text run at (8,1) width 20: "test"
-        LayoutText {#text} at (56,129) size 4x18
-          text run at (56,129) width 4: " "
+        LayoutMenuList {SELECT} at (5,130) size 50x18 [border: (1px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (1,1) size 48x16
+            LayoutText (anonymous) at (8,1) size 19x13
+              text run at (8,1) width 19: "test"
+        LayoutText {#text} at (55,129) size 4x18
+          text run at (55,129) width 4: " "
       LayoutText {#text} at (0,0) size 0x0
       LayoutBR {BR} at (0,0) size 0x0
       LayoutText {#text} at (0,148) size 509x18
         text run at (0,148) width 509: "This tests that background is white if only background-image:none is specified."
       LayoutBR {BR} at (508,162) size 1x0
-      LayoutMenuList {SELECT} at (0,167) size 51x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 51x18
-          LayoutText (anonymous) at (8,2) size 20x13
-            text run at (8,2) width 20: "test"
-      LayoutText {#text} at (51,166) size 4x18
-        text run at (51,166) width 4: " "
-      LayoutBR {BR} at (55,180) size 0x0
+      LayoutMenuList {SELECT} at (0,167) size 50x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 50x18
+          LayoutText (anonymous) at (8,2) size 19x13
+            text run at (8,2) width 19: "test"
+      LayoutText {#text} at (50,166) size 4x18
+        text run at (50,166) width 4: " "
+      LayoutBR {BR} at (54,180) size 0x0
       LayoutText {#text} at (0,185) size 430x18
         text run at (0,185) width 430: "This tests that the image specified for background-image is visible."
       LayoutBR {BR} at (429,199) size 1x0
-      LayoutMenuList {SELECT} at (0,203) size 51x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 49x16
-          LayoutText (anonymous) at (8,1) size 20x13
-            text run at (8,1) width 20: "test"
+      LayoutMenuList {SELECT} at (0,203) size 50x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 48x16
+          LayoutText (anonymous) at (8,1) size 19x13
+            text run at (8,1) width 19: "test"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.png
index a0d110f..9469de9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.txt
index c389930..89430ce 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select-writing-direction-natural-expected.txt
@@ -40,9 +40,9 @@
           LayoutMenuList {SELECT} at (148,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
               LayoutText (anonymous) at (8,2) size 18x13
-                text run at (8,2) width 4: "("
-                text run at (11,2) width 8 RTL: "\x{5D0}"
-                text run at (18,2) width 8: "A"
+                text run at (8,2) width 3: "("
+                text run at (10,2) width 8 RTL: "\x{5D0}"
+                text run at (17,2) width 9: "A"
           LayoutText {#text} at (218,0) size 4x18
             text run at (218,0) width 4: " "
           LayoutMenuList {SELECT} at (222,1) size 70x18 [bgcolor=#F8F8F8]
@@ -69,9 +69,9 @@
           LayoutMenuList {SELECT} at (640,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
               LayoutText (anonymous) at (8,2) size 18x13
-                text run at (8,2) width 4: "("
-                text run at (11,2) width 8 RTL: "\x{5D0}"
-                text run at (18,2) width 8: "A"
+                text run at (8,2) width 3: "("
+                text run at (10,2) width 8 RTL: "\x{5D0}"
+                text run at (17,2) width 9: "A"
           LayoutText {#text} at (710,0) size 4x18
             text run at (710,0) width 4: " "
           LayoutMenuList {SELECT} at (714,1) size 70x18 [bgcolor=#F8F8F8]
@@ -99,16 +99,16 @@
           LayoutMenuList {SELECT} at (74,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
               LayoutText (anonymous) at (29,2) size 18x13
-                text run at (29,2) width 8: "A"
-                text run at (36,2) width 11 RTL: "(\x{5D0}"
+                text run at (29,2) width 9: "A"
+                text run at (37,2) width 10 RTL: "(\x{5D0}"
           LayoutText {#text} at (70,0) size 4x18
             text run at (70,0) width 4 RTL: " "
           LayoutMenuList {SELECT} at (0,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
               LayoutText (anonymous) at (29,2) size 18x13
                 text run at (29,2) width 8 RTL: "\x{5D0}"
-                text run at (36,2) width 8: "A"
-                text run at (43,2) width 4 RTL: "("
+                text run at (36,2) width 9: "A"
+                text run at (44,2) width 3 RTL: "("
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {DIV} at (0,19) size 784x19
           LayoutMenuList {SELECT} at (714,1) size 70x18 [bgcolor=#F8F8F8]
@@ -128,14 +128,14 @@
           LayoutMenuList {SELECT} at (566,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
               LayoutText (anonymous) at (29,2) size 18x13
-                text run at (29,2) width 8: "A"
-                text run at (36,2) width 11 RTL: "(\x{5D0}"
+                text run at (29,2) width 9: "A"
+                text run at (37,2) width 10 RTL: "(\x{5D0}"
           LayoutText {#text} at (562,0) size 4x18
             text run at (562,0) width 4 RTL: " "
           LayoutMenuList {SELECT} at (492,1) size 70x18 [bgcolor=#F8F8F8]
             LayoutBlockFlow (anonymous) at (0,0) size 70x18
               LayoutText (anonymous) at (29,2) size 18x13
                 text run at (29,2) width 8 RTL: "\x{5D0}"
-                text run at (36,2) width 8: "A"
-                text run at (43,2) width 4 RTL: "("
+                text run at (36,2) width 9: "A"
+                text run at (44,2) width 3 RTL: "("
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.png
index 9c7bc42..0cf79e29 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.txt
index 9ff167f6..c3bd6355 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-basic-expected.txt
@@ -3,176 +3,179 @@
 layer at (0,0) size 800x551
   LayoutBlockFlow {HTML} at (0,0) size 800x551
     LayoutBlockFlow {BODY} at (8,8) size 784x535
-      LayoutText {#text} at (42,49) size 5x18
-        text run at (42,49) width 5: " "
-      LayoutText {#text} at (88,49) size 5x18
-        text run at (88,49) width 5: " "
+      LayoutText {#text} at (41,49) size 5x18
+        text run at (41,49) width 5: " "
+      LayoutText {#text} at (113,49) size 5x18
+        text run at (113,49) width 5: " "
       LayoutText {#text} at (0,0) size 0x0
-      LayoutText {#text} at (134,49) size 5x18
-        text run at (134,49) width 5: " "
-      LayoutText {#text} at (196,49) size 5x18
-        text run at (196,49) width 5: " "
-      LayoutText {#text} at (248,49) size 5x18
-        text run at (248,49) width 5: " "
-      LayoutText {#text} at (301,49) size 5x18
-        text run at (301,49) width 5: " "
-      LayoutText {#text} at (353,49) size 5x18
-        text run at (353,49) width 5: " "
-      LayoutBR {BR} at (357,49) size 1x18
-      LayoutText {#text} at (46,120) size 5x18
-        text run at (46,120) width 5: " "
-      LayoutText {#text} at (92,120) size 5x18
-        text run at (92,120) width 5: " "
-      LayoutBR {BR} at (96,120) size 1x18
-      LayoutText {#text} at (42,187) size 5x18
-        text run at (42,187) width 5: " "
-      LayoutBR {BR} at (46,187) size 1x18
-      LayoutText {#text} at (42,254) size 5x18
-        text run at (42,254) width 5: " "
-      LayoutBR {BR} at (46,254) size 1x18
+      LayoutText {#text} at (159,49) size 5x18
+        text run at (159,49) width 5: " "
+      LayoutText {#text} at (218,49) size 5x18
+        text run at (218,49) width 5: " "
+      LayoutText {#text} at (270,49) size 4x18
+        text run at (270,49) width 4: " "
+      LayoutText {#text} at (321,49) size 5x18
+        text run at (321,49) width 5: " "
+      LayoutText {#text} at (372,49) size 5x18
+        text run at (372,49) width 5: " "
+      LayoutBR {BR} at (376,49) size 1x18
+      LayoutText {#text} at (45,120) size 5x18
+        text run at (45,120) width 5: " "
+      LayoutText {#text} at (90,120) size 5x18
+        text run at (90,120) width 5: " "
+      LayoutBR {BR} at (94,120) size 1x18
+      LayoutText {#text} at (41,187) size 5x18
+        text run at (41,187) width 5: " "
+      LayoutBR {BR} at (45,187) size 1x18
+      LayoutText {#text} at (41,254) size 5x18
+        text run at (41,254) width 5: " "
+      LayoutBR {BR} at (45,254) size 1x18
       LayoutText {#text} at (48,383) size 5x18
         text run at (48,383) width 5: " "
       LayoutText {#text} at (106,383) size 5x18
         text run at (106,383) width 5: " "
-      LayoutText {#text} at (170,383) size 5x18
-        text run at (170,383) width 5: " "
-      LayoutText {#text} at (233,383) size 5x18
-        text run at (233,383) width 5: " "
+      LayoutText {#text} at (171,383) size 5x18
+        text run at (171,383) width 5: " "
+      LayoutText {#text} at (235,383) size 5x18
+        text run at (235,383) width 5: " "
       LayoutBR {BR} at (0,0) size 0x0
       LayoutText {#text} at (55,517) size 5x18
         text run at (55,517) width 5: " "
       LayoutText {#text} at (130,517) size 5x18
         text run at (130,517) width 5: " "
       LayoutBR {BR} at (134,517) size 1x18
-layer at (12,12) size 34x59 clip at (13,13) size 21x57 scrollHeight 56
-  LayoutListBox {SELECT} at (4,4.25) size 34.06x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 21.06x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "foo"
-layer at (58,12) size 34x59 clip at (59,13) size 21x57 scrollHeight 56
-  LayoutListBox {SELECT} at (50.06,4.25) size 34.27x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 21.27x14.19 [color=#FFFFFF] [bgcolor=#0069D9]
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "foo"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 21.27x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "bar"
-layer at (104,12) size 35x59 clip at (105,13) size 22x57 scrollHeight 56
-  LayoutListBox {SELECT} at (96.33,4.25) size 34.27x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 21.27x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "foo"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 21.27x14.19 [color=#808080] [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "bar"
-layer at (151,12) size 49x59 clip at (152,13) size 36x57 scrollHeight 56
-  LayoutListBox {SELECT} at (142.59,4.25) size 49.55x58.75 [color=#7F7F7F] [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 36.55x14.19 [color=#808080] [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "foo"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 36.55x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "bar"
-    LayoutBlockFlow {OPTGROUP} at (1,29.38) size 36.55x28.38
-      LayoutBlockFlow {DIV} at (0,0) size 36.55x14.19
-      LayoutBlockFlow {OPTION} at (0,14.19) size 36.55x14.19 [color=#808080] [bgcolor=#D4D4D4]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 20x13
-          text run at (15,0) width 20: "baz"
-layer at (212,55) size 41x16 clip at (213,56) size 28x14 scrollHeight 56
-  LayoutListBox {SELECT} at (204.14,46.81) size 40.58x16.19 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo1"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo2"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo3"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo4"
-layer at (265,41) size 40x30 clip at (266,42) size 27x28 scrollHeight 56
-  LayoutListBox {SELECT} at (256.72,32.63) size 40.58x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo1"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo2"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo3"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo4"
-layer at (317,26) size 41x45 clip at (318,27) size 28x43 scrollHeight 56
-  LayoutListBox {SELECT} at (309.30,18.44) size 40.58x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo1"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo2"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo3"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 27.58x14.19
-      LayoutText {#text} at (2,0) size 24x13
-        text run at (2,0) width 24: "foo4"
-layer at (12,79) size 38x63 clip at (15,82) size 21x57 scrollHeight 56
-  LayoutListBox {SELECT} at (4,71.25) size 38.06x62.75 [bgcolor=#FFFFFF] [border: (3px solid #00FF00)]
-    LayoutBlockFlow {OPTION} at (3,3) size 21.06x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "foo"
-layer at (62,83) size 34x59 clip at (63,84) size 21x57 scrollHeight 56
-  LayoutListBox {SELECT} at (54.06,75.25) size 34.06x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 21.06x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "foo"
-layer at (12,150) size 34x59 clip at (13,151) size 21x57 scrollHeight 56
-  LayoutListBox {SELECT} at (4,142.25) size 34.06x58.75 [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 21.06x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "foo"
-layer at (12,217) size 34x59 clip at (13,218) size 21x57 scrollHeight 56
-  LayoutListBox {SELECT} at (4,209.25) size 34.06x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 21.06x14.19
-      LayoutText {#text} at (2,0) size 18x13
-        text run at (2,0) width 18: "foo"
-layer at (12,322) size 41x83 clip at (13,323) size 28x81 scrollHeight 80
-  LayoutListBox {SELECT} at (4,314.25) size 40.88x82.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 27.88x20.19
+layer at (12,12) size 33x59 clip at (13,13) size 20x57 scrollHeight 56
+  LayoutListBox {SELECT} at (4,4.25) size 33.16x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 20.16x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "foo"
+layer at (57,12) size 61x59 clip at (58,13) size 48x57 scrollHeight 56
+  LayoutListBox {SELECT} at (49.16,4.25) size 60.69x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 47.69x14.19 [color=#FFFFFF] [bgcolor=#0069D9]
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "foo"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 47.69x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "bar"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 47.69x14.19 [color=#808080] [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Disabled"
+layer at (130,12) size 33x59 clip at (131,13) size 20x57 scrollHeight 56
+  LayoutListBox {SELECT} at (121.84,4.25) size 33.36x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 20.36x14.19 [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "foo"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 20.36x14.19 [color=#808080] [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "bar"
+layer at (175,12) size 48x59 clip at (176,13) size 35x57 scrollHeight 56
+  LayoutListBox {SELECT} at (167.20,4.25) size 47.44x58.75 [color=#7F7F7F] [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 34.44x14.19 [color=#808080] [bgcolor=#D4D4D4]
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "foo"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 34.44x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "bar"
+    LayoutBlockFlow {OPTGROUP} at (1,29.38) size 34.44x28.38
+      LayoutBlockFlow {DIV} at (0,0) size 34.44x14.19
+      LayoutBlockFlow {OPTION} at (0,14.19) size 34.44x14.19 [color=#808080] [bgcolor=#D4D4D4]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 19x13
+          text run at (14,0) width 19: "baz"
+layer at (235,55) size 39x16 clip at (236,56) size 26x14 scrollHeight 56
+  LayoutListBox {SELECT} at (226.64,46.81) size 39.36x16.19 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo1"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo2"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo3"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo4"
+layer at (286,41) size 39x30 clip at (287,42) size 26x28 scrollHeight 56
+  LayoutListBox {SELECT} at (278,32.63) size 39.36x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo1"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo2"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo3"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo4"
+layer at (337,26) size 40x45 clip at (338,27) size 27x43 scrollHeight 56
+  LayoutListBox {SELECT} at (329.36,18.44) size 39.36x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo1"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo2"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo3"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 26.36x14.19
+      LayoutText {#text} at (2,0) size 23x13
+        text run at (2,0) width 23: "foo4"
+layer at (12,79) size 37x63 clip at (15,82) size 20x57 scrollHeight 56
+  LayoutListBox {SELECT} at (4,71.25) size 37.16x62.75 [bgcolor=#FFFFFF] [border: (3px solid #00FF00)]
+    LayoutBlockFlow {OPTION} at (3,3) size 20.16x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "foo"
+layer at (61,83) size 33x59 clip at (62,84) size 20x57 scrollHeight 56
+  LayoutListBox {SELECT} at (53.16,75.25) size 33.16x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 20.16x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "foo"
+layer at (12,150) size 33x59 clip at (13,151) size 20x57 scrollHeight 56
+  LayoutListBox {SELECT} at (4,142.25) size 33.16x58.75 [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 20.16x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "foo"
+layer at (12,217) size 33x59 clip at (13,218) size 20x57 scrollHeight 56
+  LayoutListBox {SELECT} at (4,209.25) size 33.16x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 20.16x14.19
+      LayoutText {#text} at (2,0) size 17x13
+        text run at (2,0) width 17: "foo"
+layer at (12,322) size 40x83 clip at (13,323) size 27x81 scrollHeight 80
+  LayoutListBox {SELECT} at (4,314.25) size 40.48x82.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 27.48x20.19
       LayoutText {#text} at (2,0) size 24x18
         text run at (2,0) width 24: "foo"
-layer at (65,303) size 46x102 clip at (66,304) size 33x100
-  LayoutListBox {SELECT} at (56.88,295) size 45.88x102 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 32.88x25
-      LayoutText {#text} at (2,0) size 29x23
-        text run at (2,0) width 29: "foo"
-layer at (123,284) size 51x121 clip at (124,285) size 38x119
-  LayoutListBox {SELECT} at (114.75,275.81) size 51.34x121.19 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 38.34x29.80
-      LayoutText {#text} at (2,0) size 35x28
-        text run at (2,0) width 35: "foo"
-layer at (186,322) size 52x83 clip at (187,323) size 39x81 scrollHeight 80
-  LayoutListBox {SELECT} at (178.09,314.25) size 51.81x82.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 38.81x20.19
+layer at (64,303) size 47x102 clip at (65,304) size 34x100
+  LayoutListBox {SELECT} at (56.48,295) size 46.36x102 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 33.36x25
+      LayoutText {#text} at (2,0) size 30x23
+        text run at (2,0) width 30: "foo"
+layer at (123,284) size 52x121 clip at (124,285) size 39x119
+  LayoutListBox {SELECT} at (114.84,275.81) size 52.23x121.19 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 39.23x29.80
+      LayoutText {#text} at (2,0) size 36x28
+        text run at (2,0) width 36: "foo"
+layer at (187,322) size 53x83 clip at (188,323) size 40x81 scrollHeight 80
+  LayoutListBox {SELECT} at (179.08,314.25) size 52.69x82.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 39.69x20.19
       LayoutText {#text} at (2,0) size 24x18
         text run at (2,0) width 24: "foo"
-    LayoutBlockFlow {OPTION} at (1,21.19) size 38.81x29.80
-      LayoutText {#text} at (2,0) size 35x28
-        text run at (2,0) width 35: "bar"
-layer at (14,450) size 44x87 clip at (15,451) size 31x85
-  LayoutListBox {SELECT} at (6,441.81) size 43.58x87.19 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 30.58x21.30
+    LayoutBlockFlow {OPTION} at (1,21.19) size 39.69x29.80
+      LayoutText {#text} at (2,0) size 36x28
+        text run at (2,0) width 36: "bar"
+layer at (14,450) size 43x87 clip at (15,451) size 30x85
+  LayoutListBox {SELECT} at (6,441.81) size 43.22x87.19 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 30.22x21.30
       LayoutText {#text} at (3,0) size 25x19
         text run at (3,0) width 25: "foo"
-layer at (76,417) size 54x118 clip at (78,419) size 39x114 scrollHeight 113
-  LayoutListBox {SELECT} at (67.58,409.44) size 54.63x117.56 [bgcolor=#FFFFFF] [border: (2px solid #999999)]
-    LayoutBlockFlow {OPTION} at (2,2) size 39.63x28.39
-      LayoutText {#text} at (4,0) size 32x26
-        text run at (4,0) width 32: "foo"
+layer at (75,417) size 56x118 clip at (77,419) size 41x114 scrollHeight 113
+  LayoutListBox {SELECT} at (67.22,409.44) size 55.30x117.56 [bgcolor=#FFFFFF] [border: (2px solid #999999)]
+    LayoutBlockFlow {OPTION} at (2,2) size 40.30x28.39
+      LayoutText {#text} at (4,0) size 33x26
+        text run at (4,0) width 33: "foo"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-separator-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-separator-expected.png
index 7020abdb..952e0f1f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-separator-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-appearance-separator-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-with-display-none-option-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-with-display-none-option-expected.png
index 88e1c99..7ef4008 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-with-display-none-option-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-with-display-none-option-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-with-display-none-option-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-with-display-none-option-expected.txt
index 89cfe0f..63094944 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-with-display-none-option-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/listbox-with-display-none-option-expected.txt
@@ -7,147 +7,147 @@
         LayoutText {#text} at (0,0) size 608x18
           text run at (0,0) width 608: "The select list box should not display items (options and optgroups) with style \"display: none\"."
       LayoutBlockFlow (anonymous) at (0,34) size 784x115
-        LayoutText {#text} at (49,97) size 5x18
-          text run at (49,97) width 5: " "
-        LayoutText {#text} at (112,97) size 5x18
-          text run at (112,97) width 5: " "
-        LayoutText {#text} at (175,97) size 5x18
-          text run at (175,97) width 5: " "
-        LayoutText {#text} at (229,97) size 5x18
-          text run at (229,97) width 5: " "
-        LayoutText {#text} at (283,97) size 5x18
-          text run at (283,97) width 5: " "
+        LayoutText {#text} at (48,97) size 5x18
+          text run at (48,97) width 5: " "
+        LayoutText {#text} at (108,97) size 5x18
+          text run at (108,97) width 5: " "
+        LayoutText {#text} at (169,97) size 5x18
+          text run at (169,97) width 5: " "
+        LayoutText {#text} at (221,97) size 5x18
+          text run at (221,97) width 5: " "
+        LayoutText {#text} at (273,97) size 5x18
+          text run at (273,97) width 5: " "
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
-layer at (8,64) size 50x101 clip at (9,65) size 37x99
-  LayoutListBox {SELECT} at (0,13.69) size 49.58x101.31 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 36.58x14.19
+layer at (8,64) size 48x101 clip at (9,65) size 35x99
+  LayoutListBox {SELECT} at (0,13.69) size 48.06x101.31 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 35.06x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 36.58x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "Five"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 16x13
+        text run at (2,0) width 16: "Six"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
+layer at (60,64) size 57x101 clip at (61,65) size 44x99
+  LayoutListBox {SELECT} at (52.06,13.69) size 56.73x101.31 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 43.73x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 43.73x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "Five"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 17x13
-        text run at (2,0) width 17: "Six"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
-layer at (62,64) size 59x101 clip at (63,65) size 46x99
-  LayoutListBox {SELECT} at (53.58,13.69) size 59.16x101.31 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 46.16x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 43.73x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTGROUP} at (1,43.56) size 43.73x28.38
+      LayoutBlockFlow {DIV} at (0,0) size 43.73x14.19
+        LayoutText {#text} at (2,0) size 40x13
+          text run at (2,0) width 40: "***45***"
+      LayoutBlockFlow {OPTION} at (0,14.19) size 43.73x14.19
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 21x13
+          text run at (14,0) width 21: "Five"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 43.73x14.19
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
+layer at (121,64) size 57x101 clip at (122,65) size 44x99
+  LayoutListBox {SELECT} at (112.80,13.69) size 56.73x101.31 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 43.73x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 43.73x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 46.16x14.19
-      LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 46.16x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTGROUP} at (1,43.56) size 46.16x28.38
-      LayoutBlockFlow {DIV} at (0,0) size 46.16x14.19
-        LayoutText {#text} at (2,0) size 43x13
-          text run at (2,0) width 43: "***45***"
-      LayoutBlockFlow {OPTION} at (0,14.19) size 46.16x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 23x13
-          text run at (15,0) width 23: "Five"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 46.16x14.19
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
-layer at (125,64) size 59x101 clip at (126,65) size 46x99
-  LayoutListBox {SELECT} at (116.73,13.69) size 59.16x101.31 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 46.16x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTGROUP} at (1,29.38) size 43.73x28.38
+      LayoutBlockFlow {DIV} at (0,0) size 43.73x14.19
+        LayoutText {#text} at (2,0) size 40x13
+          text run at (2,0) width 40: "***45***"
+      LayoutBlockFlow {OPTION} at (0,14.19) size 43.73x14.19
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 24x13
+          text run at (14,0) width 24: "Four"
+    LayoutBlockFlow {OPTION} at (1,57.75) size 43.73x14.19
+      LayoutText {#text} at (2,0) size 16x13
+        text run at (2,0) width 16: "Six"
+    LayoutBlockFlow {OPTION} at (1,71.94) size 43.73x14.19
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
+layer at (182,50) size 48x115 clip at (183,51) size 35x113
+  LayoutListBox {SELECT} at (173.53,-0.50) size 48.06x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 35.06x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 46.16x14.19
-      LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTGROUP} at (1,29.38) size 46.16x28.38
-      LayoutBlockFlow {DIV} at (0,0) size 46.16x14.19
-        LayoutText {#text} at (2,0) size 43x13
-          text run at (2,0) width 43: "***45***"
-      LayoutBlockFlow {OPTION} at (0,14.19) size 46.16x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 25x13
-          text run at (15,0) width 25: "Four"
-    LayoutBlockFlow {OPTION} at (1,57.75) size 46.16x14.19
-      LayoutText {#text} at (2,0) size 17x13
-        text run at (2,0) width 17: "Six"
-    LayoutBlockFlow {OPTION} at (1,71.94) size 46.16x14.19
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
-layer at (188,50) size 49x115 clip at (189,51) size 36x113
-  LayoutListBox {SELECT} at (179.89,-0.50) size 49.58x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 36.58x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
+layer at (234,50) size 48x115 clip at (235,51) size 35x113
+  LayoutListBox {SELECT} at (225.59,-0.50) size 48.06x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 35.06x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
-layer at (241,50) size 50x115 clip at (242,51) size 37x113
-  LayoutListBox {SELECT} at (233.47,-0.50) size 49.58x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 36.58x14.19
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTION} at (1,43.56) size 35.06x14.19
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
+layer at (286,50) size 54x115 clip at (287,51) size 41x113
+  LayoutListBox {SELECT} at (277.66,-0.50) size 53.86x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 40.86x14.19
+      LayoutText {#text} at (2,0) size 21x13
+        text run at (2,0) width 21: "One"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 40.86x14.19
       LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTION} at (1,43.56) size 36.58x14.19
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
-layer at (295,50) size 56x115 clip at (296,51) size 43x113
-  LayoutListBox {SELECT} at (287.05,-0.50) size 55.97x115.50 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 42.97x14.19
-      LayoutText {#text} at (2,0) size 22x13
-        text run at (2,0) width 22: "One"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 42.97x14.19
-      LayoutText {#text} at (2,0) size 23x13
-        text run at (2,0) width 23: "Two"
-    LayoutBlockFlow {OPTION} at (1,29.38) size 42.97x14.19
-      LayoutText {#text} at (2,0) size 30x13
-        text run at (2,0) width 30: "Three"
-    LayoutBlockFlow {OPTGROUP} at (1,43.56) size 42.97x56.75
-      LayoutBlockFlow {DIV} at (0,0) size 42.97x14.19
-        LayoutText {#text} at (2,0) size 39x13
-          text run at (2,0) width 39: "**456**"
-      LayoutBlockFlow {OPTION} at (0,14.19) size 42.97x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 25x13
-          text run at (15,0) width 25: "Four"
-      LayoutBlockFlow {OPTION} at (0,28.38) size 42.97x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 23x13
-          text run at (15,0) width 23: "Five"
-      LayoutBlockFlow {OPTION} at (0,42.56) size 42.97x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 18x13
-          text run at (15,0) width 18: "Six"
-    LayoutBlockFlow {OPTION} at (1,100.31) size 42.97x14.19
-      LayoutText {#text} at (2,0) size 33x13
-        text run at (2,0) width 33: "Seven"
+        text run at (2,0) width 22: "Two"
+    LayoutBlockFlow {OPTION} at (1,29.38) size 40.86x14.19
+      LayoutText {#text} at (2,0) size 29x13
+        text run at (2,0) width 29: "Three"
+    LayoutBlockFlow {OPTGROUP} at (1,43.56) size 40.86x56.75
+      LayoutBlockFlow {DIV} at (0,0) size 40.86x14.19
+        LayoutText {#text} at (2,0) size 37x13
+          text run at (2,0) width 37: "**456**"
+      LayoutBlockFlow {OPTION} at (0,14.19) size 40.86x14.19
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 24x13
+          text run at (14,0) width 24: "Four"
+      LayoutBlockFlow {OPTION} at (0,28.38) size 40.86x14.19
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 21x13
+          text run at (14,0) width 21: "Five"
+      LayoutBlockFlow {OPTION} at (0,42.56) size 40.86x14.19
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 16x13
+          text run at (14,0) width 16: "Six"
+    LayoutBlockFlow {OPTION} at (1,100.31) size 40.86x14.19
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Seven"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.png
index b610ce4..5624e91 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.txt
index a2b2387..8c95dde 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/menulist-appearance-basic-expected.txt
@@ -3,72 +3,72 @@
 layer at (0,0) size 800x410
   LayoutBlockFlow {HTML} at (0,0) size 800x410
     LayoutBlockFlow {BODY} at (8,8) size 784x394
-      LayoutMenuList {SELECT} at (4,4) size 49x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 49x18
-          LayoutText (anonymous) at (8,2) size 18x13
-            text run at (8,2) width 18: "foo"
-      LayoutText {#text} at (57,3) size 4x18
-        text run at (57,3) width 4: " "
-      LayoutBR {BR} at (61,3) size 0x18
-      LayoutMenuList {SELECT} at (4,30) size 49x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 49x18
-          LayoutText (anonymous) at (8,2) size 18x13
-            text run at (8,2) width 18: "foo"
-      LayoutText {#text} at (57,29) size 4x18
-        text run at (57,29) width 4: " "
-      LayoutMenuList {SELECT} at (65,30) size 49x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 49x18
-          LayoutText (anonymous) at (8,2) size 18x13
-            text run at (8,2) width 18: "foo"
-      LayoutText {#text} at (118,29) size 4x18
-        text run at (118,29) width 4: " "
-      LayoutMenuList {SELECT} at (126,30) size 49x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 49x18
-          LayoutText (anonymous) at (8,2) size 18x13
-            text run at (8,2) width 18: "foo"
-      LayoutText {#text} at (179,29) size 4x18
-        text run at (179,29) width 4: " "
-      LayoutMenuList {SELECT} at (187,30) size 49x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 49x18
-          LayoutText (anonymous) at (8,2) size 18x13
-            text run at (8,2) width 18: "foo"
-      LayoutText {#text} at (240,29) size 4x18
-        text run at (240,29) width 4: " "
-      LayoutBR {BR} at (244,29) size 0x18
-      LayoutMenuList {SELECT} at (4,56) size 53x22 [bgcolor=#F8F8F8] [border: (3px solid #00FF00)]
-        LayoutBlockFlow (anonymous) at (3,3) size 47x16
-          LayoutText (anonymous) at (8,1) size 18x13
-            text run at (8,1) width 18: "foo"
-      LayoutText {#text} at (61,57) size 4x18
-        text run at (61,57) width 4: " "
-      LayoutMenuList {SELECT} at (69,58) size 49x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 47x16
-          LayoutText (anonymous) at (8,1) size 18x13
-            text run at (8,1) width 18: "foo"
-      LayoutText {#text} at (122,57) size 4x18
-        text run at (122,57) width 4: " "
-      LayoutBR {BR} at (126,57) size 0x18
-      LayoutMenuList {SELECT} at (4,93) size 49x18 [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 47x16
-          LayoutText (anonymous) at (8,1) size 18x13
-            text run at (8,1) width 18: "foo"
-      LayoutText {#text} at (57,92) size 4x18
-        text run at (57,92) width 4: " "
-      LayoutBlockFlow {DIV} at (61,82) size 71x40 [bgcolor=#DBB102]
-        LayoutMenuList {SELECT} at (12,12) size 47x16
-          LayoutBlockFlow (anonymous) at (0,0) size 47x16
-            LayoutText (anonymous) at (8,1) size 18x13
-              text run at (8,1) width 18: "bar"
-      LayoutText {#text} at (132,92) size 4x18
-        text run at (132,92) width 4: " "
-      LayoutBR {BR} at (136,92) size 0x18
-      LayoutMenuList {SELECT} at (4,126) size 49x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (1,1) size 47x16
-          LayoutText (anonymous) at (8,1) size 18x13
-            text run at (8,1) width 18: "foo"
-      LayoutText {#text} at (57,125) size 4x18
-        text run at (57,125) width 4: " "
-      LayoutBR {BR} at (61,125) size 0x18
+      LayoutMenuList {SELECT} at (4,4) size 48x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 48x18
+          LayoutText (anonymous) at (8,2) size 17x13
+            text run at (8,2) width 17: "foo"
+      LayoutText {#text} at (56,3) size 4x18
+        text run at (56,3) width 4: " "
+      LayoutBR {BR} at (60,3) size 0x18
+      LayoutMenuList {SELECT} at (4,30) size 48x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 48x18
+          LayoutText (anonymous) at (8,2) size 17x13
+            text run at (8,2) width 17: "foo"
+      LayoutText {#text} at (56,29) size 4x18
+        text run at (56,29) width 4: " "
+      LayoutMenuList {SELECT} at (64,30) size 48x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 48x18
+          LayoutText (anonymous) at (8,2) size 17x13
+            text run at (8,2) width 17: "foo"
+      LayoutText {#text} at (116,29) size 4x18
+        text run at (116,29) width 4: " "
+      LayoutMenuList {SELECT} at (124,30) size 48x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 48x18
+          LayoutText (anonymous) at (8,2) size 17x13
+            text run at (8,2) width 17: "foo"
+      LayoutText {#text} at (176,29) size 4x18
+        text run at (176,29) width 4: " "
+      LayoutMenuList {SELECT} at (184,30) size 48x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 48x18
+          LayoutText (anonymous) at (8,2) size 17x13
+            text run at (8,2) width 17: "foo"
+      LayoutText {#text} at (236,29) size 4x18
+        text run at (236,29) width 4: " "
+      LayoutBR {BR} at (240,29) size 0x18
+      LayoutMenuList {SELECT} at (4,56) size 52x22 [bgcolor=#F8F8F8] [border: (3px solid #00FF00)]
+        LayoutBlockFlow (anonymous) at (3,3) size 46x16
+          LayoutText (anonymous) at (8,1) size 17x13
+            text run at (8,1) width 17: "foo"
+      LayoutText {#text} at (60,57) size 4x18
+        text run at (60,57) width 4: " "
+      LayoutMenuList {SELECT} at (68,58) size 48x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 46x16
+          LayoutText (anonymous) at (8,1) size 17x13
+            text run at (8,1) width 17: "foo"
+      LayoutText {#text} at (120,57) size 4x18
+        text run at (120,57) width 4: " "
+      LayoutBR {BR} at (124,57) size 0x18
+      LayoutMenuList {SELECT} at (4,93) size 48x18 [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 46x16
+          LayoutText (anonymous) at (8,1) size 17x13
+            text run at (8,1) width 17: "foo"
+      LayoutText {#text} at (56,92) size 4x18
+        text run at (56,92) width 4: " "
+      LayoutBlockFlow {DIV} at (60,82) size 70x40 [bgcolor=#DBB102]
+        LayoutMenuList {SELECT} at (12,12) size 46x16
+          LayoutBlockFlow (anonymous) at (0,0) size 46x16
+            LayoutText (anonymous) at (8,1) size 17x13
+              text run at (8,1) width 17: "bar"
+      LayoutText {#text} at (130,92) size 4x18
+        text run at (130,92) width 4: " "
+      LayoutBR {BR} at (134,92) size 0x18
+      LayoutMenuList {SELECT} at (4,126) size 48x18 [bgcolor=#F8F8F8] [border: (1px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (1,1) size 46x16
+          LayoutText (anonymous) at (8,1) size 17x13
+            text run at (8,1) width 17: "foo"
+      LayoutText {#text} at (56,125) size 4x18
+        text run at (56,125) width 4: " "
+      LayoutBR {BR} at (60,125) size 0x18
       LayoutMenuList {SELECT} at (4,152) size 51x21 [bgcolor=#F8F8F8]
         LayoutBlockFlow (anonymous) at (0,0) size 51x21
           LayoutText (anonymous) at (8,2) size 20x16
@@ -94,13 +94,13 @@
             text run at (12,1) width 25: "foo"
       LayoutText {#text} at (83,196) size 4x18
         text run at (83,196) width 4: " "
-      LayoutMenuList {SELECT} at (95,185) size 94x36 [bgcolor=#F8F8F8] [border: (2px solid #A6A6A6)]
-        LayoutBlockFlow (anonymous) at (2,2) size 90x32
-          LayoutText (anonymous) at (16,2) size 32x26
-            text run at (16,2) width 32: "foo"
-      LayoutText {#text} at (197,196) size 4x18
-        text run at (197,196) width 4: " "
-      LayoutBR {BR} at (201,196) size 0x18
+      LayoutMenuList {SELECT} at (95,185) size 95x36 [bgcolor=#F8F8F8] [border: (2px solid #A6A6A6)]
+        LayoutBlockFlow (anonymous) at (2,2) size 91x32
+          LayoutText (anonymous) at (16,2) size 33x26
+            text run at (16,2) width 33: "foo"
+      LayoutText {#text} at (198,196) size 4x18
+        text run at (198,196) width 4: " "
+      LayoutBR {BR} at (202,196) size 0x18
       LayoutText {#text} at (208,244) size 4x18
         text run at (208,244) width 4: " "
       LayoutBR {BR} at (212,244) size 0x18
@@ -117,3855 +117,3855 @@
 layer at (12,241) size 200x25 clip at (13,242) size 187x23 scrollHeight 42
   LayoutListBox {SELECT} at (4,233) size 200x25 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 187x14.19
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 1"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 1"
     LayoutBlockFlow {OPTION} at (1,15.19) size 187x14.19
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 2"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 2"
     LayoutBlockFlow {OPTION} at (1,29.38) size 187x14.19
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 3"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 3"
 layer at (12,274) size 200x25 clip at (13,275) size 187x23 scrollY 5.00 scrollHeight 42
   LayoutListBox {SELECT} at (4,266) size 200x25 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 187x14.19
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 1"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 1"
     LayoutBlockFlow {OPTION} at (1,15.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 2"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 2"
     LayoutBlockFlow {OPTION} at (1,29.38) size 187x14.19
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 3"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 3"
 layer at (12,307) size 200x25 clip at (13,308) size 187x23 scrollY 5.00 scrollHeight 42
   LayoutListBox {SELECT} at (4,299) size 200x25 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 187x14.19
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 1"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 1"
     LayoutBlockFlow {OPTION} at (1,15.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 2"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 2"
     LayoutBlockFlow {OPTION} at (1,29.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 3"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 3"
 layer at (12,340) size 200x25 clip at (13,341) size 187x23 scrollHeight 312
   LayoutListBox {SELECT} at (4,332) size 200x25 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 44x13
-        text run at (2,0) width 44: "Item 0.1"
+      LayoutText {#text} at (2,0) size 41x13
+        text run at (2,0) width 41: "Item 0.1"
     LayoutBlockFlow {OPTGROUP} at (1,15.19) size 187x56.75
       LayoutBlockFlow {DIV} at (0,0) size 187x14.19
-        LayoutText {#text} at (2,0) size 45x13
-          text run at (2,0) width 45: "Group 1"
+        LayoutText {#text} at (2,0) size 43x13
+          text run at (2,0) width 43: "Group 1"
       LayoutBlockFlow {OPTION} at (0,14.19) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 1.1"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 1.1"
       LayoutBlockFlow {OPTION} at (0,28.38) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 1.2"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 1.2"
       LayoutBlockFlow {OPTION} at (0,42.56) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 1.3"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 1.3"
     LayoutBlockFlow {OPTGROUP} at (1,71.94) size 187x56.75
       LayoutBlockFlow {DIV} at (0,0) size 187x14.19
-        LayoutText {#text} at (2,0) size 45x13
-          text run at (2,0) width 45: "Group 2"
+        LayoutText {#text} at (2,0) size 43x13
+          text run at (2,0) width 43: "Group 2"
       LayoutBlockFlow {OPTION} at (0,14.19) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 2.1"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 2.1"
       LayoutBlockFlow {OPTION} at (0,28.38) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 2.2"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 2.2"
       LayoutBlockFlow {OPTION} at (0,42.56) size 187x14.19 [bgcolor=#D4D4D4]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 2.3"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 2.3"
     LayoutBlockFlow {OPTGROUP} at (1,128.69) size 187x56.75
       LayoutBlockFlow {DIV} at (0,0) size 187x14.19
-        LayoutText {#text} at (2,0) size 45x13
-          text run at (2,0) width 45: "Group 3"
+        LayoutText {#text} at (2,0) size 43x13
+          text run at (2,0) width 43: "Group 3"
       LayoutBlockFlow {OPTION} at (0,14.19) size 187x14.19 [bgcolor=#D4D4D4]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 3.1"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 3.1"
       LayoutBlockFlow {OPTION} at (0,28.38) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 3.2"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 3.2"
       LayoutBlockFlow {OPTION} at (0,42.56) size 187x14.19 [bgcolor=#D4D4D4]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 3.3"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 3.3"
     LayoutBlockFlow {OPTGROUP} at (1,185.44) size 187x56.75
       LayoutBlockFlow {DIV} at (0,0) size 187x14.19
-        LayoutText {#text} at (2,0) size 45x13
-          text run at (2,0) width 45: "Group 4"
+        LayoutText {#text} at (2,0) size 43x13
+          text run at (2,0) width 43: "Group 4"
       LayoutBlockFlow {OPTION} at (0,14.19) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 4.1"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 4.1"
       LayoutBlockFlow {OPTION} at (0,28.38) size 187x14.19 [bgcolor=#D4D4D4]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 4.2"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 4.2"
       LayoutBlockFlow {OPTION} at (0,42.56) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 4.3"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 4.3"
     LayoutBlockFlow {OPTGROUP} at (1,242.19) size 187x56.75
       LayoutBlockFlow {DIV} at (0,0) size 187x14.19
-        LayoutText {#text} at (2,0) size 45x13
-          text run at (2,0) width 45: "Group 5"
+        LayoutText {#text} at (2,0) size 43x13
+          text run at (2,0) width 43: "Group 5"
       LayoutBlockFlow {OPTION} at (0,14.19) size 187x14.19 [bgcolor=#D4D4D4]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 5.1"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 5.1"
       LayoutBlockFlow {OPTION} at (0,28.38) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 5.2"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 5.2"
       LayoutBlockFlow {OPTION} at (0,42.56) size 187x14.19
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 44x13
-          text run at (15,0) width 44: "Item 5.3"
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 42x13
+          text run at (14,0) width 42: "Item 5.3"
     LayoutBlockFlow {OPTION} at (1,298.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 44x13
-        text run at (2,0) width 44: "Item 0.2"
+      LayoutText {#text} at (2,0) size 41x13
+        text run at (2,0) width 41: "Item 0.2"
 layer at (12,373) size 200x25 clip at (13,374) size 187x23 scrollHeight 17507
   LayoutListBox {SELECT} at (4,365) size 200x25 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
     LayoutBlockFlow {OPTION} at (1,1) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 1"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 1"
     LayoutBlockFlow {OPTION} at (1,15.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 2"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 2"
     LayoutBlockFlow {OPTION} at (1,29.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 3"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 3"
     LayoutBlockFlow {OPTION} at (1,43.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 4"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 4"
     LayoutBlockFlow {OPTION} at (1,57.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 5"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 5"
     LayoutBlockFlow {OPTION} at (1,71.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 6"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 6"
     LayoutBlockFlow {OPTION} at (1,86.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 7"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 7"
     LayoutBlockFlow {OPTION} at (1,100.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 8"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 8"
     LayoutBlockFlow {OPTION} at (1,114.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 34x13
-        text run at (2,0) width 34: "Item 9"
+      LayoutText {#text} at (2,0) size 32x13
+        text run at (2,0) width 32: "Item 9"
     LayoutBlockFlow {OPTION} at (1,128.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 10"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 10"
     LayoutBlockFlow {OPTION} at (1,142.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 11"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 11"
     LayoutBlockFlow {OPTION} at (1,157.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 12"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 12"
     LayoutBlockFlow {OPTION} at (1,171.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 13"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 13"
     LayoutBlockFlow {OPTION} at (1,185.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 14"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 14"
     LayoutBlockFlow {OPTION} at (1,199.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 15"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 15"
     LayoutBlockFlow {OPTION} at (1,213.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 16"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 16"
     LayoutBlockFlow {OPTION} at (1,228) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 17"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 17"
     LayoutBlockFlow {OPTION} at (1,242.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 18"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 18"
     LayoutBlockFlow {OPTION} at (1,256.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 19"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 19"
     LayoutBlockFlow {OPTION} at (1,270.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 20"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 20"
     LayoutBlockFlow {OPTION} at (1,284.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 21"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 21"
     LayoutBlockFlow {OPTION} at (1,298.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 22"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 22"
     LayoutBlockFlow {OPTION} at (1,313.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 23"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 23"
     LayoutBlockFlow {OPTION} at (1,327.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 24"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 24"
     LayoutBlockFlow {OPTION} at (1,341.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 25"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 25"
     LayoutBlockFlow {OPTION} at (1,355.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 26"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 26"
     LayoutBlockFlow {OPTION} at (1,369.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 27"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 27"
     LayoutBlockFlow {OPTION} at (1,384.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 28"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 28"
     LayoutBlockFlow {OPTION} at (1,398.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 29"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 29"
     LayoutBlockFlow {OPTION} at (1,412.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 30"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 30"
     LayoutBlockFlow {OPTION} at (1,426.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 31"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 31"
     LayoutBlockFlow {OPTION} at (1,440.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 32"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 32"
     LayoutBlockFlow {OPTION} at (1,455) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 33"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 33"
     LayoutBlockFlow {OPTION} at (1,469.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 34"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 34"
     LayoutBlockFlow {OPTION} at (1,483.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 35"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 35"
     LayoutBlockFlow {OPTION} at (1,497.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 36"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 36"
     LayoutBlockFlow {OPTION} at (1,511.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 37"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 37"
     LayoutBlockFlow {OPTION} at (1,525.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 38"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 38"
     LayoutBlockFlow {OPTION} at (1,540.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 39"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 39"
     LayoutBlockFlow {OPTION} at (1,554.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 40"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 40"
     LayoutBlockFlow {OPTION} at (1,568.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 41"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 41"
     LayoutBlockFlow {OPTION} at (1,582.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 42"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 42"
     LayoutBlockFlow {OPTION} at (1,596.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 43"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 43"
     LayoutBlockFlow {OPTION} at (1,611.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 44"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 44"
     LayoutBlockFlow {OPTION} at (1,625.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 45"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 45"
     LayoutBlockFlow {OPTION} at (1,639.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 46"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 46"
     LayoutBlockFlow {OPTION} at (1,653.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 47"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 47"
     LayoutBlockFlow {OPTION} at (1,667.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 48"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 48"
     LayoutBlockFlow {OPTION} at (1,682) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 49"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 49"
     LayoutBlockFlow {OPTION} at (1,696.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 50"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 50"
     LayoutBlockFlow {OPTION} at (1,710.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 51"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 51"
     LayoutBlockFlow {OPTION} at (1,724.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 52"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 52"
     LayoutBlockFlow {OPTION} at (1,738.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 53"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 53"
     LayoutBlockFlow {OPTION} at (1,752.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 54"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 54"
     LayoutBlockFlow {OPTION} at (1,767.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 55"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 55"
     LayoutBlockFlow {OPTION} at (1,781.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 56"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 56"
     LayoutBlockFlow {OPTION} at (1,795.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 57"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 57"
     LayoutBlockFlow {OPTION} at (1,809.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 58"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 58"
     LayoutBlockFlow {OPTION} at (1,823.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 59"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 59"
     LayoutBlockFlow {OPTION} at (1,838.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 60"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 60"
     LayoutBlockFlow {OPTION} at (1,852.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 61"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 61"
     LayoutBlockFlow {OPTION} at (1,866.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 62"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 62"
     LayoutBlockFlow {OPTION} at (1,880.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 63"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 63"
     LayoutBlockFlow {OPTION} at (1,894.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 64"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 64"
     LayoutBlockFlow {OPTION} at (1,909) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 65"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 65"
     LayoutBlockFlow {OPTION} at (1,923.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 66"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 66"
     LayoutBlockFlow {OPTION} at (1,937.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 67"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 67"
     LayoutBlockFlow {OPTION} at (1,951.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 68"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 68"
     LayoutBlockFlow {OPTION} at (1,965.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 69"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 69"
     LayoutBlockFlow {OPTION} at (1,979.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 70"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 70"
     LayoutBlockFlow {OPTION} at (1,994.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 71"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 71"
     LayoutBlockFlow {OPTION} at (1,1008.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 72"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 72"
     LayoutBlockFlow {OPTION} at (1,1022.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 73"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 73"
     LayoutBlockFlow {OPTION} at (1,1036.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 74"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 74"
     LayoutBlockFlow {OPTION} at (1,1050.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 75"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 75"
     LayoutBlockFlow {OPTION} at (1,1065.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 76"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 76"
     LayoutBlockFlow {OPTION} at (1,1079.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 77"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 77"
     LayoutBlockFlow {OPTION} at (1,1093.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 78"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 78"
     LayoutBlockFlow {OPTION} at (1,1107.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 79"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 79"
     LayoutBlockFlow {OPTION} at (1,1121.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 80"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 80"
     LayoutBlockFlow {OPTION} at (1,1136) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 81"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 81"
     LayoutBlockFlow {OPTION} at (1,1150.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 82"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 82"
     LayoutBlockFlow {OPTION} at (1,1164.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 83"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 83"
     LayoutBlockFlow {OPTION} at (1,1178.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 84"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 84"
     LayoutBlockFlow {OPTION} at (1,1192.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 85"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 85"
     LayoutBlockFlow {OPTION} at (1,1206.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 86"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 86"
     LayoutBlockFlow {OPTION} at (1,1221.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 87"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 87"
     LayoutBlockFlow {OPTION} at (1,1235.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 88"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 88"
     LayoutBlockFlow {OPTION} at (1,1249.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 89"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 89"
     LayoutBlockFlow {OPTION} at (1,1263.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 90"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 90"
     LayoutBlockFlow {OPTION} at (1,1277.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 91"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 91"
     LayoutBlockFlow {OPTION} at (1,1292.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 92"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 92"
     LayoutBlockFlow {OPTION} at (1,1306.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 93"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 93"
     LayoutBlockFlow {OPTION} at (1,1320.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 94"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 94"
     LayoutBlockFlow {OPTION} at (1,1334.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 95"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 95"
     LayoutBlockFlow {OPTION} at (1,1348.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 96"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 96"
     LayoutBlockFlow {OPTION} at (1,1363) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 97"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 97"
     LayoutBlockFlow {OPTION} at (1,1377.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 98"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 98"
     LayoutBlockFlow {OPTION} at (1,1391.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 40x13
-        text run at (2,0) width 40: "Item 99"
+      LayoutText {#text} at (2,0) size 38x13
+        text run at (2,0) width 38: "Item 99"
     LayoutBlockFlow {OPTION} at (1,1405.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 100"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 100"
     LayoutBlockFlow {OPTION} at (1,1419.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 101"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 101"
     LayoutBlockFlow {OPTION} at (1,1433.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 102"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 102"
     LayoutBlockFlow {OPTION} at (1,1448.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 103"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 103"
     LayoutBlockFlow {OPTION} at (1,1462.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 104"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 104"
     LayoutBlockFlow {OPTION} at (1,1476.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 105"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 105"
     LayoutBlockFlow {OPTION} at (1,1490.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 106"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 106"
     LayoutBlockFlow {OPTION} at (1,1504.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 107"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 107"
     LayoutBlockFlow {OPTION} at (1,1519.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 108"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 108"
     LayoutBlockFlow {OPTION} at (1,1533.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 109"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 109"
     LayoutBlockFlow {OPTION} at (1,1547.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 110"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 110"
     LayoutBlockFlow {OPTION} at (1,1561.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 111"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 111"
     LayoutBlockFlow {OPTION} at (1,1575.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 112"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 112"
     LayoutBlockFlow {OPTION} at (1,1590) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 113"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 113"
     LayoutBlockFlow {OPTION} at (1,1604.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 114"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 114"
     LayoutBlockFlow {OPTION} at (1,1618.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 115"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 115"
     LayoutBlockFlow {OPTION} at (1,1632.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 116"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 116"
     LayoutBlockFlow {OPTION} at (1,1646.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 117"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 117"
     LayoutBlockFlow {OPTION} at (1,1660.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 118"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 118"
     LayoutBlockFlow {OPTION} at (1,1675.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 119"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 119"
     LayoutBlockFlow {OPTION} at (1,1689.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 120"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 120"
     LayoutBlockFlow {OPTION} at (1,1703.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 121"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 121"
     LayoutBlockFlow {OPTION} at (1,1717.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 122"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 122"
     LayoutBlockFlow {OPTION} at (1,1731.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 123"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 123"
     LayoutBlockFlow {OPTION} at (1,1746.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 124"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 124"
     LayoutBlockFlow {OPTION} at (1,1760.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 125"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 125"
     LayoutBlockFlow {OPTION} at (1,1774.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 126"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 126"
     LayoutBlockFlow {OPTION} at (1,1788.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 127"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 127"
     LayoutBlockFlow {OPTION} at (1,1802.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 128"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 128"
     LayoutBlockFlow {OPTION} at (1,1817) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 129"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 129"
     LayoutBlockFlow {OPTION} at (1,1831.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 130"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 130"
     LayoutBlockFlow {OPTION} at (1,1845.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 131"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 131"
     LayoutBlockFlow {OPTION} at (1,1859.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 132"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 132"
     LayoutBlockFlow {OPTION} at (1,1873.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 133"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 133"
     LayoutBlockFlow {OPTION} at (1,1887.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 134"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 134"
     LayoutBlockFlow {OPTION} at (1,1902.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 135"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 135"
     LayoutBlockFlow {OPTION} at (1,1916.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 136"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 136"
     LayoutBlockFlow {OPTION} at (1,1930.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 137"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 137"
     LayoutBlockFlow {OPTION} at (1,1944.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 138"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 138"
     LayoutBlockFlow {OPTION} at (1,1958.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 139"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 139"
     LayoutBlockFlow {OPTION} at (1,1973.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 140"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 140"
     LayoutBlockFlow {OPTION} at (1,1987.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 141"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 141"
     LayoutBlockFlow {OPTION} at (1,2001.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 142"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 142"
     LayoutBlockFlow {OPTION} at (1,2015.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 143"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 143"
     LayoutBlockFlow {OPTION} at (1,2029.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 144"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 144"
     LayoutBlockFlow {OPTION} at (1,2044) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 145"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 145"
     LayoutBlockFlow {OPTION} at (1,2058.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 146"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 146"
     LayoutBlockFlow {OPTION} at (1,2072.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 147"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 147"
     LayoutBlockFlow {OPTION} at (1,2086.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 148"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 148"
     LayoutBlockFlow {OPTION} at (1,2100.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 149"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 149"
     LayoutBlockFlow {OPTION} at (1,2114.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 150"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 150"
     LayoutBlockFlow {OPTION} at (1,2129.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 151"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 151"
     LayoutBlockFlow {OPTION} at (1,2143.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 152"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 152"
     LayoutBlockFlow {OPTION} at (1,2157.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 153"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 153"
     LayoutBlockFlow {OPTION} at (1,2171.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 154"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 154"
     LayoutBlockFlow {OPTION} at (1,2185.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 155"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 155"
     LayoutBlockFlow {OPTION} at (1,2200.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 156"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 156"
     LayoutBlockFlow {OPTION} at (1,2214.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 157"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 157"
     LayoutBlockFlow {OPTION} at (1,2228.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 158"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 158"
     LayoutBlockFlow {OPTION} at (1,2242.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 159"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 159"
     LayoutBlockFlow {OPTION} at (1,2256.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 160"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 160"
     LayoutBlockFlow {OPTION} at (1,2271) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 161"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 161"
     LayoutBlockFlow {OPTION} at (1,2285.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 162"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 162"
     LayoutBlockFlow {OPTION} at (1,2299.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 163"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 163"
     LayoutBlockFlow {OPTION} at (1,2313.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 164"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 164"
     LayoutBlockFlow {OPTION} at (1,2327.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 165"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 165"
     LayoutBlockFlow {OPTION} at (1,2341.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 166"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 166"
     LayoutBlockFlow {OPTION} at (1,2356.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 167"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 167"
     LayoutBlockFlow {OPTION} at (1,2370.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 168"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 168"
     LayoutBlockFlow {OPTION} at (1,2384.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 169"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 169"
     LayoutBlockFlow {OPTION} at (1,2398.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 170"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 170"
     LayoutBlockFlow {OPTION} at (1,2412.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 171"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 171"
     LayoutBlockFlow {OPTION} at (1,2427.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 172"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 172"
     LayoutBlockFlow {OPTION} at (1,2441.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 173"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 173"
     LayoutBlockFlow {OPTION} at (1,2455.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 174"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 174"
     LayoutBlockFlow {OPTION} at (1,2469.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 175"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 175"
     LayoutBlockFlow {OPTION} at (1,2483.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 176"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 176"
     LayoutBlockFlow {OPTION} at (1,2498) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 177"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 177"
     LayoutBlockFlow {OPTION} at (1,2512.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 178"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 178"
     LayoutBlockFlow {OPTION} at (1,2526.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 179"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 179"
     LayoutBlockFlow {OPTION} at (1,2540.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 180"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 180"
     LayoutBlockFlow {OPTION} at (1,2554.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 181"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 181"
     LayoutBlockFlow {OPTION} at (1,2568.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 182"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 182"
     LayoutBlockFlow {OPTION} at (1,2583.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 183"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 183"
     LayoutBlockFlow {OPTION} at (1,2597.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 184"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 184"
     LayoutBlockFlow {OPTION} at (1,2611.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 185"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 185"
     LayoutBlockFlow {OPTION} at (1,2625.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 186"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 186"
     LayoutBlockFlow {OPTION} at (1,2639.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 187"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 187"
     LayoutBlockFlow {OPTION} at (1,2654.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 188"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 188"
     LayoutBlockFlow {OPTION} at (1,2668.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 189"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 189"
     LayoutBlockFlow {OPTION} at (1,2682.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 190"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 190"
     LayoutBlockFlow {OPTION} at (1,2696.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 191"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 191"
     LayoutBlockFlow {OPTION} at (1,2710.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 192"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 192"
     LayoutBlockFlow {OPTION} at (1,2725) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 193"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 193"
     LayoutBlockFlow {OPTION} at (1,2739.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 194"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 194"
     LayoutBlockFlow {OPTION} at (1,2753.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 195"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 195"
     LayoutBlockFlow {OPTION} at (1,2767.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 196"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 196"
     LayoutBlockFlow {OPTION} at (1,2781.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 197"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 197"
     LayoutBlockFlow {OPTION} at (1,2795.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 198"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 198"
     LayoutBlockFlow {OPTION} at (1,2810.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 199"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 199"
     LayoutBlockFlow {OPTION} at (1,2824.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 200"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 200"
     LayoutBlockFlow {OPTION} at (1,2838.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 201"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 201"
     LayoutBlockFlow {OPTION} at (1,2852.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 202"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 202"
     LayoutBlockFlow {OPTION} at (1,2866.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 203"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 203"
     LayoutBlockFlow {OPTION} at (1,2881.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 204"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 204"
     LayoutBlockFlow {OPTION} at (1,2895.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 205"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 205"
     LayoutBlockFlow {OPTION} at (1,2909.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 206"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 206"
     LayoutBlockFlow {OPTION} at (1,2923.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 207"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 207"
     LayoutBlockFlow {OPTION} at (1,2937.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 208"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 208"
     LayoutBlockFlow {OPTION} at (1,2952) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 209"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 209"
     LayoutBlockFlow {OPTION} at (1,2966.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 210"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 210"
     LayoutBlockFlow {OPTION} at (1,2980.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 211"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 211"
     LayoutBlockFlow {OPTION} at (1,2994.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 212"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 212"
     LayoutBlockFlow {OPTION} at (1,3008.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 213"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 213"
     LayoutBlockFlow {OPTION} at (1,3022.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 214"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 214"
     LayoutBlockFlow {OPTION} at (1,3037.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 215"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 215"
     LayoutBlockFlow {OPTION} at (1,3051.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 216"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 216"
     LayoutBlockFlow {OPTION} at (1,3065.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 217"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 217"
     LayoutBlockFlow {OPTION} at (1,3079.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 218"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 218"
     LayoutBlockFlow {OPTION} at (1,3093.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 219"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 219"
     LayoutBlockFlow {OPTION} at (1,3108.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 220"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 220"
     LayoutBlockFlow {OPTION} at (1,3122.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 221"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 221"
     LayoutBlockFlow {OPTION} at (1,3136.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 222"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 222"
     LayoutBlockFlow {OPTION} at (1,3150.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 223"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 223"
     LayoutBlockFlow {OPTION} at (1,3164.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 224"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 224"
     LayoutBlockFlow {OPTION} at (1,3179) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 225"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 225"
     LayoutBlockFlow {OPTION} at (1,3193.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 226"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 226"
     LayoutBlockFlow {OPTION} at (1,3207.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 227"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 227"
     LayoutBlockFlow {OPTION} at (1,3221.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 228"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 228"
     LayoutBlockFlow {OPTION} at (1,3235.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 229"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 229"
     LayoutBlockFlow {OPTION} at (1,3249.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 230"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 230"
     LayoutBlockFlow {OPTION} at (1,3264.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 231"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 231"
     LayoutBlockFlow {OPTION} at (1,3278.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 232"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 232"
     LayoutBlockFlow {OPTION} at (1,3292.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 233"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 233"
     LayoutBlockFlow {OPTION} at (1,3306.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 234"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 234"
     LayoutBlockFlow {OPTION} at (1,3320.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 235"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 235"
     LayoutBlockFlow {OPTION} at (1,3335.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 236"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 236"
     LayoutBlockFlow {OPTION} at (1,3349.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 237"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 237"
     LayoutBlockFlow {OPTION} at (1,3363.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 238"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 238"
     LayoutBlockFlow {OPTION} at (1,3377.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 239"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 239"
     LayoutBlockFlow {OPTION} at (1,3391.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 240"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 240"
     LayoutBlockFlow {OPTION} at (1,3406) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 241"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 241"
     LayoutBlockFlow {OPTION} at (1,3420.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 242"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 242"
     LayoutBlockFlow {OPTION} at (1,3434.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 243"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 243"
     LayoutBlockFlow {OPTION} at (1,3448.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 244"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 244"
     LayoutBlockFlow {OPTION} at (1,3462.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 245"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 245"
     LayoutBlockFlow {OPTION} at (1,3476.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 246"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 246"
     LayoutBlockFlow {OPTION} at (1,3491.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 247"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 247"
     LayoutBlockFlow {OPTION} at (1,3505.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 248"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 248"
     LayoutBlockFlow {OPTION} at (1,3519.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 249"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 249"
     LayoutBlockFlow {OPTION} at (1,3533.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 250"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 250"
     LayoutBlockFlow {OPTION} at (1,3547.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 251"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 251"
     LayoutBlockFlow {OPTION} at (1,3562.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 252"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 252"
     LayoutBlockFlow {OPTION} at (1,3576.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 253"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 253"
     LayoutBlockFlow {OPTION} at (1,3590.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 254"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 254"
     LayoutBlockFlow {OPTION} at (1,3604.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 255"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 255"
     LayoutBlockFlow {OPTION} at (1,3618.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 256"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 256"
     LayoutBlockFlow {OPTION} at (1,3633) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 257"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 257"
     LayoutBlockFlow {OPTION} at (1,3647.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 258"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 258"
     LayoutBlockFlow {OPTION} at (1,3661.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 259"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 259"
     LayoutBlockFlow {OPTION} at (1,3675.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 260"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 260"
     LayoutBlockFlow {OPTION} at (1,3689.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 261"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 261"
     LayoutBlockFlow {OPTION} at (1,3703.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 262"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 262"
     LayoutBlockFlow {OPTION} at (1,3718.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 263"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 263"
     LayoutBlockFlow {OPTION} at (1,3732.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 264"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 264"
     LayoutBlockFlow {OPTION} at (1,3746.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 265"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 265"
     LayoutBlockFlow {OPTION} at (1,3760.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 266"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 266"
     LayoutBlockFlow {OPTION} at (1,3774.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 267"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 267"
     LayoutBlockFlow {OPTION} at (1,3789.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 268"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 268"
     LayoutBlockFlow {OPTION} at (1,3803.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 269"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 269"
     LayoutBlockFlow {OPTION} at (1,3817.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 270"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 270"
     LayoutBlockFlow {OPTION} at (1,3831.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 271"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 271"
     LayoutBlockFlow {OPTION} at (1,3845.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 272"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 272"
     LayoutBlockFlow {OPTION} at (1,3860) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 273"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 273"
     LayoutBlockFlow {OPTION} at (1,3874.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 274"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 274"
     LayoutBlockFlow {OPTION} at (1,3888.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 275"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 275"
     LayoutBlockFlow {OPTION} at (1,3902.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 276"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 276"
     LayoutBlockFlow {OPTION} at (1,3916.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 277"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 277"
     LayoutBlockFlow {OPTION} at (1,3930.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 278"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 278"
     LayoutBlockFlow {OPTION} at (1,3945.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 279"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 279"
     LayoutBlockFlow {OPTION} at (1,3959.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 280"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 280"
     LayoutBlockFlow {OPTION} at (1,3973.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 281"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 281"
     LayoutBlockFlow {OPTION} at (1,3987.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 282"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 282"
     LayoutBlockFlow {OPTION} at (1,4001.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 283"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 283"
     LayoutBlockFlow {OPTION} at (1,4016.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 284"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 284"
     LayoutBlockFlow {OPTION} at (1,4030.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 285"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 285"
     LayoutBlockFlow {OPTION} at (1,4044.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 286"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 286"
     LayoutBlockFlow {OPTION} at (1,4058.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 287"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 287"
     LayoutBlockFlow {OPTION} at (1,4072.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 288"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 288"
     LayoutBlockFlow {OPTION} at (1,4087) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 289"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 289"
     LayoutBlockFlow {OPTION} at (1,4101.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 290"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 290"
     LayoutBlockFlow {OPTION} at (1,4115.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 291"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 291"
     LayoutBlockFlow {OPTION} at (1,4129.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 292"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 292"
     LayoutBlockFlow {OPTION} at (1,4143.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 293"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 293"
     LayoutBlockFlow {OPTION} at (1,4157.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 294"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 294"
     LayoutBlockFlow {OPTION} at (1,4172.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 295"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 295"
     LayoutBlockFlow {OPTION} at (1,4186.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 296"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 296"
     LayoutBlockFlow {OPTION} at (1,4200.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 297"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 297"
     LayoutBlockFlow {OPTION} at (1,4214.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 298"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 298"
     LayoutBlockFlow {OPTION} at (1,4228.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 299"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 299"
     LayoutBlockFlow {OPTION} at (1,4243.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 300"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 300"
     LayoutBlockFlow {OPTION} at (1,4257.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 301"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 301"
     LayoutBlockFlow {OPTION} at (1,4271.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 302"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 302"
     LayoutBlockFlow {OPTION} at (1,4285.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 303"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 303"
     LayoutBlockFlow {OPTION} at (1,4299.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 304"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 304"
     LayoutBlockFlow {OPTION} at (1,4314) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 305"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 305"
     LayoutBlockFlow {OPTION} at (1,4328.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 306"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 306"
     LayoutBlockFlow {OPTION} at (1,4342.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 307"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 307"
     LayoutBlockFlow {OPTION} at (1,4356.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 308"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 308"
     LayoutBlockFlow {OPTION} at (1,4370.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 309"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 309"
     LayoutBlockFlow {OPTION} at (1,4384.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 310"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 310"
     LayoutBlockFlow {OPTION} at (1,4399.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 311"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 311"
     LayoutBlockFlow {OPTION} at (1,4413.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 312"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 312"
     LayoutBlockFlow {OPTION} at (1,4427.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 313"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 313"
     LayoutBlockFlow {OPTION} at (1,4441.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 314"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 314"
     LayoutBlockFlow {OPTION} at (1,4455.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 315"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 315"
     LayoutBlockFlow {OPTION} at (1,4470.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 316"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 316"
     LayoutBlockFlow {OPTION} at (1,4484.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 317"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 317"
     LayoutBlockFlow {OPTION} at (1,4498.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 318"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 318"
     LayoutBlockFlow {OPTION} at (1,4512.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 319"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 319"
     LayoutBlockFlow {OPTION} at (1,4526.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 320"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 320"
     LayoutBlockFlow {OPTION} at (1,4541) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 321"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 321"
     LayoutBlockFlow {OPTION} at (1,4555.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 322"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 322"
     LayoutBlockFlow {OPTION} at (1,4569.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 323"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 323"
     LayoutBlockFlow {OPTION} at (1,4583.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 324"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 324"
     LayoutBlockFlow {OPTION} at (1,4597.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 325"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 325"
     LayoutBlockFlow {OPTION} at (1,4611.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 326"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 326"
     LayoutBlockFlow {OPTION} at (1,4626.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 327"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 327"
     LayoutBlockFlow {OPTION} at (1,4640.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 328"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 328"
     LayoutBlockFlow {OPTION} at (1,4654.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 329"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 329"
     LayoutBlockFlow {OPTION} at (1,4668.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 330"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 330"
     LayoutBlockFlow {OPTION} at (1,4682.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 331"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 331"
     LayoutBlockFlow {OPTION} at (1,4697.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 332"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 332"
     LayoutBlockFlow {OPTION} at (1,4711.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 333"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 333"
     LayoutBlockFlow {OPTION} at (1,4725.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 334"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 334"
     LayoutBlockFlow {OPTION} at (1,4739.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 335"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 335"
     LayoutBlockFlow {OPTION} at (1,4753.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 336"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 336"
     LayoutBlockFlow {OPTION} at (1,4768) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 337"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 337"
     LayoutBlockFlow {OPTION} at (1,4782.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 338"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 338"
     LayoutBlockFlow {OPTION} at (1,4796.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 339"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 339"
     LayoutBlockFlow {OPTION} at (1,4810.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 340"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 340"
     LayoutBlockFlow {OPTION} at (1,4824.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 341"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 341"
     LayoutBlockFlow {OPTION} at (1,4838.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 342"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 342"
     LayoutBlockFlow {OPTION} at (1,4853.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 343"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 343"
     LayoutBlockFlow {OPTION} at (1,4867.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 344"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 344"
     LayoutBlockFlow {OPTION} at (1,4881.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 345"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 345"
     LayoutBlockFlow {OPTION} at (1,4895.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 346"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 346"
     LayoutBlockFlow {OPTION} at (1,4909.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 347"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 347"
     LayoutBlockFlow {OPTION} at (1,4924.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 348"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 348"
     LayoutBlockFlow {OPTION} at (1,4938.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 349"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 349"
     LayoutBlockFlow {OPTION} at (1,4952.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 350"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 350"
     LayoutBlockFlow {OPTION} at (1,4966.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 351"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 351"
     LayoutBlockFlow {OPTION} at (1,4980.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 352"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 352"
     LayoutBlockFlow {OPTION} at (1,4995) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 353"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 353"
     LayoutBlockFlow {OPTION} at (1,5009.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 354"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 354"
     LayoutBlockFlow {OPTION} at (1,5023.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 355"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 355"
     LayoutBlockFlow {OPTION} at (1,5037.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 356"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 356"
     LayoutBlockFlow {OPTION} at (1,5051.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 357"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 357"
     LayoutBlockFlow {OPTION} at (1,5065.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 358"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 358"
     LayoutBlockFlow {OPTION} at (1,5080.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 359"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 359"
     LayoutBlockFlow {OPTION} at (1,5094.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 360"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 360"
     LayoutBlockFlow {OPTION} at (1,5108.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 361"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 361"
     LayoutBlockFlow {OPTION} at (1,5122.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 362"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 362"
     LayoutBlockFlow {OPTION} at (1,5136.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 363"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 363"
     LayoutBlockFlow {OPTION} at (1,5151.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 364"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 364"
     LayoutBlockFlow {OPTION} at (1,5165.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 365"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 365"
     LayoutBlockFlow {OPTION} at (1,5179.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 366"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 366"
     LayoutBlockFlow {OPTION} at (1,5193.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 367"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 367"
     LayoutBlockFlow {OPTION} at (1,5207.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 368"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 368"
     LayoutBlockFlow {OPTION} at (1,5222) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 369"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 369"
     LayoutBlockFlow {OPTION} at (1,5236.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 370"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 370"
     LayoutBlockFlow {OPTION} at (1,5250.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 371"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 371"
     LayoutBlockFlow {OPTION} at (1,5264.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 372"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 372"
     LayoutBlockFlow {OPTION} at (1,5278.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 373"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 373"
     LayoutBlockFlow {OPTION} at (1,5292.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 374"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 374"
     LayoutBlockFlow {OPTION} at (1,5307.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 375"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 375"
     LayoutBlockFlow {OPTION} at (1,5321.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 376"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 376"
     LayoutBlockFlow {OPTION} at (1,5335.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 377"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 377"
     LayoutBlockFlow {OPTION} at (1,5349.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 378"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 378"
     LayoutBlockFlow {OPTION} at (1,5363.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 379"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 379"
     LayoutBlockFlow {OPTION} at (1,5378.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 380"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 380"
     LayoutBlockFlow {OPTION} at (1,5392.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 381"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 381"
     LayoutBlockFlow {OPTION} at (1,5406.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 382"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 382"
     LayoutBlockFlow {OPTION} at (1,5420.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 383"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 383"
     LayoutBlockFlow {OPTION} at (1,5434.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 384"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 384"
     LayoutBlockFlow {OPTION} at (1,5449) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 385"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 385"
     LayoutBlockFlow {OPTION} at (1,5463.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 386"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 386"
     LayoutBlockFlow {OPTION} at (1,5477.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 387"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 387"
     LayoutBlockFlow {OPTION} at (1,5491.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 388"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 388"
     LayoutBlockFlow {OPTION} at (1,5505.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 389"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 389"
     LayoutBlockFlow {OPTION} at (1,5519.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 390"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 390"
     LayoutBlockFlow {OPTION} at (1,5534.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 391"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 391"
     LayoutBlockFlow {OPTION} at (1,5548.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 392"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 392"
     LayoutBlockFlow {OPTION} at (1,5562.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 393"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 393"
     LayoutBlockFlow {OPTION} at (1,5576.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 394"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 394"
     LayoutBlockFlow {OPTION} at (1,5590.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 395"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 395"
     LayoutBlockFlow {OPTION} at (1,5605.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 396"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 396"
     LayoutBlockFlow {OPTION} at (1,5619.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 397"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 397"
     LayoutBlockFlow {OPTION} at (1,5633.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 398"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 398"
     LayoutBlockFlow {OPTION} at (1,5647.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 399"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 399"
     LayoutBlockFlow {OPTION} at (1,5661.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 400"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 400"
     LayoutBlockFlow {OPTION} at (1,5676) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 401"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 401"
     LayoutBlockFlow {OPTION} at (1,5690.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 402"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 402"
     LayoutBlockFlow {OPTION} at (1,5704.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 403"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 403"
     LayoutBlockFlow {OPTION} at (1,5718.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 404"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 404"
     LayoutBlockFlow {OPTION} at (1,5732.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 405"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 405"
     LayoutBlockFlow {OPTION} at (1,5746.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 406"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 406"
     LayoutBlockFlow {OPTION} at (1,5761.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 407"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 407"
     LayoutBlockFlow {OPTION} at (1,5775.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 408"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 408"
     LayoutBlockFlow {OPTION} at (1,5789.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 409"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 409"
     LayoutBlockFlow {OPTION} at (1,5803.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 410"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 410"
     LayoutBlockFlow {OPTION} at (1,5817.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 411"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 411"
     LayoutBlockFlow {OPTION} at (1,5832.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 412"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 412"
     LayoutBlockFlow {OPTION} at (1,5846.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 413"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 413"
     LayoutBlockFlow {OPTION} at (1,5860.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 414"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 414"
     LayoutBlockFlow {OPTION} at (1,5874.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 415"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 415"
     LayoutBlockFlow {OPTION} at (1,5888.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 416"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 416"
     LayoutBlockFlow {OPTION} at (1,5903) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 417"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 417"
     LayoutBlockFlow {OPTION} at (1,5917.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 418"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 418"
     LayoutBlockFlow {OPTION} at (1,5931.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 419"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 419"
     LayoutBlockFlow {OPTION} at (1,5945.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 420"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 420"
     LayoutBlockFlow {OPTION} at (1,5959.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 421"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 421"
     LayoutBlockFlow {OPTION} at (1,5973.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 422"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 422"
     LayoutBlockFlow {OPTION} at (1,5988.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 423"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 423"
     LayoutBlockFlow {OPTION} at (1,6002.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 424"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 424"
     LayoutBlockFlow {OPTION} at (1,6016.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 425"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 425"
     LayoutBlockFlow {OPTION} at (1,6030.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 426"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 426"
     LayoutBlockFlow {OPTION} at (1,6044.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 427"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 427"
     LayoutBlockFlow {OPTION} at (1,6059.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 428"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 428"
     LayoutBlockFlow {OPTION} at (1,6073.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 429"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 429"
     LayoutBlockFlow {OPTION} at (1,6087.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 430"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 430"
     LayoutBlockFlow {OPTION} at (1,6101.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 431"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 431"
     LayoutBlockFlow {OPTION} at (1,6115.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 432"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 432"
     LayoutBlockFlow {OPTION} at (1,6130) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 433"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 433"
     LayoutBlockFlow {OPTION} at (1,6144.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 434"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 434"
     LayoutBlockFlow {OPTION} at (1,6158.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 435"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 435"
     LayoutBlockFlow {OPTION} at (1,6172.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 436"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 436"
     LayoutBlockFlow {OPTION} at (1,6186.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 437"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 437"
     LayoutBlockFlow {OPTION} at (1,6200.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 438"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 438"
     LayoutBlockFlow {OPTION} at (1,6215.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 439"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 439"
     LayoutBlockFlow {OPTION} at (1,6229.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 440"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 440"
     LayoutBlockFlow {OPTION} at (1,6243.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 441"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 441"
     LayoutBlockFlow {OPTION} at (1,6257.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 442"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 442"
     LayoutBlockFlow {OPTION} at (1,6271.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 443"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 443"
     LayoutBlockFlow {OPTION} at (1,6286.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 444"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 444"
     LayoutBlockFlow {OPTION} at (1,6300.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 445"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 445"
     LayoutBlockFlow {OPTION} at (1,6314.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 446"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 446"
     LayoutBlockFlow {OPTION} at (1,6328.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 447"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 447"
     LayoutBlockFlow {OPTION} at (1,6342.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 448"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 448"
     LayoutBlockFlow {OPTION} at (1,6357) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 449"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 449"
     LayoutBlockFlow {OPTION} at (1,6371.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 450"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 450"
     LayoutBlockFlow {OPTION} at (1,6385.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 451"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 451"
     LayoutBlockFlow {OPTION} at (1,6399.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 452"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 452"
     LayoutBlockFlow {OPTION} at (1,6413.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 453"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 453"
     LayoutBlockFlow {OPTION} at (1,6427.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 454"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 454"
     LayoutBlockFlow {OPTION} at (1,6442.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 455"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 455"
     LayoutBlockFlow {OPTION} at (1,6456.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 456"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 456"
     LayoutBlockFlow {OPTION} at (1,6470.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 457"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 457"
     LayoutBlockFlow {OPTION} at (1,6484.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 458"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 458"
     LayoutBlockFlow {OPTION} at (1,6498.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 459"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 459"
     LayoutBlockFlow {OPTION} at (1,6513.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 460"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 460"
     LayoutBlockFlow {OPTION} at (1,6527.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 461"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 461"
     LayoutBlockFlow {OPTION} at (1,6541.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 462"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 462"
     LayoutBlockFlow {OPTION} at (1,6555.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 463"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 463"
     LayoutBlockFlow {OPTION} at (1,6569.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 464"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 464"
     LayoutBlockFlow {OPTION} at (1,6584) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 465"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 465"
     LayoutBlockFlow {OPTION} at (1,6598.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 466"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 466"
     LayoutBlockFlow {OPTION} at (1,6612.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 467"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 467"
     LayoutBlockFlow {OPTION} at (1,6626.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 468"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 468"
     LayoutBlockFlow {OPTION} at (1,6640.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 469"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 469"
     LayoutBlockFlow {OPTION} at (1,6654.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 470"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 470"
     LayoutBlockFlow {OPTION} at (1,6669.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 471"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 471"
     LayoutBlockFlow {OPTION} at (1,6683.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 472"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 472"
     LayoutBlockFlow {OPTION} at (1,6697.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 473"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 473"
     LayoutBlockFlow {OPTION} at (1,6711.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 474"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 474"
     LayoutBlockFlow {OPTION} at (1,6725.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 475"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 475"
     LayoutBlockFlow {OPTION} at (1,6740.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 476"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 476"
     LayoutBlockFlow {OPTION} at (1,6754.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 477"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 477"
     LayoutBlockFlow {OPTION} at (1,6768.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 478"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 478"
     LayoutBlockFlow {OPTION} at (1,6782.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 479"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 479"
     LayoutBlockFlow {OPTION} at (1,6796.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 480"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 480"
     LayoutBlockFlow {OPTION} at (1,6811) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 481"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 481"
     LayoutBlockFlow {OPTION} at (1,6825.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 482"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 482"
     LayoutBlockFlow {OPTION} at (1,6839.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 483"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 483"
     LayoutBlockFlow {OPTION} at (1,6853.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 484"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 484"
     LayoutBlockFlow {OPTION} at (1,6867.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 485"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 485"
     LayoutBlockFlow {OPTION} at (1,6881.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 486"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 486"
     LayoutBlockFlow {OPTION} at (1,6896.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 487"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 487"
     LayoutBlockFlow {OPTION} at (1,6910.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 488"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 488"
     LayoutBlockFlow {OPTION} at (1,6924.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 489"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 489"
     LayoutBlockFlow {OPTION} at (1,6938.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 490"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 490"
     LayoutBlockFlow {OPTION} at (1,6952.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 491"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 491"
     LayoutBlockFlow {OPTION} at (1,6967.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 492"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 492"
     LayoutBlockFlow {OPTION} at (1,6981.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 493"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 493"
     LayoutBlockFlow {OPTION} at (1,6995.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 494"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 494"
     LayoutBlockFlow {OPTION} at (1,7009.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 495"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 495"
     LayoutBlockFlow {OPTION} at (1,7023.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 496"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 496"
     LayoutBlockFlow {OPTION} at (1,7038) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 497"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 497"
     LayoutBlockFlow {OPTION} at (1,7052.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 498"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 498"
     LayoutBlockFlow {OPTION} at (1,7066.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 499"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 499"
     LayoutBlockFlow {OPTION} at (1,7080.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 500"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 500"
     LayoutBlockFlow {OPTION} at (1,7094.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 501"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 501"
     LayoutBlockFlow {OPTION} at (1,7108.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 502"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 502"
     LayoutBlockFlow {OPTION} at (1,7123.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 503"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 503"
     LayoutBlockFlow {OPTION} at (1,7137.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 504"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 504"
     LayoutBlockFlow {OPTION} at (1,7151.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 505"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 505"
     LayoutBlockFlow {OPTION} at (1,7165.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 506"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 506"
     LayoutBlockFlow {OPTION} at (1,7179.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 507"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 507"
     LayoutBlockFlow {OPTION} at (1,7194.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 508"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 508"
     LayoutBlockFlow {OPTION} at (1,7208.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 509"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 509"
     LayoutBlockFlow {OPTION} at (1,7222.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 510"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 510"
     LayoutBlockFlow {OPTION} at (1,7236.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 511"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 511"
     LayoutBlockFlow {OPTION} at (1,7250.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 512"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 512"
     LayoutBlockFlow {OPTION} at (1,7265) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 513"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 513"
     LayoutBlockFlow {OPTION} at (1,7279.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 514"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 514"
     LayoutBlockFlow {OPTION} at (1,7293.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 515"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 515"
     LayoutBlockFlow {OPTION} at (1,7307.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 516"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 516"
     LayoutBlockFlow {OPTION} at (1,7321.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 517"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 517"
     LayoutBlockFlow {OPTION} at (1,7335.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 518"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 518"
     LayoutBlockFlow {OPTION} at (1,7350.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 519"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 519"
     LayoutBlockFlow {OPTION} at (1,7364.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 520"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 520"
     LayoutBlockFlow {OPTION} at (1,7378.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 521"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 521"
     LayoutBlockFlow {OPTION} at (1,7392.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 522"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 522"
     LayoutBlockFlow {OPTION} at (1,7406.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 523"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 523"
     LayoutBlockFlow {OPTION} at (1,7421.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 524"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 524"
     LayoutBlockFlow {OPTION} at (1,7435.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 525"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 525"
     LayoutBlockFlow {OPTION} at (1,7449.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 526"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 526"
     LayoutBlockFlow {OPTION} at (1,7463.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 527"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 527"
     LayoutBlockFlow {OPTION} at (1,7477.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 528"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 528"
     LayoutBlockFlow {OPTION} at (1,7492) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 529"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 529"
     LayoutBlockFlow {OPTION} at (1,7506.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 530"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 530"
     LayoutBlockFlow {OPTION} at (1,7520.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 531"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 531"
     LayoutBlockFlow {OPTION} at (1,7534.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 532"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 532"
     LayoutBlockFlow {OPTION} at (1,7548.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 533"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 533"
     LayoutBlockFlow {OPTION} at (1,7562.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 534"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 534"
     LayoutBlockFlow {OPTION} at (1,7577.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 535"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 535"
     LayoutBlockFlow {OPTION} at (1,7591.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 536"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 536"
     LayoutBlockFlow {OPTION} at (1,7605.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 537"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 537"
     LayoutBlockFlow {OPTION} at (1,7619.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 538"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 538"
     LayoutBlockFlow {OPTION} at (1,7633.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 539"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 539"
     LayoutBlockFlow {OPTION} at (1,7648.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 540"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 540"
     LayoutBlockFlow {OPTION} at (1,7662.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 541"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 541"
     LayoutBlockFlow {OPTION} at (1,7676.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 542"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 542"
     LayoutBlockFlow {OPTION} at (1,7690.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 543"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 543"
     LayoutBlockFlow {OPTION} at (1,7704.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 544"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 544"
     LayoutBlockFlow {OPTION} at (1,7719) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 545"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 545"
     LayoutBlockFlow {OPTION} at (1,7733.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 546"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 546"
     LayoutBlockFlow {OPTION} at (1,7747.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 547"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 547"
     LayoutBlockFlow {OPTION} at (1,7761.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 548"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 548"
     LayoutBlockFlow {OPTION} at (1,7775.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 549"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 549"
     LayoutBlockFlow {OPTION} at (1,7789.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 550"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 550"
     LayoutBlockFlow {OPTION} at (1,7804.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 551"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 551"
     LayoutBlockFlow {OPTION} at (1,7818.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 552"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 552"
     LayoutBlockFlow {OPTION} at (1,7832.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 553"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 553"
     LayoutBlockFlow {OPTION} at (1,7846.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 554"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 554"
     LayoutBlockFlow {OPTION} at (1,7860.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 555"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 555"
     LayoutBlockFlow {OPTION} at (1,7875.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 556"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 556"
     LayoutBlockFlow {OPTION} at (1,7889.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 557"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 557"
     LayoutBlockFlow {OPTION} at (1,7903.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 558"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 558"
     LayoutBlockFlow {OPTION} at (1,7917.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 559"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 559"
     LayoutBlockFlow {OPTION} at (1,7931.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 560"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 560"
     LayoutBlockFlow {OPTION} at (1,7946) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 561"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 561"
     LayoutBlockFlow {OPTION} at (1,7960.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 562"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 562"
     LayoutBlockFlow {OPTION} at (1,7974.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 563"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 563"
     LayoutBlockFlow {OPTION} at (1,7988.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 564"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 564"
     LayoutBlockFlow {OPTION} at (1,8002.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 565"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 565"
     LayoutBlockFlow {OPTION} at (1,8016.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 566"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 566"
     LayoutBlockFlow {OPTION} at (1,8031.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 567"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 567"
     LayoutBlockFlow {OPTION} at (1,8045.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 568"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 568"
     LayoutBlockFlow {OPTION} at (1,8059.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 569"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 569"
     LayoutBlockFlow {OPTION} at (1,8073.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 570"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 570"
     LayoutBlockFlow {OPTION} at (1,8087.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 571"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 571"
     LayoutBlockFlow {OPTION} at (1,8102.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 572"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 572"
     LayoutBlockFlow {OPTION} at (1,8116.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 573"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 573"
     LayoutBlockFlow {OPTION} at (1,8130.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 574"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 574"
     LayoutBlockFlow {OPTION} at (1,8144.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 575"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 575"
     LayoutBlockFlow {OPTION} at (1,8158.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 576"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 576"
     LayoutBlockFlow {OPTION} at (1,8173) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 577"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 577"
     LayoutBlockFlow {OPTION} at (1,8187.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 578"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 578"
     LayoutBlockFlow {OPTION} at (1,8201.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 579"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 579"
     LayoutBlockFlow {OPTION} at (1,8215.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 580"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 580"
     LayoutBlockFlow {OPTION} at (1,8229.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 581"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 581"
     LayoutBlockFlow {OPTION} at (1,8243.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 582"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 582"
     LayoutBlockFlow {OPTION} at (1,8258.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 583"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 583"
     LayoutBlockFlow {OPTION} at (1,8272.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 584"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 584"
     LayoutBlockFlow {OPTION} at (1,8286.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 585"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 585"
     LayoutBlockFlow {OPTION} at (1,8300.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 586"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 586"
     LayoutBlockFlow {OPTION} at (1,8314.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 587"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 587"
     LayoutBlockFlow {OPTION} at (1,8329.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 588"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 588"
     LayoutBlockFlow {OPTION} at (1,8343.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 589"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 589"
     LayoutBlockFlow {OPTION} at (1,8357.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 590"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 590"
     LayoutBlockFlow {OPTION} at (1,8371.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 591"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 591"
     LayoutBlockFlow {OPTION} at (1,8385.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 592"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 592"
     LayoutBlockFlow {OPTION} at (1,8400) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 593"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 593"
     LayoutBlockFlow {OPTION} at (1,8414.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 594"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 594"
     LayoutBlockFlow {OPTION} at (1,8428.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 595"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 595"
     LayoutBlockFlow {OPTION} at (1,8442.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 596"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 596"
     LayoutBlockFlow {OPTION} at (1,8456.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 597"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 597"
     LayoutBlockFlow {OPTION} at (1,8470.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 598"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 598"
     LayoutBlockFlow {OPTION} at (1,8485.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 599"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 599"
     LayoutBlockFlow {OPTION} at (1,8499.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 600"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 600"
     LayoutBlockFlow {OPTION} at (1,8513.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 601"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 601"
     LayoutBlockFlow {OPTION} at (1,8527.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 602"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 602"
     LayoutBlockFlow {OPTION} at (1,8541.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 603"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 603"
     LayoutBlockFlow {OPTION} at (1,8556.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 604"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 604"
     LayoutBlockFlow {OPTION} at (1,8570.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 605"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 605"
     LayoutBlockFlow {OPTION} at (1,8584.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 606"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 606"
     LayoutBlockFlow {OPTION} at (1,8598.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 607"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 607"
     LayoutBlockFlow {OPTION} at (1,8612.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 608"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 608"
     LayoutBlockFlow {OPTION} at (1,8627) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 609"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 609"
     LayoutBlockFlow {OPTION} at (1,8641.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 610"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 610"
     LayoutBlockFlow {OPTION} at (1,8655.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 611"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 611"
     LayoutBlockFlow {OPTION} at (1,8669.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 612"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 612"
     LayoutBlockFlow {OPTION} at (1,8683.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 613"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 613"
     LayoutBlockFlow {OPTION} at (1,8697.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 614"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 614"
     LayoutBlockFlow {OPTION} at (1,8712.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 615"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 615"
     LayoutBlockFlow {OPTION} at (1,8726.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 616"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 616"
     LayoutBlockFlow {OPTION} at (1,8740.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 617"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 617"
     LayoutBlockFlow {OPTION} at (1,8754.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 618"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 618"
     LayoutBlockFlow {OPTION} at (1,8768.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 619"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 619"
     LayoutBlockFlow {OPTION} at (1,8783.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 620"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 620"
     LayoutBlockFlow {OPTION} at (1,8797.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 621"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 621"
     LayoutBlockFlow {OPTION} at (1,8811.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 622"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 622"
     LayoutBlockFlow {OPTION} at (1,8825.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 623"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 623"
     LayoutBlockFlow {OPTION} at (1,8839.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 624"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 624"
     LayoutBlockFlow {OPTION} at (1,8854) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 625"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 625"
     LayoutBlockFlow {OPTION} at (1,8868.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 626"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 626"
     LayoutBlockFlow {OPTION} at (1,8882.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 627"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 627"
     LayoutBlockFlow {OPTION} at (1,8896.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 628"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 628"
     LayoutBlockFlow {OPTION} at (1,8910.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 629"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 629"
     LayoutBlockFlow {OPTION} at (1,8924.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 630"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 630"
     LayoutBlockFlow {OPTION} at (1,8939.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 631"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 631"
     LayoutBlockFlow {OPTION} at (1,8953.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 632"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 632"
     LayoutBlockFlow {OPTION} at (1,8967.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 633"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 633"
     LayoutBlockFlow {OPTION} at (1,8981.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 634"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 634"
     LayoutBlockFlow {OPTION} at (1,8995.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 635"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 635"
     LayoutBlockFlow {OPTION} at (1,9010.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 636"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 636"
     LayoutBlockFlow {OPTION} at (1,9024.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 637"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 637"
     LayoutBlockFlow {OPTION} at (1,9038.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 638"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 638"
     LayoutBlockFlow {OPTION} at (1,9052.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 639"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 639"
     LayoutBlockFlow {OPTION} at (1,9066.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 640"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 640"
     LayoutBlockFlow {OPTION} at (1,9081) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 641"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 641"
     LayoutBlockFlow {OPTION} at (1,9095.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 642"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 642"
     LayoutBlockFlow {OPTION} at (1,9109.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 643"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 643"
     LayoutBlockFlow {OPTION} at (1,9123.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 644"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 644"
     LayoutBlockFlow {OPTION} at (1,9137.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 645"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 645"
     LayoutBlockFlow {OPTION} at (1,9151.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 646"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 646"
     LayoutBlockFlow {OPTION} at (1,9166.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 647"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 647"
     LayoutBlockFlow {OPTION} at (1,9180.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 648"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 648"
     LayoutBlockFlow {OPTION} at (1,9194.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 649"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 649"
     LayoutBlockFlow {OPTION} at (1,9208.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 650"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 650"
     LayoutBlockFlow {OPTION} at (1,9222.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 651"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 651"
     LayoutBlockFlow {OPTION} at (1,9237.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 652"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 652"
     LayoutBlockFlow {OPTION} at (1,9251.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 653"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 653"
     LayoutBlockFlow {OPTION} at (1,9265.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 654"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 654"
     LayoutBlockFlow {OPTION} at (1,9279.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 655"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 655"
     LayoutBlockFlow {OPTION} at (1,9293.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 656"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 656"
     LayoutBlockFlow {OPTION} at (1,9308) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 657"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 657"
     LayoutBlockFlow {OPTION} at (1,9322.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 658"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 658"
     LayoutBlockFlow {OPTION} at (1,9336.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 659"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 659"
     LayoutBlockFlow {OPTION} at (1,9350.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 660"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 660"
     LayoutBlockFlow {OPTION} at (1,9364.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 661"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 661"
     LayoutBlockFlow {OPTION} at (1,9378.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 662"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 662"
     LayoutBlockFlow {OPTION} at (1,9393.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 663"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 663"
     LayoutBlockFlow {OPTION} at (1,9407.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 664"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 664"
     LayoutBlockFlow {OPTION} at (1,9421.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 665"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 665"
     LayoutBlockFlow {OPTION} at (1,9435.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 666"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 666"
     LayoutBlockFlow {OPTION} at (1,9449.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 667"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 667"
     LayoutBlockFlow {OPTION} at (1,9464.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 668"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 668"
     LayoutBlockFlow {OPTION} at (1,9478.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 669"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 669"
     LayoutBlockFlow {OPTION} at (1,9492.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 670"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 670"
     LayoutBlockFlow {OPTION} at (1,9506.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 671"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 671"
     LayoutBlockFlow {OPTION} at (1,9520.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 672"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 672"
     LayoutBlockFlow {OPTION} at (1,9535) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 673"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 673"
     LayoutBlockFlow {OPTION} at (1,9549.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 674"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 674"
     LayoutBlockFlow {OPTION} at (1,9563.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 675"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 675"
     LayoutBlockFlow {OPTION} at (1,9577.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 676"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 676"
     LayoutBlockFlow {OPTION} at (1,9591.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 677"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 677"
     LayoutBlockFlow {OPTION} at (1,9605.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 678"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 678"
     LayoutBlockFlow {OPTION} at (1,9620.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 679"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 679"
     LayoutBlockFlow {OPTION} at (1,9634.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 680"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 680"
     LayoutBlockFlow {OPTION} at (1,9648.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 681"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 681"
     LayoutBlockFlow {OPTION} at (1,9662.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 682"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 682"
     LayoutBlockFlow {OPTION} at (1,9676.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 683"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 683"
     LayoutBlockFlow {OPTION} at (1,9691.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 684"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 684"
     LayoutBlockFlow {OPTION} at (1,9705.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 685"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 685"
     LayoutBlockFlow {OPTION} at (1,9719.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 686"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 686"
     LayoutBlockFlow {OPTION} at (1,9733.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 687"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 687"
     LayoutBlockFlow {OPTION} at (1,9747.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 688"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 688"
     LayoutBlockFlow {OPTION} at (1,9762) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 689"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 689"
     LayoutBlockFlow {OPTION} at (1,9776.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 690"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 690"
     LayoutBlockFlow {OPTION} at (1,9790.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 691"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 691"
     LayoutBlockFlow {OPTION} at (1,9804.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 692"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 692"
     LayoutBlockFlow {OPTION} at (1,9818.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 693"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 693"
     LayoutBlockFlow {OPTION} at (1,9832.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 694"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 694"
     LayoutBlockFlow {OPTION} at (1,9847.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 695"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 695"
     LayoutBlockFlow {OPTION} at (1,9861.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 696"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 696"
     LayoutBlockFlow {OPTION} at (1,9875.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 697"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 697"
     LayoutBlockFlow {OPTION} at (1,9889.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 698"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 698"
     LayoutBlockFlow {OPTION} at (1,9903.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 699"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 699"
     LayoutBlockFlow {OPTION} at (1,9918.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 700"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 700"
     LayoutBlockFlow {OPTION} at (1,9932.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 701"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 701"
     LayoutBlockFlow {OPTION} at (1,9946.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 702"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 702"
     LayoutBlockFlow {OPTION} at (1,9960.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 703"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 703"
     LayoutBlockFlow {OPTION} at (1,9974.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 704"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 704"
     LayoutBlockFlow {OPTION} at (1,9989) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 705"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 705"
     LayoutBlockFlow {OPTION} at (1,10003.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 706"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 706"
     LayoutBlockFlow {OPTION} at (1,10017.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 707"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 707"
     LayoutBlockFlow {OPTION} at (1,10031.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 708"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 708"
     LayoutBlockFlow {OPTION} at (1,10045.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 709"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 709"
     LayoutBlockFlow {OPTION} at (1,10059.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 710"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 710"
     LayoutBlockFlow {OPTION} at (1,10074.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 711"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 711"
     LayoutBlockFlow {OPTION} at (1,10088.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 712"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 712"
     LayoutBlockFlow {OPTION} at (1,10102.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 713"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 713"
     LayoutBlockFlow {OPTION} at (1,10116.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 714"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 714"
     LayoutBlockFlow {OPTION} at (1,10130.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 715"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 715"
     LayoutBlockFlow {OPTION} at (1,10145.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 716"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 716"
     LayoutBlockFlow {OPTION} at (1,10159.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 717"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 717"
     LayoutBlockFlow {OPTION} at (1,10173.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 718"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 718"
     LayoutBlockFlow {OPTION} at (1,10187.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 719"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 719"
     LayoutBlockFlow {OPTION} at (1,10201.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 720"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 720"
     LayoutBlockFlow {OPTION} at (1,10216) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 721"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 721"
     LayoutBlockFlow {OPTION} at (1,10230.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 722"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 722"
     LayoutBlockFlow {OPTION} at (1,10244.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 723"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 723"
     LayoutBlockFlow {OPTION} at (1,10258.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 724"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 724"
     LayoutBlockFlow {OPTION} at (1,10272.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 725"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 725"
     LayoutBlockFlow {OPTION} at (1,10286.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 726"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 726"
     LayoutBlockFlow {OPTION} at (1,10301.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 727"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 727"
     LayoutBlockFlow {OPTION} at (1,10315.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 728"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 728"
     LayoutBlockFlow {OPTION} at (1,10329.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 729"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 729"
     LayoutBlockFlow {OPTION} at (1,10343.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 730"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 730"
     LayoutBlockFlow {OPTION} at (1,10357.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 731"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 731"
     LayoutBlockFlow {OPTION} at (1,10372.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 732"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 732"
     LayoutBlockFlow {OPTION} at (1,10386.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 733"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 733"
     LayoutBlockFlow {OPTION} at (1,10400.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 734"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 734"
     LayoutBlockFlow {OPTION} at (1,10414.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 735"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 735"
     LayoutBlockFlow {OPTION} at (1,10428.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 736"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 736"
     LayoutBlockFlow {OPTION} at (1,10443) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 737"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 737"
     LayoutBlockFlow {OPTION} at (1,10457.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 738"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 738"
     LayoutBlockFlow {OPTION} at (1,10471.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 739"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 739"
     LayoutBlockFlow {OPTION} at (1,10485.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 740"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 740"
     LayoutBlockFlow {OPTION} at (1,10499.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 741"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 741"
     LayoutBlockFlow {OPTION} at (1,10513.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 742"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 742"
     LayoutBlockFlow {OPTION} at (1,10528.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 743"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 743"
     LayoutBlockFlow {OPTION} at (1,10542.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 744"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 744"
     LayoutBlockFlow {OPTION} at (1,10556.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 745"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 745"
     LayoutBlockFlow {OPTION} at (1,10570.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 746"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 746"
     LayoutBlockFlow {OPTION} at (1,10584.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 747"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 747"
     LayoutBlockFlow {OPTION} at (1,10599.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 748"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 748"
     LayoutBlockFlow {OPTION} at (1,10613.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 749"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 749"
     LayoutBlockFlow {OPTION} at (1,10627.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 750"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 750"
     LayoutBlockFlow {OPTION} at (1,10641.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 751"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 751"
     LayoutBlockFlow {OPTION} at (1,10655.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 752"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 752"
     LayoutBlockFlow {OPTION} at (1,10670) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 753"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 753"
     LayoutBlockFlow {OPTION} at (1,10684.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 754"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 754"
     LayoutBlockFlow {OPTION} at (1,10698.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 755"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 755"
     LayoutBlockFlow {OPTION} at (1,10712.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 756"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 756"
     LayoutBlockFlow {OPTION} at (1,10726.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 757"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 757"
     LayoutBlockFlow {OPTION} at (1,10740.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 758"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 758"
     LayoutBlockFlow {OPTION} at (1,10755.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 759"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 759"
     LayoutBlockFlow {OPTION} at (1,10769.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 760"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 760"
     LayoutBlockFlow {OPTION} at (1,10783.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 761"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 761"
     LayoutBlockFlow {OPTION} at (1,10797.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 762"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 762"
     LayoutBlockFlow {OPTION} at (1,10811.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 763"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 763"
     LayoutBlockFlow {OPTION} at (1,10826.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 764"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 764"
     LayoutBlockFlow {OPTION} at (1,10840.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 765"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 765"
     LayoutBlockFlow {OPTION} at (1,10854.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 766"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 766"
     LayoutBlockFlow {OPTION} at (1,10868.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 767"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 767"
     LayoutBlockFlow {OPTION} at (1,10882.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 768"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 768"
     LayoutBlockFlow {OPTION} at (1,10897) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 769"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 769"
     LayoutBlockFlow {OPTION} at (1,10911.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 770"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 770"
     LayoutBlockFlow {OPTION} at (1,10925.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 771"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 771"
     LayoutBlockFlow {OPTION} at (1,10939.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 772"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 772"
     LayoutBlockFlow {OPTION} at (1,10953.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 773"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 773"
     LayoutBlockFlow {OPTION} at (1,10967.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 774"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 774"
     LayoutBlockFlow {OPTION} at (1,10982.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 775"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 775"
     LayoutBlockFlow {OPTION} at (1,10996.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 776"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 776"
     LayoutBlockFlow {OPTION} at (1,11010.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 777"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 777"
     LayoutBlockFlow {OPTION} at (1,11024.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 778"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 778"
     LayoutBlockFlow {OPTION} at (1,11038.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 779"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 779"
     LayoutBlockFlow {OPTION} at (1,11053.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 780"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 780"
     LayoutBlockFlow {OPTION} at (1,11067.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 781"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 781"
     LayoutBlockFlow {OPTION} at (1,11081.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 782"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 782"
     LayoutBlockFlow {OPTION} at (1,11095.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 783"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 783"
     LayoutBlockFlow {OPTION} at (1,11109.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 784"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 784"
     LayoutBlockFlow {OPTION} at (1,11124) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 785"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 785"
     LayoutBlockFlow {OPTION} at (1,11138.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 786"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 786"
     LayoutBlockFlow {OPTION} at (1,11152.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 787"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 787"
     LayoutBlockFlow {OPTION} at (1,11166.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 788"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 788"
     LayoutBlockFlow {OPTION} at (1,11180.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 789"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 789"
     LayoutBlockFlow {OPTION} at (1,11194.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 790"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 790"
     LayoutBlockFlow {OPTION} at (1,11209.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 791"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 791"
     LayoutBlockFlow {OPTION} at (1,11223.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 792"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 792"
     LayoutBlockFlow {OPTION} at (1,11237.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 793"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 793"
     LayoutBlockFlow {OPTION} at (1,11251.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 794"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 794"
     LayoutBlockFlow {OPTION} at (1,11265.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 795"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 795"
     LayoutBlockFlow {OPTION} at (1,11280.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 796"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 796"
     LayoutBlockFlow {OPTION} at (1,11294.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 797"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 797"
     LayoutBlockFlow {OPTION} at (1,11308.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 798"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 798"
     LayoutBlockFlow {OPTION} at (1,11322.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 799"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 799"
     LayoutBlockFlow {OPTION} at (1,11336.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 800"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 800"
     LayoutBlockFlow {OPTION} at (1,11351) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 801"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 801"
     LayoutBlockFlow {OPTION} at (1,11365.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 802"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 802"
     LayoutBlockFlow {OPTION} at (1,11379.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 803"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 803"
     LayoutBlockFlow {OPTION} at (1,11393.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 804"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 804"
     LayoutBlockFlow {OPTION} at (1,11407.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 805"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 805"
     LayoutBlockFlow {OPTION} at (1,11421.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 806"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 806"
     LayoutBlockFlow {OPTION} at (1,11436.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 807"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 807"
     LayoutBlockFlow {OPTION} at (1,11450.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 808"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 808"
     LayoutBlockFlow {OPTION} at (1,11464.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 809"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 809"
     LayoutBlockFlow {OPTION} at (1,11478.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 810"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 810"
     LayoutBlockFlow {OPTION} at (1,11492.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 811"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 811"
     LayoutBlockFlow {OPTION} at (1,11507.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 812"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 812"
     LayoutBlockFlow {OPTION} at (1,11521.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 813"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 813"
     LayoutBlockFlow {OPTION} at (1,11535.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 814"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 814"
     LayoutBlockFlow {OPTION} at (1,11549.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 815"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 815"
     LayoutBlockFlow {OPTION} at (1,11563.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 816"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 816"
     LayoutBlockFlow {OPTION} at (1,11578) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 817"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 817"
     LayoutBlockFlow {OPTION} at (1,11592.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 818"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 818"
     LayoutBlockFlow {OPTION} at (1,11606.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 819"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 819"
     LayoutBlockFlow {OPTION} at (1,11620.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 820"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 820"
     LayoutBlockFlow {OPTION} at (1,11634.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 821"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 821"
     LayoutBlockFlow {OPTION} at (1,11648.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 822"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 822"
     LayoutBlockFlow {OPTION} at (1,11663.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 823"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 823"
     LayoutBlockFlow {OPTION} at (1,11677.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 824"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 824"
     LayoutBlockFlow {OPTION} at (1,11691.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 825"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 825"
     LayoutBlockFlow {OPTION} at (1,11705.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 826"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 826"
     LayoutBlockFlow {OPTION} at (1,11719.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 827"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 827"
     LayoutBlockFlow {OPTION} at (1,11734.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 828"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 828"
     LayoutBlockFlow {OPTION} at (1,11748.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 829"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 829"
     LayoutBlockFlow {OPTION} at (1,11762.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 830"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 830"
     LayoutBlockFlow {OPTION} at (1,11776.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 831"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 831"
     LayoutBlockFlow {OPTION} at (1,11790.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 832"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 832"
     LayoutBlockFlow {OPTION} at (1,11805) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 833"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 833"
     LayoutBlockFlow {OPTION} at (1,11819.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 834"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 834"
     LayoutBlockFlow {OPTION} at (1,11833.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 835"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 835"
     LayoutBlockFlow {OPTION} at (1,11847.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 836"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 836"
     LayoutBlockFlow {OPTION} at (1,11861.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 837"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 837"
     LayoutBlockFlow {OPTION} at (1,11875.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 838"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 838"
     LayoutBlockFlow {OPTION} at (1,11890.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 839"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 839"
     LayoutBlockFlow {OPTION} at (1,11904.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 840"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 840"
     LayoutBlockFlow {OPTION} at (1,11918.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 841"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 841"
     LayoutBlockFlow {OPTION} at (1,11932.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 842"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 842"
     LayoutBlockFlow {OPTION} at (1,11946.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 843"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 843"
     LayoutBlockFlow {OPTION} at (1,11961.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 844"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 844"
     LayoutBlockFlow {OPTION} at (1,11975.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 845"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 845"
     LayoutBlockFlow {OPTION} at (1,11989.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 846"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 846"
     LayoutBlockFlow {OPTION} at (1,12003.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 847"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 847"
     LayoutBlockFlow {OPTION} at (1,12017.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 848"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 848"
     LayoutBlockFlow {OPTION} at (1,12032) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 849"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 849"
     LayoutBlockFlow {OPTION} at (1,12046.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 850"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 850"
     LayoutBlockFlow {OPTION} at (1,12060.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 851"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 851"
     LayoutBlockFlow {OPTION} at (1,12074.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 852"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 852"
     LayoutBlockFlow {OPTION} at (1,12088.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 853"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 853"
     LayoutBlockFlow {OPTION} at (1,12102.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 854"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 854"
     LayoutBlockFlow {OPTION} at (1,12117.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 855"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 855"
     LayoutBlockFlow {OPTION} at (1,12131.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 856"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 856"
     LayoutBlockFlow {OPTION} at (1,12145.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 857"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 857"
     LayoutBlockFlow {OPTION} at (1,12159.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 858"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 858"
     LayoutBlockFlow {OPTION} at (1,12173.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 859"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 859"
     LayoutBlockFlow {OPTION} at (1,12188.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 860"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 860"
     LayoutBlockFlow {OPTION} at (1,12202.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 861"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 861"
     LayoutBlockFlow {OPTION} at (1,12216.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 862"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 862"
     LayoutBlockFlow {OPTION} at (1,12230.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 863"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 863"
     LayoutBlockFlow {OPTION} at (1,12244.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 864"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 864"
     LayoutBlockFlow {OPTION} at (1,12259) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 865"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 865"
     LayoutBlockFlow {OPTION} at (1,12273.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 866"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 866"
     LayoutBlockFlow {OPTION} at (1,12287.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 867"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 867"
     LayoutBlockFlow {OPTION} at (1,12301.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 868"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 868"
     LayoutBlockFlow {OPTION} at (1,12315.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 869"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 869"
     LayoutBlockFlow {OPTION} at (1,12329.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 870"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 870"
     LayoutBlockFlow {OPTION} at (1,12344.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 871"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 871"
     LayoutBlockFlow {OPTION} at (1,12358.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 872"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 872"
     LayoutBlockFlow {OPTION} at (1,12372.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 873"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 873"
     LayoutBlockFlow {OPTION} at (1,12386.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 874"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 874"
     LayoutBlockFlow {OPTION} at (1,12400.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 875"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 875"
     LayoutBlockFlow {OPTION} at (1,12415.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 876"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 876"
     LayoutBlockFlow {OPTION} at (1,12429.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 877"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 877"
     LayoutBlockFlow {OPTION} at (1,12443.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 878"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 878"
     LayoutBlockFlow {OPTION} at (1,12457.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 879"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 879"
     LayoutBlockFlow {OPTION} at (1,12471.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 880"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 880"
     LayoutBlockFlow {OPTION} at (1,12486) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 881"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 881"
     LayoutBlockFlow {OPTION} at (1,12500.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 882"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 882"
     LayoutBlockFlow {OPTION} at (1,12514.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 883"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 883"
     LayoutBlockFlow {OPTION} at (1,12528.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 884"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 884"
     LayoutBlockFlow {OPTION} at (1,12542.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 885"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 885"
     LayoutBlockFlow {OPTION} at (1,12556.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 886"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 886"
     LayoutBlockFlow {OPTION} at (1,12571.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 887"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 887"
     LayoutBlockFlow {OPTION} at (1,12585.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 888"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 888"
     LayoutBlockFlow {OPTION} at (1,12599.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 889"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 889"
     LayoutBlockFlow {OPTION} at (1,12613.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 890"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 890"
     LayoutBlockFlow {OPTION} at (1,12627.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 891"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 891"
     LayoutBlockFlow {OPTION} at (1,12642.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 892"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 892"
     LayoutBlockFlow {OPTION} at (1,12656.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 893"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 893"
     LayoutBlockFlow {OPTION} at (1,12670.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 894"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 894"
     LayoutBlockFlow {OPTION} at (1,12684.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 895"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 895"
     LayoutBlockFlow {OPTION} at (1,12698.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 896"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 896"
     LayoutBlockFlow {OPTION} at (1,12713) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 897"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 897"
     LayoutBlockFlow {OPTION} at (1,12727.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 898"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 898"
     LayoutBlockFlow {OPTION} at (1,12741.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 899"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 899"
     LayoutBlockFlow {OPTION} at (1,12755.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 900"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 900"
     LayoutBlockFlow {OPTION} at (1,12769.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 901"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 901"
     LayoutBlockFlow {OPTION} at (1,12783.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 902"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 902"
     LayoutBlockFlow {OPTION} at (1,12798.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 903"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 903"
     LayoutBlockFlow {OPTION} at (1,12812.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 904"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 904"
     LayoutBlockFlow {OPTION} at (1,12826.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 905"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 905"
     LayoutBlockFlow {OPTION} at (1,12840.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 906"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 906"
     LayoutBlockFlow {OPTION} at (1,12854.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 907"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 907"
     LayoutBlockFlow {OPTION} at (1,12869.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 908"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 908"
     LayoutBlockFlow {OPTION} at (1,12883.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 909"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 909"
     LayoutBlockFlow {OPTION} at (1,12897.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 910"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 910"
     LayoutBlockFlow {OPTION} at (1,12911.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 911"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 911"
     LayoutBlockFlow {OPTION} at (1,12925.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 912"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 912"
     LayoutBlockFlow {OPTION} at (1,12940) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 913"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 913"
     LayoutBlockFlow {OPTION} at (1,12954.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 914"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 914"
     LayoutBlockFlow {OPTION} at (1,12968.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 915"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 915"
     LayoutBlockFlow {OPTION} at (1,12982.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 916"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 916"
     LayoutBlockFlow {OPTION} at (1,12996.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 917"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 917"
     LayoutBlockFlow {OPTION} at (1,13010.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 918"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 918"
     LayoutBlockFlow {OPTION} at (1,13025.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 919"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 919"
     LayoutBlockFlow {OPTION} at (1,13039.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 920"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 920"
     LayoutBlockFlow {OPTION} at (1,13053.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 921"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 921"
     LayoutBlockFlow {OPTION} at (1,13067.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 922"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 922"
     LayoutBlockFlow {OPTION} at (1,13081.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 923"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 923"
     LayoutBlockFlow {OPTION} at (1,13096.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 924"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 924"
     LayoutBlockFlow {OPTION} at (1,13110.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 925"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 925"
     LayoutBlockFlow {OPTION} at (1,13124.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 926"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 926"
     LayoutBlockFlow {OPTION} at (1,13138.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 927"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 927"
     LayoutBlockFlow {OPTION} at (1,13152.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 928"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 928"
     LayoutBlockFlow {OPTION} at (1,13167) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 929"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 929"
     LayoutBlockFlow {OPTION} at (1,13181.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 930"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 930"
     LayoutBlockFlow {OPTION} at (1,13195.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 931"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 931"
     LayoutBlockFlow {OPTION} at (1,13209.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 932"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 932"
     LayoutBlockFlow {OPTION} at (1,13223.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 933"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 933"
     LayoutBlockFlow {OPTION} at (1,13237.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 934"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 934"
     LayoutBlockFlow {OPTION} at (1,13252.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 935"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 935"
     LayoutBlockFlow {OPTION} at (1,13266.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 936"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 936"
     LayoutBlockFlow {OPTION} at (1,13280.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 937"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 937"
     LayoutBlockFlow {OPTION} at (1,13294.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 938"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 938"
     LayoutBlockFlow {OPTION} at (1,13308.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 939"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 939"
     LayoutBlockFlow {OPTION} at (1,13323.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 940"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 940"
     LayoutBlockFlow {OPTION} at (1,13337.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 941"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 941"
     LayoutBlockFlow {OPTION} at (1,13351.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 942"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 942"
     LayoutBlockFlow {OPTION} at (1,13365.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 943"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 943"
     LayoutBlockFlow {OPTION} at (1,13379.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 944"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 944"
     LayoutBlockFlow {OPTION} at (1,13394) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 945"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 945"
     LayoutBlockFlow {OPTION} at (1,13408.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 946"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 946"
     LayoutBlockFlow {OPTION} at (1,13422.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 947"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 947"
     LayoutBlockFlow {OPTION} at (1,13436.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 948"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 948"
     LayoutBlockFlow {OPTION} at (1,13450.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 949"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 949"
     LayoutBlockFlow {OPTION} at (1,13464.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 950"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 950"
     LayoutBlockFlow {OPTION} at (1,13479.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 951"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 951"
     LayoutBlockFlow {OPTION} at (1,13493.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 952"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 952"
     LayoutBlockFlow {OPTION} at (1,13507.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 953"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 953"
     LayoutBlockFlow {OPTION} at (1,13521.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 954"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 954"
     LayoutBlockFlow {OPTION} at (1,13535.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 955"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 955"
     LayoutBlockFlow {OPTION} at (1,13550.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 956"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 956"
     LayoutBlockFlow {OPTION} at (1,13564.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 957"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 957"
     LayoutBlockFlow {OPTION} at (1,13578.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 958"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 958"
     LayoutBlockFlow {OPTION} at (1,13592.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 959"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 959"
     LayoutBlockFlow {OPTION} at (1,13606.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 960"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 960"
     LayoutBlockFlow {OPTION} at (1,13621) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 961"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 961"
     LayoutBlockFlow {OPTION} at (1,13635.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 962"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 962"
     LayoutBlockFlow {OPTION} at (1,13649.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 963"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 963"
     LayoutBlockFlow {OPTION} at (1,13663.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 964"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 964"
     LayoutBlockFlow {OPTION} at (1,13677.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 965"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 965"
     LayoutBlockFlow {OPTION} at (1,13691.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 966"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 966"
     LayoutBlockFlow {OPTION} at (1,13706.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 967"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 967"
     LayoutBlockFlow {OPTION} at (1,13720.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 968"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 968"
     LayoutBlockFlow {OPTION} at (1,13734.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 969"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 969"
     LayoutBlockFlow {OPTION} at (1,13748.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 970"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 970"
     LayoutBlockFlow {OPTION} at (1,13762.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 971"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 971"
     LayoutBlockFlow {OPTION} at (1,13777.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 972"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 972"
     LayoutBlockFlow {OPTION} at (1,13791.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 973"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 973"
     LayoutBlockFlow {OPTION} at (1,13805.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 974"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 974"
     LayoutBlockFlow {OPTION} at (1,13819.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 975"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 975"
     LayoutBlockFlow {OPTION} at (1,13833.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 976"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 976"
     LayoutBlockFlow {OPTION} at (1,13848) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 977"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 977"
     LayoutBlockFlow {OPTION} at (1,13862.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 978"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 978"
     LayoutBlockFlow {OPTION} at (1,13876.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 979"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 979"
     LayoutBlockFlow {OPTION} at (1,13890.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 980"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 980"
     LayoutBlockFlow {OPTION} at (1,13904.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 981"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 981"
     LayoutBlockFlow {OPTION} at (1,13918.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 982"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 982"
     LayoutBlockFlow {OPTION} at (1,13933.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 983"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 983"
     LayoutBlockFlow {OPTION} at (1,13947.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 984"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 984"
     LayoutBlockFlow {OPTION} at (1,13961.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 985"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 985"
     LayoutBlockFlow {OPTION} at (1,13975.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 986"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 986"
     LayoutBlockFlow {OPTION} at (1,13989.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 987"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 987"
     LayoutBlockFlow {OPTION} at (1,14004.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 988"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 988"
     LayoutBlockFlow {OPTION} at (1,14018.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 989"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 989"
     LayoutBlockFlow {OPTION} at (1,14032.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 990"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 990"
     LayoutBlockFlow {OPTION} at (1,14046.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 991"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 991"
     LayoutBlockFlow {OPTION} at (1,14060.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 992"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 992"
     LayoutBlockFlow {OPTION} at (1,14075) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 993"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 993"
     LayoutBlockFlow {OPTION} at (1,14089.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 994"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 994"
     LayoutBlockFlow {OPTION} at (1,14103.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 995"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 995"
     LayoutBlockFlow {OPTION} at (1,14117.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 996"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 996"
     LayoutBlockFlow {OPTION} at (1,14131.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 997"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 997"
     LayoutBlockFlow {OPTION} at (1,14145.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 998"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 998"
     LayoutBlockFlow {OPTION} at (1,14160.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 47x13
-        text run at (2,0) width 47: "Item 999"
+      LayoutText {#text} at (2,0) size 44x13
+        text run at (2,0) width 44: "Item 999"
     LayoutBlockFlow {OPTION} at (1,14174.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1000"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1000"
     LayoutBlockFlow {OPTION} at (1,14188.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1001"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1001"
     LayoutBlockFlow {OPTION} at (1,14202.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1002"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1002"
     LayoutBlockFlow {OPTION} at (1,14216.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1003"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1003"
     LayoutBlockFlow {OPTION} at (1,14231.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1004"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1004"
     LayoutBlockFlow {OPTION} at (1,14245.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1005"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1005"
     LayoutBlockFlow {OPTION} at (1,14259.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1006"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1006"
     LayoutBlockFlow {OPTION} at (1,14273.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1007"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1007"
     LayoutBlockFlow {OPTION} at (1,14287.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1008"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1008"
     LayoutBlockFlow {OPTION} at (1,14302) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1009"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1009"
     LayoutBlockFlow {OPTION} at (1,14316.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1010"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1010"
     LayoutBlockFlow {OPTION} at (1,14330.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1011"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1011"
     LayoutBlockFlow {OPTION} at (1,14344.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1012"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1012"
     LayoutBlockFlow {OPTION} at (1,14358.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1013"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1013"
     LayoutBlockFlow {OPTION} at (1,14372.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1014"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1014"
     LayoutBlockFlow {OPTION} at (1,14387.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1015"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1015"
     LayoutBlockFlow {OPTION} at (1,14401.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1016"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1016"
     LayoutBlockFlow {OPTION} at (1,14415.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1017"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1017"
     LayoutBlockFlow {OPTION} at (1,14429.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1018"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1018"
     LayoutBlockFlow {OPTION} at (1,14443.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1019"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1019"
     LayoutBlockFlow {OPTION} at (1,14458.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1020"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1020"
     LayoutBlockFlow {OPTION} at (1,14472.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1021"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1021"
     LayoutBlockFlow {OPTION} at (1,14486.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1022"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1022"
     LayoutBlockFlow {OPTION} at (1,14500.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1023"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1023"
     LayoutBlockFlow {OPTION} at (1,14514.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1024"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1024"
     LayoutBlockFlow {OPTION} at (1,14529) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1025"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1025"
     LayoutBlockFlow {OPTION} at (1,14543.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1026"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1026"
     LayoutBlockFlow {OPTION} at (1,14557.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1027"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1027"
     LayoutBlockFlow {OPTION} at (1,14571.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1028"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1028"
     LayoutBlockFlow {OPTION} at (1,14585.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1029"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1029"
     LayoutBlockFlow {OPTION} at (1,14599.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1030"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1030"
     LayoutBlockFlow {OPTION} at (1,14614.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1031"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1031"
     LayoutBlockFlow {OPTION} at (1,14628.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1032"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1032"
     LayoutBlockFlow {OPTION} at (1,14642.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1033"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1033"
     LayoutBlockFlow {OPTION} at (1,14656.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1034"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1034"
     LayoutBlockFlow {OPTION} at (1,14670.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1035"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1035"
     LayoutBlockFlow {OPTION} at (1,14685.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1036"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1036"
     LayoutBlockFlow {OPTION} at (1,14699.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1037"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1037"
     LayoutBlockFlow {OPTION} at (1,14713.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1038"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1038"
     LayoutBlockFlow {OPTION} at (1,14727.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1039"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1039"
     LayoutBlockFlow {OPTION} at (1,14741.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1040"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1040"
     LayoutBlockFlow {OPTION} at (1,14756) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1041"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1041"
     LayoutBlockFlow {OPTION} at (1,14770.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1042"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1042"
     LayoutBlockFlow {OPTION} at (1,14784.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1043"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1043"
     LayoutBlockFlow {OPTION} at (1,14798.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1044"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1044"
     LayoutBlockFlow {OPTION} at (1,14812.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1045"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1045"
     LayoutBlockFlow {OPTION} at (1,14826.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1046"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1046"
     LayoutBlockFlow {OPTION} at (1,14841.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1047"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1047"
     LayoutBlockFlow {OPTION} at (1,14855.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1048"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1048"
     LayoutBlockFlow {OPTION} at (1,14869.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1049"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1049"
     LayoutBlockFlow {OPTION} at (1,14883.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1050"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1050"
     LayoutBlockFlow {OPTION} at (1,14897.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1051"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1051"
     LayoutBlockFlow {OPTION} at (1,14912.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1052"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1052"
     LayoutBlockFlow {OPTION} at (1,14926.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1053"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1053"
     LayoutBlockFlow {OPTION} at (1,14940.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1054"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1054"
     LayoutBlockFlow {OPTION} at (1,14954.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1055"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1055"
     LayoutBlockFlow {OPTION} at (1,14968.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1056"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1056"
     LayoutBlockFlow {OPTION} at (1,14983) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1057"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1057"
     LayoutBlockFlow {OPTION} at (1,14997.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1058"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1058"
     LayoutBlockFlow {OPTION} at (1,15011.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1059"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1059"
     LayoutBlockFlow {OPTION} at (1,15025.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1060"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1060"
     LayoutBlockFlow {OPTION} at (1,15039.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1061"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1061"
     LayoutBlockFlow {OPTION} at (1,15053.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1062"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1062"
     LayoutBlockFlow {OPTION} at (1,15068.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1063"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1063"
     LayoutBlockFlow {OPTION} at (1,15082.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1064"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1064"
     LayoutBlockFlow {OPTION} at (1,15096.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1065"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1065"
     LayoutBlockFlow {OPTION} at (1,15110.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1066"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1066"
     LayoutBlockFlow {OPTION} at (1,15124.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1067"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1067"
     LayoutBlockFlow {OPTION} at (1,15139.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1068"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1068"
     LayoutBlockFlow {OPTION} at (1,15153.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1069"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1069"
     LayoutBlockFlow {OPTION} at (1,15167.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1070"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1070"
     LayoutBlockFlow {OPTION} at (1,15181.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1071"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1071"
     LayoutBlockFlow {OPTION} at (1,15195.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1072"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1072"
     LayoutBlockFlow {OPTION} at (1,15210) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1073"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1073"
     LayoutBlockFlow {OPTION} at (1,15224.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1074"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1074"
     LayoutBlockFlow {OPTION} at (1,15238.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1075"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1075"
     LayoutBlockFlow {OPTION} at (1,15252.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1076"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1076"
     LayoutBlockFlow {OPTION} at (1,15266.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1077"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1077"
     LayoutBlockFlow {OPTION} at (1,15280.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1078"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1078"
     LayoutBlockFlow {OPTION} at (1,15295.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1079"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1079"
     LayoutBlockFlow {OPTION} at (1,15309.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1080"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1080"
     LayoutBlockFlow {OPTION} at (1,15323.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1081"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1081"
     LayoutBlockFlow {OPTION} at (1,15337.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1082"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1082"
     LayoutBlockFlow {OPTION} at (1,15351.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1083"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1083"
     LayoutBlockFlow {OPTION} at (1,15366.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1084"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1084"
     LayoutBlockFlow {OPTION} at (1,15380.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1085"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1085"
     LayoutBlockFlow {OPTION} at (1,15394.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1086"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1086"
     LayoutBlockFlow {OPTION} at (1,15408.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1087"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1087"
     LayoutBlockFlow {OPTION} at (1,15422.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1088"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1088"
     LayoutBlockFlow {OPTION} at (1,15437) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1089"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1089"
     LayoutBlockFlow {OPTION} at (1,15451.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1090"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1090"
     LayoutBlockFlow {OPTION} at (1,15465.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1091"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1091"
     LayoutBlockFlow {OPTION} at (1,15479.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1092"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1092"
     LayoutBlockFlow {OPTION} at (1,15493.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1093"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1093"
     LayoutBlockFlow {OPTION} at (1,15507.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1094"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1094"
     LayoutBlockFlow {OPTION} at (1,15522.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1095"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1095"
     LayoutBlockFlow {OPTION} at (1,15536.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1096"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1096"
     LayoutBlockFlow {OPTION} at (1,15550.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1097"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1097"
     LayoutBlockFlow {OPTION} at (1,15564.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1098"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1098"
     LayoutBlockFlow {OPTION} at (1,15578.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1099"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1099"
     LayoutBlockFlow {OPTION} at (1,15593.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1100"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1100"
     LayoutBlockFlow {OPTION} at (1,15607.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1101"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1101"
     LayoutBlockFlow {OPTION} at (1,15621.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1102"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1102"
     LayoutBlockFlow {OPTION} at (1,15635.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1103"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1103"
     LayoutBlockFlow {OPTION} at (1,15649.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1104"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1104"
     LayoutBlockFlow {OPTION} at (1,15664) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1105"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1105"
     LayoutBlockFlow {OPTION} at (1,15678.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1106"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1106"
     LayoutBlockFlow {OPTION} at (1,15692.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1107"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1107"
     LayoutBlockFlow {OPTION} at (1,15706.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1108"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1108"
     LayoutBlockFlow {OPTION} at (1,15720.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1109"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1109"
     LayoutBlockFlow {OPTION} at (1,15734.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1110"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1110"
     LayoutBlockFlow {OPTION} at (1,15749.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1111"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1111"
     LayoutBlockFlow {OPTION} at (1,15763.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1112"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1112"
     LayoutBlockFlow {OPTION} at (1,15777.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1113"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1113"
     LayoutBlockFlow {OPTION} at (1,15791.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1114"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1114"
     LayoutBlockFlow {OPTION} at (1,15805.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1115"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1115"
     LayoutBlockFlow {OPTION} at (1,15820.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1116"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1116"
     LayoutBlockFlow {OPTION} at (1,15834.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1117"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1117"
     LayoutBlockFlow {OPTION} at (1,15848.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1118"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1118"
     LayoutBlockFlow {OPTION} at (1,15862.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1119"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1119"
     LayoutBlockFlow {OPTION} at (1,15876.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1120"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1120"
     LayoutBlockFlow {OPTION} at (1,15891) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1121"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1121"
     LayoutBlockFlow {OPTION} at (1,15905.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1122"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1122"
     LayoutBlockFlow {OPTION} at (1,15919.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1123"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1123"
     LayoutBlockFlow {OPTION} at (1,15933.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1124"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1124"
     LayoutBlockFlow {OPTION} at (1,15947.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1125"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1125"
     LayoutBlockFlow {OPTION} at (1,15961.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1126"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1126"
     LayoutBlockFlow {OPTION} at (1,15976.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1127"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1127"
     LayoutBlockFlow {OPTION} at (1,15990.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1128"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1128"
     LayoutBlockFlow {OPTION} at (1,16004.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1129"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1129"
     LayoutBlockFlow {OPTION} at (1,16018.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1130"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1130"
     LayoutBlockFlow {OPTION} at (1,16032.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1131"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1131"
     LayoutBlockFlow {OPTION} at (1,16047.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1132"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1132"
     LayoutBlockFlow {OPTION} at (1,16061.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1133"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1133"
     LayoutBlockFlow {OPTION} at (1,16075.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1134"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1134"
     LayoutBlockFlow {OPTION} at (1,16089.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1135"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1135"
     LayoutBlockFlow {OPTION} at (1,16103.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1136"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1136"
     LayoutBlockFlow {OPTION} at (1,16118) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1137"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1137"
     LayoutBlockFlow {OPTION} at (1,16132.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1138"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1138"
     LayoutBlockFlow {OPTION} at (1,16146.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1139"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1139"
     LayoutBlockFlow {OPTION} at (1,16160.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1140"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1140"
     LayoutBlockFlow {OPTION} at (1,16174.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1141"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1141"
     LayoutBlockFlow {OPTION} at (1,16188.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1142"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1142"
     LayoutBlockFlow {OPTION} at (1,16203.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1143"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1143"
     LayoutBlockFlow {OPTION} at (1,16217.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1144"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1144"
     LayoutBlockFlow {OPTION} at (1,16231.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1145"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1145"
     LayoutBlockFlow {OPTION} at (1,16245.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1146"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1146"
     LayoutBlockFlow {OPTION} at (1,16259.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1147"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1147"
     LayoutBlockFlow {OPTION} at (1,16274.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1148"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1148"
     LayoutBlockFlow {OPTION} at (1,16288.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1149"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1149"
     LayoutBlockFlow {OPTION} at (1,16302.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1150"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1150"
     LayoutBlockFlow {OPTION} at (1,16316.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1151"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1151"
     LayoutBlockFlow {OPTION} at (1,16330.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1152"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1152"
     LayoutBlockFlow {OPTION} at (1,16345) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1153"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1153"
     LayoutBlockFlow {OPTION} at (1,16359.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1154"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1154"
     LayoutBlockFlow {OPTION} at (1,16373.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1155"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1155"
     LayoutBlockFlow {OPTION} at (1,16387.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1156"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1156"
     LayoutBlockFlow {OPTION} at (1,16401.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1157"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1157"
     LayoutBlockFlow {OPTION} at (1,16415.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1158"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1158"
     LayoutBlockFlow {OPTION} at (1,16430.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1159"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1159"
     LayoutBlockFlow {OPTION} at (1,16444.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1160"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1160"
     LayoutBlockFlow {OPTION} at (1,16458.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1161"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1161"
     LayoutBlockFlow {OPTION} at (1,16472.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1162"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1162"
     LayoutBlockFlow {OPTION} at (1,16486.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1163"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1163"
     LayoutBlockFlow {OPTION} at (1,16501.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1164"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1164"
     LayoutBlockFlow {OPTION} at (1,16515.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1165"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1165"
     LayoutBlockFlow {OPTION} at (1,16529.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1166"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1166"
     LayoutBlockFlow {OPTION} at (1,16543.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1167"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1167"
     LayoutBlockFlow {OPTION} at (1,16557.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1168"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1168"
     LayoutBlockFlow {OPTION} at (1,16572) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1169"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1169"
     LayoutBlockFlow {OPTION} at (1,16586.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1170"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1170"
     LayoutBlockFlow {OPTION} at (1,16600.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1171"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1171"
     LayoutBlockFlow {OPTION} at (1,16614.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1172"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1172"
     LayoutBlockFlow {OPTION} at (1,16628.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1173"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1173"
     LayoutBlockFlow {OPTION} at (1,16642.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1174"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1174"
     LayoutBlockFlow {OPTION} at (1,16657.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1175"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1175"
     LayoutBlockFlow {OPTION} at (1,16671.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1176"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1176"
     LayoutBlockFlow {OPTION} at (1,16685.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1177"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1177"
     LayoutBlockFlow {OPTION} at (1,16699.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1178"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1178"
     LayoutBlockFlow {OPTION} at (1,16713.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1179"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1179"
     LayoutBlockFlow {OPTION} at (1,16728.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1180"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1180"
     LayoutBlockFlow {OPTION} at (1,16742.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1181"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1181"
     LayoutBlockFlow {OPTION} at (1,16756.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1182"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1182"
     LayoutBlockFlow {OPTION} at (1,16770.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1183"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1183"
     LayoutBlockFlow {OPTION} at (1,16784.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1184"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1184"
     LayoutBlockFlow {OPTION} at (1,16799) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1185"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1185"
     LayoutBlockFlow {OPTION} at (1,16813.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1186"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1186"
     LayoutBlockFlow {OPTION} at (1,16827.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1187"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1187"
     LayoutBlockFlow {OPTION} at (1,16841.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1188"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1188"
     LayoutBlockFlow {OPTION} at (1,16855.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1189"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1189"
     LayoutBlockFlow {OPTION} at (1,16869.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1190"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1190"
     LayoutBlockFlow {OPTION} at (1,16884.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1191"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1191"
     LayoutBlockFlow {OPTION} at (1,16898.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1192"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1192"
     LayoutBlockFlow {OPTION} at (1,16912.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1193"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1193"
     LayoutBlockFlow {OPTION} at (1,16926.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1194"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1194"
     LayoutBlockFlow {OPTION} at (1,16940.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1195"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1195"
     LayoutBlockFlow {OPTION} at (1,16955.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1196"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1196"
     LayoutBlockFlow {OPTION} at (1,16969.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1197"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1197"
     LayoutBlockFlow {OPTION} at (1,16983.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1198"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1198"
     LayoutBlockFlow {OPTION} at (1,16997.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1199"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1199"
     LayoutBlockFlow {OPTION} at (1,17011.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1200"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1200"
     LayoutBlockFlow {OPTION} at (1,17026) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1201"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1201"
     LayoutBlockFlow {OPTION} at (1,17040.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1202"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1202"
     LayoutBlockFlow {OPTION} at (1,17054.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1203"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1203"
     LayoutBlockFlow {OPTION} at (1,17068.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1204"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1204"
     LayoutBlockFlow {OPTION} at (1,17082.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1205"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1205"
     LayoutBlockFlow {OPTION} at (1,17096.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1206"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1206"
     LayoutBlockFlow {OPTION} at (1,17111.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1207"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1207"
     LayoutBlockFlow {OPTION} at (1,17125.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1208"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1208"
     LayoutBlockFlow {OPTION} at (1,17139.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1209"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1209"
     LayoutBlockFlow {OPTION} at (1,17153.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1210"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1210"
     LayoutBlockFlow {OPTION} at (1,17167.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1211"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1211"
     LayoutBlockFlow {OPTION} at (1,17182.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1212"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1212"
     LayoutBlockFlow {OPTION} at (1,17196.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1213"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1213"
     LayoutBlockFlow {OPTION} at (1,17210.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1214"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1214"
     LayoutBlockFlow {OPTION} at (1,17224.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1215"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1215"
     LayoutBlockFlow {OPTION} at (1,17238.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1216"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1216"
     LayoutBlockFlow {OPTION} at (1,17253) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1217"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1217"
     LayoutBlockFlow {OPTION} at (1,17267.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1218"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1218"
     LayoutBlockFlow {OPTION} at (1,17281.38) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1219"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1219"
     LayoutBlockFlow {OPTION} at (1,17295.56) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1220"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1220"
     LayoutBlockFlow {OPTION} at (1,17309.75) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1221"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1221"
     LayoutBlockFlow {OPTION} at (1,17323.94) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1222"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1222"
     LayoutBlockFlow {OPTION} at (1,17338.13) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1223"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1223"
     LayoutBlockFlow {OPTION} at (1,17352.31) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1224"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1224"
     LayoutBlockFlow {OPTION} at (1,17366.50) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1225"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1225"
     LayoutBlockFlow {OPTION} at (1,17380.69) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1226"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1226"
     LayoutBlockFlow {OPTION} at (1,17394.88) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1227"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1227"
     LayoutBlockFlow {OPTION} at (1,17409.06) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1228"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1228"
     LayoutBlockFlow {OPTION} at (1,17423.25) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1229"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1229"
     LayoutBlockFlow {OPTION} at (1,17437.44) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1230"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1230"
     LayoutBlockFlow {OPTION} at (1,17451.63) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1231"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1231"
     LayoutBlockFlow {OPTION} at (1,17465.81) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1232"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1232"
     LayoutBlockFlow {OPTION} at (1,17480) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1233"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1233"
     LayoutBlockFlow {OPTION} at (1,17494.19) size 187x14.19 [bgcolor=#D4D4D4]
-      LayoutText {#text} at (2,0) size 53x13
-        text run at (2,0) width 53: "Item 1234"
+      LayoutText {#text} at (2,0) size 50x13
+        text run at (2,0) width 50: "Item 1234"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.png
index 04e46b79..d348992 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.txt
index cebd3be7..f2d86fee 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/optgroup-rendering-expected.txt
@@ -4,97 +4,97 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x321
     LayoutBlockFlow {BODY} at (8,8) size 784x305
       LayoutBlockFlow {FORM} at (0,0) size 784x305
-        LayoutText {#text} at (68,268) size 5x18
-          text run at (68,268) width 5: " "
-        LayoutBR {BR} at (72,268) size 1x18
-        LayoutMenuList {SELECT} at (0,287) size 75x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 75x18
-            LayoutText (anonymous) at (8,2) size 30x13
-              text run at (8,2) width 30: "Three"
+        LayoutText {#text} at (66,268) size 5x18
+          text run at (66,268) width 5: " "
+        LayoutBR {BR} at (70,268) size 1x18
+        LayoutMenuList {SELECT} at (0,287) size 72x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 72x18
+            LayoutText (anonymous) at (8,2) size 29x13
+              text run at (8,2) width 29: "Three"
         LayoutText {#text} at (0,0) size 0x0
-layer at (8,8) size 69x286 clip at (9,9) size 56x284 scrollHeight 283
-  LayoutListBox {SELECT} at (0,0.25) size 68.89x285.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTGROUP} at (1,1) size 55.89x70.94 [color=#008000]
-      LayoutBlockFlow {DIV} at (0,0) size 55.89x14.19
-        LayoutText {#text} at (2,0) size 46x13
-          text run at (2,0) width 46: "Enabled"
-      LayoutBlockFlow {OPTION} at (0,14.19) size 55.89x14.19 [color=#0000FF]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 23x13
-          text run at (15,0) width 23: "One"
-      LayoutBlockFlow {OPTION} at (0,28.38) size 55.89x14.19 [color=#0000FF]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 23x13
-          text run at (15,0) width 23: "Two"
-      LayoutBlockFlow {OPTION} at (0,42.56) size 55.89x14.19 [color=#0000FF]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 31x13
-          text run at (15,0) width 31: "Three"
-      LayoutBlockFlow {OPTION} at (0,56.75) size 55.89x14.19 [color=#0000FF]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 25x13
-          text run at (15,0) width 25: "Four"
-    LayoutBlockFlow {OPTGROUP} at (1,71.94) size 55.89x70.94 [color=#FFC0CB]
-      LayoutBlockFlow {DIV} at (0,0) size 55.89x14.19
-        LayoutText {#text} at (2,0) size 49x13
-          text run at (2,0) width 49: "Disabled"
-      LayoutBlockFlow {OPTION} at (0,14.19) size 55.89x14.19 [color=#FF0000]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 23x13
-          text run at (15,0) width 23: "One"
-      LayoutBlockFlow {OPTION} at (0,28.38) size 55.89x14.19 [color=#FF0000]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 23x13
-          text run at (15,0) width 23: "Two"
-      LayoutBlockFlow {OPTION} at (0,42.56) size 55.89x14.19 [color=#FF0000]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 31x13
-          text run at (15,0) width 31: "Three"
-      LayoutBlockFlow {OPTION} at (0,56.75) size 55.89x14.19 [color=#FF0000]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 25x13
-          text run at (15,0) width 25: "Four"
-    LayoutBlockFlow {OPTGROUP} at (1,142.88) size 55.89x70.94 [color=#008000]
-      LayoutBlockFlow {DIV} at (0,0) size 55.89x14.19
-        LayoutText {#text} at (2,0) size 52x13
-          text run at (2,0) width 52: "Enabled2"
-      LayoutBlockFlow {OPTION} at (0,14.19) size 55.89x14.19 [color=#0000FF]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 23x13
-          text run at (15,0) width 23: "One"
-      LayoutBlockFlow {OPTION} at (0,28.38) size 55.89x14.19 [color=#FF0000]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 23x13
-          text run at (15,0) width 23: "Two"
-      LayoutBlockFlow {OPTION} at (0,42.56) size 55.89x14.19 [color=#000000] [bgcolor=#D4D4D4]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 31x13
-          text run at (15,0) width 31: "Three"
-      LayoutBlockFlow {OPTION} at (0,56.75) size 55.89x14.19 [color=#0000FF]
-        LayoutInline {<pseudo:before>} at (0,0) size 14x13
-          LayoutTextFragment (anonymous) at (2,0) size 14x13
-            text run at (2,0) width 14: "    "
-        LayoutText {#text} at (15,0) size 25x13
-          text run at (15,0) width 25: "Four"
+layer at (8,8) size 66x286 clip at (9,9) size 53x284 scrollHeight 283
+  LayoutListBox {SELECT} at (0,0.25) size 66.47x285.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTGROUP} at (1,1) size 53.47x70.94 [color=#008000]
+      LayoutBlockFlow {DIV} at (0,0) size 53.47x14.19
+        LayoutText {#text} at (2,0) size 44x13
+          text run at (2,0) width 44: "Enabled"
+      LayoutBlockFlow {OPTION} at (0,14.19) size 53.47x14.19 [color=#0000FF]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 22x13
+          text run at (14,0) width 22: "One"
+      LayoutBlockFlow {OPTION} at (0,28.38) size 53.47x14.19 [color=#0000FF]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 22x13
+          text run at (14,0) width 22: "Two"
+      LayoutBlockFlow {OPTION} at (0,42.56) size 53.47x14.19 [color=#0000FF]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 29x13
+          text run at (14,0) width 29: "Three"
+      LayoutBlockFlow {OPTION} at (0,56.75) size 53.47x14.19 [color=#0000FF]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 24x13
+          text run at (14,0) width 24: "Four"
+    LayoutBlockFlow {OPTGROUP} at (1,71.94) size 53.47x70.94 [color=#FFC0CB]
+      LayoutBlockFlow {DIV} at (0,0) size 53.47x14.19
+        LayoutText {#text} at (2,0) size 47x13
+          text run at (2,0) width 47: "Disabled"
+      LayoutBlockFlow {OPTION} at (0,14.19) size 53.47x14.19 [color=#FF0000]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 22x13
+          text run at (14,0) width 22: "One"
+      LayoutBlockFlow {OPTION} at (0,28.38) size 53.47x14.19 [color=#FF0000]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 22x13
+          text run at (14,0) width 22: "Two"
+      LayoutBlockFlow {OPTION} at (0,42.56) size 53.47x14.19 [color=#FF0000]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 29x13
+          text run at (14,0) width 29: "Three"
+      LayoutBlockFlow {OPTION} at (0,56.75) size 53.47x14.19 [color=#FF0000]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 24x13
+          text run at (14,0) width 24: "Four"
+    LayoutBlockFlow {OPTGROUP} at (1,142.88) size 53.47x70.94 [color=#008000]
+      LayoutBlockFlow {DIV} at (0,0) size 53.47x14.19
+        LayoutText {#text} at (2,0) size 50x13
+          text run at (2,0) width 50: "Enabled2"
+      LayoutBlockFlow {OPTION} at (0,14.19) size 53.47x14.19 [color=#0000FF]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 22x13
+          text run at (14,0) width 22: "One"
+      LayoutBlockFlow {OPTION} at (0,28.38) size 53.47x14.19 [color=#FF0000]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 22x13
+          text run at (14,0) width 22: "Two"
+      LayoutBlockFlow {OPTION} at (0,42.56) size 53.47x14.19 [color=#000000] [bgcolor=#D4D4D4]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 29x13
+          text run at (14,0) width 29: "Three"
+      LayoutBlockFlow {OPTION} at (0,56.75) size 53.47x14.19 [color=#0000FF]
+        LayoutInline {<pseudo:before>} at (0,0) size 13x13
+          LayoutTextFragment (anonymous) at (2,0) size 13x13
+            text run at (2,0) width 13: "    "
+        LayoutText {#text} at (14,0) size 24x13
+          text run at (14,0) width 24: "Four"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-expected.png
index 7942665a..d2ae91a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-many-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-many-expected.png
index 3eb7821..90b6df5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-many-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-many-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-rtl-expected.png
index 5d0636b..58bdb9c9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-single-option-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-single-option-expected.png
index bcf6762c..b161104a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-single-option-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-single-option-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-styled-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-styled-expected.png
index d894764..785ee5a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-styled-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-styled-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-texttransform-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-texttransform-expected.png
index 6e80f91..7500fa4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-texttransform-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-texttransform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-transform-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-transform-expected.png
index e48d2f2..724a946 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-transform-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-transform-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-zoom-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-zoom-expected.png
index f741778..1e28b31c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-zoom-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/select/popup-menu-appearance-zoom-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/stuff-on-my-optgroup-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/stuff-on-my-optgroup-expected.png
index 566c7d3..e8f2161d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/stuff-on-my-optgroup-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/stuff-on-my-optgroup-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/stuff-on-my-optgroup-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/stuff-on-my-optgroup-expected.txt
index f1a7e685d..c7c32e67 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/stuff-on-my-optgroup-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/stuff-on-my-optgroup-expected.txt
@@ -3,13 +3,13 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,0) size 67x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 67x18
-          LayoutText (anonymous) at (8,2) size 22x13
-            text run at (8,2) width 22: "One"
-      LayoutBR {BR} at (67,13) size 0x0
-      LayoutMenuList {SELECT} at (0,18) size 67x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 67x18
-          LayoutText (anonymous) at (8,2) size 22x13
-            text run at (8,2) width 22: "One"
+      LayoutMenuList {SELECT} at (0,0) size 65x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 65x18
+          LayoutText (anonymous) at (8,2) size 21x13
+            text run at (8,2) width 21: "One"
+      LayoutBR {BR} at (65,13) size 0x0
+      LayoutMenuList {SELECT} at (0,18) size 65x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 65x18
+          LayoutText (anonymous) at (8,2) size 21x13
+            text run at (8,2) width 21: "One"
       LayoutText {#text} at (0,0) size 0x0
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 d36e5b29..f7e51d9 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/submit/submit-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-appearance-basic-expected.txt
index 4aa4840..048b73f7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-appearance-basic-expected.txt
@@ -3,69 +3,69 @@
 layer at (0,0) size 800x219
   LayoutBlockFlow {HTML} at (0,0) size 800x219
     LayoutBlockFlow {BODY} at (8,8) size 784x203
-      LayoutButton {INPUT} at (4,4) size 33.06x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-          LayoutText {#text} at (0,0) size 18x13
-            text run at (0,0) width 18: "foo"
-      LayoutText {#text} at (41,3) size 5x18
-        text run at (41,3) width 5: " "
-      LayoutBR {BR} at (45,3) size 1x18
-      LayoutButton {INPUT} at (4,30) size 35.06x24 [bgcolor=#C0C0C0] [border: (3px solid #00FF00)]
-        LayoutBlockFlow (anonymous) at (9,5) size 17.06x13
-          LayoutText {#text} at (0,0) size 18x13
-            text run at (0,0) width 18: "foo"
-      LayoutText {#text} at (43,32) size 5x18
-        text run at (43,32) width 5: " "
-      LayoutButton {INPUT} at (51.06,31) size 33.06x22 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 17.06x13
-          LayoutText {#text} at (0,0) size 18x13
-            text run at (0,0) width 18: "foo"
-      LayoutText {#text} at (88,32) size 5x18
-        text run at (88,32) width 5: " "
-      LayoutBR {BR} at (92,32) size 1x18
-      LayoutButton {INPUT} at (4,62) size 33.06x22 [border: (2px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (8,4) size 17.06x13
-          LayoutText {#text} at (0,0) size 18x13
-            text run at (0,0) width 18: "foo"
-      LayoutText {#text} at (41,63) size 5x18
-        text run at (41,63) width 5: " "
-      LayoutBR {BR} at (45,63) size 1x18
-      LayoutButton {INPUT} at (4,92) size 33.06x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 17.06x13
-          LayoutText {#text} at (0,0) size 18x13
-            text run at (0,0) width 18: "foo"
-      LayoutText {#text} at (41,91) size 5x18
-        text run at (41,91) width 5: " "
-      LayoutBR {BR} at (45,91) size 1x18
-      LayoutButton {INPUT} at (4,118) size 35.88x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 19.88x16
+      LayoutButton {INPUT} at (4,4) size 32.16x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+          LayoutText {#text} at (0,0) size 17x13
+            text run at (0,0) width 17: "foo"
+      LayoutText {#text} at (40,3) size 5x18
+        text run at (40,3) width 5: " "
+      LayoutBR {BR} at (44,3) size 1x18
+      LayoutButton {INPUT} at (4,30) size 34.16x24 [bgcolor=#C0C0C0] [border: (3px solid #00FF00)]
+        LayoutBlockFlow (anonymous) at (9,5) size 16.16x13
+          LayoutText {#text} at (0,0) size 17x13
+            text run at (0,0) width 17: "foo"
+      LayoutText {#text} at (42,32) size 5x18
+        text run at (42,32) width 5: " "
+      LayoutButton {INPUT} at (50.16,31) size 32.16x22 [bgcolor=#C0C0C0] [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 16.16x13
+          LayoutText {#text} at (0,0) size 17x13
+            text run at (0,0) width 17: "foo"
+      LayoutText {#text} at (86,32) size 5x18
+        text run at (86,32) width 5: " "
+      LayoutBR {BR} at (90,32) size 1x18
+      LayoutButton {INPUT} at (4,62) size 32.16x22 [border: (2px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (8,4) size 16.16x13
+          LayoutText {#text} at (0,0) size 17x13
+            text run at (0,0) width 17: "foo"
+      LayoutText {#text} at (40,63) size 5x18
+        text run at (40,63) width 5: " "
+      LayoutBR {BR} at (44,63) size 1x18
+      LayoutButton {INPUT} at (4,92) size 32.16x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 16.16x13
+          LayoutText {#text} at (0,0) size 17x13
+            text run at (0,0) width 17: "foo"
+      LayoutText {#text} at (40,91) size 5x18
+        text run at (40,91) width 5: " "
+      LayoutBR {BR} at (44,91) size 1x18
+      LayoutButton {INPUT} at (4,118) size 35.08x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 19.08x16
           LayoutText {#text} at (0,0) size 20x16
             text run at (0,0) width 20: "foo"
       LayoutText {#text} at (43,119) size 5x18
         text run at (43,119) width 5: " "
-      LayoutButton {INPUT} at (51.88,118) size 35.88x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 19.88x16
+      LayoutButton {INPUT} at (51.08,118) size 35.08x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 19.08x16
           LayoutText {#text} at (0,0) size 20x16
             text run at (0,0) width 20: "foo"
-      LayoutText {#text} at (91,119) size 5x18
-        text run at (91,119) width 5: " "
-      LayoutButton {INPUT} at (99.75,118) size 35.88x21 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 19.88x16
+      LayoutText {#text} at (90,119) size 5x18
+        text run at (90,119) width 5: " "
+      LayoutButton {INPUT} at (98.16,118) size 35.08x21 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 19.08x16
           LayoutText {#text} at (0,0) size 20x16
             text run at (0,0) width 20: "foo"
-      LayoutText {#text} at (139,119) size 5x18
-        text run at (139,119) width 5: " "
-      LayoutBR {BR} at (143,119) size 1x18
-      LayoutButton {INPUT} at (6,158) size 48.58x32.50 [bgcolor=#C0C0C0] [border: (3px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (12,6) size 24.58x19
+      LayoutText {#text} at (137,119) size 5x18
+        text run at (137,119) width 5: " "
+      LayoutBR {BR} at (141,119) size 1x18
+      LayoutButton {INPUT} at (6,158) size 48.22x32.50 [bgcolor=#C0C0C0] [border: (3px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (12,6) size 24.22x19
           LayoutText {#text} at (0,0) size 25x19
             text run at (0,0) width 25: "foo"
       LayoutText {#text} at (60,166) size 5x18
         text run at (60,166) width 5: " "
-      LayoutButton {INPUT} at (72.58,151) size 63.63x44 [bgcolor=#C0C0C0] [border: (4px outset #C0C0C0)]
-        LayoutBlockFlow (anonymous) at (16,8) size 31.63x26
-          LayoutText {#text} at (0,0) size 32x26
-            text run at (0,0) width 32: "foo"
+      LayoutButton {INPUT} at (72.22,151) size 64.30x44 [bgcolor=#C0C0C0] [border: (4px outset #C0C0C0)]
+        LayoutBlockFlow (anonymous) at (16,8) size 32.30x26
+          LayoutText {#text} at (0,0) size 33x26
+            text run at (0,0) width 33: "foo"
       LayoutText {#text} at (144,166) size 5x18
         text run at (144,166) width 5: " "
       LayoutBR {BR} at (148,166) size 1x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.png
index c50eb078..5d379c3b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.txt
index f48b2d7..382bdd5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/submit/submit-focus-by-mouse-then-keydown-expected.txt
@@ -6,7 +6,7 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [3, 4, 64, 29]
+        [3, 4, 62, 29]
       ],
       "paintInvalidationClients": [
         "LayoutButton INPUT",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-expected.png
index 3a59a783..a20da70 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
index 51310bc5..2657b4f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
index 92237ac..9c42f54 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/date-suggestion-picker-appearance-with-scroll-bar-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-expected.png
index dfa44c9..0bde952 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew-expected.png
index 3eda22a2..3b91eab 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-locale-hebrew-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl-expected.png
index 8aa796c..19e07f1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-with-scroll-bar-expected.png
index 2762b9f..1f923e9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/datetimelocal-suggestion-picker-appearance-with-scroll-bar-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-expected.png
index cb63b1a..573662a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl-expected.png
index 070cb86..0bc6a60 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png
index 1329190..e55af89 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/month-suggestion-picker-appearance-with-scroll-bar-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-expected.png
index a5401775..3474357 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew-expected.png
index 1532417e..1ca467e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-locale-hebrew-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl-expected.png
index eae8c09..07ed084 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar-expected.png
index 4e6cfec..c4d02ad 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/time-suggestion-picker-appearance-with-scroll-bar-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-expected.png
index ebda4ef..368634d8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
index 2fdbcbe..1c9a17a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-rtl-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png
index e599963..a6dc0c8a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/suggestion-picker/week-suggestion-picker-appearance-with-scroll-bar-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/tabbing-input-iframe-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/tabbing-input-iframe-expected.png
index c455932..0082f03a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/tabbing-input-iframe-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/tabbing-input-iframe-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/tabbing-input-iframe-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/tabbing-input-iframe-expected.txt
index f2626a1e..a186e926 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/tabbing-input-iframe-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/tabbing-input-iframe-expected.txt
@@ -24,7 +24,7 @@
         LayoutBlockFlow {BODY} at (8,8) size 284x134
 layer at (452,167) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 122x13
-      text run at (0,0) width 122: "This should have focus"
+    LayoutText {#text} at (0,0) size 115x13
+      text run at (0,0) width 115: "This should have focus"
 selection start: position 0 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
 selection end:   position 22 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/targeted-frame-submission-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/targeted-frame-submission-expected.png
index 868c480..a6c935c3d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/targeted-frame-submission-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/targeted-frame-submission-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/targeted-frame-submission-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/targeted-frame-submission-expected.txt
index 89883fe..96db27e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/targeted-frame-submission-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/targeted-frame-submission-expected.txt
@@ -4,10 +4,10 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
       LayoutBlockFlow {FORM} at (0,0) size 784x18
-        LayoutButton {INPUT} at (0,0) size 40.20x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 24.20x13
-            LayoutText {#text} at (0,0) size 25x13
-              text run at (0,0) width 25: "form"
+        LayoutButton {INPUT} at (0,0) size 38.98x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 22.98x13
+            LayoutText {#text} at (0,0) size 23x13
+              text run at (0,0) width 23: "form"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {DIV} at (0,34) size 784x36
         LayoutText {#text} at (0,0) size 779x36
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text-style-color-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text-style-color-expected.png
index 8ae6b15..1c7a6465 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text-style-color-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text-style-color-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text-style-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text-style-color-expected.txt
index c076237..e3d535c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text-style-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text-style-color-expected.txt
@@ -16,17 +16,17 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (11,11) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 37x13
-      text run at (0,0) width 37: "default"
+    LayoutText {#text} at (0,0) size 35x13
+      text run at (0,0) width 35: "default"
 layer at (146,11) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "red"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "red"
 layer at (281,11) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 87x13
-      text run at (0,0) width 87: "default on green"
+    LayoutText {#text} at (0,0) size 82x13
+      text run at (0,0) width 82: "default on green"
 layer at (416,11) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 68x13
-      text run at (0,0) width 68: "red on green"
+    LayoutText {#text} at (0,0) size 64x13
+      text run at (0,0) width 64: "red on green"
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 df697e0..d65940f0 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/forms/text/text-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-appearance-basic-expected.txt
index 64c7cdc..686b5018 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/text/text-appearance-basic-expected.txt
@@ -22,60 +22,60 @@
       LayoutText {#text} at (139,87) size 4x18
         text run at (139,87) width 4: " "
       LayoutBR {BR} at (143,87) size 0x18
-      LayoutTextControl {INPUT} at (4,122) size 192x24 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-      LayoutText {#text} at (200,126) size 4x18
-        text run at (200,126) width 4: " "
-      LayoutTextControl {INPUT} at (208,118) size 215x29 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+      LayoutTextControl {INPUT} at (4,122) size 173x24 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (181,126) size 4x18
+        text run at (181,126) width 4: " "
+      LayoutTextControl {INPUT} at (189,118) size 234x29 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutText {#text} at (427,126) size 4x18
         text run at (427,126) width 4: " "
-      LayoutTextControl {INPUT} at (435,114) size 257x34 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-      LayoutText {#text} at (696,126) size 4x18
-        text run at (696,126) width 4: " "
-      LayoutBR {BR} at (700,126) size 0x18
+      LayoutTextControl {INPUT} at (435,114) size 276x34 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+      LayoutText {#text} at (715,126) size 4x18
+        text run at (715,126) width 4: " "
+      LayoutBR {BR} at (719,126) size 0x18
       LayoutTextControl {INPUT} at (6,167) size 196x28 [bgcolor=#FFFFFF] [border: (3px inset #EEEEEE)]
       LayoutText {#text} at (208,173) size 4x18
         text run at (208,173) width 4: " "
-      LayoutTextControl {INPUT} at (220,160) size 242x38 [bgcolor=#FFFFFF] [border: (4px inset #EEEEEE)]
-      LayoutText {#text} at (470,173) size 4x18
-        text run at (470,173) width 4: " "
-      LayoutBR {BR} at (474,173) size 0x18
+      LayoutTextControl {INPUT} at (220,160) size 261x38 [bgcolor=#FFFFFF] [border: (4px inset #EEEEEE)]
+      LayoutText {#text} at (489,173) size 4x18
+        text run at (489,173) width 4: " "
+      LayoutBR {BR} at (493,173) size 0x18
 layer at (15,15) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (16,43) size 125x13
   LayoutBlockFlow {DIV} at (4,4) size 125x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (160,43) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (15,71) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
 layer at (15,98) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 18x13
-      text run at (0,0) width 18: "foo"
-layer at (15,133) size 186x18
-  LayoutBlockFlow {DIV} at (3,3) size 186x18
+    LayoutText {#text} at (0,0) size 17x13
+      text run at (0,0) width 17: "foo"
+layer at (15,133) size 167x18
+  LayoutBlockFlow {DIV} at (3,3) size 167x18
     LayoutText {#text} at (0,0) size 24x18
       text run at (0,0) width 24: "foo"
-layer at (219,129) size 209x23
-  LayoutBlockFlow {DIV} at (3,3) size 209x23
-    LayoutText {#text} at (0,0) size 29x23
-      text run at (0,0) width 29: "foo"
-layer at (446,125) size 251x28
-  LayoutBlockFlow {DIV} at (3,3) size 251x28
-    LayoutText {#text} at (0,0) size 35x28
-      text run at (0,0) width 35: "foo"
+layer at (200,129) size 228x23
+  LayoutBlockFlow {DIV} at (3,3) size 228x23
+    LayoutText {#text} at (0,0) size 30x23
+      text run at (0,0) width 30: "foo"
+layer at (446,125) size 270x28
+  LayoutBlockFlow {DIV} at (3,3) size 270x28
+    LayoutText {#text} at (0,0) size 36x28
+      text run at (0,0) width 36: "foo"
 layer at (19,180) size 187x19
   LayoutBlockFlow {DIV} at (4.50,4.50) size 187x19
     LayoutText {#text} at (0,0) size 25x19
       text run at (0,0) width 25: "foo"
-layer at (234,174) size 230x26
-  LayoutBlockFlow {DIV} at (6,6) size 230x26
-    LayoutText {#text} at (0,0) size 32x26
-      text run at (0,0) width 32: "foo"
+layer at (234,174) size 249x26
+  LayoutBlockFlow {DIV} at (6,6) size 249x26
+    LayoutText {#text} at (0,0) size 33x26
+      text run at (0,0) width 33: "foo"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textAreaLineHeight-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textAreaLineHeight-expected.txt
index eab0470..9adfa73 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textAreaLineHeight-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textAreaLineHeight-expected.txt
@@ -59,18 +59,17 @@
         text run at (0,18) width 384: "Demo text here that wraps a bit and should demonstrate"
         text run at (383,18) width 5: " "
         text run at (0,71) width 184: "the goodness of line-height"
-layer at (8,829) size 141x32 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 69
+layer at (8,829) size 141x32 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0 scrollHeight 56
   LayoutTextControl {TEXTAREA} at (0,54) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (3,3) size 120x65
-      LayoutText {#text} at (0,0) size 112x65
-        text run at (0,0) width 105: "Demo text here that"
-        text run at (104,0) width 5: " "
-        text run at (0,13) width 82: "wraps a bit and"
-        text run at (81,13) width 5: " "
-        text run at (0,26) width 106: "should demonstrate"
-        text run at (105,26) width 4: " "
-        text run at (0,39) width 112: "the goodness of line-"
-        text run at (0,52) width 33: "height"
+    LayoutBlockFlow {DIV} at (3,3) size 120x52
+      LayoutText {#text} at (0,0) size 118x52
+        text run at (0,0) width 100: "Demo text here that"
+        text run at (99,0) width 4: " "
+        text run at (0,13) width 114: "wraps a bit and should"
+        text run at (113,13) width 4: " "
+        text run at (0,26) width 82: "demonstrate the"
+        text run at (82,26) width 4: " "
+        text run at (0,39) width 118: "goodness of line-height"
 layer at (8,901) size 141x32 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0
   LayoutTextControl {TEXTAREA} at (0,126) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-align-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-align-expected.png
index 38fc608..74dee79c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-align-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-align-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-align-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-align-expected.txt
index 506bdb9..6611638 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-align-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-align-expected.txt
@@ -22,25 +22,25 @@
 layer at (8,42) size 321x32 clip at (9,43) size 319x30
   LayoutTextControl {TEXTAREA} at (0,0) size 321x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x13
-      LayoutText {#text} at (0,0) size 189x13
-        text run at (0,0) width 189: "This is should be aligned to the left."
+      LayoutText {#text} at (0,0) size 178x13
+        text run at (0,0) width 178: "This is should be aligned to the left."
 layer at (8,78) size 321x32 clip at (9,79) size 319x30
   LayoutTextControl {TEXTAREA} at (0,36) size 321x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x13
-      LayoutText {#text} at (0,0) size 189x13
-        text run at (0,0) width 189: "This is should be aligned to the left."
+      LayoutText {#text} at (0,0) size 178x13
+        text run at (0,0) width 178: "This is should be aligned to the left."
 layer at (8,114) size 321x32 clip at (9,115) size 319x30
   LayoutTextControl {TEXTAREA} at (0,72) size 321x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x13
-      LayoutText {#text} at (0,0) size 189x13
-        text run at (0,0) width 189: "This is should be aligned to the left."
+      LayoutText {#text} at (0,0) size 178x13
+        text run at (0,0) width 178: "This is should be aligned to the left."
 layer at (8,150) size 321x32 clip at (9,151) size 319x30
   LayoutTextControl {TEXTAREA} at (0,108) size 321x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x13
-      LayoutText {#text} at (0,0) size 189x13
-        text run at (0,0) width 189: "This is should be aligned to the left."
+      LayoutText {#text} at (0,0) size 178x13
+        text run at (0,0) width 178: "This is should be aligned to the left."
 layer at (8,182) size 321x32 clip at (9,183) size 319x30
   LayoutTextControl {TEXTAREA} at (0,0) size 321x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x13
-      LayoutText {#text} at (0,0) size 189x13
-        text run at (0,0) width 189: "This is should be aligned to the left."
+      LayoutText {#text} at (0,0) size 178x13
+        text run at (0,0) width 178: "This is should be aligned to the left."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.png
index a790825..ea8932ba 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt
index 5b31ff5..1ebee2b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-pseudo-style-expected.txt
@@ -16,24 +16,24 @@
 layer at (8,26) size 141x32 clip at (9,27) size 139x30
   LayoutTextControl {TEXTAREA} at (0,18) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13 [color=#640000]
-      LayoutText {#text} at (0,0) size 21x13
-        text run at (0,0) width 21: "text"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "text"
     LayoutBlockFlow {DIV} at (3,3) size 135x13
 layer at (153,26) size 141x32 clip at (154,27) size 139x30
   LayoutTextControl {TEXTAREA} at (145,18) size 141x32 [color=#545454] [bgcolor=#FFFFFF] [border: (1px solid #545454)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13 [color=#640000]
-      LayoutText {#text} at (0,0) size 69x13
-        text run at (0,0) width 69: "disabled text"
+      LayoutText {#text} at (0,0) size 65x13
+        text run at (0,0) width 65: "disabled text"
     LayoutBlockFlow {DIV} at (3,3) size 135x13
 layer at (298,26) size 141x32 clip at (299,27) size 139x30
   LayoutTextControl {TEXTAREA} at (290,18) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13 [color=#A9A9A9]
-      LayoutText {#text} at (0,0) size 37x13
-        text run at (0,0) width 37: "default"
+      LayoutText {#text} at (0,0) size 35x13
+        text run at (0,0) width 35: "default"
     LayoutBlockFlow {DIV} at (3,3) size 135x13
 layer at (443,26) size 141x32 clip at (444,27) size 139x30
   LayoutTextControl {TEXTAREA} at (435,18) size 141x32 [color=#545454] [bgcolor=#FFFFFF] [border: (1px solid #545454)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13 [color=#A9A9A9]
-      LayoutText {#text} at (0,0) size 85x13
-        text run at (0,0) width 85: "default disabled"
+      LayoutText {#text} at (0,0) size 80x13
+        text run at (0,0) width 80: "default disabled"
     LayoutBlockFlow {DIV} at (3,3) size 135x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.png
index f813871..cc635469 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.txt
index 67ed06d..9056a44 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-1-expected.txt
@@ -12,7 +12,7 @@
 layer at (8,42) size 141x32 clip at (9,43) size 139x30
   LayoutTextControl {TEXTAREA} at (0,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13 [color=#A9A9A9]
-      LayoutText {#text} at (0,0) size 63x13
-        text run at (0,0) width 63: "Placeholder"
+      LayoutText {#text} at (0,0) size 60x13
+        text run at (0,0) width 60: "Placeholder"
     LayoutBlockFlow {DIV} at (3,3) size 135x13
 caret: position 0 of child 0 {DIV} of {#document-fragment} of child 1 {TEXTAREA} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.png
index 7e6fe62..1941935 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.txt
index c94f7ee8..7cafa36 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-placeholder-visibility-2-expected.txt
@@ -12,7 +12,7 @@
 layer at (8,42) size 141x32 clip at (9,43) size 139x30
   LayoutTextControl {TEXTAREA} at (0,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13 [color=#A9A9A9]
-      LayoutText {#text} at (0,0) size 63x13
-        text run at (0,0) width 63: "Placeholder"
+      LayoutText {#text} at (0,0) size 60x13
+        text run at (0,0) width 60: "Placeholder"
     LayoutBlockFlow {DIV} at (3,3) size 135x13
 caret: position 0 of child 0 {DIV} of {#document-fragment} of child 1 {TEXTAREA} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.png
index 7f0336d..8c34713 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.txt
index 8c50160..90c86e7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scroll-height-expected.txt
@@ -10,59 +10,59 @@
 layer at (8,8) size 200x200 clip at (9,9) size 183x198 scrollHeight 316
   LayoutTextControl {TEXTAREA} at (0,0) size 200x200 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 179x312
-      LayoutText {#text} at (0,0) size 84x13
-        text run at (0,0) width 84: "Lots of content."
-      LayoutBR {BR} at (83,11) size 1x0
-      LayoutText {#text} at (0,13) size 84x13
-        text run at (0,13) width 84: "Lots of content."
-      LayoutBR {BR} at (83,24) size 1x0
-      LayoutText {#text} at (0,26) size 84x13
-        text run at (0,26) width 84: "Lots of content."
-      LayoutBR {BR} at (83,37) size 1x0
-      LayoutText {#text} at (0,39) size 84x13
-        text run at (0,39) width 84: "Lots of content."
-      LayoutBR {BR} at (83,50) size 1x0
+      LayoutText {#text} at (0,0) size 79x13
+        text run at (0,0) width 79: "Lots of content."
+      LayoutBR {BR} at (78,11) size 1x0
+      LayoutText {#text} at (0,13) size 79x13
+        text run at (0,13) width 79: "Lots of content."
+      LayoutBR {BR} at (78,24) size 1x0
+      LayoutText {#text} at (0,26) size 79x13
+        text run at (0,26) width 79: "Lots of content."
+      LayoutBR {BR} at (78,37) size 1x0
+      LayoutText {#text} at (0,39) size 79x13
+        text run at (0,39) width 79: "Lots of content."
+      LayoutBR {BR} at (78,50) size 1x0
       LayoutBR {BR} at (0,52) size 0x13
-      LayoutText {#text} at (0,65) size 84x13
-        text run at (0,65) width 84: "Lots of content."
-      LayoutBR {BR} at (83,76) size 1x0
-      LayoutText {#text} at (0,78) size 84x13
-        text run at (0,78) width 84: "Lots of content."
-      LayoutBR {BR} at (83,89) size 1x0
+      LayoutText {#text} at (0,65) size 79x13
+        text run at (0,65) width 79: "Lots of content."
+      LayoutBR {BR} at (78,76) size 1x0
+      LayoutText {#text} at (0,78) size 79x13
+        text run at (0,78) width 79: "Lots of content."
+      LayoutBR {BR} at (78,89) size 1x0
       LayoutBR {BR} at (0,91) size 0x13
-      LayoutText {#text} at (0,104) size 84x13
-        text run at (0,104) width 84: "Lots of content."
-      LayoutBR {BR} at (83,115) size 1x0
-      LayoutText {#text} at (0,117) size 84x13
-        text run at (0,117) width 84: "Lots of content."
-      LayoutBR {BR} at (83,128) size 1x0
+      LayoutText {#text} at (0,104) size 79x13
+        text run at (0,104) width 79: "Lots of content."
+      LayoutBR {BR} at (78,115) size 1x0
+      LayoutText {#text} at (0,117) size 79x13
+        text run at (0,117) width 79: "Lots of content."
+      LayoutBR {BR} at (78,128) size 1x0
       LayoutBR {BR} at (0,130) size 0x13
-      LayoutText {#text} at (0,143) size 84x13
-        text run at (0,143) width 84: "Lots of content."
-      LayoutBR {BR} at (83,154) size 1x0
-      LayoutText {#text} at (0,156) size 84x13
-        text run at (0,156) width 84: "Lots of content."
-      LayoutBR {BR} at (83,167) size 1x0
+      LayoutText {#text} at (0,143) size 79x13
+        text run at (0,143) width 79: "Lots of content."
+      LayoutBR {BR} at (78,154) size 1x0
+      LayoutText {#text} at (0,156) size 79x13
+        text run at (0,156) width 79: "Lots of content."
+      LayoutBR {BR} at (78,167) size 1x0
       LayoutBR {BR} at (0,169) size 0x13
-      LayoutText {#text} at (0,182) size 84x13
-        text run at (0,182) width 84: "Lots of content."
-      LayoutBR {BR} at (83,193) size 1x0
-      LayoutText {#text} at (0,195) size 84x13
-        text run at (0,195) width 84: "Lots of content."
-      LayoutBR {BR} at (83,206) size 1x0
+      LayoutText {#text} at (0,182) size 79x13
+        text run at (0,182) width 79: "Lots of content."
+      LayoutBR {BR} at (78,193) size 1x0
+      LayoutText {#text} at (0,195) size 79x13
+        text run at (0,195) width 79: "Lots of content."
+      LayoutBR {BR} at (78,206) size 1x0
       LayoutBR {BR} at (0,208) size 0x13
-      LayoutText {#text} at (0,221) size 84x13
-        text run at (0,221) width 84: "Lots of content."
-      LayoutBR {BR} at (83,232) size 1x0
-      LayoutText {#text} at (0,234) size 84x13
-        text run at (0,234) width 84: "Lots of content."
-      LayoutBR {BR} at (83,245) size 1x0
+      LayoutText {#text} at (0,221) size 79x13
+        text run at (0,221) width 79: "Lots of content."
+      LayoutBR {BR} at (78,232) size 1x0
+      LayoutText {#text} at (0,234) size 79x13
+        text run at (0,234) width 79: "Lots of content."
+      LayoutBR {BR} at (78,245) size 1x0
       LayoutBR {BR} at (0,247) size 0x13
-      LayoutText {#text} at (0,260) size 84x13
-        text run at (0,260) width 84: "Lots of content."
-      LayoutBR {BR} at (83,271) size 1x0
-      LayoutText {#text} at (0,273) size 84x13
-        text run at (0,273) width 84: "Lots of content."
-      LayoutBR {BR} at (83,284) size 1x0
+      LayoutText {#text} at (0,260) size 79x13
+        text run at (0,260) width 79: "Lots of content."
+      LayoutBR {BR} at (78,271) size 1x0
+      LayoutText {#text} at (0,273) size 79x13
+        text run at (0,273) width 79: "Lots of content."
+      LayoutBR {BR} at (78,284) size 1x0
       LayoutBR {BR} at (0,286) size 0x13
       LayoutBR {BR} at (0,299) size 0x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.png
index edf0d02f..7709935e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.txt
index fc02624b..ca38865 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-scrolled-type-expected.txt
@@ -41,38 +41,38 @@
       LayoutText {#text} at (0,104) size 7x13
         text run at (0,104) width 7: "9"
       LayoutBR {BR} at (6,115) size 1x0
-      LayoutText {#text} at (0,117) size 14x13
-        text run at (0,117) width 14: "10"
-      LayoutBR {BR} at (13,128) size 1x0
-      LayoutText {#text} at (0,130) size 14x13
-        text run at (0,130) width 14: "11"
-      LayoutBR {BR} at (13,141) size 1x0
-      LayoutText {#text} at (0,143) size 14x13
-        text run at (0,143) width 14: "12"
-      LayoutBR {BR} at (13,154) size 1x0
-      LayoutText {#text} at (0,156) size 14x13
-        text run at (0,156) width 14: "13"
-      LayoutBR {BR} at (13,167) size 1x0
-      LayoutText {#text} at (0,169) size 14x13
-        text run at (0,169) width 14: "14"
-      LayoutBR {BR} at (13,180) size 1x0
-      LayoutText {#text} at (0,182) size 14x13
-        text run at (0,182) width 14: "15"
-      LayoutBR {BR} at (13,193) size 1x0
-      LayoutText {#text} at (0,195) size 14x13
-        text run at (0,195) width 14: "16"
-      LayoutBR {BR} at (13,206) size 1x0
-      LayoutText {#text} at (0,208) size 14x13
-        text run at (0,208) width 14: "17"
-      LayoutBR {BR} at (13,219) size 1x0
-      LayoutText {#text} at (0,221) size 43x13
-        text run at (0,221) width 43: "18 Pass"
-      LayoutBR {BR} at (42,232) size 1x0
-      LayoutText {#text} at (0,234) size 14x13
-        text run at (0,234) width 14: "19"
-      LayoutBR {BR} at (13,245) size 1x0
-      LayoutText {#text} at (0,247) size 14x13
-        text run at (0,247) width 14: "20"
-      LayoutBR {BR} at (13,258) size 1x0
+      LayoutText {#text} at (0,117) size 13x13
+        text run at (0,117) width 13: "10"
+      LayoutBR {BR} at (12,128) size 1x0
+      LayoutText {#text} at (0,130) size 13x13
+        text run at (0,130) width 13: "11"
+      LayoutBR {BR} at (12,141) size 1x0
+      LayoutText {#text} at (0,143) size 13x13
+        text run at (0,143) width 13: "12"
+      LayoutBR {BR} at (12,154) size 1x0
+      LayoutText {#text} at (0,156) size 13x13
+        text run at (0,156) width 13: "13"
+      LayoutBR {BR} at (12,167) size 1x0
+      LayoutText {#text} at (0,169) size 13x13
+        text run at (0,169) width 13: "14"
+      LayoutBR {BR} at (12,180) size 1x0
+      LayoutText {#text} at (0,182) size 13x13
+        text run at (0,182) width 13: "15"
+      LayoutBR {BR} at (12,193) size 1x0
+      LayoutText {#text} at (0,195) size 13x13
+        text run at (0,195) width 13: "16"
+      LayoutBR {BR} at (12,206) size 1x0
+      LayoutText {#text} at (0,208) size 13x13
+        text run at (0,208) width 13: "17"
+      LayoutBR {BR} at (12,219) size 1x0
+      LayoutText {#text} at (0,221) size 40x13
+        text run at (0,221) width 40: "18 Pass"
+      LayoutBR {BR} at (39,232) size 1x0
+      LayoutText {#text} at (0,234) size 13x13
+        text run at (0,234) width 13: "19"
+      LayoutBR {BR} at (12,245) size 1x0
+      LayoutText {#text} at (0,247) size 13x13
+        text run at (0,247) width 13: "20"
+      LayoutBR {BR} at (12,258) size 1x0
       LayoutBR {BR} at (0,260) size 0x13
 caret: position 7 of child 34 {#text} of child 0 {DIV} of {#document-fragment} of child 3 {TEXTAREA} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-setinnerhtml-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-setinnerhtml-expected.png
index c1f46fc..d5773365 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-setinnerhtml-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-setinnerhtml-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-setinnerhtml-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-setinnerhtml-expected.txt
index 1188cd92..c76da72 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-setinnerhtml-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea-setinnerhtml-expected.txt
@@ -7,5 +7,5 @@
 layer at (8,8) size 141x32 clip at (9,9) size 139x30
   LayoutTextControl {TEXTAREA} at (0,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 66x13
-        text run at (0,0) width 66: "Test Passed"
+      LayoutText {#text} at (0,0) size 62x13
+        text run at (0,0) width 62: "Test Passed"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-appearance-basic-expected.png
index f140121..d1d96cc6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-appearance-basic-expected.txt
index c6826c19..c23fb39 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-appearance-basic-expected.txt
@@ -17,65 +17,65 @@
       LayoutText {#text} at (149,162) size 4x18
         text run at (149,162) width 4: " "
       LayoutBR {BR} at (153,162) size 0x18
-      LayoutText {#text} at (209,236) size 4x18
-        text run at (209,236) width 4: " "
+      LayoutText {#text} at (189,236) size 4x18
+        text run at (189,236) width 4: " "
       LayoutText {#text} at (442,236) size 4x18
         text run at (442,236) width 4: " "
-      LayoutText {#text} at (715,236) size 4x18
-        text run at (715,236) width 4: " "
-      LayoutBR {BR} at (719,236) size 0x18
+      LayoutText {#text} at (735,236) size 4x18
+        text run at (735,236) width 4: " "
+      LayoutBR {BR} at (739,236) size 0x18
       LayoutText {#text} at (215,320) size 4x18
         text run at (215,320) width 4: " "
-      LayoutText {#text} at (482,320) size 4x18
-        text run at (482,320) width 4: " "
-      LayoutBR {BR} at (486,320) size 0x18
+      LayoutText {#text} at (502,320) size 4x18
+        text run at (502,320) width 4: " "
+      LayoutBR {BR} at (506,320) size 0x18
 layer at (12,12) size 141x32 clip at (13,13) size 139x30
   LayoutTextControl {TEXTAREA} at (4,4) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 18x13
-        text run at (0,0) width 18: "foo"
+      LayoutText {#text} at (0,0) size 17x13
+        text run at (0,0) width 17: "foo"
 layer at (12,56) size 145x36 clip at (15,59) size 139x30
   LayoutTextControl {TEXTAREA} at (4,48) size 145x36 [bgcolor=#FFFFFF] [border: (3px solid #00FF00)]
     LayoutBlockFlow {DIV} at (5,5) size 135x13
-      LayoutText {#text} at (0,0) size 18x13
-        text run at (0,0) width 18: "foo"
+      LayoutText {#text} at (0,0) size 17x13
+        text run at (0,0) width 17: "foo"
 layer at (169,60) size 141x32 clip at (170,61) size 139x30
   LayoutTextControl {TEXTAREA} at (161,52) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 18x13
-        text run at (0,0) width 18: "foo"
+      LayoutText {#text} at (0,0) size 17x13
+        text run at (0,0) width 17: "foo"
 layer at (12,104) size 141x32 clip at (13,105) size 139x30
   LayoutTextControl {TEXTAREA} at (4,96) size 141x32 [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 18x13
-        text run at (0,0) width 18: "foo"
+      LayoutText {#text} at (0,0) size 17x13
+        text run at (0,0) width 17: "foo"
 layer at (12,148) size 141x32 clip at (13,149) size 139x30
   LayoutTextControl {TEXTAREA} at (4,140) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 18x13
-        text run at (0,0) width 18: "foo"
-layer at (12,212) size 201x42 clip at (13,213) size 199x40
-  LayoutTextControl {TEXTAREA} at (4,204) size 201x42 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (3,3) size 195x18
+      LayoutText {#text} at (0,0) size 17x13
+        text run at (0,0) width 17: "foo"
+layer at (12,212) size 181x42 clip at (13,213) size 179x40
+  LayoutTextControl {TEXTAREA} at (4,204) size 181x42 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 175x18
       LayoutText {#text} at (0,0) size 24x18
         text run at (0,0) width 24: "foo"
-layer at (225,202) size 221x52 clip at (226,203) size 219x50
-  LayoutTextControl {TEXTAREA} at (217,194) size 221x52 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (3,3) size 215x23
-      LayoutText {#text} at (0,0) size 29x23
-        text run at (0,0) width 29: "foo"
-layer at (458,192) size 261x62 clip at (459,193) size 259x60
-  LayoutTextControl {TEXTAREA} at (450,184) size 261x62 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
-    LayoutBlockFlow {DIV} at (3,3) size 255x28
-      LayoutText {#text} at (0,0) size 35x28
-        text run at (0,0) width 35: "foo"
+layer at (205,202) size 241x52 clip at (206,203) size 239x50
+  LayoutTextControl {TEXTAREA} at (197,194) size 241x52 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 235x23
+      LayoutText {#text} at (0,0) size 30x23
+        text run at (0,0) width 30: "foo"
+layer at (458,192) size 281x62 clip at (459,193) size 279x60
+  LayoutTextControl {TEXTAREA} at (450,184) size 281x62 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+    LayoutBlockFlow {DIV} at (3,3) size 275x28
+      LayoutText {#text} at (0,0) size 36x28
+        text run at (0,0) width 36: "foo"
 layer at (14,290) size 203x46 clip at (15,291) size 201x44
   LayoutTextControl {TEXTAREA} at (6,282) size 203x46 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (4,4) size 195x19
       LayoutText {#text} at (0,0) size 25x19
         text run at (0,0) width 25: "foo"
-layer at (235,270) size 247x64 clip at (237,272) size 243x60
-  LayoutTextControl {TEXTAREA} at (227,262) size 247x64 [bgcolor=#FFFFFF] [border: (2px solid #000000)]
-    LayoutBlockFlow {DIV} at (6,6) size 235x26
-      LayoutText {#text} at (0,0) size 32x26
-        text run at (0,0) width 32: "foo"
+layer at (235,270) size 267x64 clip at (237,272) size 263x60
+  LayoutTextControl {TEXTAREA} at (227,262) size 267x64 [bgcolor=#FFFFFF] [border: (2px solid #000000)]
+    LayoutBlockFlow {DIV} at (6,6) size 255x26
+      LayoutText {#text} at (0,0) size 33x26
+        text run at (0,0) width 33: "foo"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-placeholder-paint-order-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-placeholder-paint-order-expected.png
index bed07fb..b056b22 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-placeholder-paint-order-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textarea/textarea-placeholder-paint-order-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.png
index 1842751..574a873 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt
index e6a995a..cbf0674 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-outline-expected.txt
@@ -6,10 +6,10 @@
       LayoutText {#text} at (0,0) size 563x18
         text run at (0,0) width 563: "This tests that a negative outline-offset won't get in the way of a cursor in a text control."
       LayoutBR {BR} at (562,14) size 1x0
-      LayoutTextControl {INPUT} at (0,18) size 213x27 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
+      LayoutTextControl {INPUT} at (0,18) size 232x27 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
       LayoutText {#text} at (0,0) size 0x0
-layer at (10,28) size 209x23 scrollWidth 553
-  LayoutBlockFlow {DIV} at (2,2) size 209x23
-    LayoutText {#text} at (0,0) size 554x23
-      text run at (0,0) width 554: "abcThis tests that typing doesn't cut holes in the focus outline"
+layer at (10,28) size 228x23 scrollWidth 564
+  LayoutBlockFlow {DIV} at (2,2) size 228x23
+    LayoutText {#text} at (0,0) size 564x23
+      text run at (0,0) width 564: "abcThis tests that typing doesn't cut holes in the focus outline"
 caret: position 3 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 3 {INPUT} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-overflow-by-value-update-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-overflow-by-value-update-expected.txt
index d53c4510..6608599 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-overflow-by-value-update-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/forms/textfield-overflow-by-value-update-expected.txt
@@ -8,5 +8,5 @@
       LayoutText {#text} at (0,0) size 0x0
 layer at (9,9) size 100x0 scrollHeight 38
   LayoutBlockFlow {DIV} at (1,1) size 100x0
-    LayoutText {#text} at (0,0) size 65x38
-      text run at (0,0) width 65: "FAIL"
+    LayoutText {#text} at (0,0) size 67x38
+      text run at (0,0) width 67: "FAIL"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.png
index b39e42c0..46429913 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.txt
index 840972e..49682c0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-summary-child-expected.txt
@@ -19,8 +19,8 @@
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {DIV} at (0,18) size 784x0
       LayoutBlockFlow (anonymous) at (0,18) size 784x18
-        LayoutButton {INPUT} at (0,0) size 40.28x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 24.28x13
-            LayoutText {#text} at (0,0) size 25x13
-              text run at (0,0) width 25: "click"
+        LayoutButton {INPUT} at (0,0) size 38.78x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 22.78x13
+            LayoutText {#text} at (0,0) size 23x13
+              text run at (0,0) width 23: "click"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-text-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-text-expected.png
index 72782e0..4241dc38 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-text-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-text-expected.txt
index 747b756..462c5f8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-text-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/html/details-replace-text-expected.txt
@@ -20,8 +20,8 @@
               text run at (0,0) width 63: "Details2"
           LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow (anonymous) at (0,36) size 784x18
-        LayoutButton {INPUT} at (0,0) size 40.28x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 24.28x13
-            LayoutText {#text} at (0,0) size 25x13
-              text run at (0,0) width 25: "click"
+        LayoutButton {INPUT} at (0,0) size 38.78x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 22.78x13
+            LayoutText {#text} at (0,0) size 23x13
+              text run at (0,0) width 23: "click"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/html/keygen-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/html/keygen-expected.png
index cb3482c..22fa98b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/html/keygen-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/html/keygen-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/html/keygen-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/html/keygen-expected.txt
index f10c15ff..2d67c5d3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/html/keygen-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/html/keygen-expected.txt
@@ -3,9 +3,9 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutBlockFlow {KEYGEN} at (0,0) size 146x18
-        LayoutMenuList {SELECT} at (0,0) size 146x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 146x18
-            LayoutText (anonymous) at (8,2) size 97x13
-              text run at (8,2) width 97: "2048 (High Grade)"
+      LayoutBlockFlow {KEYGEN} at (0,0) size 140x18
+        LayoutMenuList {SELECT} at (0,0) size 140x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 140x18
+            LayoutText (anonymous) at (8,2) size 91x13
+              text run at (8,2) width 91: "2048 (High Grade)"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/images/12-55-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/images/12-55-expected.png
index 54668ff..5a650fb 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/images/12-55-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/images/12-55-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/images/182-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/images/182-expected.png
index 732c97d..d8a6eea 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/images/182-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/images/182-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/images/2-dht-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/images/2-dht-expected.png
index 447ffd5b..f249c5f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/images/2-dht-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/images/2-dht-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/images/23-55-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/images/23-55-expected.png
index 8f7c7ad..0ec9979 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/images/23-55-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/images/23-55-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/images/55-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/images/55-expected.png
index 81ae4b7e..832167ea 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/images/55-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/images/55-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/lists/dynamic-marker-crash-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/lists/dynamic-marker-crash-expected.png
index c03009a96..5abf73b6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/lists/dynamic-marker-crash-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/lists/dynamic-marker-crash-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/lists/dynamic-marker-crash-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/lists/dynamic-marker-crash-expected.txt
index d263a05..59104876 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/lists/dynamic-marker-crash-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/lists/dynamic-marker-crash-expected.txt
@@ -15,5 +15,5 @@
               text run at (0,0) width 340: "There should be an input field above this line of text."
 layer at (51,19) size 245x13
   LayoutBlockFlow {DIV} at (3,3) size 245x13
-    LayoutText {#text} at (0,0) size 57x13
-      text run at (0,0) width 57: "blah blubb"
+    LayoutText {#text} at (0,0) size 54x13
+      text run at (0,0) width 54: "blah blubb"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/lists/markers-in-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/lists/markers-in-selection-expected.png
index 83f15ffc..e3ce350c1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/lists/markers-in-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/lists/markers-in-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png
index 5595721f..888cb01 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/multicol/multicol-with-child-renderLayer-for-input-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/multicol/multicol-with-child-renderLayer-for-input-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/multicol/multicol-with-child-renderLayer-for-input-expected.txt
index 8be8886..e894185 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/multicol/multicol-with-child-renderLayer-for-input-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/multicol/multicol-with-child-renderLayer-for-input-expected.txt
@@ -24,6 +24,6 @@
   LayoutTextControl (relative positioned) {INPUT} at (145.97,97) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
 layer at (157,108) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 39x13
-      text run at (0,0) width 39: "Testing"
+    LayoutText {#text} at (0,0) size 37x13
+      text run at (0,0) width 37: "Testing"
 caret: position 7 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 1 {INPUT} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-x-y-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-x-y-expected.png
index 73f411b..6a884de4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-x-y-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-x-y-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-x-y-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-x-y-expected.txt
index efd688c57..e7d3b8f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-x-y-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/overflow-x-y-expected.txt
@@ -75,10 +75,10 @@
 layer at (8,241) size 141x32 clip at (9,242) size 124x30
   LayoutTextControl {TEXTAREA} at (0,15) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 120x13
-      LayoutText {#text} at (0,0) size 89x13
-        text run at (0,0) width 89: "Textarea y-scroll"
+      LayoutText {#text} at (0,0) size 84x13
+        text run at (0,0) width 84: "Textarea y-scroll"
 layer at (153,226) size 141x47 clip at (154,227) size 139x30
   LayoutTextControl {TEXTAREA} at (145,0) size 141x47 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 89x13
-        text run at (0,0) width 89: "Textarea x-scroll"
+      LayoutText {#text} at (0,0) size 84x13
+        text run at (0,0) width 84: "Textarea x-scroll"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.png
index 3b3e2a1..48bcae2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.txt
index 8013a51a..5a8757e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.txt
@@ -12,8 +12,8 @@
         text run at (0,0) width 573: "This tests that we can scroll to reveal something in a nested positioned block in overflow."
     LayoutBlockFlow {DIV} at (0,18) size 572.31x800
     LayoutBlockFlow (anonymous) at (0,818) size 572.31x18
-      LayoutButton {INPUT} at (0,0) size 202.67x18 [bgcolor=#C0C0C0]
-        LayoutBlockFlow (anonymous) at (8,2) size 186.67x13
-          LayoutText {#text} at (0,0) size 187x13
-            text run at (0,0) width 187: "If you can see this, test has passed"
+      LayoutButton {INPUT} at (0,0) size 191.81x18 [bgcolor=#C0C0C0]
+        LayoutBlockFlow (anonymous) at (8,2) size 175.81x13
+          LayoutText {#text} at (0,0) size 176x13
+            text run at (0,0) width 176: "If you can see this, test has passed"
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/document-write-option-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/document-write-option-expected.png
index 1f1a9b87..c89be8cf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/document-write-option-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/document-write-option-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/document-write-option-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/document-write-option-expected.txt
index 8c3c28c..80c359a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/document-write-option-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/document-write-option-expected.txt
@@ -3,8 +3,8 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutMenuList {SELECT} at (0,0) size 319x18 [bgcolor=#F8F8F8]
-        LayoutBlockFlow (anonymous) at (0,0) size 319x18
-          LayoutText (anonymous) at (8,2) size 288x13
-            text run at (8,2) width 288: "This is a very long string so it makes the select bigger."
+      LayoutMenuList {SELECT} at (0,0) size 302x18 [bgcolor=#F8F8F8]
+        LayoutBlockFlow (anonymous) at (0,0) size 302x18
+          LayoutText (anonymous) at (8,2) size 271x13
+            text run at (8,2) width 271: "This is a very long string so it makes the select bigger."
       LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.png
index 0eaf64e..f621db1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.txt
index f8254056..5ec73d3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/entity-comment-in-textarea-expected.txt
@@ -8,6 +8,6 @@
 layer at (8,8) size 141x32 clip at (9,9) size 139x30
   LayoutTextControl {TEXTAREA} at (0,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 135x13
-      LayoutText {#text} at (0,0) size 23x13
-        text run at (0,0) width 20: "<!--"
-        text run at (19,0) width 4: " "
+      LayoutText {#text} at (0,0) size 22x13
+        text run at (0,0) width 19: "<!--"
+        text run at (18,0) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.png
index 9ad26a8..87d32b8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.txt
index 9b4932ab..e15f1da 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/parser/open-comment-in-textarea-expected.txt
@@ -8,12 +8,12 @@
 layer at (8,8) size 141x32 clip at (9,9) size 124x30 scrollHeight 56
   LayoutTextControl {TEXTAREA} at (0,0) size 141x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 120x52
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "<!--"
-      LayoutBR {BR} at (19,11) size 1x0
-      LayoutText {#text} at (0,13) size 119x26
-        text run at (0,13) width 116: "This should be part of"
-        text run at (115,13) width 4: " "
-        text run at (0,26) width 67: "the textarea."
-      LayoutBR {BR} at (66,37) size 1x0
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "<!--"
+      LayoutBR {BR} at (18,11) size 1x0
+      LayoutText {#text} at (0,13) size 112x26
+        text run at (0,13) width 109: "This should be part of"
+        text run at (108,13) width 4: " "
+        text run at (0,26) width 63: "the textarea."
+      LayoutBR {BR} at (62,37) size 1x0
       LayoutBR {BR} at (0,39) size 0x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
index be036f0..2f5e3ce9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/caret-invalidation-in-overflow-scroll-expected.txt
@@ -7,7 +7,7 @@
       "drawsContent": true,
       "repaintRects": [
         [407, 10, 4, 15],
-        [404, 10, 4, 15]
+        [405, 10, 4, 15]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow DIV id='inner-editor'",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/change-text-content-and-background-color-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/change-text-content-and-background-color-expected.txt
index 9ec5e1c..bb90eaaf1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/change-text-content-and-background-color-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/change-text-content-and-background-color-expected.txt
@@ -8,7 +8,7 @@
       "repaintRects": [
         [30, 30, 200, 23],
         [30, 30, 46, 23],
-        [30, 30, 41, 23],
+        [30, 30, 42, 23],
         [8, 8, 244, 67]
       ],
       "paintInvalidationClients": [
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/control-clip-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/control-clip-expected.txt
index 52742cb..ca0c8b2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/control-clip-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/control-clip-expected.txt
@@ -6,12 +6,12 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [84, 114, 48, 13],
-        [80, 114, 56, 13],
+        [85, 114, 46, 13],
+        [81, 114, 54, 13],
         [16, 114, 184, 13],
         [9, 84, 198, 14],
-        [9, 84, 55, 14],
-        [9, 84, 48, 14]
+        [9, 84, 53, 14],
+        [9, 84, 46, 14]
       ],
       "paintInvalidationClients": [
         "InlineTextBox ''",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/delete-into-nested-block-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/delete-into-nested-block-expected.txt
index d1b72df..23d1fb6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/delete-into-nested-block-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/delete-into-nested-block-expected.txt
@@ -6,7 +6,6 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [31, 119, 761, 37],
         [8, 155, 784, 19],
         [8, 155, 32, 19],
         [8, 137, 784, 37],
@@ -19,7 +18,6 @@
         [3, 114, 794, 111]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'one'",
         "LayoutText #text",
         "RootInlineBox",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-clear-expected.txt
index f1ec59f8..cd413be 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-clear-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-clear-expected.txt
@@ -6,11 +6,9 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [387, 123, 385, 392],
-        [387, 23, 385, 554]
+        [387, 123, 385, 392]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "LayoutText #text",
         "InlineTextBox '\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053'",
         "InlineTextBox '\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E'",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.txt
index 20682db..f8d5e71 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/japanese-rl-selection-repaint-expected.txt
@@ -6,7 +6,6 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [453, 556, 319, 21],
         [420, 23, 352, 553]
       ],
       "paintInvalidationClients": [
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/multi-layout-one-frame-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/multi-layout-one-frame-expected.txt
index 33e880f0..984f361 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/multi-layout-one-frame-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/multi-layout-one-frame-expected.txt
@@ -7,11 +7,11 @@
       "drawsContent": true,
       "repaintRects": [
         [146, 11, 125, 13],
-        [146, 11, 46, 13],
-        [146, 11, 40, 13],
+        [146, 11, 44, 13],
+        [146, 11, 38, 13],
         [11, 11, 125, 13],
-        [11, 11, 46, 13],
-        [11, 11, 40, 13]
+        [11, 11, 44, 13],
+        [11, 11, 38, 13]
       ],
       "paintInvalidationClients": [
         "InlineTextBox ''",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/overflow-move-after-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/overflow-move-after-scroll-expected.txt
index 70f8479..ca24542 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/overflow-move-after-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/overflow-move-after-scroll-expected.txt
@@ -31,11 +31,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow (positioned) DIV id='block'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/overflow-scroll-after-move-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/overflow-scroll-after-move-expected.txt
index 2865786..99164ed 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/overflow-scroll-after-move-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/overflow-scroll-after-move-expected.txt
@@ -31,11 +31,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow (positioned) DIV id='block'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.txt
index 08d1e658..f923dc8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/search-field-cancel-expected.txt
@@ -7,7 +7,7 @@
       "drawsContent": true,
       "repaintRects": [
         [17, 45, 108, 13],
-        [17, 45, 53, 13]
+        [17, 45, 50, 13]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow DIV id='inner-editor'",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-after-delete-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-after-delete-expected.txt
index e8be3f5..1a247b2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-after-delete-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-after-delete-expected.txt
@@ -10,8 +10,7 @@
         [38, 94, 152, 90],
         [38, 93, 152, 91],
         [38, 75, 152, 108],
-        [38, 74, 3, 20],
-        [8, 75, 784, 108]
+        [38, 74, 3, 20]
       ],
       "paintInvalidationClients": [
         "InlineTextBox 'hello world hello'",
@@ -26,7 +25,6 @@
         "InlineTextBox ' '",
         "InlineTextBox 'world hello'",
         "LayoutText #text",
-        "LayoutBlockFlow HTML",
         "RootInlineBox",
         "RootInlineBox",
         "RootInlineBox",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-after-remove-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-after-remove-expected.txt
index b11083f..f7267d8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-after-remove-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-after-remove-expected.txt
@@ -12,12 +12,9 @@
         [39, 75, 36, 18],
         [38, 94, 152, 90],
         [38, 93, 152, 91],
-        [38, 75, 152, 108],
-        [8, 75, 784, 108],
-        [8, 75, 784, 108]
+        [38, 75, 152, 108]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'world hello'",
         "InlineTextBox ' '",
         "InlineTextBox 'world hello world'",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-clear-expected.txt
index a4639fb..4c5157a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-clear-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-clear-expected.txt
@@ -8,16 +8,12 @@
       "repaintRects": [
         [8, 208, 100, 100],
         [8, 108, 100, 100],
-        [8, 49, 784, 159],
-        [8, 49, 784, 159],
-        [8, 49, 784, 59],
         [8, 49, 96, 118],
         [8, 49, 4, 18],
         [8, 8, 100, 200],
         [8, 8, 100, 100]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'FAIL: Test did'",
         "InlineTextBox 'not run'",
         "LayoutText #text",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
index 7ef1fcd..e688e99 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
@@ -6,10 +6,9 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [11, 33, 75, 18],
-        [11, 32, 778, 20],
-        [11, 11, 57, 18],
-        [11, 10, 778, 20]
+        [11, 33, 79, 18],
+        [11, 11, 61, 18],
+        [11, 11, 57, 18]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow HTML",
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/subtree-root-skipped-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/subtree-root-skipped-expected.txt
index ad47c77b..3f32cc3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/subtree-root-skipped-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/repaint/subtree-root-skipped-expected.txt
@@ -7,8 +7,8 @@
       "drawsContent": true,
       "repaintRects": [
         [11, 11, 125, 13],
-        [11, 11, 31, 13],
-        [11, 11, 24, 13],
+        [11, 11, 29, 13],
+        [11, 11, 23, 13],
         [8, 298, 10, 10],
         [8, 288, 10, 20]
       ],
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-expected.png
index 9c85723..6085053 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-expected.txt
index 58f9344b..37ffdd8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-expected.txt
@@ -10,32 +10,32 @@
         LayoutImage {IMG} at (1,39) size 27x27 [border: (1px solid #000000)]
         LayoutImage {IMG} at (1,66) size 27x27 [border: (1px solid #000000)]
         LayoutText {#text} at (0,0) size 0x0
-        LayoutButton {INPUT} at (1,93) size 42.58x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 26.58x13
-            LayoutText {#text} at (0,0) size 27x13
-              text run at (0,0) width 27: "input"
-        LayoutButton {INPUT} at (1,111) size 42.58x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 26.58x13
-            LayoutText {#text} at (0,0) size 27x13
-              text run at (0,0) width 27: "input"
+        LayoutButton {INPUT} at (1,93) size 41.08x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 25.08x13
+            LayoutText {#text} at (0,0) size 26x13
+              text run at (0,0) width 26: "input"
+        LayoutButton {INPUT} at (1,111) size 41.08x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 25.08x13
+            LayoutText {#text} at (0,0) size 26x13
+              text run at (0,0) width 26: "input"
         LayoutText {#text} at (0,0) size 0x0
-        LayoutButton {BUTTON} at (1,129) size 50.34x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 34.34x13
-            LayoutText {#text} at (0,0) size 35x13
-              text run at (0,0) width 35: "button"
-        LayoutButton {BUTTON} at (1,147) size 50.34x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 34.34x13
-            LayoutText {#text} at (0,0) size 35x13
-              text run at (0,0) width 35: "button"
+        LayoutButton {BUTTON} at (1,129) size 48.53x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 32.53x13
+            LayoutText {#text} at (0,0) size 33x13
+              text run at (0,0) width 33: "button"
+        LayoutButton {BUTTON} at (1,147) size 48.53x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 32.53x13
+            LayoutText {#text} at (0,0) size 33x13
+              text run at (0,0) width 33: "button"
         LayoutText {#text} at (0,0) size 0x0
-        LayoutMenuList {SELECT} at (1,165) size 63x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 63x18
-            LayoutText (anonymous) at (8,2) size 32x13
-              text run at (8,2) width 32: "select"
-        LayoutMenuList {SELECT} at (1,183) size 63x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 63x18
-            LayoutText (anonymous) at (8,2) size 32x13
-              text run at (8,2) width 32: "select"
+        LayoutMenuList {SELECT} at (1,165) size 61x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 61x18
+            LayoutText (anonymous) at (8,2) size 30x13
+              text run at (8,2) width 30: "select"
+        LayoutMenuList {SELECT} at (1,183) size 61x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 61x18
+            LayoutText (anonymous) at (8,2) size 30x13
+              text run at (8,2) width 30: "select"
         LayoutText {#text} at (0,0) size 0x0
         LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {INPUT} at (3.88,292) size 12x12
@@ -50,16 +50,16 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (12,31) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-layer at (9,209) size 48x45 clip at (10,210) size 35x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,201.44) size 48.42x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 35.42x14.19
-      LayoutText {#text} at (2,0) size 32x13
-        text run at (2,0) width 32: "select"
-layer at (9,253) size 48x45 clip at (10,254) size 35x43 scrollHeight 42
-  LayoutListBox {SELECT} at (1,245.44) size 48.42x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 35.42x14.19
-      LayoutText {#text} at (2,0) size 32x13
-        text run at (2,0) width 32: "select"
+layer at (9,209) size 47x45 clip at (10,210) size 34x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,201.44) size 46.61x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 33.61x14.19
+      LayoutText {#text} at (2,0) size 30x13
+        text run at (2,0) width 30: "select"
+layer at (9,253) size 47x45 clip at (10,254) size 34x43 scrollHeight 42
+  LayoutListBox {SELECT} at (1,245.44) size 46.61x44.56 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 33.61x14.19
+      LayoutText {#text} at (2,0) size 30x13
+        text run at (2,0) width 30: "select"
 layer at (9,371) size 27x27
   LayoutIFrame {IFRAME} at (1,363) size 27x27 [border: (1px solid #000000)]
     layer at (0,0) size 25x25
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-mixture-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-mixture-expected.png
index 417a919..10a3df1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-mixture-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-mixture-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-mixture-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-mixture-expected.txt
index 08e2df0..32faaa8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-mixture-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/replaced-breaking-mixture-expected.txt
@@ -10,10 +10,10 @@
       LayoutBlockFlow {DIV} at (0,43) size 10x36
         LayoutText {#text} at (0,0) size 25x18
           text run at (0,0) width 25: "Foo"
-        LayoutMenuList {SELECT} at (0,18) size 53x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 53x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+        LayoutMenuList {SELECT} at (0,18) size 52x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 52x18
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
       LayoutBlockFlow {DIV} at (0,79) size 10x37
         LayoutText {#text} at (0,0) size 25x18
           text run at (0,0) width 25: "Foo"
@@ -23,10 +23,10 @@
         LayoutText {#text} at (0,25) size 25x18
           text run at (0,25) width 25: "Foo"
       LayoutBlockFlow {DIV} at (0,159) size 10x36
-        LayoutMenuList {SELECT} at (0,0) size 53x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 53x18
-            LayoutText (anonymous) at (8,2) size 22x13
-              text run at (8,2) width 22: "One"
+        LayoutMenuList {SELECT} at (0,0) size 52x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 52x18
+            LayoutText (anonymous) at (8,2) size 21x13
+              text run at (8,2) width 21: "One"
         LayoutText {#text} at (0,18) size 25x18
           text run at (0,18) width 25: "Foo"
       LayoutBlockFlow {DIV} at (0,195) size 10x37
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-button-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-button-expected.png
index 4e6fb3ef..e03cc18 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-button-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-button-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-button-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-button-expected.txt
index 5e00db6..9a26505 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-button-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-button-expected.txt
@@ -9,22 +9,22 @@
       LayoutTable {TABLE} at (0,18) size 784x22
         LayoutTableSection {TBODY} at (0,0) size 784x22
           LayoutTableRow {TR} at (0,1) size 784x20
-            LayoutTableCell {TD} at (1,1) size 67x20 [r=0 c=0 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,1) size 65x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 49x13
-                  LayoutText {#text} at (0,0) size 49x13
-                    text run at (0,0) width 49: "New Mail"
-            LayoutTableCell {TD} at (69,1) size 48x20 [r=0 c=1 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,1) size 46x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 30x13
-                  LayoutText {#text} at (0,0) size 30x13
-                    text run at (0,0) width 30: "Reply"
-            LayoutTableCell {TD} at (118,1) size 65x20 [r=0 c=2 rs=1 cs=1]
+            LayoutTableCell {TD} at (1,1) size 65x20 [r=0 c=0 rs=1 cs=1]
               LayoutButton {INPUT} at (1,1) size 63x18 [bgcolor=#C0C0C0]
                 LayoutBlockFlow (anonymous) at (8,2) size 47x13
                   LayoutText {#text} at (0,0) size 47x13
-                    text run at (0,0) width 47: "Reply All"
-            LayoutTableCell {TD} at (184,1) size 599x20 [r=0 c=3 rs=1 cs=1]
+                    text run at (0,0) width 47: "New Mail"
+            LayoutTableCell {TD} at (67,1) size 47x20 [r=0 c=1 rs=1 cs=1]
+              LayoutButton {INPUT} at (1,1) size 45x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 29x13
+                  LayoutText {#text} at (0,0) size 29x13
+                    text run at (0,0) width 29: "Reply"
+            LayoutTableCell {TD} at (115,1) size 62x20 [r=0 c=2 rs=1 cs=1]
+              LayoutButton {INPUT} at (1,1) size 60x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 44x13
+                  LayoutText {#text} at (0,0) size 44x13
+                    text run at (0,0) width 44: "Reply All"
+            LayoutTableCell {TD} at (178,1) size 605x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
       LayoutBlockFlow (anonymous) at (0,40) size 784x36
@@ -33,21 +33,21 @@
       LayoutTable {TABLE} at (0,76) size 784x22
         LayoutTableSection {TBODY} at (0,0) size 784x22
           LayoutTableRow {TR} at (0,1) size 784x20
-            LayoutTableCell {TD} at (1,1) size 67x20 [r=0 c=0 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,1) size 65x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 49x13
-                  LayoutText {#text} at (0,0) size 49x13
-                    text run at (0,0) width 49: "New Mail"
-            LayoutTableCell {TD} at (69,1) size 48x20 [r=0 c=1 rs=1 cs=1]
-              LayoutButton {INPUT} at (1,1) size 46x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 30x13
-                  LayoutText {#text} at (0,0) size 30x13
-                    text run at (0,0) width 30: "Reply"
-            LayoutTableCell {TD} at (118,1) size 65x20 [r=0 c=2 rs=1 cs=1]
+            LayoutTableCell {TD} at (1,1) size 65x20 [r=0 c=0 rs=1 cs=1]
               LayoutButton {INPUT} at (1,1) size 63x18 [bgcolor=#C0C0C0]
                 LayoutBlockFlow (anonymous) at (8,2) size 47x13
                   LayoutText {#text} at (0,0) size 47x13
-                    text run at (0,0) width 47: "Reply All"
-            LayoutTableCell {TD} at (184,1) size 599x20 [r=0 c=3 rs=1 cs=1]
+                    text run at (0,0) width 47: "New Mail"
+            LayoutTableCell {TD} at (67,1) size 47x20 [r=0 c=1 rs=1 cs=1]
+              LayoutButton {INPUT} at (1,1) size 45x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 29x13
+                  LayoutText {#text} at (0,0) size 29x13
+                    text run at (0,0) width 29: "Reply"
+            LayoutTableCell {TD} at (115,1) size 62x20 [r=0 c=2 rs=1 cs=1]
+              LayoutButton {INPUT} at (1,1) size 60x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 44x13
+                  LayoutText {#text} at (0,0) size 44x13
+                    text run at (0,0) width 44: "Reply All"
+            LayoutTableCell {TD} at (178,1) size 605x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-menulist-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-menulist-expected.txt
index a6b6294..f743277 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-menulist-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-menulist-expected.txt
@@ -12,18 +12,18 @@
             LayoutTableCell {TD} at (1,1) size 2x20 [r=0 c=0 rs=1 cs=1]
               LayoutMenuList {SELECT} at (1,1) size 0x18 [bgcolor=#F8F8F8]
                 LayoutBlockFlow (anonymous) at (0,0) size 31x18
-                  LayoutText (anonymous) at (8,2) size 20x13
-                    text run at (8,2) width 20: "one"
+                  LayoutText (anonymous) at (8,2) size 19x13
+                    text run at (8,2) width 19: "one"
             LayoutTableCell {TD} at (4,1) size 2x20 [r=0 c=1 rs=1 cs=1]
               LayoutMenuList {SELECT} at (1,1) size 0x18 [bgcolor=#F8F8F8]
                 LayoutBlockFlow (anonymous) at (0,0) size 31x18
-                  LayoutText (anonymous) at (8,2) size 20x13
-                    text run at (8,2) width 20: "two"
+                  LayoutText (anonymous) at (8,2) size 19x13
+                    text run at (8,2) width 19: "two"
             LayoutTableCell {TD} at (7,1) size 2x20 [r=0 c=2 rs=1 cs=1]
               LayoutMenuList {SELECT} at (1,1) size 0x18 [bgcolor=#F8F8F8]
                 LayoutBlockFlow (anonymous) at (0,0) size 31x18
-                  LayoutText (anonymous) at (8,2) size 27x13
-                    text run at (8,2) width 27: "three"
+                  LayoutText (anonymous) at (8,2) size 26x13
+                    text run at (8,2) width 26: "three"
             LayoutTableCell {TD} at (10,1) size 773x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt
index 9f53c43..7a2c6a7 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-searchfield-expected.txt
@@ -51,30 +51,30 @@
             LayoutTableCell {TD} at (34,1) size 749x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
-layer at (19,31) size 0x13 scrollWidth 49
-  LayoutBlockFlow {DIV} at (0,0) size 0x13
-    LayoutText {#text} at (0,0) size 49x13
-      text run at (0,0) width 49: "New Mail"
-layer at (30,31) size 0x13 scrollWidth 30
-  LayoutBlockFlow {DIV} at (0,0) size 0x13
-    LayoutText {#text} at (0,0) size 30x13
-      text run at (0,0) width 30: "Reply"
-layer at (41,31) size 0x13 scrollWidth 46
+layer at (19,31) size 0x13 scrollWidth 46
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 47x13
-      text run at (0,0) width 47: "Reply All"
-layer at (30,90) size 0x13 scrollWidth 49
+      text run at (0,0) width 47: "New Mail"
+layer at (30,31) size 0x13 scrollWidth 28
   LayoutBlockFlow {DIV} at (0,0) size 0x13
-    LayoutText {#text} at (0,0) size 49x13
-      text run at (0,0) width 49: "New Mail"
-layer at (41,90) size 0x13 scrollWidth 30
+    LayoutText {#text} at (0,0) size 29x13
+      text run at (0,0) width 29: "Reply"
+layer at (41,31) size 0x13 scrollWidth 44
   LayoutBlockFlow {DIV} at (0,0) size 0x13
-    LayoutText {#text} at (0,0) size 30x13
-      text run at (0,0) width 30: "Reply"
-layer at (52,90) size 0x13 scrollWidth 46
+    LayoutText {#text} at (0,0) size 44x13
+      text run at (0,0) width 44: "Reply All"
+layer at (30,90) size 0x13 scrollWidth 46
   LayoutBlockFlow {DIV} at (0,0) size 0x13
     LayoutText {#text} at (0,0) size 47x13
-      text run at (0,0) width 47: "Reply All"
+      text run at (0,0) width 47: "New Mail"
+layer at (41,90) size 0x13 scrollWidth 28
+  LayoutBlockFlow {DIV} at (0,0) size 0x13
+    LayoutText {#text} at (0,0) size 29x13
+      text run at (0,0) width 29: "Reply"
+layer at (52,90) size 0x13 scrollWidth 44
+  LayoutBlockFlow {DIV} at (0,0) size 0x13
+    LayoutText {#text} at (0,0) size 44x13
+      text run at (0,0) width 44: "Reply All"
 layer at (20,32) size 11x11 transparent
   LayoutBlockFlow {DIV} at (6,1) size 11x11
 layer at (31,32) size 11x11 transparent
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textarea-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textarea-expected.txt
index 33447ec..fb15f09 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textarea-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textarea-expected.txt
@@ -27,36 +27,36 @@
             LayoutTableCell {TD} at (28,8) size 755x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
-layer at (10,28) size 6x32 clip at (0,0) size 0x0 scrollWidth 9 scrollHeight 43
+layer at (10,28) size 6x32 clip at (0,0) size 0x0 scrollWidth 8 scrollHeight 43
   LayoutTextControl {TEXTAREA} at (1,1) size 6x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 0x39
       LayoutText {#text} at (0,0) size 7x39
         text run at (0,0) width 7: "o"
         text run at (0,13) width 7: "n"
-        text run at (0,26) width 7: "e"
-layer at (19,28) size 6x32 clip at (0,0) size 0x0 scrollWidth 11 scrollHeight 43
+        text run at (0,26) width 6: "e"
+layer at (19,28) size 6x32 clip at (0,0) size 0x0 scrollWidth 10 scrollHeight 43
   LayoutTextControl {TEXTAREA} at (1,1) size 6x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 0x39
       LayoutText {#text} at (0,0) size 9x39
         text run at (0,0) width 4: "t"
         text run at (0,13) width 9: "w"
         text run at (0,26) width 7: "o"
-layer at (28,28) size 6x32 clip at (0,0) size 0x0 scrollWidth 9 scrollHeight 69
+layer at (28,28) size 6x32 clip at (0,0) size 0x0 scrollWidth 8 scrollHeight 69
   LayoutTextControl {TEXTAREA} at (1,1) size 6x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 0x65
       LayoutText {#text} at (0,0) size 7x65
         text run at (0,0) width 4: "t"
         text run at (0,13) width 7: "h"
-        text run at (0,26) width 5: "r"
-        text run at (0,39) width 7: "e"
-        text run at (0,52) width 7: "e"
-layer at (10,100) size 6x32 clip at (0,0) size 0x0 scrollWidth 11 scrollHeight 173
+        text run at (0,26) width 4: "r"
+        text run at (0,39) width 6: "e"
+        text run at (0,52) width 6: "e"
+layer at (10,100) size 6x32 clip at (0,0) size 0x0 scrollWidth 10 scrollHeight 173
   LayoutTextControl {TEXTAREA} at (1,1) size 6x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 0x169
       LayoutText {#text} at (0,0) size 9x169
         text run at (0,0) width 7: "o"
         text run at (0,13) width 7: "n"
-        text run at (0,26) width 7: "e"
+        text run at (0,26) width 6: "e"
         text run at (0,39) width 0: " "
         text run at (0,52) width 4: "t"
         text run at (0,65) width 9: "w"
@@ -64,22 +64,22 @@
         text run at (0,91) width 0: " "
         text run at (0,104) width 4: "t"
         text run at (0,117) width 7: "h"
-        text run at (0,130) width 5: "r"
-        text run at (0,143) width 7: "e"
-        text run at (0,156) width 7: "e"
-layer at (19,100) size 6x32 clip at (0,0) size 0x0 scrollWidth 11 scrollHeight 43
+        text run at (0,130) width 4: "r"
+        text run at (0,143) width 6: "e"
+        text run at (0,156) width 6: "e"
+layer at (19,100) size 6x32 clip at (0,0) size 0x0 scrollWidth 10 scrollHeight 43
   LayoutTextControl {TEXTAREA} at (1,1) size 6x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 0x39
       LayoutText {#text} at (0,0) size 9x39
         text run at (0,0) width 4: "t"
         text run at (0,13) width 9: "w"
         text run at (0,26) width 7: "o"
-layer at (28,100) size 6x32 clip at (0,0) size 0x0 scrollWidth 9 scrollHeight 69
+layer at (28,100) size 6x32 clip at (0,0) size 0x0 scrollWidth 8 scrollHeight 69
   LayoutTextControl {TEXTAREA} at (1,1) size 6x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 0x65
       LayoutText {#text} at (0,0) size 7x65
         text run at (0,0) width 4: "t"
         text run at (0,13) width 7: "h"
-        text run at (0,26) width 5: "r"
-        text run at (0,39) width 7: "e"
-        text run at (0,52) width 7: "e"
+        text run at (0,26) width 4: "r"
+        text run at (0,39) width 6: "e"
+        text run at (0,52) width 6: "e"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textfield-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textfield-expected.txt
index cac6ea7..6bf7a23 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textfield-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/replaced/width100percent-textfield-expected.txt
@@ -33,27 +33,27 @@
             LayoutTableCell {TD} at (28,1) size 755x20 [r=0 c=3 rs=1 cs=1]
               LayoutText {#text} at (1,1) size 4x18
                 text run at (1,1) width 4: " "
-layer at (13,31) size 0x13 scrollWidth 49
-  LayoutBlockFlow {DIV} at (3,3) size 0x13
-    LayoutText {#text} at (0,0) size 49x13
-      text run at (0,0) width 49: "New Mail"
-layer at (22,31) size 0x13 scrollWidth 30
-  LayoutBlockFlow {DIV} at (3,3) size 0x13
-    LayoutText {#text} at (0,0) size 30x13
-      text run at (0,0) width 30: "Reply"
-layer at (31,31) size 0x13 scrollWidth 46
+layer at (13,31) size 0x13 scrollWidth 46
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 47x13
-      text run at (0,0) width 47: "Reply All"
-layer at (13,90) size 0x13 scrollWidth 49
+      text run at (0,0) width 47: "New Mail"
+layer at (22,31) size 0x13 scrollWidth 28
   LayoutBlockFlow {DIV} at (3,3) size 0x13
-    LayoutText {#text} at (0,0) size 49x13
-      text run at (0,0) width 49: "New Mail"
-layer at (22,90) size 0x13 scrollWidth 30
+    LayoutText {#text} at (0,0) size 29x13
+      text run at (0,0) width 29: "Reply"
+layer at (31,31) size 0x13 scrollWidth 44
   LayoutBlockFlow {DIV} at (3,3) size 0x13
-    LayoutText {#text} at (0,0) size 30x13
-      text run at (0,0) width 30: "Reply"
-layer at (31,90) size 0x13 scrollWidth 46
+    LayoutText {#text} at (0,0) size 44x13
+      text run at (0,0) width 44: "Reply All"
+layer at (13,90) size 0x13 scrollWidth 46
   LayoutBlockFlow {DIV} at (3,3) size 0x13
     LayoutText {#text} at (0,0) size 47x13
-      text run at (0,0) width 47: "Reply All"
+      text run at (0,0) width 47: "New Mail"
+layer at (22,90) size 0x13 scrollWidth 28
+  LayoutBlockFlow {DIV} at (3,3) size 0x13
+    LayoutText {#text} at (0,0) size 29x13
+      text run at (0,0) width 29: "Reply"
+layer at (31,90) size 0x13 scrollWidth 44
+  LayoutBlockFlow {DIV} at (3,3) size 0x13
+    LayoutText {#text} at (0,0) size 44x13
+      text run at (0,0) width 44: "Reply All"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/ruby/select-ruby-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/ruby/select-ruby-expected.png
index a8c197c..50335d5c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/ruby/select-ruby-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/ruby/select-ruby-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/064-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/064-expected.png
index 962e93e..7aca891f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/064-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/064-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/064-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/064-expected.txt
index 29179ce..885bde0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/064-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/selectors/064-expected.txt
@@ -10,8 +10,8 @@
               text run at (0,0) width 286: "This text should turn green while it is active."
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {P} at (0,34) size 784x19 [color=#00FF00]
-          LayoutButton {BUTTON} at (0,1) size 248.63x18 [color=#000000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 232.63x13
-              LayoutText {#text} at (0,0) size 233x13
-                text run at (0,0) width 233: "This text should turn green while it is active."
+          LayoutButton {BUTTON} at (0,1) size 234.44x18 [color=#000000] [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 218.44x13
+              LayoutText {#text} at (0,0) size 219x13
+                text run at (0,0) width 219: "This text should turn green while it is active."
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/spatial-navigation/snav-multiple-select-focusring-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/spatial-navigation/snav-multiple-select-focusring-expected.png
index 060c4a2..1f6b22d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/spatial-navigation/snav-multiple-select-focusring-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/spatial-navigation/snav-multiple-select-focusring-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt
index 193c11be..1f903d6c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/spatial-navigation/snav-multiple-select-focusring-expected.txt
@@ -5,11 +5,11 @@
     LayoutBlockFlow {BODY} at (8,8) size 784x59
       LayoutText {#text} at (0,0) size 0x0
       LayoutText {#text} at (0,0) size 0x0
-layer at (8,8) size 350x59 clip at (9,9) size 337x57 scrollHeight 56
-  LayoutListBox {SELECT} at (0,0.25) size 350.27x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 337.27x14.19 [color=#FFFFFF] [bgcolor=#0069D9]
-      LayoutText {#text} at (2,0) size 334x13
-        text run at (2,0) width 334: "make-the-item-long-enough-to-make-a-difference-in-pixel-test"
-    LayoutBlockFlow {OPTION} at (1,15.19) size 337.27x14.19
+layer at (8,8) size 332x59 clip at (9,9) size 319x57 scrollHeight 56
+  LayoutListBox {SELECT} at (0,0.25) size 332.16x58.75 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 319.16x14.19 [color=#FFFFFF] [bgcolor=#0069D9]
+      LayoutText {#text} at (2,0) size 316x13
+        text run at (2,0) width 316: "make-the-item-long-enough-to-make-a-difference-in-pixel-test"
+    LayoutBlockFlow {OPTION} at (1,15.19) size 319.16x14.19
       LayoutText {#text} at (2,0) size 7x13
         text run at (2,0) width 7: "b"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/append-cells2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/table/append-cells2-expected.png
index 367e3c4..4a34d10 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/append-cells2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/append-cells2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/append-cells2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/append-cells2-expected.txt
index 67cc20b..fc9def4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/append-cells2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/append-cells2-expected.txt
@@ -76,14 +76,14 @@
               LayoutText {#text} at (0,0) size 4x18
                 text run at (0,0) width 4: " "
       LayoutBlockFlow (anonymous) at (0,124) size 784x19
-        LayoutButton {BUTTON} at (0,1) size 43.91x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 27.91x13
-            LayoutText {#text} at (0,0) size 28x13
-              text run at (0,0) width 28: "show"
-        LayoutText {#text} at (43,0) size 5x18
-          text run at (43,0) width 5: " "
-        LayoutButton {BUTTON} at (47.91,1) size 38.55x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 22.55x13
-            LayoutText {#text} at (0,0) size 23x13
-              text run at (0,0) width 23: "hide"
+        LayoutButton {BUTTON} at (0,1) size 42.70x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 26.70x13
+            LayoutText {#text} at (0,0) size 27x13
+              text run at (0,0) width 27: "show"
+        LayoutText {#text} at (42,0) size 5x18
+          text run at (42,0) width 5: " "
+        LayoutButton {BUTTON} at (46.70,1) size 37.34x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 21.34x13
+            LayoutText {#text} at (0,0) size 22x13
+              text run at (0,0) width 22: "hide"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/remove-td-display-none-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/table/remove-td-display-none-expected.png
index 6ba774b..0573026c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/remove-td-display-none-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/remove-td-display-none-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/remove-td-display-none-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/remove-td-display-none-expected.txt
index 96026e6..fceec91 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/remove-td-display-none-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/remove-td-display-none-expected.txt
@@ -53,14 +53,14 @@
               LayoutText {#text} at (0,0) size 8x18
                 text run at (0,0) width 8: "4"
       LayoutBlockFlow (anonymous) at (0,88) size 784x19
-        LayoutButton {BUTTON} at (0,1) size 43.91x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 27.91x13
-            LayoutText {#text} at (0,0) size 28x13
-              text run at (0,0) width 28: "show"
-        LayoutText {#text} at (43,0) size 5x18
-          text run at (43,0) width 5: " "
-        LayoutButton {BUTTON} at (47.91,1) size 38.55x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 22.55x13
-            LayoutText {#text} at (0,0) size 23x13
-              text run at (0,0) width 23: "hide"
+        LayoutButton {BUTTON} at (0,1) size 42.70x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 26.70x13
+            LayoutText {#text} at (0,0) size 27x13
+              text run at (0,0) width 27: "show"
+        LayoutText {#text} at (42,0) size 5x18
+          text run at (42,0) width 5: " "
+        LayoutButton {BUTTON} at (46.70,1) size 37.34x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 21.34x13
+            LayoutText {#text} at (0,0) size 22x13
+              text run at (0,0) width 22: "hide"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/spanOverlapRepaint-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/table/spanOverlapRepaint-expected.png
index 7572c1c8..35acd71 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/spanOverlapRepaint-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/spanOverlapRepaint-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/spanOverlapRepaint-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/spanOverlapRepaint-expected.txt
index 9f2730a..c034e75 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/spanOverlapRepaint-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/spanOverlapRepaint-expected.txt
@@ -22,5 +22,5 @@
                       LayoutText {#text} at (0,0) size 0x0
 layer at (26,28) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 26x13
-      text run at (0,0) width 26: "hello"
+    LayoutText {#text} at (0,0) size 24x13
+      text run at (0,0) width 24: "hello"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/text-field-baseline-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/table/text-field-baseline-expected.png
index 071f536..5778beb6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/text-field-baseline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/text-field-baseline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/table/text-field-baseline-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/table/text-field-baseline-expected.txt
index e7353f01..7a14c98 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/table/text-field-baseline-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/table/text-field-baseline-expected.txt
@@ -89,12 +89,12 @@
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (36,266) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 19x13
-      text run at (0,0) width 19: "Bar"
+    LayoutText {#text} at (0,0) size 18x13
+      text run at (0,0) width 18: "Bar"
 layer at (36,285) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 19x13
-      text run at (0,0) width 19: "Bar"
+    LayoutText {#text} at (0,0) size 18x13
+      text run at (0,0) width 18: "Bar"
 layer at (36,304) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
 layer at (36,323) size 125x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/emphasis-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/emphasis-expected.png
index be70970..d6e0a52 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/emphasis-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/emphasis-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-listbox-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-listbox-expected.png
index 0d9e491..a072054 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-listbox-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-listbox-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-listbox-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-listbox-expected.txt
index 2947295..289f124 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-listbox-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-listbox-expected.txt
@@ -13,7 +13,7 @@
         LayoutText {#text} at (0,0) size 102x18
           text run at (0,0) width 102: "1) direction: rtl;"
         LayoutBR {BR} at (101,14) size 1x0
-        LayoutBR {BR} at (77,44) size 1x0
+        LayoutBR {BR} at (76,44) size 1x0
       LayoutBlockFlow {DIV} at (0,100) size 100x19
         LayoutText {#text} at (18,1) size 82x18
           text run at (18,1) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
@@ -23,7 +23,7 @@
         LayoutText {#text} at (0,18) size 102x18
           text run at (0,18) width 102: "2) direction: ltr;"
         LayoutBR {BR} at (101,32) size 1x0
-        LayoutBR {BR} at (77,62) size 1x0
+        LayoutBR {BR} at (76,62) size 1x0
       LayoutBlockFlow {DIV} at (0,185) size 100x19
         LayoutText {#text} at (0,1) size 82x18
           text run at (0,1) width 23: "abc"
@@ -33,28 +33,28 @@
         LayoutText {#text} at (0,18) size 72x18
           text run at (0,18) width 72: "3) No style"
         LayoutBR {BR} at (71,32) size 1x0
-        LayoutBR {BR} at (77,62) size 1x0
+        LayoutBR {BR} at (76,62) size 1x0
       LayoutBlockFlow {DIV} at (0,270) size 100x19
         LayoutText {#text} at (0,1) size 82x18
           text run at (0,1) width 23: "abc"
           text run at (22,1) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
       LayoutBlockFlow (anonymous) at (0,289) size 784x18
         LayoutBR {BR} at (0,0) size 0x18
-layer at (8,78) size 78x30 clip at (20,79) size 65x28
-  LayoutListBox {SELECT} at (0,17.63) size 77.69x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (12,1) size 64.69x14.19
-      LayoutText {#text} at (2,0) size 61x13
+layer at (8,78) size 77x30 clip at (20,79) size 64x28
+  LayoutListBox {SELECT} at (0,17.63) size 76.78x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (12,1) size 63.78x14.19
+      LayoutText {#text} at (2,0) size 60x13
         text run at (2,0) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-        text run at (43,0) width 20: "abc"
-layer at (8,163) size 78x30 clip at (9,164) size 65x28
-  LayoutListBox {SELECT} at (0,35.63) size 77.69x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 64.69x14.19
-      LayoutText {#text} at (2,0) size 61x13
-        text run at (2,0) width 20: "abc"
-        text run at (21,0) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-layer at (8,248) size 78x30 clip at (9,249) size 65x28
-  LayoutListBox {SELECT} at (0,35.63) size 77.69x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
-    LayoutBlockFlow {OPTION} at (1,1) size 64.69x14.19
-      LayoutText {#text} at (2,0) size 61x13
-        text run at (2,0) width 20: "abc"
-        text run at (21,0) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
+        text run at (43,0) width 19: "abc"
+layer at (8,163) size 77x30 clip at (9,164) size 64x28
+  LayoutListBox {SELECT} at (0,35.63) size 76.78x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 63.78x14.19
+      LayoutText {#text} at (2,0) size 60x13
+        text run at (2,0) width 19: "abc"
+        text run at (20,0) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
+layer at (8,248) size 77x30 clip at (9,249) size 64x28
+  LayoutListBox {SELECT} at (0,35.63) size 76.78x30.38 [bgcolor=#FFFFFF] [border: (1px solid #999999)]
+    LayoutBlockFlow {OPTION} at (1,1) size 63.78x14.19
+      LayoutText {#text} at (2,0) size 60x13
+        text run at (2,0) width 19: "abc"
+        text run at (20,0) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png
index c42dec93..9c53e6bc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt
index 9e6da28..63cad0e61 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/bidi-menulist-expected.txt
@@ -16,9 +16,9 @@
         LayoutBR {BR} at (285,14) size 1x0
         LayoutMenuList {SELECT} at (0,18) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (16,2) size 61x13
-              text run at (16,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
-              text run at (57,2) width 20: "abc"
+            LayoutText (anonymous) at (17,2) size 60x13
+              text run at (17,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
+              text run at (58,2) width 19: "abc"
         LayoutBR {BR} at (100,31) size 0x0
       LayoutBlockFlow {DIV} at (0,106) size 100x19
         LayoutText {#text} at (0,1) size 82x18
@@ -31,9 +31,9 @@
         LayoutBR {BR} at (117,32) size 1x0
         LayoutMenuList {SELECT} at (0,36) size 200x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 200x18
-            LayoutText (anonymous) at (8,2) size 61x13
-              text run at (8,2) width 20: "abc"
-              text run at (27,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
+            LayoutText (anonymous) at (8,2) size 60x13
+              text run at (8,2) width 19: "abc"
+              text run at (26,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
         LayoutBR {BR} at (200,49) size 0x0
       LayoutBlockFlow {DIV} at (0,179) size 200x19
         LayoutText {#text} at (0,1) size 82x18
@@ -46,9 +46,9 @@
         LayoutBR {BR} at (71,32) size 1x0
         LayoutMenuList {SELECT} at (0,36) size 100x18 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 100x18
-            LayoutText (anonymous) at (8,2) size 61x13
-              text run at (8,2) width 20: "abc"
-              text run at (27,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
+            LayoutText (anonymous) at (8,2) size 60x13
+              text run at (8,2) width 19: "abc"
+              text run at (26,2) width 42 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
         LayoutBR {BR} at (100,49) size 0x0
       LayoutBlockFlow {DIV} at (0,252) size 100x19
         LayoutText {#text} at (0,1) size 82x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png
index 00b3dc4b..c911633 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt
index a2c41ca..d1bb325 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/pop-up-button-text-alignment-and-direction-expected.txt
@@ -10,12 +10,12 @@
       LayoutBlockFlow {DIV} at (0,34) size 784x228
         LayoutMenuList {SELECT} at (0,0) size 500x21 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 500x21
-            LayoutText (anonymous) at (8,2) size 158x16
-              text run at (8,2) width 31: "First "
-              text run at (38,2) width 49 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}"
-              text run at (86,2) width 16: "03"
-              text run at (101,2) width 37 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
-              text run at (137,2) width 29: " fifth"
+            LayoutText (anonymous) at (8,2) size 153x16
+              text run at (8,2) width 30: "First "
+              text run at (37,2) width 48 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}"
+              text run at (84,2) width 16: "03"
+              text run at (99,2) width 36 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
+              text run at (134,2) width 27: " fifth"
         LayoutBlockFlow {DIV} at (0,21) size 470x36
           LayoutText {#text} at (10,10) size 163x16
             text run at (10,10) width 32: "First "
@@ -25,12 +25,12 @@
             text run at (141,10) width 32: " fifth"
         LayoutMenuList {SELECT} at (0,57) size 500x21 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 500x21
-            LayoutText (anonymous) at (8,2) size 158x16
-              text run at (8,2) width 24: "fifth"
-              text run at (31,2) width 53 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} "
-              text run at (83,2) width 16: "03"
-              text run at (98,2) width 41 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
-              text run at (138,2) width 28: "First"
+            LayoutText (anonymous) at (8,2) size 153x16
+              text run at (8,2) width 23: "fifth"
+              text run at (30,2) width 52 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} "
+              text run at (81,2) width 15: "03"
+              text run at (95,2) width 40 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
+              text run at (134,2) width 27: "First"
         LayoutBlockFlow {DIV} at (0,78) size 470x36
           LayoutText {#text} at (10,10) size 163x16
             text run at (10,10) width 27: "fifth"
@@ -40,27 +40,27 @@
             text run at (144,10) width 29: "First"
         LayoutMenuList {SELECT} at (0,114) size 500x21 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 500x21
-            LayoutText (anonymous) at (8,2) size 158x16
-              text run at (8,2) width 158 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
+            LayoutText (anonymous) at (8,2) size 153x16
+              text run at (8,2) width 153 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
         LayoutBlockFlow {DIV} at (0,135) size 470x36
           LayoutText {#text} at (10,10) size 163x16
             text run at (10,10) width 163 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
         LayoutMenuList {SELECT} at (0,171) size 500x21 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 500x21
-            LayoutText (anonymous) at (8,2) size 158x16
-              text run at (8,2) width 158 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
+            LayoutText (anonymous) at (8,2) size 153x16
+              text run at (8,2) width 153 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
         LayoutBlockFlow {DIV} at (0,192) size 470x36
           LayoutText {#text} at (10,10) size 163x16
             text run at (10,10) width 163 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
       LayoutBlockFlow {DIV} at (0,262) size 784x228
         LayoutMenuList {SELECT} at (0,0) size 500x21 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 500x21
-            LayoutText (anonymous) at (319,2) size 158x16
-              text run at (319,2) width 32: "First "
-              text run at (350,2) width 49 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}"
-              text run at (398,2) width 16: "03"
-              text run at (413,2) width 37 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
-              text run at (449,2) width 28: " fifth"
+            LayoutText (anonymous) at (324,2) size 153x16
+              text run at (324,2) width 30: "First "
+              text run at (354,2) width 48 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA}"
+              text run at (401,2) width 15: "03"
+              text run at (415,2) width 37 RTL: "\x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
+              text run at (451,2) width 26: " fifth"
         LayoutBlockFlow {DIV} at (0,21) size 470x36
           LayoutText {#text} at (297,10) size 163x16
             text run at (297,10) width 33: "First "
@@ -70,12 +70,12 @@
             text run at (429,10) width 31: " fifth"
         LayoutMenuList {SELECT} at (0,57) size 500x21 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 500x21
-            LayoutText (anonymous) at (319,2) size 158x16
-              text run at (319,2) width 25: "fifth"
-              text run at (343,2) width 53 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} "
-              text run at (395,2) width 16: "03"
-              text run at (410,2) width 40 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
-              text run at (450,2) width 27: "First"
+            LayoutText (anonymous) at (324,2) size 153x16
+              text run at (324,2) width 23: "fifth"
+              text run at (346,2) width 52 RTL: ") \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} "
+              text run at (397,2) width 16: "03"
+              text run at (412,2) width 40 RTL: " \x{5E9}\x{5E0}\x{5D9}\x{5D4} ("
+              text run at (451,2) width 26: "First"
         LayoutBlockFlow {DIV} at (0,78) size 470x36
           LayoutText {#text} at (297,10) size 163x16
             text run at (297,10) width 28: "fifth"
@@ -85,15 +85,15 @@
             text run at (432,10) width 28: "First"
         LayoutMenuList {SELECT} at (0,114) size 500x21 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 500x21
-            LayoutText (anonymous) at (319,2) size 158x16
-              text run at (319,2) width 158 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
+            LayoutText (anonymous) at (324,2) size 153x16
+              text run at (324,2) width 153 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
         LayoutBlockFlow {DIV} at (0,135) size 470x36
           LayoutText {#text} at (297,10) size 163x16
             text run at (297,10) width 163 LTR override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
         LayoutMenuList {SELECT} at (0,171) size 500x21 [bgcolor=#F8F8F8]
           LayoutBlockFlow (anonymous) at (0,0) size 500x21
-            LayoutText (anonymous) at (319,2) size 158x16
-              text run at (319,2) width 158 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
+            LayoutText (anonymous) at (324,2) size 153x16
+              text run at (324,2) width 153 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
         LayoutBlockFlow {DIV} at (0,192) size 470x36
           LayoutText {#text} at (297,10) size 163x16
             text run at (297,10) width 163 RTL override: "First \x{5E9}\x{5E0}\x{5D9}\x{5D4} (03) \x{5E8}\x{5D1}\x{5D9}\x{5E2}\x{5D9}\x{5EA} fifth"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.png
index e7029e55..94d1cd6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt
index 46ca74a..5de61a4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/international/unicode-bidi-plaintext-in-textarea-expected.txt
@@ -16,40 +16,40 @@
 layer at (8,44) size 321x58 clip at (9,45) size 319x56
   LayoutTextControl {TEXTAREA} at (0,0) size 321x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x39
-      LayoutText {#text} at (286,0) size 29x13
-        text run at (286,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
-      LayoutBR {BR} at (286,0) size 1x13
-      LayoutText {#text} at (0,13) size 29x13
-        text run at (0,13) width 29: "hello!"
-      LayoutBR {BR} at (28,13) size 1x13
+      LayoutText {#text} at (287,0) size 28x13
+        text run at (287,0) width 28 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
+      LayoutBR {BR} at (287,0) size 1x13
+      LayoutText {#text} at (0,13) size 27x13
+        text run at (0,13) width 27: "hello!"
+      LayoutBR {BR} at (26,13) size 1x13
       LayoutBR {BR} at (0,26) size 0x13
 layer at (8,106) size 321x58 clip at (9,107) size 319x56
   LayoutTextControl {TEXTAREA} at (0,62) size 321x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x39
-      LayoutText {#text} at (286,0) size 29x13
-        text run at (286,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
-      LayoutBR {BR} at (286,0) size 1x13
-      LayoutText {#text} at (0,13) size 29x13
-        text run at (0,13) width 29: "hello!"
-      LayoutBR {BR} at (28,13) size 1x13
+      LayoutText {#text} at (287,0) size 28x13
+        text run at (287,0) width 28 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
+      LayoutBR {BR} at (287,0) size 1x13
+      LayoutText {#text} at (0,13) size 27x13
+        text run at (0,13) width 27: "hello!"
+      LayoutBR {BR} at (26,13) size 1x13
       LayoutBR {BR} at (0,26) size 0x13
 layer at (8,168) size 321x58 clip at (9,169) size 319x56
   LayoutTextControl {TEXTAREA} at (0,124) size 321x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x39
-      LayoutText {#text} at (286,0) size 29x13
-        text run at (286,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
-      LayoutBR {BR} at (286,0) size 1x13
-      LayoutText {#text} at (0,13) size 29x13
-        text run at (0,13) width 29: "hello!"
-      LayoutBR {BR} at (28,13) size 1x13
+      LayoutText {#text} at (287,0) size 28x13
+        text run at (287,0) width 28 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
+      LayoutBR {BR} at (287,0) size 1x13
+      LayoutText {#text} at (0,13) size 27x13
+        text run at (0,13) width 27: "hello!"
+      LayoutBR {BR} at (26,13) size 1x13
       LayoutBR {BR} at (0,26) size 0x13
 layer at (8,230) size 321x58 clip at (9,231) size 319x56
   LayoutTextControl {TEXTAREA} at (0,186) size 321x58 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 315x39
-      LayoutText {#text} at (286,0) size 29x13
-        text run at (286,0) width 29 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
-      LayoutBR {BR} at (286,0) size 1x13
-      LayoutText {#text} at (0,13) size 29x13
-        text run at (0,13) width 29: "hello!"
-      LayoutBR {BR} at (28,13) size 1x13
+      LayoutText {#text} at (287,0) size 28x13
+        text run at (287,0) width 28 RTL: "\x{5E9}\x{5DC}\x{5D5}\x{5DD}!"
+      LayoutBR {BR} at (287,0) size 1x13
+      LayoutText {#text} at (0,13) size 27x13
+        text run at (0,13) width 27: "hello!"
+      LayoutBR {BR} at (26,13) size 1x13
       LayoutBR {BR} at (0,26) size 0x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/midword-break-before-surrogate-pair-expected.png
index 647ee93..269d03f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/midword-break-before-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/midword-break-before-surrogate-pair-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/midword-break-before-surrogate-pair-expected.txt
index d347bae..5aac7e2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/midword-break-before-surrogate-pair-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/midword-break-before-surrogate-pair-expected.txt
@@ -3,7 +3,19 @@
 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 186x114 [border: (3px solid #0000FF)]
-        LayoutText {#text} at (3,9) size 173x95
-          text run at (3,9) width 173: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
-          text run at (3,63) width 115: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,0) size 784x36
+        LayoutText {#text} at (0,0) size 765x36
+          text run at (0,0) width 765: "The following box should break the sequence of symbols at the 5 character mark and not overflow the blue box. This is"
+          text run at (0,18) width 253: "because U+1D49 is a number category "
+          text run at (252,18) width 298: "unicode character, for which break-all applies."
+      LayoutBlockFlow {DIV} at (0,52) size 186x104 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,3) size 173x98
+          text run at (3,3) width 173: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+          text run at (3,52) width 74: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,172) size 784x18
+        LayoutText {#text} at (0,0) size 779x18
+          text run at (0,0) width 539: "The following box should not break the sequence of symbols since U+1F1EF is not "
+          text run at (538,0) width 241: "a letter or number category character."
+      LayoutBlockFlow {DIV} at (0,206) size 186x55 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,3) size 576x49
+          text run at (3,3) width 576: "\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-hard-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-hard-linebreak-expected.png
index 48093ce..7223252 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-hard-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-hard-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painted-separately-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painted-separately-expected.png
index 948c953..39d0bba 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painted-separately-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painted-separately-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painting-hidpi-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painting-hidpi-expected.png
new file mode 100644
index 0000000..d1e219e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painting-hidpi-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painting-hidpi-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painting-hidpi-expected.txt
new file mode 100644
index 0000000..d610d10
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-painting-hidpi-expected.txt
@@ -0,0 +1,50 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x34
+  LayoutBlockFlow {HTML} at (0,0) size 800x34
+    LayoutBlockFlow {BODY} at (8,8) size 784x18
+      LayoutBlockFlow {DIV} at (0,0) size 300.39x18
+        LayoutInline {SPAN} at (0,0) size 38x18
+          LayoutText {#text} at (0,0) size 38x18
+            text run at (0,0) width 38: "There"
+        LayoutText {#text} at (37,0) size 5x18
+          text run at (37,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 43x18
+          LayoutText {#text} at (41,0) size 43x18
+            text run at (41,0) width 43: "should"
+        LayoutText {#text} at (83,0) size 5x18
+          text run at (83,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 17x18
+          LayoutText {#text} at (87,0) size 17x18
+            text run at (87,0) width 17: "be"
+        LayoutText {#text} at (103,0) size 5x18
+          text run at (103,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 17x18
+          LayoutText {#text} at (107,0) size 17x18
+            text run at (107,0) width 17: "no"
+        LayoutText {#text} at (123,0) size 5x18
+          text run at (123,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 36x18
+          LayoutText {#text} at (127,0) size 36x18
+            text run at (127,0) width 36: "white"
+        LayoutText {#text} at (162,0) size 5x18
+          text run at (162,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 30x18
+          LayoutText {#text} at (166,0) size 30x18
+            text run at (166,0) width 30: "gaps"
+        LayoutText {#text} at (195,0) size 5x18
+          text run at (195,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 55x18
+          LayoutText {#text} at (199,0) size 55x18
+            text run at (199,0) width 55: "between"
+        LayoutText {#text} at (253,0) size 5x18
+          text run at (253,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 40x18
+          LayoutText {#text} at (257,0) size 40x18
+            text run at (257,0) width 40: "words"
+        LayoutText {#text} at (296,0) size 5x18
+          text run at (296,0) width 5: "."
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutText {#text} at (0,0) size 0x0
+selection start: position 0 of child 0 {#text} of child 1 {SPAN} of child 1 {DIV} of body
+selection end:   position 1 of child 16 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-rect-rounding-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-rect-rounding-expected.png
index baa1e6d..870a469 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-rect-rounding-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/selection-rect-rounding-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/shaping/shaping-selection-rect-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/shaping/shaping-selection-rect-expected.png
index 378b8f5..e2ac9ce 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/shaping/shaping-selection-rect-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/shaping/shaping-selection-rect-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/textIteratorNilRenderer-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/textIteratorNilRenderer-expected.png
index fb245b1..9f6f843 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/textIteratorNilRenderer-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/textIteratorNilRenderer-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/textIteratorNilRenderer-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/text/textIteratorNilRenderer-expected.txt
index a9bde6d..885de10 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/textIteratorNilRenderer-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/textIteratorNilRenderer-expected.txt
@@ -5,22 +5,22 @@
     LayoutBlockFlow {BODY} at (8,8) size 784x584
       LayoutBlockFlow {CENTER} at (0,0) size 784x53
         LayoutBlockFlow {FORM} at (0,0) size 784x19
-          LayoutTable {TABLE} at (63,0) size 658x19
-            LayoutTableSection {TBODY} at (0,0) size 658x19
-              LayoutTableRow {TR} at (0,0) size 658x19
+          LayoutTable {TABLE} at (65,0) size 654x19
+            LayoutTableSection {TBODY} at (0,0) size 654x19
+              LayoutTableRow {TR} at (0,0) size 654x19
                 LayoutTableCell {TD} at (0,0) size 150x18 [r=0 c=0 rs=2 cs=1]
                   LayoutText {#text} at (0,0) size 4x18
                     text run at (0,0) width 4: " "
                 LayoutTableCell {TD} at (150,0) size 251x19 [r=0 c=1 rs=1 cs=1]
                   LayoutTextControl {INPUT} at (0,0) size 251x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                   LayoutText {#text} at (0,0) size 0x0
-                LayoutTableCell {TD} at (401,0) size 97x18 [r=0 c=2 rs=1 cs=1]
-                  LayoutButton {INPUT} at (0,0) size 96.41x18 [bgcolor=#C0C0C0]
-                    LayoutBlockFlow (anonymous) at (8,2) size 80.41x13
-                      LayoutText {#text} at (0,0) size 81x13
-                        text run at (0,0) width 81: "Search Froogle"
+                LayoutTableCell {TD} at (401,0) size 93x18 [r=0 c=2 rs=1 cs=1]
+                  LayoutButton {INPUT} at (0,0) size 92.19x18 [bgcolor=#C0C0C0]
+                    LayoutBlockFlow (anonymous) at (8,2) size 76.19x13
+                      LayoutText {#text} at (0,0) size 77x13
+                        text run at (0,0) width 77: "Search Froogle"
                   LayoutText {#text} at (0,0) size 0x0
-                LayoutTableCell {TD} at (498,0) size 160x18 [r=0 c=3 rs=2 cs=1]
+                LayoutTableCell {TD} at (494,0) size 160x18 [r=0 c=3 rs=2 cs=1]
                   LayoutInline {LABEL} at (0,0) size 116x13
                     LayoutText {#text} at (0,0) size 0x0
                     LayoutBlockFlow {INPUT} at (12.88,3) size 12x12
@@ -29,6 +29,6 @@
                   LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow (anonymous) at (0,35) size 784x18
           LayoutBR {BR} at (392,0) size 0x18
-layer at (224,11) size 245x13
+layer at (226,11) size 245x13
   LayoutBlockFlow {DIV} at (3,3) size 245x13
 caret: position 1 of child 0 {#text} of child 1 {TD} of child 0 {TR} of child 1 {TBODY} of child 1 {TABLE} of child 1 {FORM} of child 1 {CENTER} of body
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/whitespace/pre-wrap-overflow-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
index eb49420..9d41006 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
index cd5c4ce..aae781f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/horizontal-bt-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
index e91daf9..4391149 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-lr-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-lr-selection-expected.png
index 9b8f28a9..fd735395 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-lr-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-lr-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-lr-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-lr-selection-expected.txt
index cc7c7d4..5d34a5b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-lr-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-lr-selection-expected.txt
@@ -9,14 +9,14 @@
           text run at (38,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
           text run at (71,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
           text run at (104,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
-          text run at (137,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
+          text run at (137,0) width 383: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
           text run at (170,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
           text run at (203,0) width 392: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
           text run at (236,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
           text run at (269,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
-          text run at (302,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
+          text run at (302,0) width 383: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
           text run at (335,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
-          text run at (368,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
+          text run at (368,0) width 383: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
           text run at (401,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
           text run at (434,0) width 392: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
           text run at (467,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-rl-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-rl-selection-expected.png
index 6048045..4f5657c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-rl-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-rl-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-rl-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-rl-selection-expected.txt
index 0352946..69f4a4d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-rl-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/japanese-rl-selection-expected.txt
@@ -9,14 +9,14 @@
           text run at (38,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
           text run at (71,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
           text run at (104,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
-          text run at (137,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
+          text run at (137,0) width 383: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
           text run at (170,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
           text run at (203,0) width 392: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
           text run at (236,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
           text run at (269,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
-          text run at (302,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
+          text run at (302,0) width 383: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
           text run at (335,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
-          text run at (368,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
+          text run at (368,0) width 383: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
           text run at (401,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
           text run at (434,0) width 392: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
           text run at (467,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/vertical-lr-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/vertical-lr-replaced-selection-expected.png
index 73216d76..c1b419b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/vertical-lr-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/vertical-lr-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/vertical-rl-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/vertical-rl-replaced-selection-expected.png
index 89fe9cf..a97d970 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/vertical-rl-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/fast/writing-mode/vertical-rl-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.png b/third_party/WebKit/LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.png
index 7ec1c51..32c6fe8 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.txt
index 65fb88a..ddb65453 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/filesystem/input-display-expected.txt
@@ -6,9 +6,9 @@
       LayoutBlockFlow {DIV} at (0,0) size 102x102 [border: (1px solid #000000)]
       LayoutBlockFlow {FORM} at (0,152) size 784x18
         LayoutBlockFlow {P} at (0,0) size 784x18
-          LayoutFileUploadControl {INPUT} at (0,0) size 222x18 "hello.txt"
-            LayoutButton {INPUT} at (0,0) size 78.53x18 [bgcolor=#C0C0C0]
-              LayoutBlockFlow (anonymous) at (8,2) size 62.53x13
-                LayoutText {#text} at (0,0) size 63x13
-                  text run at (0,0) width 63: "Choose File"
+          LayoutFileUploadControl {INPUT} at (0,0) size 212x18 "hello.txt"
+            LayoutButton {INPUT} at (0,0) size 75.22x18 [bgcolor=#C0C0C0]
+              LayoutBlockFlow (anonymous) at (8,2) size 59.22x13
+                LayoutText {#text} at (0,0) size 60x13
+                  text run at (0,0) width 60: "Choose File"
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png b/third_party/WebKit/LayoutTests/platform/mac/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png
index 4173d9d..8c6f78e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/http/tests/webfont/popup-menu-load-webfont-after-open-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/invalidate-after-composited-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/invalidate-after-composited-scroll-expected.txt
index ac4db69..7600ce4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/invalidate-after-composited-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/paint/invalidation/invalidate-after-composited-scroll-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='target'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/selection/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/paint/selection/selection-within-composited-scroller-expected.txt
index c129f3c..7707fd0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/paint/selection/selection-within-composited-scroller-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/paint/selection/selection-within-composited-scroller-expected.txt
@@ -41,11 +41,6 @@
                     "LayoutBlockFlow DIV id='target'",
                     "LayoutText #text",
                     "InlineTextBox 'test'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/paint/selection/text-selection-newline-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac/paint/selection/text-selection-newline-br-expected.png
index 65720485..fcfe07d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/paint/selection/text-selection-newline-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/paint/selection/text-selection-newline-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/plugins/mouse-click-plugin-clears-selection-expected.png b/third_party/WebKit/LayoutTests/platform/mac/plugins/mouse-click-plugin-clears-selection-expected.png
index 5f23327..e044efb 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/plugins/mouse-click-plugin-clears-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/plugins/mouse-click-plugin-clears-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/plugins/mouse-click-plugin-clears-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/plugins/mouse-click-plugin-clears-selection-expected.txt
index 2eb6d2d..8fb9dc1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/plugins/mouse-click-plugin-clears-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/plugins/mouse-click-plugin-clears-selection-expected.txt
@@ -12,5 +12,5 @@
   LayoutEmbeddedObject {EMBED} at (0,0) size 100x100
 layer at (11,111) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 26x13
-      text run at (0,0) width 26: "hello"
+    LayoutText {#text} at (0,0) size 24x13
+      text run at (0,0) width 24: "hello"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.png
index 53bc81e0..abc056ea 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.txt
index b7dd1a5..7cab1e2 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/svg/custom/inline-svg-in-xhtml-expected.txt
@@ -26,9 +26,9 @@
           LayoutTextControl {input} at (113.75,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
           LayoutText {#text} at (0,0) size 0x0
         LayoutBlockFlow {p} at (14,74.59) size 688x19
-          LayoutButton {button} at (0,1) size 61.98x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 45.98x13
-              LayoutText {#text} at (0,0) size 46x13
-                text run at (0,0) width 46: "Activate!"
+          LayoutButton {button} at (0,1) size 59.27x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 43.27x13
+              LayoutText {#text} at (0,0) size 44x13
+                text run at (0,0) width 44: "Activate!"
 layer at (182,82) size 125x13
   LayoutBlockFlow {div} at (3,3) size 125x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/hixie/mixed/003-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/hixie/mixed/003-expected.png
index 0e3eaa4..2f6b3d4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/svg/hixie/mixed/003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/svg/hixie/mixed/003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/hixie/mixed/003-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/svg/hixie/mixed/003-expected.txt
index a00f33b5..d573a68 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/svg/hixie/mixed/003-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/svg/hixie/mixed/003-expected.txt
@@ -15,5 +15,5 @@
         LayoutText {#text} at (0,0) size 0x0
 layer at (11,19) size 305x13
   LayoutBlockFlow {div} at (3,3) size 305x13
-    LayoutText {#text} at (0,0) size 120x13
-      text run at (0,0) width 120: "This test has PASSED."
+    LayoutText {#text} at (0,0) size 114x13
+      text run at (0,0) width 114: "This test has PASSED."
diff --git a/third_party/WebKit/LayoutTests/platform/mac/svg/text/foreignObject-text-clipping-bug-expected.png b/third_party/WebKit/LayoutTests/platform/mac/svg/text/foreignObject-text-clipping-bug-expected.png
index c14fd35..3458b4f46 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/svg/text/foreignObject-text-clipping-bug-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/svg/text/foreignObject-text-clipping-bug-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1188-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1188-expected.png
index 7e3ad19..a37511c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1188-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1188-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1188-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1188-expected.txt
index 955d589..f0cf36f4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1188-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1188-expected.txt
@@ -15,22 +15,22 @@
               LayoutTableCell {TD} at (2,57) size 594x36 [bgcolor=#99CCCC] [r=1 c=0 rs=1 cs=3]
                 LayoutInline {FONT} at (0,0) size 128x15
                   LayoutInline {B} at (0,0) size 128x15
-                    LayoutText {#text} at (66,3) size 128x15
-                      text run at (66,3) width 128: "Search the Web with"
-                LayoutText {#text} at (193,1) size 5x18
-                  text run at (193,1) width 5: " "
-                LayoutMenuList {SELECT} at (197.55,2) size 82x18 [bgcolor=#F8F8F8]
-                  LayoutBlockFlow (anonymous) at (0,0) size 82x18
-                    LayoutText (anonymous) at (8,2) size 51x13
-                      text run at (8,2) width 51: "Netscape"
-                LayoutTextControl {INPUT} at (279.55,1) size 191x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-                LayoutText {#text} at (470,1) size 5x18
-                  text run at (470,1) width 5: " "
-                LayoutButton {INPUT} at (474.55,2) size 53.02x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 37.02x13
-                    LayoutText {#text} at (0,0) size 37x13
-                      text run at (0,0) width 37: "Search"
-                LayoutBR {BR} at (527,15) size 1x0
+                    LayoutText {#text} at (68,3) size 128x15
+                      text run at (68,3) width 128: "Search the Web with"
+                LayoutText {#text} at (195,1) size 5x18
+                  text run at (195,1) width 5: " "
+                LayoutMenuList {SELECT} at (199.95,2) size 79x18 [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 79x18
+                    LayoutText (anonymous) at (8,2) size 48x13
+                      text run at (8,2) width 48: "Netscape"
+                LayoutTextControl {INPUT} at (278.95,1) size 191x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+                LayoutText {#text} at (469,1) size 5x18
+                  text run at (469,1) width 5: " "
+                LayoutButton {INPUT} at (473.95,2) size 51.20x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 35.20x13
+                    LayoutText {#text} at (0,0) size 36x13
+                      text run at (0,0) width 36: "Search"
+                LayoutBR {BR} at (525,15) size 1x0
                 LayoutInline {SMALL} at (0,0) size 570x15
                   LayoutInline {A} at (0,0) size 101x15 [color=#0000EE]
                     LayoutText {#text} at (12,20) size 101x15
@@ -136,5 +136,5 @@
                   LayoutTableSection {TBODY} at (0,0) size 0x1
                     LayoutTableRow {TR} at (0,0) size 0x1
                       LayoutTableCell {TD} at (0,0) size 0x0 [r=0 c=0 rs=1 cs=1]
-layer at (293,79) size 185x13
+layer at (292,79) size 185x13
   LayoutBlockFlow {DIV} at (3,3) size 185x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1318-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1318-expected.png
index 6a4d16c55..65bddca5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1318-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1318-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1318-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1318-expected.txt
index 8ec1f4e..eab09ef 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1318-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug1318-expected.txt
@@ -18,32 +18,32 @@
                 LayoutBR {BR} at (392,55) size 0x17
               LayoutText {#text} at (0,0) size 0x0
           LayoutTableRow {TR} at (0,74) size 784x21
-            LayoutTableCell {TD} at (0,76) size 562x17 [r=1 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (0,76) size 564x17 [r=1 c=0 rs=1 cs=1]
               LayoutInline {FONT} at (0,0) size 141x15
-                LayoutText {#text} at (420,1) size 141x15
-                  text run at (420,1) width 141: "I agree with the program"
+                LayoutText {#text} at (422,1) size 141x15
+                  text run at (422,1) width 141: "I agree with the program"
               LayoutText {#text} at (0,0) size 0x0
-            LayoutTableCell {TD} at (562,74) size 72x21 [r=1 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (564,74) size 72x21 [r=1 c=1 rs=1 cs=1]
               LayoutBlockFlow {INPUT} at (3.88,4) size 12x13
           LayoutTableRow {TR} at (0,95) size 784x21
-            LayoutTableCell {TD} at (0,97) size 562x17 [r=2 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (0,97) size 564x17 [r=2 c=0 rs=1 cs=1]
               LayoutInline {FONT} at (0,0) size 153x15
-                LayoutText {#text} at (408,1) size 153x15
-                  text run at (408,1) width 153: "I think vouchers are wrong"
+                LayoutText {#text} at (410,1) size 153x15
+                  text run at (410,1) width 153: "I think vouchers are wrong"
               LayoutText {#text} at (0,0) size 0x0
-            LayoutTableCell {TD} at (562,95) size 72x21 [r=2 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (564,95) size 72x21 [r=2 c=1 rs=1 cs=1]
               LayoutBlockFlow {INPUT} at (3.88,4) size 12x13
           LayoutTableRow {TR} at (0,116) size 784x20
-            LayoutTableCell {TD} at (0,117) size 634x17 [r=3 c=0 rs=1 cs=2]
+            LayoutTableCell {TD} at (0,117) size 636x17 [r=3 c=0 rs=1 cs=2]
               LayoutInline {A} at (0,0) size 76x18 [color=#0000EE]
                 LayoutInline {FONT} at (0,0) size 76x15
-                  LayoutText {#text} at (279,1) size 76x15
-                    text run at (279,1) width 76: "View Results"
+                  LayoutText {#text} at (280,1) size 76x15
+                    text run at (280,1) width 76: "View Results"
               LayoutInline {FONT} at (0,0) size 1x15
                 LayoutText {#text} at (0,0) size 0x0
-            LayoutTableCell {TD} at (634,116) size 150x20 [r=3 c=2 rs=1 cs=2]
-              LayoutButton {INPUT} at (55.63,1) size 38.75x18 [bgcolor=#C0C0C0]
-                LayoutBlockFlow (anonymous) at (8,2) size 22.75x13
-                  LayoutText {#text} at (0,0) size 23x13
-                    text run at (0,0) width 23: "vote"
+            LayoutTableCell {TD} at (636,116) size 148x20 [r=3 c=2 rs=1 cs=2]
+              LayoutButton {INPUT} at (55.23,1) size 37.53x18 [bgcolor=#C0C0C0]
+                LayoutBlockFlow (anonymous) at (8,2) size 21.53x13
+                  LayoutText {#text} at (0,0) size 22x13
+                    text run at (0,0) width 22: "vote"
               LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug138725-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug138725-expected.png
index e3248ba..9d1c2578 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug138725-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug138725-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug138725-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug138725-expected.txt
index 92005ad..4fffb82 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug138725-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug138725-expected.txt
@@ -3,32 +3,32 @@
 layer at (0,0) size 800x600
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
-      LayoutTable {TABLE} at (0,0) size 147x52
-        LayoutTableSection {TBODY} at (0,0) size 147x52
-          LayoutTableRow {TR} at (0,2) size 147x48
-            LayoutTableCell {TD} at (2,2) size 143x48 [r=0 c=0 rs=1 cs=1]
-              LayoutBlockFlow (anonymous) at (1,1) size 141x0
+      LayoutTable {TABLE} at (0,0) size 141x52
+        LayoutTableSection {TBODY} at (0,0) size 141x52
+          LayoutTableRow {TR} at (0,2) size 141x48
+            LayoutTableCell {TD} at (2,2) size 137x48 [r=0 c=0 rs=1 cs=1]
+              LayoutBlockFlow (anonymous) at (1,1) size 135x0
                 LayoutInline {SPAN} at (0,0) size 0x0
                   LayoutText {#text} at (0,0) size 0x0
                   LayoutInline {SPAN} at (0,0) size 0x0
                     LayoutText {#text} at (0,0) size 0x0
                     LayoutText {#text} at (0,0) size 0x0
-              LayoutBlockFlow (anonymous) at (1,1) size 141x46
-                LayoutTable {TABLE} at (0,0) size 141x46
-                  LayoutTableSection {TBODY} at (0,0) size 141x46
-                    LayoutTableRow {TR} at (0,2) size 141x42
-                      LayoutTableCell {TD} at (2,2) size 137x42 [r=0 c=0 rs=1 cs=1]
-                        LayoutTable (floating) {TABLE} at (1,1) size 135x40
-                          LayoutTableSection {TBODY} at (0,0) size 135x40
-                            LayoutTableRow {TR} at (0,2) size 135x36
-                              LayoutTableCell {TD} at (2,2) size 131x36 [r=0 c=0 rs=1 cs=1]
-                                LayoutBlockFlow {FORM} at (1,1) size 129x18
-                                  LayoutButton {INPUT} at (0,0) size 128.25x18 [bgcolor=#C0C0C0]
-                                    LayoutBlockFlow (anonymous) at (8,2) size 112.25x13
-                                      LayoutText {#text} at (0,0) size 113x13
-                                        text run at (0,0) width 113: "ApplyForThisPosition"
+              LayoutBlockFlow (anonymous) at (1,1) size 135x46
+                LayoutTable {TABLE} at (0,0) size 135x46
+                  LayoutTableSection {TBODY} at (0,0) size 135x46
+                    LayoutTableRow {TR} at (0,2) size 135x42
+                      LayoutTableCell {TD} at (2,2) size 131x42 [r=0 c=0 rs=1 cs=1]
+                        LayoutTable (floating) {TABLE} at (1,1) size 129x40
+                          LayoutTableSection {TBODY} at (0,0) size 129x40
+                            LayoutTableRow {TR} at (0,2) size 129x36
+                              LayoutTableCell {TD} at (2,2) size 125x36 [r=0 c=0 rs=1 cs=1]
+                                LayoutBlockFlow {FORM} at (1,1) size 123x18
+                                  LayoutButton {INPUT} at (0,0) size 122.20x18 [bgcolor=#C0C0C0]
+                                    LayoutBlockFlow (anonymous) at (8,2) size 106.20x13
+                                      LayoutText {#text} at (0,0) size 107x13
+                                        text run at (0,0) width 107: "ApplyForThisPosition"
                                   LayoutText {#text} at (0,0) size 0x0
-              LayoutBlockFlow (anonymous) at (1,47) size 141x0
+              LayoutBlockFlow (anonymous) at (1,47) size 135x0
                 LayoutInline {SPAN} at (0,0) size 0x0
                   LayoutInline {SPAN} at (0,0) size 0x0
                   LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.png
index 2983cd5..1699608 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.txt
index 0be8a3c..a18d1471 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug18359-expected.txt
@@ -8,37 +8,37 @@
           text run at (0,0) width 364: "SeaMonkey XPInstall Trigger Page"
       LayoutBlockFlow {HR} at (0,47.91) size 784x2 [border: (1px inset #EEEEEE)]
       LayoutBlockFlow {FORM} at (0,57.91) size 784x47
-        LayoutTable {TABLE} at (0,0) size 602x47
-          LayoutTableSection {TBODY} at (0,0) size 602x47
-            LayoutTableRow {TR} at (0,2) size 602x21
+        LayoutTable {TABLE} at (0,0) size 598x47
+          LayoutTableSection {TBODY} at (0,0) size 598x47
+            LayoutTableRow {TR} at (0,2) size 598x21
               LayoutTableCell {TD} at (2,2) size 107x20 [r=0 c=0 rs=1 cs=1]
                 LayoutInline {B} at (0,0) size 96x18
                   LayoutText {#text} at (1,1) size 96x18
                     text run at (1,1) width 96: "Trigger URL:"
               LayoutTableCell {TD} at (111,2) size 403x21 [r=0 c=1 rs=1 cs=1]
                 LayoutTextControl {INPUT} at (1,1) size 401x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-              LayoutTableCell {TD} at (516,2) size 84x20 [r=0 c=2 rs=1 cs=1]
-                LayoutButton {INPUT} at (1,1) size 53.30x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 37.30x13
-                    LayoutText {#text} at (0,0) size 38x13
-                      text run at (0,0) width 38: "Trigger"
-            LayoutTableRow {TR} at (0,25) size 602x20
+              LayoutTableCell {TD} at (516,2) size 80x20 [r=0 c=2 rs=1 cs=1]
+                LayoutButton {INPUT} at (1,1) size 51.19x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 35.19x13
+                    LayoutText {#text} at (0,0) size 36x13
+                      text run at (0,0) width 36: "Trigger"
+            LayoutTableRow {TR} at (0,25) size 598x20
               LayoutTableCell {TD} at (2,25) size 107x20 [r=1 c=0 rs=1 cs=1]
                 LayoutInline {B} at (0,0) size 105x18
                   LayoutText {#text} at (1,1) size 105x18
                     text run at (1,1) width 105: "Run Test Case:"
               LayoutTableCell {TD} at (111,25) size 403x20 [r=1 c=1 rs=1 cs=1]
-                LayoutMenuList {SELECT} at (1,1) size 259x18 [bgcolor=#F8F8F8]
-                  LayoutBlockFlow (anonymous) at (0,0) size 259x18
-                    LayoutText (anonymous) at (8,2) size 71x13
-                      text run at (8,2) width 71: "a_abortinstall"
+                LayoutMenuList {SELECT} at (1,1) size 248x18 [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 248x18
+                    LayoutText (anonymous) at (8,2) size 67x13
+                      text run at (8,2) width 67: "a_abortinstall"
                 LayoutText {#text} at (0,0) size 0x0
-              LayoutTableCell {TD} at (516,25) size 84x20 [r=1 c=2 rs=1 cs=1]
-                LayoutButton {INPUT} at (1,1) size 81.52x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 65.52x13
-                    LayoutText {#text} at (0,0) size 66x13
-                      text run at (0,0) width 66: "Trigger case"
+              LayoutTableCell {TD} at (516,25) size 80x20 [r=1 c=2 rs=1 cs=1]
+                LayoutButton {INPUT} at (1,1) size 77.89x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 61.89x13
+                    LayoutText {#text} at (0,0) size 62x13
+                      text run at (0,0) width 62: "Trigger case"
 layer at (123,72) size 395x13
   LayoutBlockFlow {DIV} at (3,3) size 395x13
-    LayoutText {#text} at (0,0) size 96x13
-      text run at (0,0) width 96: "http://jimbob/jars/"
+    LayoutText {#text} at (0,0) size 90x13
+      text run at (0,0) width 90: "http://jimbob/jars/"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug194024-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug194024-expected.png
index 3469eed..cc5e073 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug194024-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug194024-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug194024-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug194024-expected.txt
index 47cb4dd8..a0f369d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug194024-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug194024-expected.txt
@@ -102,45 +102,45 @@
 layer at (20,26) size 760x32 clip at (21,27) size 758x30
   LayoutTextControl {TEXTAREA} at (0,0) size 760x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 754x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
 layer at (20,76) size 760x32 clip at (21,77) size 758x30
   LayoutTextControl {TEXTAREA} at (0,0) size 760x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 754x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
 layer at (24,128) size 752x32 clip at (25,129) size 750x30
   LayoutTextControl {TEXTAREA} at (0,0) size 752x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 746x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
 layer at (24,182) size 752x32 clip at (25,183) size 750x30
   LayoutTextControl {TEXTAREA} at (0,0) size 752x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 746x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
 layer at (27,237) size 746x32 clip at (28,238) size 744x30
   LayoutTextControl {TEXTAREA} at (1,1) size 746x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 740x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
 layer at (27,293) size 746x32 clip at (28,294) size 744x30
   LayoutTextControl {TEXTAREA} at (1,1) size 746x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 740x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
 layer at (24,348) size 752x32 clip at (25,349) size 750x30
   LayoutTextControl {TEXTAREA} at (1,1) size 752x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 746x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
 layer at (27,403) size 746x32 clip at (28,404) size 744x30
   LayoutTextControl {TEXTAREA} at (2,2) size 746x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 740x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
 layer at (31,461) size 738x32 clip at (32,462) size 736x30
   LayoutTextControl {TEXTAREA} at (2,2) size 738x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 732x13
-      LayoutText {#text} at (0,0) size 20x13
-        text run at (0,0) width 20: "test"
+      LayoutText {#text} at (0,0) size 19x13
+        text run at (0,0) width 19: "test"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-2-expected.png
index 75d69a5..76f42b9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-2-expected.txt
index 8b99125d..39151f4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-2-expected.txt
@@ -97,16 +97,16 @@
                     LayoutTextControl {INPUT} at (0,8) size 107x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
             LayoutText {#text} at (0,0) size 0x0
           LayoutBlockFlow {P} at (0,253) size 568x32
-            LayoutButton {INPUT} at (0,9) size 56.64x18 [bgcolor=#C0C0C0]
-              LayoutBlockFlow (anonymous) at (8,2) size 40.64x13
-                LayoutText {#text} at (0,0) size 41x13
-                  text run at (0,0) width 41: "Submit!"
-            LayoutText {#text} at (56,6) size 7x19
-              text run at (56,6) width 7: " "
-            LayoutButton {INPUT} at (62.27,9) size 74.50x18 [bgcolor=#C0C0C0]
-              LayoutBlockFlow (anonymous) at (8,2) size 58.50x13
-                LayoutText {#text} at (0,0) size 59x13
-                  text run at (0,0) width 59: "Clear Form"
+            LayoutButton {INPUT} at (0,9) size 54.53x18 [bgcolor=#C0C0C0]
+              LayoutBlockFlow (anonymous) at (8,2) size 38.53x13
+                LayoutText {#text} at (0,0) size 39x13
+                  text run at (0,0) width 39: "Submit!"
+            LayoutText {#text} at (54,6) size 7x19
+              text run at (54,6) width 7: " "
+            LayoutButton {INPUT} at (60.16,9) size 71.48x18 [bgcolor=#C0C0C0]
+              LayoutBlockFlow (anonymous) at (8,2) size 55.48x13
+                LayoutText {#text} at (0,0) size 56x13
+                  text run at (0,0) width 56: "Clear Form"
             LayoutText {#text} at (0,0) size 0x0
 layer at (159,291) size 101x13
   LayoutBlockFlow {DIV} at (3,3) size 101x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.png
index a0f59a1..def1716e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.txt
index 14338ba..202257e4 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-3-expected.txt
@@ -1,8 +1,8 @@
-layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 678
+layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 659
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 785x678 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
-  LayoutBlockFlow {HTML} at (0,0) size 785x677.50
-    LayoutBlockFlow {BODY} at (8,21.44) size 769x640.06
+layer at (0,0) size 785x659 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
+  LayoutBlockFlow {HTML} at (0,0) size 785x658.50
+    LayoutBlockFlow {BODY} at (8,21.44) size 769x621.06
       LayoutBlockFlow {H1} at (0,0) size 769x37
         LayoutText {#text} at (0,0) size 317x37
           text run at (0,0) width 317: "Generic Table Tests - 1"
@@ -62,28 +62,29 @@
       LayoutBlockFlow {H2} at (0,400.16) size 769x28
         LayoutText {#text} at (0,0) size 156x28
           text run at (0,0) width 156: "Submit Results"
-      LayoutBlockFlow {FORM} at (0,448.06) size 769x38
-        LayoutBlockFlow {P} at (0,0) size 769x38
+      LayoutBlockFlow {FORM} at (0,448.06) size 769x19
+        LayoutBlockFlow {P} at (0,0) size 769x19
           LayoutText {#text} at (0,0) size 267x18
             text run at (0,0) width 267: "How does your browser fare on this test? "
-          LayoutMenuList {SELECT} at (266.59,1) size 245x18 [bgcolor=#F8F8F8]
-            LayoutBlockFlow (anonymous) at (0,0) size 245x18
-              LayoutText (anonymous) at (8,2) size 140x13
-                text run at (8,2) width 140: "The test renders correctly."
-          LayoutText {#text} at (511,0) size 5x18
-            text run at (511,0) width 5: " "
+          LayoutMenuList {SELECT} at (266.59,1) size 232x18 [bgcolor=#F8F8F8]
+            LayoutBlockFlow (anonymous) at (0,0) size 232x18
+              LayoutText (anonymous) at (8,2) size 132x13
+                text run at (8,2) width 132: "The test renders correctly."
+          LayoutText {#text} at (498,0) size 5x18
+            text run at (498,0) width 5: " "
           LayoutInline {LABEL} at (0,0) size 204x18
-            LayoutText {#text} at (515,0) size 73x18
-              text run at (515,0) width 73: "Comment: "
-            LayoutTextControl {INPUT} at (587.14,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+            LayoutText {#text} at (502,0) size 73x18
+              text run at (502,0) width 73: "Comment: "
+            LayoutTextControl {INPUT} at (574.14,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+          LayoutText {#text} at (705,0) size 5x18
+            text run at (705,0) width 5: " "
+          LayoutButton {INPUT} at (709.14,1) size 51.64x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 35.64x13
+              LayoutText {#text} at (0,0) size 36x13
+                text run at (0,0) width 36: "Submit"
           LayoutText {#text} at (0,0) size 0x0
-          LayoutButton {INPUT} at (0,20) size 53.45x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 37.45x13
-              LayoutText {#text} at (0,0) size 38x13
-                text run at (0,0) width 38: "Submit"
-          LayoutText {#text} at (0,0) size 0x0
-      LayoutBlockFlow {HR} at (0,502.06) size 769x2 [border: (1px inset #EEEEEE)]
-      LayoutBlockFlow {P} at (0,520.06) size 769x18
+      LayoutBlockFlow {HR} at (0,483.06) size 769x2 [border: (1px inset #EEEEEE)]
+      LayoutBlockFlow {P} at (0,501.06) size 769x18
         LayoutText {#text} at (0,0) size 64x18
           text run at (0,0) width 64: "Up to the "
         LayoutInline {A} at (0,0) size 75x18 [color=#0000EE]
@@ -91,7 +92,7 @@
             text run at (63,0) width 75: "Table Tests"
         LayoutText {#text} at (137,0) size 5x18
           text run at (137,0) width 5: "."
-      LayoutBlockFlow {P} at (0,554.06) size 769x18
+      LayoutBlockFlow {P} at (0,535.06) size 769x18
         LayoutText {#text} at (0,0) size 64x18
           text run at (0,0) width 64: "Up to the "
         LayoutInline {A} at (0,0) size 101x18 [color=#0000EE]
@@ -99,7 +100,7 @@
             text run at (63,0) width 101: "Evil Tests Page"
         LayoutText {#text} at (163,0) size 5x18
           text run at (163,0) width 5: "."
-      LayoutBlockFlow {P} at (0,588.06) size 769x18
+      LayoutBlockFlow {P} at (0,569.06) size 769x18
         LayoutText {#text} at (0,0) size 177x18
           text run at (0,0) width 177: "This page is maintained by "
         LayoutInline {A} at (0,0) size 79x18 [color=#0000EE]
@@ -112,8 +113,8 @@
             text run at (263,0) width 125: "py8ieh@bath.ac.uk"
         LayoutText {#text} at (387,0) size 10x18
           text run at (387,0) width 10: ")."
-      LayoutBlockFlow {P} at (0,622.06) size 769x18
+      LayoutBlockFlow {P} at (0,603.06) size 769x18
         LayoutText {#text} at (0,0) size 185x18
           text run at (0,0) width 185: "Last updated in March 1999."
-layer at (598,473) size 125x13
+layer at (585,473) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-4-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-4-expected.txt
index 4add911..abbb6a3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-4-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug2479-4-expected.txt
@@ -184,10 +184,10 @@
         LayoutBlockFlow {P} at (0,0) size 769x38
           LayoutText {#text} at (0,0) size 267x18
             text run at (0,0) width 267: "How does your browser fare on this test? "
-          LayoutMenuList {SELECT} at (266.59,1) size 469x18 [bgcolor=#F8F8F8]
-            LayoutBlockFlow (anonymous) at (0,0) size 469x18
-              LayoutText (anonymous) at (8,2) size 438x13
-                text run at (8,2) width 438: "The tests all render identically, and this browser may or may not grok CSS2 tables."
+          LayoutMenuList {SELECT} at (266.59,1) size 444x18 [bgcolor=#F8F8F8]
+            LayoutBlockFlow (anonymous) at (0,0) size 444x18
+              LayoutText (anonymous) at (8,2) size 413x13
+                text run at (8,2) width 413: "The tests all render identically, and this browser may or may not grok CSS2 tables."
           LayoutText {#text} at (0,0) size 0x0
           LayoutInline {LABEL} at (0,0) size 203x18
             LayoutText {#text} at (0,19) size 72x18
@@ -195,10 +195,10 @@
             LayoutTextControl {INPUT} at (71.55,19) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
           LayoutText {#text} at (202,19) size 5x18
             text run at (202,19) width 5: " "
-          LayoutButton {INPUT} at (206.55,20) size 53.45x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 37.45x13
-              LayoutText {#text} at (0,0) size 38x13
-                text run at (0,0) width 38: "Submit"
+          LayoutButton {INPUT} at (206.55,20) size 51.64x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 35.64x13
+              LayoutText {#text} at (0,0) size 36x13
+                text run at (0,0) width 36: "Submit"
           LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow {HR} at (0,2372.78) size 769x2 [border: (1px inset #EEEEEE)]
       LayoutBlockFlow {P} at (0,2390.78) size 769x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug26178-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug26178-expected.png
index b780ef3..c5ff0cf9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug26178-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug26178-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug26178-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug26178-expected.txt
index 2dea0483..eec208b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug26178-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug26178-expected.txt
@@ -15,8 +15,8 @@
               LayoutText {#text} at (1,1) size 59x18
                 text run at (1,1) width 59: "First row"
       LayoutBlockFlow {FORM} at (0,46) size 784x18
-        LayoutButton {INPUT} at (0,0) size 45.36x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 29.36x13
-            LayoutText {#text} at (0,0) size 30x13
-              text run at (0,0) width 30: "insert"
+        LayoutButton {INPUT} at (0,0) size 43.55x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 27.55x13
+            LayoutText {#text} at (0,0) size 28x13
+              text run at (0,0) width 28: "insert"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug28928-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug28928-expected.png
index 736b2b35..2b0fc5b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug28928-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug28928-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug28928-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug28928-expected.txt
index cd12232b..9aee3f1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug28928-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug28928-expected.txt
@@ -14,13 +14,13 @@
                 LayoutTextControl {INPUT} at (0,0) size 89x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                 LayoutText {#text} at (89,0) size 4x18
                   text run at (89,0) width 4: " "
-                LayoutButton {INPUT} at (93,1) size 38.33x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 22.33x13
-                    LayoutText {#text} at (0,0) size 23x13
-                      text run at (0,0) width 23: " Go "
-                LayoutText {#text} at (131,0) size 5x18
-                  text run at (131,0) width 5: " "
-                LayoutBR {BR} at (135,14) size 1x0
+                LayoutButton {INPUT} at (93,1) size 37.13x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 21.13x13
+                    LayoutText {#text} at (0,0) size 22x13
+                      text run at (0,0) width 22: " Go "
+                LayoutText {#text} at (130,0) size 5x18
+                  text run at (130,0) width 5: " "
+                LayoutBR {BR} at (134,14) size 1x0
                 LayoutText {#text} at (0,19) size 190x18
                   text run at (0,19) width 190: "Enter City Name or Zip Code"
           LayoutTableRow {TR} at (0,59) size 196x0
@@ -36,13 +36,13 @@
                 LayoutTextControl {INPUT} at (0,0) size 89x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                 LayoutText {#text} at (89,0) size 4x18
                   text run at (89,0) width 4: " "
-                LayoutButton {INPUT} at (93,1) size 38.33x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 22.33x13
-                    LayoutText {#text} at (0,0) size 23x13
-                      text run at (0,0) width 23: " Go "
-                LayoutText {#text} at (131,0) size 5x18
-                  text run at (131,0) width 5: " "
-                LayoutBR {BR} at (135,14) size 1x0
+                LayoutButton {INPUT} at (93,1) size 37.13x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 21.13x13
+                    LayoutText {#text} at (0,0) size 22x13
+                      text run at (0,0) width 22: " Go "
+                LayoutText {#text} at (130,0) size 5x18
+                  text run at (130,0) width 5: " "
+                LayoutBR {BR} at (134,14) size 1x0
                 LayoutText {#text} at (0,19) size 190x18
                   text run at (0,19) width 190: "Enter City Name or Zip Code"
           LayoutTableRow {TR} at (0,59) size 196x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug29326-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug29326-expected.png
index 8f054a5..a695cf5a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug29326-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug29326-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug29326-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug29326-expected.txt
index d8e9be2a4..9be7685 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug29326-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug29326-expected.txt
@@ -8,8 +8,8 @@
           LayoutTableRow {TR} at (0,2) size 398x38
             LayoutTableCell {TD} at (2,2) size 394x38 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               LayoutBlockFlow {FORM} at (2,2) size 390x18
-                LayoutMenuList {SELECT} at (0,0) size 54x18 [bgcolor=#F8F8F8]
-                  LayoutBlockFlow (anonymous) at (0,0) size 54x18
-                    LayoutText (anonymous) at (8,2) size 23x13
-                      text run at (8,2) width 23: "Test"
+                LayoutMenuList {SELECT} at (0,0) size 53x18 [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 53x18
+                    LayoutText (anonymous) at (8,2) size 22x13
+                      text run at (8,2) width 22: "Test"
                 LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30559-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30559-expected.png
index 78980c9..7d3626b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30559-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30559-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30559-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30559-expected.txt
index 809f46b..aa1951f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30559-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30559-expected.txt
@@ -19,5 +19,5 @@
 layer at (260,36) size 51x32 clip at (261,37) size 49x30
   LayoutTextControl {TEXTAREA} at (2,2) size 51x32 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 45x13
-      LayoutText {#text} at (0,0) size 18x13
-        text run at (0,0) width 18: "bar"
+      LayoutText {#text} at (0,0) size 17x13
+        text run at (0,0) width 17: "bar"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30692-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30692-expected.png
index 050fcbe..057999970 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30692-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30692-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30692-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30692-expected.txt
index c31baa1..b4a9408fa 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30692-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug30692-expected.txt
@@ -47,10 +47,10 @@
 layer at (11,95) size 622x69 clip at (12,96) size 620x67
   LayoutTextControl {TEXTAREA} at (1,1) size 622.39x69.19 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 616.39x13
-      LayoutText {#text} at (0,0) size 226x13
-        text run at (0,0) width 226: "BUG: the height of the textarea is not 80%"
+      LayoutText {#text} at (0,0) size 213x13
+        text run at (0,0) width 213: "BUG: the height of the textarea is not 80%"
 layer at (11,208) size 622x80 clip at (12,209) size 620x78
   LayoutTextControl {TEXTAREA} at (1,1) size 622.39x80 [bgcolor=#FFFFFF] [border: (1px solid #000000)]
     LayoutBlockFlow {DIV} at (3,3) size 616.39x13
-      LayoutText {#text} at (0,0) size 219x13
-        text run at (0,0) width 219: "OK: the height of the textarea is 80 pixels"
+      LayoutText {#text} at (0,0) size 207x13
+        text run at (0,0) width 207: "OK: the height of the textarea is 80 pixels"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug33855-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug33855-expected.png
index af3748d..3f56b7e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug33855-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug33855-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug33855-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug33855-expected.txt
index 1ed9d2f..883330a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug33855-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug33855-expected.txt
@@ -7,32 +7,32 @@
         LayoutTable {TABLE} at (0,0) size 784x24
           LayoutTableSection {TBODY} at (0,0) size 784x24
             LayoutTableRow {TR} at (0,2) size 784x20 [bgcolor=#FFFFFF]
-              LayoutTableCell {TD} at (2,2) size 67x20 [r=0 c=0 rs=1 cs=1]
-                LayoutButton {INPUT} at (1.31,1) size 64.36x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 48.36x13
-                    LayoutText {#text} at (0,0) size 49x13
-                      text run at (0,0) width 49: "Select all"
-              LayoutTableCell {TD} at (71,2) size 52x20 [r=0 c=1 rs=1 cs=1]
-                LayoutButton {INPUT} at (1.14,1) size 49.70x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 33.70x13
-                    LayoutText {#text} at (0,0) size 34x13
-                      text run at (0,0) width 34: "Delete"
-              LayoutTableCell {TD} at (125,2) size 82x20 [r=0 c=2 rs=1 cs=1]
-                LayoutButton {INPUT} at (1.20,1) size 79.59x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 63.59x13
-                    LayoutText {#text} at (0,0) size 64x13
-                      text run at (0,0) width 64: "Empty trash"
-              LayoutTableCell {TD} at (209,2) size 393x20 [r=0 c=3 rs=1 cs=1]
+              LayoutTableCell {TD} at (2,2) size 64x20 [r=0 c=0 rs=1 cs=1]
+                LayoutButton {INPUT} at (1.33,1) size 61.34x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 45.34x13
+                    LayoutText {#text} at (0,0) size 46x13
+                      text run at (0,0) width 46: "Select all"
+              LayoutTableCell {TD} at (68,2) size 50x20 [r=0 c=1 rs=1 cs=1]
+                LayoutButton {INPUT} at (1.05,1) size 47.89x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 31.89x13
+                    LayoutText {#text} at (0,0) size 32x13
+                      text run at (0,0) width 32: "Delete"
+              LayoutTableCell {TD} at (120,2) size 79x20 [r=0 c=2 rs=1 cs=1]
+                LayoutButton {INPUT} at (1.36,1) size 76.27x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 60.27x13
+                    LayoutText {#text} at (0,0) size 61x13
+                      text run at (0,0) width 61: "Empty trash"
+              LayoutTableCell {TD} at (201,2) size 408x20 [r=0 c=3 rs=1 cs=1]
                 LayoutText {#text} at (1,1) size 4x18
                   text run at (1,1) width 4: " "
-              LayoutTableCell {TD} at (604,2) size 65x20 [r=0 c=4 rs=1 cs=1]
-                LayoutButton {INPUT} at (1.33,1) size 62.33x18 [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 46.33x13
-                    LayoutText {#text} at (0,0) size 47x13
-                      text run at (0,0) width 47: "Move to:"
-              LayoutTableCell {TD} at (671,2) size 111x20 [r=0 c=5 rs=1 cs=1]
-                LayoutMenuList {SELECT} at (1,1) size 109x18 [bgcolor=#F8F8F8]
-                  LayoutBlockFlow (anonymous) at (0,0) size 109x18
-                    LayoutText (anonymous) at (8,2) size 78x13
-                      text run at (8,2) width 78: "Choose folder "
+              LayoutTableCell {TD} at (611,2) size 62x20 [r=0 c=4 rs=1 cs=1]
+                LayoutButton {INPUT} at (1.05,1) size 59.91x18 [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 43.91x13
+                    LayoutText {#text} at (0,0) size 44x13
+                      text run at (0,0) width 44: "Move to:"
+              LayoutTableCell {TD} at (675,2) size 107x20 [r=0 c=5 rs=1 cs=1]
+                LayoutMenuList {SELECT} at (1,1) size 105x18 [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 105x18
+                    LayoutText (anonymous) at (8,2) size 74x13
+                      text run at (8,2) width 74: "Choose folder "
                 LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug39209-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug39209-expected.png
index 687af9a..d129ca1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug39209-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug39209-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug39209-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug39209-expected.txt
index 80fe3bf..636760c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug39209-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug39209-expected.txt
@@ -6,19 +6,19 @@
       LayoutTable {TABLE} at (0,0) size 439x78 [border: (1px outset #808080)]
         LayoutTableSection {TBODY} at (1,1) size 437x76
           LayoutTableRow {TR} at (0,2) size 437x48
-            LayoutTableCell {TD} at (2,15) size 146x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+            LayoutTableCell {TD} at (2,15) size 149x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               LayoutText {#text} at (2,2) size 31x18
                 text run at (2,2) width 31: "Blah"
-            LayoutTableCell {TD} at (150,2) size 285x48 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
-              LayoutTable {TABLE} at (110.50,2) size 64x44 [border: (1px outset #808080)]
-                LayoutTableSection {TBODY} at (1,1) size 62x42
-                  LayoutTableRow {TR} at (0,2) size 62x38
-                    LayoutTableCell {TD} at (2,2) size 58x38 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
-                      LayoutBlockFlow {FORM} at (2,2) size 54x18
-                        LayoutButton {INPUT} at (0,0) size 53.45x18 [bgcolor=#C0C0C0]
-                          LayoutBlockFlow (anonymous) at (8,2) size 37.45x13
-                            LayoutText {#text} at (0,0) size 38x13
-                              text run at (0,0) width 38: "Submit"
+            LayoutTableCell {TD} at (153,2) size 282x48 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+              LayoutTable {TABLE} at (110,2) size 62x44 [border: (1px outset #808080)]
+                LayoutTableSection {TBODY} at (1,1) size 60x42
+                  LayoutTableRow {TR} at (0,2) size 60x38
+                    LayoutTableCell {TD} at (2,2) size 56x38 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
+                      LayoutBlockFlow {FORM} at (2,2) size 52x18
+                        LayoutButton {INPUT} at (0,0) size 51.64x18 [bgcolor=#C0C0C0]
+                          LayoutBlockFlow (anonymous) at (8,2) size 35.64x13
+                            LayoutText {#text} at (0,0) size 36x13
+                              text run at (0,0) width 36: "Submit"
                         LayoutText {#text} at (0,0) size 0x0
           LayoutTableRow {TR} at (0,52) size 437x22
             LayoutTableCell {TD} at (2,52) size 433x22 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=2]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4382-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4382-expected.png
index f8980836..1286dab 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4382-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4382-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4382-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4382-expected.txt
index 73f8fd3..c118047 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4382-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4382-expected.txt
@@ -16,10 +16,10 @@
         LayoutTextControl {INPUT} at (51.09,0) size 119x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (170,0) size 5x18
           text run at (170,0) width 5: " "
-        LayoutMenuList {SELECT} at (174.09,1) size 76x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 76x18
-            LayoutText (anonymous) at (8,2) size 33x13
-              text run at (8,2) width 33: "Excite"
+        LayoutMenuList {SELECT} at (174.09,1) size 74x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 74x18
+            LayoutText (anonymous) at (8,2) size 31x13
+              text run at (8,2) width 31: "Excite"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow (anonymous) at (0,53) size 784x36
         LayoutBR {BR} at (0,0) size 0x18
@@ -27,9 +27,9 @@
           text run at (0,18) width 270: "The select should not contain blank items "
         LayoutBR {BR} at (269,32) size 1x0
       LayoutBlockFlow {FORM} at (0,89) size 784x18
-        LayoutMenuList {SELECT} at (0,0) size 226x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 226x18
-            LayoutText (anonymous) at (8,2) size 56x13
-              text run at (8,2) width 56: "Quick Link"
+        LayoutMenuList {SELECT} at (0,0) size 209x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 209x18
+            LayoutText (anonymous) at (8,2) size 53x13
+              text run at (8,2) width 53: "Quick Link"
 layer at (62,29) size 113x13
   LayoutBlockFlow {DIV} at (3,3) size 113x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4429-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4429-expected.png
index 9f4b0603..2e236bf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4429-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4429-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4429-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4429-expected.txt
index 5aa6316..73a1b40 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4429-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug4429-expected.txt
@@ -11,8 +11,8 @@
                 LayoutText {#text} at (2,2) size 22x18
                   text run at (2,2) width 22: "foo"
         LayoutBlockFlow (anonymous) at (0,28) size 784x18
-          LayoutButton {INPUT} at (0,0) size 53.45x18 [bgcolor=#C0C0C0]
-            LayoutBlockFlow (anonymous) at (8,2) size 37.45x13
-              LayoutText {#text} at (0,0) size 38x13
-                text run at (0,0) width 38: "Submit"
+          LayoutButton {INPUT} at (0,0) size 51.64x18 [bgcolor=#C0C0C0]
+            LayoutBlockFlow (anonymous) at (8,2) size 35.64x13
+              LayoutText {#text} at (0,0) size 36x13
+                text run at (0,0) width 36: "Submit"
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.png
index 00e6e0d..a9a9a4b 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.txt
index 6226b50c..988e2fe 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug44505-expected.txt
@@ -110,8 +110,8 @@
     LayoutBlockFlow {FORM} at (2,2) size 150x19
       LayoutButton {BUTTON} at (0,1) size 200x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
         LayoutBlockFlow (anonymous) at (8,2) size 184x13
-          LayoutText {#text} at (74,0) size 36x13
-            text run at (74,0) width 36: "button"
+          LayoutText {#text} at (75,0) size 34x13
+            text run at (75,0) width 34: "button"
 layer at (167,219) size 138x23 clip at (168,220) size 136x21
   LayoutTableCell {TD} at (158,2) size 138x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
     LayoutText {#text} at (2,2) size 4x18
@@ -129,8 +129,8 @@
     LayoutBlockFlow {FORM} at (2,2) size 276x19
       LayoutButton {BUTTON} at (0,1) size 200x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
         LayoutBlockFlow (anonymous) at (8,2) size 184x13
-          LayoutText {#text} at (74,0) size 36x13
-            text run at (74,0) width 36: "button"
+          LayoutText {#text} at (75,0) size 34x13
+            text run at (75,0) width 34: "button"
 layer at (293,272) size 12x23 clip at (294,273) size 10x21
   LayoutTableCell {TD} at (284,2) size 12x22 [bgcolor=#0000FF] [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
     LayoutText {#text} at (2,2) size 4x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-1-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-1-expected.png
index 17e7f0d..bc6d611 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-1-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-1-expected.txt
index 9873ea1..b1dbf37 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-1-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-1-expected.txt
@@ -33,21 +33,21 @@
                 text run at (2,38) width 293: "Architecture, Bidi, Necko/Imglib, and more..."
       LayoutBlockFlow (anonymous) at (0,111) size 784x37
         LayoutBR {BR} at (0,0) size 0x18
-        LayoutButton {INPUT} at (0,19) size 53.02x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 37.02x13
-            LayoutText {#text} at (0,0) size 37x13
-              text run at (0,0) width 37: "Reload"
-        LayoutText {#text} at (53,18) size 9x18
-          text run at (53,18) width 9: "  "
-        LayoutButton {INPUT} at (61.02,19) size 83.94x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 67.94x13
-            LayoutText {#text} at (0,0) size 68x13
-              text run at (0,0) width 68: "Change Font"
-        LayoutText {#text} at (144,18) size 9x18
-          text run at (144,18) width 9: "  "
-        LayoutTextControl {INPUT} at (152.95,18) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutButton {INPUT} at (0,19) size 51.20x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 35.20x13
+            LayoutText {#text} at (0,0) size 36x13
+              text run at (0,0) width 36: "Reload"
+        LayoutText {#text} at (51,18) size 9x18
+          text run at (51,18) width 9: "  "
+        LayoutButton {INPUT} at (59.20,19) size 80.61x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 64.61x13
+            LayoutText {#text} at (0,0) size 65x13
+              text run at (0,0) width 65: "Change Font"
+        LayoutText {#text} at (139,18) size 9x18
+          text run at (139,18) width 9: "  "
+        LayoutTextControl {INPUT} at (147.81,18) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (164,140) size 125x13
+layer at (159,140) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 7x13
       text run at (0,0) width 7: "6"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-2-expected.png
index ddbbd823..03ec250 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-2-expected.txt
index ded9485..23ab10f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug46368-2-expected.txt
@@ -21,21 +21,21 @@
                 text run at (2,2) width 245: "foo bar foo bar foo bar foo bar foo bar"
       LayoutBlockFlow (anonymous) at (0,65) size 784x37
         LayoutBR {BR} at (0,0) size 0x18
-        LayoutButton {INPUT} at (0,19) size 53.02x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 37.02x13
-            LayoutText {#text} at (0,0) size 37x13
-              text run at (0,0) width 37: "Reload"
-        LayoutText {#text} at (53,18) size 9x18
-          text run at (53,18) width 9: "  "
-        LayoutButton {INPUT} at (61.02,19) size 83.94x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 67.94x13
-            LayoutText {#text} at (0,0) size 68x13
-              text run at (0,0) width 68: "Change Font"
-        LayoutText {#text} at (144,18) size 9x18
-          text run at (144,18) width 9: "  "
-        LayoutTextControl {INPUT} at (152.95,18) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutButton {INPUT} at (0,19) size 51.20x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 35.20x13
+            LayoutText {#text} at (0,0) size 36x13
+              text run at (0,0) width 36: "Reload"
+        LayoutText {#text} at (51,18) size 9x18
+          text run at (51,18) width 9: "  "
+        LayoutButton {INPUT} at (59.20,19) size 80.61x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 64.61x13
+            LayoutText {#text} at (0,0) size 65x13
+              text run at (0,0) width 65: "Change Font"
+        LayoutText {#text} at (139,18) size 9x18
+          text run at (139,18) width 9: "  "
+        LayoutTextControl {INPUT} at (147.81,18) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (0,0) size 0x0
-layer at (164,94) size 125x13
+layer at (159,94) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
     LayoutText {#text} at (0,0) size 7x13
       text run at (0,0) width 7: "6"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51037-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51037-expected.png
index b9aeabe7..8a28239 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51037-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51037-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51037-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51037-expected.txt
index 8b0e4f8..d33971c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51037-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51037-expected.txt
@@ -15,18 +15,18 @@
           text run at (0,0) width 35: "Top: "
         LayoutTextControl {INPUT} at (34.22,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
       LayoutBlockFlow {P} at (0,104) size 784x18
-        LayoutButton {INPUT} at (0,0) size 44.97x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 28.97x13
-            LayoutText {#text} at (0,0) size 29x13
-              text run at (0,0) width 29: "Move"
+        LayoutButton {INPUT} at (0,0) size 43.75x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 27.75x13
+            LayoutText {#text} at (0,0) size 28x13
+              text run at (0,0) width 28: "Move"
 layer at (46,45) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 33x13
-      text run at (0,0) width 33: "120px"
+    LayoutText {#text} at (0,0) size 32x13
+      text run at (0,0) width 32: "120px"
 layer at (45,80) size 125x13
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 33x13
-      text run at (0,0) width 33: "120px"
+    LayoutText {#text} at (0,0) size 32x13
+      text run at (0,0) width 32: "120px"
 layer at (250,120) size 30x48
   LayoutTable (positioned) {TABLE} at (250,120) size 30x48 [border: (1px outset #808080)]
     LayoutTableSection {TBODY} at (1,1) size 28x46
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51727-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51727-expected.png
index ad0320a..c240766 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51727-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51727-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51727-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51727-expected.txt
index 75058a00..184a1a1 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51727-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug51727-expected.txt
@@ -4,16 +4,16 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x80
     LayoutBlockFlow {BODY} at (8,8) size 784x64
       LayoutBlockFlow {FORM} at (0,0) size 784x38
-        LayoutButton {INPUT} at (0,1) size 153.61x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 137.61x13
-            LayoutText {#text} at (0,0) size 138x13
-              text run at (0,0) width 138: "(1) Fill cell with long string"
-        LayoutBR {BR} at (153,0) size 1x18
-        LayoutButton {INPUT} at (0,20) size 157.84x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 141.84x13
-            LayoutText {#text} at (0,0) size 142x13
-              text run at (0,0) width 142: "(2) Fill cell with short string"
-        LayoutBR {BR} at (157,19) size 1x18
+        LayoutButton {INPUT} at (0,1) size 144.55x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 128.55x13
+            LayoutText {#text} at (0,0) size 129x13
+              text run at (0,0) width 129: "(1) Fill cell with long string"
+        LayoutBR {BR} at (144,0) size 1x18
+        LayoutButton {INPUT} at (0,20) size 148.48x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 132.48x13
+            LayoutText {#text} at (0,0) size 133x13
+              text run at (0,0) width 133: "(2) Fill cell with short string"
+        LayoutBR {BR} at (148,19) size 1x18
       LayoutTable {TABLE} at (0,38) size 83x26
         LayoutTableSection {TBODY} at (0,0) size 83x26
           LayoutTableRow {TR} at (0,2) size 83x22
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52505-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52505-expected.png
index b5d28161..eed74a1d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52505-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52505-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52505-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52505-expected.txt
index 5b0d7aad..a1e802e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52505-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52505-expected.txt
@@ -4,14 +4,14 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x106
     LayoutBlockFlow {BODY} at (8,8) size 784x90
       LayoutBlockFlow {FORM} at (0,0) size 784x36
-        LayoutButton {INPUT} at (0,0) size 253.09x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 237.09x13
-            LayoutText {#text} at (0,0) size 238x13
-              text run at (0,0) width 238: "[Step 1] Set cell width to 60px (nothing seen)"
-        LayoutButton {INPUT} at (0,18) size 256.80x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 240.80x13
-            LayoutText {#text} at (0,0) size 241x13
-              text run at (0,0) width 241: "[Step 2] Set cell width to 20px (garbage seen)"
+        LayoutButton {INPUT} at (0,0) size 239.20x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 223.20x13
+            LayoutText {#text} at (0,0) size 224x13
+              text run at (0,0) width 224: "[Step 1] Set cell width to 60px (nothing seen)"
+        LayoutButton {INPUT} at (0,18) size 242.92x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 226.92x13
+            LayoutText {#text} at (0,0) size 227x13
+              text run at (0,0) width 227: "[Step 2] Set cell width to 20px (garbage seen)"
       LayoutTable {TABLE} at (0,36) size 34x54
         LayoutTableSection {TBODY} at (0,0) size 34x54
           LayoutTableRow {TR} at (0,2) size 34x24
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52506-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52506-expected.png
index cfab3d0..bc708ab9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52506-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52506-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52506-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52506-expected.txt
index ac9dab3..355ddaf 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52506-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug52506-expected.txt
@@ -4,14 +4,14 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x114
     LayoutBlockFlow {BODY} at (8,8) size 784x98
       LayoutBlockFlow {FORM} at (0,0) size 784x36
-        LayoutButton {INPUT} at (0,0) size 179.09x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 163.09x13
-            LayoutText {#text} at (0,0) size 164x13
-              text run at (0,0) width 164: "[Step 1] Set cell height to 60px"
-        LayoutButton {INPUT} at (0,18) size 179.09x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 163.09x13
-            LayoutText {#text} at (0,0) size 164x13
-              text run at (0,0) width 164: "[Step 2] Set cell height to 20px"
+        LayoutButton {INPUT} at (0,0) size 169.44x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 153.44x13
+            LayoutText {#text} at (0,0) size 154x13
+              text run at (0,0) width 154: "[Step 1] Set cell height to 60px"
+        LayoutButton {INPUT} at (0,18) size 169.44x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 153.44x13
+            LayoutText {#text} at (0,0) size 154x13
+              text run at (0,0) width 154: "[Step 2] Set cell height to 20px"
       LayoutTable {TABLE} at (0,36) size 42x62
         LayoutTableSection {TBODY} at (0,0) size 42x62
           LayoutTableRow {TR} at (0,2) size 42x28
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.png
index 582ad4b..3c9ab8a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.txt
index 63be75d..99eebf9 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug59354-expected.txt
@@ -54,7 +54,7 @@
                                               LayoutTableCell {TD} at (123,1) size 141x29 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
                                                 LayoutTextControl {INPUT} at (5,5) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                                                 LayoutText {#text} at (0,0) size 0x0
-layer at (242,97) size 125x13 scrollWidth 191
+layer at (242,97) size 125x13 scrollWidth 181
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 191x13
-      text run at (0,0) width 191: "simon.king@pipinghotnetworks.com"
+    LayoutText {#text} at (0,0) size 182x13
+      text run at (0,0) width 182: "simon.king@pipinghotnetworks.com"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug60749-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug60749-expected.png
index 2fe23612..7620b3c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug60749-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug60749-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug60749-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug60749-expected.txt
index 9d5405e..326d03724 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug60749-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug60749-expected.txt
@@ -13,14 +13,14 @@
               LayoutText {#text} at (2,2) size 108x18
                 text run at (2,2) width 108: "   InspectionText"
       LayoutBlockFlow {FORM} at (0,28) size 784x19
-        LayoutButton {INPUT} at (0,1) size 86.92x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 70.92x13
-            LayoutText {#text} at (0,0) size 71x13
-              text run at (0,0) width 71: "change width"
-        LayoutText {#text} at (86,0) size 5x18
-          text run at (86,0) width 5: " "
-        LayoutButton {INPUT} at (90.92,1) size 177.41x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 161.41x13
-            LayoutText {#text} at (0,0) size 162x13
-              text run at (0,0) width 162: "change width with table reflow"
+        LayoutButton {INPUT} at (0,1) size 83.30x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 67.30x13
+            LayoutText {#text} at (0,0) size 68x13
+              text run at (0,0) width 68: "change width"
+        LayoutText {#text} at (83,0) size 5x18
+          text run at (83,0) width 5: " "
+        LayoutButton {INPUT} at (87.30,1) size 168.36x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 152.36x13
+            LayoutText {#text} at (0,0) size 153x13
+              text run at (0,0) width 153: "change width with table reflow"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug68912-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug68912-expected.png
index e3a9ae1..0d346ae0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug68912-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug68912-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug68912-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug68912-expected.txt
index 54d0a868..673d6f0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug68912-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug68912-expected.txt
@@ -9,8 +9,8 @@
       LayoutBlockFlow {P} at (0,34) size 784x19
         LayoutText {#text} at (0,0) size 42x18
           text run at (0,0) width 42: "Crash "
-        LayoutButton {BUTTON} at (41.33,1) size 90.59x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-          LayoutBlockFlow (anonymous) at (8,2) size 74.59x13
-            LayoutText {#text} at (0,0) size 75x13
-              text run at (0,0) width 75: "TR.cells = null"
+        LayoutButton {BUTTON} at (41.33,1) size 86.06x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+          LayoutBlockFlow (anonymous) at (8,2) size 70.06x13
+            LayoutText {#text} at (0,0) size 71x13
+              text run at (0,0) width 71: "TR.cells = null"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug7342-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug7342-expected.png
index 61e5cc7d..203b08a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug7342-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug7342-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug7342-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug7342-expected.txt
index 595bc56..a6696d0 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug7342-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug7342-expected.txt
@@ -58,10 +58,10 @@
                             LayoutText {#text} at (0,0) size 0x0
                           LayoutText {#text} at (0,0) size 0x0
                         LayoutTableCell {TD} at (349,4) size 102x28 [border: (1px inset #808080)] [r=0 c=3 rs=1 cs=1]
-                          LayoutButton {INPUT} at (5,5) size 53.02x18 [bgcolor=#C0C0C0]
-                            LayoutBlockFlow (anonymous) at (8,2) size 37.02x13
-                              LayoutText {#text} at (0,0) size 37x13
-                                text run at (0,0) width 37: "Search"
+                          LayoutButton {INPUT} at (5,5) size 51.20x18 [bgcolor=#C0C0C0]
+                            LayoutBlockFlow (anonymous) at (8,2) size 35.20x13
+                              LayoutText {#text} at (0,0) size 36x13
+                                text run at (0,0) width 36: "Search"
                           LayoutText {#text} at (0,0) size 0x0
                       LayoutTableRow {TR} at (0,37) size 455x28
                         LayoutTableCell {TD} at (4,37) size 110x28 [border: (1px inset #808080)] [r=1 c=0 rs=1 cs=1]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.png
index 4657131..a82fcc5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.txt
index 8f605ff..f288d9c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/bugs/bug96334-expected.txt
@@ -1,45 +1,45 @@
-layer at (0,0) size 800x600 scrollWidth 995
+layer at (0,0) size 800x600 scrollWidth 988
   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
-      LayoutTable {TABLE} at (0,0) size 987x139 [border: (2px solid #0000FF)]
-        LayoutTableSection {TBODY} at (2,2) size 983x135
-          LayoutTableRow {TR} at (0,2) size 983x131
-            LayoutTableCell {TD} at (2,2) size 219x131 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
-              LayoutTable {TABLE} at (2,2) size 215x127 [border: (2px solid #008000)]
-                LayoutTableSection {TBODY} at (2,2) size 211x123
-                  LayoutTableRow {TR} at (0,2) size 211x83
-                    LayoutTableCell {TD} at (2,2) size 207x83 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+      LayoutTable {TABLE} at (0,0) size 980x139 [border: (2px solid #0000FF)]
+        LayoutTableSection {TBODY} at (2,2) size 976x135
+          LayoutTableRow {TR} at (0,2) size 976x131
+            LayoutTableCell {TD} at (2,2) size 212x131 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+              LayoutTable {TABLE} at (2,2) size 208x127 [border: (2px solid #008000)]
+                LayoutTableSection {TBODY} at (2,2) size 204x123
+                  LayoutTableRow {TR} at (0,2) size 204x83
+                    LayoutTableCell {TD} at (2,2) size 200x83 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
                       LayoutTable {TABLE} at (2,2) size 143x31 [border: (2px solid #FF0000)]
                         LayoutTableSection {TBODY} at (2,2) size 139x27
                           LayoutTableRow {TR} at (0,2) size 139x23
                             LayoutTableCell {TD} at (2,2) size 135x23 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
                               LayoutTextControl {INPUT} at (2,2) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                               LayoutText {#text} at (0,0) size 0x0
-                      LayoutTable {TABLE} at (2,33) size 203x48 [border: (2px solid #FF0000)]
-                        LayoutTableSection {TBODY} at (2,2) size 199x44
-                          LayoutTableRow {TR} at (0,2) size 199x40
-                            LayoutTableCell {TD} at (2,2) size 195x40 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+                      LayoutTable {TABLE} at (2,33) size 196x48 [border: (2px solid #FF0000)]
+                        LayoutTableSection {TBODY} at (2,2) size 192x44
+                          LayoutTableRow {TR} at (0,2) size 192x40
+                            LayoutTableCell {TD} at (2,2) size 188x40 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
                               LayoutText {#text} at (2,2) size 172x36
                                 text run at (2,2) width 172: "THIS TABLE NEEDS TO"
                                 text run at (2,20) width 67: "BE HERE"
-                  LayoutTableRow {TR} at (0,87) size 211x34
-                    LayoutTableCell {TD} at (2,87) size 207x34 [border: (1px solid #C0C0C0)] [r=1 c=0 rs=1 cs=1]
-                      LayoutTable {TABLE} at (2,2) size 203x30 [border: (2px solid #FF0000)]
-                        LayoutTableSection {TBODY} at (2,2) size 199x26
-                          LayoutTableRow {TR} at (0,2) size 199x22
-                            LayoutTableCell {TD} at (2,2) size 195x22 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
-                              LayoutMenuList {SELECT} at (2,2) size 191x18 [bgcolor=#F8F8F8]
-                                LayoutBlockFlow (anonymous) at (0,0) size 191x18
-                                  LayoutText (anonymous) at (8,2) size 160x13
-                                    text run at (8,2) width 160: "USE THIS JAVASCRIPT HERE"
+                  LayoutTableRow {TR} at (0,87) size 204x34
+                    LayoutTableCell {TD} at (2,87) size 200x34 [border: (1px solid #C0C0C0)] [r=1 c=0 rs=1 cs=1]
+                      LayoutTable {TABLE} at (2,2) size 196x30 [border: (2px solid #FF0000)]
+                        LayoutTableSection {TBODY} at (2,2) size 192x26
+                          LayoutTableRow {TR} at (0,2) size 192x22
+                            LayoutTableCell {TD} at (2,2) size 188x22 [border: (1px solid #C0C0C0)] [r=0 c=0 rs=1 cs=1]
+                              LayoutMenuList {SELECT} at (2,2) size 184x18 [bgcolor=#F8F8F8]
+                                LayoutBlockFlow (anonymous) at (0,0) size 184x18
+                                  LayoutText (anonymous) at (8,2) size 153x13
+                                    text run at (8,2) width 153: "USE THIS JAVASCRIPT HERE"
                               LayoutText {#text} at (0,0) size 0x0
-            LayoutTableCell {TD} at (223,2) size 758x40 [border: (1px solid #C0C0C0)] [r=0 c=1 rs=1 cs=1]
+            LayoutTableCell {TD} at (216,2) size 758x40 [border: (1px solid #C0C0C0)] [r=0 c=1 rs=1 cs=1]
               LayoutText {#text} at (2,2) size 754x36
                 text run at (2,2) width 754: "KEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLEooKEEPoTHEoTEXToHEREoASoLONGoASoPOSSIBLE"
                 text run at (2,20) width 608: "THIS SIMULATES THE PROBLEM ON THE WWW.MAPBLAST.COM/ \"CREATE MAP\""
-layer at (29,29) size 125x13 scrollWidth 137
+layer at (29,29) size 125x13 scrollWidth 131
   LayoutBlockFlow {DIV} at (3,3) size 125x13
-    LayoutText {#text} at (0,0) size 137x13
-      text run at (0,0) width 137: "THIS NEEDS THIS VALUE"
+    LayoutText {#text} at (0,0) size 131x13
+      text run at (0,0) width 131: "THIS NEEDS THIS VALUE"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/collapsing_borders/bug41262-4-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/collapsing_borders/bug41262-4-expected.png
index 3deefd80..506d754 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/collapsing_borders/bug41262-4-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/collapsing_borders/bug41262-4-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/collapsing_borders/bug41262-4-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/collapsing_borders/bug41262-4-expected.txt
index 6117c3e..abef1fd 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/collapsing_borders/bug41262-4-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/collapsing_borders/bug41262-4-expected.txt
@@ -29,13 +29,13 @@
                   LayoutText {#text} at (4,4) size 60x18
                     text run at (4,4) width 60: "6:00 a.m."
           LayoutBlockFlow {P} at (0,96) size 704x19
-            LayoutButton {INPUT} at (289.03,1) size 61.89x18 [bgcolor=#C0C0C0]
-              LayoutBlockFlow (anonymous) at (8,2) size 45.89x13
-                LayoutText {#text} at (0,0) size 46x13
-                  text run at (0,0) width 46: "separate"
+            LayoutButton {INPUT} at (291.45,1) size 59.48x18 [bgcolor=#C0C0C0]
+              LayoutBlockFlow (anonymous) at (8,2) size 43.48x13
+                LayoutText {#text} at (0,0) size 44x13
+                  text run at (0,0) width 44: "separate"
             LayoutText {#text} at (350,0) size 5x18
               text run at (350,0) width 5: " "
-            LayoutButton {INPUT} at (354.92,1) size 60.03x18 [bgcolor=#C0C0C0]
-              LayoutBlockFlow (anonymous) at (8,2) size 44.03x13
-                LayoutText {#text} at (0,0) size 45x13
-                  text run at (0,0) width 45: "collapse"
+            LayoutButton {INPUT} at (354.94,1) size 57.61x18 [bgcolor=#C0C0C0]
+              LayoutBlockFlow (anonymous) at (8,2) size 41.61x13
+                LayoutText {#text} at (0,0) size 42x13
+                  text run at (0,0) width 42: "collapse"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/core/margins-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/core/margins-expected.png
index 418101a9..18bc34e 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/core/margins-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/core/margins-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/core/margins-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/core/margins-expected.txt
index 17fdcb0..9e87155 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/core/margins-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/core/margins-expected.txt
@@ -11,10 +11,10 @@
           LayoutTableRow {TR} at (0,2) size 398x38
             LayoutTableCell {TD} at (2,2) size 394x38 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               LayoutBlockFlow {FORM} at (2,2) size 390x18
-                LayoutMenuList {SELECT} at (0,0) size 54x18 [bgcolor=#F8F8F8]
-                  LayoutBlockFlow (anonymous) at (0,0) size 54x18
-                    LayoutText (anonymous) at (8,2) size 23x13
-                      text run at (8,2) width 23: "Test"
+                LayoutMenuList {SELECT} at (0,0) size 53x18 [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 53x18
+                    LayoutText (anonymous) at (8,2) size 22x13
+                      text run at (8,2) width 22: "Test"
                 LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow (anonymous) at (0,62) size 784x18
         LayoutText {#text} at (0,0) size 301x18
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/dom/tableDom-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/dom/tableDom-expected.png
index 8a2b8fb..7413f28 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/dom/tableDom-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/dom/tableDom-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/dom/tableDom-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/dom/tableDom-expected.txt
index 5a1cef4..0af94266 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/dom/tableDom-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/dom/tableDom-expected.txt
@@ -4,31 +4,31 @@
   LayoutBlockFlow {HTML} at (0,0) size 800x600
     LayoutBlockFlow {BODY} at (8,8) size 784x584
       LayoutBlockFlow {FORM} at (0,0) size 784x19
-        LayoutMenuList {SELECT} at (0,1) size 94x18 [bgcolor=#F8F8F8]
-          LayoutBlockFlow (anonymous) at (0,0) size 94x18
-            LayoutText (anonymous) at (8,2) size 62x13
-              text run at (8,2) width 62: "append cell"
-        LayoutText {#text} at (94,0) size 53x18
-          text run at (94,0) width 53: "   tbody "
-        LayoutTextControl {INPUT} at (146.44,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-        LayoutText {#text} at (187,0) size 42x18
-          text run at (187,0) width 42: "   row "
-        LayoutTextControl {INPUT} at (228.31,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-        LayoutText {#text} at (269,0) size 36x18
-          text run at (269,0) width 36: "   col "
-        LayoutTextControl {INPUT} at (304.86,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-        LayoutText {#text} at (345,0) size 76x18
-          text run at (345,0) width 76: "   row span "
-        LayoutTextControl {INPUT} at (420.06,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-        LayoutText {#text} at (461,0) size 69x18
-          text run at (461,0) width 69: "   col span "
-        LayoutTextControl {INPUT} at (529.94,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
-        LayoutText {#text} at (570,0) size 21x18
-          text run at (570,0) width 21: "     "
-        LayoutButton {INPUT} at (590.94,1) size 41.33x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 25.33x13
-            LayoutText {#text} at (0,0) size 26x13
-              text run at (0,0) width 26: "Do It"
+        LayoutMenuList {SELECT} at (0,1) size 91x18 [bgcolor=#F8F8F8]
+          LayoutBlockFlow (anonymous) at (0,0) size 91x18
+            LayoutText (anonymous) at (8,2) size 59x13
+              text run at (8,2) width 59: "append cell"
+        LayoutText {#text} at (91,0) size 53x18
+          text run at (91,0) width 53: "   tbody "
+        LayoutTextControl {INPUT} at (143.44,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (184,0) size 42x18
+          text run at (184,0) width 42: "   row "
+        LayoutTextControl {INPUT} at (225.31,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (266,0) size 36x18
+          text run at (266,0) width 36: "   col "
+        LayoutTextControl {INPUT} at (301.86,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (342,0) size 76x18
+          text run at (342,0) width 76: "   row span "
+        LayoutTextControl {INPUT} at (417.06,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (458,0) size 69x18
+          text run at (458,0) width 69: "   col span "
+        LayoutTextControl {INPUT} at (526.94,0) size 41x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (567,0) size 21x18
+          text run at (567,0) width 21: "     "
+        LayoutButton {INPUT} at (587.94,1) size 39.81x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 23.81x13
+            LayoutText {#text} at (0,0) size 24x13
+              text run at (0,0) width 24: "Do It"
         LayoutText {#text} at (0,0) size 0x0
       LayoutBlockFlow (anonymous) at (0,35) size 784x18
         LayoutBR {BR} at (0,0) size 0x18
@@ -47,23 +47,23 @@
                 text run at (2,2) width 24: "c22"
       LayoutBlockFlow (anonymous) at (0,105) size 784x18
         LayoutBR {BR} at (0,0) size 0x18
-layer at (157,11) size 35x13
+layer at (154,11) size 35x13
   LayoutBlockFlow {DIV} at (3,3) size 35x13
     LayoutText {#text} at (0,0) size 7x13
       text run at (0,0) width 7: "0"
-layer at (239,11) size 35x13
+layer at (236,11) size 35x13
   LayoutBlockFlow {DIV} at (3,3) size 35x13
     LayoutText {#text} at (0,0) size 7x13
       text run at (0,0) width 7: "0"
-layer at (316,11) size 35x13
+layer at (313,11) size 35x13
   LayoutBlockFlow {DIV} at (3,3) size 35x13
     LayoutText {#text} at (0,0) size 7x13
       text run at (0,0) width 7: "0"
-layer at (431,11) size 35x13
+layer at (428,11) size 35x13
   LayoutBlockFlow {DIV} at (3,3) size 35x13
     LayoutText {#text} at (0,0) size 7x13
       text run at (0,0) width 7: "1"
-layer at (541,11) size 35x13
+layer at (538,11) size 35x13
   LayoutBlockFlow {DIV} at (3,3) size 35x13
     LayoutText {#text} at (0,0) size 7x13
       text run at (0,0) width 7: "1"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/move_row-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/move_row-expected.txt
index e35caf2..a2e79ce 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/move_row-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla/other/move_row-expected.txt
@@ -36,10 +36,10 @@
         LayoutTextControl {INPUT} at (21,0) size 17x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
         LayoutText {#text} at (38,0) size 4x18
           text run at (38,0) width 4: " "
-        LayoutButton {INPUT} at (42,1) size 29.44x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 13.44x13
-            LayoutText {#text} at (0,0) size 14x13
-              text run at (0,0) width 14: "go"
+        LayoutButton {INPUT} at (42,1) size 28.84x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 12.84x13
+            LayoutText {#text} at (0,0) size 13x13
+              text run at (0,0) width 13: "go"
         LayoutText {#text} at (0,0) size 0x0
 layer at (11,145) size 11x13
   LayoutBlockFlow {DIV} at (3,3) size 11x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1725-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1725-expected.png
index e60bf2f20..e02b766 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1725-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1725-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1725-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1725-expected.txt
index 66cf6d5..5692750 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1725-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug1725-expected.txt
@@ -23,10 +23,10 @@
                 LayoutTableSection {TBODY} at (0,0) size 440x24
                   LayoutTableRow {TR} at (0,2) size 440x20
                     LayoutTableCell {TD} at (2,2) size 217x20 [r=0 c=0 rs=1 cs=1]
-                      LayoutButton {INPUT} at (1,1) size 95.28x18 [bgcolor=#C0C0C0]
-                        LayoutBlockFlow (anonymous) at (8,2) size 79.28x13
-                          LayoutText {#text} at (0,0) size 80x13
-                            text run at (0,0) width 80: "Submit Criteria"
+                      LayoutButton {INPUT} at (1,1) size 90.75x18 [bgcolor=#C0C0C0]
+                        LayoutBlockFlow (anonymous) at (8,2) size 74.75x13
+                          LayoutText {#text} at (0,0) size 75x13
+                            text run at (0,0) width 75: "Submit Criteria"
                     LayoutTableCell {TD} at (221,2) size 217x20 [r=0 c=1 rs=1 cs=1]
                       LayoutText {#text} at (1,1) size 8x18
                         text run at (1,1) width 8: "4"
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png
index 3a71051..39ba050 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt
index 7afa1555..4541092 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug2479-5-expected.txt
@@ -1,44 +1,44 @@
-layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 1426
+layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollHeight 1462
   LayoutView at (0,0) size 800x600
-layer at (8,8) size 769x1410 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
-  LayoutBlockFlow {HTML} at (8,8) size 769x1410 [border: (16px solid #00FF00)]
-    LayoutTable (anonymous) at (16,16) size 737x1378
-      LayoutTableSection (anonymous) at (0,0) size 737x1378
-        LayoutTableRow (anonymous) at (0,0) size 737x1378
-          LayoutTableCell {HEAD} at (0,0) size 237x490 [color=#FFFFFF] [bgcolor=#FF0000] [border: (5px solid #FFFFFF)] [r=0 c=0 rs=1 cs=1]
-            LayoutBlockFlow {META} at (21,37) size 195x2 [border: (1px dotted #FFFFFF)]
-            LayoutBlockFlow {META} at (21,55) size 195x2 [border: (1px dotted #FFFFFF)]
-            LayoutBlockFlow {META} at (21,73) size 195x2 [border: (1px dotted #FFFFFF)]
-            LayoutBlockFlow {META} at (21,91) size 195x2 [border: (1px dotted #FFFFFF)]
-            LayoutBlockFlow {TITLE} at (21,109) size 195x56 [border: (1px dotted #FFFFFF)]
-              LayoutText {#text} at (1,1) size 189x54
-                text run at (1,1) width 189: "Evil Tests: Rendering BODY"
-                text run at (1,19) width 163: "and HEAD as children of"
-                text run at (1,37) width 67: "HTML - 2"
-            LayoutBlockFlow {STYLE} at (21,181) size 195x272 [border: (1px dotted #FFFFFF)]
-              LayoutText {#text} at (1,1) size 190x270
+layer at (8,8) size 769x1446 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
+  LayoutBlockFlow {HTML} at (8,8) size 769x1446 [border: (16px solid #00FF00)]
+    LayoutTable (anonymous) at (16,16) size 737x1414
+      LayoutTableSection (anonymous) at (0,0) size 737x1414
+        LayoutTableRow (anonymous) at (0,0) size 737x1414
+          LayoutTableCell {HEAD} at (0,0) size 260x454 [color=#FFFFFF] [bgcolor=#FF0000] [border: (5px solid #FFFFFF)] [r=0 c=0 rs=1 cs=1]
+            LayoutBlockFlow {META} at (21,37) size 218x2 [border: (1px dotted #FFFFFF)]
+            LayoutBlockFlow {META} at (21,55) size 218x2 [border: (1px dotted #FFFFFF)]
+            LayoutBlockFlow {META} at (21,73) size 218x2 [border: (1px dotted #FFFFFF)]
+            LayoutBlockFlow {META} at (21,91) size 218x2 [border: (1px dotted #FFFFFF)]
+            LayoutBlockFlow {TITLE} at (21,109) size 218x38 [border: (1px dotted #FFFFFF)]
+              LayoutText {#text} at (1,1) size 216x36
+                text run at (1,1) width 216: "Evil Tests: Rendering BODY and"
+                text run at (1,19) width 207: "HEAD as children of HTML - 2"
+            LayoutBlockFlow {STYLE} at (21,163) size 218x254 [border: (1px dotted #FFFFFF)]
+              LayoutText {#text} at (1,1) size 208x252
                 text run at (1,1) width 83: "/* Layout */ "
-                text run at (83,1) width 58: "HTML {"
-                text run at (1,19) width 177: "display: block; border: 1em"
-                text run at (1,37) width 166: "lime solid; margin: 8px; }"
-                text run at (1,55) width 165: "HEAD, BODY { display:"
-                text run at (1,73) width 190: "table-cell; border: solid thick;"
-                text run at (1,91) width 182: "padding: 1em; margin: 1em;"
-                text run at (1,109) width 12: "} "
-                text run at (12,109) width 161: "HEAD > *, BODY > * {"
-                text run at (1,127) width 174: "display: block; border: thin"
-                text run at (1,145) width 162: "dotted; margin: 1em 0; } "
-                text run at (162,145) width 14: "/*"
-                text run at (1,163) width 92: "Formatting */ "
-                text run at (92,163) width 99: "HTML { color:"
-                text run at (1,181) width 179: "black; background: green; }"
-                text run at (1,199) width 142: "HEAD { color: white;"
-                text run at (1,217) width 125: "background: red; } "
-                text run at (125,217) width 58: "BODY {"
-                text run at (1,235) width 174: "color: yellow; background:"
-                text run at (1,253) width 40: "teal; }"
-          LayoutTableCell {BODY} at (237,41) size 500x1337 [color=#FFFF00] [bgcolor=#008080] [border: (5px solid #FFFF00)] [r=0 c=1 rs=1 cs=1]
-            LayoutBlockFlow {H1} at (21,53) size 458x76 [border: (1px dotted #FFFF00)]
+                text run at (83,1) width 112: "HTML { display:"
+                text run at (1,19) width 194: "block; border: 1em lime solid;"
+                text run at (1,37) width 98: "margin: 8px; } "
+                text run at (98,37) width 111: "HEAD, BODY {"
+                text run at (1,55) width 204: "display: table-cell; border: solid"
+                text run at (1,73) width 41: "thick; "
+                text run at (41,73) width 147: "padding: 1em; margin:"
+                text run at (1,91) width 48: "1em; } "
+                text run at (48,91) width 161: "HEAD > *, BODY > * {"
+                text run at (1,109) width 174: "display: block; border: thin"
+                text run at (1,127) width 162: "dotted; margin: 1em 0; } "
+                text run at (162,127) width 14: "/*"
+                text run at (1,145) width 92: "Formatting */ "
+                text run at (92,145) width 99: "HTML { color:"
+                text run at (1,163) width 179: "black; background: green; }"
+                text run at (1,181) width 142: "HEAD { color: white;"
+                text run at (1,199) width 125: "background: red; } "
+                text run at (125,199) width 58: "BODY {"
+                text run at (1,217) width 205: "color: yellow; background: teal;"
+                text run at (1,235) width 8: "}"
+          LayoutTableCell {BODY} at (260,41) size 477x1373 [color=#FFFF00] [bgcolor=#008080] [border: (5px solid #FFFF00)] [r=0 c=1 rs=1 cs=1]
+            LayoutBlockFlow {H1} at (21,53) size 435x76 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 152x37
                 text run at (1,1) width 152: "Rendering "
               LayoutInline {CODE} at (0,0) size 63x30
@@ -57,7 +57,7 @@
                   text run at (157,43) width 63: "HTML"
               LayoutText {#text} at (219,38) size 44x37
                 text run at (219,38) width 44: " - 2"
-            LayoutBlockFlow {P} at (21,161) size 458x38 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {P} at (21,161) size 435x38 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 393x18
                 text run at (1,1) width 393: "If you have any comments to make regarding this test, e-mail"
               LayoutInline {A} at (0,0) size 186x18 [color=#0000EE]
@@ -65,11 +65,11 @@
                   text run at (1,19) width 186: "py8ieh=eviltests@bath.ac.uk"
               LayoutText {#text} at (186,19) size 5x18
                 text run at (186,19) width 5: "."
-            LayoutBlockFlow {DL} at (21,215) size 458x92 [border: (1px dotted #FFFF00)]
-              LayoutBlockFlow {DT} at (1,1) size 456x18
+            LayoutBlockFlow {DL} at (21,215) size 435x92 [border: (1px dotted #FFFF00)]
+              LayoutBlockFlow {DT} at (1,1) size 433x18
                 LayoutText {#text} at (0,0) size 83x18
                   text run at (0,0) width 83: "Prerequisites"
-              LayoutBlockFlow {DD} at (41,19) size 416x72
+              LayoutBlockFlow {DD} at (41,19) size 393x72
                 LayoutText {#text} at (0,0) size 392x54
                   text run at (0,0) width 392: "Browsers that are subjected to this test should support the the"
                   text run at (0,18) width 388: "background, padding, margin, border and color properties of"
@@ -77,69 +77,71 @@
                 LayoutInline {CODE} at (0,0) size 63x15
                   LayoutText {#text} at (160,38) size 63x15
                     text run at (160,38) width 63: "overflow"
-                LayoutText {#text} at (222,36) size 401x36
-                  text run at (222,36) width 179: " property and fixed position"
-                  text run at (0,54) width 109: "stuff from CSS2."
-            LayoutBlockFlow {H2} at (21,331) size 458x58 [border: (1px dotted #FFFF00)]
-              LayoutText {#text} at (1,1) size 440x56
-                text run at (1,1) width 440: "1. Making the BODY and the HEAD into a"
-                text run at (1,29) width 51: "table"
-            LayoutBlockFlow {P} at (21,413) size 458x20 [border: (1px dotted #FFFF00)]
+                LayoutText {#text} at (222,36) size 345x36
+                  text run at (222,36) width 123: " property and fixed"
+                  text run at (0,54) width 165: "position stuff from CSS2."
+            LayoutBlockFlow {H2} at (21,331) size 435x58 [border: (1px dotted #FFFF00)]
+              LayoutText {#text} at (1,1) size 422x56
+                text run at (1,1) width 422: "1. Making the BODY and the HEAD into"
+                text run at (1,29) width 69: "a table"
+            LayoutBlockFlow {P} at (21,413) size 435x20 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 264x18
                 text run at (1,1) width 264: "This is really evil, but completely valid..."
-            LayoutBlockFlow {P} at (21,449) size 458x110 [border: (1px dotted #FFFF00)]
-              LayoutText {#text} at (1,1) size 452x108
-                text run at (1,1) width 450: "This document should have two cells, side by side: one on the left, the"
-                text run at (1,19) width 452: "other on the right. The one on the left should be red with white writing"
-                text run at (1,37) width 445: "and a thick white border. It should contain four dotted lines separated"
-                text run at (1,55) width 419: "by a blank line, followed by a dotted bordered box containing the"
-                text run at (1,73) width 403: "document title, and another dotted bordered box containing the"
-                text run at (1,91) width 191: "stylesheet, also shown below:"
-            LayoutBlockFlow {PRE} at (21,575) size 458x17 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {P} at (21,449) size 435x110 [border: (1px dotted #FFFF00)]
+              LayoutText {#text} at (1,1) size 431x108
+                text run at (1,1) width 426: "This document should have two cells, side by side: one on the left,"
+                text run at (1,19) width 426: "the other on the right. The one on the left should be red with white"
+                text run at (1,37) width 431: "writing and a thick white border. It should contain four dotted lines"
+                text run at (1,55) width 388: "separated by a blank line, followed by a dotted bordered box"
+                text run at (1,73) width 403: "containing the document title, and another dotted bordered box"
+                text run at (1,91) width 286: "containing the stylesheet, also shown below:"
+            LayoutBlockFlow {PRE} at (21,575) size 435x17 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 39x15
                 text run at (1,1) width 39: "  ..."
                 text run at (40,1) width 0: " "
-            LayoutBlockFlow {P} at (21,608) size 458x38 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {P} at (21,608) size 435x38 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 419x36
                 text run at (1,1) width 419: "The dotted borders and lines and the text in the left cell should be"
                 text run at (1,19) width 40: "white."
-            LayoutBlockFlow {P} at (21,662) size 458x38 [border: (1px dotted #FFFF00)]
-              LayoutText {#text} at (1,1) size 447x36
-                text run at (1,1) width 447: "The right cell should be teal, with yellow text. This paragraph you are"
-                text run at (1,19) width 255: "reading now should be in this right cell."
-            LayoutBlockFlow {P} at (21,716) size 458x20 [border: (1px dotted #FFFF00)]
-              LayoutText {#text} at (1,1) size 454x18
-                text run at (1,1) width 454: "The width of the two cells is left up to the user agent to decide, I think."
-            LayoutBlockFlow {P} at (21,752) size 458x74 [border: (1px dotted #FFFF00)]
-              LayoutText {#text} at (1,1) size 443x72
-                text run at (1,1) width 443: "The right cell should look similar to the left cell in formatting -- each"
-                text run at (1,19) width 443: "box of text should have a yellow dotted border, and there should be a"
-                text run at (1,37) width 420: "blank line between each such box. No box should be nested -- the"
-                text run at (1,55) width 356: "dotted boxes should always be distinct from each other."
-            LayoutBlockFlow {P} at (21,842) size 458x38 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {P} at (21,662) size 435x38 [border: (1px dotted #FFFF00)]
+              LayoutText {#text} at (1,1) size 424x36
+                text run at (1,1) width 424: "The right cell should be teal, with yellow text. This paragraph you"
+                text run at (1,19) width 278: "are reading now should be in this right cell."
+            LayoutBlockFlow {P} at (21,716) size 435x38 [border: (1px dotted #FFFF00)]
+              LayoutText {#text} at (1,1) size 413x36
+                text run at (1,1) width 413: "The width of the two cells is left up to the user agent to decide, I"
+                text run at (1,19) width 37: "think."
+            LayoutBlockFlow {P} at (21,770) size 435x92 [border: (1px dotted #FFFF00)]
+              LayoutText {#text} at (1,1) size 414x90
+                text run at (1,1) width 409: "The right cell should look similar to the left cell in formatting --"
+                text run at (1,19) width 399: "each box of text should have a yellow dotted border, and there"
+                text run at (1,37) width 414: "should be a blank line between each such box. No box should be"
+                text run at (1,55) width 399: "nested -- the dotted boxes should always be distinct from each"
+                text run at (1,73) width 37: "other."
+            LayoutBlockFlow {P} at (21,878) size 435x38 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 417x36
                 text run at (1,1) width 417: "The cells should be the same height, and they should have grown"
                 text run at (1,19) width 229: "vertically to accommodate this text."
-            LayoutBlockFlow {P} at (21,896) size 458x56 [border: (1px dotted #FFFF00)]
-              LayoutText {#text} at (1,1) size 437x54
-                text run at (1,1) width 436: "Around the whole setup should be two borders, dark green and light"
-                text run at (1,19) width 437: "green. The cells should be separated from each other and from these"
-                text run at (1,37) width 230: "outer borders by 1em of dark green."
-            LayoutBlockFlow {P} at (21,968) size 458x38 [border: (1px dotted #FFFF00)]
-              LayoutText {#text} at (1,1) size 446x36
-                text run at (1,1) width 446: "There should also be some alternate stylesheets set up to allow you to"
-                text run at (1,19) width 389: "display the <META> content. This may help with diagnosis."
-            LayoutBlockFlow {H2} at (21,1030) size 458x30 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {P} at (21,932) size 435x56 [border: (1px dotted #FFFF00)]
+              LayoutText {#text} at (1,1) size 433x54
+                text run at (1,1) width 403: "Around the whole setup should be two borders, dark green and"
+                text run at (1,19) width 433: "light green. The cells should be separated from each other and from"
+                text run at (1,37) width 267: "these outer borders by 1em of dark green."
+            LayoutBlockFlow {P} at (21,1004) size 435x38 [border: (1px dotted #FFFF00)]
+              LayoutText {#text} at (1,1) size 429x36
+                text run at (1,1) width 429: "There should also be some alternate stylesheets set up to allow you"
+                text run at (1,19) width 406: "to display the <META> content. This may help with diagnosis."
+            LayoutBlockFlow {H2} at (21,1066) size 435x30 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 156x28
                 text run at (1,1) width 156: "Submit Results"
-            LayoutBlockFlow {FORM} at (21,1084) size 458x90 [border: (1px dotted #FFFF00)]
-              LayoutBlockFlow {P} at (1,17) size 456x56
+            LayoutBlockFlow {FORM} at (21,1120) size 435x90 [border: (1px dotted #FFFF00)]
+              LayoutBlockFlow {P} at (1,17) size 433x56
                 LayoutText {#text} at (0,0) size 263x18
                   text run at (0,0) width 263: "How does your browser fare on this test?"
-                LayoutMenuList {SELECT} at (0,19) size 456x18 [color=#000000] [bgcolor=#F8F8F8]
-                  LayoutBlockFlow (anonymous) at (0,0) size 456x18
-                    LayoutText (anonymous) at (8,2) size 214x13
-                      text run at (8,2) width 214: "Document renders exactly as described."
+                LayoutMenuList {SELECT} at (0,19) size 433x18 [color=#000000] [bgcolor=#F8F8F8]
+                  LayoutBlockFlow (anonymous) at (0,0) size 433x18
+                    LayoutText (anonymous) at (8,2) size 202x13
+                      text run at (8,2) width 202: "Document renders exactly as described."
                 LayoutText {#text} at (0,0) size 0x0
                 LayoutInline {LABEL} at (0,0) size 203x18
                   LayoutText {#text} at (0,37) size 72x18
@@ -147,19 +149,19 @@
                   LayoutTextControl {INPUT} at (71.55,37) size 131x19 [color=#000000] [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
                 LayoutText {#text} at (202,37) size 5x18
                   text run at (202,37) width 5: " "
-                LayoutButton {INPUT} at (206.55,38) size 53.45x18 [color=#000000] [bgcolor=#C0C0C0]
-                  LayoutBlockFlow (anonymous) at (8,2) size 37.45x13
-                    LayoutText {#text} at (0,0) size 38x13
-                      text run at (0,0) width 38: "Submit"
+                LayoutButton {INPUT} at (206.55,38) size 51.64x18 [color=#000000] [bgcolor=#C0C0C0]
+                  LayoutBlockFlow (anonymous) at (8,2) size 35.64x13
+                    LayoutText {#text} at (0,0) size 36x13
+                      text run at (0,0) width 36: "Submit"
                 LayoutText {#text} at (0,0) size 0x0
-            LayoutBlockFlow {HR} at (21,1190) size 458x2 [border: (1px dotted #FFFF00)]
-            LayoutBlockFlow {P} at (21,1208) size 458x20 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {HR} at (21,1226) size 435x2 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {P} at (21,1244) size 435x20 [border: (1px dotted #FFFF00)]
               LayoutInline {A} at (0,0) size 164x18 [color=#0000EE]
                 LayoutText {#text} at (1,1) size 164x18
                   text run at (1,1) width 164: "Up to the Evil Tests Page"
               LayoutText {#text} at (164,1) size 5x18
                 text run at (164,1) width 5: "."
-            LayoutBlockFlow {P} at (21,1244) size 458x20 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {P} at (21,1280) size 435x20 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 177x18
                 text run at (1,1) width 177: "This page is maintained by "
               LayoutInline {A} at (0,0) size 79x18 [color=#0000EE]
@@ -172,8 +174,8 @@
                   text run at (264,1) width 125: "py8ieh@bath.ac.uk"
               LayoutText {#text} at (388,1) size 10x18
                 text run at (388,1) width 10: ")."
-            LayoutBlockFlow {P} at (21,1280) size 458x20 [border: (1px dotted #FFFF00)]
+            LayoutBlockFlow {P} at (21,1316) size 435x20 [border: (1px dotted #FFFF00)]
               LayoutText {#text} at (1,1) size 172x18
                 text run at (1,1) width 172: "Last updated in June 1999."
-layer at (358,1206) size 125x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0
+layer at (381,1242) size 125x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0
   LayoutBlockFlow {DIV} at (3,3) size 125x13
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug58402-2-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug58402-2-expected.png
index 78481ff..77f982f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug58402-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug58402-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug58402-2-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug58402-2-expected.txt
index ff2e9fe..8e9fa38 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug58402-2-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/bugs/bug58402-2-expected.txt
@@ -33,14 +33,14 @@
               LayoutText {#text} at (2,2) size 37x18
                 text run at (2,2) width 37: "row 3"
       LayoutBlockFlow (anonymous) at (0,240) size 784x19
-        LayoutButton {INPUT} at (0,1) size 55.09x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 39.09x13
-            LayoutText {#text} at (0,0) size 40x13
-              text run at (0,0) width 40: "expand"
-        LayoutText {#text} at (55,0) size 5x18
-          text run at (55,0) width 5: " "
-        LayoutButton {INPUT} at (59.09,1) size 42.55x18 [bgcolor=#C0C0C0]
-          LayoutBlockFlow (anonymous) at (8,2) size 26.55x13
-            LayoutText {#text} at (0,0) size 27x13
-              text run at (0,0) width 27: "sizes"
+        LayoutButton {INPUT} at (0,1) size 53.28x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 37.28x13
+            LayoutText {#text} at (0,0) size 38x13
+              text run at (0,0) width 38: "expand"
+        LayoutText {#text} at (53,0) size 5x18
+          text run at (53,0) width 5: " "
+        LayoutButton {INPUT} at (57.28,1) size 41.03x18 [bgcolor=#C0C0C0]
+          LayoutBlockFlow (anonymous) at (8,2) size 25.03x13
+            LayoutText {#text} at (0,0) size 26x13
+              text run at (0,0) width 26: "sizes"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-5-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-5-expected.png
index be07194..9bf5ac6 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-5-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-5-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-5-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-5-expected.txt
index 87c6188..7dd2265 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-5-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-5-expected.txt
@@ -49,35 +49,35 @@
                 LayoutText {#text} at (2,1) size 37x18
                   text run at (2,1) width 37: "11pm"
         LayoutBlockFlow {P} at (0,96) size 784x36
-          LayoutButton {BUTTON} at (270.03,0) size 75.33x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 59.33x13
-              LayoutText {#text} at (0,0) size 60x13
-                text run at (0,0) width 19: "No "
-                text run at (18,0) width 42: "borders"
-          LayoutButton {BUTTON} at (345.36,0) size 95.25x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 79.25x13
-              LayoutText {#text} at (0,0) size 80x13
-                text run at (0,0) width 45: "Exterior "
-                text run at (44,0) width 36: "border"
-          LayoutButton {BUTTON} at (440.61,0) size 73.36x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 57.36x13
-              LayoutText {#text} at (0,0) size 58x13
-                text run at (0,0) width 17: "All "
-                text run at (16,0) width 42: "borders"
-          LayoutBR {BR} at (513,13) size 1x0
-          LayoutButton {BUTTON} at (235.84,18) size 100.98x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 84.98x13
-              LayoutText {#text} at (0,0) size 85x13
-                text run at (0,0) width 45: "Column "
-                text run at (44,0) width 41: "borders"
-          LayoutButton {BUTTON} at (336.83,18) size 99.11x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 83.11x13
-              LayoutText {#text} at (0,0) size 84x13
-                text run at (0,0) width 43: "Groups "
-                text run at (42,0) width 42: "borders"
-          LayoutButton {BUTTON} at (435.94,18) size 112.22x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 96.22x13
-              LayoutText {#text} at (0,0) size 97x13
-                text run at (0,0) width 33: "Table "
-                text run at (32,0) width 65: "row borders"
+          LayoutButton {BUTTON} at (275.45,0) size 72.31x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 56.31x13
+              LayoutText {#text} at (0,0) size 57x13
+                text run at (0,0) width 18: "No "
+                text run at (17,0) width 40: "borders"
+          LayoutButton {BUTTON} at (347.77,0) size 90.73x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 74.73x13
+              LayoutText {#text} at (0,0) size 75x13
+                text run at (0,0) width 42: "Exterior "
+                text run at (41,0) width 34: "border"
+          LayoutButton {BUTTON} at (438.50,0) size 70.03x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 54.03x13
+              LayoutText {#text} at (0,0) size 55x13
+                text run at (0,0) width 16: "All "
+                text run at (15,0) width 40: "borders"
+          LayoutBR {BR} at (508,13) size 1x0
+          LayoutButton {BUTTON} at (242.63,18) size 96.77x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 80.77x13
+              LayoutText {#text} at (0,0) size 81x13
+                text run at (0,0) width 43: "Column "
+                text run at (42,0) width 39: "borders"
+          LayoutButton {BUTTON} at (339.39,18) size 94.89x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 78.89x13
+              LayoutText {#text} at (0,0) size 79x13
+                text run at (0,0) width 41: "Groups "
+                text run at (40,0) width 39: "borders"
+          LayoutButton {BUTTON} at (434.28,18) size 107.08x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 91.08x13
+              LayoutText {#text} at (0,0) size 92x13
+                text run at (0,0) width 31: "Table "
+                text run at (30,0) width 62: "row borders"
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-6-expected.png b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-6-expected.png
index e496567..5749c7a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-6-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-6-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-6-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-6-expected.txt
index 89f92a5..fc5b635 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-6-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/tables/mozilla_expected_failures/collapsing_borders/bug41262-6-expected.txt
@@ -49,35 +49,35 @@
                 LayoutText {#text} at (2,1) size 37x18
                   text run at (2,1) width 37: "11pm"
         LayoutBlockFlow {P} at (0,98) size 784x36
-          LayoutButton {BUTTON} at (270.03,0) size 75.33x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 59.33x13
-              LayoutText {#text} at (0,0) size 60x13
-                text run at (0,0) width 19: "No "
-                text run at (18,0) width 42: "borders"
-          LayoutButton {BUTTON} at (345.36,0) size 95.25x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 79.25x13
-              LayoutText {#text} at (0,0) size 80x13
-                text run at (0,0) width 45: "Exterior "
-                text run at (44,0) width 36: "border"
-          LayoutButton {BUTTON} at (440.61,0) size 73.36x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 57.36x13
-              LayoutText {#text} at (0,0) size 58x13
-                text run at (0,0) width 17: "All "
-                text run at (16,0) width 42: "borders"
-          LayoutBR {BR} at (513,13) size 1x0
-          LayoutButton {BUTTON} at (235.84,18) size 100.98x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 84.98x13
-              LayoutText {#text} at (0,0) size 85x13
-                text run at (0,0) width 45: "Column "
-                text run at (44,0) width 41: "borders"
-          LayoutButton {BUTTON} at (336.83,18) size 99.11x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 83.11x13
-              LayoutText {#text} at (0,0) size 84x13
-                text run at (0,0) width 43: "Groups "
-                text run at (42,0) width 42: "borders"
-          LayoutButton {BUTTON} at (435.94,18) size 112.22x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
-            LayoutBlockFlow (anonymous) at (8,2) size 96.22x13
-              LayoutText {#text} at (0,0) size 97x13
-                text run at (0,0) width 33: "Table "
-                text run at (32,0) width 65: "row borders"
+          LayoutButton {BUTTON} at (275.45,0) size 72.31x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 56.31x13
+              LayoutText {#text} at (0,0) size 57x13
+                text run at (0,0) width 18: "No "
+                text run at (17,0) width 40: "borders"
+          LayoutButton {BUTTON} at (347.77,0) size 90.73x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 74.73x13
+              LayoutText {#text} at (0,0) size 75x13
+                text run at (0,0) width 42: "Exterior "
+                text run at (41,0) width 34: "border"
+          LayoutButton {BUTTON} at (438.50,0) size 70.03x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 54.03x13
+              LayoutText {#text} at (0,0) size 55x13
+                text run at (0,0) width 16: "All "
+                text run at (15,0) width 40: "borders"
+          LayoutBR {BR} at (508,13) size 1x0
+          LayoutButton {BUTTON} at (242.63,18) size 96.77x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 80.77x13
+              LayoutText {#text} at (0,0) size 81x13
+                text run at (0,0) width 43: "Column "
+                text run at (42,0) width 39: "borders"
+          LayoutButton {BUTTON} at (339.39,18) size 94.89x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 78.89x13
+              LayoutText {#text} at (0,0) size 79x13
+                text run at (0,0) width 41: "Groups "
+                text run at (40,0) width 39: "borders"
+          LayoutButton {BUTTON} at (434.28,18) size 107.08x18 [bgcolor=#C0C0C0] [border: none (2px outset #C0C0C0) none (2px outset #C0C0C0)]
+            LayoutBlockFlow (anonymous) at (8,2) size 91.08x13
+              LayoutText {#text} at (0,0) size 92x13
+                text run at (0,0) width 31: "Table "
+                text run at (30,0) width 62: "row borders"
           LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/transforms/2d/zoom-menulist-expected.png b/third_party/WebKit/LayoutTests/platform/mac/transforms/2d/zoom-menulist-expected.png
index 86b2285..e02010c 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/transforms/2d/zoom-menulist-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/transforms/2d/zoom-menulist-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/transforms/2d/zoom-menulist-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/transforms/2d/zoom-menulist-expected.txt
index f9c2e4f..b625474 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/transforms/2d/zoom-menulist-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/transforms/2d/zoom-menulist-expected.txt
@@ -7,8 +7,8 @@
         LayoutText {#text} at (0,0) size 273x37
           text run at (0,0) width 273: "Zooming Menu List"
       LayoutBlockFlow (anonymous) at (0,58.44) size 784x54
-        LayoutMenuList {SELECT} at (0,0) size 177x54 [bgcolor=#F8F8F8] [border: (3px solid #A6A6A6)]
-          LayoutBlockFlow (anonymous) at (3,3) size 171x48
-            LayoutText (anonymous) at (24,3) size 61x39
-              text run at (24,3) width 61: "One"
+        LayoutMenuList {SELECT} at (0,0) size 179x54 [bgcolor=#F8F8F8] [border: (3px solid #A6A6A6)]
+          LayoutBlockFlow (anonymous) at (3,3) size 173x48
+            LayoutText (anonymous) at (24,3) size 63x39
+              text run at (24,3) width 63: "One"
         LayoutText {#text} at (0,0) size 0x0
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/pointerevent/fast/events/autoscroll-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/pointerevent/fast/events/autoscroll-expected.png
index 02c37bd..836f265f 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/pointerevent/fast/events/autoscroll-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/pointerevent/fast/events/autoscroll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/pointerevent/fast/events/autoscroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/pointerevent/fast/events/autoscroll-expected.txt
new file mode 100644
index 0000000..cf79a4e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/pointerevent/fast/events/autoscroll-expected.txt
@@ -0,0 +1,31 @@
+layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollY 2563.00 scrollHeight 3163
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 785x3163 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
+  LayoutBlockFlow {HTML} at (0,0) size 785x3163
+    LayoutBlockFlow {BODY} at (8,8) size 769x3139
+      LayoutBlockFlow {P} at (0,0) size 769x18
+        LayoutText {#text} at (0,0) size 55x18
+          text run at (0,0) width 55: "Test for "
+        LayoutInline {A} at (0,0) size 69x18 [color=#0000EE]
+          LayoutText {#text} at (54,0) size 69x18
+            text run at (54,0) width 69: "bug 12331"
+        LayoutText {#text} at (122,0) size 5x18
+          text run at (122,0) width 5: "."
+      LayoutBlockFlow {P} at (0,34) size 769x36
+        LayoutText {#text} at (0,0) size 756x36
+          text run at (0,0) width 756: "To test manually, scroll down until you find the input element. Select some text. If the bug occurs, the page will scroll"
+          text run at (0,18) width 119: "back up to the top."
+      LayoutBlockFlow {DIV} at (0,86) size 769x3000
+      LayoutBlockFlow (anonymous) at (0,3086) size 769x19
+        LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow {P} at (0,3121) size 769x18
+        LayoutText {#text} at (0,0) size 412x18
+          text run at (0,0) width 412: "If the bug does not occur, you'll be left down here at the bottom."
+layer at (11,3097) size 125x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0
+  LayoutBlockFlow {DIV} at (3,3) size 125x13
+    LayoutText {#text} at (0,0) size 116x13
+      text run at (0,0) width 116: "select some of this text"
+selection start: position 2 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
+selection end:   position 18 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
+scrolled to 0,2563
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
deleted file mode 100644
index ce54543..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
+++ /dev/null
@@ -1,92 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [200, 200],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [200, 200],
-              "shouldFlattenTransform": false,
-              "transform": [
-                [1, 0, 0, 0],
-                [0, 1, 0, 0],
-                [0, 0, 1, -0.01],
-                [0, 0, 0, 1]
-              ],
-              "children": [
-                {
-                  "bounds": [185, 185],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "bounds": [185, 265],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false,
-                          "children": [
-                            {
-                              "position": [0, 65],
-                              "bounds": [60, 200],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#008000",
-                              "transform": [
-                                [1, 0, 0, 0],
-                                [0, 1, 0, 0],
-                                [0, 0, 1, 0],
-                                [0, 0, 10, 1]
-                              ]
-                            },
-                            {
-                              "position": [65, 65],
-                              "bounds": [60, 200],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#0000FF",
-                              "transform": [
-                                [1, 0, 0, 0],
-                                [0, 1, 0, 0],
-                                [0, 0, 1, 0],
-                                [0, 0, 20, 1]
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 185],
-                  "bounds": [185, 15]
-                },
-                {
-                  "position": [185, 0],
-                  "bounds": [15, 185]
-                },
-                {
-                  "position": [185, 185],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
deleted file mode 100644
index 3639926..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [308, 208],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [4, 4],
-              "bounds": [285, 200],
-              "children": [
-                {
-                  "bounds": [285, 530],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [289, 4],
-                  "bounds": [15, 185]
-                },
-                {
-                  "position": [289, 189],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [50, 200],
-          "bounds": [200, 200],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [12, 12],
-          "bounds": [80, 80],
-          "shouldFlattenTransform": false,
-          "hasScrollParent": true,
-          "children": [
-            {
-              "position": [10, 10],
-              "bounds": [100, 100],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#FF0000"
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "hasScrollParent": true,
-          "children": [
-            {
-              "position": [22, 102],
-              "bounds": [100, 100],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [22, 212],
-              "bounds": [100, 320],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
deleted file mode 100644
index ffcafae5..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
+++ /dev/null
@@ -1,132 +0,0 @@
-{
-  "bounds": [800, 600],
-  "paintingPhases": [
-    "GraphicsLayerPaintBackground",
-    "GraphicsLayerPaintForeground",
-    "GraphicsLayerPaintMask"
-  ],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "paintingPhases": [
-        "GraphicsLayerPaintBackground",
-        "GraphicsLayerPaintForeground",
-        "GraphicsLayerPaintMask"
-      ],
-      "children": [
-        {
-          "bounds": [800, 242],
-          "drawsContent": true,
-          "paintingPhases": [
-            "GraphicsLayerPaintBackground",
-            "GraphicsLayerPaintMask"
-          ],
-          "children": [
-            {
-              "position": [29, 31],
-              "bounds": [80, 10],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#008000",
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintForeground",
-                "GraphicsLayerPaintMask"
-              ]
-            },
-            {
-              "bounds": [800, 242],
-              "drawsContent": true,
-              "paintingPhases": [
-                "GraphicsLayerPaintForeground"
-              ]
-            },
-            {
-              "position": [28, 20],
-              "bounds": [202, 202],
-              "drawsContent": true,
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintMask",
-                "GraphicsLayerPaintCompositedScroll"
-              ],
-              "children": [
-                {
-                  "position": [1, 1],
-                  "bounds": [185, 185],
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ],
-                  "children": [
-                    {
-                      "bounds": [185, 715],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintOverflowContents",
-                        "GraphicsLayerPaintCompositedScroll"
-                      ],
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false,
-                          "paintingPhases": [
-                            "GraphicsLayerPaintForeground",
-                            "GraphicsLayerPaintOverflowContents",
-                            "GraphicsLayerPaintCompositedScroll"
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ],
-                  "children": [
-                    {
-                      "position": [1, 186],
-                      "bounds": [185, 15],
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    },
-                    {
-                      "position": [186, 1],
-                      "bounds": [15, 185],
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    },
-                    {
-                      "position": [186, 186],
-                      "bounds": [15, 15],
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
deleted file mode 100644
index e34bb0c8..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 100],
-              "children": [
-                {
-                  "bounds": [85, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 100]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 85],
-              "children": [
-                {
-                  "bounds": [200, 85],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [100, 15]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [200, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 100],
-              "children": [
-                {
-                  "bounds": [10, 10]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents-expected.png
index 7e549df1..b3d41eca 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/do-not-paint-outline-into-composited-scrolling-contents-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
deleted file mode 100644
index e51ea0cb..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [285, 285],
-              "children": [
-                {
-                  "bounds": [1000, 1000],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 285],
-                  "bounds": [285, 15]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 285]
-                },
-                {
-                  "position": [285, 285],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
deleted file mode 100644
index e51ea0cb..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [285, 285],
-              "children": [
-                {
-                  "bounds": [1000, 1000],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 285],
-                  "bounds": [285, 15]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 285]
-                },
-                {
-                  "position": [285, 285],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
deleted file mode 100644
index e51ea0cb..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [285, 285],
-              "children": [
-                {
-                  "bounds": [1000, 1000],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 285],
-                  "bounds": [285, 15]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 285]
-                },
-                {
-                  "position": [285, 285],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
deleted file mode 100644
index e34bb0c8..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
+++ /dev/null
@@ -1,148 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 100],
-              "children": [
-                {
-                  "bounds": [85, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 100]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 85],
-              "children": [
-                {
-                  "bounds": [200, 85],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [100, 15]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [200, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 100],
-              "children": [
-                {
-                  "bounds": [10, 10]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
deleted file mode 100644
index 25a29071..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-{
-  "bounds": [1208, 821],
-  "children": [
-    {
-      "bounds": [1208, 821],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [1200, 800],
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "bounds": [1200, 800],
-              "drawsContent": true,
-              "children": [
-                {
-                  "bounds": [1200, 800],
-                  "children": [
-                    {
-                      "bounds": [1200, 1000],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [1200, 1000],
-                          "drawsContent": true,
-                          "children": [
-                            {
-                              "bounds": [1200, 1000],
-                              "children": [
-                                {
-                                  "bounds": [1200, 10000],
-                                  "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 10008],
-          "bounds": [1200, 0]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [1200, 1000],
-          "children": [
-            {
-              "children": [
-                {
-                  "position": [1193, 0],
-                  "bounds": [7, 1000]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
deleted file mode 100644
index b391a74..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
+++ /dev/null
@@ -1,80 +0,0 @@
-{
-  "bounds": [785, 5516],
-  "children": [
-    {
-      "bounds": [785, 5516],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [8, 8],
-              "bounds": [500, 500],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF",
-              "children": [
-                {
-                  "bounds": [485, 485],
-                  "children": [
-                    {
-                      "bounds": [485, 5000],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [0, 485],
-                      "bounds": [485, 15]
-                    },
-                    {
-                      "position": [485, 0],
-                      "bounds": [15, 485]
-                    },
-                    {
-                      "position": [485, 485],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [8, 8],
-              "bounds": [400, 400],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backfaceVisibility": "hidden",
-          "backgroundColor": "#FFFF00"
-        },
-        {
-          "position": [8, 8],
-          "bounds": [20, 5000],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#FA8072",
-          "hasScrollParent": true
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
deleted file mode 100644
index d3f96465..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [98, 90],
-          "bounds": [300, 300],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backfaceVisibility": "hidden",
-          "backgroundColor": "#FFEFD5",
-          "children": [
-            {
-              "bounds": [102, 102],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [1, 1],
-                  "bounds": [100, 100],
-                  "children": [
-                    {
-                      "bounds": [100, 180],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [60, 60],
-          "bounds": [80, 80],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [103, 95],
-              "bounds": [60, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [103, 139],
-              "bounds": [60, 128],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [98, 90],
-          "children": [
-            {
-              "position": [94, 1],
-              "bounds": [7, 100]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
deleted file mode 100644
index 82f793e..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
+++ /dev/null
@@ -1,57 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "bounds": [320, 340],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [305, 325],
-              "children": [
-                {
-                  "bounds": [305, 1224],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 325],
-                  "bounds": [305, 15]
-                },
-                {
-                  "position": [305, 0],
-                  "bounds": [15, 325]
-                },
-                {
-                  "position": [305, 325],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [10, 10],
-          "bounds": [284, 1204],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#C0C0C0"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
index 5bb4b2d6..2f93caa5 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
@@ -18,12 +18,7 @@
                 {
                   "bounds": [185, 1025],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 41b46cb..d956378 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -141,10 +136,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2511],
+  "bounds": [785, 2436],
   "children": [
     {
-      "bounds": [785, 2511],
+      "bounds": [785, 2436],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -161,12 +156,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -268,10 +258,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4416],
+  "bounds": [785, 4266],
   "children": [
     {
-      "bounds": [785, 4416],
+      "bounds": [785, 4266],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -285,15 +275,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -395,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6321],
+  "bounds": [785, 6051],
   "children": [
     {
-      "bounds": [785, 6321],
+      "bounds": [785, 6051],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -412,14 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
index c3d9d853..655e094 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -138,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2448],
+  "bounds": [785, 2373],
   "children": [
     {
-      "bounds": [785, 2448],
+      "bounds": [785, 2373],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -155,15 +150,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -265,10 +252,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4353],
+  "bounds": [785, 4158],
   "children": [
     {
-      "bounds": [785, 4353],
+      "bounds": [785, 4158],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -282,14 +269,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index a523eab7..595a6d3 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -138,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2466],
+  "bounds": [785, 2391],
   "children": [
     {
-      "bounds": [785, 2466],
+      "bounds": [785, 2391],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -158,12 +153,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -265,10 +255,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4371],
+  "bounds": [785, 4221],
   "children": [
     {
-      "bounds": [785, 4371],
+      "bounds": [785, 4221],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -285,12 +275,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -392,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6276],
+  "bounds": [785, 6051],
   "children": [
     {
-      "bounds": [785, 6276],
+      "bounds": [785, 6051],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -409,15 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
index 509faf40..af6afbc 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
@@ -193,11 +193,6 @@
                     "InlineTextBox '\n'",
                     "InlineTextBox '  Text'",
                     "InlineTextBox '\n'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
index 58d0260..a7f9b307 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
@@ -74,11 +74,6 @@
                     "InlineTextBox 'Findme in a typewriter!'",
                     "LayoutSVGInlineText #text",
                     "InlineTextBox 'Findme on a path! Did you findme?'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
index 6562a91..0ef5bac 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 270],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -59,12 +54,7 @@
                 {
                   "bounds": [189, 270],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
deleted file mode 100644
index 7ca7dcf..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
+++ /dev/null
@@ -1,1005 +0,0 @@
-{
-  "bounds": [785, 2016],
-  "children": [
-    {
-      "bounds": [785, 2016],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [10, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15]
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85]
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [35, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [130, 10],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [157, 18],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [136, -15],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [250, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15]
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85]
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [275, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [370, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15]
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85]
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [395, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [10, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [37, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [16, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [130, 130],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15]
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85]
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [155, 195],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 105],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 161],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [250, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [277, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [256, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [370, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [397, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [376, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [10, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [35, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [130, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [155, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [250, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [275, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [370, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15]
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85]
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [395, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [375, 20],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [15, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [135, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [255, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [15, 260],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [135, 260],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
index b02d6cf55..f87db437 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
@@ -103,11 +103,6 @@
                     "InlineTextBox 'CONTENT'",
                     "LayoutText #text",
                     "InlineTextBox 'CONTENT'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
deleted file mode 100644
index c39fc44..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 108],
-          "bounds": [210, 210],
-          "drawsContent": true,
-          "repaintRects": [
-            [0, 0, 210, 210]
-          ],
-          "paintInvalidationClients": [
-            "LayoutBlockFlow DIV id='container'"
-          ],
-          "children": [
-            {
-              "position": [5, 5],
-              "bounds": [185, 185],
-              "children": [
-                {
-                  "bounds": [400, 400],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "repaintRects": [
-                    [-5, -5, 210, 210]
-                  ],
-                  "paintInvalidationClients": [
-                    "LayoutBlockFlow DIV id='container'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [5, 190],
-                  "bounds": [185, 15]
-                },
-                {
-                  "position": [190, 5],
-                  "bounds": [15, 185]
-                },
-                {
-                  "position": [190, 190],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
index c7895ce..4b9345a 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='indicator'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png
new file mode 100644
index 0000000..f3c604d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png
new file mode 100644
index 0000000..767b178
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png
new file mode 100644
index 0000000..bedd1e1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/selection/text-selection-newline-br-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/selection/text-selection-newline-br-expected.png
index 65720485..fcfe07d 100644
--- a/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/selection/text-selection-newline-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/spv2/paint/selection/text-selection-newline-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.png b/third_party/WebKit/LayoutTests/platform/mac/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.png
new file mode 100644
index 0000000..836f265f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.txt b/third_party/WebKit/LayoutTests/platform/mac/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.txt
new file mode 100644
index 0000000..cf79a4e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/mac/virtual/trustedeventsdefaultaction/fast/events/autoscroll-expected.txt
@@ -0,0 +1,31 @@
+layer at (0,0) size 800x600 clip at (0,0) size 785x600 scrollY 2563.00 scrollHeight 3163
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 785x3163 backgroundClip at (0,0) size 785x600 clip at (0,0) size 785x600
+  LayoutBlockFlow {HTML} at (0,0) size 785x3163
+    LayoutBlockFlow {BODY} at (8,8) size 769x3139
+      LayoutBlockFlow {P} at (0,0) size 769x18
+        LayoutText {#text} at (0,0) size 55x18
+          text run at (0,0) width 55: "Test for "
+        LayoutInline {A} at (0,0) size 69x18 [color=#0000EE]
+          LayoutText {#text} at (54,0) size 69x18
+            text run at (54,0) width 69: "bug 12331"
+        LayoutText {#text} at (122,0) size 5x18
+          text run at (122,0) width 5: "."
+      LayoutBlockFlow {P} at (0,34) size 769x36
+        LayoutText {#text} at (0,0) size 756x36
+          text run at (0,0) width 756: "To test manually, scroll down until you find the input element. Select some text. If the bug occurs, the page will scroll"
+          text run at (0,18) width 119: "back up to the top."
+      LayoutBlockFlow {DIV} at (0,86) size 769x3000
+      LayoutBlockFlow (anonymous) at (0,3086) size 769x19
+        LayoutTextControl {INPUT} at (0,0) size 131x19 [bgcolor=#FFFFFF] [border: (2px inset #EEEEEE)]
+        LayoutText {#text} at (0,0) size 0x0
+      LayoutBlockFlow {P} at (0,3121) size 769x18
+        LayoutText {#text} at (0,0) size 412x18
+          text run at (0,0) width 412: "If the bug does not occur, you'll be left down here at the bottom."
+layer at (11,3097) size 125x13 backgroundClip at (0,0) size 0x0 clip at (0,0) size 0x0
+  LayoutBlockFlow {DIV} at (3,3) size 125x13
+    LayoutText {#text} at (0,0) size 116x13
+      text run at (0,0) width 116: "select some of this text"
+selection start: position 2 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
+selection end:   position 18 of child 0 {#text} of child 0 {DIV} of {#document-fragment} of child 7 {INPUT} of body
+scrolled to 0,2563
diff --git a/third_party/WebKit/LayoutTests/platform/mac/webaudio/audiobuffersource-loop-points-expected.wav b/third_party/WebKit/LayoutTests/platform/mac/webaudio/audiobuffersource-loop-points-expected.wav
deleted file mode 100644
index 72b09d8..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/webaudio/audiobuffersource-loop-points-expected.wav
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/mac/webaudio/audiobuffersource-playbackrate-expected.wav b/third_party/WebKit/LayoutTests/platform/mac/webaudio/audiobuffersource-playbackrate-expected.wav
deleted file mode 100644
index 8b9802ff..0000000
--- a/third_party/WebKit/LayoutTests/platform/mac/webaudio/audiobuffersource-playbackrate-expected.wav
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/iframes/invisible-nested-iframe-show-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/iframes/invisible-nested-iframe-show-expected.txt
index 2593df88..4dbc934 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/iframes/invisible-nested-iframe-show-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/iframes/invisible-nested-iframe-show-expected.txt
@@ -79,8 +79,7 @@
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
+                  "bounds": [15, 150]
                 }
               ]
             }
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
index d888fc7..ff2a18fd 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
@@ -20,12 +20,7 @@
                 {
                   "bounds": [285, 800],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -33,13 +28,11 @@
               "children": [
                 {
                   "position": [1, 286],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [286, 1],
-                  "bounds": [15, 285],
-                  "drawsContent": true
+                  "bounds": [15, 285]
                 },
                 {
                   "position": [286, 286],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 920c00cce..058b91a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -47,13 +42,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -143,10 +136,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2658],
+  "bounds": [785, 2546],
   "children": [
     {
-      "bounds": [785, 2658],
+      "bounds": [785, 2546],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -163,12 +156,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -176,13 +164,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -272,10 +258,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4722],
+  "bounds": [785, 4498],
   "children": [
     {
-      "bounds": [785, 4722],
+      "bounds": [785, 4498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,15 +275,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -305,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -401,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6786],
+  "bounds": [785, 6402],
   "children": [
     {
-      "bounds": [785, 6786],
+      "bounds": [785, 6402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -418,14 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -433,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-toggling-expected.txt
index 10b4bbd..6f74aec 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2610],
+  "bounds": [785, 2498],
   "children": [
     {
-      "bounds": [785, 2610],
+      "bounds": [785, 2498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -157,15 +150,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -173,13 +158,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +252,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4674],
+  "bounds": [785, 4402],
   "children": [
     {
-      "bounds": [785, 4674],
+      "bounds": [785, 4402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -286,14 +269,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -301,13 +277,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 64ad064..2c91562 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2610],
+  "bounds": [785, 2498],
   "children": [
     {
-      "bounds": [785, 2610],
+      "bounds": [785, 2498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -160,12 +153,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -173,13 +161,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +255,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4674],
+  "bounds": [785, 4450],
   "children": [
     {
-      "bounds": [785, 4674],
+      "bounds": [785, 4450],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,12 +275,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -302,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -398,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6738],
+  "bounds": [785, 6402],
   "children": [
     {
-      "bounds": [785, 6738],
+      "bounds": [785, 6402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -415,15 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -431,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/textarea-scroll-touch-expected.txt
index 380b605..f9ac3308 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 328],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -34,8 +29,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
@@ -60,12 +54,7 @@
                 {
                   "bounds": [189, 328],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -73,8 +62,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
index 9010262c..08f6211 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='content'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -43,23 +38,15 @@
                 {
                   "position": [0, 485],
                   "bounds": [485, 15],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 485, 15]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
                   "position": [485, 0],
                   "bounds": [15, 485],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 485]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
deleted file mode 100644
index 82f0392..0000000
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
deleted file mode 100644
index 82f0392..0000000
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/squashing/selection-repaint-with-gaps-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/squashing/selection-repaint-with-gaps-expected.txt
index e8a6a74..8f7d7ce1 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/compositing/squashing/selection-repaint-with-gaps-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/compositing/squashing/selection-repaint-with-gaps-expected.txt
@@ -19,8 +19,7 @@
               "bounds": [100, 210],
               "drawsContent": true,
               "repaintRects": [
-                [34, 80, 6, 19],
-                [0, 80, 35, 39]
+                [0, 80, 38, 39]
               ]
             }
           ]
@@ -49,12 +48,8 @@
               "bounds": [100, 210],
               "drawsContent": true,
               "repaintRects": [
-                [34, 160, 6, 19],
-                [34, 80, 6, 39],
-                [34, 80, 6, 19],
-                [0, 160, 35, 39],
-                [0, 80, 100, 50],
-                [0, 80, 35, 39]
+                [0, 160, 38, 39],
+                [0, 80, 39, 39]
               ]
             }
           ]
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-expected.txt
index 2c4545a2..66ffdf7f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-expected.txt
@@ -61,7 +61,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-hw-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-hw-expected.png
index d15c7545..480a3e4 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-hw-expected.txt
index c3a369e..185942a7 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-hw-expected.txt
@@ -61,7 +61,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-expected.txt
index 5165fe7..b7ba329 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-expected.txt
@@ -59,7 +59,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-hw-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-hw-expected.png
index c99a015..9f671ce1 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-hw-expected.txt
index 5165fe7..b7ba329 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-subregion-hw-expected.txt
@@ -59,7 +59,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-tile-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-tile-expected.txt
index 60b528f9..72301b7 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-tile-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-tile-expected.txt
@@ -7,19 +7,19 @@
         LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
           LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
       LayoutText {#text} at (0,95) size 4x19
         text run at (0,95) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-tile-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-tile-hw-expected.txt
index 60b528f9..72301b7 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-tile-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/filters/effect-reference-tile-hw-expected.txt
@@ -7,19 +7,19 @@
         LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
           LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
       LayoutText {#text} at (0,95) size 4x19
         text run at (0,95) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/css3/flexbox/flexbox-baseline-margins-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/css3/flexbox/flexbox-baseline-margins-expected.png
index ec61197..0fcde72c 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/css3/flexbox/flexbox-baseline-margins-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/css3/flexbox/flexbox-baseline-margins-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/deleting/delete-to-select-table-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/deleting/delete-to-select-table-expected.png
index d27d6349..65d89e3f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/deleting/delete-to-select-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/deleting/delete-to-select-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/4916541-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/4916541-expected.png
index a9464ba9..2815760 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/4916541-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/4916541-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5136770-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5136770-expected.png
index 3690ca0..d3752b0 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5136770-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5136770-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5142012-1-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5142012-1-expected.png
index 9b635b2..1bbbca8 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5142012-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5142012-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5190926-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5190926-expected.png
index bd9f293..3079bb0 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5190926-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5190926-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5481523-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5481523-expected.png
index adf6933..7a0b7aa 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5481523-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/5481523-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/indent-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/indent-selection-expected.png
index 7779a992..d8e8c20 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/indent-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/indent-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/remove-list-from-range-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/remove-list-from-range-selection-expected.png
index c68de08..172f4cd 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/remove-list-from-range-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/remove-list-from-range-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/selectAll-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/selectAll-expected.png
index 46699aa..5d9b8680 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/selectAll-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/execCommand/selectAll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690703-2-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690703-2-expected.png
index 5a7e4ce..3dece2c 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690703-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690703-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690703-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690703-expected.png
index 3e44625c..1560872 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690703-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690703-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690719-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690719-expected.png
index 3e44625c..1560872 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690719-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/3690719-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/4818145-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/4818145-expected.png
index 6a83e724..5da7ba5 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/4818145-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/4818145-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/4947387-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/4947387-expected.png
index 19c8bee..084d606 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/4947387-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/4947387-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5057506-2-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5057506-2-expected.png
index e84b044..786ad01 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5057506-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5057506-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5057506-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5057506-expected.png
index 950250a2..1e2fe18 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5057506-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5057506-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5232159-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5232159-expected.png
index c4e448d..20b770f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5232159-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/5232159-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/7152-1-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/7152-1-expected.png
index fd1762e..2dec8d4 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/7152-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/7152-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/7152-2-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/7152-2-expected.png
index ad57fb4..c408954 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/7152-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/7152-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/doubleclick-crash-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/doubleclick-crash-expected.png
new file mode 100644
index 0000000..50384e3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/doubleclick-crash-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/doubleclick-crash-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/doubleclick-crash-expected.txt
new file mode 100644
index 0000000..35e23c77
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/doubleclick-crash-expected.txt
@@ -0,0 +1,17 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 (0,0) size 800x587
+      LayoutBlockFlow {PRE} at (0,0) size 800x80
+        LayoutText {#text} at (0,0) size 40x64
+          text run at (0,0) width 40: "Test."
+          text run at (40,0) width 0: " "
+          text run at (0,16) width 40: "Test."
+          text run at (40,16) width 0: " "
+          text run at (0,32) width 0: " "
+          text run at (0,48) width 0: " "
+        LayoutText {#text} at (0,64) size 0x16
+          text run at (0,64) width 0: " "
+caret: position 5 of child 0 {#text} of child 1 {PRE} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-by-character-002-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-by-character-002-expected.png
index 3581305..39102b9 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-by-character-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-by-character-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-by-character-003-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-by-character-003-expected.png
index 8cf9f24..e648ebe5 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-by-character-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-by-character-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-inside-transforms-backward-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-inside-transforms-backward-expected.png
index 4e69c40..16b06b6c 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-inside-transforms-backward-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-inside-transforms-backward-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-inside-transforms-forward-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-inside-transforms-forward-expected.png
index 62558b5..dc48fa10 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-inside-transforms-forward-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/extend-inside-transforms-forward-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/image-before-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/image-before-linebreak-expected.png
index 07dea51..edb9758 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/image-before-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/image-before-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/mixed-editability-6-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/mixed-editability-6-expected.png
index 70c24a1..7210e28 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/mixed-editability-6-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/mixed-editability-6-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/mixed-editability-7-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/mixed-editability-7-expected.png
index d96844d..d6119d7 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/mixed-editability-7-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/mixed-editability-7-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/node-removal-2-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/node-removal-2-expected.png
index 6da0198b4..dccfabf 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/node-removal-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/node-removal-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/paragraph-granularity-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/paragraph-granularity-expected.png
index 39177c62..29c5fed 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/paragraph-granularity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/paragraph-granularity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/range-between-block-and-inline-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/range-between-block-and-inline-expected.png
index 9ad52c9..cfe48e3 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/range-between-block-and-inline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/range-between-block-and-inline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/replaced-boundaries-3-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/replaced-boundaries-3-expected.png
index e1cd7a46..d3fe2c25 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/replaced-boundaries-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/replaced-boundaries-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-001-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-001-expected.png
index 1f86dfb3..1ca15d9 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-002-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-002-expected.png
index c74a638..335471c4 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-003-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-003-expected.png
index 49f080c3..3617ddf 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-004-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-004-expected.png
index aca9f58..8825679 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-all-004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-missing-image-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-missing-image-expected.png
index a43cea3..d92bad4 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-missing-image-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/select-missing-image-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/selection-actions-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/selection-actions-expected.png
index 061fb39..c7818fff 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/selection-actions-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/selection-actions-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/selection-button-text-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/selection-button-text-expected.png
index 352b999..61a412e5 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/selection-button-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/selection-button-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/transformed-selection-rects-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/transformed-selection-rects-expected.png
index a545785..2b96cde3 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/transformed-selection-rects-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/transformed-selection-rects-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
index de1b736..bbc0ef5 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
index 98ccbffd..ce8f6d5 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
index e2fc47b..ac862dac 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
index 9bc7f69..bf848f3 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
index 863a036c..ac862dac 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
index a87e635..cf5748a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
index d7aaea32..4c21dd88 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
index a317373..cf5748a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
index e43ee839..d10e03d9e 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
index 85be87a6..c9582d50 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
index e43ee839..d10e03d9e 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
index 85be87a6..c9582d50 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/word-granularity-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/word-granularity-expected.png
index a791f07..b3a77c9 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/word-granularity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/selection/word-granularity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5017613-1-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5017613-1-expected.png
index 6a8d1d4..1e1b189 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5017613-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5017613-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5017613-2-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5017613-2-expected.png
index 4012d60..9a015b0 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5017613-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5017613-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5046875-1-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5046875-1-expected.png
index 5ec290a..05a9c86 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5046875-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5046875-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5228141-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5228141-expected.png
index 19ac7b9..59f2a3e 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5228141-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5228141-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5279521-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5279521-expected.png
index 4082ef5..87e1b95f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5279521-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/5279521-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/apple-style-editable-mix-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/apple-style-editable-mix-expected.png
index 781c3964..1686084 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/apple-style-editable-mix-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/apple-style-editable-mix-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/block-style-003-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/block-style-003-expected.png
index 80342a4..e6552975 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/block-style-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/block-style-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-005-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-005-expected.png
index daa88f4..9462bc3 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-006-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-006-expected.png
index a49765a5..edef3df 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-006-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-006-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-010-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-010-expected.png
index e50f5bd2..5c92871 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-010-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-010-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-011-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-011-expected.png
index ab8afbfb..98916998 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-011-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-011-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-012-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-012-expected.png
index ebe9949..759ce6a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-012-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/create-block-for-style-012-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/relative-font-size-change-001-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/relative-font-size-change-001-expected.png
index 139d152..23ce46ff 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/relative-font-size-change-001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/relative-font-size-change-001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/relative-font-size-change-002-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/relative-font-size-change-002-expected.png
index 2f1fe5c..fb42515 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/relative-font-size-change-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/relative-font-size-change-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/style-3998892-fix-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/style-3998892-fix-expected.png
index 6d98a34..ded85d6a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/style-3998892-fix-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/style-3998892-fix-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/style-boundary-004-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/style-boundary-004-expected.png
index 1855136..cfaf248 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/style-boundary-004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/style-boundary-004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/table-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/table-selection-expected.png
index 716992c..419d5e3 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/table-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/editing/style/table-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/backgrounds/selection-background-color-of-image-list-style-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
index 123cda31..916d971 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/backgrounds/selection-background-color-of-list-style-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/backgrounds/selection-background-color-of-list-style-expected.png
index f9d94b6..da67da03 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/backgrounds/selection-background-color-of-list-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/backgrounds/selection-background-color-of-list-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/basic-textareas-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/basic-textareas-expected.png
index 2e8069f66..5e9a400f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/basic-textareas-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/basic-textareas-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/form-added-to-table-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/form-added-to-table-expected.png
index bc766ba9..d102112 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/form-added-to-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/form-added-to-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/listbox-appearance-basic-expected.png
index 910a6df..a84d8dd 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/listbox-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/listbox-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/listbox-appearance-basic-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/listbox-appearance-basic-expected.txt
index ce4fbf3..8633398a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/listbox-appearance-basic-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/listbox-appearance-basic-expected.txt
@@ -5,20 +5,20 @@
     LayoutBlockFlow {BODY} at (8,8) size 769x611
       LayoutText {#text} at (46,59) size 4x19
         text run at (46,59) width 4: " "
-      LayoutText {#text} at (97,59) size 4x19
-        text run at (97,59) width 4: " "
+      LayoutText {#text} at (129,59) size 4x19
+        text run at (129,59) width 4: " "
       LayoutText {#text} at (0,0) size 0x0
-      LayoutText {#text} at (148,59) size 4x19
-        text run at (148,59) width 4: " "
-      LayoutText {#text} at (218,59) size 4x19
-        text run at (218,59) width 4: " "
-      LayoutText {#text} at (275,59) size 4x19
-        text run at (275,59) width 4: " "
-      LayoutText {#text} at (332,59) size 4x19
-        text run at (332,59) width 4: " "
-      LayoutText {#text} at (389,59) size 4x19
-        text run at (389,59) width 4: " "
-      LayoutBR {BR} at (393,59) size 0x19
+      LayoutText {#text} at (180,59) size 4x19
+        text run at (180,59) width 4: " "
+      LayoutText {#text} at (250,59) size 4x19
+        text run at (250,59) width 4: " "
+      LayoutText {#text} at (307,59) size 4x19
+        text run at (307,59) width 4: " "
+      LayoutText {#text} at (364,59) size 4x19
+        text run at (364,59) width 4: " "
+      LayoutText {#text} at (421,59) size 4x19
+        text run at (421,59) width 4: " "
+      LayoutBR {BR} at (425,59) size 0x19
       LayoutText {#text} at (50,142) size 4x19
         text run at (50,142) width 4: " "
       LayoutText {#text} at (100,142) size 4x19
@@ -49,24 +49,27 @@
     LayoutBlockFlow {OPTION} at (1,1) size 21x17
       LayoutText {#text} at (2,0) size 17x16
         text run at (2,0) width 17: "foo"
-layer at (62,12) size 39x70 clip at (63,13) size 22x68
-  LayoutListBox {SELECT} at (54,4) size 39x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
-    LayoutBlockFlow {OPTION} at (1,1) size 22x17 [color=#FFFFCC] [bgcolor=#0000FF]
+layer at (62,12) size 71x70 clip at (63,13) size 54x68
+  LayoutListBox {SELECT} at (54,4) size 71x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+    LayoutBlockFlow {OPTION} at (1,1) size 54x17 [color=#FFFFCC] [bgcolor=#0000FF]
       LayoutText {#text} at (2,0) size 17x16
         text run at (2,0) width 17: "foo"
-    LayoutBlockFlow {OPTION} at (1,18) size 22x17
+    LayoutBlockFlow {OPTION} at (1,18) size 54x17
       LayoutText {#text} at (2,0) size 18x16
         text run at (2,0) width 18: "bar"
-layer at (113,12) size 39x70 clip at (114,13) size 22x68
-  LayoutListBox {SELECT} at (105,4) size 39x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+    LayoutBlockFlow {OPTION} at (1,35) size 54x17 [color=#808080] [bgcolor=#999999]
+      LayoutText {#text} at (2,0) size 50x16
+        text run at (2,0) width 50: "Disabled"
+layer at (145,12) size 39x70 clip at (146,13) size 22x68
+  LayoutListBox {SELECT} at (137,4) size 39x70 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 22x17 [color=#FFFFFF] [bgcolor=#999999]
       LayoutText {#text} at (2,0) size 17x16
         text run at (2,0) width 17: "foo"
     LayoutBlockFlow {OPTION} at (1,18) size 22x17 [color=#808080] [bgcolor=#999999]
       LayoutText {#text} at (2,0) size 18x16
         text run at (2,0) width 18: "bar"
-layer at (164,12) size 58x70 clip at (165,13) size 41x68
-  LayoutListBox {SELECT} at (156,4) size 58x70 [color=#808080] [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+layer at (196,12) size 58x70 clip at (197,13) size 41x68
+  LayoutListBox {SELECT} at (188,4) size 58x70 [color=#808080] [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 41x17 [bgcolor=#999999]
       LayoutText {#text} at (2,0) size 17x16
         text run at (2,0) width 17: "foo"
@@ -81,8 +84,8 @@
             text run at (2,0) width 16: "    "
         LayoutText {#text} at (18,0) size 21x16
           text run at (18,0) width 21: "baz"
-layer at (234,63) size 45x19 clip at (235,64) size 28x17 scrollHeight 68
-  LayoutListBox {SELECT} at (226,55) size 45x19 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+layer at (266,63) size 45x19 clip at (267,64) size 28x17 scrollHeight 68
+  LayoutListBox {SELECT} at (258,55) size 45x19 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo1"
@@ -95,8 +98,8 @@
     LayoutBlockFlow {OPTION} at (1,52) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo4"
-layer at (291,46) size 45x36 clip at (292,47) size 28x34 scrollHeight 68
-  LayoutListBox {SELECT} at (283,38) size 45x36 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+layer at (323,46) size 45x36 clip at (324,47) size 28x34 scrollHeight 68
+  LayoutListBox {SELECT} at (315,38) size 45x36 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo1"
@@ -109,8 +112,8 @@
     LayoutBlockFlow {OPTION} at (1,52) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo4"
-layer at (348,29) size 45x53 clip at (349,30) size 28x51 scrollHeight 68
-  LayoutListBox {SELECT} at (340,21) size 45x53 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
+layer at (380,29) size 45x53 clip at (381,30) size 28x51 scrollHeight 68
+  LayoutListBox {SELECT} at (372,21) size 45x53 [bgcolor=#FFFFFF] [border: (1px solid #A9A9A9)]
     LayoutBlockFlow {OPTION} at (1,1) size 28x17
       LayoutText {#text} at (2,0) size 24x16
         text run at (2,0) width 24: "foo1"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/menulist-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/menulist-appearance-basic-expected.png
index dbea3cc..ae466e0 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/menulist-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/select/menulist-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/textarea-scrolled-focus-ring-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/textarea-scrolled-focus-ring-expected.png
index f71c6d7..4b5da96 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/textarea-scrolled-focus-ring-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/forms/textarea-scrolled-focus-ring-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/layers/scroll-rect-to-visible-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/layers/scroll-rect-to-visible-expected.png
index f0fd7b8..d86fa4b 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/layers/scroll-rect-to-visible-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/layers/scroll-rect-to-visible-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/lists/markers-in-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/lists/markers-in-selection-expected.png
index fdf01a2..9b6968f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/lists/markers-in-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/lists/markers-in-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/image-selection-highlight-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/image-selection-highlight-expected.png
index 6513fdf..4fe0b68 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/image-selection-highlight-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/image-selection-highlight-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/overflow-x-y-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/overflow-x-y-expected.png
index 46bc706..a8c4a02 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/overflow-x-y-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/overflow/overflow-x-y-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/parser/open-comment-in-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/parser/open-comment-in-textarea-expected.png
index 4410f2ae..980dedf 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/parser/open-comment-in-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/parser/open-comment-in-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/delete-into-nested-block-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/delete-into-nested-block-expected.txt
index 3051fab..877fc43 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/delete-into-nested-block-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/delete-into-nested-block-expected.txt
@@ -11,7 +11,6 @@
         [8, 147, 784, 41],
         [8, 147, 784, 21],
         [8, 147, 23, 20],
-        [8, 127, 784, 40],
         [8, 127, 784, 21],
         [8, 127, 30, 20],
         [8, 127, 22, 20],
@@ -19,7 +18,6 @@
         [7, 126, 3, 22]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'one'",
         "LayoutText #text",
         "RootInlineBox",
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/japanese-rl-selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/japanese-rl-selection-clear-expected.txt
index 578e9c9c..402b9a6 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/japanese-rl-selection-clear-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/japanese-rl-selection-clear-expected.txt
@@ -6,11 +6,9 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [442, 123, 335, 397],
-        [442, 23, 335, 554]
+        [442, 123, 335, 397]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "LayoutText #text",
         "InlineTextBox '\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042'",
         "InlineTextBox '\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B\u306A'",
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/japanese-rl-selection-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/japanese-rl-selection-repaint-expected.txt
index 933bbc2..c4235da 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/japanese-rl-selection-repaint-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/japanese-rl-selection-repaint-expected.txt
@@ -6,7 +6,6 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [562, 544, 215, 33],
         [538, 23, 239, 553]
       ],
       "paintInvalidationClients": [
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-after-delete-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-after-delete-expected.txt
index 0ba4132..c6d7ce9 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-after-delete-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-after-delete-expected.txt
@@ -10,8 +10,7 @@
         [38, 100, 152, 80],
         [38, 99, 152, 81],
         [38, 79, 152, 99],
-        [38, 78, 3, 21],
-        [8, 79, 784, 99]
+        [38, 78, 3, 21]
       ],
       "paintInvalidationClients": [
         "InlineTextBox 'hello world hello world'",
@@ -24,7 +23,6 @@
         "InlineTextBox ' '",
         "InlineTextBox 'hello'",
         "LayoutText #text",
-        "LayoutBlockFlow HTML",
         "RootInlineBox",
         "RootInlineBox",
         "RootInlineBox",
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-after-remove-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-after-remove-expected.txt
index be49fcdf..a4161be 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-after-remove-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-after-remove-expected.txt
@@ -12,12 +12,9 @@
         [39, 79, 32, 19],
         [38, 100, 152, 80],
         [38, 99, 152, 81],
-        [38, 79, 152, 99],
-        [8, 79, 784, 99],
-        [8, 79, 784, 99]
+        [38, 79, 152, 99]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'world hello world'",
         "InlineTextBox ' '",
         "InlineTextBox 'hello world hello world'",
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-clear-expected.txt
index af80b83..37d3098 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-clear-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-clear-expected.txt
@@ -8,16 +8,12 @@
       "repaintRects": [
         [8, 208, 100, 100],
         [8, 108, 100, 100],
-        [8, 48, 784, 160],
-        [8, 48, 784, 160],
-        [8, 48, 784, 60],
         [8, 48, 90, 119],
         [8, 48, 4, 19],
         [8, 8, 100, 200],
         [8, 8, 100, 100]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'FAIL: Test did'",
         "InlineTextBox 'not run'",
         "LayoutText #text",
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
index d8071f3..d7cb92a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
@@ -6,10 +6,9 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [11, 35, 70, 19],
-        [11, 34, 778, 22],
-        [11, 11, 51, 19],
-        [11, 10, 778, 22]
+        [11, 35, 74, 19],
+        [11, 11, 55, 19],
+        [11, 11, 51, 19]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow HTML",
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-textarea-expected.png
index ccb238b4..d85efac 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/replaced/width100percent-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/midword-break-before-surrogate-pair-expected.png
index 2c94a37c..8fdd620 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/midword-break-before-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/midword-break-before-surrogate-pair-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/midword-break-before-surrogate-pair-expected.txt
index edd3b1fe..bc4ee65b 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/midword-break-before-surrogate-pair-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/midword-break-before-surrogate-pair-expected.txt
@@ -1,9 +1,22 @@
+CONSOLE WARNING: Failed to decode downloaded font: NotoSansSymbols-Regular-u1d49e,1f1ef.ttf
 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 186x92 [border: (3px solid #0000FF)]
+      LayoutBlockFlow {P} at (0,0) size 784x40
+        LayoutText {#text} at (0,0) size 768x39
+          text run at (0,0) width 768: "The following box should break the sequence of symbols at the 5 character mark and not overflow the blue box. This is because"
+          text run at (0,20) width 188: "U+1D49 is a number category "
+          text run at (188,20) width 279: "unicode character, for which break-all applies."
+      LayoutBlockFlow {DIV} at (0,56) size 186x92 [border: (3px solid #0000FF)]
         LayoutText {#text} at (3,4) size 168x84
           text run at (3,4) width 168: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
           text run at (3,47) width 112: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,164) size 784x20
+        LayoutText {#text} at (0,0) size 732x19
+          text run at (0,0) width 505: "The following box should not break the sequence of symbols since U+1F1EF is not "
+          text run at (505,0) width 227: "a letter or number category character."
+      LayoutBlockFlow {DIV} at (0,200) size 186x49 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,4) size 448x41
+          text run at (3,4) width 448: "\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}"
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-hard-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-hard-linebreak-expected.png
index a5d4e78..9c9c799 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-hard-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-hard-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-painting-hidpi-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-painting-hidpi-expected.png
new file mode 100644
index 0000000..b79c669ba
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-painting-hidpi-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-painting-hidpi-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-painting-hidpi-expected.txt
new file mode 100644
index 0000000..5f74367
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-painting-hidpi-expected.txt
@@ -0,0 +1,50 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x36
+  LayoutBlockFlow {HTML} at (0,0) size 800x36
+    LayoutBlockFlow {BODY} at (8,8) size 784x20
+      LayoutBlockFlow {DIV} at (0,0) size 285x20
+        LayoutInline {SPAN} at (0,0) size 35x19
+          LayoutText {#text} at (0,0) size 35x19
+            text run at (0,0) width 35: "There"
+        LayoutText {#text} at (35,0) size 4x19
+          text run at (35,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 39x19
+          LayoutText {#text} at (39,0) size 39x19
+            text run at (39,0) width 39: "should"
+        LayoutText {#text} at (78,0) size 4x19
+          text run at (78,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 15x19
+          LayoutText {#text} at (82,0) size 15x19
+            text run at (82,0) width 15: "be"
+        LayoutText {#text} at (97,0) size 4x19
+          text run at (97,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 15x19
+          LayoutText {#text} at (101,0) size 15x19
+            text run at (101,0) width 15: "no"
+        LayoutText {#text} at (116,0) size 4x19
+          text run at (116,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 32x19
+          LayoutText {#text} at (120,0) size 32x19
+            text run at (120,0) width 32: "white"
+        LayoutText {#text} at (152,0) size 4x19
+          text run at (152,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 28x19
+          LayoutText {#text} at (156,0) size 28x19
+            text run at (156,0) width 28: "gaps"
+        LayoutText {#text} at (184,0) size 4x19
+          text run at (184,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 51x19
+          LayoutText {#text} at (188,0) size 51x19
+            text run at (188,0) width 51: "between"
+        LayoutText {#text} at (239,0) size 4x19
+          text run at (239,0) width 4: " "
+        LayoutInline {SPAN} at (0,0) size 38x19
+          LayoutText {#text} at (243,0) size 38x19
+            text run at (243,0) width 38: "words"
+        LayoutText {#text} at (281,0) size 4x19
+          text run at (281,0) width 4: "."
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutText {#text} at (0,0) size 0x0
+selection start: position 0 of child 0 {#text} of child 1 {SPAN} of child 1 {DIV} of body
+selection end:   position 1 of child 16 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-rect-rounding-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-rect-rounding-expected.png
index a5331c3..1ef7c2a3 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-rect-rounding-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/selection-rect-rounding-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/shaping/shaping-selection-rect-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/shaping/shaping-selection-rect-expected.png
index e990f63..f2c738f 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/shaping/shaping-selection-rect-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/shaping/shaping-selection-rect-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/whitespace/pre-wrap-overflow-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
index d24196e..f79aea6a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
index 24823a60..7fe3095 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/horizontal-bt-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
index 36e98fb..04a6d0b4 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/japanese-lr-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/japanese-lr-selection-expected.png
index 09f8d04..e58f057 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/japanese-lr-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/japanese-lr-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/japanese-rl-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/japanese-rl-selection-expected.png
index 0f759cdf..03a0121 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/japanese-rl-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/japanese-rl-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/vertical-lr-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/vertical-lr-replaced-selection-expected.png
index 209603d..40d301d 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/vertical-lr-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/vertical-lr-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/vertical-rl-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/vertical-rl-replaced-selection-expected.png
index 06d216b3..bdaf762 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/vertical-rl-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/fast/writing-mode/vertical-rl-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/paint/selection/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/paint/selection/selection-within-composited-scroller-expected.txt
index 6e6942a..56f7d2e 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/paint/selection/selection-within-composited-scroller-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/paint/selection/selection-within-composited-scroller-expected.txt
@@ -41,11 +41,6 @@
                     "LayoutBlockFlow DIV id='target'",
                     "LayoutText #text",
                     "InlineTextBox 'test'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -54,13 +49,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/svg/text/foreignObject-text-clipping-bug-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/svg/text/foreignObject-text-clipping-bug-expected.png
index 494cd482..6b0e914 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/svg/text/foreignObject-text-clipping-bug-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/svg/text/foreignObject-text-clipping-bug-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 920c00cce..058b91a 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -47,13 +42,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -143,10 +136,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2658],
+  "bounds": [785, 2546],
   "children": [
     {
-      "bounds": [785, 2658],
+      "bounds": [785, 2546],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -163,12 +156,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -176,13 +164,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -272,10 +258,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4722],
+  "bounds": [785, 4498],
   "children": [
     {
-      "bounds": [785, 4722],
+      "bounds": [785, 4498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,15 +275,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -305,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -401,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6786],
+  "bounds": [785, 6402],
   "children": [
     {
-      "bounds": [785, 6786],
+      "bounds": [785, 6402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -418,14 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -433,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
index 10b4bbd..6f74aec 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2610],
+  "bounds": [785, 2498],
   "children": [
     {
-      "bounds": [785, 2610],
+      "bounds": [785, 2498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -157,15 +150,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -173,13 +158,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +252,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4674],
+  "bounds": [785, 4402],
   "children": [
     {
-      "bounds": [785, 4674],
+      "bounds": [785, 4402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -286,14 +269,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -301,13 +277,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 64ad064..2c91562 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2610],
+  "bounds": [785, 2498],
   "children": [
     {
-      "bounds": [785, 2610],
+      "bounds": [785, 2498],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -160,12 +153,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -173,13 +161,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +255,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4674],
+  "bounds": [785, 4450],
   "children": [
     {
-      "bounds": [785, 4674],
+      "bounds": [785, 4450],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,12 +275,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -302,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -398,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6738],
+  "bounds": [785, 6402],
   "children": [
     {
-      "bounds": [785, 6738],
+      "bounds": [785, 6402],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -415,15 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -431,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
index 7b4a438..1abe5f1 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
@@ -193,11 +193,6 @@
                     "InlineTextBox '\n'",
                     "InlineTextBox '  Text'",
                     "InlineTextBox '\n'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -206,13 +201,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
index 59761dc..d0973db 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
@@ -74,11 +74,6 @@
                     "InlineTextBox 'Findme in a typewriter!'",
                     "LayoutSVGInlineText #text",
                     "InlineTextBox 'Findme on a path! Did you findme?'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -87,13 +82,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [785, 15],
-                  "drawsContent": true
+                  "bounds": [785, 15]
                 },
                 {
                   "position": [785, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [785, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
index 380b605..f9ac3308 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 328],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -34,8 +29,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
@@ -60,12 +54,7 @@
                 {
                   "bounds": [189, 328],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -73,8 +62,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
index 93f12ef..ce6d6bd 100644
--- a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
@@ -103,11 +103,6 @@
                     "InlineTextBox 'CONTENT'",
                     "LayoutText #text",
                     "InlineTextBox 'CONTENT'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -116,13 +111,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png
new file mode 100644
index 0000000..2e02559d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win-xp/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png
new file mode 100644
index 0000000..a3add720
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win-xp/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/force-compositing-mode/overflow-iframe-enter-compositing-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/force-compositing-mode/overflow-iframe-enter-compositing-expected.txt
deleted file mode 100644
index c32f17d..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/force-compositing-mode/overflow-iframe-enter-compositing-expected.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [154, 154],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [150, 150],
-              "children": [
-                {
-                  "bounds": [135, 135],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [508, 516],
-                          "children": [
-                            {
-                              "bounds": [508, 516],
-                              "drawsContent": true
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [0, 135],
-                  "bounds": [135, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [135, 0],
-                  "bounds": [15, 135],
-                  "drawsContent": true
-                },
-                {
-                  "position": [135, 135],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "bounds": [508, 516],
-  "children": [
-    {
-      "bounds": [508, 516],
-      "drawsContent": true
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/force-compositing-mode/overflow-iframe-layer-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/force-compositing-mode/overflow-iframe-layer-expected.txt
deleted file mode 100644
index c32f17d..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/force-compositing-mode/overflow-iframe-layer-expected.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [154, 154],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [150, 150],
-              "children": [
-                {
-                  "bounds": [135, 135],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [508, 516],
-                          "children": [
-                            {
-                              "bounds": [508, 516],
-                              "drawsContent": true
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [0, 135],
-                  "bounds": [135, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [135, 0],
-                  "bounds": [15, 135],
-                  "drawsContent": true
-                },
-                {
-                  "position": [135, 135],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "bounds": [508, 516],
-  "children": [
-    {
-      "bounds": [508, 516],
-      "drawsContent": true
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/become-overlapped-iframe-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/become-overlapped-iframe-expected.txt
deleted file mode 100644
index a0b24f4..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/become-overlapped-iframe-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [58, 58],
-          "bounds": [350, 200],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [15, 15],
-              "bounds": [320, 170],
-              "children": [
-                {
-                  "bounds": [305, 170],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [305, 230],
-                          "children": [
-                            {
-                              "bounds": [305, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [305, 0],
-                  "bounds": [15, 170],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [5, 5],
-          "bounds": [150, 150],
-          "drawsContent": true,
-          "backgroundColor": "#00000099"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '-->'
---------
-{
-  "bounds": [305, 230],
-  "children": [
-    {
-      "bounds": [305, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/composited-parent-iframe-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/composited-parent-iframe-expected.txt
deleted file mode 100644
index beab796..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/composited-parent-iframe-expected.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [-12, -12],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe-delayed-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe-delayed-expected.txt
deleted file mode 100644
index 10dc15a..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe-delayed-expected.txt
+++ /dev/null
@@ -1,93 +0,0 @@
-
-When the parent document becomes composited, the layer trees should get connected together.
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 108],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [100, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe-expected.txt
deleted file mode 100644
index c369d6a..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [5, 5],
-          "bounds": [50, 50],
-          "drawsContent": true,
-          "backgroundColor": "#00000033"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe2-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe2-expected.txt
deleted file mode 100644
index c369d6a..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe2-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [5, 5],
-          "bounds": [50, 50],
-          "drawsContent": true,
-          "backgroundColor": "#00000033"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe3-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe3-expected.txt
deleted file mode 100644
index 45fbd25..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/connect-compositing-iframe3-expected.txt
+++ /dev/null
@@ -1,84 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/enter-compositing-iframe-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/enter-compositing-iframe-expected.txt
deleted file mode 100644
index c369d6a..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/enter-compositing-iframe-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [5, 5],
-          "bounds": [50, 50],
-          "drawsContent": true,
-          "backgroundColor": "#00000033"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/iframe-resize-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/iframe-resize-expected.txt
deleted file mode 100644
index c35e724..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/iframe-resize-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [470, 190],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [400, 120],
-              "children": [
-                {
-                  "bounds": [385, 120],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [385, 230],
-                          "children": [
-                            {
-                              "bounds": [385, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [385, 0],
-                  "bounds": [15, 120],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [5, 5],
-          "bounds": [50, 50],
-          "drawsContent": true,
-          "backgroundColor": "#00000033"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '-->'
---------
-{
-  "bounds": [385, 230],
-  "children": [
-    {
-      "bounds": [385, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/iframe-size-from-zero-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/iframe-size-from-zero-expected.txt
deleted file mode 100644
index 04d8dac..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/iframe-size-from-zero-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [28, 28],
-          "bounds": [330, 180],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [15, 15],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [5, 5],
-          "bounds": [50, 50],
-          "drawsContent": true,
-          "backgroundColor": "#00000033"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/invisible-nested-iframe-show-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/invisible-nested-iframe-show-expected.txt
deleted file mode 100644
index 9bace11..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/invisible-nested-iframe-show-expected.txt
+++ /dev/null
@@ -1,187 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [-12, -12],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 192],
-                          "children": [
-                            {
-                              "bounds": [285, 192],
-                              "drawsContent": true,
-                              "children": [
-                                {
-                                  "position": [8, 8],
-                                  "bounds": [252, 172],
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "position": [1, 1],
-                                      "bounds": [250, 170],
-                                      "children": [
-                                        {
-                                          "bounds": [250, 170],
-                                          "children": [
-                                            {
-                                              "children": [
-                                                {
-                                                  "bounds": [250, 230],
-                                                  "children": [
-                                                    {
-                                                      "bounds": [250, 230],
-                                                      "drawsContent": true,
-                                                      "backgroundColor": "#C0C0C0",
-                                                      "children": [
-                                                        {
-                                                          "position": [18, 10],
-                                                          "bounds": [210, 210],
-                                                          "contentsOpaque": true,
-                                                          "drawsContent": true,
-                                                          "backgroundColor": "#0000FF"
-                                                        }
-                                                      ]
-                                                    }
-                                                  ]
-                                                }
-                                              ]
-                                            }
-                                          ]
-                                        }
-                                      ]
-                                    }
-                                  ]
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [18, 202],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF",
-          "transform": [
-            [1, 0, 0, 0],
-            [0, 1, 0, 0],
-            [0, 0, 1, 0],
-            [0, 0, 1, 1]
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '-->'
---------
-{
-  "bounds": [285, 192],
-  "children": [
-    {
-      "bounds": [285, 192],
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [252, 172],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [1, 1],
-              "bounds": [250, 170],
-              "children": [
-                {
-                  "bounds": [250, 170],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [250, 230],
-                          "children": [
-                            {
-                              "bounds": [250, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '/-->'
---------
-{
-  "bounds": [250, 230],
-  "children": [
-    {
-      "bounds": [250, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/overlapped-iframe-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/overlapped-iframe-expected.txt
deleted file mode 100644
index 831b26c4..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/overlapped-iframe-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [5, 5],
-          "bounds": [50, 50],
-          "drawsContent": true,
-          "backgroundColor": "#00000033"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/resizer-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/resizer-expected.txt
deleted file mode 100644
index d3f3b06..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/resizer-expected.txt
+++ /dev/null
@@ -1,89 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [304, 154],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 150],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [285, 230],
-                          "children": [
-                            {
-                              "bounds": [285, 230],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [18, 10],
-                                  "bounds": [210, 210],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 150],
-                  "drawsContent": true
-                }
-              ]
-            },
-            {
-              "position": [287, 137],
-              "bounds": [15, 15],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '-->'
---------
-{
-  "bounds": [285, 230],
-  "children": [
-    {
-      "bounds": [285, 230],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [18, 10],
-          "bounds": [210, 210],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/scrolling-iframe-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/scrolling-iframe-expected.txt
deleted file mode 100644
index 0e04dd5..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/iframes/scrolling-iframe-expected.txt
+++ /dev/null
@@ -1,100 +0,0 @@
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [370, 220],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [35, 35],
-              "bounds": [300, 150],
-              "children": [
-                {
-                  "bounds": [285, 135],
-                  "children": [
-                    {
-                      "children": [
-                        {
-                          "bounds": [508, 608],
-                          "children": [
-                            {
-                              "bounds": [508, 608],
-                              "drawsContent": true,
-                              "backgroundColor": "#C0C0C0",
-                              "children": [
-                                {
-                                  "position": [108, 100],
-                                  "bounds": [200, 200],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#0000FF"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [0, 135],
-                  "bounds": [285, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 135],
-                  "drawsContent": true
-                },
-                {
-                  "position": [285, 135],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [5, 5],
-          "bounds": [50, 50],
-          "drawsContent": true,
-          "backgroundColor": "#00000033"
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '-->'
---------
-{
-  "bounds": [508, 608],
-  "children": [
-    {
-      "bounds": [508, 608],
-      "drawsContent": true,
-      "backgroundColor": "#C0C0C0",
-      "children": [
-        {
-          "position": [108, 100],
-          "bounds": [200, 200],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#0000FF"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
deleted file mode 100644
index 1930fc2..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/layer-creation/fixed-position-in-fixed-overflow-expected.txt
+++ /dev/null
@@ -1,53 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [800, 600],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [785, 600],
-              "children": [
-                {
-                  "bounds": [785, 1000],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "position": [192, 0],
-                          "bounds": [100, 100],
-                          "contentsOpaque": true,
-                          "drawsContent": true,
-                          "backgroundColor": "#FFFF00"
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [785, 0],
-                  "bounds": [15, 600],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
deleted file mode 100644
index b0200a5..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/layer-creation/fixed-position-nonscrollable-body-mismatch-containers-expected.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-Even though the fixed-position element's container is nonscrollable, it should still be composited because one of its ancestors is scrolling.
-
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 68],
-          "bounds": [302, 302],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [1, 1],
-              "bounds": [285, 285],
-              "children": [
-                {
-                  "bounds": [285, 800],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [1, 286],
-                  "bounds": [285, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [286, 1],
-                  "bounds": [15, 285],
-                  "drawsContent": true
-                },
-                {
-                  "position": [286, 286],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [10, 100],
-          "bounds": [100, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#00FF00"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/clear-scroll-parent-expected.txt
deleted file mode 100644
index ab91040..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/clear-scroll-parent-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [308, 208],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [4, 4],
-              "bounds": [285, 200],
-              "children": [
-                {
-                  "bounds": [285, 530],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [289, 4],
-                  "bounds": [15, 185],
-                  "drawsContent": true
-                },
-                {
-                  "position": [289, 189],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [50, 200],
-          "bounds": [200, 200],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [12, 12],
-          "bounds": [80, 80],
-          "shouldFlattenTransform": false,
-          "hasScrollParent": true,
-          "children": [
-            {
-              "position": [10, 10],
-              "bounds": [100, 100],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#FF0000"
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "hasScrollParent": true,
-          "children": [
-            {
-              "position": [22, 102],
-              "bounds": [100, 100],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [22, 212],
-              "bounds": [100, 320],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/composited-scrolling-paint-phases-expected.txt
deleted file mode 100644
index 143d38a..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/composited-scrolling-paint-phases-expected.txt
+++ /dev/null
@@ -1,134 +0,0 @@
-{
-  "bounds": [800, 600],
-  "paintingPhases": [
-    "GraphicsLayerPaintBackground",
-    "GraphicsLayerPaintForeground",
-    "GraphicsLayerPaintMask"
-  ],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "paintingPhases": [
-        "GraphicsLayerPaintBackground",
-        "GraphicsLayerPaintForeground",
-        "GraphicsLayerPaintMask"
-      ],
-      "children": [
-        {
-          "bounds": [800, 242],
-          "drawsContent": true,
-          "paintingPhases": [
-            "GraphicsLayerPaintBackground",
-            "GraphicsLayerPaintMask"
-          ],
-          "children": [
-            {
-              "position": [29, 31],
-              "bounds": [80, 10],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#008000",
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintForeground",
-                "GraphicsLayerPaintMask"
-              ]
-            },
-            {
-              "bounds": [800, 242],
-              "drawsContent": true,
-              "paintingPhases": [
-                "GraphicsLayerPaintForeground"
-              ]
-            },
-            {
-              "position": [28, 20],
-              "bounds": [202, 202],
-              "drawsContent": true,
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintMask",
-                "GraphicsLayerPaintCompositedScroll"
-              ],
-              "children": [
-                {
-                  "position": [1, 1],
-                  "bounds": [185, 185],
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ],
-                  "children": [
-                    {
-                      "bounds": [185, 715],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintOverflowContents",
-                        "GraphicsLayerPaintCompositedScroll"
-                      ],
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false,
-                          "paintingPhases": [
-                            "GraphicsLayerPaintForeground",
-                            "GraphicsLayerPaintOverflowContents",
-                            "GraphicsLayerPaintCompositedScroll"
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ],
-                  "children": [
-                    {
-                      "position": [1, 186],
-                      "bounds": [185, 15],
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    },
-                    {
-                      "position": [186, 1],
-                      "bounds": [15, 185],
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    },
-                    {
-                      "position": [186, 186],
-                      "bounds": [15, 15],
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/content-gains-scrollbars-expected.txt
deleted file mode 100644
index 6d6689b..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/content-gains-scrollbars-expected.txt
+++ /dev/null
@@ -1,152 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 100],
-              "children": [
-                {
-                  "bounds": [85, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 100],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 85],
-              "children": [
-                {
-                  "bounds": [200, 85],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [100, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [200, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 100],
-              "children": [
-                {
-                  "bounds": [10, 10]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/overflow-scrollbar-layers-expected.txt
deleted file mode 100644
index 6d6689b..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/overflow-scrollbar-layers-expected.txt
+++ /dev/null
@@ -1,152 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 100],
-              "children": [
-                {
-                  "bounds": [85, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 100],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 85],
-              "children": [
-                {
-                  "bounds": [200, 85],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [100, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [200, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 100],
-              "children": [
-                {
-                  "bounds": [10, 10]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
deleted file mode 100644
index c0deec5..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-{
-  "bounds": [1208, 821],
-  "children": [
-    {
-      "bounds": [1208, 821],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [1200, 800],
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "bounds": [1200, 800],
-              "drawsContent": true,
-              "children": [
-                {
-                  "bounds": [1200, 800],
-                  "children": [
-                    {
-                      "bounds": [1200, 1000],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [1200, 1000],
-                          "drawsContent": true,
-                          "children": [
-                            {
-                              "bounds": [1200, 1000],
-                              "children": [
-                                {
-                                  "bounds": [1200, 10000],
-                                  "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 10008],
-          "bounds": [1200, 0]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [1200, 1000],
-          "children": [
-            {
-              "children": [
-                {
-                  "position": [1193, 0],
-                  "bounds": [7, 1000],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scroll-parent-absolute-expected.txt
deleted file mode 100644
index c15c2d1..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scroll-parent-absolute-expected.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-{
-  "bounds": [785, 5516],
-  "children": [
-    {
-      "bounds": [785, 5516],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [8, 8],
-              "bounds": [500, 500],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF",
-              "children": [
-                {
-                  "bounds": [485, 485],
-                  "children": [
-                    {
-                      "bounds": [485, 5000],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [0, 485],
-                      "bounds": [485, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [485, 0],
-                      "bounds": [15, 485],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [485, 485],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [8, 8],
-              "bounds": [400, 400],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backfaceVisibility": "hidden",
-          "backgroundColor": "#FFFF00"
-        },
-        {
-          "position": [8, 8],
-          "bounds": [20, 5000],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#FA8072",
-          "hasScrollParent": true
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
deleted file mode 100644
index 7f2c9bc..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [98, 90],
-          "bounds": [300, 300],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backfaceVisibility": "hidden",
-          "backgroundColor": "#FFEFD5",
-          "children": [
-            {
-              "bounds": [102, 102],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [1, 1],
-                  "bounds": [100, 100],
-                  "children": [
-                    {
-                      "bounds": [100, 180],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [60, 60],
-          "bounds": [80, 80],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [103, 95],
-              "bounds": [60, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [103, 139],
-              "bounds": [60, 128],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [98, 90],
-          "children": [
-            {
-              "position": [94, 1],
-              "bounds": [7, 100],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
deleted file mode 100644
index 28eef39..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "bounds": [320, 340],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [305, 325],
-              "children": [
-                {
-                  "bounds": [305, 1224],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 325],
-                  "bounds": [305, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [305, 0],
-                  "bounds": [15, 325],
-                  "drawsContent": true
-                },
-                {
-                  "position": [305, 325],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [10, 10],
-          "bounds": [284, 1204],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#C0C0C0"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scrolling-without-painting-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scrolling-without-painting-expected.txt
index f0db4a09..f9f7d07 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scrolling-without-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/scrolling-without-painting-expected.txt
@@ -18,12 +18,7 @@
                 {
                   "bounds": [185, 1025],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -31,18 +26,13 @@
               "children": [
                 {
                   "position": [1, 186],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [186, 1],
                   "bounds": [15, 185],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 185]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 7d2ebd4..f1d578d 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -47,13 +42,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -143,10 +136,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2670],
+  "bounds": [785, 2558],
   "children": [
     {
-      "bounds": [785, 2670],
+      "bounds": [785, 2558],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -163,12 +156,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -176,13 +164,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -272,10 +258,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4734],
+  "bounds": [785, 4510],
   "children": [
     {
-      "bounds": [785, 4734],
+      "bounds": [785, 4510],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,15 +275,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -305,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -401,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6798],
+  "bounds": [785, 6414],
   "children": [
     {
-      "bounds": [785, 6798],
+      "bounds": [785, 6414],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -418,14 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -433,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-toggling-expected.txt
index b6b3cfe..fe372df7 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2604],
+  "bounds": [785, 2492],
   "children": [
     {
-      "bounds": [785, 2604],
+      "bounds": [785, 2492],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -157,15 +150,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -173,13 +158,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +252,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4668],
+  "bounds": [785, 4396],
   "children": [
     {
-      "bounds": [785, 4668],
+      "bounds": [785, 4396],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -286,14 +269,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -301,13 +277,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 6777c05f..b40fab7 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2622],
+  "bounds": [785, 2510],
   "children": [
     {
-      "bounds": [785, 2622],
+      "bounds": [785, 2510],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -160,12 +153,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -173,13 +161,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +255,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4686],
+  "bounds": [785, 4462],
   "children": [
     {
-      "bounds": [785, 4686],
+      "bounds": [785, 4462],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,12 +275,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -302,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -398,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6750],
+  "bounds": [785, 6414],
   "children": [
     {
-      "bounds": [785, 6750],
+      "bounds": [785, 6414],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -415,15 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -431,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/textarea-scroll-touch-expected.txt
index 39c686f..ddda2df 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 337],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -34,8 +29,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
@@ -60,12 +54,7 @@
                 {
                   "bounds": [189, 337],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -73,8 +62,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
deleted file mode 100644
index cf78466..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
+++ /dev/null
@@ -1,1029 +0,0 @@
-{
-  "bounds": [785, 2016],
-  "children": [
-    {
-      "bounds": [785, 2016],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [10, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [35, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [130, 10],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [157, 18],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [136, -15],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [250, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [275, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [370, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [395, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [10, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [37, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [16, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [130, 130],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [155, 195],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 105],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 161],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [250, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [277, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [256, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [370, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [397, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [376, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [10, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [35, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [130, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [155, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [250, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [275, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [370, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [395, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [375, 20],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [15, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [135, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [255, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [15, 260],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [135, 260],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/updating-scrolling-content-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/updating-scrolling-content-expected.txt
index 540be7b..cd704810 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/updating-scrolling-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/overflow/updating-scrolling-content-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='indicator'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -42,18 +37,13 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
                   "bounds": [15, 185],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 185]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
index 06892f3..c3218cf 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/repaint/should-not-clip-composited-overflow-scrolling-layer-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='content'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -43,23 +38,15 @@
                 {
                   "position": [0, 485],
                   "bounds": [485, 15],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 485, 15]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
                   "position": [485, 0],
                   "bounds": [15, 485],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 485]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-expected.txt
deleted file mode 100644
index 6b6ae37..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-expected.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "bounds": [400, 400],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [400, 400],
-              "children": [
-                {
-                  "bounds": [385, 385],
-                  "children": [
-                    {
-                      "position": [615, 0],
-                      "children": [
-                        {
-                          "position": [-615, 0],
-                          "bounds": [1000, 1000],
-                          "children": [
-                            {
-                              "bounds": [1000, 1000],
-                              "drawsContent": true,
-                              "backgroundColor": "#FF0000",
-                              "children": [
-                                {
-                                  "position": [665, 50],
-                                  "bounds": [100, 100],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#008000"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [0, 385],
-                  "bounds": [385, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [385, 0],
-                  "bounds": [15, 385],
-                  "drawsContent": true
-                },
-                {
-                  "position": [385, 385],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "position": [-615, 0],
-  "bounds": [1000, 1000],
-  "children": [
-    {
-      "bounds": [1000, 1000],
-      "drawsContent": true,
-      "backgroundColor": "#FF0000",
-      "children": [
-        {
-          "position": [665, 50],
-          "bounds": [100, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
index 991c58cc..f3ec1ff5 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.txt
deleted file mode 100644
index 74299b01..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-absolute-overflow-scrolled-expected.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "bounds": [400, 400],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [400, 400],
-              "children": [
-                {
-                  "bounds": [385, 385],
-                  "children": [
-                    {
-                      "position": [615, 0],
-                      "children": [
-                        {
-                          "position": [-615, 0],
-                          "bounds": [1000, 1000],
-                          "children": [
-                            {
-                              "bounds": [1000, 1000],
-                              "drawsContent": true,
-                              "backgroundColor": "#FF0000",
-                              "children": [
-                                {
-                                  "position": [51, 50],
-                                  "bounds": [100, 100],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#008000"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [0, 385],
-                  "bounds": [385, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [385, 0],
-                  "bounds": [15, 385],
-                  "drawsContent": true
-                },
-                {
-                  "position": [385, 385],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "position": [-615, 0],
-  "bounds": [1000, 1000],
-  "children": [
-    {
-      "bounds": [1000, 1000],
-      "drawsContent": true,
-      "backgroundColor": "#FF0000",
-      "children": [
-        {
-          "position": [51, 50],
-          "bounds": [100, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-expected.txt
deleted file mode 100644
index 6b6ae37..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-expected.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "bounds": [400, 400],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [400, 400],
-              "children": [
-                {
-                  "bounds": [385, 385],
-                  "children": [
-                    {
-                      "position": [615, 0],
-                      "children": [
-                        {
-                          "position": [-615, 0],
-                          "bounds": [1000, 1000],
-                          "children": [
-                            {
-                              "bounds": [1000, 1000],
-                              "drawsContent": true,
-                              "backgroundColor": "#FF0000",
-                              "children": [
-                                {
-                                  "position": [665, 50],
-                                  "bounds": [100, 100],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#008000"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [0, 385],
-                  "bounds": [385, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [385, 0],
-                  "bounds": [15, 385],
-                  "drawsContent": true
-                },
-                {
-                  "position": [385, 385],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "position": [-615, 0],
-  "bounds": [1000, 1000],
-  "children": [
-    {
-      "bounds": [1000, 1000],
-      "drawsContent": true,
-      "backgroundColor": "#FF0000",
-      "children": [
-        {
-          "position": [665, 50],
-          "bounds": [100, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png b/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
index 991c58cc..f3ec1ff5 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.txt
deleted file mode 100644
index 6b6ae37..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/rtl/rtl-iframe-fixed-overflow-scrolled-expected.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "bounds": [400, 400],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [400, 400],
-              "children": [
-                {
-                  "bounds": [385, 385],
-                  "children": [
-                    {
-                      "position": [615, 0],
-                      "children": [
-                        {
-                          "position": [-615, 0],
-                          "bounds": [1000, 1000],
-                          "children": [
-                            {
-                              "bounds": [1000, 1000],
-                              "drawsContent": true,
-                              "backgroundColor": "#FF0000",
-                              "children": [
-                                {
-                                  "position": [665, 50],
-                                  "bounds": [100, 100],
-                                  "contentsOpaque": true,
-                                  "drawsContent": true,
-                                  "backgroundColor": "#008000"
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "position": [0, 385],
-                  "bounds": [385, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [385, 0],
-                  "bounds": [15, 385],
-                  "drawsContent": true
-                },
-                {
-                  "position": [385, 385],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
---------
-Frame: '<!--framePath //<!--frame0-->-->'
---------
-{
-  "position": [-615, 0],
-  "bounds": [1000, 1000],
-  "children": [
-    {
-      "bounds": [1000, 1000],
-      "drawsContent": true,
-      "backgroundColor": "#FF0000",
-      "children": [
-        {
-          "position": [665, 50],
-          "bounds": [100, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/scrollbars/nested-overlay-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
deleted file mode 100644
index ef656a16..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/scrollbars/nested-overlay-scrollbars-expected.txt
+++ /dev/null
@@ -1,107 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [404, 404],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [400, 400],
-              "children": [
-                {
-                  "bounds": [400, 704],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "position": [0, 500],
-                          "bounds": [204, 204],
-                          "drawsContent": true,
-                          "children": [
-                            {
-                              "position": [2, 2],
-                              "bounds": [200, 200],
-                              "children": [
-                                {
-                                  "bounds": [5000, 9000],
-                                  "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
-                                }
-                              ]
-                            }
-                          ]
-                        },
-                        {
-                          "shouldFlattenTransform": false,
-                          "children": [
-                            {
-                              "position": [2, 502],
-                              "bounds": [100, 800],
-                              "contentsOpaque": true,
-                              "drawsContent": true,
-                              "backgroundColor": "#808080"
-                            },
-                            {
-                              "position": [2, 2502],
-                              "bounds": [5000, 1000],
-                              "drawsContent": true
-                            }
-                          ]
-                        },
-                        {
-                          "position": [2, 502],
-                          "children": [
-                            {
-                              "position": [2, 195],
-                              "bounds": [193, 7],
-                              "drawsContent": true
-                            },
-                            {
-                              "position": [195, 2],
-                              "bounds": [7, 193],
-                              "drawsContent": true
-                            },
-                            {
-                              "position": [195, 195],
-                              "bounds": [7, 7],
-                              "drawsContent": true
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [395, 2],
-                  "bounds": [7, 400],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/squashing/composited-bounds-for-negative-z-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/squashing/composited-bounds-for-negative-z-expected.txt
deleted file mode 100644
index 8dc812d..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/squashing/composited-bounds-for-negative-z-expected.txt
+++ /dev/null
@@ -1,73 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "children": [
-        {
-          "bounds": [800, 408],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [8, 100],
-              "bounds": [10, 10],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#FF0000"
-            },
-            {
-              "bounds": [800, 408],
-              "drawsContent": true
-            },
-            {
-              "position": [108, 100],
-              "bounds": [300, 300],
-              "drawsContent": true,
-              "children": [
-                {
-                  "bounds": [285, 300],
-                  "children": [
-                    {
-                      "bounds": [285, 1000],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [285, 0],
-                      "bounds": [15, 300],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "shouldFlattenTransform": false,
-              "children": [
-                {
-                  "position": [108, 100],
-                  "bounds": [285, 1000]
-                },
-                {
-                  "position": [108, 100],
-                  "bounds": [285, 1000],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/squashing/selection-repaint-with-gaps-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/squashing/selection-repaint-with-gaps-expected.txt
index 4f71401..f470a6b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/squashing/selection-repaint-with-gaps-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/compositing/squashing/selection-repaint-with-gaps-expected.txt
@@ -19,8 +19,7 @@
               "bounds": [100, 210],
               "drawsContent": true,
               "repaintRects": [
-                [37, 80, 3, 17],
-                [0, 80, 40, 35]
+                [0, 80, 42, 35]
               ]
             }
           ]
@@ -49,12 +48,8 @@
               "bounds": [100, 210],
               "drawsContent": true,
               "repaintRects": [
-                [37, 160, 3, 17],
-                [37, 80, 3, 35],
-                [37, 80, 3, 17],
-                [0, 160, 40, 35],
-                [0, 80, 100, 50],
-                [0, 80, 40, 35]
+                [0, 160, 42, 35],
+                [0, 80, 44, 35]
               ]
             }
           ]
diff --git a/third_party/WebKit/LayoutTests/platform/win/compositing/update-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/win/compositing/update-paint-phases-expected.txt
deleted file mode 100644
index 9ba6603..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/compositing/update-paint-phases-expected.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-{
-  "bounds": [800, 600],
-  "paintingPhases": [
-    "GraphicsLayerPaintBackground",
-    "GraphicsLayerPaintForeground",
-    "GraphicsLayerPaintMask"
-  ],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "paintingPhases": [
-        "GraphicsLayerPaintBackground",
-        "GraphicsLayerPaintForeground",
-        "GraphicsLayerPaintMask"
-      ],
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [102, 102],
-          "drawsContent": true,
-          "paintingPhases": [
-            "GraphicsLayerPaintBackground",
-            "GraphicsLayerPaintMask",
-            "GraphicsLayerPaintCompositedScroll"
-          ],
-          "children": [
-            {
-              "position": [1, 1],
-              "bounds": [85, 85],
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintForeground",
-                "GraphicsLayerPaintMask"
-              ],
-              "children": [
-                {
-                  "bounds": [85, 120],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "paintingPhases": [
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintOverflowContents",
-                    "GraphicsLayerPaintCompositedScroll"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintOverflowContents",
-                        "GraphicsLayerPaintCompositedScroll"
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintForeground",
-                "GraphicsLayerPaintMask"
-              ],
-              "children": [
-                {
-                  "position": [1, 86],
-                  "bounds": [85, 15],
-                  "drawsContent": true,
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ]
-                },
-                {
-                  "position": [86, 1],
-                  "bounds": [15, 85],
-                  "drawsContent": true,
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ]
-                },
-                {
-                  "position": [86, 86],
-                  "bounds": [15, 15],
-                  "drawsContent": true,
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-expected.txt b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-expected.txt
index 711dcaf..31625c424 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-expected.txt
@@ -61,7 +61,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-hw-expected.png b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-hw-expected.png
index ed98a8f..88c5ebf 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-hw-expected.txt
index 15093b9..8e29b826 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-hw-expected.txt
@@ -61,7 +61,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-expected.txt b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-expected.txt
index 57493396..d43dbc1 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-expected.txt
@@ -59,7 +59,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-hw-expected.png b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-hw-expected.png
index e0966ff..078c5574 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-hw-expected.txt
index 57493396..d43dbc1 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-subregion-hw-expected.txt
@@ -59,7 +59,7 @@
             [feTurbulence type="TURBULENCE" baseFrequency="0.05, 0.05" seed="0.00" numOctaves="2" stitchTiles="0"]
           LayoutSVGResourceFilter {filter} [id="tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="drop-shadow"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feDropShadow stdDeviation="4.00, 4.00" dx="10.00" dy="5.00" flood-color="#000000" flood-opacity="1.00]
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-expected.txt b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-expected.txt
index 8d9e062..6ce33c5 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-expected.txt
@@ -7,19 +7,19 @@
         LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
           LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
       LayoutText {#text} at (0,96) size 4x17
         text run at (0,96) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-hw-expected.png b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-hw-expected.png
index 61c416bf..53bca2c0 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-hw-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-hw-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-hw-expected.txt b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-hw-expected.txt
index 8d9e062..6ce33c5 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-hw-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/filters/effect-reference-tile-hw-expected.txt
@@ -7,19 +7,19 @@
         LayoutSVGHiddenContainer {defs} at (0,0) size 0x0
           LayoutSVGResourceFilter {filter} [id="non-integer-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="shrink-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-src-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
           LayoutSVGResourceFilter {filter} [id="zero-dst-tile"] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
             [feTile]
-              [feColorMatrix type="MATRIX" values="1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00 0.00 0.00 0.00 0.00 1.00 0.00"]
+              [feColorMatrix type="MATRIX"]
                 [SourceGraphic]
       LayoutText {#text} at (0,96) size 4x17
         text run at (0,96) width 4: " "
diff --git a/third_party/WebKit/LayoutTests/platform/win/css3/flexbox/flexbox-baseline-margins-expected.png b/third_party/WebKit/LayoutTests/platform/win/css3/flexbox/flexbox-baseline-margins-expected.png
index 1ea6206..2d11a08 100644
--- a/third_party/WebKit/LayoutTests/platform/win/css3/flexbox/flexbox-baseline-margins-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/css3/flexbox/flexbox-baseline-margins-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/deleting/delete-to-select-table-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/deleting/delete-to-select-table-expected.png
index f39e583a..2cc80a9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/deleting/delete-to-select-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/deleting/delete-to-select-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/4916541-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/4916541-expected.png
index dda5395..fd88e67 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/4916541-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/4916541-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5136770-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5136770-expected.png
index 1d4b624..4c15200b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5136770-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5136770-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5142012-1-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5142012-1-expected.png
index bc9beb12..db573b4 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5142012-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5142012-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5142012-2-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5142012-2-expected.png
index 8c8e9f5..9538b693 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5142012-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5142012-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5190926-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5190926-expected.png
index a540d6f4..6f0e8ba 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5190926-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5190926-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5481523-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5481523-expected.png
index d688b571..97b33b32 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5481523-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/5481523-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/indent-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/indent-selection-expected.png
index 02a61b32..ec5b52f0 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/indent-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/indent-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/remove-list-from-range-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/remove-list-from-range-selection-expected.png
index a32b1b7..6f05ba1 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/remove-list-from-range-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/remove-list-from-range-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/selectAll-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/selectAll-expected.png
index ee74e66..b201604 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/selectAll-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/execCommand/selectAll-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690703-2-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690703-2-expected.png
index 686ea31..cc2810a9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690703-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690703-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690703-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690703-expected.png
index 22eeb7c..094e2d6 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690703-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690703-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690719-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690719-expected.png
index 22eeb7c..094e2d6 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690719-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/3690719-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/4818145-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/4818145-expected.png
index a32ff22..aa583b9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/4818145-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/4818145-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/4947387-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/4947387-expected.png
index 8f266515..dc5c6c3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/4947387-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/4947387-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/5057506-2-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/5057506-2-expected.png
index a8ffc8b..60c0e151 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/5057506-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/5057506-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/5057506-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/5057506-expected.png
index d47a1dcb..0a3b149 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/5057506-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/5057506-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/5232159-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/5232159-expected.png
index cd1f269..fcbb03a 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/5232159-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/5232159-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/7152-1-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/7152-1-expected.png
index 0fc0f11..8f70cbc 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/7152-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/7152-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/7152-2-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/7152-2-expected.png
index 38c8cfd..8e230fd4 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/7152-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/7152-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/doubleclick-crash-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/doubleclick-crash-expected.png
index 965cd3d..50384e3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/doubleclick-crash-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/doubleclick-crash-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/doubleclick-crash-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/doubleclick-crash-expected.txt
index dd3ea8c..35e23c77 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/doubleclick-crash-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/doubleclick-crash-expected.txt
@@ -1,5 +1,4 @@
 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
-EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
 layer at (0,0) size 800x600
@@ -15,5 +14,4 @@
           text run at (0,48) width 0: " "
         LayoutText {#text} at (0,64) size 0x16
           text run at (0,64) width 0: " "
-selection start: position 5 of child 0 {#text} of child 1 {PRE} of body
-selection end:   position 6 of child 0 {#text} of child 1 {PRE} of body
+caret: position 5 of child 0 {#text} of child 1 {PRE} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-by-character-002-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-by-character-002-expected.png
index 6c96a675..099d3033 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-by-character-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-by-character-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-by-character-003-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-by-character-003-expected.png
index 49214438..8088328b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-by-character-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-by-character-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-inside-transforms-backward-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-inside-transforms-backward-expected.png
index 843ad7b1..e37ce5f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-inside-transforms-backward-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-inside-transforms-backward-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-inside-transforms-forward-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-inside-transforms-forward-expected.png
index 31b9ee1..1fe0e02 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-inside-transforms-forward-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/extend-inside-transforms-forward-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/image-before-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/image-before-linebreak-expected.png
index 86810ce..58cdc760 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/image-before-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/image-before-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-6-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-6-expected.png
index 6a3056d0..abd53ad 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-6-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-6-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-7-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-7-expected.png
index fb924bd..b1514591 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-7-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/mixed-editability-7-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/node-removal-2-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/node-removal-2-expected.png
index 6c1ca6e..590fda5 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/node-removal-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/node-removal-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/paragraph-granularity-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/paragraph-granularity-expected.png
index e39bd9f..8ae42f4f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/paragraph-granularity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/paragraph-granularity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/range-between-block-and-inline-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/range-between-block-and-inline-expected.png
index a650e8da..a9c1941 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/range-between-block-and-inline-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/range-between-block-and-inline-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/replaced-boundaries-3-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/replaced-boundaries-3-expected.png
index b015963..25d0989 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/replaced-boundaries-3-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/replaced-boundaries-3-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-001-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-001-expected.png
index ba7d100..4a80330 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-002-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-002-expected.png
index 3c69d71..77567bf 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-003-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-003-expected.png
index ea7cb1b..d6aabce 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-004-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-004-expected.png
index 2d9d754..4073d488 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-005-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-005-expected.png
index 605ace88..0e0d622 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-006-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-006-expected.png
index 605ace88..0e0d622 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-006-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-all-006-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-missing-image-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-missing-image-expected.png
index 841ee2d..731d7bf 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-missing-image-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/select-missing-image-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.png
index a05b0c9..685aba4 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-actions-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-button-text-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-button-text-expected.png
index 83223976..f4ff37e 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-button-text-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/selection-button-text-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/transformed-selection-rects-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/transformed-selection-rects-expected.png
index 5830c4f..ab86f69 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/transformed-selection-rects-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/transformed-selection-rects-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
index f3c3cfb..36ff4f0 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt
index ac76417..1c97068 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt
@@ -1,18 +1,18 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x279
-  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
-    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
-      LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutText {#text} at (0,1) size 696x17
-          text run at (0,1) width 696: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
-      LayoutBlockFlow {DIV} at (0,35) size 68x214.69
-        LayoutBlockFlow {P} at (16,0) size 36x214.69
-          LayoutText {#text} at (0,0) size 17x126
-            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
-          LayoutBR {BR} at (0,125) size 17x1
-          LayoutText {#text} at (18,0) size 17x124
-            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
-      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+layer at (0,0) size 800x286
+  LayoutBlockFlow {HTML} at (0,0) size 800x285.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x256.69
+      LayoutBlockFlow {P} at (0,0) size 784x26
+        LayoutText {#text} at (0,4) size 702x17
+          text run at (0,4) width 702: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,42) size 84x214.69
+        LayoutBlockFlow {P} at (16,0) size 52x214.69
+          LayoutText {#text} at (4,0) size 17x128
+            text run at (4,0) width 128: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+          LayoutBR {BR} at (4,128) size 17x0
+          LayoutText {#text} at (30,0) size 17x128
+            text run at (30,0) width 128: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,269.69) size 784x0
 selection start: position 5 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
 selection end:   position 5 of child 2 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
index 90fa1d3..2bef51f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt
index 5963a228..1d063d3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt
@@ -1,18 +1,18 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x279
-  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
-    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
-      LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutText {#text} at (0,1) size 697x17
-          text run at (0,1) width 697: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
-      LayoutBlockFlow {DIV} at (0,35) size 68x214.69
-        LayoutBlockFlow {P} at (16,0) size 36x214.69
-          LayoutText {#text} at (0,0) size 17x126
-            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
-          LayoutBR {BR} at (0,125) size 17x1
-          LayoutText {#text} at (18,0) size 17x124
-            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
-      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+layer at (0,0) size 800x286
+  LayoutBlockFlow {HTML} at (0,0) size 800x285.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x256.69
+      LayoutBlockFlow {P} at (0,0) size 784x26
+        LayoutText {#text} at (0,4) size 702x17
+          text run at (0,4) width 702: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,42) size 84x214.69
+        LayoutBlockFlow {P} at (16,0) size 52x214.69
+          LayoutText {#text} at (4,0) size 17x128
+            text run at (4,0) width 128: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+          LayoutBR {BR} at (4,128) size 17x0
+          LayoutText {#text} at (30,0) size 17x128
+            text run at (30,0) width 128: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,269.69) size 784x0
 selection start: position 2 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
 selection end:   position 2 of child 2 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
index 495e1ad..c598ca65 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt
index ac76417..1c97068 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt
@@ -1,18 +1,18 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x279
-  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
-    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
-      LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutText {#text} at (0,1) size 696x17
-          text run at (0,1) width 696: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
-      LayoutBlockFlow {DIV} at (0,35) size 68x214.69
-        LayoutBlockFlow {P} at (16,0) size 36x214.69
-          LayoutText {#text} at (0,0) size 17x126
-            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
-          LayoutBR {BR} at (0,125) size 17x1
-          LayoutText {#text} at (18,0) size 17x124
-            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
-      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+layer at (0,0) size 800x286
+  LayoutBlockFlow {HTML} at (0,0) size 800x285.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x256.69
+      LayoutBlockFlow {P} at (0,0) size 784x26
+        LayoutText {#text} at (0,4) size 702x17
+          text run at (0,4) width 702: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,42) size 84x214.69
+        LayoutBlockFlow {P} at (16,0) size 52x214.69
+          LayoutText {#text} at (4,0) size 17x128
+            text run at (4,0) width 128: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+          LayoutBR {BR} at (4,128) size 17x0
+          LayoutText {#text} at (30,0) size 17x128
+            text run at (30,0) width 128: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,269.69) size 784x0
 selection start: position 5 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
 selection end:   position 5 of child 2 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
index fd3ed60..ebd7b29b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt
index 89858868..b0a868b6 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt
@@ -1,18 +1,18 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x279
-  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
-    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
-      LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutText {#text} at (0,1) size 696x17
-          text run at (0,1) width 696: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
-      LayoutBlockFlow {DIV} at (0,35) size 84x214.69
-        LayoutBlockFlow {P} at (16,0) size 18x214.69
-          LayoutText {#text} at (0,0) size 17x126
-            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
-        LayoutBlockFlow {P} at (50,0) size 18x214.69
-          LayoutText {#text} at (0,0) size 17x124
-            text run at (0,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
-      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+layer at (0,0) size 800x286
+  LayoutBlockFlow {HTML} at (0,0) size 800x285.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x256.69
+      LayoutBlockFlow {P} at (0,0) size 784x26
+        LayoutText {#text} at (0,4) size 702x17
+          text run at (0,4) width 702: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,42) size 100x214.69
+        LayoutBlockFlow {P} at (16,0) size 26x214.69
+          LayoutText {#text} at (4,0) size 17x128
+            text run at (4,0) width 128: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+        LayoutBlockFlow {P} at (58,0) size 26x214.69
+          LayoutText {#text} at (4,0) size 17x128
+            text run at (4,0) width 128: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,269.69) size 784x0
 selection start: position 5 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
 selection end:   position 5 of child 0 {#text} of child 3 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
index 39c19048..c598ca65 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt
index 83256df..cf768272 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt
@@ -1,16 +1,16 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x192
-  LayoutBlockFlow {HTML} at (0,0) size 800x192
-    LayoutBlockFlow {BODY} at (8,16) size 784x163
-      LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutText {#text} at (0,1) size 696x17
-          text run at (0,1) width 696: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
-      LayoutBlockFlow {DIV} at (0,35) size 68x128
-        LayoutBlockFlow {P} at (16,0) size 36x128
-          LayoutText {#text} at (0,0) size 35x126
-            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
-            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
-      LayoutBlockFlow {PRE} at (0,176) size 784x0
+layer at (0,0) size 800x201
+  LayoutBlockFlow {HTML} at (0,0) size 800x201
+    LayoutBlockFlow {BODY} at (8,16) size 784x172
+      LayoutBlockFlow {P} at (0,0) size 784x26
+        LayoutText {#text} at (0,4) size 702x17
+          text run at (0,4) width 702: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,42) size 84x130
+        LayoutBlockFlow {P} at (16,0) size 52x130
+          LayoutText {#text} at (4,0) size 43x128
+            text run at (4,0) width 128: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+            text run at (30,0) width 128: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,185) size 784x0
 selection start: position 5 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
 selection end:   position 13 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
index 84d64b3..451b5b9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt
index 5963a228..1d063d3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt
@@ -1,18 +1,18 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x279
-  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
-    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
-      LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutText {#text} at (0,1) size 697x17
-          text run at (0,1) width 697: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
-      LayoutBlockFlow {DIV} at (0,35) size 68x214.69
-        LayoutBlockFlow {P} at (16,0) size 36x214.69
-          LayoutText {#text} at (0,0) size 17x126
-            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
-          LayoutBR {BR} at (0,125) size 17x1
-          LayoutText {#text} at (18,0) size 17x124
-            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
-      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+layer at (0,0) size 800x286
+  LayoutBlockFlow {HTML} at (0,0) size 800x285.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x256.69
+      LayoutBlockFlow {P} at (0,0) size 784x26
+        LayoutText {#text} at (0,4) size 702x17
+          text run at (0,4) width 702: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,42) size 84x214.69
+        LayoutBlockFlow {P} at (16,0) size 52x214.69
+          LayoutText {#text} at (4,0) size 17x128
+            text run at (4,0) width 128: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+          LayoutBR {BR} at (4,128) size 17x0
+          LayoutText {#text} at (30,0) size 17x128
+            text run at (30,0) width 128: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,269.69) size 784x0
 selection start: position 2 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
 selection end:   position 2 of child 2 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
index 647efb0..324266f7 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt
index d42b0f27..2c710fc 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt
@@ -1,18 +1,18 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x279
-  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
-    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
-      LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutText {#text} at (0,1) size 697x17
-          text run at (0,1) width 697: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
-      LayoutBlockFlow {DIV} at (0,35) size 84x214.69
-        LayoutBlockFlow {P} at (16,0) size 18x214.69
-          LayoutText {#text} at (0,0) size 17x126
-            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
-        LayoutBlockFlow {P} at (50,0) size 18x214.69
-          LayoutText {#text} at (0,0) size 17x124
-            text run at (0,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
-      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+layer at (0,0) size 800x286
+  LayoutBlockFlow {HTML} at (0,0) size 800x285.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x256.69
+      LayoutBlockFlow {P} at (0,0) size 784x26
+        LayoutText {#text} at (0,4) size 702x17
+          text run at (0,4) width 702: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,42) size 100x214.69
+        LayoutBlockFlow {P} at (16,0) size 26x214.69
+          LayoutText {#text} at (4,0) size 17x128
+            text run at (4,0) width 128: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+        LayoutBlockFlow {P} at (58,0) size 26x214.69
+          LayoutText {#text} at (4,0) size 17x128
+            text run at (4,0) width 128: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,269.69) size 784x0
 selection start: position 2 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
 selection end:   position 2 of child 0 {#text} of child 3 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
index edc69af..451b5b9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt
index 6b2376a..291e2532 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt
@@ -1,16 +1,16 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 800x192
-  LayoutBlockFlow {HTML} at (0,0) size 800x192
-    LayoutBlockFlow {BODY} at (8,16) size 784x163
-      LayoutBlockFlow {P} at (0,0) size 784x19
-        LayoutText {#text} at (0,1) size 697x17
-          text run at (0,1) width 697: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
-      LayoutBlockFlow {DIV} at (0,35) size 68x128
-        LayoutBlockFlow {P} at (16,0) size 36x128
-          LayoutText {#text} at (0,0) size 35x126
-            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
-            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
-      LayoutBlockFlow {PRE} at (0,176) size 784x0
+layer at (0,0) size 800x201
+  LayoutBlockFlow {HTML} at (0,0) size 800x201
+    LayoutBlockFlow {BODY} at (8,16) size 784x172
+      LayoutBlockFlow {P} at (0,0) size 784x26
+        LayoutText {#text} at (0,4) size 702x17
+          text run at (0,4) width 702: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,42) size 84x130
+        LayoutBlockFlow {P} at (16,0) size 52x130
+          LayoutText {#text} at (4,0) size 43x128
+            text run at (4,0) width 128: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+            text run at (30,0) width 128: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,185) size 784x0
 selection start: position 2 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
 selection end:   position 10 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
index ac7a7754..21ddbb6 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
index 1d2770a..652c6ce 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
index ac7a7754..21ddbb6 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
index 1d2770a..652c6ce 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/vertical-rl-rtl-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/selection/word-granularity-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/selection/word-granularity-expected.png
index 6e37e38..f39075a6 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/selection/word-granularity-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/selection/word-granularity-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/5017613-1-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/5017613-1-expected.png
index a88e3b11..4d5e833 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/5017613-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/5017613-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/5017613-2-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/5017613-2-expected.png
index 6a692af..d1408c9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/5017613-2-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/5017613-2-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/5046875-1-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/5046875-1-expected.png
index 33550d8..0d4c0ea8 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/5046875-1-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/5046875-1-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/5228141-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/5228141-expected.png
index 0261087..9b741c2 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/5228141-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/5228141-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/5279521-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/5279521-expected.png
index 0b9cab5a..df73a91 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/5279521-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/5279521-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/apple-style-editable-mix-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/apple-style-editable-mix-expected.png
index 0dfc49a..58bf4df 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/apple-style-editable-mix-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/apple-style-editable-mix-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/block-style-003-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/block-style-003-expected.png
index 3a7e7b9..d19757dd 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/block-style-003-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/block-style-003-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-005-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-005-expected.png
index ab5a221a..b96a77a 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-005-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-005-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-006-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-006-expected.png
index 9f33db7e..bdf3e34 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-006-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-006-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-010-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-010-expected.png
index 06edbe3..31a23663 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-010-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-010-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-011-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-011-expected.png
index 4205ac7..1f9d2bc 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-011-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-011-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-012-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-012-expected.png
index ed17d986..9f00b75 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-012-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/create-block-for-style-012-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/relative-font-size-change-001-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/relative-font-size-change-001-expected.png
index 21a98fce..5ef9914b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/relative-font-size-change-001-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/relative-font-size-change-001-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/relative-font-size-change-002-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/relative-font-size-change-002-expected.png
index 05e6551..54274cc 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/relative-font-size-change-002-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/relative-font-size-change-002-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/style-3998892-fix-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/style-3998892-fix-expected.png
index 5fd08951..1adc269 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/style-3998892-fix-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/style-3998892-fix-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/style-boundary-004-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/style-boundary-004-expected.png
index 64b00b8..3c1ca1b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/style-boundary-004-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/style-boundary-004-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/editing/style/table-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/editing/style/table-selection-expected.png
index 2fa8bf8c..2f8516d 100644
--- a/third_party/WebKit/LayoutTests/platform/win/editing/style/table-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/editing/style/table-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/selection-background-color-of-image-list-style-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
index ed741b9..908e0ac 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/selection-background-color-of-image-list-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/selection-background-color-of-list-style-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/selection-background-color-of-list-style-expected.png
index fd7f25a..c1059669 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/selection-background-color-of-list-style-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/backgrounds/selection-background-color-of-list-style-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/basic-textareas-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/basic-textareas-expected.png
index 97a2a75..f98b755 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/basic-textareas-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/basic-textareas-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/basic-textareas-quirks-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/basic-textareas-quirks-expected.png
index 66303bd8358..5f3a60f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/basic-textareas-quirks-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/basic-textareas-quirks-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/form-added-to-table-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/form-added-to-table-expected.png
index 3f84da30..0159c827 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/form-added-to-table-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/form-added-to-table-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/listbox-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/listbox-appearance-basic-expected.png
index 3660cd9c..b214dae 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/listbox-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/listbox-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-basic-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-basic-expected.png
index d51d1abf..5079e08 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-basic-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/select/menulist-appearance-basic-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/forms/textarea-scrolled-focus-ring-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/forms/textarea-scrolled-focus-ring-expected.png
index 42eb76c..0569fd04 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/forms/textarea-scrolled-focus-ring-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/forms/textarea-scrolled-focus-ring-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/layers/scroll-rect-to-visible-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/layers/scroll-rect-to-visible-expected.png
index 04f1b88e..bc7238f9 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/layers/scroll-rect-to-visible-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/layers/scroll-rect-to-visible-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/lists/markers-in-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/lists/markers-in-selection-expected.png
index eda3f81..af84d50db 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/lists/markers-in-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/lists/markers-in-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/overflow/overflow-x-y-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/overflow/overflow-x-y-expected.png
index ed9c48a..255844f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/overflow/overflow-x-y-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/overflow/overflow-x-y-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/parser/open-comment-in-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/parser/open-comment-in-textarea-expected.png
index a0350d3..753968d 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/parser/open-comment-in-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/parser/open-comment-in-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/delete-into-nested-block-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/delete-into-nested-block-expected.txt
index 97beadd..61e216f4 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/delete-into-nested-block-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/delete-into-nested-block-expected.txt
@@ -11,7 +11,6 @@
         [8, 137, 784, 37],
         [8, 137, 784, 19],
         [8, 137, 24, 18],
-        [8, 119, 784, 36],
         [8, 119, 784, 19],
         [8, 119, 32, 18],
         [8, 119, 24, 18],
@@ -19,7 +18,6 @@
         [7, 118, 3, 20]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'one'",
         "LayoutText #text",
         "RootInlineBox",
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/japanese-rl-selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/japanese-rl-selection-clear-expected.txt
index b21f30a2..7434b0b3 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/japanese-rl-selection-clear-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/japanese-rl-selection-clear-expected.txt
@@ -6,26 +6,25 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [428, 123, 349, 397],
-        [428, 23, 349, 554]
+        [374, 123, 398, 390]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "LayoutText #text",
-        "InlineTextBox '\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042'",
-        "InlineTextBox '\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B\u306A'",
-        "InlineTextBox '\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F\u3057'",
-        "InlineTextBox '\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B'",
-        "InlineTextBox '\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089'",
-        "InlineTextBox '\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C'",
-        "InlineTextBox '\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060'",
-        "InlineTextBox '\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3'",
-        "InlineTextBox '\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u8A2A\u554F\u3057'",
-        "InlineTextBox '\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B'",
-        "InlineTextBox '\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089'",
-        "InlineTextBox '\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C'",
-        "InlineTextBox '\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060'",
-        "InlineTextBox '\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F'"
+        "InlineTextBox '\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053'",
+        "InlineTextBox '\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E'",
+        "InlineTextBox '\u3059\u304B\u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060\u3051\u3067\u306A'",
+        "InlineTextBox '\u304F\u3001\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4'",
+        "InlineTextBox '\u304B\u3089\u3082\u691C\u7D22\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B'",
+        "InlineTextBox '\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063'",
+        "InlineTextBox '\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A'",
+        "InlineTextBox '\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F'",
+        "InlineTextBox '\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C'",
+        "InlineTextBox '\u7D22\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6'",
+        "InlineTextBox '\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B\u3053\u3068'",
+        "InlineTextBox '\u304C\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057'",
+        "InlineTextBox '\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F'",
+        "InlineTextBox '\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC'",
+        "InlineTextBox '\u30B9\u3060\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F'"
       ]
     }
   ]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/japanese-rl-selection-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/japanese-rl-selection-repaint-expected.txt
index 43f384f..a69ac30c 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/japanese-rl-selection-repaint-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/japanese-rl-selection-repaint-expected.txt
@@ -6,23 +6,23 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [553, 544, 224, 33],
-        [528, 23, 249, 552]
+        [408, 23, 364, 539]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow HTML",
         "LayoutBlockFlow BODY",
         "LayoutText #text",
-        "InlineTextBox '\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057'",
-        "InlineTextBox '\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B\u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060\u3051\u3067\u306A'",
-        "InlineTextBox '\u304F\u3001\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B\u3053\u3068\u304C'",
-        "InlineTextBox '\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F'",
-        "InlineTextBox '\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9'",
-        "InlineTextBox '\u3060\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059'",
-        "InlineTextBox '\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082'",
-        "InlineTextBox '\u691C\u7D22\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B'",
-        "InlineTextBox '\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A\u3089\u30BF\u30A4'",
-        "InlineTextBox '\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F'"
+        "InlineTextBox '\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C'",
+        "InlineTextBox '\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B\u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060'",
+        "InlineTextBox '\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C'",
+        "InlineTextBox '\u7D22\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18'",
+        "InlineTextBox '\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A'",
+        "InlineTextBox '\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC'",
+        "InlineTextBox '\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u8A2A\u554F\u3057'",
+        "InlineTextBox '\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B\u3053\u3068\u304C\u3067\u304D'",
+        "InlineTextBox '\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F'",
+        "InlineTextBox '\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9'",
+        "InlineTextBox '\u30EC\u30B9\u3060\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F'"
       ]
     }
   ]
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/overflow-move-after-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/overflow-move-after-scroll-expected.txt
index 2063a11..b4c07d2 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/overflow-move-after-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/overflow-move-after-scroll-expected.txt
@@ -31,11 +31,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow (positioned) DIV id='block'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -44,18 +39,13 @@
               "children": [
                 {
                   "position": [0, 385],
-                  "bounds": [685, 15],
-                  "drawsContent": true
+                  "bounds": [685, 15]
                 },
                 {
                   "position": [685, 0],
                   "bounds": [15, 385],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 385]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/overflow-scroll-after-move-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/overflow-scroll-after-move-expected.txt
index 9c8fabf..e92477b 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/overflow-scroll-after-move-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/overflow-scroll-after-move-expected.txt
@@ -31,11 +31,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow (positioned) DIV id='block'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -44,18 +39,13 @@
               "children": [
                 {
                   "position": [0, 385],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
                   "bounds": [15, 385],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 385]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-after-delete-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-after-delete-expected.txt
index 82ec4f2..e2f3f09 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-after-delete-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-after-delete-expected.txt
@@ -10,8 +10,7 @@
         [38, 94, 152, 90],
         [38, 93, 152, 91],
         [38, 75, 152, 107],
-        [38, 74, 3, 19],
-        [8, 75, 784, 107]
+        [38, 74, 3, 19]
       ],
       "paintInvalidationClients": [
         "InlineTextBox 'hello world hello'",
@@ -26,7 +25,6 @@
         "InlineTextBox ' '",
         "InlineTextBox 'world hello'",
         "LayoutText #text",
-        "LayoutBlockFlow HTML",
         "RootInlineBox",
         "RootInlineBox",
         "RootInlineBox",
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-after-remove-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-after-remove-expected.txt
index c57c25b..2c85d09 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-after-remove-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-after-remove-expected.txt
@@ -12,12 +12,9 @@
         [39, 75, 36, 17],
         [38, 94, 152, 90],
         [38, 93, 152, 91],
-        [38, 75, 152, 107],
-        [8, 75, 784, 107],
-        [8, 75, 784, 107]
+        [38, 75, 152, 107]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'world hello'",
         "InlineTextBox ' '",
         "InlineTextBox 'world hello world'",
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-clear-expected.txt
index 10daf79e..781e961 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-clear-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-clear-expected.txt
@@ -8,16 +8,12 @@
       "repaintRects": [
         [8, 208, 100, 100],
         [8, 108, 100, 100],
-        [8, 49, 784, 159],
-        [8, 49, 784, 159],
-        [8, 49, 784, 59],
         [8, 49, 97, 117],
         [8, 49, 4, 17],
         [8, 8, 100, 200],
         [8, 8, 100, 100]
       ],
       "paintInvalidationClients": [
-        "LayoutBlockFlow HTML",
         "InlineTextBox 'FAIL: Test did'",
         "InlineTextBox 'not run'",
         "LayoutText #text",
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
index 926110b..ba884825 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/repaint/selection-partial-invalidation-between-blocks-expected.txt
@@ -6,10 +6,9 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [11, 33, 75, 17],
-        [11, 32, 778, 20],
-        [11, 11, 57, 17],
-        [11, 10, 778, 20]
+        [11, 33, 79, 17],
+        [11, 11, 61, 17],
+        [11, 11, 57, 17]
       ],
       "paintInvalidationClients": [
         "LayoutBlockFlow HTML",
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-textarea-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-textarea-expected.png
index 2f80f706..eb232289 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-textarea-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/replaced/width100percent-textarea-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/ruby/select-ruby-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/ruby/select-ruby-expected.png
index 12616a3..4fd5138 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/ruby/select-ruby-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/ruby/select-ruby-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.png
index f48af06..f6b41658 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.txt
index e1d42a2..35f0e59 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/midword-break-before-surrogate-pair-expected.txt
@@ -3,7 +3,19 @@
 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 186x94 [border: (3px solid #0000FF)]
-        LayoutText {#text} at (3,4) size 174x84
-          text run at (3,4) width 174: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
-          text run at (3,48) width 44: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,0) size 784x36
+        LayoutText {#text} at (0,0) size 765x35
+          text run at (0,0) width 765: "The following box should break the sequence of symbols at the 5 character mark and not overflow the blue box. This is"
+          text run at (0,18) width 253: "because U+1D49 is a number category "
+          text run at (252,18) width 298: "unicode character, for which break-all applies."
+      LayoutBlockFlow {DIV} at (0,52) size 186x104 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,3) size 173x98
+          text run at (3,3) width 173: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+          text run at (3,52) width 74: "\x{D835}\x{DC9E}\x{D835}\x{DC9E}\x{D835}\x{DC9E}"
+      LayoutBlockFlow {P} at (0,172) size 784x18
+        LayoutText {#text} at (0,0) size 779x17
+          text run at (0,0) width 539: "The following box should not break the sequence of symbols since U+1F1EF is not "
+          text run at (538,0) width 241: "a letter or number category character."
+      LayoutBlockFlow {DIV} at (0,206) size 186x56 [border: (3px solid #0000FF)]
+        LayoutText {#text} at (3,4) size 422x49
+          text run at (3,4) width 422: "\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}\x{D83C}\x{DDEF}\x{D83C}\x{DDF5}"
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-hard-linebreak-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-hard-linebreak-expected.png
index 22ea6175..d75d632 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-hard-linebreak-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-hard-linebreak-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painted-separately-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painted-separately-expected.png
index 6b93ea4..3670500 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painted-separately-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painted-separately-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painting-hidpi-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painting-hidpi-expected.png
new file mode 100644
index 0000000..596c7a4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painting-hidpi-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painting-hidpi-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painting-hidpi-expected.txt
new file mode 100644
index 0000000..e240a8b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-painting-hidpi-expected.txt
@@ -0,0 +1,50 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x34
+  LayoutBlockFlow {HTML} at (0,0) size 800x34
+    LayoutBlockFlow {BODY} at (8,8) size 784x18
+      LayoutBlockFlow {DIV} at (0,0) size 300.39x18
+        LayoutInline {SPAN} at (0,0) size 38x17
+          LayoutText {#text} at (0,0) size 38x17
+            text run at (0,0) width 38: "There"
+        LayoutText {#text} at (37,0) size 5x17
+          text run at (37,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 43x17
+          LayoutText {#text} at (41,0) size 43x17
+            text run at (41,0) width 43: "should"
+        LayoutText {#text} at (83,0) size 5x17
+          text run at (83,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 17x17
+          LayoutText {#text} at (87,0) size 17x17
+            text run at (87,0) width 17: "be"
+        LayoutText {#text} at (103,0) size 5x17
+          text run at (103,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 17x17
+          LayoutText {#text} at (107,0) size 17x17
+            text run at (107,0) width 17: "no"
+        LayoutText {#text} at (123,0) size 5x17
+          text run at (123,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 36x17
+          LayoutText {#text} at (127,0) size 36x17
+            text run at (127,0) width 36: "white"
+        LayoutText {#text} at (162,0) size 5x17
+          text run at (162,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 30x17
+          LayoutText {#text} at (166,0) size 30x17
+            text run at (166,0) width 30: "gaps"
+        LayoutText {#text} at (195,0) size 5x17
+          text run at (195,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 55x17
+          LayoutText {#text} at (199,0) size 55x17
+            text run at (199,0) width 55: "between"
+        LayoutText {#text} at (253,0) size 5x17
+          text run at (253,0) width 5: " "
+        LayoutInline {SPAN} at (0,0) size 40x17
+          LayoutText {#text} at (257,0) size 40x17
+            text run at (257,0) width 40: "words"
+        LayoutText {#text} at (296,0) size 5x17
+          text run at (296,0) width 5: "."
+      LayoutText {#text} at (0,0) size 0x0
+      LayoutText {#text} at (0,0) size 0x0
+selection start: position 0 of child 0 {#text} of child 1 {SPAN} of child 1 {DIV} of body
+selection end:   position 1 of child 16 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-rect-rounding-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-rect-rounding-expected.png
index e655904..0375f09 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-rect-rounding-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/selection-rect-rounding-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/shaping/shaping-selection-rect-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/shaping/shaping-selection-rect-expected.png
index be74e412..97f6d6e 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/shaping/shaping-selection-rect-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/shaping/shaping-selection-rect-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/pre-wrap-overflow-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
index f0367caa..148fb17 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/pre-wrap-overflow-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
index d94d225..90847cb 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/text/whitespace/select-new-line-with-line-break-normal-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/horizontal-bt-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
index 36fb1a5..6d439bea 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/horizontal-bt-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-lr-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-lr-selection-expected.png
index 9b0e6ecc..3190387 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-lr-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-lr-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-lr-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-lr-selection-expected.txt
index 04274b2..46540d2 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-lr-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-lr-selection-expected.txt
@@ -1,24 +1,24 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (0,0) size 361x600
-  LayoutBlockFlow {HTML} at (0,0) size 361x600 [border: (10px solid #800000)]
-    LayoutBlockFlow {BODY} at (18,18) size 325x564 [border: (5px solid #000000)]
-      LayoutBlockFlow {DIV} at (5,105) size 315x400
-        LayoutText {#text} at (0,0) size 315x395
-          text run at (0,0) width 384: "\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}"
-          text run at (21,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
-          text run at (42,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
-          text run at (63,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
-          text run at (84,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
-          text run at (105,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
-          text run at (126,0) width 395: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
-          text run at (147,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
-          text run at (168,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
-          text run at (189,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
-          text run at (210,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
-          text run at (231,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
-          text run at (252,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
-          text run at (273,0) width 395: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
-          text run at (294,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+layer at (0,0) size 556x600
+  LayoutBlockFlow {HTML} at (0,0) size 556x600 [border: (10px solid #800000)]
+    LayoutBlockFlow {BODY} at (18,18) size 520x564 [border: (5px solid #000000)]
+      LayoutBlockFlow {DIV} at (5,105) size 510x400
+        LayoutText {#text} at (5,0) size 500x390
+          text run at (5,0) width 384: "\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}"
+          text run at (39,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
+          text run at (73,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
+          text run at (107,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
+          text run at (141,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
+          text run at (175,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
+          text run at (209,0) width 390: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
+          text run at (243,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+          text run at (277,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
+          text run at (311,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
+          text run at (345,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
+          text run at (379,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
+          text run at (413,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
+          text run at (447,0) width 390: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
+          text run at (481,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
 selection start: position 5 of child 0 {#text} of child 1 {DIV} of body
-selection end:   position 258 of child 0 {#text} of child 1 {DIV} of body
+selection end:   position 185 of child 0 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-rl-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-rl-selection-expected.png
index 3e2fb57..6fb1b59 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-rl-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-rl-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-rl-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-rl-selection-expected.txt
index cedea2b8..0e1c934 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-rl-selection-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/japanese-rl-selection-expected.txt
@@ -1,24 +1,24 @@
 layer at (0,0) size 800x600
   LayoutView at (0,0) size 800x600
-layer at (439,0) size 361x600
-  LayoutBlockFlow {HTML} at (0,0) size 361x600 [border: (10px solid #800000)]
-    LayoutBlockFlow {BODY} at (18,18) size 325x564 [border: (5px solid #000000)]
-      LayoutBlockFlow {DIV} at (5,105) size 315x400
-        LayoutText {#text} at (0,0) size 315x395
-          text run at (0,0) width 384: "\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}"
-          text run at (21,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
-          text run at (42,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
-          text run at (63,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
-          text run at (84,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
-          text run at (105,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
-          text run at (126,0) width 395: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
-          text run at (147,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
-          text run at (168,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
-          text run at (189,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
-          text run at (210,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
-          text run at (231,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
-          text run at (252,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
-          text run at (273,0) width 395: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
-          text run at (294,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+layer at (244,0) size 556x600
+  LayoutBlockFlow {HTML} at (0,0) size 556x600 [border: (10px solid #800000)]
+    LayoutBlockFlow {BODY} at (18,18) size 520x564 [border: (5px solid #000000)]
+      LayoutBlockFlow {DIV} at (5,105) size 510x400
+        LayoutText {#text} at (5,0) size 500x390
+          text run at (5,0) width 384: "\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}"
+          text run at (39,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
+          text run at (73,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
+          text run at (107,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
+          text run at (141,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
+          text run at (175,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
+          text run at (209,0) width 390: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
+          text run at (243,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+          text run at (277,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
+          text run at (311,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
+          text run at (345,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
+          text run at (379,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
+          text run at (413,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
+          text run at (447,0) width 390: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
+          text run at (481,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
 selection start: position 5 of child 0 {#text} of child 1 {DIV} of body
-selection end:   position 258 of child 0 {#text} of child 1 {DIV} of body
+selection end:   position 203 of child 0 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/vertical-lr-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/vertical-lr-replaced-selection-expected.png
index 28f29c5..136ee49 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/vertical-lr-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/vertical-lr-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/vertical-rl-replaced-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/vertical-rl-replaced-selection-expected.png
index 24a01de..3c9d9a2 100644
--- a/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/vertical-rl-replaced-selection-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/fast/writing-mode/vertical-rl-replaced-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/invalidate-after-composited-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/invalidate-after-composited-scroll-expected.txt
index a13afdaf..3543193 100644
--- a/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/invalidate-after-composited-scroll-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/paint/invalidation/invalidate-after-composited-scroll-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='target'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -43,12 +38,8 @@
                 {
                   "position": [185, 0],
                   "bounds": [15, 200],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 200]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 }
               ]
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/selection/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/platform/win/paint/selection/selection-within-composited-scroller-expected.txt
index 959a046d..7f1e81a 100644
--- a/third_party/WebKit/LayoutTests/platform/win/paint/selection/selection-within-composited-scroller-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/paint/selection/selection-within-composited-scroller-expected.txt
@@ -41,11 +41,6 @@
                     "LayoutBlockFlow DIV id='target'",
                     "LayoutText #text",
                     "InlineTextBox 'test'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -54,13 +49,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/win/paint/selection/text-selection-newline-br-expected.png b/third_party/WebKit/LayoutTests/platform/win/paint/selection/text-selection-newline-br-expected.png
index ae94bee..b397b03 100644
--- a/third_party/WebKit/LayoutTests/platform/win/paint/selection/text-selection-newline-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/paint/selection/text-selection-newline-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/svg/text/foreignObject-text-clipping-bug-expected.png b/third_party/WebKit/LayoutTests/platform/win/svg/text/foreignObject-text-clipping-bug-expected.png
index d00b7fac..8afe7cc 100644
--- a/third_party/WebKit/LayoutTests/platform/win/svg/text/foreignObject-text-clipping-bug-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/svg/text/foreignObject-text-clipping-bug-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
deleted file mode 100644
index ab91040..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
+++ /dev/null
@@ -1,90 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [308, 208],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [4, 4],
-              "bounds": [285, 200],
-              "children": [
-                {
-                  "bounds": [285, 530],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [289, 4],
-                  "bounds": [15, 185],
-                  "drawsContent": true
-                },
-                {
-                  "position": [289, 189],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [50, 200],
-          "bounds": [200, 200],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [12, 12],
-          "bounds": [80, 80],
-          "shouldFlattenTransform": false,
-          "hasScrollParent": true,
-          "children": [
-            {
-              "position": [10, 10],
-              "bounds": [100, 100],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#FF0000"
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "hasScrollParent": true,
-          "children": [
-            {
-              "position": [22, 102],
-              "bounds": [100, 100],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [22, 212],
-              "bounds": [100, 320],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
deleted file mode 100644
index 143d38a..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
+++ /dev/null
@@ -1,134 +0,0 @@
-{
-  "bounds": [800, 600],
-  "paintingPhases": [
-    "GraphicsLayerPaintBackground",
-    "GraphicsLayerPaintForeground",
-    "GraphicsLayerPaintMask"
-  ],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "paintingPhases": [
-        "GraphicsLayerPaintBackground",
-        "GraphicsLayerPaintForeground",
-        "GraphicsLayerPaintMask"
-      ],
-      "children": [
-        {
-          "bounds": [800, 242],
-          "drawsContent": true,
-          "paintingPhases": [
-            "GraphicsLayerPaintBackground",
-            "GraphicsLayerPaintMask"
-          ],
-          "children": [
-            {
-              "position": [29, 31],
-              "bounds": [80, 10],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#008000",
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintForeground",
-                "GraphicsLayerPaintMask"
-              ]
-            },
-            {
-              "bounds": [800, 242],
-              "drawsContent": true,
-              "paintingPhases": [
-                "GraphicsLayerPaintForeground"
-              ]
-            },
-            {
-              "position": [28, 20],
-              "bounds": [202, 202],
-              "drawsContent": true,
-              "paintingPhases": [
-                "GraphicsLayerPaintBackground",
-                "GraphicsLayerPaintMask",
-                "GraphicsLayerPaintCompositedScroll"
-              ],
-              "children": [
-                {
-                  "position": [1, 1],
-                  "bounds": [185, 185],
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ],
-                  "children": [
-                    {
-                      "bounds": [185, 715],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintOverflowContents",
-                        "GraphicsLayerPaintCompositedScroll"
-                      ],
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false,
-                          "paintingPhases": [
-                            "GraphicsLayerPaintForeground",
-                            "GraphicsLayerPaintOverflowContents",
-                            "GraphicsLayerPaintCompositedScroll"
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "paintingPhases": [
-                    "GraphicsLayerPaintBackground",
-                    "GraphicsLayerPaintForeground",
-                    "GraphicsLayerPaintMask"
-                  ],
-                  "children": [
-                    {
-                      "position": [1, 186],
-                      "bounds": [185, 15],
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    },
-                    {
-                      "position": [186, 1],
-                      "bounds": [15, 185],
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    },
-                    {
-                      "position": [186, 186],
-                      "bounds": [15, 15],
-                      "drawsContent": true,
-                      "paintingPhases": [
-                        "GraphicsLayerPaintBackground",
-                        "GraphicsLayerPaintForeground",
-                        "GraphicsLayerPaintMask"
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
deleted file mode 100644
index 6d6689b..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
+++ /dev/null
@@ -1,152 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 100],
-              "children": [
-                {
-                  "bounds": [85, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 100],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 85],
-              "children": [
-                {
-                  "bounds": [200, 85],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [100, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [200, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 100],
-              "children": [
-                {
-                  "bounds": [10, 10]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
deleted file mode 100644
index 91dc218..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [285, 285],
-              "children": [
-                {
-                  "bounds": [1000, 1000],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 285],
-                  "bounds": [285, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 285],
-                  "drawsContent": true
-                },
-                {
-                  "position": [285, 285],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
deleted file mode 100644
index 91dc218..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [285, 285],
-              "children": [
-                {
-                  "bounds": [1000, 1000],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 285],
-                  "bounds": [285, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 285],
-                  "drawsContent": true
-                },
-                {
-                  "position": [285, 285],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
deleted file mode 100644
index 91dc218..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
+++ /dev/null
@@ -1,54 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [285, 285],
-              "children": [
-                {
-                  "bounds": [1000, 1000],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 285],
-                  "bounds": [285, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [285, 0],
-                  "bounds": [15, 285],
-                  "drawsContent": true
-                },
-                {
-                  "position": [285, 285],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
deleted file mode 100644
index 6d6689b..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
+++ /dev/null
@@ -1,152 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 100],
-              "children": [
-                {
-                  "bounds": [85, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [10, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 100],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 85],
-              "children": [
-                {
-                  "bounds": [200, 85],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 10]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [100, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [200, 200],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [200, 200]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 85],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [85, 0],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 13],
-          "bounds": [100, 100],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [100, 100],
-              "children": [
-                {
-                  "bounds": [10, 10]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [85, 85],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
deleted file mode 100644
index c0deec5..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
+++ /dev/null
@@ -1,77 +0,0 @@
-{
-  "bounds": [1208, 821],
-  "children": [
-    {
-      "bounds": [1208, 821],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 8],
-          "bounds": [1200, 800],
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "bounds": [1200, 800],
-              "drawsContent": true,
-              "children": [
-                {
-                  "bounds": [1200, 800],
-                  "children": [
-                    {
-                      "bounds": [1200, 1000],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "bounds": [1200, 1000],
-                          "drawsContent": true,
-                          "children": [
-                            {
-                              "bounds": [1200, 1000],
-                              "children": [
-                                {
-                                  "bounds": [1200, 10000],
-                                  "shouldFlattenTransform": false,
-                                  "drawsContent": true,
-                                  "children": [
-                                    {
-                                      "shouldFlattenTransform": false
-                                    }
-                                  ]
-                                }
-                              ]
-                            }
-                          ]
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [8, 10008],
-          "bounds": [1200, 0]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [1200, 1000],
-          "children": [
-            {
-              "children": [
-                {
-                  "position": [1193, 0],
-                  "bounds": [7, 1000],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
deleted file mode 100644
index c15c2d1..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
+++ /dev/null
@@ -1,82 +0,0 @@
-{
-  "bounds": [785, 5516],
-  "children": [
-    {
-      "bounds": [785, 5516],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [8, 8],
-              "bounds": [500, 500],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF",
-              "children": [
-                {
-                  "bounds": [485, 485],
-                  "children": [
-                    {
-                      "bounds": [485, 5000],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [0, 485],
-                      "bounds": [485, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [485, 0],
-                      "bounds": [15, 485],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [485, 485],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [8, 8],
-              "bounds": [400, 400],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [8, 8],
-          "bounds": [300, 300],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backfaceVisibility": "hidden",
-          "backgroundColor": "#FFFF00"
-        },
-        {
-          "position": [8, 8],
-          "bounds": [20, 5000],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#FA8072",
-          "hasScrollParent": true
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
deleted file mode 100644
index 7f2c9bc..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
+++ /dev/null
@@ -1,78 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [98, 90],
-          "bounds": [300, 300],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backfaceVisibility": "hidden",
-          "backgroundColor": "#FFEFD5",
-          "children": [
-            {
-              "bounds": [102, 102],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [1, 1],
-                  "bounds": [100, 100],
-                  "children": [
-                    {
-                      "bounds": [100, 180],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [60, 60],
-          "bounds": [80, 80],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [103, 95],
-              "bounds": [60, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [103, 139],
-              "bounds": [60, 128],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [98, 90],
-          "children": [
-            {
-              "position": [94, 1],
-              "bounds": [7, 100],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
deleted file mode 100644
index 28eef39..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
+++ /dev/null
@@ -1,59 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "bounds": [320, 340],
-          "drawsContent": true,
-          "children": [
-            {
-              "bounds": [305, 325],
-              "children": [
-                {
-                  "bounds": [305, 1224],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [0, 325],
-                  "bounds": [305, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [305, 0],
-                  "bounds": [15, 325],
-                  "drawsContent": true
-                },
-                {
-                  "position": [305, 325],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [10, 10],
-          "bounds": [284, 1204],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#C0C0C0"
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
index f0db4a09..f9f7d07 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-without-painting-expected.txt
@@ -18,12 +18,7 @@
                 {
                   "bounds": [185, 1025],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -31,18 +26,13 @@
               "children": [
                 {
                   "position": [1, 186],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [186, 1],
                   "bounds": [15, 185],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 185]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
index 7d2ebd4..f1d578d 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-after-removing-scrolling-contents-expected.txt
@@ -34,12 +34,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -47,13 +42,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -143,10 +136,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2670],
+  "bounds": [785, 2558],
   "children": [
     {
-      "bounds": [785, 2670],
+      "bounds": [785, 2558],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -163,12 +156,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -176,13 +164,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -272,10 +258,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4734],
+  "bounds": [785, 4510],
   "children": [
     {
-      "bounds": [785, 4734],
+      "bounds": [785, 4510],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,15 +275,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -305,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -401,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6798],
+  "bounds": [785, 6414],
   "children": [
     {
-      "bounds": [785, 6798],
+      "bounds": [785, 6414],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -418,14 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -433,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
index b6b3cfe..fe372df7 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2604],
+  "bounds": [785, 2492],
   "children": [
     {
-      "bounds": [785, 2604],
+      "bounds": [785, 2492],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -157,15 +150,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -173,13 +158,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +252,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4668],
+  "bounds": [785, 4396],
   "children": [
     {
-      "bounds": [785, 4668],
+      "bounds": [785, 4396],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -286,14 +269,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -301,13 +277,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
index 6777c05f..b40fab7 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/selection-gaps-toggling-with-scrolling-contents-expected.txt
@@ -31,12 +31,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -44,13 +39,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -140,10 +133,10 @@
 *** iteration 2: ***
 
 {
-  "bounds": [785, 2622],
+  "bounds": [785, 2510],
   "children": [
     {
-      "bounds": [785, 2622],
+      "bounds": [785, 2510],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -160,12 +153,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -173,13 +161,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -269,10 +255,10 @@
 *** iteration 3: ***
 
 {
-  "bounds": [785, 4686],
+  "bounds": [785, 4462],
   "children": [
     {
-      "bounds": [785, 4686],
+      "bounds": [785, 4462],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -289,12 +275,7 @@
                 {
                   "bounds": [285, 665],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -302,13 +283,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
@@ -398,10 +377,10 @@
 *** iteration 4: ***
 
 {
-  "bounds": [785, 6750],
+  "bounds": [785, 6414],
   "children": [
     {
-      "bounds": [785, 6750],
+      "bounds": [785, 6414],
       "contentsOpaque": true,
       "drawsContent": true,
       "children": [
@@ -415,15 +394,7 @@
               "children": [
                 {
                   "bounds": [285, 665],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "position": [0, 195],
-                      "bounds": [285, 15],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true
-                    }
-                  ]
+                  "shouldFlattenTransform": false
                 }
               ]
             },
@@ -431,13 +402,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [285, 15],
-                  "drawsContent": true
+                  "bounds": [285, 15]
                 },
                 {
                   "position": [285, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [285, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
index 0997216..d56610c 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-color-change-expected.txt
@@ -193,11 +193,6 @@
                     "InlineTextBox '\n'",
                     "InlineTextBox '  Text'",
                     "InlineTextBox '\n'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -206,13 +201,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
index 8186975..dfa6a1f 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/text-match-highlight-expected.txt
@@ -74,11 +74,6 @@
                     "InlineTextBox 'Findme in a typewriter!'",
                     "LayoutSVGInlineText #text",
                     "InlineTextBox 'Findme on a path! Did you findme?'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -87,13 +82,11 @@
               "children": [
                 {
                   "position": [0, 485],
-                  "bounds": [785, 15],
-                  "drawsContent": true
+                  "bounds": [785, 15]
                 },
                 {
                   "position": [785, 0],
-                  "bounds": [15, 485],
-                  "drawsContent": true
+                  "bounds": [15, 485]
                 },
                 {
                   "position": [785, 485],
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
index 39c686f..ddda2df 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/textarea-scroll-touch-expected.txt
@@ -21,12 +21,7 @@
                 {
                   "bounds": [189, 337],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -34,8 +29,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
@@ -60,12 +54,7 @@
                 {
                   "bounds": [189, 337],
                   "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
+                  "drawsContent": true
                 }
               ]
             },
@@ -73,8 +62,7 @@
               "children": [
                 {
                   "position": [190, 1],
-                  "bounds": [15, 109],
-                  "drawsContent": true
+                  "bounds": [15, 109]
                 },
                 {
                   "position": [190, 110],
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
deleted file mode 100644
index cf78466..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
+++ /dev/null
@@ -1,1029 +0,0 @@
-{
-  "bounds": [785, 2016],
-  "children": [
-    {
-      "bounds": [785, 2016],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [10, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [35, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [130, 10],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [157, 18],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [136, -15],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [250, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [275, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [370, 10],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "drawsContent": true,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [395, 75],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, -15],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 41],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [10, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [37, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [16, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [130, 130],
-              "bounds": [104, 104],
-              "drawsContent": true,
-              "children": [
-                {
-                  "position": [2, 2],
-                  "bounds": [85, 85],
-                  "children": [
-                    {
-                      "bounds": [85, 144],
-                      "shouldFlattenTransform": false,
-                      "children": [
-                        {
-                          "shouldFlattenTransform": false
-                        }
-                      ]
-                    }
-                  ]
-                },
-                {
-                  "children": [
-                    {
-                      "position": [2, 87],
-                      "bounds": [85, 15],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 2],
-                      "bounds": [15, 85],
-                      "drawsContent": true
-                    },
-                    {
-                      "position": [87, 87],
-                      "bounds": [15, 15],
-                      "drawsContent": true
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "position": [155, 195],
-              "bounds": [80, 40],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 105],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 161],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [250, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [277, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [256, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [370, 130],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [105, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [397, 138],
-              "bounds": [80, 40],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#800080"
-            },
-            {
-              "position": [376, 105],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [10, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [35, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [130, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [155, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [250, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [275, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [370, 250],
-          "bounds": [104, 104],
-          "drawsContent": true,
-          "children": [
-            {
-              "position": [2, 2],
-              "bounds": [85, 85],
-              "children": [
-                {
-                  "bounds": [85, 144],
-                  "shouldFlattenTransform": false,
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [2, 87],
-                  "bounds": [85, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 2],
-                  "bounds": [15, 85],
-                  "drawsContent": true
-                },
-                {
-                  "position": [87, 87],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        },
-        {
-          "position": [395, 315],
-          "bounds": [80, 40],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#800080"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 225],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 281],
-              "bounds": [75, 24],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "position": [375, 20],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [15, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [135, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [255, 140],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [15, 260],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "position": [135, 260],
-          "bounds": [50, 100],
-          "contentsOpaque": true,
-          "drawsContent": true,
-          "backgroundColor": "#008000"
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, -43],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 13],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 77],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 133],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [16, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [16, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [136, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [136, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [256, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [256, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        },
-        {
-          "shouldFlattenTransform": false,
-          "children": [
-            {
-              "position": [376, 197],
-              "bounds": [75, 24],
-              "contentsOpaque": true,
-              "drawsContent": true,
-              "backgroundColor": "#0000FF"
-            },
-            {
-              "position": [376, 253],
-              "bounds": [75, 80],
-              "drawsContent": true
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
index 7abd9b70..c158fabd 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-and-content-expected.txt
@@ -103,11 +103,6 @@
                     "InlineTextBox 'CONTENT'",
                     "LayoutText #text",
                     "InlineTextBox 'CONTENT'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -116,13 +111,11 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
-                  "bounds": [15, 185],
-                  "drawsContent": true
+                  "bounds": [15, 185]
                 },
                 {
                   "position": [185, 185],
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
deleted file mode 100644
index 6f166e1f..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-{
-  "bounds": [800, 600],
-  "children": [
-    {
-      "bounds": [800, 600],
-      "contentsOpaque": true,
-      "drawsContent": true,
-      "children": [
-        {
-          "position": [8, 108],
-          "bounds": [210, 210],
-          "drawsContent": true,
-          "repaintRects": [
-            [0, 0, 210, 210]
-          ],
-          "paintInvalidationClients": [
-            "LayoutBlockFlow DIV id='container'"
-          ],
-          "children": [
-            {
-              "position": [5, 5],
-              "bounds": [185, 185],
-              "children": [
-                {
-                  "bounds": [400, 400],
-                  "shouldFlattenTransform": false,
-                  "drawsContent": true,
-                  "repaintRects": [
-                    [-5, -5, 210, 210]
-                  ],
-                  "paintInvalidationClients": [
-                    "LayoutBlockFlow DIV id='container'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
-                  ]
-                }
-              ]
-            },
-            {
-              "children": [
-                {
-                  "position": [5, 190],
-                  "bounds": [185, 15],
-                  "drawsContent": true
-                },
-                {
-                  "position": [190, 5],
-                  "bounds": [15, 185],
-                  "drawsContent": true
-                },
-                {
-                  "position": [190, 190],
-                  "bounds": [15, 15],
-                  "drawsContent": true
-                }
-              ]
-            }
-          ]
-        }
-      ]
-    }
-  ]
-}
-
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
index 540be7b..cd704810 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-content-expected.txt
@@ -29,11 +29,6 @@
                   ],
                   "paintInvalidationClients": [
                     "LayoutBlockFlow DIV id='indicator'"
-                  ],
-                  "children": [
-                    {
-                      "shouldFlattenTransform": false
-                    }
                   ]
                 }
               ]
@@ -42,18 +37,13 @@
               "children": [
                 {
                   "position": [0, 185],
-                  "bounds": [185, 15],
-                  "drawsContent": true
+                  "bounds": [185, 15]
                 },
                 {
                   "position": [185, 0],
                   "bounds": [15, 185],
-                  "drawsContent": true,
                   "repaintRects": [
                     [0, 0, 15, 185]
-                  ],
-                  "paintInvalidationClients": [
-                    "##ALL##"
                   ]
                 },
                 {
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png
new file mode 100644
index 0000000..f7b736b7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/image-resize-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png
new file mode 100644
index 0000000..7a249b5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png
new file mode 100644
index 0000000..45e864c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/selection/text-selection-newline-br-expected.png b/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/selection/text-selection-newline-br-expected.png
index ae94bee..b397b03 100644
--- a/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/selection/text-selection-newline-br-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win/virtual/spv2/paint/selection/text-selection-newline-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/webaudio/audiobuffersource-loop-points-expected.wav b/third_party/WebKit/LayoutTests/platform/win/webaudio/audiobuffersource-loop-points-expected.wav
deleted file mode 100644
index 72b09d8..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/webaudio/audiobuffersource-loop-points-expected.wav
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win/webaudio/audiobuffersource-playbackrate-expected.wav b/third_party/WebKit/LayoutTests/platform/win/webaudio/audiobuffersource-playbackrate-expected.wav
deleted file mode 100644
index 8b9802ff..0000000
--- a/third_party/WebKit/LayoutTests/platform/win/webaudio/audiobuffersource-playbackrate-expected.wav
+++ /dev/null
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/doubleclick-crash-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/doubleclick-crash-expected.png
new file mode 100644
index 0000000..ed33ff62
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/doubleclick-crash-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/doubleclick-crash-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/doubleclick-crash-expected.txt
new file mode 100644
index 0000000..dd3ea8c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/doubleclick-crash-expected.txt
@@ -0,0 +1,19 @@
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
+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 (0,0) size 800x587
+      LayoutBlockFlow {PRE} at (0,0) size 800x80
+        LayoutText {#text} at (0,0) size 40x64
+          text run at (0,0) width 40: "Test."
+          text run at (40,0) width 0: " "
+          text run at (0,16) width 40: "Test."
+          text run at (40,16) width 0: " "
+          text run at (0,32) width 0: " "
+          text run at (0,48) width 0: " "
+        LayoutText {#text} at (0,64) size 0x16
+          text run at (0,64) width 0: " "
+selection start: position 5 of child 0 {#text} of child 1 {PRE} of body
+selection end:   position 6 of child 0 {#text} of child 1 {PRE} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
new file mode 100644
index 0000000..849f2e1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt
new file mode 100644
index 0000000..ac76417
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-backward-br-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x279
+  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
+      LayoutBlockFlow {P} at (0,0) size 784x19
+        LayoutText {#text} at (0,1) size 696x17
+          text run at (0,1) width 696: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,35) size 68x214.69
+        LayoutBlockFlow {P} at (16,0) size 36x214.69
+          LayoutText {#text} at (0,0) size 17x126
+            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+          LayoutBR {BR} at (0,125) size 17x1
+          LayoutText {#text} at (18,0) size 17x124
+            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+selection start: position 5 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
+selection end:   position 5 of child 2 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
new file mode 100644
index 0000000..4a490374
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt
new file mode 100644
index 0000000..5963a228
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-lr-ltr-extend-line-forward-br-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x279
+  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
+      LayoutBlockFlow {P} at (0,0) size 784x19
+        LayoutText {#text} at (0,1) size 697x17
+          text run at (0,1) width 697: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,35) size 68x214.69
+        LayoutBlockFlow {P} at (16,0) size 36x214.69
+          LayoutText {#text} at (0,0) size 17x126
+            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+          LayoutBR {BR} at (0,125) size 17x1
+          LayoutText {#text} at (18,0) size 17x124
+            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+selection start: position 2 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
+selection end:   position 2 of child 2 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
new file mode 100644
index 0000000..0e2fea0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt
new file mode 100644
index 0000000..ac76417
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-br-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x279
+  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
+      LayoutBlockFlow {P} at (0,0) size 784x19
+        LayoutText {#text} at (0,1) size 696x17
+          text run at (0,1) width 696: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,35) size 68x214.69
+        LayoutBlockFlow {P} at (16,0) size 36x214.69
+          LayoutText {#text} at (0,0) size 17x126
+            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+          LayoutBR {BR} at (0,125) size 17x1
+          LayoutText {#text} at (18,0) size 17x124
+            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+selection start: position 5 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
+selection end:   position 5 of child 2 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
new file mode 100644
index 0000000..b36dbb0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt
new file mode 100644
index 0000000..89858868
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-p-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x279
+  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
+      LayoutBlockFlow {P} at (0,0) size 784x19
+        LayoutText {#text} at (0,1) size 696x17
+          text run at (0,1) width 696: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,35) size 84x214.69
+        LayoutBlockFlow {P} at (16,0) size 18x214.69
+          LayoutText {#text} at (0,0) size 17x126
+            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+        LayoutBlockFlow {P} at (50,0) size 18x214.69
+          LayoutText {#text} at (0,0) size 17x124
+            text run at (0,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+selection start: position 5 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
+selection end:   position 5 of child 0 {#text} of child 3 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
new file mode 100644
index 0000000..0e2fea0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt
new file mode 100644
index 0000000..83256df
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-backward-wrap-expected.txt
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x192
+  LayoutBlockFlow {HTML} at (0,0) size 800x192
+    LayoutBlockFlow {BODY} at (8,16) size 784x163
+      LayoutBlockFlow {P} at (0,0) size 784x19
+        LayoutText {#text} at (0,1) size 696x17
+          text run at (0,1) width 696: "This tests horizontal caret movement in vertical writing mode. \"\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,35) size 68x128
+        LayoutBlockFlow {P} at (16,0) size 36x128
+          LayoutText {#text} at (0,0) size 35x126
+            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,176) size 784x0
+selection start: position 5 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
+selection end:   position 13 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
new file mode 100644
index 0000000..d368f61e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt
new file mode 100644
index 0000000..5963a228
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-br-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x279
+  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
+      LayoutBlockFlow {P} at (0,0) size 784x19
+        LayoutText {#text} at (0,1) size 697x17
+          text run at (0,1) width 697: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,35) size 68x214.69
+        LayoutBlockFlow {P} at (16,0) size 36x214.69
+          LayoutText {#text} at (0,0) size 17x126
+            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+          LayoutBR {BR} at (0,125) size 17x1
+          LayoutText {#text} at (18,0) size 17x124
+            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+selection start: position 2 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
+selection end:   position 2 of child 2 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
new file mode 100644
index 0000000..741bf8d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt
new file mode 100644
index 0000000..d42b0f27
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-p-expected.txt
@@ -0,0 +1,18 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x279
+  LayoutBlockFlow {HTML} at (0,0) size 800x278.69
+    LayoutBlockFlow {BODY} at (8,16) size 784x249.69
+      LayoutBlockFlow {P} at (0,0) size 784x19
+        LayoutText {#text} at (0,1) size 697x17
+          text run at (0,1) width 697: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,35) size 84x214.69
+        LayoutBlockFlow {P} at (16,0) size 18x214.69
+          LayoutText {#text} at (0,0) size 17x126
+            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+        LayoutBlockFlow {P} at (50,0) size 18x214.69
+          LayoutText {#text} at (0,0) size 17x124
+            text run at (0,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,262.69) size 784x0
+selection start: position 2 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
+selection end:   position 2 of child 0 {#text} of child 3 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
new file mode 100644
index 0000000..d368f61e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt
new file mode 100644
index 0000000..6b2376a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/editing/selection/vertical-rl-ltr-extend-line-forward-wrap-expected.txt
@@ -0,0 +1,16 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x192
+  LayoutBlockFlow {HTML} at (0,0) size 800x192
+    LayoutBlockFlow {BODY} at (8,16) size 784x163
+      LayoutBlockFlow {P} at (0,0) size 784x19
+        LayoutText {#text} at (0,1) size 697x17
+          text run at (0,1) width 697: "This tests horizontal caret movement in vertical writing mode. \"\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}\" and \"\x{540D}\x{524D}\" must be selected."
+      LayoutBlockFlow {DIV} at (0,35) size 68x128
+        LayoutBlockFlow {P} at (16,0) size 36x128
+          LayoutText {#text} at (0,0) size 35x126
+            text run at (0,0) width 126: "\x{543E}\x{8F29}\x{306F}\x{732B}\x{3067}\x{3042}\x{308B}\x{3002}"
+            text run at (18,0) width 124: "\x{540D}\x{524D}\x{306F}\x{307E}\x{3060}\x{7121}\x{3044}\x{3002}"
+      LayoutBlockFlow {PRE} at (0,176) size 784x0
+selection start: position 2 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
+selection end:   position 10 of child 0 {#text} of child 1 {P} of child 3 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/repaint/japanese-rl-selection-clear-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/fast/repaint/japanese-rl-selection-clear-expected.txt
new file mode 100644
index 0000000..016f714b
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/repaint/japanese-rl-selection-clear-expected.txt
@@ -0,0 +1,31 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "repaintRects": [
+        [428, 123, 349, 397]
+      ],
+      "paintInvalidationClients": [
+        "LayoutText #text",
+        "InlineTextBox '\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042'",
+        "InlineTextBox '\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C\u9A13\u306F\u3042\u308A\u307E\u3059\u304B\u306A'",
+        "InlineTextBox '\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F\u3057'",
+        "InlineTextBox '\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B'",
+        "InlineTextBox '\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089'",
+        "InlineTextBox '\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C'",
+        "InlineTextBox '\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060'",
+        "InlineTextBox '\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F\u3057\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3'",
+        "InlineTextBox '\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u8A2A\u554F\u3057'",
+        "InlineTextBox '\u305F\u30A6\u30A7\u30D6\u30DA\u30FC\u30B8\u306E\u30B3\u30F3\u30C6\u30F3\u30C4\u304B\u3089\u3082\u691C\u7D22\u3059\u308B'",
+        "InlineTextBox '\u3053\u3068\u304C\u3067\u304D\u307E\u3059\u3002\u305B\u3063\u304B\u304F\u898B\u3064\u3051\u305F\u3059\u3070\u3089'",
+        "InlineTextBox '\u3057\u3044\u8A18\u4E8B\u304C\u3069\u3053\u306B\u3042\u3063\u305F\u304B\u5FD8\u308C\u3066\u3057\u307E\u3063\u305F\u7D4C'",
+        "InlineTextBox '\u9A13\u306F\u3042\u308A\u307E\u3059\u304B \u306A\u3089\u30BF\u30A4\u30C8\u30EB\u3068\u30A2\u30C9\u30EC\u30B9\u3060'",
+        "InlineTextBox '\u3051\u3067\u306A\u304F\u3001\u8A2A\u554F'"
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/repaint/japanese-rl-selection-repaint-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/fast/repaint/japanese-rl-selection-repaint-expected.txt
index c47c748..94d19091 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/repaint/japanese-rl-selection-repaint-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/repaint/japanese-rl-selection-repaint-expected.txt
@@ -6,7 +6,6 @@
       "contentsOpaque": true,
       "drawsContent": true,
       "repaintRects": [
-        [553, 544, 224, 33],
         [528, 23, 249, 553]
       ],
       "paintInvalidationClients": [
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-expected.png
index b72c42b19..7dd0cd9 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-expected.png
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/text/emphasis-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-lr-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-lr-selection-expected.png
new file mode 100644
index 0000000..e3a1ef7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-lr-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-lr-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-lr-selection-expected.txt
new file mode 100644
index 0000000..04274b2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-lr-selection-expected.txt
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 361x600
+  LayoutBlockFlow {HTML} at (0,0) size 361x600 [border: (10px solid #800000)]
+    LayoutBlockFlow {BODY} at (18,18) size 325x564 [border: (5px solid #000000)]
+      LayoutBlockFlow {DIV} at (5,105) size 315x400
+        LayoutText {#text} at (0,0) size 315x395
+          text run at (0,0) width 384: "\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}"
+          text run at (21,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
+          text run at (42,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
+          text run at (63,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
+          text run at (84,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
+          text run at (105,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
+          text run at (126,0) width 395: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
+          text run at (147,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+          text run at (168,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
+          text run at (189,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
+          text run at (210,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
+          text run at (231,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
+          text run at (252,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
+          text run at (273,0) width 395: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
+          text run at (294,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+selection start: position 5 of child 0 {#text} of child 1 {DIV} of body
+selection end:   position 258 of child 0 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-rl-selection-expected.png b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-rl-selection-expected.png
new file mode 100644
index 0000000..18702a3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-rl-selection-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-rl-selection-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-rl-selection-expected.txt
new file mode 100644
index 0000000..cedea2b8
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/fast/writing-mode/japanese-rl-selection-expected.txt
@@ -0,0 +1,24 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (439,0) size 361x600
+  LayoutBlockFlow {HTML} at (0,0) size 361x600 [border: (10px solid #800000)]
+    LayoutBlockFlow {BODY} at (18,18) size 325x564 [border: (5px solid #000000)]
+      LayoutBlockFlow {DIV} at (5,105) size 315x400
+        LayoutText {#text} at (0,0) size 315x395
+          text run at (0,0) width 384: "\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}"
+          text run at (21,0) width 384: "\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}"
+          text run at (42,0) width 363: "\x{3059}\x{304B}\x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}"
+          text run at (63,0) width 384: "\x{304F}\x{3001}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}"
+          text run at (84,0) width 384: "\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}"
+          text run at (105,0) width 384: "\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}"
+          text run at (126,0) width 395: "\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}"
+          text run at (147,0) width 384: "\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+          text run at (168,0) width 384: "\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}"
+          text run at (189,0) width 384: "\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{8A2A}\x{554F}\x{3057}\x{305F}\x{30A6}\x{30A7}\x{30D6}"
+          text run at (210,0) width 384: "\x{30DA}\x{30FC}\x{30B8}\x{306E}\x{30B3}\x{30F3}\x{30C6}\x{30F3}\x{30C4}\x{304B}\x{3089}\x{3082}\x{691C}\x{7D22}\x{3059}\x{308B}\x{3053}\x{3068}"
+          text run at (231,0) width 384: "\x{304C}\x{3067}\x{304D}\x{307E}\x{3059}\x{3002}\x{305B}\x{3063}\x{304B}\x{304F}\x{898B}\x{3064}\x{3051}\x{305F}\x{3059}\x{3070}\x{3089}\x{3057}"
+          text run at (252,0) width 384: "\x{3044}\x{8A18}\x{4E8B}\x{304C}\x{3069}\x{3053}\x{306B}\x{3042}\x{3063}\x{305F}\x{304B}\x{5FD8}\x{308C}\x{3066}\x{3057}\x{307E}\x{3063}\x{305F}"
+          text run at (273,0) width 395: "\x{7D4C}\x{9A13}\x{306F}\x{3042}\x{308A}\x{307E}\x{3059}\x{304B} \x{306A}\x{3089}\x{30BF}\x{30A4}\x{30C8}\x{30EB}\x{3068}\x{30A2}\x{30C9}\x{30EC}"
+          text run at (294,0) width 192: "\x{30B9}\x{3060}\x{3051}\x{3067}\x{306A}\x{304F}\x{3001}\x{8A2A}\x{554F}"
+selection start: position 5 of child 0 {#text} of child 1 {DIV} of body
+selection end:   position 258 of child 0 {#text} of child 1 {DIV} of body
diff --git a/third_party/WebKit/LayoutTests/platform/win7/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
index 8c854b6..0f0f8084 100644
--- a/third_party/WebKit/LayoutTests/platform/win7/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
+++ b/third_party/WebKit/LayoutTests/platform/win7/imported/web-platform-tests/html/semantics/forms/constraints/form-validation-reportValidity-expected.txt
@@ -1,171 +1,215 @@
 ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
-ValidationMessageClient: main-message=Please match the requested format. sub-message=
-ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
-ValidationMessageClient: main-message=Please fill out this field. sub-message=
-ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
 ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 4 characters or less (you are currently using 5 characters). sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please shorten this text to 20 characters or less (you are currently using 21 characters). sub-message=
+ValidationMessageClient: main-message=Please shorten this text to 20 characters or less (you are currently using 21 characters). sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
 ValidationMessageClient: main-message=Please enter a URL. sub-message=
+ValidationMessageClient: main-message=Please enter a URL. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 CONSOLE WARNING: The specified value "a" is not a valid email address.
+ValidationMessageClient: main-message=Please shorten this text to 10 characters or less (you are currently using 15 characters). sub-message=
 CONSOLE WARNING: The specified value "a" is not a valid email address.
 ValidationMessageClient: main-message=Please shorten this text to 10 characters or less (you are currently using 15 characters). sub-message=
 ValidationMessageClient: main-message=Please match the requested format. sub-message=
+ValidationMessageClient: main-message=Please match the requested format. sub-message=
 CONSOLE WARNING: The specified value "abc" is not a valid email address.
 ValidationMessageClient: main-message=Please include an '@' in the email address. 'abc' is missing an '@'. sub-message=
+ValidationMessageClient: main-message=Please include an '@' in the email address. 'abc' is missing an '@'. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Value must be 01/01/2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be 01/01/2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be 01/01/2001 or later. sub-message=
 ValidationMessageClient: main-message=Value must be 01/01/2001 or later. sub-message=
 ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is 01/01/1970. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is 01/01/1970. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Value must be January, 2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be January, 2000 or earlier. sub-message=
+ValidationMessageClient: main-message=Value must be January, 2001 or later. sub-message=
 ValidationMessageClient: main-message=Value must be January, 2001 or later. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Value must be Week 01, 2000 or earlier. sub-message=
 ValidationMessageClient: main-message=Value must be Week 01, 2000 or earlier. sub-message=
 ValidationMessageClient: main-message=Value must be Week 01, 2001 or later. sub-message=
+ValidationMessageClient: main-message=Value must be Week 01, 2001 or later. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is Week 01, 1970. sub-message=
 ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is Week 01, 1970. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Value must be 12:00 PM or earlier. sub-message=
 ValidationMessageClient: main-message=Value must be 12:00 PM or earlier. sub-message=
 ValidationMessageClient: main-message=Value must be 12:00 PM or later. sub-message=
+ValidationMessageClient: main-message=Value must be 12:00 PM or later. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is 12:00 AM. sub-message=
 ValidationMessageClient: main-message=Please enter a valid value. The nearest valid value is 12:00 AM. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Value must be less than or equal to 5. sub-message=
 ValidationMessageClient: main-message=Value must be less than or equal to 5. sub-message=
 ValidationMessageClient: main-message=Value must be greater than or equal to 5. sub-message=
+ValidationMessageClient: main-message=Value must be greater than or equal to 5. sub-message=
+ValidationMessageClient: main-message=Please enter a valid value. The two nearest valid values are 2 and 4. sub-message=
 ValidationMessageClient: main-message=Please enter a valid value. The two nearest valid values are 2 and 4. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
+ValidationMessageClient: main-message=Please check this box if you want to proceed. sub-message=
 ValidationMessageClient: main-message=Please check this box if you want to proceed. sub-message=
 ValidationMessageClient: main-message=Please select one of these options. sub-message=
+ValidationMessageClient: main-message=Please select one of these options. sub-message=
+ValidationMessageClient: main-message=Please select a file. sub-message=
 ValidationMessageClient: main-message=Please select a file. sub-message=
 ValidationMessageClient: main-message=Please select an item in the list. sub-message=
+ValidationMessageClient: main-message=Please select an item in the list. sub-message=
+ValidationMessageClient: main-message=Please fill out this field. sub-message=
 ValidationMessageClient: main-message=Please fill out this field. sub-message=
 This is a testharness.js-based test.
 PASS [INPUT in TEXT status] no constraint 
 PASS [INPUT in TEXT status] no constraint (in a form) 
-FAIL [INPUT in TEXT status] suffering from being too long assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TEXT status] suffering from being too long 
 PASS [INPUT in TEXT status] suffering from being too long (in a form) 
-FAIL [INPUT in TEXT status] suffering from a pattern mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TEXT status] suffering from a pattern mismatch 
 PASS [INPUT in TEXT status] suffering from a pattern mismatch (in a form) 
-FAIL [INPUT in TEXT status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TEXT status] suffering from being missing 
 PASS [INPUT in TEXT status] suffering from being missing (in a form) 
 PASS [INPUT in SEARCH status] no constraint 
 PASS [INPUT in SEARCH status] no constraint (in a form) 
-FAIL [INPUT in SEARCH status] suffering from being too long assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in SEARCH status] suffering from being too long 
 PASS [INPUT in SEARCH status] suffering from being too long (in a form) 
-FAIL [INPUT in SEARCH status] suffering from a pattern mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in SEARCH status] suffering from a pattern mismatch 
 PASS [INPUT in SEARCH status] suffering from a pattern mismatch (in a form) 
-FAIL [INPUT in SEARCH status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in SEARCH status] suffering from being missing 
 PASS [INPUT in SEARCH status] suffering from being missing (in a form) 
 PASS [INPUT in TEL status] no constraint 
 PASS [INPUT in TEL status] no constraint (in a form) 
-FAIL [INPUT in TEL status] suffering from being too long assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TEL status] suffering from being too long 
 PASS [INPUT in TEL status] suffering from being too long (in a form) 
-FAIL [INPUT in TEL status] suffering from a pattern mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TEL status] suffering from a pattern mismatch 
 PASS [INPUT in TEL status] suffering from a pattern mismatch (in a form) 
-FAIL [INPUT in TEL status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TEL status] suffering from being missing 
 PASS [INPUT in TEL status] suffering from being missing (in a form) 
 PASS [INPUT in PASSWORD status] no constraint 
 PASS [INPUT in PASSWORD status] no constraint (in a form) 
-FAIL [INPUT in PASSWORD status] suffering from being too long assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in PASSWORD status] suffering from being too long 
 PASS [INPUT in PASSWORD status] suffering from being too long (in a form) 
-FAIL [INPUT in PASSWORD status] suffering from a pattern mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in PASSWORD status] suffering from a pattern mismatch 
 PASS [INPUT in PASSWORD status] suffering from a pattern mismatch (in a form) 
-FAIL [INPUT in PASSWORD status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in PASSWORD status] suffering from being missing 
 PASS [INPUT in PASSWORD status] suffering from being missing (in a form) 
 PASS [INPUT in URL status] no constraint 
 PASS [INPUT in URL status] no constraint (in a form) 
-FAIL [INPUT in URL status] suffering from being too long assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in URL status] suffering from being too long 
 PASS [INPUT in URL status] suffering from being too long (in a form) 
-FAIL [INPUT in URL status] suffering from a pattern mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in URL status] suffering from a pattern mismatch 
 PASS [INPUT in URL status] suffering from a pattern mismatch (in a form) 
-FAIL [INPUT in URL status] suffering from a type mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in URL status] suffering from a type mismatch 
 PASS [INPUT in URL status] suffering from a type mismatch (in a form) 
-FAIL [INPUT in URL status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in URL status] suffering from being missing 
 PASS [INPUT in URL status] suffering from being missing (in a form) 
 PASS [INPUT in EMAIL status] no constraint 
 PASS [INPUT in EMAIL status] no constraint (in a form) 
-FAIL [INPUT in EMAIL status] suffering from being too long assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in EMAIL status] suffering from being too long 
 PASS [INPUT in EMAIL status] suffering from being too long (in a form) 
-FAIL [INPUT in EMAIL status] suffering from a pattern mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in EMAIL status] suffering from a pattern mismatch 
 PASS [INPUT in EMAIL status] suffering from a pattern mismatch (in a form) 
-FAIL [INPUT in EMAIL status] suffering from a type mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in EMAIL status] suffering from a type mismatch 
 PASS [INPUT in EMAIL status] suffering from a type mismatch (in a form) 
-FAIL [INPUT in EMAIL status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in EMAIL status] suffering from being missing 
 PASS [INPUT in EMAIL status] suffering from being missing (in a form) 
 FAIL [INPUT in DATETIME status] The datetime type must be supported. assert_equals: The datetime type should be supported. expected "datetime" but got "text"
 PASS [INPUT in DATE status] no constraint 
 PASS [INPUT in DATE status] no constraint (in a form) 
-FAIL [INPUT in DATE status] suffering from an overflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in DATE status] suffering from an overflow 
 PASS [INPUT in DATE status] suffering from an overflow (in a form) 
-FAIL [INPUT in DATE status] suffering from an underflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in DATE status] suffering from an underflow 
 PASS [INPUT in DATE status] suffering from an underflow (in a form) 
-FAIL [INPUT in DATE status] suffering from a step mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in DATE status] suffering from a step mismatch 
 PASS [INPUT in DATE status] suffering from a step mismatch (in a form) 
-FAIL [INPUT in DATE status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in DATE status] suffering from being missing 
 PASS [INPUT in DATE status] suffering from being missing (in a form) 
 PASS [INPUT in MONTH status] no constraint 
 PASS [INPUT in MONTH status] no constraint (in a form) 
-FAIL [INPUT in MONTH status] suffering from an overflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in MONTH status] suffering from an overflow 
 PASS [INPUT in MONTH status] suffering from an overflow (in a form) 
-FAIL [INPUT in MONTH status] suffering from an underflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in MONTH status] suffering from an underflow 
 PASS [INPUT in MONTH status] suffering from an underflow (in a form) 
-FAIL [INPUT in MONTH status] suffering from a step mismatch assert_true: The invalid event should be fired. expected true got false
+FAIL [INPUT in MONTH status] suffering from a step mismatch assert_false: The reportValidity method should be false. expected false got true
 FAIL [INPUT in MONTH status] suffering from a step mismatch (in a form) assert_false: The reportValidity method of the element's form owner should return false. expected false got true
-FAIL [INPUT in MONTH status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in MONTH status] suffering from being missing 
 PASS [INPUT in MONTH status] suffering from being missing (in a form) 
 PASS [INPUT in WEEK status] no constraint 
 PASS [INPUT in WEEK status] no constraint (in a form) 
-FAIL [INPUT in WEEK status] suffering from an overflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in WEEK status] suffering from an overflow 
 PASS [INPUT in WEEK status] suffering from an overflow (in a form) 
-FAIL [INPUT in WEEK status] suffering from an underflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in WEEK status] suffering from an underflow 
 PASS [INPUT in WEEK status] suffering from an underflow (in a form) 
-FAIL [INPUT in WEEK status] suffering from a step mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in WEEK status] suffering from a step mismatch 
 PASS [INPUT in WEEK status] suffering from a step mismatch (in a form) 
-FAIL [INPUT in WEEK status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in WEEK status] suffering from being missing 
 PASS [INPUT in WEEK status] suffering from being missing (in a form) 
 PASS [INPUT in TIME status] no constraint 
 PASS [INPUT in TIME status] no constraint (in a form) 
-FAIL [INPUT in TIME status] suffering from an overflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TIME status] suffering from an overflow 
 PASS [INPUT in TIME status] suffering from an overflow (in a form) 
-FAIL [INPUT in TIME status] suffering from an underflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TIME status] suffering from an underflow 
 PASS [INPUT in TIME status] suffering from an underflow (in a form) 
-FAIL [INPUT in TIME status] suffering from a step mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TIME status] suffering from a step mismatch 
 PASS [INPUT in TIME status] suffering from a step mismatch (in a form) 
-FAIL [INPUT in TIME status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in TIME status] suffering from being missing 
 PASS [INPUT in TIME status] suffering from being missing (in a form) 
-FAIL [INPUT in NUMBER status] suffering from an overflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in NUMBER status] suffering from an overflow 
 PASS [INPUT in NUMBER status] suffering from an overflow (in a form) 
-FAIL [INPUT in NUMBER status] suffering from an underflow assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in NUMBER status] suffering from an underflow 
 PASS [INPUT in NUMBER status] suffering from an underflow (in a form) 
-FAIL [INPUT in NUMBER status] suffering from a step mismatch assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in NUMBER status] suffering from a step mismatch 
 PASS [INPUT in NUMBER status] suffering from a step mismatch (in a form) 
-FAIL [INPUT in NUMBER status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in NUMBER status] suffering from being missing 
 PASS [INPUT in NUMBER status] suffering from being missing (in a form) 
 PASS [INPUT in CHECKBOX status] no constraint 
 PASS [INPUT in CHECKBOX status] no constraint (in a form) 
-FAIL [INPUT in CHECKBOX status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in CHECKBOX status] suffering from being missing 
 PASS [INPUT in CHECKBOX status] suffering from being missing (in a form) 
 PASS [INPUT in RADIO status] no constraint 
 PASS [INPUT in RADIO status] no constraint (in a form) 
-FAIL [INPUT in RADIO status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in RADIO status] suffering from being missing 
 PASS [INPUT in RADIO status] suffering from being missing (in a form) 
 PASS [INPUT in FILE status] no constraint 
 PASS [INPUT in FILE status] no constraint (in a form) 
-FAIL [INPUT in FILE status] suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [INPUT in FILE status] suffering from being missing 
 PASS [INPUT in FILE status] suffering from being missing (in a form) 
 PASS [select]  no constraint 
 PASS [select]  no constraint (in a form) 
-FAIL [select]  suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [select]  suffering from being missing 
 PASS [select]  suffering from being missing (in a form) 
 PASS [textarea]  no constraint 
 PASS [textarea]  no constraint (in a form) 
-FAIL [textarea]  suffering from being missing assert_true: The invalid event should be fired. expected true got false
+PASS [textarea]  suffering from being missing 
 PASS [textarea]  suffering from being missing (in a form) 
 Harness: the test ran to completion.
 
diff --git a/third_party/WebKit/LayoutTests/platform/win7/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt b/third_party/WebKit/LayoutTests/platform/win7/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt
new file mode 100644
index 0000000..dd184de6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/platform/win7/virtual/spv2/paint/invalidation/spv2/image-resize-expected.txt
@@ -0,0 +1 @@
+["LayoutImage (positioned) IMG"]
diff --git a/third_party/WebKit/LayoutTests/presentation/presentation-api.html b/third_party/WebKit/LayoutTests/presentation/presentation-api.html
index 96cfd41..52b9f9a 100644
--- a/third_party/WebKit/LayoutTests/presentation/presentation-api.html
+++ b/third_party/WebKit/LayoutTests/presentation/presentation-api.html
@@ -8,7 +8,7 @@
 test(function() {
     assert_true('presentation' in navigator);
     assert_true('defaultRequest' in navigator.presentation);
-    assert_true('session' in navigator.presentation);
+    assert_true('connection' in navigator.presentation);
 
     assert_true('PresentationRequest' in window);
 }, "Test that the Presentation API is present.")
@@ -16,7 +16,7 @@
 test(function() {
   assert_equals(typeof(navigator.presentation), "object");
   assert_equals(typeof(navigator.presentation.defaultRequest), "object");
-  assert_equals(typeof(navigator.presentation.session), "object");
+  assert_equals(typeof(navigator.presentation.connection), "object");
 }, "Test the Presentation API property types.");
 
 test(function() {
@@ -28,7 +28,7 @@
   assert_equals(typeof(request.start), "function");
   assert_equals(typeof(request.reconnect), "function");
   assert_equals(typeof(request.getAvailability), "function");
-  assert_equals(typeof(request.onsessionconnect), "object");
+  assert_equals(typeof(request.onconnectionavailable), "object");
 
   assert_true(request instanceof EventTarget);
 }, "Test PresentationRequest API types.");
diff --git a/third_party/WebKit/LayoutTests/presentation/presentationrequest.html b/third_party/WebKit/LayoutTests/presentation/presentationrequest.html
index b255c3e..d4b538c 100644
--- a/third_party/WebKit/LayoutTests/presentation/presentationrequest.html
+++ b/third_party/WebKit/LayoutTests/presentation/presentationrequest.html
@@ -18,10 +18,10 @@
 
 test(function() {
   navigator.presentation.defaultRequest = new PresentationRequest("http://example.com");
-  navigator.presentation.defaultRequest.onsessionconnect = function() {  };
+  navigator.presentation.defaultRequest.onconnectionavailable = function() {  };
   gc();
-  assert_not_equals(navigator.presentation.defaultRequest.onsessionconnect, undefined);
-}, "Test that navigator.presentation.defaultRequest.onsessionconnect isn't reset after gc()");
+  assert_not_equals(navigator.presentation.defaultRequest.onconnectionavailable, undefined);
+}, "Test that navigator.presentation.defaultRequest.onconnectionavailable isn't reset after gc()");
 
 </script>
 </body>
diff --git a/third_party/WebKit/LayoutTests/printing/webgl-oversized-printing.html b/third_party/WebKit/LayoutTests/printing/webgl-oversized-printing.html
index 8cc5242..b82776f 100644
--- a/third_party/WebKit/LayoutTests/printing/webgl-oversized-printing.html
+++ b/third_party/WebKit/LayoutTests/printing/webgl-oversized-printing.html
@@ -7,7 +7,7 @@
 <div id="console"></div>
 <script>
 var can = document.createElement('canvas');
-can.width = can.height = 64000;
+can.width = can.height = 17000;
 document.body.appendChild(can);
 var ctx = can.getContext("webgl");
 ctx.clearColor(0, 0, 0, 1);
diff --git a/third_party/WebKit/LayoutTests/svg/filters/feColorMatrix-invalid-animation-expected.txt b/third_party/WebKit/LayoutTests/svg/filters/feColorMatrix-invalid-animation-expected.txt
index c54d5c8a..a344a47 100644
--- a/third_party/WebKit/LayoutTests/svg/filters/feColorMatrix-invalid-animation-expected.txt
+++ b/third_party/WebKit/LayoutTests/svg/filters/feColorMatrix-invalid-animation-expected.txt
@@ -4,4 +4,6 @@
 layer at (0,0) size 800x600
   LayoutSVGRoot {svg} at (0,0) size 100x100
     LayoutSVGResourceFilter {filter} [id=""] [filterUnits=objectBoundingBox] [primitiveUnits=userSpaceOnUse]
+      [feColorMatrix type="MATRIX"]
+        [SourceGraphic]
     LayoutSVGRect {rect} at (0,0) size 100x100 [fill={[type=SOLID] [color=#008000]}] [x=0.00] [y=0.00] [width=100.00] [height=100.00]
diff --git a/third_party/WebKit/LayoutTests/svg/filters/filter-source-outside-viewport-expected.html b/third_party/WebKit/LayoutTests/svg/filters/filter-source-outside-viewport-expected.html
new file mode 100644
index 0000000..f718ea6
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/svg/filters/filter-source-outside-viewport-expected.html
@@ -0,0 +1,2 @@
+<!DOCTYPE html>
+<div style="width: 100px; height: 100px; background-color: green"></div>
diff --git a/third_party/WebKit/LayoutTests/svg/filters/filter-source-outside-viewport.html b/third_party/WebKit/LayoutTests/svg/filters/filter-source-outside-viewport.html
new file mode 100644
index 0000000..ac4c5cd
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/svg/filters/filter-source-outside-viewport.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<svg width="100" height="100">
+  <filter id="largeOffsetFilter" x="0" y="0" width="1" height="1">
+    <feOffset dx="-2000" dy="-2000"/>
+  </filter>
+  <g filter="url(#largeOffsetFilter)">
+    <rect x="0" y="0" width="100" height="100" fill="red"/>
+    <rect x="2000" y="2000" width="100" height="100" fill="green"/>
+  </g>
+</svg>
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
new file mode 100644
index 0000000..068faec
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/accelerated-overflow-scroll-should-not-affect-perspective-expected.txt
@@ -0,0 +1,87 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [200, 200],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [200, 200],
+              "shouldFlattenTransform": false,
+              "transform": [
+                [1, 0, 0, 0],
+                [0, 1, 0, 0],
+                [0, 0, 1, -0.01],
+                [0, 0, 0, 1]
+              ],
+              "children": [
+                {
+                  "bounds": [185, 185],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [185, 265],
+                      "shouldFlattenTransform": false,
+                      "children": [
+                        {
+                          "position": [0, 65],
+                          "bounds": [60, 200],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#008000",
+                          "transform": [
+                            [1, 0, 0, 0],
+                            [0, 1, 0, 0],
+                            [0, 0, 1, 0],
+                            [0, 0, 10, 1]
+                          ]
+                        },
+                        {
+                          "position": [65, 65],
+                          "bounds": [60, 200],
+                          "contentsOpaque": true,
+                          "drawsContent": true,
+                          "backgroundColor": "#0000FF",
+                          "transform": [
+                            [1, 0, 0, 0],
+                            [0, 1, 0, 0],
+                            [0, 0, 1, 0],
+                            [0, 0, 20, 1]
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 185],
+                  "bounds": [185, 15]
+                },
+                {
+                  "position": [185, 0],
+                  "bounds": [15, 185]
+                },
+                {
+                  "position": [185, 185],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
new file mode 100644
index 0000000..5a12c16
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/clear-scroll-parent-expected.txt
@@ -0,0 +1,84 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [308, 208],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [4, 4],
+              "bounds": [285, 200],
+              "children": [
+                {
+                  "bounds": [285, 530],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [289, 4],
+                  "bounds": [15, 185]
+                },
+                {
+                  "position": [289, 189],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [50, 200],
+          "bounds": [200, 200],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [12, 12],
+          "bounds": [80, 80],
+          "shouldFlattenTransform": false,
+          "hasScrollParent": true,
+          "children": [
+            {
+              "position": [10, 10],
+              "bounds": [100, 100],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#FF0000"
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "hasScrollParent": true,
+          "children": [
+            {
+              "position": [22, 102],
+              "bounds": [100, 100],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [22, 212],
+              "bounds": [100, 320],
+              "drawsContent": true
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
new file mode 100644
index 0000000..deaa07a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/composited-scrolling-paint-phases-expected.txt
@@ -0,0 +1,122 @@
+{
+  "bounds": [800, 600],
+  "paintingPhases": [
+    "GraphicsLayerPaintBackground",
+    "GraphicsLayerPaintForeground",
+    "GraphicsLayerPaintMask"
+  ],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "paintingPhases": [
+        "GraphicsLayerPaintBackground",
+        "GraphicsLayerPaintForeground",
+        "GraphicsLayerPaintMask"
+      ],
+      "children": [
+        {
+          "bounds": [800, 242],
+          "drawsContent": true,
+          "paintingPhases": [
+            "GraphicsLayerPaintBackground",
+            "GraphicsLayerPaintMask"
+          ],
+          "children": [
+            {
+              "position": [29, 31],
+              "bounds": [80, 10],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#008000",
+              "paintingPhases": [
+                "GraphicsLayerPaintBackground",
+                "GraphicsLayerPaintForeground",
+                "GraphicsLayerPaintMask"
+              ]
+            },
+            {
+              "bounds": [800, 242],
+              "drawsContent": true,
+              "paintingPhases": [
+                "GraphicsLayerPaintForeground"
+              ]
+            },
+            {
+              "position": [28, 20],
+              "bounds": [202, 202],
+              "drawsContent": true,
+              "paintingPhases": [
+                "GraphicsLayerPaintBackground",
+                "GraphicsLayerPaintMask",
+                "GraphicsLayerPaintCompositedScroll"
+              ],
+              "children": [
+                {
+                  "position": [1, 1],
+                  "bounds": [185, 185],
+                  "paintingPhases": [
+                    "GraphicsLayerPaintBackground",
+                    "GraphicsLayerPaintForeground",
+                    "GraphicsLayerPaintMask"
+                  ],
+                  "children": [
+                    {
+                      "bounds": [185, 715],
+                      "shouldFlattenTransform": false,
+                      "drawsContent": true,
+                      "paintingPhases": [
+                        "GraphicsLayerPaintForeground",
+                        "GraphicsLayerPaintOverflowContents",
+                        "GraphicsLayerPaintCompositedScroll"
+                      ]
+                    }
+                  ]
+                },
+                {
+                  "paintingPhases": [
+                    "GraphicsLayerPaintBackground",
+                    "GraphicsLayerPaintForeground",
+                    "GraphicsLayerPaintMask"
+                  ],
+                  "children": [
+                    {
+                      "position": [1, 186],
+                      "bounds": [185, 15],
+                      "paintingPhases": [
+                        "GraphicsLayerPaintBackground",
+                        "GraphicsLayerPaintForeground",
+                        "GraphicsLayerPaintMask"
+                      ]
+                    },
+                    {
+                      "position": [186, 1],
+                      "bounds": [15, 185],
+                      "paintingPhases": [
+                        "GraphicsLayerPaintBackground",
+                        "GraphicsLayerPaintForeground",
+                        "GraphicsLayerPaintMask"
+                      ]
+                    },
+                    {
+                      "position": [186, 186],
+                      "bounds": [15, 15],
+                      "drawsContent": true,
+                      "paintingPhases": [
+                        "GraphicsLayerPaintBackground",
+                        "GraphicsLayerPaintForeground",
+                        "GraphicsLayerPaintMask"
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
new file mode 100644
index 0000000..183c7e49
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/content-gains-scrollbars-expected.txt
@@ -0,0 +1,133 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [85, 100],
+              "children": [
+                {
+                  "bounds": [85, 200],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [10, 200]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [85, 0],
+                  "bounds": [15, 100]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [100, 85],
+              "children": [
+                {
+                  "bounds": [200, 85],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [200, 10]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 85],
+                  "bounds": [100, 15]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [200, 200],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [200, 200]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 85],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [85, 0],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [100, 100],
+              "children": [
+                {
+                  "bounds": [10, 10]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
new file mode 100644
index 0000000..663eae2f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-expected.txt
@@ -0,0 +1,47 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [300, 300],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [285, 285],
+              "children": [
+                {
+                  "bounds": [1000, 1000],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 285],
+                  "bounds": [285, 15]
+                },
+                {
+                  "position": [285, 0],
+                  "bounds": [15, 285]
+                },
+                {
+                  "position": [285, 285],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
new file mode 100644
index 0000000..663eae2f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-auto-with-touch-toggle-expected.txt
@@ -0,0 +1,47 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [300, 300],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [285, 285],
+              "children": [
+                {
+                  "bounds": [1000, 1000],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 285],
+                  "bounds": [285, 15]
+                },
+                {
+                  "position": [285, 0],
+                  "bounds": [15, 285]
+                },
+                {
+                  "position": [285, 285],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
new file mode 100644
index 0000000..663eae2f
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-overlay-with-touch-expected.txt
@@ -0,0 +1,47 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [300, 300],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [285, 285],
+              "children": [
+                {
+                  "bounds": [1000, 1000],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 285],
+                  "bounds": [285, 15]
+                },
+                {
+                  "position": [285, 0],
+                  "bounds": [15, 285]
+                },
+                {
+                  "position": [285, 285],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
new file mode 100644
index 0000000..183c7e49
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/overflow-scrollbar-layers-expected.txt
@@ -0,0 +1,133 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [85, 100],
+              "children": [
+                {
+                  "bounds": [85, 200],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [10, 200]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [85, 0],
+                  "bounds": [15, 100]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [100, 85],
+              "children": [
+                {
+                  "bounds": [200, 85],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [200, 10]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 85],
+                  "bounds": [100, 15]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [200, 200],
+                  "shouldFlattenTransform": false,
+                  "children": [
+                    {
+                      "bounds": [200, 200]
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 85],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [85, 0],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 13],
+          "bounds": [100, 100],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [100, 100],
+              "children": [
+                {
+                  "bounds": [10, 10]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [85, 85],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
new file mode 100644
index 0000000..df0bc6e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/reparented-scrollbars-non-sc-anc-expected.txt
@@ -0,0 +1,71 @@
+{
+  "bounds": [1208, 821],
+  "children": [
+    {
+      "bounds": [1208, 821],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 8],
+          "bounds": [1200, 800],
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "bounds": [1200, 800],
+              "drawsContent": true,
+              "children": [
+                {
+                  "bounds": [1200, 800],
+                  "children": [
+                    {
+                      "bounds": [1200, 1000],
+                      "shouldFlattenTransform": false,
+                      "children": [
+                        {
+                          "bounds": [1200, 1000],
+                          "drawsContent": true,
+                          "children": [
+                            {
+                              "bounds": [1200, 1000],
+                              "children": [
+                                {
+                                  "bounds": [1200, 10000],
+                                  "shouldFlattenTransform": false,
+                                  "drawsContent": true
+                                }
+                              ]
+                            }
+                          ]
+                        }
+                      ]
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [8, 10008],
+          "bounds": [1200, 0]
+        },
+        {
+          "position": [8, 8],
+          "bounds": [1200, 1000],
+          "children": [
+            {
+              "children": [
+                {
+                  "position": [1193, 0],
+                  "bounds": [7, 1000]
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
new file mode 100644
index 0000000..1159b1a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-absolute-expected.txt
@@ -0,0 +1,75 @@
+{
+  "bounds": [785, 5516],
+  "children": [
+    {
+      "bounds": [785, 5516],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [8, 8],
+              "bounds": [500, 500],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF",
+              "children": [
+                {
+                  "bounds": [485, 485],
+                  "children": [
+                    {
+                      "bounds": [485, 5000],
+                      "shouldFlattenTransform": false,
+                      "drawsContent": true
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [0, 485],
+                      "bounds": [485, 15]
+                    },
+                    {
+                      "position": [485, 0],
+                      "bounds": [15, 485]
+                    },
+                    {
+                      "position": [485, 485],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [8, 8],
+              "bounds": [400, 400],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [8, 8],
+          "bounds": [300, 300],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backfaceVisibility": "hidden",
+          "backgroundColor": "#FFFF00"
+        },
+        {
+          "position": [8, 8],
+          "bounds": [20, 5000],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#FA8072",
+          "hasScrollParent": true
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
new file mode 100644
index 0000000..fe87f95
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scroll-parent-with-non-stacking-context-composited-ancestor-expected.txt
@@ -0,0 +1,72 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [98, 90],
+          "bounds": [300, 300],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backfaceVisibility": "hidden",
+          "backgroundColor": "#FFEFD5",
+          "children": [
+            {
+              "bounds": [102, 102],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [1, 1],
+                  "bounds": [100, 100],
+                  "children": [
+                    {
+                      "bounds": [100, 180],
+                      "shouldFlattenTransform": false
+                    }
+                  ]
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [60, 60],
+          "bounds": [80, 80],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [103, 95],
+              "bounds": [60, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [103, 139],
+              "bounds": [60, 128],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [98, 90],
+          "children": [
+            {
+              "position": [94, 1],
+              "bounds": [7, 100]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
new file mode 100644
index 0000000..d7459347
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/scrolling-content-clip-to-viewport-expected.txt
@@ -0,0 +1,52 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "bounds": [320, 340],
+          "drawsContent": true,
+          "children": [
+            {
+              "bounds": [305, 325],
+              "children": [
+                {
+                  "bounds": [305, 1224],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [0, 325],
+                  "bounds": [305, 15]
+                },
+                {
+                  "position": [305, 0],
+                  "bounds": [15, 325]
+                },
+                {
+                  "position": [305, 325],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [10, 10],
+          "bounds": [284, 1204],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#C0C0C0"
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
new file mode 100644
index 0000000..1137062
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/universal-accelerated-overflow-scroll-expected.txt
@@ -0,0 +1,945 @@
+{
+  "bounds": [785, 2016],
+  "children": [
+    {
+      "bounds": [785, 2016],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [10, 10],
+              "bounds": [104, 104],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [2, 2],
+                  "bounds": [85, 85],
+                  "children": [
+                    {
+                      "bounds": [85, 144],
+                      "shouldFlattenTransform": false,
+                      "drawsContent": true
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [2, 87],
+                      "bounds": [85, 15]
+                    },
+                    {
+                      "position": [87, 2],
+                      "bounds": [15, 85]
+                    },
+                    {
+                      "position": [87, 87],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [35, 75],
+              "bounds": [80, 40],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, -15],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 41],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [130, 10],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [105, 144],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [157, 18],
+              "bounds": [80, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#800080"
+            },
+            {
+              "position": [136, -15],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [250, 10],
+              "bounds": [104, 104],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [2, 2],
+                  "bounds": [85, 85],
+                  "children": [
+                    {
+                      "bounds": [85, 144],
+                      "shouldFlattenTransform": false
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [2, 87],
+                      "bounds": [85, 15]
+                    },
+                    {
+                      "position": [87, 2],
+                      "bounds": [15, 85]
+                    },
+                    {
+                      "position": [87, 87],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [275, 75],
+              "bounds": [80, 40],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, -15],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 41],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [370, 10],
+              "bounds": [104, 104],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [2, 2],
+                  "bounds": [85, 85],
+                  "children": [
+                    {
+                      "bounds": [85, 144],
+                      "shouldFlattenTransform": false,
+                      "drawsContent": true
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [2, 87],
+                      "bounds": [85, 15]
+                    },
+                    {
+                      "position": [87, 2],
+                      "bounds": [15, 85]
+                    },
+                    {
+                      "position": [87, 87],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [395, 75],
+              "bounds": [80, 40],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, -15],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 41],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [10, 130],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [105, 144],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [37, 138],
+              "bounds": [80, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#800080"
+            },
+            {
+              "position": [16, 105],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [130, 130],
+              "bounds": [104, 104],
+              "drawsContent": true,
+              "children": [
+                {
+                  "position": [2, 2],
+                  "bounds": [85, 85],
+                  "children": [
+                    {
+                      "bounds": [85, 144],
+                      "shouldFlattenTransform": false
+                    }
+                  ]
+                },
+                {
+                  "children": [
+                    {
+                      "position": [2, 87],
+                      "bounds": [85, 15]
+                    },
+                    {
+                      "position": [87, 2],
+                      "bounds": [15, 85]
+                    },
+                    {
+                      "position": [87, 87],
+                      "bounds": [15, 15],
+                      "drawsContent": true
+                    }
+                  ]
+                }
+              ]
+            },
+            {
+              "position": [155, 195],
+              "bounds": [80, 40],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, 105],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 161],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [250, 130],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [105, 144],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [277, 138],
+              "bounds": [80, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#800080"
+            },
+            {
+              "position": [256, 105],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [370, 130],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [105, 144],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [397, 138],
+              "bounds": [80, 40],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#800080"
+            },
+            {
+              "position": [376, 105],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [10, 250],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [85, 144],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [35, 315],
+          "bounds": [80, 40],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#800080"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, 225],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 281],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [130, 250],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [85, 144],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [155, 315],
+          "bounds": [80, 40],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#800080"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, 225],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 281],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [250, 250],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [85, 144],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [275, 315],
+          "bounds": [80, 40],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#800080"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, 225],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 281],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [370, 250],
+          "bounds": [104, 104],
+          "drawsContent": true,
+          "children": [
+            {
+              "position": [2, 2],
+              "bounds": [85, 85],
+              "children": [
+                {
+                  "bounds": [85, 144],
+                  "shouldFlattenTransform": false
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [2, 87],
+                  "bounds": [85, 15]
+                },
+                {
+                  "position": [87, 2],
+                  "bounds": [15, 85]
+                },
+                {
+                  "position": [87, 87],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        },
+        {
+          "position": [395, 315],
+          "bounds": [80, 40],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#800080"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, 225],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 281],
+              "bounds": [75, 24],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "position": [375, 20],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [15, 140],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [135, 140],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [255, 140],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [15, 260],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "position": [135, 260],
+          "bounds": [50, 100],
+          "contentsOpaque": true,
+          "drawsContent": true,
+          "backgroundColor": "#008000"
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, -43],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 13],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, -43],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 13],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, -43],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 13],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, -43],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 13],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, 77],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 133],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, 77],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 133],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, 77],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 133],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, 77],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 133],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [16, 197],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [16, 253],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [136, 197],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [136, 253],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [256, 197],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [256, 253],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        },
+        {
+          "shouldFlattenTransform": false,
+          "children": [
+            {
+              "position": [376, 197],
+              "bounds": [75, 24],
+              "contentsOpaque": true,
+              "drawsContent": true,
+              "backgroundColor": "#0000FF"
+            },
+            {
+              "position": [376, 253],
+              "bounds": [75, 80],
+              "drawsContent": true
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
new file mode 100644
index 0000000..246c6c4
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/prefer_compositing_to_lcd_text/compositing/overflow/updating-scrolling-container-expected.txt
@@ -0,0 +1,60 @@
+{
+  "bounds": [800, 600],
+  "children": [
+    {
+      "bounds": [800, 600],
+      "contentsOpaque": true,
+      "drawsContent": true,
+      "children": [
+        {
+          "position": [8, 108],
+          "bounds": [210, 210],
+          "drawsContent": true,
+          "repaintRects": [
+            [0, 0, 210, 210]
+          ],
+          "paintInvalidationClients": [
+            "LayoutBlockFlow DIV id='container'"
+          ],
+          "children": [
+            {
+              "position": [5, 5],
+              "bounds": [185, 185],
+              "children": [
+                {
+                  "bounds": [400, 400],
+                  "shouldFlattenTransform": false,
+                  "drawsContent": true,
+                  "repaintRects": [
+                    [-5, -5, 210, 210]
+                  ],
+                  "paintInvalidationClients": [
+                    "LayoutBlockFlow DIV id='container'"
+                  ]
+                }
+              ]
+            },
+            {
+              "children": [
+                {
+                  "position": [5, 190],
+                  "bounds": [185, 15]
+                },
+                {
+                  "position": [190, 5],
+                  "bounds": [15, 185]
+                },
+                {
+                  "position": [190, 190],
+                  "bounds": [15, 15],
+                  "drawsContent": true
+                }
+              ]
+            }
+          ]
+        }
+      ]
+    }
+  ]
+}
+
diff --git a/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.txt b/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.txt
new file mode 100644
index 0000000..62109bb
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/percent-size-image-resize-container-expected.txt
@@ -0,0 +1,2 @@
+["LayoutBlockFlow (positioned) DIV",
+ "LayoutImage (positioned) IMG"]
diff --git a/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.txt b/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.txt
new file mode 100644
index 0000000..02078a3
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/selection-change-in-iframe-with-relative-parent-expected.txt
@@ -0,0 +1,18 @@
+["LayoutBlockFlow HTML",
+ "LayoutBlockFlow BODY",
+ "LayoutText #text",
+ "InlineTextBox 'Foo'",
+ "LayoutBR BR",
+ "InlineTextBox '\n'",
+ "LayoutBR BR",
+ "InlineTextBox '\n'",
+ "LayoutText #text",
+ "InlineTextBox 'Bar'",
+ "LayoutBR BR",
+ "InlineTextBox '\n'",
+ "LayoutBR BR",
+ "InlineTextBox '\n'",
+ "LayoutText #text",
+ "InlineTextBox 'Bazz'",
+ "LayoutBR BR",
+ "InlineTextBox '\n'"]
diff --git a/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/selection-within-composited-scroller-expected.txt b/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/selection-within-composited-scroller-expected.txt
new file mode 100644
index 0000000..522cd4d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/virtual/spv2/paint/invalidation/spv2/selection-within-composited-scroller-expected.txt
@@ -0,0 +1,6 @@
+["LayoutBlockFlow HTML",
+ "LayoutBlockFlow BODY",
+ "LayoutBlockFlow DIV id='scroller'",
+ "LayoutBlockFlow DIV id='target'",
+ "LayoutText #text",
+ "InlineTextBox 'test'"]
diff --git a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
index 76d38a6..5d18afd 100644
--- a/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/virtual/stable/webexposed/global-interface-listing-expected.txt
@@ -3240,8 +3240,8 @@
     getter state
     method constructor
 interface Presentation
+    getter connection
     getter defaultRequest
-    getter session
     method constructor
     setter defaultRequest
 interface PresentationAvailability
@@ -3249,14 +3249,7 @@
     getter value
     method constructor
     setter onchange
-interface PresentationRequest
-    getter onsessionconnect
-    method constructor
-    method getAvailability
-    method reconnect
-    method start
-    setter onsessionconnect
-interface PresentationSession
+interface PresentationConnection
     getter binaryType
     getter id
     getter onmessage
@@ -3268,9 +3261,16 @@
     setter binaryType
     setter onmessage
     setter onstatechange
-interface PresentationSessionConnectEvent
-    getter session
+interface PresentationConnectionAvailableEvent
+    getter connection
     method constructor
+interface PresentationRequest
+    getter onconnectionavailable
+    method constructor
+    method getAvailability
+    method reconnect
+    method start
+    setter onconnectionavailable
 interface ProcessingInstruction
     getter sheet
     getter target
diff --git a/third_party/WebKit/LayoutTests/webaudio/audiobuffersource-loop-points-expected.wav b/third_party/WebKit/LayoutTests/webaudio/audiobuffersource-loop-points-expected.wav
index 72c2f47..7f7d8646 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audiobuffersource-loop-points-expected.wav
+++ b/third_party/WebKit/LayoutTests/webaudio/audiobuffersource-loop-points-expected.wav
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/webaudio/audiobuffersource-playbackrate-expected.wav b/third_party/WebKit/LayoutTests/webaudio/audiobuffersource-playbackrate-expected.wav
index e3e3134..97ff13c 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audiobuffersource-playbackrate-expected.wav
+++ b/third_party/WebKit/LayoutTests/webaudio/audiobuffersource-playbackrate-expected.wav
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-exponentialRampToValueAtTime-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-exponentialRampToValueAtTime-expected.txt
index 6c1fd9d..be2b432f 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-exponentialRampToValueAtTime-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-exponentialRampToValueAtTime-expected.txt
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS All 100 tests started and ended at the correct time.
-PASS All 100 tests passed within an acceptable tolerance.
+PASS All 100 tests passed within an acceptable relative tolerance of 0.00001222.
 PASS AudioParam exponentialRampToValueAtTime() test passed.
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-exponentialRampToValueAtTime.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-exponentialRampToValueAtTime.html
index ddf219e3..5af3ffb2 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-exponentialRampToValueAtTime.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-exponentialRampToValueAtTime.html
@@ -5,6 +5,7 @@
     <script src="resources/audio-testing.js"></script>
     <script src="resources/audioparam-testing.js"></script>
     <script src="../resources/js-test.js"></script>
+    <title>Test AudioParam.exponentialRampToValueAtTime</title>
   </head>
 
   <body>
@@ -25,7 +26,7 @@
       var numberOfTests = 100;
 
       // Max allowed difference between the rendered data and the expected result.
-      var maxAllowedError = 6.75e-4;
+      var maxAllowedError = 1.222e-5;
 
       // The AudioGainNode starts with this value instead of the default value.
       var initialValue = 100;
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-linearRampToValueAtTime-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-linearRampToValueAtTime-expected.txt
index 45ab57a..5a62e28 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-linearRampToValueAtTime-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-linearRampToValueAtTime-expected.txt
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS All 100 tests started and ended at the correct time.
-PASS All 100 tests passed within an acceptable tolerance.
+PASS All 100 tests passed within an acceptable relative tolerance of 0.000001865.
 PASS AudioParam linearRampToValueAtTime() test passed.
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-linearRampToValueAtTime.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-linearRampToValueAtTime.html
index 1afab67..6f5ade8 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-linearRampToValueAtTime.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-linearRampToValueAtTime.html
@@ -5,6 +5,7 @@
 <script src="resources/audio-testing.js"></script>
 <script src="resources/audioparam-testing.js"></script>
 <script src="../resources/js-test.js"></script>
+<title>Test AudioParam.linearRampToValueAtTime</title>
 </head>
 
 <body>
@@ -25,7 +26,7 @@
 var numberOfTests = 100;
 
 // Max allowed difference between the rendered data and the expected result.
-var maxAllowedError = 7.51e-7;
+var maxAllowedError = 1.865e-6;
 
 // Set the gain node value to the specified value at the specified time.
 function setValue(value, time)
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-sampling-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-sampling-expected.txt
new file mode 100644
index 0000000..eb72478e
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-sampling-expected.txt
@@ -0,0 +1,33 @@
+Test Sampling of LinearRampToValueAtTime
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS linearRamp: Sample 1 is 0.9929687 within a relative error of 1.201e-8.
+PASS linearRamp: Sample 128 is 0.0007812500 within a relative error of 0.00001526.
+PASS linearRamp passed.
+
+PASS linearRamp:short: Sample 1 is 0.8200000 within a relative error of 8.723e-9.
+PASS linearRamp:short: Sample 5 is 0.02000000 within a relative error of 9.537e-7.
+PASS linearRamp:short passed.
+
+PASS linearRamp:long: Sample 1 is 0.9955000 within a relative error of 2.827e-8.
+PASS linearRamp:long: Sample 200 is 0.0005000000 within a relative error of 0.00004674.
+PASS linearRamp:long passed.
+
+PASS exponentialRamp: Sample 1 is 0.9222396 within a relative error of 2.505e-8.
+PASS exponentialRamp: Sample 128 is 0.00001009035 within a relative error of 1.484e-7.
+PASS exponentialRamp passed.
+
+PASS exponentialRamp:short: Sample 1 is 0.1258925 within a relative error of 5.027e-8.
+PASS exponentialRamp:short: Sample 5 is 0.00001258925 within a relative error of 3.821e-7.
+PASS exponentialRamp:short passed.
+
+PASS exponentialRamp:long: Sample 1 is 0.9495110 within a relative error of 8.035e-9.
+PASS exponentialRamp:long: Sample 200 is 0.00001005773 within a relative error of 0.000001337.
+PASS exponentialRamp:long passed.
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-sampling.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-sampling.html
new file mode 100644
index 0000000..01c23b36
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-sampling.html
@@ -0,0 +1,178 @@
+<!doctype html>
+<html>
+  <head>
+    <script src="resources/compatibility.js"></script>
+    <script src="resources/audio-testing.js"></script>
+    <script src="resources/audioparam-testing.js"></script>
+    <script src="../resources/js-test.js"></script>
+    <title>Test Sampling of LinearRampToValueAtTime</title>
+  </head>
+
+  <body>
+    <script>
+      description("Test Sampling of LinearRampToValueAtTime");
+ 
+      window.jsTestIsAsync = true;
+      var sampleRate = 12800;
+      var context;
+
+      var audit = Audit.createTaskRunner();
+
+      function runTest(config) {
+        // Create a short context with a constant signal source connected to a gain node that will
+        // be automated.
+        context = new OfflineAudioContext(1, 256, sampleRate);
+
+        // Create a constant unit amplitude source.
+        var source = context.createBufferSource();
+        var b = createConstantBuffer(context, 1, 1);
+        source.buffer = b;
+        source.loop = true;
+
+        // Gain node that is to be automated.
+        var gain = context.createGain();
+        gain.gain.value = 0;
+        gain.gain.setValueAtTime(config.startValue, config.startTime);
+        config.automationFunction(gain);
+
+        source.connect(gain);
+        gain.connect(context.destination);
+
+        source.start();
+
+        return context.startRendering().then(function (resultBuffer) {
+          // Check that the automation has the correct sampling.
+          var resultData = resultBuffer.getChannelData(0);
+
+          // The automation has starts at config.startTime, so the frame just after this should have
+          // the automation applied.
+          var startFrame = Math.ceil(config.startTime * sampleRate);
+
+          // The automation ends at config.endTime so the frame just before this should have the
+          // automation applied.
+          var endFrame = Math.floor(config.endTime * sampleRate);
+
+          // Use the true automation to find the expected values.
+          var expectedStart = config.expectedFunction(startFrame / sampleRate);
+          var expectedEnd = config.expectedFunction(endFrame / sampleRate);
+
+          var success = Should(config.desc + ": Sample " + startFrame,
+            resultData[startFrame]).beCloseTo(expectedStart, config.startValueThreshold, 7);
+          success = Should(config.desc + ": Sample " + endFrame,
+            resultData[endFrame]).beCloseTo(expectedEnd, config.endValueThreshold, 7) && success;
+
+          if (success)
+            testPassed(config.desc + " passed.\n");
+          else
+            testFailed(config.desc + " failed.\n");
+        });
+      }
+
+      function expectedLinear(t) {
+        var slope = (this.endValue - this.startValue) / (this.endTime - this.startTime);
+        return this.startValue + slope * (t - this.startTime);
+      };
+
+      function expectedExponential(t) {
+        var ratio = this.endValue / this.startValue;
+        var exponent = (t - this.startTime) / (this.endTime - this.startTime);
+        return this.startValue * Math.pow(ratio, exponent);
+      };
+
+      function linearAutomation(g) {
+        g.gain.linearRampToValueAtTime(this.endValue, this.endTime);
+      }
+
+      function exponentialAutomation(g) {
+        g.gain.exponentialRampToValueAtTime(this.endValue, this.endTime);
+      }
+
+      // Basically want to test that if neither the start time nor end time is on a frame boundary
+      // that we sample the automation curve correctly.  The start times and end times are mostly
+      // arbitrary, except that they cannot be on a frame boundary.
+      var testConfigs = [{
+          desc: "linearRamp",
+          startTime: .1 / sampleRate,
+          endTime: 128.1 / sampleRate,
+          startValue: 1,
+          endValue: 0,
+          startValueThreshold: 1.201e-8,
+          endValueThreshold: 1.526e-5,
+          automationFunction: linearAutomation,
+          expectedFunction: expectedLinear
+        }, {
+          desc: "linearRamp:short",
+          startTime: .1 / sampleRate,
+          endTime: 5.1 / sampleRate,
+          startValue: 1,
+          endValue: 0,
+          startValueThreshold: 8.723e-9,
+          endValueThreshold: 9.537e-7,
+          automationFunction: linearAutomation,
+          expectedFunction: expectedLinear
+        }, {
+          desc: "linearRamp:long",
+          startTime: .1 / sampleRate,
+          endTime: 200.1 / sampleRate,
+          startValue: 1,
+          endValue: 0,
+          startValueThreshold: 2.827e-8,
+          endValueThreshold: 4.674e-5,
+          automationFunction: linearAutomation,
+          expectedFunction: expectedLinear
+        }, {
+          desc: "exponentialRamp",
+          startTime: .1 / sampleRate,
+          endTime: 128.1 / sampleRate,
+          startValue: 1,
+          endValue: 1e-5,
+          startValueThreshold: 2.505e-8,
+          endValueThreshold: 1.484e-7,
+          automationFunction: exponentialAutomation,
+          expectedFunction: expectedExponential
+        }, {
+          desc: "exponentialRamp:short",
+          startTime: .1 / sampleRate,
+          endTime: 5.1 / sampleRate,
+          startValue: 1,
+          endValue: 1e-5,
+          startValueThreshold: 5.027e-8,
+          endValueThreshold: 3.821e-7,
+          automationFunction: exponentialAutomation,
+          expectedFunction: expectedExponential
+        }, {
+          desc: "exponentialRamp:long",
+          startTime: .1 / sampleRate,
+          endTime: 200.1 / sampleRate,
+          startValue: 1,
+          endValue: 1e-5,
+          startValueThreshold: 8.035e-9,
+          endValueThreshold: 1.337e-6,
+          automationFunction: exponentialAutomation,
+          expectedFunction: expectedExponential
+        },
+      ];
+
+      function createTaskFunction(config) {
+        return function (done) {
+          runTest(config).then(done);
+        };
+      }
+
+      // Create all of the tasks from the test configs
+      for (var k = 0; k < testConfigs.length; ++k) {
+        var config = testConfigs[k];
+        var taskName = config.desc + ":task" + k;
+        audit.defineTask(taskName, createTaskFunction(config));
+      }
+
+      audit.defineTask("finish", function (done) {
+        finishJSTest();
+        done();
+      });
+
+      audit.runTasks();
+      successfullyParsed = true;
+    </script>
+  </body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-expected.txt
index 4c03a1a6..b2632748 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-expected.txt
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS All 100 tests started and ended at the correct time.
-PASS All 100 tests passed within an acceptable tolerance.
+PASS All 100 tests passed within an acceptable relative tolerance of 6.273e-7.
 PASS AudioParam setTargetAtTime() test passed.
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling-expected.txt
new file mode 100644
index 0000000..57afccc
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling-expected.txt
@@ -0,0 +1,15 @@
+Test Sampling of SetTargetAtTime
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Initialize by setValueAtTime: Target value at frame 129 is 9139.31185271227 within a relative error of 3.6029e-8.
+PASS Initialize by setValueAtTime: Target value at frame 1 is 9139.311852712282 within a relative error of 3.6029e-8.
+PASS Initialize by setValueAtTime: Target value at frame 0 is 10000 within a relative error of 3.6029e-8.
+PASS Initialize by setter: Target value at frame 129 is 9139.31185271227 within a relative error of 3.6029e-8.
+PASS Initialize by setter: Target value at frame 1 is 9139.311852712282 within a relative error of 3.6029e-8.
+PASS Initialize by setter: Target value at frame 0 is 10000 within a relative error of 0.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling.html
new file mode 100644
index 0000000..adbce48
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime-sampling.html
@@ -0,0 +1,102 @@
+<!doctype html>
+<html>
+  <head>
+    <script src="resources/compatibility.js"></script>
+    <script src="resources/audio-testing.js"></script>
+    <script src="resources/audioparam-testing.js"></script>
+    <script src="../resources/js-test.js"></script>
+    <title>Test Sampling for SetTargetAtTime</title>
+  </head>
+
+  <body>
+    <script>
+      description("Test Sampling of SetTargetAtTime");
+ 
+      window.jsTestIsAsync = true;
+      // Some slow sample rate, but otherwise arbitrary.
+      var sampleRate = 12800;
+
+      // Time constant for setTargetValue. Make it short, but is otherwise arbitrary.
+      var timeConstant = 10 / sampleRate;
+
+      // Defaut initial gain for test.  Arbitrary, but we want it large so the changes look large,
+      // even if the relative change isn't.
+      var initialGain = 10000;
+
+      var audit = Audit.createTaskRunner();
+
+      // Test sampling of setTargetAtTime that starts at |startFrame|.  A gain node is used for
+      // testing.  |initializeGainFunction| initializes the gain value. 
+      function doTest(message, startFrame, threshold, initializeGainFunction) {
+        var context = new OfflineAudioContext(1, 256, sampleRate);
+        var source = context.createBufferSource();
+        var b = context.createBuffer(1, 1, sampleRate);
+        b.getChannelData(0)[0] = 1;
+        source.buffer = b;
+        source.loop = true;
+
+        var gain = context.createGain();
+        // Initialize the value of the gain node appropriately.
+        initializeGainFunction(gain);
+        gain.gain.setTargetAtTime(0, startFrame / sampleRate, timeConstant);
+
+        source.connect(gain);
+        gain.connect(context.destination);
+
+        source.start();
+
+        return context.startRendering().then(function (resultBuffer) {
+          // Verify that the sampling of the setTargetAtTime automation was done correctly. We just
+          // look at the sample just past the start of the automation.
+          var resultData = resultBuffer.getChannelData(0);
+          // Compute the true result at the frame just past startFrame and verify that the actual
+          // rendered result is within |threshold| of the expected value.
+          var frame = Math.ceil(startFrame);
+          var v = 10000 * Math.exp(-(frame / sampleRate - startFrame / sampleRate) / timeConstant);
+          Should(message + ": Target value at frame " + frame, resultData[frame]).beCloseTo(v, threshold);
+        });
+      }
+
+      function initializeGainBySetter (g) {
+        g.gain.value = initialGain;
+      }
+
+      function initializeGainBySetValue (g) {
+        g.gain.setValueAtTime(initialGain, 0);
+      }
+
+      audit.defineTask("setValue;128.1", function (done) {
+        doTest("Initialize by setValueAtTime", 128.1, 3.6029e-8, initializeGainBySetValue).then(done);
+      });
+
+      audit.defineTask("setValue;0.1", function (done) {
+        doTest("Initialize by setValueAtTime", 0.1, 3.6029e-8, initializeGainBySetValue).then(done);
+      });
+
+      audit.defineTask("setValue;0.0", function (done) {
+        doTest("Initialize by setValueAtTime", 0, 3.6029e-8, initializeGainBySetValue).then(done);
+      });
+
+      audit.defineTask("setter;128.1", function (done) {
+        doTest("Initialize by setter", 128.1, 3.6029e-8, initializeGainBySetter).then(done);
+      });
+
+      audit.defineTask("setter;0.1", function (done) {
+        doTest("Initialize by setter", 0.1, 3.6029e-8, initializeGainBySetter).then(done);
+      });
+
+      audit.defineTask("setter;0.0", function (done) {
+        doTest("Initialize by setter", 0, 0, initializeGainBySetter).then(done);
+      });
+
+
+      audit.defineTask("finish", function (done) {
+        finishJSTest();
+        done();
+      });
+
+      audit.runTasks();
+      successfullyParsed = true;
+    </script>
+  </body>
+</html>
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime.html
index fe77394a..a5b1402 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setTargetAtTime.html
@@ -5,6 +5,7 @@
 <script src="resources/audio-testing.js"></script>
 <script src="resources/audioparam-testing.js"></script>
 <script src="../resources/js-test.js"></script>
+<title>Test AudioParam.setTargetAtTime</title>
 </head>
 
 <body>
@@ -24,7 +25,7 @@
 var numberOfTests = 100;
 
 // Max allowed difference between the rendered data and the expected result.
-var maxAllowedError = 3.9e-5;
+var maxAllowedError = 6.273e-7;
 
 // The AudioGainNode starts with this value instead of the default value.
 var initialValue = 100;
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueAtTime-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueAtTime-expected.txt
index adbe35c..21391a4 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueAtTime-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueAtTime-expected.txt
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS All 100 tests started and ended at the correct time.
-PASS All 100 tests passed within an acceptable tolerance.
+PASS All 100 tests passed within an acceptable relative tolerance of 6e-8.
 PASS AudioParam setValueAtTime() test passed.
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-expected.txt b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-expected.txt
index 7377bb0..530d3b3 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-expected.txt
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-expected.txt
@@ -3,7 +3,7 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 PASS All 20 tests started and ended at the correct time.
-PASS All 20 tests passed within an acceptable tolerance.
+PASS All 20 tests passed within an acceptable relative tolerance of 4.657e-10.
 PASS AudioParam setValueCurveAtTime() test passed.
 PASS successfullyParsed is true
 
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation.html
index 8d9bd7e..06a6e14 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime-interpolation.html
@@ -5,6 +5,7 @@
     <script src="../resources/js-test.js"></script>
     <script src="resources/compatibility.js"></script>
     <script src="resources/audio-testing.js"></script>
+    <title>Test Interpolation for AudioParam.setValueCurveAtTime</title>
   </head>
 
   <body>
@@ -217,7 +218,7 @@
          var expected = new Float32Array(testDurationFrames);
 
          var curveStartFrame = config.curveStartTime * sampleRate;
-         var curveEndFrame = Math.floor((config.curveStartTime + config.curveDuration) * sampleRate);
+         var curveEndFrame = (config.curveStartTime + config.curveDuration) * sampleRate;
          var fullGainFrame = config.fullGainTime * sampleRate;
 
          var k;
diff --git a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime.html b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime.html
index fa8f9213..ffbc5706 100644
--- a/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime.html
+++ b/third_party/WebKit/LayoutTests/webaudio/audioparam-setValueCurveAtTime.html
@@ -5,6 +5,7 @@
 <script src="resources/audio-testing.js"></script>
 <script src="resources/audioparam-testing.js"></script>
 <script src="../resources/js-test.js"></script>
+<title>Test AudioParam.setValueCurveAtTime</title>
 </head>
 
 <body>
@@ -42,13 +43,6 @@
     gainNode.gain.setValueCurveAtTime(curve, startTime, endTime - startTime);
 }
 
-// Create a sine wave of the specified duration.
-function createReferenceSineArray(startTime, endTime, startValue, endValue, sampleRate)
-{
-    // Ignore |startValue| and |endValue| for the sine wave.
-    return createSineWaveArray(endTime - startTime, freqHz, sineAmplitude, sampleRate);
-}
-
 function runTest() 
 {
     // The curve of values to use.
@@ -63,7 +57,8 @@
                             "setValueCurveAtTime()",
                             maxAllowedError,
                             createReferenceSineArray,
-                            2 * Math.PI * sineAmplitude * freqHz / sampleRate);
+                            2 * Math.PI * sineAmplitude * freqHz / sampleRate,
+                            differenceErrorMetric);
 }
 
 runTest();
diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/audio-testing.js b/third_party/WebKit/LayoutTests/webaudio/resources/audio-testing.js
index 33f8ac5..13220d1 100644
--- a/third_party/WebKit/LayoutTests/webaudio/resources/audio-testing.js
+++ b/third_party/WebKit/LayoutTests/webaudio/resources/audio-testing.js
@@ -527,8 +527,9 @@
         return this._success;
     }
 
-    // Check if |target| is close to |value| using the given relative error |threshold|.
-    // |value| should not be zero, but no check is made for that.
+    // Check if |target| is close to |value| using the given relative error |threshold|.  |value|
+    // should not be zero, but no check is made for that.  The |target| value is printed to
+    // precision |precision|, with |precision| defaulting to 7.
     //
     // Example:
     // Should("One", 1.001).beCloseTo(1, .1);
@@ -536,16 +537,21 @@
     // Result:
     // "PASS One is 1 within a relative error of 0.1."
     // "FAIL One is not 1 within a relative error of 0.1: 2"
-    ShouldModel.prototype.beCloseTo = function (value, relativeErrorThreshold) {
+    ShouldModel.prototype.beCloseTo = function (value, relativeErrorThreshold, precision) {
         var type = typeof value;
         this._assert(type === 'number', 'value should be number for');
 
         var relativeError = Math.abs(this.target - value) / Math.abs(value);
         if (relativeError <= relativeErrorThreshold) {
-            this._testPassed("is " + value + " within a relative error of " + relativeErrorThreshold);
+            this._testPassed("is " + value.toPrecision(precision) +
+                " within a relative error of " + relativeErrorThreshold);
         } else {
-            this._testFailed("is not " + value + " within a relative error of " + relativeErrorThreshold
-                             + ": " + this.target);
+            // Include actual relative error so the failed test case can be updated with the actual
+            // relative error, if appropriate.
+            this._testFailed("is not " + value.toPrecision(precision) +
+                " within a relative error of " + relativeErrorThreshold +
+                ": " + this.target + " with relative error " + relativeError
+            );
         }
         return this._success;
     }
diff --git a/third_party/WebKit/LayoutTests/webaudio/resources/audioparam-testing.js b/third_party/WebKit/LayoutTests/webaudio/resources/audioparam-testing.js
index 3df3083..abcbce1 100644
--- a/third_party/WebKit/LayoutTests/webaudio/resources/audioparam-testing.js
+++ b/third_party/WebKit/LayoutTests/webaudio/resources/audioparam-testing.js
@@ -33,19 +33,6 @@
     return timeToSampleFrame((numberOfTests + 1) * timeInterval, sampleRate);
 }
 
-// Create a buffer containing the same constant value.
-function createConstantBuffer(context, constant, length) {
-    var buffer = context.createBuffer(1, length, context.sampleRate);
-    var n = buffer.length;
-    var data = buffer.getChannelData(0);
-
-    for (var k = 0; k < n; ++k) {
-        data[k] = constant;
-    }
-
-    return buffer;
-}
-
 // Create a constant reference signal with the given |value|.  Basically the same as
 // |createConstantBuffer|, but with the parameters to match the other create functions.  The
 // |endValue| is ignored.
@@ -55,25 +42,43 @@
     var endFrame = timeToSampleFrame(endTime, sampleRate);
     var length = endFrame - startFrame;
 
-    var buffer = createConstantBuffer(context, value, length);
+    var buffer = createConstantBuffer(context, length, value);
 
     return buffer.getChannelData(0);
 }
 
+function getStartEndFrames(startTime, endTime, sampleRate)
+{
+    // Start frame is the ceiling of the start time because the ramp
+    // starts at or after the sample frame.  End frame is the ceiling
+    // because it's the exclusive ending frame of the automation.
+    var startFrame = Math.ceil(startTime * sampleRate);
+    var endFrame = Math.ceil(endTime * sampleRate);
+
+    return {startFrame: startFrame, endFrame: endFrame};
+}
+
 // Create a linear ramp starting at |startValue| and ending at |endValue|.  The ramp starts at time
 // |startTime| and ends at |endTime|.  (The start and end times are only used to compute how many
 // samples to return.)
 function createLinearRampArray(startTime, endTime, startValue, endValue, sampleRate)
 {
-    var startFrame = timeToSampleFrame(startTime, sampleRate);
-    var endFrame = timeToSampleFrame(endTime, sampleRate);
+    var frameInfo = getStartEndFrames(startTime, endTime, sampleRate);
+    var startFrame = frameInfo.startFrame;
+    var endFrame = frameInfo.endFrame;
     var length = endFrame - startFrame;
     var array = new Array(length);
 
-    var step = (endValue - startValue) / length;
+    var step = Math.fround((endValue - startValue) / (endTime - startTime) / sampleRate);
+    var start = Math.fround(startValue + (endValue - startValue) * (startFrame / sampleRate - startTime) / (endTime - startTime));
 
+    var slope = (endValue - startValue) / (endTime - startTime);
+
+    // v(t) = v0 + (v1 - v0)*(t-t0)/(t1-t0)
     for (k = 0; k < length; ++k) {
-        array[k] = startValue + k * step;
+        //array[k] = Math.fround(start + k * step);
+        var t = (startFrame + k) / sampleRate;
+        array[k] = startValue + slope * (t - startTime);
     }
 
     return array;
@@ -84,15 +89,20 @@
 // many samples to return.)
 function createExponentialRampArray(startTime, endTime, startValue, endValue, sampleRate)
 {
-    var startFrame = timeToSampleFrame(startTime, sampleRate);
-    var endFrame = timeToSampleFrame(endTime, sampleRate);
+    var deltaTime = endTime - startTime;
+
+    var frameInfo = getStartEndFrames(startTime, endTime, sampleRate);
+    var startFrame = frameInfo.startFrame;
+    var endFrame = frameInfo.endFrame;
     var length = endFrame - startFrame;
     var array = new Array(length);
 
-    var multiplier = Math.pow(endValue / startValue, 1 / length);
-    
+    var ratio = endValue / startValue;
+
+    // v(t) = v0*(v1/v0)^((t-t0)/(t1-t0))
     for (var k = 0; k < length; ++k) {
-        array[k] = startValue * Math.pow(multiplier, k);
+        var t = Math.fround((startFrame + k) / sampleRate);
+        array[k] = Math.fround(startValue * Math.pow(ratio, (t - startTime) / deltaTime));
     }
 
     return array;
@@ -109,17 +119,52 @@
 // return.)
 function createExponentialApproachArray(startTime, endTime, startValue, targetValue, sampleRate, timeConstant)
 {
-    var startFrame = timeToSampleFrame(startTime, sampleRate);
-    var endFrame = timeToSampleFrame(endTime, sampleRate);
-    var length = endFrame - startFrame;
+    var startFrameFloat = startTime * sampleRate;
+    var frameInfo = getStartEndFrames(startTime, endTime, sampleRate);
+    var startFrame = frameInfo.startFrame;
+    var endFrame = frameInfo.endFrame;
+    var length = Math.floor(endFrame - startFrame);
     var array = new Array(length);
     var c = discreteTimeConstantForSampleRate(timeConstant, sampleRate);
 
-    var value = startValue;
-    
+    var delta = startValue - targetValue;
+
+    // v(t) = v1 + (v0 - v1) * exp(-(t-t0)/tau)
     for (var k = 0; k < length; ++k) {
+        var t = (startFrame + k) / sampleRate;
+        var value = targetValue + delta * Math.exp(-(t - startTime) / timeConstant);
         array[k] = value;
-        value += (targetValue - value) * c;
+    }
+
+    return array;
+}
+
+// Create a sine wave of the specified duration.
+function createReferenceSineArray(startTime, endTime, startValue, endValue, sampleRate)
+{
+    // Ignore |startValue| and |endValue| for the sine wave.
+    var curve = createSineWaveArray(endTime - startTime, freqHz, sineAmplitude, sampleRate);
+    // Sample the curve appropriately.
+    var frameInfo = getStartEndFrames(startTime, endTime, sampleRate);
+    var startFrame = frameInfo.startFrame;
+    var endFrame = frameInfo.endFrame;
+    var length = Math.floor(endFrame - startFrame);
+    var array = new Array(length);
+
+    // v(t) = linearly interpolate between V[k] and V[k + 1] where k = floor(N/duration*(t - t0))
+    var f = length / (endTime - startTime);
+
+    for (var k = 0; k < length; ++k) {
+        var t = (startFrame + k) / sampleRate;
+        var indexFloat = f * (t - startTime);
+        var index = Math.floor(indexFloat);
+        if (index + 1 < length) {
+            var v0 = curve[index];
+            var v1 = curve[index + 1];
+            array[k] = v0 + (v1 - v0) * (indexFloat - index);
+        } else {
+            array[k] = curve[length - 1];
+        }
     }
 
     return array;
@@ -153,6 +198,18 @@
     }
 }
 
+// Relative error metric
+function relativeErrorMetric(actual, expected)
+{
+    return (actual - expected) / Math.abs(expected);
+}
+
+// Difference metric
+function differenceErrorMetric(actual, expected)
+{
+    return actual - expected;
+}
+
 // Return the difference between the starting value at |timeIntervalIndex| and the starting value at
 // the next time interval.  Since we started at a large initial value, we decrease the value at each
 // time interval.
@@ -162,7 +219,7 @@
 }
 
 // Compare a section of the rendered data against our expected signal.
-function comparePartialSignals(rendered, expectedFunction, startTime, endTime, valueInfo, sampleRate)
+function comparePartialSignals(rendered, expectedFunction, startTime, endTime, valueInfo, sampleRate, errorMetric)
 {
     var startSample = timeToSampleFrame(startTime, sampleRate);
     var expected = expectedFunction(startTime, endTime, valueInfo.startValue, valueInfo.endValue, sampleRate, timeConstant);
@@ -186,14 +243,14 @@
             testFailed("Nan or infinity for reference data at " + maxErrorIndex);
             break;
         }
-        var error = Math.abs(rendered[startSample + k] - expected[k]);
+        var error = Math.abs(errorMetric(rendered[startSample + k], expected[k]));
         if (error > maxError) {
             maxError = error;
             maxErrorIndex = k;
         }
     }
 
-    return {maxError : maxError, index : maxErrorIndex};
+    return {maxError : maxError, index : maxErrorIndex, expected: expected};
 }
 
 // Find the discontinuities in the data and compare the locations of the discontinuities with the
@@ -270,21 +327,28 @@
 // values of each interval.
 //
 // breakThreshold - threshold to use for determining discontinuities.
-function compareSignals(testName, maxError, renderedData, expectedFunction, timeValueInfo, breakThreshold)
+function compareSignals(testName, maxError, renderedData, expectedFunction, timeValueInfo, breakThreshold, errorMetric)
 {
     var success = true;
     var failedTestCount = 0;
     var times = timeValueInfo.times;
     var values = timeValueInfo.values;
     var n = values.length;
+    var expectedSignal = [];
 
     success = verifyDiscontinuities(renderedData, times, breakThreshold);
 
     for (var k = 0; k < n; ++k) {
-        var result = comparePartialSignals(renderedData, expectedFunction, times[k], times[k + 1], values[k], sampleRate);
+        var result = comparePartialSignals(renderedData, expectedFunction, times[k], times[k + 1], values[k], sampleRate, errorMetric);
+
+        expectedSignal = expectedSignal.concat(Array.prototype.slice.call(result.expected));
 
         if (result.maxError > maxError) {
-            testFailed("Incorrect value for test " + k + ". Max error = " + result.maxError + " at offset " + (result.index + timeToSampleFrame(times[k], sampleRate)));
+            var offset = result.index + timeToSampleFrame(times[k], sampleRate);
+            testFailed("Incorrect value for test " + k + ". Max error = " + result.maxError
+                       + " at offset " + offset
+                       + ": actual = " + renderedData[offset]
+                       + ", expected = " + expectedSignal[offset] + ".");
             ++failedTestCount;
         }
     }
@@ -293,7 +357,7 @@
         testFailed(failedTestCount + " tests failed out of " + n);
         success = false;
     } else {
-        testPassed("All " + n + " tests passed within an acceptable tolerance.");
+        testPassed("All " + n + " tests passed within an acceptable relative tolerance of " + maxError + ".");
     }
       
     if (success) {
@@ -315,7 +379,7 @@
 // jumpThreshold - optional parameter that specifies the threshold to use for detecting
 // discontinuities.  If not specified, defaults to discontinuityThreshold.
 //
-function checkResultFunction(testName, error, referenceFunction, jumpThreshold)
+function checkResultFunction(testName, error, referenceFunction, jumpThreshold, errorMetric)
 {
     return function(event) {
         var buffer = event.renderedBuffer;
@@ -329,7 +393,7 @@
             threshold = jumpThreshold;
         }
         
-        compareSignals(testName, error, renderedData, referenceFunction, timeValueInfo, threshold);
+        compareSignals(testName, error, renderedData, referenceFunction, timeValueInfo, threshold, errorMetric);
 
         finishJSTest();
     }
@@ -395,7 +459,7 @@
 // jumpThreshold - optional parameter that specifies the threshold to use for detecting
 // discontinuities.  If not specified, defaults to discontinuityThreshold.
 //
-function createAudioGraphAndTest(numberOfTests, initialValue, setValueFunction, automationFunction, testName, maxError, referenceFunction, jumpThreshold)
+function createAudioGraphAndTest(numberOfTests, initialValue, setValueFunction, automationFunction, testName, maxError, referenceFunction, jumpThreshold, errorMetric)
 {
     if (window.testRunner) {
         testRunner.dumpAsText();
@@ -406,7 +470,7 @@
 
     // Create offline audio context.
     context = new OfflineAudioContext(2, renderLength(numberOfTests), sampleRate);
-    var constantBuffer = createConstantBuffer(context, 1, renderLength(numberOfTests));
+    var constantBuffer = createConstantBuffer(context, renderLength(numberOfTests), 1);
 
     // We use an AudioGainNode here simply as a convenient way to test the AudioParam
     // automation, since it's easy to pass a constant value through the node, automate the
@@ -435,6 +499,7 @@
     context.oncomplete = checkResultFunction(testName,
                                              maxError,
                                              referenceFunction,
-                                             jumpThreshold);
+                                             jumpThreshold,
+                                             errorMetric || relativeErrorMetric);
     context.startRendering();
 }
diff --git a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
index ec85131b0..da181ce 100644
--- a/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
+++ b/third_party/WebKit/LayoutTests/webexposed/global-interface-listing-expected.txt
@@ -3741,8 +3741,8 @@
     getter state
     method constructor
 interface Presentation
+    getter connection
     getter defaultRequest
-    getter session
     method constructor
     setter defaultRequest
 interface PresentationAvailability
@@ -3750,14 +3750,7 @@
     getter value
     method constructor
     setter onchange
-interface PresentationRequest
-    getter onsessionconnect
-    method constructor
-    method getAvailability
-    method reconnect
-    method start
-    setter onsessionconnect
-interface PresentationSession
+interface PresentationConnection
     getter binaryType
     getter id
     getter onmessage
@@ -3769,9 +3762,16 @@
     setter binaryType
     setter onmessage
     setter onstatechange
-interface PresentationSessionConnectEvent
-    getter session
+interface PresentationConnectionAvailableEvent
+    getter connection
     method constructor
+interface PresentationRequest
+    getter onconnectionavailable
+    method constructor
+    method getAvailability
+    method reconnect
+    method start
+    setter onconnectionavailable
 interface ProcessingInstruction
     getter sheet
     getter target
diff --git a/third_party/WebKit/ManualTests/webaudio/osc-exponentialRamp.html b/third_party/WebKit/ManualTests/webaudio/osc-exponentialRamp.html
new file mode 100644
index 0000000..3ae701f
--- /dev/null
+++ b/third_party/WebKit/ManualTests/webaudio/osc-exponentialRamp.html
@@ -0,0 +1,45 @@
+<!doctype html>
+<html>
+  <head>
+    <title>Osc with ExponentialRamp (crbug.com/522229)</title>
+  </head>
+
+  <body>
+    <p>
+      Test from <a href="crbug.com/522229">crbug.com/522229</a>.  This test cannot be validated
+      using an offline context because it requires user interaction.
+    </p>
+    <p>
+      Press the start button to start the test and the stop button to stop it.
+    </p>
+    <p>
+      Press any set of keys quickly and listen.  At no point should audio ever be silent.  There
+      should be no glitches either.  If either of these happens, this test has failed.
+    </p>
+    <button onclick="startTest()">Start</button>
+    <button onclick="stopTest()">Stop</button>
+
+    <script>
+      var context = new AudioContext();
+      var sawosc;
+
+      function updateOsc(event) {
+        var freq = Math.random() * 440 + 440;
+        sawosc.frequency.exponentialRampToValueAtTime(freq, context.currentTime + 0.025);
+      }
+
+      function startTest() {
+        sawosc = context.createOscillator();
+        sawosc.type = 'sawtooth';
+        sawosc.connect(context.destination);
+        window.addEventListener('keydown', updateOsc);
+        sawosc.start();
+      }
+
+      function stopTest() {
+        window.removeEventListener('keydown', updateOsc);
+        sawosc.stop();
+      }
+    </script>
+  </body>
+</html>
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
index 3ed8d24..e88c277 100644
--- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.cpp
@@ -15,6 +15,12 @@
 #include "core/inspector/ConsoleMessage.h"
 #include "core/inspector/ScriptArguments.h"
 #include "platform/RuntimeEnabledFeatures.h"
+#include "platform/Task.h"
+#include "public/platform/Platform.h"
+#include "public/platform/WebScheduler.h"
+#include "public/platform/WebTaskRunner.h"
+#include "public/platform/WebThread.h"
+#include "wtf/Functional.h"
 
 namespace blink {
 
@@ -59,7 +65,7 @@
         // Either collected or https://crbug.com/450330
         if (value.IsEmpty() || !value->IsPromise())
             return;
-        ASSERT(!v8::Local<v8::Promise>::Cast(value)->HasHandler());
+        ASSERT(!hasHandler());
 
         EventTarget* target = executionContext->errorEventTarget();
         if (RuntimeEnabledFeatures::promiseRejectionEventEnabled() && target) {
@@ -124,6 +130,27 @@
         }
     }
 
+    void makePromiseWeak()
+    {
+        ASSERT(!m_promise.isEmpty() && !m_promise.isWeak());
+        m_promise.setWeak(this, &Message::didCollectPromise);
+    }
+
+    void makePromiseStrong()
+    {
+        ASSERT(!m_promise.isEmpty() && m_promise.isWeak());
+        m_promise.clearWeak();
+    }
+
+    bool hasHandler()
+    {
+        if (isCollected())
+            return false;
+        ScriptState::Scope scope(m_scriptState);
+        v8::Local<v8::Value> value = m_promise.newLocal(m_scriptState->isolate());
+        return v8::Local<v8::Promise>::Cast(value)->HasHandler();
+    }
+
 private:
     Message(ScriptState* scriptState, v8::Local<v8::Promise> promise, const ScriptValue& exception, const String& errorMessage, const String& resourceName, int scriptId, int lineNumber, int columnNumber, PassRefPtrWillBeRawPtr<ScriptCallStack> callStack)
         : m_scriptState(scriptState)
@@ -139,7 +166,6 @@
         , m_collected(false)
         , m_shouldLogToConsole(true)
     {
-        m_promise.setWeak(this, &Message::didCollectPromise);
     }
 
     static void didCollectPromise(const v8::WeakCallbackInfo<Message>& data)
@@ -193,7 +219,8 @@
     for (size_t i = 0; i < m_reportedAsErrors.size(); ++i) {
         auto& message = m_reportedAsErrors.at(i);
         if (!message->isCollected() && message->hasPromise(data.GetPromise())) {
-            message->revoke();
+            message->makePromiseStrong();
+            Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(FROM_HERE, new Task(bind(&RejectedPromises::revokeNow, this, message.release())));
             m_reportedAsErrors.remove(i);
             return;
         }
@@ -202,11 +229,24 @@
 
 void RejectedPromises::dispose()
 {
-    processQueue();
+    if (!m_queue.isEmpty()) {
+        OwnPtrWillBeRawPtr<WillBeHeapDeque<OwnPtrWillBeMember<Message>>> queue = adoptPtr(new WillBeHeapDeque<OwnPtrWillBeMember<Message>>());
+        queue->swap(m_queue);
+        processQueueNow(queue.release());
+    }
 }
 
 void RejectedPromises::processQueue()
 {
+    if (m_queue.isEmpty())
+        return;
+    OwnPtrWillBeRawPtr<WillBeHeapDeque<OwnPtrWillBeMember<Message>>> queue = adoptPtr(new WillBeHeapDeque<OwnPtrWillBeMember<Message>>());
+    queue->swap(m_queue);
+    Platform::current()->currentThread()->scheduler()->timerTaskRunner()->postTask(FROM_HERE, new Task(bind(&RejectedPromises::processQueueNow, this, queue.release())));
+}
+
+void RejectedPromises::processQueueNow(PassOwnPtrWillBeRawPtr<WillBeHeapDeque<OwnPtrWillBeMember<Message>>> queue)
+{
     // Remove collected handlers.
     for (size_t i = 0; i < m_reportedAsErrors.size();) {
         if (m_reportedAsErrors.at(i)->isCollected())
@@ -215,16 +255,21 @@
             ++i;
     }
 
-    while (!m_queue.isEmpty()) {
-        OwnPtrWillBeRawPtr<Message> message = m_queue.takeFirst();
-        if (message->isCollected())
-            continue;
-
-        message->report();
-        m_reportedAsErrors.append(message.release());
-        if (m_reportedAsErrors.size() > maxReportedHandlersPendingResolution)
-            m_reportedAsErrors.remove(0, maxReportedHandlersPendingResolution / 10);
+    while (!queue->isEmpty()) {
+        OwnPtrWillBeRawPtr<Message> message = queue->takeFirst();
+        if (!message->hasHandler()) {
+            message->report();
+            message->makePromiseWeak();
+            m_reportedAsErrors.append(message.release());
+            if (m_reportedAsErrors.size() > maxReportedHandlersPendingResolution)
+                m_reportedAsErrors.remove(0, maxReportedHandlersPendingResolution / 10);
+        }
     }
 }
 
+void RejectedPromises::revokeNow(PassOwnPtrWillBeRawPtr<Message> message)
+{
+    message->revoke();
+}
+
 } // namespace blink
diff --git a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h
index c194d3d..61212574 100644
--- a/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h
+++ b/third_party/WebKit/Source/bindings/core/v8/RejectedPromises.h
@@ -16,13 +16,13 @@
 class ScriptCallStack;
 class ScriptState;
 
-class RejectedPromises final : public NoBaseWillBeGarbageCollected<RejectedPromises> {
+class RejectedPromises final : public RefCountedWillBeGarbageCollected<RejectedPromises> {
     WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(RejectedPromises);
     DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(RejectedPromises);
 public:
-    static PassOwnPtrWillBeRawPtr<RejectedPromises> create()
+    static PassRefPtrWillBeRawPtr<RejectedPromises> create()
     {
-        return adoptPtrWillBeNoop(new RejectedPromises);
+        return adoptRefWillBeNoop(new RejectedPromises);
     }
 
     RejectedPromises();
@@ -37,6 +37,9 @@
 private:
     class Message;
 
+    void processQueueNow(PassOwnPtrWillBeRawPtr<WillBeHeapDeque<OwnPtrWillBeMember<Message>>>);
+    void revokeNow(PassOwnPtrWillBeRawPtr<Message>);
+
     WillBeHeapDeque<OwnPtrWillBeMember<Message>> m_queue;
     WillBeHeapVector<OwnPtrWillBeMember<Message>> m_reportedAsErrors;
 };
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h b/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h
index 3cd5e06..3521d04 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ScopedPersistent.h
@@ -72,6 +72,11 @@
         m_handle.SetWeak(parameters, callback, type);
     }
 
+    void clearWeak()
+    {
+        m_handle.template ClearWeak<void>();
+    }
+
     bool isEmpty() const { return m_handle.IsEmpty(); }
     bool isWeak() const { return m_handle.IsWeak(); }
 
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
index e1e648f..0104aaf 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp
@@ -55,9 +55,9 @@
 
     ASSERT(attribute.propertyLocationConfiguration);
     if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnInstance)
-        instanceTemplate->SetAccessor(name, getter, setter, data, attribute.settings, attribute.attribute);
+        instanceTemplate->SetAccessor(name, getter, setter, data, static_cast<v8::AccessControl>(attribute.settings), static_cast<v8::PropertyAttribute>(attribute.attribute));
     if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype)
-        prototypeTemplate->SetAccessor(name, getter, setter, data, attribute.settings, attribute.attribute);
+        prototypeTemplate->SetAccessor(name, getter, setter, data, static_cast<v8::AccessControl>(attribute.settings), static_cast<v8::PropertyAttribute>(attribute.attribute));
     if (attribute.propertyLocationConfiguration & V8DOMConfiguration::OnInterface)
         ASSERT_NOT_REACHED();
 }
@@ -125,9 +125,9 @@
         v8::Local<FunctionOrTemplate> getter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, getterCallback, data, signature, 0);
         v8::Local<FunctionOrTemplate> setter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, setterCallback, data, signature, 1);
         if (accessor.propertyLocationConfiguration & V8DOMConfiguration::OnInstance)
-            instanceOrTemplate->SetAccessorProperty(name, getter, setter, accessor.attribute, accessor.settings);
+            instanceOrTemplate->SetAccessorProperty(name, getter, setter, static_cast<v8::PropertyAttribute>(accessor.attribute), static_cast<v8::AccessControl>(accessor.settings));
         if (accessor.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype)
-            prototypeOrTemplate->SetAccessorProperty(name, getter, setter, accessor.attribute, accessor.settings);
+            prototypeOrTemplate->SetAccessorProperty(name, getter, setter, static_cast<v8::PropertyAttribute>(accessor.attribute), static_cast<v8::AccessControl>(accessor.settings));
     }
     if (accessor.propertyLocationConfiguration & V8DOMConfiguration::OnInterface) {
         // Attributes installed on the interface object must be static
@@ -135,7 +135,7 @@
         // type check against a holder.
         v8::Local<FunctionOrTemplate> getter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, getterCallback, data, v8::Local<v8::Signature>(), 0);
         v8::Local<FunctionOrTemplate> setter = createAccessorFunctionOrTemplate<FunctionOrTemplate>(isolate, setterCallback, data, v8::Local<v8::Signature>(), 1);
-        interfaceOrTemplate->SetAccessorProperty(name, getter, setter, accessor.attribute, accessor.settings);
+        interfaceOrTemplate->SetAccessorProperty(name, getter, setter, static_cast<v8::PropertyAttribute>(accessor.attribute), static_cast<v8::AccessControl>(accessor.settings));
     }
 }
 
@@ -166,7 +166,7 @@
 }
 
 template<class Configuration>
-void installMethodInternal(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature> signature, v8::PropertyAttribute attribute, const Configuration& method, const DOMWrapperWorld& world)
+void installMethodInternal(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature> signature, const Configuration& method, const DOMWrapperWorld& world)
 {
     if (method.exposeConfiguration == V8DOMConfiguration::OnlyExposedToPrivateScript
         && !world.isPrivateScriptIsolatedWorld())
@@ -181,9 +181,9 @@
         v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), signature, method.length);
         functionTemplate->RemovePrototype();
         if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInstance)
-            instanceTemplate->Set(name, functionTemplate, attribute);
+            instanceTemplate->Set(name, functionTemplate, static_cast<v8::PropertyAttribute>(method.attribute));
         if (method.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype)
-            prototypeTemplate->Set(name, functionTemplate, attribute);
+            prototypeTemplate->Set(name, functionTemplate, static_cast<v8::PropertyAttribute>(method.attribute));
     }
     if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInterface) {
         // Operations installed on the interface object must be static
@@ -191,7 +191,38 @@
         // type check against a holder.
         v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), v8::Local<v8::Signature>(), method.length);
         functionTemplate->RemovePrototype();
-        interfaceTemplate->Set(name, functionTemplate, attribute);
+        interfaceTemplate->Set(name, functionTemplate, static_cast<v8::PropertyAttribute>(method.attribute));
+    }
+}
+
+void installMethodInternal(v8::Isolate* isolate, v8::Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Function> interface, v8::Local<v8::Signature> signature, const V8DOMConfiguration::MethodConfiguration& method, const DOMWrapperWorld& world)
+{
+    if (method.exposeConfiguration == V8DOMConfiguration::OnlyExposedToPrivateScript
+        && !world.isPrivateScriptIsolatedWorld())
+        return;
+
+    v8::Local<v8::Name> name = method.methodName(isolate);
+    v8::FunctionCallback callback = method.callbackForWorld(world);
+
+    ASSERT(method.propertyLocationConfiguration);
+    if (method.propertyLocationConfiguration &
+        (V8DOMConfiguration::OnInstance | V8DOMConfiguration::OnPrototype)) {
+        v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), signature, method.length);
+        functionTemplate->RemovePrototype();
+        v8::Local<v8::Function> function = v8CallOrCrash(functionTemplate->GetFunction(isolate->GetCurrentContext()));
+        if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInstance)
+            v8CallOrCrash(instance->DefineOwnProperty(isolate->GetCurrentContext(), name, function, static_cast<v8::PropertyAttribute>(method.attribute)));
+        if (method.propertyLocationConfiguration & V8DOMConfiguration::OnPrototype)
+            v8CallOrCrash(prototype->DefineOwnProperty(isolate->GetCurrentContext(), name, function, static_cast<v8::PropertyAttribute>(method.attribute)));
+    }
+    if (method.propertyLocationConfiguration & V8DOMConfiguration::OnInterface) {
+        // Operations installed on the interface object must be static
+        // operations, so no need to specify a signature, i.e. no need to do
+        // type check against a holder.
+        v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), v8::Local<v8::Signature>(), method.length);
+        functionTemplate->RemovePrototype();
+        v8::Local<v8::Function> function = v8CallOrCrash(functionTemplate->GetFunction(isolate->GetCurrentContext()));
+        v8CallOrCrash(interface->DefineOwnProperty(isolate->GetCurrentContext(), name, function, static_cast<v8::PropertyAttribute>(method.attribute)));
     }
 }
 
@@ -249,23 +280,29 @@
     prototypeTemplate->SetNativeDataProperty(constantName, getter, 0, v8::Local<v8::Value>(), attributes);
 }
 
-void V8DOMConfiguration::installMethods(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature> signature, v8::PropertyAttribute attribute, const MethodConfiguration* methods, size_t methodCount)
+void V8DOMConfiguration::installMethods(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature> signature, const MethodConfiguration* methods, size_t methodCount)
 {
     const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
     for (size_t i = 0; i < methodCount; ++i)
-        installMethodInternal(isolate, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, attribute, methods[i], world);
+        installMethodInternal(isolate, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, methods[i], world);
 }
 
-void V8DOMConfiguration::installMethod(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature> signature, v8::PropertyAttribute attribute, const MethodConfiguration& method)
+void V8DOMConfiguration::installMethod(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature> signature, const MethodConfiguration& method)
 {
     const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
-    installMethodInternal(isolate, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, attribute, method, world);
+    installMethodInternal(isolate, instanceTemplate, prototypeTemplate, interfaceTemplate, signature, method, world);
 }
 
-void V8DOMConfiguration::installMethod(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Signature> signature, v8::PropertyAttribute attribute, const SymbolKeyedMethodConfiguration& method)
+void V8DOMConfiguration::installMethod(v8::Isolate* isolate, v8::Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Function> interface, v8::Local<v8::Signature> signature, const MethodConfiguration& method)
 {
     const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
-    installMethodInternal(isolate, v8::Local<v8::ObjectTemplate>(), prototypeTemplate, v8::Local<v8::FunctionTemplate>(), signature, attribute, method, world);
+    installMethodInternal(isolate, instance, prototype, interface, signature, method, world);
+}
+
+void V8DOMConfiguration::installMethod(v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Signature> signature, const SymbolKeyedMethodConfiguration& method)
+{
+    const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate);
+    installMethodInternal(isolate, v8::Local<v8::ObjectTemplate>(), prototypeTemplate, v8::Local<v8::FunctionTemplate>(), signature, method, world);
 }
 
 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate* isolate, v8::Local<v8::FunctionTemplate> functionDescriptor, const char* interfaceName, v8::Local<v8::FunctionTemplate> parentClass, size_t fieldCount,
@@ -291,7 +328,7 @@
     if (accessorCount)
         installAccessors(isolate, instanceTemplate, prototypeTemplate, functionDescriptor, defaultSignature, accessors, accessorCount);
     if (methodCount)
-        installMethods(isolate, instanceTemplate, prototypeTemplate, functionDescriptor, defaultSignature, static_cast<v8::PropertyAttribute>(v8::None), methods, methodCount);
+        installMethods(isolate, instanceTemplate, prototypeTemplate, functionDescriptor, defaultSignature, methods, methodCount);
     return defaultSignature;
 }
 
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.h b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.h
index 04b82884..e4c44e6 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.h
@@ -74,8 +74,8 @@
         v8::AccessorNameGetterCallback getterForMainWorld;
         v8::AccessorNameSetterCallback setterForMainWorld;
         const WrapperTypeInfo* data;
-        v8::AccessControl settings;
-        v8::PropertyAttribute attribute;
+        unsigned settings : 8; // v8::AccessControl
+        unsigned attribute : 8; // v8::PropertyAttribute
         unsigned exposeConfiguration : 1; // ExposeConfiguration
         unsigned propertyLocationConfiguration : 3; // PropertyLocationConfiguration
         unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration
@@ -96,8 +96,8 @@
         v8::FunctionCallback getterForMainWorld;
         v8::FunctionCallback setterForMainWorld;
         const WrapperTypeInfo* data;
-        v8::AccessControl settings;
-        v8::PropertyAttribute attribute;
+        unsigned settings : 8; // v8::AccessControl
+        unsigned attribute : 8; // v8::PropertyAttribute
         unsigned exposeConfiguration : 1; // ExposeConfiguration
         unsigned propertyLocationConfiguration : 3; // PropertyLocationConfiguration
         unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration
@@ -160,6 +160,7 @@
         v8::FunctionCallback callback;
         v8::FunctionCallback callbackForMainWorld;
         int length;
+        unsigned attribute : 8; // v8::PropertyAttribute
         unsigned exposeConfiguration : 1; // ExposeConfiguration
         unsigned propertyLocationConfiguration : 3; // PropertyLocationConfiguration
     };
@@ -177,15 +178,18 @@
         v8::FunctionCallback callback;
         // SymbolKeyedMethodConfiguration doesn't support per-world bindings.
         int length;
+        unsigned attribute : 8; // v8::PropertyAttribute
         unsigned exposeConfiguration : 1; // ExposeConfiguration
         unsigned propertyLocationConfiguration : 3; // PropertyLocationConfiguration
     };
 
-    static void installMethods(v8::Isolate*, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, v8::PropertyAttribute, const MethodConfiguration*, size_t methodCount);
+    static void installMethods(v8::Isolate*, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const MethodConfiguration*, size_t methodCount);
 
-    static void installMethod(v8::Isolate*, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, v8::PropertyAttribute, const MethodConfiguration&);
+    static void installMethod(v8::Isolate*, v8::Local<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const MethodConfiguration&);
 
-    static void installMethod(v8::Isolate*, v8::Local<v8::ObjectTemplate>, v8::Local<v8::Signature>, v8::PropertyAttribute, const SymbolKeyedMethodConfiguration&);
+    static void installMethod(v8::Isolate*, v8::Local<v8::Object> instance, v8::Local<v8::Object> prototype, v8::Local<v8::Function> interface, v8::Local<v8::Signature>, const MethodConfiguration&);
+
+    static void installMethod(v8::Isolate*, v8::Local<v8::ObjectTemplate>, v8::Local<v8::Signature>, const SymbolKeyedMethodConfiguration&);
 
     static v8::Local<v8::Signature> installDOMClassTemplate(v8::Isolate*, v8::Local<v8::FunctionTemplate>, const char* interfaceName, v8::Local<v8::FunctionTemplate> parentClass, size_t fieldCount,
         const AttributeConfiguration*, size_t attributeCount,
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
index e24e5d25..5511c68 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp
@@ -192,7 +192,7 @@
 static RejectedPromises& rejectedPromisesOnMainThread()
 {
     ASSERT(isMainThread());
-    DEFINE_STATIC_LOCAL(OwnPtrWillBePersistent<RejectedPromises>, rejectedPromises, (adoptPtrWillBeNoop(new RejectedPromises())));
+    DEFINE_STATIC_LOCAL(RefPtrWillBePersistent<RejectedPromises>, rejectedPromises, (adoptRefWillBeNoop(new RejectedPromises())));
     return *rejectedPromises;
 }
 
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
index e4b8696a..e1b8f4d 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.cpp
@@ -83,11 +83,11 @@
     ASSERT(!m_errorPrototype.isEmpty());
 
     v8::Context::Scope scope(context());
-    v8::Local<v8::Function> function = constructorForType(type);
-    if (function.IsEmpty())
+    v8::Local<v8::Function> interfaceObject = constructorForType(type);
+    if (interfaceObject.IsEmpty())
         return v8::Local<v8::Object>();
     v8::Local<v8::Object> instanceTemplate;
-    if (!V8ObjectConstructor::newInstance(m_isolate, function).ToLocal(&instanceTemplate))
+    if (!V8ObjectConstructor::newInstance(m_isolate, interfaceObject).ToLocal(&instanceTemplate))
         return v8::Local<v8::Object>();
     m_wrapperBoilerplates.Set(type, instanceTemplate);
     return instanceTemplate->Clone();
@@ -102,33 +102,33 @@
     // We shouldn't reach this point for the types that are implemented in v8 such as typed arrays and
     // hence don't have domTemplateFunction.
     ASSERT(type->domTemplateFunction);
-    v8::Local<v8::FunctionTemplate> functionTemplate = type->domTemplate(m_isolate);
+    v8::Local<v8::FunctionTemplate> interfaceTemplate = type->domTemplate(m_isolate);
     // Getting the function might fail if we're running out of stack or memory.
-    v8::Local<v8::Function> function;
-    if (!functionTemplate->GetFunction(currentContext).ToLocal(&function))
+    v8::Local<v8::Function> interfaceObject;
+    if (!interfaceTemplate->GetFunction(currentContext).ToLocal(&interfaceObject))
         return v8::Local<v8::Function>();
 
     if (type->parentClass) {
         v8::Local<v8::Object> prototypeTemplate = constructorForType(type->parentClass);
         if (prototypeTemplate.IsEmpty())
             return v8::Local<v8::Function>();
-        if (!v8CallBoolean(function->SetPrototype(currentContext, prototypeTemplate)))
+        if (!v8CallBoolean(interfaceObject->SetPrototype(currentContext, prototypeTemplate)))
             return v8::Local<v8::Function>();
     }
 
-    v8::Local<v8::Object> prototypeObject = function->Get(currentContext, v8AtomicString(m_isolate, "prototype")).ToLocalChecked().As<v8::Object>();
+    v8::Local<v8::Object> prototypeObject = interfaceObject->Get(currentContext, v8AtomicString(m_isolate, "prototype")).ToLocalChecked().As<v8::Object>();
     if (prototypeObject->InternalFieldCount() == v8PrototypeInternalFieldcount
         && type->wrapperTypePrototype == WrapperTypeInfo::WrapperTypeObjectPrototype)
         prototypeObject->SetAlignedPointerInInternalField(v8PrototypeTypeIndex, const_cast<WrapperTypeInfo*>(type));
-    type->preparePrototypeObject(m_isolate, prototypeObject, functionTemplate);
+    type->preparePrototypeAndInterfaceObject(m_isolate, prototypeObject, interfaceObject, interfaceTemplate);
     if (type->wrapperTypePrototype == WrapperTypeInfo::WrapperTypeExceptionPrototype) {
         if (!v8CallBoolean(prototypeObject->SetPrototype(currentContext, m_errorPrototype.newLocal(m_isolate))))
             return v8::Local<v8::Function>();
     }
 
-    m_constructorMap.Set(type, function);
+    m_constructorMap.Set(type, interfaceObject);
 
-    return function;
+    return interfaceObject;
 }
 
 v8::Local<v8::Object> V8PerContextData::prototypeForType(const WrapperTypeInfo* type)
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h
index 9049110..15df092d6 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h
+++ b/third_party/WebKit/Source/bindings/core/v8/V8PerContextData.h
@@ -82,8 +82,8 @@
 
     v8::Local<v8::Function> constructorForType(const WrapperTypeInfo* type)
     {
-        v8::Local<v8::Function> function = m_constructorMap.Get(type);
-        return (!function.IsEmpty()) ? function : constructorForTypeSlowCase(type);
+        v8::Local<v8::Function> interfaceObject = m_constructorMap.Get(type);
+        return (!interfaceObject.IsEmpty()) ? interfaceObject : constructorForTypeSlowCase(type);
     }
 
     v8::Local<v8::Object> prototypeForType(const WrapperTypeInfo*);
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.cpp b/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.cpp
index 7f547c87..2446664 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.cpp
@@ -127,7 +127,7 @@
 void WorkerScriptController::dispose()
 {
     m_rejectedPromises->dispose();
-    m_rejectedPromises.clear();
+    m_rejectedPromises.release();
 
     m_world->dispose();
 
diff --git a/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h b/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h
index 8a81458a2..fa4b1c9 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WorkerScriptController.h
@@ -111,7 +111,7 @@
     bool m_executionScheduledToTerminate;
     mutable Mutex m_scheduledTerminationMutex;
 
-    OwnPtrWillBeMember<RejectedPromises> m_rejectedPromises;
+    RefPtrWillBeMember<RejectedPromises> m_rejectedPromises;
 
     // |m_globalScopeExecutionState| refers to a stack object
     // that evaluate() allocates; evaluate() ensuring that the
diff --git a/third_party/WebKit/Source/bindings/core/v8/WrapperTypeInfo.h b/third_party/WebKit/Source/bindings/core/v8/WrapperTypeInfo.h
index 1e306df7..dfdd028 100644
--- a/third_party/WebKit/Source/bindings/core/v8/WrapperTypeInfo.h
+++ b/third_party/WebKit/Source/bindings/core/v8/WrapperTypeInfo.h
@@ -57,7 +57,7 @@
 typedef void (*TraceFunction)(Visitor*, ScriptWrappable*);
 typedef ActiveDOMObject* (*ToActiveDOMObjectFunction)(v8::Local<v8::Object>);
 typedef void (*ResolveWrapperReachabilityFunction)(v8::Isolate*, ScriptWrappable*, const v8::Persistent<v8::Object>&);
-typedef void (*PreparePrototypeObjectFunction)(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::FunctionTemplate>);
+typedef void (*PreparePrototypeAndInterfaceObjectFunction)(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, v8::Local<v8::FunctionTemplate>);
 typedef void (*InstallConditionallyEnabledPropertiesFunction)(v8::Local<v8::Object>, v8::Isolate*);
 
 inline void setObjectGroup(v8::Isolate* isolate, ScriptWrappable* scriptWrappable, const v8::Persistent<v8::Object>& wrapper)
@@ -171,10 +171,10 @@
         return traceFunction(visitor, scriptWrappable);
     }
 
-    void preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) const
+    void preparePrototypeAndInterfaceObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate) const
     {
-        if (preparePrototypeObjectFunction)
-            preparePrototypeObjectFunction(isolate, prototypeObject, interfaceTemplate);
+        if (preparePrototypeAndInterfaceObjectFunction)
+            preparePrototypeAndInterfaceObjectFunction(isolate, prototypeObject, interfaceObject, interfaceTemplate);
     }
 
     void installConditionallyEnabledProperties(v8::Local<v8::Object> prototypeObject, v8::Isolate* isolate) const
@@ -209,7 +209,7 @@
     const TraceFunction traceFunction;
     const ToActiveDOMObjectFunction toActiveDOMObjectFunction;
     const ResolveWrapperReachabilityFunction visitDOMWrapperFunction;
-    PreparePrototypeObjectFunction preparePrototypeObjectFunction;
+    PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfaceObjectFunction;
     const InstallConditionallyEnabledPropertiesFunction installConditionallyEnabledPropertiesFunction;
     const char* const interfaceName;
     const WrapperTypeInfo* parentClass;
diff --git a/third_party/WebKit/Source/bindings/scripts/v8_methods.py b/third_party/WebKit/Source/bindings/scripts/v8_methods.py
index 47a0e05..f7d831e 100644
--- a/third_party/WebKit/Source/bindings/scripts/v8_methods.py
+++ b/third_party/WebKit/Source/bindings/scripts/v8_methods.py
@@ -48,8 +48,6 @@
 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES = frozenset([
     'DoNotCheckSecurity',
     'DoNotCheckSignature',
-    'NotEnumerable',
-    'Unforgeable',
 ])
 
 
@@ -140,8 +138,6 @@
         # TODO(yukishiino): Retire has_custom_registration flag.  Should be
         # replaced with V8DOMConfiguration::PropertyLocationConfiguration.
         'has_custom_registration':
-            is_static or
-            is_unforgeable(interface, method) or
             v8_utilities.has_extended_attribute(
                 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES),
         'has_exception_state':
diff --git a/third_party/WebKit/Source/bindings/templates/interface.cpp b/third_party/WebKit/Source/bindings/templates/interface.cpp
index ca338421..cd909993 100644
--- a/third_party/WebKit/Source/bindings/templates/interface.cpp
+++ b/third_party/WebKit/Source/bindings/templates/interface.cpp
@@ -482,7 +482,7 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wglobal-constructors"
 #endif
-const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, 0, {{v8_class}}::preparePrototypeObject, {{v8_class}}::installConditionallyEnabledProperties, "{{interface_name}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
+const WrapperTypeInfo {{v8_class}}Constructor::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}Constructor::domTemplate, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, 0, {{v8_class}}::preparePrototypeAndInterfaceObject, {{v8_class}}::installConditionallyEnabledProperties, "{{interface_name}}", 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
 #pragma clang diagnostic pop
 #endif
@@ -787,7 +787,7 @@
 {% if has_conditional_attributes_on_instance %}
 void {{v8_class}}::installConditionallyEnabledProperties(v8::Local<v8::Object> instanceObject, v8::Isolate* isolate)
 {
-#error TODO(yukishiino): Rename this function to prepareInstanceObject (c.f. preparePrototypeObject) and implement this function if necessary.  http://crbug.com/503508
+#error TODO(yukishiino): Rename this function to prepareInstanceObject (c.f. preparePrototypeAndInterfaceObject) and implement this function if necessary.  http://crbug.com/503508
 }
 
 {% endif %}
@@ -795,10 +795,10 @@
 
 
 {##############################################################################}
-{% block prepare_prototype_object %}
+{% block prepare_prototype_and_interface_object %}
 {% from 'methods.cpp' import install_conditionally_enabled_methods with context %}
 {% if unscopeables or has_conditional_attributes_on_prototype or conditionally_enabled_methods %}
-void {{v8_class}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
+void {{v8_class}}::preparePrototypeAndInterfaceObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
 {
 {% if unscopeables %}
     {{install_unscopeables() | indent}}
@@ -841,7 +841,7 @@
 {% for attribute in attributes if attribute.exposed_test and attribute.on_prototype %}
 {% filter exposed(attribute.exposed_test) %}
 const V8DOMConfiguration::AccessorConfiguration accessorConfiguration = {{attribute_configuration(attribute)}};
-V8DOMConfiguration::installAccessor(isolate, v8::Local<v8::Object>(), prototypeObject, v8::Local<v8::Function>(), signature, accessorConfiguration);
+V8DOMConfiguration::installAccessor(isolate, v8::Local<v8::Object>(), prototypeObject, interfaceObject, signature, accessorConfiguration);
 {% endfilter %}
 {% endfor %}
 {% endmacro %}
@@ -890,11 +890,11 @@
 {% if has_partial_interface %}
 InstallTemplateFunction {{v8_class}}::install{{v8_class}}TemplateFunction = (InstallTemplateFunction)&{{v8_class}}::install{{v8_class}}Template;
 
-void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplateFunction, PreparePrototypeObjectFunction preparePrototypeObjectFunction)
+void {{v8_class}}::updateWrapperTypeInfo(InstallTemplateFunction installTemplateFunction, PreparePrototypeAndInterfaceObjectFunction preparePrototypeAndInterfaceObjectFunction)
 {
     {{v8_class}}::install{{v8_class}}TemplateFunction = installTemplateFunction;
-    if (preparePrototypeObjectFunction)
-        {{v8_class}}::wrapperTypeInfo.preparePrototypeObjectFunction = preparePrototypeObjectFunction;
+    if (preparePrototypeAndInterfaceObjectFunction)
+        {{v8_class}}::wrapperTypeInfo.preparePrototypeAndInterfaceObjectFunction = preparePrototypeAndInterfaceObjectFunction;
 }
 
 {% for method in methods if method.overloads and method.overloads.has_partial_overloads %}
diff --git a/third_party/WebKit/Source/bindings/templates/interface.h b/third_party/WebKit/Source/bindings/templates/interface.h
index d54b4b56..38e7e31 100644
--- a/third_party/WebKit/Source/bindings/templates/interface.h
+++ b/third_party/WebKit/Source/bindings/templates/interface.h
@@ -167,11 +167,11 @@
     static void installConditionallyEnabledProperties(v8::Local<v8::Object>, v8::Isolate*){% if has_conditional_attributes %};
     {% else %} { }
     {% endif %}
-    static void preparePrototypeObject(v8::Isolate*, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate){% if unscopeables or has_conditional_attributes_on_prototype or conditionally_enabled_methods %};
+    static void preparePrototypeAndInterfaceObject(v8::Isolate*, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate){% if unscopeables or has_conditional_attributes_on_prototype or conditionally_enabled_methods %};
     {% else %} { }
     {% endif %}
     {% if has_partial_interface %}
-    {{exported}}static void updateWrapperTypeInfo(InstallTemplateFunction, PreparePrototypeObjectFunction);
+    {{exported}}static void updateWrapperTypeInfo(InstallTemplateFunction, PreparePrototypeAndInterfaceObjectFunction);
     {{exported}}static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate>, v8::Isolate*);
     {% for method in methods if method.overloads and method.overloads.has_partial_overloads %}
     {{exported}}static void register{{method.name | blink_capitalize}}MethodForPartialInterface(void (*)(const v8::FunctionCallbackInfo<v8::Value>&));
diff --git a/third_party/WebKit/Source/bindings/templates/interface_base.cpp b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
index 3f4e451..37012d4 100644
--- a/third_party/WebKit/Source/bindings/templates/interface_base.cpp
+++ b/third_party/WebKit/Source/bindings/templates/interface_base.cpp
@@ -26,7 +26,7 @@
 #pragma clang diagnostic push
 #pragma clang diagnostic ignored "-Wglobal-constructors"
 #endif
-{{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{v8_class}}::preparePrototypeObject, {{v8_class}}::installConditionallyEnabledProperties, "{{interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
+{{wrapper_type_info_const}}WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::trace, {{to_active_dom_object}}, {{visit_dom_wrapper}}, {{v8_class}}::preparePrototypeAndInterfaceObject, {{v8_class}}::installConditionallyEnabledProperties, "{{interface_name}}", {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{event_target_inheritance}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
 #if defined(COMPONENT_BUILD) && defined(WIN32) && COMPILER(CLANG)
 #pragma clang diagnostic pop
 #endif
@@ -427,8 +427,8 @@
     {% if iterator_method %}
     {% filter exposed(iterator_method.exposed_test) %}
     {% filter runtime_enabled(iterator_method.runtime_enabled_function) %}
-    const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::iteratorMethodCallback, 0, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype };
-    V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignature, v8::DontDelete, symbolKeyedIteratorConfiguration);
+    const V8DOMConfiguration::SymbolKeyedMethodConfiguration symbolKeyedIteratorConfiguration = { v8::Symbol::GetIterator, {{cpp_class_or_partial}}V8Internal::iteratorMethodCallback, 0, v8::DontDelete, V8DOMConfiguration::ExposedToAllScripts, V8DOMConfiguration::OnPrototype };
+    V8DOMConfiguration::installMethod(isolate, prototypeTemplate, defaultSignature, symbolKeyedIteratorConfiguration);
     {% endfilter %}{# runtime_enabled() #}
     {% endfilter %}{# exposed() #}
     {% endif %}
@@ -486,7 +486,7 @@
 {% block to_impl_with_type_check %}{% endblock %}
 {% block install_conditional_attributes %}{% endblock %}
 {##############################################################################}
-{% block prepare_prototype_object %}{% endblock %}
+{% block prepare_prototype_and_interface_object %}{% endblock %}
 {##############################################################################}
 {% block to_active_dom_object %}{% endblock %}
 {% block ref_object_and_deref_object %}{% endblock %}
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp b/third_party/WebKit/Source/bindings/templates/methods.cpp
index 07327ab2..d91a1e9 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp
@@ -652,22 +652,22 @@
 {% macro method_configuration(method) %}
 {% from 'conversions.cpp' import property_location %}
 {% set method_callback =
-   '%sV8Internal::%sMethodCallback' % (cpp_class_or_partial, method.name) %}
+       '%sV8Internal::%sMethodCallback' % (cpp_class_or_partial, method.name) %}
 {% set method_callback_for_main_world =
-   '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class_or_partial, method.name)
-   if method.is_per_world_bindings else '0' %}
+       '%sV8Internal::%sMethodCallbackForMainWorld' % (cpp_class_or_partial, method.name)
+       if method.is_per_world_bindings else '0' %}
+{% set property_attribute =
+       'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attributes)
+       if method.property_attributes else 'v8::None' %}
 {% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivateScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::ExposedToAllScripts' %}
-{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{only_exposed_to_private_script}}, {{property_location(method)}}}
+{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{property_attribute}}, {{only_exposed_to_private_script}}, {{property_location(method)}}}
 {%- endmacro %}
 
 
 {######################################}
 {% macro install_custom_signature(method, instance_template, prototype_template, interface_template, signature) %}
-{% set property_attribute =
-       'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attributes)
-       if method.property_attributes else 'v8::None' %}
 const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
-V8DOMConfiguration::installMethod(isolate, {{instance_template}}, {{prototype_template}}, {{interface_template}}, {{signature}}, {{property_attribute}}, {{method.name}}MethodConfiguration);
+V8DOMConfiguration::installMethod(isolate, {{instance_template}}, {{prototype_template}}, {{interface_template}}, {{signature}}, {{method.name}}MethodConfiguration);
 {%- endmacro %}
 
 {######################################}
@@ -684,9 +684,8 @@
 {% filter runtime_enabled(method.overloads.runtime_enabled_function_all
                           if method.overloads else
                           method.runtime_enabled_function) %}
-v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New(isolate, {{cpp_class_or_partial}}V8Internal::{{method.name}}MethodCallback, v8Undefined(), defaultSignature, {{method.number_of_required_arguments}});
-v8::Local<v8::Function> function = v8CallOrCrash(functionTemplate->GetFunction(isolate->GetCurrentContext()));
-v8CallOrCrash(prototypeObject->Set(isolate->GetCurrentContext(), v8AtomicString(isolate, "{{method.name}}"), function));
+const V8DOMConfiguration::MethodConfiguration {{method.name}}MethodConfiguration = {{method_configuration(method)}};
+V8DOMConfiguration::installMethod(isolate, v8::Local<v8::Object>(), prototypeObject, interfaceObject, defaultSignature, {{method.name}}MethodConfiguration);
 {% endfilter %}{# runtime_enabled() #}
 {% endfilter %}{# exposed() #}
 {% endfor %}
diff --git a/third_party/WebKit/Source/bindings/templates/partial_interface.cpp b/third_party/WebKit/Source/bindings/templates/partial_interface.cpp
index b4489a7..f219897 100644
--- a/third_party/WebKit/Source/bindings/templates/partial_interface.cpp
+++ b/third_party/WebKit/Source/bindings/templates/partial_interface.cpp
@@ -2,14 +2,14 @@
 
 
 {##############################################################################}
-{% block prepare_prototype_object %}
+{% block prepare_prototype_and_interface_object %}
 {% from 'interface.cpp' import install_unscopeables with context %}
 {% from 'interface.cpp' import install_conditionally_enabled_attributes_on_prototype with context %}
 {% from 'methods.cpp' import install_conditionally_enabled_methods
         with context %}
-void {{v8_class_or_partial}}::preparePrototypeObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
+void {{v8_class_or_partial}}::preparePrototypeAndInterfaceObject(v8::Isolate* isolate, v8::Local<v8::Object> prototypeObject, v8::Local<v8::Function> interfaceObject, v8::Local<v8::FunctionTemplate> interfaceTemplate)
 {
-    {{v8_class}}::preparePrototypeObject(isolate, prototypeObject, interfaceTemplate);
+    {{v8_class}}::preparePrototypeAndInterfaceObject(isolate, prototypeObject, interfaceObject, interfaceTemplate);
 {% if unscopeables %}
     {{install_unscopeables() | indent}}
 {% endif %}
@@ -31,7 +31,7 @@
     // Should be invoked from initModules.
     {{v8_class}}::updateWrapperTypeInfo(
         &{{v8_class_or_partial}}::install{{v8_class}}Template,
-        &{{v8_class_or_partial}}::preparePrototypeObject);
+        &{{v8_class_or_partial}}::preparePrototypeAndInterfaceObject);
     {% for method in methods %}
     {% if method.overloads and method.overloads.has_partial_overloads %}
     {{v8_class}}::register{{method.name | blink_capitalize}}MethodForPartialInterface(&{{cpp_class_or_partial}}V8Internal::{{method.name}}Method);
diff --git a/third_party/WebKit/Source/bindings/templates/partial_interface.h b/third_party/WebKit/Source/bindings/templates/partial_interface.h
index 84092276..a445dc80 100644
--- a/third_party/WebKit/Source/bindings/templates/partial_interface.h
+++ b/third_party/WebKit/Source/bindings/templates/partial_interface.h
@@ -30,7 +30,7 @@
     {% endif %}
     {% endfor %}
     {# Custom internal fields #}
-    static void preparePrototypeObject(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::FunctionTemplate>);
+    static void preparePrototypeAndInterfaceObject(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, v8::Local<v8::FunctionTemplate>);
 private:
     static void install{{v8_class}}Template(v8::Local<v8::FunctionTemplate>, v8::Isolate*);
 };
diff --git a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
index b675ed8..3a0f3414 100644
--- a/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
+++ b/third_party/WebKit/Source/core/animation/CompositorAnimations.cpp
@@ -41,8 +41,8 @@
 #include "core/animation/animatable/AnimatableValue.h"
 #include "core/layout/LayoutBoxModelObject.h"
 #include "core/layout/LayoutObject.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/geometry/FloatBox.h"
 #include "public/platform/Platform.h"
@@ -343,7 +343,7 @@
 
     const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect);
 
-    DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
+    PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
     ASSERT(layer);
 
     Vector<OwnPtr<WebCompositorAnimation>> animations;
@@ -355,7 +355,7 @@
             WebCompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
             ASSERT(compositorPlayer);
             compositorPlayer->addAnimation(compositorAnimation.leakPtr());
-        } else if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->addAnimation(compositorAnimation.release())) {
+        } else if (!layer->compositedLayerMapping()->mainGraphicsLayer()->addAnimation(compositorAnimation.release())) {
             // FIXME: We should know ahead of time whether these animations can be started.
             for (int startedAnimationId : startedAnimationIds)
                 cancelAnimationOnCompositor(element, animation, startedAnimationId);
@@ -383,7 +383,7 @@
         ASSERT(compositorPlayer);
         compositorPlayer->removeAnimation(id);
     } else {
-        toLayoutBoxModelObject(element.layoutObject())->layer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->removeAnimation(id);
+        toLayoutBoxModelObject(element.layoutObject())->layer()->compositedLayerMapping()->mainGraphicsLayer()->removeAnimation(id);
     }
 }
 
@@ -402,7 +402,7 @@
         ASSERT(compositorPlayer);
         compositorPlayer->pauseAnimation(id, pauseTime);
     } else {
-        toLayoutBoxModelObject(element.layoutObject())->layer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->pauseAnimation(id, pauseTime);
+        toLayoutBoxModelObject(element.layoutObject())->layer()->compositedLayerMapping()->mainGraphicsLayer()->pauseAnimation(id, pauseTime);
     }
 }
 
@@ -417,14 +417,14 @@
     if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject())
         return false;
 
-    DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
+    PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
 
     if (!layer || !layer->isAllowedToQueryCompositingState()
-        || !layer->compositedDeprecatedPaintLayerMapping()
-        || !layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer())
+        || !layer->compositedLayerMapping()
+        || !layer->compositedLayerMapping()->mainGraphicsLayer())
         return false;
 
-    if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->platformLayer())
+    if (!layer->compositedLayerMapping()->mainGraphicsLayer()->platformLayer())
         return false;
 
     return true;
@@ -434,14 +434,14 @@
 {
     ASSERT(element.layoutObject());
 
-    DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
+    PaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
     ASSERT(layer);
 
     WebCompositorAnimationPlayer* compositorPlayer = animation.compositorPlayer();
     ASSERT(compositorPlayer);
 
-    ASSERT(layer->compositedDeprecatedPaintLayerMapping());
-    compositorPlayer->attachLayer(layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->platformLayer());
+    ASSERT(layer->compositedLayerMapping());
+    compositorPlayer->attachLayer(layer->compositedLayerMapping()->mainGraphicsLayer()->platformLayer());
 }
 
 // -----------------------------------------------------------------------
diff --git a/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp b/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
index 6e546d938..c04226c 100644
--- a/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
+++ b/third_party/WebKit/Source/core/animation/KeyframeEffect.cpp
@@ -44,7 +44,7 @@
 #include "core/dom/Element.h"
 #include "core/dom/NodeComputedStyle.h"
 #include "core/frame/UseCounter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/svg/SVGElement.h"
 
 namespace blink {
diff --git a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
index b38de39e..2379497 100644
--- a/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
+++ b/third_party/WebKit/Source/core/animation/css/CSSAnimations.cpp
@@ -53,7 +53,7 @@
 #include "core/events/TransitionEvent.h"
 #include "core/frame/UseCounter.h"
 #include "core/layout/LayoutObject.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/animation/TimingFunction.h"
 #include "public/platform/Platform.h"
 #include "wtf/BitArray.h"
diff --git a/third_party/WebKit/Source/core/compositing/DisplayListCompositingTest.cpp b/third_party/WebKit/Source/core/compositing/DisplayListCompositingTest.cpp
index 22fb164..818d5887 100644
--- a/third_party/WebKit/Source/core/compositing/DisplayListCompositingTest.cpp
+++ b/third_party/WebKit/Source/core/compositing/DisplayListCompositingTest.cpp
@@ -6,7 +6,7 @@
 
 #include "core/layout/LayoutTestHelper.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/graphics/CompositedDisplayList.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/transforms/TransformTestHelper.h"
diff --git a/third_party/WebKit/Source/core/core.gypi b/third_party/WebKit/Source/core/core.gypi
index 81ea4225..5d0c9a3 100644
--- a/third_party/WebKit/Source/core/core.gypi
+++ b/third_party/WebKit/Source/core/core.gypi
@@ -709,8 +709,8 @@
             'layout/TracedLayoutObject.cpp',
             'layout/TracedLayoutObject.h',
             'layout/VerticalPositionCache.h',
-            'layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp',
-            'layout/compositing/CompositedDeprecatedPaintLayerMapping.h',
+            'layout/compositing/CompositedLayerMapping.cpp',
+            'layout/compositing/CompositedLayerMapping.h',
             'layout/compositing/CompositingInputsUpdater.cpp',
             'layout/compositing/CompositingInputsUpdater.h',
             'layout/compositing/CompositingLayerAssigner.cpp',
@@ -721,8 +721,8 @@
             'layout/compositing/CompositingRequirementsUpdater.h',
             'layout/compositing/CompositingState.h',
             'layout/compositing/CompositingTriggers.h',
-            'layout/compositing/DeprecatedPaintLayerCompositor.cpp',
-            'layout/compositing/DeprecatedPaintLayerCompositor.h',
+            'layout/compositing/PaintLayerCompositor.cpp',
+            'layout/compositing/PaintLayerCompositor.h',
             'layout/compositing/GraphicsLayerTreeBuilder.cpp',
             'layout/compositing/GraphicsLayerTreeBuilder.h',
             'layout/compositing/GraphicsLayerUpdater.cpp',
@@ -1903,18 +1903,18 @@
             'paint/ClipScope.h',
             'paint/CompositingRecorder.cpp',
             'paint/CompositingRecorder.h',
-            'paint/DeprecatedPaintLayer.cpp',
-            'paint/DeprecatedPaintLayerClipper.cpp',
-            'paint/DeprecatedPaintLayerFilterInfo.cpp',
-            'paint/DeprecatedPaintLayerFilterInfo.h',
-            'paint/DeprecatedPaintLayerFragment.h',
-            'paint/DeprecatedPaintLayerReflectionInfo.cpp',
-            'paint/DeprecatedPaintLayerPainter.cpp',
-            'paint/DeprecatedPaintLayerPainter.h',
-            'paint/DeprecatedPaintLayerPaintingInfo.h',
-            'paint/DeprecatedPaintLayerScrollableArea.cpp',
-            'paint/DeprecatedPaintLayerStackingNode.cpp',
-            'paint/DeprecatedPaintLayerStackingNodeIterator.cpp',
+            'paint/PaintLayer.cpp',
+            'paint/PaintLayerClipper.cpp',
+            'paint/PaintLayerFilterInfo.cpp',
+            'paint/PaintLayerFilterInfo.h',
+            'paint/PaintLayerFragment.h',
+            'paint/PaintLayerReflectionInfo.cpp',
+            'paint/PaintLayerPainter.cpp',
+            'paint/PaintLayerPainter.h',
+            'paint/PaintLayerPaintingInfo.h',
+            'paint/PaintLayerScrollableArea.cpp',
+            'paint/PaintLayerStackingNode.cpp',
+            'paint/PaintLayerStackingNodeIterator.cpp',
             'paint/DetailsMarkerPainter.cpp',
             'paint/DetailsMarkerPainter.h',
             'paint/EllipsisBoxPainter.cpp',
@@ -3877,7 +3877,7 @@
             'page/PagePopupClientTest.cpp',
             'page/PrintContextTest.cpp',
             'page/scrolling/ScrollStateTest.cpp',
-            'paint/DeprecatedPaintLayerPainterTest.cpp',
+            'paint/PaintLayerPainterTest.cpp',
             'paint/DisplayItemListPaintTest.cpp',
             'paint/DisplayItemListPaintTest.h',
             'paint/LayerClipRecorderTest.cpp',
diff --git a/third_party/WebKit/Source/core/css/MediaValues.cpp b/third_party/WebKit/Source/core/css/MediaValues.cpp
index 0ac46475..728de30 100644
--- a/third_party/WebKit/Source/core/css/MediaValues.cpp
+++ b/third_party/WebKit/Source/core/css/MediaValues.cpp
@@ -17,7 +17,7 @@
 #include "core/html/imports/HTMLImportsController.h"
 #include "core/layout/LayoutObject.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/ChromeClient.h"
 #include "core/page/Page.h"
 #include "core/style/ComputedStyle.h"
diff --git a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
index 498e3bf..e746827 100644
--- a/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/CSSPropertyParser.cpp
@@ -183,6 +183,25 @@
     return nullptr;
 }
 
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeNumber(CSSParserTokenRange& range, ValueRange valueRange)
+{
+    const CSSParserToken& token = range.peek();
+    if (token.type() == NumberToken) {
+        if (valueRange == ValueRangeNonNegative && token.numericValue() < 0)
+            return nullptr;
+        return cssValuePool().createValue(range.consumeIncludingWhitespace().numericValue(), token.unitType());
+    }
+    CalcParser calcParser(range, ValueRangeAll);
+    if (const CSSCalcValue* calculation = calcParser.value()) {
+        // TODO(rwlbuis) Calcs should not be subject to parse time range checks.
+        // spec: https://drafts.csswg.org/css-values-3/#calc-range
+        if (calculation->category() != CalcNumber || (valueRange == ValueRangeNonNegative && calculation->isNegative()))
+            return nullptr;
+        return calcParser.consumeNumber();
+    }
+    return nullptr;
+}
+
 inline bool shouldAcceptUnitlessValues(double fValue, CSSParserMode cssParserMode, UnitlessQuirk unitless)
 {
     // Quirks mode for certain properties and presentation attributes accept unit-less values for certain units.
@@ -252,6 +271,28 @@
     return nullptr;
 }
 
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeAngle(CSSParserTokenRange& range)
+{
+    const CSSParserToken& token = range.peek();
+    if (token.type() == DimensionToken) {
+        switch (token.unitType()) {
+        case CSSPrimitiveValue::UnitType::Degrees:
+        case CSSPrimitiveValue::UnitType::Radians:
+        case CSSPrimitiveValue::UnitType::Gradians:
+        case CSSPrimitiveValue::UnitType::Turns:
+            return cssValuePool().createValue(range.consumeIncludingWhitespace().numericValue(), token.unitType());
+        default:
+            return nullptr;
+        }
+    }
+    CalcParser calcParser(range, ValueRangeAll);
+    if (const CSSCalcValue* calculation = calcParser.value()) {
+        if (calculation->category() == CalcAngle)
+            return calcParser.consumeValue();
+    }
+    return nullptr;
+}
+
 static inline bool isCSSWideKeyword(const CSSValueID& id)
 {
     return id == CSSValueInitial || id == CSSValueInherit || id == CSSValueUnset || id == CSSValueDefault;
@@ -548,6 +589,40 @@
     return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative, UnitlessQuirk::Allow);
 }
 
+static PassRefPtrWillBeRawPtr<CSSPrimitiveValue> consumeLineHeight(CSSParserTokenRange& range, CSSParserMode cssParserMode)
+{
+    if (range.peek().id() == CSSValueNormal)
+        return consumeIdent(range);
+
+    RefPtrWillBeRawPtr<CSSPrimitiveValue> lineHeight = consumeNumber(range, ValueRangeNonNegative);
+    if (lineHeight)
+        return lineHeight;
+    return consumeLengthOrPercent(range, cssParserMode, ValueRangeNonNegative);
+}
+
+static PassRefPtrWillBeRawPtr<CSSValueList> consumeRotation(CSSParserTokenRange& range)
+{
+    ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled());
+    RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+
+    RefPtrWillBeRawPtr<CSSValue> rotation = consumeAngle(range);
+    if (!rotation)
+        return nullptr;
+    list->append(rotation.release());
+
+    if (range.atEnd())
+        return list.release();
+
+    for (unsigned i = 0; i < 3; i++) { // 3 dimensions of rotation
+        RefPtrWillBeRawPtr<CSSValue> dimension = consumeNumber(range, ValueRangeAll);
+        if (!dimension)
+            return nullptr;
+        list->append(dimension.release());
+    }
+
+    return list.release();
+}
+
 PassRefPtrWillBeRawPtr<CSSValue> CSSPropertyParser::parseSingleValue(CSSPropertyID propId)
 {
     m_range.consumeWhitespace();
@@ -577,6 +652,10 @@
         return consumeTabSize(m_range, m_context.mode());
     case CSSPropertyFontSize:
         return consumeFontSize(m_range, m_context.mode());
+    case CSSPropertyLineHeight:
+        return consumeLineHeight(m_range, m_context.mode());
+    case CSSPropertyRotate:
+        return consumeRotation(m_range);
     default:
         return nullptr;
     }
diff --git a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
index 36a928ed..d23f9a0 100644
--- a/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
+++ b/third_party/WebKit/Source/core/css/parser/LegacyCSSPropertyParser.cpp
@@ -776,9 +776,6 @@
         }
         break;
 
-    case CSSPropertyLineHeight:
-        parsedValue = parseLineHeight();
-        break;
     case CSSPropertyCounterIncrement:
         if (id == CSSValueNone)
             validPrimitive = true;
@@ -1020,31 +1017,6 @@
         break;
     }
 
-    case CSSPropertyRotate: { // rotate : <angle> <number>{3}? defaults to a 0 0 1
-        ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled());
-        RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-
-        if (!validUnit(value, FAngle))
-            return false;
-        list->append(createPrimitiveNumericValue(value));
-        value = m_valueList->next();
-
-        if (!value) {
-            parsedValue = list.release();
-            break;
-        }
-
-        for (unsigned i = 0; i < 3; i++) { // 3 dimensions of rotation
-            if (!value || !validUnit(value, FNumber))
-                return false;
-            list->append(createPrimitiveNumericValue(value));
-            value = m_valueList->next();
-        }
-
-        parsedValue = list.release();
-        break;
-    }
-
     case CSSPropertyScale: { // scale: <number>{1,3}, default scale for all axis is 1
         ASSERT(RuntimeEnabledFeatures::cssIndependentTransformPropertiesEnabled());
         RefPtrWillBeRawPtr<CSSValueList> scaleList = CSSValueList::createSpaceSeparated();
@@ -1412,6 +1384,8 @@
     case CSSPropertyWordSpacing:
     case CSSPropertyTabSize:
     case CSSPropertyFontSize:
+    case CSSPropertyLineHeight:
+    case CSSPropertyRotate:
         validPrimitive = false;
         break;
 
diff --git a/third_party/WebKit/Source/core/dom/DOMHighResTimeStamp.h b/third_party/WebKit/Source/core/dom/DOMHighResTimeStamp.h
new file mode 100644
index 0000000..d60ed0f
--- /dev/null
+++ b/third_party/WebKit/Source/core/dom/DOMHighResTimeStamp.h
@@ -0,0 +1,24 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef DOMHighResTimeStamp_h
+#define DOMHighResTimeStamp_h
+
+namespace blink {
+
+typedef double DOMHighResTimeStamp;
+
+inline DOMHighResTimeStamp convertSecondsToDOMHighResTimeStamp(double seconds)
+{
+    return static_cast<DOMHighResTimeStamp>(seconds * 1000.0);
+}
+
+inline double convertDOMHighResTimeStampToSeconds(DOMHighResTimeStamp milliseconds)
+{
+    return milliseconds / 1000.0;
+}
+
+} // namespace blink
+
+#endif // DOMHighResTimeStamp_h
diff --git a/third_party/WebKit/Source/core/dom/Document.cpp b/third_party/WebKit/Source/core/dom/Document.cpp
index f05738876..0c76765 100644
--- a/third_party/WebKit/Source/core/dom/Document.cpp
+++ b/third_party/WebKit/Source/core/dom/Document.cpp
@@ -173,7 +173,7 @@
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutView.h"
 #include "core/layout/TextAutosizer.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/loader/CookieJar.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameFetchContext.h"
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 9034a84..c9ea807b 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -116,7 +116,7 @@
 #include "core/page/scrolling/ScrollCustomizationCallbacks.h"
 #include "core/page/scrolling/ScrollState.h"
 #include "core/page/scrolling/ScrollStateCallback.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGElement.h"
 #include "platform/EventDispatchForbiddenScope.h"
@@ -1888,7 +1888,7 @@
         return;
     layoutObject->layer()->setNeedsCompositingInputsUpdate();
     // Changes in the return value of requiresAcceleratedCompositing change if
-    // the DeprecatedPaintLayer is self-painting.
+    // the PaintLayer is self-painting.
     layoutObject->layer()->updateSelfPaintingLayer();
 }
 
diff --git a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
index f5cf582..6db3012 100644
--- a/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
+++ b/third_party/WebKit/Source/core/dom/ScriptRunnerTest.cpp
@@ -172,7 +172,7 @@
     RefPtrWillBePersistent<Document> m_document;
     RefPtrWillBePersistent<Element> m_element;
     OwnPtrWillBePersistent<ScriptRunner> m_scriptRunner;
-    std::vector<int> m_order; // gmock matchers don't work nicely with WTF::Vector
+    WTF::Vector<int> m_order;
     MockPlatform m_platform;
     Platform* m_oldPlatform; // NOT OWNED
 };
@@ -209,13 +209,13 @@
     m_scriptRunner->queueScriptForExecution(scriptLoader3.get(), ScriptRunner::IN_ORDER_EXECUTION);
 
     EXPECT_CALL(*scriptLoader1, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(1);
+        m_order.append(1);
     }));
     EXPECT_CALL(*scriptLoader2, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(2);
+        m_order.append(2);
     }));
     EXPECT_CALL(*scriptLoader3, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(3);
+        m_order.append(3);
     }));
 
     // Make the scripts become ready in reverse order.
@@ -262,19 +262,19 @@
     m_scriptRunner->notifyScriptReady(scriptLoader5.get(), ScriptRunner::ASYNC_EXECUTION);
 
     EXPECT_CALL(*scriptLoader1, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(1);
+        m_order.append(1);
     }));
     EXPECT_CALL(*scriptLoader2, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(2);
+        m_order.append(2);
     }));
     EXPECT_CALL(*scriptLoader3, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(3);
+        m_order.append(3);
     }));
     EXPECT_CALL(*scriptLoader4, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(4);
+        m_order.append(4);
     }));
     EXPECT_CALL(*scriptLoader5, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(5);
+        m_order.append(5);
     }));
 
     m_platform.runAllTasks();
@@ -307,19 +307,19 @@
     m_scriptRunner->notifyScriptReady(scriptLoader5.get(), ScriptRunner::ASYNC_EXECUTION);
 
     EXPECT_CALL(*scriptLoader1, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(1);
+        m_order.append(1);
     }));
     EXPECT_CALL(*scriptLoader2, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(2);
+        m_order.append(2);
     }));
     EXPECT_CALL(*scriptLoader3, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(3);
+        m_order.append(3);
     }));
     EXPECT_CALL(*scriptLoader4, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(4);
+        m_order.append(4);
     }));
     EXPECT_CALL(*scriptLoader5, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(5);
+        m_order.append(5);
     }));
 
     m_platform.runAllTasks();
@@ -341,18 +341,18 @@
 
     MockScriptLoader* scriptLoader = scriptLoader2.get();
     EXPECT_CALL(*scriptLoader1, execute()).WillOnce(Invoke([scriptLoader, this] {
-        m_order.push_back(1);
+        m_order.append(1);
         m_scriptRunner->notifyScriptReady(scriptLoader, ScriptRunner::ASYNC_EXECUTION);
     }));
 
     scriptLoader = scriptLoader3.get();
     EXPECT_CALL(*scriptLoader2, execute()).WillOnce(Invoke([scriptLoader, this] {
-        m_order.push_back(2);
+        m_order.append(2);
         m_scriptRunner->notifyScriptReady(scriptLoader, ScriptRunner::ASYNC_EXECUTION);
     }));
 
     EXPECT_CALL(*scriptLoader3, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(3);
+        m_order.append(3);
     }));
 
     // Make sure that re-entrant calls to notifyScriptReady don't cause ScriptRunner::execute to do
@@ -382,20 +382,20 @@
 
     MockScriptLoader* scriptLoader = scriptLoader2.get();
     EXPECT_CALL(*scriptLoader1, execute()).WillOnce(Invoke([scriptLoader, this] {
-        m_order.push_back(1);
+        m_order.append(1);
         m_scriptRunner->queueScriptForExecution(scriptLoader, ScriptRunner::IN_ORDER_EXECUTION);
         m_scriptRunner->resume();
     }));
 
     scriptLoader = scriptLoader3.get();
     EXPECT_CALL(*scriptLoader2, execute()).WillOnce(Invoke([scriptLoader, this] {
-        m_order.push_back(2);
+        m_order.append(2);
         m_scriptRunner->queueScriptForExecution(scriptLoader, ScriptRunner::IN_ORDER_EXECUTION);
         m_scriptRunner->resume();
     }));
 
     EXPECT_CALL(*scriptLoader3, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(3);
+        m_order.append(3);
     }));
 
     // Make sure that re-entrant calls to queueScriptForExecution don't cause ScriptRunner::execute to do
@@ -424,14 +424,14 @@
     m_scriptRunner->notifyScriptReady(scriptLoader3.get(), ScriptRunner::ASYNC_EXECUTION);
 
     EXPECT_CALL(*scriptLoader1, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(1);
+        m_order.append(1);
         m_platform.setShouldYield(true);
     }));
     EXPECT_CALL(*scriptLoader2, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(2);
+        m_order.append(2);
     }));
     EXPECT_CALL(*scriptLoader3, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(3);
+        m_order.append(3);
     }));
 
     m_platform.runSingleTask();
@@ -457,7 +457,7 @@
 
         if (i > 0) {
             EXPECT_CALL(*scriptLoaders[i], execute()).WillOnce(Invoke([this, i] {
-                m_order.push_back(i);
+                m_order.append(i);
             }));
         }
     }
@@ -470,7 +470,7 @@
         for (int i = 2; i < 20; i++)
             m_scriptRunner->notifyScriptReady(scriptLoaders[i].get(), ScriptRunner::ASYNC_EXECUTION);
         m_scriptRunner->resume();
-        m_order.push_back(0);
+        m_order.append(0);
     }));
 
     m_platform.runAllTasks();
@@ -498,14 +498,14 @@
     m_scriptRunner->resume();
 
     EXPECT_CALL(*scriptLoader1, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(1);
+        m_order.append(1);
         m_platform.setShouldYield(true);
     }));
     EXPECT_CALL(*scriptLoader2, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(2);
+        m_order.append(2);
     }));
     EXPECT_CALL(*scriptLoader3, execute()).WillOnce(Invoke([this] {
-        m_order.push_back(3);
+        m_order.append(3);
     }));
 
     m_platform.runSingleTask();
diff --git a/third_party/WebKit/Source/core/dom/TypedFlexibleArrayBufferView.h b/third_party/WebKit/Source/core/dom/TypedFlexibleArrayBufferView.h
index 814b4f2..5b35aa5 100644
--- a/third_party/WebKit/Source/core/dom/TypedFlexibleArrayBufferView.h
+++ b/third_party/WebKit/Source/core/dom/TypedFlexibleArrayBufferView.h
@@ -29,8 +29,9 @@
     }
 };
 
-using FlexibleInt32ArrayView = TypedFlexibleArrayBufferView<WTF::Int32Array>;
 using FlexibleFloat32ArrayView = TypedFlexibleArrayBufferView<WTF::Float32Array>;
+using FlexibleInt32ArrayView = TypedFlexibleArrayBufferView<WTF::Int32Array>;
+using FlexibleUint32ArrayView = TypedFlexibleArrayBufferView<WTF::Uint32Array>;
 
 } // namespace blink
 
diff --git a/third_party/WebKit/Source/core/editing/DragCaretController.cpp b/third_party/WebKit/Source/core/editing/DragCaretController.cpp
index b618583..0d422de 100644
--- a/third_party/WebKit/Source/core/editing/DragCaretController.cpp
+++ b/third_party/WebKit/Source/core/editing/DragCaretController.cpp
@@ -28,7 +28,7 @@
 
 #include "core/editing/EditingUtilities.h"
 #include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index d54b6a9b..e8ce33f 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -72,7 +72,7 @@
 #include "core/page/FocusController.h"
 #include "core/page/FrameTree.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/SecureTextInput.h"
 #include "platform/geometry/FloatQuad.h"
 #include "platform/graphics/GraphicsContext.h"
diff --git a/third_party/WebKit/Source/core/editing/RenderedPosition.cpp b/third_party/WebKit/Source/core/editing/RenderedPosition.cpp
index 6a78ad5..96e85c1b 100644
--- a/third_party/WebKit/Source/core/editing/RenderedPosition.cpp
+++ b/third_party/WebKit/Source/core/editing/RenderedPosition.cpp
@@ -35,7 +35,7 @@
 #include "core/editing/VisiblePosition.h"
 #include "core/editing/VisibleUnits.h"
 #include "core/layout/compositing/CompositedSelectionBound.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 
 namespace blink {
 
@@ -244,7 +244,7 @@
         return;
 
     LayoutRect rect = m_layoutObject->localCaretRect(m_inlineBox, m_offset);
-    DeprecatedPaintLayer* layer = nullptr;
+    PaintLayer* layer = nullptr;
     bound.edgeTopInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMinYCorner(), &layer);
     bound.edgeBottomInLayer = m_layoutObject->localToInvalidationBackingPoint(rect.minXMaxYCorner(), nullptr);
     bound.layer = layer ? layer->graphicsLayerBacking() : nullptr;
diff --git a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
index 75c8f02..90d0c19a 100644
--- a/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
+++ b/third_party/WebKit/Source/core/editing/VisibleUnits.cpp
@@ -54,7 +54,7 @@
 #include "core/layout/LayoutView.h"
 #include "core/layout/line/InlineIterator.h"
 #include "core/layout/line/InlineTextBox.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/Logging.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/heap/Handle.h"
diff --git a/third_party/WebKit/Source/core/events/Event.cpp b/third_party/WebKit/Source/core/events/Event.cpp
index 05c35a6..2ae0e03 100644
--- a/third_party/WebKit/Source/core/events/Event.cpp
+++ b/third_party/WebKit/Source/core/events/Event.cpp
@@ -29,6 +29,8 @@
 #include "core/frame/OriginsUsingFeatures.h"
 #include "core/frame/UseCounter.h"
 #include "core/svg/SVGElement.h"
+#include "core/timing/DOMWindowPerformance.h"
+#include "core/timing/Performance.h"
 #include "wtf/CurrentTime.h"
 
 namespace blink {
@@ -51,7 +53,7 @@
     , m_eventPhase(0)
     , m_currentTarget(nullptr)
     , m_createTime(convertSecondsToDOMTimeStamp(currentTime()))
-    , m_uiCreateTime(0)
+    , m_platformTimeStamp(monotonicallyIncreasingTime())
 {
 }
 
@@ -257,6 +259,24 @@
     return m_currentTarget.get();
 }
 
+double Event::timeStamp(ScriptState* scriptState) const
+{
+    double timeStamp = 0;
+    // TODO(majidvp): Get rid of m_createTime once the flag is enabled by default;
+    if (UNLIKELY(RuntimeEnabledFeatures::hiResEventTimeStampEnabled())) {
+        // Only expose monotonic time after changing its origin to its target
+        // document's time origin.
+        if (scriptState && scriptState->domWindow()) {
+            Performance* performance = DOMWindowPerformance::performance(*scriptState->domWindow());
+            timeStamp = performance->monotonicTimeToDOMHighResTimeStamp(m_platformTimeStamp);
+        }
+    } else {
+        timeStamp = m_createTime;
+    }
+
+    return timeStamp;
+}
+
 DEFINE_TRACE(Event)
 {
     visitor->trace(m_currentTarget);
diff --git a/third_party/WebKit/Source/core/events/Event.h b/third_party/WebKit/Source/core/events/Event.h
index f0ee9c3..0d9f567 100644
--- a/third_party/WebKit/Source/core/events/Event.h
+++ b/third_party/WebKit/Source/core/events/Event.h
@@ -26,6 +26,7 @@
 
 #include "bindings/core/v8/ScriptWrappable.h"
 #include "core/CoreExport.h"
+#include "core/dom/DOMHighResTimeStamp.h"
 #include "core/dom/DOMTimeStamp.h"
 #include "core/events/EventInit.h"
 #include "core/events/EventPath.h"
@@ -122,7 +123,16 @@
 
     bool bubbles() const { return m_canBubble; }
     bool cancelable() const { return m_cancelable; }
-    DOMTimeStamp timeStamp() const { return m_createTime; }
+
+    // Event creation timestamp in milliseconds. If |HiResEventTimeStamp|
+    // runtime feature is enabled it returns a DOMHighResTimeStamp using the
+    // platform timestamp (see |m_platformTimeStamp|) otherwise it returns a
+    // DOMTimeStamp that represents the current object's construction time (see
+    // |m_createTime|). For more info see http://crbug.com/160524
+    double timeStamp(ScriptState*) const;
+    double platformTimeStamp() const { return m_platformTimeStamp; }
+    void setPlatformTimeStamp(double platformTimeStamp) { m_platformTimeStamp = platformTimeStamp; }
+    DOMTimeStamp createTime() const { return m_createTime; }
 
     void stopPropagation() { m_propagationStopped = true; }
     void stopImmediatePropagation() { m_immediatePropagationStopped = true; }
@@ -183,9 +193,6 @@
 
     bool isBeingDispatched() const { return eventPhase(); }
 
-    double uiCreateTime() const { return m_uiCreateTime; }
-    void setUICreateTime(double uiCreateTime) { m_uiCreateTime = uiCreateTime; }
-
     // Events that must not leak across isolated world, similar to how
     // ErrorEvent behaves, can override this method.
     virtual bool canBeDispatchedInWorld(const DOMWrapperWorld&) const { return true; }
@@ -225,7 +232,10 @@
     DOMTimeStamp m_createTime;
     RefPtrWillBeMember<Event> m_underlyingEvent;
     OwnPtrWillBeMember<EventPath> m_eventPath;
-    double m_uiCreateTime; // For input events, the time the event was recorded by the UI.
+    // The monotonic platform time in seconds, for input events it is the
+    // event timestamp provided by the host OS and reported in the original
+    // WebInputEvent instance.
+    double m_platformTimeStamp;
 };
 
 #define DEFINE_EVENT_TYPE_CASTS(typeName) \
diff --git a/third_party/WebKit/Source/core/events/Event.idl b/third_party/WebKit/Source/core/events/Event.idl
index 0739812..1db19f6 100644
--- a/third_party/WebKit/Source/core/events/Event.idl
+++ b/third_party/WebKit/Source/core/events/Event.idl
@@ -44,7 +44,17 @@
     readonly attribute boolean defaultPrevented;
 
     [RuntimeEnabled=TrustedEvents, Unforgeable] readonly attribute boolean isTrusted;
-    readonly attribute DOMTimeStamp timeStamp;
+
+    // TODO(majidvp): At the moment the actual return value type can either
+    // be: 
+    //  - DOMTimeStamp (i.e. long long): legacy type
+    //  - DOMHighResTimeStamp (i.e. double):  HighResEventTimeStamp REF is 
+    //    enabled 
+    // Below IDL definition uses DOMHighResTimeStamp because all DOMTimeStamp
+    // values can be represented in double type without any loss of precision.
+    // Once the feature is enabled by default the return value type will always
+    // match the definition here.
+    [CallWith=ScriptState] readonly attribute DOMHighResTimeStamp timeStamp;
 
     // FIXME: initEvent()'s arguments should not be optional.
     [Measure] void initEvent([Default=Undefined] optional DOMString type,
diff --git a/third_party/WebKit/Source/core/events/EventTypeNames.in b/third_party/WebKit/Source/core/events/EventTypeNames.in
index 423d9e2..442cff3 100644
--- a/third_party/WebKit/Source/core/events/EventTypeNames.in
+++ b/third_party/WebKit/Source/core/events/EventTypeNames.in
@@ -52,6 +52,7 @@
 compositionupdate
 connect
 connecting
+connectionavailable
 contextlost
 contextmenu
 contextrestored
@@ -195,7 +196,6 @@
 selectstart
 show
 signalingstatechange
-sessionconnect
 soundend
 soundstart
 sourceclose
diff --git a/third_party/WebKit/Source/core/events/GestureEvent.cpp b/third_party/WebKit/Source/core/events/GestureEvent.cpp
index dbba665..fba9c8d 100644
--- a/third_party/WebKit/Source/core/events/GestureEvent.cpp
+++ b/third_party/WebKit/Source/core/events/GestureEvent.cpp
@@ -100,7 +100,7 @@
 {
 }
 
-GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY, float velocityX, float velocityY, bool inertial, double uiTimestamp, int resendingPluginId)
+GestureEvent::GestureEvent(const AtomicString& type, PassRefPtrWillBeRawPtr<AbstractView> view, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, float deltaX, float deltaY, float velocityX, float velocityY, bool inertial, double timestamp, int resendingPluginId)
     : MouseRelatedEvent(type, true, true, view, 0, IntPoint(screenX, screenY), IntPoint(clientX, clientY), IntPoint(0, 0), ctrlKey, altKey, shiftKey, metaKey, PositionType::Position)
     , m_deltaX(deltaX)
     , m_deltaY(deltaY)
@@ -109,7 +109,7 @@
     , m_inertial(inertial)
     , m_resendingPluginId(resendingPluginId)
 {
-    setUICreateTime(uiTimestamp);
+    setPlatformTimeStamp(timestamp);
 }
 
 PassRefPtrWillBeRawPtr<EventDispatchMediator> GestureEvent::createMediator()
diff --git a/third_party/WebKit/Source/core/events/KeyboardEvent.cpp b/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
index 1d71c349..e9846d0 100644
--- a/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
+++ b/third_party/WebKit/Source/core/events/KeyboardEvent.cpp
@@ -82,7 +82,7 @@
     , m_location(keyLocationCode(key))
     , m_isAutoRepeat(key.isAutoRepeat())
 {
-    setUICreateTime(key.timestamp());
+    setPlatformTimeStamp(key.timestamp());
 }
 
 KeyboardEvent::KeyboardEvent(const AtomicString& eventType, const KeyboardEventInit& initializer)
diff --git a/third_party/WebKit/Source/core/events/MouseEvent.cpp b/third_party/WebKit/Source/core/events/MouseEvent.cpp
index a922a7b..b07622d 100644
--- a/third_party/WebKit/Source/core/events/MouseEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseEvent.cpp
@@ -120,7 +120,7 @@
     bool ctrlKey, bool altKey, bool shiftKey, bool metaKey,
     short button, unsigned short buttons, PassRefPtrWillBeRawPtr<EventTarget> relatedTarget,
     PlatformMouseEvent::SyntheticEventType syntheticEventType,
-    double uiCreateTime)
+    double timestamp)
     : MouseRelatedEvent(eventType, canBubble, cancelable, view, detail, IntPoint(screenX, screenY),
         IntPoint(windowX, windowY),
         IntPoint(movementX, movementY),
@@ -132,7 +132,7 @@
     , m_relatedTarget(relatedTarget)
     , m_syntheticEventType(syntheticEventType)
 {
-    setUICreateTime(uiCreateTime);
+    setPlatformTimeStamp(timestamp);
 }
 
 MouseEvent::MouseEvent(const AtomicString& eventType, const MouseEventInit& initializer)
diff --git a/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp b/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
index 4ada458..23194cce 100644
--- a/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
+++ b/third_party/WebKit/Source/core/events/MouseRelatedEvent.cpp
@@ -28,7 +28,7 @@
 #include "core/frame/FrameView.h"
 #include "core/frame/LocalFrame.h"
 #include "core/layout/LayoutObject.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 
 namespace blink {
 
@@ -153,7 +153,7 @@
 
     // Adjust layerLocation to be relative to the layer.
     // FIXME: event.layerX and event.layerY are poorly defined,
-    // and probably don't always correspond to DeprecatedPaintLayer offsets.
+    // and probably don't always correspond to PaintLayer offsets.
     // https://bugs.webkit.org/show_bug.cgi?id=21868
     Node* n = targetNode;
     while (n && !n->layoutObject())
@@ -161,7 +161,7 @@
 
     if (n) {
         // FIXME: This logic is a wrong implementation of convertToLayerCoords.
-        for (DeprecatedPaintLayer* layer = n->layoutObject()->enclosingLayer(); layer; layer = layer->parent())
+        for (PaintLayer* layer = n->layoutObject()->enclosingLayer(); layer; layer = layer->parent())
             m_layerLocation -= toLayoutSize(layer->location());
     }
 
diff --git a/third_party/WebKit/Source/core/events/TouchEvent.cpp b/third_party/WebKit/Source/core/events/TouchEvent.cpp
index be31a8b..b5f8b51b 100644
--- a/third_party/WebKit/Source/core/events/TouchEvent.cpp
+++ b/third_party/WebKit/Source/core/events/TouchEvent.cpp
@@ -45,7 +45,7 @@
         TouchList* changedTouches, const AtomicString& type,
         PassRefPtrWillBeRawPtr<AbstractView> view,
         bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, bool cancelable, bool causesScrollingIfUncanceled,
-        double uiCreateTime)
+        double timestamp)
     // Pass a sourceCapabilities including the ability to fire touchevents when creating this touchevent, which is always created from input device capabilities from EventHandler.
     : UIEventWithKeyState(type, true, cancelable, view, 0, ctrlKey, altKey, shiftKey, metaKey, InputDeviceCapabilities::firesTouchEventsSourceCapabilities())
     , m_touches(touches)
@@ -53,7 +53,7 @@
     , m_changedTouches(changedTouches)
     , m_causesScrollingIfUncanceled(causesScrollingIfUncanceled)
 {
-    setUICreateTime(uiCreateTime);
+    setPlatformTimeStamp(timestamp);
 }
 
 TouchEvent::~TouchEvent()
diff --git a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
index a62cb6a..8e09575 100644
--- a/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
+++ b/third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp
@@ -532,6 +532,10 @@
     if (!existingResource)
         return Load;
 
+    // Service Worker's CORS fallback message must not be cached.
+    if (existingResource->response().wasFallbackRequiredByServiceWorker())
+        return Reload;
+
     // We already have a preload going for this URL.
     if (fetchRequest.forPreload() && existingResource->isPreloaded())
         return Use;
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index ad12344..3c579bf 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -64,9 +64,9 @@
 #include "core/layout/ScrollAlignment.h"
 #include "core/layout/TextAutosizer.h"
 #include "core/layout/TracedLayoutObject.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
 #include "core/layout/compositing/CompositedSelection.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/layout/svg/LayoutSVGRoot.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
@@ -76,8 +76,8 @@
 #include "core/page/FrameTree.h"
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/FramePainter.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ComputedStyle.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGSVGElement.h"
@@ -365,7 +365,7 @@
 
 void FrameView::invalidateRect(const IntRect& rect)
 {
-    // For querying DeprecatedPaintLayer::compositingState() when invalidating scrollbars.
+    // For querying PaintLayer::compositingState() when invalidating scrollbars.
     // FIXME: do all scrollbar invalidations after layout of all frames is complete. It's currently not recursively true.
     DisableCompositingQueryAsserts disabler;
     if (!parent()) {
@@ -1288,7 +1288,7 @@
         LayoutObject* layoutObject = viewportConstrainedObject;
         ASSERT(layoutObject->style()->hasViewportConstrainedPosition());
         ASSERT(layoutObject->hasLayer());
-        DeprecatedPaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
+        PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
 
         if (layer->isPaintInvalidationContainer())
             continue;
@@ -1338,7 +1338,7 @@
     // FIXME: Find out what are enough to invalidate in slow path scrolling. crbug.com/451090#9.
     ASSERT(layoutView());
     if (contentsInCompositedLayer())
-        layoutView()->layer()->compositedDeprecatedPaintLayerMapping()->setContentsNeedDisplay();
+        layoutView()->layer()->compositedLayerMapping()->setContentsNeedDisplay();
     else
         layoutView()->setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
 
@@ -1784,8 +1784,8 @@
 {
     m_isTransparent = isTransparent;
     DisableCompositingQueryAsserts disabler;
-    if (layoutView() && layoutView()->layer()->hasCompositedDeprecatedPaintLayerMapping())
-        layoutView()->layer()->compositedDeprecatedPaintLayerMapping()->updateContentsOpaque();
+    if (layoutView() && layoutView()->layer()->hasCompositedLayerMapping())
+        layoutView()->layer()->compositedLayerMapping()->updateContentsOpaque();
 }
 
 bool FrameView::hasOpaqueBackground() const
@@ -1802,11 +1802,11 @@
 {
     m_baseBackgroundColor = backgroundColor;
 
-    if (layoutView() && layoutView()->layer()->hasCompositedDeprecatedPaintLayerMapping()) {
-        CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = layoutView()->layer()->compositedDeprecatedPaintLayerMapping();
-        compositedDeprecatedPaintLayerMapping->updateContentsOpaque();
-        if (compositedDeprecatedPaintLayerMapping->mainGraphicsLayer())
-            compositedDeprecatedPaintLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
+    if (layoutView() && layoutView()->layer()->hasCompositedLayerMapping()) {
+        CompositedLayerMapping* compositedLayerMapping = layoutView()->layer()->compositedLayerMapping();
+        compositedLayerMapping->updateContentsOpaque();
+        if (compositedLayerMapping->mainGraphicsLayer())
+            compositedLayerMapping->mainGraphicsLayer()->setNeedsDisplay();
     }
     recalculateScrollbarOverlayStyle();
 }
@@ -2053,7 +2053,7 @@
         return windowClipRect();
 
     // If we have no layer, just return our window clip rect.
-    const DeprecatedPaintLayer* enclosingLayer = ownerElement->layoutObject()->enclosingLayer();
+    const PaintLayer* enclosingLayer = ownerElement->layoutObject()->enclosingLayer();
     if (!enclosingLayer)
         return windowClipRect();
 
@@ -3945,7 +3945,7 @@
     if (!graphicsLayer)
         return;
 
-    DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentLayoutObject(), paintInvalidationContainer, viewRect);
+    PaintLayer::mapRectToPaintInvalidationBacking(localFrame->contentLayoutObject(), paintInvalidationContainer, viewRect);
 
     graphicsLayerTimingRequests.add(graphicsLayer, Vector<std::pair<int64_t, WebRect>>()).storedValue->value.append(std::make_pair(m_frame->frameID(), enclosingIntRect(viewRect)));
 }
diff --git a/third_party/WebKit/Source/core/frame/FrameView.h b/third_party/WebKit/Source/core/frame/FrameView.h
index 6490f53..a7e1167 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.h
+++ b/third_party/WebKit/Source/core/frame/FrameView.h
@@ -128,7 +128,7 @@
 
     // Methods for getting/setting the size Blink should use to layout the contents.
     // NOTE: Scrollbar exclusion is based on the FrameView's scrollbars. To exclude
-    // scrollbars on the root DeprecatedPaintLayer, use LayoutView::layoutSize.
+    // scrollbars on the root PaintLayer, use LayoutView::layoutSize.
     IntSize layoutSize(IncludeScrollbarsInRect = ExcludeScrollbars) const;
     void setLayoutSize(const IntSize&);
 
diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
index def62f7a..c0b3b8d 100644
--- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
@@ -54,14 +54,14 @@
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/layout/HitTestResult.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/loader/FrameLoadRequest.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/loader/NavigationScheduler.h"
 #include "core/page/FocusController.h"
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/TransformRecorder.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "platform/DragImage.h"
diff --git a/third_party/WebKit/Source/core/frame/RemoteFrame.cpp b/third_party/WebKit/Source/core/frame/RemoteFrame.cpp
index 48626ba..84163cb 100644
--- a/third_party/WebKit/Source/core/frame/RemoteFrame.cpp
+++ b/third_party/WebKit/Source/core/frame/RemoteFrame.cpp
@@ -14,7 +14,7 @@
 #include "core/html/HTMLFrameOwnerElement.h"
 #include "core/layout/LayoutPart.h"
 #include "core/loader/FrameLoadRequest.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/PluginScriptForbiddenScope.h"
 #include "platform/UserGestureIndicator.h"
 #include "platform/graphics/GraphicsLayer.h"
diff --git a/third_party/WebKit/Source/core/frame/UseCounter.h b/third_party/WebKit/Source/core/frame/UseCounter.h
index 4e0e7d83..0d96fea 100644
--- a/third_party/WebKit/Source/core/frame/UseCounter.h
+++ b/third_party/WebKit/Source/core/frame/UseCounter.h
@@ -805,11 +805,11 @@
         PresentationRequestStart = 929,
         PresentationRequestReconnect = 930,
         PresentationRequestGetAvailability = 931,
-        PresentationRequestSessionConnectEventListener = 932,
-        PresentationSessionClose = 933,
-        PresentationSessionSend = 934,
-        PresentationSessionStateChangeEventListener = 935,
-        PresentationSessionMessageEventListener = 936,
+        PresentationRequestConnectionAvailableEventListener = 932,
+        PresentationConnectionClose = 933,
+        PresentationConnectionSend = 934,
+        PresentationConnectionStateChangeEventListener = 935,
+        PresentationConnectionMessageEventListener = 936,
         CSSAnimationsStackedNeutralKeyframe = 937,
         ReadingCheckedInClickHandler = 938,
         FlexboxIntrinsicSizeAlgorithmIsDifferent = 939,
@@ -833,11 +833,11 @@
         BackspaceNavigatedBack = 957,
         BackspaceNavigatedBackAfterFormInteraction = 958,
         CSPSourceWildcardWouldMatchExactHost = 959,
-        CredentialManagerGet = 959,
-        CredentialManagerGetWithUI = 960,
-        CredentialManagerGetWithoutUI = 961,
-        CredentialManagerStore = 962,
-        CredentialManagerRequireUserMediation = 963,
+        CredentialManagerGet = 960,
+        CredentialManagerGetWithUI = 961,
+        CredentialManagerGetWithoutUI = 962,
+        CredentialManagerStore = 963,
+        CredentialManagerRequireUserMediation = 964,
 
         // Add new features immediately above this line. Don't change assigned
         // numbers of any item, and don't reuse removed slots.
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.cpp b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
index 3b2033c9..384faf6 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewport.cpp
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.cpp
@@ -38,7 +38,7 @@
 #include "core/inspector/InspectorInstrumentation.h"
 #include "core/layout/LayoutView.h"
 #include "core/layout/TextAutosizer.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/page/ChromeClient.h"
 #include "core/page/Page.h"
@@ -71,12 +71,15 @@
     : m_frameHost(&owner)
     , m_scale(1)
     , m_topControlsAdjustment(0)
+    , m_maxPageScale(-1)
+    , m_trackPinchZoomStatsForPage(false)
 {
     reset();
 }
 
 VisualViewport::~VisualViewport()
 {
+    sendUMAMetrics();
 }
 
 DEFINE_TRACE(VisualViewport)
@@ -269,8 +272,8 @@
 //  |       +- *pageScaleLayer
 //  |           +- *innerViewportScrollLayer
 //  |               +-- overflowControlsHostLayer (root layer)
-//  |                   +-- outerViewportContainerLayer (fixed pos container) [frame container layer in DeprecatedPaintLayerCompositor]
-//  |                   |   +-- outerViewportScrollLayer [frame scroll layer in DeprecatedPaintLayerCompositor]
+//  |                   +-- outerViewportContainerLayer (fixed pos container) [frame container layer in PaintLayerCompositor]
+//  |                   |   +-- outerViewportScrollLayer [frame scroll layer in PaintLayerCompositor]
 //  |                   |       +-- content layers ...
 //  +- horizontalScrollbarLayer
 //  +- verticalScrollbarLayer
@@ -397,7 +400,7 @@
 
     ASSERT(frameHost().page().deprecatedLocalMainFrame()->contentLayoutObject());
 
-    DeprecatedPaintLayerCompositor* compositor = frameHost().page().deprecatedLocalMainFrame()->contentLayoutObject()->compositor();
+    PaintLayerCompositor* compositor = frameHost().page().deprecatedLocalMainFrame()->contentLayoutObject()->compositor();
     // Get the outer viewport scroll layer.
     WebLayer* scrollLayer = compositor->scrollLayer() ? compositor->scrollLayer()->platformLayer() : 0;
 
@@ -654,6 +657,68 @@
     return flooredIntPoint(FloatPoint(rootFrameToViewport(FloatPoint(pointInRootFrame))));
 }
 
+void VisualViewport::startTrackingPinchStats()
+{
+    if (!mainFrame())
+        return;
+
+    Document* document = mainFrame()->document();
+    if (!document)
+        return;
+
+    if (!document->url().protocolIsInHTTPFamily())
+        return;
+
+    m_trackPinchZoomStatsForPage = !shouldDisableDesktopWorkarounds();
+}
+
+void VisualViewport::userDidChangeScale()
+{
+    if (!m_trackPinchZoomStatsForPage)
+        return;
+
+    m_maxPageScale = std::max(m_maxPageScale, m_scale);
+}
+
+void VisualViewport::sendUMAMetrics()
+{
+    if (m_trackPinchZoomStatsForPage) {
+        bool didScale = m_maxPageScale > 0;
+
+        Platform::current()->histogramEnumeration("Viewport.DidScalePage", didScale ? 1 : 0, 2);
+
+        if (didScale) {
+            int zoomPercentage = floor(m_maxPageScale * 100);
+
+            // See the PageScaleFactor enumeration in histograms.xml for the bucket ranges.
+            int bucket = floor(zoomPercentage / 25.f);
+
+            Platform::current()->histogramEnumeration("Viewport.MaxPageScale", bucket, 21);
+        }
+    }
+
+    m_maxPageScale = -1;
+    m_trackPinchZoomStatsForPage = false;
+}
+
+bool VisualViewport::shouldDisableDesktopWorkarounds() const
+{
+    if (!mainFrame() || !mainFrame()->view())
+        return false;
+
+    if (!mainFrame()->settings()->viewportEnabled())
+        return false;
+
+    // A document is considered adapted to small screen UAs if one of these holds:
+    // 1. The author specified viewport has a constrained width that is equal to
+    //    the initial viewport width.
+    // 2. The author has disabled viewport zoom.
+    const PageScaleConstraints& constraints = frameHost().pageScaleConstraintsSet().pageDefinedConstraints();
+
+    return mainFrame()->view()->layoutSize().width() == m_size.width()
+        || (constraints.minimumScale == constraints.maximumScale && constraints.minimumScale != -1);
+}
+
 String VisualViewport::debugName(const GraphicsLayer* graphicsLayer)
 {
     String name;
diff --git a/third_party/WebKit/Source/core/frame/VisualViewport.h b/third_party/WebKit/Source/core/frame/VisualViewport.h
index 04208e4..1156163 100644
--- a/third_party/WebKit/Source/core/frame/VisualViewport.h
+++ b/third_party/WebKit/Source/core/frame/VisualViewport.h
@@ -195,6 +195,15 @@
     GraphicsLayer* layerForHorizontalScrollbar() const override;
     GraphicsLayer* layerForVerticalScrollbar() const override;
 
+    // Used for gathering data on user pinch-zoom statistics.
+    void userDidChangeScale();
+    void sendUMAMetrics();
+    void startTrackingPinchStats();
+
+    // Heuristic-based function for determining if we should disable workarounds
+    // for viewing websites that are not optimized for mobile devices.
+    bool shouldDisableDesktopWorkarounds() const;
+
 private:
     explicit VisualViewport(FrameHost&);
 
@@ -231,6 +240,8 @@
     float m_scale;
     IntSize m_size;
     float m_topControlsAdjustment;
+    float m_maxPageScale;
+    bool m_trackPinchZoomStatsForPage;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp b/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
index a5b29fa8..e3240421 100644
--- a/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLAnchorElement.cpp
@@ -349,7 +349,7 @@
     sendPings(completedURL);
 
     ResourceRequest request(completedURL);
-    request.setUIStartTime(event->uiCreateTime());
+    request.setUIStartTime(event->platformTimeStamp());
     request.setInputPerfMetricReportPolicy(InputToLoadPerfMetricReportPolicy::ReportLink);
 
     ReferrerPolicy policy;
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index 7f08606..d0b1507b 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -43,7 +43,7 @@
 #include "core/html/canvas/CanvasRenderingContext.h"
 #include "core/html/canvas/CanvasRenderingContextFactory.h"
 #include "core/layout/LayoutHTMLCanvas.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/MIMETypeRegistry.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/Task.h"
@@ -316,7 +316,7 @@
     // the canvas contents are sent separately through a texture layer.
     if (ro && (!m_context || !m_context->isAccelerated())) {
         LayoutRect mappedDirtyRect(enclosingIntRect(mapRect(m_dirtyRect, srcRect, FloatRect(ro->contentBoxRect()))));
-        // For querying DeprecatedPaintLayer::compositingState()
+        // For querying PaintLayer::compositingState()
         // FIXME: is this invalidation using the correct compositing state?
         DisableCompositingQueryAsserts disabler;
         ro->invalidatePaintRectangle(mappedDirtyRect);
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
index 614c6ce0..f9b4716 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp
@@ -62,7 +62,7 @@
 #include "core/inspector/ConsoleMessage.h"
 #include "core/layout/LayoutVideo.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/FrameLoaderClient.h"
 #include "core/page/ChromeClient.h"
diff --git a/third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp b/third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp
index 69c4a83..4526dafe 100644
--- a/third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp
+++ b/third_party/WebKit/Source/core/html/forms/TextFieldInputType.cpp
@@ -51,7 +51,7 @@
 #include "core/layout/LayoutTextControlSingleLine.h"
 #include "core/layout/LayoutTheme.h"
 #include "core/page/ChromeClient.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/EventDispatchForbiddenScope.h"
 #include "wtf/text/WTFString.h"
 
@@ -230,9 +230,9 @@
         LayoutTextControlSingleLine* layoutTextControl = toLayoutTextControlSingleLine(element().layoutObject());
         if (event->type() == EventTypeNames::blur) {
             if (LayoutBox* innerEditorLayoutObject = element().innerEditorElement()->layoutBox()) {
-                // FIXME: This class has no need to know about DeprecatedPaintLayer!
-                if (DeprecatedPaintLayer* innerLayer = innerEditorLayoutObject->layer()) {
-                    if (DeprecatedPaintLayerScrollableArea* innerScrollableArea = innerLayer->scrollableArea()) {
+                // FIXME: This class has no need to know about PaintLayer!
+                if (PaintLayer* innerLayer = innerEditorLayoutObject->layer()) {
+                    if (PaintLayerScrollableArea* innerScrollableArea = innerLayer->scrollableArea()) {
                         IntSize scrollOffset(!layoutTextControl->style()->isLeftToRightDirection() ? innerScrollableArea->scrollWidth().toInt() : 0, 0);
                         innerScrollableArea->scrollToOffset(scrollOffset, ScrollOffsetClamped);
                     }
diff --git a/third_party/WebKit/Source/core/html/forms/TypeAhead.cpp b/third_party/WebKit/Source/core/html/forms/TypeAhead.cpp
index 38bbef1..4415ea9 100644
--- a/third_party/WebKit/Source/core/html/forms/TypeAhead.cpp
+++ b/third_party/WebKit/Source/core/html/forms/TypeAhead.cpp
@@ -42,7 +42,7 @@
 {
 }
 
-static const DOMTimeStamp typeAheadTimeout = 1000;
+static const double typeAheadTimeout = 1; // in seconds
 
 static String stripLeadingWhiteSpace(const String& string)
 {
@@ -59,12 +59,12 @@
 
 int TypeAhead::handleEvent(KeyboardEvent* event, MatchModeFlags matchMode)
 {
-    if (event->timeStamp() < m_lastTypeTime)
+    if (event->platformTimeStamp() < m_lastTypeTime)
         return -1;
 
     int optionCount = m_dataSource->optionCount();
-    DOMTimeStamp delta = event->timeStamp() - m_lastTypeTime;
-    m_lastTypeTime = event->timeStamp();
+    double delta = event->platformTimeStamp() - m_lastTypeTime;
+    m_lastTypeTime = event->platformTimeStamp();
 
     UChar c = event->charCode();
 
@@ -122,7 +122,7 @@
 
 bool TypeAhead::hasActiveSession(KeyboardEvent* event)
 {
-    DOMTimeStamp delta = event->timeStamp() - m_lastTypeTime;
+    double delta = event->platformTimeStamp() - m_lastTypeTime;
     return delta <= typeAheadTimeout;
 }
 
diff --git a/third_party/WebKit/Source/core/html/forms/TypeAhead.h b/third_party/WebKit/Source/core/html/forms/TypeAhead.h
index fd71c96..67cebdc9 100644
--- a/third_party/WebKit/Source/core/html/forms/TypeAhead.h
+++ b/third_party/WebKit/Source/core/html/forms/TypeAhead.h
@@ -27,7 +27,6 @@
 #define TypeAhead_h
 
 #include "core/CoreExport.h"
-#include "core/dom/DOMTimeStamp.h"
 #include "wtf/Allocator.h"
 #include "wtf/text/StringBuilder.h"
 #include "wtf/text/WTFString.h"
@@ -64,7 +63,8 @@
 
 private:
     TypeAheadDataSource* m_dataSource;
-    DOMTimeStamp m_lastTypeTime;
+    // platform timestamp of last keyboard event in seconds
+    double m_lastTypeTime;
     UChar m_repeatingChar;
     StringBuilder m_buffer;
 };
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
index 7a1d819..f8a5ef3fe 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.cpp
@@ -793,10 +793,17 @@
         return;
     }
     if (token->name() == inputTag) {
+        // Per spec https://html.spec.whatwg.org/#parsing-main-inbody,
+        // section "A start tag whose tag name is "input""
+
         Attribute* typeAttribute = token->getAttributeItem(typeAttr);
+        bool disableFrameset = !typeAttribute || !equalIgnoringCase(typeAttribute->value(), "hidden");
+
         m_tree.reconstructTheActiveFormattingElements();
+        // TODO(kouhei): Make it obvious that insertSelfClosingHTMLElement may mutate the token.
         m_tree.insertSelfClosingHTMLElement(token);
-        if (!typeAttribute || !equalIgnoringCase(typeAttribute->value(), "hidden"))
+
+        if (disableFrameset)
             m_framesetOk = false;
         return;
     }
diff --git a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h
index e6eb94b..d69b955 100644
--- a/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h
+++ b/third_party/WebKit/Source/core/html/parser/HTMLTreeBuilder.h
@@ -207,6 +207,7 @@
         RefPtrWillBeMember<HTMLStackItem> m_contextElementStackItem;
     };
 
+    // https://html.spec.whatwg.org/#frameset-ok-flag
     bool m_framesetOk;
 #if ENABLE(ASSERT)
     bool m_isAttached;
diff --git a/third_party/WebKit/Source/core/input/EventHandler.cpp b/third_party/WebKit/Source/core/input/EventHandler.cpp
index 7aa55fa..a521a0d 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.cpp
+++ b/third_party/WebKit/Source/core/input/EventHandler.cpp
@@ -79,7 +79,7 @@
 #include "core/page/SpatialNavigation.h"
 #include "core/page/TouchAdjustment.h"
 #include "core/page/scrolling/ScrollState.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ComputedStyle.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "platform/PlatformGestureEvent.h"
@@ -861,7 +861,7 @@
     bool inResizer = false;
     LayoutObject* layoutObject = node ? node->layoutObject() : nullptr;
     if (layoutObject && m_frame->view()) {
-        DeprecatedPaintLayer* layer = layoutObject->enclosingLayer();
+        PaintLayer* layer = layoutObject->enclosingLayer();
         inResizer = layer->scrollableArea() && layer->scrollableArea()->isPointInResizeControl(result.roundedPointInMainFrame(), ResizerForPointer);
     }
 
@@ -956,7 +956,7 @@
     m_clickNode = mev.innerNode()->isTextNode() ?  ComposedTreeTraversal::parent(*mev.innerNode()) : mev.innerNode();
 
     if (FrameView* view = m_frame->view()) {
-        DeprecatedPaintLayer* layer = mev.innerNode()->layoutObject() ? mev.innerNode()->layoutObject()->enclosingLayer() : nullptr;
+        PaintLayer* layer = mev.innerNode()->layoutObject() ? mev.innerNode()->layoutObject()->enclosingLayer() : nullptr;
         IntPoint p = view->rootFrameToContents(mouseEvent.position());
         if (layer && layer->scrollableArea() && layer->scrollableArea()->isPointInResizeControl(p, ResizerForPointer)) {
             m_resizeScrollableArea = layer->scrollableArea();
@@ -1017,7 +1017,7 @@
     return swallowEvent;
 }
 
-static DeprecatedPaintLayer* layerForNode(Node* node)
+static PaintLayer* layerForNode(Node* node)
 {
     if (!node)
         return nullptr;
@@ -1026,16 +1026,16 @@
     if (!layoutObject)
         return nullptr;
 
-    DeprecatedPaintLayer* layer = layoutObject->enclosingLayer();
+    PaintLayer* layer = layoutObject->enclosingLayer();
     if (!layer)
         return nullptr;
 
     return layer;
 }
 
-ScrollableArea* EventHandler::associatedScrollableArea(const DeprecatedPaintLayer* layer) const
+ScrollableArea* EventHandler::associatedScrollableArea(const PaintLayer* layer) const
 {
-    if (DeprecatedPaintLayerScrollableArea* scrollableArea = layer->scrollableArea()) {
+    if (PaintLayerScrollableArea* scrollableArea = layer->scrollableArea()) {
         if (scrollableArea->scrollsOverflow())
             return scrollableArea;
     }
@@ -1056,7 +1056,7 @@
     if (!page)
         return result;
 
-    if (DeprecatedPaintLayer* layer = layerForNode(hoveredNode.innerNode())) {
+    if (PaintLayer* layer = layerForNode(hoveredNode.innerNode())) {
         if (ScrollableArea* layerScrollableArea = associatedScrollableArea(layer))
             layerScrollableArea->mouseMovedInContentArea();
     }
@@ -1497,8 +1497,8 @@
     RefPtrWillBeMember<Node> lastNodeUnderMouse = m_nodeUnderMouse;
     m_nodeUnderMouse = result;
 
-    DeprecatedPaintLayer* layerForLastNode = layerForNode(lastNodeUnderMouse.get());
-    DeprecatedPaintLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get());
+    PaintLayer* layerForLastNode = layerForNode(lastNodeUnderMouse.get());
+    PaintLayer* layerForNodeUnderMouse = layerForNode(m_nodeUnderMouse.get());
     Page* page = m_frame->page();
 
     if (lastNodeUnderMouse && (!m_nodeUnderMouse || m_nodeUnderMouse->document() != m_frame->document())) {
@@ -2186,7 +2186,7 @@
 bool EventHandler::handleScrollGestureOnResizer(Node* eventTarget, const PlatformGestureEvent& gestureEvent)
 {
     if (gestureEvent.type() == PlatformEvent::GestureScrollBegin) {
-        DeprecatedPaintLayer* layer = eventTarget->layoutObject() ? eventTarget->layoutObject()->enclosingLayer() : nullptr;
+        PaintLayer* layer = eventTarget->layoutObject() ? eventTarget->layoutObject()->enclosingLayer() : nullptr;
         IntPoint p = m_frame->view()->rootFrameToContents(gestureEvent.position());
         if (layer && layer->scrollableArea() && layer->scrollableArea()->isPointInResizeControl(p, ResizerForTouch)) {
             m_resizeScrollableArea = layer->scrollableArea();
diff --git a/third_party/WebKit/Source/core/input/EventHandler.h b/third_party/WebKit/Source/core/input/EventHandler.h
index 0d3d60b0..143ac1b5 100644
--- a/third_party/WebKit/Source/core/input/EventHandler.h
+++ b/third_party/WebKit/Source/core/input/EventHandler.h
@@ -51,8 +51,8 @@
 
 class AutoscrollController;
 class DataTransfer;
-class DeprecatedPaintLayer;
-class DeprecatedPaintLayerScrollableArea;
+class PaintLayer;
+class PaintLayerScrollableArea;
 class Document;
 class DragState;
 class Element;
@@ -256,7 +256,7 @@
     bool isCursorVisible() const;
     void updateCursor();
 
-    ScrollableArea* associatedScrollableArea(const DeprecatedPaintLayer*) const;
+    ScrollableArea* associatedScrollableArea(const PaintLayer*) const;
 
     // Scrolls the elements of the DOM tree. Returns true if a node was scrolled.
     // False if we reached the root and couldn't scroll anything.
@@ -367,7 +367,7 @@
 
     bool m_svgPan;
 
-    RawPtrWillBeMember<DeprecatedPaintLayerScrollableArea> m_resizeScrollableArea;
+    RawPtrWillBeMember<PaintLayerScrollableArea> m_resizeScrollableArea;
 
     RefPtrWillBeMember<Node> m_capturingMouseEventsNode;
     bool m_eventHandlerWillResetCapturingMouseEventsNode;
diff --git a/third_party/WebKit/Source/core/inspector/DebuggerScript.js b/third_party/WebKit/Source/core/inspector/DebuggerScript.js
index c6c2fd5e..22483ed 100644
--- a/third_party/WebKit/Source/core/inspector/DebuggerScript.js
+++ b/third_party/WebKit/Source/core/inspector/DebuggerScript.js
@@ -68,8 +68,7 @@
             continue;
         result.push({
             type: scopeDetails.type(),
-            object: scopeObject,
-            name: scopeDetails.name()
+            object: scopeObject
         });
     }
     return result;
@@ -390,12 +389,10 @@
     var scopeMirrors = (scopeDetailsLevel === DebuggerScript.ScopeInfoDetails.NoScopes ? [] : frameMirror.allScopes(scopeDetailsLevel === DebuggerScript.ScopeInfoDetails.FastAsyncScopes));
     var scopeTypes = new Array(scopeMirrors.length);
     var scopeObjects = new Array(scopeMirrors.length);
-    var scopeNames = new Array(scopeMirrors.length);
     for (var i = 0; i < scopeMirrors.length; ++i) {
         var scopeDetails = scopeMirrors[i].details();
         scopeTypes[i] = scopeDetails.type();
         scopeObjects[i] = scopeDetails.object();
-        scopeNames[i] = scopeDetails.name();
     }
 
     // Calculated lazily.
@@ -408,16 +405,14 @@
         if (!scopeChain) {
             scopeChain = [];
             for (var i = 0, j = 0; i < scopeObjects.length; ++i) {
-                var scopeObject = DebuggerScript._buildScopeObject(scopeTypes[i], scopeObjects[i], scopeNames[i]);
+                var scopeObject = DebuggerScript._buildScopeObject(scopeTypes[i], scopeObjects[i]);
                 if (scopeObject) {
                     scopeTypes[j] = scopeTypes[i];
-                    scopeNames[j] = scopeNames[i];
                     scopeChain[j] = scopeObject;
                     ++j;
                 }
             }
             scopeTypes.length = scopeChain.length;
-            scopeNames.length = scopeChain.length;
             scopeObjects = null; // Free for GC.
         }
         return scopeChain;
@@ -430,13 +425,6 @@
         return scopeTypes;
     }
 
-    function lazyScopeNames()
-    {
-        if (!scopeChain)
-            lazyScopeChain();
-        return scopeNames;
-    }
-
     function ensureFuncMirror()
     {
         if (!funcMirror) {
@@ -546,7 +534,6 @@
         "thisObject": thisObject,
         "scopeChain": lazyScopeChain,
         "scopeType": lazyScopeTypes,
-        "scopeName": lazyScopeNames,
         "evaluate": evaluate,
         "caller": callerFrame,
         "restart": restart,
diff --git a/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js b/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js
index 5c76040..d508bc0 100644
--- a/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js
+++ b/third_party/WebKit/Source/core/inspector/InjectedScriptSource.js
@@ -482,7 +482,7 @@
             delete details["rawScopes"];
             var scopes = [];
             for (var i = 0; i < rawScopes.length; ++i)
-                scopes[i] = InjectedScript.CallFrameProxy._createScopeJson(rawScopes[i].type, rawScopes[i].name, rawScopes[i].object, objectGroupName);
+                scopes[i] = InjectedScript.CallFrameProxy._createScopeJson(rawScopes[i].type, rawScopes[i].object, objectGroupName);
             details.scopeChain = scopes;
         }
         return details;
@@ -1543,7 +1543,7 @@
         var scopeChain = callFrame.scopeChain;
         var scopeChainProxy = [];
         for (var i = 0; i < scopeChain.length; ++i)
-            scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson(callFrame.scopeType(i), callFrame.scopeName(i), scopeChain[i], "backtrace");
+            scopeChainProxy[i] = InjectedScript.CallFrameProxy._createScopeJson(callFrame.scopeType(i), scopeChain[i], "backtrace");
         return scopeChainProxy;
     },
 
@@ -1567,21 +1567,17 @@
 
 /**
  * @param {number} scopeTypeCode
- * @param {string} scopeName
  * @param {*} scopeObject
  * @param {string} groupId
  * @return {!DebuggerAgent.Scope}
  */
-InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeName, scopeObject, groupId)
+InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeObject, groupId)
 {
-    var scope = {
+    return {
         object: injectedScript._wrapObject(scopeObject, groupId),
         type: InjectedScript.CallFrameProxy._scopeTypeNames[scopeTypeCode],
         __proto__: null
     };
-    if (scopeName)
-        scope.name = scopeName;
-    return scope;
 }
 
 /**
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
index 6f56871..d1bcac09 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.cpp
@@ -192,6 +192,14 @@
     }
 }
 
+void InspectorAnimationAgent::getCurrentTime(ErrorString* errorString, const String& id, double* currentTime)
+{
+    Animation* animation = assertAnimation(errorString, id);
+    if (m_idToAnimationClone.get(id))
+        animation = m_idToAnimationClone.get(id);
+    *currentTime = animation->timeline()->currentTime() - animation->startTime();
+}
+
 Animation* InspectorAnimationAgent::animationClone(Animation* animation)
 {
     const String id = String::number(animation->sequenceNumber());
diff --git a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h
index ecd7d00..5eaefa29 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorAnimationAgent.h
@@ -38,6 +38,7 @@
     // Protocol method implementations
     void getPlaybackRate(ErrorString*, double* playbackRate) override;
     void setPlaybackRate(ErrorString*, double playbackRate) override;
+    void getCurrentTime(ErrorString*, const String& animationId, double* currentTime) override;
     void setTiming(ErrorString*, const String& animationId, double duration, double delay) override;
     void seekAnimations(ErrorString*, const RefPtr<JSONArray>& animationIds, double currentTime) override;
 
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
index 1c614bd9c..09772def 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.cpp
@@ -44,8 +44,8 @@
 #include "core/inspector/InstrumentingAgents.h"
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/loader/DocumentLoader.h"
 #include "platform/geometry/IntRect.h"
 #include "platform/graphics/CompositingReasons.h"
@@ -207,7 +207,7 @@
 
 PassRefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> > InspectorLayerTreeAgent::buildLayerTree()
 {
-    DeprecatedPaintLayerCompositor* compositor = deprecatedPaintLayerCompositor();
+    PaintLayerCompositor* compositor = deprecatedPaintLayerCompositor();
     if (!compositor || !compositor->inCompositingMode())
         return nullptr;
 
@@ -218,21 +218,21 @@
     return layers.release();
 }
 
-void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(DeprecatedPaintLayer* root, LayerIdToNodeIdMap& layerIdToNodeIdMap)
+void InspectorLayerTreeAgent::buildLayerIdToNodeIdMap(PaintLayer* root, LayerIdToNodeIdMap& layerIdToNodeIdMap)
 {
-    if (root->hasCompositedDeprecatedPaintLayerMapping()) {
+    if (root->hasCompositedLayerMapping()) {
         if (Node* node = root->layoutObject()->generatingNode()) {
-            GraphicsLayer* graphicsLayer = root->compositedDeprecatedPaintLayerMapping()->childForSuperlayers();
+            GraphicsLayer* graphicsLayer = root->compositedLayerMapping()->childForSuperlayers();
             layerIdToNodeIdMap.set(graphicsLayer->platformLayer()->id(), idForNode(node));
         }
     }
-    for (DeprecatedPaintLayer* child = root->firstChild(); child; child = child->nextSibling())
+    for (PaintLayer* child = root->firstChild(); child; child = child->nextSibling())
         buildLayerIdToNodeIdMap(child, layerIdToNodeIdMap);
     if (!root->layoutObject()->isLayoutIFrame())
         return;
     FrameView* childFrameView = toFrameView(toLayoutPart(root->layoutObject())->widget());
     if (LayoutView* childLayoutView = childFrameView->layoutView()) {
-        if (DeprecatedPaintLayerCompositor* childCompositor = childLayoutView->compositor())
+        if (PaintLayerCompositor* childCompositor = childLayoutView->compositor())
             buildLayerIdToNodeIdMap(childCompositor->rootLayer(), layerIdToNodeIdMap);
     }
 }
@@ -254,10 +254,10 @@
     return DOMNodeIds::idForNode(node);
 }
 
-DeprecatedPaintLayerCompositor* InspectorLayerTreeAgent::deprecatedPaintLayerCompositor()
+PaintLayerCompositor* InspectorLayerTreeAgent::deprecatedPaintLayerCompositor()
 {
     LayoutView* layoutView = m_pageAgent->inspectedFrame()->contentLayoutObject();
-    DeprecatedPaintLayerCompositor* compositor = layoutView ? layoutView->compositor() : nullptr;
+    PaintLayerCompositor* compositor = layoutView ? layoutView->compositor() : nullptr;
     return compositor;
 }
 
@@ -289,7 +289,7 @@
         *errorString = "Invalid layer id";
         return nullptr;
     }
-    DeprecatedPaintLayerCompositor* compositor = deprecatedPaintLayerCompositor();
+    PaintLayerCompositor* compositor = deprecatedPaintLayerCompositor();
     if (!compositor) {
         *errorString = "Not in compositing mode";
         return nullptr;
diff --git a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h
index b4c3d80..4f758dd 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorLayerTreeAgent.h
@@ -48,8 +48,8 @@
 class LayoutObject;
 class LayoutRect;
 class PictureSnapshot;
-class DeprecatedPaintLayer;
-class DeprecatedPaintLayerCompositor;
+class PaintLayer;
+class PaintLayerCompositor;
 
 typedef String ErrorString;
 
@@ -94,12 +94,12 @@
 
     GraphicsLayer* rootGraphicsLayer();
 
-    DeprecatedPaintLayerCompositor* deprecatedPaintLayerCompositor();
+    PaintLayerCompositor* deprecatedPaintLayerCompositor();
     GraphicsLayer* layerById(ErrorString*, const String& layerId);
     const PictureSnapshot* snapshotById(ErrorString*, const String& snapshotId);
 
     typedef HashMap<int, int> LayerIdToNodeIdMap;
-    void buildLayerIdToNodeIdMap(DeprecatedPaintLayer*, LayerIdToNodeIdMap&);
+    void buildLayerIdToNodeIdMap(PaintLayer*, LayerIdToNodeIdMap&);
     void gatherGraphicsLayers(GraphicsLayer*, HashMap<int, int>& layerIdToNodeIdMap, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&);
     int idForNode(Node*);
 
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
index 5f50ba4..f414f26 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.cpp
@@ -21,7 +21,7 @@
 #include "core/layout/LayoutImage.h"
 #include "core/layout/LayoutObject.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/workers/WorkerThread.h"
 #include "core/xmlhttprequest/XMLHttpRequest.h"
 #include "platform/JSONValues.h"
@@ -584,7 +584,7 @@
 const char InspectorLayerInvalidationTrackingEvent::ReflectionLayerChanged[] = "Reflection layer change";
 const char InspectorLayerInvalidationTrackingEvent::NewCompositedLayer[] = "Assigned a new composited layer";
 
-PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayerInvalidationTrackingEvent::data(const DeprecatedPaintLayer* layer, const char* reason)
+PassRefPtr<TraceEvent::ConvertableToTraceFormat> InspectorLayerInvalidationTrackingEvent::data(const PaintLayer* layer, const char* reason)
 {
     const LayoutObject* paintInvalidationContainer = layer->layoutObject()->containerForPaintInvalidation();
 
diff --git a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
index 22080ed..5608f921 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
+++ b/third_party/WebKit/Source/core/inspector/InspectorTraceEvents.h
@@ -28,7 +28,7 @@
 class HitTestResult;
 class ImageResource;
 class KURL;
-class DeprecatedPaintLayer;
+class PaintLayer;
 class LayoutRect;
 class LocalFrame;
 class Node;
@@ -228,7 +228,7 @@
 extern const char ReflectionLayerChanged[];
 extern const char NewCompositedLayer[];
 
-PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(const DeprecatedPaintLayer*, const char* reason);
+PassRefPtr<TraceEvent::ConvertableToTraceFormat> data(const PaintLayer*, const char* reason);
 }
 
 #define TRACE_LAYER_INVALIDATION(LAYER, REASON) \
diff --git a/third_party/WebKit/Source/core/inspector/injected_script_externs.js b/third_party/WebKit/Source/core/inspector/injected_script_externs.js
index c78421f..b6c2843 100644
--- a/third_party/WebKit/Source/core/inspector/injected_script_externs.js
+++ b/third_party/WebKit/Source/core/inspector/injected_script_externs.js
@@ -224,11 +224,6 @@
  */
 JavaScriptCallFrame.prototype.scopeType = function(scopeIndex) {}
 
-/**
- * @param {number} scopeIndex
- * @return {string}
- */
-JavaScriptCallFrame.prototype.scopeName = function(scopeIndex) {}
 
 /** @type {!Window} */
 var inspectedGlobalObject;
diff --git a/third_party/WebKit/Source/core/inspector/v8/JavaScriptCallFrame.cpp b/third_party/WebKit/Source/core/inspector/v8/JavaScriptCallFrame.cpp
index bab3c223..8b050a95 100644
--- a/third_party/WebKit/Source/core/inspector/v8/JavaScriptCallFrame.cpp
+++ b/third_party/WebKit/Source/core/inspector/v8/JavaScriptCallFrame.cpp
@@ -140,14 +140,6 @@
     return scopeType->Get(scopeIndex)->Int32Value();
 }
 
-v8::Local<v8::String> JavaScriptCallFrame::scopeName(int scopeIndex) const
-{
-    v8::Local<v8::Object> callFrame = m_callFrame.newLocal(m_isolate);
-    v8::Local<v8::Function> func = v8::Local<v8::Function>::Cast(callFrame->Get(v8AtomicString(m_isolate, "scopeName")));
-    v8::Local<v8::Array> scopeType = v8::Local<v8::Array>::Cast(V8ScriptRunner::callInternalFunction(func, callFrame, 0, 0, m_isolate).ToLocalChecked());
-    return scopeType->Get(scopeIndex)->ToString();
-}
-
 v8::Local<v8::Value> JavaScriptCallFrame::thisObject() const
 {
     return m_callFrame.newLocal(m_isolate)->Get(v8AtomicString(m_isolate, "thisObject"));
diff --git a/third_party/WebKit/Source/core/inspector/v8/JavaScriptCallFrame.h b/third_party/WebKit/Source/core/inspector/v8/JavaScriptCallFrame.h
index 902dd74..87fda92 100644
--- a/third_party/WebKit/Source/core/inspector/v8/JavaScriptCallFrame.h
+++ b/third_party/WebKit/Source/core/inspector/v8/JavaScriptCallFrame.h
@@ -60,7 +60,6 @@
 
     v8::Local<v8::Value> scopeChain() const;
     int scopeType(int scopeIndex) const;
-    v8::Local<v8::String> scopeName(int scopeIndex) const;
     v8::Local<v8::Value> thisObject() const;
     String stepInPositions() const;
     bool isAtReturn() const;
diff --git a/third_party/WebKit/Source/core/inspector/v8/V8JavaScriptCallFrame.cpp b/third_party/WebKit/Source/core/inspector/v8/V8JavaScriptCallFrame.cpp
index 913cc57..8ea5f942 100644
--- a/third_party/WebKit/Source/core/inspector/v8/V8JavaScriptCallFrame.cpp
+++ b/third_party/WebKit/Source/core/inspector/v8/V8JavaScriptCallFrame.cpp
@@ -137,16 +137,6 @@
     info.GetReturnValue().Set(impl->scopeType(scopeIndex));
 }
 
-void scopeNameMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
-    JavaScriptCallFrame* impl = V8JavaScriptCallFrame::unwrap(info.Holder());
-    v8::Maybe<int32_t> maybeScopeIndex = info[0]->Int32Value(info.GetIsolate()->GetCurrentContext());
-    if (maybeScopeIndex.IsNothing())
-        return;
-    int scopeIndex = maybeScopeIndex.FromJust();
-    info.GetReturnValue().Set(impl->scopeName(scopeIndex));
-}
-
 char hiddenPropertyName[] = "v8inspector::JavaScriptCallFrame";
 char className[] = "V8JavaScriptCallFrame";
 using JavaScriptCallFrameWrapper = InspectorWrapper<JavaScriptCallFrame, hiddenPropertyName, className>;
@@ -172,7 +162,6 @@
     {"restart", restartMethodCallback},
     {"setVariableValue", setVariableValueMethodCallback},
     {"scopeType", scopeTypeMethodCallback},
-    {"scopeName", scopeNameMethodCallback}
 };
 
 } // namespace
diff --git a/third_party/WebKit/Source/core/layout/ClipRectsCache.h b/third_party/WebKit/Source/core/layout/ClipRectsCache.h
index a3a6089..d7c8bfe 100644
--- a/third_party/WebKit/Source/core/layout/ClipRectsCache.h
+++ b/third_party/WebKit/Source/core/layout/ClipRectsCache.h
@@ -13,7 +13,7 @@
 
 namespace blink {
 
-class DeprecatedPaintLayer;
+class PaintLayer;
 
 enum ClipRectsCacheSlot {
     // Relative to the ancestor treated as the root (e.g. transformed layer). Used for hit testing.
@@ -42,7 +42,7 @@
 #endif
         {
         }
-        const DeprecatedPaintLayer* root;
+        const PaintLayer* root;
         RefPtr<ClipRects> clipRects;
 #if ENABLE(ASSERT)
         OverlayScrollbarSizeRelevancy scrollbarRelevancy;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
index 4ba7ef6..0c8b7e60 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.cpp
@@ -30,6 +30,7 @@
 #include "core/dom/Element.h"
 #include "core/dom/StyleEngine.h"
 #include "core/dom/shadow/ShadowRoot.h"
+#include "core/editing/DragCaretController.h"
 #include "core/editing/EditingUtilities.h"
 #include "core/editing/Editor.h"
 #include "core/editing/FrameSelection.h"
@@ -64,8 +65,8 @@
 #include "core/page/Page.h"
 #include "core/paint/BlockPainter.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ComputedStyle.h"
 #include "core/style/ContentData.h"
 #include "platform/RuntimeEnabledFeatures.h"
@@ -892,7 +893,7 @@
 
         for (auto block : *infoMap) {
             if (block.key->hasOverflowClip()) {
-                DeprecatedPaintLayerScrollableArea* scrollableArea = block.key->layer()->scrollableArea();
+                PaintLayerScrollableArea* scrollableArea = block.key->layer()->scrollableArea();
                 ScrollInfo& scrollInfo = block.value;
                 scrollableArea->finalizeScrollDimensions(scrollInfo.scrollOffset, scrollInfo.autoHorizontalScrollBarChanged, scrollInfo.autoVerticalScrollBarChanged);
             }
@@ -2561,6 +2562,25 @@
     return isInlineBlockOrInlineTable() && !size().isEmpty() && node() && editingIgnoresContent(node());
 }
 
+static inline bool caretBrowsingEnabled(const LocalFrame* frame)
+{
+    Settings* settings = frame->settings();
+    return settings && settings->caretBrowsingEnabled();
+}
+
+bool LayoutBlock::hasCursorCaret() const
+{
+    LocalFrame* frame = this->frame();
+    return frame->selection().caretLayoutObject() == this && (frame->selection().hasEditableStyle() || caretBrowsingEnabled(frame));
+}
+
+bool LayoutBlock::hasDragCaret() const
+{
+    LocalFrame* frame = this->frame();
+    DragCaretController& dragCaretController = frame->page()->dragCaretController();
+    return dragCaretController.caretLayoutObject() == this && (dragCaretController.isContentEditable() || caretBrowsingEnabled(frame));
+}
+
 LayoutRect LayoutBlock::localCaretRect(InlineBox* inlineBox, int caretOffset, LayoutUnit* extraWidthToEndOfLine)
 {
     // Do the normal calculation in most cases.
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlock.h b/third_party/WebKit/Source/core/layout/LayoutBlock.h
index 66c2aaa6..654d5aeb 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlock.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBlock.h
@@ -403,6 +403,11 @@
     void absoluteRects(Vector<IntRect>&, const LayoutPoint& accumulatedOffset) const override;
     void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const override;
 
+public:
+    bool hasCursorCaret() const;
+    bool hasDragCaret() const;
+    bool hasCaret() const { return hasCursorCaret() || hasDragCaret(); }
+
 private:
     LayoutRect localCaretRect(InlineBox*, int caretOffset, LayoutUnit* extraWidthToEndOfLine = nullptr) final;
     bool isInlineBoxWrapperActuallyChild() const;
diff --git a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
index 2769420..d08012e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBlockFlow.cpp
@@ -51,9 +51,9 @@
 #include "core/layout/shapes/ShapeOutsideInfo.h"
 #include "core/paint/BlockFlowPainter.h"
 #include "core/paint/ClipScope.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/geometry/TransformState.h"
 #include "platform/text/BidiTextRun.h"
@@ -322,7 +322,7 @@
     if (m_paintInvalidationLogicalTop != m_paintInvalidationLogicalBottom) {
         bool hasVisibleContent = style()->visibility() == VISIBLE;
         if (!hasVisibleContent) {
-            DeprecatedPaintLayer* layer = enclosingLayer();
+            PaintLayer* layer = enclosingLayer();
             layer->updateDescendantDependentFlags();
             hasVisibleContent = layer->hasVisibleContent();
         }
@@ -1342,7 +1342,7 @@
         logicalTop += collapsedBeforePos - collapsedBeforeNeg;
     }
 
-    DeprecatedPaintLayer* childLayer = child.layer();
+    PaintLayer* childLayer = child.layer();
     if (childLayer->staticBlockPosition() != logicalTop)
         childLayer->setStaticBlockPosition(logicalTop);
 }
@@ -2631,7 +2631,7 @@
     LayoutRect rect = selectionGapRectsForPaintInvalidation(paintInvalidationContainer);
     // FIXME: groupedMapping() leaks the squashing abstraction.
     if (paintInvalidationContainer->layer()->groupedMapping())
-        DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
+        PaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
     return rect;
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.cpp b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
index e4ea241..d44efe6f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.cpp
@@ -51,13 +51,13 @@
 #include "core/layout/LayoutScrollbarPart.h"
 #include "core/layout/LayoutTableCell.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/layout/shapes/ShapeOutsideInfo.h"
 #include "core/page/AutoscrollController.h"
 #include "core/page/Page.h"
 #include "core/paint/BackgroundImageGeometry.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ShadowList.h"
 #include "platform/LengthFunctions.h"
 #include "platform/geometry/DoubleRect.h"
@@ -98,19 +98,19 @@
     setIsBox();
 }
 
-DeprecatedPaintLayerType LayoutBox::layerTypeRequired() const
+PaintLayerType LayoutBox::layerTypeRequired() const
 {
     // hasAutoZIndex only returns true if the element is positioned or a flex-item since
     // position:static elements that are not flex-items get their z-index coerced to auto.
     if (isPositioned() || createsGroup() || hasClipPath() || hasTransformRelatedProperty()
         || style()->hasCompositorProxy() || hasHiddenBackface() || hasReflection() || style()->specifiesColumns()
         || !style()->hasAutoZIndex() || style()->shouldCompositeForCurrentAnimations())
-        return NormalDeprecatedPaintLayer;
+        return NormalPaintLayer;
 
     if (hasOverflowClip())
-        return OverflowClipDeprecatedPaintLayer;
+        return OverflowClipPaintLayer;
 
-    return NoDeprecatedPaintLayer;
+    return NoPaintLayer;
 }
 
 void LayoutBox::willBeDestroyed()
@@ -240,7 +240,7 @@
         document().view()->recalculateScrollbarOverlayStyle();
         document().view()->recalculateCustomScrollbarStyle();
         if (LayoutView* layoutView = view()) {
-            if (DeprecatedPaintLayerScrollableArea* scrollableArea = layoutView->scrollableArea()) {
+            if (PaintLayerScrollableArea* scrollableArea = layoutView->scrollableArea()) {
                 if (scrollableArea->horizontalScrollbar() && scrollableArea->horizontalScrollbar()->isCustomScrollbar())
                     scrollableArea->horizontalScrollbar()->styleChanged();
                 if (scrollableArea->verticalScrollbar() && scrollableArea->verticalScrollbar()->isCustomScrollbar())
@@ -649,7 +649,7 @@
     return (hasOverflowClip() || isLayoutIFrame()) && style()->resize() != RESIZE_NONE;
 }
 
-void LayoutBox::addLayerHitTestRects(LayerHitTestRects& layerRects, const DeprecatedPaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
+void LayoutBox::addLayerHitTestRects(LayerHitTestRects& layerRects, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
 {
     LayoutPoint adjustedLayerOffset = layerOffset + locationOffset();
     LayoutBoxModelObject::addLayerHitTestRects(layerRects, currentLayer, adjustedLayerOffset, containerRect);
@@ -1260,7 +1260,7 @@
         return false;
     if (childBox.size().isZero())
         return false;
-    if (DeprecatedPaintLayer* childLayer = childBox.layer()) {
+    if (PaintLayer* childLayer = childBox.layer()) {
         // FIXME: perhaps this could be less conservative?
         if (childLayer->compositingState() != NotComposited)
             return false;
@@ -1406,7 +1406,7 @@
         // Issue paint invalidations for any scrollbars if there is a scrollable area for this layoutObject.
         if (ScrollableArea* area = scrollableArea()) {
             // In slimming paint mode, we already invalidated the display item clients of the scrollbars
-            // during DeprecatedPaintLayerScrollableArea::invalidateScrollbarRect(). However, for now we still need to
+            // during PaintLayerScrollableArea::invalidateScrollbarRect(). However, for now we still need to
             // invalidate the rectangles to trigger repaints.
             if (area->hasVerticalBarDamage())
                 invalidatePaintRectangleNotInvalidatingDisplayItemClients(LayoutRect(area->verticalBarDamage()));
@@ -1772,7 +1772,7 @@
 LayoutRect LayoutBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState) const
 {
     if (style()->visibility() != VISIBLE) {
-        DeprecatedPaintLayer* layer = enclosingLayer();
+        PaintLayer* layer = enclosingLayer();
         layer->updateDescendantDependentFlags();
         if (layer->subtreeIsInvisible())
             return LayoutRect();
@@ -2757,7 +2757,7 @@
     if (style()->position() == FixedPosition && containingBlock->isLayoutView()) {
         const LayoutView* view = toLayoutView(containingBlock);
         if (FrameView* frameView = view->frameView()) {
-            // Don't use visibleContentRect since the DeprecatedPaintLayer's size has not been set yet.
+            // Don't use visibleContentRect since the PaintLayer's size has not been set yet.
             IntSize viewportSize = frameView->layoutViewportScrollableArea()->excludeScrollbars(frameView->frameRect().size());
             return containingBlock->isHorizontalWritingMode() ? viewportSize.width() : viewportSize.height();
         }
@@ -2801,7 +2801,7 @@
     if (style()->position() == FixedPosition && containingBlock->isLayoutView()) {
         const LayoutView* view = toLayoutView(containingBlock);
         if (FrameView* frameView = view->frameView()) {
-            // Don't use visibleContentRect since the DeprecatedPaintLayer's size has not been set yet.
+            // Don't use visibleContentRect since the PaintLayer's size has not been set yet.
             IntSize viewportSize = frameView->layoutViewportScrollableArea()->excludeScrollbars(frameView->frameRect().size());
             return containingBlock->isHorizontalWritingMode() ? viewportSize.height() : viewportSize.width();
         }
@@ -3921,8 +3921,8 @@
 
 bool LayoutBox::hasNonCompositedScrollbars() const
 {
-    if (DeprecatedPaintLayer* layer = this->layer()) {
-        if (DeprecatedPaintLayerScrollableArea* scrollableArea = layer->scrollableArea()) {
+    if (PaintLayer* layer = this->layer()) {
+        if (PaintLayerScrollableArea* scrollableArea = layer->scrollableArea()) {
             if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->layerForHorizontalScrollbar())
                 return true;
             if (scrollableArea->hasVerticalScrollbar() && !scrollableArea->layerForVerticalScrollbar())
@@ -4345,11 +4345,11 @@
 }
 
 
-DeprecatedPaintLayer* LayoutBox::enclosingFloatPaintingLayer() const
+PaintLayer* LayoutBox::enclosingFloatPaintingLayer() const
 {
     const LayoutObject* curr = this;
     while (curr) {
-        DeprecatedPaintLayer* layer = curr->hasLayer() && curr->isBox() ? toLayoutBox(curr)->layer() : 0;
+        PaintLayer* layer = curr->hasLayer() && curr->isBox() ? toLayoutBox(curr)->layer() : 0;
         if (layer && layer->isSelfPaintingLayer())
             return layer;
         curr = curr->parent();
diff --git a/third_party/WebKit/Source/core/layout/LayoutBox.h b/third_party/WebKit/Source/core/layout/LayoutBox.h
index b10cab7..a4c38dd 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBox.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBox.h
@@ -82,7 +82,7 @@
 public:
     explicit LayoutBox(ContainerNode*);
 
-    DeprecatedPaintLayerType layerTypeRequired() const override;
+    PaintLayerType layerTypeRequired() const override;
 
     bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const override;
 
@@ -597,7 +597,7 @@
 
     void removeFloatingOrPositionedChildFromBlockLists();
 
-    DeprecatedPaintLayer* enclosingFloatPaintingLayer() const;
+    PaintLayer* enclosingFloatPaintingLayer() const;
 
     virtual int firstLineBoxBaseline() const { return -1; }
     virtual int inlineBlockBaseline(LineDirectionMode) const { return -1; } // Returns -1 if we should skip this box when computing the baseline of an inline-block.
@@ -747,7 +747,7 @@
 
     LayoutObject* splitAnonymousBoxesAroundChild(LayoutObject* beforeChild);
 
-    void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override;
+    void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override;
     void computeSelfHitTestRects(Vector<LayoutRect>&, const LayoutPoint& layerOffset) const override;
 
     PaintInvalidationReason paintInvalidationReason(const LayoutBoxModelObject& paintInvalidationContainer,
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
index c795921..c0f483a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp
@@ -36,10 +36,10 @@
 #include "core/layout/LayoutObject.h"
 #include "core/layout/LayoutTextFragment.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/scrolling/ScrollingConstraints.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/BorderEdge.h"
 #include "core/style/ShadowList.h"
 #include "platform/LengthFunctions.h"
@@ -206,8 +206,8 @@
         && ((oldStyle->originalDisplay() == BLOCK) || (oldStyle->originalDisplay() == INLINE_BLOCK)))
         parent()->setNeedsLayout(LayoutInvalidationReason::ChildChanged, MarkContainerChain);
 
-    DeprecatedPaintLayerType type = layerTypeRequired();
-    if (type != NoDeprecatedPaintLayer) {
+    PaintLayerType type = layerTypeRequired();
+    if (type != NoPaintLayer) {
         if (!layer() && layerCreationAllowedForSubtree()) {
             if (wasFloatingBeforeStyleChanged && isFloating())
                 setChildNeedsLayout();
@@ -218,7 +218,7 @@
             }
         }
     } else if (layer() && layer()->parent()) {
-        DeprecatedPaintLayer* parentLayer = layer()->parent();
+        PaintLayer* parentLayer = layer()->parent();
         setHasTransformRelatedProperty(false); // Either a transform wasn't specified or the object doesn't support transforms, so just null out the bit.
         setHasReflection(false);
         layer()->removeOnlyThisLayer(); // calls destroyLayer() which clears m_layer
@@ -282,10 +282,10 @@
     }
 }
 
-void LayoutBoxModelObject::createLayer(DeprecatedPaintLayerType type)
+void LayoutBoxModelObject::createLayer(PaintLayerType type)
 {
 
-    // Acquiring a DeprecatedPaintLayer may change the paint invalidation container. Therefore we must eagerly
+    // Acquiring a PaintLayer may change the paint invalidation container. Therefore we must eagerly
     // invalidate paint for this object before creating the layer.
     if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() && isRooted()) {
         DisablePaintInvalidationStateAsserts invalidationDisabler;
@@ -301,7 +301,7 @@
     }
 
     ASSERT(!m_layer);
-    m_layer = adoptPtr(new DeprecatedPaintLayer(this, type));
+    m_layer = adoptPtr(new PaintLayer(this, type));
     setHasLayer(true);
     m_layer->insertOnlyThisLayer();
 }
@@ -317,12 +317,12 @@
     return m_layer && m_layer->isSelfPaintingLayer();
 }
 
-DeprecatedPaintLayerScrollableArea* LayoutBoxModelObject::scrollableArea() const
+PaintLayerScrollableArea* LayoutBoxModelObject::scrollableArea() const
 {
     return m_layer ? m_layer->scrollableArea() : 0;
 }
 
-void LayoutBoxModelObject::addLayerHitTestRects(LayerHitTestRects& rects, const DeprecatedPaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
+void LayoutBoxModelObject::addLayerHitTestRects(LayerHitTestRects& rects, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
 {
     if (hasLayer()) {
         if (isLayoutView()) {
@@ -404,7 +404,7 @@
             squashingLayer->setNeedsDisplayInRect(enclosingIntRect(paintInvalidationRect), invalidationReason);
         }
     } else {
-        layer()->compositedDeprecatedPaintLayerMapping()->setContentsNeedDisplayInRect(r, invalidationReason);
+        layer()->compositedLayerMapping()->setContentsNeedDisplayInRect(r, invalidationReason);
     }
 }
 
@@ -413,8 +413,8 @@
     if (layer()->groupedMapping()) {
         if (GraphicsLayer* squashingLayer = layer()->groupedMapping()->squashingLayer())
             squashingLayer->invalidateDisplayItemClient(displayItemClient);
-    } else if (CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = layer()->compositedDeprecatedPaintLayerMapping()) {
-        compositedDeprecatedPaintLayerMapping->invalidateDisplayItemClient(displayItemClient);
+    } else if (CompositedLayerMapping* compositedLayerMapping = layer()->compositedLayerMapping()) {
+        compositedLayerMapping->invalidateDisplayItemClient(displayItemClient);
     }
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
index fab409c..d133d6133 100644
--- a/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutBoxModelObject.h
@@ -31,16 +31,16 @@
 
 namespace blink {
 
-class DeprecatedPaintLayer;
-class DeprecatedPaintLayerScrollableArea;
+class PaintLayer;
+class PaintLayerScrollableArea;
 
-enum DeprecatedPaintLayerType {
-    NoDeprecatedPaintLayer,
-    NormalDeprecatedPaintLayer,
+enum PaintLayerType {
+    NoPaintLayer,
+    NormalPaintLayer,
     // A forced or overflow clip layer is required for bookkeeping purposes,
     // but does not force a layer to be self painting.
-    OverflowClipDeprecatedPaintLayer,
-    ForcedDeprecatedPaintLayer
+    OverflowClipPaintLayer,
+    ForcedPaintLayer
 };
 
 // Modes for some of the line-related functions.
@@ -74,17 +74,17 @@
 //
 // The reason for this partial implementation is that the 2 classes inheriting
 // from it (LayoutBox and LayoutInline) have different requirements but need to
-// have a DeprecatedPaintLayer.
+// have a PaintLayer.
 // For a full implementation of the box model, see LayoutBox.
 //
-// An important member of this class is DeprecatedPaintLayer. This class is
+// An important member of this class is PaintLayer. This class is
 // central to painting and hit-testing (see its class comment).
-// DeprecatedPaintLayers are instantiated for several reasons based on the
+// PaintLayers are instantiated for several reasons based on the
 // return value of layerTypeRequired().
 // Interestingly, most SVG objects inherit from LayoutSVGModelObject and thus
-// can't have a DeprecatedPaintLayer. This is an unfortunate artifact of our
+// can't have a PaintLayer. This is an unfortunate artifact of our
 // design as it limits code sharing and prevents hardware accelerating SVG
-// (the current design require a DeprecatedPaintLayer for compositing).
+// (the current design require a PaintLayer for compositing).
 //
 // In order to fully understand LayoutBoxModelObject and the inherited classes,
 // we need to introduce the concept of coordinate systems.
@@ -152,15 +152,15 @@
     virtual int pixelSnappedOffsetHeight() const;
 
     bool hasSelfPaintingLayer() const;
-    DeprecatedPaintLayer* layer() const { return m_layer.get(); }
-    DeprecatedPaintLayerScrollableArea* scrollableArea() const;
+    PaintLayer* layer() const { return m_layer.get(); }
+    PaintLayerScrollableArea* scrollableArea() const;
 
     virtual void updateFromStyle();
 
-    // The type of DeprecatedPaintLayer to instantiate.
-    // Any value returned from this function other than NoDeprecatedPaintLayer
+    // The type of PaintLayer to instantiate.
+    // Any value returned from this function other than NoPaintLayer
     // will populate |m_layer|.
-    virtual DeprecatedPaintLayerType layerTypeRequired() const = 0;
+    virtual PaintLayerType layerTypeRequired() const = 0;
 
     // This will work on inlines to return the bounding box of all of the lines' border boxes.
     virtual IntRect borderBoundingBox() const = 0;
@@ -296,7 +296,7 @@
     void addOutlineRectsForNormalChildren(Vector<LayoutRect>&, const LayoutPoint& additionalOffset, IncludeBlockVisualOverflowOrNot) const;
     void addOutlineRectsForDescendant(const LayoutObject& descendant, Vector<LayoutRect>&, const LayoutPoint& additionalOffset, IncludeBlockVisualOverflowOrNot) const;
 
-    void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer*, const LayoutPoint&, const LayoutRect&) const override;
+    void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer*, const LayoutPoint&, const LayoutRect&) const override;
 
     void styleWillChange(StyleDifference, const ComputedStyle& newStyle) override;
     void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
@@ -330,14 +330,14 @@
     IntSize calculateImageIntrinsicDimensions(StyleImage*, const IntSize& scaledPositioningAreaSize, ScaleByEffectiveZoomOrNot) const;
 
 private:
-    void createLayer(DeprecatedPaintLayerType);
+    void createLayer(PaintLayerType);
 
     LayoutUnit computedCSSPadding(const Length&) const;
     bool isBoxModelObject() const final { return true; }
 
-    // The DeprecatedPaintLayer associated with this object.
+    // The PaintLayer associated with this object.
     // |m_layer| can be nullptr depending on the return value of layerTypeRequired().
-    OwnPtr<DeprecatedPaintLayer> m_layer;
+    OwnPtr<PaintLayer> m_layer;
 };
 
 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutBoxModelObject, isBoxModelObject());
diff --git a/third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp
index ce12d43a..707e655 100644
--- a/third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutDeprecatedFlexibleBox.cpp
@@ -29,7 +29,7 @@
 #include "core/layout/LayoutView.h"
 #include "core/layout/TextAutosizer.h"
 #include "core/layout/TextRunConstructor.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/fonts/Font.h"
 #include "wtf/StdLibExtras.h"
 #include "wtf/text/CharacterNames.h"
@@ -377,7 +377,7 @@
         for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
             if (child->isOutOfFlowPositioned()) {
                 child->containingBlock()->insertPositionedObject(child);
-                DeprecatedPaintLayer* childLayer = child->layer();
+                PaintLayer* childLayer = child->layer();
                 childLayer->setStaticInlinePosition(xPos);
                 if (childLayer->staticBlockPosition() != yPos) {
                     childLayer->setStaticBlockPosition(yPos);
@@ -618,7 +618,7 @@
         for (LayoutBox* child = iterator.first(); child; child = iterator.next()) {
             if (child->isOutOfFlowPositioned()) {
                 child->containingBlock()->insertPositionedObject(child);
-                DeprecatedPaintLayer* childLayer = child->layer();
+                PaintLayer* childLayer = child->layer();
                 childLayer->setStaticInlinePosition(borderStart() + paddingStart());
                 if (childLayer->staticBlockPosition() != size().height()) {
                     childLayer->setStaticBlockPosition(size().height());
diff --git a/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp b/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp
index bef4033..7ae64d5 100644
--- a/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.cpp
@@ -51,15 +51,15 @@
 {
 }
 
-DeprecatedPaintLayerType LayoutEmbeddedObject::layerTypeRequired() const
+PaintLayerType LayoutEmbeddedObject::layerTypeRequired() const
 {
-    // This can't just use LayoutPart::layerTypeRequired, because DeprecatedPaintLayerCompositor
+    // This can't just use LayoutPart::layerTypeRequired, because PaintLayerCompositor
     // doesn't loop through LayoutEmbeddedObjects the way it does frames in order
     // to update the self painting bit on their Layer.
     // Also, unlike iframes, embeds don't used the usesCompositing bit on LayoutView
     // in requiresAcceleratedCompositing.
     if (requiresAcceleratedCompositing())
-        return NormalDeprecatedPaintLayer;
+        return NormalPaintLayer;
     return LayoutPart::layerTypeRequired();
 }
 
@@ -84,6 +84,10 @@
     m_pluginUnavailabilityReason = pluginUnavailabilityReason;
 
     m_unavailablePluginReplacementText = localizedUnavailablePluginReplacementText(node(), pluginUnavailabilityReason);
+
+    // node() is nullptr when LayoutPart is being destroyed.
+    if (node())
+        setShouldDoFullPaintInvalidation();
 }
 
 bool LayoutEmbeddedObject::showsUnavailablePluginIndicator() const
diff --git a/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.h b/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.h
index 45f309a..8b2f9cf 100644
--- a/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutEmbeddedObject.h
@@ -58,7 +58,7 @@
     bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectEmbeddedObject || LayoutPart::isOfType(type); }
     LayoutBox* embeddedContentBox() const final;
 
-    DeprecatedPaintLayerType layerTypeRequired() const final;
+    PaintLayerType layerTypeRequired() const final;
 
     ScrollResultOneDimensional scroll(ScrollDirectionPhysical, ScrollGranularity, float multiplier) final;
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
index 54d650c..232d9ec 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlexibleBox.cpp
@@ -35,7 +35,7 @@
 #include "core/layout/LayoutView.h"
 #include "core/layout/TextAutosizer.h"
 #include "core/paint/BlockPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ComputedStyle.h"
 #include "platform/LengthFunctions.h"
 #include "wtf/MathExtras.h"
@@ -1056,7 +1056,7 @@
 {
     ASSERT(child.isOutOfFlowPositioned());
     child.containingBlock()->insertPositionedObject(&child);
-    DeprecatedPaintLayer* childLayer = child.layer();
+    PaintLayer* childLayer = child.layer();
     LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffset;
     if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowReverse)
         inlinePosition = mainAxisExtent() - mainAxisOffset;
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlowThread.cpp b/third_party/WebKit/Source/core/layout/LayoutFlowThread.cpp
index 63b33d9..f0ffeb0 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlowThread.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutFlowThread.cpp
@@ -163,7 +163,7 @@
         m_multiColumnSetIntervalTree.add(MultiColumnSetIntervalTree::createInterval(columnSet->logicalTopInFlowThread(), columnSet->logicalBottomInFlowThread(), columnSet));
 }
 
-void LayoutFlowThread::collectLayerFragments(DeprecatedPaintLayerFragments& layerFragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRectInFlowThread)
+void LayoutFlowThread::collectLayerFragments(PaintLayerFragments& layerFragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRectInFlowThread)
 {
     ASSERT(!m_columnSetsInvalidated);
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutFlowThread.h b/third_party/WebKit/Source/core/layout/LayoutFlowThread.h
index c162a14..03b0eb8 100644
--- a/third_party/WebKit/Source/core/layout/LayoutFlowThread.h
+++ b/third_party/WebKit/Source/core/layout/LayoutFlowThread.h
@@ -32,7 +32,7 @@
 
 #include "core/CoreExport.h"
 #include "core/layout/LayoutBlockFlow.h"
-#include "core/paint/DeprecatedPaintLayerFragment.h"
+#include "core/paint/PaintLayerFragment.h"
 #include "wtf/ListHashSet.h"
 
 namespace blink {
@@ -62,7 +62,7 @@
 
     // Always create a Layer for the LayoutFlowThread so that we
     // can easily avoid drawing the children directly.
-    DeprecatedPaintLayerType layerTypeRequired() const final { return NormalDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const final { return NormalPaintLayer; }
 
     virtual void flowThreadDescendantWasInserted(LayoutObject*) { }
     virtual void flowThreadDescendantWillBeRemoved(LayoutObject*) { }
@@ -95,7 +95,7 @@
     virtual bool isPageLogicalHeightKnown() const { return true; }
     bool pageLogicalSizeChanged() const { return m_pageLogicalSizeChanged; }
 
-    void collectLayerFragments(DeprecatedPaintLayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRectInFlowThread);
+    void collectLayerFragments(PaintLayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRectInFlowThread);
 
     // Return the visual bounding box based on the supplied flow-thread bounding box. Both
     // rectangles are completely physical in terms of writing mode.
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp
index c7dedbb..d3f5503 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.cpp
@@ -28,7 +28,7 @@
 
 #include "core/frame/LocalFrame.h"
 #include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/geometry/TransformState.h"
 #include "wtf/TemporaryChange.h"
 
@@ -119,7 +119,7 @@
 #if ENABLE(ASSERT)
     if (m_mapping.size() > 0) {
         const LayoutObject* lastLayoutObject = m_mapping.last().m_layoutObject;
-        const DeprecatedPaintLayer* layer = lastLayoutObject->enclosingLayer();
+        const PaintLayer* layer = lastLayoutObject->enclosingLayer();
 
         // Bounds for invisible layers are intentionally not calculated, and are
         // therefore not necessarily expected to be correct here. This is ok,
@@ -168,7 +168,7 @@
 #if ENABLE(ASSERT)
     if (m_mapping.size() > 0) {
         const LayoutObject* lastLayoutObject = m_mapping.last().m_layoutObject;
-        const DeprecatedPaintLayer* layer = lastLayoutObject->enclosingLayer();
+        const PaintLayer* layer = lastLayoutObject->enclosingLayer();
 
         // Bounds for invisible layers are intentionally not calculated, and are
         // therefore not necessarily expected to be correct here. This is ok,
@@ -214,7 +214,7 @@
     return true;
 }
 
-void LayoutGeometryMap::pushMappingsToAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer)
+void LayoutGeometryMap::pushMappingsToAncestor(const PaintLayer* layer, const PaintLayer* ancestorLayer)
 {
     const LayoutObject* layoutObject = layer->layoutObject();
 
@@ -292,7 +292,7 @@
     }
 }
 
-void LayoutGeometryMap::popMappingsToAncestor(const DeprecatedPaintLayer* ancestorLayer)
+void LayoutGeometryMap::popMappingsToAncestor(const PaintLayer* ancestorLayer)
 {
     const LayoutBoxModelObject* ancestorLayoutObject = ancestorLayer ? ancestorLayer->layoutObject() : 0;
     popMappingsToAncestor(ancestorLayoutObject);
diff --git a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h
index 39f3834..ddb41dfa 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h
+++ b/third_party/WebKit/Source/core/layout/LayoutGeometryMap.h
@@ -38,7 +38,7 @@
 
 namespace blink {
 
-class DeprecatedPaintLayer;
+class PaintLayer;
 class LayoutBoxModelObject;
 class TransformationMatrix;
 class TransformState;
@@ -65,8 +65,8 @@
     FloatQuad mapToContainer(const FloatRect&, const LayoutBoxModelObject*) const;
 
     // Called by code walking the layout or layer trees.
-    void pushMappingsToAncestor(const DeprecatedPaintLayer*, const DeprecatedPaintLayer* ancestorLayer);
-    void popMappingsToAncestor(const DeprecatedPaintLayer*);
+    void pushMappingsToAncestor(const PaintLayer*, const PaintLayer* ancestorLayer);
+    void popMappingsToAncestor(const PaintLayer*);
     void pushMappingsToAncestor(const LayoutObject*, const LayoutBoxModelObject* ancestorLayoutObject);
     void popMappingsToAncestor(const LayoutBoxModelObject*);
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
index ea88af2..0369b67 100644
--- a/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutGrid.cpp
@@ -28,8 +28,8 @@
 
 #include "core/layout/LayoutView.h"
 #include "core/layout/TextAutosizer.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/GridPainter.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ComputedStyle.h"
 #include "core/style/GridCoordinate.h"
 #include "platform/LengthFunctions.h"
@@ -1366,7 +1366,7 @@
     ASSERT(child.isOutOfFlowPositioned());
     child.containingBlock()->insertPositionedObject(&child);
 
-    DeprecatedPaintLayer* childLayer = child.layer();
+    PaintLayer* childLayer = child.layer();
     childLayer->setStaticInlinePosition(borderAndPaddingStart());
     childLayer->setStaticBlockPosition(borderAndPaddingBefore());
 }
@@ -1445,7 +1445,7 @@
 
     if (child.parent() == this && !startIsAuto) {
         // If column/row start is "auto" the static position has been already set in prepareChildForPositionedLayout().
-        DeprecatedPaintLayer* childLayer = child.layer();
+        PaintLayer* childLayer = child.layer();
         if (direction == ForColumns)
             childLayer->setStaticInlinePosition(borderStart() + offset);
         else
@@ -1793,10 +1793,17 @@
     return GridAxisStart;
 }
 
+static inline LayoutUnit offsetBetweenTracks(ContentDistributionType distribution, const Vector<LayoutUnit>& trackPositions, const LayoutUnit& childBreadth)
+{
+    return (distribution == ContentDistributionStretch || ContentDistributionStretch == ContentDistributionDefault) ? LayoutUnit() : trackPositions[1] - trackPositions[0] - childBreadth;
+
+}
+
 LayoutUnit LayoutGrid::columnAxisOffsetForChild(const LayoutBox& child) const
 {
     const GridCoordinate& coordinate = cachedGridCoordinate(child);
-    LayoutUnit startOfRow = m_rowPositions[coordinate.rows.resolvedInitialPosition.toInt()];
+    size_t childStartLine = coordinate.rows.resolvedInitialPosition.toInt();
+    LayoutUnit startOfRow = m_rowPositions[childStartLine];
     LayoutUnit startPosition = startOfRow + marginBeforeForChild(child);
     if (hasAutoMarginsInColumnAxis(child))
         return startPosition;
@@ -1806,8 +1813,12 @@
         return startPosition;
     case GridAxisEnd:
     case GridAxisCenter: {
-        LayoutUnit endOfRow = m_rowPositions[coordinate.rows.resolvedFinalPosition.next().toInt()];
-        LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(child.styleRef().alignSelfOverflowAlignment(), endOfRow - startOfRow, child.logicalHeight() + child.marginLogicalHeight());
+        size_t childEndLine = coordinate.rows.resolvedFinalPosition.next().toInt();
+        LayoutUnit endOfRow = m_rowPositions[childEndLine];
+        LayoutUnit childBreadth = child.logicalHeight() + child.marginLogicalHeight();
+        if (childEndLine - childStartLine > 1 && childEndLine < m_rowPositions.size() - 1)
+            endOfRow -= offsetBetweenTracks(styleRef().alignContentDistribution(), m_rowPositions, childBreadth);
+        LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(child.styleRef().alignSelfOverflowAlignment(), endOfRow - startOfRow, childBreadth);
         return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPosition : offsetFromStartPosition / 2);
     }
     }
@@ -1819,7 +1830,8 @@
 LayoutUnit LayoutGrid::rowAxisOffsetForChild(const LayoutBox& child) const
 {
     const GridCoordinate& coordinate = cachedGridCoordinate(child);
-    LayoutUnit startOfColumn = m_columnPositions[coordinate.columns.resolvedInitialPosition.toInt()];
+    size_t childStartLine = coordinate.columns.resolvedInitialPosition.toInt();
+    LayoutUnit startOfColumn = m_columnPositions[childStartLine];
     LayoutUnit startPosition = startOfColumn + marginStartForChild(child);
     if (hasAutoMarginsInRowAxis(child))
         return startPosition;
@@ -1829,8 +1841,12 @@
         return startPosition;
     case GridAxisEnd:
     case GridAxisCenter: {
-        LayoutUnit endOfColumn = m_columnPositions[coordinate.columns.resolvedFinalPosition.next().toInt()];
-        LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(child.styleRef().justifySelfOverflowAlignment(), endOfColumn - startOfColumn, child.logicalWidth() + child.marginLogicalWidth());
+        size_t childEndLine = coordinate.columns.resolvedFinalPosition.next().toInt();
+        LayoutUnit endOfColumn = m_columnPositions[childEndLine];
+        LayoutUnit childBreadth = child.logicalWidth() + child.marginLogicalWidth();
+        if (childEndLine - childStartLine > 1 && childEndLine < m_columnPositions.size() - 1)
+            endOfColumn -= offsetBetweenTracks(styleRef().justifyContentDistribution(), m_columnPositions, childBreadth);
+        LayoutUnit offsetFromStartPosition = computeOverflowAlignmentOffset(child.styleRef().justifySelfOverflowAlignment(), endOfColumn - startOfColumn, childBreadth);
         return startPosition + (axisPosition == GridAxisEnd ? offsetFromStartPosition : offsetFromStartPosition / 2);
     }
     }
diff --git a/third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.cpp b/third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.cpp
index bf13abb..bfeda78e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.cpp
@@ -43,9 +43,9 @@
     view()->frameView()->setIsVisuallyNonEmpty();
 }
 
-DeprecatedPaintLayerType LayoutHTMLCanvas::layerTypeRequired() const
+PaintLayerType LayoutHTMLCanvas::layerTypeRequired() const
 {
-    return NormalDeprecatedPaintLayer;
+    return NormalPaintLayer;
 }
 
 void LayoutHTMLCanvas::paintReplaced(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
diff --git a/third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.h b/third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.h
index 360d243..204a706 100644
--- a/third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.h
+++ b/third_party/WebKit/Source/core/layout/LayoutHTMLCanvas.h
@@ -37,7 +37,7 @@
     explicit LayoutHTMLCanvas(HTMLCanvasElement*);
 
     bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectCanvas || LayoutReplaced::isOfType(type); }
-    DeprecatedPaintLayerType layerTypeRequired() const override;
+    PaintLayerType layerTypeRequired() const override;
     PaintInvalidationReason invalidatePaintIfNeeded(PaintInvalidationState&, const LayoutBoxModelObject&) final;
 
     void canvasSizeChanged();
diff --git a/third_party/WebKit/Source/core/layout/LayoutIFrame.cpp b/third_party/WebKit/Source/core/layout/LayoutIFrame.cpp
index 43291a6..69a2439e 100644
--- a/third_party/WebKit/Source/core/layout/LayoutIFrame.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutIFrame.cpp
@@ -52,10 +52,10 @@
     return isInline();
 }
 
-DeprecatedPaintLayerType LayoutIFrame::layerTypeRequired() const
+PaintLayerType LayoutIFrame::layerTypeRequired() const
 {
     if (style()->resize() != RESIZE_NONE)
-        return NormalDeprecatedPaintLayer;
+        return NormalPaintLayer;
     return LayoutPart::layerTypeRequired();
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutIFrame.h b/third_party/WebKit/Source/core/layout/LayoutIFrame.h
index 8945bd6..5697818 100644
--- a/third_party/WebKit/Source/core/layout/LayoutIFrame.h
+++ b/third_party/WebKit/Source/core/layout/LayoutIFrame.h
@@ -44,7 +44,7 @@
 
     bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutIFrame || LayoutPart::isOfType(type); }
 
-    DeprecatedPaintLayerType layerTypeRequired() const override;
+    PaintLayerType layerTypeRequired() const override;
 };
 
 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutIFrame, isLayoutIFrame());
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.cpp b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
index 1d818bcea..201e54de 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.cpp
@@ -35,9 +35,9 @@
 #include "core/layout/api/LineLayoutBoxModel.h"
 #include "core/layout/line/InlineTextBox.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/InlinePainter.h"
 #include "core/paint/ObjectPainter.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/StyleInheritedData.h"
 #include "platform/geometry/FloatQuad.h"
 #include "platform/geometry/Region.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutInline.h b/third_party/WebKit/Source/core/layout/LayoutInline.h
index f96615f..3e14907c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutInline.h
+++ b/third_party/WebKit/Source/core/layout/LayoutInline.h
@@ -173,7 +173,7 @@
 
     bool nodeAtPoint(HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction) final;
 
-    DeprecatedPaintLayerType layerTypeRequired() const override { return isInFlowPositioned() || createsGroup() || hasClipPath() || style()->shouldCompositeForCurrentAnimations() || style()->hasCompositorProxy() ? NormalDeprecatedPaintLayer : NoDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const override { return isInFlowPositioned() || createsGroup() || hasClipPath() || style()->shouldCompositeForCurrentAnimations() || style()->hasCompositorProxy() ? NormalPaintLayer : NoPaintLayer; }
 
     LayoutUnit offsetLeft() const final;
     LayoutUnit offsetTop() const final;
diff --git a/third_party/WebKit/Source/core/layout/LayoutListBox.cpp b/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
index 30b18961..220924ec 100644
--- a/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
@@ -54,7 +54,7 @@
 #include "core/page/FocusController.h"
 #include "core/page/Page.h"
 #include "core/page/SpatialNavigation.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/fonts/FontCache.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/text/BidiTextRun.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
index 8794eb9..e440119 100644
--- a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
@@ -29,8 +29,8 @@
 #include "core/layout/LayoutAnalyzer.h"
 #include "core/layout/LayoutListItem.h"
 #include "core/layout/TextRunConstructor.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/ListMarkerPainter.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/fonts/Font.h"
 #include "wtf/text/StringBuilder.h"
 
@@ -1468,7 +1468,7 @@
     mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0);
     // FIXME: groupedMapping() leaks the squashing abstraction.
     if (paintInvalidationContainer->layer()->groupedMapping())
-        DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
+        PaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
     return rect;
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutMedia.h b/third_party/WebKit/Source/core/layout/LayoutMedia.h
index b5556f0..819cf2f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMedia.h
+++ b/third_party/WebKit/Source/core/layout/LayoutMedia.h
@@ -60,7 +60,7 @@
     LayoutObjectChildList* virtualChildren() final { return children(); }
     const LayoutObjectChildList* virtualChildren() const final { return children(); }
 
-    DeprecatedPaintLayerType layerTypeRequired() const override { return NormalDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const override { return NormalPaintLayer; }
 
     bool canHaveChildren() const final { return true; }
     bool isChildAllowed(LayoutObject*, const ComputedStyle&) const final;
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
index 55e2cf85..e00045d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.cpp
@@ -329,7 +329,7 @@
     return result;
 }
 
-void LayoutMultiColumnSet::collectLayerFragments(DeprecatedPaintLayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect)
+void LayoutMultiColumnSet::collectLayerFragments(PaintLayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect)
 {
     for (const auto& group : m_fragmentainerGroups)
         group.collectLayerFragments(fragments, layerBoundingBox, dirtyRect);
diff --git a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.h b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.h
index 45e9fd2d..85823f3a 100644
--- a/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.h
+++ b/third_party/WebKit/Source/core/layout/LayoutMultiColumnSet.h
@@ -153,7 +153,7 @@
 
     LayoutRect fragmentsBoundingBox(const LayoutRect& boundingBoxInFlowThread) const;
 
-    void collectLayerFragments(DeprecatedPaintLayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect);
+    void collectLayerFragments(PaintLayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect);
 
     LayoutUnit columnGap() const;
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.cpp b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
index ecb1ccd..65c242af 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.cpp
@@ -72,11 +72,11 @@
 #include "core/layout/LayoutTableRow.h"
 #include "core/layout/LayoutTheme.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/AutoscrollController.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/ObjectPainter.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ContentData.h"
 #include "core/style/ShadowList.h"
 #include "platform/JSONValues.h"
@@ -515,8 +515,8 @@
     return r;
 }
 
-static void addLayers(LayoutObject* obj, DeprecatedPaintLayer* parentLayer, LayoutObject*& newObject,
-    DeprecatedPaintLayer*& beforeChild)
+static void addLayers(LayoutObject* obj, PaintLayer* parentLayer, LayoutObject*& newObject,
+    PaintLayer*& beforeChild)
 {
     if (obj->hasLayer()) {
         if (!beforeChild && newObject) {
@@ -534,17 +534,17 @@
         addLayers(curr, parentLayer, newObject, beforeChild);
 }
 
-void LayoutObject::addLayers(DeprecatedPaintLayer* parentLayer)
+void LayoutObject::addLayers(PaintLayer* parentLayer)
 {
     if (!parentLayer)
         return;
 
     LayoutObject* object = this;
-    DeprecatedPaintLayer* beforeChild = nullptr;
+    PaintLayer* beforeChild = nullptr;
     blink::addLayers(this, parentLayer, object, beforeChild);
 }
 
-void LayoutObject::removeLayers(DeprecatedPaintLayer* parentLayer)
+void LayoutObject::removeLayers(PaintLayer* parentLayer)
 {
     if (!parentLayer)
         return;
@@ -558,13 +558,13 @@
         curr->removeLayers(parentLayer);
 }
 
-void LayoutObject::moveLayers(DeprecatedPaintLayer* oldParent, DeprecatedPaintLayer* newParent)
+void LayoutObject::moveLayers(PaintLayer* oldParent, PaintLayer* newParent)
 {
     if (!newParent)
         return;
 
     if (hasLayer()) {
-        DeprecatedPaintLayer* layer = toLayoutBoxModelObject(this)->layer();
+        PaintLayer* layer = toLayoutBoxModelObject(this)->layer();
         ASSERT(oldParent == layer->parent());
         if (oldParent)
             oldParent->removeChild(layer);
@@ -576,14 +576,14 @@
         curr->moveLayers(oldParent, newParent);
 }
 
-DeprecatedPaintLayer* LayoutObject::findNextLayer(DeprecatedPaintLayer* parentLayer, LayoutObject* startPoint, bool checkParent)
+PaintLayer* LayoutObject::findNextLayer(PaintLayer* parentLayer, LayoutObject* startPoint, bool checkParent)
 {
     // Error check the parent layer passed in. If it's null, we can't find anything.
     if (!parentLayer)
         return 0;
 
     // Step 1: If our layer is a child of the desired parent, then return our layer.
-    DeprecatedPaintLayer* ourLayer = hasLayer() ? toLayoutBoxModelObject(this)->layer() : nullptr;
+    PaintLayer* ourLayer = hasLayer() ? toLayoutBoxModelObject(this)->layer() : nullptr;
     if (ourLayer && ourLayer->parent() == parentLayer)
         return ourLayer;
 
@@ -592,7 +592,7 @@
     if (!ourLayer || ourLayer == parentLayer) {
         for (LayoutObject* curr = startPoint ? startPoint->nextSibling() : slowFirstChild();
             curr; curr = curr->nextSibling()) {
-            DeprecatedPaintLayer* nextLayer = curr->findNextLayer(parentLayer, nullptr, false);
+            PaintLayer* nextLayer = curr->findNextLayer(parentLayer, nullptr, false);
             if (nextLayer)
                 return nextLayer;
         }
@@ -611,7 +611,7 @@
     return nullptr;
 }
 
-DeprecatedPaintLayer* LayoutObject::enclosingLayer() const
+PaintLayer* LayoutObject::enclosingLayer() const
 {
     for (const LayoutObject* current = this; current; current = current->parent()) {
         if (current->hasLayer())
@@ -1075,7 +1075,7 @@
     // FIXME: CompositingState is not necessarily up to date for many callers of this function.
     DisableCompositingQueryAsserts disabler;
 
-    if (DeprecatedPaintLayer* compositingLayer = enclosingLayer()->enclosingLayerForPaintInvalidationCrossingFrameBoundaries())
+    if (PaintLayer* compositingLayer = enclosingLayer()->enclosingLayerForPaintInvalidationCrossingFrameBoundaries())
         container = compositingLayer->layoutObject();
     return container;
 }
@@ -1195,10 +1195,10 @@
 void LayoutObject::invalidateDisplayItemClient(const DisplayItemClientWrapper& displayItemClient) const
 {
     // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree.
-    if (DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer()) {
+    if (PaintLayer* enclosingLayer = this->enclosingLayer()) {
         // This is valid because we want to invalidate the client in the display item list of the current backing.
         DisableCompositingQueryAsserts disabler;
-        if (const DeprecatedPaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerForPaintInvalidationCrossingFrameBoundaries())
+        if (const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerForPaintInvalidationCrossingFrameBoundaries())
             paintInvalidationLayer->layoutObject()->invalidateDisplayItemClientOnBacking(displayItemClient);
 
         enclosingLayer->setNeedsRepaint();
@@ -1209,7 +1209,7 @@
 {
     paintInvalidationContainer.invalidateDisplayItemClientOnBacking(*this);
 
-    if (DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer())
+    if (PaintLayer* enclosingLayer = this->enclosingLayer())
         enclosingLayer->setNeedsRepaint();
 }
 
@@ -1217,7 +1217,7 @@
 {
     if (!paintInvalidationContainer)
         return computePaintInvalidationRect(paintInvalidationContainer, paintInvalidationState);
-    return DeprecatedPaintLayer::computePaintInvalidationRect(this, paintInvalidationContainer->layer(), paintInvalidationState);
+    return PaintLayer::computePaintInvalidationRect(this, paintInvalidationContainer->layer(), paintInvalidationState);
 }
 
 const LayoutBoxModelObject* LayoutObject::invalidatePaintRectangleInternal(const LayoutRect& r) const
@@ -1233,7 +1233,7 @@
     LayoutRect dirtyRect(r);
 
     const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidationOnRootedTree();
-    DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContainer, dirtyRect);
+    PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContainer, dirtyRect);
     invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintInvalidationRectangle);
     return &paintInvalidationContainer;
 }
@@ -1346,7 +1346,7 @@
     const LayoutRect oldBounds = previousPaintInvalidationRect();
     const LayoutPoint oldLocation = RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() ? LayoutPoint() : previousPositionFromPaintInvalidationBacking();
     LayoutRect newBounds = boundsRectForPaintInvalidation(&paintInvalidationContainer, &paintInvalidationState);
-    LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() ? LayoutPoint() : DeprecatedPaintLayer::positionFromPaintInvalidationBacking(this, &paintInvalidationContainer, &paintInvalidationState);
+    LayoutPoint newLocation = RuntimeEnabledFeatures::slimmingPaintOffsetCachingEnabled() ? LayoutPoint() : PaintLayer::positionFromPaintInvalidationBacking(this, &paintInvalidationContainer, &paintInvalidationState);
 
     // Composited scrolling should not be included in the bounds and position tracking, because the graphics layer backing the scroller
     // does not move on scroll.
@@ -1719,14 +1719,14 @@
 
     // If filter changed, and the layer does not paint into its own separate backing or it paints with filters, then we need to invalidate paints.
     if (diff.filterChanged() && hasLayer()) {
-        DeprecatedPaintLayer* layer = toLayoutBoxModelObject(this)->layer();
+        PaintLayer* layer = toLayoutBoxModelObject(this)->layer();
         if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paintsWithFilters())
             diff.setNeedsPaintInvalidationLayer();
     }
 
     // If backdrop filter changed, and the layer does not paint into its own separate backing or it paints with filters, then we need to invalidate paints.
     if (diff.backdropFilterChanged() && hasLayer()) {
-        DeprecatedPaintLayer* layer = toLayoutBoxModelObject(this)->layer();
+        PaintLayer* layer = toLayoutBoxModelObject(this)->layer();
         if (!layer->hasStyleDeterminedDirectCompositingReasons() || layer->paintsWithBackdropFilters())
             diff.setNeedsPaintInvalidationLayer();
     }
@@ -1737,7 +1737,9 @@
             || style()->isBackgroundColorCurrentColor()
             // Skip any text nodes that do not contain text boxes. Whitespace cannot be
             // skipped or we will miss invalidating decorations (e.g., underlines).
-            || (isText() && !isBR() && toLayoutText(this)->hasTextBoxes()))
+            || (isText() && !isBR() && toLayoutText(this)->hasTextBoxes())
+            // Caret is painted in text color.
+            || (isLayoutBlock() && toLayoutBlock(this)->hasCaret()))
             diff.setNeedsPaintInvalidationObject();
     }
 
@@ -1745,7 +1747,7 @@
     // style changing, since it depends on whether we decide to composite these elements. When the
     // layer status of one of these elements changes, we need to force a layout.
     if (!diff.needsFullLayout() && style() && isBoxModelObject()) {
-        bool requiresLayer = toLayoutBoxModelObject(this)->layerTypeRequired() != NoDeprecatedPaintLayer;
+        bool requiresLayer = toLayoutBoxModelObject(this)->layerTypeRequired() != NoPaintLayer;
         if (hasLayer() != requiresLayer)
             diff.setNeedsFullLayout();
     }
@@ -1897,7 +1899,7 @@
         // Keep layer hierarchy visibility bits up to date if visibility changes.
         if (m_style->visibility() != newStyle.visibility()) {
             // We might not have an enclosing layer yet because we might not be in the tree.
-            if (DeprecatedPaintLayer* layer = enclosingLayer())
+            if (PaintLayer* layer = enclosingLayer())
                 layer->potentiallyDirtyVisibleContentStatus(newStyle.visibility());
         }
 
@@ -2137,7 +2139,7 @@
 {
     transform.makeIdentity();
     transform.translate(offsetInContainer.width().toFloat(), offsetInContainer.height().toFloat());
-    DeprecatedPaintLayer* layer = hasLayer() ? toLayoutBoxModelObject(this)->layer() : 0;
+    PaintLayer* layer = hasLayer() ? toLayoutBoxModelObject(this)->layer() : 0;
     if (layer && layer->transform())
         transform.multiply(layer->currentTransform());
 
@@ -2175,7 +2177,7 @@
     return transformState.lastPlanarPoint();
 }
 
-FloatPoint LayoutObject::localToInvalidationBackingPoint(const LayoutPoint& localPoint, DeprecatedPaintLayer** backingLayer)
+FloatPoint LayoutObject::localToInvalidationBackingPoint(const LayoutPoint& localPoint, PaintLayer** backingLayer)
 {
     const LayoutBoxModelObject& paintInvalidationContainer = containerForPaintInvalidationOnRootedTree();
     ASSERT(paintInvalidationContainer.layer());
@@ -2189,7 +2191,7 @@
     if (paintInvalidationContainer.layer()->compositingState() == NotComposited)
         return containerPoint;
 
-    DeprecatedPaintLayer::mapPointToPaintBackingCoordinates(&paintInvalidationContainer, containerPoint);
+    PaintLayer::mapPointToPaintBackingCoordinates(&paintInvalidationContainer, containerPoint);
     return containerPoint;
 }
 
@@ -2244,7 +2246,7 @@
     // Figure out what layer our container is in. Any offset (or new layer) for this
     // layoutObject within it's container will be applied in addLayerHitTestRects.
     LayoutPoint layerOffset;
-    const DeprecatedPaintLayer* currentLayer = nullptr;
+    const PaintLayer* currentLayer = nullptr;
 
     if (!hasLayer()) {
         LayoutObject* container = this->container();
@@ -2262,7 +2264,7 @@
     this->addLayerHitTestRects(layerRects, currentLayer, layerOffset, LayoutRect());
 }
 
-void LayoutObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const DeprecatedPaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
+void LayoutObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
 {
     ASSERT(currentLayer);
     ASSERT(currentLayer == this->enclosingLayer());
@@ -2501,7 +2503,7 @@
 
     // Keep our layer hierarchy updated. Optimize for the common case where we don't have any children
     // and don't have a layer attached to ourselves.
-    DeprecatedPaintLayer* layer = nullptr;
+    PaintLayer* layer = nullptr;
     if (slowFirstChild() || hasLayer()) {
         layer = parent()->enclosingLayer();
         addLayers(layer);
@@ -2528,7 +2530,7 @@
     // FIXME: We should ASSERT(isRooted()) but we have some out-of-order removals which would need to be fixed first.
 
     // If we remove a visible child from an invisible parent, we don't know the layer visibility any more.
-    DeprecatedPaintLayer* layer = nullptr;
+    PaintLayer* layer = nullptr;
     if (parent()->style()->visibility() != VISIBLE && style()->visibility() == VISIBLE && !hasLayer()) {
         layer = parent()->enclosingLayer();
         if (layer)
@@ -3168,7 +3170,7 @@
     // means we won't skip painting of the whole layer with a CachedSubsequenceDisplayItem.
     // This is to ensure we'll check paint offset changes of the objects on the layer.
     // We'll still use cached display items for non-invalidated objects on the layer.
-    if (DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer())
+    if (PaintLayer* enclosingLayer = this->enclosingLayer())
         enclosingLayer->setNeedsRepaint();
 
     for (LayoutObject* container = this->containerCrossingFrameBoundaries(); container && !container->shouldCheckForPaintInvalidationRegardlessOfPaintInvalidationState(); container = container->containerCrossingFrameBoundaries())
@@ -3314,13 +3316,13 @@
 void LayoutObject::invalidateDisplayItemClientForNonCompositingDescendantsOf(const LayoutObject& object) const
 {
     // Not using enclosingCompositedContainer() directly because this object may be in an orphaned subtree.
-    const DeprecatedPaintLayer* enclosingLayer = this->enclosingLayer();
+    const PaintLayer* enclosingLayer = this->enclosingLayer();
     if (!enclosingLayer)
         return;
 
     // This is valid because we want to invalidate the client in the display item list of the current backing.
     DisableCompositingQueryAsserts disabler;
-    const DeprecatedPaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
+    const PaintLayer* paintInvalidationLayer = enclosingLayer->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
     if (!paintInvalidationLayer)
         return;
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutObject.h b/third_party/WebKit/Source/core/layout/LayoutObject.h
index 59858bbf..e97e1a1c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObject.h
+++ b/third_party/WebKit/Source/core/layout/LayoutObject.h
@@ -65,7 +65,7 @@
 class LayoutBlock;
 class LayoutFlowThread;
 class LayoutGeometryMap;
-class DeprecatedPaintLayer;
+class PaintLayer;
 class LayoutMultiColumnSpannerPlaceholder;
 class LayoutView;
 class TransformState;
@@ -110,7 +110,7 @@
     bool draggable;
 };
 
-typedef WTF::HashMap<const DeprecatedPaintLayer*, Vector<LayoutRect>> LayerHitTestRects;
+typedef WTF::HashMap<const PaintLayer*, Vector<LayoutRect>> LayerHitTestRects;
 
 #ifndef NDEBUG
 const int showTreeCharacterOffset = 39;
@@ -210,11 +210,11 @@
     // The following six functions are used when the layout tree hierarchy changes to make sure layers get
     // properly added and removed.  Since containership can be implemented by any subclass, and since a hierarchy
     // can contain a mixture of boxes and other object types, these functions need to be in the base class.
-    DeprecatedPaintLayer* enclosingLayer() const;
-    void addLayers(DeprecatedPaintLayer* parentLayer);
-    void removeLayers(DeprecatedPaintLayer* parentLayer);
-    void moveLayers(DeprecatedPaintLayer* oldParent, DeprecatedPaintLayer* newParent);
-    DeprecatedPaintLayer* findNextLayer(DeprecatedPaintLayer* parentLayer, LayoutObject* startPoint, bool checkParent = true);
+    PaintLayer* enclosingLayer() const;
+    void addLayers(PaintLayer* parentLayer);
+    void removeLayers(PaintLayer* parentLayer);
+    void moveLayers(PaintLayer* oldParent, PaintLayer* newParent);
+    PaintLayer* findNextLayer(PaintLayer* parentLayer, LayoutObject* startPoint, bool checkParent = true);
 
     // Scrolling is a LayoutBox concept, however some code just cares about recursively scrolling our enclosing ScrollableArea(s).
     bool scrollRectToVisible(const LayoutRect&, const ScrollAlignment& alignX = ScrollAlignment::alignCenterIfNeeded, const ScrollAlignment& alignY = ScrollAlignment::alignCenterIfNeeded);
@@ -882,7 +882,7 @@
     FloatPoint localToContainerPoint(const FloatPoint&, const LayoutBoxModelObject* paintInvalidationContainer, MapCoordinatesFlags = 0, bool* wasFixed = nullptr, const PaintInvalidationState* = nullptr) const;
 
     // Convert a local point into the coordinate system of backing coordinates. Also returns the backing layer if needed.
-    FloatPoint localToInvalidationBackingPoint(const LayoutPoint&, DeprecatedPaintLayer** backingLayer = nullptr);
+    FloatPoint localToInvalidationBackingPoint(const LayoutPoint&, PaintLayer** backingLayer = nullptr);
 
     // Return the offset from the container() layoutObject (excluding transforms). In multi-column layout,
     // different offsets apply at different points, so return the offset that applies to the given point.
@@ -1336,7 +1336,7 @@
     // containerRect is a rect that has already been added for the currentLayer which is likely to
     // be a container for child elements. Any rect wholly contained by containerRect can be
     // skipped.
-    virtual void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const;
+    virtual void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const;
 
     // Add hit-test rects for this layoutObject only to the provided list. layerOffset is the offset
     // of this layoutObject within the current layer that should be used for each result.
diff --git a/third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp b/third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp
index 6b536d8..81b0251f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutObjectChildList.cpp
@@ -31,7 +31,7 @@
 #include "core/layout/LayoutCounter.h"
 #include "core/layout/LayoutObject.h"
 #include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ComputedStyle.h"
 
 namespace blink {
diff --git a/third_party/WebKit/Source/core/layout/LayoutPart.cpp b/third_party/WebKit/Source/core/layout/LayoutPart.cpp
index 2c88320d..c8f01f9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutPart.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutPart.cpp
@@ -34,7 +34,7 @@
 #include "core/layout/LayoutView.h"
 #include "core/layout/svg/LayoutSVGRoot.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/PartPainter.h"
 #include "core/plugins/PluginView.h"
 
@@ -105,12 +105,12 @@
     return nullptr;
 }
 
-DeprecatedPaintLayerType LayoutPart::layerTypeRequired() const
+PaintLayerType LayoutPart::layerTypeRequired() const
 {
-    DeprecatedPaintLayerType type = LayoutReplaced::layerTypeRequired();
-    if (type != NoDeprecatedPaintLayer)
+    PaintLayerType type = LayoutReplaced::layerTypeRequired();
+    if (type != NoPaintLayer)
         return type;
-    return ForcedDeprecatedPaintLayer;
+    return ForcedPaintLayer;
 }
 
 bool LayoutPart::requiresAcceleratedCompositing() const
diff --git a/third_party/WebKit/Source/core/layout/LayoutPart.h b/third_party/WebKit/Source/core/layout/LayoutPart.h
index 237519c..39a834c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutPart.h
+++ b/third_party/WebKit/Source/core/layout/LayoutPart.h
@@ -55,7 +55,7 @@
     virtual void paintContents(const PaintInfo&, const LayoutPoint&) const;
 
 protected:
-    DeprecatedPaintLayerType layerTypeRequired() const override;
+    PaintLayerType layerTypeRequired() const override;
 
     void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) final;
     void layout() override;
diff --git a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp
index df06e903..06003e4 100644
--- a/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutReplaced.cpp
@@ -29,8 +29,8 @@
 #include "core/layout/LayoutBlock.h"
 #include "core/layout/LayoutImage.h"
 #include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/ReplacedPainter.h"
 #include "platform/LengthFunctions.h"
 
@@ -445,7 +445,7 @@
     mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0);
     // FIXME: groupedMapping() leaks the squashing abstraction.
     if (paintInvalidationContainer->layer()->groupedMapping())
-        DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
+        PaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
     return rect;
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutReplica.h b/third_party/WebKit/Source/core/layout/LayoutReplica.h
index 563030c..6bf658d 100644
--- a/third_party/WebKit/Source/core/layout/LayoutReplica.h
+++ b/third_party/WebKit/Source/core/layout/LayoutReplica.h
@@ -40,7 +40,7 @@
 
     const char* name() const override { return "LayoutReplica"; }
 
-    DeprecatedPaintLayerType layerTypeRequired() const override { return NormalDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const override { return NormalPaintLayer; }
 
     void layout() override;
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutScrollbarPart.h b/third_party/WebKit/Source/core/layout/LayoutScrollbarPart.h
index 970cefe1a..f0f9f98 100644
--- a/third_party/WebKit/Source/core/layout/LayoutScrollbarPart.h
+++ b/third_party/WebKit/Source/core/layout/LayoutScrollbarPart.h
@@ -40,7 +40,7 @@
 
     const char* name() const override { return "LayoutScrollbarPart"; }
 
-    DeprecatedPaintLayerType layerTypeRequired() const override { return NoDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const override { return NoPaintLayer; }
 
     void layout() override;
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
index 8a85ea6..458f732 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp
@@ -42,7 +42,7 @@
 #include "core/layout/TableLayoutAlgorithmFixed.h"
 #include "core/layout/TextAutosizer.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/TablePainter.h"
 #include "core/style/StyleInheritedData.h"
 
@@ -55,7 +55,6 @@
     , m_head(nullptr)
     , m_foot(nullptr)
     , m_firstBody(nullptr)
-    , m_currentBorder(nullptr)
     , m_collapsedBordersValid(false)
     , m_hasColElements(false)
     , m_needsSectionRecalc(false)
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.h b/third_party/WebKit/Source/core/layout/LayoutTable.h
index 84ac080..4c0bc038 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.h
@@ -304,10 +304,6 @@
     typedef Vector<CollapsedBorderValue> CollapsedBorderValues;
     void invalidateCollapsedBorders();
 
-    // TODO(wangxianzhu): This method should be moved into TablePainter.
-    const CollapsedBorderValue* currentBorderValue() const { return m_currentBorder; }
-    void setCurrentBorderValue(const CollapsedBorderValue* val) const { m_currentBorder = val; }
-
     bool hasSections() const { return m_head || m_foot || m_firstBody; }
 
     void recalcSectionsIfNeeded() const
@@ -384,9 +380,9 @@
 
     void recalcCollapsedBordersIfNeeded();
 
-    // TODO(layout-dev): All mutables in this class (except for m_currentBorder) are lazily updated by recalcSections()
-    // which is called by various getter methods (e.g. borderBefore(), borderAfter()). They allow dirty layout even after
-    // DocumentLifecycle::LayoutClean which seems not proper. crbug.com/538236.
+    // TODO(layout-dev): All mutables in this class are lazily updated by recalcSections()
+    // which is called by various getter methods (e.g. borderBefore(), borderAfter()).
+    // They allow dirty layout even after DocumentLifecycle::LayoutClean which seems not proper. crbug.com/538236.
 
     mutable Vector<int> m_columnPos;
 
@@ -439,9 +435,6 @@
 
     // A sorted list of all unique border values that we want to paint.
     CollapsedBorderValues m_collapsedBorders;
-    // Used by TablePainter during painting.
-    // TODO(wangxianzhu): Move it into painter.
-    mutable const CollapsedBorderValue* m_currentBorder;
     bool m_collapsedBordersValid : 1;
 
     mutable bool m_hasColElements : 1;
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
index 97ec0d8..7ad7ba3f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -160,7 +160,7 @@
     }
 }
 
-void LayoutTableCell::addLayerHitTestRects(LayerHitTestRects& layerRects, const DeprecatedPaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
+void LayoutTableCell::addLayerHitTestRects(LayerHitTestRects& layerRects, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
 {
     LayoutPoint adjustedLayerOffset = layerOffset;
     // LayoutTableCell's location includes the offset of it's containing LayoutTableRow, so
@@ -959,7 +959,7 @@
     // In slimming paint mode, we need to invalidate all cells with collapsed border changed.
     // FIXME: Need a way to invalidate/repaint the borders only. crbug.com/451090#c5.
     if (changed)
-        invalidateDisplayItemClient(*this);
+        table()->invalidateDisplayItemClient(*this);
 
     addBorderStyle(borderValues, startBorder);
     addBorderStyle(borderValues, endBorder);
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.h b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
index 70a15f8..216920f 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
@@ -274,7 +274,7 @@
     void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override;
     void computePreferredLogicalWidths() override;
 
-    void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override;
+    void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override;
 
 private:
     bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); }
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCol.h b/third_party/WebKit/Source/core/layout/LayoutTableCol.h
index 081b432..d580947 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCol.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCol.h
@@ -119,7 +119,7 @@
 
     bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override;
     bool canHaveChildren() const override;
-    DeprecatedPaintLayerType layerTypeRequired() const override { return NoDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const override { return NoPaintLayer; }
 
     LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const override;
     void imageChanged(WrappedImagePtr, const IntRect* = nullptr) override;
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableRow.h b/third_party/WebKit/Source/core/layout/LayoutTableRow.h
index 0240efc2..ab41d03 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableRow.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTableRow.h
@@ -137,15 +137,15 @@
     void addChild(LayoutObject* child, LayoutObject* beforeChild = nullptr) override;
     void layout() override;
 
-    DeprecatedPaintLayerType layerTypeRequired() const override
+    PaintLayerType layerTypeRequired() const override
     {
         if (hasTransformRelatedProperty() || hasHiddenBackface() || hasClipPath() || createsGroup() || style()->shouldCompositeForCurrentAnimations() || style()->hasCompositorProxy())
-            return NormalDeprecatedPaintLayer;
+            return NormalPaintLayer;
 
         if (hasOverflowClip())
-            return OverflowClipDeprecatedPaintLayer;
+            return OverflowClipPaintLayer;
 
-        return NoDeprecatedPaintLayer;
+        return NoPaintLayer;
     }
 
     void paint(const PaintInfo&, const LayoutPoint&) const override;
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.cpp b/third_party/WebKit/Source/core/layout/LayoutText.cpp
index 8b2b885..c709cd6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutText.cpp
@@ -40,7 +40,7 @@
 #include "core/layout/line/EllipsisBox.h"
 #include "core/layout/line/GlyphOverflow.h"
 #include "core/layout/line/InlineTextBox.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/fonts/Character.h"
 #include "platform/fonts/FontCache.h"
 #include "platform/geometry/FloatQuad.h"
@@ -1325,7 +1325,7 @@
     return prev;
 }
 
-void LayoutText::addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
+void LayoutText::addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
 {
     // Text nodes aren't event targets, so don't descend any further.
 }
@@ -1625,7 +1625,7 @@
     mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, 0);
     // FIXME: groupedMapping() leaks the squashing abstraction.
     if (paintInvalidationContainer->layer()->groupedMapping())
-        DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
+        PaintLayer::mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
     return rect;
 }
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.h b/third_party/WebKit/Source/core/layout/LayoutText.h
index 1f9cb6c..a6646c4 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.h
+++ b/third_party/WebKit/Source/core/layout/LayoutText.h
@@ -189,7 +189,7 @@
     virtual void setTextInternal(PassRefPtr<StringImpl>);
     virtual UChar previousCharacter() const;
 
-    void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override;
+    void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const override;
 
     virtual InlineTextBox* createTextBox(int start, unsigned short length); // Subclassed by SVG.
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp
index 99cf347e..b6ce8e2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTextControlSingleLine.cpp
@@ -33,9 +33,9 @@
 #include "core/layout/HitTestResult.h"
 #include "core/layout/LayoutAnalyzer.h"
 #include "core/layout/LayoutTheme.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/ThemePainter.h"
 #include "platform/PlatformKeyboardEvent.h"
 #include "platform/fonts/SimpleFontData.h"
diff --git a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
index 923f251..2f3a4ae9 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp
@@ -44,7 +44,7 @@
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutTableCell.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
 #include "core/layout/line/InlineTextBox.h"
 #include "core/layout/svg/LayoutSVGContainer.h"
 #include "core/layout/svg/LayoutSVGGradientStop.h"
@@ -55,7 +55,7 @@
 #include "core/layout/svg/LayoutSVGText.h"
 #include "core/layout/svg/SVGLayoutTreeAsText.h"
 #include "core/page/PrintContext.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/LayoutUnit.h"
 #include "wtf/HexNumber.h"
 #include "wtf/Vector.h"
@@ -542,7 +542,7 @@
             LayoutView* root = view->layoutView();
             if (root) {
                 root->document().updateLayout();
-                DeprecatedPaintLayer* layer = root->layer();
+                PaintLayer* layer = root->layer();
                 if (layer)
                     LayoutTreeAsText::writeLayers(ts, layer, layer, layer->rect(), indent + 1, behavior);
             }
@@ -556,7 +556,7 @@
     LayerPaintPhaseForeground = 1
 };
 
-static void write(TextStream& ts, DeprecatedPaintLayer& layer,
+static void write(TextStream& ts, PaintLayer& layer,
     const LayoutRect& layerBounds, const LayoutRect& backgroundClipRect, const LayoutRect& clipRect,
     LayerPaintPhase paintPhase = LayerPaintPhaseAll, int indent = 0, LayoutAsTextBehavior behavior = LayoutAsTextBehaviorNormal)
 {
@@ -623,11 +623,11 @@
         ts << " blendMode: " << compositeOperatorName(CompositeSourceOver, layer.layoutObject()->style()->blendMode());
 
     if (behavior & LayoutAsTextShowCompositedLayers) {
-        if (layer.hasCompositedDeprecatedPaintLayerMapping()) {
+        if (layer.hasCompositedLayerMapping()) {
             ts << " (composited, bounds="
-                << layer.compositedDeprecatedPaintLayerMapping()->compositedBounds()
+                << layer.compositedLayerMapping()->compositedBounds()
                 << ", drawsContent="
-                << layer.compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->drawsContent()
+                << layer.compositedLayerMapping()->mainGraphicsLayer()->drawsContent()
                 << (layer.shouldIsolateCompositedDescendants() ? ", isolatesCompositedBlending" : "")
                 << ")";
         }
@@ -639,16 +639,16 @@
         write(ts, *layer.layoutObject(), indent + 1, behavior);
 }
 
-static Vector<DeprecatedPaintLayerStackingNode*> normalFlowListFor(DeprecatedPaintLayerStackingNode* node)
+static Vector<PaintLayerStackingNode*> normalFlowListFor(PaintLayerStackingNode* node)
 {
-    DeprecatedPaintLayerStackingNodeIterator it(*node, NormalFlowChildren);
-    Vector<DeprecatedPaintLayerStackingNode*> vector;
-    while (DeprecatedPaintLayerStackingNode* normalFlowChild = it.next())
+    PaintLayerStackingNodeIterator it(*node, NormalFlowChildren);
+    Vector<PaintLayerStackingNode*> vector;
+    while (PaintLayerStackingNode* normalFlowChild = it.next())
         vector.append(normalFlowChild);
     return vector;
 }
 
-void LayoutTreeAsText::writeLayers(TextStream& ts, const DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* layer,
+void LayoutTreeAsText::writeLayers(TextStream& ts, const PaintLayer* rootLayer, PaintLayer* layer,
     const LayoutRect& paintRect, int indent, LayoutAsTextBehavior behavior)
 {
     // Calculate the clip rects we should use.
@@ -663,7 +663,7 @@
     layer->convertToLayerCoords(rootLayer, offsetFromRoot);
     bool shouldPaint = (behavior & LayoutAsTextShowAllLayers) ? true : layer->intersectsDamageRect(layerBounds, damageRect.rect(), offsetFromRoot);
 
-    Vector<DeprecatedPaintLayerStackingNode*>* negList = layer->stackingNode()->negZOrderList();
+    Vector<PaintLayerStackingNode*>* negList = layer->stackingNode()->negZOrderList();
     bool paintsBackgroundSeparately = negList && negList->size() > 0;
     if (shouldPaint && paintsBackgroundSeparately)
         write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), LayerPaintPhaseBackground, indent, behavior);
@@ -682,7 +682,7 @@
     if (shouldPaint)
         write(ts, *layer, layerBounds, damageRect.rect(), clipRectToApply.rect(), paintsBackgroundSeparately ? LayerPaintPhaseForeground : LayerPaintPhaseAll, indent, behavior);
 
-    Vector<DeprecatedPaintLayerStackingNode*> normalFlowList = normalFlowListFor(layer->stackingNode());
+    Vector<PaintLayerStackingNode*> normalFlowList = normalFlowListFor(layer->stackingNode());
     if (!normalFlowList.isEmpty()) {
         int currIndent = indent;
         if (behavior & LayoutAsTextShowLayerNesting) {
@@ -694,7 +694,7 @@
             writeLayers(ts, rootLayer, normalFlowList.at(i)->layer(), paintRect, currIndent, behavior);
     }
 
-    if (Vector<DeprecatedPaintLayerStackingNode*>* posList = layer->stackingNode()->posZOrderList()) {
+    if (Vector<PaintLayerStackingNode*>* posList = layer->stackingNode()->posZOrderList()) {
         int currIndent = indent;
         if (behavior & LayoutAsTextShowLayerNesting) {
             writeIndent(ts, indent);
@@ -770,7 +770,7 @@
     if (!layoutObject->hasLayer())
         return ts.release();
 
-    DeprecatedPaintLayer* layer = layoutObject->layer();
+    PaintLayer* layer = layoutObject->layer();
     LayoutTreeAsText::writeLayers(ts, layer, layer, layer->rect(), 0, behavior);
     writeSelection(ts, layoutObject);
     return ts.release();
diff --git a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.h b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.h
index a7836e72..ccf1110 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.h
@@ -34,7 +34,7 @@
 namespace blink {
 
 class Color;
-class DeprecatedPaintLayer;
+class PaintLayer;
 class Element;
 class LayoutRect;
 class LocalFrame;
@@ -69,7 +69,7 @@
 // not being done).
 public:
 static void writeLayoutObject(TextStream&, const LayoutObject&, LayoutAsTextBehavior);
-static void writeLayers(TextStream&, const DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer*, const LayoutRect& paintDirtyRect, int indent = 0, LayoutAsTextBehavior = LayoutAsTextBehaviorNormal);
+static void writeLayers(TextStream&, const PaintLayer* rootLayer, PaintLayer*, const LayoutRect& paintDirtyRect, int indent = 0, LayoutAsTextBehavior = LayoutAsTextBehaviorNormal);
 static void writeLineBoxTree(TextStream&, const LayoutBlockFlow&, int indent = 0);
 };
 
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.cpp b/third_party/WebKit/Source/core/layout/LayoutView.cpp
index 7574129..24becc1c6 100644
--- a/third_party/WebKit/Source/core/layout/LayoutView.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutView.cpp
@@ -35,9 +35,9 @@
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutQuote.h"
 #include "core/layout/LayoutScrollbarPart.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/ViewPainter.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "platform/TraceEvent.h"
@@ -83,7 +83,7 @@
 bool LayoutView::hitTest(HitTestResult& result)
 {
     // We have to recursively update layout/style here because otherwise, when the hit test recurses
-    // into a child document, it could trigger a layout on the parent document, which can destroy DeprecatedPaintLayer
+    // into a child document, it could trigger a layout on the parent document, which can destroy PaintLayer
     // that are higher up in the call stack, leading to crashes.
     // Note that Document::updateLayout calls its parent's updateLayout.
     frameView()->updateLifecycleToCompositingCleanPlusScrolling();
@@ -382,7 +382,7 @@
     LayoutRect dirtyRect = viewRect();
     if (doingFullPaintInvalidation() && !dirtyRect.isEmpty()) {
         const LayoutBoxModelObject& paintInvalidationContainer = paintInvalidationState.paintInvalidationContainer();
-        DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContainer, dirtyRect, &paintInvalidationState);
+        PaintLayer::mapRectToPaintInvalidationBacking(this, &paintInvalidationContainer, dirtyRect, &paintInvalidationState);
         invalidatePaintUsingContainer(paintInvalidationContainer, dirtyRect, PaintInvalidationFull);
         invalidateDisplayItemClients(paintInvalidationContainer);
     }
@@ -906,10 +906,10 @@
     return m_compositor && m_compositor->staleInCompositingMode();
 }
 
-DeprecatedPaintLayerCompositor* LayoutView::compositor()
+PaintLayerCompositor* LayoutView::compositor()
 {
     if (!m_compositor)
-        m_compositor = adoptPtr(new DeprecatedPaintLayerCompositor(*this));
+        m_compositor = adoptPtr(new PaintLayerCompositor(*this));
 
     return m_compositor.get();
 }
diff --git a/third_party/WebKit/Source/core/layout/LayoutView.h b/third_party/WebKit/Source/core/layout/LayoutView.h
index cbab821f..0d02f47 100644
--- a/third_party/WebKit/Source/core/layout/LayoutView.h
+++ b/third_party/WebKit/Source/core/layout/LayoutView.h
@@ -38,7 +38,7 @@
 
 namespace blink {
 
-class DeprecatedPaintLayerCompositor;
+class PaintLayerCompositor;
 class LayoutQuote;
 
 // LayoutView is the root of the layout tree and the Document's LayoutObject.
@@ -77,7 +77,7 @@
 
     bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectLayoutView || LayoutBlockFlow::isOfType(type); }
 
-    DeprecatedPaintLayerType layerTypeRequired() const override { return NormalDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const override { return NormalPaintLayer; }
 
     bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override;
 
@@ -157,7 +157,7 @@
     // Notification that this view moved into or out of a native window.
     void setIsInWindow(bool);
 
-    DeprecatedPaintLayerCompositor* compositor();
+    PaintLayerCompositor* compositor();
     bool usesCompositing() const;
 
     // TODO(trchen): All pinch-zoom implementation should now use compositor raster scale based zooming,
@@ -251,7 +251,7 @@
     // See the class comment for more details.
     LayoutState* m_layoutState;
 
-    OwnPtr<DeprecatedPaintLayerCompositor> m_compositor;
+    OwnPtr<PaintLayerCompositor> m_compositor;
     RefPtr<IntervalArena> m_intervalArena;
 
     LayoutQuote* m_layoutQuoteHead;
diff --git a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
index 1c293bd0..8c64788 100644
--- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
+++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.cpp
@@ -227,7 +227,7 @@
     return unionRect(startColumnRect, endColumnRect);
 }
 
-void MultiColumnFragmentainerGroup::collectLayerFragments(DeprecatedPaintLayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect) const
+void MultiColumnFragmentainerGroup::collectLayerFragments(PaintLayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect) const
 {
     // |layerBoundingBox| is in the flow thread coordinate space, relative to the top/left edge of
     // the flow thread, but note that it has been converted with respect to writing mode (so that
@@ -279,14 +279,14 @@
     ASSERT(endColumn >= startColumn);
 
     for (unsigned i = startColumn; i <= endColumn; i++) {
-        DeprecatedPaintLayerFragment fragment;
+        PaintLayerFragment fragment;
 
         // Set the physical translation offset.
         fragment.paginationOffset = toLayoutPoint(flowThreadTranslationAtOffset(logicalTopInFlowThreadAt(i)));
 
         // Set the overflow clip rect that corresponds to the column.
         fragment.paginationClip = flowThreadPortionOverflowRectAt(i);
-        // Flip it into more a physical (DeprecatedPaintLayer-style) rectangle.
+        // Flip it into more a physical (PaintLayer-style) rectangle.
         flowThread->flipForWritingMode(fragment.paginationClip);
 
         fragments.append(fragment);
diff --git a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h
index 1de413e..d78409af 100644
--- a/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h
+++ b/third_party/WebKit/Source/core/layout/MultiColumnFragmentainerGroup.h
@@ -68,7 +68,7 @@
     LayoutPoint visualPointToFlowThreadPoint(const LayoutPoint& visualPoint) const;
     LayoutRect fragmentsBoundingBox(const LayoutRect& boundingBoxInFlowThread) const;
 
-    void collectLayerFragments(DeprecatedPaintLayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect) const;
+    void collectLayerFragments(PaintLayerFragments&, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect) const;
     LayoutRect calculateOverflow() const;
 
     // The "CSS actual" value of column-count. This includes overflowing columns, if any.
diff --git a/third_party/WebKit/Source/core/layout/OverflowModel.h b/third_party/WebKit/Source/core/layout/OverflowModel.h
index 3b93584..cd865d3 100644
--- a/third_party/WebKit/Source/core/layout/OverflowModel.h
+++ b/third_party/WebKit/Source/core/layout/OverflowModel.h
@@ -65,7 +65,7 @@
 // example for this is positioned objects that can be anywhere on the page and
 // could artificially inflate the visual overflow.
 // TODO(jchaffraix): Explain the interaction with the content visual overflow
-// code path (BoxPainter) and DeprecatedPaintLayerClipper.
+// code path (BoxPainter) and PaintLayerClipper.
 //
 // This object is allocated only when some of these fields have non-default
 // values in the owning box. Care should be taken to use LayoutBox adder
diff --git a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
index 3c79090..58fc44f 100644
--- a/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
+++ b/third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp
@@ -9,7 +9,7 @@
 #include "core/layout/LayoutView.h"
 #include "core/layout/svg/LayoutSVGModelObject.h"
 #include "core/layout/svg/LayoutSVGRoot.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 
 namespace blink {
 
diff --git a/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp b/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
index 009e07b..244d9f4 100644
--- a/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
+++ b/third_party/WebKit/Source/core/layout/TableLayoutAlgorithmAuto.cpp
@@ -545,8 +545,9 @@
             } else {
                 numAuto++;
                 totalAuto += m_layoutStruct[i].clampedEffectiveMaxLogicalWidth();
-                allocAuto += cellLogicalWidth;
             }
+            if (!m_layoutStruct[i].columnHasNoCells)
+                allocAuto += cellLogicalWidth;
             break;
         default:
             break;
@@ -593,13 +594,12 @@
     }
 
     // Give each auto width column its share of the available width, non-empty columns then empty columns.
-    if (available > 0 && numAuto) {
+    if (available > 0 && (numAuto || numAutoEmptyCellsOnly)) {
         available += allocAuto;
-        distributeWidthToColumns<float, Auto, NonEmptyCells, InitialWidth, StartToEnd>(available, totalAuto);
-    }
-    if (available > 0 && numAutoEmptyCellsOnly) {
-        unsigned total = numAutoEmptyCellsOnly;
-        distributeWidthToColumns<unsigned, Auto, EmptyCells, InitialWidth, StartToEnd>(available, total);
+        if (numAuto)
+            distributeWidthToColumns<float, Auto, NonEmptyCells, InitialWidth, StartToEnd>(available, totalAuto);
+        if (numAutoEmptyCellsOnly)
+            distributeWidthToColumns<unsigned, Auto, EmptyCells, InitialWidth, StartToEnd>(available, numAutoEmptyCellsOnly);
     }
 
     // Any remaining available width expands fixed width, percent width, and non-empty auto width columns, in that order.
diff --git a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
index 4d2bed9ce..bba07950 100644
--- a/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
+++ b/third_party/WebKit/Source/core/layout/TextAutosizer.cpp
@@ -531,10 +531,7 @@
         if (frame->isRemoteFrame())
             return;
 
-        LocalFrame* mainFrame = m_document->page()->deprecatedLocalMainFrame();
-        if (!mainFrame->view())
-            return;
-
+        LocalFrame* mainFrame = toLocalFrame(frame);
         IntSize frameSize = m_document->settings()->textAutosizingWindowSizeOverride();
         if (frameSize.isEmpty())
             frameSize = windowSize();
diff --git a/third_party/WebKit/Source/core/layout/api/LineLayoutBoxModel.h b/third_party/WebKit/Source/core/layout/api/LineLayoutBoxModel.h
index 2889833..d088a56 100644
--- a/third_party/WebKit/Source/core/layout/api/LineLayoutBoxModel.h
+++ b/third_party/WebKit/Source/core/layout/api/LineLayoutBoxModel.h
@@ -28,7 +28,7 @@
 
     LineLayoutBoxModel() { }
 
-    DeprecatedPaintLayer* layer() const
+    PaintLayer* layer() const
     {
         return toBoxModel()->layer();
     }
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp
deleted file mode 100644
index 2882de0..0000000
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.cpp
+++ /dev/null
@@ -1,2402 +0,0 @@
-/*
- * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-
-#include "core/HTMLNames.h"
-#include "core/dom/DOMNodeIds.h"
-#include "core/fetch/ImageResource.h"
-#include "core/frame/FrameHost.h"
-#include "core/frame/FrameView.h"
-#include "core/frame/RemoteFrame.h"
-#include "core/html/HTMLCanvasElement.h"
-#include "core/html/HTMLIFrameElement.h"
-#include "core/html/HTMLMediaElement.h"
-#include "core/html/HTMLVideoElement.h"
-#include "core/html/canvas/CanvasRenderingContext.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/layout/LayoutEmbeddedObject.h"
-#include "core/layout/LayoutHTMLCanvas.h"
-#include "core/layout/LayoutImage.h"
-#include "core/layout/LayoutPart.h"
-#include "core/layout/LayoutVideo.h"
-#include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/Page.h"
-#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
-#include "core/paint/DeprecatedPaintLayerStackingNodeIterator.h"
-#include "core/paint/ScrollableAreaPainter.h"
-#include "core/paint/TransformRecorder.h"
-#include "core/plugins/PluginView.h"
-#include "platform/LengthFunctions.h"
-#include "platform/RuntimeEnabledFeatures.h"
-#include "platform/fonts/FontCache.h"
-#include "platform/geometry/TransformState.h"
-#include "platform/graphics/BitmapImage.h"
-#include "platform/graphics/GraphicsContext.h"
-#include "platform/graphics/paint/ClipDisplayItem.h"
-#include "platform/graphics/paint/DisplayItemList.h"
-#include "platform/graphics/paint/TransformDisplayItem.h"
-#include "wtf/CurrentTime.h"
-#include "wtf/text/StringBuilder.h"
-
-namespace blink {
-
-using namespace HTMLNames;
-
-static IntRect clipBox(LayoutBox* layoutObject);
-
-static IntRect contentsRect(const LayoutObject* layoutObject)
-{
-    if (!layoutObject->isBox())
-        return IntRect();
-    if (layoutObject->isCanvas())
-        return pixelSnappedIntRect(toLayoutHTMLCanvas(layoutObject)->replacedContentRect());
-    if (layoutObject->isVideo())
-        return toLayoutVideo(layoutObject)->videoBox();
-
-    return pixelSnappedIntRect(toLayoutBox(layoutObject)->contentBoxRect());
-}
-
-static IntRect backgroundRect(const LayoutObject* layoutObject)
-{
-    if (!layoutObject->isBox())
-        return IntRect();
-
-    LayoutRect rect;
-    const LayoutBox* box = toLayoutBox(layoutObject);
-    EFillBox clip = box->style()->backgroundClip();
-    switch (clip) {
-    case BorderFillBox:
-        rect = box->borderBoxRect();
-        break;
-    case PaddingFillBox:
-        rect = box->paddingBoxRect();
-        break;
-    case ContentFillBox:
-        rect = box->contentBoxRect();
-        break;
-    case TextFillBox:
-        break;
-    }
-
-    return pixelSnappedIntRect(rect);
-}
-
-static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject)
-{
-    if (layoutObject->isCanvas()) {
-        HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
-        if (CanvasRenderingContext* context = canvas->renderingContext())
-            return context->isAccelerated();
-    }
-    return false;
-}
-
-static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style)
-{
-    return style.hasBoxDecorations() || style.hasBackgroundImage();
-}
-
-static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject* layoutObject)
-{
-    // No support for decorations - border, border-radius or outline.
-    // Only simple background - solid color or transparent.
-    if (hasBoxDecorationsOrBackgroundImage(layoutObject->styleRef()))
-        return false;
-
-    // If there is no background, there is nothing to support.
-    if (!layoutObject->style()->hasBackground())
-        return true;
-
-    // Simple background that is contained within the contents rect.
-    return contentsRect(layoutObject).contains(backgroundRect(layoutObject));
-}
-
-static WebLayer* platformLayerForPlugin(LayoutObject* layoutObject)
-{
-    if (!layoutObject->isEmbeddedObject())
-        return nullptr;
-    Widget* widget = toLayoutEmbeddedObject(layoutObject)->widget();
-    if (!widget || !widget->isPluginView())
-        return nullptr;
-    return toPluginView(widget)->platformLayer();
-
-}
-
-static inline bool isAcceleratedContents(LayoutObject* layoutObject)
-{
-    return isAcceleratedCanvas(layoutObject)
-        || (layoutObject->isEmbeddedObject() && toLayoutEmbeddedObject(layoutObject)->requiresAcceleratedCompositing())
-        || layoutObject->isVideo();
-}
-
-// Get the scrolling coordinator in a way that works inside CompositedDeprecatedPaintLayerMapping's destructor.
-static ScrollingCoordinator* scrollingCoordinatorFromLayer(DeprecatedPaintLayer& layer)
-{
-    Page* page = layer.layoutObject()->frame()->page();
-    return (!page) ? nullptr : page->scrollingCoordinator();
-}
-
-CompositedDeprecatedPaintLayerMapping::CompositedDeprecatedPaintLayerMapping(DeprecatedPaintLayer& layer)
-    : m_owningLayer(layer)
-    , m_contentOffsetInCompositingLayerDirty(false)
-    , m_pendingUpdateScope(GraphicsLayerUpdateNone)
-    , m_isMainFrameLayoutViewLayer(false)
-    , m_backgroundLayerPaintsFixedRootBackground(false)
-    , m_scrollingContentsAreEmpty(false)
-{
-    if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame())
-        m_isMainFrameLayoutViewLayer = true;
-
-    createPrimaryGraphicsLayer();
-}
-
-CompositedDeprecatedPaintLayerMapping::~CompositedDeprecatedPaintLayerMapping()
-{
-    // Hits in compositing/squashing/squash-onto-nephew.html.
-    DisableCompositingQueryAsserts disabler;
-
-    // Do not leave the destroyed pointer dangling on any Layers that painted to this mapping's squashing layer.
-    for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
-        DeprecatedPaintLayer* oldSquashedLayer = m_squashedLayers[i].paintLayer;
-        // Assert on incorrect mappings between layers and groups
-        ASSERT(oldSquashedLayer->groupedMapping() == this);
-        if (oldSquashedLayer->groupedMapping() == this) {
-            oldSquashedLayer->setGroupedMapping(0, DeprecatedPaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
-            oldSquashedLayer->setLostGroupedMapping(true);
-        }
-    }
-
-    updateClippingLayers(false, false);
-    updateOverflowControlsLayers(false, false, false, false);
-    updateChildTransformLayer(false);
-    updateForegroundLayer(false);
-    updateBackgroundLayer(false);
-    updateMaskLayer(false);
-    updateClippingMaskLayers(false);
-    updateScrollingLayers(false);
-    updateSquashingLayers(false);
-    destroyGraphicsLayers();
-}
-
-PassOwnPtr<GraphicsLayer> CompositedDeprecatedPaintLayerMapping::createGraphicsLayer(CompositingReasons reasons)
-{
-    GraphicsLayerFactory* graphicsLayerFactory = nullptr;
-    if (Page* page = layoutObject()->frame()->page())
-        graphicsLayerFactory = page->chromeClient().graphicsLayerFactory();
-
-    OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, this);
-
-    graphicsLayer->setCompositingReasons(reasons);
-    if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode())
-        graphicsLayer->setOwnerNodeId(DOMNodeIds::idForNode(owningNode));
-
-    return graphicsLayer.release();
-}
-
-void CompositedDeprecatedPaintLayerMapping::createPrimaryGraphicsLayer()
-{
-    m_graphicsLayer = createGraphicsLayer(m_owningLayer.compositingReasons());
-
-    updateOpacity(layoutObject()->styleRef());
-    updateTransform(layoutObject()->styleRef());
-    updateFilters(layoutObject()->styleRef());
-    updateBackdropFilters(layoutObject()->styleRef());
-
-    if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
-        updateLayerBlendMode(layoutObject()->styleRef());
-        updateIsRootForIsolatedGroup();
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::destroyGraphicsLayers()
-{
-    if (m_graphicsLayer)
-        m_graphicsLayer->removeFromParent();
-
-    m_ancestorClippingLayer = nullptr;
-    m_graphicsLayer = nullptr;
-    m_foregroundLayer = nullptr;
-    m_backgroundLayer = nullptr;
-    m_childContainmentLayer = nullptr;
-    m_childTransformLayer = nullptr;
-    m_maskLayer = nullptr;
-    m_childClippingMaskLayer = nullptr;
-
-    m_scrollingLayer = nullptr;
-    m_scrollingContentsLayer = nullptr;
-    m_scrollingBlockSelectionLayer = nullptr;
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateOpacity(const ComputedStyle& style)
-{
-    m_graphicsLayer->setOpacity(compositingOpacity(style.opacity()));
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateTransform(const ComputedStyle& style)
-{
-    // FIXME: This could use m_owningLayer.transform(), but that currently has transform-origin
-    // baked into it, and we don't want that.
-    TransformationMatrix t;
-    if (m_owningLayer.hasTransformRelatedProperty()) {
-        style.applyTransform(t, LayoutSize(toLayoutBox(layoutObject())->pixelSnappedSize()), ComputedStyle::ExcludeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
-        makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing());
-    }
-
-    m_graphicsLayer->setTransform(t);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateFilters(const ComputedStyle& style)
-{
-    m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style));
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateBackdropFilters(const ComputedStyle& style)
-{
-    m_graphicsLayer->setBackdropFilters(owningLayer().computeBackdropFilterOperations(style));
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateLayerBlendMode(const ComputedStyle& style)
-{
-    setBlendMode(style.blendMode());
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateIsRootForIsolatedGroup()
-{
-    bool isolate = m_owningLayer.shouldIsolateCompositedDescendants();
-
-    // non stacking context layers should never isolate
-    ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate);
-
-    m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateContentsOpaque()
-{
-    ASSERT(m_isMainFrameLayoutViewLayer || !m_backgroundLayer);
-    if (isAcceleratedCanvas(layoutObject())) {
-        // Determine whether the rendering context's external texture layer is opaque.
-        CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->node())->renderingContext();
-        if (!context->hasAlpha())
-            m_graphicsLayer->setContentsOpaque(true);
-        else if (WebLayer* layer = context->platformLayer())
-            m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()).hasAlpha());
-        else
-            m_graphicsLayer->setContentsOpaque(false);
-    } else if (m_backgroundLayer) {
-        m_graphicsLayer->setContentsOpaque(false);
-        m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
-    } else {
-        // For non-root layers, background is always painted by the primary graphics layer.
-        m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateCompositedBounds()
-{
-    ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle::InCompositingUpdate);
-    // FIXME: if this is really needed for performance, it would be better to store it on Layer.
-    m_compositedBounds = m_owningLayer.boundingBoxForCompositing();
-    m_contentOffsetInCompositingLayerDirty = true;
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateAfterPartResize()
-{
-    if (layoutObject()->isLayoutPart()) {
-        if (DeprecatedPaintLayerCompositor* innerCompositor = DeprecatedPaintLayerCompositor::frameContentsCompositor(toLayoutPart(layoutObject()))) {
-            innerCompositor->frameViewDidChangeSize();
-            // We can floor this point because our frameviews are always aligned to pixel boundaries.
-            ASSERT(m_compositedBounds.location() == flooredIntPoint(m_compositedBounds.location()));
-            innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contentsBox().location()));
-        }
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateCompositingReasons()
-{
-    // All other layers owned by this mapping will have the same compositing reason
-    // for their lifetime, so they are initialized only when created.
-    m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons());
-}
-
-bool CompositedDeprecatedPaintLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor(DeprecatedPaintLayer* scrollParent)
-{
-    if (!m_owningLayer.parent())
-        return false;
-
-    const DeprecatedPaintLayer* compositingAncestor = m_owningLayer.enclosingLayerWithCompositedDeprecatedPaintLayerMapping(ExcludeSelf);
-    if (!compositingAncestor)
-        return false;
-
-    const LayoutObject* clippingContainer = m_owningLayer.clippingContainer();
-    if (!clippingContainer)
-        return false;
-
-    if (clippingContainer->enclosingLayer() == scrollParent)
-        return false;
-
-    if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer))
-        return false;
-
-    // We ignore overflow clip here; we want composited overflow content to
-    // behave as if it lives in an unclipped universe so it can prepaint, etc.
-    // This means that we need to check if we are actually clipped before
-    // setting up m_ancestorClippingLayer otherwise
-    // updateAncestorClippingLayerGeometry will fail as the clip rect will be
-    // infinite.
-    // FIXME: this should use cached clip rects, but this sometimes give
-    // inaccurate results (and trips the ASSERTS in DeprecatedPaintLayerClipper).
-    ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, IgnoreOverlayScrollbarSize);
-    clipRectsContext.setIgnoreOverflowClip();
-    IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect());
-    return parentClipRect != LayoutRect::infiniteIntRect();
-}
-
-DeprecatedPaintLayer* CompositedDeprecatedPaintLayerMapping::scrollParent()
-{
-    DeprecatedPaintLayer* scrollParent = m_owningLayer.scrollParent();
-    if (scrollParent && !scrollParent->needsCompositedScrolling())
-        return nullptr;
-    return scrollParent;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateGraphicsLayerConfiguration()
-{
-    ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle::InCompositingUpdate);
-
-    // Note carefully: here we assume that the compositing state of all descendants have been updated already,
-    // so it is legitimate to compute and cache the composited bounds for this layer.
-    updateCompositedBounds();
-
-    if (DeprecatedPaintLayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) {
-        if (reflection->reflectionLayer()->hasCompositedDeprecatedPaintLayerMapping())
-            reflection->reflectionLayer()->compositedDeprecatedPaintLayerMapping()->updateCompositedBounds();
-    }
-
-    DeprecatedPaintLayerCompositor* compositor = this->compositor();
-    LayoutObject* layoutObject = this->layoutObject();
-
-    bool layerConfigChanged = false;
-    setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgroundLayer(&m_owningLayer));
-
-    // The background layer is currently only used for fixed root backgrounds.
-    if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground))
-        layerConfigChanged = true;
-
-    if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_owningLayer)))
-        layerConfigChanged = true;
-
-    bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants(&m_owningLayer);
-
-    // Our scrolling layer will clip.
-    if (m_owningLayer.needsCompositedScrolling())
-        needsDescendantsClippingLayer = false;
-
-    DeprecatedPaintLayer* scrollParent = this->scrollParent();
-
-    // This is required because compositing layers are parented according to the z-order hierarchy, yet
-    // clipping goes down the layoutObject hierarchy. Thus, a DeprecatedPaintLayer can be clipped by a
-    // DeprecatedPaintLayer that is an ancestor in the layoutObject hierarchy, but a sibling in the z-order
-    // hierarchy. Further, that sibling need not be composited at all. In such scenarios, an ancestor
-    // clipping layer is necessary to apply the composited clip for this layer.
-    bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent);
-
-    if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer))
-        layerConfigChanged = true;
-
-    bool scrollingConfigChanged = false;
-    if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) {
-        layerConfigChanged = true;
-        scrollingConfigChanged = true;
-    }
-
-    if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), requiresVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip))
-        layerConfigChanged = true;
-
-    bool hasPerspective = false;
-    // FIXME: Can |style| be really null that late in the DocumentCycle?
-    if (const ComputedStyle* style = layoutObject->style())
-        hasPerspective = style->hasPerspective();
-    bool needsChildTransformLayer = hasPerspective && layoutObject->isBox();
-    if (updateChildTransformLayer(needsChildTransformLayer))
-        layerConfigChanged = true;
-
-    if (updateSquashingLayers(!m_squashedLayers.isEmpty()))
-        layerConfigChanged = true;
-
-    updateScrollParent(scrollParent);
-    updateClipParent(scrollParent);
-
-    if (layerConfigChanged)
-        updateInternalHierarchy();
-
-    if (scrollingConfigChanged) {
-        if (layoutObject->view())
-            compositor->scrollingLayerDidChange(&m_owningLayer);
-    }
-
-    // A mask layer is not part of the hierarchy proper, it's an auxiliary layer
-    // that's plugged into another GraphicsLayer that is part of the hierarchy.
-    // It has no parent or child GraphicsLayer. For that reason, we process it
-    // here, after the hierarchy has been updated.
-    bool maskLayerChanged = false;
-    if (updateMaskLayer(layoutObject->hasMask())) {
-        maskLayerChanged = true;
-        m_graphicsLayer->setMaskLayer(m_maskLayer.get());
-    }
-
-    bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owningLayer) && (hasClippingLayer() || hasScrollingLayer());
-    // If we have a border radius or clip path on a scrolling layer, we need a clipping mask to properly
-    // clip the scrolled contents, even if there are no composited descendants.
-    bool hasClipPath = layoutObject->style()->clipPath();
-    bool needsChildClippingMask = (hasClipPath || layoutObject->style()->hasBorderRadius()) && (hasChildClippingLayer || isAcceleratedContents(layoutObject) || hasScrollingLayer());
-    if (updateClippingMaskLayers(needsChildClippingMask)) {
-        // Clip path clips the entire subtree, including scrollbars. It must be attached directly onto
-        // the main m_graphicsLayer.
-        if (hasClipPath)
-            m_graphicsLayer->setMaskLayer(m_childClippingMaskLayer.get());
-        else if (hasClippingLayer())
-            clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
-        else if (hasScrollingLayer())
-            scrollingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
-        else if (isAcceleratedContents(layoutObject))
-            m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.get());
-    }
-
-    if (m_owningLayer.reflectionInfo()) {
-        if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedDeprecatedPaintLayerMapping()) {
-            GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->reflectionLayer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer();
-            m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
-        }
-    } else {
-        m_graphicsLayer->setReplicatedByLayer(nullptr);
-    }
-
-    updateBackgroundColor();
-
-    if (layoutObject->isImage()) {
-        if (isDirectlyCompositedImage()) {
-            updateImageContents();
-        } else if (m_graphicsLayer->hasContentsLayer()) {
-            m_graphicsLayer->setContentsToImage(nullptr);
-        }
-    }
-
-    if (WebLayer* layer = platformLayerForPlugin(layoutObject)) {
-        m_graphicsLayer->setContentsToPlatformLayer(layer);
-    } else if (layoutObject->node() && layoutObject->node()->isFrameOwnerElement() && toHTMLFrameOwnerElement(layoutObject->node())->contentFrame()) {
-        Frame* frame = toHTMLFrameOwnerElement(layoutObject->node())->contentFrame();
-        if (frame->isRemoteFrame()) {
-            WebLayer* layer = toRemoteFrame(frame)->remotePlatformLayer();
-            m_graphicsLayer->setContentsToPlatformLayer(layer);
-        }
-    } else if (layoutObject->isVideo()) {
-        HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject->node());
-        m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer());
-    } else if (isAcceleratedCanvas(layoutObject)) {
-        HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
-        if (CanvasRenderingContext* context = canvas->renderingContext())
-            m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer());
-        layerConfigChanged = true;
-    }
-    if (layoutObject->isLayoutPart()) {
-        if (DeprecatedPaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layoutObject)))
-            layerConfigChanged = true;
-    }
-
-    // Changes to either the internal hierarchy or the mask layer have an impact
-    // on painting phases, so we need to update when either are updated.
-    if (layerConfigChanged || maskLayerChanged)
-        updatePaintingPhases();
-
-    return layerConfigChanged;
-}
-
-static IntRect clipBox(LayoutBox* layoutObject)
-{
-    LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect());
-    if (layoutObject->hasOverflowClip())
-        result = layoutObject->overflowClipRect(LayoutPoint());
-
-    if (layoutObject->hasClip())
-        result.intersect(layoutObject->clipRect(LayoutPoint()));
-
-    return pixelSnappedIntRect(result);
-}
-
-static LayoutPoint computeOffsetFromCompositedAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* compositedAncestor)
-{
-    LayoutPoint offset = layer->visualOffsetFromAncestor(compositedAncestor);
-    if (compositedAncestor)
-        offset.move(compositedAncestor->compositedDeprecatedPaintLayerMapping()->owningLayer().subpixelAccumulation());
-    return offset;
-}
-
-void CompositedDeprecatedPaintLayerMapping::computeBoundsOfOwningLayer(const DeprecatedPaintLayer* compositedAncestor, IntRect& localBounds, IntRect& compositingBoundsRelativeToCompositedAncestor, LayoutPoint& offsetFromCompositedAncestor,
-    IntPoint& snappedOffsetFromCompositedAncestor)
-{
-    LayoutRect localRawCompositingBounds = compositedBounds();
-    offsetFromCompositedAncestor = computeOffsetFromCompositedAncestor(&m_owningLayer, compositedAncestor);
-    snappedOffsetFromCompositedAncestor = IntPoint(offsetFromCompositedAncestor.x().round(), offsetFromCompositedAncestor.y().round());
-
-    LayoutSize subpixelAccumulation = offsetFromCompositedAncestor - snappedOffsetFromCompositedAncestor;
-    m_owningLayer.setSubpixelAccumulation(subpixelAccumulation);
-
-    // Move the bounds by the subpixel accumulation so that it pixel-snaps relative to absolute pixels instead of local coordinates.
-    localRawCompositingBounds.move(subpixelAccumulation);
-    localBounds = pixelSnappedIntRect(localRawCompositingBounds);
-
-    compositingBoundsRelativeToCompositedAncestor = localBounds;
-    compositingBoundsRelativeToCompositedAncestor.moveBy(snappedOffsetFromCompositedAncestor);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const DeprecatedPaintLayer& referenceLayer,
-    Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, LayoutPoint* offsetFromTransformedAncestor, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
-{
-    if (!squashingLayer)
-        return;
-
-    LayoutPoint offsetFromReferenceLayerToParentGraphicsLayer(offsetFromCompositedAncestor);
-    offsetFromReferenceLayerToParentGraphicsLayer.moveBy(-graphicsLayerParentLocation);
-
-    // FIXME: Cache these offsets.
-    LayoutPoint referenceOffsetFromTransformedAncestor = referenceLayer.computeOffsetFromTransformedAncestor();
-
-    LayoutRect totalSquashBounds;
-    for (size_t i = 0; i < layers.size(); ++i) {
-        LayoutRect squashedBounds = layers[i].paintLayer->boundingBoxForCompositing();
-
-        // Store the local bounds of the Layer subtree before applying the offset.
-        layers[i].compositedBounds = squashedBounds;
-
-        LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].paintLayer->computeOffsetFromTransformedAncestor();
-        LayoutSize offsetFromSquashingLayer = offsetFromTransformedAncestorForSquashedLayer - referenceOffsetFromTransformedAncestor;
-
-        squashedBounds.move(offsetFromSquashingLayer);
-        totalSquashBounds.unite(squashedBounds);
-    }
-
-    // The totalSquashBounds is positioned with respect to referenceLayer of this CompositedDeprecatedPaintLayerMapping.
-    // But the squashingLayer needs to be positioned with respect to the ancestor CompositedDeprecatedPaintLayerMapping.
-    // The conversion between referenceLayer and the ancestor CLM is already computed as
-    // offsetFromReferenceLayerToParentGraphicsLayer.
-    totalSquashBounds.moveBy(offsetFromReferenceLayerToParentGraphicsLayer);
-    const IntRect squashLayerBounds = enclosingIntRect(totalSquashBounds);
-    const IntPoint squashLayerOrigin = squashLayerBounds.location();
-    const LayoutSize squashLayerOriginInOwningLayerSpace = squashLayerOrigin - offsetFromReferenceLayerToParentGraphicsLayer;
-
-    // Now that the squashing bounds are known, we can convert the DeprecatedPaintLayer painting offsets
-    // from CLM owning layer space to the squashing layer space.
-    //
-    // The painting offset we want to compute for each squashed DeprecatedPaintLayer is essentially the position of
-    // the squashed DeprecatedPaintLayer described w.r.t. referenceLayer's origin.
-    // So we just need to convert that point from referenceLayer space to the squashing layer's
-    // space. This is simply done by subtracing squashLayerOriginInOwningLayerSpace, but then the offset
-    // overall needs to be negated because that's the direction that the painting code expects the
-    // offset to be.
-    for (size_t i = 0; i < layers.size(); ++i) {
-        const LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].paintLayer->computeOffsetFromTransformedAncestor();
-        const LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorForSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInOwningLayerSpace;
-
-        IntSize newOffsetFromLayoutObject = -IntSize(offsetFromSquashLayerOrigin.width().round(), offsetFromSquashLayerOrigin.height().round());
-        LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffsetFromLayoutObject;
-        if (layers[i].offsetFromLayoutObjectSet && layers[i].offsetFromLayoutObject != newOffsetFromLayoutObject) {
-            // It is ok to issue paint invalidation here, because all of the geometry needed to correctly invalidate paint is computed by this point.
-            DisablePaintInvalidationStateAsserts disabler;
-            layers[i].paintLayer->layoutObject()->invalidatePaintIncludingNonCompositingDescendants();
-
-            TRACE_LAYER_INVALIDATION(layers[i].paintLayer, InspectorLayerInvalidationTrackingEvent::SquashingLayerGeometryWasUpdated);
-            layersNeedingPaintInvalidation.append(layers[i].paintLayer);
-        }
-        layers[i].offsetFromLayoutObject = newOffsetFromLayoutObject;
-        layers[i].offsetFromLayoutObjectSet = true;
-
-        layers[i].paintLayer->setSubpixelAccumulation(subpixelAccumulation);
-    }
-
-    squashingLayer->setPosition(squashLayerBounds.location());
-    squashingLayer->setSize(squashLayerBounds.size());
-
-    *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor;
-    offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace);
-
-    for (size_t i = 0; i < layers.size(); ++i)
-        layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(referenceLayer, layers[i], layers);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateGraphicsLayerGeometry(const DeprecatedPaintLayer* compositingContainer, const DeprecatedPaintLayer* compositingStackingContext, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
-{
-    ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle::InCompositingUpdate);
-
-    // Set transform property, if it is not animating. We have to do this here because the transform
-    // is affected by the layer dimensions.
-    if (!layoutObject()->style()->isRunningTransformAnimationOnCompositor())
-        updateTransform(layoutObject()->styleRef());
-
-    // Set opacity, if it is not animating.
-    if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor())
-        updateOpacity(layoutObject()->styleRef());
-
-    if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor())
-        updateFilters(layoutObject()->styleRef());
-
-    if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor())
-        updateBackdropFilters(layoutObject()->styleRef());
-
-    // We compute everything relative to the enclosing compositing layer.
-    IntRect ancestorCompositingBounds;
-    if (compositingContainer) {
-        ASSERT(compositingContainer->hasCompositedDeprecatedPaintLayerMapping());
-        ancestorCompositingBounds = compositingContainer->compositedDeprecatedPaintLayerMapping()->pixelSnappedCompositedBounds();
-    }
-
-    IntRect localCompositingBounds;
-    IntRect relativeCompositingBounds;
-    LayoutPoint offsetFromCompositedAncestor;
-    IntPoint snappedOffsetFromCompositedAncestor;
-    computeBoundsOfOwningLayer(compositingContainer, localCompositingBounds, relativeCompositingBounds, offsetFromCompositedAncestor, snappedOffsetFromCompositedAncestor);
-
-    IntPoint graphicsLayerParentLocation;
-    computeGraphicsLayerParentLocation(compositingContainer, ancestorCompositingBounds, graphicsLayerParentLocation);
-
-    // Might update graphicsLayerParentLocation.
-    updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromCompositedAncestor, graphicsLayerParentLocation);
-    updateOverflowControlsHostLayerGeometry(compositingStackingContext, compositingContainer);
-
-    FloatSize contentsSize = relativeCompositingBounds.size();
-
-    updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingBounds, graphicsLayerParentLocation);
-    updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor, graphicsLayerParentLocation);
-    updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerParentLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation);
-
-    // If we have a layer that clips children, position it.
-    IntRect clippingBox;
-    if (m_childContainmentLayer)
-        clippingBox = clipBox(toLayoutBox(layoutObject()));
-
-    updateChildTransformLayerGeometry();
-    updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds);
-
-    updateMaskLayerGeometry();
-    updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeCompositingBounds);
-    updateForegroundLayerGeometry(contentsSize, clippingBox);
-    updateBackgroundLayerGeometry(contentsSize);
-    updateReflectionLayerGeometry(layersNeedingPaintInvalidation);
-    updateScrollingLayerGeometry(localCompositingBounds);
-    updateChildClippingMaskLayerGeometry();
-
-    if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scrollsOverflow())
-        m_owningLayer.scrollableArea()->positionOverflowControls();
-
-    if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
-        updateLayerBlendMode(layoutObject()->styleRef());
-        updateIsRootForIsolatedGroup();
-    }
-
-    updateContentsRect();
-    updateBackgroundColor();
-    updateDrawsContent();
-    updateContentsOpaque();
-    updateAfterPartResize();
-    updateRenderingContext();
-    updateShouldFlattenTransform();
-    updateChildrenTransform();
-    updateScrollParent(scrollParent());
-    registerScrollingLayers();
-
-    updateCompositingReasons();
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& graphicsLayerParentLocation)
-{
-    m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
-    m_graphicsLayer->setOffsetFromLayoutObject(toIntSize(localCompositingBounds.location()));
-
-    FloatSize oldSize = m_graphicsLayer->size();
-    const IntSize& contentsSize = relativeCompositingBounds.size();
-    if (oldSize != contentsSize)
-        m_graphicsLayer->setSize(contentsSize);
-
-    // m_graphicsLayer is the corresponding GraphicsLayer for this DeprecatedPaintLayer and its non-compositing
-    // descendants. So, the visibility flag for m_graphicsLayer should be true if there are any
-    // non-compositing visible layers.
-    bool contentsVisible = m_owningLayer.hasVisibleContent() || hasVisibleNonCompositingDescendant(&m_owningLayer);
-    if (layoutObject()->isVideo()) {
-        HTMLVideoElement* videoElement = toHTMLVideoElement(layoutObject()->node());
-        if (videoElement->isFullscreen() && videoElement->usesOverlayFullscreenVideo())
-            contentsVisible = false;
-    }
-    m_graphicsLayer->setContentsVisible(contentsVisible);
-
-    m_graphicsLayer->setBackfaceVisibility(layoutObject()->style()->backfaceVisibility() == BackfaceVisibilityVisible);
-}
-
-void CompositedDeprecatedPaintLayerMapping::computeGraphicsLayerParentLocation(const DeprecatedPaintLayer* compositingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLocation)
-{
-    if (compositingContainer && compositingContainer->compositedDeprecatedPaintLayerMapping()->hasClippingLayer()) {
-        // If the compositing ancestor has a layer to clip children, we parent in that, and therefore
-        // position relative to it.
-        IntRect clippingBox = clipBox(toLayoutBox(compositingContainer->layoutObject()));
-        graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(compositingContainer->subpixelAccumulation());
-    } else if (compositingContainer && compositingContainer->compositedDeprecatedPaintLayerMapping()->childTransformLayer()) {
-        // Similarly, if the compositing ancestor has a child transform layer, we parent in that, and therefore
-        // position relative to it. It's already taken into account the contents offset, so we do not need to here.
-        graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subpixelAccumulation());
-    } else if (compositingContainer) {
-        graphicsLayerParentLocation = ancestorCompositingBounds.location();
-    } else {
-        graphicsLayerParentLocation = layoutObject()->view()->documentRect().location();
-    }
-
-    if (compositingContainer && compositingContainer->needsCompositedScrolling()) {
-        LayoutBox* layoutBox = toLayoutBox(compositingContainer->layoutObject());
-        IntSize scrollOffset = layoutBox->scrolledContentOffset();
-        IntPoint scrollOrigin(layoutBox->borderLeft(), layoutBox->borderTop());
-        graphicsLayerParentLocation = scrollOrigin - scrollOffset;
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateAncestorClippingLayerGeometry(const DeprecatedPaintLayer* compositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLayerParentLocation)
-{
-    if (!compositingContainer || !m_ancestorClippingLayer)
-        return;
-
-    ClipRectsContext clipRectsContext(compositingContainer, PaintingClipRectsIgnoringOverflowClip, IgnoreOverlayScrollbarSize);
-    IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect());
-    ASSERT(parentClipRect != LayoutRect::infiniteIntRect());
-    m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
-    m_ancestorClippingLayer->setSize(parentClipRect.size());
-
-    // backgroundRect is relative to compositingContainer, so subtract snappedOffsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y to get back to local coords.
-    m_ancestorClippingLayer->setOffsetFromLayoutObject(parentClipRect.location() - snappedOffsetFromCompositedAncestor);
-
-    // The primary layer is then parented in, and positioned relative to this clipping layer.
-    graphicsLayerParentLocation = parentClipRect.location();
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateOverflowControlsHostLayerGeometry(const DeprecatedPaintLayer* compositingStackingContext, const DeprecatedPaintLayer* compositingContainer)
-{
-    if (!m_overflowControlsHostLayer)
-        return;
-
-    if (needsToReparentOverflowControls()) {
-        if (m_overflowControlsClippingLayer) {
-            m_overflowControlsClippingLayer->setSize(m_ancestorClippingLayer->size());
-            m_overflowControlsClippingLayer->setOffsetFromLayoutObject(m_ancestorClippingLayer->offsetFromLayoutObject());
-            m_overflowControlsClippingLayer->setMasksToBounds(true);
-            m_overflowControlsHostLayer->setPosition(IntPoint(-m_overflowControlsClippingLayer->offsetFromLayoutObject()));
-
-            FloatPoint position = m_ancestorClippingLayer->position();
-            if (compositingStackingContext != compositingContainer) {
-                LayoutPoint offset;
-                compositingContainer->convertToLayerCoords(compositingStackingContext, offset);
-                FloatSize offsetFromStackingContainer = toFloatSize(FloatPoint(offset));
-                position += offsetFromStackingContainer;
-            }
-
-            m_overflowControlsClippingLayer->setPosition(position);
-        } else {
-            // The controls are in the same 2D space as the compositing container, so we can map them into the space of the container.
-            TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
-            m_owningLayer.layoutObject()->mapLocalToContainer(compositingStackingContext->layoutObject(), transformState, ApplyContainerFlip);
-            transformState.flatten();
-            LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState.lastPlanarPoint());
-            if (DeprecatedPaintLayerScrollableArea* scrollableArea = compositingStackingContext->scrollableArea())
-                offsetFromStackingContainer.move(LayoutSize(scrollableArea->adjustedScrollOffset()));
-            m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStackingContainer));
-        }
-    } else {
-        m_overflowControlsHostLayer->setPosition(FloatPoint());
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds)
-{
-    if (!m_childContainmentLayer)
-        return;
-
-    FloatPoint clipPositionInLayoutObjectSpace(clippingBox.location() - localCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()));
-
-    // If there are layers between the the child containment layer and
-    // m_graphicsLayer (eg, the child transform layer), we must adjust the clip
-    // position to get it in the correct space.
-    FloatPoint clipPositionInParentSpace = clipPositionInLayoutObjectSpace;
-    for (GraphicsLayer* ancestor = m_childContainmentLayer->parent(); ancestor != mainGraphicsLayer(); ancestor = ancestor->parent())
-        clipPositionInParentSpace -= toFloatSize(ancestor->position());
-
-    m_childContainmentLayer->setPosition(clipPositionInParentSpace);
-    m_childContainmentLayer->setSize(clippingBox.size());
-    m_childContainmentLayer->setOffsetFromLayoutObject(toIntSize(clippingBox.location()));
-    if (m_childClippingMaskLayer && !m_scrollingLayer && !layoutObject()->style()->clipPath()) {
-        m_childClippingMaskLayer->setSize(m_childContainmentLayer->size());
-        m_childClippingMaskLayer->setOffsetFromLayoutObject(m_childContainmentLayer->offsetFromLayoutObject());
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateChildTransformLayerGeometry()
-{
-    if (!m_childTransformLayer)
-        return;
-    const IntRect borderBox = toLayoutBox(m_owningLayer.layoutObject())->pixelSnappedBorderBoxRect();
-    m_childTransformLayer->setSize(borderBox.size());
-    m_childTransformLayer->setPosition(FloatPoint(contentOffsetInCompositingLayer()));
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateMaskLayerGeometry()
-{
-    if (!m_maskLayer)
-        return;
-
-    if (m_maskLayer->size() != m_graphicsLayer->size()) {
-        m_maskLayer->setSize(m_graphicsLayer->size());
-        m_maskLayer->setNeedsDisplay();
-    }
-    m_maskLayer->setPosition(FloatPoint());
-    m_maskLayer->setOffsetFromLayoutObject(m_graphicsLayer->offsetFromLayoutObject());
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAncestor, const IntRect& relativeCompositingBounds)
-{
-    if (m_owningLayer.hasTransformRelatedProperty()) {
-        const LayoutRect borderBox = toLayoutBox(layoutObject())->borderBoxRect();
-
-        // Get layout bounds in the coords of compositingContainer to match relativeCompositingBounds.
-        IntRect layerBounds = pixelSnappedIntRect(toLayoutPoint(m_owningLayer.subpixelAccumulation()), borderBox.size());
-        layerBounds.moveBy(snappedOffsetFromCompositedAncestor);
-
-        // Update properties that depend on layer dimensions
-        FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint(), layerBounds.size()));
-
-        // |transformOrigin| is in the local space of this layer. layerBounds - relativeCompositingBounds converts to the space of the
-        // compositing bounds relative to the composited ancestor. This does not apply to the z direction, since the page is 2D.
-        FloatPoint3D compositedTransformOrigin(
-            layerBounds.x() - relativeCompositingBounds.x() + transformOrigin.x(),
-            layerBounds.y() - relativeCompositingBounds.y() + transformOrigin.y(),
-            transformOrigin.z());
-        m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
-    } else {
-        FloatPoint3D compositedTransformOrigin(
-            relativeCompositingBounds.width() * 0.5f,
-            relativeCompositingBounds.height() * 0.5f,
-            0.f);
-        m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateReflectionLayerGeometry(Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
-{
-    if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedDeprecatedPaintLayerMapping())
-        return;
-
-    CompositedDeprecatedPaintLayerMapping* reflectionCompositedDeprecatedPaintLayerMapping = m_owningLayer.reflectionInfo()->reflectionLayer()->compositedDeprecatedPaintLayerMapping();
-    reflectionCompositedDeprecatedPaintLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer, &m_owningLayer, layersNeedingPaintInvalidation);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateScrollingLayerGeometry(const IntRect& localCompositingBounds)
-{
-    if (!m_scrollingLayer)
-        return;
-
-    ASSERT(m_scrollingContentsLayer);
-    LayoutBox* layoutBox = toLayoutBox(layoutObject());
-    IntRect overflowClipRect = enclosingIntRect(layoutBox->overflowClipRect(LayoutPoint()));
-    DoubleSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedScrollOffset();
-    m_scrollingLayer->setPosition(FloatPoint(overflowClipRect.location() - localCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation())));
-    m_scrollingLayer->setSize(overflowClipRect.size());
-
-    IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromLayoutObject();
-    m_scrollingLayer->setOffsetFromLayoutObject(-toIntSize(overflowClipRect.location()));
-
-    if (m_childClippingMaskLayer && !layoutObject()->style()->clipPath()) {
-        m_childClippingMaskLayer->setPosition(m_scrollingLayer->position());
-        m_childClippingMaskLayer->setSize(m_scrollingLayer->size());
-        m_childClippingMaskLayer->setOffsetFromLayoutObject(toIntSize(overflowClipRect.location()));
-    }
-
-    bool overflowClipRectOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromLayoutObject();
-
-    IntSize scrollSize(layoutBox->scrollWidth(), layoutBox->scrollHeight());
-    if (scrollSize != m_scrollingContentsLayer->size() || overflowClipRectOffsetChanged)
-        m_scrollingContentsLayer->setNeedsDisplay();
-
-    DoubleSize scrollingContentsOffset(overflowClipRect.location().x() - adjustedScrollOffset.width(), overflowClipRect.location().y() - adjustedScrollOffset.height());
-    // The scroll offset change is compared using floating point so that fractional scroll offset
-    // change can be propagated to compositor.
-    if (scrollingContentsOffset != m_scrollingContentsLayer->offsetDoubleFromLayoutObject() || scrollSize != m_scrollingContentsLayer->size()) {
-        bool coordinatorHandlesOffset = compositor()->scrollingLayerDidChange(&m_owningLayer);
-        m_scrollingContentsLayer->setPosition(coordinatorHandlesOffset ? FloatPoint() : FloatPoint(-toFloatSize(adjustedScrollOffset)));
-    }
-
-    m_scrollingContentsLayer->setSize(scrollSize);
-    // FIXME: The paint offset and the scroll offset should really be separate concepts.
-    m_scrollingContentsLayer->setOffsetDoubleFromLayoutObject(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay);
-
-    if (m_foregroundLayer) {
-        if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
-            m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
-        m_foregroundLayer->setNeedsDisplay();
-        m_foregroundLayer->setOffsetFromLayoutObject(m_scrollingContentsLayer->offsetFromLayoutObject());
-    }
-
-    updateScrollingBlockSelection();
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateChildClippingMaskLayerGeometry()
-{
-    if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath())
-        return;
-    LayoutBox* layoutBox = toLayoutBox(layoutObject());
-    IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect());
-
-    m_childClippingMaskLayer->setPosition(m_graphicsLayer->position());
-    m_childClippingMaskLayer->setSize(m_graphicsLayer->size());
-    m_childClippingMaskLayer->setOffsetFromLayoutObject(toIntSize(clientBox.location()));
-
-    // NOTE: also some stuff happening in updateChildContainmentLayerGeometry().
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateForegroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize, const IntRect& clippingBox)
-{
-    if (!m_foregroundLayer)
-        return;
-
-    FloatSize foregroundSize = relativeCompositingBoundsSize;
-    IntSize foregroundOffset = m_graphicsLayer->offsetFromLayoutObject();
-    m_foregroundLayer->setPosition(FloatPoint());
-
-    if (hasClippingLayer()) {
-        // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
-        // so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
-        foregroundSize = FloatSize(clippingBox.size());
-        foregroundOffset = toIntSize(clippingBox.location());
-    } else if (m_childTransformLayer) {
-        // Things are different if we have a child transform layer rather
-        // than a clipping layer. In this case, we want to actually change
-        // the position of the layer (to compensate for our ancestor
-        // compositing DeprecatedPaintLayer's position) rather than leave the position the
-        // same and use offset-from-layoutObject + size to describe a clipped
-        // "window" onto the clipped layer.
-
-        m_foregroundLayer->setPosition(-m_childTransformLayer->position());
-    }
-
-    if (foregroundSize != m_foregroundLayer->size()) {
-        m_foregroundLayer->setSize(foregroundSize);
-        m_foregroundLayer->setNeedsDisplay();
-    }
-    m_foregroundLayer->setOffsetFromLayoutObject(foregroundOffset);
-
-    // NOTE: there is some more configuring going on in updateScrollingLayerGeometry().
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize)
-{
-    if (!m_backgroundLayer)
-        return;
-
-    FloatSize backgroundSize = relativeCompositingBoundsSize;
-    if (backgroundLayerPaintsFixedRootBackground()) {
-        FrameView* frameView = toLayoutView(layoutObject())->frameView();
-        backgroundSize = frameView->visibleContentRect().size();
-    }
-    m_backgroundLayer->setPosition(FloatPoint());
-    if (backgroundSize != m_backgroundLayer->size()) {
-        m_backgroundLayer->setSize(backgroundSize);
-        m_backgroundLayer->setNeedsDisplay();
-    }
-    m_backgroundLayer->setOffsetFromLayoutObject(m_graphicsLayer->offsetFromLayoutObject());
-}
-
-void CompositedDeprecatedPaintLayerMapping::registerScrollingLayers()
-{
-    // Register fixed position layers and their containers with the scrolling coordinator.
-    ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
-    if (!scrollingCoordinator)
-        return;
-
-    scrollingCoordinator->updateLayerPositionConstraint(&m_owningLayer);
-
-    // Page scale is applied as a transform on the root layout view layer. Because the scroll
-    // layer is further up in the hierarchy, we need to avoid marking the root layout view
-    // layer as a container.
-    bool isContainer = m_owningLayer.hasTransformRelatedProperty() && !m_owningLayer.isRootLayer();
-    // FIXME: we should make certain that childForSuperLayers will never be the m_squashingContainmentLayer here
-    scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSuperlayers(), isContainer);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateInternalHierarchy()
-{
-    // m_foregroundLayer has to be inserted in the correct order with child layers,
-    // so it's not inserted here.
-    if (m_ancestorClippingLayer)
-        m_ancestorClippingLayer->removeAllChildren();
-
-    m_graphicsLayer->removeFromParent();
-
-    if (m_ancestorClippingLayer)
-        m_ancestorClippingLayer->addChild(m_graphicsLayer.get());
-
-    // Layer to which children should be attached as we build the hierarchy.
-    GraphicsLayer* bottomLayer = m_graphicsLayer.get();
-    auto updateBottomLayer = [&bottomLayer](GraphicsLayer* layer)
-    {
-        if (layer) {
-            bottomLayer->addChild(layer);
-            bottomLayer = layer;
-        }
-    };
-
-    updateBottomLayer(m_childTransformLayer.get());
-    updateBottomLayer(m_childContainmentLayer.get());
-    updateBottomLayer(m_scrollingLayer.get());
-
-    // Now constructing the subtree for the overflow controls.
-    bottomLayer = m_graphicsLayer.get();
-    if (m_isMainFrameLayoutViewLayer)
-        bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewport().containerLayer();
-    updateBottomLayer(m_overflowControlsClippingLayer.get());
-    updateBottomLayer(m_overflowControlsHostLayer.get());
-    if (m_layerForHorizontalScrollbar)
-        m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get());
-    if (m_layerForVerticalScrollbar)
-        m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get());
-    if (m_layerForScrollCorner)
-        m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get());
-
-    // The squashing containment layer, if it exists, becomes a no-op parent.
-    if (m_squashingLayer) {
-        ASSERT((m_ancestorClippingLayer && !m_squashingContainmentLayer) || (!m_ancestorClippingLayer && m_squashingContainmentLayer));
-
-        if (m_squashingContainmentLayer) {
-            m_squashingContainmentLayer->removeAllChildren();
-            m_squashingContainmentLayer->addChild(m_graphicsLayer.get());
-            m_squashingContainmentLayer->addChild(m_squashingLayer.get());
-        } else {
-            // The ancestor clipping layer is already set up and has m_graphicsLayer under it.
-            m_ancestorClippingLayer->addChild(m_squashingLayer.get());
-        }
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updatePaintingPhases()
-{
-    m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
-    if (m_scrollingContentsLayer) {
-        GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
-        if (!m_foregroundLayer)
-            paintPhase |= GraphicsLayerPaintForeground;
-        m_scrollingContentsLayer->setPaintingPhase(paintPhase);
-        if (m_scrollingBlockSelectionLayer)
-            m_scrollingBlockSelectionLayer->setPaintingPhase(paintPhase);
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateContentsRect()
-{
-    m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateContentsOffsetInCompositingLayer(const IntPoint& snappedOffsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation)
-{
-    // m_graphicsLayer is positioned relative to our compositing ancestor
-    // DeprecatedPaintLayer, but it's not positioned at the origin of m_owningLayer, it's
-    // offset by m_contentBounds.location(). This is what
-    // contentOffsetInCompositingLayer is meant to capture, roughly speaking
-    // (ignoring rounding and subpixel accumulation).
-    //
-    // Our ancestor graphics layers in this CLM (m_graphicsLayer and potentially
-    // m_ancestorClippingLayer) have pixel snapped, so if we don't adjust this
-    // offset, we'll see accumulated rounding errors due to that snapping.
-    //
-    // In order to ensure that we account for this rounding, we compute
-    // contentsOffsetInCompositingLayer in a somewhat roundabout way.
-    //
-    // our position = (desired position) - (inherited graphics layer offset).
-    //
-    // Precisely,
-    // Offset = snappedOffsetFromCompositedAncestor - offsetDueToAncestorGraphicsLayers (See code below)
-    //      = snappedOffsetFromCompositedAncestor - (m_graphicsLayer->position() + graphicsLayerParentLocation)
-    //      = snappedOffsetFromCompositedAncestor - (relativeCompositingBounds.location() - graphicsLayerParentLocation + graphicsLayerParentLocation) (See updateMainGraphicsLayerGeometry)
-    //      = snappedOffsetFromCompositedAncestor - relativeCompositingBounds.location()
-    //      = snappedOffsetFromCompositedAncestor - (pixelSnappedIntRect(contentBounds.location()) + snappedOffsetFromCompositedAncestor) (See computeBoundsOfOwningLayer)
-    //      = -pixelSnappedIntRect(contentBounds.location())
-    //
-    // As you can see, we've ended up at the same spot (-contentBounds.location()),
-    // but by subtracting off our ancestor graphics layers positions, we can be
-    // sure we've accounted correctly for any pixel snapping due to ancestor
-    // graphics layers.
-    //
-    // And drawing of composited children takes into account the subpixel
-    // accumulation of this CLM already (through its own
-    // graphicsLayerParentLocation it appears).
-    FloatPoint offsetDueToAncestorGraphicsLayers = m_graphicsLayer->position() + graphicsLayerParentLocation;
-    m_contentOffsetInCompositingLayer = LayoutSize(snappedOffsetFromCompositedAncestor - offsetDueToAncestorGraphicsLayers);
-    m_contentOffsetInCompositingLayerDirty = false;
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateScrollingBlockSelection()
-{
-    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
-        return;
-
-    if (!m_scrollingBlockSelectionLayer)
-        return;
-
-    if (!m_scrollingContentsAreEmpty) {
-        // In this case, the selection will be painted directly into m_scrollingContentsLayer.
-        m_scrollingBlockSelectionLayer->setDrawsContent(false);
-        return;
-    }
-
-    const IntRect blockSelectionGapsBounds = m_owningLayer.blockSelectionGapsBounds();
-    const bool shouldDrawContent = !blockSelectionGapsBounds.isEmpty();
-    m_scrollingBlockSelectionLayer->setDrawsContent(shouldDrawContent);
-    if (!shouldDrawContent)
-        return;
-    // FIXME: Remove the flooredIntSize conversion. crbug.com/414283.
-    const IntPoint position = blockSelectionGapsBounds.location() + flooredIntSize(m_owningLayer.scrollableArea()->adjustedScrollOffset());
-    if (m_scrollingBlockSelectionLayer->size() == blockSelectionGapsBounds.size() && m_scrollingBlockSelectionLayer->position() == position)
-        return;
-
-    m_scrollingBlockSelectionLayer->setPosition(position);
-    m_scrollingBlockSelectionLayer->setSize(blockSelectionGapsBounds.size());
-    m_scrollingBlockSelectionLayer->setOffsetFromLayoutObject(toIntSize(blockSelectionGapsBounds.location()), GraphicsLayer::SetNeedsDisplay);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateDrawsContent()
-{
-    bool hasPaintedContent = containsPaintedContent();
-    m_graphicsLayer->setDrawsContent(hasPaintedContent);
-
-    if (m_scrollingLayer) {
-        // m_scrollingLayer never has backing store.
-        // m_scrollingContentsLayer only needs backing store if the scrolled contents need to paint.
-        m_scrollingContentsAreEmpty = !m_owningLayer.hasVisibleContent() || !(layoutObject()->hasBackground() || paintsChildren());
-        m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty);
-        updateScrollingBlockSelection();
-    }
-
-    if (hasPaintedContent && isAcceleratedCanvas(layoutObject())) {
-        CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->node())->renderingContext();
-        // Content layer may be null if context is lost.
-        if (WebLayer* contentLayer = context->platformLayer()) {
-            Color bgColor(Color::transparent);
-            if (contentLayerSupportsDirectBackgroundComposition(layoutObject())) {
-                bgColor = layoutObjectBackgroundColor();
-                hasPaintedContent = false;
-            }
-            contentLayer->setBackgroundColor(bgColor.rgb());
-        }
-    }
-
-    // FIXME: we could refine this to only allocate backings for one of these layers if possible.
-    if (m_foregroundLayer)
-        m_foregroundLayer->setDrawsContent(hasPaintedContent);
-
-    if (m_backgroundLayer)
-        m_backgroundLayer->setDrawsContent(hasPaintedContent);
-
-    if (m_maskLayer)
-        m_maskLayer->setDrawsContent(true);
-
-    if (m_childClippingMaskLayer)
-        m_childClippingMaskLayer->setDrawsContent(true);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateChildrenTransform()
-{
-    if (GraphicsLayer* childTransformLayer = this->childTransformLayer()) {
-        childTransformLayer->setTransform(owningLayer().perspectiveTransform());
-        childTransformLayer->setTransformOrigin(owningLayer().perspectiveOrigin());
-    }
-
-    updateShouldFlattenTransform();
-}
-
-// Return true if the layers changed.
-bool CompositedDeprecatedPaintLayerMapping::updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip)
-{
-    bool layersChanged = false;
-
-    if (needsAncestorClip) {
-        if (!m_ancestorClippingLayer) {
-            m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayerForAncestorClip);
-            m_ancestorClippingLayer->setMasksToBounds(true);
-            m_ancestorClippingLayer->setShouldFlattenTransform(false);
-            layersChanged = true;
-        }
-    } else if (m_ancestorClippingLayer) {
-        m_ancestorClippingLayer->removeFromParent();
-        m_ancestorClippingLayer = nullptr;
-        layersChanged = true;
-    }
-
-    if (needsDescendantClip) {
-        // We don't need a child containment layer if we're the main frame layout view
-        // layer. It's redundant as the frame clip above us will handle this clipping.
-        if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) {
-            m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayerForDescendantClip);
-            m_childContainmentLayer->setMasksToBounds(true);
-            layersChanged = true;
-        }
-    } else if (hasClippingLayer()) {
-        m_childContainmentLayer->removeFromParent();
-        m_childContainmentLayer = nullptr;
-        layersChanged = true;
-    }
-
-    return layersChanged;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateChildTransformLayer(bool needsChildTransformLayer)
-{
-    bool layersChanged = false;
-
-    if (needsChildTransformLayer) {
-        if (!m_childTransformLayer) {
-            m_childTransformLayer = createGraphicsLayer(CompositingReasonLayerForPerspective);
-            m_childTransformLayer->setDrawsContent(false);
-            layersChanged = true;
-        }
-    } else if (m_childTransformLayer) {
-        m_childTransformLayer->removeFromParent();
-        m_childTransformLayer = nullptr;
-        layersChanged = true;
-    }
-
-    return layersChanged;
-}
-
-void CompositedDeprecatedPaintLayerMapping::setBackgroundLayerPaintsFixedRootBackground(bool backgroundLayerPaintsFixedRootBackground)
-{
-    m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootBackground;
-}
-
-// Only a member function so it can call createGraphicsLayer.
-bool CompositedDeprecatedPaintLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason)
-{
-    if (needsLayer == !!layer)
-        return false;
-    layer = needsLayer ? createGraphicsLayer(reason) : nullptr;
-    return true;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip)
-{
-    // If the subtree is invisible, we don't actually need scrollbar layers.
-    bool invisible = m_owningLayer.subtreeIsInvisible();
-    needsHorizontalScrollbarLayer &= !invisible;
-    needsVerticalScrollbarLayer &= !invisible;
-    needsScrollCornerLayer &= !invisible;
-
-    bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForHorizontalScrollbar);
-    bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForVerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVerticalScrollbar);
-    bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrollCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner);
-
-    bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needsVerticalScrollbarLayer || needsScrollCornerLayer;
-    toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowControlsHostLayer, CompositingReasonLayerForOverflowControlsHost);
-    bool needsOverflowClipLayer = needsOverflowControlsHostLayer && needsAncestorClip;
-    toggleScrollbarLayerIfNeeded(m_overflowControlsClippingLayer, needsOverflowClipLayer, CompositingReasonLayerForOverflowControlsHost);
-
-    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
-        if (horizontalScrollbarLayerChanged)
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer.scrollableArea(), HorizontalScrollbar);
-        if (verticalScrollbarLayerChanged)
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer.scrollableArea(), VerticalScrollbar);
-    }
-
-    return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || scrollCornerLayerChanged;
-}
-
-void CompositedDeprecatedPaintLayerMapping::positionOverflowControlsLayers()
-{
-    IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() - roundedIntSize(m_owningLayer.subpixelAccumulation());
-    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
-        Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar();
-        if (hBar) {
-            layer->setPosition(hBar->frameRect().location() - offsetFromLayoutObject);
-            layer->setSize(hBar->frameRect().size());
-            if (layer->hasContentsLayer())
-                layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().size()));
-        }
-        layer->setDrawsContent(hBar && !layer->hasContentsLayer());
-    }
-
-    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
-        Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar();
-        if (vBar) {
-            layer->setPosition(vBar->frameRect().location() - offsetFromLayoutObject);
-            layer->setSize(vBar->frameRect().size());
-            if (layer->hasContentsLayer())
-                layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().size()));
-        }
-        layer->setDrawsContent(vBar && !layer->hasContentsLayer());
-    }
-
-    if (GraphicsLayer* layer = layerForScrollCorner()) {
-        const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->scrollCornerAndResizerRect();
-        layer->setPosition(FloatPoint(scrollCornerAndResizer.location() - offsetFromLayoutObject));
-        layer->setSize(FloatSize(scrollCornerAndResizer.size()));
-        layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
-    }
-}
-
-bool CompositedDeprecatedPaintLayerMapping::hasUnpositionedOverflowControlsLayers() const
-{
-    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
-        if (!layer->drawsContent())
-            return true;
-    }
-
-    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
-        if (!layer->drawsContent())
-            return true;
-    }
-
-    if (GraphicsLayer* layer = layerForScrollCorner()) {
-        if (!layer->drawsContent())
-            return true;
-    }
-
-    return false;
-}
-
-enum ApplyToGraphicsLayersModeFlags {
-    ApplyToLayersAffectedByPreserve3D = (1 << 0),
-    ApplyToSquashingLayer = (1 << 1),
-    ApplyToScrollbarLayers = (1 << 2),
-    ApplyToBackgroundLayer = (1 << 3),
-    ApplyToMaskLayers = (1 << 4),
-    ApplyToContentLayers = (1 << 5),
-    ApplyToChildContainingLayers = (1 << 6), // layers between m_graphicsLayer and children
-    ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers | ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToLayersAffectedByPreserve3D | ApplyToContentLayers)
-};
-typedef unsigned ApplyToGraphicsLayersMode;
-
-template <typename Func>
-static void ApplyToGraphicsLayers(const CompositedDeprecatedPaintLayerMapping* mapping, const Func& f, ApplyToGraphicsLayersMode mode)
-{
-    ASSERT(mode);
-
-    if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->childTransformLayer())
-        f(mapping->childTransformLayer());
-    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLayers)) && mapping->mainGraphicsLayer())
-        f(mapping->mainGraphicsLayer());
-    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildContainingLayers)) && mapping->clippingLayer())
-        f(mapping->clippingLayer());
-    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildContainingLayers)) && mapping->scrollingLayer())
-        f(mapping->scrollingLayer());
-    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildContainingLayers)) && mapping->scrollingBlockSelectionLayer())
-        f(mapping->scrollingBlockSelectionLayer());
-    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLayers) || (mode & ApplyToChildContainingLayers)) && mapping->scrollingContentsLayer())
-        f(mapping->scrollingContentsLayer());
-    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLayers)) && mapping->foregroundLayer())
-        f(mapping->foregroundLayer());
-
-    if ((mode & ApplyToChildContainingLayers) && mapping->childTransformLayer())
-        f(mapping->childTransformLayer());
-
-    if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer())
-        f(mapping->squashingLayer());
-
-    if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping->maskLayer())
-        f(mapping->maskLayer());
-    if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping->childClippingMaskLayer())
-        f(mapping->childClippingMaskLayer());
-
-    if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers)) && mapping->backgroundLayer())
-        f(mapping->backgroundLayer());
-
-    if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar())
-        f(mapping->layerForHorizontalScrollbar());
-    if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar())
-        f(mapping->layerForVerticalScrollbar());
-    if ((mode & ApplyToScrollbarLayers) && mapping->layerForScrollCorner())
-        f(mapping->layerForScrollCorner());
-}
-
-struct UpdateRenderingContextFunctor {
-    void operator() (GraphicsLayer* layer) const { layer->setRenderingContext(renderingContext); }
-    int renderingContext;
-};
-
-void CompositedDeprecatedPaintLayerMapping::updateRenderingContext()
-{
-    // All layers but the squashing layer (which contains 'alien' content) should be included in this
-    // rendering context.
-    int id = 0;
-
-    // NB, it is illegal at this point to query an ancestor's compositing state. Some compositing
-    // reasons depend on the compositing state of ancestors. So if we want a rendering context id
-    // for the context root, we cannot ask for the id of its associated WebLayer now; it may not have
-    // one yet. We could do a second past after doing the compositing updates to get these ids,
-    // but this would actually be harmful. We do not want to attach any semantic meaning to
-    // the context id other than the fact that they group a number of layers together for the
-    // sake of 3d sorting. So instead we will ask the compositor to vend us an arbitrary, but
-    // consistent id.
-    if (DeprecatedPaintLayer* root = m_owningLayer.renderingContextRoot()) {
-        if (Node* node = root->layoutObject()->node())
-            id = static_cast<int>(WTF::PtrHash<Node*>::hash(node));
-    }
-
-    UpdateRenderingContextFunctor functor = { id };
-    ApplyToGraphicsLayersMode mode = ApplyToAllGraphicsLayers & ~ApplyToSquashingLayer;
-    ApplyToGraphicsLayers<UpdateRenderingContextFunctor>(this, functor, mode);
-}
-
-struct UpdateShouldFlattenTransformFunctor {
-    void operator() (GraphicsLayer* layer) const { layer->setShouldFlattenTransform(shouldFlatten); }
-    bool shouldFlatten;
-};
-
-void CompositedDeprecatedPaintLayerMapping::updateShouldFlattenTransform()
-{
-    // All CLM-managed layers that could affect a descendant layer should update their
-    // should-flatten-transform value (the other layers' transforms don't matter here).
-    UpdateShouldFlattenTransformFunctor functor = { !m_owningLayer.shouldPreserve3D() };
-    ApplyToGraphicsLayersMode mode = ApplyToLayersAffectedByPreserve3D;
-    ApplyToGraphicsLayers(this, functor, mode);
-
-    // Note, if we apply perspective, we have to set should flatten differently
-    // so that the transform propagates to child layers correctly.
-    if (hasChildTransformLayer()) {
-        ApplyToGraphicsLayers(this, [](GraphicsLayer* layer) {
-            layer->setShouldFlattenTransform(false);
-        }, ApplyToChildContainingLayers);
-    }
-
-    // Regardless, mark the scrolling contents layer and scrolling block
-    // selection layer (if they exist) as not flattening. Having them flatten
-    // causes unclipped render surfaces which cause bugs.
-    // http://crbug.com/521768
-    if (hasScrollingLayer()) {
-        m_scrollingContentsLayer->setShouldFlattenTransform(false);
-        if (m_scrollingBlockSelectionLayer)
-            m_scrollingBlockSelectionLayer->setShouldFlattenTransform(false);
-    }
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
-{
-    bool layerChanged = false;
-    if (needsForegroundLayer) {
-        if (!m_foregroundLayer) {
-            m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForForeground);
-            m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
-            layerChanged = true;
-        }
-    } else if (m_foregroundLayer) {
-        m_foregroundLayer->removeFromParent();
-        m_foregroundLayer = nullptr;
-        layerChanged = true;
-    }
-
-    return layerChanged;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer)
-{
-    bool layerChanged = false;
-    if (needsBackgroundLayer) {
-        if (!m_backgroundLayer) {
-            m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBackground);
-            m_backgroundLayer->setTransformOrigin(FloatPoint3D());
-            m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
-            layerChanged = true;
-        }
-    } else {
-        if (m_backgroundLayer) {
-            m_backgroundLayer->removeFromParent();
-            m_backgroundLayer = nullptr;
-            layerChanged = true;
-        }
-    }
-
-    if (layerChanged && !m_owningLayer.layoutObject()->documentBeingDestroyed())
-        compositor()->rootFixedBackgroundsChanged();
-
-    return layerChanged;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateMaskLayer(bool needsMaskLayer)
-{
-    bool layerChanged = false;
-    if (needsMaskLayer) {
-        if (!m_maskLayer) {
-            m_maskLayer = createGraphicsLayer(CompositingReasonLayerForMask);
-            m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
-            layerChanged = true;
-        }
-    } else if (m_maskLayer) {
-        m_maskLayer = nullptr;
-        layerChanged = true;
-    }
-
-    return layerChanged;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateClippingMaskLayers(bool needsChildClippingMaskLayer)
-{
-    bool layerChanged = false;
-    if (needsChildClippingMaskLayer) {
-        if (!m_childClippingMaskLayer) {
-            m_childClippingMaskLayer = createGraphicsLayer(CompositingReasonLayerForClippingMask);
-            m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildClippingMask);
-            layerChanged = true;
-        }
-    } else if (m_childClippingMaskLayer) {
-        m_childClippingMaskLayer = nullptr;
-        layerChanged = true;
-    }
-    return layerChanged;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateScrollingLayers(bool needsScrollingLayers)
-{
-    ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
-
-    bool layerChanged = false;
-    if (needsScrollingLayers) {
-        if (!m_scrollingLayer) {
-            // Outer layer which corresponds with the scroll view.
-            m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScrollingContainer);
-            m_scrollingLayer->setDrawsContent(false);
-            m_scrollingLayer->setMasksToBounds(true);
-
-            // Inner layer which renders the content that scrolls.
-            m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLayerForScrollingContents);
-            m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
-
-            if (!RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) {
-                m_scrollingBlockSelectionLayer = createGraphicsLayer(CompositingReasonLayerForScrollingBlockSelection);
-                m_scrollingBlockSelectionLayer->setDrawsContent(true);
-                m_scrollingContentsLayer->addChild(m_scrollingBlockSelectionLayer.get());
-            }
-
-            layerChanged = true;
-            if (scrollingCoordinator)
-                scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLayer.scrollableArea());
-        }
-    } else if (m_scrollingLayer) {
-        m_scrollingLayer = nullptr;
-        m_scrollingContentsLayer = nullptr;
-        m_scrollingBlockSelectionLayer = nullptr;
-        layerChanged = true;
-        if (scrollingCoordinator)
-            scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLayer.scrollableArea());
-    }
-
-    return layerChanged;
-}
-
-static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLayer* topmostLayer, DeprecatedPaintLayer* scrollParent, ScrollingCoordinator* scrollingCoordinator)
-{
-    if (!layer)
-        return;
-
-    // Only the topmost layer has a scroll parent. All other layers have a null scroll parent.
-    if (layer != topmostLayer)
-        scrollParent = 0;
-
-    scrollingCoordinator->updateScrollParentForGraphicsLayer(layer, scrollParent);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateScrollParent(DeprecatedPaintLayer* scrollParent)
-{
-    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
-        GraphicsLayer* topmostLayer = childForSuperlayers();
-        updateScrollParentForGraphicsLayer(m_squashingContainmentLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
-        updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
-        updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
-    }
-}
-
-static void updateClipParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLayer* topmostLayer, DeprecatedPaintLayer* clipParent, ScrollingCoordinator* scrollingCoordinator)
-{
-    if (!layer)
-        return;
-
-    // Only the topmost layer has a scroll parent. All other layers have a null scroll parent.
-    if (layer != topmostLayer)
-        clipParent = 0;
-
-    scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateClipParent(DeprecatedPaintLayer* scrollParent)
-{
-    if (owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent))
-        return;
-
-    DeprecatedPaintLayer* clipParent = m_owningLayer.clipParent();
-    if (clipParent)
-        clipParent = clipParent->enclosingLayerWithCompositedDeprecatedPaintLayerMapping(IncludeSelf);
-
-    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
-        GraphicsLayer* topmostLayer = childForSuperlayers();
-        updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), topmostLayer, clipParent, scrollingCoordinator);
-        updateClipParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmostLayer, clipParent, scrollingCoordinator);
-        updateClipParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, clipParent, scrollingCoordinator);
-    }
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateSquashingLayers(bool needsSquashingLayers)
-{
-    bool layersChanged = false;
-
-    if (needsSquashingLayers) {
-        if (!m_squashingLayer) {
-            m_squashingLayer = createGraphicsLayer(CompositingReasonLayerForSquashingContents);
-            m_squashingLayer->setDrawsContent(true);
-            layersChanged = true;
-        }
-
-        if (m_ancestorClippingLayer) {
-            if (m_squashingContainmentLayer) {
-                m_squashingContainmentLayer->removeFromParent();
-                m_squashingContainmentLayer = nullptr;
-                layersChanged = true;
-            }
-        } else {
-            if (!m_squashingContainmentLayer) {
-                m_squashingContainmentLayer = createGraphicsLayer(CompositingReasonLayerForSquashingContainer);
-                m_squashingContainmentLayer->setShouldFlattenTransform(false);
-                layersChanged = true;
-            }
-        }
-
-        ASSERT((m_ancestorClippingLayer && !m_squashingContainmentLayer) || (!m_ancestorClippingLayer && m_squashingContainmentLayer));
-        ASSERT(m_squashingLayer);
-    } else {
-        if (m_squashingLayer) {
-            m_squashingLayer->removeFromParent();
-            m_squashingLayer = nullptr;
-            layersChanged = true;
-        }
-        if (m_squashingContainmentLayer) {
-            m_squashingContainmentLayer->removeFromParent();
-            m_squashingContainmentLayer = nullptr;
-            layersChanged = true;
-        }
-        ASSERT(!m_squashingLayer && !m_squashingContainmentLayer);
-    }
-
-    return layersChanged;
-}
-
-GraphicsLayerPaintingPhase CompositedDeprecatedPaintLayerMapping::paintingPhaseForPrimaryLayer() const
-{
-    unsigned phase = 0;
-    if (!m_backgroundLayer)
-        phase |= GraphicsLayerPaintBackground;
-    if (!m_foregroundLayer)
-        phase |= GraphicsLayerPaintForeground;
-    if (!m_maskLayer)
-        phase |= GraphicsLayerPaintMask;
-
-    if (m_scrollingContentsLayer) {
-        phase &= ~GraphicsLayerPaintForeground;
-        phase |= GraphicsLayerPaintCompositedScroll;
-    }
-
-    return static_cast<GraphicsLayerPaintingPhase>(phase);
-}
-
-float CompositedDeprecatedPaintLayerMapping::compositingOpacity(float layoutObjectOpacity) const
-{
-    float finalOpacity = layoutObjectOpacity;
-
-    for (DeprecatedPaintLayer* curr = m_owningLayer.parent(); curr; curr = curr->parent()) {
-        // We only care about parents that are stacking contexts.
-        // Recall that opacity creates stacking context.
-        if (!curr->stackingNode()->isStackingContext())
-            continue;
-
-        // If we found a composited layer, regardless of whether it actually
-        // paints into it, we want to compute opacity relative to it. So we can
-        // break here.
-        //
-        // FIXME: with grouped backings, a composited descendant will have to
-        // continue past the grouped (squashed) layers that its parents may
-        // contribute to. This whole confusion can be avoided by specifying
-        // explicitly the composited ancestor where we would stop accumulating
-        // opacity.
-        if (curr->compositingState() == PaintsIntoOwnBacking)
-            break;
-
-        finalOpacity *= curr->layoutObject()->opacity();
-    }
-
-    return finalOpacity;
-}
-
-Color CompositedDeprecatedPaintLayerMapping::layoutObjectBackgroundColor() const
-{
-    return layoutObject()->resolveColor(CSSPropertyBackgroundColor);
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateBackgroundColor()
-{
-    m_graphicsLayer->setBackgroundColor(layoutObjectBackgroundColor());
-}
-
-bool CompositedDeprecatedPaintLayerMapping::paintsChildren() const
-{
-    if (m_owningLayer.hasVisibleContent() && m_owningLayer.hasNonEmptyChildLayoutObjects())
-        return true;
-
-    if (hasVisibleNonCompositingDescendant(&m_owningLayer))
-        return true;
-
-    return false;
-}
-
-static bool isCompositedPlugin(LayoutObject* layoutObject)
-{
-    return layoutObject->isEmbeddedObject() && toLayoutEmbeddedObject(layoutObject)->requiresAcceleratedCompositing();
-}
-
-bool CompositedDeprecatedPaintLayerMapping::hasVisibleNonCompositingDescendant(DeprecatedPaintLayer* parent)
-{
-    if (!parent->hasVisibleDescendant())
-        return false;
-
-    // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
-    parent->stackingNode()->updateLayerListsIfNeeded();
-
-#if ENABLE(ASSERT)
-    LayerListMutationDetector mutationChecker(parent->stackingNode());
-#endif
-
-    DeprecatedPaintLayerStackingNodeIterator normalFlowIterator(*parent->stackingNode(), AllChildren);
-    while (DeprecatedPaintLayerStackingNode* curNode = normalFlowIterator.next()) {
-        DeprecatedPaintLayer* curLayer = curNode->layer();
-        if (curLayer->hasCompositedDeprecatedPaintLayerMapping())
-            continue;
-        if (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer))
-            return true;
-    }
-
-    return false;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::containsPaintedContent() const
-{
-    if (m_owningLayer.isReflection())
-        return false;
-
-    if (layoutObject()->isImage() && isDirectlyCompositedImage())
-        return false;
-
-    LayoutObject* layoutObject = this->layoutObject();
-    // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
-    // and set background color on the layer in that case, instead of allocating backing store and painting.
-    if (layoutObject->isVideo() && toLayoutVideo(layoutObject)->shouldDisplayVideo())
-        return m_owningLayer.hasBoxDecorationsOrBackground();
-
-    if (m_owningLayer.hasVisibleBoxDecorations())
-        return true;
-
-    if (layoutObject->hasMask()) // masks require special treatment
-        return true;
-
-    if (layoutObject->isReplaced() && !isCompositedPlugin(layoutObject))
-        return true;
-
-    if (layoutObject->isLayoutMultiColumnSet())
-        return true;
-
-    if (layoutObject->node() && layoutObject->node()->isDocumentNode()) {
-        // Look to see if the root object has a non-simple background
-        LayoutObject* rootObject = layoutObject->document().documentElement() ? layoutObject->document().documentElement()->layoutObject() : 0;
-        // Reject anything that has a border, a border-radius or outline,
-        // or is not a simple background (no background, or solid color).
-        if (rootObject && hasBoxDecorationsOrBackgroundImage(rootObject->styleRef()))
-            return true;
-
-        // Now look at the body's layoutObject.
-        HTMLElement* body = layoutObject->document().body();
-        LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject() : 0;
-        if (bodyObject && hasBoxDecorationsOrBackgroundImage(bodyObject->styleRef()))
-            return true;
-    }
-
-    // FIXME: it's O(n^2). A better solution is needed.
-    return paintsChildren();
-}
-
-// An image can be directly compositing if it's the sole content of the layer, and has no box decorations
-// that require painting. Direct compositing saves backing store.
-bool CompositedDeprecatedPaintLayerMapping::isDirectlyCompositedImage() const
-{
-    ASSERT(layoutObject()->isImage());
-
-    LayoutObject* layoutObject = this->layoutObject();
-    if (m_owningLayer.hasBoxDecorationsOrBackground() || layoutObject->hasClip() || layoutObject->hasClipPath())
-        return false;
-
-    LayoutImage* imageLayoutObject = toLayoutImage(layoutObject);
-    if (ImageResource* cachedImage = imageLayoutObject->cachedImage()) {
-        if (!cachedImage->hasImage())
-            return false;
-
-        Image* image = cachedImage->imageForLayoutObject(imageLayoutObject);
-        if (!image->isBitmapImage())
-            return false;
-
-        // FIXME: We should be able to handle bitmap images using direct compositing
-        // no matter what image-orientation value. See crbug.com/502267
-        if (imageLayoutObject->style()->respectImageOrientation() != RespectImageOrientation)
-            return true;
-    }
-
-    return false;
-}
-
-void CompositedDeprecatedPaintLayerMapping::contentChanged(ContentChangeType changeType)
-{
-    if ((changeType == ImageChanged) && layoutObject()->isImage() && isDirectlyCompositedImage()) {
-        updateImageContents();
-        return;
-    }
-
-    if (changeType == CanvasChanged && isAcceleratedCanvas(layoutObject())) {
-        m_graphicsLayer->setContentsNeedsDisplay();
-        return;
-    }
-}
-
-void CompositedDeprecatedPaintLayerMapping::updateImageContents()
-{
-    ASSERT(layoutObject()->isImage());
-    LayoutImage* imageLayoutObject = toLayoutImage(layoutObject());
-
-    ImageResource* cachedImage = imageLayoutObject->cachedImage();
-    if (!cachedImage)
-        return;
-
-    Image* image = cachedImage->imageForLayoutObject(imageLayoutObject);
-    if (!image)
-        return;
-
-    // This is a no-op if the layer doesn't have an inner layer for the image.
-    m_graphicsLayer->setContentsToImage(image);
-
-    m_graphicsLayer->setFilterQuality(layoutObject()->style()->imageRendering() == ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality);
-
-    // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632
-    updateDrawsContent();
-
-    // Image animation is "lazy", in that it automatically stops unless someone is drawing
-    // the image. So we have to kick the animation each time; this has the downside that the
-    // image will keep animating, even if its layer is not visible.
-    image->startAnimation();
-}
-
-FloatPoint3D CompositedDeprecatedPaintLayerMapping::computeTransformOrigin(const IntRect& borderBox) const
-{
-    const ComputedStyle& style = layoutObject()->styleRef();
-
-    FloatPoint3D origin;
-    origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width()));
-    origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height()));
-    origin.setZ(style.transformOriginZ());
-
-    return origin;
-}
-
-// Return the offset from the top-left of this compositing layer at which the
-// LayoutObject's contents are painted.
-LayoutSize CompositedDeprecatedPaintLayerMapping::contentOffsetInCompositingLayer() const
-{
-    ASSERT(!m_contentOffsetInCompositingLayerDirty);
-    return m_contentOffsetInCompositingLayer;
-}
-
-LayoutRect CompositedDeprecatedPaintLayerMapping::contentsBox() const
-{
-    LayoutRect contentsBox = LayoutRect(contentsRect(layoutObject()));
-    contentsBox.move(contentOffsetInCompositingLayer());
-    return contentsBox;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::needsToReparentOverflowControls() const
-{
-    return m_owningLayer.scrollableArea()
-        && m_owningLayer.scrollableArea()->hasOverlayScrollbars()
-        && m_owningLayer.scrollableArea()->topmostScrollChild();
-}
-
-GraphicsLayer* CompositedDeprecatedPaintLayerMapping::detachLayerForOverflowControls(const DeprecatedPaintLayer& enclosingLayer)
-{
-    GraphicsLayer* host = m_overflowControlsClippingLayer.get();
-    if (!host)
-        host = m_overflowControlsHostLayer.get();
-    host->removeFromParent();
-    return host;
-}
-
-GraphicsLayer* CompositedDeprecatedPaintLayerMapping::parentForSublayers() const
-{
-    if (m_scrollingBlockSelectionLayer)
-        return m_scrollingBlockSelectionLayer.get();
-
-    if (m_scrollingContentsLayer)
-        return m_scrollingContentsLayer.get();
-
-    if (m_childContainmentLayer)
-        return m_childContainmentLayer.get();
-
-    if (m_childTransformLayer)
-        return m_childTransformLayer.get();
-
-    return m_graphicsLayer.get();
-}
-
-GraphicsLayer* CompositedDeprecatedPaintLayerMapping::childForSuperlayers() const
-{
-    if (m_squashingContainmentLayer)
-        return m_squashingContainmentLayer.get();
-
-    if (m_ancestorClippingLayer)
-        return m_ancestorClippingLayer.get();
-
-    return m_graphicsLayer.get();
-}
-
-void CompositedDeprecatedPaintLayerMapping::setBlendMode(WebBlendMode blendMode)
-{
-    if (m_ancestorClippingLayer) {
-        m_ancestorClippingLayer->setBlendMode(blendMode);
-        m_graphicsLayer->setBlendMode(WebBlendModeNormal);
-    } else {
-        m_graphicsLayer->setBlendMode(blendMode);
-    }
-}
-
-GraphicsLayerUpdater::UpdateType CompositedDeprecatedPaintLayerMapping::updateTypeForChildren(GraphicsLayerUpdater::UpdateType updateType) const
-{
-    if (m_pendingUpdateScope >= GraphicsLayerUpdateSubtree)
-        return GraphicsLayerUpdater::ForceUpdate;
-    return updateType;
-}
-
-struct SetContentsNeedsDisplayFunctor {
-    void operator() (GraphicsLayer* layer) const
-    {
-        if (layer->drawsContent())
-            layer->setNeedsDisplay();
-    }
-};
-
-void CompositedDeprecatedPaintLayerMapping::setSquashingContentsNeedDisplay()
-{
-    ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToSquashingLayer);
-}
-
-void CompositedDeprecatedPaintLayerMapping::setContentsNeedDisplay()
-{
-    // FIXME: need to split out paint invalidations for the background.
-    ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToContentLayers);
-}
-
-struct SetContentsNeedsDisplayInRectFunctor {
-    void operator() (GraphicsLayer* layer) const
-    {
-        if (layer->drawsContent()) {
-            IntRect layerDirtyRect = r;
-            layerDirtyRect.move(-layer->offsetFromLayoutObject());
-            layer->setNeedsDisplayInRect(layerDirtyRect, invalidationReason);
-        }
-    }
-
-    IntRect r;
-    PaintInvalidationReason invalidationReason;
-};
-
-// r is in the coordinate space of the layer's layout object
-void CompositedDeprecatedPaintLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, PaintInvalidationReason invalidationReason)
-{
-    // FIXME: need to split out paint invalidations for the background.
-    // FIXME: need to distinguish invalidations for different layers (e.g. the main layer and scrolling layer). crbug.com/416535.
-    SetContentsNeedsDisplayInRectFunctor functor = {
-        enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
-        invalidationReason
-    };
-    ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
-}
-
-void CompositedDeprecatedPaintLayerMapping::invalidateDisplayItemClient(const DisplayItemClientWrapper& displayItemClient)
-{
-    // FIXME: need to split out paint invalidations for the background.
-    // FIXME: need to distinguish invalidations for different layers (e.g. the main layer and scrolling layer). crbug.com/416535.
-    ApplyToGraphicsLayers(this, [&displayItemClient](GraphicsLayer* layer) {
-        layer->invalidateDisplayItemClient(displayItemClient);
-    }, ApplyToContentLayers);
-}
-
-const GraphicsLayerPaintInfo* CompositedDeprecatedPaintLayerMapping::containingSquashedLayer(const LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, unsigned maxSquashedLayerIndex)
-{
-    for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) {
-        if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject()))
-            return &layers[i];
-    }
-    return nullptr;
-}
-
-const GraphicsLayerPaintInfo* CompositedDeprecatedPaintLayerMapping::containingSquashedLayer(const LayoutObject* layoutObject, unsigned maxSquashedLayerIndex)
-{
-    return CompositedDeprecatedPaintLayerMapping::containingSquashedLayer(layoutObject, m_squashedLayers, maxSquashedLayerIndex);
-}
-
-IntRect CompositedDeprecatedPaintLayerMapping::localClipRectForSquashedLayer(const DeprecatedPaintLayer& referenceLayer, const GraphicsLayerPaintInfo& paintInfo, const Vector<GraphicsLayerPaintInfo>& layers)
-{
-    const LayoutObject* clippingContainer = paintInfo.paintLayer->clippingContainer();
-    if (clippingContainer == referenceLayer.clippingContainer())
-        return LayoutRect::infiniteIntRect();
-
-    ASSERT(clippingContainer);
-
-    const GraphicsLayerPaintInfo* ancestorPaintInfo = containingSquashedLayer(clippingContainer, layers, layers.size());
-    // Must be there, otherwise CompositingLayerAssigner::canSquashIntoCurrentSquashingOwner would have disallowed squashing.
-    ASSERT(ancestorPaintInfo);
-
-    // FIXME: this is a potential performance issue. We should consider caching these clip rects or otherwise optimizing.
-    ClipRectsContext clipRectsContext(ancestorPaintInfo->paintLayer, UncachedClipRects);
-    IntRect parentClipRect = pixelSnappedIntRect(paintInfo.paintLayer->clipper().backgroundClipRect(clipRectsContext).rect());
-    ASSERT(parentClipRect != LayoutRect::infiniteIntRect());
-
-    // Convert from ancestor to local coordinates.
-    IntSize ancestorToLocalOffset = paintInfo.offsetFromLayoutObject - ancestorPaintInfo->offsetFromLayoutObject;
-    parentClipRect.move(ancestorToLocalOffset);
-    return parentClipRect;
-}
-
-void CompositedDeprecatedPaintLayerMapping::doPaintTask(const GraphicsLayerPaintInfo& paintInfo, const PaintLayerFlags& paintLayerFlags, GraphicsContext* context,
-    const IntRect& clip /* In the coords of rootLayer */) const
-{
-    FontCachePurgePreventer fontCachePurgePreventer;
-
-    IntSize offset = paintInfo.offsetFromLayoutObject;
-    AffineTransform translation;
-    translation.translate(-offset.width(), -offset.height());
-    TransformRecorder transformRecorder(*context, *this, translation);
-
-    // The dirtyRect is in the coords of the painting root.
-    IntRect dirtyRect(clip);
-    dirtyRect.move(offset);
-
-    if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) {
-        LayoutRect bounds = paintInfo.compositedBounds;
-        bounds.move(paintInfo.paintLayer->subpixelAccumulation());
-        dirtyRect.intersect(pixelSnappedIntRect(bounds));
-    } else {
-        dirtyRect.move(roundedIntSize(paintInfo.paintLayer->subpixelAccumulation()));
-    }
-
-#if ENABLE(ASSERT)
-    paintInfo.paintLayer->layoutObject()->assertSubtreeIsLaidOut();
-#endif
-
-    float deviceScaleFactor = blink::deviceScaleFactor(paintInfo.paintLayer->layoutObject()->frame());
-    context->setDeviceScaleFactor(deviceScaleFactor);
-
-    if (paintInfo.paintLayer->compositingState() != PaintsIntoGroupedBacking) {
-        // FIXME: GraphicsLayers need a way to split for multicol.
-        DeprecatedPaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dirtyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation());
-        DeprecatedPaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context, paintingInfo, paintLayerFlags);
-
-        if (paintInfo.paintLayer->containsDirtyOverlayScrollbars())
-            DeprecatedPaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context, paintingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars);
-    } else {
-        DeprecatedPaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dirtyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation());
-
-        // DeprecatedPaintLayer::paintLayer assumes that the caller clips to the passed rect. Squashed layers need to do this clipping in software,
-        // since there is no graphics layer to clip them precisely. Furthermore, in some cases we squash layers that need clipping in software
-        // from clipping ancestors (see CompositedDeprecatedPaintLayerMapping::localClipRectForSquashedLayer()).
-        // FIXME: Is it correct to clip to dirtyRect in slimming paint mode?
-        // FIXME: Combine similar code here and LayerClipRecorder.
-        dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer);
-        {
-            ASSERT(context->displayItemList());
-            if (!context->displayItemList()->displayItemConstructionIsDisabled())
-                context->displayItemList()->createAndAppend<ClipDisplayItem>(*this, DisplayItem::ClipLayerOverflowControls, dirtyRect);
-        }
-        DeprecatedPaintLayerPainter(*paintInfo.paintLayer).paintLayer(context, paintingInfo, paintLayerFlags);
-        {
-            ASSERT(context->displayItemList());
-            if (!context->displayItemList()->displayItemConstructionIsDisabled()) {
-                if (context->displayItemList()->lastDisplayItemIsNoopBegin())
-                    context->displayItemList()->removeLastDisplayItem();
-                else
-                    context->displayItemList()->createAndAppend<EndClipDisplayItem>(*this, DisplayItem::clipTypeToEndClipType(DisplayItem::ClipLayerOverflowControls));
-            }
-        }
-    }
-}
-
-static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
-{
-    if (!scrollbar)
-        return;
-
-    const IntRect& scrollbarRect = scrollbar->frameRect();
-    TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::translation(-scrollbarRect.x(), -scrollbarRect.y()));
-    IntRect transformedClip = clip;
-    transformedClip.moveBy(scrollbarRect.location());
-    scrollbar->paint(&context, transformedClip);
-}
-
-// Up-call from compositing layer drawing callback.
-void CompositedDeprecatedPaintLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, const IntRect& clip) const
-{
-    // https://code.google.com/p/chromium/issues/detail?id=343772
-    DisableCompositingQueryAsserts disabler;
-#if ENABLE(ASSERT)
-    // FIXME: once the state machine is ready, this can be removed and we can refer to that instead.
-    if (Page* page = layoutObject()->frame()->page())
-        page->setIsPainting(true);
-#endif
-    TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data(m_owningLayer.layoutObject(), LayoutRect(clip), graphicsLayer));
-
-    PaintLayerFlags paintLayerFlags = 0;
-    if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground)
-        paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase;
-    if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground)
-        paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase;
-    if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask)
-        paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase;
-    if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask)
-        paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase;
-    if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents)
-        paintLayerFlags |= PaintLayerPaintingOverflowContents;
-    if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll)
-        paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase;
-
-    if (graphicsLayer == m_backgroundLayer)
-        paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers.
-    else if (compositor()->fixedRootBackgroundLayer())
-        paintLayerFlags |= PaintLayerPaintingSkipRootBackground;
-
-    if (graphicsLayer == m_graphicsLayer.get()
-        || graphicsLayer == m_foregroundLayer.get()
-        || graphicsLayer == m_backgroundLayer.get()
-        || graphicsLayer == m_maskLayer.get()
-        || graphicsLayer == m_childClippingMaskLayer.get()
-        || graphicsLayer == m_scrollingContentsLayer.get()
-        || graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
-
-        GraphicsLayerPaintInfo paintInfo;
-        paintInfo.paintLayer = &m_owningLayer;
-        paintInfo.compositedBounds = compositedBounds();
-        paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject();
-
-        // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
-        doPaintTask(paintInfo, paintLayerFlags, &context, clip);
-    } else if (graphicsLayer == m_squashingLayer.get()) {
-        for (size_t i = 0; i < m_squashedLayers.size(); ++i)
-            doPaintTask(m_squashedLayers[i], paintLayerFlags, &context, clip);
-    } else if (graphicsLayer == layerForHorizontalScrollbar()) {
-        paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), context, clip);
-    } else if (graphicsLayer == layerForVerticalScrollbar()) {
-        paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), context, clip);
-    } else if (graphicsLayer == layerForScrollCorner()) {
-        IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()->scrollCornerAndResizerRect().location();
-        ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner(&context, -scrollCornerAndResizerLocation, clip);
-        ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&context, -scrollCornerAndResizerLocation, clip);
-    }
-    InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLayer, &context, LayoutRect(clip));
-#if ENABLE(ASSERT)
-    if (Page* page = layoutObject()->frame()->page())
-        page->setIsPainting(false);
-#endif
-}
-
-bool CompositedDeprecatedPaintLayerMapping::isTrackingPaintInvalidations() const
-{
-    GraphicsLayerClient* client = compositor();
-    return client ? client->isTrackingPaintInvalidations() : false;
-}
-
-#if ENABLE(ASSERT)
-void CompositedDeprecatedPaintLayerMapping::verifyNotPainting()
-{
-    ASSERT(!layoutObject()->frame()->page() || !layoutObject()->frame()->page()->isPainting());
-}
-#endif
-
-void CompositedDeprecatedPaintLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double monotonicTime, int group)
-{
-    layoutObject()->node()->document().compositorPendingAnimations().notifyCompositorAnimationStarted(monotonicTime, group);
-}
-
-IntRect CompositedDeprecatedPaintLayerMapping::pixelSnappedCompositedBounds() const
-{
-    LayoutRect bounds = m_compositedBounds;
-    bounds.move(m_owningLayer.subpixelAccumulation());
-    return pixelSnappedIntRect(bounds);
-}
-
-bool CompositedDeprecatedPaintLayerMapping::invalidateLayerIfNoPrecedingEntry(size_t indexToClear)
-{
-    DeprecatedPaintLayer* layerToRemove = m_squashedLayers[indexToClear].paintLayer;
-    size_t previousIndex = 0;
-    for (; previousIndex < indexToClear; ++previousIndex) {
-        if (m_squashedLayers[previousIndex].paintLayer == layerToRemove)
-            break;
-    }
-    if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this) {
-        compositor()->paintInvalidationOnCompositingChange(layerToRemove);
-        return true;
-    }
-    return false;
-}
-
-bool CompositedDeprecatedPaintLayerMapping::updateSquashingLayerAssignment(DeprecatedPaintLayer* squashedLayer, size_t nextSquashedLayerIndex)
-{
-    GraphicsLayerPaintInfo paintInfo;
-    paintInfo.paintLayer = squashedLayer;
-    // NOTE: composited bounds are updated elsewhere
-    // NOTE: offsetFromLayoutObject is updated elsewhere
-
-    // Change tracking on squashing layers: at the first sign of something changed, just invalidate the layer.
-    // FIXME: Perhaps we can find a tighter more clever mechanism later.
-    if (nextSquashedLayerIndex < m_squashedLayers.size()) {
-        if (paintInfo.paintLayer == m_squashedLayers[nextSquashedLayerIndex].paintLayer)
-            return false;
-
-        // Must invalidate before adding the squashed layer to the mapping.
-        compositor()->paintInvalidationOnCompositingChange(squashedLayer);
-
-        // If the layer which was previously at |nextSquashedLayerIndex| is not earlier in the grouped mapping, invalidate its current
-        // backing now, since it will move later or be removed from the squashing layer.
-        invalidateLayerIfNoPrecedingEntry(nextSquashedLayerIndex);
-
-        m_squashedLayers.insert(nextSquashedLayerIndex, paintInfo);
-    } else {
-        // Must invalidate before adding the squashed layer to the mapping.
-        compositor()->paintInvalidationOnCompositingChange(squashedLayer);
-        m_squashedLayers.append(paintInfo);
-    }
-    squashedLayer->setGroupedMapping(this, DeprecatedPaintLayer::InvalidateLayerAndRemoveFromMapping);
-
-    return true;
-}
-
-void CompositedDeprecatedPaintLayerMapping::removeLayerFromSquashingGraphicsLayer(const DeprecatedPaintLayer* layer)
-{
-    size_t layerIndex = 0;
-    for (; layerIndex < m_squashedLayers.size(); ++layerIndex) {
-        if (m_squashedLayers[layerIndex].paintLayer == layer)
-            break;
-    }
-
-    // Assert on incorrect mappings between layers and groups
-    ASSERT(layerIndex < m_squashedLayers.size());
-    if (layerIndex == m_squashedLayers.size())
-        return;
-
-    m_squashedLayers.remove(layerIndex);
-}
-
-#if ENABLE(ASSERT)
-bool CompositedDeprecatedPaintLayerMapping::verifyLayerInSquashingVector(const DeprecatedPaintLayer* layer)
-{
-    for (size_t layerIndex = 0; layerIndex < m_squashedLayers.size(); ++layerIndex) {
-        if (m_squashedLayers[layerIndex].paintLayer == layer)
-            return true;
-    }
-
-    return false;
-}
-#endif
-
-void CompositedDeprecatedPaintLayerMapping::finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex)
-{
-    if (nextSquashedLayerIndex < m_squashedLayers.size()) {
-        // Any additional squashed Layers in the array no longer belong here, but they might have been
-        // added already at an earlier index. Clear pointers on those that do not appear in the valid set
-        // before removing all the extra entries.
-        for (size_t i = nextSquashedLayerIndex; i < m_squashedLayers.size(); ++i) {
-            if (invalidateLayerIfNoPrecedingEntry(i))
-                m_squashedLayers[i].paintLayer->setGroupedMapping(nullptr, DeprecatedPaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
-        }
-
-        m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex);
-    }
-}
-
-String CompositedDeprecatedPaintLayerMapping::debugName(const GraphicsLayer* graphicsLayer)
-{
-    String name;
-    if (graphicsLayer == m_graphicsLayer.get()) {
-        name = m_owningLayer.debugName();
-    } else if (graphicsLayer == m_squashingContainmentLayer.get()) {
-        name = "Squashing Containment Layer";
-    } else if (graphicsLayer == m_squashingLayer.get()) {
-        name = "Squashing Layer";
-    } else if (graphicsLayer == m_ancestorClippingLayer.get()) {
-        name = "Ancestor Clipping Layer";
-    } else if (graphicsLayer == m_foregroundLayer.get()) {
-        name = m_owningLayer.debugName() + " (foreground) Layer";
-    } else if (graphicsLayer == m_backgroundLayer.get()) {
-        name = m_owningLayer.debugName() + " (background) Layer";
-    } else if (graphicsLayer == m_childContainmentLayer.get()) {
-        name = "Child Containment Layer";
-    } else if (graphicsLayer == m_childTransformLayer.get()) {
-        name = "Child Transform Layer";
-    } else if (graphicsLayer == m_maskLayer.get()) {
-        name = "Mask Layer";
-    } else if (graphicsLayer == m_childClippingMaskLayer.get()) {
-        name = "Child Clipping Mask Layer";
-    } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
-        name = "Horizontal Scrollbar Layer";
-    } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
-        name = "Vertical Scrollbar Layer";
-    } else if (graphicsLayer == m_layerForScrollCorner.get()) {
-        name = "Scroll Corner Layer";
-    } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
-        name = "Overflow Controls Host Layer";
-    } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) {
-        name = "Overflow Controls ClipLayer Layer";
-    } else if (graphicsLayer == m_scrollingLayer.get()) {
-        name = "Scrolling Layer";
-    } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
-        name = "Scrolling Contents Layer";
-    } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
-        name = "Scrolling Block Selection Layer";
-    } else {
-        ASSERT_NOT_REACHED();
-    }
-
-    return name;
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h b/third_party/WebKit/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h
deleted file mode 100644
index 50c83e76..0000000
--- a/third_party/WebKit/Source/core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CompositedDeprecatedPaintLayerMapping_h
-#define CompositedDeprecatedPaintLayerMapping_h
-
-#include "core/layout/compositing/GraphicsLayerUpdater.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "platform/geometry/FloatPoint.h"
-#include "platform/geometry/FloatPoint3D.h"
-#include "platform/graphics/GraphicsLayer.h"
-#include "platform/graphics/GraphicsLayerClient.h"
-#include "wtf/Allocator.h"
-
-namespace blink {
-
-class DeprecatedPaintLayerCompositor;
-
-// A GraphicsLayerPaintInfo contains all the info needed to paint a partial subtree of Layers into a GraphicsLayer.
-struct GraphicsLayerPaintInfo {
-    ALLOW_ONLY_INLINE_ALLOCATION();
-    DeprecatedPaintLayer* paintLayer;
-
-    LayoutRect compositedBounds;
-
-    // The clip rect to apply, in the local coordinate space of the squashed layer, when painting it.
-    IntRect localClipRectForSquashedLayer;
-
-    // Offset describing where this squashed Layer paints into the shared GraphicsLayer backing.
-    IntSize offsetFromLayoutObject;
-    bool offsetFromLayoutObjectSet;
-
-    GraphicsLayerPaintInfo() : paintLayer(nullptr), offsetFromLayoutObjectSet(false) { }
-};
-
-enum GraphicsLayerUpdateScope {
-    GraphicsLayerUpdateNone,
-    GraphicsLayerUpdateLocal,
-    GraphicsLayerUpdateSubtree,
-};
-
-// CompositedDeprecatedPaintLayerMapping keeps track of how Layers of the layout tree correspond to
-// GraphicsLayers of the composited layer tree. Each instance of CompositedDeprecatedPaintLayerMapping
-// manages a small cluster of GraphicsLayers and the references to which Layers
-// and paint phases contribute to each GraphicsLayer.
-//
-// Currently (Oct. 2013) there is one CompositedDeprecatedPaintLayerMapping for each Layer,
-// but this is likely to evolve soon.
-class CompositedDeprecatedPaintLayerMapping final : public GraphicsLayerClient {
-    WTF_MAKE_NONCOPYABLE(CompositedDeprecatedPaintLayerMapping); WTF_MAKE_FAST_ALLOCATED(CompositedDeprecatedPaintLayerMapping);
-public:
-    explicit CompositedDeprecatedPaintLayerMapping(DeprecatedPaintLayer&);
-    ~CompositedDeprecatedPaintLayerMapping() override;
-
-    DeprecatedPaintLayer& owningLayer() const { return m_owningLayer; }
-
-    bool updateGraphicsLayerConfiguration();
-    void updateGraphicsLayerGeometry(const DeprecatedPaintLayer* compositingContainer, const DeprecatedPaintLayer* compositingStackingContext, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
-
-    // Update whether layer needs blending.
-    void updateContentsOpaque();
-
-    GraphicsLayer* mainGraphicsLayer() const { return m_graphicsLayer.get(); }
-
-    // Layer to clip children
-    bool hasClippingLayer() const { return m_childContainmentLayer; }
-    GraphicsLayer* clippingLayer() const { return m_childContainmentLayer.get(); }
-
-    // Layer to get clipped by ancestor
-    bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer; }
-    GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); }
-
-    GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); }
-
-    GraphicsLayer* backgroundLayer() const { return m_backgroundLayer.get(); }
-    bool backgroundLayerPaintsFixedRootBackground() const { return m_backgroundLayerPaintsFixedRootBackground; }
-
-    bool hasScrollingLayer() const { return m_scrollingLayer; }
-    GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); }
-    GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
-    GraphicsLayer* scrollingBlockSelectionLayer() const { return m_scrollingBlockSelectionLayer.get(); }
-
-    bool hasMaskLayer() const { return m_maskLayer; }
-    GraphicsLayer* maskLayer() const { return m_maskLayer.get(); }
-
-    bool hasChildClippingMaskLayer() const { return m_childClippingMaskLayer; }
-    GraphicsLayer* childClippingMaskLayer() const { return m_childClippingMaskLayer.get(); }
-
-    GraphicsLayer* parentForSublayers() const;
-    GraphicsLayer* childForSuperlayers() const;
-
-    bool hasChildTransformLayer() const { return m_childTransformLayer; }
-    GraphicsLayer* childTransformLayer() const { return m_childTransformLayer.get(); }
-
-    GraphicsLayer* squashingContainmentLayer() const { return m_squashingContainmentLayer.get(); }
-    GraphicsLayer* squashingLayer() const { return m_squashingLayer.get(); }
-
-    void setSquashingContentsNeedDisplay();
-    void setContentsNeedDisplay();
-    // LayoutRect is in the coordinate space of the layer's layout object.
-    void setContentsNeedDisplayInRect(const LayoutRect&, PaintInvalidationReason);
-
-    void invalidateDisplayItemClient(const DisplayItemClientWrapper&);
-
-    // Notification from the layoutObject that its content changed.
-    void contentChanged(ContentChangeType);
-
-    LayoutRect compositedBounds() const { return m_compositedBounds; }
-    IntRect pixelSnappedCompositedBounds() const;
-
-    void positionOverflowControlsLayers();
-    bool hasUnpositionedOverflowControlsLayers() const;
-
-    // Returns true if the assignment actually changed the assigned squashing layer.
-    bool updateSquashingLayerAssignment(DeprecatedPaintLayer* squashedLayer, size_t nextSquashedLayerIndex);
-    void removeLayerFromSquashingGraphicsLayer(const DeprecatedPaintLayer*);
-#if ENABLE(ASSERT)
-    bool verifyLayerInSquashingVector(const DeprecatedPaintLayer*);
-#endif
-
-    void finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex);
-    void updateRenderingContext();
-    void updateShouldFlattenTransform();
-
-    // GraphicsLayerClient interface
-    void notifyAnimationStarted(const GraphicsLayer*, double monotonicTime, int group) override;
-    void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip) const override;
-    bool isTrackingPaintInvalidations() const override;
-
-#if ENABLE(ASSERT)
-    void verifyNotPainting() override;
-#endif
-
-    LayoutRect contentsBox() const;
-
-    GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
-    GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
-    GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
-
-    // Returns true if the overflow controls cannot be positioned within this
-    // CLM's internal hierarchy without incorrectly stacking under some
-    // scrolling content. If this returns true, these controls must be
-    // repositioned in the graphics layer tree to ensure that they stack above
-    // scrolling content.
-    bool needsToReparentOverflowControls() const;
-
-    // Removes the overflow controls host layer from its parent and positions it
-    // so that it can be inserted as a sibling to this CLM without changing
-    // position.
-    GraphicsLayer* detachLayerForOverflowControls(const DeprecatedPaintLayer& enclosingLayer);
-
-    void updateFilters(const ComputedStyle&);
-    void updateBackdropFilters(const ComputedStyle&);
-
-    void setBlendMode(WebBlendMode);
-
-    bool needsGraphicsLayerUpdate() { return m_pendingUpdateScope > GraphicsLayerUpdateNone; }
-    void setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateScope scope) { m_pendingUpdateScope = std::max(static_cast<GraphicsLayerUpdateScope>(m_pendingUpdateScope), scope); }
-    void clearNeedsGraphicsLayerUpdate() { m_pendingUpdateScope = GraphicsLayerUpdateNone; }
-
-    GraphicsLayerUpdater::UpdateType updateTypeForChildren(GraphicsLayerUpdater::UpdateType) const;
-
-#if ENABLE(ASSERT)
-    void assertNeedsToUpdateGraphicsLayerBitsCleared() {  ASSERT(m_pendingUpdateScope == GraphicsLayerUpdateNone); }
-#endif
-
-    String debugName(const GraphicsLayer*) override;
-
-    LayoutSize contentOffsetInCompositingLayer() const;
-
-    LayoutPoint squashingOffsetFromTransformedAncestor()
-    {
-        return m_squashingLayerOffsetFromTransformedAncestor;
-    }
-
-    // If there is a squashed layer painting into this CLM that is an ancestor of the given LayoutObject, return it. Otherwise return nullptr.
-    const GraphicsLayerPaintInfo* containingSquashedLayer(const LayoutObject*, unsigned maxSquashedLayerIndex);
-
-    void updateScrollingBlockSelection();
-
-    DisplayItemClient displayItemClient() const { return toDisplayItemClient(this); }
-    String debugName() const { return "CompositedLayerMapping for " + owningLayer().debugName(); }
-
-private:
-    static const GraphicsLayerPaintInfo* containingSquashedLayer(const LayoutObject*,  const Vector<GraphicsLayerPaintInfo>& layers, unsigned maxSquashedLayerIndex);
-
-    // Helper methods to updateGraphicsLayerGeometry:
-    void computeGraphicsLayerParentLocation(const DeprecatedPaintLayer* compositingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLocation);
-    void updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const DeprecatedPaintLayer& referenceLayer, Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer*, LayoutPoint* offsetFromTransformedAncestor, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
-    void updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& graphicsLayerParentLocation);
-    void updateAncestorClippingLayerGeometry(const DeprecatedPaintLayer* compositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLayerParentLocation);
-    void updateOverflowControlsHostLayerGeometry(const DeprecatedPaintLayer* compositingStackingContext, const DeprecatedPaintLayer* compositingContainer);
-    void updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds);
-    void updateChildTransformLayerGeometry();
-    void updateMaskLayerGeometry();
-    void updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAncestor, const IntRect& relativeCompositingBounds);
-    void updateForegroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize, const IntRect& clippingBox);
-    void updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize);
-    void updateReflectionLayerGeometry(Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
-    void updateScrollingLayerGeometry(const IntRect& localCompositingBounds);
-    void updateChildClippingMaskLayerGeometry();
-
-    void createPrimaryGraphicsLayer();
-    void destroyGraphicsLayers();
-
-    PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons);
-    bool toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>&, bool needsLayer, CompositingReasons);
-
-    LayoutBoxModelObject* layoutObject() const { return m_owningLayer.layoutObject(); }
-    DeprecatedPaintLayerCompositor* compositor() const { return m_owningLayer.compositor(); }
-
-    void updateInternalHierarchy();
-    void updatePaintingPhases();
-    bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);
-    bool updateChildTransformLayer(bool needsChildTransformLayer);
-    bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip);
-    bool updateForegroundLayer(bool needsForegroundLayer);
-    bool updateBackgroundLayer(bool needsBackgroundLayer);
-    bool updateMaskLayer(bool needsMaskLayer);
-    bool updateClippingMaskLayers(bool needsChildClippingMaskLayer);
-    bool requiresHorizontalScrollbarLayer() const { return m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->horizontalScrollbar(); }
-    bool requiresVerticalScrollbarLayer() const { return m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->verticalScrollbar(); }
-    bool requiresScrollCornerLayer() const { return m_owningLayer.scrollableArea() && !m_owningLayer.scrollableArea()->scrollCornerAndResizerRect().isEmpty(); }
-    bool updateScrollingLayers(bool scrollingLayers);
-    void updateScrollParent(DeprecatedPaintLayer*);
-    void updateClipParent(DeprecatedPaintLayer* scrollParent);
-    bool updateSquashingLayers(bool needsSquashingLayers);
-    void updateDrawsContent();
-    void updateChildrenTransform();
-    void updateCompositedBounds();
-    void registerScrollingLayers();
-
-    // Also sets subpixelAccumulation on the layer.
-    void computeBoundsOfOwningLayer(const DeprecatedPaintLayer* compositedAncestor, IntRect& localCompositingBounds, IntRect& compositingBoundsRelativeToCompositedAncestor, LayoutPoint& offsetFromCompositedAncestor, IntPoint& snappedOffsetFromCompositedAncestor);
-
-    void setBackgroundLayerPaintsFixedRootBackground(bool);
-
-    GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
-
-    // Result is transform origin in pixels.
-    FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
-
-    void updateOpacity(const ComputedStyle&);
-    void updateTransform(const ComputedStyle&);
-    void updateLayerBlendMode(const ComputedStyle&);
-    void updateIsRootForIsolatedGroup();
-    // Return the opacity value that this layer should use for compositing.
-    float compositingOpacity(float layoutObjectOpacity) const;
-
-    bool paintsChildren() const;
-
-    // Returns true if this layer has content that needs to be displayed by painting into the backing store.
-    bool containsPaintedContent() const;
-    // Returns true if the Layer just contains an image that we can composite directly.
-    bool isDirectlyCompositedImage() const;
-    void updateImageContents();
-
-    Color layoutObjectBackgroundColor() const;
-    void updateBackgroundColor();
-    void updateContentsRect();
-    void updateContentsOffsetInCompositingLayer(const IntPoint& snappedOffsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation);
-    void updateAfterPartResize();
-    void updateCompositingReasons();
-
-    static bool hasVisibleNonCompositingDescendant(DeprecatedPaintLayer* parent);
-
-    void doPaintTask(const GraphicsLayerPaintInfo&, const PaintLayerFlags&, GraphicsContext*, const IntRect& clip) const;
-
-    // Computes the background clip rect for the given squashed layer, up to any containing layer that is squashed into the
-    // same squashing layer and contains this squashed layer's clipping ancestor.
-    // The clip rect is returned in the coordinate space of the given squashed layer.
-    // If there is no such containing layer, returns the infinite rect.
-    // FIXME: unify this code with the code that sets up m_ancestorClippingLayer. They are doing very similar things.
-    static IntRect localClipRectForSquashedLayer(const DeprecatedPaintLayer& referenceLayer, const GraphicsLayerPaintInfo&,  const Vector<GraphicsLayerPaintInfo>& layers);
-
-    // Return true if |m_owningLayer|'s compositing ancestor is not a descendant (inclusive) of the
-    // clipping container for |m_owningLayer|.
-    bool owningLayerClippedByLayerNotAboveCompositedAncestor(DeprecatedPaintLayer* scrollParent);
-
-    DeprecatedPaintLayer* scrollParent();
-
-    // Clear the groupedMapping entry on the layer at the given index, only if that layer does
-    // not appear earlier in the set of layers for this object.
-    bool invalidateLayerIfNoPrecedingEntry(size_t);
-
-    DeprecatedPaintLayer& m_owningLayer;
-
-    // The hierarchy of layers that is maintained by the CompositedDeprecatedPaintLayerMapping looks like this:
-    //
-    //  + m_ancestorClippingLayer [OPTIONAL]
-    //    + m_graphicsLayer
-    //      + m_childTransformLayer [OPTIONAL]
-    //      | + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTIONAL]
-    //      |                                             + m_scrollingContentsLayer [Present iff m_scrollingLayer is present]
-    //      |                                               + m_scrollingBlockSelectionLayer [Present iff m_scrollingLayer is present]
-    //      + m_overflowControlsClippingLayer [OPTIONAL] // *The overflow controls may need to be repositioned in the
-    //        + m_overflowControlsHostLayer [OPTIONAL]   //  graphics layer tree by the RLC to ensure that they stack
-    //          + m_layerForVerticalScrollbar [OPTIONAL] //  above scrolling content.
-    //          + m_layerForHorizontalScrollbar [OPTIONAL]
-    //          + m_layerForScrollCorner [OPTIONAL]
-    //
-    // We need an ancestor clipping layer if our clipping ancestor is not our ancestor in the
-    // clipping tree. Here's what that might look like.
-    //
-    // Let A = the clipping ancestor,
-    //     B = the clip descendant, and
-    //     SC = the stacking context that is the ancestor of A and B in the stacking tree.
-    //
-    // SC
-    //  + A = m_graphicsLayer
-    //  |  + m_childContainmentLayer
-    //  |     + ...
-    //  ...
-    //  |
-    //  + B = m_ancestorClippingLayer [+]
-    //     + m_graphicsLayer
-    //        + ...
-    //
-    // In this case B is clipped by another layer that doesn't happen to be its ancestor: A.
-    // So we create an ancestor clipping layer for B, [+], which ensures that B is clipped
-    // as if it had been A's descendant.
-    OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context.
-    OwnPtr<GraphicsLayer> m_graphicsLayer;
-    OwnPtr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children.
-    OwnPtr<GraphicsLayer> m_childTransformLayer; // Only used if we have perspective.
-    OwnPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling.
-    OwnPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling.
-    OwnPtr<GraphicsLayer> m_scrollingBlockSelectionLayer; // Only used if the layer is using composited scrolling, but has no scrolling contents apart from block selection gaps.
-
-    // This layer is also added to the hierarchy by the RLB, but in a different way than
-    // the layers above. It's added to m_graphicsLayer as its mask layer (naturally) if
-    // we have a mask, and isn't part of the typical hierarchy (it has no children).
-    OwnPtr<GraphicsLayer> m_maskLayer; // Only used if we have a mask.
-    OwnPtr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path.
-
-    // There are two other (optional) layers whose painting is managed by the CompositedDeprecatedPaintLayerMapping,
-    // but whose position in the hierarchy is maintained by the DeprecatedPaintLayerCompositor. These
-    // are the foreground and background layers. The foreground layer exists if we have composited
-    // descendants with negative z-order. We need the extra layer in this case because the layer
-    // needs to draw both below (for the background, say) and above (for the normal flow content, say)
-    // the negative z-order descendants and this is impossible with a single layer. The RLC handles
-    // inserting m_foregroundLayer in the correct position in our descendant list for us (right after
-    // the neg z-order dsecendants).
-    //
-    // The background layer is only created if this is the root layer and our background is entirely
-    // fixed. In this case we want to put the background in a separate composited layer so that when
-    // we scroll, we don't have to re-raster the background into position. This layer is also inserted
-    // into the tree by the RLC as it gets a special home. This layer becomes a descendant of the
-    // frame clipping layer. That is:
-    //   ...
-    //     + frame clipping layer
-    //       + m_backgroundLayer
-    //       + frame scrolling layer
-    //         + root content layer
-    //
-    // With the hierarchy set up like this, the root content layer is able to scroll without affecting
-    // the background layer (or paint invalidation).
-    OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately.
-    OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately.
-
-    OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
-    OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
-    OwnPtr<GraphicsLayer> m_layerForScrollCorner;
-
-    // This layer exists to simplify the reparenting of overflow control that is occasionally required
-    // to ensure that scrollbars appear above scrolling content.
-    OwnPtr<GraphicsLayer> m_overflowControlsHostLayer;
-
-    // The reparented overflow controls sometimes need to be clipped by a non-ancestor. In just the same
-    // way we need an ancestor clipping layer to clip this CLM's internal hierarchy, we add another layer
-    // to clip the overflow controls. It would be possible to make m_overflowControlsHostLayer be
-    // responsible for applying this clip, but that could require repositioning all of the overflow
-    // controls since the this clip may apply an offset. By using a separate layer, the overflow controls
-    // can remain ignorant of the layers above them and still work correctly.
-    OwnPtr<GraphicsLayer> m_overflowControlsClippingLayer;
-
-    // A squashing CLM has two possible squashing-related structures.
-    //
-    // If m_ancestorClippingLayer is present:
-    //
-    // m_ancestorClippingLayer
-    //   + m_graphicsLayer
-    //   + m_squashingLayer
-    //
-    // If not:
-    //
-    // m_squashingContainmentLayer
-    //   + m_graphicsLayer
-    //   + m_squashingLayer
-    //
-    // Stacking children of a squashed layer receive graphics layers that are parented to the compositd ancestor of the
-    // squashed layer (i.e. nearest enclosing composited layer that is not squashed).
-    OwnPtr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squashed layers exist and m_squashingContainmentLayer is not present, to contain the squashed layers as siblings to the rest of the GraphicsLayer tree chunk.
-    OwnPtr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers exist, this is the backing that squashed layers paint into.
-    Vector<GraphicsLayerPaintInfo> m_squashedLayers;
-    LayoutPoint m_squashingLayerOffsetFromTransformedAncestor;
-
-    LayoutRect m_compositedBounds;
-
-    LayoutSize m_contentOffsetInCompositingLayer;
-    unsigned m_contentOffsetInCompositingLayerDirty : 1;
-
-    unsigned m_pendingUpdateScope : 2;
-    unsigned m_isMainFrameLayoutViewLayer : 1;
-
-    unsigned m_backgroundLayerPaintsFixedRootBackground : 1;
-    unsigned m_scrollingContentsAreEmpty : 1;
-};
-
-} // namespace blink
-
-#endif // CompositedDeprecatedPaintLayerMapping_h
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
new file mode 100644
index 0000000..3d987d6
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp
@@ -0,0 +1,2402 @@
+/*
+ * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "core/layout/compositing/CompositedLayerMapping.h"
+
+#include "core/HTMLNames.h"
+#include "core/dom/DOMNodeIds.h"
+#include "core/fetch/ImageResource.h"
+#include "core/frame/FrameHost.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/RemoteFrame.h"
+#include "core/html/HTMLCanvasElement.h"
+#include "core/html/HTMLIFrameElement.h"
+#include "core/html/HTMLMediaElement.h"
+#include "core/html/HTMLVideoElement.h"
+#include "core/html/canvas/CanvasRenderingContext.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/layout/LayoutEmbeddedObject.h"
+#include "core/layout/LayoutHTMLCanvas.h"
+#include "core/layout/LayoutImage.h"
+#include "core/layout/LayoutPart.h"
+#include "core/layout/LayoutVideo.h"
+#include "core/layout/LayoutView.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/Page.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/paint/PaintLayerPainter.h"
+#include "core/paint/PaintLayerStackingNodeIterator.h"
+#include "core/paint/ScrollableAreaPainter.h"
+#include "core/paint/TransformRecorder.h"
+#include "core/plugins/PluginView.h"
+#include "platform/LengthFunctions.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/fonts/FontCache.h"
+#include "platform/geometry/TransformState.h"
+#include "platform/graphics/BitmapImage.h"
+#include "platform/graphics/GraphicsContext.h"
+#include "platform/graphics/paint/ClipDisplayItem.h"
+#include "platform/graphics/paint/DisplayItemList.h"
+#include "platform/graphics/paint/TransformDisplayItem.h"
+#include "wtf/CurrentTime.h"
+#include "wtf/text/StringBuilder.h"
+
+namespace blink {
+
+using namespace HTMLNames;
+
+static IntRect clipBox(LayoutBox* layoutObject);
+
+static IntRect contentsRect(const LayoutObject* layoutObject)
+{
+    if (!layoutObject->isBox())
+        return IntRect();
+    if (layoutObject->isCanvas())
+        return pixelSnappedIntRect(toLayoutHTMLCanvas(layoutObject)->replacedContentRect());
+    if (layoutObject->isVideo())
+        return toLayoutVideo(layoutObject)->videoBox();
+
+    return pixelSnappedIntRect(toLayoutBox(layoutObject)->contentBoxRect());
+}
+
+static IntRect backgroundRect(const LayoutObject* layoutObject)
+{
+    if (!layoutObject->isBox())
+        return IntRect();
+
+    LayoutRect rect;
+    const LayoutBox* box = toLayoutBox(layoutObject);
+    EFillBox clip = box->style()->backgroundClip();
+    switch (clip) {
+    case BorderFillBox:
+        rect = box->borderBoxRect();
+        break;
+    case PaddingFillBox:
+        rect = box->paddingBoxRect();
+        break;
+    case ContentFillBox:
+        rect = box->contentBoxRect();
+        break;
+    case TextFillBox:
+        break;
+    }
+
+    return pixelSnappedIntRect(rect);
+}
+
+static inline bool isAcceleratedCanvas(const LayoutObject* layoutObject)
+{
+    if (layoutObject->isCanvas()) {
+        HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
+        if (CanvasRenderingContext* context = canvas->renderingContext())
+            return context->isAccelerated();
+    }
+    return false;
+}
+
+static bool hasBoxDecorationsOrBackgroundImage(const ComputedStyle& style)
+{
+    return style.hasBoxDecorations() || style.hasBackgroundImage();
+}
+
+static bool contentLayerSupportsDirectBackgroundComposition(const LayoutObject* layoutObject)
+{
+    // No support for decorations - border, border-radius or outline.
+    // Only simple background - solid color or transparent.
+    if (hasBoxDecorationsOrBackgroundImage(layoutObject->styleRef()))
+        return false;
+
+    // If there is no background, there is nothing to support.
+    if (!layoutObject->style()->hasBackground())
+        return true;
+
+    // Simple background that is contained within the contents rect.
+    return contentsRect(layoutObject).contains(backgroundRect(layoutObject));
+}
+
+static WebLayer* platformLayerForPlugin(LayoutObject* layoutObject)
+{
+    if (!layoutObject->isEmbeddedObject())
+        return nullptr;
+    Widget* widget = toLayoutEmbeddedObject(layoutObject)->widget();
+    if (!widget || !widget->isPluginView())
+        return nullptr;
+    return toPluginView(widget)->platformLayer();
+
+}
+
+static inline bool isAcceleratedContents(LayoutObject* layoutObject)
+{
+    return isAcceleratedCanvas(layoutObject)
+        || (layoutObject->isEmbeddedObject() && toLayoutEmbeddedObject(layoutObject)->requiresAcceleratedCompositing())
+        || layoutObject->isVideo();
+}
+
+// Get the scrolling coordinator in a way that works inside CompositedLayerMapping's destructor.
+static ScrollingCoordinator* scrollingCoordinatorFromLayer(PaintLayer& layer)
+{
+    Page* page = layer.layoutObject()->frame()->page();
+    return (!page) ? nullptr : page->scrollingCoordinator();
+}
+
+CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer)
+    : m_owningLayer(layer)
+    , m_contentOffsetInCompositingLayerDirty(false)
+    , m_pendingUpdateScope(GraphicsLayerUpdateNone)
+    , m_isMainFrameLayoutViewLayer(false)
+    , m_backgroundLayerPaintsFixedRootBackground(false)
+    , m_scrollingContentsAreEmpty(false)
+{
+    if (layer.isRootLayer() && layoutObject()->frame()->isMainFrame())
+        m_isMainFrameLayoutViewLayer = true;
+
+    createPrimaryGraphicsLayer();
+}
+
+CompositedLayerMapping::~CompositedLayerMapping()
+{
+    // Hits in compositing/squashing/squash-onto-nephew.html.
+    DisableCompositingQueryAsserts disabler;
+
+    // Do not leave the destroyed pointer dangling on any Layers that painted to this mapping's squashing layer.
+    for (size_t i = 0; i < m_squashedLayers.size(); ++i) {
+        PaintLayer* oldSquashedLayer = m_squashedLayers[i].paintLayer;
+        // Assert on incorrect mappings between layers and groups
+        ASSERT(oldSquashedLayer->groupedMapping() == this);
+        if (oldSquashedLayer->groupedMapping() == this) {
+            oldSquashedLayer->setGroupedMapping(0, PaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
+            oldSquashedLayer->setLostGroupedMapping(true);
+        }
+    }
+
+    updateClippingLayers(false, false);
+    updateOverflowControlsLayers(false, false, false, false);
+    updateChildTransformLayer(false);
+    updateForegroundLayer(false);
+    updateBackgroundLayer(false);
+    updateMaskLayer(false);
+    updateClippingMaskLayers(false);
+    updateScrollingLayers(false);
+    updateSquashingLayers(false);
+    destroyGraphicsLayers();
+}
+
+PassOwnPtr<GraphicsLayer> CompositedLayerMapping::createGraphicsLayer(CompositingReasons reasons)
+{
+    GraphicsLayerFactory* graphicsLayerFactory = nullptr;
+    if (Page* page = layoutObject()->frame()->page())
+        graphicsLayerFactory = page->chromeClient().graphicsLayerFactory();
+
+    OwnPtr<GraphicsLayer> graphicsLayer = GraphicsLayer::create(graphicsLayerFactory, this);
+
+    graphicsLayer->setCompositingReasons(reasons);
+    if (Node* owningNode = m_owningLayer.layoutObject()->generatingNode())
+        graphicsLayer->setOwnerNodeId(DOMNodeIds::idForNode(owningNode));
+
+    return graphicsLayer.release();
+}
+
+void CompositedLayerMapping::createPrimaryGraphicsLayer()
+{
+    m_graphicsLayer = createGraphicsLayer(m_owningLayer.compositingReasons());
+
+    updateOpacity(layoutObject()->styleRef());
+    updateTransform(layoutObject()->styleRef());
+    updateFilters(layoutObject()->styleRef());
+    updateBackdropFilters(layoutObject()->styleRef());
+
+    if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
+        updateLayerBlendMode(layoutObject()->styleRef());
+        updateIsRootForIsolatedGroup();
+    }
+}
+
+void CompositedLayerMapping::destroyGraphicsLayers()
+{
+    if (m_graphicsLayer)
+        m_graphicsLayer->removeFromParent();
+
+    m_ancestorClippingLayer = nullptr;
+    m_graphicsLayer = nullptr;
+    m_foregroundLayer = nullptr;
+    m_backgroundLayer = nullptr;
+    m_childContainmentLayer = nullptr;
+    m_childTransformLayer = nullptr;
+    m_maskLayer = nullptr;
+    m_childClippingMaskLayer = nullptr;
+
+    m_scrollingLayer = nullptr;
+    m_scrollingContentsLayer = nullptr;
+    m_scrollingBlockSelectionLayer = nullptr;
+}
+
+void CompositedLayerMapping::updateOpacity(const ComputedStyle& style)
+{
+    m_graphicsLayer->setOpacity(compositingOpacity(style.opacity()));
+}
+
+void CompositedLayerMapping::updateTransform(const ComputedStyle& style)
+{
+    // FIXME: This could use m_owningLayer.transform(), but that currently has transform-origin
+    // baked into it, and we don't want that.
+    TransformationMatrix t;
+    if (m_owningLayer.hasTransformRelatedProperty()) {
+        style.applyTransform(t, LayoutSize(toLayoutBox(layoutObject())->pixelSnappedSize()), ComputedStyle::ExcludeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
+        makeMatrixRenderable(t, compositor()->hasAcceleratedCompositing());
+    }
+
+    m_graphicsLayer->setTransform(t);
+}
+
+void CompositedLayerMapping::updateFilters(const ComputedStyle& style)
+{
+    m_graphicsLayer->setFilters(owningLayer().computeFilterOperations(style));
+}
+
+void CompositedLayerMapping::updateBackdropFilters(const ComputedStyle& style)
+{
+    m_graphicsLayer->setBackdropFilters(owningLayer().computeBackdropFilterOperations(style));
+}
+
+void CompositedLayerMapping::updateLayerBlendMode(const ComputedStyle& style)
+{
+    setBlendMode(style.blendMode());
+}
+
+void CompositedLayerMapping::updateIsRootForIsolatedGroup()
+{
+    bool isolate = m_owningLayer.shouldIsolateCompositedDescendants();
+
+    // non stacking context layers should never isolate
+    ASSERT(m_owningLayer.stackingNode()->isStackingContext() || !isolate);
+
+    m_graphicsLayer->setIsRootForIsolatedGroup(isolate);
+}
+
+void CompositedLayerMapping::updateContentsOpaque()
+{
+    ASSERT(m_isMainFrameLayoutViewLayer || !m_backgroundLayer);
+    if (isAcceleratedCanvas(layoutObject())) {
+        // Determine whether the rendering context's external texture layer is opaque.
+        CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->node())->renderingContext();
+        if (!context->hasAlpha())
+            m_graphicsLayer->setContentsOpaque(true);
+        else if (WebLayer* layer = context->platformLayer())
+            m_graphicsLayer->setContentsOpaque(!Color(layer->backgroundColor()).hasAlpha());
+        else
+            m_graphicsLayer->setContentsOpaque(false);
+    } else if (m_backgroundLayer) {
+        m_graphicsLayer->setContentsOpaque(false);
+        m_backgroundLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
+    } else {
+        // For non-root layers, background is always painted by the primary graphics layer.
+        m_graphicsLayer->setContentsOpaque(m_owningLayer.backgroundIsKnownToBeOpaqueInRect(compositedBounds()));
+    }
+}
+
+void CompositedLayerMapping::updateCompositedBounds()
+{
+    ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle::InCompositingUpdate);
+    // FIXME: if this is really needed for performance, it would be better to store it on Layer.
+    m_compositedBounds = m_owningLayer.boundingBoxForCompositing();
+    m_contentOffsetInCompositingLayerDirty = true;
+}
+
+void CompositedLayerMapping::updateAfterPartResize()
+{
+    if (layoutObject()->isLayoutPart()) {
+        if (PaintLayerCompositor* innerCompositor = PaintLayerCompositor::frameContentsCompositor(toLayoutPart(layoutObject()))) {
+            innerCompositor->frameViewDidChangeSize();
+            // We can floor this point because our frameviews are always aligned to pixel boundaries.
+            ASSERT(m_compositedBounds.location() == flooredIntPoint(m_compositedBounds.location()));
+            innerCompositor->frameViewDidChangeLocation(flooredIntPoint(contentsBox().location()));
+        }
+    }
+}
+
+void CompositedLayerMapping::updateCompositingReasons()
+{
+    // All other layers owned by this mapping will have the same compositing reason
+    // for their lifetime, so they are initialized only when created.
+    m_graphicsLayer->setCompositingReasons(m_owningLayer.compositingReasons());
+}
+
+bool CompositedLayerMapping::owningLayerClippedByLayerNotAboveCompositedAncestor(PaintLayer* scrollParent)
+{
+    if (!m_owningLayer.parent())
+        return false;
+
+    const PaintLayer* compositingAncestor = m_owningLayer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf);
+    if (!compositingAncestor)
+        return false;
+
+    const LayoutObject* clippingContainer = m_owningLayer.clippingContainer();
+    if (!clippingContainer)
+        return false;
+
+    if (clippingContainer->enclosingLayer() == scrollParent)
+        return false;
+
+    if (compositingAncestor->layoutObject()->isDescendantOf(clippingContainer))
+        return false;
+
+    // We ignore overflow clip here; we want composited overflow content to
+    // behave as if it lives in an unclipped universe so it can prepaint, etc.
+    // This means that we need to check if we are actually clipped before
+    // setting up m_ancestorClippingLayer otherwise
+    // updateAncestorClippingLayerGeometry will fail as the clip rect will be
+    // infinite.
+    // FIXME: this should use cached clip rects, but this sometimes give
+    // inaccurate results (and trips the ASSERTS in PaintLayerClipper).
+    ClipRectsContext clipRectsContext(compositingAncestor, UncachedClipRects, IgnoreOverlayScrollbarSize);
+    clipRectsContext.setIgnoreOverflowClip();
+    IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect());
+    return parentClipRect != LayoutRect::infiniteIntRect();
+}
+
+PaintLayer* CompositedLayerMapping::scrollParent()
+{
+    PaintLayer* scrollParent = m_owningLayer.scrollParent();
+    if (scrollParent && !scrollParent->needsCompositedScrolling())
+        return nullptr;
+    return scrollParent;
+}
+
+bool CompositedLayerMapping::updateGraphicsLayerConfiguration()
+{
+    ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle::InCompositingUpdate);
+
+    // Note carefully: here we assume that the compositing state of all descendants have been updated already,
+    // so it is legitimate to compute and cache the composited bounds for this layer.
+    updateCompositedBounds();
+
+    if (PaintLayerReflectionInfo* reflection = m_owningLayer.reflectionInfo()) {
+        if (reflection->reflectionLayer()->hasCompositedLayerMapping())
+            reflection->reflectionLayer()->compositedLayerMapping()->updateCompositedBounds();
+    }
+
+    PaintLayerCompositor* compositor = this->compositor();
+    LayoutObject* layoutObject = this->layoutObject();
+
+    bool layerConfigChanged = false;
+    setBackgroundLayerPaintsFixedRootBackground(compositor->needsFixedRootBackgroundLayer(&m_owningLayer));
+
+    // The background layer is currently only used for fixed root backgrounds.
+    if (updateBackgroundLayer(m_backgroundLayerPaintsFixedRootBackground))
+        layerConfigChanged = true;
+
+    if (updateForegroundLayer(compositor->needsContentsCompositingLayer(&m_owningLayer)))
+        layerConfigChanged = true;
+
+    bool needsDescendantsClippingLayer = compositor->clipsCompositingDescendants(&m_owningLayer);
+
+    // Our scrolling layer will clip.
+    if (m_owningLayer.needsCompositedScrolling())
+        needsDescendantsClippingLayer = false;
+
+    PaintLayer* scrollParent = this->scrollParent();
+
+    // This is required because compositing layers are parented according to the z-order hierarchy, yet
+    // clipping goes down the layoutObject hierarchy. Thus, a PaintLayer can be clipped by a
+    // PaintLayer that is an ancestor in the layoutObject hierarchy, but a sibling in the z-order
+    // hierarchy. Further, that sibling need not be composited at all. In such scenarios, an ancestor
+    // clipping layer is necessary to apply the composited clip for this layer.
+    bool needsAncestorClip = owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent);
+
+    if (updateClippingLayers(needsAncestorClip, needsDescendantsClippingLayer))
+        layerConfigChanged = true;
+
+    bool scrollingConfigChanged = false;
+    if (updateScrollingLayers(m_owningLayer.needsCompositedScrolling())) {
+        layerConfigChanged = true;
+        scrollingConfigChanged = true;
+    }
+
+    if (updateOverflowControlsLayers(requiresHorizontalScrollbarLayer(), requiresVerticalScrollbarLayer(), requiresScrollCornerLayer(), needsAncestorClip))
+        layerConfigChanged = true;
+
+    bool hasPerspective = false;
+    // FIXME: Can |style| be really null that late in the DocumentCycle?
+    if (const ComputedStyle* style = layoutObject->style())
+        hasPerspective = style->hasPerspective();
+    bool needsChildTransformLayer = hasPerspective && layoutObject->isBox();
+    if (updateChildTransformLayer(needsChildTransformLayer))
+        layerConfigChanged = true;
+
+    if (updateSquashingLayers(!m_squashedLayers.isEmpty()))
+        layerConfigChanged = true;
+
+    updateScrollParent(scrollParent);
+    updateClipParent(scrollParent);
+
+    if (layerConfigChanged)
+        updateInternalHierarchy();
+
+    if (scrollingConfigChanged) {
+        if (layoutObject->view())
+            compositor->scrollingLayerDidChange(&m_owningLayer);
+    }
+
+    // A mask layer is not part of the hierarchy proper, it's an auxiliary layer
+    // that's plugged into another GraphicsLayer that is part of the hierarchy.
+    // It has no parent or child GraphicsLayer. For that reason, we process it
+    // here, after the hierarchy has been updated.
+    bool maskLayerChanged = false;
+    if (updateMaskLayer(layoutObject->hasMask())) {
+        maskLayerChanged = true;
+        m_graphicsLayer->setMaskLayer(m_maskLayer.get());
+    }
+
+    bool hasChildClippingLayer = compositor->clipsCompositingDescendants(&m_owningLayer) && (hasClippingLayer() || hasScrollingLayer());
+    // If we have a border radius or clip path on a scrolling layer, we need a clipping mask to properly
+    // clip the scrolled contents, even if there are no composited descendants.
+    bool hasClipPath = layoutObject->style()->clipPath();
+    bool needsChildClippingMask = (hasClipPath || layoutObject->style()->hasBorderRadius()) && (hasChildClippingLayer || isAcceleratedContents(layoutObject) || hasScrollingLayer());
+    if (updateClippingMaskLayers(needsChildClippingMask)) {
+        // Clip path clips the entire subtree, including scrollbars. It must be attached directly onto
+        // the main m_graphicsLayer.
+        if (hasClipPath)
+            m_graphicsLayer->setMaskLayer(m_childClippingMaskLayer.get());
+        else if (hasClippingLayer())
+            clippingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
+        else if (hasScrollingLayer())
+            scrollingLayer()->setMaskLayer(m_childClippingMaskLayer.get());
+        else if (isAcceleratedContents(layoutObject))
+            m_graphicsLayer->setContentsClippingMaskLayer(m_childClippingMaskLayer.get());
+    }
+
+    if (m_owningLayer.reflectionInfo()) {
+        if (m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedLayerMapping()) {
+            GraphicsLayer* reflectionLayer = m_owningLayer.reflectionInfo()->reflectionLayer()->compositedLayerMapping()->mainGraphicsLayer();
+            m_graphicsLayer->setReplicatedByLayer(reflectionLayer);
+        }
+    } else {
+        m_graphicsLayer->setReplicatedByLayer(nullptr);
+    }
+
+    updateBackgroundColor();
+
+    if (layoutObject->isImage()) {
+        if (isDirectlyCompositedImage()) {
+            updateImageContents();
+        } else if (m_graphicsLayer->hasContentsLayer()) {
+            m_graphicsLayer->setContentsToImage(nullptr);
+        }
+    }
+
+    if (WebLayer* layer = platformLayerForPlugin(layoutObject)) {
+        m_graphicsLayer->setContentsToPlatformLayer(layer);
+    } else if (layoutObject->node() && layoutObject->node()->isFrameOwnerElement() && toHTMLFrameOwnerElement(layoutObject->node())->contentFrame()) {
+        Frame* frame = toHTMLFrameOwnerElement(layoutObject->node())->contentFrame();
+        if (frame->isRemoteFrame()) {
+            WebLayer* layer = toRemoteFrame(frame)->remotePlatformLayer();
+            m_graphicsLayer->setContentsToPlatformLayer(layer);
+        }
+    } else if (layoutObject->isVideo()) {
+        HTMLMediaElement* mediaElement = toHTMLMediaElement(layoutObject->node());
+        m_graphicsLayer->setContentsToPlatformLayer(mediaElement->platformLayer());
+    } else if (isAcceleratedCanvas(layoutObject)) {
+        HTMLCanvasElement* canvas = toHTMLCanvasElement(layoutObject->node());
+        if (CanvasRenderingContext* context = canvas->renderingContext())
+            m_graphicsLayer->setContentsToPlatformLayer(context->platformLayer());
+        layerConfigChanged = true;
+    }
+    if (layoutObject->isLayoutPart()) {
+        if (PaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layoutObject)))
+            layerConfigChanged = true;
+    }
+
+    // Changes to either the internal hierarchy or the mask layer have an impact
+    // on painting phases, so we need to update when either are updated.
+    if (layerConfigChanged || maskLayerChanged)
+        updatePaintingPhases();
+
+    return layerConfigChanged;
+}
+
+static IntRect clipBox(LayoutBox* layoutObject)
+{
+    LayoutRect result = LayoutRect(LayoutRect::infiniteIntRect());
+    if (layoutObject->hasOverflowClip())
+        result = layoutObject->overflowClipRect(LayoutPoint());
+
+    if (layoutObject->hasClip())
+        result.intersect(layoutObject->clipRect(LayoutPoint()));
+
+    return pixelSnappedIntRect(result);
+}
+
+static LayoutPoint computeOffsetFromCompositedAncestor(const PaintLayer* layer, const PaintLayer* compositedAncestor)
+{
+    LayoutPoint offset = layer->visualOffsetFromAncestor(compositedAncestor);
+    if (compositedAncestor)
+        offset.move(compositedAncestor->compositedLayerMapping()->owningLayer().subpixelAccumulation());
+    return offset;
+}
+
+void CompositedLayerMapping::computeBoundsOfOwningLayer(const PaintLayer* compositedAncestor, IntRect& localBounds, IntRect& compositingBoundsRelativeToCompositedAncestor, LayoutPoint& offsetFromCompositedAncestor,
+    IntPoint& snappedOffsetFromCompositedAncestor)
+{
+    LayoutRect localRawCompositingBounds = compositedBounds();
+    offsetFromCompositedAncestor = computeOffsetFromCompositedAncestor(&m_owningLayer, compositedAncestor);
+    snappedOffsetFromCompositedAncestor = IntPoint(offsetFromCompositedAncestor.x().round(), offsetFromCompositedAncestor.y().round());
+
+    LayoutSize subpixelAccumulation = offsetFromCompositedAncestor - snappedOffsetFromCompositedAncestor;
+    m_owningLayer.setSubpixelAccumulation(subpixelAccumulation);
+
+    // Move the bounds by the subpixel accumulation so that it pixel-snaps relative to absolute pixels instead of local coordinates.
+    localRawCompositingBounds.move(subpixelAccumulation);
+    localBounds = pixelSnappedIntRect(localRawCompositingBounds);
+
+    compositingBoundsRelativeToCompositedAncestor = localBounds;
+    compositingBoundsRelativeToCompositedAncestor.moveBy(snappedOffsetFromCompositedAncestor);
+}
+
+void CompositedLayerMapping::updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const PaintLayer& referenceLayer,
+    Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer* squashingLayer, LayoutPoint* offsetFromTransformedAncestor, Vector<PaintLayer*>& layersNeedingPaintInvalidation)
+{
+    if (!squashingLayer)
+        return;
+
+    LayoutPoint offsetFromReferenceLayerToParentGraphicsLayer(offsetFromCompositedAncestor);
+    offsetFromReferenceLayerToParentGraphicsLayer.moveBy(-graphicsLayerParentLocation);
+
+    // FIXME: Cache these offsets.
+    LayoutPoint referenceOffsetFromTransformedAncestor = referenceLayer.computeOffsetFromTransformedAncestor();
+
+    LayoutRect totalSquashBounds;
+    for (size_t i = 0; i < layers.size(); ++i) {
+        LayoutRect squashedBounds = layers[i].paintLayer->boundingBoxForCompositing();
+
+        // Store the local bounds of the Layer subtree before applying the offset.
+        layers[i].compositedBounds = squashedBounds;
+
+        LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].paintLayer->computeOffsetFromTransformedAncestor();
+        LayoutSize offsetFromSquashingLayer = offsetFromTransformedAncestorForSquashedLayer - referenceOffsetFromTransformedAncestor;
+
+        squashedBounds.move(offsetFromSquashingLayer);
+        totalSquashBounds.unite(squashedBounds);
+    }
+
+    // The totalSquashBounds is positioned with respect to referenceLayer of this CompositedLayerMapping.
+    // But the squashingLayer needs to be positioned with respect to the ancestor CompositedLayerMapping.
+    // The conversion between referenceLayer and the ancestor CLM is already computed as
+    // offsetFromReferenceLayerToParentGraphicsLayer.
+    totalSquashBounds.moveBy(offsetFromReferenceLayerToParentGraphicsLayer);
+    const IntRect squashLayerBounds = enclosingIntRect(totalSquashBounds);
+    const IntPoint squashLayerOrigin = squashLayerBounds.location();
+    const LayoutSize squashLayerOriginInOwningLayerSpace = squashLayerOrigin - offsetFromReferenceLayerToParentGraphicsLayer;
+
+    // Now that the squashing bounds are known, we can convert the PaintLayer painting offsets
+    // from CLM owning layer space to the squashing layer space.
+    //
+    // The painting offset we want to compute for each squashed PaintLayer is essentially the position of
+    // the squashed PaintLayer described w.r.t. referenceLayer's origin.
+    // So we just need to convert that point from referenceLayer space to the squashing layer's
+    // space. This is simply done by subtracing squashLayerOriginInOwningLayerSpace, but then the offset
+    // overall needs to be negated because that's the direction that the painting code expects the
+    // offset to be.
+    for (size_t i = 0; i < layers.size(); ++i) {
+        const LayoutPoint offsetFromTransformedAncestorForSquashedLayer = layers[i].paintLayer->computeOffsetFromTransformedAncestor();
+        const LayoutSize offsetFromSquashLayerOrigin = (offsetFromTransformedAncestorForSquashedLayer - referenceOffsetFromTransformedAncestor) - squashLayerOriginInOwningLayerSpace;
+
+        IntSize newOffsetFromLayoutObject = -IntSize(offsetFromSquashLayerOrigin.width().round(), offsetFromSquashLayerOrigin.height().round());
+        LayoutSize subpixelAccumulation = offsetFromSquashLayerOrigin + newOffsetFromLayoutObject;
+        if (layers[i].offsetFromLayoutObjectSet && layers[i].offsetFromLayoutObject != newOffsetFromLayoutObject) {
+            // It is ok to issue paint invalidation here, because all of the geometry needed to correctly invalidate paint is computed by this point.
+            DisablePaintInvalidationStateAsserts disabler;
+            layers[i].paintLayer->layoutObject()->invalidatePaintIncludingNonCompositingDescendants();
+
+            TRACE_LAYER_INVALIDATION(layers[i].paintLayer, InspectorLayerInvalidationTrackingEvent::SquashingLayerGeometryWasUpdated);
+            layersNeedingPaintInvalidation.append(layers[i].paintLayer);
+        }
+        layers[i].offsetFromLayoutObject = newOffsetFromLayoutObject;
+        layers[i].offsetFromLayoutObjectSet = true;
+
+        layers[i].paintLayer->setSubpixelAccumulation(subpixelAccumulation);
+    }
+
+    squashingLayer->setPosition(squashLayerBounds.location());
+    squashingLayer->setSize(squashLayerBounds.size());
+
+    *offsetFromTransformedAncestor = referenceOffsetFromTransformedAncestor;
+    offsetFromTransformedAncestor->move(squashLayerOriginInOwningLayerSpace);
+
+    for (size_t i = 0; i < layers.size(); ++i)
+        layers[i].localClipRectForSquashedLayer = localClipRectForSquashedLayer(referenceLayer, layers[i], layers);
+}
+
+void CompositedLayerMapping::updateGraphicsLayerGeometry(const PaintLayer* compositingContainer, const PaintLayer* compositingStackingContext, Vector<PaintLayer*>& layersNeedingPaintInvalidation)
+{
+    ASSERT(m_owningLayer.compositor()->lifecycle().state() == DocumentLifecycle::InCompositingUpdate);
+
+    // Set transform property, if it is not animating. We have to do this here because the transform
+    // is affected by the layer dimensions.
+    if (!layoutObject()->style()->isRunningTransformAnimationOnCompositor())
+        updateTransform(layoutObject()->styleRef());
+
+    // Set opacity, if it is not animating.
+    if (!layoutObject()->style()->isRunningOpacityAnimationOnCompositor())
+        updateOpacity(layoutObject()->styleRef());
+
+    if (!layoutObject()->style()->isRunningFilterAnimationOnCompositor())
+        updateFilters(layoutObject()->styleRef());
+
+    if (!layoutObject()->style()->isRunningBackdropFilterAnimationOnCompositor())
+        updateBackdropFilters(layoutObject()->styleRef());
+
+    // We compute everything relative to the enclosing compositing layer.
+    IntRect ancestorCompositingBounds;
+    if (compositingContainer) {
+        ASSERT(compositingContainer->hasCompositedLayerMapping());
+        ancestorCompositingBounds = compositingContainer->compositedLayerMapping()->pixelSnappedCompositedBounds();
+    }
+
+    IntRect localCompositingBounds;
+    IntRect relativeCompositingBounds;
+    LayoutPoint offsetFromCompositedAncestor;
+    IntPoint snappedOffsetFromCompositedAncestor;
+    computeBoundsOfOwningLayer(compositingContainer, localCompositingBounds, relativeCompositingBounds, offsetFromCompositedAncestor, snappedOffsetFromCompositedAncestor);
+
+    IntPoint graphicsLayerParentLocation;
+    computeGraphicsLayerParentLocation(compositingContainer, ancestorCompositingBounds, graphicsLayerParentLocation);
+
+    // Might update graphicsLayerParentLocation.
+    updateAncestorClippingLayerGeometry(compositingContainer, snappedOffsetFromCompositedAncestor, graphicsLayerParentLocation);
+    updateOverflowControlsHostLayerGeometry(compositingStackingContext, compositingContainer);
+
+    FloatSize contentsSize = relativeCompositingBounds.size();
+
+    updateMainGraphicsLayerGeometry(relativeCompositingBounds, localCompositingBounds, graphicsLayerParentLocation);
+    updateContentsOffsetInCompositingLayer(snappedOffsetFromCompositedAncestor, graphicsLayerParentLocation);
+    updateSquashingLayerGeometry(offsetFromCompositedAncestor, graphicsLayerParentLocation, m_owningLayer, m_squashedLayers, m_squashingLayer.get(), &m_squashingLayerOffsetFromTransformedAncestor, layersNeedingPaintInvalidation);
+
+    // If we have a layer that clips children, position it.
+    IntRect clippingBox;
+    if (m_childContainmentLayer)
+        clippingBox = clipBox(toLayoutBox(layoutObject()));
+
+    updateChildTransformLayerGeometry();
+    updateChildContainmentLayerGeometry(clippingBox, localCompositingBounds);
+
+    updateMaskLayerGeometry();
+    updateTransformGeometry(snappedOffsetFromCompositedAncestor, relativeCompositingBounds);
+    updateForegroundLayerGeometry(contentsSize, clippingBox);
+    updateBackgroundLayerGeometry(contentsSize);
+    updateReflectionLayerGeometry(layersNeedingPaintInvalidation);
+    updateScrollingLayerGeometry(localCompositingBounds);
+    updateChildClippingMaskLayerGeometry();
+
+    if (m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->scrollsOverflow())
+        m_owningLayer.scrollableArea()->positionOverflowControls();
+
+    if (RuntimeEnabledFeatures::cssCompositingEnabled()) {
+        updateLayerBlendMode(layoutObject()->styleRef());
+        updateIsRootForIsolatedGroup();
+    }
+
+    updateContentsRect();
+    updateBackgroundColor();
+    updateDrawsContent();
+    updateContentsOpaque();
+    updateAfterPartResize();
+    updateRenderingContext();
+    updateShouldFlattenTransform();
+    updateChildrenTransform();
+    updateScrollParent(scrollParent());
+    registerScrollingLayers();
+
+    updateCompositingReasons();
+}
+
+void CompositedLayerMapping::updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& graphicsLayerParentLocation)
+{
+    m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
+    m_graphicsLayer->setOffsetFromLayoutObject(toIntSize(localCompositingBounds.location()));
+
+    FloatSize oldSize = m_graphicsLayer->size();
+    const IntSize& contentsSize = relativeCompositingBounds.size();
+    if (oldSize != contentsSize)
+        m_graphicsLayer->setSize(contentsSize);
+
+    // m_graphicsLayer is the corresponding GraphicsLayer for this PaintLayer and its non-compositing
+    // descendants. So, the visibility flag for m_graphicsLayer should be true if there are any
+    // non-compositing visible layers.
+    bool contentsVisible = m_owningLayer.hasVisibleContent() || hasVisibleNonCompositingDescendant(&m_owningLayer);
+    if (layoutObject()->isVideo()) {
+        HTMLVideoElement* videoElement = toHTMLVideoElement(layoutObject()->node());
+        if (videoElement->isFullscreen() && videoElement->usesOverlayFullscreenVideo())
+            contentsVisible = false;
+    }
+    m_graphicsLayer->setContentsVisible(contentsVisible);
+
+    m_graphicsLayer->setBackfaceVisibility(layoutObject()->style()->backfaceVisibility() == BackfaceVisibilityVisible);
+}
+
+void CompositedLayerMapping::computeGraphicsLayerParentLocation(const PaintLayer* compositingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLocation)
+{
+    if (compositingContainer && compositingContainer->compositedLayerMapping()->hasClippingLayer()) {
+        // If the compositing ancestor has a layer to clip children, we parent in that, and therefore
+        // position relative to it.
+        IntRect clippingBox = clipBox(toLayoutBox(compositingContainer->layoutObject()));
+        graphicsLayerParentLocation = clippingBox.location() + roundedIntSize(compositingContainer->subpixelAccumulation());
+    } else if (compositingContainer && compositingContainer->compositedLayerMapping()->childTransformLayer()) {
+        // Similarly, if the compositing ancestor has a child transform layer, we parent in that, and therefore
+        // position relative to it. It's already taken into account the contents offset, so we do not need to here.
+        graphicsLayerParentLocation = roundedIntPoint(compositingContainer->subpixelAccumulation());
+    } else if (compositingContainer) {
+        graphicsLayerParentLocation = ancestorCompositingBounds.location();
+    } else {
+        graphicsLayerParentLocation = layoutObject()->view()->documentRect().location();
+    }
+
+    if (compositingContainer && compositingContainer->needsCompositedScrolling()) {
+        LayoutBox* layoutBox = toLayoutBox(compositingContainer->layoutObject());
+        IntSize scrollOffset = layoutBox->scrolledContentOffset();
+        IntPoint scrollOrigin(layoutBox->borderLeft(), layoutBox->borderTop());
+        graphicsLayerParentLocation = scrollOrigin - scrollOffset;
+    }
+}
+
+void CompositedLayerMapping::updateAncestorClippingLayerGeometry(const PaintLayer* compositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLayerParentLocation)
+{
+    if (!compositingContainer || !m_ancestorClippingLayer)
+        return;
+
+    ClipRectsContext clipRectsContext(compositingContainer, PaintingClipRectsIgnoringOverflowClip, IgnoreOverlayScrollbarSize);
+    IntRect parentClipRect = pixelSnappedIntRect(m_owningLayer.clipper().backgroundClipRect(clipRectsContext).rect());
+    ASSERT(parentClipRect != LayoutRect::infiniteIntRect());
+    m_ancestorClippingLayer->setPosition(FloatPoint(parentClipRect.location() - graphicsLayerParentLocation));
+    m_ancestorClippingLayer->setSize(parentClipRect.size());
+
+    // backgroundRect is relative to compositingContainer, so subtract snappedOffsetFromCompositedAncestor.X/snappedOffsetFromCompositedAncestor.Y to get back to local coords.
+    m_ancestorClippingLayer->setOffsetFromLayoutObject(parentClipRect.location() - snappedOffsetFromCompositedAncestor);
+
+    // The primary layer is then parented in, and positioned relative to this clipping layer.
+    graphicsLayerParentLocation = parentClipRect.location();
+}
+
+void CompositedLayerMapping::updateOverflowControlsHostLayerGeometry(const PaintLayer* compositingStackingContext, const PaintLayer* compositingContainer)
+{
+    if (!m_overflowControlsHostLayer)
+        return;
+
+    if (needsToReparentOverflowControls()) {
+        if (m_overflowControlsClippingLayer) {
+            m_overflowControlsClippingLayer->setSize(m_ancestorClippingLayer->size());
+            m_overflowControlsClippingLayer->setOffsetFromLayoutObject(m_ancestorClippingLayer->offsetFromLayoutObject());
+            m_overflowControlsClippingLayer->setMasksToBounds(true);
+            m_overflowControlsHostLayer->setPosition(IntPoint(-m_overflowControlsClippingLayer->offsetFromLayoutObject()));
+
+            FloatPoint position = m_ancestorClippingLayer->position();
+            if (compositingStackingContext != compositingContainer) {
+                LayoutPoint offset;
+                compositingContainer->convertToLayerCoords(compositingStackingContext, offset);
+                FloatSize offsetFromStackingContainer = toFloatSize(FloatPoint(offset));
+                position += offsetFromStackingContainer;
+            }
+
+            m_overflowControlsClippingLayer->setPosition(position);
+        } else {
+            // The controls are in the same 2D space as the compositing container, so we can map them into the space of the container.
+            TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
+            m_owningLayer.layoutObject()->mapLocalToContainer(compositingStackingContext->layoutObject(), transformState, ApplyContainerFlip);
+            transformState.flatten();
+            LayoutPoint offsetFromStackingContainer = LayoutPoint(transformState.lastPlanarPoint());
+            if (PaintLayerScrollableArea* scrollableArea = compositingStackingContext->scrollableArea())
+                offsetFromStackingContainer.move(LayoutSize(scrollableArea->adjustedScrollOffset()));
+            m_overflowControlsHostLayer->setPosition(FloatPoint(offsetFromStackingContainer));
+        }
+    } else {
+        m_overflowControlsHostLayer->setPosition(FloatPoint());
+    }
+}
+
+void CompositedLayerMapping::updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds)
+{
+    if (!m_childContainmentLayer)
+        return;
+
+    FloatPoint clipPositionInLayoutObjectSpace(clippingBox.location() - localCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation()));
+
+    // If there are layers between the the child containment layer and
+    // m_graphicsLayer (eg, the child transform layer), we must adjust the clip
+    // position to get it in the correct space.
+    FloatPoint clipPositionInParentSpace = clipPositionInLayoutObjectSpace;
+    for (GraphicsLayer* ancestor = m_childContainmentLayer->parent(); ancestor != mainGraphicsLayer(); ancestor = ancestor->parent())
+        clipPositionInParentSpace -= toFloatSize(ancestor->position());
+
+    m_childContainmentLayer->setPosition(clipPositionInParentSpace);
+    m_childContainmentLayer->setSize(clippingBox.size());
+    m_childContainmentLayer->setOffsetFromLayoutObject(toIntSize(clippingBox.location()));
+    if (m_childClippingMaskLayer && !m_scrollingLayer && !layoutObject()->style()->clipPath()) {
+        m_childClippingMaskLayer->setSize(m_childContainmentLayer->size());
+        m_childClippingMaskLayer->setOffsetFromLayoutObject(m_childContainmentLayer->offsetFromLayoutObject());
+    }
+}
+
+void CompositedLayerMapping::updateChildTransformLayerGeometry()
+{
+    if (!m_childTransformLayer)
+        return;
+    const IntRect borderBox = toLayoutBox(m_owningLayer.layoutObject())->pixelSnappedBorderBoxRect();
+    m_childTransformLayer->setSize(borderBox.size());
+    m_childTransformLayer->setPosition(FloatPoint(contentOffsetInCompositingLayer()));
+}
+
+void CompositedLayerMapping::updateMaskLayerGeometry()
+{
+    if (!m_maskLayer)
+        return;
+
+    if (m_maskLayer->size() != m_graphicsLayer->size()) {
+        m_maskLayer->setSize(m_graphicsLayer->size());
+        m_maskLayer->setNeedsDisplay();
+    }
+    m_maskLayer->setPosition(FloatPoint());
+    m_maskLayer->setOffsetFromLayoutObject(m_graphicsLayer->offsetFromLayoutObject());
+}
+
+void CompositedLayerMapping::updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAncestor, const IntRect& relativeCompositingBounds)
+{
+    if (m_owningLayer.hasTransformRelatedProperty()) {
+        const LayoutRect borderBox = toLayoutBox(layoutObject())->borderBoxRect();
+
+        // Get layout bounds in the coords of compositingContainer to match relativeCompositingBounds.
+        IntRect layerBounds = pixelSnappedIntRect(toLayoutPoint(m_owningLayer.subpixelAccumulation()), borderBox.size());
+        layerBounds.moveBy(snappedOffsetFromCompositedAncestor);
+
+        // Update properties that depend on layer dimensions
+        FloatPoint3D transformOrigin = computeTransformOrigin(IntRect(IntPoint(), layerBounds.size()));
+
+        // |transformOrigin| is in the local space of this layer. layerBounds - relativeCompositingBounds converts to the space of the
+        // compositing bounds relative to the composited ancestor. This does not apply to the z direction, since the page is 2D.
+        FloatPoint3D compositedTransformOrigin(
+            layerBounds.x() - relativeCompositingBounds.x() + transformOrigin.x(),
+            layerBounds.y() - relativeCompositingBounds.y() + transformOrigin.y(),
+            transformOrigin.z());
+        m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
+    } else {
+        FloatPoint3D compositedTransformOrigin(
+            relativeCompositingBounds.width() * 0.5f,
+            relativeCompositingBounds.height() * 0.5f,
+            0.f);
+        m_graphicsLayer->setTransformOrigin(compositedTransformOrigin);
+    }
+}
+
+void CompositedLayerMapping::updateReflectionLayerGeometry(Vector<PaintLayer*>& layersNeedingPaintInvalidation)
+{
+    if (!m_owningLayer.reflectionInfo() || !m_owningLayer.reflectionInfo()->reflectionLayer()->hasCompositedLayerMapping())
+        return;
+
+    CompositedLayerMapping* reflectionCompositedLayerMapping = m_owningLayer.reflectionInfo()->reflectionLayer()->compositedLayerMapping();
+    reflectionCompositedLayerMapping->updateGraphicsLayerGeometry(&m_owningLayer, &m_owningLayer, layersNeedingPaintInvalidation);
+}
+
+void CompositedLayerMapping::updateScrollingLayerGeometry(const IntRect& localCompositingBounds)
+{
+    if (!m_scrollingLayer)
+        return;
+
+    ASSERT(m_scrollingContentsLayer);
+    LayoutBox* layoutBox = toLayoutBox(layoutObject());
+    IntRect overflowClipRect = enclosingIntRect(layoutBox->overflowClipRect(LayoutPoint()));
+    DoubleSize adjustedScrollOffset = m_owningLayer.scrollableArea()->adjustedScrollOffset();
+    m_scrollingLayer->setPosition(FloatPoint(overflowClipRect.location() - localCompositingBounds.location() + roundedIntSize(m_owningLayer.subpixelAccumulation())));
+    m_scrollingLayer->setSize(overflowClipRect.size());
+
+    IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromLayoutObject();
+    m_scrollingLayer->setOffsetFromLayoutObject(-toIntSize(overflowClipRect.location()));
+
+    if (m_childClippingMaskLayer && !layoutObject()->style()->clipPath()) {
+        m_childClippingMaskLayer->setPosition(m_scrollingLayer->position());
+        m_childClippingMaskLayer->setSize(m_scrollingLayer->size());
+        m_childClippingMaskLayer->setOffsetFromLayoutObject(toIntSize(overflowClipRect.location()));
+    }
+
+    bool overflowClipRectOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromLayoutObject();
+
+    IntSize scrollSize(layoutBox->scrollWidth(), layoutBox->scrollHeight());
+    if (scrollSize != m_scrollingContentsLayer->size() || overflowClipRectOffsetChanged)
+        m_scrollingContentsLayer->setNeedsDisplay();
+
+    DoubleSize scrollingContentsOffset(overflowClipRect.location().x() - adjustedScrollOffset.width(), overflowClipRect.location().y() - adjustedScrollOffset.height());
+    // The scroll offset change is compared using floating point so that fractional scroll offset
+    // change can be propagated to compositor.
+    if (scrollingContentsOffset != m_scrollingContentsLayer->offsetDoubleFromLayoutObject() || scrollSize != m_scrollingContentsLayer->size()) {
+        bool coordinatorHandlesOffset = compositor()->scrollingLayerDidChange(&m_owningLayer);
+        m_scrollingContentsLayer->setPosition(coordinatorHandlesOffset ? FloatPoint() : FloatPoint(-toFloatSize(adjustedScrollOffset)));
+    }
+
+    m_scrollingContentsLayer->setSize(scrollSize);
+    // FIXME: The paint offset and the scroll offset should really be separate concepts.
+    m_scrollingContentsLayer->setOffsetDoubleFromLayoutObject(scrollingContentsOffset, GraphicsLayer::DontSetNeedsDisplay);
+
+    if (m_foregroundLayer) {
+        if (m_foregroundLayer->size() != m_scrollingContentsLayer->size())
+            m_foregroundLayer->setSize(m_scrollingContentsLayer->size());
+        m_foregroundLayer->setNeedsDisplay();
+        m_foregroundLayer->setOffsetFromLayoutObject(m_scrollingContentsLayer->offsetFromLayoutObject());
+    }
+
+    updateScrollingBlockSelection();
+}
+
+void CompositedLayerMapping::updateChildClippingMaskLayerGeometry()
+{
+    if (!m_childClippingMaskLayer || !layoutObject()->style()->clipPath())
+        return;
+    LayoutBox* layoutBox = toLayoutBox(layoutObject());
+    IntRect clientBox = enclosingIntRect(layoutBox->clientBoxRect());
+
+    m_childClippingMaskLayer->setPosition(m_graphicsLayer->position());
+    m_childClippingMaskLayer->setSize(m_graphicsLayer->size());
+    m_childClippingMaskLayer->setOffsetFromLayoutObject(toIntSize(clientBox.location()));
+
+    // NOTE: also some stuff happening in updateChildContainmentLayerGeometry().
+}
+
+void CompositedLayerMapping::updateForegroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize, const IntRect& clippingBox)
+{
+    if (!m_foregroundLayer)
+        return;
+
+    FloatSize foregroundSize = relativeCompositingBoundsSize;
+    IntSize foregroundOffset = m_graphicsLayer->offsetFromLayoutObject();
+    m_foregroundLayer->setPosition(FloatPoint());
+
+    if (hasClippingLayer()) {
+        // If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
+        // so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
+        foregroundSize = FloatSize(clippingBox.size());
+        foregroundOffset = toIntSize(clippingBox.location());
+    } else if (m_childTransformLayer) {
+        // Things are different if we have a child transform layer rather
+        // than a clipping layer. In this case, we want to actually change
+        // the position of the layer (to compensate for our ancestor
+        // compositing PaintLayer's position) rather than leave the position the
+        // same and use offset-from-layoutObject + size to describe a clipped
+        // "window" onto the clipped layer.
+
+        m_foregroundLayer->setPosition(-m_childTransformLayer->position());
+    }
+
+    if (foregroundSize != m_foregroundLayer->size()) {
+        m_foregroundLayer->setSize(foregroundSize);
+        m_foregroundLayer->setNeedsDisplay();
+    }
+    m_foregroundLayer->setOffsetFromLayoutObject(foregroundOffset);
+
+    // NOTE: there is some more configuring going on in updateScrollingLayerGeometry().
+}
+
+void CompositedLayerMapping::updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize)
+{
+    if (!m_backgroundLayer)
+        return;
+
+    FloatSize backgroundSize = relativeCompositingBoundsSize;
+    if (backgroundLayerPaintsFixedRootBackground()) {
+        FrameView* frameView = toLayoutView(layoutObject())->frameView();
+        backgroundSize = frameView->visibleContentRect().size();
+    }
+    m_backgroundLayer->setPosition(FloatPoint());
+    if (backgroundSize != m_backgroundLayer->size()) {
+        m_backgroundLayer->setSize(backgroundSize);
+        m_backgroundLayer->setNeedsDisplay();
+    }
+    m_backgroundLayer->setOffsetFromLayoutObject(m_graphicsLayer->offsetFromLayoutObject());
+}
+
+void CompositedLayerMapping::registerScrollingLayers()
+{
+    // Register fixed position layers and their containers with the scrolling coordinator.
+    ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
+    if (!scrollingCoordinator)
+        return;
+
+    scrollingCoordinator->updateLayerPositionConstraint(&m_owningLayer);
+
+    // Page scale is applied as a transform on the root layout view layer. Because the scroll
+    // layer is further up in the hierarchy, we need to avoid marking the root layout view
+    // layer as a container.
+    bool isContainer = m_owningLayer.hasTransformRelatedProperty() && !m_owningLayer.isRootLayer();
+    // FIXME: we should make certain that childForSuperLayers will never be the m_squashingContainmentLayer here
+    scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(childForSuperlayers(), isContainer);
+}
+
+void CompositedLayerMapping::updateInternalHierarchy()
+{
+    // m_foregroundLayer has to be inserted in the correct order with child layers,
+    // so it's not inserted here.
+    if (m_ancestorClippingLayer)
+        m_ancestorClippingLayer->removeAllChildren();
+
+    m_graphicsLayer->removeFromParent();
+
+    if (m_ancestorClippingLayer)
+        m_ancestorClippingLayer->addChild(m_graphicsLayer.get());
+
+    // Layer to which children should be attached as we build the hierarchy.
+    GraphicsLayer* bottomLayer = m_graphicsLayer.get();
+    auto updateBottomLayer = [&bottomLayer](GraphicsLayer* layer)
+    {
+        if (layer) {
+            bottomLayer->addChild(layer);
+            bottomLayer = layer;
+        }
+    };
+
+    updateBottomLayer(m_childTransformLayer.get());
+    updateBottomLayer(m_childContainmentLayer.get());
+    updateBottomLayer(m_scrollingLayer.get());
+
+    // Now constructing the subtree for the overflow controls.
+    bottomLayer = m_graphicsLayer.get();
+    if (m_isMainFrameLayoutViewLayer)
+        bottomLayer = layoutObject()->frame()->page()->frameHost().visualViewport().containerLayer();
+    updateBottomLayer(m_overflowControlsClippingLayer.get());
+    updateBottomLayer(m_overflowControlsHostLayer.get());
+    if (m_layerForHorizontalScrollbar)
+        m_overflowControlsHostLayer->addChild(m_layerForHorizontalScrollbar.get());
+    if (m_layerForVerticalScrollbar)
+        m_overflowControlsHostLayer->addChild(m_layerForVerticalScrollbar.get());
+    if (m_layerForScrollCorner)
+        m_overflowControlsHostLayer->addChild(m_layerForScrollCorner.get());
+
+    // The squashing containment layer, if it exists, becomes a no-op parent.
+    if (m_squashingLayer) {
+        ASSERT((m_ancestorClippingLayer && !m_squashingContainmentLayer) || (!m_ancestorClippingLayer && m_squashingContainmentLayer));
+
+        if (m_squashingContainmentLayer) {
+            m_squashingContainmentLayer->removeAllChildren();
+            m_squashingContainmentLayer->addChild(m_graphicsLayer.get());
+            m_squashingContainmentLayer->addChild(m_squashingLayer.get());
+        } else {
+            // The ancestor clipping layer is already set up and has m_graphicsLayer under it.
+            m_ancestorClippingLayer->addChild(m_squashingLayer.get());
+        }
+    }
+}
+
+void CompositedLayerMapping::updatePaintingPhases()
+{
+    m_graphicsLayer->setPaintingPhase(paintingPhaseForPrimaryLayer());
+    if (m_scrollingContentsLayer) {
+        GraphicsLayerPaintingPhase paintPhase = GraphicsLayerPaintOverflowContents | GraphicsLayerPaintCompositedScroll;
+        if (!m_foregroundLayer)
+            paintPhase |= GraphicsLayerPaintForeground;
+        m_scrollingContentsLayer->setPaintingPhase(paintPhase);
+        if (m_scrollingBlockSelectionLayer)
+            m_scrollingBlockSelectionLayer->setPaintingPhase(paintPhase);
+    }
+}
+
+void CompositedLayerMapping::updateContentsRect()
+{
+    m_graphicsLayer->setContentsRect(pixelSnappedIntRect(contentsBox()));
+}
+
+void CompositedLayerMapping::updateContentsOffsetInCompositingLayer(const IntPoint& snappedOffsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation)
+{
+    // m_graphicsLayer is positioned relative to our compositing ancestor
+    // PaintLayer, but it's not positioned at the origin of m_owningLayer, it's
+    // offset by m_contentBounds.location(). This is what
+    // contentOffsetInCompositingLayer is meant to capture, roughly speaking
+    // (ignoring rounding and subpixel accumulation).
+    //
+    // Our ancestor graphics layers in this CLM (m_graphicsLayer and potentially
+    // m_ancestorClippingLayer) have pixel snapped, so if we don't adjust this
+    // offset, we'll see accumulated rounding errors due to that snapping.
+    //
+    // In order to ensure that we account for this rounding, we compute
+    // contentsOffsetInCompositingLayer in a somewhat roundabout way.
+    //
+    // our position = (desired position) - (inherited graphics layer offset).
+    //
+    // Precisely,
+    // Offset = snappedOffsetFromCompositedAncestor - offsetDueToAncestorGraphicsLayers (See code below)
+    //      = snappedOffsetFromCompositedAncestor - (m_graphicsLayer->position() + graphicsLayerParentLocation)
+    //      = snappedOffsetFromCompositedAncestor - (relativeCompositingBounds.location() - graphicsLayerParentLocation + graphicsLayerParentLocation) (See updateMainGraphicsLayerGeometry)
+    //      = snappedOffsetFromCompositedAncestor - relativeCompositingBounds.location()
+    //      = snappedOffsetFromCompositedAncestor - (pixelSnappedIntRect(contentBounds.location()) + snappedOffsetFromCompositedAncestor) (See computeBoundsOfOwningLayer)
+    //      = -pixelSnappedIntRect(contentBounds.location())
+    //
+    // As you can see, we've ended up at the same spot (-contentBounds.location()),
+    // but by subtracting off our ancestor graphics layers positions, we can be
+    // sure we've accounted correctly for any pixel snapping due to ancestor
+    // graphics layers.
+    //
+    // And drawing of composited children takes into account the subpixel
+    // accumulation of this CLM already (through its own
+    // graphicsLayerParentLocation it appears).
+    FloatPoint offsetDueToAncestorGraphicsLayers = m_graphicsLayer->position() + graphicsLayerParentLocation;
+    m_contentOffsetInCompositingLayer = LayoutSize(snappedOffsetFromCompositedAncestor - offsetDueToAncestorGraphicsLayers);
+    m_contentOffsetInCompositingLayerDirty = false;
+}
+
+void CompositedLayerMapping::updateScrollingBlockSelection()
+{
+    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
+        return;
+
+    if (!m_scrollingBlockSelectionLayer)
+        return;
+
+    if (!m_scrollingContentsAreEmpty) {
+        // In this case, the selection will be painted directly into m_scrollingContentsLayer.
+        m_scrollingBlockSelectionLayer->setDrawsContent(false);
+        return;
+    }
+
+    const IntRect blockSelectionGapsBounds = m_owningLayer.blockSelectionGapsBounds();
+    const bool shouldDrawContent = !blockSelectionGapsBounds.isEmpty();
+    m_scrollingBlockSelectionLayer->setDrawsContent(shouldDrawContent);
+    if (!shouldDrawContent)
+        return;
+    // FIXME: Remove the flooredIntSize conversion. crbug.com/414283.
+    const IntPoint position = blockSelectionGapsBounds.location() + flooredIntSize(m_owningLayer.scrollableArea()->adjustedScrollOffset());
+    if (m_scrollingBlockSelectionLayer->size() == blockSelectionGapsBounds.size() && m_scrollingBlockSelectionLayer->position() == position)
+        return;
+
+    m_scrollingBlockSelectionLayer->setPosition(position);
+    m_scrollingBlockSelectionLayer->setSize(blockSelectionGapsBounds.size());
+    m_scrollingBlockSelectionLayer->setOffsetFromLayoutObject(toIntSize(blockSelectionGapsBounds.location()), GraphicsLayer::SetNeedsDisplay);
+}
+
+void CompositedLayerMapping::updateDrawsContent()
+{
+    bool hasPaintedContent = containsPaintedContent();
+    m_graphicsLayer->setDrawsContent(hasPaintedContent);
+
+    if (m_scrollingLayer) {
+        // m_scrollingLayer never has backing store.
+        // m_scrollingContentsLayer only needs backing store if the scrolled contents need to paint.
+        m_scrollingContentsAreEmpty = !m_owningLayer.hasVisibleContent() || !(layoutObject()->hasBackground() || paintsChildren());
+        m_scrollingContentsLayer->setDrawsContent(!m_scrollingContentsAreEmpty);
+        updateScrollingBlockSelection();
+    }
+
+    if (hasPaintedContent && isAcceleratedCanvas(layoutObject())) {
+        CanvasRenderingContext* context = toHTMLCanvasElement(layoutObject()->node())->renderingContext();
+        // Content layer may be null if context is lost.
+        if (WebLayer* contentLayer = context->platformLayer()) {
+            Color bgColor(Color::transparent);
+            if (contentLayerSupportsDirectBackgroundComposition(layoutObject())) {
+                bgColor = layoutObjectBackgroundColor();
+                hasPaintedContent = false;
+            }
+            contentLayer->setBackgroundColor(bgColor.rgb());
+        }
+    }
+
+    // FIXME: we could refine this to only allocate backings for one of these layers if possible.
+    if (m_foregroundLayer)
+        m_foregroundLayer->setDrawsContent(hasPaintedContent);
+
+    if (m_backgroundLayer)
+        m_backgroundLayer->setDrawsContent(hasPaintedContent);
+
+    if (m_maskLayer)
+        m_maskLayer->setDrawsContent(true);
+
+    if (m_childClippingMaskLayer)
+        m_childClippingMaskLayer->setDrawsContent(true);
+}
+
+void CompositedLayerMapping::updateChildrenTransform()
+{
+    if (GraphicsLayer* childTransformLayer = this->childTransformLayer()) {
+        childTransformLayer->setTransform(owningLayer().perspectiveTransform());
+        childTransformLayer->setTransformOrigin(owningLayer().perspectiveOrigin());
+    }
+
+    updateShouldFlattenTransform();
+}
+
+// Return true if the layers changed.
+bool CompositedLayerMapping::updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip)
+{
+    bool layersChanged = false;
+
+    if (needsAncestorClip) {
+        if (!m_ancestorClippingLayer) {
+            m_ancestorClippingLayer = createGraphicsLayer(CompositingReasonLayerForAncestorClip);
+            m_ancestorClippingLayer->setMasksToBounds(true);
+            m_ancestorClippingLayer->setShouldFlattenTransform(false);
+            layersChanged = true;
+        }
+    } else if (m_ancestorClippingLayer) {
+        m_ancestorClippingLayer->removeFromParent();
+        m_ancestorClippingLayer = nullptr;
+        layersChanged = true;
+    }
+
+    if (needsDescendantClip) {
+        // We don't need a child containment layer if we're the main frame layout view
+        // layer. It's redundant as the frame clip above us will handle this clipping.
+        if (!m_childContainmentLayer && !m_isMainFrameLayoutViewLayer) {
+            m_childContainmentLayer = createGraphicsLayer(CompositingReasonLayerForDescendantClip);
+            m_childContainmentLayer->setMasksToBounds(true);
+            layersChanged = true;
+        }
+    } else if (hasClippingLayer()) {
+        m_childContainmentLayer->removeFromParent();
+        m_childContainmentLayer = nullptr;
+        layersChanged = true;
+    }
+
+    return layersChanged;
+}
+
+bool CompositedLayerMapping::updateChildTransformLayer(bool needsChildTransformLayer)
+{
+    bool layersChanged = false;
+
+    if (needsChildTransformLayer) {
+        if (!m_childTransformLayer) {
+            m_childTransformLayer = createGraphicsLayer(CompositingReasonLayerForPerspective);
+            m_childTransformLayer->setDrawsContent(false);
+            layersChanged = true;
+        }
+    } else if (m_childTransformLayer) {
+        m_childTransformLayer->removeFromParent();
+        m_childTransformLayer = nullptr;
+        layersChanged = true;
+    }
+
+    return layersChanged;
+}
+
+void CompositedLayerMapping::setBackgroundLayerPaintsFixedRootBackground(bool backgroundLayerPaintsFixedRootBackground)
+{
+    m_backgroundLayerPaintsFixedRootBackground = backgroundLayerPaintsFixedRootBackground;
+}
+
+// Only a member function so it can call createGraphicsLayer.
+bool CompositedLayerMapping::toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>& layer, bool needsLayer, CompositingReasons reason)
+{
+    if (needsLayer == !!layer)
+        return false;
+    layer = needsLayer ? createGraphicsLayer(reason) : nullptr;
+    return true;
+}
+
+bool CompositedLayerMapping::updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip)
+{
+    // If the subtree is invisible, we don't actually need scrollbar layers.
+    bool invisible = m_owningLayer.subtreeIsInvisible();
+    needsHorizontalScrollbarLayer &= !invisible;
+    needsVerticalScrollbarLayer &= !invisible;
+    needsScrollCornerLayer &= !invisible;
+
+    bool horizontalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForHorizontalScrollbar, needsHorizontalScrollbarLayer, CompositingReasonLayerForHorizontalScrollbar);
+    bool verticalScrollbarLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForVerticalScrollbar, needsVerticalScrollbarLayer, CompositingReasonLayerForVerticalScrollbar);
+    bool scrollCornerLayerChanged = toggleScrollbarLayerIfNeeded(m_layerForScrollCorner, needsScrollCornerLayer, CompositingReasonLayerForScrollCorner);
+
+    bool needsOverflowControlsHostLayer = needsHorizontalScrollbarLayer || needsVerticalScrollbarLayer || needsScrollCornerLayer;
+    toggleScrollbarLayerIfNeeded(m_overflowControlsHostLayer, needsOverflowControlsHostLayer, CompositingReasonLayerForOverflowControlsHost);
+    bool needsOverflowClipLayer = needsOverflowControlsHostLayer && needsAncestorClip;
+    toggleScrollbarLayerIfNeeded(m_overflowControlsClippingLayer, needsOverflowClipLayer, CompositingReasonLayerForOverflowControlsHost);
+
+    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
+        if (horizontalScrollbarLayerChanged)
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer.scrollableArea(), HorizontalScrollbar);
+        if (verticalScrollbarLayerChanged)
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_owningLayer.scrollableArea(), VerticalScrollbar);
+    }
+
+    return horizontalScrollbarLayerChanged || verticalScrollbarLayerChanged || scrollCornerLayerChanged;
+}
+
+void CompositedLayerMapping::positionOverflowControlsLayers()
+{
+    IntSize offsetFromLayoutObject = m_graphicsLayer->offsetFromLayoutObject() - roundedIntSize(m_owningLayer.subpixelAccumulation());
+    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
+        Scrollbar* hBar = m_owningLayer.scrollableArea()->horizontalScrollbar();
+        if (hBar) {
+            layer->setPosition(hBar->frameRect().location() - offsetFromLayoutObject);
+            layer->setSize(hBar->frameRect().size());
+            if (layer->hasContentsLayer())
+                layer->setContentsRect(IntRect(IntPoint(), hBar->frameRect().size()));
+        }
+        layer->setDrawsContent(hBar && !layer->hasContentsLayer());
+    }
+
+    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
+        Scrollbar* vBar = m_owningLayer.scrollableArea()->verticalScrollbar();
+        if (vBar) {
+            layer->setPosition(vBar->frameRect().location() - offsetFromLayoutObject);
+            layer->setSize(vBar->frameRect().size());
+            if (layer->hasContentsLayer())
+                layer->setContentsRect(IntRect(IntPoint(), vBar->frameRect().size()));
+        }
+        layer->setDrawsContent(vBar && !layer->hasContentsLayer());
+    }
+
+    if (GraphicsLayer* layer = layerForScrollCorner()) {
+        const IntRect& scrollCornerAndResizer = m_owningLayer.scrollableArea()->scrollCornerAndResizerRect();
+        layer->setPosition(FloatPoint(scrollCornerAndResizer.location() - offsetFromLayoutObject));
+        layer->setSize(FloatSize(scrollCornerAndResizer.size()));
+        layer->setDrawsContent(!scrollCornerAndResizer.isEmpty());
+    }
+}
+
+bool CompositedLayerMapping::hasUnpositionedOverflowControlsLayers() const
+{
+    if (GraphicsLayer* layer = layerForHorizontalScrollbar()) {
+        if (!layer->drawsContent())
+            return true;
+    }
+
+    if (GraphicsLayer* layer = layerForVerticalScrollbar()) {
+        if (!layer->drawsContent())
+            return true;
+    }
+
+    if (GraphicsLayer* layer = layerForScrollCorner()) {
+        if (!layer->drawsContent())
+            return true;
+    }
+
+    return false;
+}
+
+enum ApplyToGraphicsLayersModeFlags {
+    ApplyToLayersAffectedByPreserve3D = (1 << 0),
+    ApplyToSquashingLayer = (1 << 1),
+    ApplyToScrollbarLayers = (1 << 2),
+    ApplyToBackgroundLayer = (1 << 3),
+    ApplyToMaskLayers = (1 << 4),
+    ApplyToContentLayers = (1 << 5),
+    ApplyToChildContainingLayers = (1 << 6), // layers between m_graphicsLayer and children
+    ApplyToAllGraphicsLayers = (ApplyToSquashingLayer | ApplyToScrollbarLayers | ApplyToBackgroundLayer | ApplyToMaskLayers | ApplyToLayersAffectedByPreserve3D | ApplyToContentLayers)
+};
+typedef unsigned ApplyToGraphicsLayersMode;
+
+template <typename Func>
+static void ApplyToGraphicsLayers(const CompositedLayerMapping* mapping, const Func& f, ApplyToGraphicsLayersMode mode)
+{
+    ASSERT(mode);
+
+    if ((mode & ApplyToLayersAffectedByPreserve3D) && mapping->childTransformLayer())
+        f(mapping->childTransformLayer());
+    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLayers)) && mapping->mainGraphicsLayer())
+        f(mapping->mainGraphicsLayer());
+    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildContainingLayers)) && mapping->clippingLayer())
+        f(mapping->clippingLayer());
+    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildContainingLayers)) && mapping->scrollingLayer())
+        f(mapping->scrollingLayer());
+    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToChildContainingLayers)) && mapping->scrollingBlockSelectionLayer())
+        f(mapping->scrollingBlockSelectionLayer());
+    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLayers) || (mode & ApplyToChildContainingLayers)) && mapping->scrollingContentsLayer())
+        f(mapping->scrollingContentsLayer());
+    if (((mode & ApplyToLayersAffectedByPreserve3D) || (mode & ApplyToContentLayers)) && mapping->foregroundLayer())
+        f(mapping->foregroundLayer());
+
+    if ((mode & ApplyToChildContainingLayers) && mapping->childTransformLayer())
+        f(mapping->childTransformLayer());
+
+    if ((mode & ApplyToSquashingLayer) && mapping->squashingLayer())
+        f(mapping->squashingLayer());
+
+    if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping->maskLayer())
+        f(mapping->maskLayer());
+    if (((mode & ApplyToMaskLayers) || (mode & ApplyToContentLayers)) && mapping->childClippingMaskLayer())
+        f(mapping->childClippingMaskLayer());
+
+    if (((mode & ApplyToBackgroundLayer) || (mode & ApplyToContentLayers)) && mapping->backgroundLayer())
+        f(mapping->backgroundLayer());
+
+    if ((mode & ApplyToScrollbarLayers) && mapping->layerForHorizontalScrollbar())
+        f(mapping->layerForHorizontalScrollbar());
+    if ((mode & ApplyToScrollbarLayers) && mapping->layerForVerticalScrollbar())
+        f(mapping->layerForVerticalScrollbar());
+    if ((mode & ApplyToScrollbarLayers) && mapping->layerForScrollCorner())
+        f(mapping->layerForScrollCorner());
+}
+
+struct UpdateRenderingContextFunctor {
+    void operator() (GraphicsLayer* layer) const { layer->setRenderingContext(renderingContext); }
+    int renderingContext;
+};
+
+void CompositedLayerMapping::updateRenderingContext()
+{
+    // All layers but the squashing layer (which contains 'alien' content) should be included in this
+    // rendering context.
+    int id = 0;
+
+    // NB, it is illegal at this point to query an ancestor's compositing state. Some compositing
+    // reasons depend on the compositing state of ancestors. So if we want a rendering context id
+    // for the context root, we cannot ask for the id of its associated WebLayer now; it may not have
+    // one yet. We could do a second past after doing the compositing updates to get these ids,
+    // but this would actually be harmful. We do not want to attach any semantic meaning to
+    // the context id other than the fact that they group a number of layers together for the
+    // sake of 3d sorting. So instead we will ask the compositor to vend us an arbitrary, but
+    // consistent id.
+    if (PaintLayer* root = m_owningLayer.renderingContextRoot()) {
+        if (Node* node = root->layoutObject()->node())
+            id = static_cast<int>(WTF::PtrHash<Node*>::hash(node));
+    }
+
+    UpdateRenderingContextFunctor functor = { id };
+    ApplyToGraphicsLayersMode mode = ApplyToAllGraphicsLayers & ~ApplyToSquashingLayer;
+    ApplyToGraphicsLayers<UpdateRenderingContextFunctor>(this, functor, mode);
+}
+
+struct UpdateShouldFlattenTransformFunctor {
+    void operator() (GraphicsLayer* layer) const { layer->setShouldFlattenTransform(shouldFlatten); }
+    bool shouldFlatten;
+};
+
+void CompositedLayerMapping::updateShouldFlattenTransform()
+{
+    // All CLM-managed layers that could affect a descendant layer should update their
+    // should-flatten-transform value (the other layers' transforms don't matter here).
+    UpdateShouldFlattenTransformFunctor functor = { !m_owningLayer.shouldPreserve3D() };
+    ApplyToGraphicsLayersMode mode = ApplyToLayersAffectedByPreserve3D;
+    ApplyToGraphicsLayers(this, functor, mode);
+
+    // Note, if we apply perspective, we have to set should flatten differently
+    // so that the transform propagates to child layers correctly.
+    if (hasChildTransformLayer()) {
+        ApplyToGraphicsLayers(this, [](GraphicsLayer* layer) {
+            layer->setShouldFlattenTransform(false);
+        }, ApplyToChildContainingLayers);
+    }
+
+    // Regardless, mark the scrolling contents layer and scrolling block
+    // selection layer (if they exist) as not flattening. Having them flatten
+    // causes unclipped render surfaces which cause bugs.
+    // http://crbug.com/521768
+    if (hasScrollingLayer()) {
+        m_scrollingContentsLayer->setShouldFlattenTransform(false);
+        if (m_scrollingBlockSelectionLayer)
+            m_scrollingBlockSelectionLayer->setShouldFlattenTransform(false);
+    }
+}
+
+bool CompositedLayerMapping::updateForegroundLayer(bool needsForegroundLayer)
+{
+    bool layerChanged = false;
+    if (needsForegroundLayer) {
+        if (!m_foregroundLayer) {
+            m_foregroundLayer = createGraphicsLayer(CompositingReasonLayerForForeground);
+            m_foregroundLayer->setPaintingPhase(GraphicsLayerPaintForeground);
+            layerChanged = true;
+        }
+    } else if (m_foregroundLayer) {
+        m_foregroundLayer->removeFromParent();
+        m_foregroundLayer = nullptr;
+        layerChanged = true;
+    }
+
+    return layerChanged;
+}
+
+bool CompositedLayerMapping::updateBackgroundLayer(bool needsBackgroundLayer)
+{
+    bool layerChanged = false;
+    if (needsBackgroundLayer) {
+        if (!m_backgroundLayer) {
+            m_backgroundLayer = createGraphicsLayer(CompositingReasonLayerForBackground);
+            m_backgroundLayer->setTransformOrigin(FloatPoint3D());
+            m_backgroundLayer->setPaintingPhase(GraphicsLayerPaintBackground);
+            layerChanged = true;
+        }
+    } else {
+        if (m_backgroundLayer) {
+            m_backgroundLayer->removeFromParent();
+            m_backgroundLayer = nullptr;
+            layerChanged = true;
+        }
+    }
+
+    if (layerChanged && !m_owningLayer.layoutObject()->documentBeingDestroyed())
+        compositor()->rootFixedBackgroundsChanged();
+
+    return layerChanged;
+}
+
+bool CompositedLayerMapping::updateMaskLayer(bool needsMaskLayer)
+{
+    bool layerChanged = false;
+    if (needsMaskLayer) {
+        if (!m_maskLayer) {
+            m_maskLayer = createGraphicsLayer(CompositingReasonLayerForMask);
+            m_maskLayer->setPaintingPhase(GraphicsLayerPaintMask);
+            layerChanged = true;
+        }
+    } else if (m_maskLayer) {
+        m_maskLayer = nullptr;
+        layerChanged = true;
+    }
+
+    return layerChanged;
+}
+
+bool CompositedLayerMapping::updateClippingMaskLayers(bool needsChildClippingMaskLayer)
+{
+    bool layerChanged = false;
+    if (needsChildClippingMaskLayer) {
+        if (!m_childClippingMaskLayer) {
+            m_childClippingMaskLayer = createGraphicsLayer(CompositingReasonLayerForClippingMask);
+            m_childClippingMaskLayer->setPaintingPhase(GraphicsLayerPaintChildClippingMask);
+            layerChanged = true;
+        }
+    } else if (m_childClippingMaskLayer) {
+        m_childClippingMaskLayer = nullptr;
+        layerChanged = true;
+    }
+    return layerChanged;
+}
+
+bool CompositedLayerMapping::updateScrollingLayers(bool needsScrollingLayers)
+{
+    ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer);
+
+    bool layerChanged = false;
+    if (needsScrollingLayers) {
+        if (!m_scrollingLayer) {
+            // Outer layer which corresponds with the scroll view.
+            m_scrollingLayer = createGraphicsLayer(CompositingReasonLayerForScrollingContainer);
+            m_scrollingLayer->setDrawsContent(false);
+            m_scrollingLayer->setMasksToBounds(true);
+
+            // Inner layer which renders the content that scrolls.
+            m_scrollingContentsLayer = createGraphicsLayer(CompositingReasonLayerForScrollingContents);
+            m_scrollingLayer->addChild(m_scrollingContentsLayer.get());
+
+            if (!RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled()) {
+                m_scrollingBlockSelectionLayer = createGraphicsLayer(CompositingReasonLayerForScrollingBlockSelection);
+                m_scrollingBlockSelectionLayer->setDrawsContent(true);
+                m_scrollingContentsLayer->addChild(m_scrollingBlockSelectionLayer.get());
+            }
+
+            layerChanged = true;
+            if (scrollingCoordinator)
+                scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLayer.scrollableArea());
+        }
+    } else if (m_scrollingLayer) {
+        m_scrollingLayer = nullptr;
+        m_scrollingContentsLayer = nullptr;
+        m_scrollingBlockSelectionLayer = nullptr;
+        layerChanged = true;
+        if (scrollingCoordinator)
+            scrollingCoordinator->scrollableAreaScrollLayerDidChange(m_owningLayer.scrollableArea());
+    }
+
+    return layerChanged;
+}
+
+static void updateScrollParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLayer* topmostLayer, PaintLayer* scrollParent, ScrollingCoordinator* scrollingCoordinator)
+{
+    if (!layer)
+        return;
+
+    // Only the topmost layer has a scroll parent. All other layers have a null scroll parent.
+    if (layer != topmostLayer)
+        scrollParent = 0;
+
+    scrollingCoordinator->updateScrollParentForGraphicsLayer(layer, scrollParent);
+}
+
+void CompositedLayerMapping::updateScrollParent(PaintLayer* scrollParent)
+{
+    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
+        GraphicsLayer* topmostLayer = childForSuperlayers();
+        updateScrollParentForGraphicsLayer(m_squashingContainmentLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
+        updateScrollParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
+        updateScrollParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, scrollParent, scrollingCoordinator);
+    }
+}
+
+static void updateClipParentForGraphicsLayer(GraphicsLayer* layer, GraphicsLayer* topmostLayer, PaintLayer* clipParent, ScrollingCoordinator* scrollingCoordinator)
+{
+    if (!layer)
+        return;
+
+    // Only the topmost layer has a scroll parent. All other layers have a null scroll parent.
+    if (layer != topmostLayer)
+        clipParent = 0;
+
+    scrollingCoordinator->updateClipParentForGraphicsLayer(layer, clipParent);
+}
+
+void CompositedLayerMapping::updateClipParent(PaintLayer* scrollParent)
+{
+    if (owningLayerClippedByLayerNotAboveCompositedAncestor(scrollParent))
+        return;
+
+    PaintLayer* clipParent = m_owningLayer.clipParent();
+    if (clipParent)
+        clipParent = clipParent->enclosingLayerWithCompositedLayerMapping(IncludeSelf);
+
+    if (ScrollingCoordinator* scrollingCoordinator = scrollingCoordinatorFromLayer(m_owningLayer)) {
+        GraphicsLayer* topmostLayer = childForSuperlayers();
+        updateClipParentForGraphicsLayer(m_squashingContainmentLayer.get(), topmostLayer, clipParent, scrollingCoordinator);
+        updateClipParentForGraphicsLayer(m_ancestorClippingLayer.get(), topmostLayer, clipParent, scrollingCoordinator);
+        updateClipParentForGraphicsLayer(m_graphicsLayer.get(), topmostLayer, clipParent, scrollingCoordinator);
+    }
+}
+
+bool CompositedLayerMapping::updateSquashingLayers(bool needsSquashingLayers)
+{
+    bool layersChanged = false;
+
+    if (needsSquashingLayers) {
+        if (!m_squashingLayer) {
+            m_squashingLayer = createGraphicsLayer(CompositingReasonLayerForSquashingContents);
+            m_squashingLayer->setDrawsContent(true);
+            layersChanged = true;
+        }
+
+        if (m_ancestorClippingLayer) {
+            if (m_squashingContainmentLayer) {
+                m_squashingContainmentLayer->removeFromParent();
+                m_squashingContainmentLayer = nullptr;
+                layersChanged = true;
+            }
+        } else {
+            if (!m_squashingContainmentLayer) {
+                m_squashingContainmentLayer = createGraphicsLayer(CompositingReasonLayerForSquashingContainer);
+                m_squashingContainmentLayer->setShouldFlattenTransform(false);
+                layersChanged = true;
+            }
+        }
+
+        ASSERT((m_ancestorClippingLayer && !m_squashingContainmentLayer) || (!m_ancestorClippingLayer && m_squashingContainmentLayer));
+        ASSERT(m_squashingLayer);
+    } else {
+        if (m_squashingLayer) {
+            m_squashingLayer->removeFromParent();
+            m_squashingLayer = nullptr;
+            layersChanged = true;
+        }
+        if (m_squashingContainmentLayer) {
+            m_squashingContainmentLayer->removeFromParent();
+            m_squashingContainmentLayer = nullptr;
+            layersChanged = true;
+        }
+        ASSERT(!m_squashingLayer && !m_squashingContainmentLayer);
+    }
+
+    return layersChanged;
+}
+
+GraphicsLayerPaintingPhase CompositedLayerMapping::paintingPhaseForPrimaryLayer() const
+{
+    unsigned phase = 0;
+    if (!m_backgroundLayer)
+        phase |= GraphicsLayerPaintBackground;
+    if (!m_foregroundLayer)
+        phase |= GraphicsLayerPaintForeground;
+    if (!m_maskLayer)
+        phase |= GraphicsLayerPaintMask;
+
+    if (m_scrollingContentsLayer) {
+        phase &= ~GraphicsLayerPaintForeground;
+        phase |= GraphicsLayerPaintCompositedScroll;
+    }
+
+    return static_cast<GraphicsLayerPaintingPhase>(phase);
+}
+
+float CompositedLayerMapping::compositingOpacity(float layoutObjectOpacity) const
+{
+    float finalOpacity = layoutObjectOpacity;
+
+    for (PaintLayer* curr = m_owningLayer.parent(); curr; curr = curr->parent()) {
+        // We only care about parents that are stacking contexts.
+        // Recall that opacity creates stacking context.
+        if (!curr->stackingNode()->isStackingContext())
+            continue;
+
+        // If we found a composited layer, regardless of whether it actually
+        // paints into it, we want to compute opacity relative to it. So we can
+        // break here.
+        //
+        // FIXME: with grouped backings, a composited descendant will have to
+        // continue past the grouped (squashed) layers that its parents may
+        // contribute to. This whole confusion can be avoided by specifying
+        // explicitly the composited ancestor where we would stop accumulating
+        // opacity.
+        if (curr->compositingState() == PaintsIntoOwnBacking)
+            break;
+
+        finalOpacity *= curr->layoutObject()->opacity();
+    }
+
+    return finalOpacity;
+}
+
+Color CompositedLayerMapping::layoutObjectBackgroundColor() const
+{
+    return layoutObject()->resolveColor(CSSPropertyBackgroundColor);
+}
+
+void CompositedLayerMapping::updateBackgroundColor()
+{
+    m_graphicsLayer->setBackgroundColor(layoutObjectBackgroundColor());
+}
+
+bool CompositedLayerMapping::paintsChildren() const
+{
+    if (m_owningLayer.hasVisibleContent() && m_owningLayer.hasNonEmptyChildLayoutObjects())
+        return true;
+
+    if (hasVisibleNonCompositingDescendant(&m_owningLayer))
+        return true;
+
+    return false;
+}
+
+static bool isCompositedPlugin(LayoutObject* layoutObject)
+{
+    return layoutObject->isEmbeddedObject() && toLayoutEmbeddedObject(layoutObject)->requiresAcceleratedCompositing();
+}
+
+bool CompositedLayerMapping::hasVisibleNonCompositingDescendant(PaintLayer* parent)
+{
+    if (!parent->hasVisibleDescendant())
+        return false;
+
+    // FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
+    parent->stackingNode()->updateLayerListsIfNeeded();
+
+#if ENABLE(ASSERT)
+    LayerListMutationDetector mutationChecker(parent->stackingNode());
+#endif
+
+    PaintLayerStackingNodeIterator normalFlowIterator(*parent->stackingNode(), AllChildren);
+    while (PaintLayerStackingNode* curNode = normalFlowIterator.next()) {
+        PaintLayer* curLayer = curNode->layer();
+        if (curLayer->hasCompositedLayerMapping())
+            continue;
+        if (curLayer->hasVisibleContent() || hasVisibleNonCompositingDescendant(curLayer))
+            return true;
+    }
+
+    return false;
+}
+
+bool CompositedLayerMapping::containsPaintedContent() const
+{
+    if (m_owningLayer.isReflection())
+        return false;
+
+    if (layoutObject()->isImage() && isDirectlyCompositedImage())
+        return false;
+
+    LayoutObject* layoutObject = this->layoutObject();
+    // FIXME: we could optimize cases where the image, video or canvas is known to fill the border box entirely,
+    // and set background color on the layer in that case, instead of allocating backing store and painting.
+    if (layoutObject->isVideo() && toLayoutVideo(layoutObject)->shouldDisplayVideo())
+        return m_owningLayer.hasBoxDecorationsOrBackground();
+
+    if (m_owningLayer.hasVisibleBoxDecorations())
+        return true;
+
+    if (layoutObject->hasMask()) // masks require special treatment
+        return true;
+
+    if (layoutObject->isReplaced() && !isCompositedPlugin(layoutObject))
+        return true;
+
+    if (layoutObject->isLayoutMultiColumnSet())
+        return true;
+
+    if (layoutObject->node() && layoutObject->node()->isDocumentNode()) {
+        // Look to see if the root object has a non-simple background
+        LayoutObject* rootObject = layoutObject->document().documentElement() ? layoutObject->document().documentElement()->layoutObject() : 0;
+        // Reject anything that has a border, a border-radius or outline,
+        // or is not a simple background (no background, or solid color).
+        if (rootObject && hasBoxDecorationsOrBackgroundImage(rootObject->styleRef()))
+            return true;
+
+        // Now look at the body's layoutObject.
+        HTMLElement* body = layoutObject->document().body();
+        LayoutObject* bodyObject = isHTMLBodyElement(body) ? body->layoutObject() : 0;
+        if (bodyObject && hasBoxDecorationsOrBackgroundImage(bodyObject->styleRef()))
+            return true;
+    }
+
+    // FIXME: it's O(n^2). A better solution is needed.
+    return paintsChildren();
+}
+
+// An image can be directly compositing if it's the sole content of the layer, and has no box decorations
+// that require painting. Direct compositing saves backing store.
+bool CompositedLayerMapping::isDirectlyCompositedImage() const
+{
+    ASSERT(layoutObject()->isImage());
+
+    LayoutObject* layoutObject = this->layoutObject();
+    if (m_owningLayer.hasBoxDecorationsOrBackground() || layoutObject->hasClip() || layoutObject->hasClipPath())
+        return false;
+
+    LayoutImage* imageLayoutObject = toLayoutImage(layoutObject);
+    if (ImageResource* cachedImage = imageLayoutObject->cachedImage()) {
+        if (!cachedImage->hasImage())
+            return false;
+
+        Image* image = cachedImage->imageForLayoutObject(imageLayoutObject);
+        if (!image->isBitmapImage())
+            return false;
+
+        // FIXME: We should be able to handle bitmap images using direct compositing
+        // no matter what image-orientation value. See crbug.com/502267
+        if (imageLayoutObject->style()->respectImageOrientation() != RespectImageOrientation)
+            return true;
+    }
+
+    return false;
+}
+
+void CompositedLayerMapping::contentChanged(ContentChangeType changeType)
+{
+    if ((changeType == ImageChanged) && layoutObject()->isImage() && isDirectlyCompositedImage()) {
+        updateImageContents();
+        return;
+    }
+
+    if (changeType == CanvasChanged && isAcceleratedCanvas(layoutObject())) {
+        m_graphicsLayer->setContentsNeedsDisplay();
+        return;
+    }
+}
+
+void CompositedLayerMapping::updateImageContents()
+{
+    ASSERT(layoutObject()->isImage());
+    LayoutImage* imageLayoutObject = toLayoutImage(layoutObject());
+
+    ImageResource* cachedImage = imageLayoutObject->cachedImage();
+    if (!cachedImage)
+        return;
+
+    Image* image = cachedImage->imageForLayoutObject(imageLayoutObject);
+    if (!image)
+        return;
+
+    // This is a no-op if the layer doesn't have an inner layer for the image.
+    m_graphicsLayer->setContentsToImage(image);
+
+    m_graphicsLayer->setFilterQuality(layoutObject()->style()->imageRendering() == ImageRenderingPixelated ? kNone_SkFilterQuality : kLow_SkFilterQuality);
+
+    // Prevent double-drawing: https://bugs.webkit.org/show_bug.cgi?id=58632
+    updateDrawsContent();
+
+    // Image animation is "lazy", in that it automatically stops unless someone is drawing
+    // the image. So we have to kick the animation each time; this has the downside that the
+    // image will keep animating, even if its layer is not visible.
+    image->startAnimation();
+}
+
+FloatPoint3D CompositedLayerMapping::computeTransformOrigin(const IntRect& borderBox) const
+{
+    const ComputedStyle& style = layoutObject()->styleRef();
+
+    FloatPoint3D origin;
+    origin.setX(floatValueForLength(style.transformOriginX(), borderBox.width()));
+    origin.setY(floatValueForLength(style.transformOriginY(), borderBox.height()));
+    origin.setZ(style.transformOriginZ());
+
+    return origin;
+}
+
+// Return the offset from the top-left of this compositing layer at which the
+// LayoutObject's contents are painted.
+LayoutSize CompositedLayerMapping::contentOffsetInCompositingLayer() const
+{
+    ASSERT(!m_contentOffsetInCompositingLayerDirty);
+    return m_contentOffsetInCompositingLayer;
+}
+
+LayoutRect CompositedLayerMapping::contentsBox() const
+{
+    LayoutRect contentsBox = LayoutRect(contentsRect(layoutObject()));
+    contentsBox.move(contentOffsetInCompositingLayer());
+    return contentsBox;
+}
+
+bool CompositedLayerMapping::needsToReparentOverflowControls() const
+{
+    return m_owningLayer.scrollableArea()
+        && m_owningLayer.scrollableArea()->hasOverlayScrollbars()
+        && m_owningLayer.scrollableArea()->topmostScrollChild();
+}
+
+GraphicsLayer* CompositedLayerMapping::detachLayerForOverflowControls(const PaintLayer& enclosingLayer)
+{
+    GraphicsLayer* host = m_overflowControlsClippingLayer.get();
+    if (!host)
+        host = m_overflowControlsHostLayer.get();
+    host->removeFromParent();
+    return host;
+}
+
+GraphicsLayer* CompositedLayerMapping::parentForSublayers() const
+{
+    if (m_scrollingBlockSelectionLayer)
+        return m_scrollingBlockSelectionLayer.get();
+
+    if (m_scrollingContentsLayer)
+        return m_scrollingContentsLayer.get();
+
+    if (m_childContainmentLayer)
+        return m_childContainmentLayer.get();
+
+    if (m_childTransformLayer)
+        return m_childTransformLayer.get();
+
+    return m_graphicsLayer.get();
+}
+
+GraphicsLayer* CompositedLayerMapping::childForSuperlayers() const
+{
+    if (m_squashingContainmentLayer)
+        return m_squashingContainmentLayer.get();
+
+    if (m_ancestorClippingLayer)
+        return m_ancestorClippingLayer.get();
+
+    return m_graphicsLayer.get();
+}
+
+void CompositedLayerMapping::setBlendMode(WebBlendMode blendMode)
+{
+    if (m_ancestorClippingLayer) {
+        m_ancestorClippingLayer->setBlendMode(blendMode);
+        m_graphicsLayer->setBlendMode(WebBlendModeNormal);
+    } else {
+        m_graphicsLayer->setBlendMode(blendMode);
+    }
+}
+
+GraphicsLayerUpdater::UpdateType CompositedLayerMapping::updateTypeForChildren(GraphicsLayerUpdater::UpdateType updateType) const
+{
+    if (m_pendingUpdateScope >= GraphicsLayerUpdateSubtree)
+        return GraphicsLayerUpdater::ForceUpdate;
+    return updateType;
+}
+
+struct SetContentsNeedsDisplayFunctor {
+    void operator() (GraphicsLayer* layer) const
+    {
+        if (layer->drawsContent())
+            layer->setNeedsDisplay();
+    }
+};
+
+void CompositedLayerMapping::setSquashingContentsNeedDisplay()
+{
+    ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToSquashingLayer);
+}
+
+void CompositedLayerMapping::setContentsNeedDisplay()
+{
+    // FIXME: need to split out paint invalidations for the background.
+    ApplyToGraphicsLayers(this, SetContentsNeedsDisplayFunctor(), ApplyToContentLayers);
+}
+
+struct SetContentsNeedsDisplayInRectFunctor {
+    void operator() (GraphicsLayer* layer) const
+    {
+        if (layer->drawsContent()) {
+            IntRect layerDirtyRect = r;
+            layerDirtyRect.move(-layer->offsetFromLayoutObject());
+            layer->setNeedsDisplayInRect(layerDirtyRect, invalidationReason);
+        }
+    }
+
+    IntRect r;
+    PaintInvalidationReason invalidationReason;
+};
+
+// r is in the coordinate space of the layer's layout object
+void CompositedLayerMapping::setContentsNeedDisplayInRect(const LayoutRect& r, PaintInvalidationReason invalidationReason)
+{
+    // FIXME: need to split out paint invalidations for the background.
+    // FIXME: need to distinguish invalidations for different layers (e.g. the main layer and scrolling layer). crbug.com/416535.
+    SetContentsNeedsDisplayInRectFunctor functor = {
+        enclosingIntRect(LayoutRect(r.location() + m_owningLayer.subpixelAccumulation(), r.size())),
+        invalidationReason
+    };
+    ApplyToGraphicsLayers(this, functor, ApplyToContentLayers);
+}
+
+void CompositedLayerMapping::invalidateDisplayItemClient(const DisplayItemClientWrapper& displayItemClient)
+{
+    // FIXME: need to split out paint invalidations for the background.
+    // FIXME: need to distinguish invalidations for different layers (e.g. the main layer and scrolling layer). crbug.com/416535.
+    ApplyToGraphicsLayers(this, [&displayItemClient](GraphicsLayer* layer) {
+        layer->invalidateDisplayItemClient(displayItemClient);
+    }, ApplyToContentLayers);
+}
+
+const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(const LayoutObject* layoutObject, const Vector<GraphicsLayerPaintInfo>& layers, unsigned maxSquashedLayerIndex)
+{
+    for (size_t i = 0; i < layers.size() && i < maxSquashedLayerIndex; ++i) {
+        if (layoutObject->isDescendantOf(layers[i].paintLayer->layoutObject()))
+            return &layers[i];
+    }
+    return nullptr;
+}
+
+const GraphicsLayerPaintInfo* CompositedLayerMapping::containingSquashedLayer(const LayoutObject* layoutObject, unsigned maxSquashedLayerIndex)
+{
+    return CompositedLayerMapping::containingSquashedLayer(layoutObject, m_squashedLayers, maxSquashedLayerIndex);
+}
+
+IntRect CompositedLayerMapping::localClipRectForSquashedLayer(const PaintLayer& referenceLayer, const GraphicsLayerPaintInfo& paintInfo, const Vector<GraphicsLayerPaintInfo>& layers)
+{
+    const LayoutObject* clippingContainer = paintInfo.paintLayer->clippingContainer();
+    if (clippingContainer == referenceLayer.clippingContainer())
+        return LayoutRect::infiniteIntRect();
+
+    ASSERT(clippingContainer);
+
+    const GraphicsLayerPaintInfo* ancestorPaintInfo = containingSquashedLayer(clippingContainer, layers, layers.size());
+    // Must be there, otherwise CompositingLayerAssigner::canSquashIntoCurrentSquashingOwner would have disallowed squashing.
+    ASSERT(ancestorPaintInfo);
+
+    // FIXME: this is a potential performance issue. We should consider caching these clip rects or otherwise optimizing.
+    ClipRectsContext clipRectsContext(ancestorPaintInfo->paintLayer, UncachedClipRects);
+    IntRect parentClipRect = pixelSnappedIntRect(paintInfo.paintLayer->clipper().backgroundClipRect(clipRectsContext).rect());
+    ASSERT(parentClipRect != LayoutRect::infiniteIntRect());
+
+    // Convert from ancestor to local coordinates.
+    IntSize ancestorToLocalOffset = paintInfo.offsetFromLayoutObject - ancestorPaintInfo->offsetFromLayoutObject;
+    parentClipRect.move(ancestorToLocalOffset);
+    return parentClipRect;
+}
+
+void CompositedLayerMapping::doPaintTask(const GraphicsLayerPaintInfo& paintInfo, const PaintLayerFlags& paintLayerFlags, GraphicsContext* context,
+    const IntRect& clip /* In the coords of rootLayer */) const
+{
+    FontCachePurgePreventer fontCachePurgePreventer;
+
+    IntSize offset = paintInfo.offsetFromLayoutObject;
+    AffineTransform translation;
+    translation.translate(-offset.width(), -offset.height());
+    TransformRecorder transformRecorder(*context, *this, translation);
+
+    // The dirtyRect is in the coords of the painting root.
+    IntRect dirtyRect(clip);
+    dirtyRect.move(offset);
+
+    if (!(paintLayerFlags & PaintLayerPaintingOverflowContents)) {
+        LayoutRect bounds = paintInfo.compositedBounds;
+        bounds.move(paintInfo.paintLayer->subpixelAccumulation());
+        dirtyRect.intersect(pixelSnappedIntRect(bounds));
+    } else {
+        dirtyRect.move(roundedIntSize(paintInfo.paintLayer->subpixelAccumulation()));
+    }
+
+#if ENABLE(ASSERT)
+    paintInfo.paintLayer->layoutObject()->assertSubtreeIsLaidOut();
+#endif
+
+    float deviceScaleFactor = blink::deviceScaleFactor(paintInfo.paintLayer->layoutObject()->frame());
+    context->setDeviceScaleFactor(deviceScaleFactor);
+
+    if (paintInfo.paintLayer->compositingState() != PaintsIntoGroupedBacking) {
+        // FIXME: GraphicsLayers need a way to split for multicol.
+        PaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dirtyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation());
+        PaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context, paintingInfo, paintLayerFlags);
+
+        if (paintInfo.paintLayer->containsDirtyOverlayScrollbars())
+            PaintLayerPainter(*paintInfo.paintLayer).paintLayerContents(context, paintingInfo, paintLayerFlags | PaintLayerPaintingOverlayScrollbars);
+    } else {
+        PaintLayerPaintingInfo paintingInfo(paintInfo.paintLayer, LayoutRect(dirtyRect), GlobalPaintNormalPhase, paintInfo.paintLayer->subpixelAccumulation());
+
+        // PaintLayer::paintLayer assumes that the caller clips to the passed rect. Squashed layers need to do this clipping in software,
+        // since there is no graphics layer to clip them precisely. Furthermore, in some cases we squash layers that need clipping in software
+        // from clipping ancestors (see CompositedLayerMapping::localClipRectForSquashedLayer()).
+        // FIXME: Is it correct to clip to dirtyRect in slimming paint mode?
+        // FIXME: Combine similar code here and LayerClipRecorder.
+        dirtyRect.intersect(paintInfo.localClipRectForSquashedLayer);
+        {
+            ASSERT(context->displayItemList());
+            if (!context->displayItemList()->displayItemConstructionIsDisabled())
+                context->displayItemList()->createAndAppend<ClipDisplayItem>(*this, DisplayItem::ClipLayerOverflowControls, dirtyRect);
+        }
+        PaintLayerPainter(*paintInfo.paintLayer).paintLayer(context, paintingInfo, paintLayerFlags);
+        {
+            ASSERT(context->displayItemList());
+            if (!context->displayItemList()->displayItemConstructionIsDisabled()) {
+                if (context->displayItemList()->lastDisplayItemIsNoopBegin())
+                    context->displayItemList()->removeLastDisplayItem();
+                else
+                    context->displayItemList()->createAndAppend<EndClipDisplayItem>(*this, DisplayItem::clipTypeToEndClipType(DisplayItem::ClipLayerOverflowControls));
+            }
+        }
+    }
+}
+
+static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
+{
+    if (!scrollbar)
+        return;
+
+    const IntRect& scrollbarRect = scrollbar->frameRect();
+    TransformRecorder transformRecorder(context, *scrollbar, AffineTransform::translation(-scrollbarRect.x(), -scrollbarRect.y()));
+    IntRect transformedClip = clip;
+    transformedClip.moveBy(scrollbarRect.location());
+    scrollbar->paint(&context, transformedClip);
+}
+
+// Up-call from compositing layer drawing callback.
+void CompositedLayerMapping::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase graphicsLayerPaintingPhase, const IntRect& clip) const
+{
+    // https://code.google.com/p/chromium/issues/detail?id=343772
+    DisableCompositingQueryAsserts disabler;
+#if ENABLE(ASSERT)
+    // FIXME: once the state machine is ready, this can be removed and we can refer to that instead.
+    if (Page* page = layoutObject()->frame()->page())
+        page->setIsPainting(true);
+#endif
+    TRACE_EVENT1("devtools.timeline", "Paint", "data", InspectorPaintEvent::data(m_owningLayer.layoutObject(), LayoutRect(clip), graphicsLayer));
+
+    PaintLayerFlags paintLayerFlags = 0;
+    if (graphicsLayerPaintingPhase & GraphicsLayerPaintBackground)
+        paintLayerFlags |= PaintLayerPaintingCompositingBackgroundPhase;
+    if (graphicsLayerPaintingPhase & GraphicsLayerPaintForeground)
+        paintLayerFlags |= PaintLayerPaintingCompositingForegroundPhase;
+    if (graphicsLayerPaintingPhase & GraphicsLayerPaintMask)
+        paintLayerFlags |= PaintLayerPaintingCompositingMaskPhase;
+    if (graphicsLayerPaintingPhase & GraphicsLayerPaintChildClippingMask)
+        paintLayerFlags |= PaintLayerPaintingChildClippingMaskPhase;
+    if (graphicsLayerPaintingPhase & GraphicsLayerPaintOverflowContents)
+        paintLayerFlags |= PaintLayerPaintingOverflowContents;
+    if (graphicsLayerPaintingPhase & GraphicsLayerPaintCompositedScroll)
+        paintLayerFlags |= PaintLayerPaintingCompositingScrollingPhase;
+
+    if (graphicsLayer == m_backgroundLayer)
+        paintLayerFlags |= (PaintLayerPaintingRootBackgroundOnly | PaintLayerPaintingCompositingForegroundPhase); // Need PaintLayerPaintingCompositingForegroundPhase to walk child layers.
+    else if (compositor()->fixedRootBackgroundLayer())
+        paintLayerFlags |= PaintLayerPaintingSkipRootBackground;
+
+    if (graphicsLayer == m_graphicsLayer.get()
+        || graphicsLayer == m_foregroundLayer.get()
+        || graphicsLayer == m_backgroundLayer.get()
+        || graphicsLayer == m_maskLayer.get()
+        || graphicsLayer == m_childClippingMaskLayer.get()
+        || graphicsLayer == m_scrollingContentsLayer.get()
+        || graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
+
+        GraphicsLayerPaintInfo paintInfo;
+        paintInfo.paintLayer = &m_owningLayer;
+        paintInfo.compositedBounds = compositedBounds();
+        paintInfo.offsetFromLayoutObject = graphicsLayer->offsetFromLayoutObject();
+
+        // We have to use the same root as for hit testing, because both methods can compute and cache clipRects.
+        doPaintTask(paintInfo, paintLayerFlags, &context, clip);
+    } else if (graphicsLayer == m_squashingLayer.get()) {
+        for (size_t i = 0; i < m_squashedLayers.size(); ++i)
+            doPaintTask(m_squashedLayers[i], paintLayerFlags, &context, clip);
+    } else if (graphicsLayer == layerForHorizontalScrollbar()) {
+        paintScrollbar(m_owningLayer.scrollableArea()->horizontalScrollbar(), context, clip);
+    } else if (graphicsLayer == layerForVerticalScrollbar()) {
+        paintScrollbar(m_owningLayer.scrollableArea()->verticalScrollbar(), context, clip);
+    } else if (graphicsLayer == layerForScrollCorner()) {
+        IntPoint scrollCornerAndResizerLocation = m_owningLayer.scrollableArea()->scrollCornerAndResizerRect().location();
+        ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintScrollCorner(&context, -scrollCornerAndResizerLocation, clip);
+        ScrollableAreaPainter(*m_owningLayer.scrollableArea()).paintResizer(&context, -scrollCornerAndResizerLocation, clip);
+    }
+    InspectorInstrumentation::didPaint(m_owningLayer.layoutObject(), graphicsLayer, &context, LayoutRect(clip));
+#if ENABLE(ASSERT)
+    if (Page* page = layoutObject()->frame()->page())
+        page->setIsPainting(false);
+#endif
+}
+
+bool CompositedLayerMapping::isTrackingPaintInvalidations() const
+{
+    GraphicsLayerClient* client = compositor();
+    return client ? client->isTrackingPaintInvalidations() : false;
+}
+
+#if ENABLE(ASSERT)
+void CompositedLayerMapping::verifyNotPainting()
+{
+    ASSERT(!layoutObject()->frame()->page() || !layoutObject()->frame()->page()->isPainting());
+}
+#endif
+
+void CompositedLayerMapping::notifyAnimationStarted(const GraphicsLayer*, double monotonicTime, int group)
+{
+    layoutObject()->node()->document().compositorPendingAnimations().notifyCompositorAnimationStarted(monotonicTime, group);
+}
+
+IntRect CompositedLayerMapping::pixelSnappedCompositedBounds() const
+{
+    LayoutRect bounds = m_compositedBounds;
+    bounds.move(m_owningLayer.subpixelAccumulation());
+    return pixelSnappedIntRect(bounds);
+}
+
+bool CompositedLayerMapping::invalidateLayerIfNoPrecedingEntry(size_t indexToClear)
+{
+    PaintLayer* layerToRemove = m_squashedLayers[indexToClear].paintLayer;
+    size_t previousIndex = 0;
+    for (; previousIndex < indexToClear; ++previousIndex) {
+        if (m_squashedLayers[previousIndex].paintLayer == layerToRemove)
+            break;
+    }
+    if (previousIndex == indexToClear && layerToRemove->groupedMapping() == this) {
+        compositor()->paintInvalidationOnCompositingChange(layerToRemove);
+        return true;
+    }
+    return false;
+}
+
+bool CompositedLayerMapping::updateSquashingLayerAssignment(PaintLayer* squashedLayer, size_t nextSquashedLayerIndex)
+{
+    GraphicsLayerPaintInfo paintInfo;
+    paintInfo.paintLayer = squashedLayer;
+    // NOTE: composited bounds are updated elsewhere
+    // NOTE: offsetFromLayoutObject is updated elsewhere
+
+    // Change tracking on squashing layers: at the first sign of something changed, just invalidate the layer.
+    // FIXME: Perhaps we can find a tighter more clever mechanism later.
+    if (nextSquashedLayerIndex < m_squashedLayers.size()) {
+        if (paintInfo.paintLayer == m_squashedLayers[nextSquashedLayerIndex].paintLayer)
+            return false;
+
+        // Must invalidate before adding the squashed layer to the mapping.
+        compositor()->paintInvalidationOnCompositingChange(squashedLayer);
+
+        // If the layer which was previously at |nextSquashedLayerIndex| is not earlier in the grouped mapping, invalidate its current
+        // backing now, since it will move later or be removed from the squashing layer.
+        invalidateLayerIfNoPrecedingEntry(nextSquashedLayerIndex);
+
+        m_squashedLayers.insert(nextSquashedLayerIndex, paintInfo);
+    } else {
+        // Must invalidate before adding the squashed layer to the mapping.
+        compositor()->paintInvalidationOnCompositingChange(squashedLayer);
+        m_squashedLayers.append(paintInfo);
+    }
+    squashedLayer->setGroupedMapping(this, PaintLayer::InvalidateLayerAndRemoveFromMapping);
+
+    return true;
+}
+
+void CompositedLayerMapping::removeLayerFromSquashingGraphicsLayer(const PaintLayer* layer)
+{
+    size_t layerIndex = 0;
+    for (; layerIndex < m_squashedLayers.size(); ++layerIndex) {
+        if (m_squashedLayers[layerIndex].paintLayer == layer)
+            break;
+    }
+
+    // Assert on incorrect mappings between layers and groups
+    ASSERT(layerIndex < m_squashedLayers.size());
+    if (layerIndex == m_squashedLayers.size())
+        return;
+
+    m_squashedLayers.remove(layerIndex);
+}
+
+#if ENABLE(ASSERT)
+bool CompositedLayerMapping::verifyLayerInSquashingVector(const PaintLayer* layer)
+{
+    for (size_t layerIndex = 0; layerIndex < m_squashedLayers.size(); ++layerIndex) {
+        if (m_squashedLayers[layerIndex].paintLayer == layer)
+            return true;
+    }
+
+    return false;
+}
+#endif
+
+void CompositedLayerMapping::finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex)
+{
+    if (nextSquashedLayerIndex < m_squashedLayers.size()) {
+        // Any additional squashed Layers in the array no longer belong here, but they might have been
+        // added already at an earlier index. Clear pointers on those that do not appear in the valid set
+        // before removing all the extra entries.
+        for (size_t i = nextSquashedLayerIndex; i < m_squashedLayers.size(); ++i) {
+            if (invalidateLayerIfNoPrecedingEntry(i))
+                m_squashedLayers[i].paintLayer->setGroupedMapping(nullptr, PaintLayer::DoNotInvalidateLayerAndRemoveFromMapping);
+        }
+
+        m_squashedLayers.remove(nextSquashedLayerIndex, m_squashedLayers.size() - nextSquashedLayerIndex);
+    }
+}
+
+String CompositedLayerMapping::debugName(const GraphicsLayer* graphicsLayer)
+{
+    String name;
+    if (graphicsLayer == m_graphicsLayer.get()) {
+        name = m_owningLayer.debugName();
+    } else if (graphicsLayer == m_squashingContainmentLayer.get()) {
+        name = "Squashing Containment Layer";
+    } else if (graphicsLayer == m_squashingLayer.get()) {
+        name = "Squashing Layer";
+    } else if (graphicsLayer == m_ancestorClippingLayer.get()) {
+        name = "Ancestor Clipping Layer";
+    } else if (graphicsLayer == m_foregroundLayer.get()) {
+        name = m_owningLayer.debugName() + " (foreground) Layer";
+    } else if (graphicsLayer == m_backgroundLayer.get()) {
+        name = m_owningLayer.debugName() + " (background) Layer";
+    } else if (graphicsLayer == m_childContainmentLayer.get()) {
+        name = "Child Containment Layer";
+    } else if (graphicsLayer == m_childTransformLayer.get()) {
+        name = "Child Transform Layer";
+    } else if (graphicsLayer == m_maskLayer.get()) {
+        name = "Mask Layer";
+    } else if (graphicsLayer == m_childClippingMaskLayer.get()) {
+        name = "Child Clipping Mask Layer";
+    } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
+        name = "Horizontal Scrollbar Layer";
+    } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
+        name = "Vertical Scrollbar Layer";
+    } else if (graphicsLayer == m_layerForScrollCorner.get()) {
+        name = "Scroll Corner Layer";
+    } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
+        name = "Overflow Controls Host Layer";
+    } else if (graphicsLayer == m_overflowControlsClippingLayer.get()) {
+        name = "Overflow Controls ClipLayer Layer";
+    } else if (graphicsLayer == m_scrollingLayer.get()) {
+        name = "Scrolling Layer";
+    } else if (graphicsLayer == m_scrollingContentsLayer.get()) {
+        name = "Scrolling Contents Layer";
+    } else if (graphicsLayer == m_scrollingBlockSelectionLayer.get()) {
+        name = "Scrolling Block Selection Layer";
+    } else {
+        ASSERT_NOT_REACHED();
+    }
+
+    return name;
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h
new file mode 100644
index 0000000..c9df972
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.h
@@ -0,0 +1,434 @@
+/*
+ * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef CompositedLayerMapping_h
+#define CompositedLayerMapping_h
+
+#include "core/layout/compositing/GraphicsLayerUpdater.h"
+#include "core/paint/PaintLayer.h"
+#include "platform/geometry/FloatPoint.h"
+#include "platform/geometry/FloatPoint3D.h"
+#include "platform/graphics/GraphicsLayer.h"
+#include "platform/graphics/GraphicsLayerClient.h"
+#include "wtf/Allocator.h"
+
+namespace blink {
+
+class PaintLayerCompositor;
+
+// A GraphicsLayerPaintInfo contains all the info needed to paint a partial subtree of Layers into a GraphicsLayer.
+struct GraphicsLayerPaintInfo {
+    ALLOW_ONLY_INLINE_ALLOCATION();
+    PaintLayer* paintLayer;
+
+    LayoutRect compositedBounds;
+
+    // The clip rect to apply, in the local coordinate space of the squashed layer, when painting it.
+    IntRect localClipRectForSquashedLayer;
+
+    // Offset describing where this squashed Layer paints into the shared GraphicsLayer backing.
+    IntSize offsetFromLayoutObject;
+    bool offsetFromLayoutObjectSet;
+
+    GraphicsLayerPaintInfo() : paintLayer(nullptr), offsetFromLayoutObjectSet(false) { }
+};
+
+enum GraphicsLayerUpdateScope {
+    GraphicsLayerUpdateNone,
+    GraphicsLayerUpdateLocal,
+    GraphicsLayerUpdateSubtree,
+};
+
+// CompositedLayerMapping keeps track of how Layers of the layout tree correspond to
+// GraphicsLayers of the composited layer tree. Each instance of CompositedLayerMapping
+// manages a small cluster of GraphicsLayers and the references to which Layers
+// and paint phases contribute to each GraphicsLayer.
+//
+// Currently (Oct. 2013) there is one CompositedLayerMapping for each Layer,
+// but this is likely to evolve soon.
+class CompositedLayerMapping final : public GraphicsLayerClient {
+    WTF_MAKE_NONCOPYABLE(CompositedLayerMapping); WTF_MAKE_FAST_ALLOCATED(CompositedPaintLayerMapping);
+public:
+    explicit CompositedLayerMapping(PaintLayer&);
+    ~CompositedLayerMapping() override;
+
+    PaintLayer& owningLayer() const { return m_owningLayer; }
+
+    bool updateGraphicsLayerConfiguration();
+    void updateGraphicsLayerGeometry(const PaintLayer* compositingContainer, const PaintLayer* compositingStackingContext, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
+
+    // Update whether layer needs blending.
+    void updateContentsOpaque();
+
+    GraphicsLayer* mainGraphicsLayer() const { return m_graphicsLayer.get(); }
+
+    // Layer to clip children
+    bool hasClippingLayer() const { return m_childContainmentLayer; }
+    GraphicsLayer* clippingLayer() const { return m_childContainmentLayer.get(); }
+
+    // Layer to get clipped by ancestor
+    bool hasAncestorClippingLayer() const { return m_ancestorClippingLayer; }
+    GraphicsLayer* ancestorClippingLayer() const { return m_ancestorClippingLayer.get(); }
+
+    GraphicsLayer* foregroundLayer() const { return m_foregroundLayer.get(); }
+
+    GraphicsLayer* backgroundLayer() const { return m_backgroundLayer.get(); }
+    bool backgroundLayerPaintsFixedRootBackground() const { return m_backgroundLayerPaintsFixedRootBackground; }
+
+    bool hasScrollingLayer() const { return m_scrollingLayer; }
+    GraphicsLayer* scrollingLayer() const { return m_scrollingLayer.get(); }
+    GraphicsLayer* scrollingContentsLayer() const { return m_scrollingContentsLayer.get(); }
+    GraphicsLayer* scrollingBlockSelectionLayer() const { return m_scrollingBlockSelectionLayer.get(); }
+
+    bool hasMaskLayer() const { return m_maskLayer; }
+    GraphicsLayer* maskLayer() const { return m_maskLayer.get(); }
+
+    bool hasChildClippingMaskLayer() const { return m_childClippingMaskLayer; }
+    GraphicsLayer* childClippingMaskLayer() const { return m_childClippingMaskLayer.get(); }
+
+    GraphicsLayer* parentForSublayers() const;
+    GraphicsLayer* childForSuperlayers() const;
+
+    bool hasChildTransformLayer() const { return m_childTransformLayer; }
+    GraphicsLayer* childTransformLayer() const { return m_childTransformLayer.get(); }
+
+    GraphicsLayer* squashingContainmentLayer() const { return m_squashingContainmentLayer.get(); }
+    GraphicsLayer* squashingLayer() const { return m_squashingLayer.get(); }
+
+    void setSquashingContentsNeedDisplay();
+    void setContentsNeedDisplay();
+    // LayoutRect is in the coordinate space of the layer's layout object.
+    void setContentsNeedDisplayInRect(const LayoutRect&, PaintInvalidationReason);
+
+    void invalidateDisplayItemClient(const DisplayItemClientWrapper&);
+
+    // Notification from the layoutObject that its content changed.
+    void contentChanged(ContentChangeType);
+
+    LayoutRect compositedBounds() const { return m_compositedBounds; }
+    IntRect pixelSnappedCompositedBounds() const;
+
+    void positionOverflowControlsLayers();
+    bool hasUnpositionedOverflowControlsLayers() const;
+
+    // Returns true if the assignment actually changed the assigned squashing layer.
+    bool updateSquashingLayerAssignment(PaintLayer* squashedLayer, size_t nextSquashedLayerIndex);
+    void removeLayerFromSquashingGraphicsLayer(const PaintLayer*);
+#if ENABLE(ASSERT)
+    bool verifyLayerInSquashingVector(const PaintLayer*);
+#endif
+
+    void finishAccumulatingSquashingLayers(size_t nextSquashedLayerIndex);
+    void updateRenderingContext();
+    void updateShouldFlattenTransform();
+
+    // GraphicsLayerClient interface
+    void notifyAnimationStarted(const GraphicsLayer*, double monotonicTime, int group) override;
+    void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect& clip) const override;
+    bool isTrackingPaintInvalidations() const override;
+
+#if ENABLE(ASSERT)
+    void verifyNotPainting() override;
+#endif
+
+    LayoutRect contentsBox() const;
+
+    GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
+    GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
+    GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
+
+    // Returns true if the overflow controls cannot be positioned within this
+    // CLM's internal hierarchy without incorrectly stacking under some
+    // scrolling content. If this returns true, these controls must be
+    // repositioned in the graphics layer tree to ensure that they stack above
+    // scrolling content.
+    bool needsToReparentOverflowControls() const;
+
+    // Removes the overflow controls host layer from its parent and positions it
+    // so that it can be inserted as a sibling to this CLM without changing
+    // position.
+    GraphicsLayer* detachLayerForOverflowControls(const PaintLayer& enclosingLayer);
+
+    void updateFilters(const ComputedStyle&);
+    void updateBackdropFilters(const ComputedStyle&);
+
+    void setBlendMode(WebBlendMode);
+
+    bool needsGraphicsLayerUpdate() { return m_pendingUpdateScope > GraphicsLayerUpdateNone; }
+    void setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateScope scope) { m_pendingUpdateScope = std::max(static_cast<GraphicsLayerUpdateScope>(m_pendingUpdateScope), scope); }
+    void clearNeedsGraphicsLayerUpdate() { m_pendingUpdateScope = GraphicsLayerUpdateNone; }
+
+    GraphicsLayerUpdater::UpdateType updateTypeForChildren(GraphicsLayerUpdater::UpdateType) const;
+
+#if ENABLE(ASSERT)
+    void assertNeedsToUpdateGraphicsLayerBitsCleared() {  ASSERT(m_pendingUpdateScope == GraphicsLayerUpdateNone); }
+#endif
+
+    String debugName(const GraphicsLayer*) override;
+
+    LayoutSize contentOffsetInCompositingLayer() const;
+
+    LayoutPoint squashingOffsetFromTransformedAncestor()
+    {
+        return m_squashingLayerOffsetFromTransformedAncestor;
+    }
+
+    // If there is a squashed layer painting into this CLM that is an ancestor of the given LayoutObject, return it. Otherwise return nullptr.
+    const GraphicsLayerPaintInfo* containingSquashedLayer(const LayoutObject*, unsigned maxSquashedLayerIndex);
+
+    void updateScrollingBlockSelection();
+
+    DisplayItemClient displayItemClient() const { return toDisplayItemClient(this); }
+    String debugName() const { return "CompositedLayerMapping for " + owningLayer().debugName(); }
+
+private:
+    static const GraphicsLayerPaintInfo* containingSquashedLayer(const LayoutObject*,  const Vector<GraphicsLayerPaintInfo>& layers, unsigned maxSquashedLayerIndex);
+
+    // Helper methods to updateGraphicsLayerGeometry:
+    void computeGraphicsLayerParentLocation(const PaintLayer* compositingContainer, const IntRect& ancestorCompositingBounds, IntPoint& graphicsLayerParentLocation);
+    void updateSquashingLayerGeometry(const LayoutPoint& offsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation, const PaintLayer& referenceLayer, Vector<GraphicsLayerPaintInfo>& layers, GraphicsLayer*, LayoutPoint* offsetFromTransformedAncestor, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
+    void updateMainGraphicsLayerGeometry(const IntRect& relativeCompositingBounds, const IntRect& localCompositingBounds, const IntPoint& graphicsLayerParentLocation);
+    void updateAncestorClippingLayerGeometry(const PaintLayer* compositingContainer, const IntPoint& snappedOffsetFromCompositedAncestor, IntPoint& graphicsLayerParentLocation);
+    void updateOverflowControlsHostLayerGeometry(const PaintLayer* compositingStackingContext, const PaintLayer* compositingContainer);
+    void updateChildContainmentLayerGeometry(const IntRect& clippingBox, const IntRect& localCompositingBounds);
+    void updateChildTransformLayerGeometry();
+    void updateMaskLayerGeometry();
+    void updateTransformGeometry(const IntPoint& snappedOffsetFromCompositedAncestor, const IntRect& relativeCompositingBounds);
+    void updateForegroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize, const IntRect& clippingBox);
+    void updateBackgroundLayerGeometry(const FloatSize& relativeCompositingBoundsSize);
+    void updateReflectionLayerGeometry(Vector<PaintLayer*>& layersNeedingPaintInvalidation);
+    void updateScrollingLayerGeometry(const IntRect& localCompositingBounds);
+    void updateChildClippingMaskLayerGeometry();
+
+    void createPrimaryGraphicsLayer();
+    void destroyGraphicsLayers();
+
+    PassOwnPtr<GraphicsLayer> createGraphicsLayer(CompositingReasons);
+    bool toggleScrollbarLayerIfNeeded(OwnPtr<GraphicsLayer>&, bool needsLayer, CompositingReasons);
+
+    LayoutBoxModelObject* layoutObject() const { return m_owningLayer.layoutObject(); }
+    PaintLayerCompositor* compositor() const { return m_owningLayer.compositor(); }
+
+    void updateInternalHierarchy();
+    void updatePaintingPhases();
+    bool updateClippingLayers(bool needsAncestorClip, bool needsDescendantClip);
+    bool updateChildTransformLayer(bool needsChildTransformLayer);
+    bool updateOverflowControlsLayers(bool needsHorizontalScrollbarLayer, bool needsVerticalScrollbarLayer, bool needsScrollCornerLayer, bool needsAncestorClip);
+    bool updateForegroundLayer(bool needsForegroundLayer);
+    bool updateBackgroundLayer(bool needsBackgroundLayer);
+    bool updateMaskLayer(bool needsMaskLayer);
+    bool updateClippingMaskLayers(bool needsChildClippingMaskLayer);
+    bool requiresHorizontalScrollbarLayer() const { return m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->horizontalScrollbar(); }
+    bool requiresVerticalScrollbarLayer() const { return m_owningLayer.scrollableArea() && m_owningLayer.scrollableArea()->verticalScrollbar(); }
+    bool requiresScrollCornerLayer() const { return m_owningLayer.scrollableArea() && !m_owningLayer.scrollableArea()->scrollCornerAndResizerRect().isEmpty(); }
+    bool updateScrollingLayers(bool scrollingLayers);
+    void updateScrollParent(PaintLayer*);
+    void updateClipParent(PaintLayer* scrollParent);
+    bool updateSquashingLayers(bool needsSquashingLayers);
+    void updateDrawsContent();
+    void updateChildrenTransform();
+    void updateCompositedBounds();
+    void registerScrollingLayers();
+
+    // Also sets subpixelAccumulation on the layer.
+    void computeBoundsOfOwningLayer(const PaintLayer* compositedAncestor, IntRect& localCompositingBounds, IntRect& compositingBoundsRelativeToCompositedAncestor, LayoutPoint& offsetFromCompositedAncestor, IntPoint& snappedOffsetFromCompositedAncestor);
+
+    void setBackgroundLayerPaintsFixedRootBackground(bool);
+
+    GraphicsLayerPaintingPhase paintingPhaseForPrimaryLayer() const;
+
+    // Result is transform origin in pixels.
+    FloatPoint3D computeTransformOrigin(const IntRect& borderBox) const;
+
+    void updateOpacity(const ComputedStyle&);
+    void updateTransform(const ComputedStyle&);
+    void updateLayerBlendMode(const ComputedStyle&);
+    void updateIsRootForIsolatedGroup();
+    // Return the opacity value that this layer should use for compositing.
+    float compositingOpacity(float layoutObjectOpacity) const;
+
+    bool paintsChildren() const;
+
+    // Returns true if this layer has content that needs to be displayed by painting into the backing store.
+    bool containsPaintedContent() const;
+    // Returns true if the Layer just contains an image that we can composite directly.
+    bool isDirectlyCompositedImage() const;
+    void updateImageContents();
+
+    Color layoutObjectBackgroundColor() const;
+    void updateBackgroundColor();
+    void updateContentsRect();
+    void updateContentsOffsetInCompositingLayer(const IntPoint& snappedOffsetFromCompositedAncestor, const IntPoint& graphicsLayerParentLocation);
+    void updateAfterPartResize();
+    void updateCompositingReasons();
+
+    static bool hasVisibleNonCompositingDescendant(PaintLayer* parent);
+
+    void doPaintTask(const GraphicsLayerPaintInfo&, const PaintLayerFlags&, GraphicsContext*, const IntRect& clip) const;
+
+    // Computes the background clip rect for the given squashed layer, up to any containing layer that is squashed into the
+    // same squashing layer and contains this squashed layer's clipping ancestor.
+    // The clip rect is returned in the coordinate space of the given squashed layer.
+    // If there is no such containing layer, returns the infinite rect.
+    // FIXME: unify this code with the code that sets up m_ancestorClippingLayer. They are doing very similar things.
+    static IntRect localClipRectForSquashedLayer(const PaintLayer& referenceLayer, const GraphicsLayerPaintInfo&,  const Vector<GraphicsLayerPaintInfo>& layers);
+
+    // Return true if |m_owningLayer|'s compositing ancestor is not a descendant (inclusive) of the
+    // clipping container for |m_owningLayer|.
+    bool owningLayerClippedByLayerNotAboveCompositedAncestor(PaintLayer* scrollParent);
+
+    PaintLayer* scrollParent();
+
+    // Clear the groupedMapping entry on the layer at the given index, only if that layer does
+    // not appear earlier in the set of layers for this object.
+    bool invalidateLayerIfNoPrecedingEntry(size_t);
+
+    PaintLayer& m_owningLayer;
+
+    // The hierarchy of layers that is maintained by the CompositedLayerMapping looks like this:
+    //
+    //  + m_ancestorClippingLayer [OPTIONAL]
+    //    + m_graphicsLayer
+    //      + m_childTransformLayer [OPTIONAL]
+    //      | + m_childContainmentLayer [OPTIONAL] <-OR-> m_scrollingLayer [OPTIONAL]
+    //      |                                             + m_scrollingContentsLayer [Present iff m_scrollingLayer is present]
+    //      |                                               + m_scrollingBlockSelectionLayer [Present iff m_scrollingLayer is present]
+    //      + m_overflowControlsClippingLayer [OPTIONAL] // *The overflow controls may need to be repositioned in the
+    //        + m_overflowControlsHostLayer [OPTIONAL]   //  graphics layer tree by the RLC to ensure that they stack
+    //          + m_layerForVerticalScrollbar [OPTIONAL] //  above scrolling content.
+    //          + m_layerForHorizontalScrollbar [OPTIONAL]
+    //          + m_layerForScrollCorner [OPTIONAL]
+    //
+    // We need an ancestor clipping layer if our clipping ancestor is not our ancestor in the
+    // clipping tree. Here's what that might look like.
+    //
+    // Let A = the clipping ancestor,
+    //     B = the clip descendant, and
+    //     SC = the stacking context that is the ancestor of A and B in the stacking tree.
+    //
+    // SC
+    //  + A = m_graphicsLayer
+    //  |  + m_childContainmentLayer
+    //  |     + ...
+    //  ...
+    //  |
+    //  + B = m_ancestorClippingLayer [+]
+    //     + m_graphicsLayer
+    //        + ...
+    //
+    // In this case B is clipped by another layer that doesn't happen to be its ancestor: A.
+    // So we create an ancestor clipping layer for B, [+], which ensures that B is clipped
+    // as if it had been A's descendant.
+    OwnPtr<GraphicsLayer> m_ancestorClippingLayer; // Only used if we are clipped by an ancestor which is not a stacking context.
+    OwnPtr<GraphicsLayer> m_graphicsLayer;
+    OwnPtr<GraphicsLayer> m_childContainmentLayer; // Only used if we have clipping on a stacking context with compositing children.
+    OwnPtr<GraphicsLayer> m_childTransformLayer; // Only used if we have perspective.
+    OwnPtr<GraphicsLayer> m_scrollingLayer; // Only used if the layer is using composited scrolling.
+    OwnPtr<GraphicsLayer> m_scrollingContentsLayer; // Only used if the layer is using composited scrolling.
+    OwnPtr<GraphicsLayer> m_scrollingBlockSelectionLayer; // Only used if the layer is using composited scrolling, but has no scrolling contents apart from block selection gaps.
+
+    // This layer is also added to the hierarchy by the RLB, but in a different way than
+    // the layers above. It's added to m_graphicsLayer as its mask layer (naturally) if
+    // we have a mask, and isn't part of the typical hierarchy (it has no children).
+    OwnPtr<GraphicsLayer> m_maskLayer; // Only used if we have a mask.
+    OwnPtr<GraphicsLayer> m_childClippingMaskLayer; // Only used if we have to clip child layers or accelerated contents with border radius or clip-path.
+
+    // There are two other (optional) layers whose painting is managed by the CompositedLayerMapping,
+    // but whose position in the hierarchy is maintained by the PaintLayerCompositor. These
+    // are the foreground and background layers. The foreground layer exists if we have composited
+    // descendants with negative z-order. We need the extra layer in this case because the layer
+    // needs to draw both below (for the background, say) and above (for the normal flow content, say)
+    // the negative z-order descendants and this is impossible with a single layer. The RLC handles
+    // inserting m_foregroundLayer in the correct position in our descendant list for us (right after
+    // the neg z-order dsecendants).
+    //
+    // The background layer is only created if this is the root layer and our background is entirely
+    // fixed. In this case we want to put the background in a separate composited layer so that when
+    // we scroll, we don't have to re-raster the background into position. This layer is also inserted
+    // into the tree by the RLC as it gets a special home. This layer becomes a descendant of the
+    // frame clipping layer. That is:
+    //   ...
+    //     + frame clipping layer
+    //       + m_backgroundLayer
+    //       + frame scrolling layer
+    //         + root content layer
+    //
+    // With the hierarchy set up like this, the root content layer is able to scroll without affecting
+    // the background layer (or paint invalidation).
+    OwnPtr<GraphicsLayer> m_foregroundLayer; // Only used in cases where we need to draw the foreground separately.
+    OwnPtr<GraphicsLayer> m_backgroundLayer; // Only used in cases where we need to draw the background separately.
+
+    OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
+    OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
+    OwnPtr<GraphicsLayer> m_layerForScrollCorner;
+
+    // This layer exists to simplify the reparenting of overflow control that is occasionally required
+    // to ensure that scrollbars appear above scrolling content.
+    OwnPtr<GraphicsLayer> m_overflowControlsHostLayer;
+
+    // The reparented overflow controls sometimes need to be clipped by a non-ancestor. In just the same
+    // way we need an ancestor clipping layer to clip this CLM's internal hierarchy, we add another layer
+    // to clip the overflow controls. It would be possible to make m_overflowControlsHostLayer be
+    // responsible for applying this clip, but that could require repositioning all of the overflow
+    // controls since the this clip may apply an offset. By using a separate layer, the overflow controls
+    // can remain ignorant of the layers above them and still work correctly.
+    OwnPtr<GraphicsLayer> m_overflowControlsClippingLayer;
+
+    // A squashing CLM has two possible squashing-related structures.
+    //
+    // If m_ancestorClippingLayer is present:
+    //
+    // m_ancestorClippingLayer
+    //   + m_graphicsLayer
+    //   + m_squashingLayer
+    //
+    // If not:
+    //
+    // m_squashingContainmentLayer
+    //   + m_graphicsLayer
+    //   + m_squashingLayer
+    //
+    // Stacking children of a squashed layer receive graphics layers that are parented to the compositd ancestor of the
+    // squashed layer (i.e. nearest enclosing composited layer that is not squashed).
+    OwnPtr<GraphicsLayer> m_squashingContainmentLayer; // Only used if any squashed layers exist and m_squashingContainmentLayer is not present, to contain the squashed layers as siblings to the rest of the GraphicsLayer tree chunk.
+    OwnPtr<GraphicsLayer> m_squashingLayer; // Only used if any squashed layers exist, this is the backing that squashed layers paint into.
+    Vector<GraphicsLayerPaintInfo> m_squashedLayers;
+    LayoutPoint m_squashingLayerOffsetFromTransformedAncestor;
+
+    LayoutRect m_compositedBounds;
+
+    LayoutSize m_contentOffsetInCompositingLayer;
+    unsigned m_contentOffsetInCompositingLayerDirty : 1;
+
+    unsigned m_pendingUpdateScope : 2;
+    unsigned m_isMainFrameLayoutViewLayer : 1;
+
+    unsigned m_backgroundLayerPaintsFixedRootBackground : 1;
+    unsigned m_scrollingContentsAreEmpty : 1;
+};
+
+} // namespace blink
+
+#endif // CompositedLayerMapping_h
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
index 4edc69b..851df37 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.cpp
@@ -6,14 +6,14 @@
 #include "core/layout/compositing/CompositingInputsUpdater.h"
 
 #include "core/layout/LayoutBlock.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/TraceEvent.h"
 
 namespace blink {
 
-CompositingInputsUpdater::CompositingInputsUpdater(DeprecatedPaintLayer* rootLayer)
+CompositingInputsUpdater::CompositingInputsUpdater(PaintLayer* rootLayer)
     : m_geometryMap(UseTransforms)
     , m_rootLayer(rootLayer)
 {
@@ -29,7 +29,7 @@
     updateRecursive(m_rootLayer, DoNotForceUpdate, AncestorInfo());
 }
 
-static const DeprecatedPaintLayer* findParentLayerOnClippingContainerChain(const DeprecatedPaintLayer* layer)
+static const PaintLayer* findParentLayerOnClippingContainerChain(const PaintLayer* layer)
 {
     LayoutObject* current = layer->layoutObject();
     while (current) {
@@ -62,7 +62,7 @@
     return nullptr;
 }
 
-static const DeprecatedPaintLayer* findParentLayerOnContainingBlockChain(const LayoutObject* object)
+static const PaintLayer* findParentLayerOnContainingBlockChain(const LayoutObject* object)
 {
     for (const LayoutObject* current = object; current; current = current->containingBlock()) {
         if (current->hasLayer())
@@ -72,13 +72,13 @@
     return nullptr;
 }
 
-static bool hasClippedStackingAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* clippingLayer)
+static bool hasClippedStackingAncestor(const PaintLayer* layer, const PaintLayer* clippingLayer)
 {
     if (layer == clippingLayer)
         return false;
     bool foundInterveningClip = false;
     const LayoutObject* clippingLayoutObject = clippingLayer->layoutObject();
-    for (const DeprecatedPaintLayer* current = layer->compositingContainer(); current; current = current->compositingContainer()) {
+    for (const PaintLayer* current = layer->compositingContainer(); current; current = current->compositingContainer()) {
         if (current == clippingLayer)
             return foundInterveningClip;
 
@@ -93,24 +93,24 @@
     return false;
 }
 
-void CompositingInputsUpdater::updateRecursive(DeprecatedPaintLayer* layer, UpdateType updateType, AncestorInfo info)
+void CompositingInputsUpdater::updateRecursive(PaintLayer* layer, UpdateType updateType, AncestorInfo info)
 {
     if (!layer->childNeedsCompositingInputsUpdate() && updateType != ForceUpdate)
         return;
 
     m_geometryMap.pushMappingsToAncestor(layer, layer->parent());
 
-    if (layer->hasCompositedDeprecatedPaintLayerMapping())
+    if (layer->hasCompositedLayerMapping())
         info.enclosingCompositedLayer = layer;
 
     if (layer->needsCompositingInputsUpdate()) {
         if (info.enclosingCompositedLayer)
-            info.enclosingCompositedLayer->compositedDeprecatedPaintLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
+            info.enclosingCompositedLayer->compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
         updateType = ForceUpdate;
     }
 
     if (updateType == ForceUpdate) {
-        DeprecatedPaintLayer::AncestorDependentCompositingInputs properties;
+        PaintLayer::AncestorDependentCompositingInputs properties;
 
         if (!layer->isRootLayer()) {
             properties.clippedAbsoluteBoundingBox = enclosingIntRect(m_geometryMap.absoluteRect(FloatRect(layer->boundingBoxForCompositingOverlapTest())));
@@ -123,7 +123,7 @@
             IntRect clipRect = pixelSnappedIntRect(layer->clipper().backgroundClipRect(ClipRectsContext(m_rootLayer, AbsoluteClipRects)).rect());
             properties.clippedAbsoluteBoundingBox.intersect(clipRect);
 
-            const DeprecatedPaintLayer* parent = layer->parent();
+            const PaintLayer* parent = layer->parent();
             properties.opacityAncestor = parent->isTransparent() ? parent : parent->opacityAncestor();
             properties.transformAncestor = parent->hasTransformRelatedProperty() ? parent : parent->transformAncestor();
             properties.filterAncestor = parent->hasFilter() ? parent : parent->filterAncestor();
@@ -131,21 +131,21 @@
             properties.nearestFixedPositionLayer = layerIsFixedPosition ? layer : parent->nearestFixedPositionLayer();
 
             if (info.hasAncestorWithClipOrOverflowClip) {
-                const DeprecatedPaintLayer* parentLayerOnClippingContainerChain = findParentLayerOnClippingContainerChain(layer);
+                const PaintLayer* parentLayerOnClippingContainerChain = findParentLayerOnClippingContainerChain(layer);
                 const bool parentHasClipOrOverflowClip = parentLayerOnClippingContainerChain->layoutObject()->hasClipOrOverflowClip();
                 properties.clippingContainer = parentHasClipOrOverflowClip ? parentLayerOnClippingContainerChain->layoutObject() : parentLayerOnClippingContainerChain->clippingContainer();
             }
 
             if (info.lastScrollingAncestor) {
                 const LayoutObject* containingBlock = layer->layoutObject()->containingBlock();
-                const DeprecatedPaintLayer* parentLayerOnContainingBlockChain = findParentLayerOnContainingBlockChain(containingBlock);
+                const PaintLayer* parentLayerOnContainingBlockChain = findParentLayerOnContainingBlockChain(containingBlock);
 
                 properties.ancestorScrollingLayer = parentLayerOnContainingBlockChain->ancestorScrollingLayer();
                 if (parentLayerOnContainingBlockChain->scrollsOverflow())
                     properties.ancestorScrollingLayer = parentLayerOnContainingBlockChain;
 
                 if (layer->layoutObject()->isOutOfFlowPositioned() && !layer->subtreeIsInvisible()) {
-                    const DeprecatedPaintLayer* clippingLayer = properties.clippingContainer ? properties.clippingContainer->enclosingLayer() : layer->compositor()->rootLayer();
+                    const PaintLayer* clippingLayer = properties.clippingContainer ? properties.clippingContainer->enclosingLayer() : layer->compositor()->rootLayer();
                     if (hasClippedStackingAncestor(layer, clippingLayer))
                         properties.clipParent = clippingLayer;
                 }
@@ -173,8 +173,8 @@
     if (layer->layoutObject()->hasClipPath())
         info.hasAncestorWithClipPath = true;
 
-    DeprecatedPaintLayer::DescendantDependentCompositingInputs descendantProperties;
-    for (DeprecatedPaintLayer* child = layer->firstChild(); child; child = child->nextSibling()) {
+    PaintLayer::DescendantDependentCompositingInputs descendantProperties;
+    for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibling()) {
         updateRecursive(child, updateType, info);
 
         descendantProperties.hasDescendantWithClipPath |= child->hasDescendantWithClipPath() || child->layoutObject()->hasClipPath();
@@ -189,12 +189,12 @@
 
 #if ENABLE(ASSERT)
 
-void CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(DeprecatedPaintLayer* layer)
+void CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(PaintLayer* layer)
 {
     ASSERT(!layer->childNeedsCompositingInputsUpdate());
     ASSERT(!layer->needsCompositingInputsUpdate());
 
-    for (DeprecatedPaintLayer* child = layer->firstChild(); child; child = child->nextSibling())
+    for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibling())
         assertNeedsCompositingInputsUpdateBitsCleared(child);
 }
 
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.h b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.h
index f2180e25..0c646a4 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.h
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingInputsUpdater.h
@@ -10,18 +10,18 @@
 
 namespace blink {
 
-class DeprecatedPaintLayer;
+class PaintLayer;
 
 class CompositingInputsUpdater {
     STACK_ALLOCATED();
 public:
-    explicit CompositingInputsUpdater(DeprecatedPaintLayer* rootLayer);
+    explicit CompositingInputsUpdater(PaintLayer* rootLayer);
     ~CompositingInputsUpdater();
 
     void update();
 
 #if ENABLE(ASSERT)
-    static void assertNeedsCompositingInputsUpdateBitsCleared(DeprecatedPaintLayer*);
+    static void assertNeedsCompositingInputsUpdateBitsCleared(PaintLayer*);
 #endif
 
 private:
@@ -40,22 +40,22 @@
         {
         }
 
-        DeprecatedPaintLayer* ancestorStackingContext;
-        DeprecatedPaintLayer* enclosingCompositedLayer;
+        PaintLayer* ancestorStackingContext;
+        PaintLayer* enclosingCompositedLayer;
         // Notice that lastScrollingAncestor isn't the same thing as
         // ancestorScrollingLayer. The former is just the nearest scrolling
-        // along the DeprecatedPaintLayer::parent() chain. The latter is the layer that
+        // along the PaintLayer::parent() chain. The latter is the layer that
         // actually controls the scrolling of this layer, which we find on the
         // containing block chain.
-        DeprecatedPaintLayer* lastScrollingAncestor;
+        PaintLayer* lastScrollingAncestor;
         bool hasAncestorWithClipOrOverflowClip;
         bool hasAncestorWithClipPath;
     };
 
-    void updateRecursive(DeprecatedPaintLayer*, UpdateType, AncestorInfo);
+    void updateRecursive(PaintLayer*, UpdateType, AncestorInfo);
 
     LayoutGeometryMap m_geometryMap;
-    DeprecatedPaintLayer* m_rootLayer;
+    PaintLayer* m_rootLayer;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.cpp
index bab9654..fe254a0 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.cpp
@@ -29,7 +29,7 @@
 
 #include "core/inspector/InspectorTraceEvents.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
 #include "platform/TraceEvent.h"
@@ -40,7 +40,7 @@
 // the ratio |gSquashingSparsityTolerance|:1.
 static uint64_t gSquashingSparsityTolerance = 6;
 
-CompositingLayerAssigner::CompositingLayerAssigner(DeprecatedPaintLayerCompositor* compositor)
+CompositingLayerAssigner::CompositingLayerAssigner(PaintLayerCompositor* compositor)
     : m_compositor(compositor)
     , m_layersChanged(false)
 {
@@ -50,7 +50,7 @@
 {
 }
 
-void CompositingLayerAssigner::assign(DeprecatedPaintLayer* updateRoot, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
+void CompositingLayerAssigner::assign(PaintLayer* updateRoot, Vector<PaintLayer*>& layersNeedingPaintInvalidation)
 {
     TRACE_EVENT0("blink", "CompositingLayerAssigner::assign");
 
@@ -60,7 +60,7 @@
         squashingState.mostRecentMapping->finishAccumulatingSquashingLayers(squashingState.nextSquashedLayerIndex);
 }
 
-void CompositingLayerAssigner::SquashingState::updateSquashingStateForNewMapping(CompositedDeprecatedPaintLayerMapping* newCompositedDeprecatedPaintLayerMapping, bool hasNewCompositedDeprecatedPaintLayerMapping)
+void CompositingLayerAssigner::SquashingState::updateSquashingStateForNewMapping(CompositedLayerMapping* newCompositedLayerMapping, bool hasNewCompositedLayerMapping)
 {
     // The most recent backing is done accumulating any more squashing layers.
     if (hasMostRecentMapping)
@@ -68,12 +68,12 @@
 
     nextSquashedLayerIndex = 0;
     boundingRect = IntRect();
-    mostRecentMapping = newCompositedDeprecatedPaintLayerMapping;
-    hasMostRecentMapping = hasNewCompositedDeprecatedPaintLayerMapping;
+    mostRecentMapping = newCompositedLayerMapping;
+    hasMostRecentMapping = hasNewCompositedLayerMapping;
     haveAssignedBackingsToEntireSquashingLayerSubtree = false;
 }
 
-bool CompositingLayerAssigner::squashingWouldExceedSparsityTolerance(const DeprecatedPaintLayer* candidate, const CompositingLayerAssigner::SquashingState& squashingState)
+bool CompositingLayerAssigner::squashingWouldExceedSparsityTolerance(const PaintLayer* candidate, const CompositingLayerAssigner::SquashingState& squashingState)
 {
     IntRect bounds = candidate->clippedAbsoluteBoundingBox();
     IntRect newBoundingRect = squashingState.boundingRect;
@@ -83,7 +83,7 @@
     return newBoundingRectArea > gSquashingSparsityTolerance * newSquashedArea;
 }
 
-bool CompositingLayerAssigner::needsOwnBacking(const DeprecatedPaintLayer* layer) const
+bool CompositingLayerAssigner::needsOwnBacking(const PaintLayer* layer) const
 {
     if (!m_compositor->canBeComposited(layer))
         return false;
@@ -91,16 +91,16 @@
     return requiresCompositing(layer->compositingReasons()) || (m_compositor->staleInCompositingMode() && layer->isRootLayer());
 }
 
-CompositingStateTransitionType CompositingLayerAssigner::computeCompositedLayerUpdate(DeprecatedPaintLayer* layer)
+CompositingStateTransitionType CompositingLayerAssigner::computeCompositedLayerUpdate(PaintLayer* layer)
 {
     CompositingStateTransitionType update = NoCompositingStateChange;
     if (needsOwnBacking(layer)) {
-        if (!layer->hasCompositedDeprecatedPaintLayerMapping()) {
-            update = AllocateOwnCompositedDeprecatedPaintLayerMapping;
+        if (!layer->hasCompositedLayerMapping()) {
+            update = AllocateOwnCompositedLayerMapping;
         }
     } else {
-        if (layer->hasCompositedDeprecatedPaintLayerMapping())
-            update = RemoveOwnCompositedDeprecatedPaintLayerMapping;
+        if (layer->hasCompositedLayerMapping())
+            update = RemoveOwnCompositedLayerMapping;
 
         if (!layer->subtreeIsInvisible() && m_compositor->canBeComposited(layer) && requiresSquashing(layer->compositingReasons())) {
             // We can't compute at this time whether the squashing layer update is a no-op,
@@ -113,13 +113,13 @@
     return update;
 }
 
-CompositingReasons CompositingLayerAssigner::getReasonsPreventingSquashing(const DeprecatedPaintLayer* layer, const CompositingLayerAssigner::SquashingState& squashingState)
+CompositingReasons CompositingLayerAssigner::getReasonsPreventingSquashing(const PaintLayer* layer, const CompositingLayerAssigner::SquashingState& squashingState)
 {
     if (!squashingState.haveAssignedBackingsToEntireSquashingLayerSubtree)
         return CompositingReasonSquashingWouldBreakPaintOrder;
 
     ASSERT(squashingState.hasMostRecentMapping);
-    const DeprecatedPaintLayer& squashingLayer = squashingState.mostRecentMapping->owningLayer();
+    const PaintLayer& squashingLayer = squashingState.mostRecentMapping->owningLayer();
 
     // FIXME: this special case for video exists only to deal with corner cases
     // where a LayoutVideo does not report that it needs to be directly composited.
@@ -146,7 +146,7 @@
         return CompositingReasonSquashingBlendingIsDisallowed;
 
     // FIXME: this is not efficient, since it walks up the tree. We should store these values on the CompositingInputsCache.
-    if (layer->clippingContainer() != squashingLayer.clippingContainer() && !squashingLayer.compositedDeprecatedPaintLayerMapping()->containingSquashedLayer(layer->clippingContainer(), squashingState.nextSquashedLayerIndex))
+    if (layer->clippingContainer() != squashingLayer.clippingContainer() && !squashingLayer.compositedLayerMapping()->containingSquashedLayer(layer->clippingContainer(), squashingState.nextSquashedLayerIndex))
         return CompositingReasonSquashingClippingContainerMismatch;
 
     // Composited descendants need to be clipped by a child containment graphics layer, which would not be available if the layer is
@@ -160,8 +160,8 @@
     if (layer->scrollParent() && layer->hasCompositingDescendant())
         return CompositingReasonScrollChildWithCompositedDescendants;
 
-    const DeprecatedPaintLayer::AncestorDependentCompositingInputs& compositingInputs = layer->ancestorDependentCompositingInputs();
-    const DeprecatedPaintLayer::AncestorDependentCompositingInputs& squashingLayerCompositingInputs = squashingLayer.ancestorDependentCompositingInputs();
+    const PaintLayer::AncestorDependentCompositingInputs& compositingInputs = layer->ancestorDependentCompositingInputs();
+    const PaintLayer::AncestorDependentCompositingInputs& squashingLayerCompositingInputs = squashingLayer.ancestorDependentCompositingInputs();
 
     if (compositingInputs.opacityAncestor != squashingLayerCompositingInputs.opacityAncestor)
         return CompositingReasonSquashingOpacityAncestorMismatch;
@@ -179,16 +179,16 @@
     return CompositingReasonNone;
 }
 
-void CompositingLayerAssigner::updateSquashingAssignment(DeprecatedPaintLayer* layer, SquashingState& squashingState, const CompositingStateTransitionType compositedLayerUpdate,
-    Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
+void CompositingLayerAssigner::updateSquashingAssignment(PaintLayer* layer, SquashingState& squashingState, const CompositingStateTransitionType compositedLayerUpdate,
+    Vector<PaintLayer*>& layersNeedingPaintInvalidation)
 {
     // NOTE: In the future as we generalize this, the background of this layer may need to be assigned to a different backing than
-    // the squashed DeprecatedPaintLayer's own primary contents. This would happen when we have a composited negative z-index element that needs
+    // the squashed PaintLayer's own primary contents. This would happen when we have a composited negative z-index element that needs
     // to paint on top of the background, but below the layer's main contents. For now, because we always composite layers
     // when they have a composited negative z-index child, such layers will never need squashing so it is not yet an issue.
     if (compositedLayerUpdate == PutInSquashingLayer) {
-        // A layer that is squashed with other layers cannot have its own CompositedDeprecatedPaintLayerMapping.
-        ASSERT(!layer->hasCompositedDeprecatedPaintLayerMapping());
+        // A layer that is squashed with other layers cannot have its own CompositedLayerMapping.
+        ASSERT(!layer->hasCompositedLayerMapping());
         ASSERT(squashingState.hasMostRecentMapping);
 
         bool changedSquashingLayer =
@@ -211,7 +211,7 @@
             // Before removing |layer| from an already-existing squashing layer that may have other content, issue a paint invalidation.
             m_compositor->paintInvalidationOnCompositingChange(layer);
             layer->groupedMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
-            layer->setGroupedMapping(nullptr, DeprecatedPaintLayer::InvalidateLayerAndRemoveFromMapping);
+            layer->setGroupedMapping(nullptr, PaintLayer::InvalidateLayerAndRemoveFromMapping);
         }
 
         // If we need to issue paint invalidations, do so now that we've removed it from a squashed layer.
@@ -223,29 +223,29 @@
     }
 }
 
-void CompositingLayerAssigner::assignLayersToBackingsForReflectionLayer(DeprecatedPaintLayer* reflectionLayer, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
+void CompositingLayerAssigner::assignLayersToBackingsForReflectionLayer(PaintLayer* reflectionLayer, Vector<PaintLayer*>& layersNeedingPaintInvalidation)
 {
     CompositingStateTransitionType compositedLayerUpdate = computeCompositedLayerUpdate(reflectionLayer);
     if (compositedLayerUpdate != NoCompositingStateChange) {
         TRACE_LAYER_INVALIDATION(reflectionLayer, InspectorLayerInvalidationTrackingEvent::ReflectionLayerChanged);
         layersNeedingPaintInvalidation.append(reflectionLayer);
         m_layersChanged = true;
-        m_compositor->allocateOrClearCompositedDeprecatedPaintLayerMapping(reflectionLayer, compositedLayerUpdate);
+        m_compositor->allocateOrClearCompositedLayerMapping(reflectionLayer, compositedLayerUpdate);
     }
     m_compositor->updateDirectCompositingReasons(reflectionLayer);
 
     // FIXME: Why do we updateGraphicsLayerConfiguration here instead of in the GraphicsLayerUpdater?
-    if (reflectionLayer->hasCompositedDeprecatedPaintLayerMapping())
-        reflectionLayer->compositedDeprecatedPaintLayerMapping()->updateGraphicsLayerConfiguration();
+    if (reflectionLayer->hasCompositedLayerMapping())
+        reflectionLayer->compositedLayerMapping()->updateGraphicsLayerConfiguration();
 }
 
-static ScrollingCoordinator* scrollingCoordinatorFromLayer(DeprecatedPaintLayer& layer)
+static ScrollingCoordinator* scrollingCoordinatorFromLayer(PaintLayer& layer)
 {
     Page* page = layer.layoutObject()->frame()->page();
     return (!page) ? nullptr : page->scrollingCoordinator();
 }
 
-void CompositingLayerAssigner::assignLayersToBackingsInternal(DeprecatedPaintLayer* layer, SquashingState& squashingState, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
+void CompositingLayerAssigner::assignLayersToBackingsInternal(PaintLayer* layer, SquashingState& squashingState, Vector<PaintLayer*>& layersNeedingPaintInvalidation)
 {
     if (requiresSquashing(layer->compositingReasons())) {
         CompositingReasons reasonsPreventingSquashing = getReasonsPreventingSquashing(layer, squashingState);
@@ -255,7 +255,7 @@
 
     CompositingStateTransitionType compositedLayerUpdate = computeCompositedLayerUpdate(layer);
 
-    if (m_compositor->allocateOrClearCompositedDeprecatedPaintLayerMapping(layer, compositedLayerUpdate)) {
+    if (m_compositor->allocateOrClearCompositedLayerMapping(layer, compositedLayerUpdate)) {
         TRACE_LAYER_INVALIDATION(layer, InspectorLayerInvalidationTrackingEvent::NewCompositedLayer);
         layersNeedingPaintInvalidation.append(layer);
         m_layersChanged = true;
@@ -281,15 +281,15 @@
     }
 
     if (layer->stackingNode()->isStackingContext()) {
-        DeprecatedPaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NegativeZOrderChildren);
-        while (DeprecatedPaintLayerStackingNode* curNode = iterator.next())
+        PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NegativeZOrderChildren);
+        while (PaintLayerStackingNode* curNode = iterator.next())
             assignLayersToBackingsInternal(curNode->layer(), squashingState, layersNeedingPaintInvalidation);
     }
 
     // At this point, if the layer is to be separately composited, then its backing becomes the most recent in paint-order.
     if (layer->compositingState() == PaintsIntoOwnBacking) {
         ASSERT(!requiresSquashing(layer->compositingReasons()));
-        squashingState.updateSquashingStateForNewMapping(layer->compositedDeprecatedPaintLayerMapping(), layer->hasCompositedDeprecatedPaintLayerMapping());
+        squashingState.updateSquashingStateForNewMapping(layer->compositedLayerMapping(), layer->hasCompositedLayerMapping());
     }
 
     if (layer->scrollParent())
@@ -298,8 +298,8 @@
     if (layer->needsCompositedScrolling())
         layer->scrollableArea()->setTopmostScrollChild(nullptr);
 
-    DeprecatedPaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
-    while (DeprecatedPaintLayerStackingNode* curNode = iterator.next())
+    PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
+    while (PaintLayerStackingNode* curNode = iterator.next())
         assignLayersToBackingsInternal(curNode->layer(), squashingState, layersNeedingPaintInvalidation);
 
     if (squashingState.hasMostRecentMapping && &squashingState.mostRecentMapping->owningLayer() == layer)
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.h b/third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.h
index b4bd647b..58eae24 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.h
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingLayerAssigner.h
@@ -27,29 +27,29 @@
 #ifndef CompositingLayerAssigner_h
 #define CompositingLayerAssigner_h
 
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "platform/geometry/IntRect.h"
 #include "platform/geometry/LayoutPoint.h"
 #include "wtf/Allocator.h"
 
 namespace blink {
 
-class CompositedDeprecatedPaintLayerMapping;
-class DeprecatedPaintLayer;
+class CompositedLayerMapping;
+class PaintLayer;
 
 class CompositingLayerAssigner {
     STACK_ALLOCATED();
 public:
-    explicit CompositingLayerAssigner(DeprecatedPaintLayerCompositor*);
+    explicit CompositingLayerAssigner(PaintLayerCompositor*);
     ~CompositingLayerAssigner();
 
-    void assign(DeprecatedPaintLayer* updateRoot, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
+    void assign(PaintLayer* updateRoot, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
 
     bool layersChanged() const { return m_layersChanged; }
 
     // FIXME: This function should be private. We should remove the one caller
     // once we've fixed the compositing chicken/egg issues.
-    CompositingStateTransitionType computeCompositedLayerUpdate(DeprecatedPaintLayer*);
+    CompositingStateTransitionType computeCompositedLayerUpdate(PaintLayer*);
 
 private:
     struct SquashingState {
@@ -60,15 +60,15 @@
             , nextSquashedLayerIndex(0)
             , totalAreaOfSquashedRects(0) { }
 
-        void updateSquashingStateForNewMapping(CompositedDeprecatedPaintLayerMapping*, bool hasNewCompositedDeprecatedPaintLayerMapping);
+        void updateSquashingStateForNewMapping(CompositedLayerMapping*, bool hasNewCompositedPaintLayerMapping);
 
         // The most recent composited backing that the layer should squash onto if needed.
-        CompositedDeprecatedPaintLayerMapping* mostRecentMapping;
+        CompositedLayerMapping* mostRecentMapping;
         bool hasMostRecentMapping;
 
         // Whether all Layers in the stacking subtree rooted at the most recent mapping's
-        // owning layer have had CompositedDeprecatedPaintLayerMappings assigned. Layers cannot squash into a
-        // CompositedDeprecatedPaintLayerMapping owned by a stacking ancestor, since this changes paint order.
+        // owning layer have had CompositedLayerMappings assigned. Layers cannot squash into a
+        // CompositedLayerMapping owned by a stacking ancestor, since this changes paint order.
         bool haveAssignedBackingsToEntireSquashingLayerSubtree;
 
         // Counter that tracks what index the next Layer would be if it gets squashed to the current squashing layer.
@@ -82,14 +82,14 @@
         uint64_t totalAreaOfSquashedRects;
     };
 
-    void assignLayersToBackingsInternal(DeprecatedPaintLayer*, SquashingState&, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
-    void assignLayersToBackingsForReflectionLayer(DeprecatedPaintLayer* reflectionLayer, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
-    CompositingReasons getReasonsPreventingSquashing(const DeprecatedPaintLayer*, const SquashingState&);
-    bool squashingWouldExceedSparsityTolerance(const DeprecatedPaintLayer* candidate, const SquashingState&);
-    void updateSquashingAssignment(DeprecatedPaintLayer*, SquashingState&, CompositingStateTransitionType, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
-    bool needsOwnBacking(const DeprecatedPaintLayer*) const;
+    void assignLayersToBackingsInternal(PaintLayer*, SquashingState&, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
+    void assignLayersToBackingsForReflectionLayer(PaintLayer* reflectionLayer, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
+    CompositingReasons getReasonsPreventingSquashing(const PaintLayer*, const SquashingState&);
+    bool squashingWouldExceedSparsityTolerance(const PaintLayer* candidate, const SquashingState&);
+    void updateSquashingAssignment(PaintLayer*, SquashingState&, CompositingStateTransitionType, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
+    bool needsOwnBacking(const PaintLayer*) const;
 
-    DeprecatedPaintLayerCompositor* m_compositor;
+    PaintLayerCompositor* m_compositor;
     bool m_layersChanged;
 };
 
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
index b67ab28..0c7dd1d 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.cpp
@@ -11,7 +11,7 @@
 #include "core/frame/Settings.h"
 #include "core/layout/LayoutView.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 
 namespace blink {
 
@@ -45,7 +45,7 @@
     return !m_layoutView.document().ownerElement();
 }
 
-CompositingReasons CompositingReasonFinder::directReasons(const DeprecatedPaintLayer* layer) const
+CompositingReasons CompositingReasonFinder::directReasons(const PaintLayer* layer) const
 {
     if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
         return CompositingReasonNone;
@@ -139,7 +139,7 @@
     return layoutObject->hasTransformRelatedProperty() && layoutObject->style()->has3DTransform();
 }
 
-CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(const DeprecatedPaintLayer* layer) const
+CompositingReasons CompositingReasonFinder::nonStyleDeterminedDirectReasons(const PaintLayer* layer) const
 {
     CompositingReasons directReasons = CompositingReasonNone;
     LayoutObject* layoutObject = layer->layoutObject();
@@ -155,7 +155,7 @@
     // Composite |layer| if it is inside of an ancestor scrolling layer, but that
     // scrolling layer is not not on the stacking context ancestor chain of |layer|.
     // See the definition of the scrollParent property in Layer for more detail.
-    if (const DeprecatedPaintLayer* scrollingAncestor = layer->ancestorScrollingLayer()) {
+    if (const PaintLayer* scrollingAncestor = layer->ancestorScrollingLayer()) {
         if (scrollingAncestor->needsCompositedScrolling() && layer->scrollParent())
             directReasons |= CompositingReasonOverflowScrollingParent;
     }
@@ -177,7 +177,7 @@
     return style.shouldCompositeForCurrentAnimations();
 }
 
-bool CompositingReasonFinder::requiresCompositingForPositionFixed(const DeprecatedPaintLayer* layer) const
+bool CompositingReasonFinder::requiresCompositingForPositionFixed(const PaintLayer* layer) const
 {
     if (!(m_compositingTriggers & ViewportConstrainedPositionedTrigger))
         return false;
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.h b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.h
index 60e3ba1..d898b23d7 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.h
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingReasonFinder.h
@@ -12,7 +12,7 @@
 
 namespace blink {
 
-class DeprecatedPaintLayer;
+class PaintLayer;
 class LayoutObject;
 class ComputedStyle;
 class LayoutView;
@@ -24,7 +24,7 @@
     explicit CompositingReasonFinder(LayoutView&);
 
     CompositingReasons potentialCompositingReasonsFromStyle(LayoutObject*) const;
-    CompositingReasons directReasons(const DeprecatedPaintLayer*) const;
+    CompositingReasons directReasons(const PaintLayer*) const;
 
     void updateTriggers();
 
@@ -35,10 +35,10 @@
 private:
     bool isMainFrame() const;
 
-    CompositingReasons nonStyleDeterminedDirectReasons(const DeprecatedPaintLayer*) const;
+    CompositingReasons nonStyleDeterminedDirectReasons(const PaintLayer*) const;
 
     bool requiresCompositingForTransform(LayoutObject*) const;
-    bool requiresCompositingForPositionFixed(const DeprecatedPaintLayer*) const;
+    bool requiresCompositingForPositionFixed(const PaintLayer*) const;
 
     LayoutView& m_layoutView;
     CompositingTriggerFlags m_compositingTriggers;
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
index 81f8ae19..5c804aa2 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.cpp
@@ -28,10 +28,10 @@
 #include "core/layout/compositing/CompositingRequirementsUpdater.h"
 
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/DeprecatedPaintLayerStackingNode.h"
-#include "core/paint/DeprecatedPaintLayerStackingNodeIterator.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/paint/PaintLayer.h"
+#include "core/paint/PaintLayerStackingNode.h"
+#include "core/paint/PaintLayerStackingNodeIterator.h"
 #include "platform/TraceEvent.h"
 
 namespace blink {
@@ -79,7 +79,7 @@
         beginNewOverlapTestingContext();
     }
 
-    void add(DeprecatedPaintLayer* layer, const IntRect& bounds)
+    void add(PaintLayer* layer, const IntRect& bounds)
     {
         ASSERT(!layer->isRootLayer());
         if (bounds.isEmpty())
@@ -124,7 +124,7 @@
 
 class CompositingRequirementsUpdater::RecursionData {
 public:
-    explicit RecursionData(DeprecatedPaintLayer* compositingAncestor)
+    explicit RecursionData(PaintLayer* compositingAncestor)
         : m_compositingAncestor(compositingAncestor)
         , m_subtreeIsCompositing(false)
         , m_hasUnisolatedCompositedBlendingDescendant(false)
@@ -133,7 +133,7 @@
     {
     }
 
-    DeprecatedPaintLayer* m_compositingAncestor;
+    PaintLayer* m_compositingAncestor;
     bool m_subtreeIsCompositing;
     bool m_hasUnisolatedCompositedBlendingDescendant;
     bool m_testingOverlap;
@@ -150,7 +150,7 @@
     return reasons != CompositingReasonNone;
 }
 
-static CompositingReasons subtreeReasonsForCompositing(DeprecatedPaintLayer* layer, bool hasCompositedDescendants, bool has3DTransformedDescendants)
+static CompositingReasons subtreeReasonsForCompositing(PaintLayer* layer, bool hasCompositedDescendants, bool has3DTransformedDescendants)
 {
     CompositingReasons subtreeReasons = CompositingReasonNone;
 
@@ -188,7 +188,7 @@
 {
 }
 
-void CompositingRequirementsUpdater::update(DeprecatedPaintLayer* root)
+void CompositingRequirementsUpdater::update(PaintLayer* root)
 {
     TRACE_EVENT0("blink", "CompositingRequirementsUpdater::updateRecursive");
 
@@ -202,22 +202,22 @@
     // of them dynamically, we are requiring a full tree walk. This
     // should be removed as soon as proper overlap testing based on
     // scrolling and animation bounds is implemented (crbug.com/252472).
-    Vector<DeprecatedPaintLayer*> unclippedDescendants;
+    Vector<PaintLayer*> unclippedDescendants;
     IntRect absoluteDecendantBoundingBox;
     updateRecursive(0, root, overlapTestRequestMap, recursionData, saw3DTransform, unclippedDescendants, absoluteDecendantBoundingBox);
 }
 
-void CompositingRequirementsUpdater::updateRecursive(DeprecatedPaintLayer* ancestorLayer, DeprecatedPaintLayer* layer, OverlapMap& overlapMap, RecursionData& currentRecursionData, bool& descendantHas3DTransform, Vector<DeprecatedPaintLayer*>& unclippedDescendants, IntRect& absoluteDecendantBoundingBox)
+void CompositingRequirementsUpdater::updateRecursive(PaintLayer* ancestorLayer, PaintLayer* layer, OverlapMap& overlapMap, RecursionData& currentRecursionData, bool& descendantHas3DTransform, Vector<PaintLayer*>& unclippedDescendants, IntRect& absoluteDecendantBoundingBox)
 {
-    DeprecatedPaintLayerCompositor* compositor = m_layoutView.compositor();
+    PaintLayerCompositor* compositor = m_layoutView.compositor();
 
     layer->stackingNode()->updateLayerListsIfNeeded();
 
     CompositingReasons reasonsToComposite = CompositingReasonNone;
     CompositingReasons directReasons = m_compositingReasonFinder.directReasons(layer);
 
-    // Video is special. It's the only DeprecatedPaintLayer type that can both have
-    // DeprecatedPaintLayer children and whose children can't use its backing to render
+    // Video is special. It's the only PaintLayer type that can both have
+    // PaintLayer children and whose children can't use its backing to render
     // into. These children (the controls) always need to be promoted into their
     // own layers to draw on top of the accelerated video.
     if (currentRecursionData.m_compositingAncestor && currentRecursionData.m_compositingAncestor->layoutObject()->isVideo())
@@ -244,7 +244,7 @@
             // both opaque and may only have an integer translation as its
             // transform. Both opacity and screen space transform are inherited
             // properties, so this cannot be determined from local information.
-            layer->scrollableArea()->updateNeedsCompositedScrolling(DeprecatedPaintLayerScrollableArea::IgnoreLCDText);
+            layer->scrollableArea()->updateNeedsCompositedScrolling(PaintLayerScrollableArea::IgnoreLCDText);
             if (layer->needsCompositedScrolling())
                 reasonsToComposite |= CompositingReasonOverflowScrollingTouch;
         }
@@ -261,7 +261,7 @@
     if (currentRecursionData.m_hasCompositedScrollingAncestor) {
         Vector<size_t> unclippedDescendantsToRemove;
         for (size_t i = 0; i < unclippedDescendants.size(); i++) {
-            DeprecatedPaintLayer* unclippedDescendant = unclippedDescendants.at(i);
+            PaintLayer* unclippedDescendant = unclippedDescendants.at(i);
             // If we've reached the containing block of one of the unclipped
             // descendants, that element is no longer relevant to whether or not we
             // should opt in. Unfortunately we can't easily remove from the list
@@ -319,8 +319,8 @@
     bool willHaveForegroundLayer = false;
 
     if (layer->stackingNode()->isStackingContext()) {
-        DeprecatedPaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NegativeZOrderChildren);
-        while (DeprecatedPaintLayerStackingNode* curNode = iterator.next()) {
+        PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NegativeZOrderChildren);
+        while (PaintLayerStackingNode* curNode = iterator.next()) {
             IntRect absoluteChildDecendantBoundingBox;
             updateRecursive(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDecendantBoundingBox);
             absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox);
@@ -361,8 +361,8 @@
         childRecursionData.m_testingOverlap = true;
     }
 
-    DeprecatedPaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
-    while (DeprecatedPaintLayerStackingNode* curNode = iterator.next()) {
+    PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
+    while (PaintLayerStackingNode* curNode = iterator.next()) {
         IntRect absoluteChildDecendantBoundingBox;
         updateRecursive(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDecendantBoundingBox);
         absoluteDecendantBoundingBox.unite(absoluteChildDecendantBoundingBox);
@@ -420,7 +420,7 @@
         // If the original layer is composited, the reflection needs to be, too.
         if (layer->reflectionInfo()) {
             // FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another layoutObject?
-            DeprecatedPaintLayer* reflectionLayer = layer->reflectionInfo()->reflectionLayer();
+            PaintLayer* reflectionLayer = layer->reflectionInfo()->reflectionLayer();
             CompositingReasons reflectionCompositingReason = willBeCompositedOrSquashed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone;
             reflectionLayer->setCompositingReasons(reflectionCompositingReason, CompositingReasonReflectionOfCompositedParent);
         }
diff --git a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.h b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.h
index cc0920f..4e7f6ab 100644
--- a/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.h
+++ b/third_party/WebKit/Source/core/layout/compositing/CompositingRequirementsUpdater.h
@@ -35,7 +35,7 @@
 namespace blink {
 
 class CompositingReasonFinder;
-class DeprecatedPaintLayer;
+class PaintLayer;
 class LayoutView;
 
 class CompositingRequirementsUpdater {
@@ -53,13 +53,13 @@
     //      must be compositing so that its contents render over that child.
     //      This implies that its positive z-index children must also be compositing.
     //
-    void update(DeprecatedPaintLayer* root);
+    void update(PaintLayer* root);
 
 private:
     class OverlapMap;
     class RecursionData;
 
-    void updateRecursive(DeprecatedPaintLayer* ancestorLayer, DeprecatedPaintLayer* currentLayer, OverlapMap&, RecursionData&, bool& descendantHas3DTransform, Vector<DeprecatedPaintLayer*>& unclippedDescendants, IntRect& absoluteDecendantBoundingBox);
+    void updateRecursive(PaintLayer* ancestorLayer, PaintLayer* currentLayer, OverlapMap&, RecursionData&, bool& descendantHas3DTransform, Vector<PaintLayer*>& unclippedDescendants, IntRect& absoluteDecendantBoundingBox);
 
     LayoutView& m_layoutView;
     CompositingReasonFinder& m_compositingReasonFinder;
diff --git a/third_party/WebKit/Source/core/layout/compositing/DeprecatedPaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/DeprecatedPaintLayerCompositor.cpp
deleted file mode 100644
index fdea5c9e..0000000
--- a/third_party/WebKit/Source/core/layout/compositing/DeprecatedPaintLayerCompositor.cpp
+++ /dev/null
@@ -1,1210 +0,0 @@
-/*
- * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-
-#include "core/animation/AnimationTimeline.h"
-#include "core/animation/DocumentAnimations.h"
-#include "core/dom/DOMNodeIds.h"
-#include "core/dom/Fullscreen.h"
-#include "core/editing/FrameSelection.h"
-#include "core/frame/FrameHost.h"
-#include "core/frame/FrameView.h"
-#include "core/frame/LocalFrame.h"
-#include "core/frame/Settings.h"
-#include "core/html/HTMLIFrameElement.h"
-#include "core/html/HTMLVideoElement.h"
-#include "core/inspector/InspectorInstrumentation.h"
-#include "core/layout/LayoutPart.h"
-#include "core/layout/LayoutVideo.h"
-#include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/CompositingInputsUpdater.h"
-#include "core/layout/compositing/CompositingLayerAssigner.h"
-#include "core/layout/compositing/CompositingRequirementsUpdater.h"
-#include "core/layout/compositing/GraphicsLayerTreeBuilder.h"
-#include "core/layout/compositing/GraphicsLayerUpdater.h"
-#include "core/loader/FrameLoaderClient.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/Page.h"
-#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/paint/FramePainter.h"
-#include "core/paint/TransformRecorder.h"
-#include "platform/RuntimeEnabledFeatures.h"
-#include "platform/ScriptForbiddenScope.h"
-#include "platform/TraceEvent.h"
-#include "platform/graphics/GraphicsLayer.h"
-#include "platform/graphics/paint/DisplayItemList.h"
-#include "platform/graphics/paint/DrawingRecorder.h"
-#include "platform/graphics/paint/TransformDisplayItem.h"
-#include "public/platform/Platform.h"
-
-namespace blink {
-
-DeprecatedPaintLayerCompositor::DeprecatedPaintLayerCompositor(LayoutView& layoutView)
-    : m_layoutView(layoutView)
-    , m_compositingReasonFinder(layoutView)
-    , m_pendingUpdateType(CompositingUpdateNone)
-    , m_hasAcceleratedCompositing(true)
-    , m_compositing(false)
-    , m_rootShouldAlwaysCompositeDirty(true)
-    , m_needsUpdateFixedBackground(false)
-    , m_isTrackingPaintInvalidations(layoutView.frameView()->isTrackingPaintInvalidations())
-    , m_inOverlayFullscreenVideo(false)
-    , m_needsUpdateDescendantDependentFlags(false)
-    , m_rootLayerAttachment(RootLayerUnattached)
-{
-    updateAcceleratedCompositingSettings();
-}
-
-DeprecatedPaintLayerCompositor::~DeprecatedPaintLayerCompositor()
-{
-    ASSERT(m_rootLayerAttachment == RootLayerUnattached);
-}
-
-bool DeprecatedPaintLayerCompositor::inCompositingMode() const
-{
-    // FIXME: This should assert that lifecycle is >= CompositingClean since
-    // the last step of updateIfNeeded can set this bit to false.
-    ASSERT(m_layoutView.layer()->isAllowedToQueryCompositingState());
-    return m_compositing;
-}
-
-bool DeprecatedPaintLayerCompositor::staleInCompositingMode() const
-{
-    return m_compositing;
-}
-
-void DeprecatedPaintLayerCompositor::setCompositingModeEnabled(bool enable)
-{
-    if (enable == m_compositing)
-        return;
-
-    m_compositing = enable;
-
-    if (m_compositing)
-        ensureRootLayer();
-    else
-        destroyRootLayer();
-
-    // Schedule an update in the parent frame so the <iframe>'s layer in the owner
-    // document matches the compositing state here.
-    if (HTMLFrameOwnerElement* ownerElement = m_layoutView.document().ownerElement())
-        ownerElement->setNeedsCompositingUpdate();
-}
-
-void DeprecatedPaintLayerCompositor::enableCompositingModeIfNeeded()
-{
-    if (!m_rootShouldAlwaysCompositeDirty)
-        return;
-
-    m_rootShouldAlwaysCompositeDirty = false;
-    if (m_compositing)
-        return;
-
-    if (rootShouldAlwaysComposite()) {
-        // FIXME: Is this needed? It was added in https://bugs.webkit.org/show_bug.cgi?id=26651.
-        // No tests fail if it's deleted.
-        setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
-        setCompositingModeEnabled(true);
-    }
-}
-
-bool DeprecatedPaintLayerCompositor::rootShouldAlwaysComposite() const
-{
-    if (!m_hasAcceleratedCompositing)
-        return false;
-    return m_layoutView.frame()->isLocalRoot() || m_compositingReasonFinder.requiresCompositingForScrollableFrame();
-}
-
-void DeprecatedPaintLayerCompositor::updateAcceleratedCompositingSettings()
-{
-    m_compositingReasonFinder.updateTriggers();
-    m_hasAcceleratedCompositing = m_layoutView.document().settings()->acceleratedCompositingEnabled();
-    m_rootShouldAlwaysCompositeDirty = true;
-    if (m_rootLayerAttachment != RootLayerUnattached)
-        rootLayer()->setNeedsCompositingInputsUpdate();
-}
-
-bool DeprecatedPaintLayerCompositor::preferCompositingToLCDTextEnabled() const
-{
-    return m_compositingReasonFinder.hasOverflowScrollTrigger();
-}
-
-static LayoutVideo* findFullscreenVideoLayoutObject(Document& document)
-{
-    // Recursively find the document that is in fullscreen.
-    Element* fullscreenElement = Fullscreen::fullscreenElementFrom(document);
-    Document* contentDocument = &document;
-    while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) {
-        contentDocument = toHTMLFrameOwnerElement(fullscreenElement)->contentDocument();
-        if (!contentDocument)
-            return nullptr;
-        fullscreenElement = Fullscreen::fullscreenElementFrom(*contentDocument);
-    }
-    // Get the current fullscreen element from the document.
-    fullscreenElement = Fullscreen::currentFullScreenElementFrom(*contentDocument);
-    if (!isHTMLVideoElement(fullscreenElement))
-        return nullptr;
-    LayoutObject* layoutObject = fullscreenElement->layoutObject();
-    if (!layoutObject)
-        return nullptr;
-    return toLayoutVideo(layoutObject);
-}
-
-// The descendant-dependent flags system is badly broken because we clean dirty
-// bits in upward tree walks, which means we need to call updateDescendantDependentFlags
-// at every node in the tree to fully clean all the dirty bits. While we'll in
-// the process of fixing this issue, updateDescendantDependentFlagsForEntireSubtree
-// provides a big hammer for actually cleaning all the dirty bits in a subtree.
-//
-// FIXME: Remove this function once the descendant-dependent flags system keeps
-// its dirty bits scoped to subtrees.
-void updateDescendantDependentFlagsForEntireSubtree(DeprecatedPaintLayer& layer)
-{
-    layer.updateDescendantDependentFlags();
-
-    for (DeprecatedPaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
-        updateDescendantDependentFlagsForEntireSubtree(*child);
-}
-
-void DeprecatedPaintLayerCompositor::updateIfNeededRecursive()
-{
-    for (Frame* child = m_layoutView.frameView()->frame().tree().firstChild(); child; child = child->tree().nextSibling()) {
-        if (!child->isLocalFrame())
-            continue;
-        LocalFrame* localFrame = toLocalFrame(child);
-        // It's possible for trusted Pepper plugins to force hit testing in situations where
-        // the frame tree is in an inconsistent state, such as in the middle of frame detach.
-        // TODO(bbudge) Remove this check when trusted Pepper plugins are gone.
-        if (localFrame->document()->isActive())
-            localFrame->contentLayoutObject()->compositor()->updateIfNeededRecursive();
-    }
-
-    TRACE_EVENT0("blink", "DeprecatedPaintLayerCompositor::updateIfNeededRecursive");
-
-    ASSERT(!m_layoutView.needsLayout());
-
-    ScriptForbiddenScope forbidScript;
-
-    // FIXME: enableCompositingModeIfNeeded can trigger a CompositingUpdateRebuildTree,
-    // which asserts that it's not InCompositingUpdate.
-    enableCompositingModeIfNeeded();
-
-    if (m_needsUpdateDescendantDependentFlags) {
-        updateDescendantDependentFlagsForEntireSubtree(*rootLayer());
-        m_needsUpdateDescendantDependentFlags = false;
-    }
-
-    m_layoutView.commitPendingSelection();
-
-    lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate);
-    updateIfNeeded();
-    lifecycle().advanceTo(DocumentLifecycle::CompositingClean);
-
-    DocumentAnimations::updateCompositorAnimations(m_layoutView.document());
-
-    m_layoutView.frameView()->scrollableArea()->updateCompositorScrollAnimations();
-    if (const FrameView::ScrollableAreaSet* animatingScrollableAreas = m_layoutView.frameView()->animatingScrollableAreas()) {
-        for (ScrollableArea* scrollableArea : *animatingScrollableAreas)
-            scrollableArea->updateCompositorScrollAnimations();
-    }
-
-#if ENABLE(ASSERT)
-    ASSERT(lifecycle().state() == DocumentLifecycle::CompositingClean);
-    assertNoUnresolvedDirtyBits();
-    for (Frame* child = m_layoutView.frameView()->frame().tree().firstChild(); child; child = child->tree().nextSibling()) {
-        if (child->isLocalFrame())
-            toLocalFrame(child)->contentLayoutObject()->compositor()->assertNoUnresolvedDirtyBits();
-    }
-#endif
-}
-
-void DeprecatedPaintLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType updateType)
-{
-    ASSERT(updateType != CompositingUpdateNone);
-    m_pendingUpdateType = std::max(m_pendingUpdateType, updateType);
-    page()->animator().scheduleVisualUpdate(m_layoutView.frame());
-    lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean);
-}
-
-void DeprecatedPaintLayerCompositor::didLayout()
-{
-    // FIXME: Technically we only need to do this when the FrameView's
-    // isScrollable method would return a different value.
-    m_rootShouldAlwaysCompositeDirty = true;
-    enableCompositingModeIfNeeded();
-
-    // FIXME: Rather than marking the entire LayoutView as dirty, we should
-    // track which Layers moved during layout and only dirty those
-    // specific Layers.
-    rootLayer()->setNeedsCompositingInputsUpdate();
-}
-
-#if ENABLE(ASSERT)
-
-void DeprecatedPaintLayerCompositor::assertNoUnresolvedDirtyBits()
-{
-    ASSERT(m_pendingUpdateType == CompositingUpdateNone);
-    ASSERT(!m_rootShouldAlwaysCompositeDirty);
-}
-
-#endif
-
-void DeprecatedPaintLayerCompositor::applyOverlayFullscreenVideoAdjustmentIfNeeded()
-{
-    m_inOverlayFullscreenVideo = false;
-    if (!m_rootContentLayer)
-        return;
-
-    bool isLocalRoot = m_layoutView.frame()->isLocalRoot();
-    LayoutVideo* video = findFullscreenVideoLayoutObject(m_layoutView.document());
-    if (!video || !video->layer()->hasCompositedDeprecatedPaintLayerMapping() || !video->videoElement()->usesOverlayFullscreenVideo()) {
-        if (isLocalRoot) {
-            GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer();
-            if (backgroundLayer && !backgroundLayer->parent())
-                rootFixedBackgroundsChanged();
-        }
-        return;
-    }
-
-    GraphicsLayer* videoLayer = video->layer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer();
-
-    // The fullscreen video has layer position equal to its enclosing frame's scroll position because fullscreen container is fixed-positioned.
-    // We should reset layer position here since we are going to reattach the layer at the very top level.
-    videoLayer->setPosition(IntPoint());
-
-    // Only steal fullscreen video layer and clear all other layers if we are the main frame.
-    if (!isLocalRoot)
-        return;
-
-    m_rootContentLayer->removeAllChildren();
-    m_overflowControlsHostLayer->addChild(videoLayer);
-    if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
-        backgroundLayer->removeFromParent();
-    m_inOverlayFullscreenVideo = true;
-}
-
-void DeprecatedPaintLayerCompositor::updateWithoutAcceleratedCompositing(CompositingUpdateType updateType)
-{
-    ASSERT(!hasAcceleratedCompositing());
-
-    if (updateType >= CompositingUpdateAfterCompositingInputChange)
-        CompositingInputsUpdater(rootLayer()).update();
-
-#if ENABLE(ASSERT)
-    CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(rootLayer());
-#endif
-}
-
-static void forceRecomputePaintInvalidationRectsIncludingNonCompositingDescendants(LayoutObject* layoutObject)
-{
-    // We clear the previous paint invalidation rect as it's wrong (paint invaliation container
-    // changed, ...). Forcing a full invalidation will make us recompute it. Also we are not
-    // changing the previous position from our paint invalidation container, which is fine as
-    // we want a full paint invalidation anyway.
-    layoutObject->setPreviousPaintInvalidationRect(LayoutRect());
-    layoutObject->setShouldDoFullPaintInvalidation();
-
-    for (LayoutObject* child = layoutObject->slowFirstChild(); child; child = child->nextSibling()) {
-        if (!child->isPaintInvalidationContainer())
-            forceRecomputePaintInvalidationRectsIncludingNonCompositingDescendants(child);
-    }
-}
-
-
-void DeprecatedPaintLayerCompositor::updateIfNeeded()
-{
-    CompositingUpdateType updateType = m_pendingUpdateType;
-    m_pendingUpdateType = CompositingUpdateNone;
-
-    if (!hasAcceleratedCompositing()) {
-        updateWithoutAcceleratedCompositing(updateType);
-        return;
-    }
-
-    if (updateType == CompositingUpdateNone)
-        return;
-
-    DeprecatedPaintLayer* updateRoot = rootLayer();
-
-    Vector<DeprecatedPaintLayer*> layersNeedingPaintInvalidation;
-
-    if (updateType >= CompositingUpdateAfterCompositingInputChange) {
-        CompositingInputsUpdater(updateRoot).update();
-
-#if ENABLE(ASSERT)
-        // FIXME: Move this check to the end of the compositing update.
-        CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(updateRoot);
-#endif
-
-        CompositingRequirementsUpdater(m_layoutView, m_compositingReasonFinder).update(updateRoot);
-
-        CompositingLayerAssigner layerAssigner(this);
-        layerAssigner.assign(updateRoot, layersNeedingPaintInvalidation);
-
-        bool layersChanged = layerAssigner.layersChanged();
-
-        {
-            TRACE_EVENT0("blink", "DeprecatedPaintLayerCompositor::updateAfterCompositingChange");
-            if (const FrameView::ScrollableAreaSet* scrollableAreas = m_layoutView.frameView()->scrollableAreas()) {
-                for (ScrollableArea* scrollableArea : *scrollableAreas)
-                    layersChanged |= scrollableArea->updateAfterCompositingChange();
-            }
-        }
-
-        if (layersChanged)
-            updateType = std::max(updateType, CompositingUpdateRebuildTree);
-    }
-
-    if (updateType != CompositingUpdateNone) {
-        GraphicsLayerUpdater updater;
-        updater.update(*updateRoot, layersNeedingPaintInvalidation);
-
-        if (updater.needsRebuildTree())
-            updateType = std::max(updateType, CompositingUpdateRebuildTree);
-
-#if ENABLE(ASSERT)
-        // FIXME: Move this check to the end of the compositing update.
-        GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updateRoot);
-#endif
-    }
-
-    if (updateType >= CompositingUpdateRebuildTree) {
-        GraphicsLayerTreeBuilder::AncestorInfo ancestorInfo;
-        GraphicsLayerVector childList;
-        ancestorInfo.childLayersOfEnclosingCompositedLayer = &childList;
-        {
-            TRACE_EVENT0("blink", "GraphicsLayerTreeBuilder::rebuild");
-            GraphicsLayerTreeBuilder().rebuild(*updateRoot, ancestorInfo);
-        }
-
-        if (childList.isEmpty())
-            destroyRootLayer();
-        else
-            m_rootContentLayer->setChildren(childList);
-
-        applyOverlayFullscreenVideoAdjustmentIfNeeded();
-    }
-
-    if (m_needsUpdateFixedBackground) {
-        rootFixedBackgroundsChanged();
-        m_needsUpdateFixedBackground = false;
-    }
-
-    for (unsigned i = 0; i < layersNeedingPaintInvalidation.size(); i++)
-        forceRecomputePaintInvalidationRectsIncludingNonCompositingDescendants(layersNeedingPaintInvalidation[i]->layoutObject());
-
-    m_layoutView.frameView()->setFrameTimingRequestsDirty(true);
-
-    // Inform the inspector that the layer tree has changed.
-    if (m_layoutView.frame()->isMainFrame())
-        InspectorInstrumentation::layerTreeDidChange(m_layoutView.frame());
-}
-
-bool DeprecatedPaintLayerCompositor::allocateOrClearCompositedDeprecatedPaintLayerMapping(DeprecatedPaintLayer* layer, const CompositingStateTransitionType compositedLayerUpdate)
-{
-    bool compositedDeprecatedPaintLayerMappingChanged = false;
-
-    // FIXME: It would be nice to directly use the layer's compositing reason,
-    // but allocateOrClearCompositedDeprecatedPaintLayerMapping also gets called without having updated compositing
-    // requirements fully.
-    switch (compositedLayerUpdate) {
-    case AllocateOwnCompositedDeprecatedPaintLayerMapping:
-        ASSERT(!layer->hasCompositedDeprecatedPaintLayerMapping());
-        setCompositingModeEnabled(true);
-
-        // If we need to issue paint invalidations, do so before allocating the compositedDeprecatedPaintLayerMapping and clearing out the groupedMapping.
-        paintInvalidationOnCompositingChange(layer);
-
-        // If this layer was previously squashed, we need to remove its reference to a groupedMapping right away, so
-        // that computing paint invalidation rects will know the layer's correct compositingState.
-        // FIXME: do we need to also remove the layer from it's location in the squashing list of its groupedMapping?
-        // Need to create a test where a squashed layer pops into compositing. And also to cover all other
-        // sorts of compositingState transitions.
-        layer->setLostGroupedMapping(false);
-        layer->setGroupedMapping(nullptr, DeprecatedPaintLayer::InvalidateLayerAndRemoveFromMapping);
-
-        layer->ensureCompositedDeprecatedPaintLayerMapping();
-        compositedDeprecatedPaintLayerMappingChanged = true;
-
-        // At this time, the ScrollingCooridnator only supports the top-level frame.
-        if (layer->isRootLayer() && m_layoutView.frame()->isLocalRoot()) {
-            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-                scrollingCoordinator->frameViewRootLayerDidChange(m_layoutView.frameView());
-        }
-        break;
-    case RemoveOwnCompositedDeprecatedPaintLayerMapping:
-    // PutInSquashingLayer means you might have to remove the composited layer mapping first.
-    case PutInSquashingLayer:
-        if (layer->hasCompositedDeprecatedPaintLayerMapping()) {
-            // If we're removing the compositedDeprecatedPaintLayerMapping from a reflection, clear the source GraphicsLayer's pointer to
-            // its replica GraphicsLayer. In practice this should never happen because reflectee and reflection
-            // are both either composited, or not composited.
-            if (layer->isReflection()) {
-                DeprecatedPaintLayer* sourceLayer = toLayoutBoxModelObject(layer->layoutObject()->parent())->layer();
-                if (sourceLayer->hasCompositedDeprecatedPaintLayerMapping()) {
-                    ASSERT(sourceLayer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->replicaLayer() == layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer());
-                    sourceLayer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->setReplicatedByLayer(nullptr);
-                }
-            }
-
-            layer->clearCompositedDeprecatedPaintLayerMapping();
-            compositedDeprecatedPaintLayerMappingChanged = true;
-        }
-
-        break;
-    case RemoveFromSquashingLayer:
-    case NoCompositingStateChange:
-        // Do nothing.
-        break;
-    }
-
-    if (compositedDeprecatedPaintLayerMappingChanged && layer->layoutObject()->isLayoutPart()) {
-        DeprecatedPaintLayerCompositor* innerCompositor = frameContentsCompositor(toLayoutPart(layer->layoutObject()));
-        if (innerCompositor && innerCompositor->staleInCompositingMode())
-            innerCompositor->updateRootLayerAttachment();
-    }
-
-    if (compositedDeprecatedPaintLayerMappingChanged)
-        layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects);
-
-    // If a fixed position layer gained/lost a compositedDeprecatedPaintLayerMapping or the reason not compositing it changed,
-    // the scrolling coordinator needs to recalculate whether it can do fast scrolling.
-    if (compositedDeprecatedPaintLayerMappingChanged) {
-        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-            scrollingCoordinator->frameViewFixedObjectsDidChange(m_layoutView.frameView());
-    }
-
-    return compositedDeprecatedPaintLayerMappingChanged;
-}
-
-void DeprecatedPaintLayerCompositor::paintInvalidationOnCompositingChange(DeprecatedPaintLayer* layer)
-{
-    // If the layoutObject is not attached yet, no need to issue paint invalidations.
-    if (layer->layoutObject() != &m_layoutView && !layer->layoutObject()->parent())
-        return;
-
-    // For querying Layer::compositingState()
-    // Eager invalidation here is correct, since we are invalidating with respect to the previous frame's
-    // compositing state when changing the compositing backing of the layer.
-    DisableCompositingQueryAsserts disabler;
-    // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
-    DisablePaintInvalidationStateAsserts paintInvalidationAssertisabler;
-
-    layer->layoutObject()->invalidatePaintIncludingNonCompositingDescendants();
-}
-
-void DeprecatedPaintLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset)
-{
-    if (m_overflowControlsHostLayer)
-        m_overflowControlsHostLayer->setPosition(contentsOffset);
-}
-
-void DeprecatedPaintLayerCompositor::frameViewDidChangeSize()
-{
-    if (m_containerLayer) {
-        FrameView* frameView = m_layoutView.frameView();
-        m_containerLayer->setSize(frameView->visibleContentSize());
-        m_overflowControlsHostLayer->setSize(frameView->visibleContentSize(IncludeScrollbars));
-
-        frameViewDidScroll();
-        updateOverflowControlsLayers();
-    }
-}
-
-enum AcceleratedFixedRootBackgroundHistogramBuckets {
-    ScrolledMainFrameBucket = 0,
-    ScrolledMainFrameWithAcceleratedFixedRootBackground = 1,
-    ScrolledMainFrameWithUnacceleratedFixedRootBackground = 2,
-    AcceleratedFixedRootBackgroundHistogramMax = 3
-};
-
-void DeprecatedPaintLayerCompositor::frameViewDidScroll()
-{
-    FrameView* frameView = m_layoutView.frameView();
-    IntPoint scrollPosition = frameView->scrollPosition();
-
-    if (!m_scrollLayer)
-        return;
-
-    bool scrollingCoordinatorHandlesOffset = false;
-    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) {
-        scrollingCoordinatorHandlesOffset = scrollingCoordinator->scrollableAreaScrollLayerDidChange(frameView);
-    }
-
-    // Scroll position = scroll minimum + scroll offset. Adjust the layer's
-    // position to handle whatever the scroll coordinator isn't handling.
-    // The minimum scroll position is non-zero for RTL pages with overflow.
-    if (scrollingCoordinatorHandlesOffset)
-        m_scrollLayer->setPosition(-frameView->minimumScrollPosition());
-    else
-        m_scrollLayer->setPosition(-scrollPosition);
-
-
-    Platform::current()->histogramEnumeration("Renderer.AcceleratedFixedRootBackground",
-        ScrolledMainFrameBucket,
-        AcceleratedFixedRootBackgroundHistogramMax);
-}
-
-void DeprecatedPaintLayerCompositor::frameViewScrollbarsExistenceDidChange()
-{
-    if (m_containerLayer)
-        updateOverflowControlsLayers();
-}
-
-void DeprecatedPaintLayerCompositor::rootFixedBackgroundsChanged()
-{
-    if (!supportsFixedRootBackgroundCompositing())
-        return;
-
-    // To avoid having to make the fixed root background layer fixed positioned to
-    // stay put, we position it in the layer tree as follows:
-    //
-    // + Overflow controls host
-    //   + LocalFrame clip
-    //     + (Fixed root background) <-- Here.
-    //     + LocalFrame scroll
-    //       + Root content layer
-    //   + Scrollbars
-    //
-    // That is, it needs to be the first child of the frame clip, the sibling of
-    // the frame scroll layer. The compositor does not own the background layer, it
-    // just positions it (like the foreground layer).
-    if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
-        m_containerLayer->addChildBelow(backgroundLayer, m_scrollLayer.get());
-}
-
-bool DeprecatedPaintLayerCompositor::scrollingLayerDidChange(DeprecatedPaintLayer* layer)
-{
-    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-        return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->scrollableArea());
-    return false;
-}
-
-String DeprecatedPaintLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
-{
-    ASSERT(lifecycle().state() >= DocumentLifecycle::PaintInvalidationClean);
-
-    if (!m_rootContentLayer)
-        return String();
-
-    // We skip dumping the scroll and clip layers to keep layerTreeAsText output
-    // similar between platforms (unless we explicitly request dumping from the
-    // root.
-    GraphicsLayer* rootLayer = m_rootContentLayer.get();
-    if (flags & LayerTreeIncludesRootLayer)
-        rootLayer = rootGraphicsLayer();
-
-    return rootLayer->layerTreeAsText(flags);
-}
-
-DeprecatedPaintLayerCompositor* DeprecatedPaintLayerCompositor::frameContentsCompositor(LayoutPart* layoutObject)
-{
-    if (!layoutObject->node()->isFrameOwnerElement())
-        return nullptr;
-
-    HTMLFrameOwnerElement* element = toHTMLFrameOwnerElement(layoutObject->node());
-    if (Document* contentDocument = element->contentDocument()) {
-        if (LayoutView* view = contentDocument->layoutView())
-            return view->compositor();
-    }
-    return nullptr;
-}
-
-// FIXME: What does this function do? It needs a clearer name.
-bool DeprecatedPaintLayerCompositor::parentFrameContentLayers(LayoutPart* layoutObject)
-{
-    DeprecatedPaintLayerCompositor* innerCompositor = frameContentsCompositor(layoutObject);
-    if (!innerCompositor || !innerCompositor->staleInCompositingMode() || innerCompositor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame)
-        return false;
-
-    DeprecatedPaintLayer* layer = layoutObject->layer();
-    if (!layer->hasCompositedDeprecatedPaintLayerMapping())
-        return false;
-
-    CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = layer->compositedDeprecatedPaintLayerMapping();
-    GraphicsLayer* hostingLayer = compositedDeprecatedPaintLayerMapping->parentForSublayers();
-    GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer();
-    if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != rootLayer) {
-        hostingLayer->removeAllChildren();
-        hostingLayer->addChild(rootLayer);
-    }
-    return true;
-}
-
-static void fullyInvalidatePaintRecursive(DeprecatedPaintLayer* layer)
-{
-    if (layer->compositingState() == PaintsIntoOwnBacking) {
-        layer->compositedDeprecatedPaintLayerMapping()->setContentsNeedDisplay();
-        layer->compositedDeprecatedPaintLayerMapping()->setSquashingContentsNeedDisplay();
-    }
-
-    for (DeprecatedPaintLayer* child = layer->firstChild(); child; child = child->nextSibling())
-        fullyInvalidatePaintRecursive(child);
-}
-
-void DeprecatedPaintLayerCompositor::fullyInvalidatePaint()
-{
-    // We're walking all compositing layers and invalidating them, so there's
-    // no need to have up-to-date compositing state.
-    DisableCompositingQueryAsserts disabler;
-    fullyInvalidatePaintRecursive(rootLayer());
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayerCompositor::rootLayer() const
-{
-    return m_layoutView.layer();
-}
-
-GraphicsLayer* DeprecatedPaintLayerCompositor::rootGraphicsLayer() const
-{
-    if (m_overflowControlsHostLayer)
-        return m_overflowControlsHostLayer.get();
-    return m_rootContentLayer.get();
-}
-
-GraphicsLayer* DeprecatedPaintLayerCompositor::frameScrollLayer() const
-{
-    return m_scrollLayer.get();
-}
-
-GraphicsLayer* DeprecatedPaintLayerCompositor::scrollLayer() const
-{
-    if (ScrollableArea* scrollableArea = m_layoutView.frameView()->scrollableArea())
-        return scrollableArea->layerForScrolling();
-    return nullptr;
-}
-
-GraphicsLayer* DeprecatedPaintLayerCompositor::containerLayer() const
-{
-    return m_containerLayer.get();
-}
-
-GraphicsLayer* DeprecatedPaintLayerCompositor::ensureRootTransformLayer()
-{
-    ASSERT(rootGraphicsLayer());
-
-    if (!m_rootTransformLayer.get()) {
-        m_rootTransformLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
-        m_overflowControlsHostLayer->addChild(m_rootTransformLayer.get());
-        m_rootTransformLayer->addChild(m_containerLayer.get());
-        updateOverflowControlsLayers();
-    }
-
-    return m_rootTransformLayer.get();
-}
-
-void DeprecatedPaintLayerCompositor::setIsInWindow(bool isInWindow)
-{
-    if (!staleInCompositingMode())
-        return;
-
-    if (isInWindow) {
-        if (m_rootLayerAttachment != RootLayerUnattached)
-            return;
-
-        RootLayerAttachment attachment = m_layoutView.frame()->isLocalRoot() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame;
-        attachCompositorTimeline();
-        attachRootLayer(attachment);
-    } else {
-        if (m_rootLayerAttachment == RootLayerUnattached)
-            return;
-
-        detachRootLayer();
-        detachCompositorTimeline();
-    }
-}
-
-void DeprecatedPaintLayerCompositor::updateRootLayerPosition()
-{
-    if (m_rootContentLayer) {
-        const IntRect& documentRect = m_layoutView.documentRect();
-        m_rootContentLayer->setSize(documentRect.size());
-        m_rootContentLayer->setPosition(documentRect.location());
-    }
-    if (m_containerLayer) {
-        FrameView* frameView = m_layoutView.frameView();
-        m_containerLayer->setSize(frameView->visibleContentSize());
-        m_overflowControlsHostLayer->setSize(frameView->visibleContentSize(IncludeScrollbars));
-    }
-}
-
-void DeprecatedPaintLayerCompositor::updatePotentialCompositingReasonsFromStyle(DeprecatedPaintLayer* layer)
-{
-    layer->setPotentialCompositingReasonsFromStyle(m_compositingReasonFinder.potentialCompositingReasonsFromStyle(layer->layoutObject()));
-}
-
-void DeprecatedPaintLayerCompositor::updateDirectCompositingReasons(DeprecatedPaintLayer* layer)
-{
-    layer->setCompositingReasons(m_compositingReasonFinder.directReasons(layer), CompositingReasonComboAllDirectReasons);
-}
-
-bool DeprecatedPaintLayerCompositor::canBeComposited(const DeprecatedPaintLayer* layer) const
-{
-    const bool hasCompositorAnimation = m_compositingReasonFinder.requiresCompositingForAnimation(*layer->layoutObject()->style());
-    return m_hasAcceleratedCompositing && (hasCompositorAnimation || !layer->subtreeIsInvisible()) && layer->isSelfPaintingLayer() && !layer->layoutObject()->isLayoutFlowThread();
-}
-
-// Return true if the given layer is a stacking context and has compositing child
-// layers that it needs to clip. In this case we insert a clipping GraphicsLayer
-// into the hierarchy between this layer and its children in the z-order hierarchy.
-bool DeprecatedPaintLayerCompositor::clipsCompositingDescendants(const DeprecatedPaintLayer* layer) const
-{
-    return layer->hasCompositingDescendant() && layer->layoutObject()->hasClipOrOverflowClip();
-}
-
-// If an element has composited negative z-index children, those children paint in front of the
-// layer background, so we need an extra 'contents' layer for the foreground of the layer
-// object.
-bool DeprecatedPaintLayerCompositor::needsContentsCompositingLayer(const DeprecatedPaintLayer* layer) const
-{
-    if (!layer->hasCompositingDescendant())
-        return false;
-    return layer->stackingNode()->hasNegativeZOrderList();
-}
-
-static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
-{
-    if (!scrollbar)
-        return;
-
-    // Frame scrollbars are painted in the space of the containing frame, not the local space of the scrollbar.
-    const IntPoint& paintOffset = scrollbar->frameRect().location();
-    IntRect transformedClip = clip;
-    transformedClip.moveBy(paintOffset);
-
-    AffineTransform translation;
-    translation.translate(-paintOffset.x(), -paintOffset.y());
-    TransformRecorder transformRecorder(context, *scrollbar, translation);
-
-    scrollbar->paint(&context, transformedClip);
-}
-
-void DeprecatedPaintLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip) const
-{
-    if (graphicsLayer == layerForHorizontalScrollbar())
-        paintScrollbar(m_layoutView.frameView()->horizontalScrollbar(), context, clip);
-    else if (graphicsLayer == layerForVerticalScrollbar())
-        paintScrollbar(m_layoutView.frameView()->verticalScrollbar(), context, clip);
-    else if (graphicsLayer == layerForScrollCorner())
-        FramePainter(*m_layoutView.frameView()).paintScrollCorner(&context, clip);
-}
-
-bool DeprecatedPaintLayerCompositor::supportsFixedRootBackgroundCompositing() const
-{
-    if (Settings* settings = m_layoutView.document().settings())
-        return settings->preferCompositingToLCDTextEnabled();
-    return false;
-}
-
-bool DeprecatedPaintLayerCompositor::needsFixedRootBackgroundLayer(const DeprecatedPaintLayer* layer) const
-{
-    if (layer != m_layoutView.layer())
-        return false;
-
-    return supportsFixedRootBackgroundCompositing() && m_layoutView.rootBackgroundIsEntirelyFixed();
-}
-
-GraphicsLayer* DeprecatedPaintLayerCompositor::fixedRootBackgroundLayer() const
-{
-    // Get the fixed root background from the LayoutView layer's compositedDeprecatedPaintLayerMapping.
-    DeprecatedPaintLayer* viewLayer = m_layoutView.layer();
-    if (!viewLayer)
-        return nullptr;
-
-    if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->compositedDeprecatedPaintLayerMapping()->backgroundLayerPaintsFixedRootBackground())
-        return viewLayer->compositedDeprecatedPaintLayerMapping()->backgroundLayer();
-
-    return nullptr;
-}
-
-static void resetTrackedPaintInvalidationRectsRecursive(GraphicsLayer* graphicsLayer)
-{
-    if (!graphicsLayer)
-        return;
-
-    graphicsLayer->resetTrackedPaintInvalidations();
-
-    for (size_t i = 0; i < graphicsLayer->children().size(); ++i)
-        resetTrackedPaintInvalidationRectsRecursive(graphicsLayer->children()[i]);
-
-    if (GraphicsLayer* replicaLayer = graphicsLayer->replicaLayer())
-        resetTrackedPaintInvalidationRectsRecursive(replicaLayer);
-
-    if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer())
-        resetTrackedPaintInvalidationRectsRecursive(maskLayer);
-
-    if (GraphicsLayer* clippingMaskLayer = graphicsLayer->contentsClippingMaskLayer())
-        resetTrackedPaintInvalidationRectsRecursive(clippingMaskLayer);
-}
-
-void DeprecatedPaintLayerCompositor::resetTrackedPaintInvalidationRects()
-{
-    if (GraphicsLayer* rootLayer = rootGraphicsLayer())
-        resetTrackedPaintInvalidationRectsRecursive(rootLayer);
-}
-
-void DeprecatedPaintLayerCompositor::setTracksPaintInvalidations(bool tracksPaintInvalidations)
-{
-#if ENABLE(ASSERT)
-    if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
-        ASSERT(lifecycle().state() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean
-            // TODO(wangxianzhu): Remove this when we remove the old path for spv2.
-            || lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
-    } else {
-        ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
-    }
-#endif
-
-    m_isTrackingPaintInvalidations = tracksPaintInvalidations;
-}
-
-bool DeprecatedPaintLayerCompositor::isTrackingPaintInvalidations() const
-{
-    return m_isTrackingPaintInvalidations;
-}
-
-bool DeprecatedPaintLayerCompositor::requiresHorizontalScrollbarLayer() const
-{
-    return m_layoutView.frameView()->horizontalScrollbar();
-}
-
-bool DeprecatedPaintLayerCompositor::requiresVerticalScrollbarLayer() const
-{
-    return m_layoutView.frameView()->verticalScrollbar();
-}
-
-bool DeprecatedPaintLayerCompositor::requiresScrollCornerLayer() const
-{
-    return m_layoutView.frameView()->isScrollCornerVisible();
-}
-
-void DeprecatedPaintLayerCompositor::updateOverflowControlsLayers()
-{
-    GraphicsLayer* controlsParent = m_rootTransformLayer.get() ? m_rootTransformLayer.get() : m_overflowControlsHostLayer.get();
-    // Main frame scrollbars should always be stuck to the sides of the screen (in overscroll and in pinch-zoom), so
-    // make the parent for the scrollbars be the viewport container layer.
-    if (m_layoutView.frame()->isMainFrame()) {
-        VisualViewport& visualViewport = m_layoutView.frameView()->page()->frameHost().visualViewport();
-        controlsParent = visualViewport.containerLayer();
-    }
-
-    if (requiresHorizontalScrollbarLayer()) {
-        if (!m_layerForHorizontalScrollbar) {
-            m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerFactory(), this);
-        }
-
-        if (m_layerForHorizontalScrollbar->parent() != controlsParent) {
-            controlsParent->addChild(m_layerForHorizontalScrollbar.get());
-
-            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-                scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), HorizontalScrollbar);
-        }
-    } else if (m_layerForHorizontalScrollbar) {
-        m_layerForHorizontalScrollbar->removeFromParent();
-        m_layerForHorizontalScrollbar = nullptr;
-
-        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), HorizontalScrollbar);
-    }
-
-    if (requiresVerticalScrollbarLayer()) {
-        if (!m_layerForVerticalScrollbar) {
-            m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFactory(), this);
-        }
-
-        if (m_layerForVerticalScrollbar->parent() != controlsParent) {
-            controlsParent->addChild(m_layerForVerticalScrollbar.get());
-
-            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-                scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), VerticalScrollbar);
-        }
-    } else if (m_layerForVerticalScrollbar) {
-        m_layerForVerticalScrollbar->removeFromParent();
-        m_layerForVerticalScrollbar = nullptr;
-
-        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), VerticalScrollbar);
-    }
-
-    if (requiresScrollCornerLayer()) {
-        if (!m_layerForScrollCorner)
-            m_layerForScrollCorner = GraphicsLayer::create(graphicsLayerFactory(), this);
-
-        if (m_layerForScrollCorner->parent() != controlsParent)
-            controlsParent->addChild(m_layerForScrollCorner.get());
-    } else if (m_layerForScrollCorner) {
-        m_layerForScrollCorner->removeFromParent();
-        m_layerForScrollCorner = nullptr;
-    }
-
-    m_layoutView.frameView()->positionScrollbarLayers();
-}
-
-void DeprecatedPaintLayerCompositor::ensureRootLayer()
-{
-    RootLayerAttachment expectedAttachment = m_layoutView.frame()->isLocalRoot() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame;
-    if (expectedAttachment == m_rootLayerAttachment)
-        return;
-
-    Settings* settings = m_layoutView.document().settings();
-    if (!m_rootContentLayer) {
-        m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
-        IntRect overflowRect = m_layoutView.pixelSnappedLayoutOverflowRect();
-        m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.maxY()));
-        m_rootContentLayer->setPosition(FloatPoint());
-        m_rootContentLayer->setOwnerNodeId(DOMNodeIds::idForNode(m_layoutView.generatingNode()));
-
-        // FIXME: with rootLayerScrolls, we probably don't even need m_rootContentLayer?
-        if (!(settings && settings->rootLayerScrolls())) {
-            // Need to clip to prevent transformed content showing outside this frame
-            m_rootContentLayer->setMasksToBounds(true);
-        }
-    }
-
-    if (!m_overflowControlsHostLayer) {
-        ASSERT(!m_scrollLayer);
-        ASSERT(!m_containerLayer);
-
-        // Create a layer to host the clipping layer and the overflow controls layers.
-        m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
-
-        // Clip iframe's overflow controls layer.
-        bool containerMasksToBounds = !m_layoutView.frame()->isLocalRoot();
-        m_overflowControlsHostLayer->setMasksToBounds(containerMasksToBounds);
-
-        // Create a clipping layer if this is an iframe or settings require to clip.
-        m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
-        m_containerLayer->setMasksToBounds(containerMasksToBounds);
-
-        m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
-        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-            scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_scrollLayer.get(), true);
-
-        // Hook them up
-        m_overflowControlsHostLayer->addChild(m_containerLayer.get());
-        m_containerLayer->addChild(m_scrollLayer.get());
-        m_scrollLayer->addChild(m_rootContentLayer.get());
-
-        frameViewDidChangeSize();
-    }
-
-    // Check to see if we have to change the attachment
-    if (m_rootLayerAttachment != RootLayerUnattached) {
-        detachRootLayer();
-        detachCompositorTimeline();
-    }
-
-    attachCompositorTimeline();
-    attachRootLayer(expectedAttachment);
-}
-
-void DeprecatedPaintLayerCompositor::destroyRootLayer()
-{
-    if (!m_rootContentLayer)
-        return;
-
-    detachRootLayer();
-
-    if (m_layerForHorizontalScrollbar) {
-        m_layerForHorizontalScrollbar->removeFromParent();
-        m_layerForHorizontalScrollbar = nullptr;
-        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), HorizontalScrollbar);
-        if (Scrollbar* horizontalScrollbar = m_layoutView.frameView()->horizontalScrollbar())
-            m_layoutView.frameView()->invalidateScrollbar(horizontalScrollbar, IntRect(IntPoint(0, 0), horizontalScrollbar->frameRect().size()));
-    }
-
-    if (m_layerForVerticalScrollbar) {
-        m_layerForVerticalScrollbar->removeFromParent();
-        m_layerForVerticalScrollbar = nullptr;
-        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
-            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), VerticalScrollbar);
-        if (Scrollbar* verticalScrollbar = m_layoutView.frameView()->verticalScrollbar())
-            m_layoutView.frameView()->invalidateScrollbar(verticalScrollbar, IntRect(IntPoint(0, 0), verticalScrollbar->frameRect().size()));
-    }
-
-    if (m_layerForScrollCorner) {
-        m_layerForScrollCorner = nullptr;
-        m_layoutView.frameView()->invalidateScrollCorner(m_layoutView.frameView()->scrollCornerRect());
-    }
-
-    if (m_overflowControlsHostLayer) {
-        m_overflowControlsHostLayer = nullptr;
-        m_containerLayer = nullptr;
-        m_scrollLayer = nullptr;
-    }
-    ASSERT(!m_scrollLayer);
-    m_rootContentLayer = nullptr;
-    m_rootTransformLayer = nullptr;
-}
-
-void DeprecatedPaintLayerCompositor::attachRootLayer(RootLayerAttachment attachment)
-{
-    if (!m_rootContentLayer)
-        return;
-
-    switch (attachment) {
-    case RootLayerUnattached:
-        ASSERT_NOT_REACHED();
-        break;
-    case RootLayerAttachedViaChromeClient: {
-        LocalFrame& frame = m_layoutView.frameView()->frame();
-        Page* page = frame.page();
-        if (!page)
-            return;
-        page->chromeClient().attachRootGraphicsLayer(rootGraphicsLayer(), &frame);
-        break;
-    }
-    case RootLayerAttachedViaEnclosingFrame: {
-        HTMLFrameOwnerElement* ownerElement = m_layoutView.document().ownerElement();
-        ASSERT(ownerElement);
-        // The layer will get hooked up via CompositedDeprecatedPaintLayerMapping::updateGraphicsLayerConfiguration()
-        // for the frame's layoutObject in the parent document.
-        ownerElement->setNeedsCompositingUpdate();
-        break;
-    }
-    }
-
-    m_rootLayerAttachment = attachment;
-}
-
-void DeprecatedPaintLayerCompositor::detachRootLayer()
-{
-    if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached)
-        return;
-
-    switch (m_rootLayerAttachment) {
-    case RootLayerAttachedViaEnclosingFrame: {
-        // The layer will get unhooked up via CompositedDeprecatedPaintLayerMapping::updateGraphicsLayerConfiguration()
-        // for the frame's layoutObject in the parent document.
-        if (m_overflowControlsHostLayer)
-            m_overflowControlsHostLayer->removeFromParent();
-        else
-            m_rootContentLayer->removeFromParent();
-
-        if (HTMLFrameOwnerElement* ownerElement = m_layoutView.document().ownerElement())
-            ownerElement->setNeedsCompositingUpdate();
-        break;
-    }
-    case RootLayerAttachedViaChromeClient: {
-        LocalFrame& frame = m_layoutView.frameView()->frame();
-        Page* page = frame.page();
-        if (!page)
-            return;
-        page->chromeClient().attachRootGraphicsLayer(0, &frame);
-        break;
-    }
-    case RootLayerUnattached:
-        break;
-    }
-
-    m_rootLayerAttachment = RootLayerUnattached;
-}
-
-void DeprecatedPaintLayerCompositor::updateRootLayerAttachment()
-{
-    ensureRootLayer();
-}
-
-void DeprecatedPaintLayerCompositor::attachCompositorTimeline()
-{
-    LocalFrame& frame = m_layoutView.frameView()->frame();
-    Page* page = frame.page();
-    if (!page)
-        return;
-
-    WebCompositorAnimationTimeline* compositorTimeline = frame.document() ? frame.document()->timeline().compositorTimeline() : nullptr;
-    if (compositorTimeline)
-        page->chromeClient().attachCompositorAnimationTimeline(compositorTimeline, &frame);
-}
-
-void DeprecatedPaintLayerCompositor::detachCompositorTimeline()
-{
-    LocalFrame& frame = m_layoutView.frameView()->frame();
-    Page* page = frame.page();
-    if (!page)
-        return;
-
-    WebCompositorAnimationTimeline* compositorTimeline = frame.document() ? frame.document()->timeline().compositorTimeline() : nullptr;
-    if (compositorTimeline)
-        page->chromeClient().detachCompositorAnimationTimeline(compositorTimeline, &frame);
-}
-
-ScrollingCoordinator* DeprecatedPaintLayerCompositor::scrollingCoordinator() const
-{
-    if (Page* page = this->page())
-        return page->scrollingCoordinator();
-
-    return nullptr;
-}
-
-GraphicsLayerFactory* DeprecatedPaintLayerCompositor::graphicsLayerFactory() const
-{
-    if (Page* page = this->page())
-        return page->chromeClient().graphicsLayerFactory();
-    return nullptr;
-}
-
-Page* DeprecatedPaintLayerCompositor::page() const
-{
-    return m_layoutView.frameView()->frame().page();
-}
-
-DocumentLifecycle& DeprecatedPaintLayerCompositor::lifecycle() const
-{
-    return m_layoutView.document().lifecycle();
-}
-
-String DeprecatedPaintLayerCompositor::debugName(const GraphicsLayer* graphicsLayer)
-{
-    String name;
-    if (graphicsLayer == m_rootContentLayer.get()) {
-        name = "Content Root Layer";
-    } else if (graphicsLayer == m_rootTransformLayer.get()) {
-        name = "Root Transform Layer";
-    } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
-        name = "Frame Overflow Controls Host Layer";
-    } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
-        name = "Frame Horizontal Scrollbar Layer";
-    } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
-        name = "Frame Vertical Scrollbar Layer";
-    } else if (graphicsLayer == m_layerForScrollCorner.get()) {
-        name = "Frame Scroll Corner Layer";
-    } else if (graphicsLayer == m_containerLayer.get()) {
-        name = "Frame Clipping Layer";
-    } else if (graphicsLayer == m_scrollLayer.get()) {
-        name = "Frame Scrolling Layer";
-    } else {
-        ASSERT_NOT_REACHED();
-    }
-
-    return name;
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/compositing/DeprecatedPaintLayerCompositor.h b/third_party/WebKit/Source/core/layout/compositing/DeprecatedPaintLayerCompositor.h
deleted file mode 100644
index 08c0603..0000000
--- a/third_party/WebKit/Source/core/layout/compositing/DeprecatedPaintLayerCompositor.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DeprecatedPaintLayerCompositor_h
-#define DeprecatedPaintLayerCompositor_h
-
-#include "core/CoreExport.h"
-#include "core/layout/compositing/CompositingReasonFinder.h"
-#include "platform/graphics/GraphicsLayerClient.h"
-#include "wtf/HashMap.h"
-
-namespace blink {
-
-class DeprecatedPaintLayer;
-class DocumentLifecycle;
-class GraphicsLayer;
-class GraphicsLayerFactory;
-class IntPoint;
-class Page;
-class LayoutPart;
-class ScrollingCoordinator;
-
-enum CompositingUpdateType {
-    CompositingUpdateNone,
-    CompositingUpdateAfterGeometryChange,
-    CompositingUpdateAfterCompositingInputChange,
-    CompositingUpdateRebuildTree,
-};
-
-enum CompositingStateTransitionType {
-    NoCompositingStateChange,
-    AllocateOwnCompositedDeprecatedPaintLayerMapping,
-    RemoveOwnCompositedDeprecatedPaintLayerMapping,
-    PutInSquashingLayer,
-    RemoveFromSquashingLayer
-};
-
-// DeprecatedPaintLayerCompositor manages the hierarchy of
-// composited Layers. It determines which Layers
-// become compositing, and creates and maintains a hierarchy of
-// GraphicsLayers based on the Layer painting order.
-//
-// There is one DeprecatedPaintLayerCompositor per LayoutView.
-
-class CORE_EXPORT DeprecatedPaintLayerCompositor final : public GraphicsLayerClient {
-    WTF_MAKE_FAST_ALLOCATED(DeprecatedPaintLayerCompositor);
-public:
-    explicit DeprecatedPaintLayerCompositor(LayoutView&);
-    ~DeprecatedPaintLayerCompositor() override;
-
-    void updateIfNeededRecursive();
-
-    // Return true if this LayoutView is in "compositing mode" (i.e. has one or more
-    // composited Layers)
-    bool inCompositingMode() const;
-    // FIXME: Replace all callers with inCompositingMode and remove this function.
-    bool staleInCompositingMode() const;
-    // This will make a compositing layer at the root automatically, and hook up to
-    // the native view/window system.
-    void setCompositingModeEnabled(bool);
-
-    // Returns true if the accelerated compositing is enabled
-    bool hasAcceleratedCompositing() const { return m_hasAcceleratedCompositing; }
-
-    bool preferCompositingToLCDTextEnabled() const;
-
-    bool rootShouldAlwaysComposite() const;
-
-    // Copy the accelerated compositing related flags from Settings
-    void updateAcceleratedCompositingSettings();
-
-    // Used to indicate that a compositing update will be needed for the next frame that gets drawn.
-    void setNeedsCompositingUpdate(CompositingUpdateType);
-
-    void didLayout();
-
-    // Whether layer's compositedDeprecatedPaintLayerMapping needs a GraphicsLayer to clip z-order children of the given Layer.
-    bool clipsCompositingDescendants(const DeprecatedPaintLayer*) const;
-
-    // Whether the given layer needs an extra 'contents' layer.
-    bool needsContentsCompositingLayer(const DeprecatedPaintLayer*) const;
-
-    bool supportsFixedRootBackgroundCompositing() const;
-    bool needsFixedRootBackgroundLayer(const DeprecatedPaintLayer*) const;
-    GraphicsLayer* fixedRootBackgroundLayer() const;
-    void setNeedsUpdateFixedBackground() { m_needsUpdateFixedBackground = true; }
-
-    // Issue paint invalidations of the appropriate layers when the given Layer starts or stops being composited.
-    void paintInvalidationOnCompositingChange(DeprecatedPaintLayer*);
-
-    void fullyInvalidatePaint();
-
-    DeprecatedPaintLayer* rootLayer() const;
-    GraphicsLayer* rootGraphicsLayer() const;
-    GraphicsLayer* frameScrollLayer() const;
-    GraphicsLayer* scrollLayer() const;
-    GraphicsLayer* containerLayer() const;
-
-    // We don't always have a root transform layer. This function lazily allocates one
-    // and returns it as required.
-    GraphicsLayer* ensureRootTransformLayer();
-
-    enum RootLayerAttachment {
-        RootLayerUnattached,
-        RootLayerAttachedViaChromeClient,
-        RootLayerAttachedViaEnclosingFrame
-    };
-
-    RootLayerAttachment rootLayerAttachment() const { return m_rootLayerAttachment; }
-    void updateRootLayerAttachment();
-    void updateRootLayerPosition();
-
-    void setIsInWindow(bool);
-
-    static DeprecatedPaintLayerCompositor* frameContentsCompositor(LayoutPart*);
-    // Return true if the layers changed.
-    static bool parentFrameContentLayers(LayoutPart*);
-
-    // Update the geometry of the layers used for clipping and scrolling in frames.
-    void frameViewDidChangeLocation(const IntPoint& contentsOffset);
-    void frameViewDidChangeSize();
-    void frameViewDidScroll();
-    void frameViewScrollbarsExistenceDidChange();
-    void rootFixedBackgroundsChanged();
-
-    bool scrollingLayerDidChange(DeprecatedPaintLayer*);
-
-    String layerTreeAsText(LayerTreeFlags);
-
-    GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
-    GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
-    GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
-
-    void resetTrackedPaintInvalidationRects();
-    void setTracksPaintInvalidations(bool);
-
-    String debugName(const GraphicsLayer*) override;
-    DocumentLifecycle& lifecycle() const;
-
-    bool needsUpdateDescendantDependentFlags() const { return m_needsUpdateDescendantDependentFlags; }
-    void setNeedsUpdateDescendantDependentFlags() { m_needsUpdateDescendantDependentFlags = true; }
-
-    void updatePotentialCompositingReasonsFromStyle(DeprecatedPaintLayer*);
-
-    // Whether the layer could ever be composited.
-    bool canBeComposited(const DeprecatedPaintLayer*) const;
-
-    // FIXME: Move allocateOrClearCompositedDeprecatedPaintLayerMapping to CompositingLayerAssigner once we've fixed
-    // the compositing chicken/egg issues.
-    bool allocateOrClearCompositedDeprecatedPaintLayerMapping(DeprecatedPaintLayer*, CompositingStateTransitionType compositedLayerUpdate);
-
-    void updateDirectCompositingReasons(DeprecatedPaintLayer*);
-
-    bool inOverlayFullscreenVideo() const { return m_inOverlayFullscreenVideo; }
-
-private:
-#if ENABLE(ASSERT)
-    void assertNoUnresolvedDirtyBits();
-#endif
-
-    // GraphicsLayerClient implementation
-    void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) const override;
-
-    bool isTrackingPaintInvalidations() const override;
-
-    void updateWithoutAcceleratedCompositing(CompositingUpdateType);
-    void updateIfNeeded();
-
-    void ensureRootLayer();
-    void destroyRootLayer();
-
-    void attachRootLayer(RootLayerAttachment);
-    void detachRootLayer();
-
-    void attachCompositorTimeline();
-    void detachCompositorTimeline();
-
-    void updateOverflowControlsLayers();
-
-    Page* page() const;
-
-    GraphicsLayerFactory* graphicsLayerFactory() const;
-    ScrollingCoordinator* scrollingCoordinator() const;
-
-    void enableCompositingModeIfNeeded();
-
-    bool requiresHorizontalScrollbarLayer() const;
-    bool requiresVerticalScrollbarLayer() const;
-    bool requiresScrollCornerLayer() const;
-
-    void applyOverlayFullscreenVideoAdjustmentIfNeeded();
-
-    LayoutView& m_layoutView;
-    OwnPtr<GraphicsLayer> m_rootContentLayer;
-    OwnPtr<GraphicsLayer> m_rootTransformLayer;
-
-    CompositingReasonFinder m_compositingReasonFinder;
-
-    CompositingUpdateType m_pendingUpdateType;
-
-    bool m_hasAcceleratedCompositing;
-    bool m_compositing;
-
-    // The root layer doesn't composite if it's a non-scrollable frame.
-    // So, after a layout we set this dirty bit to know that we need
-    // to recompute whether the root layer should composite even if
-    // none of its descendants composite.
-    // FIXME: Get rid of all the callers of setCompositingModeEnabled
-    // except the one in updateIfNeeded, then rename this to
-    // m_compositingDirty.
-    bool m_rootShouldAlwaysCompositeDirty;
-    bool m_needsUpdateFixedBackground;
-    bool m_isTrackingPaintInvalidations; // Used for testing.
-    bool m_inOverlayFullscreenVideo;
-    bool m_needsUpdateDescendantDependentFlags;
-
-    RootLayerAttachment m_rootLayerAttachment;
-
-    // Enclosing container layer, which clips for iframe content
-    OwnPtr<GraphicsLayer> m_containerLayer;
-    OwnPtr<GraphicsLayer> m_scrollLayer;
-
-    // Enclosing layer for overflow controls and the clipping layer
-    OwnPtr<GraphicsLayer> m_overflowControlsHostLayer;
-
-    // Layers for overflow controls
-    OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
-    OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
-    OwnPtr<GraphicsLayer> m_layerForScrollCorner;
-};
-
-} // namespace blink
-
-#endif // DeprecatedPaintLayerCompositor_h
diff --git a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp
index be109f1..4f2c16d8 100644
--- a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.cpp
@@ -31,9 +31,9 @@
 #include "core/html/HTMLVideoElement.h"
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/paint/PaintLayer.h"
 
 namespace blink {
 
@@ -45,7 +45,7 @@
 {
 }
 
-static bool shouldAppendLayer(const DeprecatedPaintLayer& layer)
+static bool shouldAppendLayer(const PaintLayer& layer)
 {
     Node* node = layer.layoutObject()->node();
     if (node && isHTMLVideoElement(*node)) {
@@ -56,7 +56,7 @@
     return true;
 }
 
-void GraphicsLayerTreeBuilder::rebuild(DeprecatedPaintLayer& layer, AncestorInfo info)
+void GraphicsLayerTreeBuilder::rebuild(PaintLayer& layer, AncestorInfo info)
 {
     // Make the layer compositing if necessary, and set up clipping and content layers.
     // Note that we can only do work here that is independent of whether the descendant layers
@@ -64,14 +64,14 @@
 
     layer.stackingNode()->updateLayerListsIfNeeded();
 
-    const bool hasCompositedDeprecatedPaintLayerMapping = layer.hasCompositedDeprecatedPaintLayerMapping();
-    CompositedDeprecatedPaintLayerMapping* currentCompositedDeprecatedPaintLayerMapping = layer.compositedDeprecatedPaintLayerMapping();
+    const bool hasCompositedLayerMapping = layer.hasCompositedLayerMapping();
+    CompositedLayerMapping* currentCompositedLayerMapping = layer.compositedLayerMapping();
 
-    // If this layer has a compositedDeprecatedPaintLayerMapping, then that is where we place subsequent children GraphicsLayers.
+    // If this layer has a compositedLayerMapping, then that is where we place subsequent children GraphicsLayers.
     // Otherwise children continue to append to the child list of the enclosing layer.
     GraphicsLayerVector layerChildren;
     AncestorInfo infoForChildren(info);
-    if (hasCompositedDeprecatedPaintLayerMapping) {
+    if (hasCompositedLayerMapping) {
         infoForChildren.childLayersOfEnclosingCompositedLayer = &layerChildren;
         infoForChildren.enclosingCompositedLayer = &layer;
     }
@@ -81,56 +81,56 @@
 #endif
 
     if (layer.stackingNode()->isStackingContext()) {
-        DeprecatedPaintLayerStackingNodeIterator iterator(*layer.stackingNode(), NegativeZOrderChildren);
-        while (DeprecatedPaintLayerStackingNode* curNode = iterator.next())
+        PaintLayerStackingNodeIterator iterator(*layer.stackingNode(), NegativeZOrderChildren);
+        while (PaintLayerStackingNode* curNode = iterator.next())
             rebuild(*curNode->layer(), infoForChildren);
 
         // If a negative z-order child is compositing, we get a foreground layer which needs to get parented.
-        if (hasCompositedDeprecatedPaintLayerMapping && currentCompositedDeprecatedPaintLayerMapping->foregroundLayer())
-            infoForChildren.childLayersOfEnclosingCompositedLayer->append(currentCompositedDeprecatedPaintLayerMapping->foregroundLayer());
+        if (hasCompositedLayerMapping && currentCompositedLayerMapping->foregroundLayer())
+            infoForChildren.childLayersOfEnclosingCompositedLayer->append(currentCompositedLayerMapping->foregroundLayer());
     }
 
-    DeprecatedPaintLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
-    while (DeprecatedPaintLayerStackingNode* curNode = iterator.next())
+    PaintLayerStackingNodeIterator iterator(*layer.stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
+    while (PaintLayerStackingNode* curNode = iterator.next())
         rebuild(*curNode->layer(), infoForChildren);
 
-    if (hasCompositedDeprecatedPaintLayerMapping) {
+    if (hasCompositedLayerMapping) {
         bool parented = false;
         if (layer.layoutObject()->isLayoutPart())
-            parented = DeprecatedPaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layer.layoutObject()));
+            parented = PaintLayerCompositor::parentFrameContentLayers(toLayoutPart(layer.layoutObject()));
 
         if (!parented)
-            currentCompositedDeprecatedPaintLayerMapping->parentForSublayers()->setChildren(layerChildren);
+            currentCompositedLayerMapping->parentForSublayers()->setChildren(layerChildren);
 
         // If the layer has a clipping layer the overflow controls layers will be siblings of the clipping layer.
         // Otherwise, the overflow control layers are normal children.
         // FIXME: Why isn't this handled in CLM updateInternalHierarchy?
-        if (!currentCompositedDeprecatedPaintLayerMapping->hasClippingLayer() && !currentCompositedDeprecatedPaintLayerMapping->hasScrollingLayer()) {
-            if (GraphicsLayer* overflowControlLayer = currentCompositedDeprecatedPaintLayerMapping->layerForHorizontalScrollbar()) {
+        if (!currentCompositedLayerMapping->hasClippingLayer() && !currentCompositedLayerMapping->hasScrollingLayer()) {
+            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForHorizontalScrollbar()) {
                 overflowControlLayer->removeFromParent();
-                currentCompositedDeprecatedPaintLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
+                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
             }
 
-            if (GraphicsLayer* overflowControlLayer = currentCompositedDeprecatedPaintLayerMapping->layerForVerticalScrollbar()) {
+            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForVerticalScrollbar()) {
                 overflowControlLayer->removeFromParent();
-                currentCompositedDeprecatedPaintLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
+                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
             }
 
-            if (GraphicsLayer* overflowControlLayer = currentCompositedDeprecatedPaintLayerMapping->layerForScrollCorner()) {
+            if (GraphicsLayer* overflowControlLayer = currentCompositedLayerMapping->layerForScrollCorner()) {
                 overflowControlLayer->removeFromParent();
-                currentCompositedDeprecatedPaintLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
+                currentCompositedLayerMapping->parentForSublayers()->addChild(overflowControlLayer);
             }
         }
 
         if (shouldAppendLayer(layer))
-            info.childLayersOfEnclosingCompositedLayer->append(currentCompositedDeprecatedPaintLayerMapping->childForSuperlayers());
+            info.childLayersOfEnclosingCompositedLayer->append(currentCompositedLayerMapping->childForSuperlayers());
     }
 
     if (layer.scrollParent()
-        && layer.scrollParent()->hasCompositedDeprecatedPaintLayerMapping()
-        && layer.scrollParent()->compositedDeprecatedPaintLayerMapping()->needsToReparentOverflowControls()
+        && layer.scrollParent()->hasCompositedLayerMapping()
+        && layer.scrollParent()->compositedLayerMapping()->needsToReparentOverflowControls()
         && layer.scrollParent()->scrollableArea()->topmostScrollChild() == &layer)
-        info.childLayersOfEnclosingCompositedLayer->append(layer.scrollParent()->compositedDeprecatedPaintLayerMapping()->detachLayerForOverflowControls(*info.enclosingCompositedLayer));
+        info.childLayersOfEnclosingCompositedLayer->append(layer.scrollParent()->compositedLayerMapping()->detachLayerForOverflowControls(*info.enclosingCompositedLayer));
 }
 
 }
diff --git a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.h b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.h
index df14fc0d..b314447 100644
--- a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.h
+++ b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerTreeBuilder.h
@@ -32,7 +32,7 @@
 
 namespace blink {
 
-class DeprecatedPaintLayer;
+class PaintLayer;
 
 class GraphicsLayerTreeBuilder {
     STACK_ALLOCATED();
@@ -48,11 +48,11 @@
         {
         }
 
-        DeprecatedPaintLayer* enclosingCompositedLayer;
+        PaintLayer* enclosingCompositedLayer;
         GraphicsLayerVector* childLayersOfEnclosingCompositedLayer;
     };
 
-    void rebuild(DeprecatedPaintLayer&, AncestorInfo);
+    void rebuild(PaintLayer&, AncestorInfo);
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp
index d425cbb..4834aefd 100644
--- a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp
+++ b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.cpp
@@ -29,9 +29,9 @@
 
 #include "core/html/HTMLMediaElement.h"
 #include "core/inspector/InspectorTraceEvents.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/TraceEvent.h"
 
 namespace blink {
@@ -44,7 +44,7 @@
     {
     }
 
-    UpdateContext(const UpdateContext& other, const DeprecatedPaintLayer& layer)
+    UpdateContext(const UpdateContext& other, const PaintLayer& layer)
         : m_compositingStackingContext(other.m_compositingStackingContext)
         , m_compositingAncestor(other.compositingContainer(layer))
     {
@@ -56,19 +56,19 @@
         }
     }
 
-    const DeprecatedPaintLayer* compositingContainer(const DeprecatedPaintLayer& layer) const
+    const PaintLayer* compositingContainer(const PaintLayer& layer) const
     {
         return layer.stackingNode()->isTreatedAsOrStackingContext() ? m_compositingStackingContext : m_compositingAncestor;
     }
 
-    const DeprecatedPaintLayer* compositingStackingContext() const
+    const PaintLayer* compositingStackingContext() const
     {
         return m_compositingStackingContext;
     }
 
 private:
-    const DeprecatedPaintLayer* m_compositingStackingContext;
-    const DeprecatedPaintLayer* m_compositingAncestor;
+    const PaintLayer* m_compositingStackingContext;
+    const PaintLayer* m_compositingAncestor;
 };
 
 GraphicsLayerUpdater::GraphicsLayerUpdater()
@@ -80,21 +80,21 @@
 {
 }
 
-void GraphicsLayerUpdater::update(DeprecatedPaintLayer& layer, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
+void GraphicsLayerUpdater::update(PaintLayer& layer, Vector<PaintLayer*>& layersNeedingPaintInvalidation)
 {
     TRACE_EVENT0("blink", "GraphicsLayerUpdater::update");
     updateRecursive(layer, DoNotForceUpdate, UpdateContext(), layersNeedingPaintInvalidation);
     layer.compositor()->updateRootLayerPosition();
 }
 
-void GraphicsLayerUpdater::updateRecursive(DeprecatedPaintLayer& layer, UpdateType updateType, const UpdateContext& context, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation)
+void GraphicsLayerUpdater::updateRecursive(PaintLayer& layer, UpdateType updateType, const UpdateContext& context, Vector<PaintLayer*>& layersNeedingPaintInvalidation)
 {
-    if (layer.hasCompositedDeprecatedPaintLayerMapping()) {
-        CompositedDeprecatedPaintLayerMapping* mapping = layer.compositedDeprecatedPaintLayerMapping();
+    if (layer.hasCompositedLayerMapping()) {
+        CompositedLayerMapping* mapping = layer.compositedLayerMapping();
 
         if (updateType == ForceUpdate || mapping->needsGraphicsLayerUpdate()) {
-            const DeprecatedPaintLayer* compositingContainer = context.compositingContainer(layer);
-            ASSERT(compositingContainer == layer.enclosingLayerWithCompositedDeprecatedPaintLayerMapping(ExcludeSelf));
+            const PaintLayer* compositingContainer = context.compositingContainer(layer);
+            ASSERT(compositingContainer == layer.enclosingLayerWithCompositedLayerMapping(ExcludeSelf));
 
             if (mapping->updateGraphicsLayerConfiguration())
                 m_needsRebuildTree = true;
@@ -110,18 +110,18 @@
     }
 
     UpdateContext childContext(context, layer);
-    for (DeprecatedPaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
+    for (PaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
         updateRecursive(*child, updateType, childContext, layersNeedingPaintInvalidation);
 }
 
 #if ENABLE(ASSERT)
 
-void GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(DeprecatedPaintLayer& layer)
+void GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(PaintLayer& layer)
 {
-    if (layer.hasCompositedDeprecatedPaintLayerMapping())
-        layer.compositedDeprecatedPaintLayerMapping()->assertNeedsToUpdateGraphicsLayerBitsCleared();
+    if (layer.hasCompositedLayerMapping())
+        layer.compositedLayerMapping()->assertNeedsToUpdateGraphicsLayerBitsCleared();
 
-    for (DeprecatedPaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
+    for (PaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
         assertNeedsToUpdateGraphicsLayerBitsCleared(*child);
 }
 
diff --git a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.h b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.h
index 6434923..dc7cb4f4 100644
--- a/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.h
+++ b/third_party/WebKit/Source/core/layout/compositing/GraphicsLayerUpdater.h
@@ -32,7 +32,7 @@
 
 namespace blink {
 
-class DeprecatedPaintLayer;
+class PaintLayer;
 
 class GraphicsLayerUpdater {
     STACK_ALLOCATED();
@@ -45,18 +45,18 @@
         ForceUpdate,
     };
 
-    void update(DeprecatedPaintLayer&, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
+    void update(PaintLayer&, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
 
     bool needsRebuildTree() const { return m_needsRebuildTree; }
 
 #if ENABLE(ASSERT)
-    static void assertNeedsToUpdateGraphicsLayerBitsCleared(DeprecatedPaintLayer&);
+    static void assertNeedsToUpdateGraphicsLayerBitsCleared(PaintLayer&);
 #endif
 
 private:
     class UpdateContext;
 
-    void updateRecursive(DeprecatedPaintLayer&, UpdateType, const UpdateContext&, Vector<DeprecatedPaintLayer*>& layersNeedingPaintInvalidation);
+    void updateRecursive(PaintLayer&, UpdateType, const UpdateContext&, Vector<PaintLayer*>& layersNeedingPaintInvalidation);
 
     bool m_needsRebuildTree;
 };
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
new file mode 100644
index 0000000..9d509b2
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.cpp
@@ -0,0 +1,1210 @@
+/*
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#include "core/layout/compositing/PaintLayerCompositor.h"
+
+#include "core/animation/AnimationTimeline.h"
+#include "core/animation/DocumentAnimations.h"
+#include "core/dom/DOMNodeIds.h"
+#include "core/dom/Fullscreen.h"
+#include "core/editing/FrameSelection.h"
+#include "core/frame/FrameHost.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
+#include "core/html/HTMLIFrameElement.h"
+#include "core/html/HTMLVideoElement.h"
+#include "core/inspector/InspectorInstrumentation.h"
+#include "core/layout/LayoutPart.h"
+#include "core/layout/LayoutVideo.h"
+#include "core/layout/LayoutView.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/CompositingInputsUpdater.h"
+#include "core/layout/compositing/CompositingLayerAssigner.h"
+#include "core/layout/compositing/CompositingRequirementsUpdater.h"
+#include "core/layout/compositing/GraphicsLayerTreeBuilder.h"
+#include "core/layout/compositing/GraphicsLayerUpdater.h"
+#include "core/loader/FrameLoaderClient.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/Page.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/paint/FramePainter.h"
+#include "core/paint/TransformRecorder.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/ScriptForbiddenScope.h"
+#include "platform/TraceEvent.h"
+#include "platform/graphics/GraphicsLayer.h"
+#include "platform/graphics/paint/DisplayItemList.h"
+#include "platform/graphics/paint/DrawingRecorder.h"
+#include "platform/graphics/paint/TransformDisplayItem.h"
+#include "public/platform/Platform.h"
+
+namespace blink {
+
+PaintLayerCompositor::PaintLayerCompositor(LayoutView& layoutView)
+    : m_layoutView(layoutView)
+    , m_compositingReasonFinder(layoutView)
+    , m_pendingUpdateType(CompositingUpdateNone)
+    , m_hasAcceleratedCompositing(true)
+    , m_compositing(false)
+    , m_rootShouldAlwaysCompositeDirty(true)
+    , m_needsUpdateFixedBackground(false)
+    , m_isTrackingPaintInvalidations(layoutView.frameView()->isTrackingPaintInvalidations())
+    , m_inOverlayFullscreenVideo(false)
+    , m_needsUpdateDescendantDependentFlags(false)
+    , m_rootLayerAttachment(RootLayerUnattached)
+{
+    updateAcceleratedCompositingSettings();
+}
+
+PaintLayerCompositor::~PaintLayerCompositor()
+{
+    ASSERT(m_rootLayerAttachment == RootLayerUnattached);
+}
+
+bool PaintLayerCompositor::inCompositingMode() const
+{
+    // FIXME: This should assert that lifecycle is >= CompositingClean since
+    // the last step of updateIfNeeded can set this bit to false.
+    ASSERT(m_layoutView.layer()->isAllowedToQueryCompositingState());
+    return m_compositing;
+}
+
+bool PaintLayerCompositor::staleInCompositingMode() const
+{
+    return m_compositing;
+}
+
+void PaintLayerCompositor::setCompositingModeEnabled(bool enable)
+{
+    if (enable == m_compositing)
+        return;
+
+    m_compositing = enable;
+
+    if (m_compositing)
+        ensureRootLayer();
+    else
+        destroyRootLayer();
+
+    // Schedule an update in the parent frame so the <iframe>'s layer in the owner
+    // document matches the compositing state here.
+    if (HTMLFrameOwnerElement* ownerElement = m_layoutView.document().ownerElement())
+        ownerElement->setNeedsCompositingUpdate();
+}
+
+void PaintLayerCompositor::enableCompositingModeIfNeeded()
+{
+    if (!m_rootShouldAlwaysCompositeDirty)
+        return;
+
+    m_rootShouldAlwaysCompositeDirty = false;
+    if (m_compositing)
+        return;
+
+    if (rootShouldAlwaysComposite()) {
+        // FIXME: Is this needed? It was added in https://bugs.webkit.org/show_bug.cgi?id=26651.
+        // No tests fail if it's deleted.
+        setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
+        setCompositingModeEnabled(true);
+    }
+}
+
+bool PaintLayerCompositor::rootShouldAlwaysComposite() const
+{
+    if (!m_hasAcceleratedCompositing)
+        return false;
+    return m_layoutView.frame()->isLocalRoot() || m_compositingReasonFinder.requiresCompositingForScrollableFrame();
+}
+
+void PaintLayerCompositor::updateAcceleratedCompositingSettings()
+{
+    m_compositingReasonFinder.updateTriggers();
+    m_hasAcceleratedCompositing = m_layoutView.document().settings()->acceleratedCompositingEnabled();
+    m_rootShouldAlwaysCompositeDirty = true;
+    if (m_rootLayerAttachment != RootLayerUnattached)
+        rootLayer()->setNeedsCompositingInputsUpdate();
+}
+
+bool PaintLayerCompositor::preferCompositingToLCDTextEnabled() const
+{
+    return m_compositingReasonFinder.hasOverflowScrollTrigger();
+}
+
+static LayoutVideo* findFullscreenVideoLayoutObject(Document& document)
+{
+    // Recursively find the document that is in fullscreen.
+    Element* fullscreenElement = Fullscreen::fullscreenElementFrom(document);
+    Document* contentDocument = &document;
+    while (fullscreenElement && fullscreenElement->isFrameOwnerElement()) {
+        contentDocument = toHTMLFrameOwnerElement(fullscreenElement)->contentDocument();
+        if (!contentDocument)
+            return nullptr;
+        fullscreenElement = Fullscreen::fullscreenElementFrom(*contentDocument);
+    }
+    // Get the current fullscreen element from the document.
+    fullscreenElement = Fullscreen::currentFullScreenElementFrom(*contentDocument);
+    if (!isHTMLVideoElement(fullscreenElement))
+        return nullptr;
+    LayoutObject* layoutObject = fullscreenElement->layoutObject();
+    if (!layoutObject)
+        return nullptr;
+    return toLayoutVideo(layoutObject);
+}
+
+// The descendant-dependent flags system is badly broken because we clean dirty
+// bits in upward tree walks, which means we need to call updateDescendantDependentFlags
+// at every node in the tree to fully clean all the dirty bits. While we'll in
+// the process of fixing this issue, updateDescendantDependentFlagsForEntireSubtree
+// provides a big hammer for actually cleaning all the dirty bits in a subtree.
+//
+// FIXME: Remove this function once the descendant-dependent flags system keeps
+// its dirty bits scoped to subtrees.
+void updateDescendantDependentFlagsForEntireSubtree(PaintLayer& layer)
+{
+    layer.updateDescendantDependentFlags();
+
+    for (PaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
+        updateDescendantDependentFlagsForEntireSubtree(*child);
+}
+
+void PaintLayerCompositor::updateIfNeededRecursive()
+{
+    for (Frame* child = m_layoutView.frameView()->frame().tree().firstChild(); child; child = child->tree().nextSibling()) {
+        if (!child->isLocalFrame())
+            continue;
+        LocalFrame* localFrame = toLocalFrame(child);
+        // It's possible for trusted Pepper plugins to force hit testing in situations where
+        // the frame tree is in an inconsistent state, such as in the middle of frame detach.
+        // TODO(bbudge) Remove this check when trusted Pepper plugins are gone.
+        if (localFrame->document()->isActive())
+            localFrame->contentLayoutObject()->compositor()->updateIfNeededRecursive();
+    }
+
+    TRACE_EVENT0("blink", "PaintLayerCompositor::updateIfNeededRecursive");
+
+    ASSERT(!m_layoutView.needsLayout());
+
+    ScriptForbiddenScope forbidScript;
+
+    // FIXME: enableCompositingModeIfNeeded can trigger a CompositingUpdateRebuildTree,
+    // which asserts that it's not InCompositingUpdate.
+    enableCompositingModeIfNeeded();
+
+    if (m_needsUpdateDescendantDependentFlags) {
+        updateDescendantDependentFlagsForEntireSubtree(*rootLayer());
+        m_needsUpdateDescendantDependentFlags = false;
+    }
+
+    m_layoutView.commitPendingSelection();
+
+    lifecycle().advanceTo(DocumentLifecycle::InCompositingUpdate);
+    updateIfNeeded();
+    lifecycle().advanceTo(DocumentLifecycle::CompositingClean);
+
+    DocumentAnimations::updateCompositorAnimations(m_layoutView.document());
+
+    m_layoutView.frameView()->scrollableArea()->updateCompositorScrollAnimations();
+    if (const FrameView::ScrollableAreaSet* animatingScrollableAreas = m_layoutView.frameView()->animatingScrollableAreas()) {
+        for (ScrollableArea* scrollableArea : *animatingScrollableAreas)
+            scrollableArea->updateCompositorScrollAnimations();
+    }
+
+#if ENABLE(ASSERT)
+    ASSERT(lifecycle().state() == DocumentLifecycle::CompositingClean);
+    assertNoUnresolvedDirtyBits();
+    for (Frame* child = m_layoutView.frameView()->frame().tree().firstChild(); child; child = child->tree().nextSibling()) {
+        if (child->isLocalFrame())
+            toLocalFrame(child)->contentLayoutObject()->compositor()->assertNoUnresolvedDirtyBits();
+    }
+#endif
+}
+
+void PaintLayerCompositor::setNeedsCompositingUpdate(CompositingUpdateType updateType)
+{
+    ASSERT(updateType != CompositingUpdateNone);
+    m_pendingUpdateType = std::max(m_pendingUpdateType, updateType);
+    page()->animator().scheduleVisualUpdate(m_layoutView.frame());
+    lifecycle().ensureStateAtMost(DocumentLifecycle::LayoutClean);
+}
+
+void PaintLayerCompositor::didLayout()
+{
+    // FIXME: Technically we only need to do this when the FrameView's
+    // isScrollable method would return a different value.
+    m_rootShouldAlwaysCompositeDirty = true;
+    enableCompositingModeIfNeeded();
+
+    // FIXME: Rather than marking the entire LayoutView as dirty, we should
+    // track which Layers moved during layout and only dirty those
+    // specific Layers.
+    rootLayer()->setNeedsCompositingInputsUpdate();
+}
+
+#if ENABLE(ASSERT)
+
+void PaintLayerCompositor::assertNoUnresolvedDirtyBits()
+{
+    ASSERT(m_pendingUpdateType == CompositingUpdateNone);
+    ASSERT(!m_rootShouldAlwaysCompositeDirty);
+}
+
+#endif
+
+void PaintLayerCompositor::applyOverlayFullscreenVideoAdjustmentIfNeeded()
+{
+    m_inOverlayFullscreenVideo = false;
+    if (!m_rootContentLayer)
+        return;
+
+    bool isLocalRoot = m_layoutView.frame()->isLocalRoot();
+    LayoutVideo* video = findFullscreenVideoLayoutObject(m_layoutView.document());
+    if (!video || !video->layer()->hasCompositedLayerMapping() || !video->videoElement()->usesOverlayFullscreenVideo()) {
+        if (isLocalRoot) {
+            GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer();
+            if (backgroundLayer && !backgroundLayer->parent())
+                rootFixedBackgroundsChanged();
+        }
+        return;
+    }
+
+    GraphicsLayer* videoLayer = video->layer()->compositedLayerMapping()->mainGraphicsLayer();
+
+    // The fullscreen video has layer position equal to its enclosing frame's scroll position because fullscreen container is fixed-positioned.
+    // We should reset layer position here since we are going to reattach the layer at the very top level.
+    videoLayer->setPosition(IntPoint());
+
+    // Only steal fullscreen video layer and clear all other layers if we are the main frame.
+    if (!isLocalRoot)
+        return;
+
+    m_rootContentLayer->removeAllChildren();
+    m_overflowControlsHostLayer->addChild(videoLayer);
+    if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
+        backgroundLayer->removeFromParent();
+    m_inOverlayFullscreenVideo = true;
+}
+
+void PaintLayerCompositor::updateWithoutAcceleratedCompositing(CompositingUpdateType updateType)
+{
+    ASSERT(!hasAcceleratedCompositing());
+
+    if (updateType >= CompositingUpdateAfterCompositingInputChange)
+        CompositingInputsUpdater(rootLayer()).update();
+
+#if ENABLE(ASSERT)
+    CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(rootLayer());
+#endif
+}
+
+static void forceRecomputePaintInvalidationRectsIncludingNonCompositingDescendants(LayoutObject* layoutObject)
+{
+    // We clear the previous paint invalidation rect as it's wrong (paint invaliation container
+    // changed, ...). Forcing a full invalidation will make us recompute it. Also we are not
+    // changing the previous position from our paint invalidation container, which is fine as
+    // we want a full paint invalidation anyway.
+    layoutObject->setPreviousPaintInvalidationRect(LayoutRect());
+    layoutObject->setShouldDoFullPaintInvalidation();
+
+    for (LayoutObject* child = layoutObject->slowFirstChild(); child; child = child->nextSibling()) {
+        if (!child->isPaintInvalidationContainer())
+            forceRecomputePaintInvalidationRectsIncludingNonCompositingDescendants(child);
+    }
+}
+
+
+void PaintLayerCompositor::updateIfNeeded()
+{
+    CompositingUpdateType updateType = m_pendingUpdateType;
+    m_pendingUpdateType = CompositingUpdateNone;
+
+    if (!hasAcceleratedCompositing()) {
+        updateWithoutAcceleratedCompositing(updateType);
+        return;
+    }
+
+    if (updateType == CompositingUpdateNone)
+        return;
+
+    PaintLayer* updateRoot = rootLayer();
+
+    Vector<PaintLayer*> layersNeedingPaintInvalidation;
+
+    if (updateType >= CompositingUpdateAfterCompositingInputChange) {
+        CompositingInputsUpdater(updateRoot).update();
+
+#if ENABLE(ASSERT)
+        // FIXME: Move this check to the end of the compositing update.
+        CompositingInputsUpdater::assertNeedsCompositingInputsUpdateBitsCleared(updateRoot);
+#endif
+
+        CompositingRequirementsUpdater(m_layoutView, m_compositingReasonFinder).update(updateRoot);
+
+        CompositingLayerAssigner layerAssigner(this);
+        layerAssigner.assign(updateRoot, layersNeedingPaintInvalidation);
+
+        bool layersChanged = layerAssigner.layersChanged();
+
+        {
+            TRACE_EVENT0("blink", "PaintLayerCompositor::updateAfterCompositingChange");
+            if (const FrameView::ScrollableAreaSet* scrollableAreas = m_layoutView.frameView()->scrollableAreas()) {
+                for (ScrollableArea* scrollableArea : *scrollableAreas)
+                    layersChanged |= scrollableArea->updateAfterCompositingChange();
+            }
+        }
+
+        if (layersChanged)
+            updateType = std::max(updateType, CompositingUpdateRebuildTree);
+    }
+
+    if (updateType != CompositingUpdateNone) {
+        GraphicsLayerUpdater updater;
+        updater.update(*updateRoot, layersNeedingPaintInvalidation);
+
+        if (updater.needsRebuildTree())
+            updateType = std::max(updateType, CompositingUpdateRebuildTree);
+
+#if ENABLE(ASSERT)
+        // FIXME: Move this check to the end of the compositing update.
+        GraphicsLayerUpdater::assertNeedsToUpdateGraphicsLayerBitsCleared(*updateRoot);
+#endif
+    }
+
+    if (updateType >= CompositingUpdateRebuildTree) {
+        GraphicsLayerTreeBuilder::AncestorInfo ancestorInfo;
+        GraphicsLayerVector childList;
+        ancestorInfo.childLayersOfEnclosingCompositedLayer = &childList;
+        {
+            TRACE_EVENT0("blink", "GraphicsLayerTreeBuilder::rebuild");
+            GraphicsLayerTreeBuilder().rebuild(*updateRoot, ancestorInfo);
+        }
+
+        if (childList.isEmpty())
+            destroyRootLayer();
+        else
+            m_rootContentLayer->setChildren(childList);
+
+        applyOverlayFullscreenVideoAdjustmentIfNeeded();
+    }
+
+    if (m_needsUpdateFixedBackground) {
+        rootFixedBackgroundsChanged();
+        m_needsUpdateFixedBackground = false;
+    }
+
+    for (unsigned i = 0; i < layersNeedingPaintInvalidation.size(); i++)
+        forceRecomputePaintInvalidationRectsIncludingNonCompositingDescendants(layersNeedingPaintInvalidation[i]->layoutObject());
+
+    m_layoutView.frameView()->setFrameTimingRequestsDirty(true);
+
+    // Inform the inspector that the layer tree has changed.
+    if (m_layoutView.frame()->isMainFrame())
+        InspectorInstrumentation::layerTreeDidChange(m_layoutView.frame());
+}
+
+bool PaintLayerCompositor::allocateOrClearCompositedLayerMapping(PaintLayer* layer, const CompositingStateTransitionType compositedLayerUpdate)
+{
+    bool compositedLayerMappingChanged = false;
+
+    // FIXME: It would be nice to directly use the layer's compositing reason,
+    // but allocateOrClearCompositedLayerMapping also gets called without having updated compositing
+    // requirements fully.
+    switch (compositedLayerUpdate) {
+    case AllocateOwnCompositedLayerMapping:
+        ASSERT(!layer->hasCompositedLayerMapping());
+        setCompositingModeEnabled(true);
+
+        // If we need to issue paint invalidations, do so before allocating the compositedLayerMapping and clearing out the groupedMapping.
+        paintInvalidationOnCompositingChange(layer);
+
+        // If this layer was previously squashed, we need to remove its reference to a groupedMapping right away, so
+        // that computing paint invalidation rects will know the layer's correct compositingState.
+        // FIXME: do we need to also remove the layer from it's location in the squashing list of its groupedMapping?
+        // Need to create a test where a squashed layer pops into compositing. And also to cover all other
+        // sorts of compositingState transitions.
+        layer->setLostGroupedMapping(false);
+        layer->setGroupedMapping(nullptr, PaintLayer::InvalidateLayerAndRemoveFromMapping);
+
+        layer->ensureCompositedLayerMapping();
+        compositedLayerMappingChanged = true;
+
+        // At this time, the ScrollingCooridnator only supports the top-level frame.
+        if (layer->isRootLayer() && m_layoutView.frame()->isLocalRoot()) {
+            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+                scrollingCoordinator->frameViewRootLayerDidChange(m_layoutView.frameView());
+        }
+        break;
+    case RemoveOwnCompositedLayerMapping:
+    // PutInSquashingLayer means you might have to remove the composited layer mapping first.
+    case PutInSquashingLayer:
+        if (layer->hasCompositedLayerMapping()) {
+            // If we're removing the compositedLayerMapping from a reflection, clear the source GraphicsLayer's pointer to
+            // its replica GraphicsLayer. In practice this should never happen because reflectee and reflection
+            // are both either composited, or not composited.
+            if (layer->isReflection()) {
+                PaintLayer* sourceLayer = toLayoutBoxModelObject(layer->layoutObject()->parent())->layer();
+                if (sourceLayer->hasCompositedLayerMapping()) {
+                    ASSERT(sourceLayer->compositedLayerMapping()->mainGraphicsLayer()->replicaLayer() == layer->compositedLayerMapping()->mainGraphicsLayer());
+                    sourceLayer->compositedLayerMapping()->mainGraphicsLayer()->setReplicatedByLayer(nullptr);
+                }
+            }
+
+            layer->clearCompositedLayerMapping();
+            compositedLayerMappingChanged = true;
+        }
+
+        break;
+    case RemoveFromSquashingLayer:
+    case NoCompositingStateChange:
+        // Do nothing.
+        break;
+    }
+
+    if (compositedLayerMappingChanged && layer->layoutObject()->isLayoutPart()) {
+        PaintLayerCompositor* innerCompositor = frameContentsCompositor(toLayoutPart(layer->layoutObject()));
+        if (innerCompositor && innerCompositor->staleInCompositingMode())
+            innerCompositor->updateRootLayerAttachment();
+    }
+
+    if (compositedLayerMappingChanged)
+        layer->clipper().clearClipRectsIncludingDescendants(PaintingClipRects);
+
+    // If a fixed position layer gained/lost a compositedLayerMapping or the reason not compositing it changed,
+    // the scrolling coordinator needs to recalculate whether it can do fast scrolling.
+    if (compositedLayerMappingChanged) {
+        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+            scrollingCoordinator->frameViewFixedObjectsDidChange(m_layoutView.frameView());
+    }
+
+    return compositedLayerMappingChanged;
+}
+
+void PaintLayerCompositor::paintInvalidationOnCompositingChange(PaintLayer* layer)
+{
+    // If the layoutObject is not attached yet, no need to issue paint invalidations.
+    if (layer->layoutObject() != &m_layoutView && !layer->layoutObject()->parent())
+        return;
+
+    // For querying Layer::compositingState()
+    // Eager invalidation here is correct, since we are invalidating with respect to the previous frame's
+    // compositing state when changing the compositing backing of the layer.
+    DisableCompositingQueryAsserts disabler;
+    // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
+    DisablePaintInvalidationStateAsserts paintInvalidationAssertisabler;
+
+    layer->layoutObject()->invalidatePaintIncludingNonCompositingDescendants();
+}
+
+void PaintLayerCompositor::frameViewDidChangeLocation(const IntPoint& contentsOffset)
+{
+    if (m_overflowControlsHostLayer)
+        m_overflowControlsHostLayer->setPosition(contentsOffset);
+}
+
+void PaintLayerCompositor::frameViewDidChangeSize()
+{
+    if (m_containerLayer) {
+        FrameView* frameView = m_layoutView.frameView();
+        m_containerLayer->setSize(frameView->visibleContentSize());
+        m_overflowControlsHostLayer->setSize(frameView->visibleContentSize(IncludeScrollbars));
+
+        frameViewDidScroll();
+        updateOverflowControlsLayers();
+    }
+}
+
+enum AcceleratedFixedRootBackgroundHistogramBuckets {
+    ScrolledMainFrameBucket = 0,
+    ScrolledMainFrameWithAcceleratedFixedRootBackground = 1,
+    ScrolledMainFrameWithUnacceleratedFixedRootBackground = 2,
+    AcceleratedFixedRootBackgroundHistogramMax = 3
+};
+
+void PaintLayerCompositor::frameViewDidScroll()
+{
+    FrameView* frameView = m_layoutView.frameView();
+    IntPoint scrollPosition = frameView->scrollPosition();
+
+    if (!m_scrollLayer)
+        return;
+
+    bool scrollingCoordinatorHandlesOffset = false;
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) {
+        scrollingCoordinatorHandlesOffset = scrollingCoordinator->scrollableAreaScrollLayerDidChange(frameView);
+    }
+
+    // Scroll position = scroll minimum + scroll offset. Adjust the layer's
+    // position to handle whatever the scroll coordinator isn't handling.
+    // The minimum scroll position is non-zero for RTL pages with overflow.
+    if (scrollingCoordinatorHandlesOffset)
+        m_scrollLayer->setPosition(-frameView->minimumScrollPosition());
+    else
+        m_scrollLayer->setPosition(-scrollPosition);
+
+
+    Platform::current()->histogramEnumeration("Renderer.AcceleratedFixedRootBackground",
+        ScrolledMainFrameBucket,
+        AcceleratedFixedRootBackgroundHistogramMax);
+}
+
+void PaintLayerCompositor::frameViewScrollbarsExistenceDidChange()
+{
+    if (m_containerLayer)
+        updateOverflowControlsLayers();
+}
+
+void PaintLayerCompositor::rootFixedBackgroundsChanged()
+{
+    if (!supportsFixedRootBackgroundCompositing())
+        return;
+
+    // To avoid having to make the fixed root background layer fixed positioned to
+    // stay put, we position it in the layer tree as follows:
+    //
+    // + Overflow controls host
+    //   + LocalFrame clip
+    //     + (Fixed root background) <-- Here.
+    //     + LocalFrame scroll
+    //       + Root content layer
+    //   + Scrollbars
+    //
+    // That is, it needs to be the first child of the frame clip, the sibling of
+    // the frame scroll layer. The compositor does not own the background layer, it
+    // just positions it (like the foreground layer).
+    if (GraphicsLayer* backgroundLayer = fixedRootBackgroundLayer())
+        m_containerLayer->addChildBelow(backgroundLayer, m_scrollLayer.get());
+}
+
+bool PaintLayerCompositor::scrollingLayerDidChange(PaintLayer* layer)
+{
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+        return scrollingCoordinator->scrollableAreaScrollLayerDidChange(layer->scrollableArea());
+    return false;
+}
+
+String PaintLayerCompositor::layerTreeAsText(LayerTreeFlags flags)
+{
+    ASSERT(lifecycle().state() >= DocumentLifecycle::PaintInvalidationClean);
+
+    if (!m_rootContentLayer)
+        return String();
+
+    // We skip dumping the scroll and clip layers to keep layerTreeAsText output
+    // similar between platforms (unless we explicitly request dumping from the
+    // root.
+    GraphicsLayer* rootLayer = m_rootContentLayer.get();
+    if (flags & LayerTreeIncludesRootLayer)
+        rootLayer = rootGraphicsLayer();
+
+    return rootLayer->layerTreeAsText(flags);
+}
+
+PaintLayerCompositor* PaintLayerCompositor::frameContentsCompositor(LayoutPart* layoutObject)
+{
+    if (!layoutObject->node()->isFrameOwnerElement())
+        return nullptr;
+
+    HTMLFrameOwnerElement* element = toHTMLFrameOwnerElement(layoutObject->node());
+    if (Document* contentDocument = element->contentDocument()) {
+        if (LayoutView* view = contentDocument->layoutView())
+            return view->compositor();
+    }
+    return nullptr;
+}
+
+// FIXME: What does this function do? It needs a clearer name.
+bool PaintLayerCompositor::parentFrameContentLayers(LayoutPart* layoutObject)
+{
+    PaintLayerCompositor* innerCompositor = frameContentsCompositor(layoutObject);
+    if (!innerCompositor || !innerCompositor->staleInCompositingMode() || innerCompositor->rootLayerAttachment() != RootLayerAttachedViaEnclosingFrame)
+        return false;
+
+    PaintLayer* layer = layoutObject->layer();
+    if (!layer->hasCompositedLayerMapping())
+        return false;
+
+    CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
+    GraphicsLayer* hostingLayer = compositedLayerMapping->parentForSublayers();
+    GraphicsLayer* rootLayer = innerCompositor->rootGraphicsLayer();
+    if (hostingLayer->children().size() != 1 || hostingLayer->children()[0] != rootLayer) {
+        hostingLayer->removeAllChildren();
+        hostingLayer->addChild(rootLayer);
+    }
+    return true;
+}
+
+static void fullyInvalidatePaintRecursive(PaintLayer* layer)
+{
+    if (layer->compositingState() == PaintsIntoOwnBacking) {
+        layer->compositedLayerMapping()->setContentsNeedDisplay();
+        layer->compositedLayerMapping()->setSquashingContentsNeedDisplay();
+    }
+
+    for (PaintLayer* child = layer->firstChild(); child; child = child->nextSibling())
+        fullyInvalidatePaintRecursive(child);
+}
+
+void PaintLayerCompositor::fullyInvalidatePaint()
+{
+    // We're walking all compositing layers and invalidating them, so there's
+    // no need to have up-to-date compositing state.
+    DisableCompositingQueryAsserts disabler;
+    fullyInvalidatePaintRecursive(rootLayer());
+}
+
+PaintLayer* PaintLayerCompositor::rootLayer() const
+{
+    return m_layoutView.layer();
+}
+
+GraphicsLayer* PaintLayerCompositor::rootGraphicsLayer() const
+{
+    if (m_overflowControlsHostLayer)
+        return m_overflowControlsHostLayer.get();
+    return m_rootContentLayer.get();
+}
+
+GraphicsLayer* PaintLayerCompositor::frameScrollLayer() const
+{
+    return m_scrollLayer.get();
+}
+
+GraphicsLayer* PaintLayerCompositor::scrollLayer() const
+{
+    if (ScrollableArea* scrollableArea = m_layoutView.frameView()->scrollableArea())
+        return scrollableArea->layerForScrolling();
+    return nullptr;
+}
+
+GraphicsLayer* PaintLayerCompositor::containerLayer() const
+{
+    return m_containerLayer.get();
+}
+
+GraphicsLayer* PaintLayerCompositor::ensureRootTransformLayer()
+{
+    ASSERT(rootGraphicsLayer());
+
+    if (!m_rootTransformLayer.get()) {
+        m_rootTransformLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+        m_overflowControlsHostLayer->addChild(m_rootTransformLayer.get());
+        m_rootTransformLayer->addChild(m_containerLayer.get());
+        updateOverflowControlsLayers();
+    }
+
+    return m_rootTransformLayer.get();
+}
+
+void PaintLayerCompositor::setIsInWindow(bool isInWindow)
+{
+    if (!staleInCompositingMode())
+        return;
+
+    if (isInWindow) {
+        if (m_rootLayerAttachment != RootLayerUnattached)
+            return;
+
+        RootLayerAttachment attachment = m_layoutView.frame()->isLocalRoot() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame;
+        attachCompositorTimeline();
+        attachRootLayer(attachment);
+    } else {
+        if (m_rootLayerAttachment == RootLayerUnattached)
+            return;
+
+        detachRootLayer();
+        detachCompositorTimeline();
+    }
+}
+
+void PaintLayerCompositor::updateRootLayerPosition()
+{
+    if (m_rootContentLayer) {
+        const IntRect& documentRect = m_layoutView.documentRect();
+        m_rootContentLayer->setSize(documentRect.size());
+        m_rootContentLayer->setPosition(documentRect.location());
+    }
+    if (m_containerLayer) {
+        FrameView* frameView = m_layoutView.frameView();
+        m_containerLayer->setSize(frameView->visibleContentSize());
+        m_overflowControlsHostLayer->setSize(frameView->visibleContentSize(IncludeScrollbars));
+    }
+}
+
+void PaintLayerCompositor::updatePotentialCompositingReasonsFromStyle(PaintLayer* layer)
+{
+    layer->setPotentialCompositingReasonsFromStyle(m_compositingReasonFinder.potentialCompositingReasonsFromStyle(layer->layoutObject()));
+}
+
+void PaintLayerCompositor::updateDirectCompositingReasons(PaintLayer* layer)
+{
+    layer->setCompositingReasons(m_compositingReasonFinder.directReasons(layer), CompositingReasonComboAllDirectReasons);
+}
+
+bool PaintLayerCompositor::canBeComposited(const PaintLayer* layer) const
+{
+    const bool hasCompositorAnimation = m_compositingReasonFinder.requiresCompositingForAnimation(*layer->layoutObject()->style());
+    return m_hasAcceleratedCompositing && (hasCompositorAnimation || !layer->subtreeIsInvisible()) && layer->isSelfPaintingLayer() && !layer->layoutObject()->isLayoutFlowThread();
+}
+
+// Return true if the given layer is a stacking context and has compositing child
+// layers that it needs to clip. In this case we insert a clipping GraphicsLayer
+// into the hierarchy between this layer and its children in the z-order hierarchy.
+bool PaintLayerCompositor::clipsCompositingDescendants(const PaintLayer* layer) const
+{
+    return layer->hasCompositingDescendant() && layer->layoutObject()->hasClipOrOverflowClip();
+}
+
+// If an element has composited negative z-index children, those children paint in front of the
+// layer background, so we need an extra 'contents' layer for the foreground of the layer
+// object.
+bool PaintLayerCompositor::needsContentsCompositingLayer(const PaintLayer* layer) const
+{
+    if (!layer->hasCompositingDescendant())
+        return false;
+    return layer->stackingNode()->hasNegativeZOrderList();
+}
+
+static void paintScrollbar(const Scrollbar* scrollbar, GraphicsContext& context, const IntRect& clip)
+{
+    if (!scrollbar)
+        return;
+
+    // Frame scrollbars are painted in the space of the containing frame, not the local space of the scrollbar.
+    const IntPoint& paintOffset = scrollbar->frameRect().location();
+    IntRect transformedClip = clip;
+    transformedClip.moveBy(paintOffset);
+
+    AffineTransform translation;
+    translation.translate(-paintOffset.x(), -paintOffset.y());
+    TransformRecorder transformRecorder(context, *scrollbar, translation);
+
+    scrollbar->paint(&context, transformedClip);
+}
+
+void PaintLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const IntRect& clip) const
+{
+    if (graphicsLayer == layerForHorizontalScrollbar())
+        paintScrollbar(m_layoutView.frameView()->horizontalScrollbar(), context, clip);
+    else if (graphicsLayer == layerForVerticalScrollbar())
+        paintScrollbar(m_layoutView.frameView()->verticalScrollbar(), context, clip);
+    else if (graphicsLayer == layerForScrollCorner())
+        FramePainter(*m_layoutView.frameView()).paintScrollCorner(&context, clip);
+}
+
+bool PaintLayerCompositor::supportsFixedRootBackgroundCompositing() const
+{
+    if (Settings* settings = m_layoutView.document().settings())
+        return settings->preferCompositingToLCDTextEnabled();
+    return false;
+}
+
+bool PaintLayerCompositor::needsFixedRootBackgroundLayer(const PaintLayer* layer) const
+{
+    if (layer != m_layoutView.layer())
+        return false;
+
+    return supportsFixedRootBackgroundCompositing() && m_layoutView.rootBackgroundIsEntirelyFixed();
+}
+
+GraphicsLayer* PaintLayerCompositor::fixedRootBackgroundLayer() const
+{
+    // Get the fixed root background from the LayoutView layer's compositedLayerMapping.
+    PaintLayer* viewLayer = m_layoutView.layer();
+    if (!viewLayer)
+        return nullptr;
+
+    if (viewLayer->compositingState() == PaintsIntoOwnBacking && viewLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBackground())
+        return viewLayer->compositedLayerMapping()->backgroundLayer();
+
+    return nullptr;
+}
+
+static void resetTrackedPaintInvalidationRectsRecursive(GraphicsLayer* graphicsLayer)
+{
+    if (!graphicsLayer)
+        return;
+
+    graphicsLayer->resetTrackedPaintInvalidations();
+
+    for (size_t i = 0; i < graphicsLayer->children().size(); ++i)
+        resetTrackedPaintInvalidationRectsRecursive(graphicsLayer->children()[i]);
+
+    if (GraphicsLayer* replicaLayer = graphicsLayer->replicaLayer())
+        resetTrackedPaintInvalidationRectsRecursive(replicaLayer);
+
+    if (GraphicsLayer* maskLayer = graphicsLayer->maskLayer())
+        resetTrackedPaintInvalidationRectsRecursive(maskLayer);
+
+    if (GraphicsLayer* clippingMaskLayer = graphicsLayer->contentsClippingMaskLayer())
+        resetTrackedPaintInvalidationRectsRecursive(clippingMaskLayer);
+}
+
+void PaintLayerCompositor::resetTrackedPaintInvalidationRects()
+{
+    if (GraphicsLayer* rootLayer = rootGraphicsLayer())
+        resetTrackedPaintInvalidationRectsRecursive(rootLayer);
+}
+
+void PaintLayerCompositor::setTracksPaintInvalidations(bool tracksPaintInvalidations)
+{
+#if ENABLE(ASSERT)
+    if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+        ASSERT(lifecycle().state() == DocumentLifecycle::CompositingForSlimmingPaintV2Clean
+            // TODO(wangxianzhu): Remove this when we remove the old path for spv2.
+            || lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
+    } else {
+        ASSERT(lifecycle().state() == DocumentLifecycle::PaintInvalidationClean);
+    }
+#endif
+
+    m_isTrackingPaintInvalidations = tracksPaintInvalidations;
+}
+
+bool PaintLayerCompositor::isTrackingPaintInvalidations() const
+{
+    return m_isTrackingPaintInvalidations;
+}
+
+bool PaintLayerCompositor::requiresHorizontalScrollbarLayer() const
+{
+    return m_layoutView.frameView()->horizontalScrollbar();
+}
+
+bool PaintLayerCompositor::requiresVerticalScrollbarLayer() const
+{
+    return m_layoutView.frameView()->verticalScrollbar();
+}
+
+bool PaintLayerCompositor::requiresScrollCornerLayer() const
+{
+    return m_layoutView.frameView()->isScrollCornerVisible();
+}
+
+void PaintLayerCompositor::updateOverflowControlsLayers()
+{
+    GraphicsLayer* controlsParent = m_rootTransformLayer.get() ? m_rootTransformLayer.get() : m_overflowControlsHostLayer.get();
+    // Main frame scrollbars should always be stuck to the sides of the screen (in overscroll and in pinch-zoom), so
+    // make the parent for the scrollbars be the viewport container layer.
+    if (m_layoutView.frame()->isMainFrame()) {
+        VisualViewport& visualViewport = m_layoutView.frameView()->page()->frameHost().visualViewport();
+        controlsParent = visualViewport.containerLayer();
+    }
+
+    if (requiresHorizontalScrollbarLayer()) {
+        if (!m_layerForHorizontalScrollbar) {
+            m_layerForHorizontalScrollbar = GraphicsLayer::create(graphicsLayerFactory(), this);
+        }
+
+        if (m_layerForHorizontalScrollbar->parent() != controlsParent) {
+            controlsParent->addChild(m_layerForHorizontalScrollbar.get());
+
+            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+                scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), HorizontalScrollbar);
+        }
+    } else if (m_layerForHorizontalScrollbar) {
+        m_layerForHorizontalScrollbar->removeFromParent();
+        m_layerForHorizontalScrollbar = nullptr;
+
+        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), HorizontalScrollbar);
+    }
+
+    if (requiresVerticalScrollbarLayer()) {
+        if (!m_layerForVerticalScrollbar) {
+            m_layerForVerticalScrollbar = GraphicsLayer::create(graphicsLayerFactory(), this);
+        }
+
+        if (m_layerForVerticalScrollbar->parent() != controlsParent) {
+            controlsParent->addChild(m_layerForVerticalScrollbar.get());
+
+            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+                scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), VerticalScrollbar);
+        }
+    } else if (m_layerForVerticalScrollbar) {
+        m_layerForVerticalScrollbar->removeFromParent();
+        m_layerForVerticalScrollbar = nullptr;
+
+        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), VerticalScrollbar);
+    }
+
+    if (requiresScrollCornerLayer()) {
+        if (!m_layerForScrollCorner)
+            m_layerForScrollCorner = GraphicsLayer::create(graphicsLayerFactory(), this);
+
+        if (m_layerForScrollCorner->parent() != controlsParent)
+            controlsParent->addChild(m_layerForScrollCorner.get());
+    } else if (m_layerForScrollCorner) {
+        m_layerForScrollCorner->removeFromParent();
+        m_layerForScrollCorner = nullptr;
+    }
+
+    m_layoutView.frameView()->positionScrollbarLayers();
+}
+
+void PaintLayerCompositor::ensureRootLayer()
+{
+    RootLayerAttachment expectedAttachment = m_layoutView.frame()->isLocalRoot() ? RootLayerAttachedViaChromeClient : RootLayerAttachedViaEnclosingFrame;
+    if (expectedAttachment == m_rootLayerAttachment)
+        return;
+
+    Settings* settings = m_layoutView.document().settings();
+    if (!m_rootContentLayer) {
+        m_rootContentLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+        IntRect overflowRect = m_layoutView.pixelSnappedLayoutOverflowRect();
+        m_rootContentLayer->setSize(FloatSize(overflowRect.maxX(), overflowRect.maxY()));
+        m_rootContentLayer->setPosition(FloatPoint());
+        m_rootContentLayer->setOwnerNodeId(DOMNodeIds::idForNode(m_layoutView.generatingNode()));
+
+        // FIXME: with rootLayerScrolls, we probably don't even need m_rootContentLayer?
+        if (!(settings && settings->rootLayerScrolls())) {
+            // Need to clip to prevent transformed content showing outside this frame
+            m_rootContentLayer->setMasksToBounds(true);
+        }
+    }
+
+    if (!m_overflowControlsHostLayer) {
+        ASSERT(!m_scrollLayer);
+        ASSERT(!m_containerLayer);
+
+        // Create a layer to host the clipping layer and the overflow controls layers.
+        m_overflowControlsHostLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+
+        // Clip iframe's overflow controls layer.
+        bool containerMasksToBounds = !m_layoutView.frame()->isLocalRoot();
+        m_overflowControlsHostLayer->setMasksToBounds(containerMasksToBounds);
+
+        // Create a clipping layer if this is an iframe or settings require to clip.
+        m_containerLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+        m_containerLayer->setMasksToBounds(containerMasksToBounds);
+
+        m_scrollLayer = GraphicsLayer::create(graphicsLayerFactory(), this);
+        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+            scrollingCoordinator->setLayerIsContainerForFixedPositionLayers(m_scrollLayer.get(), true);
+
+        // Hook them up
+        m_overflowControlsHostLayer->addChild(m_containerLayer.get());
+        m_containerLayer->addChild(m_scrollLayer.get());
+        m_scrollLayer->addChild(m_rootContentLayer.get());
+
+        frameViewDidChangeSize();
+    }
+
+    // Check to see if we have to change the attachment
+    if (m_rootLayerAttachment != RootLayerUnattached) {
+        detachRootLayer();
+        detachCompositorTimeline();
+    }
+
+    attachCompositorTimeline();
+    attachRootLayer(expectedAttachment);
+}
+
+void PaintLayerCompositor::destroyRootLayer()
+{
+    if (!m_rootContentLayer)
+        return;
+
+    detachRootLayer();
+
+    if (m_layerForHorizontalScrollbar) {
+        m_layerForHorizontalScrollbar->removeFromParent();
+        m_layerForHorizontalScrollbar = nullptr;
+        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), HorizontalScrollbar);
+        if (Scrollbar* horizontalScrollbar = m_layoutView.frameView()->horizontalScrollbar())
+            m_layoutView.frameView()->invalidateScrollbar(horizontalScrollbar, IntRect(IntPoint(0, 0), horizontalScrollbar->frameRect().size()));
+    }
+
+    if (m_layerForVerticalScrollbar) {
+        m_layerForVerticalScrollbar->removeFromParent();
+        m_layerForVerticalScrollbar = nullptr;
+        if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+            scrollingCoordinator->scrollableAreaScrollbarLayerDidChange(m_layoutView.frameView(), VerticalScrollbar);
+        if (Scrollbar* verticalScrollbar = m_layoutView.frameView()->verticalScrollbar())
+            m_layoutView.frameView()->invalidateScrollbar(verticalScrollbar, IntRect(IntPoint(0, 0), verticalScrollbar->frameRect().size()));
+    }
+
+    if (m_layerForScrollCorner) {
+        m_layerForScrollCorner = nullptr;
+        m_layoutView.frameView()->invalidateScrollCorner(m_layoutView.frameView()->scrollCornerRect());
+    }
+
+    if (m_overflowControlsHostLayer) {
+        m_overflowControlsHostLayer = nullptr;
+        m_containerLayer = nullptr;
+        m_scrollLayer = nullptr;
+    }
+    ASSERT(!m_scrollLayer);
+    m_rootContentLayer = nullptr;
+    m_rootTransformLayer = nullptr;
+}
+
+void PaintLayerCompositor::attachRootLayer(RootLayerAttachment attachment)
+{
+    if (!m_rootContentLayer)
+        return;
+
+    switch (attachment) {
+    case RootLayerUnattached:
+        ASSERT_NOT_REACHED();
+        break;
+    case RootLayerAttachedViaChromeClient: {
+        LocalFrame& frame = m_layoutView.frameView()->frame();
+        Page* page = frame.page();
+        if (!page)
+            return;
+        page->chromeClient().attachRootGraphicsLayer(rootGraphicsLayer(), &frame);
+        break;
+    }
+    case RootLayerAttachedViaEnclosingFrame: {
+        HTMLFrameOwnerElement* ownerElement = m_layoutView.document().ownerElement();
+        ASSERT(ownerElement);
+        // The layer will get hooked up via CompositedLayerMapping::updateGraphicsLayerConfiguration()
+        // for the frame's layoutObject in the parent document.
+        ownerElement->setNeedsCompositingUpdate();
+        break;
+    }
+    }
+
+    m_rootLayerAttachment = attachment;
+}
+
+void PaintLayerCompositor::detachRootLayer()
+{
+    if (!m_rootContentLayer || m_rootLayerAttachment == RootLayerUnattached)
+        return;
+
+    switch (m_rootLayerAttachment) {
+    case RootLayerAttachedViaEnclosingFrame: {
+        // The layer will get unhooked up via CompositedLayerMapping::updateGraphicsLayerConfiguration()
+        // for the frame's layoutObject in the parent document.
+        if (m_overflowControlsHostLayer)
+            m_overflowControlsHostLayer->removeFromParent();
+        else
+            m_rootContentLayer->removeFromParent();
+
+        if (HTMLFrameOwnerElement* ownerElement = m_layoutView.document().ownerElement())
+            ownerElement->setNeedsCompositingUpdate();
+        break;
+    }
+    case RootLayerAttachedViaChromeClient: {
+        LocalFrame& frame = m_layoutView.frameView()->frame();
+        Page* page = frame.page();
+        if (!page)
+            return;
+        page->chromeClient().attachRootGraphicsLayer(0, &frame);
+        break;
+    }
+    case RootLayerUnattached:
+        break;
+    }
+
+    m_rootLayerAttachment = RootLayerUnattached;
+}
+
+void PaintLayerCompositor::updateRootLayerAttachment()
+{
+    ensureRootLayer();
+}
+
+void PaintLayerCompositor::attachCompositorTimeline()
+{
+    LocalFrame& frame = m_layoutView.frameView()->frame();
+    Page* page = frame.page();
+    if (!page)
+        return;
+
+    WebCompositorAnimationTimeline* compositorTimeline = frame.document() ? frame.document()->timeline().compositorTimeline() : nullptr;
+    if (compositorTimeline)
+        page->chromeClient().attachCompositorAnimationTimeline(compositorTimeline, &frame);
+}
+
+void PaintLayerCompositor::detachCompositorTimeline()
+{
+    LocalFrame& frame = m_layoutView.frameView()->frame();
+    Page* page = frame.page();
+    if (!page)
+        return;
+
+    WebCompositorAnimationTimeline* compositorTimeline = frame.document() ? frame.document()->timeline().compositorTimeline() : nullptr;
+    if (compositorTimeline)
+        page->chromeClient().detachCompositorAnimationTimeline(compositorTimeline, &frame);
+}
+
+ScrollingCoordinator* PaintLayerCompositor::scrollingCoordinator() const
+{
+    if (Page* page = this->page())
+        return page->scrollingCoordinator();
+
+    return nullptr;
+}
+
+GraphicsLayerFactory* PaintLayerCompositor::graphicsLayerFactory() const
+{
+    if (Page* page = this->page())
+        return page->chromeClient().graphicsLayerFactory();
+    return nullptr;
+}
+
+Page* PaintLayerCompositor::page() const
+{
+    return m_layoutView.frameView()->frame().page();
+}
+
+DocumentLifecycle& PaintLayerCompositor::lifecycle() const
+{
+    return m_layoutView.document().lifecycle();
+}
+
+String PaintLayerCompositor::debugName(const GraphicsLayer* graphicsLayer)
+{
+    String name;
+    if (graphicsLayer == m_rootContentLayer.get()) {
+        name = "Content Root Layer";
+    } else if (graphicsLayer == m_rootTransformLayer.get()) {
+        name = "Root Transform Layer";
+    } else if (graphicsLayer == m_overflowControlsHostLayer.get()) {
+        name = "Frame Overflow Controls Host Layer";
+    } else if (graphicsLayer == m_layerForHorizontalScrollbar.get()) {
+        name = "Frame Horizontal Scrollbar Layer";
+    } else if (graphicsLayer == m_layerForVerticalScrollbar.get()) {
+        name = "Frame Vertical Scrollbar Layer";
+    } else if (graphicsLayer == m_layerForScrollCorner.get()) {
+        name = "Frame Scroll Corner Layer";
+    } else if (graphicsLayer == m_containerLayer.get()) {
+        name = "Frame Clipping Layer";
+    } else if (graphicsLayer == m_scrollLayer.get()) {
+        name = "Frame Scrolling Layer";
+    } else {
+        ASSERT_NOT_REACHED();
+    }
+
+    return name;
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
new file mode 100644
index 0000000..12d042a
--- /dev/null
+++ b/third_party/WebKit/Source/core/layout/compositing/PaintLayerCompositor.h
@@ -0,0 +1,256 @@
+/*
+ * Copyright (C) 2009 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PaintLayerCompositor_h
+#define PaintLayerCompositor_h
+
+#include "core/CoreExport.h"
+#include "core/layout/compositing/CompositingReasonFinder.h"
+#include "platform/graphics/GraphicsLayerClient.h"
+#include "wtf/HashMap.h"
+
+namespace blink {
+
+class PaintLayer;
+class DocumentLifecycle;
+class GraphicsLayer;
+class GraphicsLayerFactory;
+class IntPoint;
+class Page;
+class LayoutPart;
+class ScrollingCoordinator;
+
+enum CompositingUpdateType {
+    CompositingUpdateNone,
+    CompositingUpdateAfterGeometryChange,
+    CompositingUpdateAfterCompositingInputChange,
+    CompositingUpdateRebuildTree,
+};
+
+enum CompositingStateTransitionType {
+    NoCompositingStateChange,
+    AllocateOwnCompositedLayerMapping,
+    RemoveOwnCompositedLayerMapping,
+    PutInSquashingLayer,
+    RemoveFromSquashingLayer
+};
+
+// PaintLayerCompositor manages the hierarchy of
+// composited Layers. It determines which Layers
+// become compositing, and creates and maintains a hierarchy of
+// GraphicsLayers based on the Layer painting order.
+//
+// There is one PaintLayerCompositor per LayoutView.
+
+class CORE_EXPORT PaintLayerCompositor final : public GraphicsLayerClient {
+    WTF_MAKE_FAST_ALLOCATED(PaintLayerCompositor);
+public:
+    explicit PaintLayerCompositor(LayoutView&);
+    ~PaintLayerCompositor() override;
+
+    void updateIfNeededRecursive();
+
+    // Return true if this LayoutView is in "compositing mode" (i.e. has one or more
+    // composited Layers)
+    bool inCompositingMode() const;
+    // FIXME: Replace all callers with inCompositingMode and remove this function.
+    bool staleInCompositingMode() const;
+    // This will make a compositing layer at the root automatically, and hook up to
+    // the native view/window system.
+    void setCompositingModeEnabled(bool);
+
+    // Returns true if the accelerated compositing is enabled
+    bool hasAcceleratedCompositing() const { return m_hasAcceleratedCompositing; }
+
+    bool preferCompositingToLCDTextEnabled() const;
+
+    bool rootShouldAlwaysComposite() const;
+
+    // Copy the accelerated compositing related flags from Settings
+    void updateAcceleratedCompositingSettings();
+
+    // Used to indicate that a compositing update will be needed for the next frame that gets drawn.
+    void setNeedsCompositingUpdate(CompositingUpdateType);
+
+    void didLayout();
+
+    // Whether layer's compositedLayerMapping needs a GraphicsLayer to clip z-order children of the given Layer.
+    bool clipsCompositingDescendants(const PaintLayer*) const;
+
+    // Whether the given layer needs an extra 'contents' layer.
+    bool needsContentsCompositingLayer(const PaintLayer*) const;
+
+    bool supportsFixedRootBackgroundCompositing() const;
+    bool needsFixedRootBackgroundLayer(const PaintLayer*) const;
+    GraphicsLayer* fixedRootBackgroundLayer() const;
+    void setNeedsUpdateFixedBackground() { m_needsUpdateFixedBackground = true; }
+
+    // Issue paint invalidations of the appropriate layers when the given Layer starts or stops being composited.
+    void paintInvalidationOnCompositingChange(PaintLayer*);
+
+    void fullyInvalidatePaint();
+
+    PaintLayer* rootLayer() const;
+    GraphicsLayer* rootGraphicsLayer() const;
+    GraphicsLayer* frameScrollLayer() const;
+    GraphicsLayer* scrollLayer() const;
+    GraphicsLayer* containerLayer() const;
+
+    // We don't always have a root transform layer. This function lazily allocates one
+    // and returns it as required.
+    GraphicsLayer* ensureRootTransformLayer();
+
+    enum RootLayerAttachment {
+        RootLayerUnattached,
+        RootLayerAttachedViaChromeClient,
+        RootLayerAttachedViaEnclosingFrame
+    };
+
+    RootLayerAttachment rootLayerAttachment() const { return m_rootLayerAttachment; }
+    void updateRootLayerAttachment();
+    void updateRootLayerPosition();
+
+    void setIsInWindow(bool);
+
+    static PaintLayerCompositor* frameContentsCompositor(LayoutPart*);
+    // Return true if the layers changed.
+    static bool parentFrameContentLayers(LayoutPart*);
+
+    // Update the geometry of the layers used for clipping and scrolling in frames.
+    void frameViewDidChangeLocation(const IntPoint& contentsOffset);
+    void frameViewDidChangeSize();
+    void frameViewDidScroll();
+    void frameViewScrollbarsExistenceDidChange();
+    void rootFixedBackgroundsChanged();
+
+    bool scrollingLayerDidChange(PaintLayer*);
+
+    String layerTreeAsText(LayerTreeFlags);
+
+    GraphicsLayer* layerForHorizontalScrollbar() const { return m_layerForHorizontalScrollbar.get(); }
+    GraphicsLayer* layerForVerticalScrollbar() const { return m_layerForVerticalScrollbar.get(); }
+    GraphicsLayer* layerForScrollCorner() const { return m_layerForScrollCorner.get(); }
+
+    void resetTrackedPaintInvalidationRects();
+    void setTracksPaintInvalidations(bool);
+
+    String debugName(const GraphicsLayer*) override;
+    DocumentLifecycle& lifecycle() const;
+
+    bool needsUpdateDescendantDependentFlags() const { return m_needsUpdateDescendantDependentFlags; }
+    void setNeedsUpdateDescendantDependentFlags() { m_needsUpdateDescendantDependentFlags = true; }
+
+    void updatePotentialCompositingReasonsFromStyle(PaintLayer*);
+
+    // Whether the layer could ever be composited.
+    bool canBeComposited(const PaintLayer*) const;
+
+    // FIXME: Move allocateOrClearCompositedLayerMapping to CompositingLayerAssigner once we've fixed
+    // the compositing chicken/egg issues.
+    bool allocateOrClearCompositedLayerMapping(PaintLayer*, CompositingStateTransitionType compositedLayerUpdate);
+
+    void updateDirectCompositingReasons(PaintLayer*);
+
+    bool inOverlayFullscreenVideo() const { return m_inOverlayFullscreenVideo; }
+
+private:
+#if ENABLE(ASSERT)
+    void assertNoUnresolvedDirtyBits();
+#endif
+
+    // GraphicsLayerClient implementation
+    void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const IntRect&) const override;
+
+    bool isTrackingPaintInvalidations() const override;
+
+    void updateWithoutAcceleratedCompositing(CompositingUpdateType);
+    void updateIfNeeded();
+
+    void ensureRootLayer();
+    void destroyRootLayer();
+
+    void attachRootLayer(RootLayerAttachment);
+    void detachRootLayer();
+
+    void attachCompositorTimeline();
+    void detachCompositorTimeline();
+
+    void updateOverflowControlsLayers();
+
+    Page* page() const;
+
+    GraphicsLayerFactory* graphicsLayerFactory() const;
+    ScrollingCoordinator* scrollingCoordinator() const;
+
+    void enableCompositingModeIfNeeded();
+
+    bool requiresHorizontalScrollbarLayer() const;
+    bool requiresVerticalScrollbarLayer() const;
+    bool requiresScrollCornerLayer() const;
+
+    void applyOverlayFullscreenVideoAdjustmentIfNeeded();
+
+    LayoutView& m_layoutView;
+    OwnPtr<GraphicsLayer> m_rootContentLayer;
+    OwnPtr<GraphicsLayer> m_rootTransformLayer;
+
+    CompositingReasonFinder m_compositingReasonFinder;
+
+    CompositingUpdateType m_pendingUpdateType;
+
+    bool m_hasAcceleratedCompositing;
+    bool m_compositing;
+
+    // The root layer doesn't composite if it's a non-scrollable frame.
+    // So, after a layout we set this dirty bit to know that we need
+    // to recompute whether the root layer should composite even if
+    // none of its descendants composite.
+    // FIXME: Get rid of all the callers of setCompositingModeEnabled
+    // except the one in updateIfNeeded, then rename this to
+    // m_compositingDirty.
+    bool m_rootShouldAlwaysCompositeDirty;
+    bool m_needsUpdateFixedBackground;
+    bool m_isTrackingPaintInvalidations; // Used for testing.
+    bool m_inOverlayFullscreenVideo;
+    bool m_needsUpdateDescendantDependentFlags;
+
+    RootLayerAttachment m_rootLayerAttachment;
+
+    // Enclosing container layer, which clips for iframe content
+    OwnPtr<GraphicsLayer> m_containerLayer;
+    OwnPtr<GraphicsLayer> m_scrollLayer;
+
+    // Enclosing layer for overflow controls and the clipping layer
+    OwnPtr<GraphicsLayer> m_overflowControlsHostLayer;
+
+    // Layers for overflow controls
+    OwnPtr<GraphicsLayer> m_layerForHorizontalScrollbar;
+    OwnPtr<GraphicsLayer> m_layerForVerticalScrollbar;
+    OwnPtr<GraphicsLayer> m_layerForScrollCorner;
+};
+
+} // namespace blink
+
+#endif // PaintLayerCompositor_h
diff --git a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
index 846bca4..cc0cc2c 100644
--- a/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
+++ b/third_party/WebKit/Source/core/layout/line/BreakingContextInlineHeaders.h
@@ -40,7 +40,7 @@
 #include "core/layout/line/TrailingObjects.h"
 #include "core/layout/line/WordMeasurement.h"
 #include "core/layout/svg/LayoutSVGInlineText.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/text/TextBreakIterator.h"
 #include "wtf/Allocator.h"
 #include "wtf/Vector.h"
diff --git a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
index ca6e19e..b182aaf4 100644
--- a/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
+++ b/third_party/WebKit/Source/core/layout/line/InlineFlowBox.cpp
@@ -804,7 +804,7 @@
     if (textBox->knownToHaveNoOverflow())
         return;
 
-    const ComputedStyle& style = textBox->layoutObject().styleRef(isFirstLineStyle());
+    const ComputedStyle& style = textBox->lineLayoutItem().styleRef(isFirstLineStyle());
 
     GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox);
     GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? nullptr : &it->value.second;
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp
index c310e939b..c25a381 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.cpp
@@ -42,7 +42,7 @@
 
     // LayoutSVGlock, used by Layout(SVGText|ForeignObject), is not allowed to call setHasOverflowClip(true).
     // LayoutBlock assumes a layer to be present when the overflow clip functionality is requested. Both
-    // Layout(SVGText|ForeignObject) return 'NoDeprecatedPaintLayer' on 'layerTypeRequired'. Fine for LayoutSVGText.
+    // Layout(SVGText|ForeignObject) return 'NoPaintLayer' on 'layerTypeRequired'. Fine for LayoutSVGText.
     //
     // If we want to support overflow rules for <foreignObject> we can choose between two solutions:
     // a) make LayoutSVGForeignObject require layers and SVG layer aware
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.h
index 7ce310f..0654276d 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.h
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGBlock.h
@@ -37,7 +37,7 @@
 
     AffineTransform localTransform() const final { return m_localTransform; }
 
-    DeprecatedPaintLayerType layerTypeRequired() const final { return NoDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const final { return NoPaintLayer; }
 
     void invalidateTreeIfNeeded(PaintInvalidationState&) override;
 
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInline.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInline.h
index 7fc35d2..2410ed9 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGInline.h
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGInline.h
@@ -30,7 +30,7 @@
     explicit LayoutSVGInline(Element*);
 
     const char* name() const override { return "LayoutSVGInline"; }
-    DeprecatedPaintLayerType layerTypeRequired() const final { return NoDeprecatedPaintLayer; }
+    PaintLayerType layerTypeRequired() const final { return NoPaintLayer; }
     bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectSVG || type == LayoutObjectSVGInline || LayoutInline::isOfType(type); }
 
     bool isChildAllowed(LayoutObject*, const ComputedStyle&) const override;
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.cpp
index ac54ee3..29ce0ad 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.cpp
@@ -36,7 +36,7 @@
 #include "core/layout/svg/LayoutSVGRoot.h"
 #include "core/layout/svg/SVGLayoutSupport.h"
 #include "core/layout/svg/SVGResourcesCache.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/svg/SVGGraphicsElement.h"
 
 namespace blink {
@@ -90,7 +90,7 @@
     SVGLayoutSupport::findTreeRootObject(this)->computeLayerHitTestRects(rects);
 }
 
-void LayoutSVGModelObject::addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
+void LayoutSVGModelObject::addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const
 {
     // We don't walk into SVG trees at all - just report their container.
 }
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.h
index b2caa23..54fb62e 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.h
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGModelObject.h
@@ -65,7 +65,7 @@
     bool isOfType(LayoutObjectType type) const override { return type == LayoutObjectSVG || LayoutObject::isOfType(type); }
 
 protected:
-    void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const final;
+    void addLayerHitTestRects(LayerHitTestRects&, const PaintLayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containerRect) const final;
     void willBeDestroyed() override;
 
 private:
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
index dc587c8..43e91e7 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.cpp
@@ -25,7 +25,7 @@
 #include "core/layout/svg/LayoutSVGResourceMasker.h"
 #include "core/layout/svg/SVGResources.h"
 #include "core/layout/svg/SVGResourcesCache.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 
 #include "wtf/TemporaryChange.h"
 
@@ -200,14 +200,14 @@
     clearInvalidationMask();
 }
 
-void LayoutSVGResourceContainer::addClientLayer(DeprecatedPaintLayer* client)
+void LayoutSVGResourceContainer::addClientLayer(PaintLayer* client)
 {
     ASSERT(client);
     m_clientLayers.add(client);
     clearInvalidationMask();
 }
 
-void LayoutSVGResourceContainer::removeClientLayer(DeprecatedPaintLayer* client)
+void LayoutSVGResourceContainer::removeClientLayer(PaintLayer* client)
 {
     ASSERT(client);
     m_clientLayers.remove(client);
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.h b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.h
index d148464..1d8df0f 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.h
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGResourceContainer.h
@@ -35,7 +35,7 @@
     ClipperResourceType
 };
 
-class DeprecatedPaintLayer;
+class PaintLayer;
 
 class LayoutSVGResourceContainer : public LayoutSVGHiddenContainer {
 public:
@@ -61,8 +61,8 @@
 
     void idChanged();
     void addClientLayer(Node*);
-    void addClientLayer(DeprecatedPaintLayer*);
-    void removeClientLayer(DeprecatedPaintLayer*);
+    void addClientLayer(PaintLayer*);
+    void removeClientLayer(PaintLayer*);
 
     void invalidateCacheAndMarkForLayout(SubtreeLayoutScope* = nullptr);
 
@@ -105,7 +105,7 @@
     // 22 padding bits available
 
     HashSet<LayoutObject*> m_clients;
-    HashSet<DeprecatedPaintLayer*> m_clientLayers;
+    HashSet<PaintLayer*> m_clientLayers;
 };
 
 inline LayoutSVGResourceContainer* getLayoutSVGResourceContainerById(TreeScope& treeScope, const AtomicString& id)
diff --git a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp
index 5cf3b97..a36d8aa 100644
--- a/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/LayoutSVGRoot.cpp
@@ -32,7 +32,7 @@
 #include "core/layout/LayoutView.h"
 #include "core/layout/svg/SVGLayoutSupport.h"
 #include "core/layout/svg/SVGResourcesCache.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/SVGRootPainter.h"
 #include "core/svg/SVGElement.h"
 #include "core/svg/SVGSVGElement.h"
diff --git a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
index e457936..8096a3e 100644
--- a/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
+++ b/third_party/WebKit/Source/core/layout/svg/SVGLayoutSupport.cpp
@@ -38,7 +38,7 @@
 #include "core/layout/svg/LayoutSVGViewportContainer.h"
 #include "core/layout/svg/SVGResources.h"
 #include "core/layout/svg/SVGResourcesCache.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/svg/SVGElement.h"
 #include "platform/geometry/TransformState.h"
 #include "platform/graphics/StrokeData.h"
@@ -450,7 +450,7 @@
     // Continue walking up the layer tree, accumulating CSS transforms.
     // FIXME: this queries layer compositing state - which is not
     // supported during layout. Hence, the result may not include all CSS transforms.
-    DeprecatedPaintLayer* layer = layoutObject ? layoutObject->enclosingLayer() : 0;
+    PaintLayer* layer = layoutObject ? layoutObject->enclosingLayer() : 0;
     while (layer && layer->isAllowedToQueryCompositingState()) {
         // We can stop at compositing layers, to match the backing resolution.
         // FIXME: should we be computing the transform to the nearest composited layer,
diff --git a/third_party/WebKit/Source/core/loader/FrameLoader.cpp b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
index d5a59de..05fe067 100644
--- a/third_party/WebKit/Source/core/loader/FrameLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/FrameLoader.cpp
@@ -1363,7 +1363,7 @@
     if (m_provisionalDocumentLoader->isClientRedirect())
         m_provisionalDocumentLoader->appendRedirect(m_frame->document()->url());
     m_provisionalDocumentLoader->appendRedirect(m_provisionalDocumentLoader->request().url());
-    double triggeringEventTime = frameLoadRequest.triggeringEvent() ? convertDOMTimeStampToSeconds(frameLoadRequest.triggeringEvent()->timeStamp()) : 0;
+    double triggeringEventTime = frameLoadRequest.triggeringEvent() ? frameLoadRequest.triggeringEvent()->platformTimeStamp() : 0;
     client()->dispatchDidStartProvisionalLoad(triggeringEventTime);
     ASSERT(m_provisionalDocumentLoader);
     m_provisionalDocumentLoader->startLoadingMainResource();
diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp
index c014301..91ea712a 100644
--- a/third_party/WebKit/Source/core/page/Page.cpp
+++ b/third_party/WebKit/Source/core/page/Page.cpp
@@ -46,7 +46,7 @@
 #include "core/page/PointerLockController.h"
 #include "core/page/ValidationMessageClient.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/MemoryPurgeController.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/plugins/PluginData.h"
@@ -519,6 +519,7 @@
     if (m_mainFrame == frame) {
         frame->console().clearMessages();
         useCounter().didCommitLoad();
+        frameHost().visualViewport().sendUMAMetrics();
         m_originsUsingFeatures.updateMeasurementsAndClear();
         UserGestureIndicator::clearProcessedUserGestureSinceLoad();
     }
diff --git a/third_party/WebKit/Source/core/page/PrintContextTest.cpp b/third_party/WebKit/Source/core/page/PrintContextTest.cpp
index 1273918..c51acd4 100644
--- a/third_party/WebKit/Source/core/page/PrintContextTest.cpp
+++ b/third_party/WebKit/Source/core/page/PrintContextTest.cpp
@@ -12,8 +12,8 @@
 #include "core/html/HTMLIFrameElement.h"
 #include "core/layout/LayoutView.h"
 #include "core/loader/EmptyClients.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
+#include "core/paint/PaintLayer.h"
+#include "core/paint/PaintLayerPainter.h"
 #include "core/testing/DummyPageHolder.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/paint/SkPictureBuilder.h"
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
index 86e3467..c3d76cb 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.cpp
@@ -38,8 +38,8 @@
 #include "core/layout/LayoutGeometryMap.h"
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/ChromeClient.h"
 #include "core/page/Page.h"
 #include "core/plugins/PluginView.h"
@@ -236,9 +236,9 @@
         toWebLayer(layer)->setPositionConstraint(WebLayerPositionConstraint());
 }
 
-static WebLayerPositionConstraint computePositionConstraint(const DeprecatedPaintLayer* layer)
+static WebLayerPositionConstraint computePositionConstraint(const PaintLayer* layer)
 {
-    ASSERT(layer->hasCompositedDeprecatedPaintLayerMapping());
+    ASSERT(layer->hasCompositedLayerMapping());
     do {
         if (layer->layoutObject()->style()->position() == FixedPosition) {
             const LayoutObject* fixedPositionObject = layer->layoutObject();
@@ -249,22 +249,22 @@
 
         layer = layer->parent();
 
-        // Composited layers that inherit a fixed position state will be positioned with respect to the nearest compositedDeprecatedPaintLayerMapping's GraphicsLayer.
-        // So, once we find a layer that has its own compositedDeprecatedPaintLayerMapping, we can stop searching for a fixed position LayoutObject.
-    } while (layer && !layer->hasCompositedDeprecatedPaintLayerMapping());
+        // Composited layers that inherit a fixed position state will be positioned with respect to the nearest compositedLayerMapping's GraphicsLayer.
+        // So, once we find a layer that has its own compositedLayerMapping, we can stop searching for a fixed position LayoutObject.
+    } while (layer && !layer->hasCompositedLayerMapping());
     return WebLayerPositionConstraint();
 }
 
-void ScrollingCoordinator::updateLayerPositionConstraint(DeprecatedPaintLayer* layer)
+void ScrollingCoordinator::updateLayerPositionConstraint(PaintLayer* layer)
 {
-    ASSERT(layer->hasCompositedDeprecatedPaintLayerMapping());
-    CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = layer->compositedDeprecatedPaintLayerMapping();
-    GraphicsLayer* mainLayer = compositedDeprecatedPaintLayerMapping->childForSuperlayers();
+    ASSERT(layer->hasCompositedLayerMapping());
+    CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
+    GraphicsLayer* mainLayer = compositedLayerMapping->childForSuperlayers();
 
     // Avoid unnecessary commits
-    clearPositionConstraintExceptForLayer(compositedDeprecatedPaintLayerMapping->squashingContainmentLayer(), mainLayer);
-    clearPositionConstraintExceptForLayer(compositedDeprecatedPaintLayerMapping->ancestorClippingLayer(), mainLayer);
-    clearPositionConstraintExceptForLayer(compositedDeprecatedPaintLayerMapping->mainGraphicsLayer(), mainLayer);
+    clearPositionConstraintExceptForLayer(compositedLayerMapping->squashingContainmentLayer(), mainLayer);
+    clearPositionConstraintExceptForLayer(compositedLayerMapping->ancestorClippingLayer(), mainLayer);
+    clearPositionConstraintExceptForLayer(compositedLayerMapping->mainGraphicsLayer(), mainLayer);
 
     if (WebLayer* scrollableLayer = toWebLayer(mainLayer))
         scrollableLayer->setPositionConstraint(computePositionConstraint(layer));
@@ -455,7 +455,7 @@
 // Layers have child frames inside of them. This computes a mapping for the
 // current frame which we can consult while walking the layers of that frame.
 // Whenever we descend into a new frame, a new map will be created.
-using LayerFrameMap = HashMap<const DeprecatedPaintLayer*, Vector<const LocalFrame*>>;
+using LayerFrameMap = HashMap<const PaintLayer*, Vector<const LocalFrame*>>;
 static void makeLayerChildFrameMap(const LocalFrame* currentFrame, LayerFrameMap* map)
 {
     map->clear();
@@ -466,7 +466,7 @@
         const LayoutObject* ownerLayoutObject = toLocalFrame(child)->ownerLayoutObject();
         if (!ownerLayoutObject)
             continue;
-        const DeprecatedPaintLayer* containingLayer = ownerLayoutObject->enclosingLayer();
+        const PaintLayer* containingLayer = ownerLayoutObject->enclosingLayer();
         LayerFrameMap::iterator iter = map->find(containingLayer);
         if (iter == map->end())
             map->add(containingLayer, Vector<const LocalFrame*>()).storedValue->value.append(toLocalFrame(child));
@@ -476,18 +476,18 @@
 }
 
 static void projectRectsToGraphicsLayerSpaceRecursive(
-    const DeprecatedPaintLayer* curLayer,
+    const PaintLayer* curLayer,
     const LayerHitTestRects& layerRects,
     GraphicsLayerHitTestRects& graphicsRects,
     LayoutGeometryMap& geometryMap,
-    HashSet<const DeprecatedPaintLayer*>& layersWithRects,
+    HashSet<const PaintLayer*>& layersWithRects,
     LayerFrameMap& layerChildFrameMap)
 {
     // Project any rects for the current layer
     LayerHitTestRects::const_iterator layerIter = layerRects.find(curLayer);
     if (layerIter != layerRects.end()) {
         // Find the enclosing composited layer when it's in another document (for non-composited iframes).
-        const DeprecatedPaintLayer* compositedLayer = layerIter->key->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
+        const PaintLayer* compositedLayer = layerIter->key->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
         ASSERT(compositedLayer);
 
         // Find the appropriate GraphicsLayer for the composited Layer.
@@ -512,13 +512,13 @@
                 if (compositedLayer->layoutObject()->hasOverflowClip())
                     rect.move(compositedLayer->layoutBox()->scrolledContentOffset());
             }
-            DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(compositedLayer->layoutObject(), rect);
+            PaintLayer::mapRectToPaintBackingCoordinates(compositedLayer->layoutObject(), rect);
             glRects->append(rect);
         }
     }
 
     // Walk child layers of interest
-    for (const DeprecatedPaintLayer* childLayer = curLayer->firstChild(); childLayer; childLayer = childLayer->nextSibling()) {
+    for (const PaintLayer* childLayer = curLayer->firstChild(); childLayer; childLayer = childLayer->nextSibling()) {
         if (layersWithRects.contains(childLayer)) {
             geometryMap.pushMappingsToAncestor(childLayer, curLayer);
             projectRectsToGraphicsLayerSpaceRecursive(childLayer, layerRects, graphicsRects, geometryMap, layersWithRects, layerChildFrameMap);
@@ -531,7 +531,7 @@
     if (mapIter != layerChildFrameMap.end()) {
         for (size_t i = 0; i < mapIter->value.size(); i++) {
             const LocalFrame* childFrame = mapIter->value[i];
-            const DeprecatedPaintLayer* childLayer = childFrame->view()->layoutView()->layer();
+            const PaintLayer* childLayer = childFrame->view()->layoutView()->layer();
             if (layersWithRects.contains(childLayer)) {
                 LayerFrameMap newLayerChildFrameMap;
                 makeLayerChildFrameMap(childFrame, &newLayerChildFrameMap);
@@ -552,9 +552,9 @@
     // enclosing composited layer. To do this most efficiently we'll walk the Layer tree using
     // LayoutGeometryMap. First record all the branches we should traverse in the tree (including
     // all documents on the page).
-    HashSet<const DeprecatedPaintLayer*> layersWithRects;
+    HashSet<const PaintLayer*> layersWithRects;
     for (const auto& layerRect : layerRects) {
-        const DeprecatedPaintLayer* layer = layerRect.key;
+        const PaintLayer* layer = layerRect.key;
         do {
             if (!layersWithRects.add(layer).isNewEntry)
                 break;
@@ -572,7 +572,7 @@
     MapCoordinatesFlags flags = UseTransforms;
     if (touchHandlerInChildFrame)
         flags |= TraverseDocumentBoundaries;
-    DeprecatedPaintLayer* rootLayer = mainFrame->contentLayoutObject()->layer();
+    PaintLayer* rootLayer = mainFrame->contentLayoutObject()->layer();
     LayoutGeometryMap geometryMap(flags);
     geometryMap.pushMappingsToAncestor(rootLayer, 0);
     LayerFrameMap layerChildFrameMap;
@@ -615,11 +615,11 @@
     TRACE_EVENT0("input", "ScrollingCoordinator::setTouchEventTargetRects");
 
     // Update the list of layers with touch hit rects.
-    HashSet<const DeprecatedPaintLayer*> oldLayersWithTouchRects;
+    HashSet<const PaintLayer*> oldLayersWithTouchRects;
     m_layersWithTouchRects.swap(oldLayersWithTouchRects);
     for (const auto& layerRect : layerRects) {
         if (!layerRect.value.isEmpty()) {
-            const DeprecatedPaintLayer* compositedLayer = layerRect.key->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
+            const PaintLayer* compositedLayer = layerRect.key->enclosingLayerForPaintInvalidationCrossingFrameBoundaries();
             ASSERT(compositedLayer);
             m_layersWithTouchRects.add(compositedLayer);
         }
@@ -628,7 +628,7 @@
     // Ensure we have an entry for each composited layer that previously had rects (so that old
     // ones will get cleared out). Note that ideally we'd track this on GraphicsLayer instead of
     // Layer, but we have no good hook into the lifetime of a GraphicsLayer.
-    for (const DeprecatedPaintLayer* layer : oldLayersWithTouchRects) {
+    for (const PaintLayer* layer : oldLayersWithTouchRects) {
         if (!layerRects.contains(layer))
             layerRects.add(layer, Vector<LayoutRect>());
     }
@@ -667,25 +667,25 @@
     m_touchEventTargetRectsAreDirty = true;
 }
 
-void ScrollingCoordinator::updateScrollParentForGraphicsLayer(GraphicsLayer* child, DeprecatedPaintLayer* parent)
+void ScrollingCoordinator::updateScrollParentForGraphicsLayer(GraphicsLayer* child, PaintLayer* parent)
 {
     WebLayer* scrollParentWebLayer = nullptr;
-    if (parent && parent->hasCompositedDeprecatedPaintLayerMapping())
-        scrollParentWebLayer = toWebLayer(parent->compositedDeprecatedPaintLayerMapping()->scrollingContentsLayer());
+    if (parent && parent->hasCompositedLayerMapping())
+        scrollParentWebLayer = toWebLayer(parent->compositedLayerMapping()->scrollingContentsLayer());
 
     child->setScrollParent(scrollParentWebLayer);
 }
 
-void ScrollingCoordinator::updateClipParentForGraphicsLayer(GraphicsLayer* child, DeprecatedPaintLayer* parent)
+void ScrollingCoordinator::updateClipParentForGraphicsLayer(GraphicsLayer* child, PaintLayer* parent)
 {
     WebLayer* clipParentWebLayer = nullptr;
-    if (parent && parent->hasCompositedDeprecatedPaintLayerMapping())
-        clipParentWebLayer = toWebLayer(parent->compositedDeprecatedPaintLayerMapping()->parentForSublayers());
+    if (parent && parent->hasCompositedLayerMapping())
+        clipParentWebLayer = toWebLayer(parent->compositedLayerMapping()->parentForSublayers());
 
     child->setClipParent(clipParentWebLayer);
 }
 
-void ScrollingCoordinator::willDestroyLayer(DeprecatedPaintLayer* layer)
+void ScrollingCoordinator::willDestroyLayer(PaintLayer* layer)
 {
     m_layersWithTouchRects.remove(layer);
 }
@@ -873,8 +873,8 @@
             }
             if (!hasTouchEventTargetAncestor) {
                 // Walk up the tree to the outermost non-composited scrollable layer.
-                DeprecatedPaintLayer* enclosingNonCompositedScrollLayer = nullptr;
-                for (DeprecatedPaintLayer* parent = layoutObject->enclosingLayer(); parent && parent->compositingState() == NotComposited; parent = parent->parent()) {
+                PaintLayer* enclosingNonCompositedScrollLayer = nullptr;
+                for (PaintLayer* parent = layoutObject->enclosingLayer(); parent && parent->compositingState() == NotComposited; parent = parent->parent()) {
                     if (parent->scrollsOverflow())
                         enclosingNonCompositedScrollLayer = parent;
                 }
@@ -993,7 +993,7 @@
     for (const LayoutObject* layoutObject : *viewportConstrainedObjects) {
         ASSERT(layoutObject->isBoxModelObject() && layoutObject->hasLayer());
         ASSERT(layoutObject->style()->position() == FixedPosition);
-        DeprecatedPaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
+        PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
 
         // Whether the Layer scrolls with the viewport is a tree-depenent
         // property and our viewportConstrainedObjects collection is maintained
diff --git a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h
index 86632683..e292c4d 100644
--- a/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h
+++ b/third_party/WebKit/Source/core/page/scrolling/ScrollingCoordinator.h
@@ -107,12 +107,12 @@
     bool scrollableAreaScrollLayerDidChange(ScrollableArea*);
     void scrollableAreaScrollbarLayerDidChange(ScrollableArea*, ScrollbarOrientation);
     void setLayerIsContainerForFixedPositionLayers(GraphicsLayer*, bool);
-    void updateLayerPositionConstraint(DeprecatedPaintLayer*);
+    void updateLayerPositionConstraint(PaintLayer*);
     void touchEventTargetRectsDidChange();
-    void willDestroyLayer(DeprecatedPaintLayer*);
+    void willDestroyLayer(PaintLayer*);
 
-    void updateScrollParentForGraphicsLayer(GraphicsLayer* child, DeprecatedPaintLayer* parent);
-    void updateClipParentForGraphicsLayer(GraphicsLayer* child, DeprecatedPaintLayer* parent);
+    void updateScrollParentForGraphicsLayer(GraphicsLayer* child, PaintLayer* parent);
+    void updateClipParentForGraphicsLayer(GraphicsLayer* child, PaintLayer* parent);
 
     static String mainThreadScrollingReasonsAsText(MainThreadScrollingReasons);
     String mainThreadScrollingReasonsAsText() const;
@@ -160,7 +160,7 @@
     using ScrollbarMap = WillBeHeapHashMap<RawPtrWillBeMember<ScrollableArea>, OwnPtr<WebScrollbarLayer>>;
     ScrollbarMap m_horizontalScrollbars;
     ScrollbarMap m_verticalScrollbars;
-    HashSet<const DeprecatedPaintLayer*> m_layersWithTouchRects;
+    HashSet<const PaintLayer*> m_layersWithTouchRects;
     bool m_wasFrameScrollable;
 
     MainThreadScrollingReasons m_lastMainThreadScrollingReasons;
diff --git a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
index bc31870..9121c83 100644
--- a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
+++ b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
@@ -8,8 +8,8 @@
 #include "core/layout/LayoutBox.h"
 #include "core/layout/LayoutBoxModelObject.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/LayoutUnit.h"
 #include "platform/geometry/LayoutRect.h"
 
@@ -47,11 +47,11 @@
     if (globalPaintFlags & GlobalPaintFlattenCompositingLayers)
         return false;
 
-    DeprecatedPaintLayer* rootLayer = view.layer();
+    PaintLayer* rootLayer = view.layer();
     if (!rootLayer || rootLayer->compositingState() == NotComposited)
         return false;
 
-    return rootLayer->compositedDeprecatedPaintLayerMapping()->backgroundLayerPaintsFixedRootBackground();
+    return rootLayer->compositedLayerMapping()->backgroundLayerPaintsFixedRootBackground();
 }
 
 IntSize calculateFillTileSize(const LayoutBoxModelObject& obj, const FillLayer& fillLayer, const IntSize& positioningAreaSize)
diff --git a/third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp b/third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp
index e070153..f2211c1 100644
--- a/third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BlockFlowPainter.cpp
@@ -8,9 +8,9 @@
 #include "core/layout/FloatingObjects.h"
 #include "core/layout/LayoutBlockFlow.h"
 #include "core/paint/ClipScope.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 
 namespace blink {
 
@@ -74,7 +74,7 @@
         skipRecording ? nullptr : &(*clipScope));
     // TODO(wkorman): Rework below to process paint invalidation rects during layout rather than paint.
     if (!gapRectsBounds.isEmpty()) {
-        DeprecatedPaintLayer* layer = m_layoutBlockFlow.enclosingLayer();
+        PaintLayer* layer = m_layoutBlockFlow.enclosingLayer();
         gapRectsBounds.moveBy(-paintOffset);
         if (!m_layoutBlockFlow.hasLayer()) {
             LayoutRect localBounds(gapRectsBounds);
diff --git a/third_party/WebKit/Source/core/paint/BlockPainter.cpp b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
index a7f0298..35459944 100644
--- a/third_party/WebKit/Source/core/paint/BlockPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BlockPainter.cpp
@@ -15,11 +15,11 @@
 #include "core/page/Page.h"
 #include "core/paint/BoxClipper.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/InlinePainter.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/LineBoxListPainter.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/ScopeRecorder.h"
 #include "core/paint/ScrollRecorder.h"
 #include "core/paint/ScrollableAreaPainter.h"
@@ -40,7 +40,7 @@
     // There are some cases where not all clipped visual overflow is accounted for.
     // FIXME: reduce the number of such cases.
     ContentsClipBehavior contentsClipBehavior = ForceContentsClip;
-    if (m_layoutBlock.hasOverflowClip() && !m_layoutBlock.hasControlClip() && !(m_layoutBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForeground) && !hasCaret())
+    if (m_layoutBlock.hasOverflowClip() && !m_layoutBlock.hasControlClip() && !(m_layoutBlock.shouldPaintSelectionGaps() && originalPhase == PaintPhaseForeground) && !m_layoutBlock.hasCaret())
         contentsClipBehavior = SkipContentsClipIfPossible;
 
     if (localPaintInfo.phase == PaintPhaseOutline) {
@@ -209,7 +209,7 @@
 
     // If the caret's node's layout object's containing block is this block, and the paint action is PaintPhaseForeground,
     // then paint the caret.
-    if (paintPhase == PaintPhaseForeground && hasCaret() && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutBlock, DisplayItem::Caret, paintOffset)) {
+    if (paintPhase == PaintPhaseForeground && m_layoutBlock.hasCaret() && !LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layoutBlock, DisplayItem::Caret, paintOffset)) {
         LayoutRect bounds = m_layoutBlock.visualOverflowRect();
         bounds.moveBy(paintOffset);
         LayoutObjectDrawingRecorder recorder(*paintInfo.context, m_layoutBlock, DisplayItem::Caret, bounds, paintOffset);
@@ -217,33 +217,15 @@
     }
 }
 
-static inline bool caretBrowsingEnabled(const LocalFrame* frame)
-{
-    Settings* settings = frame->settings();
-    return settings && settings->caretBrowsingEnabled();
-}
-
-static inline bool hasCursorCaret(const FrameSelection& selection, const LayoutBlock* block, const LocalFrame* frame)
-{
-    return selection.caretLayoutObject() == block && (selection.hasEditableStyle() || caretBrowsingEnabled(frame));
-}
-
-static inline bool hasDragCaret(const DragCaretController& dragCaretController, const LayoutBlock* block, const LocalFrame* frame)
-{
-    return dragCaretController.caretLayoutObject() == block && (dragCaretController.isContentEditable() || caretBrowsingEnabled(frame));
-}
-
 void BlockPainter::paintCarets(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     LocalFrame* frame = m_layoutBlock.frame();
 
-    FrameSelection& selection = frame->selection();
-    if (hasCursorCaret(selection, &m_layoutBlock, frame))
-        selection.paintCaret(paintInfo.context, paintOffset, LayoutRect(paintInfo.rect));
+    if (m_layoutBlock.hasCursorCaret())
+        frame->selection().paintCaret(paintInfo.context, paintOffset, LayoutRect(paintInfo.rect));
 
-    DragCaretController& dragCaretController = frame->page()->dragCaretController();
-    if (hasDragCaret(dragCaretController, &m_layoutBlock, frame))
-        dragCaretController.paintDragCaret(frame, paintInfo.context, paintOffset, LayoutRect(paintInfo.rect));
+    if (m_layoutBlock.hasDragCaret())
+        frame->page()->dragCaretController().paintDragCaret(frame, paintInfo.context, paintOffset, LayoutRect(paintInfo.rect));
 }
 
 bool BlockPainter::intersectsPaintRect(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
@@ -258,13 +240,6 @@
     return (overflowRect.intersects(LayoutRect(paintInfo.rect)));
 }
 
-bool BlockPainter::hasCaret() const
-{
-    LocalFrame* frame = m_layoutBlock.frame();
-    return hasCursorCaret(frame->selection(), &m_layoutBlock, frame)
-        || hasDragCaret(frame->page()->dragCaretController(), &m_layoutBlock, frame);
-}
-
 void BlockPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     // Avoid painting descendants of the root element when stylesheets haven't loaded. This eliminates FOUC.
diff --git a/third_party/WebKit/Source/core/paint/BlockPainter.h b/third_party/WebKit/Source/core/paint/BlockPainter.h
index bd941c7..066b96a 100644
--- a/third_party/WebKit/Source/core/paint/BlockPainter.h
+++ b/third_party/WebKit/Source/core/paint/BlockPainter.h
@@ -40,7 +40,6 @@
     bool intersectsPaintRect(const PaintInfo&, const LayoutPoint& paintOffset) const;
 
 private:
-    bool hasCaret() const;
     void paintCarets(const PaintInfo&, const LayoutPoint&);
     void paintContents(const PaintInfo&, const LayoutPoint&);
 
diff --git a/third_party/WebKit/Source/core/paint/BoxClipper.cpp b/third_party/WebKit/Source/core/paint/BoxClipper.cpp
index f1d83cc..0e29877 100644
--- a/third_party/WebKit/Source/core/paint/BoxClipper.cpp
+++ b/third_party/WebKit/Source/core/paint/BoxClipper.cpp
@@ -6,8 +6,8 @@
 #include "core/paint/BoxClipper.h"
 
 #include "core/layout/LayoutBox.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/graphics/paint/ClipDisplayItem.h"
diff --git a/third_party/WebKit/Source/core/paint/BoxPainter.cpp b/third_party/WebKit/Source/core/paint/BoxPainter.cpp
index 6eedef73..d7f2736 100644
--- a/third_party/WebKit/Source/core/paint/BoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/BoxPainter.cpp
@@ -15,16 +15,16 @@
 #include "core/layout/LayoutTable.h"
 #include "core/layout/LayoutTheme.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
 #include "core/style/BorderEdge.h"
 #include "core/style/ShadowList.h"
 #include "core/paint/BackgroundImageGeometry.h"
 #include "core/paint/BoxBorderPainter.h"
 #include "core/paint/BoxDecorationData.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/NinePieceImagePainter.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/RoundedInnerRectClipper.h"
 #include "core/paint/ThemePainter.h"
 #include "platform/LengthFunctions.h"
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayer.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayer.cpp
deleted file mode 100644
index f8ef6df..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayer.cpp
+++ /dev/null
@@ -1,2745 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#include "config.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-
-#include "core/CSSPropertyNames.h"
-#include "core/HTMLNames.h"
-#include "core/css/PseudoStyleRequest.h"
-#include "core/dom/Document.h"
-#include "core/dom/shadow/ShadowRoot.h"
-#include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h"
-#include "core/frame/FrameView.h"
-#include "core/frame/LocalFrame.h"
-#include "core/html/HTMLFrameElement.h"
-#include "core/layout/HitTestRequest.h"
-#include "core/layout/HitTestResult.h"
-#include "core/layout/HitTestingTransformState.h"
-#include "core/layout/LayoutFlowThread.h"
-#include "core/layout/LayoutGeometryMap.h"
-#include "core/layout/LayoutInline.h"
-#include "core/layout/LayoutPart.h"
-#include "core/layout/LayoutReplica.h"
-#include "core/layout/LayoutScrollbar.h"
-#include "core/layout/LayoutScrollbarPart.h"
-#include "core/layout/LayoutTreeAsText.h"
-#include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/layout/svg/LayoutSVGRoot.h"
-#include "core/layout/svg/ReferenceFilterBuilder.h"
-#include "core/page/Page.h"
-#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/paint/FilterEffectBuilder.h"
-#include "platform/LengthFunctions.h"
-#include "platform/RuntimeEnabledFeatures.h"
-#include "platform/TraceEvent.h"
-#include "platform/geometry/FloatPoint3D.h"
-#include "platform/geometry/FloatRect.h"
-#include "platform/geometry/TransformState.h"
-#include "platform/graphics/filters/Filter.h"
-#include "platform/graphics/filters/SourceGraphic.h"
-#include "platform/transforms/ScaleTransformOperation.h"
-#include "platform/transforms/TransformationMatrix.h"
-#include "platform/transforms/TranslateTransformOperation.h"
-#include "public/platform/Platform.h"
-#include "wtf/Partitions.h"
-#include "wtf/StdLibExtras.h"
-#include "wtf/text/CString.h"
-
-namespace blink {
-
-namespace {
-
-static CompositingQueryMode gCompositingQueryMode =
-    CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases;
-
-} // namespace
-
-using namespace HTMLNames;
-
-DeprecatedPaintLayer::DeprecatedPaintLayer(LayoutBoxModelObject* layoutObject, DeprecatedPaintLayerType type)
-    : m_layerType(type)
-    , m_hasSelfPaintingLayerDescendant(false)
-    , m_hasSelfPaintingLayerDescendantDirty(false)
-    , m_isRootLayer(layoutObject->isLayoutView())
-    , m_visibleContentStatusDirty(true)
-    , m_hasVisibleContent(false)
-    , m_visibleDescendantStatusDirty(false)
-    , m_hasVisibleDescendant(false)
-    , m_hasVisibleNonLayerContent(false)
-#if ENABLE(ASSERT)
-    , m_needsPositionUpdate(true)
-#endif
-    , m_3DTransformedDescendantStatusDirty(true)
-    , m_has3DTransformedDescendant(false)
-    , m_containsDirtyOverlayScrollbars(false)
-    , m_hasFilterInfo(false)
-    , m_needsAncestorDependentCompositingInputsUpdate(true)
-    , m_needsDescendantDependentCompositingInputsUpdate(true)
-    , m_childNeedsCompositingInputsUpdate(true)
-    , m_hasCompositingDescendant(false)
-    , m_hasNonCompositedChild(false)
-    , m_shouldIsolateCompositedDescendants(false)
-    , m_lostGroupedMapping(false)
-    , m_needsRepaint(false)
-    , m_layoutObject(layoutObject)
-    , m_parent(0)
-    , m_previous(0)
-    , m_next(0)
-    , m_first(0)
-    , m_last(0)
-    , m_staticInlinePosition(0)
-    , m_staticBlockPosition(0)
-    , m_enclosingPaginationLayer(0)
-    , m_potentialCompositingReasonsFromStyle(CompositingReasonNone)
-    , m_compositingReasons(CompositingReasonNone)
-    , m_groupedMapping(0)
-    , m_clipper(*layoutObject)
-{
-    updateStackingNode();
-
-    m_isSelfPaintingLayer = shouldBeSelfPaintingLayer();
-
-    if (!layoutObject->slowFirstChild() && layoutObject->style()) {
-        m_visibleContentStatusDirty = false;
-        m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE;
-    }
-
-    updateScrollableArea();
-}
-
-DeprecatedPaintLayer::~DeprecatedPaintLayer()
-{
-    if (layoutObject()->frame() && layoutObject()->frame()->page()) {
-        if (ScrollingCoordinator* scrollingCoordinator = layoutObject()->frame()->page()->scrollingCoordinator())
-            scrollingCoordinator->willDestroyLayer(this);
-    }
-
-    removeFilterInfoIfNeeded();
-
-    if (groupedMapping()) {
-        DisableCompositingQueryAsserts disabler;
-        setGroupedMapping(0, InvalidateLayerAndRemoveFromMapping);
-    }
-
-    // Child layers will be deleted by their corresponding layout objects, so
-    // we don't need to delete them ourselves.
-
-    clearCompositedDeprecatedPaintLayerMapping(true);
-
-    if (m_reflectionInfo)
-        m_reflectionInfo->destroy();
-
-    if (m_scrollableArea)
-        m_scrollableArea->dispose();
-}
-
-String DeprecatedPaintLayer::debugName() const
-{
-    if (isReflection())
-        return layoutObject()->parent()->debugName() + " (reflection)";
-    return layoutObject()->debugName();
-}
-
-DeprecatedPaintLayerCompositor* DeprecatedPaintLayer::compositor() const
-{
-    if (!layoutObject()->view())
-        return 0;
-    return layoutObject()->view()->compositor();
-}
-
-void DeprecatedPaintLayer::contentChanged(ContentChangeType changeType)
-{
-    // updateLayerCompositingState will query compositingReasons for accelerated overflow scrolling.
-    // This is tripped by LayoutTests/compositing/content-changed-chicken-egg.html
-    DisableCompositingQueryAsserts disabler;
-
-    if (changeType == CanvasChanged)
-        compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange);
-
-    if (changeType == CanvasContextChanged) {
-        compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange);
-
-        // Although we're missing test coverage, we need to call
-        // GraphicsLayer::setContentsToPlatformLayer with the new platform
-        // layer for this canvas.
-        // See http://crbug.com/349195
-        if (hasCompositedDeprecatedPaintLayerMapping())
-            compositedDeprecatedPaintLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
-    }
-
-    if (m_compositedDeprecatedPaintLayerMapping)
-        m_compositedDeprecatedPaintLayerMapping->contentChanged(changeType);
-}
-
-bool DeprecatedPaintLayer::paintsWithFilters() const
-{
-    if (!layoutObject()->hasFilter())
-        return false;
-
-    // https://code.google.com/p/chromium/issues/detail?id=343759
-    DisableCompositingQueryAsserts disabler;
-    return !m_compositedDeprecatedPaintLayerMapping || compositingState() != PaintsIntoOwnBacking;
-}
-
-bool DeprecatedPaintLayer::paintsWithBackdropFilters() const
-{
-    if (!layoutObject()->hasBackdropFilter())
-        return false;
-
-    // https://code.google.com/p/chromium/issues/detail?id=343759
-    DisableCompositingQueryAsserts disabler;
-    return !m_compositedDeprecatedPaintLayerMapping || compositingState() != PaintsIntoOwnBacking;
-}
-
-LayoutSize DeprecatedPaintLayer::subpixelAccumulation() const
-{
-    return m_subpixelAccumulation;
-}
-
-void DeprecatedPaintLayer::setSubpixelAccumulation(const LayoutSize& size)
-{
-    m_subpixelAccumulation = size;
-}
-
-void DeprecatedPaintLayer::updateLayerPositionsAfterLayout()
-{
-    TRACE_EVENT0("blink,benchmark", "DeprecatedPaintLayer::updateLayerPositionsAfterLayout");
-
-    m_clipper.clearClipRectsIncludingDescendants();
-    updateLayerPositionRecursive();
-
-    {
-        // FIXME: Remove incremental compositing updates after fixing the chicken/egg issues
-        // https://code.google.com/p/chromium/issues/detail?id=343756
-        DisableCompositingQueryAsserts disabler;
-        updatePaginationRecursive(enclosingPaginationLayer());
-    }
-}
-
-void DeprecatedPaintLayer::updateLayerPositionRecursive()
-{
-    updateLayerPosition();
-
-    if (m_reflectionInfo)
-        m_reflectionInfo->reflection()->layout();
-
-    // FIXME(400589): We would like to do this in DeprecatedPaintLayerScrollableArea::updateAfterLayout,
-    // but it depends on the size computed by updateLayerPosition.
-    if (m_scrollableArea) {
-        if (ScrollAnimator* scrollAnimator = m_scrollableArea->existingScrollAnimator())
-            scrollAnimator->updateAfterLayout();
-    }
-
-    // FIXME: We should be able to remove this call because we don't care about
-    // any descendant-dependent flags, but code somewhere else is reading these
-    // flags and depending on us to update them.
-    updateDescendantDependentFlags();
-
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling())
-        child->updateLayerPositionRecursive();
-}
-
-void DeprecatedPaintLayer::updateHasSelfPaintingLayerDescendant() const
-{
-    ASSERT(m_hasSelfPaintingLayerDescendantDirty);
-
-    m_hasSelfPaintingLayerDescendant = false;
-
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling()) {
-        if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) {
-            m_hasSelfPaintingLayerDescendant = true;
-            break;
-        }
-    }
-
-    m_hasSelfPaintingLayerDescendantDirty = false;
-}
-
-void DeprecatedPaintLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus()
-{
-    for (DeprecatedPaintLayer* layer = this; layer; layer = layer->parent()) {
-        layer->m_hasSelfPaintingLayerDescendantDirty = true;
-        // If we have reached a self-painting layer, we know our parent should have a self-painting descendant
-        // in this case, there is no need to dirty our ancestors further.
-        if (layer->isSelfPaintingLayer()) {
-            ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->m_hasSelfPaintingLayerDescendant);
-            break;
-        }
-    }
-}
-
-bool DeprecatedPaintLayer::scrollsWithViewport() const
-{
-    return layoutObject()->style()->position() == FixedPosition && layoutObject()->containerForFixedPosition() == layoutObject()->view();
-}
-
-bool DeprecatedPaintLayer::scrollsWithRespectTo(const DeprecatedPaintLayer* other) const
-{
-    if (scrollsWithViewport() != other->scrollsWithViewport())
-        return true;
-    return ancestorScrollingLayer() != other->ancestorScrollingLayer();
-}
-
-void DeprecatedPaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta)
-{
-    m_clipper.clearClipRectsIncludingDescendants();
-    updateLayerPositionsAfterScrollRecursive(scrollDelta, isPaintInvalidationContainer());
-}
-
-void DeprecatedPaintLayer::updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled)
-{
-    updateLayerPosition();
-    if (paintInvalidationContainerWasScrolled && !isPaintInvalidationContainer()) {
-        // Paint invalidation rects are in the coordinate space of the paint invalidation container.
-        // If it has scrolled, the rect must be adjusted. Note that it is not safe to reset it to
-        // the current bounds rect, as the LayoutObject may have moved since the last invalidation.
-        // FIXME(416535): Ideally, pending invalidations of scrolling content should be stored in
-        // the coordinate space of the scrolling content layer, so that they need no adjustment.
-        m_layoutObject->adjustPreviousPaintInvalidationForScrollIfNeeded(scrollDelta);
-    }
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling()) {
-        child->updateLayerPositionsAfterScrollRecursive(scrollDelta,
-            paintInvalidationContainerWasScrolled && !child->isPaintInvalidationContainer());
-    }
-}
-
-void DeprecatedPaintLayer::updateTransformationMatrix()
-{
-    if (m_transform) {
-        LayoutBox* box = layoutBox();
-        ASSERT(box);
-        m_transform->makeIdentity();
-        box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedSize()), ComputedStyle::IncludeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
-        makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositing());
-    }
-}
-
-void DeprecatedPaintLayer::updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& newStyle)
-{
-    if (oldStyle && newStyle.transformDataEquivalent(*oldStyle))
-        return;
-
-    // hasTransform() on the layoutObject is also true when there is transform-style: preserve-3d or perspective set,
-    // so check style too.
-    bool hasTransform = layoutObject()->hasTransformRelatedProperty() && newStyle.hasTransform();
-    bool had3DTransform = has3DTransform();
-
-    bool hadTransform = m_transform;
-    if (hasTransform != hadTransform) {
-        if (hasTransform)
-            m_transform = adoptPtr(new TransformationMatrix);
-        else
-            m_transform.clear();
-
-        // DeprecatedPaintLayers with transforms act as clip rects roots, so clear the cached clip rects here.
-        m_clipper.clearClipRectsIncludingDescendants();
-    } else if (hasTransform) {
-        m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects);
-    }
-
-    updateTransformationMatrix();
-
-    if (had3DTransform != has3DTransform())
-        dirty3DTransformedDescendantStatus();
-}
-
-static DeprecatedPaintLayer* enclosingLayerForContainingBlock(DeprecatedPaintLayer* layer)
-{
-    if (LayoutObject* containingBlock = layer->layoutObject()->containingBlock())
-        return containingBlock->enclosingLayer();
-    return 0;
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::renderingContextRoot()
-{
-    DeprecatedPaintLayer* renderingContext = 0;
-
-    if (shouldPreserve3D())
-        renderingContext = this;
-
-    for (DeprecatedPaintLayer* current = enclosingLayerForContainingBlock(this); current && current->shouldPreserve3D(); current = enclosingLayerForContainingBlock(current))
-        renderingContext = current;
-
-    return renderingContext;
-}
-
-TransformationMatrix DeprecatedPaintLayer::currentTransform() const
-{
-    if (!m_transform)
-        return TransformationMatrix();
-    return *m_transform;
-}
-
-TransformationMatrix DeprecatedPaintLayer::renderableTransform(GlobalPaintFlags globalPaintFlags) const
-{
-    if (!m_transform)
-        return TransformationMatrix();
-
-    if (globalPaintFlags & GlobalPaintFlattenCompositingLayers) {
-        TransformationMatrix matrix = *m_transform;
-        makeMatrixRenderable(matrix, false /* flatten 3d */);
-        return matrix;
-    }
-
-    return *m_transform;
-}
-
-// Convert a bounding box from flow thread coordinates, relative to |layer|, to visual coordinates, relative to |ancestorLayer|.
-// See http://www.chromium.org/developers/design-documents/multi-column-layout for more info on these coordinate types.
-static void convertFromFlowThreadToVisualBoundingBoxInAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer, LayoutRect& rect)
-{
-    DeprecatedPaintLayer* paginationLayer = layer->enclosingPaginationLayer();
-    ASSERT(paginationLayer);
-    LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->layoutObject());
-
-    // First make the flow thread rectangle relative to the flow thread, not to |layer|.
-    LayoutPoint offsetWithinPaginationLayer;
-    layer->convertToLayerCoords(paginationLayer, offsetWithinPaginationLayer);
-    rect.moveBy(offsetWithinPaginationLayer);
-
-    // Then make the rectangle visual, relative to the fragmentation context. Split our box up into
-    // the actual fragment boxes that layout in the columns/pages and unite those together to get
-    // our true bounding box.
-    rect = flowThread->fragmentsBoundingBox(rect);
-
-    // Finally, make the visual rectangle relative to |ancestorLayer|.
-    if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) {
-        rect.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer));
-        return;
-    }
-    // The ancestor layer is inside the same pagination layer as |layer|, so we need to subtract
-    // the visual distance from the ancestor layer to the pagination layer.
-    rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer));
-}
-
-void DeprecatedPaintLayer::updatePaginationRecursive(bool needsPaginationUpdate)
-{
-    m_enclosingPaginationLayer = 0;
-
-    if (layoutObject()->isLayoutFlowThread())
-        needsPaginationUpdate = true;
-
-    if (needsPaginationUpdate) {
-        // Each paginated layer has to paint on its own. There is no recurring into child layers. Each
-        // layer has to be checked individually and genuinely know if it is going to have to split
-        // itself up when painting only its contents (and not any other descendant layers). We track an
-        // enclosingPaginationLayer instead of using a simple bit, since we want to be able to get back
-        // to that layer easily.
-        if (LayoutFlowThread* containingFlowThread = layoutObject()->flowThreadContainingBlock())
-            m_enclosingPaginationLayer = containingFlowThread->layer();
-    }
-
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling())
-        child->updatePaginationRecursive(needsPaginationUpdate);
-}
-
-void DeprecatedPaintLayer::clearPaginationRecursive()
-{
-    m_enclosingPaginationLayer = 0;
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling())
-        child->clearPaginationRecursive();
-}
-
-LayoutPoint DeprecatedPaintLayer::positionFromPaintInvalidationBacking(const LayoutObject* layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState)
-{
-    FloatPoint point = layoutObject->localToContainerPoint(FloatPoint(), paintInvalidationContainer, 0, 0, paintInvalidationState);
-
-    // FIXME: Eventually we are going to unify coordinates in GraphicsLayer space.
-    if (paintInvalidationContainer && paintInvalidationContainer->layer()->groupedMapping())
-        mapPointToPaintBackingCoordinates(paintInvalidationContainer, point);
-
-    return LayoutPoint(point);
-}
-
-void DeprecatedPaintLayer::mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* paintInvalidationContainer, FloatPoint& point)
-{
-    DeprecatedPaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer();
-    if (!paintInvalidationLayer->groupedMapping()) {
-        point.move(paintInvalidationLayer->compositedDeprecatedPaintLayerMapping()->contentOffsetInCompositingLayer());
-        return;
-    }
-
-    LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosingTransformedAncestor()->layoutObject();
-    if (!transformedAncestor)
-        return;
-
-    // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the
-    // transformed ancestor.
-    point = paintInvalidationContainer->localToContainerPoint(point, transformedAncestor);
-
-    point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTransformedAncestor());
-}
-
-void DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect)
-{
-    DeprecatedPaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer();
-    if (!paintInvalidationLayer->groupedMapping()) {
-        rect.move(paintInvalidationLayer->compositedDeprecatedPaintLayerMapping()->contentOffsetInCompositingLayer());
-        return;
-    }
-
-    LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosingTransformedAncestor()->layoutObject();
-    if (!transformedAncestor)
-        return;
-
-    // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the
-    // transformed ancestor.
-    rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect(rect), transformedAncestor).boundingBox());
-
-    rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTransformedAncestor());
-}
-
-void DeprecatedPaintLayer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState)
-{
-    if (!paintInvalidationContainer->layer()->groupedMapping()) {
-        layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paintInvalidationState);
-        return;
-    }
-
-    // This code adjusts the paint invalidation rectangle to be in the space of the transformed ancestor of the grouped (i.e. squashed)
-    // layer. This is because all layers that squash together need to issue paint invalidations w.r.t. a single container that is
-    // an ancestor of all of them, in order to properly take into account any local transforms etc.
-    // FIXME: remove this special-case code that works around the paint invalidation code structure.
-    layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paintInvalidationState);
-
-    mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
-}
-
-LayoutRect DeprecatedPaintLayer::computePaintInvalidationRect(const LayoutObject* layoutObject, const DeprecatedPaintLayer* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState)
-{
-    if (!paintInvalidationContainer->groupedMapping())
-        return layoutObject->computePaintInvalidationRect(paintInvalidationContainer->layoutObject(), paintInvalidationState);
-
-    LayoutRect rect = layoutObject->clippedOverflowRectForPaintInvalidation(paintInvalidationContainer->layoutObject(), paintInvalidationState);
-    mapRectToPaintBackingCoordinates(paintInvalidationContainer->layoutObject(), rect);
-    return rect;
-}
-
-void DeprecatedPaintLayer::dirtyVisibleContentStatus()
-{
-    compositor()->setNeedsUpdateDescendantDependentFlags();
-    m_visibleContentStatusDirty = true;
-    if (parent())
-        parent()->dirtyAncestorChainVisibleDescendantStatus();
-    // Non-self-painting layers paint into their ancestor layer, and count as part of the "visible contents" of the parent, so we need to dirty it.
-    if (!isSelfPaintingLayer())
-        parent()->dirtyVisibleContentStatus();
-}
-
-void DeprecatedPaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility)
-{
-    if (m_visibleContentStatusDirty)
-        return;
-    if (hasVisibleContent() == (visibility == VISIBLE))
-        return;
-    dirtyVisibleContentStatus();
-}
-
-void DeprecatedPaintLayer::dirtyAncestorChainVisibleDescendantStatus()
-{
-    compositor()->setNeedsUpdateDescendantDependentFlags();
-
-    for (DeprecatedPaintLayer* layer = this; layer; layer = layer->parent()) {
-        if (layer->m_visibleDescendantStatusDirty)
-            break;
-        layer->m_visibleDescendantStatusDirty = true;
-    }
-}
-
-// FIXME: this is quite brute-force. We could be more efficient if we were to
-// track state and update it as appropriate as changes are made in the layout tree.
-void DeprecatedPaintLayer::updateScrollingStateAfterCompositingChange()
-{
-    TRACE_EVENT0("blink", "DeprecatedPaintLayer::updateScrollingStateAfterCompositingChange");
-    m_hasVisibleNonLayerContent = false;
-    for (LayoutObject* r = layoutObject()->slowFirstChild(); r; r = r->nextSibling()) {
-        if (!r->hasLayer()) {
-            m_hasVisibleNonLayerContent = true;
-            break;
-        }
-    }
-
-    m_hasNonCompositedChild = false;
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling()) {
-        if (child->compositingState() == NotComposited) {
-            m_hasNonCompositedChild = true;
-            return;
-        }
-    }
-}
-
-void DeprecatedPaintLayer::updateDescendantDependentFlags()
-{
-    if (m_visibleDescendantStatusDirty) {
-        m_hasVisibleDescendant = false;
-
-        for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling()) {
-            child->updateDescendantDependentFlags();
-
-            if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) {
-                m_hasVisibleDescendant = true;
-                break;
-            }
-        }
-
-        m_visibleDescendantStatusDirty = false;
-    }
-
-    if (m_visibleContentStatusDirty) {
-        bool previouslyHasVisibleContent = m_hasVisibleContent;
-        if (layoutObject()->style()->visibility() == VISIBLE) {
-            m_hasVisibleContent = true;
-        } else {
-            // layer may be hidden but still have some visible content, check for this
-            m_hasVisibleContent = false;
-            LayoutObject* r = layoutObject()->slowFirstChild();
-            while (r) {
-                if (r->style()->visibility() == VISIBLE && (!r->hasLayer() || !r->enclosingLayer()->isSelfPaintingLayer())) {
-                    m_hasVisibleContent = true;
-                    break;
-                }
-                LayoutObject* layoutObjectFirstChild = r->slowFirstChild();
-                if (layoutObjectFirstChild && (!r->hasLayer() || !r->enclosingLayer()->isSelfPaintingLayer())) {
-                    r = layoutObjectFirstChild;
-                } else if (r->nextSibling()) {
-                    r = r->nextSibling();
-                } else {
-                    do {
-                        r = r->parent();
-                        if (r == layoutObject())
-                            r = 0;
-                    } while (r && !r->nextSibling());
-                    if (r)
-                        r = r->nextSibling();
-                }
-            }
-        }
-        m_visibleContentStatusDirty = false;
-
-        if (hasVisibleContent() != previouslyHasVisibleContent) {
-            setNeedsCompositingInputsUpdate();
-            // We need to tell m_layoutObject to recheck its rect because we
-            // pretend that invisible LayoutObjects have 0x0 rects. Changing
-            // visibility therefore changes our rect and we need to visit
-            // this LayoutObject during the invalidateTreeIfNeeded walk.
-            m_layoutObject->setMayNeedPaintInvalidation();
-        }
-    }
-}
-
-void DeprecatedPaintLayer::dirty3DTransformedDescendantStatus()
-{
-    DeprecatedPaintLayerStackingNode* stackingNode = m_stackingNode->ancestorStackingContextNode();
-    if (!stackingNode)
-        return;
-
-    stackingNode->layer()->m_3DTransformedDescendantStatusDirty = true;
-
-    // This propagates up through preserve-3d hierarchies to the enclosing flattening layer.
-    // Note that preserves3D() creates stacking context, so we can just run up the stacking containers.
-    while (stackingNode && stackingNode->layer()->preserves3D()) {
-        stackingNode->layer()->m_3DTransformedDescendantStatusDirty = true;
-        stackingNode = stackingNode->ancestorStackingContextNode();
-    }
-}
-
-// Return true if this layer or any preserve-3d descendants have 3d.
-bool DeprecatedPaintLayer::update3DTransformedDescendantStatus()
-{
-    if (m_3DTransformedDescendantStatusDirty) {
-        m_has3DTransformedDescendant = false;
-
-        m_stackingNode->updateZOrderLists();
-
-        // Transformed or preserve-3d descendants can only be in the z-order lists, not
-        // in the normal flow list, so we only need to check those.
-        DeprecatedPaintLayerStackingNodeIterator iterator(*m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren);
-        while (DeprecatedPaintLayerStackingNode* node = iterator.next())
-            m_has3DTransformedDescendant |= node->layer()->update3DTransformedDescendantStatus();
-
-        m_3DTransformedDescendantStatusDirty = false;
-    }
-
-    // If we live in a 3d hierarchy, then the layer at the root of that hierarchy needs
-    // the m_has3DTransformedDescendant set.
-    if (preserves3D())
-        return has3DTransform() || m_has3DTransformedDescendant;
-
-    return has3DTransform();
-}
-
-bool DeprecatedPaintLayer::updateLayerPosition()
-{
-    LayoutPoint localPoint;
-    LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y for inlines, so we need to subtract it out when done.
-
-    if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) {
-        LayoutInline* inlineFlow = toLayoutInline(layoutObject());
-        IntRect lineBox = inlineFlow->linesBoundingBox();
-        m_size = lineBox.size();
-        inlineBoundingBoxOffset = lineBox.location();
-        localPoint.moveBy(inlineBoundingBoxOffset);
-    } else if (LayoutBox* box = layoutBox()) {
-        m_size = pixelSnappedIntSize(box->size(), box->location());
-        localPoint.moveBy(box->topLeftLocation());
-    }
-
-    if (!layoutObject()->isOutOfFlowPositioned() && !layoutObject()->isColumnSpanAll() && layoutObject()->parent()) {
-        // We must adjust our position by walking up the layout tree looking for the
-        // nearest enclosing object with a layer.
-        LayoutObject* curr = layoutObject()->parent();
-        while (curr && !curr->hasLayer()) {
-            if (curr->isBox() && !curr->isTableRow()) {
-                // Rows and cells share the same coordinate space (that of the section).
-                // Omit them when computing our xpos/ypos.
-                localPoint.moveBy(toLayoutBox(curr)->topLeftLocation());
-            }
-            curr = curr->parent();
-        }
-        if (curr->isBox() && curr->isTableRow()) {
-            // Put ourselves into the row coordinate space.
-            localPoint.moveBy(-toLayoutBox(curr)->topLeftLocation());
-        }
-    }
-
-    // Subtract our parent's scroll offset.
-    if (DeprecatedPaintLayer* positionedParent = layoutObject()->isOutOfFlowPositioned() ? enclosingPositionedAncestor() : nullptr) {
-        // For positioned layers, we subtract out the enclosing positioned layer's scroll offset.
-        if (positionedParent->layoutObject()->hasOverflowClip()) {
-            IntSize offset = positionedParent->layoutBox()->scrolledContentOffset();
-            localPoint -= offset;
-        }
-
-        if (positionedParent->layoutObject()->isInFlowPositioned() && positionedParent->layoutObject()->isLayoutInline()) {
-            LayoutSize offset = toLayoutInline(positionedParent->layoutObject())->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject()));
-            localPoint += offset;
-        }
-    } else if (parent() && parent()->layoutObject()->hasOverflowClip()) {
-        IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset();
-        localPoint -= scrollOffset;
-    }
-
-    bool positionOrOffsetChanged = false;
-    if (layoutObject()->isInFlowPositioned()) {
-        LayoutSize newOffset = layoutObject()->offsetForInFlowPosition();
-        positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition;
-        m_offsetForInFlowPosition = newOffset;
-        localPoint.move(m_offsetForInFlowPosition);
-    } else {
-        m_offsetForInFlowPosition = LayoutSize();
-    }
-
-    // FIXME: We'd really like to just get rid of the concept of a layer rectangle and rely on the layoutObjects.
-    localPoint.moveBy(-inlineBoundingBoxOffset);
-
-    if (m_location != localPoint) {
-        positionOrOffsetChanged = true;
-        setNeedsRepaint();
-    }
-    m_location = localPoint;
-
-#if ENABLE(ASSERT)
-    m_needsPositionUpdate = false;
-#endif
-    return positionOrOffsetChanged;
-}
-
-TransformationMatrix DeprecatedPaintLayer::perspectiveTransform() const
-{
-    if (!layoutObject()->hasTransformRelatedProperty())
-        return TransformationMatrix();
-
-    const ComputedStyle& style = layoutObject()->styleRef();
-    if (!style.hasPerspective())
-        return TransformationMatrix();
-
-    TransformationMatrix t;
-    t.applyPerspective(style.perspective());
-    return t;
-}
-
-FloatPoint DeprecatedPaintLayer::perspectiveOrigin() const
-{
-    if (!layoutObject()->hasTransformRelatedProperty())
-        return FloatPoint();
-
-    const LayoutRect borderBox = toLayoutBox(layoutObject())->borderBoxRect();
-    const ComputedStyle& style = layoutObject()->styleRef();
-
-    return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox.width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.height().toFloat()));
-}
-
-static inline bool isFixedPositionedContainer(DeprecatedPaintLayer* layer)
-{
-    return layer->isRootLayer() || layer->hasTransformRelatedProperty();
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingPositionedAncestor(const DeprecatedPaintLayer* ancestor, bool* skippedAncestor) const
-{
-    ASSERT(!ancestor || skippedAncestor); // If we have specified an ancestor, surely the caller needs to know whether we skipped it.
-    if (skippedAncestor)
-        *skippedAncestor = false;
-    if (layoutObject()->style()->position() == FixedPosition) {
-        DeprecatedPaintLayer* curr = parent();
-        while (curr && !isFixedPositionedContainer(curr)) {
-            if (skippedAncestor && curr == ancestor)
-                *skippedAncestor = true;
-            curr = curr->parent();
-        }
-
-        return curr;
-    }
-
-    DeprecatedPaintLayer* curr = parent();
-    while (curr && !curr->isPositionedContainer()) {
-        if (skippedAncestor && curr == ancestor)
-            *skippedAncestor = true;
-        curr = curr->parent();
-    }
-
-    return curr;
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingTransformedAncestor() const
-{
-    DeprecatedPaintLayer* curr = parent();
-    while (curr && !curr->isRootLayer() && !curr->layoutObject()->hasTransformRelatedProperty())
-        curr = curr->parent();
-
-    return curr;
-}
-
-LayoutPoint DeprecatedPaintLayer::computeOffsetFromTransformedAncestor() const
-{
-    const AncestorDependentCompositingInputs& properties = ancestorDependentCompositingInputs();
-
-    TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
-    // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip are correct.
-    layoutObject()->mapLocalToContainer(properties.transformAncestor ? properties.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip);
-    transformState.flatten();
-    return LayoutPoint(transformState.lastPlanarPoint());
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::compositingContainer() const
-{
-    if (!stackingNode()->isTreatedAsOrStackingContext())
-        return parent();
-    if (DeprecatedPaintLayerStackingNode* ancestorStackingNode = stackingNode()->ancestorStackingContextNode())
-        return ancestorStackingNode->layer();
-    return nullptr;
-}
-
-bool DeprecatedPaintLayer::isPaintInvalidationContainer() const
-{
-    return compositingState() == PaintsIntoOwnBacking || compositingState() == PaintsIntoGroupedBacking;
-}
-
-// Note: enclosingCompositingLayer does not include squashed layers. Compositing stacking children of squashed layers
-// receive graphics layers that are parented to the compositing ancestor of the squashed layer.
-DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerWithCompositedDeprecatedPaintLayerMapping(IncludeSelfOrNot includeSelf) const
-{
-    ASSERT(isAllowedToQueryCompositingState());
-
-    if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking)
-        return const_cast<DeprecatedPaintLayer*>(this);
-
-    for (DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) {
-        if (curr->compositingState() != NotComposited && curr->compositingState() != PaintsIntoGroupedBacking)
-            return curr;
-    }
-
-    return nullptr;
-}
-
-// Return the enclosingCompositedLayerForPaintInvalidation for the given Layer
-// including crossing frame boundaries.
-DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const
-{
-    const DeprecatedPaintLayer* layer = this;
-    DeprecatedPaintLayer* compositedLayer = 0;
-    while (!compositedLayer) {
-        compositedLayer = layer->enclosingLayerForPaintInvalidation();
-        if (!compositedLayer) {
-            LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObject();
-            if (!owner)
-                break;
-            layer = owner->enclosingLayer();
-        }
-    }
-    return compositedLayer;
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingLayerForPaintInvalidation() const
-{
-    ASSERT(isAllowedToQueryCompositingState());
-
-    if (isPaintInvalidationContainer())
-        return const_cast<DeprecatedPaintLayer*>(this);
-
-    for (DeprecatedPaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) {
-        if (curr->isPaintInvalidationContainer())
-            return curr;
-    }
-
-    return nullptr;
-}
-
-void DeprecatedPaintLayer::setNeedsCompositingInputsUpdate()
-{
-    m_needsAncestorDependentCompositingInputsUpdate = true;
-    m_needsDescendantDependentCompositingInputsUpdate = true;
-
-    for (DeprecatedPaintLayer* current = this; current && !current->m_childNeedsCompositingInputsUpdate; current = current->parent())
-        current->m_childNeedsCompositingInputsUpdate = true;
-
-    compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange);
-}
-
-void DeprecatedPaintLayer::updateAncestorDependentCompositingInputs(const AncestorDependentCompositingInputs& compositingInputs)
-{
-    m_ancestorDependentCompositingInputs = compositingInputs;
-    m_needsAncestorDependentCompositingInputsUpdate = false;
-}
-
-void DeprecatedPaintLayer::updateDescendantDependentCompositingInputs(const DescendantDependentCompositingInputs& compositingInputs)
-{
-    m_descendantDependentCompositingInputs = compositingInputs;
-    m_needsDescendantDependentCompositingInputsUpdate = false;
-}
-
-void DeprecatedPaintLayer::didUpdateCompositingInputs()
-{
-    ASSERT(!needsCompositingInputsUpdate());
-    m_childNeedsCompositingInputsUpdate = false;
-    if (m_scrollableArea)
-        m_scrollableArea->updateNeedsCompositedScrolling();
-}
-
-bool DeprecatedPaintLayer::hasNonIsolatedDescendantWithBlendMode() const
-{
-    if (descendantDependentCompositingInputs().hasNonIsolatedDescendantWithBlendMode)
-        return true;
-    if (layoutObject()->isSVGRoot())
-        return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendants();
-    return false;
-}
-
-void DeprecatedPaintLayer::setCompositingReasons(CompositingReasons reasons, CompositingReasons mask)
-{
-    if ((compositingReasons() & mask) == (reasons & mask))
-        return;
-    m_compositingReasons = (reasons & mask) | (compositingReasons() & ~mask);
-}
-
-void DeprecatedPaintLayer::setHasCompositingDescendant(bool hasCompositingDescendant)
-{
-    if (m_hasCompositingDescendant == static_cast<unsigned>(hasCompositingDescendant))
-        return;
-
-    m_hasCompositingDescendant = hasCompositingDescendant;
-
-    if (hasCompositedDeprecatedPaintLayerMapping())
-        compositedDeprecatedPaintLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLocal);
-}
-
-void DeprecatedPaintLayer::setShouldIsolateCompositedDescendants(bool shouldIsolateCompositedDescendants)
-{
-    if (m_shouldIsolateCompositedDescendants == static_cast<unsigned>(shouldIsolateCompositedDescendants))
-        return;
-
-    m_shouldIsolateCompositedDescendants = shouldIsolateCompositedDescendants;
-
-    if (hasCompositedDeprecatedPaintLayerMapping())
-        compositedDeprecatedPaintLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLocal);
-}
-
-bool DeprecatedPaintLayer::hasAncestorWithFilterOutsets() const
-{
-    for (const DeprecatedPaintLayer* curr = this; curr; curr = curr->parent()) {
-        LayoutBoxModelObject* layoutObject = curr->layoutObject();
-        if (layoutObject->style()->hasFilterOutsets())
-            return true;
-    }
-    return false;
-}
-
-static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* rootLayer,
-    DeprecatedPaintLayer::TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& subPixelAccumulation, GlobalPaintFlags globalPaintFlags)
-{
-    // If we have a mask, then the clip is limited to the border box area (and there is
-    // no need to examine child layers).
-    if (!layer->layoutObject()->hasMask()) {
-        // Note: we don't have to walk z-order lists since transparent elements always establish
-        // a stacking container. This means we can just walk the layer tree directly.
-        for (DeprecatedPaintLayer* curr = layer->firstChild(); curr; curr = curr->nextSibling()) {
-            if (!layer->reflectionInfo() || layer->reflectionInfo()->reflectionLayer() != curr)
-                clipRect.unite(DeprecatedPaintLayer::transparencyClipBox(curr, rootLayer, transparencyBehavior, DeprecatedPaintLayer::DescendantsOfTransparencyClipBox, subPixelAccumulation, globalPaintFlags));
-        }
-    }
-
-    // If we have a reflection, then we need to account for that when we push the clip.  Reflect our entire
-    // current transparencyClipBox to catch all child layers.
-    // FIXME: Accelerated compositing will eventually want to do something smart here to avoid incorporating this
-    // size into the parent layer.
-    if (layer->layoutObject()->hasReflection()) {
-        LayoutPoint delta;
-        layer->convertToLayerCoords(rootLayer, delta);
-        clipRect.move(-delta.x(), -delta.y());
-        clipRect.unite(layer->layoutBox()->reflectedRect(clipRect));
-        clipRect.moveBy(delta);
-    }
-}
-
-LayoutRect DeprecatedPaintLayer::transparencyClipBox(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* rootLayer, TransparencyClipBoxBehavior transparencyBehavior,
-    TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumulation, GlobalPaintFlags globalPaintFlags)
-{
-    // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the
-    // paintDirtyRect, and that should cut down on the amount we have to paint.  Still it
-    // would be better to respect clips.
-
-    if (rootLayer != layer && ((transparencyBehavior == PaintingTransparencyClipBox && layer->paintsWithTransform(globalPaintFlags))
-        || (transparencyBehavior == HitTestingTransparencyClipBox && layer->hasTransformRelatedProperty()))) {
-        // The best we can do here is to use enclosed bounding boxes to establish a "fuzzy" enough clip to encompass
-        // the transformed layer and all of its children.
-        const DeprecatedPaintLayer* paginationLayer = transparencyMode == DescendantsOfTransparencyClipBox ? layer->enclosingPaginationLayer() : 0;
-        const DeprecatedPaintLayer* rootLayerForTransform = paginationLayer ? paginationLayer : rootLayer;
-        LayoutPoint delta;
-        layer->convertToLayerCoords(rootLayerForTransform, delta);
-
-        delta.move(subPixelAccumulation);
-        IntPoint pixelSnappedDelta = roundedIntPoint(delta);
-        TransformationMatrix transform;
-        transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y());
-        if (layer->transform())
-            transform = transform * *layer->transform();
-
-        // We don't use fragment boxes when collecting a transformed layer's bounding box, since it always
-        // paints unfragmented.
-        LayoutRect clipRect = layer->physicalBoundingBox(layer);
-        expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transparencyBehavior, subPixelAccumulation, globalPaintFlags);
-        clipRect.expand(layer->layoutObject()->style()->filterOutsets());
-        LayoutRect result = transform.mapRect(clipRect);
-        if (!paginationLayer)
-            return result;
-
-        // We have to break up the transformed extent across our columns.
-        // Split our box up into the actual fragment boxes that layout in the columns/pages and unite those together to
-        // get our true bounding box.
-        LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(paginationLayer->layoutObject());
-        result = enclosingFlowThread->fragmentsBoundingBox(result);
-
-        LayoutPoint rootLayerDelta;
-        paginationLayer->convertToLayerCoords(rootLayer, rootLayerDelta);
-        result.moveBy(rootLayerDelta);
-        return result;
-    }
-
-    LayoutRect clipRect = layer->fragmentsBoundingBox(rootLayer);
-    expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transparencyBehavior, subPixelAccumulation, globalPaintFlags);
-    clipRect.expand(layer->layoutObject()->style()->filterOutsets());
-    clipRect.move(subPixelAccumulation);
-    return clipRect;
-}
-
-LayoutRect DeprecatedPaintLayer::paintingExtent(const DeprecatedPaintLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, GlobalPaintFlags globalPaintFlags)
-{
-    return intersection(transparencyClipBox(this, rootLayer, PaintingTransparencyClipBox, RootOfTransparencyClipBox, subPixelAccumulation, globalPaintFlags), paintDirtyRect);
-}
-
-void* DeprecatedPaintLayer::operator new(size_t sz)
-{
-    return partitionAlloc(WTF::Partitions::layoutPartition(), sz);
-}
-
-void DeprecatedPaintLayer::operator delete(void* ptr)
-{
-    partitionFree(ptr);
-}
-
-void DeprecatedPaintLayer::addChild(DeprecatedPaintLayer* child, DeprecatedPaintLayer* beforeChild)
-{
-    DeprecatedPaintLayer* prevSibling = beforeChild ? beforeChild->previousSibling() : lastChild();
-    if (prevSibling) {
-        child->setPreviousSibling(prevSibling);
-        prevSibling->setNextSibling(child);
-        ASSERT(prevSibling != child);
-    } else {
-        setFirstChild(child);
-    }
-
-    if (beforeChild) {
-        beforeChild->setPreviousSibling(child);
-        child->setNextSibling(beforeChild);
-        ASSERT(beforeChild != child);
-    } else {
-        setLastChild(child);
-    }
-
-    child->m_parent = this;
-
-    setNeedsCompositingInputsUpdate();
-
-    if (!child->stackingNode()->isTreatedAsOrStackingContext() && !layoutObject()->documentBeingDestroyed())
-        compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
-
-    if (child->stackingNode()->isTreatedAsOrStackingContext() || child->firstChild()) {
-        // Dirty the z-order list in which we are contained. The ancestorStackingContextNode() can be null in the
-        // case where we're building up generated content layers. This is ok, since the lists will start
-        // off dirty in that case anyway.
-        child->stackingNode()->dirtyStackingContextZOrderLists();
-    }
-
-    // Non-self-painting children paint into this layer, so the visible contents status of this layer is affected.
-    if (!child->isSelfPaintingLayer())
-        dirtyVisibleContentStatus();
-
-    dirtyAncestorChainVisibleDescendantStatus();
-    dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
-
-    child->setNeedsRepaint();
-
-    child->updateDescendantDependentFlags();
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::removeChild(DeprecatedPaintLayer* oldChild)
-{
-    if (oldChild->previousSibling())
-        oldChild->previousSibling()->setNextSibling(oldChild->nextSibling());
-    if (oldChild->nextSibling())
-        oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling());
-
-    if (m_first == oldChild)
-        m_first = oldChild->nextSibling();
-    if (m_last == oldChild)
-        m_last = oldChild->previousSibling();
-
-    if (!oldChild->stackingNode()->isTreatedAsOrStackingContext() && !layoutObject()->documentBeingDestroyed())
-        compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
-
-    if (oldChild->stackingNode()->isTreatedAsOrStackingContext() || oldChild->firstChild()) {
-        // Dirty the z-order list in which we are contained.  When called via the
-        // reattachment process in removeOnlyThisLayer, the layer may already be disconnected
-        // from the main layer tree, so we need to null-check the
-        // |stackingContext| value.
-        oldChild->stackingNode()->dirtyStackingContextZOrderLists();
-    }
-
-    if (layoutObject()->style()->visibility() != VISIBLE)
-        dirtyVisibleContentStatus();
-
-    oldChild->setPreviousSibling(0);
-    oldChild->setNextSibling(0);
-    oldChild->m_parent = 0;
-
-    dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
-
-    oldChild->updateDescendantDependentFlags();
-
-    if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
-        dirtyAncestorChainVisibleDescendantStatus();
-
-    if (oldChild->enclosingPaginationLayer())
-        oldChild->clearPaginationRecursive();
-
-    setNeedsRepaint();
-
-    return oldChild;
-}
-
-void DeprecatedPaintLayer::removeOnlyThisLayer()
-{
-    if (!m_parent)
-        return;
-
-    if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
-        DisableCompositingQueryAsserts disabler; // We need the current compositing status.
-        if (isPaintInvalidationContainer()) {
-            // Our children will be reparented and contained by a new paint invalidation container,
-            // so need paint invalidation. CompositingUpdate can't see this layer (which has been
-            // removed) so won't do this for us.
-            DisablePaintInvalidationStateAsserts disabler;
-            layoutObject()->invalidatePaintIncludingNonCompositingDescendants();
-            layoutObject()->setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
-        }
-    }
-
-    m_clipper.clearClipRectsIncludingDescendants();
-
-    DeprecatedPaintLayer* nextSib = nextSibling();
-
-    // Remove the child reflection layer before moving other child layers.
-    // The reflection layer should not be moved to the parent.
-    if (m_reflectionInfo)
-        removeChild(m_reflectionInfo->reflectionLayer());
-
-    // Now walk our kids and reattach them to our parent.
-    DeprecatedPaintLayer* current = m_first;
-    while (current) {
-        DeprecatedPaintLayer* next = current->nextSibling();
-        removeChild(current);
-        m_parent->addChild(current, nextSib);
-
-        // FIXME: We should call a specialized version of this function.
-        current->updateLayerPositionsAfterLayout();
-        current = next;
-    }
-
-    // Remove us from the parent.
-    m_parent->removeChild(this);
-    m_layoutObject->destroyLayer();
-}
-
-void DeprecatedPaintLayer::insertOnlyThisLayer()
-{
-    if (!m_parent && layoutObject()->parent()) {
-        // We need to connect ourselves when our layoutObject() has a parent.
-        // Find our enclosingLayer and add ourselves.
-        DeprecatedPaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer();
-        ASSERT(parentLayer);
-        DeprecatedPaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer->reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNextLayer(parentLayer, layoutObject()) : 0;
-        parentLayer->addChild(this, beforeChild);
-    }
-
-    // Remove all descendant layers from the hierarchy and add them to the new position.
-    for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = curr->nextSibling())
-        curr->moveLayers(m_parent, this);
-
-    // Clear out all the clip rects.
-    m_clipper.clearClipRectsIncludingDescendants();
-}
-
-// Returns the layer reached on the walk up towards the ancestor.
-static inline const DeprecatedPaintLayer* accumulateOffsetTowardsAncestor(const DeprecatedPaintLayer* layer, const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location)
-{
-    ASSERT(ancestorLayer != layer);
-
-    const LayoutBoxModelObject* layoutObject = layer->layoutObject();
-    EPosition position = layoutObject->style()->position();
-
-    if (position == FixedPosition && (!ancestorLayer || ancestorLayer == layoutObject->view()->layer())) {
-        // If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling
-        // localToAbsolute() on the LayoutView.
-        FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), IsFixed);
-        location += LayoutSize(absPos.x(), absPos.y());
-        return ancestorLayer;
-    }
-
-    DeprecatedPaintLayer* parentLayer;
-    if (position == AbsolutePosition || position == FixedPosition) {
-        bool foundAncestorFirst;
-        parentLayer = layer->enclosingPositionedAncestor(ancestorLayer, &foundAncestorFirst);
-
-        if (foundAncestorFirst) {
-            // Found ancestorLayer before the container of the out-of-flow object, so compute offset
-            // of both relative to the container and subtract.
-
-            LayoutPoint thisCoords;
-            layer->convertToLayerCoords(parentLayer, thisCoords);
-
-            LayoutPoint ancestorCoords;
-            ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords);
-
-            location += (thisCoords - ancestorCoords);
-            return ancestorLayer;
-        }
-    } else if (layoutObject->isColumnSpanAll()) {
-        LayoutBlock* multicolContainer = layoutObject->containingBlock();
-        ASSERT(toLayoutBlockFlow(multicolContainer)->multiColumnFlowThread());
-        parentLayer = multicolContainer->layer();
-        ASSERT(parentLayer);
-    } else {
-        parentLayer = layer->parent();
-    }
-
-    if (!parentLayer)
-        return nullptr;
-
-    location += layer->location();
-    return parentLayer;
-}
-
-void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutPoint& location) const
-{
-    if (ancestorLayer == this)
-        return;
-
-    const DeprecatedPaintLayer* currLayer = this;
-    while (currLayer && currLayer != ancestorLayer)
-        currLayer = accumulateOffsetTowardsAncestor(currLayer, ancestorLayer, location);
-}
-
-void DeprecatedPaintLayer::convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutRect& rect) const
-{
-    LayoutPoint delta;
-    convertToLayerCoords(ancestorLayer, delta);
-    rect.moveBy(delta);
-}
-
-LayoutPoint DeprecatedPaintLayer::visualOffsetFromAncestor(const DeprecatedPaintLayer* ancestorLayer) const
-{
-    LayoutPoint offset;
-    if (ancestorLayer == this)
-        return offset;
-    DeprecatedPaintLayer* paginationLayer = enclosingPaginationLayer();
-    if (paginationLayer == this)
-        paginationLayer = parent()->enclosingPaginationLayer();
-    if (!paginationLayer) {
-        convertToLayerCoords(ancestorLayer, offset);
-        return offset;
-    }
-
-    LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->layoutObject());
-    convertToLayerCoords(paginationLayer, offset);
-    offset = flowThread->flowThreadPointToVisualPoint(offset);
-    if (ancestorLayer == paginationLayer)
-        return offset;
-
-    if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) {
-        offset.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer));
-    } else {
-        // The ancestor layer is also inside the pagination layer, so we need to subtract the visual
-        // distance from the ancestor layer to the pagination layer.
-        offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer));
-    }
-    return offset;
-}
-
-void DeprecatedPaintLayer::didUpdateNeedsCompositedScrolling()
-{
-    updateSelfPaintingLayer();
-}
-
-void DeprecatedPaintLayer::updateReflectionInfo(const ComputedStyle* oldStyle)
-{
-    ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle));
-    if (layoutObject()->hasReflection()) {
-        if (!m_reflectionInfo)
-            m_reflectionInfo = adoptPtr(new DeprecatedPaintLayerReflectionInfo(*layoutBox()));
-        m_reflectionInfo->updateAfterStyleChange(oldStyle);
-    } else if (m_reflectionInfo) {
-        m_reflectionInfo->destroy();
-        m_reflectionInfo = nullptr;
-    }
-}
-
-void DeprecatedPaintLayer::updateStackingNode()
-{
-    ASSERT(!m_stackingNode);
-    if (requiresStackingNode())
-        m_stackingNode = adoptPtr(new DeprecatedPaintLayerStackingNode(this));
-    else
-        m_stackingNode = nullptr;
-}
-
-void DeprecatedPaintLayer::updateScrollableArea()
-{
-    ASSERT(!m_scrollableArea);
-    if (requiresScrollableArea())
-        m_scrollableArea = DeprecatedPaintLayerScrollableArea::create(*this);
-}
-
-bool DeprecatedPaintLayer::hasOverflowControls() const
-{
-    return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollableArea->scrollCorner() || layoutObject()->style()->resize() != RESIZE_NONE);
-}
-
-void DeprecatedPaintLayer::appendSingleFragmentIgnoringPagination(DeprecatedPaintLayerFragments& fragments, const DeprecatedPaintLayer* rootLayer, const LayoutRect& dirtyRect, ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot, const LayoutSize& subPixelAccumulation)
-{
-    DeprecatedPaintLayerFragment fragment;
-    ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy, subPixelAccumulation);
-    if (respectOverflowClip == IgnoreOverflowClip)
-        clipRectsContext.setIgnoreOverflowClip();
-    clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragment.backgroundRect, fragment.foregroundRect, offsetFromRoot);
-    fragments.append(fragment);
-}
-
-void DeprecatedPaintLayer::collectFragments(DeprecatedPaintLayerFragments& fragments, const DeprecatedPaintLayer* rootLayer, const LayoutRect& dirtyRect,
-    ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot,
-    const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
-{
-    if (!enclosingPaginationLayer()) {
-        // For unpaginated layers, there is only one fragment.
-        appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect, clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy, respectOverflowClip, offsetFromRoot, subPixelAccumulation);
-        return;
-    }
-
-    // Compute our offset within the enclosing pagination layer.
-    LayoutPoint offsetWithinPaginatedLayer;
-    convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer);
-
-    // Calculate clip rects relative to the enclosingPaginationLayer. The purpose of this call is to determine our bounds clipped to intermediate
-    // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that.
-    ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy);
-    if (respectOverflowClip == IgnoreOverflowClip)
-        paginationClipRectsContext.setIgnoreOverflowClip();
-    LayoutRect layerBoundsInFlowThread;
-    ClipRect backgroundRectInFlowThread;
-    ClipRect foregroundRectInFlowThread;
-    clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect::infiniteIntRect()), layerBoundsInFlowThread,
-        backgroundRectInFlowThread, foregroundRectInFlowThread, &offsetWithinPaginatedLayer);
-
-    // Take our bounding box within the flow thread and clip it.
-    LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingBox : physicalBoundingBox(offsetWithinPaginatedLayer);
-    layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect());
-
-    // Make the dirty rect relative to the fragmentation context (multicol container, etc.).
-    LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(enclosingPaginationLayer()->layoutObject());
-    LayoutPoint offsetOfPaginationLayerFromRoot; // Visual offset from the root layer to the nearest fragmentation context.
-    bool rootLayerIsInsidePaginationLayer = rootLayer->enclosingPaginationLayer() == enclosingPaginationLayer();
-    if (rootLayerIsInsidePaginationLayer) {
-        // The root layer is in the same fragmentation context as this layer, so we need to look
-        // inside it and subtract the offset between the fragmentation context and the root layer.
-        offsetOfPaginationLayerFromRoot = -rootLayer->visualOffsetFromAncestor(enclosingPaginationLayer());
-    } else {
-        offsetOfPaginationLayerFromRoot = enclosingPaginationLayer()->visualOffsetFromAncestor(rootLayer);
-    }
-    LayoutRect dirtyRectInFlowThread(dirtyRect);
-    dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot);
-
-    // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns
-    // that intersect the actual dirtyRect as well as the pages/columns that intersect our layer's bounding box.
-    enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlowThread, dirtyRectInFlowThread);
-
-    if (fragments.isEmpty())
-        return;
-
-    // Get the parent clip rects of the pagination layer, since we need to intersect with that when painting column contents.
-    ClipRect ancestorClipRect = dirtyRect;
-    if (const DeprecatedPaintLayer* paginationParentLayer = enclosingPaginationLayer()->parent()) {
-        const DeprecatedPaintLayer* ancestorLayer = rootLayerIsInsidePaginationLayer ? paginationParentLayer : rootLayer;
-        ClipRectsContext clipRectsContext(ancestorLayer, clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy);
-        if (respectOverflowClip == IgnoreOverflowClip)
-            clipRectsContext.setIgnoreOverflowClip();
-        ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipRect(clipRectsContext);
-        if (rootLayerIsInsidePaginationLayer)
-            ancestorClipRect.moveBy(-rootLayer->visualOffsetFromAncestor(ancestorLayer));
-        ancestorClipRect.intersect(dirtyRect);
-    }
-
-    const LayoutSize subPixelAccumulationIfNeeded = offsetFromRoot ? subPixelAccumulation : LayoutSize();
-    for (size_t i = 0; i < fragments.size(); ++i) {
-        DeprecatedPaintLayerFragment& fragment = fragments.at(i);
-
-        // Set our four rects with all clipping applied that was internal to the flow thread.
-        fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThread);
-
-        // Shift to the root-relative physical position used when painting the flow thread in this fragment.
-        fragment.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromRoot + subPixelAccumulationIfNeeded);
-
-        // Intersect the fragment with our ancestor's background clip so that e.g., columns in an overflow:hidden block are
-        // properly clipped by the overflow.
-        fragment.intersect(ancestorClipRect.rect());
-
-        // Now intersect with our pagination clip. This will typically mean we're just intersecting the dirty rect with the column
-        // clip, so the column clip ends up being all we apply.
-        fragment.intersect(fragment.paginationClip);
-    }
-}
-
-static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject)
-{
-    FrameView* frameView = layoutObject->document().view();
-    if (!frameView)
-        return LayoutRect();
-
-    return LayoutRect(frameView->visibleContentRect());
-}
-
-bool DeprecatedPaintLayer::hitTest(HitTestResult& result)
-{
-    ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
-
-    // LayoutView should make sure to update layout before entering hit testing
-    ASSERT(!layoutObject()->frame()->view()->layoutPending());
-    ASSERT(!layoutObject()->document().layoutView()->needsLayout());
-
-    const HitTestRequest& request = result.hitTestRequest();
-    const HitTestLocation& hitTestLocation = result.hitTestLocation();
-
-    // Start with frameVisibleRect to ensure we include the scrollbars.
-    LayoutRect hitTestArea = frameVisibleRect(layoutObject());
-    if (request.ignoreClipping())
-        hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect()));
-
-    DeprecatedPaintLayer* insideLayer = hitTestLayer(this, 0, result, hitTestArea, hitTestLocation, false);
-    if (!insideLayer && isRootLayer()) {
-        IntRect hitRect = hitTestLocation.boundingBox();
-        bool fallback = false;
-        // If we didn't hit any layers but are still inside the document
-        // bounds, then we should fallback to hitting the document.
-        // For rect-based hit test, we do the fallback only when the hit-rect
-        // is totally within the document bounds.
-        if (hitTestArea.contains(LayoutRect(hitRect))) {
-            fallback = true;
-
-        // Mouse dragging outside the main document should also be
-        // delivered to the document.
-        // TODO(miletus): Capture behavior inconsistent with iframes
-        // crbug.com/522109.
-        // TODO(majidvp): This should apply more consistently across different event types and we
-        // should not use RequestType for it. Perhaps best for it to be done at a higher level. See
-        // http://crbug.com/505825
-        } else if ((request.active() || request.release()) && !request.isChildFrameHitTest()) {
-            fallback = true;
-        }
-        if (fallback) {
-            layoutObject()->updateHitTestResult(result, toLayoutView(layoutObject())->flipForWritingMode(hitTestLocation.point()));
-            insideLayer = this;
-
-            // Don't cache this result since it really wasn't a true hit.
-            result.setCacheable(false);
-        }
-    }
-
-    // Now determine if the result is inside an anchor - if the urlElement isn't already set.
-    Node* node = result.innerNode();
-    if (node && !result.URLElement())
-        result.setURLElement(node->enclosingLinkEventParentOrSelf());
-
-    // Now return whether we were inside this layer (this will always be true for the root
-    // layer).
-    return insideLayer;
-}
-
-Node* DeprecatedPaintLayer::enclosingElement() const
-{
-    for (LayoutObject* r = layoutObject(); r; r = r->parent()) {
-        if (Node* e = r->node())
-            return e;
-    }
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-bool DeprecatedPaintLayer::isInTopLayer() const
-{
-    Node* node = layoutObject()->node();
-    return node && node->isElementNode() && toElement(node)->isInTopLayer();
-}
-
-// Compute the z-offset of the point in the transformState.
-// This is effectively projecting a ray normal to the plane of ancestor, finding where that
-// ray intersects target, and computing the z delta between those two points.
-static double computeZOffset(const HitTestingTransformState& transformState)
-{
-    // We got an affine transform, so no z-offset
-    if (transformState.m_accumulatedTransform.isAffine())
-        return 0;
-
-    // Flatten the point into the target plane
-    FloatPoint targetPoint = transformState.mappedPoint();
-
-    // Now map the point back through the transform, which computes Z.
-    FloatPoint3D backmappedPoint = transformState.m_accumulatedTransform.mapPoint(FloatPoint3D(targetPoint));
-    return backmappedPoint.z();
-}
-
-PassRefPtr<HitTestingTransformState> DeprecatedPaintLayer::createLocalTransformState(DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer,
-    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation,
-    const HitTestingTransformState* containerTransformState,
-    const LayoutPoint& translationOffset) const
-{
-    RefPtr<HitTestingTransformState> transformState;
-    LayoutPoint offset;
-    if (containerTransformState) {
-        // If we're already computing transform state, then it's relative to the container (which we know is non-null).
-        transformState = HitTestingTransformState::create(*containerTransformState);
-        convertToLayerCoords(containerLayer, offset);
-    } else {
-        // If this is the first time we need to make transform state, then base it off of hitTestLocation,
-        // which is relative to rootLayer.
-        transformState = HitTestingTransformState::create(hitTestLocation.transformedPoint(), hitTestLocation.transformedRect(), FloatQuad(FloatRect(hitTestRect)));
-        convertToLayerCoords(rootLayer, offset);
-    }
-    offset.moveBy(translationOffset);
-
-    LayoutObject* containerLayoutObject = containerLayer ? containerLayer->layoutObject() : 0;
-    if (layoutObject()->shouldUseTransformFromContainer(containerLayoutObject)) {
-        TransformationMatrix containerTransform;
-        layoutObject()->getTransformFromContainer(containerLayoutObject, toLayoutSize(offset), containerTransform);
-        transformState->applyTransform(containerTransform, HitTestingTransformState::AccumulateTransform);
-    } else {
-        transformState->translate(offset.x(), offset.y(), HitTestingTransformState::AccumulateTransform);
-    }
-
-    return transformState;
-}
-
-
-static bool isHitCandidate(const DeprecatedPaintLayer* hitLayer, bool canDepthSort, double* zOffset, const HitTestingTransformState* transformState)
-{
-    if (!hitLayer)
-        return false;
-
-    // The hit layer is depth-sorting with other layers, so just say that it was hit.
-    if (canDepthSort)
-        return true;
-
-    // We need to look at z-depth to decide if this layer was hit.
-    if (zOffset) {
-        ASSERT(transformState);
-        // This is actually computing our z, but that's OK because the hitLayer is coplanar with us.
-        double childZOffset = computeZOffset(*transformState);
-        if (childZOffset > *zOffset) {
-            *zOffset = childZOffset;
-            return true;
-        }
-        return false;
-    }
-
-    return true;
-}
-
-// hitTestLocation and hitTestRect are relative to rootLayer.
-// A 'flattening' layer is one preserves3D() == false.
-// transformState.m_accumulatedTransform holds the transform from the containing flattening layer.
-// transformState.m_lastPlanarPoint is the hitTestLocation in the plane of the containing flattening layer.
-// transformState.m_lastPlanarQuad is the hitTestRect as a quad in the plane of the containing flattening layer.
-//
-// If zOffset is non-null (which indicates that the caller wants z offset information),
-//  *zOffset on return is the z offset of the hit point relative to the containing flattening layer.
-DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestLayer(DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult& result,
-    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, bool appliedTransform,
-    const HitTestingTransformState* transformState, double* zOffset)
-{
-    ASSERT(layoutObject()->document().lifecycle().state() >= DocumentLifecycle::CompositingClean);
-
-    if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
-        return 0;
-
-    ClipRectsCacheSlot clipRectsCacheSlot = result.hitTestRequest().ignoreClipping() ? RootRelativeClipRectsIgnoringViewportClip : RootRelativeClipRects;
-
-    // Apply a transform if we have one.
-    if (transform() && !appliedTransform) {
-        if (enclosingPaginationLayer())
-            return hitTestTransformedLayerInFragments(rootLayer, containerLayer, result, hitTestRect, hitTestLocation, transformState, zOffset, clipRectsCacheSlot);
-
-        // Make sure the parent's clip rects have been calculated.
-        if (parent()) {
-            ClipRect clipRect = clipper().backgroundClipRect(ClipRectsContext(rootLayer, clipRectsCacheSlot, IncludeOverlayScrollbarSize));
-            // Go ahead and test the enclosing clip now.
-            if (!clipRect.intersects(hitTestLocation))
-                return 0;
-        }
-
-        return hitTestLayerByApplyingTransform(rootLayer, containerLayer, result, hitTestRect, hitTestLocation, transformState, zOffset);
-    }
-
-    // Ensure our lists and 3d status are up-to-date.
-    m_stackingNode->updateLayerListsIfNeeded();
-    update3DTransformedDescendantStatus();
-
-    // The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate.
-    RefPtr<HitTestingTransformState> localTransformState;
-    if (appliedTransform) {
-        // We computed the correct state in the caller (above code), so just reference it.
-        ASSERT(transformState);
-        localTransformState = const_cast<HitTestingTransformState*>(transformState);
-    } else if (transformState || m_has3DTransformedDescendant || preserves3D()) {
-        // We need transform state for the first time, or to offset the container state, so create it here.
-        localTransformState = createLocalTransformState(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState);
-    }
-
-    // Check for hit test on backface if backface-visibility is 'hidden'
-    if (localTransformState && layoutObject()->style()->backfaceVisibility() == BackfaceVisibilityHidden) {
-        TransformationMatrix invertedMatrix = localTransformState->m_accumulatedTransform.inverse();
-        // If the z-vector of the matrix is negative, the back is facing towards the viewer.
-        if (invertedMatrix.m33() < 0)
-            return 0;
-    }
-
-    RefPtr<HitTestingTransformState> unflattenedTransformState = localTransformState;
-    if (localTransformState && !preserves3D()) {
-        // Keep a copy of the pre-flattening state, for computing z-offsets for the container
-        unflattenedTransformState = HitTestingTransformState::create(*localTransformState);
-        // This layer is flattening, so flatten the state passed to descendants.
-        localTransformState->flatten();
-    }
-
-    // The following are used for keeping track of the z-depth of the hit point of 3d-transformed
-    // descendants.
-    double localZOffset = -std::numeric_limits<double>::infinity();
-    double* zOffsetForDescendantsPtr = 0;
-    double* zOffsetForContentsPtr = 0;
-
-    bool depthSortDescendants = false;
-    if (preserves3D()) {
-        depthSortDescendants = true;
-        // Our layers can depth-test with our container, so share the z depth pointer with the container, if it passed one down.
-        zOffsetForDescendantsPtr = zOffset ? zOffset : &localZOffset;
-        zOffsetForContentsPtr = zOffset ? zOffset : &localZOffset;
-    } else if (zOffset) {
-        zOffsetForDescendantsPtr = 0;
-        // Container needs us to give back a z offset for the hit layer.
-        zOffsetForContentsPtr = zOffset;
-    }
-
-    // This variable tracks which layer the mouse ends up being inside.
-    DeprecatedPaintLayer* candidateLayer = 0;
-
-    // Begin by walking our list of positive layers from highest z-index down to the lowest z-index.
-    DeprecatedPaintLayer* hitLayer = hitTestChildren(PositiveZOrderChildren, rootLayer, result, hitTestRect, hitTestLocation,
-        localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
-    if (hitLayer) {
-        if (!depthSortDescendants)
-            return hitLayer;
-        candidateLayer = hitLayer;
-    }
-
-    // Now check our overflow objects.
-    hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, result, hitTestRect, hitTestLocation,
-        localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
-    if (hitLayer) {
-        if (!depthSortDescendants)
-            return hitLayer;
-        candidateLayer = hitLayer;
-    }
-
-    // Collect the fragments. This will compute the clip rectangles for each layer fragment.
-    DeprecatedPaintLayerFragments layerFragments;
-    if (appliedTransform)
-        appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, IncludeOverlayScrollbarSize);
-    else
-        collectFragments(layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, IncludeOverlayScrollbarSize);
-
-    if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFragments, hitTestLocation)) {
-        layoutObject()->updateHitTestResult(result, hitTestLocation.point());
-        return this;
-    }
-
-    // Next we want to see if the mouse pos is inside the child LayoutObjects of the layer. Check
-    // every fragment in reverse order.
-    if (isSelfPaintingLayer()) {
-        // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost.
-        HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation());
-        bool insideFragmentForegroundRect = false;
-        if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocation, HitTestDescendants, insideFragmentForegroundRect)
-            && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) {
-            if (result.hitTestRequest().listBased())
-                result.append(tempResult);
-            else
-                result = tempResult;
-            if (!depthSortDescendants)
-                return this;
-            // Foreground can depth-sort with descendant layers, so keep this as a candidate.
-            candidateLayer = this;
-        } else if (insideFragmentForegroundRect && result.hitTestRequest().listBased()) {
-            result.append(tempResult);
-        }
-    }
-
-    // Now check our negative z-index children.
-    hitLayer = hitTestChildren(NegativeZOrderChildren, rootLayer, result, hitTestRect, hitTestLocation,
-        localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
-    if (hitLayer) {
-        if (!depthSortDescendants)
-            return hitLayer;
-        candidateLayer = hitLayer;
-    }
-
-    // If we found a layer, return. Child layers, and foreground always render in front of background.
-    if (candidateLayer)
-        return candidateLayer;
-
-    if (isSelfPaintingLayer()) {
-        HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation());
-        bool insideFragmentBackgroundRect = false;
-        if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocation, HitTestSelf, insideFragmentBackgroundRect)
-            && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) {
-            if (result.isRectBasedTest())
-                result.append(tempResult);
-            else
-                result = tempResult;
-            return this;
-        }
-        if (insideFragmentBackgroundRect && result.hitTestRequest().listBased())
-            result.append(tempResult);
-    }
-
-    return 0;
-}
-
-bool DeprecatedPaintLayer::hitTestContentsForFragments(const DeprecatedPaintLayerFragments& layerFragments, HitTestResult& result,
-    const HitTestLocation& hitTestLocation, HitTestFilter hitTestFilter, bool& insideClipRect) const
-{
-    if (layerFragments.isEmpty())
-        return false;
-
-    for (int i = layerFragments.size() - 1; i >= 0; --i) {
-        const DeprecatedPaintLayerFragment& fragment = layerFragments.at(i);
-        if ((hitTestFilter == HitTestSelf && !fragment.backgroundRect.intersects(hitTestLocation))
-            || (hitTestFilter == HitTestDescendants && !fragment.foregroundRect.intersects(hitTestLocation)))
-            continue;
-        insideClipRect = true;
-        if (hitTestContents(result, fragment.layerBounds, hitTestLocation, hitTestFilter))
-            return true;
-    }
-
-    return false;
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestTransformedLayerInFragments(DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult& result,
-    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset, ClipRectsCacheSlot clipRectsCacheSlot)
-{
-    DeprecatedPaintLayerFragments enclosingPaginationFragments;
-    LayoutPoint offsetOfPaginationLayerFromRoot;
-    // FIXME: We're missing a sub-pixel offset here crbug.com/348728
-    LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, DeprecatedPaintLayer::RootOfTransparencyClipBox, LayoutSize());
-    enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, rootLayer, hitTestRect,
-        clipRectsCacheSlot, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
-
-    for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
-        const DeprecatedPaintLayerFragment& fragment = enclosingPaginationFragments.at(i);
-
-        // Apply the page/column clip for this fragment, as well as any clips established by layers in between us and
-        // the enclosing pagination layer.
-        LayoutRect clipRect = fragment.backgroundRect.rect();
-
-        // Now compute the clips within a given fragment
-        if (parent() != enclosingPaginationLayer()) {
-            enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPaginationLayerFromRoot);
-            LayoutRect parentClipRect = clipper().backgroundClipRect(ClipRectsContext(enclosingPaginationLayer(), clipRectsCacheSlot, IncludeOverlayScrollbarSize)).rect();
-            parentClipRect.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromRoot);
-            clipRect.intersect(parentClipRect);
-        }
-
-        if (!hitTestLocation.intersects(clipRect))
-            continue;
-
-        DeprecatedPaintLayer* hitLayer = hitTestLayerByApplyingTransform(rootLayer, containerLayer, result, hitTestRect, hitTestLocation,
-            transformState, zOffset, fragment.paginationOffset);
-        if (hitLayer)
-            return hitLayer;
-    }
-
-    return 0;
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestLayerByApplyingTransform(DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult& result,
-    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset,
-    const LayoutPoint& translationOffset)
-{
-    // Create a transform state to accumulate this transform.
-    RefPtr<HitTestingTransformState> newTransformState = createLocalTransformState(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState, translationOffset);
-
-    // If the transform can't be inverted, then don't hit test this layer at all.
-    if (!newTransformState->m_accumulatedTransform.isInvertible())
-        return 0;
-
-    // Compute the point and the hit test rect in the coords of this layer by using the values
-    // from the transformState, which store the point and quad in the coords of the last flattened
-    // layer, and the accumulated transform which lets up map through preserve-3d layers.
-    //
-    // We can't just map hitTestLocation and hitTestRect because they may have been flattened (losing z)
-    // by our container.
-    FloatPoint localPoint = newTransformState->mappedPoint();
-    FloatQuad localPointQuad = newTransformState->mappedQuad();
-    LayoutRect localHitTestRect = newTransformState->boundsOfMappedArea();
-    HitTestLocation newHitTestLocation;
-    if (hitTestLocation.isRectBasedTest())
-        newHitTestLocation = HitTestLocation(localPoint, localPointQuad);
-    else
-        newHitTestLocation = HitTestLocation(localPoint);
-
-    // Now do a hit test with the root layer shifted to be us.
-    return hitTestLayer(this, containerLayer, result, localHitTestRect, newHitTestLocation, true, newTransformState.get(), zOffset);
-}
-
-bool DeprecatedPaintLayer::hitTestContents(HitTestResult& result, const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation, HitTestFilter hitTestFilter) const
-{
-    ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
-
-    if (!layoutObject()->hitTest(result, hitTestLocation, toLayoutPoint(layerBounds.location() - layoutBoxLocation()), hitTestFilter)) {
-        // It's wrong to set innerNode, but then claim that you didn't hit anything, unless it is
-        // a rect-based test.
-        ASSERT(!result.innerNode() || (result.hitTestRequest().listBased() && result.listBasedTestResult().size()));
-        return false;
-    }
-
-    if (!result.innerNode()) {
-        // We hit something anonymous, and we didn't find a DOM node ancestor in this layer.
-
-        if (layoutObject()->isLayoutFlowThread()) {
-            // For a flow thread it's safe to just say that we didn't hit anything. That means that
-            // we'll continue as normally, and eventually hit a column set sibling instead. Column
-            // sets are also anonymous, but, unlike flow threads, they don't establish layers, so
-            // we'll fall back and hit the multicol container parent (which should have a DOM node).
-            return false;
-        }
-
-        Node* e = enclosingElement();
-        // FIXME: should be a call to result.setNodeAndPosition. What we would really want to do here is to
-        // return and look for the nearest non-anonymous ancestor, and ignore aunts and uncles on
-        // our way. It's bad to look for it manually like we do here, and give up on setting a local
-        // point in the result, because that has bad implications for text selection and
-        // caretRangeFromPoint(). See crbug.com/461791
-        if (!result.innerNode())
-            result.setInnerNode(e);
-
-    }
-    return true;
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayer::hitTestChildren(ChildrenIteration childrentoVisit, DeprecatedPaintLayer* rootLayer,
-    HitTestResult& result,
-    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation,
-    const HitTestingTransformState* transformState,
-    double* zOffsetForDescendants, double* zOffset,
-    const HitTestingTransformState* unflattenedTransformState,
-    bool depthSortDescendants)
-{
-    if (!hasSelfPaintingLayerDescendant())
-        return 0;
-
-    DeprecatedPaintLayer* resultLayer = 0;
-    DeprecatedPaintLayerStackingNodeReverseIterator iterator(*m_stackingNode, childrentoVisit);
-    while (DeprecatedPaintLayerStackingNode* child = iterator.next()) {
-        DeprecatedPaintLayer* childLayer = child->layer();
-        DeprecatedPaintLayer* hitLayer = 0;
-        HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation());
-        hitLayer = childLayer->hitTestLayer(rootLayer, this, tempResult, hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants);
-
-        // If it is a list-based test, we can safely append the temporary result since it might had hit
-        // nodes but not necesserily had hitLayer set.
-        ASSERT(!result.isRectBasedTest() || result.hitTestRequest().listBased());
-        if (result.hitTestRequest().listBased())
-            result.append(tempResult);
-
-        if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) {
-            resultLayer = hitLayer;
-            if (!result.hitTestRequest().listBased())
-                result = tempResult;
-            if (!depthSortDescendants)
-                break;
-        }
-    }
-
-    return resultLayer;
-}
-
-void DeprecatedPaintLayer::blockSelectionGapsBoundsChanged()
-{
-    if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
-        return;
-
-    setNeedsCompositingInputsUpdate();
-}
-
-void DeprecatedPaintLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds)
-{
-    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
-        return;
-    m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds));
-    blockSelectionGapsBoundsChanged();
-}
-
-void DeprecatedPaintLayer::clearBlockSelectionGapsBounds()
-{
-    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
-        return;
-    m_blockSelectionGapsBounds = IntRect();
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling())
-        child->clearBlockSelectionGapsBounds();
-    blockSelectionGapsBoundsChanged();
-}
-
-void DeprecatedPaintLayer::invalidatePaintForBlockSelectionGaps()
-{
-    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
-        return;
-
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling()) {
-        // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
-        DisablePaintInvalidationStateAsserts disabler;
-        child->invalidatePaintForBlockSelectionGaps();
-    }
-
-    if (m_blockSelectionGapsBounds.isEmpty())
-        return;
-
-    LayoutRect rect(m_blockSelectionGapsBounds);
-    if (layoutObject()->hasOverflowClip()) {
-        LayoutBox* box = layoutBox();
-        rect.move(-box->scrolledContentOffset());
-        if (!scrollableArea()->usesCompositedScrolling())
-            rect.intersect(box->overflowClipRect(LayoutPoint()));
-    }
-    if (layoutObject()->hasClip())
-        rect.intersect(toLayoutBox(layoutObject())->clipRect(LayoutPoint()));
-    if (!rect.isEmpty()) {
-        // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
-        DisablePaintInvalidationStateAsserts disabler;
-        layoutObject()->invalidatePaintRectangle(rect);
-    }
-}
-
-IntRect DeprecatedPaintLayer::blockSelectionGapsBounds() const
-{
-    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
-        return IntRect();
-
-    if (!layoutObject()->isLayoutBlockFlow())
-        return IntRect();
-
-    LayoutBlockFlow* layoutBlockFlow = toLayoutBlockFlow(layoutObject());
-    LayoutRect gapRects = layoutBlockFlow->selectionGapRectsForPaintInvalidation(layoutBlockFlow);
-
-    return pixelSnappedIntRect(gapRects);
-}
-
-bool DeprecatedPaintLayer::hasBlockSelectionGapBounds() const
-{
-    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
-        return false;
-
-    // FIXME: it would be more accurate to return !blockSelectionGapsBounds().isEmpty(), but this is impossible
-    // at the moment because it causes invalid queries to layout-dependent code (crbug.com/372802).
-    // ASSERT(layoutObject()->document().lifecycle().state() >= DocumentLifecycle::LayoutClean);
-
-    if (!layoutObject()->isLayoutBlock())
-        return false;
-
-    return toLayoutBlock(layoutObject())->shouldPaintSelectionGaps();
-}
-
-bool DeprecatedPaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const LayoutPoint& offsetFromRoot) const
-{
-    // Always examine the canvas and the root.
-    // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the LayoutView
-    // paints the root's background.
-    if (isRootLayer() || layoutObject()->isDocumentElement())
-        return true;
-
-    // If we aren't an inline flow, and our layer bounds do intersect the damage rect, then we
-    // can go ahead and return true.
-    LayoutView* view = layoutObject()->view();
-    ASSERT(view);
-    if (view && !layoutObject()->isLayoutInline()) {
-        if (layerBounds.intersects(damageRect))
-            return true;
-    }
-
-    // Otherwise we need to compute the bounding box of this single layer and see if it intersects
-    // the damage rect.
-    return physicalBoundingBox(offsetFromRoot).intersects(damageRect);
-}
-
-LayoutRect DeprecatedPaintLayer::logicalBoundingBox() const
-{
-    return layoutObject()->visualOverflowRect();
-}
-
-static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, LayoutObject* layoutObjects)
-{
-    LayoutRect result = boundingBox;
-    if (layoutObjects->isBox())
-        toLayoutBox(layoutObjects)->flipForWritingMode(result);
-    else
-        layoutObjects->containingBlock()->flipForWritingMode(result);
-    return result;
-}
-
-LayoutRect DeprecatedPaintLayer::physicalBoundingBox(const DeprecatedPaintLayer* ancestorLayer) const
-{
-    LayoutPoint offsetFromRoot;
-    convertToLayerCoords(ancestorLayer, offsetFromRoot);
-    return physicalBoundingBox(offsetFromRoot);
-}
-
-LayoutRect DeprecatedPaintLayer::physicalBoundingBox(const LayoutPoint& offsetFromRoot) const
-{
-    LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutObject());
-    result.moveBy(offsetFromRoot);
-    return result;
-}
-
-LayoutRect DeprecatedPaintLayer::fragmentsBoundingBox(const DeprecatedPaintLayer* ancestorLayer) const
-{
-    if (!enclosingPaginationLayer())
-        return physicalBoundingBox(ancestorLayer);
-
-    LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutObject());
-    convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, result);
-    return result;
-}
-
-LayoutRect DeprecatedPaintLayer::boundingBoxForCompositingOverlapTest() const
-{
-    // Apply NeverIncludeTransformForAncestorLayer, because the geometry map in CompositingInputsUpdater will take care of applying the
-    // transform of |this| (== the ancestorLayer argument to boundingBoxForCompositing).
-    return overlapBoundsIncludeChildren() ? boundingBoxForCompositing(this, NeverIncludeTransformForAncestorLayer) : fragmentsBoundingBox(this);
-}
-
-static void expandRectForReflectionAndStackingChildren(const DeprecatedPaintLayer* ancestorLayer, LayoutRect& result)
-{
-    if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->reflectionLayer()->hasCompositedDeprecatedPaintLayerMapping())
-        result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundingBoxForCompositing(ancestorLayer));
-
-    ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer->stackingNode()->hasPositiveZOrderList());
-
-#if ENABLE(ASSERT)
-    LayerListMutationDetector mutationChecker(const_cast<DeprecatedPaintLayer*>(ancestorLayer)->stackingNode());
-#endif
-
-    DeprecatedPaintLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), AllChildren);
-    while (DeprecatedPaintLayerStackingNode* node = iterator.next()) {
-        // Here we exclude both directly composited layers and squashing layers
-        // because those Layers don't paint into the graphics layer
-        // for this Layer. For example, the bounds of squashed Layers
-        // will be included in the computation of the appropriate squashing
-        // GraphicsLayer.
-        if (node->layer()->compositingState() != NotComposited)
-            continue;
-        result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer));
-    }
-}
-
-LayoutRect DeprecatedPaintLayer::physicalBoundingBoxIncludingReflectionAndStackingChildren(const LayoutPoint& offsetFromRoot) const
-{
-    LayoutRect result = physicalBoundingBox(LayoutPoint());
-
-    const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
-
-    expandRectForReflectionAndStackingChildren(this, result);
-
-    result.moveBy(offsetFromRoot);
-    return result;
-}
-
-LayoutRect DeprecatedPaintLayer::boundingBoxForCompositing(const DeprecatedPaintLayer* ancestorLayer, CalculateBoundsOptions options) const
-{
-    if (!isSelfPaintingLayer())
-        return LayoutRect();
-
-    if (!ancestorLayer)
-        ancestorLayer = this;
-
-    // FIXME: This could be improved to do a check like hasVisibleNonCompositingDescendantLayers() (bug 92580).
-    if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant())
-        return LayoutRect();
-
-    // The root layer is always just the size of the document.
-    if (isRootLayer())
-        return LayoutRect(m_layoutObject->view()->unscaledDocumentRect());
-
-    // The layer created for the LayoutFlowThread is just a helper for painting and hit-testing,
-    // and should not contribute to the bounding box. The LayoutMultiColumnSets will contribute
-    // the correct size for the layout content of the multicol container.
-    if (layoutObject()->isLayoutFlowThread())
-        return LayoutRect();
-
-    LayoutRect result = clipper().localClipRect();
-    // TODO(chrishtr): avoid converting to IntRect and back.
-    if (result == LayoutRect(LayoutRect::infiniteIntRect())) {
-        result = physicalBoundingBox(LayoutPoint());
-
-        const_cast<DeprecatedPaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
-
-        // Reflections are implemented with Layers that hang off of the reflected layer. However,
-        // the reflection layer subtree does not include the subtree of the parent Layer, so
-        // a recursive computation of stacking children yields no results. This breaks cases when there are stacking
-        // children of the parent, that need to be included in reflected composited bounds.
-        // Fix this by including composited bounds of stacking children of the reflected Layer.
-        if (hasCompositedDeprecatedPaintLayerMapping() && parent() && parent()->reflectionInfo() && parent()->reflectionInfo()->reflectionLayer() == this)
-            expandRectForReflectionAndStackingChildren(parent(), result);
-        else
-            expandRectForReflectionAndStackingChildren(this, result);
-
-        // FIXME: We can optimize the size of the composited layers, by not enlarging
-        // filtered areas with the outsets if we know that the filter is going to render in hardware.
-        // https://bugs.webkit.org/show_bug.cgi?id=81239
-        result.expand(m_layoutObject->style()->filterOutsets());
-    }
-
-    if (transform() && paintsWithTransform(GlobalPaintNormalPhase) && (this != ancestorLayer || options == MaybeIncludeTransformForAncestorLayer))
-        result = transform()->mapRect(result);
-
-    if (enclosingPaginationLayer()) {
-        convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, result);
-        return result;
-    }
-    LayoutPoint delta;
-    convertToLayerCoords(ancestorLayer, delta);
-    result.moveBy(delta);
-    return result;
-}
-
-CompositingState DeprecatedPaintLayer::compositingState() const
-{
-    ASSERT(isAllowedToQueryCompositingState());
-
-    // This is computed procedurally so there is no redundant state variable that
-    // can get out of sync from the real actual compositing state.
-
-    if (m_groupedMapping) {
-        ASSERT(!m_compositedDeprecatedPaintLayerMapping);
-        return PaintsIntoGroupedBacking;
-    }
-
-    if (!m_compositedDeprecatedPaintLayerMapping)
-        return NotComposited;
-
-    return PaintsIntoOwnBacking;
-}
-
-bool DeprecatedPaintLayer::isAllowedToQueryCompositingState() const
-{
-    if (gCompositingQueryMode == CompositingQueriesAreAllowed || RuntimeEnabledFeatures::slimmingPaintV2Enabled())
-        return true;
-    return layoutObject()->document().lifecycle().state() >= DocumentLifecycle::InCompositingUpdate;
-}
-
-CompositedDeprecatedPaintLayerMapping* DeprecatedPaintLayer::compositedDeprecatedPaintLayerMapping() const
-{
-    ASSERT(isAllowedToQueryCompositingState());
-    return m_compositedDeprecatedPaintLayerMapping.get();
-}
-
-GraphicsLayer* DeprecatedPaintLayer::graphicsLayerBacking() const
-{
-    switch (compositingState()) {
-    case NotComposited:
-        return 0;
-    case PaintsIntoGroupedBacking:
-        return groupedMapping()->squashingLayer();
-    default:
-        return compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer();
-    }
-}
-
-GraphicsLayer* DeprecatedPaintLayer::graphicsLayerBackingForScrolling() const
-{
-    switch (compositingState()) {
-    case NotComposited:
-        return 0;
-    case PaintsIntoGroupedBacking:
-        return groupedMapping()->squashingLayer();
-    default:
-        return compositedDeprecatedPaintLayerMapping()->scrollingContentsLayer() ? compositedDeprecatedPaintLayerMapping()->scrollingContentsLayer() : compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer();
-    }
-}
-
-void DeprecatedPaintLayer::ensureCompositedDeprecatedPaintLayerMapping()
-{
-    if (m_compositedDeprecatedPaintLayerMapping)
-        return;
-
-    m_compositedDeprecatedPaintLayerMapping = adoptPtr(new CompositedDeprecatedPaintLayerMapping(*this));
-    m_compositedDeprecatedPaintLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
-
-    updateOrRemoveFilterEffectBuilder();
-}
-
-void DeprecatedPaintLayer::clearCompositedDeprecatedPaintLayerMapping(bool layerBeingDestroyed)
-{
-    if (!layerBeingDestroyed) {
-        // We need to make sure our decendants get a geometry update. In principle,
-        // we could call setNeedsGraphicsLayerUpdate on our children, but that would
-        // require walking the z-order lists to find them. Instead, we over-invalidate
-        // by marking our parent as needing a geometry update.
-        if (DeprecatedPaintLayer* compositingParent = enclosingLayerWithCompositedDeprecatedPaintLayerMapping(ExcludeSelf))
-            compositingParent->compositedDeprecatedPaintLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
-    }
-
-    m_compositedDeprecatedPaintLayerMapping.clear();
-
-    if (!layerBeingDestroyed)
-        updateOrRemoveFilterEffectBuilder();
-}
-
-void DeprecatedPaintLayer::setGroupedMapping(CompositedDeprecatedPaintLayerMapping* groupedMapping, SetGroupMappingOptions options)
-{
-    if (groupedMapping == m_groupedMapping)
-        return;
-
-    if (options == InvalidateLayerAndRemoveFromMapping && m_groupedMapping) {
-        m_groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
-        m_groupedMapping->removeLayerFromSquashingGraphicsLayer(this);
-    }
-    m_groupedMapping = groupedMapping;
-    ASSERT(!m_groupedMapping || m_groupedMapping->verifyLayerInSquashingVector(this));
-    if (options == InvalidateLayerAndRemoveFromMapping && m_groupedMapping)
-        m_groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
-}
-
-bool DeprecatedPaintLayer::hasCompositedMask() const
-{
-    return m_compositedDeprecatedPaintLayerMapping && m_compositedDeprecatedPaintLayerMapping->hasMaskLayer();
-}
-
-bool DeprecatedPaintLayer::hasCompositedClippingMask() const
-{
-    return m_compositedDeprecatedPaintLayerMapping && m_compositedDeprecatedPaintLayerMapping->hasChildClippingMaskLayer();
-}
-
-bool DeprecatedPaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const
-{
-    return (transform() || layoutObject()->style()->position() == FixedPosition) && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingState() != PaintsIntoOwnBacking);
-}
-
-bool DeprecatedPaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
-{
-    if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
-        return false;
-
-    if (paintsWithTransparency(GlobalPaintNormalPhase))
-        return false;
-
-    // We can't use hasVisibleContent(), because that will be true if our layoutObject is hidden, but some child
-    // is visible and that child doesn't cover the entire rect.
-    if (layoutObject()->style()->visibility() != VISIBLE)
-        return false;
-
-    if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAffectsOpacity())
-        return false;
-
-    // FIXME: Handle simple transforms.
-    if (paintsWithTransform(GlobalPaintNormalPhase))
-        return false;
-
-    // FIXME: Remove this check.
-    // This function should not be called when layer-lists are dirty.
-    // It is somehow getting triggered during style update.
-    if (m_stackingNode->zOrderListsDirty())
-        return false;
-
-    // FIXME: We currently only check the immediate layoutObject,
-    // which will miss many cases.
-    if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect))
-        return true;
-
-    // We can't consult child layers if we clip, since they might cover
-    // parts of the rect that are clipped out.
-    if (layoutObject()->hasOverflowClip())
-        return false;
-
-    return childBackgroundIsKnownToBeOpaqueInRect(localRect);
-}
-
-bool DeprecatedPaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
-{
-    DeprecatedPaintLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, PositiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren);
-    while (DeprecatedPaintLayerStackingNode* child = revertseIterator.next()) {
-        const DeprecatedPaintLayer* childLayer = child->layer();
-        // Stop at composited paint boundaries.
-        if (childLayer->isPaintInvalidationContainer())
-            continue;
-
-        if (!childLayer->canUseConvertToLayerCoords())
-            continue;
-
-        LayoutPoint childOffset;
-        LayoutRect childLocalRect(localRect);
-        childLayer->convertToLayerCoords(this, childOffset);
-        childLocalRect.moveBy(-childOffset);
-
-        if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect))
-            return true;
-    }
-    return false;
-}
-
-bool DeprecatedPaintLayer::shouldBeSelfPaintingLayer() const
-{
-    if (layoutObject()->isLayoutPart() && toLayoutPart(layoutObject())->requiresAcceleratedCompositing())
-        return true;
-    return m_layerType == NormalDeprecatedPaintLayer
-        || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars())
-        || needsCompositedScrolling();
-}
-
-void DeprecatedPaintLayer::updateSelfPaintingLayer()
-{
-    bool isSelfPaintingLayer = shouldBeSelfPaintingLayer();
-    if (this->isSelfPaintingLayer() == isSelfPaintingLayer)
-        return;
-
-    m_isSelfPaintingLayer = isSelfPaintingLayer;
-
-    if (parent())
-        parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
-}
-
-bool DeprecatedPaintLayer::hasNonEmptyChildLayoutObjects() const
-{
-    // Some HTML can cause whitespace text nodes to have layoutObjects, like:
-    // <div>
-    // <img src=...>
-    // </div>
-    // so test for 0x0 LayoutTexts here
-    for (LayoutObject* child = layoutObject()->slowFirstChild(); child; child = child->nextSibling()) {
-        if (!child->hasLayer()) {
-            if (child->isLayoutInline() || !child->isBox())
-                return true;
-
-            if (toLayoutBox(child)->size().width() > 0 || toLayoutBox(child)->size().height() > 0)
-                return true;
-        }
-    }
-    return false;
-}
-
-bool DeprecatedPaintLayer::hasBoxDecorationsOrBackground() const
-{
-    return layoutObject()->style()->hasBoxDecorations() || layoutObject()->style()->hasBackground();
-}
-
-bool DeprecatedPaintLayer::hasVisibleBoxDecorations() const
-{
-    if (!hasVisibleContent())
-        return false;
-
-    return hasBoxDecorationsOrBackground() || hasOverflowControls();
-}
-
-void DeprecatedPaintLayer::updateFilters(const ComputedStyle* oldStyle, const ComputedStyle& newStyle)
-{
-    if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter()))
-        return;
-
-    updateOrRemoveFilterClients();
-    updateOrRemoveFilterEffectBuilder();
-}
-
-bool DeprecatedPaintLayer::attemptDirectCompositingUpdate(StyleDifference diff, const ComputedStyle* oldStyle)
-{
-    CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialCompositingReasonsFromStyle;
-    compositor()->updatePotentialCompositingReasonsFromStyle(this);
-
-    // This function implements an optimization for transforms and opacity.
-    // A common pattern is for a touchmove handler to update the transform
-    // and/or an opacity of an element every frame while the user moves their
-    // finger across the screen. The conditions below recognize when the
-    // compositing state is set up to receive a direct transform or opacity
-    // update.
-
-    if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformChanged | StyleDifference::OpacityChanged))
-        return false;
-    // The potentialCompositingReasonsFromStyle could have changed without
-    // a corresponding StyleDifference if an animation started or ended.
-    if (m_potentialCompositingReasonsFromStyle != oldPotentialCompositingReasonsFromStyle)
-        return false;
-    // We could add support for reflections if we updated the transform on
-    // the reflection layers.
-    if (layoutObject()->hasReflection())
-        return false;
-    // If we're unwinding a scheduleSVGFilterLayerUpdateHack(), then we can't
-    // perform a direct compositing update because the filters code is going
-    // to produce different output this time around. We can remove this code
-    // once we fix the chicken/egg bugs in the filters code and delete the
-    // scheduleSVGFilterLayerUpdateHack().
-    if (layoutObject()->node() && layoutObject()->node()->svgFilterNeedsLayerUpdate())
-        return false;
-    if (!m_compositedDeprecatedPaintLayerMapping)
-        return false;
-
-    // To cut off almost all the work in the compositing update for
-    // this case, we treat inline transforms has having assumed overlap
-    // (similar to how we treat animated transforms). Notice that we read
-    // CompositingReasonInlineTransform from the m_compositingReasons, which
-    // means that the inline transform actually triggered assumed overlap in
-    // the overlap map.
-    if (diff.transformChanged() && !(m_compositingReasons & CompositingReasonInlineTransform))
-        return false;
-
-    // We composite transparent Layers differently from non-transparent
-    // Layers even when the non-transparent Layers are already a
-    // stacking context.
-    if (diff.opacityChanged() && m_layoutObject->style()->hasOpacity() != oldStyle->hasOpacity())
-        return false;
-
-    // Changes in pointer-events affect hit test visibility of the scrollable
-    // area and its |m_scrollsOverflow| value which determines if the layer
-    // requires composited scrolling or not.
-    if (m_scrollableArea && m_layoutObject->style()->pointerEvents() != oldStyle->pointerEvents())
-        return false;
-
-    updateTransform(oldStyle, layoutObject()->styleRef());
-
-    // FIXME: Consider introducing a smaller graphics layer update scope
-    // that just handles transforms and opacity. GraphicsLayerUpdateLocal
-    // will also program bounds, clips, and many other properties that could
-    // not possibly have changed.
-    m_compositedDeprecatedPaintLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLocal);
-    compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange);
-
-    if (m_scrollableArea)
-        m_scrollableArea->updateAfterStyleChange(oldStyle);
-
-    return true;
-}
-
-void DeprecatedPaintLayer::styleChanged(StyleDifference diff, const ComputedStyle* oldStyle)
-{
-    if (attemptDirectCompositingUpdate(diff, oldStyle))
-        return;
-
-    m_stackingNode->updateIsTreatedAsStackingContext();
-    m_stackingNode->updateStackingNodesAfterStyleChange(oldStyle);
-
-    if (m_scrollableArea)
-        m_scrollableArea->updateAfterStyleChange(oldStyle);
-
-    // Overlay scrollbars can make this layer self-painting so we need
-    // to recompute the bit once scrollbars have been updated.
-    updateSelfPaintingLayer();
-
-    if (!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle)) {
-        ASSERT(!oldStyle || diff.needsFullLayout());
-        updateReflectionInfo(oldStyle);
-    }
-
-    updateDescendantDependentFlags();
-
-    updateTransform(oldStyle, layoutObject()->styleRef());
-    updateFilters(oldStyle, layoutObject()->styleRef());
-
-    setNeedsCompositingInputsUpdate();
-}
-
-bool DeprecatedPaintLayer::scrollsOverflow() const
-{
-    if (DeprecatedPaintLayerScrollableArea* scrollableArea = this->scrollableArea())
-        return scrollableArea->scrollsOverflow();
-
-    return false;
-}
-
-namespace {
-
-FilterOperations computeFilterOperationsHandleReferenceFilters(const FilterOperations& filters, float effectiveZoom, Node* enclosingElement)
-{
-    if (filters.hasReferenceFilter()) {
-        for (size_t i = 0; i < filters.size(); ++i) {
-            FilterOperation* filterOperation = filters.operations().at(i).get();
-            if (filterOperation->type() != FilterOperation::REFERENCE)
-                continue;
-            ReferenceFilterOperation& referenceOperation = toReferenceFilterOperation(*filterOperation);
-            // FIXME: Cache the Filter if it didn't change.
-            RefPtrWillBeRawPtr<Filter> referenceFilter = ReferenceFilterBuilder::build(effectiveZoom, toElement(enclosingElement), nullptr, referenceOperation);
-            referenceOperation.setFilter(referenceFilter.release());
-        }
-    }
-
-    return filters;
-}
-
-} // unnamed namespace
-
-FilterOperations DeprecatedPaintLayer::computeFilterOperations(const ComputedStyle& style)
-{
-    return computeFilterOperationsHandleReferenceFilters(style.filter(), style.effectiveZoom(), enclosingElement());
-}
-
-FilterOperations DeprecatedPaintLayer::computeBackdropFilterOperations(const ComputedStyle& style)
-{
-    return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(), style.effectiveZoom(), enclosingElement());
-}
-
-void DeprecatedPaintLayer::updateOrRemoveFilterClients()
-{
-    if (!hasFilter()) {
-        removeFilterInfoIfNeeded();
-        return;
-    }
-
-    if (layoutObject()->style()->filter().hasReferenceFilter())
-        ensureFilterInfo()->updateReferenceFilterClients(layoutObject()->style()->filter());
-    else if (hasFilterInfo())
-        filterInfo()->removeReferenceFilterClients();
-}
-
-void DeprecatedPaintLayer::updateOrRemoveFilterEffectBuilder()
-{
-    // FilterEffectBuilder is only used to render the filters in software mode,
-    // so we always need to run updateOrRemoveFilterEffectBuilder after the composited
-    // mode might have changed for this layer.
-    if (!paintsWithFilters()) {
-        // Don't delete the whole filter info here, because we might use it
-        // for loading CSS shader files.
-        if (DeprecatedPaintLayerFilterInfo* filterInfo = this->filterInfo())
-            filterInfo->setBuilder(nullptr);
-
-        return;
-    }
-
-    DeprecatedPaintLayerFilterInfo* filterInfo = ensureFilterInfo();
-    if (!filterInfo->builder())
-        filterInfo->setBuilder(FilterEffectBuilder::create());
-
-    // If the filter fails to build, remove it from the layer. It will still attempt to
-    // go through regular processing (e.g. compositing), but never apply anything.
-    float zoom = layoutObject()->style() ? layoutObject()->style()->effectiveZoom() : 1.0f;
-    if (!filterInfo->builder()->build(toElement(enclosingElement()), computeFilterOperations(layoutObject()->styleRef()), zoom))
-        filterInfo->setBuilder(nullptr);
-}
-
-void DeprecatedPaintLayer::filterNeedsPaintInvalidation()
-{
-    {
-        DeprecatedScheduleStyleRecalcDuringLayout marker(layoutObject()->document().lifecycle());
-        // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a style recalc, which
-        // is a problem because this function can be called while performing layout.
-        // Presumably this represents an illegal data flow of layout or compositing
-        // information into the style system.
-        toElement(layoutObject()->node())->scheduleSVGFilterLayerUpdateHack();
-    }
-
-    layoutObject()->setShouldDoFullPaintInvalidation();
-}
-
-void DeprecatedPaintLayer::addLayerHitTestRects(LayerHitTestRects& rects) const
-{
-    computeSelfHitTestRects(rects);
-    for (DeprecatedPaintLayer* child = firstChild(); child; child = child->nextSibling())
-        child->addLayerHitTestRects(rects);
-}
-
-void DeprecatedPaintLayer::computeSelfHitTestRects(LayerHitTestRects& rects) const
-{
-    if (!size().isEmpty()) {
-        Vector<LayoutRect> rect;
-
-        if (layoutBox() && layoutBox()->scrollsOverflow()) {
-            // For scrolling layers, rects are taken to be in the space of the contents.
-            // We need to include the bounding box of the layer in the space of its parent
-            // (eg. for border / scroll bars) and if it's composited then the entire contents
-            // as well as they may be on another composited layer. Skip reporting contents
-            // for non-composited layers as they'll get projected to the same layer as the
-            // bounding box.
-            if (compositingState() != NotComposited)
-                rect.append(m_scrollableArea->overflowRect());
-
-            rects.set(this, rect);
-            if (const DeprecatedPaintLayer* parentLayer = parent()) {
-                LayerHitTestRects::iterator iter = rects.find(parentLayer);
-                if (iter == rects.end()) {
-                    rects.add(parentLayer, Vector<LayoutRect>()).storedValue->value.append(physicalBoundingBox(parentLayer));
-                } else {
-                    iter->value.append(physicalBoundingBox(parentLayer));
-                }
-            }
-        } else {
-            rect.append(logicalBoundingBox());
-            rects.set(this, rect);
-        }
-    }
-}
-
-void DeprecatedPaintLayer::setNeedsRepaint()
-{
-    DeprecatedPaintLayer* layer = this;
-    while (layer && !layer->isSelfPaintingLayer() && !layer->hasSelfPaintingLayerDescendant())
-        layer = layer->parent();
-
-    // This layer is in an orphaned layer tree. Will mark ancestor for repaint when
-    // the orphaned tree is added into another tree.
-    if (!layer)
-        return;
-
-    layer->m_needsRepaint = true;
-
-    // Do this unconditionally to ensure container chain is marked when compositing status of the layer changes.
-    layer->markAncestorChainForNeedsRepaint();
-}
-
-void DeprecatedPaintLayer::markAncestorChainForNeedsRepaint()
-{
-    // Need to access compositingState(). We've ensured correct flag setting when compositingState() changes.
-    DisableCompositingQueryAsserts disabler;
-
-    if (compositingState() != NotComposited)
-        return;
-
-    DeprecatedPaintLayer* layer = this;
-    while (true) {
-        DeprecatedPaintLayer* container = layer->parent();
-        if (!container) {
-            LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObject();
-            if (!owner)
-                break;
-            container = owner->enclosingLayer();
-        }
-        if (container->isSelfPaintingLayer() || container->hasSelfPaintingLayerDescendant()) {
-            if (container->m_needsRepaint)
-                break;
-            container->m_needsRepaint = true;
-        }
-        if (container->compositingState() != NotComposited)
-            break;
-        layer = container;
-    }
-}
-
-DisableCompositingQueryAsserts::DisableCompositingQueryAsserts()
-    : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { }
-
-} // namespace blink
-
-#ifndef NDEBUG
-// FIXME: Rename?
-void showLayerTree(const blink::DeprecatedPaintLayer* layer)
-{
-    if (!layer) {
-        fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
-        return;
-    }
-
-    if (blink::LocalFrame* frame = layer->layoutObject()->frame()) {
-        WTF::String output = externalRepresentation(frame, blink::LayoutAsTextShowAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompositedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndClass | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState);
-        fprintf(stderr, "%s\n", output.utf8().data());
-    }
-}
-
-void showLayerTree(const blink::LayoutObject* layoutObject)
-{
-    if (!layoutObject) {
-        fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
-        return;
-    }
-    showLayerTree(layoutObject->enclosingLayer());
-}
-#endif
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayer.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayer.h
deleted file mode 100644
index 7e89734..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayer.h
+++ /dev/null
@@ -1,775 +0,0 @@
-/*
- * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Intel Corporation. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#ifndef DeprecatedPaintLayer_h
-#define DeprecatedPaintLayer_h
-
-#include "core/CoreExport.h"
-#include "core/layout/LayoutBox.h"
-#include "core/paint/DeprecatedPaintLayerClipper.h"
-#include "core/paint/DeprecatedPaintLayerFilterInfo.h"
-#include "core/paint/DeprecatedPaintLayerFragment.h"
-#include "core/paint/DeprecatedPaintLayerReflectionInfo.h"
-#include "core/paint/DeprecatedPaintLayerScrollableArea.h"
-#include "core/paint/DeprecatedPaintLayerStackingNode.h"
-#include "core/paint/DeprecatedPaintLayerStackingNodeIterator.h"
-#include "platform/graphics/CompositingReasons.h"
-#include "public/platform/WebBlendMode.h"
-#include "wtf/Allocator.h"
-#include "wtf/OwnPtr.h"
-
-namespace blink {
-
-class FilterEffectBuilder;
-class FilterOperations;
-class HitTestRequest;
-class HitTestResult;
-class HitTestingTransformState;
-class DeprecatedPaintLayerCompositor;
-class CompositedDeprecatedPaintLayerMapping;
-class ComputedStyle;
-class TransformationMatrix;
-
-enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf };
-
-enum CompositingQueryMode {
-    CompositingQueriesAreAllowed,
-    CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases
-};
-
-// FIXME: remove this once the compositing query ASSERTS are no longer hit.
-class CORE_EXPORT DisableCompositingQueryAsserts {
-    STACK_ALLOCATED();
-    WTF_MAKE_NONCOPYABLE(DisableCompositingQueryAsserts);
-public:
-    DisableCompositingQueryAsserts();
-private:
-    TemporaryChange<CompositingQueryMode> m_disabler;
-};
-
-// DeprecatedPaintLayer is an old object that handles lots of unrelated operations.
-// We want it to die at some point and be replaced by more focused objects. Removing
-// a lot of unneeded complexity.
-// Complex painting operations (opacity, clipping, filters, reflections, ...),
-// hardware acceleration (through DeprecatedPaintLayerCompositor),
-// scrolling (through DeprecatedPaintLayerScrollableArea)
-// along with some optimizations are all handled by DeprecatedPaintLayer.
-//
-// The class is central to painting and hit-testing: it implements the painting
-// order through DeprecatedPaintLayerStackingNode and handle lots of complex
-// graphics operations LayoutObjects don't handle (e.g. 'filter' and 'opacity').
-//
-// The compositing code is also based on DeprecatedPaintLayer. The entry to it
-// is the DeprecatedPaintLayerCompositor, which fills
-// |m_compositedDeprecatedPaintLayerMapping| for hardware accelerated layers.
-//
-// TODO(jchaffraix): Expand the documentation about hardware acceleration.
-//
-// The class is DEPRECATED, which means that we would like to remove it. The
-// reason for removal is that it has been a dumping ground for features for too
-// long and is the wrong level of abstraction, bearing no correspondence to any
-// CSS concept. Its associated objects and some of its feature need to be
-// migrated to LayoutObject (or the appropriate sub-class).
-class CORE_EXPORT DeprecatedPaintLayer {
-    WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayer);
-public:
-    DeprecatedPaintLayer(LayoutBoxModelObject*, DeprecatedPaintLayerType);
-    ~DeprecatedPaintLayer();
-
-    String debugName() const;
-
-    LayoutBoxModelObject* layoutObject() const { return m_layoutObject; }
-    LayoutBox* layoutBox() const { return m_layoutObject && m_layoutObject->isBox() ? toLayoutBox(m_layoutObject) : 0; }
-    DeprecatedPaintLayer* parent() const { return m_parent; }
-    DeprecatedPaintLayer* previousSibling() const { return m_previous; }
-    DeprecatedPaintLayer* nextSibling() const { return m_next; }
-    DeprecatedPaintLayer* firstChild() const { return m_first; }
-    DeprecatedPaintLayer* lastChild() const { return m_last; }
-
-    // TODO(wangxianzhu): Find a better name for it. 'paintContainer' might be good but
-    // we can't use it for now because it conflicts with PaintInfo::paintContainer.
-    DeprecatedPaintLayer* compositingContainer() const;
-
-    void addChild(DeprecatedPaintLayer* newChild, DeprecatedPaintLayer* beforeChild = 0);
-    DeprecatedPaintLayer* removeChild(DeprecatedPaintLayer*);
-
-    void removeOnlyThisLayer();
-    void insertOnlyThisLayer();
-
-    void styleChanged(StyleDifference, const ComputedStyle* oldStyle);
-
-    // FIXME: Many people call this function while it has out-of-date information.
-    bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; }
-
-    void setLayerType(DeprecatedPaintLayerType layerType) { m_layerType = layerType; }
-
-    bool isTransparent() const { return layoutObject()->isTransparent() || layoutObject()->style()->hasBlendMode() || layoutObject()->hasMask(); }
-
-    bool isReflection() const { return layoutObject()->isReplica(); }
-    DeprecatedPaintLayerReflectionInfo* reflectionInfo() { return m_reflectionInfo.get(); }
-    const DeprecatedPaintLayerReflectionInfo* reflectionInfo() const { return m_reflectionInfo.get(); }
-
-    const DeprecatedPaintLayer* root() const
-    {
-        const DeprecatedPaintLayer* curr = this;
-        while (curr->parent())
-            curr = curr->parent();
-        return curr;
-    }
-
-    const LayoutPoint& location() const { ASSERT(!m_needsPositionUpdate); return m_location; }
-    // FIXME: size() should ASSERT(!m_needsPositionUpdate) as well, but that fails in some tests,
-    // for example, fast/repaint/clipped-relative.html.
-    const IntSize& size() const { return m_size; }
-    void setSizeHackForLayoutTreeAsText(const IntSize& size) { m_size = size; }
-
-    LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size())); }
-
-    bool isRootLayer() const { return m_isRootLayer; }
-
-    DeprecatedPaintLayerCompositor* compositor() const;
-
-    // Notification from the layoutObject that its content changed (e.g. current frame of image changed).
-    // Allows updates of layer content without invalidating paint.
-    void contentChanged(ContentChangeType);
-
-    void updateLayerPositionsAfterLayout();
-    void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta);
-
-    DeprecatedPaintLayer* enclosingPaginationLayer() const { return m_enclosingPaginationLayer; }
-
-    void updateTransformationMatrix();
-    DeprecatedPaintLayer* renderingContextRoot();
-
-    const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlowPosition; }
-
-    void addBlockSelectionGapsBounds(const LayoutRect&);
-    void clearBlockSelectionGapsBounds();
-    void invalidatePaintForBlockSelectionGaps();
-    IntRect blockSelectionGapsBounds() const;
-    bool hasBlockSelectionGapBounds() const;
-
-    DeprecatedPaintLayerStackingNode* stackingNode() { return m_stackingNode.get(); }
-    const DeprecatedPaintLayerStackingNode* stackingNode() const { return m_stackingNode.get(); }
-
-    bool subtreeIsInvisible() const { return !hasVisibleContent() && !hasVisibleDescendant(); }
-
-    // FIXME: hasVisibleContent() should call updateDescendantDependentFlags() if m_visibleContentStatusDirty.
-    bool hasVisibleContent() const { ASSERT(!m_visibleContentStatusDirty); return m_hasVisibleContent; }
-
-    // FIXME: hasVisibleDescendant() should call updateDescendantDependentFlags() if m_visibleDescendantStatusDirty.
-    bool hasVisibleDescendant() const { ASSERT(!m_visibleDescendantStatusDirty); return m_hasVisibleDescendant; }
-
-    void dirtyVisibleContentStatus();
-    void potentiallyDirtyVisibleContentStatus(EVisibility);
-
-    bool hasBoxDecorationsOrBackground() const;
-    bool hasVisibleBoxDecorations() const;
-    // True if this layer container layoutObjects that paint.
-    bool hasNonEmptyChildLayoutObjects() const;
-
-    // Will ensure that hasNonCompositiedChild are up to date.
-    void updateScrollingStateAfterCompositingChange();
-    bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent; }
-    bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState()); return m_hasNonCompositedChild; }
-
-    // Gets the ancestor layer that serves as the containing block of this layer. It is assumed
-    // that this layer is established by an out-of-flow positioned layout object (i.e. either
-    // absolutely or fixed positioned).
-    // If |ancestor| is specified, |*skippedAncestor| will be set to true if |ancestor| is found in
-    // the ancestry chain between this layer and the containing block layer; if not found, it will
-    // be set to false. Either both |ancestor| and |skippedAncestor| should be nullptr, or none of
-    // them should.
-    DeprecatedPaintLayer* enclosingPositionedAncestor(const DeprecatedPaintLayer* ancestor = nullptr, bool* skippedAncestor = nullptr) const;
-
-    bool isPaintInvalidationContainer() const;
-
-    // Do *not* call this method unless you know what you are dooing. You probably want to call enclosingCompositingLayerForPaintInvalidation() instead.
-    // If includeSelf is true, may return this.
-    DeprecatedPaintLayer* enclosingLayerWithCompositedDeprecatedPaintLayerMapping(IncludeSelfOrNot) const;
-
-    // Returns the enclosing layer root into which this layer paints, inclusive of this one. Note that the enclosing layer may or may not have its own
-    // GraphicsLayer backing, but is nevertheless the root for a call to the Layer::paint*() methods.
-    DeprecatedPaintLayer* enclosingLayerForPaintInvalidation() const;
-
-    DeprecatedPaintLayer* enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const;
-
-    bool hasAncestorWithFilterOutsets() const;
-
-    bool canUseConvertToLayerCoords() const
-    {
-        // These LayoutObjects have an impact on their layers without the layoutObjects knowing about it.
-        return !layoutObject()->hasTransformRelatedProperty() && !layoutObject()->isSVGRoot();
-    }
-
-    void convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutPoint&) const;
-    void convertToLayerCoords(const DeprecatedPaintLayer* ancestorLayer, LayoutRect&) const;
-
-    // Does the same as convertToLayerCoords() when not in multicol. For multicol, however,
-    // convertToLayerCoords() calculates the offset in flow-thread coordinates (what the layout
-    // engine uses internally), while this method calculates the visual coordinates; i.e. it figures
-    // out which column the layer starts in and adds in the offset. See
-    // http://www.chromium.org/developers/design-documents/multi-column-layout for more info.
-    LayoutPoint visualOffsetFromAncestor(const DeprecatedPaintLayer* ancestorLayer) const;
-
-    // The hitTest() method looks for mouse events by walking layers that intersect the point from front to back.
-    bool hitTest(HitTestResult&);
-
-    bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const LayoutPoint& offsetFromRoot) const;
-
-    // Bounding box relative to some ancestor layer. Pass offsetFromRoot if known.
-    LayoutRect physicalBoundingBox(const LayoutPoint& offsetFromRoot) const;
-    LayoutRect physicalBoundingBox(const DeprecatedPaintLayer* ancestorLayer) const;
-    LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const LayoutPoint& offsetFromRoot) const;
-    LayoutRect fragmentsBoundingBox(const DeprecatedPaintLayer* ancestorLayer) const;
-
-    LayoutRect boundingBoxForCompositingOverlapTest() const;
-
-    // If true, this layer's children are included in its bounds for overlap testing.
-    // We can't rely on the children's positions if this layer has a filter that could have moved the children's pixels around.
-    bool overlapBoundsIncludeChildren() const { return hasFilter() && layoutObject()->style()->filter().hasFilterThatMovesPixels(); }
-
-    // MaybeIncludeTransformForAncestorLayer means that a transform on |ancestorLayer| may be applied to the bounding box,
-    // in particular if paintsWithTransform() is true.
-    enum CalculateBoundsOptions {
-        MaybeIncludeTransformForAncestorLayer,
-        NeverIncludeTransformForAncestorLayer,
-    };
-    LayoutRect boundingBoxForCompositing(const DeprecatedPaintLayer* ancestorLayer = 0, CalculateBoundsOptions = MaybeIncludeTransformForAncestorLayer) const;
-
-    LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; }
-    LayoutUnit staticBlockPosition() const { return m_staticBlockPosition; }
-
-    void setStaticInlinePosition(LayoutUnit position) { m_staticInlinePosition = position; }
-    void setStaticBlockPosition(LayoutUnit position) { m_staticBlockPosition = position; }
-
-    LayoutSize subpixelAccumulation() const;
-    void setSubpixelAccumulation(const LayoutSize&);
-
-    bool hasTransformRelatedProperty() const { return layoutObject()->hasTransformRelatedProperty(); }
-    // Note that this transform has the transform-origin baked in.
-    TransformationMatrix* transform() const { return m_transform.get(); }
-    void setTransform(PassOwnPtr<TransformationMatrix> transform) { m_transform = transform; }
-    void clearTransform() { m_transform.clear(); }
-
-    // currentTransform computes a transform which takes accelerated animations into account. The
-    // resulting transform has transform-origin baked in. If the layer does not have a transform,
-    // returns the identity matrix.
-    TransformationMatrix currentTransform() const;
-    TransformationMatrix renderableTransform(GlobalPaintFlags) const;
-
-    // Get the perspective transform, which is applied to transformed sublayers.
-    // Returns true if the layer has a -webkit-perspective.
-    // Note that this transform does not have the perspective-origin baked in.
-    TransformationMatrix perspectiveTransform() const;
-    FloatPoint perspectiveOrigin() const;
-    bool preserves3D() const { return layoutObject()->style()->transformStyle3D() == TransformStyle3DPreserve3D; }
-    bool has3DTransform() const { return m_transform && !m_transform->isAffine(); }
-
-    // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
-    bool shouldPreserve3D() const { return !layoutObject()->hasReflection() && layoutObject()->style()->transformStyle3D() == TransformStyle3DPreserve3D; }
-
-    void filterNeedsPaintInvalidation();
-    bool hasFilter() const { return layoutObject()->hasFilter(); }
-
-    void* operator new(size_t);
-    // Only safe to call from LayoutBoxModelObject::destroyLayer()
-    void operator delete(void*);
-
-    CompositingState compositingState() const;
-
-    // This returns true if our document is in a phase of its lifestyle during which
-    // compositing state may legally be read.
-    bool isAllowedToQueryCompositingState() const;
-
-    // Don't null check this.
-    // FIXME: Rename.
-    CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping() const;
-    GraphicsLayer* graphicsLayerBacking() const;
-    GraphicsLayer* graphicsLayerBackingForScrolling() const;
-    // NOTE: If you are using hasCompositedDeprecatedPaintLayerMapping to determine the state of compositing for this layer,
-    // (and not just to do bookkeeping related to the mapping like, say, allocating or deallocating a mapping),
-    // then you may have incorrect logic. Use compositingState() instead.
-    // FIXME: This is identical to null checking compositedDeprecatedPaintLayerMapping(), why not just call that?
-    bool hasCompositedDeprecatedPaintLayerMapping() const { return m_compositedDeprecatedPaintLayerMapping.get(); }
-    void ensureCompositedDeprecatedPaintLayerMapping();
-    void clearCompositedDeprecatedPaintLayerMapping(bool layerBeingDestroyed = false);
-    CompositedDeprecatedPaintLayerMapping* groupedMapping() const { return m_groupedMapping; }
-    enum SetGroupMappingOptions {
-        InvalidateLayerAndRemoveFromMapping,
-        DoNotInvalidateLayerAndRemoveFromMapping
-    };
-    void setGroupedMapping(CompositedDeprecatedPaintLayerMapping*, SetGroupMappingOptions);
-
-    bool hasCompositedMask() const;
-    bool hasCompositedClippingMask() const;
-    bool needsCompositedScrolling() const { return m_scrollableArea && m_scrollableArea->needsCompositedScrolling(); }
-
-    // Computes the position of the given layout object in the space of |paintInvalidationContainer|.
-    // FIXME: invert the logic to have paint invalidation containers take care of painting objects into them, rather than the reverse.
-    // This will allow us to clean up this static method messiness.
-    static LayoutPoint positionFromPaintInvalidationBacking(const LayoutObject*, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0);
-
-    static void mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* paintInvalidationContainer, FloatPoint&);
-    static void mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect&);
-
-    // Adjusts the given rect (in the coordinate space of the LayoutObject) to the coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing.
-    static void mapRectToPaintInvalidationBacking(const LayoutObject*, const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalidationState* = 0);
-
-    // Computes the bounding paint invalidation rect for |layoutObject|, in the coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing.
-    static LayoutRect computePaintInvalidationRect(const LayoutObject*, const DeprecatedPaintLayer* paintInvalidationContainer, const PaintInvalidationState* = 0);
-
-    bool paintsWithTransparency(GlobalPaintFlags globalPaintFlags) const
-    {
-        return isTransparent() && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingState() != PaintsIntoOwnBacking);
-    }
-
-    bool paintsWithTransform(GlobalPaintFlags) const;
-
-    // Returns true if background phase is painted opaque in the given rect.
-    // The query rect is given in local coordinates.
-    bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const;
-
-    bool containsDirtyOverlayScrollbars() const { return m_containsDirtyOverlayScrollbars; }
-    void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDirtyOverlayScrollbars = dirtyScrollbars; }
-
-    FilterOperations computeFilterOperations(const ComputedStyle&);
-    FilterOperations computeBackdropFilterOperations(const ComputedStyle&);
-    bool paintsWithFilters() const;
-    bool paintsWithBackdropFilters() const;
-    FilterEffectBuilder* filterEffectBuilder() const
-    {
-        DeprecatedPaintLayerFilterInfo* filterInfo = this->filterInfo();
-        return filterInfo ? filterInfo->builder() : 0;
-    }
-
-    DeprecatedPaintLayerFilterInfo* filterInfo() const { return hasFilterInfo() ? DeprecatedPaintLayerFilterInfo::filterInfoForLayer(this) : 0; }
-    DeprecatedPaintLayerFilterInfo* ensureFilterInfo() { return DeprecatedPaintLayerFilterInfo::createFilterInfoForLayerIfNeeded(this); }
-    void removeFilterInfoIfNeeded()
-    {
-        if (hasFilterInfo())
-            DeprecatedPaintLayerFilterInfo::removeFilterInfoForLayer(this);
-    }
-
-    bool hasFilterInfo() const { return m_hasFilterInfo; }
-    void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo; }
-
-    void updateFilters(const ComputedStyle* oldStyle, const ComputedStyle& newStyle);
-
-    Node* enclosingElement() const;
-
-    bool isInTopLayer() const;
-
-    bool scrollsWithViewport() const;
-    bool scrollsWithRespectTo(const DeprecatedPaintLayer*) const;
-
-    void addLayerHitTestRects(LayerHitTestRects&) const;
-
-    // Compute rects only for this layer
-    void computeSelfHitTestRects(LayerHitTestRects&) const;
-
-    // FIXME: This should probably return a ScrollableArea but a lot of internal methods are mistakenly exposed.
-    DeprecatedPaintLayerScrollableArea* scrollableArea() const { return m_scrollableArea.get(); }
-    DeprecatedPaintLayerClipper& clipper() { return m_clipper; }
-    const DeprecatedPaintLayerClipper& clipper() const { return m_clipper; }
-
-    inline bool isPositionedContainer() const
-    {
-        // FIXME: This is not in sync with containingBlock.
-        // LayoutObject::canContainFixedPositionObjects() should probably be used
-        // instead.
-        LayoutBoxModelObject* layerlayoutObject = layoutObject();
-        return isRootLayer() || layerlayoutObject->isPositioned() || hasTransformRelatedProperty();
-    }
-
-    bool scrollsOverflow() const;
-
-    CompositingReasons potentialCompositingReasonsFromStyle() const { return m_potentialCompositingReasonsFromStyle; }
-    void setPotentialCompositingReasonsFromStyle(CompositingReasons reasons) { ASSERT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m_potentialCompositingReasonsFromStyle = reasons; }
-
-    bool hasStyleDeterminedDirectCompositingReasons() const { return m_potentialCompositingReasonsFromStyle & CompositingReasonComboAllDirectStyleDeterminedReasons; }
-
-    class AncestorDependentCompositingInputs {
-        DISALLOW_ALLOCATION();
-    public:
-        AncestorDependentCompositingInputs()
-            : opacityAncestor(0)
-            , transformAncestor(0)
-            , filterAncestor(0)
-            , clippingContainer(0)
-            , ancestorScrollingLayer(0)
-            , nearestFixedPositionLayer(0)
-            , scrollParent(0)
-            , clipParent(0)
-            , hasAncestorWithClipPath(false)
-        { }
-
-        IntRect clippedAbsoluteBoundingBox;
-        const DeprecatedPaintLayer* opacityAncestor;
-        const DeprecatedPaintLayer* transformAncestor;
-        const DeprecatedPaintLayer* filterAncestor;
-        const LayoutObject* clippingContainer;
-        const DeprecatedPaintLayer* ancestorScrollingLayer;
-        const DeprecatedPaintLayer* nearestFixedPositionLayer;
-
-        // A scroll parent is a compositor concept. It's only needed in blink
-        // because we need to use it as a promotion trigger. A layer has a
-        // scroll parent if neither its compositor scrolling ancestor, nor any
-        // other layer scrolled by this ancestor, is a stacking ancestor of this
-        // layer. Layers with scroll parents must be scrolled with the main
-        // scrolling layer by the compositor.
-        const DeprecatedPaintLayer* scrollParent;
-
-        // A clip parent is another compositor concept that has leaked into
-        // blink so that it may be used as a promotion trigger. Layers with clip
-        // parents escape the clip of a stacking tree ancestor. The compositor
-        // needs to know about clip parents in order to circumvent its normal
-        // clipping logic.
-        const DeprecatedPaintLayer* clipParent;
-
-        unsigned hasAncestorWithClipPath : 1;
-    };
-
-    class DescendantDependentCompositingInputs {
-        DISALLOW_ALLOCATION();
-    public:
-        DescendantDependentCompositingInputs()
-            : hasDescendantWithClipPath(false)
-            , hasNonIsolatedDescendantWithBlendMode(false)
-        { }
-
-        unsigned hasDescendantWithClipPath : 1;
-        unsigned hasNonIsolatedDescendantWithBlendMode : 1;
-    };
-
-    void setNeedsCompositingInputsUpdate();
-    bool childNeedsCompositingInputsUpdate() const { return m_childNeedsCompositingInputsUpdate; }
-    bool needsCompositingInputsUpdate() const
-    {
-        // While we're updating the compositing inputs, these values may differ.
-        // We should never be asking for this value when that is the case.
-        ASSERT(m_needsDescendantDependentCompositingInputsUpdate == m_needsAncestorDependentCompositingInputsUpdate);
-        return m_needsDescendantDependentCompositingInputsUpdate;
-    }
-
-    void updateAncestorDependentCompositingInputs(const AncestorDependentCompositingInputs&);
-    void updateDescendantDependentCompositingInputs(const DescendantDependentCompositingInputs&);
-    void didUpdateCompositingInputs();
-
-    const AncestorDependentCompositingInputs& ancestorDependentCompositingInputs() const { ASSERT(!m_needsAncestorDependentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs; }
-    const DescendantDependentCompositingInputs& descendantDependentCompositingInputs() const { ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); return m_descendantDependentCompositingInputs; }
-
-    IntRect clippedAbsoluteBoundingBox() const { return ancestorDependentCompositingInputs().clippedAbsoluteBoundingBox; }
-    const DeprecatedPaintLayer* opacityAncestor() const { return ancestorDependentCompositingInputs().opacityAncestor; }
-    const DeprecatedPaintLayer* transformAncestor() const { return ancestorDependentCompositingInputs().transformAncestor; }
-    const DeprecatedPaintLayer* filterAncestor() const { return ancestorDependentCompositingInputs().filterAncestor; }
-    const LayoutObject* clippingContainer() const { return ancestorDependentCompositingInputs().clippingContainer; }
-    const DeprecatedPaintLayer* ancestorScrollingLayer() const { return ancestorDependentCompositingInputs().ancestorScrollingLayer; }
-    const DeprecatedPaintLayer* nearestFixedPositionLayer() const { return ancestorDependentCompositingInputs().nearestFixedPositionLayer; }
-    DeprecatedPaintLayer* scrollParent() const { return const_cast<DeprecatedPaintLayer*>(ancestorDependentCompositingInputs().scrollParent); }
-    DeprecatedPaintLayer* clipParent() const { return const_cast<DeprecatedPaintLayer*>(ancestorDependentCompositingInputs().clipParent); }
-    bool hasAncestorWithClipPath() const { return ancestorDependentCompositingInputs().hasAncestorWithClipPath; }
-    bool hasDescendantWithClipPath() const { return descendantDependentCompositingInputs().hasDescendantWithClipPath; }
-    bool hasNonIsolatedDescendantWithBlendMode() const;
-
-    bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()); return m_lostGroupedMapping; }
-    void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; }
-
-    CompositingReasons compositingReasons() const { ASSERT(isAllowedToQueryCompositingState()); return m_compositingReasons; }
-    void setCompositingReasons(CompositingReasons, CompositingReasons mask = CompositingReasonAll);
-
-    bool hasCompositingDescendant() const { ASSERT(isAllowedToQueryCompositingState()); return m_hasCompositingDescendant; }
-    void setHasCompositingDescendant(bool);
-
-    bool shouldIsolateCompositedDescendants() const { ASSERT(isAllowedToQueryCompositingState()); return m_shouldIsolateCompositedDescendants; }
-    void setShouldIsolateCompositedDescendants(bool);
-
-    void updateDescendantDependentFlags();
-
-    void updateOrRemoveFilterEffectBuilder();
-
-    void updateSelfPaintingLayer();
-
-    DeprecatedPaintLayer* enclosingTransformedAncestor() const;
-    LayoutPoint computeOffsetFromTransformedAncestor() const;
-
-    void didUpdateNeedsCompositedScrolling();
-
-    bool hasSelfPaintingLayerDescendant() const
-    {
-        if (m_hasSelfPaintingLayerDescendantDirty)
-            updateHasSelfPaintingLayerDescendant();
-        ASSERT(!m_hasSelfPaintingLayerDescendantDirty);
-        return m_hasSelfPaintingLayerDescendant;
-    }
-    LayoutRect paintingExtent(const DeprecatedPaintLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, GlobalPaintFlags);
-    void appendSingleFragmentIgnoringPagination(DeprecatedPaintLayerFragments&, const DeprecatedPaintLayer* rootLayer, const LayoutRect& dirtyRect, ClipRectsCacheSlot, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = 0, const LayoutSize& subPixelAccumulation = LayoutSize());
-    void collectFragments(DeprecatedPaintLayerFragments&, const DeprecatedPaintLayer* rootLayer, const LayoutRect& dirtyRect,
-        ClipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize,
-        ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = 0,
-        const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect* layerBoundingBox = 0);
-
-    LayoutPoint layoutBoxLocation() const { return layoutObject()->isBox() ? toLayoutBox(layoutObject())->location() : LayoutPoint(); }
-
-    enum TransparencyClipBoxBehavior {
-        PaintingTransparencyClipBox,
-        HitTestingTransparencyClipBox
-    };
-
-    enum TransparencyClipBoxMode {
-        DescendantsOfTransparencyClipBox,
-        RootOfTransparencyClipBox
-    };
-
-    static LayoutRect transparencyClipBox(const DeprecatedPaintLayer*, const DeprecatedPaintLayer* rootLayer, TransparencyClipBoxBehavior transparencyBehavior,
-        TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumulation, GlobalPaintFlags = GlobalPaintNormalPhase);
-
-    bool needsRepaint() const { return m_needsRepaint; }
-    void setNeedsRepaint();
-    void clearNeedsRepaint() { m_needsRepaint = false; }
-
-    IntSize previousScrollOffsetAccumulationForPainting() const { return m_previousScrollOffsetAccumulationForPainting; }
-    void setPreviousScrollOffsetAccumulationForPainting(const IntSize& s) { m_previousScrollOffsetAccumulationForPainting = s; }
-
-    // For subsequence display items.
-    DisplayItemClient displayItemClient() const { return toDisplayItemClient(this); }
-
-private:
-    // Bounding box in the coordinates of this layer.
-    LayoutRect logicalBoundingBox() const;
-
-    bool hasOverflowControls() const;
-
-    void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
-
-    // Returns true if the position changed.
-    bool updateLayerPosition();
-
-    void updateLayerPositionRecursive();
-    void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled);
-
-    void setNextSibling(DeprecatedPaintLayer* next) { m_next = next; }
-    void setPreviousSibling(DeprecatedPaintLayer* prev) { m_previous = prev; }
-    void setFirstChild(DeprecatedPaintLayer* first) { m_first = first; }
-    void setLastChild(DeprecatedPaintLayer* last) { m_last = last; }
-
-    void updateHasSelfPaintingLayerDescendant() const;
-    DeprecatedPaintLayer* hitTestLayer(DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult&,
-        const LayoutRect& hitTestRect, const HitTestLocation&, bool appliedTransform,
-        const HitTestingTransformState* = 0, double* zOffset = 0);
-    DeprecatedPaintLayer* hitTestLayerByApplyingTransform(DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult&,
-        const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState* = 0, double* zOffset = 0,
-        const LayoutPoint& translationOffset = LayoutPoint());
-    DeprecatedPaintLayer* hitTestChildren(ChildrenIteration, DeprecatedPaintLayer* rootLayer, HitTestResult&,
-        const LayoutRect& hitTestRect, const HitTestLocation&,
-        const HitTestingTransformState*, double* zOffsetForDescendants, double* zOffset,
-        const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
-
-    PassRefPtr<HitTestingTransformState> createLocalTransformState(DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer,
-        const LayoutRect& hitTestRect, const HitTestLocation&,
-        const HitTestingTransformState* containerTransformState,
-        const LayoutPoint& translationOffset = LayoutPoint()) const;
-
-    bool hitTestContents(HitTestResult&, const LayoutRect& layerBounds, const HitTestLocation&, HitTestFilter) const;
-    bool hitTestContentsForFragments(const DeprecatedPaintLayerFragments&, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const;
-    DeprecatedPaintLayer* hitTestTransformedLayerInFragments(DeprecatedPaintLayer* rootLayer, DeprecatedPaintLayer* containerLayer, HitTestResult&,
-        const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState*, double* zOffset, ClipRectsCacheSlot);
-
-    bool childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const;
-
-    bool shouldBeSelfPaintingLayer() const;
-
-    // FIXME: We should only create the stacking node if needed.
-    bool requiresStackingNode() const { return true; }
-    void updateStackingNode();
-
-    void updateReflectionInfo(const ComputedStyle*);
-
-    // FIXME: We could lazily allocate our ScrollableArea based on style properties ('overflow', ...)
-    // but for now, we are always allocating it for LayoutBox as it's safer. crbug.com/467721.
-    bool requiresScrollableArea() const { return layoutBox(); }
-    void updateScrollableArea();
-
-    void dirtyAncestorChainVisibleDescendantStatus();
-
-    bool attemptDirectCompositingUpdate(StyleDifference, const ComputedStyle* oldStyle);
-    void updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& newStyle);
-
-    void dirty3DTransformedDescendantStatus();
-    // Both updates the status, and returns true if descendants of this have 3d.
-    bool update3DTransformedDescendantStatus();
-
-    void updateOrRemoveFilterClients();
-
-    void updatePaginationRecursive(bool needsPaginationUpdate = false);
-    void clearPaginationRecursive();
-
-    void blockSelectionGapsBoundsChanged();
-
-    void markAncestorChainForNeedsRepaint();
-
-    DeprecatedPaintLayerType m_layerType;
-
-    // Self-painting layer is an optimization where we avoid the heavy Layer painting
-    // machinery for a Layer allocated only to handle the overflow clip case.
-    // FIXME(crbug.com/332791): Self-painting layer should be merged into the overflow-only concept.
-    unsigned m_isSelfPaintingLayer : 1;
-
-    // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to
-    // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
-    mutable unsigned m_hasSelfPaintingLayerDescendant : 1;
-    mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1;
-
-    const unsigned m_isRootLayer : 1;
-
-    unsigned m_visibleContentStatusDirty : 1;
-    unsigned m_hasVisibleContent : 1;
-    unsigned m_visibleDescendantStatusDirty : 1;
-    unsigned m_hasVisibleDescendant : 1;
-
-    unsigned m_hasVisibleNonLayerContent : 1;
-
-#if ENABLE(ASSERT)
-    unsigned m_needsPositionUpdate : 1;
-#endif
-
-    unsigned m_3DTransformedDescendantStatusDirty : 1;
-    // Set on a stacking context layer that has 3D descendants anywhere
-    // in a preserves3D hierarchy. Hint to do 3D-aware hit testing.
-    unsigned m_has3DTransformedDescendant : 1;
-
-    unsigned m_containsDirtyOverlayScrollbars : 1;
-
-    unsigned m_hasFilterInfo : 1;
-    unsigned m_needsAncestorDependentCompositingInputsUpdate : 1;
-    unsigned m_needsDescendantDependentCompositingInputsUpdate : 1;
-    unsigned m_childNeedsCompositingInputsUpdate : 1;
-
-    // Used only while determining what layers should be composited. Applies to the tree of z-order lists.
-    unsigned m_hasCompositingDescendant : 1;
-
-    // Applies to the real layout layer tree (i.e., the tree determined by the layer's parent and children and
-    // as opposed to the tree formed by the z-order and normal flow lists).
-    unsigned m_hasNonCompositedChild : 1;
-
-    // Should be for stacking contexts having unisolated blending descendants.
-    unsigned m_shouldIsolateCompositedDescendants : 1;
-
-    // True if this layout layer just lost its grouped mapping due to the CompositedDeprecatedPaintLayerMapping being destroyed,
-    // and we don't yet know to what graphics layer this Layer will be assigned.
-    unsigned m_lostGroupedMapping : 1;
-
-    unsigned m_needsRepaint : 1;
-
-    LayoutBoxModelObject* m_layoutObject;
-
-    DeprecatedPaintLayer* m_parent;
-    DeprecatedPaintLayer* m_previous;
-    DeprecatedPaintLayer* m_next;
-    DeprecatedPaintLayer* m_first;
-    DeprecatedPaintLayer* m_last;
-
-    // Our current relative position offset.
-    LayoutSize m_offsetForInFlowPosition;
-
-    // Our (x,y) coordinates are in our parent layer's coordinate space.
-    LayoutPoint m_location;
-
-    // The layer's size.
-    //
-    // If the associated LayoutBoxModelObject is a LayoutBox, it's its border
-    // box. Otherwise, this is the LayoutInline's lines' bounding box.
-    IntSize m_size;
-
-    // Cached normal flow values for absolute positioned elements with static left/top values.
-    LayoutUnit m_staticInlinePosition;
-    LayoutUnit m_staticBlockPosition;
-
-    OwnPtr<TransformationMatrix> m_transform;
-
-    // Pointer to the enclosing Layer that caused us to be paginated. It is 0 if we are not paginated.
-    //
-    // See LayoutMultiColumnFlowThread and
-    // https://sites.google.com/a/chromium.org/dev/developers/design-documents/multi-column-layout
-    // for more information about the multicol implementation. It's important to understand the
-    // difference between flow thread coordinates and visual coordinates when working with multicol
-    // in Layer, since Layer is one of the few places where we have to worry about the
-    // visual ones. Internally we try to use flow-thread coordinates whenever possible.
-    DeprecatedPaintLayer* m_enclosingPaginationLayer;
-
-    // These compositing reasons are updated whenever style changes, not while updating compositing layers.
-    // They should not be used to infer the compositing state of this layer.
-    CompositingReasons m_potentialCompositingReasonsFromStyle;
-
-    // Once computed, indicates all that a layer needs to become composited using the CompositingReasons enum bitfield.
-    CompositingReasons m_compositingReasons;
-
-    DescendantDependentCompositingInputs m_descendantDependentCompositingInputs;
-    AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs;
-
-    IntRect m_blockSelectionGapsBounds;
-
-    OwnPtr<CompositedDeprecatedPaintLayerMapping> m_compositedDeprecatedPaintLayerMapping;
-    OwnPtrWillBePersistent<DeprecatedPaintLayerScrollableArea> m_scrollableArea;
-
-    CompositedDeprecatedPaintLayerMapping* m_groupedMapping;
-
-    DeprecatedPaintLayerClipper m_clipper; // FIXME: Lazily allocate?
-    OwnPtr<DeprecatedPaintLayerStackingNode> m_stackingNode;
-    OwnPtr<DeprecatedPaintLayerReflectionInfo> m_reflectionInfo;
-
-    LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a composited layer's composited bounds compared to absolute coordinates.
-
-    IntSize m_previousScrollOffsetAccumulationForPainting;
-};
-
-} // namespace blink
-
-#ifndef NDEBUG
-// Outside the WebCore namespace for ease of invocation from gdb.
-void showLayerTree(const blink::DeprecatedPaintLayer*);
-void showLayerTree(const blink::LayoutObject*);
-#endif
-
-#endif // Layer_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerClipper.cpp
deleted file mode 100644
index 4d3bfc5..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerClipper.cpp
+++ /dev/null
@@ -1,369 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#include "config.h"
-#include "core/paint/DeprecatedPaintLayerClipper.h"
-
-#include "core/frame/Settings.h"
-#include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-
-namespace blink {
-
-static void adjustClipRectsForChildren(const LayoutObject& layoutObject, ClipRects& clipRects)
-{
-    EPosition position = layoutObject.style()->position();
-    // A fixed object is essentially the root of its containing block hierarchy, so when
-    // we encounter such an object, we reset our clip rects to the fixedClipRect.
-    if (position == FixedPosition) {
-        clipRects.setPosClipRect(clipRects.fixedClipRect());
-        clipRects.setOverflowClipRect(clipRects.fixedClipRect());
-        clipRects.setFixed(true);
-    } else if (position == RelativePosition) {
-        clipRects.setPosClipRect(clipRects.overflowClipRect());
-    } else if (position == AbsolutePosition) {
-        clipRects.setOverflowClipRect(clipRects.posClipRect());
-    }
-}
-
-static void applyClipRects(const ClipRectsContext& context, const LayoutObject& layoutObject, LayoutPoint offset, ClipRects& clipRects)
-{
-    ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip());
-    LayoutView* view = layoutObject.view();
-    ASSERT(view);
-    if (clipRects.fixed() && context.rootLayer->layoutObject() == view)
-        offset -= toIntSize(view->frameView()->scrollPosition());
-    if (layoutObject.hasOverflowClip()) {
-        ClipRect newOverflowClip = toLayoutBox(layoutObject).overflowClipRect(offset, context.scrollbarRelevancy);
-        newOverflowClip.setHasRadius(layoutObject.style()->hasBorderRadius());
-        clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
-        if (layoutObject.isPositioned())
-            clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
-        if (layoutObject.isLayoutView())
-            clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.fixedClipRect()));
-    }
-    if (layoutObject.hasClip()) {
-        LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset);
-        clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss());
-        clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowClipRect()).setIsClippedByClipCss());
-        clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()).setIsClippedByClipCss());
-
-    }
-}
-
-DeprecatedPaintLayerClipper::DeprecatedPaintLayerClipper(const LayoutBoxModelObject& layoutObject)
-    : m_layoutObject(layoutObject)
-{
-}
-
-ClipRects* DeprecatedPaintLayerClipper::clipRectsIfCached(const ClipRectsContext& context) const
-{
-    ASSERT(context.usesCache());
-    if (!m_cache)
-        return 0;
-    ClipRectsCache::Entry& entry = m_cache->get(context.cacheSlot());
-    // FIXME: We used to ASSERT that we always got a consistent root layer.
-    // We should add a test that has an inconsistent root. See
-    // http://crbug.com/366118 for an example.
-    if (context.rootLayer != entry.root)
-        return 0;
-    ASSERT(entry.scrollbarRelevancy == context.scrollbarRelevancy);
-#ifdef CHECK_CACHED_CLIP_RECTS
-    // This code is useful to check cached clip rects, but is too expensive to leave enabled in debug builds by default.
-    ClipRectsContext tempContext(context);
-    tempContext.cacheSlot = UncachedClipRects;
-    RefPtr<ClipRects> clipRects = ClipRects::create();
-    calculateClipRects(tempContext, *clipRects);
-    ASSERT(clipRects == *entry.clipRects);
-#endif
-    return entry.clipRects.get();
-}
-ClipRects* DeprecatedPaintLayerClipper::storeClipRectsInCache(const ClipRectsContext& context, ClipRects* parentClipRects, const ClipRects& clipRects) const
-{
-    ClipRectsCache::Entry& entry = cache().get(context.cacheSlot());
-    entry.root = context.rootLayer;
-#if ENABLE(ASSERT)
-    entry.scrollbarRelevancy = context.scrollbarRelevancy;
-#endif
-    if (parentClipRects) {
-        // If our clip rects match the clip rects of our parent, we share storage.
-        if (clipRects == *parentClipRects) {
-            entry.clipRects = parentClipRects;
-            return parentClipRects;
-        }
-    }
-    entry.clipRects = ClipRects::create(clipRects);
-    return entry.clipRects.get();
-}
-ClipRects* DeprecatedPaintLayerClipper::getClipRects(const ClipRectsContext& context) const
-{
-    if (ClipRects* result = clipRectsIfCached(context))
-        return result;
-    // Note that it's important that we call getClipRects on our parent
-    // before we call calculateClipRects so that calculateClipRects will hit
-    // the cache.
-    ClipRects* parentClipRects = 0;
-    if (context.rootLayer != m_layoutObject.layer() && m_layoutObject.layer()->parent())
-        parentClipRects = m_layoutObject.layer()->parent()->clipper().getClipRects(context);
-    RefPtr<ClipRects> clipRects = ClipRects::create();
-    calculateClipRects(context, *clipRects);
-    return storeClipRectsInCache(context, parentClipRects, *clipRects);
-}
-
-void DeprecatedPaintLayerClipper::clearClipRectsIncludingDescendants()
-{
-    m_cache = nullptr;
-
-    for (DeprecatedPaintLayer* layer = m_layoutObject.layer()->firstChild(); layer; layer = layer->nextSibling()) {
-        layer->clipper().clearClipRectsIncludingDescendants();
-    }
-}
-
-void DeprecatedPaintLayerClipper::clearClipRectsIncludingDescendants(ClipRectsCacheSlot cacheSlot)
-{
-    if (m_cache)
-        m_cache->clear(cacheSlot);
-
-    for (DeprecatedPaintLayer* layer = m_layoutObject.layer()->firstChild(); layer; layer = layer->nextSibling()) {
-        layer->clipper().clearClipRectsIncludingDescendants(cacheSlot);
-    }
-}
-
-LayoutRect DeprecatedPaintLayerClipper::childrenClipRect() const
-{
-    // FIXME: border-radius not accounted for.
-    // FIXME: Flow thread based columns not accounted for.
-    DeprecatedPaintLayer* clippingRootLayer = clippingRootForPainting();
-    LayoutRect layerBounds;
-    ClipRect backgroundRect, foregroundRect;
-    // Need to use uncached clip rects, because the value of 'dontClipToOverflow' may be different from the painting path (<rdar://problem/11844909>).
-    ClipRectsContext context(clippingRootLayer, UncachedClipRects);
-    calculateRects(context, LayoutRect(m_layoutObject.view()->unscaledDocumentRect()), layerBounds, backgroundRect, foregroundRect);
-    return LayoutRect(clippingRootLayer->layoutObject()->localToAbsoluteQuad(FloatQuad(FloatRect(foregroundRect.rect()))).enclosingBoundingBox());
-}
-
-LayoutRect DeprecatedPaintLayerClipper::localClipRect() const
-{
-    // FIXME: border-radius not accounted for.
-    DeprecatedPaintLayer* clippingRootLayer = clippingRootForPainting();
-    LayoutRect layerBounds;
-    ClipRect backgroundRect, foregroundRect;
-    ClipRectsContext context(clippingRootLayer, PaintingClipRects);
-    calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds, backgroundRect, foregroundRect);
-
-    LayoutRect clipRect = backgroundRect.rect();
-    // TODO(chrishtr): avoid converting to IntRect and back.
-    if (clipRect == LayoutRect(LayoutRect::infiniteIntRect()))
-        return clipRect;
-
-    LayoutPoint clippingRootOffset;
-    m_layoutObject.layer()->convertToLayerCoords(clippingRootLayer, clippingRootOffset);
-    clipRect.moveBy(-clippingRootOffset);
-
-    return clipRect;
-}
-
-void DeprecatedPaintLayerClipper::calculateRects(const ClipRectsContext& context, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
-    ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutPoint* offsetFromRoot) const
-{
-    bool isClippingRoot = m_layoutObject.layer() == context.rootLayer;
-
-    if (!isClippingRoot && m_layoutObject.layer()->parent()) {
-        backgroundRect = backgroundClipRect(context);
-        backgroundRect.move(context.subPixelAccumulation);
-        backgroundRect.intersect(paintDirtyRect);
-    } else {
-        backgroundRect = paintDirtyRect;
-    }
-
-    foregroundRect = backgroundRect;
-
-    LayoutPoint offset;
-    if (offsetFromRoot)
-        offset = *offsetFromRoot;
-    else
-        m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset);
-    layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size()));
-
-    // Update the clip rects that will be passed to child layers.
-    if (m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) {
-        foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRect(offset, context.scrollbarRelevancy));
-        if (m_layoutObject.style()->hasBorderRadius())
-            foregroundRect.setHasRadius(true);
-
-        // FIXME: Does not do the right thing with columns yet, since we don't yet factor in the
-        // individual column boxes as overflow.
-
-        // The LayoutView is special since its overflow clipping rect may be larger than its box rect (crbug.com/492871).
-        LayoutRect layerBoundsWithVisualOverflow = m_layoutObject.isLayoutView() ? toLayoutView(m_layoutObject).viewRect() : toLayoutBox(m_layoutObject).visualOverflowRect();
-        toLayoutBox(m_layoutObject).flipForWritingMode(layerBoundsWithVisualOverflow); // DeprecatedPaintLayer are in physical coordinates, so the overflow has to be flipped.
-        layerBoundsWithVisualOverflow.moveBy(offset);
-        backgroundRect.intersect(layerBoundsWithVisualOverflow);
-    }
-
-    // CSS clip (different than clipping due to overflow) can clip to any box, even if it falls outside of the border box.
-    if (m_layoutObject.hasClip()) {
-        // Clip applies to *us* as well, so go ahead and update the damageRect.
-        LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset);
-        backgroundRect.intersect(newPosClip);
-        backgroundRect.setIsClippedByClipCss();
-        foregroundRect.intersect(newPosClip);
-        foregroundRect.setIsClippedByClipCss();
-    }
-}
-
-void DeprecatedPaintLayerClipper::calculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
-{
-    bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObject.document().settings()->rootLayerScrolls();
-    if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) {
-        // The root layer's clip rect is always infinite.
-        clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
-        return;
-    }
-
-    bool isClippingRoot = m_layoutObject.layer() == context.rootLayer;
-
-    // For transformed layers, the root layer was shifted to be us, so there is no need to
-    // examine the parent. We want to cache clip rects with us as the root.
-    DeprecatedPaintLayer* parentLayer = !isClippingRoot ? m_layoutObject.layer()->parent() : 0;
-    // Ensure that our parent's clip has been calculated so that we can examine the values.
-    if (parentLayer) {
-        // FIXME: Why don't we just call getClipRects here?
-        if (context.usesCache() && parentLayer->clipper().cachedClipRects(context)) {
-            clipRects = *parentLayer->clipper().cachedClipRects(context);
-        } else {
-            parentLayer->clipper().calculateClipRects(context, clipRects);
-        }
-    } else {
-        clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
-    }
-
-    adjustClipRectsForChildren(m_layoutObject, clipRects);
-
-    if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip()) {
-        // This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
-        // some transformed layer boundary, for example, in the DeprecatedPaintLayerCompositor overlapMap, where
-        // clipRects are needed in view space.
-        applyClipRects(context, m_layoutObject, roundedLayoutPoint(m_layoutObject.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipRects);
-    }
-}
-
-static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPosition position)
-{
-    if (position == FixedPosition)
-        return parentRects.fixedClipRect();
-
-    if (position == AbsolutePosition)
-        return parentRects.posClipRect();
-
-    return parentRects.overflowClipRect();
-}
-
-ClipRect DeprecatedPaintLayerClipper::backgroundClipRect(const ClipRectsContext& context) const
-{
-    ASSERT(m_layoutObject.layer()->parent());
-    ASSERT(m_layoutObject.view());
-
-    RefPtr<ClipRects> parentClipRects = ClipRects::create();
-    if (m_layoutObject.layer() == context.rootLayer)
-        parentClipRects->reset(LayoutRect(LayoutRect::infiniteIntRect()));
-    else
-        m_layoutObject.layer()->parent()->clipper().getOrCalculateClipRects(context, *parentClipRects);
-
-    ClipRect result = backgroundClipRectForPosition(*parentClipRects, m_layoutObject.style()->position());
-
-    // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite.
-    if (parentClipRects->fixed() && context.rootLayer->layoutObject() == m_layoutObject.view() && result != LayoutRect(LayoutRect::infiniteIntRect()))
-        result.move(toIntSize(m_layoutObject.view()->frameView()->scrollPosition()));
-
-    return result;
-}
-
-void DeprecatedPaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
-{
-    if (context.usesCache())
-        clipRects = *getClipRects(context);
-    else
-        calculateClipRects(context, clipRects);
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayerClipper::clippingRootForPainting() const
-{
-    const DeprecatedPaintLayer* current = m_layoutObject.layer();
-    // FIXME: getting rid of current->hasCompositedDeprecatedPaintLayerMapping() here breaks the
-    // compositing/backing/no-backing-for-clip.html layout test, because there is a
-    // "composited but paints into ancestor" layer involved. However, it doesn't make sense that
-    // that check would be appropriate here but not inside the while loop below.
-    if (current->isPaintInvalidationContainer() || current->hasCompositedDeprecatedPaintLayerMapping())
-        return const_cast<DeprecatedPaintLayer*>(current);
-
-    while (current) {
-        if (current->isRootLayer())
-            return const_cast<DeprecatedPaintLayer*>(current);
-
-        current = current->compositingContainer();
-        ASSERT(current);
-        if (current->transform() || current->isPaintInvalidationContainer())
-            return const_cast<DeprecatedPaintLayer*>(current);
-    }
-
-    ASSERT_NOT_REACHED();
-    return 0;
-}
-
-bool DeprecatedPaintLayerClipper::shouldRespectOverflowClip(const ClipRectsContext& context) const
-{
-    DeprecatedPaintLayer* layer = m_layoutObject.layer();
-    if (layer != context.rootLayer)
-        return true;
-
-    if (context.respectOverflowClip == IgnoreOverflowClip)
-        return false;
-
-    if (layer->isRootLayer() && context.respectOverflowClipForViewport == IgnoreOverflowClip)
-        return false;
-
-    return true;
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerClipper.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerClipper.h
deleted file mode 100644
index ed72150..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerClipper.h
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Intel Corporation. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#ifndef DeprecatedPaintLayerClipper_h
-#define DeprecatedPaintLayerClipper_h
-
-#include "core/layout/ClipRectsCache.h"
-#include "core/layout/LayoutBox.h"
-#include "wtf/Allocator.h"
-
-namespace blink {
-
-class DeprecatedPaintLayer;
-
-enum ShouldRespectOverflowClip {
-    IgnoreOverflowClip,
-    RespectOverflowClip
-};
-
-class ClipRectsContext {
-    STACK_ALLOCATED();
-public:
-    ClipRectsContext(const DeprecatedPaintLayer* root, ClipRectsCacheSlot slot, OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize, const LayoutSize& accumulation = LayoutSize())
-        : rootLayer(root)
-        , scrollbarRelevancy(relevancy)
-        , m_cacheSlot(slot)
-        , subPixelAccumulation(accumulation)
-        , respectOverflowClip(slot == PaintingClipRectsIgnoringOverflowClip ? IgnoreOverflowClip : RespectOverflowClip)
-        , respectOverflowClipForViewport(slot == RootRelativeClipRectsIgnoringViewportClip ? IgnoreOverflowClip : RespectOverflowClip)
-    {
-    }
-
-    void setIgnoreOverflowClip()
-    {
-        ASSERT(!usesCache() || m_cacheSlot == PaintingClipRects);
-        ASSERT(respectOverflowClip == RespectOverflowClip);
-        if (usesCache())
-            m_cacheSlot = PaintingClipRectsIgnoringOverflowClip;
-        respectOverflowClip = IgnoreOverflowClip;
-    }
-
-    bool usesCache() const
-    {
-        return m_cacheSlot != UncachedClipRects;
-    }
-
-    ClipRectsCacheSlot cacheSlot() const
-    {
-        return m_cacheSlot;
-    }
-
-    bool isComputingPaintingRect() const
-    {
-        return m_cacheSlot == PaintingClipRectsIgnoringOverflowClip || m_cacheSlot == PaintingClipRects;
-    }
-
-    const DeprecatedPaintLayer* rootLayer;
-    const OverlayScrollbarSizeRelevancy scrollbarRelevancy;
-
-private:
-    friend class DeprecatedPaintLayerClipper;
-
-    ClipRectsCacheSlot m_cacheSlot;
-    LayoutSize subPixelAccumulation;
-    ShouldRespectOverflowClip respectOverflowClip;
-    ShouldRespectOverflowClip respectOverflowClipForViewport;
-};
-
-// DeprecatedPaintLayerClipper is responsible for computing and caching clip
-// rects.
-//
-// The main reason for this cache is that we compute the clip rects during
-// a layout tree walk but need them during a paint tree walk (see example
-// below for some explanations).
-//
-// A lot of complexity in this class come from the difference in inheritance
-// between 'overflow' and 'clip':
-// * 'overflow' applies based on the containing blocks chain.
-//    (http://www.w3.org/TR/CSS2/visufx.html#propdef-overflow)
-// * 'clip' applies to all descendants.
-//    (http://www.w3.org/TR/CSS2/visufx.html#propdef-clip)
-//
-// Let's take an example:
-// <!DOCTYPE html>
-// <div id="container" style="position: absolute; height: 100px; width: 100px">
-//   <div id="inflow" style="height: 200px; width: 200px;
-//       background-color: purple"></div>
-//   <div id="fixed" style="height: 200px; width: 200px; position: fixed;
-//       background-color: orange"></div>
-// </div>
-//
-// The paint tree looks like:
-//               html
-//              /   |
-//             /    |
-//            /     |
-//      container  fixed
-//         |
-//         |
-//       inflow
-//
-// If we add "overflow: hidden" to #container, the overflow clip will apply to
-// #inflow but not to #fixed. That's because #fixed's containing block is above
-// #container and thus 'overflow' doesn't apply to it. During our tree walk,
-// #fixed is a child of #container, which is the reason why we keep 3 clip rects
-// depending on the 'position' of the elements.
-//
-// Now instead if we add "clip: rect(0px, 100px, 100px, 0px)" to #container,
-// the clip will apply to both #inflow and #fixed. That's because 'clip'
-// applies to any descendant, regardless of containing blocks. Note that
-// #container and #fixed are siblings in the paint tree but #container does
-// clip #fixed. This is the reason why we compute the painting clip rects during
-// a layout tree walk and cache them for painting.
-//
-// This class is NOT DEPRECATED, DeprecatedPaintLayer is and we match its
-// naming.
-class DeprecatedPaintLayerClipper {
-    DISALLOW_ALLOCATION();
-    WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerClipper);
-public:
-    explicit DeprecatedPaintLayerClipper(const LayoutBoxModelObject&);
-
-    void clearClipRectsIncludingDescendants();
-    void clearClipRectsIncludingDescendants(ClipRectsCacheSlot);
-
-    LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.
-    LayoutRect localClipRect() const; // Returns the background clip rect of the layer in the local coordinate space.
-
-    ClipRects* getClipRects(const ClipRectsContext&) const;
-
-    ClipRect backgroundClipRect(const ClipRectsContext&) const;
-
-    // This method figures out our layerBounds in coordinates relative to
-    // |rootLayer|. It also computes our background and foreground clip rects
-    // for painting/event handling.
-    // Pass offsetFromRoot if known.
-    void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
-        ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutPoint* offsetFromRoot = 0) const;
-private:
-    void calculateClipRects(const ClipRectsContext&, ClipRects&) const;
-    ClipRects* clipRectsIfCached(const ClipRectsContext&) const;
-    ClipRects* storeClipRectsInCache(const ClipRectsContext&, ClipRects* parentClipRects, const ClipRects&) const;
-
-    // cachedClipRects looks buggy: It doesn't check whether context.rootLayer and entry.root match.
-    // FIXME: Move callers to clipRectsIfCached, which does the proper checks.
-    ClipRects* cachedClipRects(const ClipRectsContext& context) const
-    {
-        return m_cache ? m_cache->get(context.cacheSlot()).clipRects.get() : 0;
-    }
-    void getOrCalculateClipRects(const ClipRectsContext&, ClipRects&) const;
-
-    DeprecatedPaintLayer* clippingRootForPainting() const;
-
-    ClipRectsCache& cache() const
-    {
-        if (!m_cache)
-            m_cache = adoptPtr(new ClipRectsCache);
-        return *m_cache;
-    }
-
-    bool shouldRespectOverflowClip(const ClipRectsContext&) const;
-
-    // FIXME: Could this be a LayoutBox?
-    const LayoutBoxModelObject& m_layoutObject;
-
-    // Lazily created by 'cache() const'.
-    mutable OwnPtr<ClipRectsCache> m_cache;
-};
-
-} // namespace blink
-
-#endif // LayerClipper_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFilterInfo.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFilterInfo.cpp
deleted file mode 100644
index a83ffb2..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFilterInfo.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer in the documentation and/or other materials
- *    provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/paint/DeprecatedPaintLayerFilterInfo.h"
-
-#include "core/fetch/DocumentResourceReference.h"
-#include "core/layout/svg/LayoutSVGResourceContainer.h"
-#include "core/layout/svg/ReferenceFilterBuilder.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/FilterEffectBuilder.h"
-#include "core/svg/SVGFilterElement.h"
-
-namespace blink {
-
-DeprecatedPaintLayerFilterInfoMap* DeprecatedPaintLayerFilterInfo::s_filterMap = 0;
-
-DeprecatedPaintLayerFilterInfo* DeprecatedPaintLayerFilterInfo::filterInfoForLayer(const DeprecatedPaintLayer* layer)
-{
-    if (!s_filterMap)
-        return 0;
-    DeprecatedPaintLayerFilterInfoMap::iterator iter = s_filterMap->find(layer);
-    return (iter != s_filterMap->end()) ? iter->value : 0;
-}
-
-DeprecatedPaintLayerFilterInfo* DeprecatedPaintLayerFilterInfo::createFilterInfoForLayerIfNeeded(DeprecatedPaintLayer* layer)
-{
-    if (!s_filterMap)
-        s_filterMap = new DeprecatedPaintLayerFilterInfoMap();
-
-    DeprecatedPaintLayerFilterInfoMap::iterator iter = s_filterMap->find(layer);
-    if (iter != s_filterMap->end()) {
-        ASSERT(layer->hasFilterInfo());
-        return iter->value;
-    }
-
-    DeprecatedPaintLayerFilterInfo* filter = new DeprecatedPaintLayerFilterInfo(layer);
-    s_filterMap->set(layer, filter);
-    layer->setHasFilterInfo(true);
-    return filter;
-}
-
-void DeprecatedPaintLayerFilterInfo::removeFilterInfoForLayer(DeprecatedPaintLayer* layer)
-{
-    if (!s_filterMap)
-        return;
-    DeprecatedPaintLayerFilterInfo* filter = s_filterMap->take(layer);
-    if (s_filterMap->isEmpty()) {
-        delete s_filterMap;
-        s_filterMap = 0;
-    }
-    if (!filter) {
-        ASSERT(!layer->hasFilterInfo());
-        return;
-    }
-    layer->setHasFilterInfo(false);
-    delete filter;
-}
-
-DeprecatedPaintLayerFilterInfo::DeprecatedPaintLayerFilterInfo(DeprecatedPaintLayer* layer)
-    : m_layer(layer)
-{
-}
-
-DeprecatedPaintLayerFilterInfo::~DeprecatedPaintLayerFilterInfo()
-{
-    removeReferenceFilterClients();
-}
-
-void DeprecatedPaintLayerFilterInfo::setBuilder(PassRefPtrWillBeRawPtr<FilterEffectBuilder> builder)
-{
-    m_builder = builder;
-}
-
-void DeprecatedPaintLayerFilterInfo::notifyFinished(Resource*)
-{
-    m_layer->filterNeedsPaintInvalidation();
-}
-
-void DeprecatedPaintLayerFilterInfo::updateReferenceFilterClients(const FilterOperations& operations)
-{
-    removeReferenceFilterClients();
-    for (size_t i = 0; i < operations.size(); ++i) {
-        RefPtrWillBeRawPtr<FilterOperation> filterOperation = operations.operations().at(i);
-        if (filterOperation->type() != FilterOperation::REFERENCE)
-            continue;
-        ReferenceFilterOperation* referenceFilterOperation = toReferenceFilterOperation(filterOperation.get());
-        DocumentResourceReference* documentReference = ReferenceFilterBuilder::documentResourceReference(referenceFilterOperation);
-        DocumentResource* cachedSVGDocument = documentReference ? documentReference->document() : 0;
-
-        if (cachedSVGDocument) {
-            // Reference is external; wait for notifyFinished().
-            cachedSVGDocument->addClient(this);
-            m_externalSVGReferences.append(cachedSVGDocument);
-        } else {
-            // Reference is internal; add layer as a client so we can trigger
-            // filter paint invalidation on SVG attribute change.
-            Element* filter = m_layer->layoutObject()->node()->document().getElementById(referenceFilterOperation->fragment());
-            if (!isSVGFilterElement(filter))
-                continue;
-            if (filter->layoutObject())
-                toLayoutSVGResourceContainer(filter->layoutObject())->addClientLayer(m_layer);
-            else
-                toSVGFilterElement(filter)->addClient(m_layer->layoutObject()->node());
-            m_internalSVGReferences.append(filter);
-        }
-    }
-}
-
-void DeprecatedPaintLayerFilterInfo::removeReferenceFilterClients()
-{
-    for (size_t i = 0; i < m_externalSVGReferences.size(); ++i)
-        m_externalSVGReferences.at(i)->removeClient(this);
-    m_externalSVGReferences.clear();
-    for (size_t i = 0; i < m_internalSVGReferences.size(); ++i) {
-        Element* filter = m_internalSVGReferences.at(i).get();
-        if (filter->layoutObject())
-            toLayoutSVGResourceContainer(filter->layoutObject())->removeClientLayer(m_layer);
-        else
-            toSVGFilterElement(filter)->removeClient(m_layer->layoutObject()->node());
-    }
-    m_internalSVGReferences.clear();
-}
-
-} // namespace blink
-
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFilterInfo.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFilterInfo.h
deleted file mode 100644
index 244ce67..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFilterInfo.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer.
- * 2. Redistributions in binary form must reproduce the above
- *    copyright notice, this list of conditions and the following
- *    disclaimer in the documentation and/or other materials
- *    provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef DeprecatedPaintLayerFilterInfo_h
-#define DeprecatedPaintLayerFilterInfo_h
-
-#include "core/dom/Element.h"
-#include "core/fetch/DocumentResource.h"
-#include "platform/geometry/LayoutRect.h"
-#include "platform/graphics/filters/FilterOperation.h"
-#include "wtf/HashMap.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/PassRefPtr.h"
-#include "wtf/RefPtr.h"
-
-namespace blink {
-
-class FilterEffectBuilder;
-class FilterOperations;
-class DeprecatedPaintLayer;
-class DeprecatedPaintLayerFilterInfo;
-
-typedef HashMap<const DeprecatedPaintLayer*, DeprecatedPaintLayerFilterInfo*> DeprecatedPaintLayerFilterInfoMap;
-
-class DeprecatedPaintLayerFilterInfo final : public DocumentResourceClient {
-    WTF_MAKE_FAST_ALLOCATED(DeprecatedPaintLayerFilterInfo);
-    WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerFilterInfo);
-public:
-    static DeprecatedPaintLayerFilterInfo* filterInfoForLayer(const DeprecatedPaintLayer*);
-    static DeprecatedPaintLayerFilterInfo* createFilterInfoForLayerIfNeeded(DeprecatedPaintLayer*);
-    static void removeFilterInfoForLayer(DeprecatedPaintLayer*);
-
-    FilterEffectBuilder* builder() const { return m_builder.get(); }
-    void setBuilder(PassRefPtrWillBeRawPtr<FilterEffectBuilder>);
-
-    void updateReferenceFilterClients(const FilterOperations&);
-    void notifyFinished(Resource*) override;
-    void removeReferenceFilterClients();
-
-private:
-    DeprecatedPaintLayerFilterInfo(DeprecatedPaintLayer*);
-    ~DeprecatedPaintLayerFilterInfo() override;
-
-    DeprecatedPaintLayer* m_layer;
-
-    RefPtrWillBePersistent<FilterEffectBuilder> m_builder;
-
-    static DeprecatedPaintLayerFilterInfoMap* s_filterMap;
-    WillBePersistentHeapVector<RefPtrWillBeMember<Element>> m_internalSVGReferences;
-    Vector<ResourcePtr<DocumentResource>> m_externalSVGReferences;
-};
-
-} // namespace blink
-
-
-#endif // DeprecatedPaintLayerFilterInfo_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFragment.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFragment.h
deleted file mode 100644
index 9dcde15d..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerFragment.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DeprecatedPaintLayerFragment_h
-#define DeprecatedPaintLayerFragment_h
-
-#include "core/layout/ClipRect.h"
-#include "wtf/Allocator.h"
-#include "wtf/Vector.h"
-
-namespace blink {
-
-// DeprecatedPaintLayerFragment is the representation of a fragment.
-// https://drafts.csswg.org/css-break/#fragment
-//
-// Fragments are a paint/hit-testing only concept in Blink.
-// Every box has at least one fragment, even if it is not paginated/fragmented.
-// If a box has more than one fragment (i.e. is paginated by an ancestor), the
-// fragments are called "paginated fragments". Note that this is a Blink
-// vocabulary extension and doesn't come from the specification.
-//
-// The fragments are collected by calling DeprecatedPaintLayer::collectFragments
-// on every box once per paint/hit-testing operation.
-struct DeprecatedPaintLayerFragment {
-    ALLOW_ONLY_INLINE_ALLOCATION();
-public:
-    void setRects(const LayoutRect& bounds, const ClipRect& background, const ClipRect& foreground)
-    {
-        layerBounds = bounds;
-        backgroundRect = background;
-        foregroundRect = foreground;
-    }
-
-    void moveBy(const LayoutPoint& offset)
-    {
-        layerBounds.moveBy(offset);
-        backgroundRect.moveBy(offset);
-        foregroundRect.moveBy(offset);
-        paginationClip.moveBy(offset);
-    }
-
-    void intersect(const LayoutRect& rect)
-    {
-        backgroundRect.intersect(rect);
-        foregroundRect.intersect(rect);
-    }
-
-    // Set on all fragments.
-    //
-    // The DeprecatedPaintLayer's size in the associated ClipRectsContext's
-    // rootLayer coordinate system. See DeprecatedPaintLayer::m_size for the
-    // exact rectangle.
-    //
-    // TODO(jchaffraix): We should store the rootLayer here to ensure we don't
-    // mix coordinate systems by mistake.
-    LayoutRect layerBounds;
-
-    // Set on all fragments.
-    //
-    // The rectangle used to clip the background.
-    //
-    // The rectangle is the rectangle-to-paint if no clip applies to the
-    // fragment. It is the intersection between the visual overflow rect
-    // and any overflow clips or 'clip' properties. It is also intersected with
-    // |paginationClip| if it is present.
-    //
-    // See DeprecatedPaintLayerClipper::calculateRects.
-    ClipRect backgroundRect;
-
-    // Set on all fragments.
-    //
-    // The rectangle used to clip the content (foreground).
-    //
-    // The rectangle is the rectangle-to-paint if no clip applies to the
-    // fragment. If there is an overflow clip, the rectangle-to-paint is
-    // intersected with the border box rect without the scrollbars (content gets
-    // clipped at their edge). Also any enclosing 'clip' properties get applied
-    // to the intersected rectangle. It is also intersected with
-    // |paginationClip| if it is present.
-    //
-    // See DeprecatedPaintLayerClipper::calculateRects.
-    ClipRect foregroundRect;
-
-    // Only set on paginated fragments.
-    //
-    // The physical translation to apply to shift the layer when
-    // painting/hit-testing.
-    LayoutPoint paginationOffset;
-
-    // Only set on paginated fragments.
-    //
-    // This is the additional clip from the fragmentainer (i.e. column or
-    // page) that applies to the layer. |backgroundRect| and |foregroundRect|
-    // are intersected with it (see collectFragments).
-    //
-    // It is in layer-local (physical) coordinates.
-    LayoutRect paginationClip;
-};
-
-typedef Vector<DeprecatedPaintLayerFragment, 1> DeprecatedPaintLayerFragments;
-
-} // namespace blink
-
-#endif // DeprecatedPaintLayerFragment_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp
deleted file mode 100644
index e036df4..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.cpp
+++ /dev/null
@@ -1,703 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
-
-#include "core/frame/Settings.h"
-#include "core/layout/ClipPathOperation.h"
-#include "core/layout/LayoutBlock.h"
-#include "core/layout/LayoutView.h"
-#include "core/layout/svg/LayoutSVGResourceClipper.h"
-#include "core/page/Page.h"
-#include "core/paint/CompositingRecorder.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/FilterPainter.h"
-#include "core/paint/LayerClipRecorder.h"
-#include "core/paint/LayerFixedPositionRecorder.h"
-#include "core/paint/PaintInfo.h"
-#include "core/paint/SVGClipPainter.h"
-#include "core/paint/ScopeRecorder.h"
-#include "core/paint/ScrollRecorder.h"
-#include "core/paint/ScrollableAreaPainter.h"
-#include "core/paint/Transform3DRecorder.h"
-#include "platform/geometry/FloatPoint3D.h"
-#include "platform/graphics/GraphicsLayer.h"
-#include "platform/graphics/paint/ClipPathRecorder.h"
-#include "platform/graphics/paint/ClipRecorder.h"
-#include "platform/graphics/paint/CompositingDisplayItem.h"
-#include "platform/graphics/paint/SubsequenceRecorder.h"
-#include "platform/graphics/paint/Transform3DDisplayItem.h"
-#include "wtf/Optional.h"
-
-namespace blink {
-
-static inline bool shouldSuppressPaintingLayer(DeprecatedPaintLayer* layer)
-{
-    // Avoid painting descendants of the root layer when stylesheets haven't loaded. This eliminates FOUC.
-    // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
-    // will do a full paintInvalidationForWholeLayoutObject().
-    if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && !layer->isRootLayer() && !layer->layoutObject()->isDocumentElement())
-        return true;
-
-    return false;
-}
-
-void DeprecatedPaintLayerPainter::paint(GraphicsContext* context, const LayoutRect& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingRoot, PaintLayerFlags paintFlags)
-{
-    DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot);
-    if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags))
-        paintLayer(context, paintingInfo, paintFlags);
-}
-
-static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paintFlags, const LayoutObject* layoutObject)
-{
-    return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & PaintLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreOverflowClip : RespectOverflowClip;
-}
-
-DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayer(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
-{
-    PaintResult result = paintLayerInternal(context, paintingInfo, paintFlags);
-    m_paintLayer.clearNeedsRepaint();
-    return result;
-}
-
-DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayerInternal(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
-{
-    // https://code.google.com/p/chromium/issues/detail?id=343772
-    DisableCompositingQueryAsserts disabler;
-
-    if (m_paintLayer.compositingState() != NotComposited) {
-        if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers) {
-            // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? That's for printing and drag-image.
-            // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call?
-            paintFlags |= PaintLayerUncachedClipRects;
-        }
-    }
-
-    // Non self-painting layers without self-painting descendants don't need to be painted as their
-    // layoutObject() should properly paint itself.
-    if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLayerDescendant()) {
-        ASSERT(!m_paintLayer.needsRepaint() || !RuntimeEnabledFeatures::slimmingPaintV2Enabled());
-        return FullyPainted;
-    }
-
-    if (shouldSuppressPaintingLayer(&m_paintLayer))
-        return FullyPainted;
-
-    // If this layer is totally invisible then there is nothing to paint.
-    if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()->hasBackdropFilter())
-        return FullyPainted;
-
-    if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags()))
-        paintFlags |= PaintLayerHaveTransparency;
-
-    LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.layoutObject());
-
-    // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying the transform twice.
-    if (m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(paintFlags & PaintLayerAppliedTransform))
-        return paintLayerWithTransform(context, paintingInfo, paintFlags);
-
-    return paintLayerContentsAndReflection(context, paintingInfo, paintFlags);
-}
-
-DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayerContentsAndReflection(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy)
-{
-    ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLayerDescendant());
-
-    PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform);
-
-    PaintResult result = FullyPainted;
-
-    // Paint the reflection first if we have one.
-    if (m_paintLayer.reflectionInfo()) {
-        ScopeRecorder scopeRecorder(*context);
-        m_paintLayer.reflectionInfo()->paint(context, paintingInfo, localPaintFlags | PaintLayerPaintingReflection);
-        result = MaybeNotFullyPainted;
-    }
-
-    localPaintFlags |= PaintLayerPaintingCompositingAllPhases;
-    if (paintLayerContentsInternal(context, paintingInfo, localPaintFlags, fragmentPolicy) == MaybeNotFullyPainted)
-        result = MaybeNotFullyPainted;
-
-    return result;
-}
-
-class ClipPathHelper {
-public:
-    ClipPathHelper(GraphicsContext* context, const DeprecatedPaintLayer& paintLayer, DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed,
-        const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags)
-        : m_resourceClipper(0), m_paintLayer(paintLayer), m_context(context)
-    {
-        const ComputedStyle& style = paintLayer.layoutObject()->styleRef();
-
-        // Clip-path, like border radius, must not be applied to the contents of a composited-scrolling container.
-        // It must, however, still be applied to the mask layer, so that the compositor can properly mask the
-        // scrolling contents and scrollbars.
-        if (!paintLayer.layoutObject()->hasClipPath() || (paintLayer.needsCompositedScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase)))
-            return;
-
-        m_clipperState = SVGClipPainter::ClipperNotApplied;
-
-        paintingInfo.ancestorHasClipPathClipping = true;
-
-        ASSERT(style.clipPath());
-        if (style.clipPath()->type() == ClipPathOperation::SHAPE) {
-            ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style.clipPath());
-            if (clipPath->isValid()) {
-                if (!rootRelativeBoundsComputed) {
-                    rootRelativeBounds = paintLayer.physicalBoundingBoxIncludingReflectionAndStackingChildren(offsetFromRoot);
-                    rootRelativeBoundsComputed = true;
-                }
-                m_clipPathRecorder.emplace(*context, *paintLayer.layoutObject(), clipPath->path(FloatRect(rootRelativeBounds)));
-            }
-        } else if (style.clipPath()->type() == ClipPathOperation::REFERENCE) {
-            ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClipPathOperation(style.clipPath());
-            Document& document = paintLayer.layoutObject()->document();
-            // FIXME: It doesn't work with forward or external SVG references (https://bugs.webkit.org/show_bug.cgi?id=90405)
-            Element* element = document.getElementById(referenceClipPathOperation->fragment());
-            if (isSVGClipPathElement(element) && element->layoutObject()) {
-                if (!rootRelativeBoundsComputed) {
-                    rootRelativeBounds = paintLayer.physicalBoundingBoxIncludingReflectionAndStackingChildren(offsetFromRoot);
-                    rootRelativeBoundsComputed = true;
-                }
-
-                m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResourceContainer(element->layoutObject()));
-                if (!SVGClipPainter(*m_resourceClipper).prepareEffect(*paintLayer.layoutObject(), FloatRect(rootRelativeBounds),
-                    FloatRect(paintingInfo.paintDirtyRect), context, m_clipperState)) {
-                    // No need to post-apply the clipper if this failed.
-                    m_resourceClipper = 0;
-                }
-            }
-        }
-    }
-
-    ~ClipPathHelper()
-    {
-        if (m_resourceClipper)
-            SVGClipPainter(*m_resourceClipper).finishEffect(*m_paintLayer.layoutObject(), m_context, m_clipperState);
-    }
-private:
-    LayoutSVGResourceClipper* m_resourceClipper;
-    Optional<ClipPathRecorder> m_clipPathRecorder;
-    SVGClipPainter::ClipperState m_clipperState;
-    const DeprecatedPaintLayer& m_paintLayer;
-    GraphicsContext* m_context;
-};
-
-DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayerContents(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy)
-{
-    PaintResult result = paintLayerContentsInternal(context, paintingInfo, paintFlags, fragmentPolicy);
-    m_paintLayer.clearNeedsRepaint();
-    return result;
-}
-
-DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayerContentsInternal(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfoArg, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy)
-{
-    ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLayerDescendant());
-    ASSERT(!(paintFlags & PaintLayerAppliedTransform));
-
-    bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer();
-    bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScrollbars;
-    bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositingScrollingPhase;
-    bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingCompositingForegroundPhase;
-    bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingCompositingBackgroundPhase;
-    bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowContents;
-    // Outline always needs to be painted even if we have no visible content. Also,
-    // the outline is painted in the background phase during composited scrolling.
-    // If it were painted in the foreground phase, it would move with the scrolled
-    // content. When not composited scrolling, the outline is painted in the
-    // foreground phase. Since scrolled contents are moved by paint invalidation in this
-    // case, the outline won't get 'dragged along'.
-    bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbars
-        && ((isPaintingScrollingContent && isPaintingCompositedBackground)
-        || (!isPaintingScrollingContent && isPaintingCompositedForeground));
-    bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPaintingLayer && !isPaintingOverlayScrollbars;
-
-    PaintResult result = FullyPainted;
-
-    if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layoutObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement())
-        return result;
-
-    DeprecatedPaintLayerPaintingInfo paintingInfo = paintingInfoArg;
-
-    // Ensure our lists are up-to-date.
-    m_paintLayer.stackingNode()->updateLayerListsIfNeeded();
-
-    LayoutPoint offsetFromRoot;
-    m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
-
-    if (m_paintLayer.compositingState() == PaintsIntoOwnBacking)
-        offsetFromRoot.move(m_paintLayer.subpixelAccumulation());
-    else
-        offsetFromRoot.move(paintingInfo.subPixelAccumulation);
-
-    LayoutRect bounds = m_paintLayer.physicalBoundingBox(offsetFromRoot);
-    if (!paintingInfo.paintDirtyRect.contains(bounds))
-        result = MaybeNotFullyPainted;
-
-    LayoutRect rootRelativeBounds;
-    bool rootRelativeBoundsComputed = false;
-
-    if (paintingInfo.ancestorHasClipPathClipping && m_paintLayer.layoutObject()->style()->position() != StaticPosition)
-        UseCounter::count(m_paintLayer.layoutObject()->document(), UseCounter::ClipPathOfPositionedElement);
-
-    // These helpers output clip and compositing operations using a RAII pattern. Stack-allocated-varibles are destructed in the reverse order of construction,
-    // so they are nested properly.
-    ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo, rootRelativeBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags);
-
-    Optional<CompositingRecorder> compositingRecorder;
-    // Blending operations must be performed only with the nearest ancestor stacking context.
-    // Note that there is no need to composite if we're painting the root.
-    // FIXME: this should be unified further into DeprecatedPaintLayer::paintsWithTransparency().
-    bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocumentElement() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingNode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode();
-    if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) {
-        FloatRect compositingBounds = FloatRect(m_paintLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.globalPaintFlags()));
-        compositingRecorder.emplace(*context, *m_paintLayer.layoutObject(),
-            WebCoreCompositeToSkiaComposite(CompositeSourceOver, m_paintLayer.layoutObject()->style()->blendMode()),
-            m_paintLayer.layoutObject()->opacity(), &compositingBounds);
-    }
-
-    DeprecatedPaintLayerPaintingInfo localPaintingInfo(paintingInfo);
-    if (m_paintLayer.compositingState() == PaintsIntoOwnBacking)
-        localPaintingInfo.subPixelAccumulation = m_paintLayer.subpixelAccumulation();
-
-    DeprecatedPaintLayerFragments layerFragments;
-    if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
-        // Collect the fragments. This will compute the clip rectangles and paint offsets for each layer fragment.
-        ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects;
-        ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject());
-        if (fragmentPolicy == ForceSingleFragment)
-            m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
-        else
-            m_paintLayer.collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
-        if (shouldPaintContent) {
-            // TODO(wangxianzhu): This is for old slow scrolling. Implement similar optimization for slimming paint v2.
-            shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFragments, localPaintingInfo, paintFlags, offsetFromRoot);
-            if (!shouldPaintContent)
-                result = MaybeNotFullyPainted;
-        }
-    }
-
-    bool selectionOnly = localPaintingInfo.globalPaintFlags() & GlobalPaintSelectionOnly;
-    // If this layer's layoutObject is a child of the paintingRoot, we paint unconditionally, which
-    // is done by passing a nil paintingRoot down to our layoutObject (as if no paintingRoot was ever set).
-    // Else, our layout tree may or may not contain the painting root, so we pass that root along
-    // so it will be tested against as we descend through the layoutObjects.
-    LayoutObject* paintingRootForLayoutObject = 0;
-    if (localPaintingInfo.paintingRoot && !m_paintLayer.layoutObject()->isDescendantOf(localPaintingInfo.paintingRoot))
-        paintingRootForLayoutObject = localPaintingInfo.paintingRoot;
-
-    { // Begin block for the lifetime of any filter.
-        FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot, layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect, localPaintingInfo, paintFlags,
-            rootRelativeBounds, rootRelativeBoundsComputed);
-
-        bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintContent && !selectionOnly;
-        bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintingOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground);
-        bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPaintContent;
-        bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground;
-        bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars;
-
-        if (shouldPaintBackground) {
-            paintBackgroundForFragments(layerFragments, context, paintingInfo.paintDirtyRect,
-                localPaintingInfo, paintingRootForLayoutObject, paintFlags);
-        }
-
-        if (shouldPaintNegZOrderList) {
-            if (paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFlags) == MaybeNotFullyPainted)
-                result = MaybeNotFullyPainted;
-        }
-
-        if (shouldPaintOwnContents) {
-            paintForegroundForFragments(layerFragments, context, paintingInfo.paintDirtyRect,
-                localPaintingInfo, paintingRootForLayoutObject, selectionOnly, paintFlags);
-        }
-
-        if (shouldPaintOutline)
-            paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags);
-
-        if (shouldPaintNormalFlowAndPosZOrderLists) {
-            if (paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags) == MaybeNotFullyPainted)
-                result = MaybeNotFullyPainted;
-        }
-
-        if (shouldPaintOverlayScrollbars)
-            paintOverflowControlsForFragments(layerFragments, context, localPaintingInfo, paintFlags);
-    } // FilterPainter block
-
-    bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_paintLayer.layoutObject()->hasMask() && !selectionOnly;
-    bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClippingMaskPhase) && shouldPaintContent && !selectionOnly;
-
-    if (shouldPaintMask)
-        paintMaskForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags);
-    if (shouldPaintClippingMask) {
-        // Paint the border radius mask for the fragments.
-        paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags);
-    }
-
-    m_paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfoArg.scrollOffsetAccumulation);
-
-    return result;
-}
-
-bool DeprecatedPaintLayerPainter::needsToClip(const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, const ClipRect& clipRect)
-{
-    return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRadius();
-}
-
-bool DeprecatedPaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(DeprecatedPaintLayerFragments& fragments, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot)
-{
-    if (m_paintLayer.enclosingPaginationLayer())
-        return true; // The fragments created have already been found to intersect with the damage rect.
-
-    if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & PaintLayerPaintingOverflowContents))
-        return true;
-
-    for (DeprecatedPaintLayerFragment& fragment: fragments) {
-        LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffset;
-        // Note that this really only works reliably on the first fragment. If the layer has visible
-        // overflow and a subsequent fragment doesn't intersect with the border box of the layer
-        // (i.e. only contains an overflow portion of the layer), intersection will fail. The reason
-        // for this is that fragment.layerBounds is set to the border box, not the bounding box, of
-        // the layer.
-        if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), newOffsetFromRoot))
-            return true;
-    }
-    return false;
-}
-
-DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintLayerWithTransform(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
-{
-    TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paintingInfo.globalPaintFlags());
-    // If the transform can't be inverted, then don't paint anything.
-    if (!layerTransform.isInvertible())
-        return FullyPainted;
-
-    // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer here.
-    // m_paintLayer may be the "root", and then we should avoid looking at its parent.
-    DeprecatedPaintLayer* parentLayer = m_paintLayer.parent();
-
-    ClipRect ancestorBackgroundClipRect;
-    if (parentLayer) {
-        // Calculate the clip rectangle that the ancestors establish.
-        ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize);
-        if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) == IgnoreOverflowClip)
-            clipRectsContext.setIgnoreOverflowClip();
-        ancestorBackgroundClipRect = m_paintLayer.clipper().backgroundClipRect(clipRectsContext);
-    }
-
-    DeprecatedPaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer();
-    DeprecatedPaintLayerFragments fragments;
-    if (paginationLayer) {
-        // FIXME: This is a mess. Look closely at this code and the code in Layer and fix any
-        // issues in it & refactor to make it obvious from code structure what it does and that it's
-        // correct.
-        ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects;
-        ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject());
-        // Calculate the transformed bounding box in the current coordinate space, to figure out
-        // which fragmentainers (e.g. columns) we need to visit.
-        LayoutRect transformedExtent = DeprecatedPaintLayer::transparencyClipBox(&m_paintLayer, paginationLayer, DeprecatedPaintLayer::PaintingTransparencyClipBox, DeprecatedPaintLayer::RootOfTransparencyClipBox, paintingInfo.subPixelAccumulation, paintingInfo.globalPaintFlags());
-        // FIXME: we don't check if paginationLayer is within paintingInfo.rootLayer here.
-        paginationLayer->collectFragments(fragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, 0, paintingInfo.subPixelAccumulation, &transformedExtent);
-    } else {
-        // We don't need to collect any fragments in the regular way here. We have already
-        // calculated a clip rectangle for the ancestry if it was needed, and clipping this
-        // layer is something that can be done further down the path, when the transform has
-        // been applied.
-        DeprecatedPaintLayerFragment fragment;
-        fragment.backgroundRect = paintingInfo.paintDirtyRect;
-        fragments.append(fragment);
-    }
-
-    bool needsScope = fragments.size() > 1;
-    PaintResult result = FullyPainted;
-    for (const auto& fragment : fragments) {
-        Optional<ScopeRecorder> scopeRecorder;
-        if (needsScope)
-            scopeRecorder.emplace(*context);
-        Optional<LayerClipRecorder> clipRecorder;
-        if (parentLayer) {
-            ClipRect clipRectForFragment(ancestorBackgroundClipRect);
-            clipRectForFragment.moveBy(fragment.paginationOffset);
-            clipRectForFragment.intersect(fragment.backgroundRect);
-            if (clipRectForFragment.isEmpty())
-                continue;
-            if (needsToClip(paintingInfo, clipRectForFragment)) {
-                if (m_paintLayer.layoutObject()->style()->position() != StaticPosition && clipRectForFragment.isClippedByClipCss())
-                    UseCounter::count(m_paintLayer.layoutObject()->document(), UseCounter::ClipCssOfPositionedElement);
-                clipRecorder.emplace(*context, *parentLayer->layoutObject(), DisplayItem::ClipLayerParent, clipRectForFragment, &paintingInfo, fragment.paginationOffset, paintFlags);
-            }
-        }
-        if (paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, fragment.paginationOffset) == MaybeNotFullyPainted)
-            result = MaybeNotFullyPainted;
-    }
-    return result;
-}
-
-DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintFragmentByApplyingTransform(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& fragmentTranslation)
-{
-    // This involves subtracting out the position of the layer in our current coordinate space, but preserving
-    // the accumulated error for sub-pixel layout.
-    LayoutPoint delta;
-    m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta);
-    delta.moveBy(fragmentTranslation);
-    TransformationMatrix transform(m_paintLayer.renderableTransform(paintingInfo.globalPaintFlags()));
-    IntPoint roundedDelta = roundedIntPoint(delta);
-    transform.translateRight(roundedDelta.x(), roundedDelta.y());
-    LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta);
-
-    // TODO(jbroman): Put the real transform origin here, instead of using a
-    // matrix with the origin baked in.
-    FloatPoint3D transformOrigin;
-    Transform3DRecorder transform3DRecorder(*context, *m_paintLayer.layoutObject(), DisplayItem::Transform3DElementTransform, transform, transformOrigin);
-
-    // Now do a paint with the root layer shifted to be us.
-    DeprecatedPaintLayerPaintingInfo transformedPaintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect))), paintingInfo.globalPaintFlags(),
-        adjustedSubPixelAccumulation, paintingInfo.paintingRoot);
-    transformedPaintingInfo.ancestorHasClipPathClipping = paintingInfo.ancestorHasClipPathClipping;
-    return paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags, ForceSingleFragment);
-}
-
-DeprecatedPaintLayerPainter::PaintResult DeprecatedPaintLayerPainter::paintChildren(unsigned childrenToVisit, GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
-{
-    PaintResult result = FullyPainted;
-    if (!m_paintLayer.hasSelfPaintingLayerDescendant())
-        return result;
-
-#if ENABLE(ASSERT)
-    LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode());
-#endif
-
-    DeprecatedPaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode(), childrenToVisit);
-    DeprecatedPaintLayerStackingNode* child = iterator.next();
-    if (!child)
-        return result;
-
-    DisplayItem::Type subsequenceType;
-    if (childrenToVisit == NegativeZOrderChildren) {
-        subsequenceType = DisplayItem::SubsequenceNegativeZOrder;
-    } else {
-        ASSERT(childrenToVisit == (NormalFlowChildren | PositiveZOrderChildren));
-        subsequenceType = DisplayItem::SubsequenceNormalFlowAndPositiveZOrder;
-    }
-
-    Optional<SubsequenceRecorder> subsequenceRecorder;
-    if (!paintingInfo.disableSubsequenceCache
-        && !(paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers)
-        && !(paintFlags & PaintLayerPaintingReflection)
-        && !(paintFlags & PaintLayerPaintingRootBackgroundOnly)) {
-        if (!m_paintLayer.needsRepaint()
-            && paintingInfo.scrollOffsetAccumulation == m_paintLayer.previousScrollOffsetAccumulationForPainting()
-            && SubsequenceRecorder::useCachedSubsequenceIfPossible(*context, m_paintLayer, subsequenceType))
-            return result;
-        subsequenceRecorder.emplace(*context, m_paintLayer, subsequenceType);
-    }
-
-    IntSize scrollOffsetAccumulationForChildren = paintingInfo.scrollOffsetAccumulation;
-    if (m_paintLayer.layoutObject()->hasOverflowClip())
-        scrollOffsetAccumulationForChildren += m_paintLayer.layoutBox()->scrolledContentOffset();
-
-    bool disableChildSubsequenceCache = !RuntimeEnabledFeatures::slimmingPaintV2Enabled()
-        && (m_paintLayer.layoutObject()->hasOverflowClip() || m_paintLayer.layoutObject()->hasClip());
-
-    for (; child; child = iterator.next()) {
-        DeprecatedPaintLayerPainter childPainter(*child->layer());
-        // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedDeprecatedPaintLayerMapping::paintContents()
-        // and CompositedDeprecatedPaintLayerMapping::doPaintTask().
-        if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPaintFlags(), paintFlags))
-            continue;
-
-        DeprecatedPaintLayerPaintingInfo childPaintingInfo = paintingInfo;
-        childPaintingInfo.disableSubsequenceCache = disableChildSubsequenceCache;
-        childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulationForChildren;
-        // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer.
-        for (DeprecatedPaintLayer* parentLayer = child->layer()->parent(); parentLayer != &m_paintLayer; parentLayer = parentLayer->parent()) {
-            if (parentLayer->layoutObject()->hasOverflowClip())
-                childPaintingInfo.scrollOffsetAccumulation += parentLayer->layoutBox()->scrolledContentOffset();
-        }
-
-        if (childPainter.paintLayer(context, childPaintingInfo, paintFlags) == MaybeNotFullyPainted)
-            result = MaybeNotFullyPainted;
-    }
-
-    // Set subsequence not cacheable if the bounding box of this layer and descendants is not fully contained
-    // by paintRect, because later paintRect changes may expose new contents which will need repainting.
-    if (result == MaybeNotFullyPainted && subsequenceRecorder)
-        subsequenceRecorder->setUncacheable();
-
-    return result;
-}
-
-// FIXME: inline this.
-static bool paintForFixedRootBackground(const DeprecatedPaintLayer* layer, PaintLayerFlags paintFlags)
-{
-    return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLayerPaintingRootBackgroundOnly);
-}
-
-bool DeprecatedPaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPaintFlags globalPaintFlags, PaintLayerFlags paintFlags)
-{
-    DisableCompositingQueryAsserts disabler;
-
-    return m_paintLayer.compositingState() == NotComposited
-        || (globalPaintFlags & GlobalPaintFlattenCompositingLayers)
-        || ((paintFlags & PaintLayerPaintingReflection) && !m_paintLayer.has3DTransform())
-        || paintForFixedRootBackground(&m_paintLayer, paintFlags);
-}
-
-void DeprecatedPaintLayerPainter::paintOverflowControlsForFragments(const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags)
-{
-    bool needsScope = layerFragments.size() > 1;
-    for (auto& fragment : layerFragments) {
-        Optional<ScopeRecorder> scopeRecorder;
-        if (needsScope)
-            scopeRecorder.emplace(*context);
-
-        Optional<LayerClipRecorder> clipRecorder;
-
-        if (needsToClip(localPaintingInfo, fragment.backgroundRect))
-            clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &localPaintingInfo, fragment.paginationOffset, paintFlags);
-        if (DeprecatedPaintLayerScrollableArea* scrollableArea = m_paintLayer.scrollableArea())
-            ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
-    }
-}
-
-void DeprecatedPaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const DeprecatedPaintLayerFragment& fragment, GraphicsContext* context, const ClipRect& clipRect, const DeprecatedPaintLayerPaintingInfo& paintingInfo, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags, ClipState clipState)
-{
-    ASSERT(m_paintLayer.isSelfPaintingLayer());
-
-    Optional<LayerClipRecorder> clipRecorder;
-    if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(paintingInfo, clipRect)) {
-        DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentType(phase);
-        LayerClipRecorder::BorderRadiusClippingRule clippingRule;
-        switch (phase) {
-        case PaintPhaseBlockBackground: // Background painting will handle clipping to self.
-        case PaintPhaseSelfOutline:
-        case PaintPhaseMask: // Mask painting will handle clipping to self.
-            clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius;
-            break;
-        default:
-            clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius;
-            break;
-        }
-
-        clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlags, clippingRule);
-    }
-
-    PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, paintingInfo.globalPaintFlags(), paintFlags, paintingRootForLayoutObject, paintingInfo.rootLayer->layoutObject());
-    Optional<ScrollRecorder> scrollRecorder;
-    LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation());
-    if (!paintingInfo.scrollOffsetAccumulation.isZero()) {
-        // As a descendant of the root layer, m_paintLayer's painting is not controlled by the ScrollRecorders
-        // created by BlockPainter of the ancestor layers up to the root layer, so we need to issue ScrollRecorder
-        // for this layer seperately, with the scroll offset accumulated from the root layer to the parent of this
-        // layer, to get the same result as ScrollRecorder in BlockPainter.
-        paintOffset += paintingInfo.scrollOffsetAccumulation;
-        paintInfo.rect.move(paintingInfo.scrollOffsetAccumulation);
-        scrollRecorder.emplace(*paintInfo.context, *m_paintLayer.layoutObject(), paintInfo.phase, paintingInfo.scrollOffsetAccumulation);
-    }
-    m_paintLayer.layoutObject()->paint(paintInfo, paintOffset);
-}
-
-void DeprecatedPaintLayerPainter::paintBackgroundForFragments(const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* context,
-    const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo,
-    LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
-{
-    bool needsScope = layerFragments.size() > 1;
-    for (auto& fragment : layerFragments) {
-        Optional<ScopeRecorder> scopeRecorder;
-        if (needsScope)
-            scopeRecorder.emplace(*context);
-        paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fragment.backgroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, HasNotClipped);
-    }
-}
-
-void DeprecatedPaintLayerPainter::paintForegroundForFragments(const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* context,
-    const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo,
-    LayoutObject* paintingRootForLayoutObject, bool selectionOnly, PaintLayerFlags paintFlags)
-{
-    // Optimize clipping for the single fragment case.
-    bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty();
-    ClipState clipState = HasNotClipped;
-    Optional<LayerClipRecorder> clipRecorder;
-    if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroundRect)) {
-        clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, layerFragments[0].paginationOffset, paintFlags);
-        clipState = HasClipped;
-    }
-
-    // We have to loop through every fragment multiple times, since we have to issue paint invalidations in each specific phase in order for
-    // interleaving of the fragments to work properly.
-    paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds, layerFragments,
-        context, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
-
-    if (!selectionOnly) {
-        paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
-        paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
-        paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
-    }
-}
-
-void DeprecatedPaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* context,
-    const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags, ClipState clipState)
-{
-    bool needsScope = layerFragments.size() > 1;
-    for (auto& fragment : layerFragments) {
-        if (!fragment.foregroundRect.isEmpty()) {
-            Optional<ScopeRecorder> scopeRecorder;
-            if (needsScope)
-                scopeRecorder.emplace(*context);
-            paintFragmentWithPhase(phase, fragment, context, fragment.foregroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
-        }
-    }
-}
-
-void DeprecatedPaintLayerPainter::paintOutlineForFragments(const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo,
-    LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
-{
-    bool needsScope = layerFragments.size() > 1;
-    for (auto& fragment : layerFragments) {
-        if (!fragment.backgroundRect.isEmpty()) {
-            Optional<ScopeRecorder> scopeRecorder;
-            if (needsScope)
-                scopeRecorder.emplace(*context);
-            paintFragmentWithPhase(PaintPhaseSelfOutline, fragment, context, fragment.backgroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, HasNotClipped);
-        }
-    }
-}
-
-void DeprecatedPaintLayerPainter::paintMaskForFragments(const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo,
-    LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
-{
-    bool needsScope = layerFragments.size() > 1;
-    for (auto& fragment : layerFragments) {
-        Optional<ScopeRecorder> scopeRecorder;
-        if (needsScope)
-            scopeRecorder.emplace(*context);
-        paintFragmentWithPhase(PaintPhaseMask, fragment, context, fragment.backgroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, HasNotClipped);
-    }
-}
-
-void DeprecatedPaintLayerPainter::paintChildClippingMaskForFragments(const DeprecatedPaintLayerFragments& layerFragments, GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo,
-    LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
-{
-    bool needsScope = layerFragments.size() > 1;
-    for (auto& fragment: layerFragments) {
-        Optional<ScopeRecorder> scopeRecorder;
-        if (needsScope)
-            scopeRecorder.emplace(*context);
-        paintFragmentWithPhase(PaintPhaseClippingMask, fragment, context, fragment.foregroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, HasNotClipped);
-    }
-}
-
-void DeprecatedPaintLayerPainter::paintOverlayScrollbars(GraphicsContext* context, const LayoutRect& damageRect, const GlobalPaintFlags paintFlags, LayoutObject* paintingRoot)
-{
-    if (!m_paintLayer.containsDirtyOverlayScrollbars())
-        return;
-
-    DeprecatedPaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot);
-    paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
-
-    m_paintLayer.setContainsDirtyOverlayScrollbars(false);
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.h
deleted file mode 100644
index 9574173..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainter.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef DeprecatedPaintLayerPainter_h
-#define DeprecatedPaintLayerPainter_h
-
-#include "core/CoreExport.h"
-#include "core/paint/DeprecatedPaintLayerFragment.h"
-#include "core/paint/DeprecatedPaintLayerPaintingInfo.h"
-#include "wtf/Allocator.h"
-
-namespace blink {
-
-class ClipRect;
-class DeprecatedPaintLayer;
-class GraphicsContext;
-class LayoutPoint;
-
-class CORE_EXPORT DeprecatedPaintLayerPainter {
-    STACK_ALLOCATED();
-public:
-    enum FragmentPolicy { AllowMultipleFragments, ForceSingleFragment };
-
-    enum PaintResult {
-        // The layer is fully painted. This includes cases that nothing needs painting
-        // regardless of the paint rect.
-        FullyPainted,
-        // Some part of the layer is out of the paint rect and may be not fully painted.
-        // The results cannot be cached because they may change when paint rect changes.
-        MaybeNotFullyPainted
-    };
-
-    DeprecatedPaintLayerPainter(DeprecatedPaintLayer& paintLayer) : m_paintLayer(paintLayer) { }
-
-    // The paint() method paints the layers that intersect the damage rect from back to front.
-    //  paint() assumes that the caller will clip to the bounds of damageRect if necessary.
-    void paint(GraphicsContext*, const LayoutRect& damageRect, const GlobalPaintFlags = GlobalPaintNormalPhase, LayoutObject* paintingRoot = 0, PaintLayerFlags = 0);
-    // paintLayer() assumes that the caller will clip to the bounds of the painting dirty if necessary.
-    PaintResult paintLayer(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags);
-    // paintLayerContents() assumes that the caller will clip to the bounds of the painting dirty rect if necessary.
-    PaintResult paintLayerContents(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments);
-
-    void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, const GlobalPaintFlags, LayoutObject* paintingRoot = 0);
-
-private:
-    enum ClipState { HasNotClipped, HasClipped };
-
-    PaintResult paintLayerInternal(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags);
-    PaintResult paintLayerContentsInternal(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments);
-    PaintResult paintLayerContentsAndReflection(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments);
-    PaintResult paintLayerWithTransform(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags);
-    PaintResult paintFragmentByApplyingTransform(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& fragmentTranslation);
-
-    PaintResult paintChildren(unsigned childrenToVisit, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags);
-    bool atLeastOneFragmentIntersectsDamageRect(DeprecatedPaintLayerFragments&, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& offsetFromRoot);
-    void paintFragmentWithPhase(PaintPhase, const DeprecatedPaintLayerFragment&, GraphicsContext*, const ClipRect&, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState);
-    void paintBackgroundForFragments(const DeprecatedPaintLayerFragments&, GraphicsContext*,
-        const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags);
-    void paintForegroundForFragments(const DeprecatedPaintLayerFragments&, GraphicsContext*,
-        const LayoutRect& transparencyPaintDirtyRect, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject,
-        bool selectionOnly, PaintLayerFlags);
-    void paintForegroundForFragmentsWithPhase(PaintPhase, const DeprecatedPaintLayerFragments&, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState);
-    void paintOutlineForFragments(const DeprecatedPaintLayerFragments&, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags);
-    void paintOverflowControlsForFragments(const DeprecatedPaintLayerFragments&, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags);
-    void paintMaskForFragments(const DeprecatedPaintLayerFragments&, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags);
-    void paintChildClippingMaskForFragments(const DeprecatedPaintLayerFragments&, GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags);
-
-    static bool needsToClip(const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, const ClipRect&);
-
-    // Returns whether this layer should be painted during sofware painting (i.e., not via calls from CompositedDeprecatedPaintLayerMapping to draw into composited
-    // layers).
-    bool shouldPaintLayerInSoftwareMode(const GlobalPaintFlags, PaintLayerFlags paintFlags);
-
-    DeprecatedPaintLayer& m_paintLayer;
-};
-
-} // namespace blink
-
-#endif // DeprecatedPaintLayerPainter_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainterTest.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainterTest.cpp
deleted file mode 100644
index 4aa102d8..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPainterTest.cpp
+++ /dev/null
@@ -1,397 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-
-#include "core/paint/DisplayItemListPaintTest.h"
-#include "platform/graphics/GraphicsContext.h"
-
-namespace blink {
-
-using DeprecatedPaintLayerPainterTest = DisplayItemListPaintTest;
-using DeprecatedPaintLayerPainterTestForSlimmingPaintV2 = DisplayItemListPaintTestForSlimmingPaintV2;
-
-TEST_F(DeprecatedPaintLayerPainterTest, CachedSubsequence)
-{
-    RuntimeEnabledFeatures::setSlimmingPaintSubsequenceCachingEnabled(true);
-
-    setBodyInnerHTML(
-        "<div id='container1' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content1' style='position: absolute; width: 100px; height: 100px; background-color: red'></div>"
-        "</div>"
-        "<div id='container2' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content2' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
-        "</div>");
-    document().view()->updateAllLifecyclePhases();
-
-    DeprecatedPaintLayer& rootLayer = *layoutView().layer();
-    DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
-    LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
-    DeprecatedPaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
-    LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
-    LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
-    DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
-    LayoutObject& content2 = *document().getElementById("content2")->layoutObject();
-
-    GraphicsContext context(&rootDisplayItemList());
-    DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 600), GlobalPaintNormalPhase, LayoutSize());
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
-    rootDisplayItemList().commitNewDisplayItems();
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position: absolute; width: 100px; height: 100px; background-color: green");
-    document().view()->updateAllLifecyclePhases();
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 11,
-        TestDisplayItem(layoutView(), cachedBackgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, cachedBackgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, cachedBackgroundType),
-        TestDisplayItem(container2Layer, cachedSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    rootDisplayItemList().commitNewDisplayItems();
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    // Repeated painting should just generate the root cached subsequence.
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 2,
-        TestDisplayItem(layoutView(), cachedBackgroundType),
-        TestDisplayItem(rootLayer, cachedSubsequenceType));
-
-    rootDisplayItemList().commitNewDisplayItems();
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-}
-
-TEST_F(DeprecatedPaintLayerPainterTest, CachedSubsequenceOnInterestRectChange)
-{
-    RuntimeEnabledFeatures::setSlimmingPaintSubsequenceCachingEnabled(true);
-
-    setBodyInnerHTML(
-        "<div id='container1' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content1' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
-        "</div>"
-        "<div id='container2' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content2a' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
-        "  <div id='content2b' style='position: absolute; top: 200px; width: 100px; height: 100px; background-color: green'></div>"
-        "</div>"
-        "<div id='container3' style='position: absolute; z-index: 2; left: 300px; top: 0; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content3' style='position: absolute; width: 200px; height: 200px; background-color: green'></div>"
-        "</div>");
-    rootDisplayItemList().invalidateAll();
-
-    DeprecatedPaintLayer& rootLayer = *layoutView().layer();
-    DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
-    LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
-    DeprecatedPaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
-    LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
-    LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
-    DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
-    LayoutObject& content2a = *document().getElementById("content2a")->layoutObject();
-    LayoutObject& container3 = *document().getElementById("container3")->layoutObject();
-    DeprecatedPaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer();
-    LayoutObject& content3 = *document().getElementById("content3")->layoutObject();
-
-    document().view()->updateAllLifecyclePhases();
-    GraphicsContext context(&rootDisplayItemList());
-    DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 400, 300), GlobalPaintNormalPhase, LayoutSize());
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
-    rootDisplayItemList().commitNewDisplayItems();
-
-    // Container1 is fully in the interest rect;
-    // Container2 is partly (including its stacking chidren) in the interest rect;
-    // Content2b is out of the interest rect and output nothing;
-    // Container3 is partly in the interest rect.
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 17,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2a, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(container3, backgroundType),
-        TestDisplayItem(container3Layer, subsequenceType),
-        TestDisplayItem(content3, backgroundType),
-        TestDisplayItem(container3Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    // Container1 becomes partly in the interest rect, but uses cached subsequence
-    // because it was fully painted before;
-    // Container2's intersection with the interest rect changes;
-    // Content2b is out of the interest rect and outputs nothing;
-    // Container3 becomes out of the interest rect and outputs nothing.
-    DeprecatedPaintLayerPaintingInfo paintingInfo1(&rootLayer, LayoutRect(0, 100, 300, 300), GlobalPaintNormalPhase, LayoutSize());
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo1, PaintLayerPaintingCompositingAllPhases);
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 11,
-        TestDisplayItem(layoutView(), cachedBackgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, cachedBackgroundType),
-        TestDisplayItem(container1Layer, cachedSubsequenceType),
-        TestDisplayItem(container2, cachedBackgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2a, cachedBackgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    rootDisplayItemList().commitNewDisplayItems();
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2a, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-}
-
-TEST_F(DeprecatedPaintLayerPainterTestForSlimmingPaintV2, CachedSubsequence)
-{
-    setBodyInnerHTML(
-        "<div id='container1' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content1' style='position: absolute; width: 100px; height: 100px; background-color: red'></div>"
-        "</div>"
-        "<div id='container2' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content2' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
-        "</div>");
-    document().view()->updateAllLifecyclePhases();
-
-    DeprecatedPaintLayer& rootLayer = *layoutView().layer();
-    DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
-    LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
-    DeprecatedPaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
-    LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
-    LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
-    DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
-    LayoutObject& content2 = *document().getElementById("content2")->layoutObject();
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position: absolute; width: 100px; height: 100px; background-color: green");
-    updateLifecyclePhasesToPaintClean(LayoutRect::infiniteRect());
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 11,
-        TestDisplayItem(layoutView(), cachedBackgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, cachedBackgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, cachedBackgroundType),
-        TestDisplayItem(container2Layer, cachedSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    compositeForSlimmingPaintV2();
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    // Repeated painting should just generate the root cached subsequence.
-    setNeedsDisplayWithoutInvalidationForRoot();
-    updateLifecyclePhasesToPaintClean();
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 2,
-        TestDisplayItem(layoutView(), cachedBackgroundType),
-        TestDisplayItem(rootLayer, cachedSubsequenceType));
-
-    compositeForSlimmingPaintV2();
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-}
-
-TEST_F(DeprecatedPaintLayerPainterTestForSlimmingPaintV2, CachedSubsequenceOnInterestRectChange)
-{
-    setBodyInnerHTML(
-        "<div id='container1' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content1' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
-        "</div>"
-        "<div id='container2' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content2a' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
-        "  <div id='content2b' style='position: absolute; top: 200px; width: 100px; height: 100px; background-color: green'></div>"
-        "</div>"
-        "<div id='container3' style='position: absolute; z-index: 2; left: 300px; top: 0; width: 200px; height: 200px; background-color: blue'>"
-        "  <div id='content3' style='position: absolute; width: 200px; height: 200px; background-color: green'></div>"
-        "</div>");
-    setNeedsDisplayForRoot();
-
-    DeprecatedPaintLayer& rootLayer = *layoutView().layer();
-    DeprecatedPaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
-    LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
-    DeprecatedPaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
-    LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
-    LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
-    DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
-    LayoutObject& content2a = *document().getElementById("content2a")->layoutObject();
-    LayoutObject& container3 = *document().getElementById("container3")->layoutObject();
-    DeprecatedPaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer();
-    LayoutObject& content3 = *document().getElementById("content3")->layoutObject();
-
-    document().view()->updateAllLifecyclePhases(LayoutRect(0, 0, 400, 300));
-
-    // Container1 is fully in the interest rect;
-    // Container2 is partly (including its stacking chidren) in the interest rect;
-    // Content2b is out of the interest rect and output nothing;
-    // Container3 is partly in the interest rect.
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 17,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2a, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(container3, backgroundType),
-        TestDisplayItem(container3Layer, subsequenceType),
-        TestDisplayItem(content3, backgroundType),
-        TestDisplayItem(container3Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    setNeedsDisplayWithoutInvalidationForRoot();
-    
-    // Container1 becomes partly in the interest rect, but uses cached subsequence
-    // because it was fully painted before;
-    // Container2's intersection with the interest rect changes;
-    // Content2b is out of the interest rect and outputs nothing;
-    // Container3 becomes out of the interest rect and outputs nothing.
-    updateLifecyclePhasesToPaintClean(LayoutRect(0, 100, 300, 300));
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 11,
-        TestDisplayItem(layoutView(), cachedBackgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, cachedBackgroundType),
-        TestDisplayItem(container1Layer, cachedSubsequenceType),
-        TestDisplayItem(container2, cachedBackgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2a, cachedBackgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-
-    compositeForSlimmingPaintV2();
-
-    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
-        TestDisplayItem(layoutView(), backgroundType),
-        TestDisplayItem(rootLayer, subsequenceType),
-        TestDisplayItem(htmlLayer, subsequenceType),
-        TestDisplayItem(container1, backgroundType),
-        TestDisplayItem(container1Layer, subsequenceType),
-        TestDisplayItem(content1, backgroundType),
-        TestDisplayItem(container1Layer, endSubsequenceType),
-        TestDisplayItem(container2, backgroundType),
-        TestDisplayItem(container2Layer, subsequenceType),
-        TestDisplayItem(content2a, backgroundType),
-        TestDisplayItem(container2Layer, endSubsequenceType),
-        TestDisplayItem(htmlLayer, endSubsequenceType),
-        TestDisplayItem(rootLayer, endSubsequenceType));
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPaintingInfo.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPaintingInfo.h
deleted file mode 100644
index 5b2dfe2..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerPaintingInfo.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Intel Corporation. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#ifndef DeprecatedPaintLayerPaintingInfo_h
-#define DeprecatedPaintLayerPaintingInfo_h
-
-#include "core/paint/PaintPhase.h"
-#include "platform/geometry/LayoutRect.h"
-#include "wtf/Allocator.h"
-
-namespace blink {
-
-class DeprecatedPaintLayer;
-class LayoutObject;
-
-enum PaintLayerFlag {
-    PaintLayerNoFlag = 0,
-    PaintLayerHaveTransparency = 1,
-    PaintLayerAppliedTransform = 1 << 1,
-    PaintLayerUncachedClipRects = 1 << 2,
-    PaintLayerPaintingReflection = 1 << 3,
-    PaintLayerPaintingOverlayScrollbars = 1 << 4,
-    PaintLayerPaintingCompositingBackgroundPhase = 1 << 5,
-    PaintLayerPaintingCompositingForegroundPhase = 1 << 6,
-    PaintLayerPaintingCompositingMaskPhase = 1 << 7,
-    PaintLayerPaintingCompositingScrollingPhase = 1 << 8,
-    PaintLayerPaintingOverflowContents = 1 << 9,
-    PaintLayerPaintingRootBackgroundOnly = 1 << 10,
-    PaintLayerPaintingSkipRootBackground = 1 << 11,
-    PaintLayerPaintingChildClippingMaskPhase = 1 << 12,
-    PaintLayerPaintingRenderingClipPathAsMask = 1 << 13,
-    PaintLayerPaintingCompositingAllPhases = (PaintLayerPaintingCompositingBackgroundPhase | PaintLayerPaintingCompositingForegroundPhase | PaintLayerPaintingCompositingMaskPhase)
-};
-
-typedef unsigned PaintLayerFlags;
-
-struct DeprecatedPaintLayerPaintingInfo {
-    STACK_ALLOCATED();
-    DeprecatedPaintLayerPaintingInfo(DeprecatedPaintLayer* inRootLayer, const LayoutRect& inDirtyRect,
-        GlobalPaintFlags globalPaintFlags, const LayoutSize& inSubPixelAccumulation,
-        LayoutObject* inPaintingRoot = 0)
-        : rootLayer(inRootLayer)
-        , paintingRoot(inPaintingRoot)
-        , paintDirtyRect(inDirtyRect)
-        , subPixelAccumulation(inSubPixelAccumulation)
-        , clipToDirtyRect(true)
-        , ancestorHasClipPathClipping(false)
-        , disableSubsequenceCache(false)
-        , m_globalPaintFlags(globalPaintFlags)
-    { }
-
-    GlobalPaintFlags globalPaintFlags() const { return m_globalPaintFlags; }
-
-    // TODO(jchaffraix): We should encapsulate all these fields.
-    DeprecatedPaintLayer* rootLayer;
-    LayoutObject* paintingRoot; // only paint descendants of this object
-    LayoutRect paintDirtyRect; // relative to rootLayer;
-    LayoutSize subPixelAccumulation;
-    IntSize scrollOffsetAccumulation;
-    bool clipToDirtyRect;
-    bool ancestorHasClipPathClipping;
-    // TODO(wangxianzhu): Remove for slimming paint v2.
-    bool disableSubsequenceCache;
-
-private:
-    const GlobalPaintFlags m_globalPaintFlags;
-};
-
-} // namespace blink
-
-#endif // DeprecatedPaintLayerPaintingInfo_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerReflectionInfo.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerReflectionInfo.cpp
deleted file mode 100644
index 629f837..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerReflectionInfo.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#include "config.h"
-#include "core/paint/DeprecatedPaintLayerReflectionInfo.h"
-
-#include "core/frame/UseCounter.h"
-#include "core/layout/LayoutReplica.h"
-#include "core/style/ComputedStyle.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
-#include "platform/transforms/ScaleTransformOperation.h"
-#include "platform/transforms/TranslateTransformOperation.h"
-
-#include "wtf/RefPtr.h"
-
-namespace blink {
-
-DeprecatedPaintLayerReflectionInfo::DeprecatedPaintLayerReflectionInfo(LayoutBox& layoutObject)
-    : m_box(&layoutObject)
-    , m_isPaintingInsideReflection(false)
-{
-    UseCounter::count(box().document(), UseCounter::Reflection);
-
-    m_reflection = LayoutReplica::createAnonymous(&box().document());
-    m_reflection->setDangerousOneWayParent(m_box);
-}
-
-void DeprecatedPaintLayerReflectionInfo::destroy()
-{
-    if (!m_reflection->documentBeingDestroyed())
-        m_reflection->removeLayers(box().layer());
-
-    m_reflection->setDangerousOneWayParent(nullptr);
-    m_reflection->destroy();
-    m_reflection = nullptr;
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayerReflectionInfo::reflectionLayer() const
-{
-    return m_reflection->layer();
-}
-
-void DeprecatedPaintLayerReflectionInfo::updateAfterStyleChange(const ComputedStyle* oldStyle)
-{
-    RefPtr<ComputedStyle> newStyle = ComputedStyle::create();
-    newStyle->inheritFrom(box().styleRef());
-
-    // Map in our transform.
-    TransformOperations transform;
-    switch (box().style()->boxReflect()->direction()) {
-    case ReflectionBelow:
-        transform.operations().append(TranslateTransformOperation::create(Length(0, Fixed),
-            Length(100., Percent), TransformOperation::Translate));
-        transform.operations().append(TranslateTransformOperation::create(Length(0, Fixed),
-            box().style()->boxReflect()->offset(), TransformOperation::Translate));
-        transform.operations().append(ScaleTransformOperation::create(1.0, -1.0, ScaleTransformOperation::Scale));
-        break;
-
-    case ReflectionAbove:
-        transform.operations().append(ScaleTransformOperation::create(1.0, -1.0, ScaleTransformOperation::Scale));
-        transform.operations().append(TranslateTransformOperation::create(Length(0, Fixed),
-            Length(100., Percent), TransformOperation::Translate));
-        transform.operations().append(TranslateTransformOperation::create(Length(0, Fixed),
-            box().style()->boxReflect()->offset(), TransformOperation::Translate));
-        break;
-
-    case ReflectionRight:
-        transform.operations().append(TranslateTransformOperation::create(Length(100., Percent),
-            Length(0, Fixed), TransformOperation::Translate));
-        transform.operations().append(TranslateTransformOperation::create(
-            box().style()->boxReflect()->offset(), Length(0, Fixed), TransformOperation::Translate));
-        transform.operations().append(ScaleTransformOperation::create(-1.0, 1.0, ScaleTransformOperation::Scale));
-        break;
-
-    case ReflectionLeft:
-        transform.operations().append(ScaleTransformOperation::create(-1.0, 1.0, ScaleTransformOperation::Scale));
-        transform.operations().append(TranslateTransformOperation::create(Length(100., Percent),
-            Length(0, Fixed), TransformOperation::Translate));
-        transform.operations().append(TranslateTransformOperation::create(
-            box().style()->boxReflect()->offset(), Length(0, Fixed), TransformOperation::Translate));
-        break;
-    }
-    newStyle->setTransform(transform);
-
-    // Map in our mask.
-    newStyle->setMaskBoxImage(box().style()->boxReflect()->mask());
-
-    m_reflection->setStyle(newStyle.release());
-}
-
-void DeprecatedPaintLayerReflectionInfo::paint(GraphicsContext* context, const DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags flags)
-{
-    if (m_isPaintingInsideReflection)
-        return;
-
-    // Mark that we are now inside replica painting.
-    m_isPaintingInsideReflection = true;
-    DeprecatedPaintLayerPainter(*reflectionLayer()).paintLayer(context, paintingInfo, flags);
-    m_isPaintingInsideReflection = false;
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerReflectionInfo.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerReflectionInfo.h
deleted file mode 100644
index adfda680..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerReflectionInfo.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Intel Corporation. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#ifndef DeprecatedPaintLayerReflectionInfo_h
-#define DeprecatedPaintLayerReflectionInfo_h
-
-#include "core/layout/LayoutBoxModelObject.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
-#include "wtf/Allocator.h"
-#include "wtf/Noncopyable.h"
-
-namespace blink {
-
-class DeprecatedPaintLayer;
-class LayoutReplica;
-
-class DeprecatedPaintLayerReflectionInfo {
-    WTF_MAKE_FAST_ALLOCATED(DeprecatedPaintLayerReflectionInfo);
-    WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerReflectionInfo);
-public:
-    explicit DeprecatedPaintLayerReflectionInfo(LayoutBox&);
-    void destroy();
-
-    LayoutReplica* reflection() const { return m_reflection; }
-    DeprecatedPaintLayer* reflectionLayer() const;
-
-    bool isPaintingInsideReflection() const { return m_isPaintingInsideReflection; }
-
-    void updateAfterStyleChange(const ComputedStyle* oldStyle);
-
-    void paint(GraphicsContext*, const DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags);
-
-private:
-    LayoutBox& box() { return *m_box; }
-    const LayoutBox& box() const { return *m_box; }
-
-    LayoutBox* m_box;
-    LayoutReplica* m_reflection;
-
-    // A state bit tracking if we are painting inside a replica.
-    unsigned m_isPaintingInsideReflection : 1;
-};
-
-} // namespace blink
-
-#endif // DeprecatedPaintLayerReflectinInfo_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp
deleted file mode 100644
index 3f0c79e..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerScrollableArea.cpp
+++ /dev/null
@@ -1,1571 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#include "config.h"
-#include "core/paint/DeprecatedPaintLayerScrollableArea.h"
-
-#include "core/css/PseudoStyleRequest.h"
-#include "core/dom/AXObjectCache.h"
-#include "core/dom/Node.h"
-#include "core/dom/shadow/ShadowRoot.h"
-#include "core/editing/FrameSelection.h"
-#include "core/frame/FrameHost.h"
-#include "core/frame/FrameView.h"
-#include "core/frame/LocalFrame.h"
-#include "core/frame/Settings.h"
-#include "core/html/HTMLFrameOwnerElement.h"
-#include "core/input/EventHandler.h"
-#include "core/layout/LayoutGeometryMap.h"
-#include "core/layout/LayoutPart.h"
-#include "core/layout/LayoutScrollbar.h"
-#include "core/layout/LayoutScrollbarPart.h"
-#include "core/layout/LayoutTheme.h"
-#include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/page/ChromeClient.h"
-#include "core/page/FocusController.h"
-#include "core/page/Page.h"
-#include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/paint/DeprecatedPaintLayerFragment.h"
-#include "platform/PlatformGestureEvent.h"
-#include "platform/PlatformMouseEvent.h"
-#include "platform/graphics/GraphicsLayer.h"
-#include "platform/graphics/paint/DrawingRecorder.h"
-#include "platform/scroll/ScrollAnimator.h"
-#include "platform/scroll/ScrollbarTheme.h"
-#include "public/platform/Platform.h"
-
-namespace blink {
-
-const int ResizerControlExpandRatioForTouch = 2;
-
-DeprecatedPaintLayerScrollableArea::DeprecatedPaintLayerScrollableArea(DeprecatedPaintLayer& layer)
-    : m_layer(layer)
-    , m_inResizeMode(false)
-    , m_scrollsOverflow(false)
-    , m_inOverflowRelayout(false)
-    , m_nextTopmostScrollChild(0)
-    , m_topmostScrollChild(0)
-    , m_needsCompositedScrolling(false)
-    , m_scrollbarManager(*this)
-    , m_scrollCorner(nullptr)
-    , m_resizer(nullptr)
-#if ENABLE(ASSERT)
-    , m_hasBeenDisposed(false)
-#endif
-{
-    Node* node = box().node();
-    if (node && node->isElementNode()) {
-        // We save and restore only the scrollOffset as the other scroll values are recalculated.
-        Element* element = toElement(node);
-        m_scrollOffset = element->savedLayerScrollOffset();
-        if (!m_scrollOffset.isZero())
-            scrollAnimator()->setCurrentPosition(FloatPoint(m_scrollOffset.width(), m_scrollOffset.height()));
-        element->setSavedLayerScrollOffset(IntSize());
-    }
-    updateResizerAreaSet();
-}
-
-DeprecatedPaintLayerScrollableArea::~DeprecatedPaintLayerScrollableArea()
-{
-    ASSERT(m_hasBeenDisposed);
-}
-
-void DeprecatedPaintLayerScrollableArea::dispose()
-{
-    if (inResizeMode() && !box().documentBeingDestroyed()) {
-        if (LocalFrame* frame = box().frame())
-            frame->eventHandler().resizeScrollableAreaDestroyed();
-    }
-
-    if (LocalFrame* frame = box().frame()) {
-        if (FrameView* frameView = frame->view()) {
-            frameView->removeScrollableArea(this);
-            frameView->removeAnimatingScrollableArea(this);
-        }
-    }
-
-    if (box().frame() && box().frame()->page()) {
-        if (ScrollingCoordinator* scrollingCoordinator = box().frame()->page()->scrollingCoordinator())
-            scrollingCoordinator->willDestroyScrollableArea(this);
-    }
-
-    if (!box().documentBeingDestroyed()) {
-        Node* node = box().node();
-        // FIXME: Make setSavedLayerScrollOffset take DoubleSize. crbug.com/414283.
-        if (node && node->isElementNode())
-            toElement(node)->setSavedLayerScrollOffset(flooredIntSize(m_scrollOffset));
-    }
-
-    if (LocalFrame* frame = box().frame()) {
-        if (FrameView* frameView = frame->view())
-            frameView->removeResizerArea(box());
-    }
-
-    m_scrollbarManager.dispose();
-
-    if (m_scrollCorner)
-        m_scrollCorner->destroy();
-    if (m_resizer)
-        m_resizer->destroy();
-
-    clearScrollAnimators();
-
-#if ENABLE(ASSERT)
-    m_hasBeenDisposed = true;
-#endif
-}
-
-DEFINE_TRACE(DeprecatedPaintLayerScrollableArea)
-{
-    visitor->trace(m_scrollbarManager);
-    ScrollableArea::trace(visitor);
-}
-
-HostWindow* DeprecatedPaintLayerScrollableArea::hostWindow() const
-{
-    if (Page* page = box().frame()->page())
-        return &page->chromeClient();
-    return nullptr;
-}
-
-GraphicsLayer* DeprecatedPaintLayerScrollableArea::layerForScrolling() const
-{
-    return layer()->hasCompositedDeprecatedPaintLayerMapping() ? layer()->compositedDeprecatedPaintLayerMapping()->scrollingContentsLayer() : 0;
-}
-
-GraphicsLayer* DeprecatedPaintLayerScrollableArea::layerForHorizontalScrollbar() const
-{
-    // See crbug.com/343132.
-    DisableCompositingQueryAsserts disabler;
-
-    return layer()->hasCompositedDeprecatedPaintLayerMapping() ? layer()->compositedDeprecatedPaintLayerMapping()->layerForHorizontalScrollbar() : 0;
-}
-
-GraphicsLayer* DeprecatedPaintLayerScrollableArea::layerForVerticalScrollbar() const
-{
-    // See crbug.com/343132.
-    DisableCompositingQueryAsserts disabler;
-
-    return layer()->hasCompositedDeprecatedPaintLayerMapping() ? layer()->compositedDeprecatedPaintLayerMapping()->layerForVerticalScrollbar() : 0;
-}
-
-GraphicsLayer* DeprecatedPaintLayerScrollableArea::layerForScrollCorner() const
-{
-    // See crbug.com/343132.
-    DisableCompositingQueryAsserts disabler;
-
-    return layer()->hasCompositedDeprecatedPaintLayerMapping() ? layer()->compositedDeprecatedPaintLayerMapping()->layerForScrollCorner() : 0;
-}
-
-void DeprecatedPaintLayerScrollableArea::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
-{
-    // See crbug.com/343132.
-    DisableCompositingQueryAsserts disabler;
-
-    ASSERT(scrollbar == horizontalScrollbar() || scrollbar == verticalScrollbar());
-    ASSERT(scrollbar == horizontalScrollbar() ? !layerForHorizontalScrollbar() : !layerForVerticalScrollbar());
-
-    IntRect scrollRect = rect;
-    // If we are not yet inserted into the tree, there is no need to issue paint invaldiations.
-    if (!box().isLayoutView() && !box().parent())
-        return;
-
-    if (scrollbar == verticalScrollbar())
-        scrollRect.move(verticalScrollbarStart(0, box().size().width()), box().borderTop());
-    else
-        scrollRect.move(horizontalScrollbarStart(0), box().size().height() - box().borderBottom() - scrollbar->height());
-
-    if (scrollRect.isEmpty())
-        return;
-
-    box().invalidateDisplayItemClient(*scrollbar);
-
-    LayoutRect paintInvalidationRect = LayoutRect(scrollRect);
-    box().flipForWritingMode(paintInvalidationRect);
-
-    IntRect intRect = pixelSnappedIntRect(paintInvalidationRect);
-
-    if (box().frameView()->isInPerformLayout()) {
-        addScrollbarDamage(scrollbar, intRect);
-    } else {
-        // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
-        DisablePaintInvalidationStateAsserts disabler;
-        // We have invalidated the displayItemClient of the scrollbar, but for now we still need to
-        // invalidate the rectangles to trigger repaints.
-        box().invalidatePaintRectangleNotInvalidatingDisplayItemClients(LayoutRect(intRect));
-    }
-}
-
-void DeprecatedPaintLayerScrollableArea::invalidateScrollCornerRect(const IntRect& rect)
-{
-    ASSERT(!layerForScrollCorner());
-
-    if (m_scrollCorner) {
-        // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
-        DisablePaintInvalidationStateAsserts disabler;
-        m_scrollCorner->invalidatePaintRectangle(LayoutRect(rect));
-        box().invalidateDisplayItemClientForNonCompositingDescendantsOf(*m_scrollCorner);
-    } else {
-        box().invalidateDisplayItemClient(box());
-    }
-    if (m_resizer) {
-        m_resizer->invalidatePaintRectangle(LayoutRect(rect));
-        box().invalidateDisplayItemClientForNonCompositingDescendantsOf(*m_resizer);
-    }
-}
-
-bool DeprecatedPaintLayerScrollableArea::shouldUseIntegerScrollOffset() const
-{
-    Frame* frame = box().frame();
-    if (frame->settings() && !frame->settings()->preferCompositingToLCDTextEnabled())
-        return true;
-
-    return ScrollableArea::shouldUseIntegerScrollOffset();
-}
-
-bool DeprecatedPaintLayerScrollableArea::isActive() const
-{
-    Page* page = box().frame()->page();
-    return page && page->focusController().isActive();
-}
-
-bool DeprecatedPaintLayerScrollableArea::isScrollCornerVisible() const
-{
-    return !scrollCornerRect().isEmpty();
-}
-
-static int cornerStart(const ComputedStyle& style, int minX, int maxX, int thickness)
-{
-    if (style.shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-        return minX + style.borderLeftWidth();
-    return maxX - thickness - style.borderRightWidth();
-}
-
-static IntRect cornerRect(const ComputedStyle& style, const Scrollbar* horizontalScrollbar, const Scrollbar* verticalScrollbar, const IntRect& bounds)
-{
-    int horizontalThickness;
-    int verticalThickness;
-    if (!verticalScrollbar && !horizontalScrollbar) {
-        // FIXME: This isn't right. We need to know the thickness of custom scrollbars
-        // even when they don't exist in order to set the resizer square size properly.
-        horizontalThickness = ScrollbarTheme::theme()->scrollbarThickness();
-        verticalThickness = horizontalThickness;
-    } else if (verticalScrollbar && !horizontalScrollbar) {
-        horizontalThickness = verticalScrollbar->width();
-        verticalThickness = horizontalThickness;
-    } else if (horizontalScrollbar && !verticalScrollbar) {
-        verticalThickness = horizontalScrollbar->height();
-        horizontalThickness = verticalThickness;
-    } else {
-        horizontalThickness = verticalScrollbar->width();
-        verticalThickness = horizontalScrollbar->height();
-    }
-    return IntRect(cornerStart(style, bounds.x(), bounds.maxX(), horizontalThickness),
-        bounds.maxY() - verticalThickness - style.borderBottomWidth(),
-        horizontalThickness, verticalThickness);
-}
-
-
-IntRect DeprecatedPaintLayerScrollableArea::scrollCornerRect() const
-{
-    // We have a scrollbar corner when a scrollbar is visible and not filling the entire length of the box.
-    // This happens when:
-    // (a) A resizer is present and at least one scrollbar is present
-    // (b) Both scrollbars are present.
-    bool hasHorizontalBar = horizontalScrollbar();
-    bool hasVerticalBar = verticalScrollbar();
-    bool hasResizer = box().style()->resize() != RESIZE_NONE;
-    if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar)))
-        return cornerRect(box().styleRef(), horizontalScrollbar(), verticalScrollbar(), box().pixelSnappedBorderBoxRect());
-    return IntRect();
-}
-
-IntRect DeprecatedPaintLayerScrollableArea::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const
-{
-    LayoutView* view = box().view();
-    if (!view)
-        return scrollbarRect;
-
-    IntRect rect = scrollbarRect;
-    rect.move(scrollbarOffset(scrollbar));
-
-    return view->frameView()->convertFromLayoutObject(box(), rect);
-}
-
-IntRect DeprecatedPaintLayerScrollableArea::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
-{
-    LayoutView* view = box().view();
-    if (!view)
-        return parentRect;
-
-    IntRect rect = view->frameView()->convertToLayoutObject(box(), parentRect);
-    rect.move(-scrollbarOffset(scrollbar));
-    return rect;
-}
-
-IntPoint DeprecatedPaintLayerScrollableArea::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const
-{
-    LayoutView* view = box().view();
-    if (!view)
-        return scrollbarPoint;
-
-    IntPoint point = scrollbarPoint;
-    point.move(scrollbarOffset(scrollbar));
-    return view->frameView()->convertFromLayoutObject(box(), point);
-}
-
-IntPoint DeprecatedPaintLayerScrollableArea::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
-{
-    LayoutView* view = box().view();
-    if (!view)
-        return parentPoint;
-
-    IntPoint point = view->frameView()->convertToLayoutObject(box(), parentPoint);
-
-    point.move(-scrollbarOffset(scrollbar));
-    return point;
-}
-
-int DeprecatedPaintLayerScrollableArea::scrollSize(ScrollbarOrientation orientation) const
-{
-    IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition();
-    return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scrollDimensions.height();
-}
-
-void DeprecatedPaintLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset, ScrollType scrollType)
-{
-    setScrollOffset(DoublePoint(newScrollOffset), scrollType);
-}
-
-void DeprecatedPaintLayerScrollableArea::setScrollOffset(const DoublePoint& newScrollOffset, ScrollType)
-{
-    if (scrollOffset() == toDoubleSize(newScrollOffset))
-        return;
-
-    DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset);
-    m_scrollOffset = toDoubleSize(newScrollOffset);
-
-    LocalFrame* frame = box().frame();
-    ASSERT(frame);
-
-    RefPtrWillBeRawPtr<FrameView> frameView = box().frameView();
-
-    TRACE_EVENT1("devtools.timeline", "ScrollLayer", "data", InspectorScrollLayerEvent::data(&box()));
-
-    // FIXME(420741): Resolve circular dependency between scroll offset and
-    // compositing state, and remove this disabler.
-    DisableCompositingQueryAsserts disabler;
-
-    // Update the positions of our child layers (if needed as only fixed layers should be impacted by a scroll).
-    // We don't update compositing layers, because we need to do a deep update from the compositing ancestor.
-    if (!frameView->isInPerformLayout()) {
-        // If we're in the middle of layout, we'll just update layers once layout has finished.
-        layer()->updateLayerPositionsAfterOverflowScroll(scrollDelta);
-        // Update regions, scrolling may change the clip of a particular region.
-        frameView->updateDocumentAnnotatedRegions();
-        frameView->setNeedsUpdateWidgetPositions();
-        updateCompositingLayersAfterScroll();
-    }
-
-    const LayoutBoxModelObject* paintInvalidationContainer = box().containerForPaintInvalidation();
-    // The caret rect needs to be invalidated after scrolling
-    frame->selection().setCaretRectNeedsUpdate();
-
-    FloatQuad quadForFakeMouseMoveEvent = FloatQuad(FloatRect(layer()->layoutObject()->previousPaintInvalidationRectIncludingCompositedScrolling(*paintInvalidationContainer)));
-
-    quadForFakeMouseMoveEvent = paintInvalidationContainer->localToAbsoluteQuad(quadForFakeMouseMoveEvent);
-    frame->eventHandler().dispatchFakeMouseMoveEventSoonInQuad(quadForFakeMouseMoveEvent);
-
-    bool requiresPaintInvalidation = true;
-
-    if (box().view()->compositor()->inCompositingMode()) {
-        bool onlyScrolledCompositedLayers = scrollsOverflow()
-            && !layer()->hasVisibleNonLayerContent()
-            && !layer()->hasNonCompositedChild()
-            && !layer()->hasBlockSelectionGapBounds()
-            && box().style()->backgroundLayers().attachment() != LocalBackgroundAttachment;
-
-        if (usesCompositedScrolling() || onlyScrolledCompositedLayers)
-            requiresPaintInvalidation = false;
-    }
-
-    // Only the root layer can overlap non-composited fixed-position elements.
-    if (!requiresPaintInvalidation && layer()->isRootLayer() && frameView->hasViewportConstrainedObjects()) {
-        if (!frameView->invalidateViewportConstrainedObjects())
-            requiresPaintInvalidation = true;
-    }
-
-    // Just schedule a full paint invalidation of our object.
-    // FIXME: This invalidation will be unnecessary in slimming paint phase 2.
-    if (requiresPaintInvalidation) {
-        box().setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
-        frameView->setFrameTimingRequestsDirty(true);
-    }
-
-    // Schedule the scroll DOM event.
-    if (box().node())
-        box().node()->document().enqueueScrollEventForNode(box().node());
-
-    if (AXObjectCache* cache = box().document().existingAXObjectCache())
-        cache->handleScrollPositionChanged(&box());
-    box().view()->clearHitTestCache();
-
-    // Inform the FrameLoader of the new scroll position, so it can be restored when navigating back.
-    if (layer()->isRootLayer())
-        frameView->frame().loader().saveScrollState();
-
-    // All scrolls clear the scroll anchor.
-    frameView->clearScrollAnchor();
-}
-
-IntPoint DeprecatedPaintLayerScrollableArea::scrollPosition() const
-{
-    return IntPoint(flooredIntSize(m_scrollOffset));
-}
-
-DoublePoint DeprecatedPaintLayerScrollableArea::scrollPositionDouble() const
-{
-    return DoublePoint(m_scrollOffset);
-}
-
-IntPoint DeprecatedPaintLayerScrollableArea::minimumScrollPosition() const
-{
-    return -scrollOrigin();
-}
-
-IntPoint DeprecatedPaintLayerScrollableArea::maximumScrollPosition() const
-{
-    IntSize contentSize;
-    IntSize visibleSize;
-    if (layer()->isRootLayer()) {
-        FrameView* frameView = box().frameView();
-        contentSize = frameView->contentsSize();
-        visibleSize = frameView->visibleContentSize(ExcludeScrollbars) + frameView->topControlsSize();
-    } else if (box().hasOverflowClip()) {
-        contentSize = IntSize(pixelSnappedScrollWidth(), pixelSnappedScrollHeight());
-        visibleSize = enclosingIntRect(box().clientBoxRect()).size();
-    }
-    return -scrollOrigin() + (contentSize - visibleSize);
-}
-
-IntRect DeprecatedPaintLayerScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarInclusion) const
-{
-    int verticalScrollbarWidth = 0;
-    int horizontalScrollbarHeight = 0;
-    if (scrollbarInclusion == IncludeScrollbars) {
-        verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) ? verticalScrollbar()->width() : 0;
-        horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()) ? horizontalScrollbar()->height() : 0;
-    }
-
-    return IntRect(IntPoint(scrollXOffset(), scrollYOffset()),
-        IntSize(max(0, layer()->size().width() - verticalScrollbarWidth), max(0, layer()->size().height() - horizontalScrollbarHeight)));
-}
-
-int DeprecatedPaintLayerScrollableArea::visibleHeight() const
-{
-    return layer()->size().height();
-}
-
-int DeprecatedPaintLayerScrollableArea::visibleWidth() const
-{
-    return layer()->size().width();
-}
-
-IntSize DeprecatedPaintLayerScrollableArea::contentsSize() const
-{
-    return IntSize(scrollWidth(), scrollHeight());
-}
-
-IntPoint DeprecatedPaintLayerScrollableArea::lastKnownMousePosition() const
-{
-    return box().frame() ? box().frame()->eventHandler().lastKnownMousePosition() : IntPoint();
-}
-
-bool DeprecatedPaintLayerScrollableArea::scrollAnimatorEnabled() const
-{
-    if (Settings* settings = box().frame()->settings())
-        return settings->scrollAnimatorEnabled();
-    return false;
-}
-
-bool DeprecatedPaintLayerScrollableArea::shouldSuspendScrollAnimations() const
-{
-    LayoutView* view = box().view();
-    if (!view)
-        return true;
-    return view->frameView()->shouldSuspendScrollAnimations();
-}
-
-void DeprecatedPaintLayerScrollableArea::scrollbarVisibilityChanged()
-{
-    if (LayoutView* view = box().view())
-        return view->clearHitTestCache();
-}
-
-bool DeprecatedPaintLayerScrollableArea::scrollbarsCanBeActive() const
-{
-    LayoutView* view = box().view();
-    if (!view)
-        return false;
-    return view->frameView()->scrollbarsCanBeActive();
-}
-
-IntRect DeprecatedPaintLayerScrollableArea::scrollableAreaBoundingBox() const
-{
-    return box().absoluteBoundingBoxRect();
-}
-
-void DeprecatedPaintLayerScrollableArea::registerForAnimation()
-{
-    if (LocalFrame* frame = box().frame()) {
-        if (FrameView* frameView = frame->view())
-            frameView->addAnimatingScrollableArea(this);
-    }
-}
-
-void DeprecatedPaintLayerScrollableArea::deregisterForAnimation()
-{
-    if (LocalFrame* frame = box().frame()) {
-        if (FrameView* frameView = frame->view())
-            frameView->removeAnimatingScrollableArea(this);
-    }
-}
-
-bool DeprecatedPaintLayerScrollableArea::userInputScrollable(ScrollbarOrientation orientation) const
-{
-    if (box().isIntrinsicallyScrollable(orientation))
-        return true;
-
-    EOverflow overflowStyle = (orientation == HorizontalScrollbar) ?
-        box().style()->overflowX() : box().style()->overflowY();
-    return (overflowStyle == OSCROLL || overflowStyle == OAUTO || overflowStyle == OOVERLAY);
-}
-
-bool DeprecatedPaintLayerScrollableArea::shouldPlaceVerticalScrollbarOnLeft() const
-{
-    return box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft();
-}
-
-int DeprecatedPaintLayerScrollableArea::pageStep(ScrollbarOrientation orientation) const
-{
-    int length = (orientation == HorizontalScrollbar) ?
-        box().pixelSnappedClientWidth() : box().pixelSnappedClientHeight();
-    int minPageStep = static_cast<float>(length) * ScrollableArea::minFractionToStepWhenPaging();
-    int pageStep = max(minPageStep, length - ScrollableArea::maxOverlapBetweenPages());
-
-    return max(pageStep, 1);
-}
-
-LayoutBox& DeprecatedPaintLayerScrollableArea::box() const
-{
-    return *m_layer.layoutBox();
-}
-
-DeprecatedPaintLayer* DeprecatedPaintLayerScrollableArea::layer() const
-{
-    return &m_layer;
-}
-
-LayoutUnit DeprecatedPaintLayerScrollableArea::scrollWidth() const
-{
-    return m_overflowRect.width();
-}
-
-LayoutUnit DeprecatedPaintLayerScrollableArea::scrollHeight() const
-{
-    return m_overflowRect.height();
-}
-
-int DeprecatedPaintLayerScrollableArea::pixelSnappedScrollWidth() const
-{
-    return snapSizeToPixel(scrollWidth(), box().clientLeft() + box().location().x());
-}
-
-int DeprecatedPaintLayerScrollableArea::pixelSnappedScrollHeight() const
-{
-    return snapSizeToPixel(scrollHeight(), box().clientTop() + box().location().y());
-}
-
-void DeprecatedPaintLayerScrollableArea::computeScrollDimensions()
-{
-    m_overflowRect = box().layoutOverflowRect();
-    box().flipForWritingMode(m_overflowRect);
-
-    int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScrollbarWidth() : 0);
-    int scrollableTopOverflow = m_overflowRect.y() - box().borderTop();
-    setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow));
-}
-
-void DeprecatedPaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPosition, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior)
-{
-    cancelProgrammaticScrollAnimation();
-
-    DoublePoint newScrollPosition = clamp == ScrollOffsetClamped ? clampScrollPosition(scrollPosition) : scrollPosition;
-    if (newScrollPosition != scrollPositionDouble())
-        ScrollableArea::setScrollPosition(newScrollPosition, ProgrammaticScroll, scrollBehavior);
-}
-
-void DeprecatedPaintLayerScrollableArea::updateScrollDimensions(DoubleSize& scrollOffset, bool& autoHorizontalScrollBarChanged, bool& autoVerticalScrollBarChanged)
-{
-    ASSERT(box().hasOverflowClip());
-
-    if (needsScrollbarReconstruction()) {
-        m_scrollbarManager.setCanDetachScrollbars(false);
-        setHasHorizontalScrollbar(false);
-        setHasVerticalScrollbar(false);
-    }
-
-    m_scrollbarManager.setCanDetachScrollbars(true);
-
-    scrollOffset = adjustedScrollOffset();
-    computeScrollDimensions();
-    bool hasHorizontalOverflow = this->hasHorizontalOverflow();
-    bool hasVerticalOverflow = this->hasVerticalOverflow();
-    if (hasOverlayScrollbars()) {
-        if (!scrollSize(HorizontalScrollbar))
-            setHasHorizontalScrollbar(false);
-        if (!scrollSize(VerticalScrollbar))
-            setHasVerticalScrollbar(false);
-    }
-
-    // overflow:auto may need to lay out again if scrollbars got added/removed.
-    autoHorizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow)) || (box().style()->overflowX() == OSCROLL && !horizontalScrollbar());
-    autoVerticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow)) || (box().style()->overflowY() == OSCROLL && !verticalScrollbar());
-    if (!visualViewportSuppliesScrollbars() && (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged)) {
-        if (box().hasAutoHorizontalScrollbar())
-            setHasHorizontalScrollbar(hasHorizontalOverflow);
-        else if (box().style()->overflowX() == OSCROLL)
-            setHasHorizontalScrollbar(true);
-        if (box().hasAutoVerticalScrollbar())
-            setHasVerticalScrollbar(hasVerticalOverflow);
-        else if (box().style()->overflowY() == OSCROLL)
-            setHasVerticalScrollbar(true);
-    }
-}
-
-void DeprecatedPaintLayerScrollableArea::finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool autoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged)
-{
-    ASSERT(box().hasOverflowClip());
-
-    // Layout may cause us to be at an invalid scroll position. In this case we need
-    // to pull our scroll offsets back to the max (or push them up to the min).
-    DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble());
-    if (clampedScrollPosition != scrollPositionDouble())
-        scrollToPosition(clampedScrollPosition);
-
-    if (originalScrollOffset != adjustedScrollOffset()) {
-        DoublePoint origin(scrollOrigin());
-        scrollPositionChanged(-origin + adjustedScrollOffset(), ProgrammaticScroll);
-    }
-
-    m_scrollbarManager.setCanDetachScrollbars(false);
-
-    bool hasHorizontalOverflow = this->hasHorizontalOverflow();
-    bool hasVerticalOverflow = this->hasVerticalOverflow();
-
-    {
-        // Hits in compositing/overflow/automatically-opt-into-composited-scrolling-after-style-change.html.
-        DisableCompositingQueryAsserts disabler;
-
-        // overflow:scroll should just enable/disable.
-        if (box().style()->overflowX() == OSCROLL && horizontalScrollbar())
-            horizontalScrollbar()->setEnabled(hasHorizontalOverflow);
-        if (box().style()->overflowY() == OSCROLL && verticalScrollbar())
-            verticalScrollbar()->setEnabled(hasVerticalOverflow);
-    }
-
-    if (!visualViewportSuppliesScrollbars() && (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged)) {
-        if (hasVerticalOverflow || hasHorizontalOverflow)
-            updateScrollCornerStyle();
-
-        layer()->updateSelfPaintingLayer();
-
-        // Force an update since we know the scrollbars have changed things.
-        if (box().document().hasAnnotatedRegions())
-            box().document().setAnnotatedRegionsDirty(true);
-
-        // Our proprietary overflow: overlay value doesn't trigger a layout.
-        if ((autoHorizontalScrollBarChanged && box().style()->overflowX() != OOVERLAY) || (autoVerticalScrollBarChanged && box().style()->overflowY() != OOVERLAY)) {
-            if (!m_inOverflowRelayout) {
-                m_inOverflowRelayout = true;
-                SubtreeLayoutScope layoutScope(box());
-                layoutScope.setNeedsLayout(&box(), LayoutInvalidationReason::ScrollbarChanged);
-                if (box().isLayoutBlock()) {
-                    LayoutBlock& block = toLayoutBlock(box());
-                    block.scrollbarsChanged(autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
-                    block.layoutBlock(true);
-                } else {
-                    box().layout();
-                }
-                m_inOverflowRelayout = false;
-            }
-        }
-    }
-
-    {
-        // Hits in compositing/overflow/automatically-opt-into-composited-scrolling-after-style-change.html.
-        DisableCompositingQueryAsserts disabler;
-
-        // Set up the range (and page step/line step).
-        if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
-            int clientWidth = box().pixelSnappedClientWidth();
-            horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
-        }
-        if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
-            int clientHeight = box().pixelSnappedClientHeight();
-            verticalScrollbar->setProportion(clientHeight, overflowRect().height());
-        }
-    }
-
-    if (hasOverlayScrollbars()) {
-        if (!scrollSize(HorizontalScrollbar))
-            setHasHorizontalScrollbar(false);
-        if (!scrollSize(VerticalScrollbar))
-            setHasVerticalScrollbar(false);
-    }
-
-    bool hasOverflow = hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow();
-    updateScrollableAreaSet(hasOverflow);
-
-    DisableCompositingQueryAsserts disabler;
-    positionOverflowControls();
-}
-
-void DeprecatedPaintLayerScrollableArea::updateAfterLayout()
-{
-    DoubleSize originalScrollOffset;
-    bool autoHorizontalScrollBarChanged;
-    bool autoVerticalScrollBarChanged;
-    updateScrollDimensions(originalScrollOffset, autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
-    finalizeScrollDimensions(originalScrollOffset, autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
-}
-
-ScrollBehavior DeprecatedPaintLayerScrollableArea::scrollBehaviorStyle() const
-{
-    return box().style()->scrollBehavior();
-}
-
-bool DeprecatedPaintLayerScrollableArea::hasHorizontalOverflow() const
-{
-    return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth();
-}
-
-bool DeprecatedPaintLayerScrollableArea::hasVerticalOverflow() const
-{
-    return pixelSnappedScrollHeight() > box().pixelSnappedClientHeight();
-}
-
-bool DeprecatedPaintLayerScrollableArea::hasScrollableHorizontalOverflow() const
-{
-    return hasHorizontalOverflow() && box().scrollsOverflowX();
-}
-
-bool DeprecatedPaintLayerScrollableArea::hasScrollableVerticalOverflow() const
-{
-    return hasVerticalOverflow() && box().scrollsOverflowY();
-}
-
-static bool overflowRequiresScrollbar(EOverflow overflow)
-{
-    return overflow == OSCROLL;
-}
-
-static bool overflowDefinesAutomaticScrollbar(EOverflow overflow)
-{
-    return overflow == OAUTO || overflow == OOVERLAY;
-}
-
-// This function returns true if the given box requires overflow scrollbars (as
-// opposed to the 'viewport' scrollbars managed by the DeprecatedPaintLayerCompositor).
-// FIXME: we should use the same scrolling machinery for both the viewport and
-// overflow. Currently, we need to avoid producing scrollbars here if they'll be
-// handled externally in the RLC.
-static bool canHaveOverflowScrollbars(const LayoutBox& box)
-{
-    bool rootLayerScrolls = box.document().settings() && box.document().settings()->rootLayerScrolls();
-    return (rootLayerScrolls || !box.isLayoutView()) && box.document().viewportDefiningElement() != box.node();
-}
-
-void DeprecatedPaintLayerScrollableArea::updateAfterStyleChange(const ComputedStyle* oldStyle)
-{
-    // Don't do this on first style recalc, before layout has ever happened.
-    if (!overflowRect().size().isZero())
-        updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
-
-    if (!canHaveOverflowScrollbars(box()))
-        return;
-
-    // Avoid drawing two sets of scrollbars when one is provided by the visual viewport.
-    if (visualViewportSuppliesScrollbars()) {
-        setHasHorizontalScrollbar(false);
-        setHasVerticalScrollbar(false);
-        return;
-    }
-
-    EOverflow overflowX = box().style()->overflowX();
-    EOverflow overflowY = box().style()->overflowY();
-
-    // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present.
-    bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefinesAutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX);
-    bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAutomaticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY);
-
-    // Look for the scrollbarModes and reset the needs Horizontal & vertical Scrollbar values based on scrollbarModes, as during force style change
-    // StyleResolver::styleForDocument returns documentStyle with  no overflow values, due to which we are destorying the scrollbars that was
-    // already present.
-    if (box().isLayoutView()) {
-        if (LocalFrame* frame = box().frame()) {
-            if (FrameView* frameView = frame->view()) {
-                ScrollbarMode hMode;
-                ScrollbarMode vMode;
-                frameView->calculateScrollbarModes(hMode, vMode);
-                if (hMode == ScrollbarAlwaysOn && !needsHorizontalScrollbar)
-                    needsHorizontalScrollbar = true;
-                if (vMode == ScrollbarAlwaysOn && !needsVerticalScrollbar)
-                    needsVerticalScrollbar = true;
-            }
-        }
-    }
-
-    setHasHorizontalScrollbar(needsHorizontalScrollbar);
-    setHasVerticalScrollbar(needsVerticalScrollbar);
-
-    // With overflow: scroll, scrollbars are always visible but may be disabled.
-    // When switching to another value, we need to re-enable them (see bug 11985).
-    if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) {
-        ASSERT(hasHorizontalScrollbar());
-        horizontalScrollbar()->setEnabled(true);
-    }
-
-    if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL && overflowY != OSCROLL) {
-        ASSERT(hasVerticalScrollbar());
-        verticalScrollbar()->setEnabled(true);
-    }
-
-    // FIXME: Need to detect a swap from custom to native scrollbars (and vice versa).
-    if (horizontalScrollbar())
-        horizontalScrollbar()->styleChanged();
-    if (verticalScrollbar())
-        verticalScrollbar()->styleChanged();
-
-    updateScrollCornerStyle();
-    updateResizerAreaSet();
-    updateResizerStyle();
-}
-
-bool DeprecatedPaintLayerScrollableArea::updateAfterCompositingChange()
-{
-    layer()->updateScrollingStateAfterCompositingChange();
-    const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild;
-    m_topmostScrollChild = m_nextTopmostScrollChild;
-    m_nextTopmostScrollChild = nullptr;
-    return layersChanged;
-}
-
-void DeprecatedPaintLayerScrollableArea::updateAfterOverflowRecalc()
-{
-    computeScrollDimensions();
-    if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
-        int clientWidth = box().pixelSnappedClientWidth();
-        horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
-    }
-    if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
-        int clientHeight = box().pixelSnappedClientHeight();
-        verticalScrollbar->setProportion(clientHeight, overflowRect().height());
-    }
-
-    bool hasHorizontalOverflow = this->hasHorizontalOverflow();
-    bool hasVerticalOverflow = this->hasVerticalOverflow();
-    bool autoHorizontalScrollBarChanged = box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow);
-    bool autoVerticalScrollBarChanged = box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow);
-    if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged)
-        box().setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Unknown);
-}
-
-IntRect DeprecatedPaintLayerScrollableArea::rectForHorizontalScrollbar(const IntRect& borderBoxRect) const
-{
-    if (!hasHorizontalScrollbar())
-        return IntRect();
-
-    const IntRect& scrollCorner = scrollCornerRect();
-
-    return IntRect(horizontalScrollbarStart(borderBoxRect.x()),
-        borderBoxRect.maxY() - box().borderBottom() - horizontalScrollbar()->height(),
-        borderBoxRect.width() - (box().borderLeft() + box().borderRight()) - scrollCorner.width(),
-        horizontalScrollbar()->height());
-}
-
-IntRect DeprecatedPaintLayerScrollableArea::rectForVerticalScrollbar(const IntRect& borderBoxRect) const
-{
-    if (!hasVerticalScrollbar())
-        return IntRect();
-
-    const IntRect& scrollCorner = scrollCornerRect();
-
-    return IntRect(verticalScrollbarStart(borderBoxRect.x(), borderBoxRect.maxX()),
-        borderBoxRect.y() + box().borderTop(),
-        verticalScrollbar()->width(),
-        borderBoxRect.height() - (box().borderTop() + box().borderBottom()) - scrollCorner.height());
-}
-
-LayoutUnit DeprecatedPaintLayerScrollableArea::verticalScrollbarStart(int minX, int maxX) const
-{
-    if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-        return minX + box().borderLeft();
-    return maxX - box().borderRight() - verticalScrollbar()->width();
-}
-
-LayoutUnit DeprecatedPaintLayerScrollableArea::horizontalScrollbarStart(int minX) const
-{
-    int x = minX + box().borderLeft();
-    if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-        x += hasVerticalScrollbar() ? verticalScrollbar()->width() : resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer).width();
-    return x;
-}
-
-IntSize DeprecatedPaintLayerScrollableArea::scrollbarOffset(const Scrollbar* scrollbar) const
-{
-    if (scrollbar == verticalScrollbar())
-        return IntSize(verticalScrollbarStart(0, box().size().width()), box().borderTop());
-
-    if (scrollbar == horizontalScrollbar())
-        return IntSize(horizontalScrollbarStart(0), box().size().height() - box().borderBottom() - scrollbar->height());
-
-    ASSERT_NOT_REACHED();
-    return IntSize();
-}
-
-static inline const LayoutObject& layoutObjectForScrollbar(const LayoutObject& layoutObject)
-{
-    if (Node* node = layoutObject.node()) {
-        if (layoutObject.isLayoutView()) {
-            Document& doc = node->document();
-            if (Settings* settings = doc.settings()) {
-                if (!settings->allowCustomScrollbarInMainFrame() && layoutObject.frame() && layoutObject.frame()->isMainFrame())
-                    return layoutObject;
-            }
-
-            // Try the <body> element first as a scrollbar source.
-            Element* body = doc.body();
-            if (body && body->layoutObject() && body->layoutObject()->style()->hasPseudoStyle(SCROLLBAR))
-                return *body->layoutObject();
-
-            // If the <body> didn't have a custom style, then the root element might.
-            Element* docElement = doc.documentElement();
-            if (docElement && docElement->layoutObject() && docElement->layoutObject()->style()->hasPseudoStyle(SCROLLBAR))
-                return *docElement->layoutObject();
-
-            // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also.
-            LayoutPart* frameLayoutObject = node->document().frame()->ownerLayoutObject();
-            if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(SCROLLBAR))
-                return *frameLayoutObject;
-        }
-        if (ShadowRoot* shadowRoot = node->containingShadowRoot()) {
-            if (shadowRoot->type() == ShadowRootType::UserAgent)
-                return *shadowRoot->host()->layoutObject();
-        }
-    }
-
-    return layoutObject;
-}
-
-bool DeprecatedPaintLayerScrollableArea::needsScrollbarReconstruction() const
-{
-    const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(box());
-    bool shouldUseCustom = actualLayoutObject.isBox() && actualLayoutObject.styleRef().hasPseudoStyle(SCROLLBAR);
-    bool hasAnyScrollbar = hasScrollbar();
-    bool hasCustom = (hasHorizontalScrollbar() && horizontalScrollbar()->isCustomScrollbar()) || (hasVerticalScrollbar() && verticalScrollbar()->isCustomScrollbar());
-    return hasAnyScrollbar && (shouldUseCustom != hasCustom);
-}
-
-void DeprecatedPaintLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar)
-{
-    if (hasScrollbar == hasHorizontalScrollbar())
-        return;
-
-    if (!hasScrollbar && !layerForHorizontalScrollbar())
-        horizontalScrollbar()->invalidate();
-
-    m_scrollbarManager.setHasHorizontalScrollbar(hasScrollbar);
-
-    // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style.
-    if (hasHorizontalScrollbar())
-        horizontalScrollbar()->styleChanged();
-    if (hasVerticalScrollbar())
-        verticalScrollbar()->styleChanged();
-
-    // These are valid because we want to invalidate display item clients on the current backing.
-    DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler;
-    DisableCompositingQueryAsserts compositingAssertDisabler;
-    invalidateScrollCorner(scrollCornerRect());
-
-    // Force an update since we know the scrollbars have changed things.
-    if (box().document().hasAnnotatedRegions())
-        box().document().setAnnotatedRegionsDirty(true);
-}
-
-void DeprecatedPaintLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar)
-{
-    if (hasScrollbar == hasVerticalScrollbar())
-        return;
-
-    if (!hasScrollbar && !layerForVerticalScrollbar())
-        verticalScrollbar()->invalidate();
-
-    m_scrollbarManager.setHasVerticalScrollbar(hasScrollbar);
-
-    // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style.
-    if (hasHorizontalScrollbar())
-        horizontalScrollbar()->styleChanged();
-    if (hasVerticalScrollbar())
-        verticalScrollbar()->styleChanged();
-
-    // These are valid because we want to invalidate display item clients on the current backing.
-    DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler;
-    DisableCompositingQueryAsserts compositingAssertDisabler;
-    invalidateScrollCorner(scrollCornerRect());
-
-    // Force an update since we know the scrollbars have changed things.
-    if (box().document().hasAnnotatedRegions())
-        box().document().setAnnotatedRegionsDirty(true);
-}
-
-int DeprecatedPaintLayerScrollableArea::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
-{
-    if (!hasVerticalScrollbar() || (verticalScrollbar()->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !verticalScrollbar()->shouldParticipateInHitTesting())))
-        return 0;
-    return verticalScrollbar()->width();
-}
-
-int DeprecatedPaintLayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const
-{
-    if (!hasHorizontalScrollbar() || (horizontalScrollbar()->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !horizontalScrollbar()->shouldParticipateInHitTesting())))
-        return 0;
-    return horizontalScrollbar()->height();
-}
-
-void DeprecatedPaintLayerScrollableArea::positionOverflowControls()
-{
-    if (!hasScrollbar() && !box().canResize())
-        return;
-
-    const IntRect borderBox = box().pixelSnappedBorderBoxRect();
-    if (Scrollbar* verticalScrollbar = this->verticalScrollbar())
-        verticalScrollbar->setFrameRect(rectForVerticalScrollbar(borderBox));
-
-    if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar())
-        horizontalScrollbar->setFrameRect(rectForHorizontalScrollbar(borderBox));
-
-    const IntRect& scrollCorner = scrollCornerRect();
-    if (m_scrollCorner)
-        m_scrollCorner->setFrameRect(LayoutRect(scrollCorner));
-
-    if (m_resizer)
-        m_resizer->setFrameRect(LayoutRect(resizerCornerRect(borderBox, ResizerForPointer)));
-
-    // FIXME, this should eventually be removed, once we are certain that composited
-    // controls get correctly positioned on a compositor update. For now, conservatively
-    // leaving this unchanged.
-    if (layer()->hasCompositedDeprecatedPaintLayerMapping())
-        layer()->compositedDeprecatedPaintLayerMapping()->positionOverflowControlsLayers();
-}
-
-void DeprecatedPaintLayerScrollableArea::updateScrollCornerStyle()
-{
-    if (!m_scrollCorner && !hasScrollbar())
-        return;
-    if (!m_scrollCorner && hasOverlayScrollbars())
-        return;
-
-    const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(box());
-    RefPtr<ComputedStyle> corner = box().hasOverflowClip() ? actualLayoutObject.getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualLayoutObject.style()) : PassRefPtr<ComputedStyle>(nullptr);
-    if (corner) {
-        if (!m_scrollCorner) {
-            m_scrollCorner = LayoutScrollbarPart::createAnonymous(&box().document());
-            m_scrollCorner->setDangerousOneWayParent(&box());
-        }
-        m_scrollCorner->setStyle(corner.release());
-    } else if (m_scrollCorner) {
-        m_scrollCorner->destroy();
-        m_scrollCorner = nullptr;
-    }
-}
-
-bool DeprecatedPaintLayerScrollableArea::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint)
-{
-    if (!hasScrollbar() && !box().canResize())
-        return false;
-
-    IntRect resizeControlRect;
-    if (box().style()->resize() != RESIZE_NONE) {
-        resizeControlRect = resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer);
-        if (resizeControlRect.contains(localPoint))
-            return true;
-    }
-
-    int resizeControlSize = max(resizeControlRect.height(), 0);
-    if (hasVerticalScrollbar() && verticalScrollbar()->shouldParticipateInHitTesting()) {
-        LayoutRect vBarRect(verticalScrollbarStart(0, box().size().width()),
-            box().borderTop(),
-            verticalScrollbar()->width(),
-            box().size().height() - (box().borderTop() + box().borderBottom()) - (hasHorizontalScrollbar() ? horizontalScrollbar()->height() : resizeControlSize));
-        if (vBarRect.contains(localPoint)) {
-            result.setScrollbar(verticalScrollbar());
-            return true;
-        }
-    }
-
-    resizeControlSize = max(resizeControlRect.width(), 0);
-    if (hasHorizontalScrollbar() && horizontalScrollbar()->shouldParticipateInHitTesting()) {
-        LayoutRect hBarRect(horizontalScrollbarStart(0),
-            box().size().height() - box().borderBottom() - horizontalScrollbar()->height(),
-            box().size().width() - (box().borderLeft() + box().borderRight()) - (hasVerticalScrollbar() ? verticalScrollbar()->width() : resizeControlSize),
-            horizontalScrollbar()->height());
-        if (hBarRect.contains(localPoint)) {
-            result.setScrollbar(horizontalScrollbar());
-            return true;
-        }
-    }
-
-    // FIXME: We should hit test the m_scrollCorner and pass it back through the result.
-
-    return false;
-}
-
-IntRect DeprecatedPaintLayerScrollableArea::resizerCornerRect(const IntRect& bounds, ResizerHitTestType resizerHitTestType) const
-{
-    if (box().style()->resize() == RESIZE_NONE)
-        return IntRect();
-    IntRect corner = cornerRect(box().styleRef(), horizontalScrollbar(), verticalScrollbar(), bounds);
-
-    if (resizerHitTestType == ResizerForTouch) {
-        // We make the resizer virtually larger for touch hit testing. With the
-        // expanding ratio k = ResizerControlExpandRatioForTouch, we first move
-        // the resizer rect (of width w & height h), by (-w * (k-1), -h * (k-1)),
-        // then expand the rect by new_w/h = w/h * k.
-        int expandRatio = ResizerControlExpandRatioForTouch - 1;
-        corner.move(-corner.width() * expandRatio, -corner.height() * expandRatio);
-        corner.expand(corner.width() * expandRatio, corner.height() * expandRatio);
-    }
-
-    return corner;
-}
-
-IntRect DeprecatedPaintLayerScrollableArea::scrollCornerAndResizerRect() const
-{
-    IntRect scrollCornerAndResizer = scrollCornerRect();
-    if (scrollCornerAndResizer.isEmpty())
-        scrollCornerAndResizer = resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer);
-    return scrollCornerAndResizer;
-}
-
-bool DeprecatedPaintLayerScrollableArea::isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestType resizerHitTestType) const
-{
-    if (!box().canResize())
-        return false;
-
-    IntPoint localPoint = roundedIntPoint(box().absoluteToLocal(absolutePoint, UseTransforms));
-    IntRect localBounds(0, 0, box().pixelSnappedWidth(), box().pixelSnappedHeight());
-    return resizerCornerRect(localBounds, resizerHitTestType).contains(localPoint);
-}
-
-bool DeprecatedPaintLayerScrollableArea::hitTestResizerInFragments(const DeprecatedPaintLayerFragments& layerFragments, const HitTestLocation& hitTestLocation) const
-{
-    if (!box().canResize())
-        return false;
-
-    if (layerFragments.isEmpty())
-        return false;
-
-    for (int i = layerFragments.size() - 1; i >= 0; --i) {
-        const DeprecatedPaintLayerFragment& fragment = layerFragments.at(i);
-        if (fragment.backgroundRect.intersects(hitTestLocation) && resizerCornerRect(pixelSnappedIntRect(fragment.layerBounds), ResizerForPointer).contains(hitTestLocation.roundedPoint()))
-            return true;
-    }
-
-    return false;
-}
-
-void DeprecatedPaintLayerScrollableArea::updateResizerAreaSet()
-{
-    LocalFrame* frame = box().frame();
-    if (!frame)
-        return;
-    FrameView* frameView = frame->view();
-    if (!frameView)
-        return;
-    if (box().canResize())
-        frameView->addResizerArea(box());
-    else
-        frameView->removeResizerArea(box());
-}
-
-void DeprecatedPaintLayerScrollableArea::updateResizerStyle()
-{
-    if (!m_resizer && !box().canResize())
-        return;
-
-    const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(box());
-    RefPtr<ComputedStyle> resizer = box().hasOverflowClip() ? actualLayoutObject.getUncachedPseudoStyle(PseudoStyleRequest(RESIZER), actualLayoutObject.style()) : PassRefPtr<ComputedStyle>(nullptr);
-    if (resizer) {
-        if (!m_resizer) {
-            m_resizer = LayoutScrollbarPart::createAnonymous(&box().document());
-            m_resizer->setDangerousOneWayParent(&box());
-        }
-        m_resizer->setStyle(resizer.release());
-    } else if (m_resizer) {
-        m_resizer->destroy();
-        m_resizer = nullptr;
-    }
-}
-
-IntSize DeprecatedPaintLayerScrollableArea::offsetFromResizeCorner(const IntPoint& absolutePoint) const
-{
-    // Currently the resize corner is either the bottom right corner or the bottom left corner.
-    // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case?
-    IntSize elementSize = layer()->size();
-    if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
-        elementSize.setWidth(0);
-    IntPoint resizerPoint = IntPoint(elementSize);
-    IntPoint localPoint = roundedIntPoint(box().absoluteToLocal(absolutePoint, UseTransforms));
-    return localPoint - resizerPoint;
-}
-
-void DeprecatedPaintLayerScrollableArea::resize(const PlatformEvent& evt, const LayoutSize& oldOffset)
-{
-    // FIXME: This should be possible on generated content but is not right now.
-    if (!inResizeMode() || !box().canResize() || !box().node())
-        return;
-
-    ASSERT(box().node()->isElementNode());
-    Element* element = toElement(box().node());
-
-    Document& document = element->document();
-
-    IntPoint pos;
-    const PlatformGestureEvent* gevt = 0;
-
-    switch (evt.type()) {
-    case PlatformEvent::MouseMoved:
-        if (!document.frame()->eventHandler().mousePressed())
-            return;
-        pos = static_cast<const PlatformMouseEvent*>(&evt)->position();
-        break;
-    case PlatformEvent::GestureScrollUpdate:
-        pos = static_cast<const PlatformGestureEvent*>(&evt)->position();
-        gevt = static_cast<const PlatformGestureEvent*>(&evt);
-        pos = gevt->position();
-        pos.move(gevt->deltaX(), gevt->deltaY());
-        break;
-    default:
-        ASSERT_NOT_REACHED();
-    }
-
-    float zoomFactor = box().style()->effectiveZoom();
-
-    IntSize newOffset = offsetFromResizeCorner(document.view()->rootFrameToContents(pos));
-    newOffset.setWidth(newOffset.width() / zoomFactor);
-    newOffset.setHeight(newOffset.height() / zoomFactor);
-
-    LayoutSize currentSize = box().size();
-    currentSize.scale(1 / zoomFactor);
-    LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
-    element->setMinimumSizeForResizing(minimumSize);
-
-    LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
-    if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
-        newOffset.setWidth(-newOffset.width());
-        adjustedOldOffset.setWidth(-adjustedOldOffset.width());
-    }
-
-    LayoutSize difference((currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize);
-
-    bool isBoxSizingBorder = box().style()->boxSizing() == BORDER_BOX;
-
-    EResize resize = box().style()->resize();
-    if (resize != RESIZE_VERTICAL && difference.width()) {
-        if (element->isFormControlElement()) {
-            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
-            element->setInlineStyleProperty(CSSPropertyMarginLeft, box().marginLeft() / zoomFactor, CSSPrimitiveValue::UnitType::Pixels);
-            element->setInlineStyleProperty(CSSPropertyMarginRight, box().marginRight() / zoomFactor, CSSPrimitiveValue::UnitType::Pixels);
-        }
-        LayoutUnit baseWidth = box().size().width() - (isBoxSizingBorder ? LayoutUnit() : box().borderAndPaddingWidth());
-        baseWidth = baseWidth / zoomFactor;
-        element->setInlineStyleProperty(CSSPropertyWidth, roundToInt(baseWidth + difference.width()), CSSPrimitiveValue::UnitType::Pixels);
-    }
-
-    if (resize != RESIZE_HORIZONTAL && difference.height()) {
-        if (element->isFormControlElement()) {
-            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
-            element->setInlineStyleProperty(CSSPropertyMarginTop, box().marginTop() / zoomFactor, CSSPrimitiveValue::UnitType::Pixels);
-            element->setInlineStyleProperty(CSSPropertyMarginBottom, box().marginBottom() / zoomFactor, CSSPrimitiveValue::UnitType::Pixels);
-        }
-        LayoutUnit baseHeight = box().size().height() - (isBoxSizingBorder ? LayoutUnit() : box().borderAndPaddingHeight());
-        baseHeight = baseHeight / zoomFactor;
-        element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight + difference.height()), CSSPrimitiveValue::UnitType::Pixels);
-    }
-
-    document.updateLayout();
-
-    // FIXME (Radar 4118564): We should also autoscroll the window as necessary to keep the point under the cursor in view.
-}
-
-LayoutRect DeprecatedPaintLayerScrollableArea::scrollIntoView(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
-{
-    LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms).boundingBox());
-    localExposeRect.move(-box().borderLeft(), -box().borderTop());
-    LayoutRect layerBounds(0, 0, box().clientWidth(), box().clientHeight());
-    LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, alignX, alignY);
-
-    DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble() + roundedIntSize(r.location()));
-    if (clampedScrollPosition == scrollPositionDouble())
-        return rect;
-
-    DoubleSize oldScrollOffset = adjustedScrollOffset();
-    scrollToPosition(clampedScrollPosition);
-    DoubleSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset;
-    localExposeRect.move(-LayoutSize(scrollOffsetDifference));
-    return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox());
-}
-
-void DeprecatedPaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow)
-{
-    LocalFrame* frame = box().frame();
-    if (!frame)
-        return;
-
-    FrameView* frameView = frame->view();
-    if (!frameView)
-        return;
-
-    // FIXME: Does this need to be fixed later for OOPI?
-    bool isVisibleToHitTest = box().visibleToHitTesting();
-    if (HTMLFrameOwnerElement* owner = frame->deprecatedLocalOwner())
-        isVisibleToHitTest &= owner->layoutObject() && owner->layoutObject()->visibleToHitTesting();
-
-    bool didScrollOverflow = m_scrollsOverflow;
-
-    m_scrollsOverflow = hasOverflow && isVisibleToHitTest;
-    if (didScrollOverflow == scrollsOverflow())
-        return;
-
-    if (m_scrollsOverflow) {
-        ASSERT(canHaveOverflowScrollbars(box()));
-        frameView->addScrollableArea(this);
-    } else {
-        frameView->removeScrollableArea(this);
-    }
-}
-
-void DeprecatedPaintLayerScrollableArea::updateCompositingLayersAfterScroll()
-{
-    DeprecatedPaintLayerCompositor* compositor = box().view()->compositor();
-    if (compositor->inCompositingMode()) {
-        if (usesCompositedScrolling()) {
-            ASSERT(layer()->hasCompositedDeprecatedPaintLayerMapping());
-            layer()->compositedDeprecatedPaintLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
-            compositor->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange);
-        } else {
-            layer()->setNeedsCompositingInputsUpdate();
-        }
-    }
-}
-
-bool DeprecatedPaintLayerScrollableArea::usesCompositedScrolling() const
-{
-    // Scroll form controls on the main thread so they exhibit correct touch scroll event bubbling
-    if (box().isIntrinsicallyScrollable(VerticalScrollbar) || box().isIntrinsicallyScrollable(HorizontalScrollbar))
-        return false;
-
-    // See https://codereview.chromium.org/176633003/ for the tests that fail without this disabler.
-    DisableCompositingQueryAsserts disabler;
-    return layer()->hasCompositedDeprecatedPaintLayerMapping() && layer()->compositedDeprecatedPaintLayerMapping()->scrollingLayer();
-}
-
-static bool layerNeedsCompositedScrolling(DeprecatedPaintLayerScrollableArea::LCDTextMode mode, const DeprecatedPaintLayer* layer)
-{
-    if (mode == DeprecatedPaintLayerScrollableArea::ConsiderLCDText && !layer->compositor()->preferCompositingToLCDTextEnabled())
-        return false;
-
-    return layer->scrollsOverflow()
-        && !layer->hasDescendantWithClipPath()
-        && !layer->hasAncestorWithClipPath()
-        && !layer->layoutObject()->style()->hasBorderRadius();
-}
-
-void DeprecatedPaintLayerScrollableArea::updateNeedsCompositedScrolling(LCDTextMode mode)
-{
-    const bool needsCompositedScrolling = layerNeedsCompositedScrolling(mode, layer());
-    if (static_cast<bool>(m_needsCompositedScrolling) != needsCompositedScrolling) {
-        m_needsCompositedScrolling = needsCompositedScrolling;
-        layer()->didUpdateNeedsCompositedScrolling();
-    }
-}
-
-void DeprecatedPaintLayerScrollableArea::setTopmostScrollChild(DeprecatedPaintLayer* scrollChild)
-{
-    // We only want to track the topmost scroll child for scrollable areas with
-    // overlay scrollbars.
-    if (!hasOverlayScrollbars())
-        return;
-    m_nextTopmostScrollChild = scrollChild;
-}
-
-bool DeprecatedPaintLayerScrollableArea::visualViewportSuppliesScrollbars() const
-{
-    if (!layer()->isRootLayer())
-        return false;
-
-    LocalFrame* frame = box().frame();
-    if (!frame || !frame->isMainFrame() || !frame->settings())
-        return false;
-
-    return frame->settings()->viewportMetaEnabled();
-}
-
-DeprecatedPaintLayerScrollableArea::ScrollbarManager::ScrollbarManager(DeprecatedPaintLayerScrollableArea& scrollableArea)
-    : m_scrollableArea(&scrollableArea)
-    , m_canDetachScrollbars(0)
-    , m_hBarIsAttached(0)
-    , m_vBarIsAttached(0)
-{
-}
-
-void DeprecatedPaintLayerScrollableArea::ScrollbarManager::dispose()
-{
-    m_canDetachScrollbars = m_hBarIsAttached = m_vBarIsAttached = 0;
-    destroyScrollbar(HorizontalScrollbar);
-    destroyScrollbar(VerticalScrollbar);
-}
-
-void DeprecatedPaintLayerScrollableArea::ScrollbarManager::setCanDetachScrollbars(bool detach)
-{
-    ASSERT(!m_hBarIsAttached || m_hBar);
-    ASSERT(!m_vBarIsAttached || m_vBar);
-    m_canDetachScrollbars = detach ? 1 : 0;
-    if (!detach) {
-        if (m_hBar && !m_hBarIsAttached)
-            destroyScrollbar(HorizontalScrollbar, true);
-        if (m_vBar && !m_vBarIsAttached)
-            destroyScrollbar(VerticalScrollbar, true);
-    }
-}
-
-void DeprecatedPaintLayerScrollableArea::ScrollbarManager::setHasHorizontalScrollbar(bool hasScrollbar)
-{
-    if (hasScrollbar) {
-        // This doesn't hit in any tests, but since the equivalent code in setHasVerticalScrollbar
-        // does, presumably this code does as well.
-        DisableCompositingQueryAsserts disabler;
-        if (!m_hBar)
-            m_hBar = createScrollbar(HorizontalScrollbar);
-        m_hBarIsAttached = 1;
-    } else {
-        m_hBarIsAttached = 0;
-        if (!m_canDetachScrollbars)
-            destroyScrollbar(HorizontalScrollbar);
-    }
-}
-
-void DeprecatedPaintLayerScrollableArea::ScrollbarManager::setHasVerticalScrollbar(bool hasScrollbar)
-{
-    if (hasScrollbar) {
-        DisableCompositingQueryAsserts disabler;
-        if (!m_vBar)
-            m_vBar = createScrollbar(VerticalScrollbar);
-        m_vBarIsAttached = 1;
-    } else {
-        m_vBarIsAttached = 0;
-        if (!m_canDetachScrollbars)
-            destroyScrollbar(VerticalScrollbar);
-    }
-}
-
-PassRefPtrWillBeRawPtr<Scrollbar> DeprecatedPaintLayerScrollableArea::ScrollbarManager::createScrollbar(ScrollbarOrientation orientation)
-{
-    ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached : !m_vBarIsAttached);
-    RefPtrWillBeRawPtr<Scrollbar> widget = nullptr;
-    const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(m_scrollableArea->box());
-    bool hasCustomScrollbarStyle = actualLayoutObject.isBox() && actualLayoutObject.styleRef().hasPseudoStyle(SCROLLBAR);
-    if (hasCustomScrollbarStyle) {
-        widget = LayoutScrollbar::createCustomScrollbar(m_scrollableArea.get(), orientation, actualLayoutObject.node());
-    } else {
-        ScrollbarControlSize scrollbarSize = RegularScrollbar;
-        if (actualLayoutObject.styleRef().hasAppearance())
-            scrollbarSize = LayoutTheme::theme().scrollbarControlSizeForPart(actualLayoutObject.styleRef().appearance());
-        widget = Scrollbar::create(m_scrollableArea.get(), orientation, scrollbarSize);
-        if (orientation == HorizontalScrollbar)
-            m_scrollableArea->didAddScrollbar(widget.get(), HorizontalScrollbar);
-        else
-            m_scrollableArea->didAddScrollbar(widget.get(), VerticalScrollbar);
-    }
-    m_scrollableArea->box().document().view()->addChild(widget.get());
-    return widget.release();
-}
-
-void DeprecatedPaintLayerScrollableArea::ScrollbarManager::destroyScrollbar(ScrollbarOrientation orientation, bool invalidate)
-{
-    RefPtrWillBeMember<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar : m_vBar;
-    ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached: !m_vBarIsAttached);
-    if (!scrollbar)
-        return;
-
-    if (invalidate)
-        scrollbar->invalidate();
-    if (!scrollbar->isCustomScrollbar())
-        m_scrollableArea->willRemoveScrollbar(scrollbar.get(), orientation);
-
-    toFrameView(scrollbar->parent())->removeChild(scrollbar.get());
-    scrollbar->disconnectFromScrollableArea();
-    scrollbar = nullptr;
-}
-
-DEFINE_TRACE(DeprecatedPaintLayerScrollableArea::ScrollbarManager)
-{
-    visitor->trace(m_scrollableArea);
-    visitor->trace(m_hBar);
-    visitor->trace(m_vBar);
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerScrollableArea.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerScrollableArea.h
deleted file mode 100644
index 2e1f5af..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerScrollableArea.h
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#ifndef DeprecatedPaintLayerScrollableArea_h
-#define DeprecatedPaintLayerScrollableArea_h
-
-#include "core/CoreExport.h"
-#include "core/layout/LayoutBox.h"
-#include "core/paint/DeprecatedPaintLayerFragment.h"
-#include "platform/heap/Handle.h"
-#include "platform/scroll/ScrollableArea.h"
-
-namespace blink {
-
-enum ResizerHitTestType {
-    ResizerForPointer,
-    ResizerForTouch
-};
-
-class PlatformEvent;
-class LayoutBox;
-class DeprecatedPaintLayer;
-class LayoutScrollbarPart;
-
-class CORE_EXPORT DeprecatedPaintLayerScrollableArea final : public NoBaseWillBeGarbageCollectedFinalized<DeprecatedPaintLayerScrollableArea>, public ScrollableArea {
-    WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(DeprecatedPaintLayerScrollableArea);
-    WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(DeprecatedPaintLayerScrollableArea);
-    friend class Internals;
-
-private:
-    class ScrollbarManager {
-        DISALLOW_ALLOCATION();
-
-        // Helper class to manage the life cycle of Scrollbar objects.  Some layout containers
-        // (e.g., flexbox, table) run multi-pass layout on their children, applying different
-        // constraints.  If a child has overflow:auto, it may gain and lose scrollbars multiple
-        // times during multi-pass layout, causing pointless allocation/deallocation thrashing,
-        // and potentially leading to other problems (crbug.com/528940).
-
-        // ScrollbarManager allows a ScrollableArea to delay the destruction of a scrollbar that
-        // is no longer needed, until the end of multi-pass layout.  If the scrollbar is then
-        // re-added before multi-pass layout finishes, the previously "deleted" scrollbar will
-        // be restored, rather than constructing a new one.
-    public:
-        ScrollbarManager(DeprecatedPaintLayerScrollableArea&);
-
-        void dispose();
-
-        // When canDetachScrollbars is true, calls to setHas*Scrollbar(false) will NOT destroy
-        // an existing scrollbar, but instead detach it without destroying it.  If, subsequently,
-        // setHas*Scrollbar(true) is called, the existing scrollbar will be reattached.  When
-        // setCanDetachScrollbars(false) is called, any detached scrollbars will be destructed.
-        bool canDetachScrollbars() const { return m_canDetachScrollbars; }
-        void setCanDetachScrollbars(bool);
-
-        Scrollbar* horizontalScrollbar() const { return m_hBarIsAttached ? m_hBar.get(): nullptr; }
-        Scrollbar* verticalScrollbar() const { return m_vBarIsAttached ? m_vBar.get() : nullptr; }
-        bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
-        bool hasVerticalScrollbar() const { return verticalScrollbar(); }
-
-        void setHasHorizontalScrollbar(bool hasScrollbar);
-        void setHasVerticalScrollbar(bool hasScrollbar);
-
-        DECLARE_TRACE();
-
-    private:
-        PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
-        void destroyScrollbar(ScrollbarOrientation, bool invalidate = false);
-
-    private:
-        RawPtrWillBeMember<DeprecatedPaintLayerScrollableArea> m_scrollableArea;
-        RefPtrWillBeMember<Scrollbar> m_hBar;
-        RefPtrWillBeMember<Scrollbar> m_vBar;
-        unsigned m_canDetachScrollbars: 1;
-        unsigned m_hBarIsAttached: 1;
-        unsigned m_vBarIsAttached: 1;
-    };
-
-public:
-    // FIXME: We should pass in the LayoutBox but this opens a window
-    // for crashers during DeprecatedPaintLayer setup (see crbug.com/368062).
-    static PassOwnPtrWillBeRawPtr<DeprecatedPaintLayerScrollableArea> create(DeprecatedPaintLayer& layer)
-    {
-        return adoptPtrWillBeNoop(new DeprecatedPaintLayerScrollableArea(layer));
-    }
-
-    ~DeprecatedPaintLayerScrollableArea() override;
-    void dispose();
-
-    bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
-    bool hasVerticalScrollbar() const { return verticalScrollbar(); }
-
-    Scrollbar* horizontalScrollbar() const override { return m_scrollbarManager.horizontalScrollbar(); }
-    Scrollbar* verticalScrollbar() const override { return m_scrollbarManager.verticalScrollbar(); }
-
-    HostWindow* hostWindow() const override;
-
-    GraphicsLayer* layerForScrolling() const override;
-    GraphicsLayer* layerForHorizontalScrollbar() const override;
-    GraphicsLayer* layerForVerticalScrollbar() const override;
-    GraphicsLayer* layerForScrollCorner() const override;
-    bool usesCompositedScrolling() const override;
-    void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
-    void invalidateScrollCornerRect(const IntRect&) override;
-    bool shouldUseIntegerScrollOffset() const override;
-    bool isActive() const override;
-    bool isScrollCornerVisible() const override;
-    IntRect scrollCornerRect() const override;
-    IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const override;
-    IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const override;
-    IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const override;
-    IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const override;
-    int scrollSize(ScrollbarOrientation) const override;
-    IntPoint scrollPosition() const override;
-    DoublePoint scrollPositionDouble() const override;
-    IntPoint minimumScrollPosition() const override;
-    IntPoint maximumScrollPosition() const override;
-    IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) const override;
-    int visibleHeight() const override;
-    int visibleWidth() const override;
-    IntSize contentsSize() const override;
-    IntPoint lastKnownMousePosition() const override;
-    bool scrollAnimatorEnabled() const override;
-    bool shouldSuspendScrollAnimations() const override;
-    bool scrollbarsCanBeActive() const override;
-    void scrollbarVisibilityChanged() override;
-    IntRect scrollableAreaBoundingBox() const override;
-    void registerForAnimation() override;
-    void deregisterForAnimation() override;
-    bool userInputScrollable(ScrollbarOrientation) const override;
-    bool shouldPlaceVerticalScrollbarOnLeft() const override;
-    int pageStep(ScrollbarOrientation) const override;
-    ScrollBehavior scrollBehaviorStyle() const override;
-
-    double scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x(); }
-    double scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin().y(); }
-
-    DoubleSize scrollOffset() const { return m_scrollOffset; }
-
-    // FIXME: We shouldn't allow access to m_overflowRect outside this class.
-    LayoutRect overflowRect() const { return m_overflowRect; }
-
-    void scrollToPosition(const DoublePoint& scrollPosition, ScrollOffsetClamping = ScrollOffsetUnclamped, ScrollBehavior = ScrollBehaviorInstant);
-
-    void scrollToOffset(const DoubleSize& scrollOffset, ScrollOffsetClamping clamp = ScrollOffsetUnclamped, ScrollBehavior scrollBehavior = ScrollBehaviorInstant)
-    {
-        scrollToPosition(-scrollOrigin() + scrollOffset, clamp, scrollBehavior);
-    }
-
-    void scrollToXOffset(double x, ScrollOffsetClamping clamp = ScrollOffsetUnclamped, ScrollBehavior scrollBehavior = ScrollBehaviorInstant)
-    {
-        scrollToOffset(DoubleSize(x, scrollYOffset()), clamp, scrollBehavior);
-    }
-
-    void scrollToYOffset(double y, ScrollOffsetClamping clamp = ScrollOffsetUnclamped, ScrollBehavior scrollBehavior = ScrollBehaviorInstant)
-    {
-        scrollToOffset(DoubleSize(scrollXOffset(), y), clamp, scrollBehavior);
-    }
-
-    void setScrollPosition(const DoublePoint& position, ScrollType scrollType, ScrollBehavior scrollBehavior = ScrollBehaviorInstant) override
-    {
-        scrollToOffset(toDoubleSize(position), ScrollOffsetClamped, scrollBehavior);
-    }
-
-    void updateScrollDimensions(DoubleSize& scrollOffset, bool& autoHorizontalScrollBarChanged, bool& autoVerticalScrollBarChanged);
-    void finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool autoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged);
-
-    void updateAfterLayout();
-    void updateAfterStyleChange(const ComputedStyle*);
-    void updateAfterOverflowRecalc();
-
-    bool updateAfterCompositingChange() override;
-
-    bool hasScrollbar() const { return hasHorizontalScrollbar() || hasVerticalScrollbar(); }
-
-    LayoutScrollbarPart* scrollCorner() const { return m_scrollCorner; }
-
-    void resize(const PlatformEvent&, const LayoutSize&);
-    IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
-
-    bool inResizeMode() const { return m_inResizeMode; }
-    void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; }
-
-    IntRect touchResizerCornerRect(const IntRect& bounds) const
-    {
-        return resizerCornerRect(bounds, ResizerForTouch);
-    }
-
-    LayoutUnit scrollWidth() const;
-    LayoutUnit scrollHeight() const;
-    int pixelSnappedScrollWidth() const;
-    int pixelSnappedScrollHeight() const;
-
-    int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
-    int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
-
-    DoubleSize adjustedScrollOffset() const { return DoubleSize(scrollXOffset(), scrollYOffset()); }
-
-    void positionOverflowControls();
-
-    // isPointInResizeControl() is used for testing if a pointer/touch position is in the resize control
-    // area.
-    bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestType) const;
-    bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
-
-    bool hitTestResizerInFragments(const DeprecatedPaintLayerFragments&, const HitTestLocation&) const;
-
-    LayoutRect scrollIntoView(const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY) override;
-
-    // Returns true if scrollable area is in the FrameView's collection of scrollable areas. This can
-    // only happen if we're scrollable, visible to hit test, and do in fact overflow. This means that
-    // 'overflow: hidden' or 'pointer-events: none' layers never get added to the FrameView's collection.
-    bool scrollsOverflow() const { return m_scrollsOverflow; }
-
-    // Rectangle encompassing the scroll corner and resizer rect.
-    IntRect scrollCornerAndResizerRect() const;
-
-    enum LCDTextMode {
-        ConsiderLCDText,
-        IgnoreLCDText
-    };
-
-    void updateNeedsCompositedScrolling(LCDTextMode = ConsiderLCDText);
-    bool needsCompositedScrolling() const { return m_needsCompositedScrolling; }
-
-    // These are used during compositing updates to determine if the overflow
-    // controls need to be repositioned in the GraphicsLayer tree.
-    void setTopmostScrollChild(DeprecatedPaintLayer*);
-    DeprecatedPaintLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild); return m_topmostScrollChild; }
-
-    IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const;
-
-    LayoutBox& box() const;
-    DeprecatedPaintLayer* layer() const;
-
-    LayoutScrollbarPart* resizer() { return m_resizer; }
-
-    const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrollbarOffset; }
-    void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverlayScrollbarOffset = offset; }
-
-    IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const;
-    IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const;
-
-    DECLARE_VIRTUAL_TRACE();
-
-private:
-    explicit DeprecatedPaintLayerScrollableArea(DeprecatedPaintLayer&);
-
-    bool hasHorizontalOverflow() const;
-    bool hasVerticalOverflow() const;
-    bool hasScrollableHorizontalOverflow() const;
-    bool hasScrollableVerticalOverflow() const;
-    bool visualViewportSuppliesScrollbars() const;
-
-    bool needsScrollbarReconstruction() const;
-
-    void computeScrollDimensions();
-
-    void setScrollOffset(const IntPoint&, ScrollType) override;
-    void setScrollOffset(const DoublePoint&, ScrollType) override;
-
-    LayoutUnit verticalScrollbarStart(int minX, int maxX) const;
-    LayoutUnit horizontalScrollbarStart(int minX) const;
-    IntSize scrollbarOffset(const Scrollbar*) const;
-
-    void setHasHorizontalScrollbar(bool hasScrollbar);
-    void setHasVerticalScrollbar(bool hasScrollbar);
-
-    void updateScrollCornerStyle();
-
-    // See comments on isPointInResizeControl.
-    void updateResizerAreaSet();
-    void updateResizerStyle();
-
-
-    void updateScrollableAreaSet(bool hasOverflow);
-
-    void updateCompositingLayersAfterScroll();
-
-    DeprecatedPaintLayer& m_layer;
-
-    // Keeps track of whether the layer is currently resizing, so events can cause resizing to start and stop.
-    unsigned m_inResizeMode : 1;
-    unsigned m_scrollsOverflow : 1;
-
-    unsigned m_inOverflowRelayout : 1;
-
-    DeprecatedPaintLayer* m_nextTopmostScrollChild;
-    DeprecatedPaintLayer* m_topmostScrollChild;
-
-    // FIXME: once cc can handle composited scrolling with clip paths, we will
-    // no longer need this bit.
-    unsigned m_needsCompositedScrolling : 1;
-
-    // The width/height of our scrolled area.
-    LayoutRect m_overflowRect;
-
-    // ScrollbarManager holds the Scrollbar instances.
-    ScrollbarManager m_scrollbarManager;
-
-    // This is the (scroll) offset from scrollOrigin().
-    DoubleSize m_scrollOffset;
-
-    IntPoint m_cachedOverlayScrollbarOffset;
-
-    // LayoutObject to hold our custom scroll corner.
-    LayoutScrollbarPart* m_scrollCorner;
-
-    // LayoutObject to hold our custom resizer.
-    LayoutScrollbarPart* m_resizer;
-
-#if ENABLE(ASSERT)
-    bool m_hasBeenDisposed;
-#endif
-};
-
-} // namespace blink
-
-#endif // LayerScrollableArea_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNode.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNode.cpp
deleted file mode 100644
index 316914e4..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNode.cpp
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#include "config.h"
-#include "core/paint/DeprecatedPaintLayerStackingNode.h"
-
-#include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "public/platform/Platform.h"
-
-namespace blink {
-
-// FIXME: This should not require DeprecatedPaintLayer. There is currently a cycle where
-// in order to determine if we shoulBeTreatedAsStackingContext() we have to ask the paint
-// layer about some of its state.
-DeprecatedPaintLayerStackingNode::DeprecatedPaintLayerStackingNode(DeprecatedPaintLayer* layer)
-    : m_layer(layer)
-#if ENABLE(ASSERT)
-    , m_layerListMutationAllowed(true)
-    , m_stackingParent(0)
-#endif
-{
-    m_isTreatedAsOrStackingContext = shouldBeTreatedAsOrStackingContext();
-
-    // Non-stacking contexts should have empty z-order lists. As this is already the case,
-    // there is no need to dirty / recompute these lists.
-    m_zOrderListsDirty = isStackingContext();
-}
-
-DeprecatedPaintLayerStackingNode::~DeprecatedPaintLayerStackingNode()
-{
-#if ENABLE(ASSERT)
-    if (!layoutObject()->documentBeingDestroyed()) {
-        ASSERT(!isInStackingParentZOrderLists());
-
-        updateStackingParentForZOrderLists(0);
-    }
-#endif
-}
-
-// Helper for the sorting of layers by z-index.
-static inline bool compareZIndex(DeprecatedPaintLayerStackingNode* first, DeprecatedPaintLayerStackingNode* second)
-{
-    return first->zIndex() < second->zIndex();
-}
-
-DeprecatedPaintLayerCompositor* DeprecatedPaintLayerStackingNode::compositor() const
-{
-    ASSERT(layoutObject()->view());
-    return layoutObject()->view()->compositor();
-}
-
-void DeprecatedPaintLayerStackingNode::dirtyZOrderLists()
-{
-    ASSERT(m_layerListMutationAllowed);
-    ASSERT(isStackingContext());
-
-#if ENABLE(ASSERT)
-    updateStackingParentForZOrderLists(0);
-#endif
-
-    if (m_posZOrderList)
-        m_posZOrderList->clear();
-    if (m_negZOrderList)
-        m_negZOrderList->clear();
-    m_zOrderListsDirty = true;
-
-    if (!layoutObject()->documentBeingDestroyed())
-        compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
-}
-
-void DeprecatedPaintLayerStackingNode::dirtyStackingContextZOrderLists()
-{
-    if (DeprecatedPaintLayerStackingNode* stackingNode = ancestorStackingContextNode())
-        stackingNode->dirtyZOrderLists();
-}
-
-void DeprecatedPaintLayerStackingNode::rebuildZOrderLists()
-{
-    ASSERT(m_layerListMutationAllowed);
-    ASSERT(isDirtyStackingContext());
-
-    for (DeprecatedPaintLayer* child = layer()->firstChild(); child; child = child->nextSibling()) {
-        if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflectionLayer() != child)
-            child->stackingNode()->collectLayers(m_posZOrderList, m_negZOrderList);
-    }
-
-    // Sort the two lists.
-    if (m_posZOrderList)
-        std::stable_sort(m_posZOrderList->begin(), m_posZOrderList->end(), compareZIndex);
-
-    if (m_negZOrderList)
-        std::stable_sort(m_negZOrderList->begin(), m_negZOrderList->end(), compareZIndex);
-
-    // Append layers for top layer elements after normal layer collection, to ensure they are on top regardless of z-indexes.
-    // The layoutObjects of top layer elements are children of the view, sorted in top layer stacking order.
-    if (layer()->isRootLayer()) {
-        LayoutView* view = layoutObject()->view();
-        for (LayoutObject* child = view->firstChild(); child; child = child->nextSibling()) {
-            Element* childElement = (child->node() && child->node()->isElementNode()) ? toElement(child->node()) : 0;
-            if (childElement && childElement->isInTopLayer()) {
-                DeprecatedPaintLayer* layer = toLayoutBoxModelObject(child)->layer();
-                // Create the buffer if it doesn't exist yet.
-                if (!m_posZOrderList)
-                    m_posZOrderList = adoptPtr(new Vector<DeprecatedPaintLayerStackingNode*>);
-                m_posZOrderList->append(layer->stackingNode());
-            }
-        }
-    }
-
-#if ENABLE(ASSERT)
-    updateStackingParentForZOrderLists(this);
-#endif
-
-    m_zOrderListsDirty = false;
-}
-
-void DeprecatedPaintLayerStackingNode::collectLayers(OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& posBuffer, OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& negBuffer)
-{
-    if (layer()->isInTopLayer())
-        return;
-
-    if (isTreatedAsOrStackingContext()) {
-        OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posBuffer : negBuffer;
-        if (!buffer)
-            buffer = adoptPtr(new Vector<DeprecatedPaintLayerStackingNode*>);
-        buffer->append(this);
-    }
-
-    if (!isStackingContext()) {
-        for (DeprecatedPaintLayer* child = layer()->firstChild(); child; child = child->nextSibling()) {
-            if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflectionLayer() != child)
-                child->stackingNode()->collectLayers(posBuffer, negBuffer);
-        }
-    }
-}
-
-#if ENABLE(ASSERT)
-bool DeprecatedPaintLayerStackingNode::isInStackingParentZOrderLists() const
-{
-    if (!m_stackingParent || m_stackingParent->zOrderListsDirty())
-        return false;
-
-    if (m_stackingParent->posZOrderList() && m_stackingParent->posZOrderList()->find(this) != kNotFound)
-        return true;
-
-    if (m_stackingParent->negZOrderList() && m_stackingParent->negZOrderList()->find(this) != kNotFound)
-        return true;
-
-    return false;
-}
-
-void DeprecatedPaintLayerStackingNode::updateStackingParentForZOrderLists(DeprecatedPaintLayerStackingNode* stackingParent)
-{
-    if (m_posZOrderList) {
-        for (size_t i = 0; i < m_posZOrderList->size(); ++i)
-            m_posZOrderList->at(i)->setStackingParent(stackingParent);
-    }
-
-    if (m_negZOrderList) {
-        for (size_t i = 0; i < m_negZOrderList->size(); ++i)
-            m_negZOrderList->at(i)->setStackingParent(stackingParent);
-    }
-}
-
-#endif
-
-void DeprecatedPaintLayerStackingNode::updateLayerListsIfNeeded()
-{
-    updateZOrderLists();
-
-    if (!layer()->reflectionInfo())
-        return;
-
-    DeprecatedPaintLayer* reflectionLayer = layer()->reflectionInfo()->reflectionLayer();
-    reflectionLayer->stackingNode()->updateZOrderLists();
-}
-
-void DeprecatedPaintLayerStackingNode::updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle)
-{
-    bool wasStackingContext = oldStyle ? !oldStyle->hasAutoZIndex() : false;
-    int oldZIndex = oldStyle ? oldStyle->zIndex() : 0;
-
-    bool isStackingContext = this->isStackingContext();
-    if (isStackingContext == wasStackingContext && oldZIndex == zIndex())
-        return;
-
-    dirtyStackingContextZOrderLists();
-
-    if (isStackingContext)
-        dirtyZOrderLists();
-    else
-        clearZOrderLists();
-}
-
-void DeprecatedPaintLayerStackingNode::updateIsTreatedAsStackingContext()
-{
-    bool isTreatedAsOrStackingContext = shouldBeTreatedAsOrStackingContext();
-    if (isTreatedAsOrStackingContext == this->isTreatedAsOrStackingContext())
-        return;
-
-    m_isTreatedAsOrStackingContext = isTreatedAsOrStackingContext;
-    if (!layoutObject()->documentBeingDestroyed() && !layer()->isRootLayer())
-        compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
-    dirtyStackingContextZOrderLists();
-}
-
-DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNode::ancestorStackingContextNode() const
-{
-    for (DeprecatedPaintLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor->parent()) {
-        DeprecatedPaintLayerStackingNode* stackingNode = ancestor->stackingNode();
-        if (stackingNode->isStackingContext())
-            return stackingNode;
-    }
-    return 0;
-}
-
-LayoutBoxModelObject* DeprecatedPaintLayerStackingNode::layoutObject() const
-{
-    return m_layer->layoutObject();
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNode.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNode.h
deleted file mode 100644
index 975305d2..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNode.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Intel Corporation. All rights reserved.
- *
- * Portions are Copyright (C) 1998 Netscape Communications Corporation.
- *
- * Other contributors:
- *   Robert O'Callahan <roc+@cs.cmu.edu>
- *   David Baron <dbaron@fas.harvard.edu>
- *   Christian Biesinger <cbiesinger@web.de>
- *   Randall Jesup <rjesup@wgate.com>
- *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
- *   Josh Soref <timeless@mac.com>
- *   Boris Zbarsky <bzbarsky@mit.edu>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- *
- * Alternatively, the contents of this file may be used under the terms
- * of either the Mozilla Public License Version 1.1, found at
- * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
- * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
- * (the "GPL"), in which case the provisions of the MPL or the GPL are
- * applicable instead of those above.  If you wish to allow use of your
- * version of this file only under the terms of one of those two
- * licenses (the MPL or the GPL) and not to allow others to use your
- * version of this file under the LGPL, indicate your decision by
- * deletingthe provisions above and replace them with the notice and
- * other provisions required by the MPL or the GPL, as the case may be.
- * If you do not delete the provisions above, a recipient may use your
- * version of this file under any of the LGPL, the MPL or the GPL.
- */
-
-#ifndef DeprecatedPaintLayerStackingNode_h
-#define DeprecatedPaintLayerStackingNode_h
-
-#include "core/CoreExport.h"
-#include "core/layout/LayoutBoxModelObject.h"
-#include "wtf/Noncopyable.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/Vector.h"
-
-namespace blink {
-
-class DeprecatedPaintLayer;
-class DeprecatedPaintLayerCompositor;
-class ComputedStyle;
-class LayoutBoxModelObject;
-
-// DeprecatedPaintLayerStackingNode represents anything that is a stacking
-// context or treated as a stacking context.
-//
-// Stacking contexts are the basis for the CSS painting algorithm. The paint
-// order is determined by walking stacking contexts (or elements treated like a
-// stacking context like positioned objects or floats) in an order defined by
-// ‘z-index’. This walk is interleaved with content that is not a stacking.
-// context. See CSS 2.1 appendix E for the actual algorithm
-// http://www.w3.org/TR/CSS21/zindex.html
-// See also DeprecatedPaintLayerPainter (in particular paintLayerContents) for
-// our implementation of the walk.
-//
-// Stacking contexts form a subtree over the layout tree. Ideally we would want
-// objects of this class to be a node in this tree but there are potential
-// issues with stale pointers so we rely on DeprecatedPaintLayer's tree
-// structure.
-//
-// This class's purpose is to represent a node in the stacking context tree
-// (aka paint tree). It currently caches the z-order lists for painting and
-// hit-testing.
-//
-// To implement any z-order list iterations, use
-// DeprecatedPaintLayerStackingNodeIterator and
-// DeprecatedPaintLayerStackingNodeReverseIterator.
-//
-// This class is NOT DEPRECATED, DeprecatedPaintLayer is and we match its
-// naming.
-class CORE_EXPORT DeprecatedPaintLayerStackingNode {
-    WTF_MAKE_FAST_ALLOCATED(DeprecatedPaintLayerStackingNode);
-    WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerStackingNode);
-public:
-    explicit DeprecatedPaintLayerStackingNode(DeprecatedPaintLayer*);
-    ~DeprecatedPaintLayerStackingNode();
-
-    int zIndex() const { return layoutObject()->style()->zIndex(); }
-
-    bool isStackingContext() const { return layoutObject()->style()->isStackingContext(); }
-
-    // Update our normal and z-index lists.
-    void updateLayerListsIfNeeded();
-
-    bool zOrderListsDirty() const { return m_zOrderListsDirty; }
-    void dirtyZOrderLists();
-    void updateZOrderLists();
-    void clearZOrderLists();
-    void dirtyStackingContextZOrderLists();
-
-    bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList()->size(); }
-    bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList()->size(); }
-
-    bool isTreatedAsOrStackingContext() const { return m_isTreatedAsOrStackingContext; }
-    void updateIsTreatedAsStackingContext();
-
-    void updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle);
-
-    DeprecatedPaintLayerStackingNode* ancestorStackingContextNode() const;
-
-    DeprecatedPaintLayer* layer() const { return m_layer; }
-
-#if ENABLE(ASSERT)
-    bool layerListMutationAllowed() const { return m_layerListMutationAllowed; }
-    void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = flag; }
-#endif
-
-private:
-    friend class DeprecatedPaintLayerStackingNodeIterator;
-    friend class DeprecatedPaintLayerStackingNodeReverseIterator;
-    friend class LayoutTreeAsText;
-
-    Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList() const
-    {
-        ASSERT(!m_zOrderListsDirty);
-        ASSERT(isStackingContext() || !m_posZOrderList);
-        return m_posZOrderList.get();
-    }
-
-    Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList() const
-    {
-        ASSERT(!m_zOrderListsDirty);
-        ASSERT(isStackingContext() || !m_negZOrderList);
-        return m_negZOrderList.get();
-    }
-
-    void rebuildZOrderLists();
-    void collectLayers(OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& posZOrderList, OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>>& negZOrderList);
-
-#if ENABLE(ASSERT)
-    bool isInStackingParentZOrderLists() const;
-    void updateStackingParentForZOrderLists(DeprecatedPaintLayerStackingNode* stackingParent);
-    void setStackingParent(DeprecatedPaintLayerStackingNode* stackingParent) { m_stackingParent = stackingParent; }
-#endif
-
-    bool shouldBeTreatedAsOrStackingContext() const { return layoutObject()->style()->isTreatedAsOrStackingContext(); }
-
-    bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackingContext(); }
-
-    DeprecatedPaintLayerCompositor* compositor() const;
-    // We can't return a LayoutBox as LayoutInline can be a stacking context.
-    LayoutBoxModelObject* layoutObject() const;
-
-    DeprecatedPaintLayer* m_layer;
-
-    // m_posZOrderList holds a sorted list of all the descendant nodes within
-    // that have z-indices of 0 or greater (auto will count as 0).
-    // m_negZOrderList holds descendants within our stacking context with
-    // negative z-indices.
-    OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_posZOrderList;
-    OwnPtr<Vector<DeprecatedPaintLayerStackingNode*>> m_negZOrderList;
-
-    // This boolean caches whether the z-order lists above are dirty.
-    // It is only ever set for stacking contexts, as no other element can
-    // have z-order lists.
-    unsigned m_zOrderListsDirty : 1;
-
-    // This attribute caches whether the element was a stacking context or
-    // was treated like a stacking context, so that we can do comparison against
-    // it during style change (styleDidChange in particular), as we have lost
-    // the previous style information.
-    unsigned m_isTreatedAsOrStackingContext: 1;
-
-#if ENABLE(ASSERT)
-    unsigned m_layerListMutationAllowed : 1;
-    DeprecatedPaintLayerStackingNode* m_stackingParent;
-#endif
-};
-
-inline void DeprecatedPaintLayerStackingNode::clearZOrderLists()
-{
-    ASSERT(!isStackingContext());
-
-#if ENABLE(ASSERT)
-    updateStackingParentForZOrderLists(0);
-#endif
-
-    m_posZOrderList.clear();
-    m_negZOrderList.clear();
-}
-
-inline void DeprecatedPaintLayerStackingNode::updateZOrderLists()
-{
-    if (!m_zOrderListsDirty)
-        return;
-
-    if (!isStackingContext()) {
-        clearZOrderLists();
-        m_zOrderListsDirty = false;
-        return;
-    }
-
-    rebuildZOrderLists();
-}
-
-#if ENABLE(ASSERT)
-class LayerListMutationDetector {
-public:
-    explicit LayerListMutationDetector(DeprecatedPaintLayerStackingNode* stackingNode)
-        : m_stackingNode(stackingNode)
-        , m_previousMutationAllowedState(stackingNode->layerListMutationAllowed())
-    {
-        m_stackingNode->setLayerListMutationAllowed(false);
-    }
-
-    ~LayerListMutationDetector()
-    {
-        m_stackingNode->setLayerListMutationAllowed(m_previousMutationAllowedState);
-    }
-
-private:
-    DeprecatedPaintLayerStackingNode* m_stackingNode;
-    bool m_previousMutationAllowedState;
-};
-#endif
-
-} // namespace blink
-
-#endif // DeprecatedPaintLayerStackingNode_h
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.cpp b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.cpp
deleted file mode 100644
index 10c8c51a..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "core/paint/DeprecatedPaintLayerStackingNodeIterator.h"
-
-// FIXME: We should build our primitive on top of
-// DeprecatedLayerStackingNode and remove this include.
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/DeprecatedPaintLayerStackingNode.h"
-
-namespace blink {
-
-DeprecatedPaintLayerStackingNodeIterator::DeprecatedPaintLayerStackingNodeIterator(const DeprecatedPaintLayerStackingNode& root, unsigned whichChildren)
-    : m_root(root)
-    , m_remainingChildren(whichChildren)
-    , m_index(0)
-{
-    m_currentNormalFlowChild = root.layer()->firstChild();
-}
-
-DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNodeIterator::next()
-{
-    if (m_remainingChildren & NegativeZOrderChildren) {
-        Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOrderList();
-        if (negZOrderList && m_index < negZOrderList->size())
-            return negZOrderList->at(m_index++);
-
-        m_index = 0;
-        m_remainingChildren &= ~NegativeZOrderChildren;
-    }
-
-    if (m_remainingChildren & NormalFlowChildren) {
-        for (; m_currentNormalFlowChild; m_currentNormalFlowChild = m_currentNormalFlowChild->nextSibling()) {
-            if (!m_currentNormalFlowChild->stackingNode()->isTreatedAsOrStackingContext() && !m_currentNormalFlowChild->isReflection()) {
-                DeprecatedPaintLayer* normalFlowChild = m_currentNormalFlowChild;
-                m_currentNormalFlowChild = m_currentNormalFlowChild->nextSibling();
-                return normalFlowChild->stackingNode();
-            }
-        }
-
-        // We reset the iterator in case we reuse it.
-        m_currentNormalFlowChild = m_root.layer()->firstChild();
-        m_remainingChildren &= ~NormalFlowChildren;
-    }
-
-    if (m_remainingChildren & PositiveZOrderChildren) {
-        Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOrderList();
-        if (posZOrderList && m_index < posZOrderList->size())
-            return posZOrderList->at(m_index++);
-
-        m_index = 0;
-        m_remainingChildren &= ~PositiveZOrderChildren;
-    }
-
-    return 0;
-}
-
-DeprecatedPaintLayerStackingNode* DeprecatedPaintLayerStackingNodeReverseIterator::next()
-{
-    if (m_remainingChildren & NegativeZOrderChildren) {
-        Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOrderList();
-        if (negZOrderList && m_index >= 0)
-            return negZOrderList->at(m_index--);
-
-        m_remainingChildren &= ~NegativeZOrderChildren;
-        setIndexToLastItem();
-    }
-
-    if (m_remainingChildren & NormalFlowChildren) {
-        for (; m_currentNormalFlowChild; m_currentNormalFlowChild = m_currentNormalFlowChild->previousSibling()) {
-            if (!m_currentNormalFlowChild->stackingNode()->isTreatedAsOrStackingContext() && !m_currentNormalFlowChild->isReflection()) {
-                DeprecatedPaintLayer* normalFlowChild = m_currentNormalFlowChild;
-                m_currentNormalFlowChild = m_currentNormalFlowChild->previousSibling();
-                return normalFlowChild->stackingNode();
-            }
-        }
-
-        m_remainingChildren &= ~NormalFlowChildren;
-        setIndexToLastItem();
-    }
-
-    if (m_remainingChildren & PositiveZOrderChildren) {
-        Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOrderList();
-        if (posZOrderList && m_index >= 0)
-            return posZOrderList->at(m_index--);
-
-        m_remainingChildren &= ~PositiveZOrderChildren;
-        setIndexToLastItem();
-    }
-
-    return 0;
-}
-
-void DeprecatedPaintLayerStackingNodeReverseIterator::setIndexToLastItem()
-{
-    if (m_remainingChildren & NegativeZOrderChildren) {
-        Vector<DeprecatedPaintLayerStackingNode*>* negZOrderList = m_root.negZOrderList();
-        if (negZOrderList) {
-            m_index  = negZOrderList->size() - 1;
-            return;
-        }
-
-        m_remainingChildren &= ~NegativeZOrderChildren;
-    }
-
-    if (m_remainingChildren & NormalFlowChildren) {
-        m_currentNormalFlowChild = m_root.layer()->lastChild();
-        return;
-    }
-
-    if (m_remainingChildren & PositiveZOrderChildren) {
-        Vector<DeprecatedPaintLayerStackingNode*>* posZOrderList = m_root.posZOrderList();
-        if (posZOrderList) {
-            m_index = posZOrderList->size() - 1;
-            return;
-        }
-
-        m_remainingChildren &= ~PositiveZOrderChildren;
-    }
-
-    // No more list to visit.
-    ASSERT(!m_remainingChildren);
-    m_index = -1;
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.h b/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.h
deleted file mode 100644
index 6dde5f8..0000000
--- a/third_party/WebKit/Source/core/paint/DeprecatedPaintLayerStackingNodeIterator.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef DeprecatedPaintLayerStackingNodeIterator_h
-#define DeprecatedPaintLayerStackingNodeIterator_h
-
-#include "wtf/Allocator.h"
-#include "wtf/Noncopyable.h"
-
-namespace blink {
-
-enum ChildrenIteration {
-    NegativeZOrderChildren = 1,
-    // Normal flow children are not mandated by CSS 2.1 but are an artifact of
-    // our implementation: we allocate DeprecatedPaintLayers for elements that
-    // are not treated as stacking contexts and thus we need to walk them
-    // during painting and hit-testing.
-    NormalFlowChildren = 1 << 1,
-    PositiveZOrderChildren = 1 << 2,
-    AllChildren = NegativeZOrderChildren | NormalFlowChildren | PositiveZOrderChildren
-};
-
-class DeprecatedPaintLayerStackingNode;
-class DeprecatedPaintLayer;
-
-// This iterator walks the DeprecatedPaintLayerStackingNode lists in the following order:
-// NegativeZOrderChildren -> NormalFlowChildren -> PositiveZOrderChildren.
-class DeprecatedPaintLayerStackingNodeIterator {
-    STACK_ALLOCATED();
-    WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerStackingNodeIterator);
-public:
-    DeprecatedPaintLayerStackingNodeIterator(const DeprecatedPaintLayerStackingNode& root, unsigned whichChildren);
-
-    DeprecatedPaintLayerStackingNode* next();
-
-private:
-    const DeprecatedPaintLayerStackingNode& m_root;
-    unsigned m_remainingChildren;
-    unsigned m_index;
-    DeprecatedPaintLayer* m_currentNormalFlowChild;
-};
-
-// This iterator is similar to DeprecatedPaintLayerStackingNodeIterator but it walks the lists in reverse order
-// (from the last item to the first one).
-class DeprecatedPaintLayerStackingNodeReverseIterator {
-    STACK_ALLOCATED();
-    WTF_MAKE_NONCOPYABLE(DeprecatedPaintLayerStackingNodeReverseIterator);
-public:
-    DeprecatedPaintLayerStackingNodeReverseIterator(const DeprecatedPaintLayerStackingNode& root, unsigned whichChildren)
-        : m_root(root)
-        , m_remainingChildren(whichChildren)
-    {
-        setIndexToLastItem();
-    }
-
-    DeprecatedPaintLayerStackingNode* next();
-
-private:
-    void setIndexToLastItem();
-
-    const DeprecatedPaintLayerStackingNode& m_root;
-    unsigned m_remainingChildren;
-    int m_index;
-    DeprecatedPaintLayer* m_currentNormalFlowChild;
-};
-
-} // namespace blink
-
-#endif // DeprecatedPaintLayerStackingNodeIterator_h
diff --git a/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.cpp b/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.cpp
index b9532fa..2efebc7 100644
--- a/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.cpp
+++ b/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.cpp
@@ -8,8 +8,8 @@
 #include "core/layout/LayoutText.h"
 #include "core/layout/line/InlineTextBox.h"
 #include "core/page/FocusController.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
+#include "core/paint/PaintLayerPainter.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/paint/DrawingDisplayItem.h"
 
@@ -20,14 +20,14 @@
     setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>XYZ</div>");
     document().page()->focusController().setActive(true);
     document().page()->focusController().setFocused(true);
-    DeprecatedPaintLayer& rootLayer = *layoutView().layer();
+    PaintLayer& rootLayer = *layoutView().layer();
     Element& div = *toElement(document().body()->firstChild());
     LayoutObject& divLayoutObject = *document().body()->firstChild()->layoutObject();
     InlineTextBox& textInlineBox = *toLayoutText(div.firstChild()->layoutObject())->firstTextBox();
 
     GraphicsContext context(&rootDisplayItemList());
-    DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 600), GlobalPaintNormalPhase, LayoutSize());
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 600), GlobalPaintNormalPhase, LayoutSize());
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
     rootDisplayItemList().commitNewDisplayItems();
 
     EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2,
@@ -39,7 +39,7 @@
     EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(layoutView().displayItemClient()));
     EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(divLayoutObject.displayItemClient()));
     EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(textInlineBox.displayItemClient()));
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
     rootDisplayItemList().commitNewDisplayItems();
 
     EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3,
@@ -51,7 +51,7 @@
 TEST_F(DisplayItemListPaintTest, InlineRelayout)
 {
     setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAAA BBBBBBBBBB</div>");
-    DeprecatedPaintLayer& rootLayer = *layoutView().layer();
+    PaintLayer& rootLayer = *layoutView().layer();
     Element& div = *toElement(document().body()->firstChild());
     LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layoutObject());
     LayoutText& text = *toLayoutText(divBlock.firstChild());
@@ -59,8 +59,8 @@
     DisplayItemClient firstTextBoxDisplayItemClient = firstTextBox.displayItemClient();
 
     GraphicsContext context(&rootDisplayItemList());
-    DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 600), GlobalPaintNormalPhase, LayoutSize());
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 600), GlobalPaintNormalPhase, LayoutSize());
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
     rootDisplayItemList().commitNewDisplayItems();
 
     EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2,
@@ -72,7 +72,7 @@
     EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(layoutView().displayItemClient()));
     EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(divBlock.displayItemClient()));
     EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(firstTextBoxDisplayItemClient));
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
     rootDisplayItemList().commitNewDisplayItems();
 
     LayoutText& newText = *toLayoutText(divBlock.firstChild());
@@ -90,7 +90,7 @@
     setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>XYZ</div>");
     document().page()->focusController().setActive(true);
     document().page()->focusController().setFocused(true);
-    DeprecatedPaintLayer& rootLayer = *layoutView().layer();
+    PaintLayer& rootLayer = *layoutView().layer();
     Element& div = *toElement(document().body()->firstChild());
     LayoutObject& divLayoutObject = *document().body()->firstChild()->layoutObject();
     InlineTextBox& textInlineBox = *toLayoutText(div.firstChild()->layoutObject())->firstTextBox();
@@ -117,7 +117,7 @@
 TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout)
 {
     setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAAA BBBBBBBBBB</div>");
-    DeprecatedPaintLayer& rootLayer = *layoutView().layer();
+    PaintLayer& rootLayer = *layoutView().layer();
     Element& div = *toElement(document().body()->firstChild());
     LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layoutObject());
     LayoutText& text = *toLayoutText(divBlock.firstChild());
diff --git a/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h b/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h
index 4567d1d2..abae03e 100644
--- a/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h
+++ b/third_party/WebKit/Source/core/paint/DisplayItemListPaintTest.h
@@ -8,7 +8,7 @@
 #include "core/frame/FrameView.h"
 #include "core/layout/LayoutTestHelper.h"
 #include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include <gtest/gtest.h>
 
diff --git a/third_party/WebKit/Source/core/paint/FilterPainter.cpp b/third_party/WebKit/Source/core/paint/FilterPainter.cpp
index 21f8648..b38d952 100644
--- a/third_party/WebKit/Source/core/paint/FilterPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/FilterPainter.cpp
@@ -5,9 +5,9 @@
 #include "config.h"
 #include "core/paint/FilterPainter.h"
 
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/FilterEffectBuilder.h"
 #include "core/paint/LayerClipRecorder.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/GraphicsLayer.h"
@@ -21,7 +21,7 @@
 
 namespace blink {
 
-FilterPainter::FilterPainter(DeprecatedPaintLayer& layer, GraphicsContext* context, const LayoutPoint& offsetFromRoot, const ClipRect& clipRect, DeprecatedPaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags,
+FilterPainter::FilterPainter(PaintLayer& layer, GraphicsContext* context, const LayoutPoint& offsetFromRoot, const ClipRect& clipRect, PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags,
     LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed)
     : m_filterInProgress(false)
     , m_context(context)
diff --git a/third_party/WebKit/Source/core/paint/FilterPainter.h b/third_party/WebKit/Source/core/paint/FilterPainter.h
index 8185740a..20a87fa 100644
--- a/third_party/WebKit/Source/core/paint/FilterPainter.h
+++ b/third_party/WebKit/Source/core/paint/FilterPainter.h
@@ -5,7 +5,7 @@
 #ifndef FilterPainter_h
 #define FilterPainter_h
 
-#include "core/paint/DeprecatedPaintLayerPaintingInfo.h"
+#include "core/paint/PaintLayerPaintingInfo.h"
 #include "wtf/Allocator.h"
 #include "wtf/OwnPtr.h"
 
@@ -13,13 +13,13 @@
 
 class ClipRect;
 class GraphicsContext;
-class DeprecatedPaintLayer;
+class PaintLayer;
 class LayerClipRecorder;
 
 class FilterPainter {
     STACK_ALLOCATED();
 public:
-    FilterPainter(DeprecatedPaintLayer&, GraphicsContext*, const LayoutPoint& offsetFromRoot, const ClipRect&, DeprecatedPaintLayerPaintingInfo&, PaintLayerFlags paintFlags, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
+    FilterPainter(PaintLayer&, GraphicsContext*, const LayoutPoint& offsetFromRoot, const ClipRect&, PaintLayerPaintingInfo&, PaintLayerFlags paintFlags, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed);
     ~FilterPainter();
 
 private:
diff --git a/third_party/WebKit/Source/core/paint/FramePainter.cpp b/third_party/WebKit/Source/core/paint/FramePainter.cpp
index 71bc5f2a..29a03e8 100644
--- a/third_party/WebKit/Source/core/paint/FramePainter.cpp
+++ b/third_party/WebKit/Source/core/paint/FramePainter.cpp
@@ -12,10 +12,10 @@
 #include "core/inspector/InspectorTraceEvents.h"
 #include "core/layout/LayoutView.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
+#include "core/paint/PaintLayerPainter.h"
 #include "core/paint/ScrollbarPainter.h"
 #include "core/paint/TransformRecorder.h"
 #include "platform/fonts/FontCache.h"
@@ -113,14 +113,14 @@
 
     // frameView().nodeToDraw() is used to draw only one element (and its descendants)
     LayoutObject* layoutObject = frameView().nodeToDraw() ? frameView().nodeToDraw()->layoutObject() : 0;
-    DeprecatedPaintLayer* rootLayer = layoutView->layer();
+    PaintLayer* rootLayer = layoutView->layer();
 
 #if ENABLE(ASSERT)
     layoutView->assertSubtreeIsLaidOut();
     LayoutObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer->layoutObject());
 #endif
 
-    DeprecatedPaintLayerPainter layerPainter(*rootLayer);
+    PaintLayerPainter layerPainter(*rootLayer);
 
     float deviceScaleFactor = blink::deviceScaleFactor(rootLayer->layoutObject()->frame());
     context->setDeviceScaleFactor(deviceScaleFactor);
diff --git a/third_party/WebKit/Source/core/paint/FrameSetPainter.cpp b/third_party/WebKit/Source/core/paint/FrameSetPainter.cpp
index c614d28..72dbf19 100644
--- a/third_party/WebKit/Source/core/paint/FrameSetPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/FrameSetPainter.cpp
@@ -116,7 +116,7 @@
     size_t cols = m_layoutFrameSet.columns().m_sizes.size();
     for (size_t r = 0; r < rows; r++) {
         for (size_t c = 0; c < cols; c++) {
-            // Self-painting layers are painted during the DeprecatedPaintLayer paint recursion, not LayoutObject.
+            // Self-painting layers are painted during the PaintLayer paint recursion, not LayoutObject.
             if (!child->isBoxModelObject() || !toLayoutBoxModelObject(child)->hasSelfPaintingLayer())
                 child->paint(paintInfo, adjustedPaintOffset);
             child = child->nextSibling();
diff --git a/third_party/WebKit/Source/core/paint/InlineFlowBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineFlowBoxPainter.cpp
index fca8d6e0..58a44133 100644
--- a/third_party/WebKit/Source/core/paint/InlineFlowBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/InlineFlowBoxPainter.cpp
@@ -12,9 +12,9 @@
 #include "core/layout/api/SelectionState.h"
 #include "core/layout/line/InlineFlowBox.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LineLayoutPaintShim.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/graphics/GraphicsContextStateSaver.h"
 #include "platform/graphics/paint/DrawingRecorder.h"
 
diff --git a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
index 1cd2cba0..66b33ff 100644
--- a/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/InlineTextBoxPainter.cpp
@@ -17,6 +17,7 @@
 #include "core/layout/api/LineLayoutText.h"
 #include "core/layout/line/InlineTextBox.h"
 #include "core/paint/BoxPainter.h"
+#include "core/paint/LineLayoutPaintShim.h"
 #include "core/paint/PaintInfo.h"
 #include "core/paint/TextPainter.h"
 #include "platform/graphics/GraphicsContextStateSaver.h"
@@ -90,7 +91,7 @@
             return;
         LayoutRect paintRect(logicalVisualOverflow);
         m_inlineTextBox.logicalRectToPhysicalRect(paintRect);
-        if (paintInfo.phase != PaintPhaseSelection && (haveSelection || paintsMarkerHighlights(m_inlineTextBox.layoutObject())))
+        if (paintInfo.phase != PaintPhaseSelection && (haveSelection || paintsMarkerHighlights(*LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayoutItem()))))
             paintRect.unite(m_inlineTextBox.localSelectionRect(m_inlineTextBox.start(), m_inlineTextBox.start() + m_inlineTextBox.len()));
         paintRect.moveBy(adjustedPaintOffset);
         drawingRecorder.emplace(*paintInfo.context, m_inlineTextBox, DisplayItem::paintPhaseToDrawingType(paintInfo.phase), FloatRect(paintRect));
@@ -125,7 +126,7 @@
     LayoutTextCombine* combinedText = nullptr;
     if (!m_inlineTextBox.isHorizontal()) {
         if (styleToUse.hasTextCombine() && m_inlineTextBox.lineLayoutItem().isCombineText()) {
-            combinedText = &toLayoutTextCombine(m_inlineTextBox.layoutObject());
+            combinedText = &toLayoutTextCombine(*LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayoutItem()));
             if (!combinedText->isCombined())
                 combinedText = nullptr;
         }
@@ -139,8 +140,9 @@
     }
 
     // Determine text colors.
-    TextPainter::Style textStyle = TextPainter::textPaintingStyle(m_inlineTextBox.layoutObject(), styleToUse, paintInfo);
-    TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(m_inlineTextBox.layoutObject(), haveSelection, paintInfo, textStyle);
+    const LayoutObject& textBoxLayoutObject = *LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayoutItem());
+    TextPainter::Style textStyle = TextPainter::textPaintingStyle(textBoxLayoutObject, styleToUse, paintInfo);
+    TextPainter::Style selectionStyle = TextPainter::selectionPaintingStyle(textBoxLayoutObject, haveSelection, paintInfo, textStyle);
     bool paintSelectedTextOnly = (paintInfo.phase == PaintPhaseSelection);
     bool paintSelectedTextSeparately = !paintSelectedTextOnly && textStyle != selectionStyle;
 
@@ -154,7 +156,7 @@
     if (paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseTextClip && !isPrinting) {
         paintDocumentMarkers(context, boxOrigin, styleToUse, font, true);
 
-        if (haveSelection && !paintsCompositionMarkers(m_inlineTextBox.layoutObject())) {
+        if (haveSelection && !paintsCompositionMarkers(textBoxLayoutObject)) {
             if (combinedText)
                 paintSelection<InlineTextBoxPainter::PaintOptions::CombinedText>(context, boxRect, styleToUse, font, selectionStyle.fillColor, combinedText);
             else
@@ -260,7 +262,7 @@
         && m_inlineTextBox.isHorizontal()
         && m_inlineTextBox.isLeftToRightDirection();
     if ((!paintLineBreaks && m_inlineTextBox.isLineBreak())
-        || !paintInfo.shouldPaintWithinRoot(&m_inlineTextBox.layoutObject())
+        || !paintInfo.shouldPaintWithinRoot(LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayoutItem()))
         || m_inlineTextBox.lineLayoutItem().style()->visibility() != VISIBLE
         || m_inlineTextBox.truncation() == cFullTruncation
         || !m_inlineTextBox.len())
@@ -732,14 +734,15 @@
 
     // Get the text decoration colors.
     LayoutObject::AppliedTextDecoration underline, overline, linethrough;
-    m_inlineTextBox.layoutObject().getTextDecorations(deco, underline, overline, linethrough, true);
+    LayoutObject& textBoxLayoutObject = *LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayoutItem());
+    textBoxLayoutObject.getTextDecorations(deco, underline, overline, linethrough, true);
     if (m_inlineTextBox.isFirstLineStyle())
-        m_inlineTextBox.layoutObject().getTextDecorations(deco, underline, overline, linethrough, true, true);
+        textBoxLayoutObject.getTextDecorations(deco, underline, overline, linethrough, true, true);
 
     // Use a special function for underlines to get the positioning exactly right.
     bool isPrinting = paintInfo.isPrinting();
 
-    const ComputedStyle& styleToUse = m_inlineTextBox.lineLayoutItem().styleRef(m_inlineTextBox.isFirstLineStyle());
+    const ComputedStyle& styleToUse = textBoxLayoutObject.styleRef(m_inlineTextBox.isFirstLineStyle());
     float baseline = styleToUse.fontMetrics().ascent();
 
     // Set the thick of the line to be 10% (or something else ?)of the computed font size and not less than 1px.
@@ -819,7 +822,7 @@
     TextRun run = m_inlineTextBox.constructTextRun(style, font);
 
     // Optionally highlight the text
-    if (m_inlineTextBox.layoutObject().frame()->editor().markedTextMatchesAreHighlighted()) {
+    if (LineLayoutPaintShim::layoutObjectFrom(m_inlineTextBox.lineLayoutItem())->frame()->editor().markedTextMatchesAreHighlighted()) {
         Color color = marker->activeMatch() ?
             LayoutTheme::theme().platformActiveTextSearchHighlightColor() :
             LayoutTheme::theme().platformInactiveTextSearchHighlightColor();
diff --git a/third_party/WebKit/Source/core/paint/LayerClipRecorder.cpp b/third_party/WebKit/Source/core/paint/LayerClipRecorder.cpp
index 0f6799a1..5743fe4 100644
--- a/third_party/WebKit/Source/core/paint/LayerClipRecorder.cpp
+++ b/third_party/WebKit/Source/core/paint/LayerClipRecorder.cpp
@@ -7,7 +7,7 @@
 
 #include "core/layout/ClipRect.h"
 #include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/geometry/IntRect.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/GraphicsLayer.h"
@@ -17,7 +17,7 @@
 namespace blink {
 
 LayerClipRecorder::LayerClipRecorder(GraphicsContext& graphicsContext, const LayoutBoxModelObject& layoutObject, DisplayItem::Type clipType, const ClipRect& clipRect,
-    const DeprecatedPaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule)
+    const PaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags paintFlags, BorderRadiusClippingRule rule)
     : m_graphicsContext(graphicsContext)
     , m_layoutObject(layoutObject)
     , m_clipType(clipType)
@@ -34,7 +34,7 @@
     m_graphicsContext.displayItemList()->createAndAppend<ClipDisplayItem>(layoutObject, m_clipType, snappedClipRect, roundedRects);
 }
 
-static bool inContainingBlockChain(DeprecatedPaintLayer* startLayer, DeprecatedPaintLayer* endLayer)
+static bool inContainingBlockChain(PaintLayer* startLayer, PaintLayer* endLayer)
 {
     if (startLayer == endLayer)
         return true;
@@ -48,13 +48,13 @@
     return false;
 }
 
-void LayerClipRecorder::collectRoundedRectClips(DeprecatedPaintLayer& paintLayer, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, GraphicsContext& context, const LayoutPoint& fragmentOffset, PaintLayerFlags paintFlags,
+void LayerClipRecorder::collectRoundedRectClips(PaintLayer& paintLayer, const PaintLayerPaintingInfo& localPaintingInfo, GraphicsContext& context, const LayoutPoint& fragmentOffset, PaintLayerFlags paintFlags,
     BorderRadiusClippingRule rule, Vector<FloatRoundedRect>& roundedRectClips)
 {
     // If the clip rect has been tainted by a border radius, then we have to walk up our layer chain applying the clips from
     // any layers with overflow. The condition for being able to apply these clips is that the overflow object be in our
     // containing block chain so we check that also.
-    for (DeprecatedPaintLayer* layer = rule == IncludeSelfForBorderRadius ? &paintLayer : paintLayer.parent(); layer; layer = layer->parent()) {
+    for (PaintLayer* layer = rule == IncludeSelfForBorderRadius ? &paintLayer : paintLayer.parent(); layer; layer = layer->parent()) {
         // Composited scrolling layers handle border-radius clip in the compositor via a mask layer. We do not
         // want to apply a border-radius clip to the layer contents itself, because that would require re-rastering
         // every frame to update the clip. We only want to make sure that the mask layer is properly clipped so
diff --git a/third_party/WebKit/Source/core/paint/LayerClipRecorder.h b/third_party/WebKit/Source/core/paint/LayerClipRecorder.h
index b1f93ed8a..4f68043 100644
--- a/third_party/WebKit/Source/core/paint/LayerClipRecorder.h
+++ b/third_party/WebKit/Source/core/paint/LayerClipRecorder.h
@@ -6,7 +6,7 @@
 #define LayerClipRecorder_h
 
 #include "core/CoreExport.h"
-#include "core/paint/DeprecatedPaintLayerPaintingInfo.h"
+#include "core/paint/PaintLayerPaintingInfo.h"
 #include "core/paint/PaintPhase.h"
 #include "platform/graphics/paint/ClipDisplayItem.h"
 #include "platform/graphics/paint/DisplayItem.h"
@@ -24,7 +24,7 @@
 
     enum BorderRadiusClippingRule { IncludeSelfForBorderRadius, DoNotIncludeSelfForBorderRadius };
 
-    // Set rounded clip rectangles defined by border radii all the way from the DeprecatedPaintLayerPaintingInfo
+    // Set rounded clip rectangles defined by border radii all the way from the PaintLayerPaintingInfo
     // "root" layer down to the specified layer (or the parent of said layer, in case
     // BorderRadiusClippingRule says to skip self). fragmentOffset is used for multicol, to specify
     // the translation required to get from flow thread coordinates to visual coordinates for a
@@ -35,13 +35,13 @@
     // same time we pass a fragmentOffset, so that we can translate from flow thread coordinates to
     // visual coordinates. This may look rather confusing/redundant, but it is needed for rounded
     // border clipping. Would be nice to clean up this.
-    explicit LayerClipRecorder(GraphicsContext&, const LayoutBoxModelObject&, DisplayItem::Type, const ClipRect&, const DeprecatedPaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
+    explicit LayerClipRecorder(GraphicsContext&, const LayoutBoxModelObject&, DisplayItem::Type, const ClipRect&, const PaintLayerPaintingInfo* localPaintingInfo, const LayoutPoint& fragmentOffset, PaintLayerFlags, BorderRadiusClippingRule = IncludeSelfForBorderRadius);
 
     ~LayerClipRecorder();
 
 private:
 
-    void collectRoundedRectClips(DeprecatedPaintLayer&, const DeprecatedPaintLayerPaintingInfo& localPaintingInfo, GraphicsContext&, const LayoutPoint& fragmentOffset, PaintLayerFlags,
+    void collectRoundedRectClips(PaintLayer&, const PaintLayerPaintingInfo& localPaintingInfo, GraphicsContext&, const LayoutPoint& fragmentOffset, PaintLayerFlags,
         BorderRadiusClippingRule, Vector<FloatRoundedRect>& roundedRectClips);
 
     GraphicsContext& m_graphicsContext;
diff --git a/third_party/WebKit/Source/core/paint/LayerClipRecorderTest.cpp b/third_party/WebKit/Source/core/paint/LayerClipRecorderTest.cpp
index 2bfa4d7..53153a9 100644
--- a/third_party/WebKit/Source/core/paint/LayerClipRecorderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/LayerClipRecorderTest.cpp
@@ -7,9 +7,9 @@
 
 #include "core/layout/LayoutTestHelper.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/graphics/paint/DisplayItemList.h"
diff --git a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp
index 6d1e0cb..3cf0adf 100644
--- a/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp
+++ b/third_party/WebKit/Source/core/paint/LayoutObjectDrawingRecorderTest.cpp
@@ -7,8 +7,8 @@
 
 #include "core/layout/LayoutTestHelper.h"
 #include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/DisplayItemListPaintTest.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/graphics/GraphicsContext.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/graphics/paint/DisplayItemList.h"
diff --git a/third_party/WebKit/Source/core/paint/PaintInfo.h b/third_party/WebKit/Source/core/paint/PaintInfo.h
index c991599e..9b2f138 100644
--- a/third_party/WebKit/Source/core/paint/PaintInfo.h
+++ b/third_party/WebKit/Source/core/paint/PaintInfo.h
@@ -28,7 +28,7 @@
 
 // TODO(jchaffraix): Once we unify PaintBehavior and PaintLayerFlags, we should move
 // PaintLayerFlags to PaintPhase and rename it. Thus removing the need for this #include.
-#include "core/paint/DeprecatedPaintLayerPaintingInfo.h"
+#include "core/paint/PaintLayerPaintingInfo.h"
 #include "core/paint/PaintPhase.h"
 #include "platform/geometry/IntRect.h"
 #include "platform/geometry/LayoutRect.h"
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.cpp b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
new file mode 100644
index 0000000..7bdb7351
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.cpp
@@ -0,0 +1,2745 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "core/paint/PaintLayer.h"
+
+#include "core/CSSPropertyNames.h"
+#include "core/HTMLNames.h"
+#include "core/css/PseudoStyleRequest.h"
+#include "core/dom/Document.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "core/frame/DeprecatedScheduleStyleRecalcDuringLayout.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
+#include "core/html/HTMLFrameElement.h"
+#include "core/layout/HitTestRequest.h"
+#include "core/layout/HitTestResult.h"
+#include "core/layout/HitTestingTransformState.h"
+#include "core/layout/LayoutFlowThread.h"
+#include "core/layout/LayoutGeometryMap.h"
+#include "core/layout/LayoutInline.h"
+#include "core/layout/LayoutPart.h"
+#include "core/layout/LayoutReplica.h"
+#include "core/layout/LayoutScrollbar.h"
+#include "core/layout/LayoutScrollbarPart.h"
+#include "core/layout/LayoutTreeAsText.h"
+#include "core/layout/LayoutView.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/layout/svg/LayoutSVGRoot.h"
+#include "core/layout/svg/ReferenceFilterBuilder.h"
+#include "core/page/Page.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/paint/FilterEffectBuilder.h"
+#include "platform/LengthFunctions.h"
+#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/TraceEvent.h"
+#include "platform/geometry/FloatPoint3D.h"
+#include "platform/geometry/FloatRect.h"
+#include "platform/geometry/TransformState.h"
+#include "platform/graphics/filters/Filter.h"
+#include "platform/graphics/filters/SourceGraphic.h"
+#include "platform/transforms/ScaleTransformOperation.h"
+#include "platform/transforms/TransformationMatrix.h"
+#include "platform/transforms/TranslateTransformOperation.h"
+#include "public/platform/Platform.h"
+#include "wtf/Partitions.h"
+#include "wtf/StdLibExtras.h"
+#include "wtf/text/CString.h"
+
+namespace blink {
+
+namespace {
+
+static CompositingQueryMode gCompositingQueryMode =
+    CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases;
+
+} // namespace
+
+using namespace HTMLNames;
+
+PaintLayer::PaintLayer(LayoutBoxModelObject* layoutObject, PaintLayerType type)
+    : m_layerType(type)
+    , m_hasSelfPaintingLayerDescendant(false)
+    , m_hasSelfPaintingLayerDescendantDirty(false)
+    , m_isRootLayer(layoutObject->isLayoutView())
+    , m_visibleContentStatusDirty(true)
+    , m_hasVisibleContent(false)
+    , m_visibleDescendantStatusDirty(false)
+    , m_hasVisibleDescendant(false)
+    , m_hasVisibleNonLayerContent(false)
+#if ENABLE(ASSERT)
+    , m_needsPositionUpdate(true)
+#endif
+    , m_3DTransformedDescendantStatusDirty(true)
+    , m_has3DTransformedDescendant(false)
+    , m_containsDirtyOverlayScrollbars(false)
+    , m_hasFilterInfo(false)
+    , m_needsAncestorDependentCompositingInputsUpdate(true)
+    , m_needsDescendantDependentCompositingInputsUpdate(true)
+    , m_childNeedsCompositingInputsUpdate(true)
+    , m_hasCompositingDescendant(false)
+    , m_hasNonCompositedChild(false)
+    , m_shouldIsolateCompositedDescendants(false)
+    , m_lostGroupedMapping(false)
+    , m_needsRepaint(false)
+    , m_layoutObject(layoutObject)
+    , m_parent(0)
+    , m_previous(0)
+    , m_next(0)
+    , m_first(0)
+    , m_last(0)
+    , m_staticInlinePosition(0)
+    , m_staticBlockPosition(0)
+    , m_enclosingPaginationLayer(0)
+    , m_potentialCompositingReasonsFromStyle(CompositingReasonNone)
+    , m_compositingReasons(CompositingReasonNone)
+    , m_groupedMapping(0)
+    , m_clipper(*layoutObject)
+{
+    updateStackingNode();
+
+    m_isSelfPaintingLayer = shouldBeSelfPaintingLayer();
+
+    if (!layoutObject->slowFirstChild() && layoutObject->style()) {
+        m_visibleContentStatusDirty = false;
+        m_hasVisibleContent = layoutObject->style()->visibility() == VISIBLE;
+    }
+
+    updateScrollableArea();
+}
+
+PaintLayer::~PaintLayer()
+{
+    if (layoutObject()->frame() && layoutObject()->frame()->page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = layoutObject()->frame()->page()->scrollingCoordinator())
+            scrollingCoordinator->willDestroyLayer(this);
+    }
+
+    removeFilterInfoIfNeeded();
+
+    if (groupedMapping()) {
+        DisableCompositingQueryAsserts disabler;
+        setGroupedMapping(0, InvalidateLayerAndRemoveFromMapping);
+    }
+
+    // Child layers will be deleted by their corresponding layout objects, so
+    // we don't need to delete them ourselves.
+
+    clearCompositedLayerMapping(true);
+
+    if (m_reflectionInfo)
+        m_reflectionInfo->destroy();
+
+    if (m_scrollableArea)
+        m_scrollableArea->dispose();
+}
+
+String PaintLayer::debugName() const
+{
+    if (isReflection())
+        return layoutObject()->parent()->debugName() + " (reflection)";
+    return layoutObject()->debugName();
+}
+
+PaintLayerCompositor* PaintLayer::compositor() const
+{
+    if (!layoutObject()->view())
+        return 0;
+    return layoutObject()->view()->compositor();
+}
+
+void PaintLayer::contentChanged(ContentChangeType changeType)
+{
+    // updateLayerCompositingState will query compositingReasons for accelerated overflow scrolling.
+    // This is tripped by LayoutTests/compositing/content-changed-chicken-egg.html
+    DisableCompositingQueryAsserts disabler;
+
+    if (changeType == CanvasChanged)
+        compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange);
+
+    if (changeType == CanvasContextChanged) {
+        compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange);
+
+        // Although we're missing test coverage, we need to call
+        // GraphicsLayer::setContentsToPlatformLayer with the new platform
+        // layer for this canvas.
+        // See http://crbug.com/349195
+        if (hasCompositedLayerMapping())
+            compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
+    }
+
+    if (m_compositedLayerMapping)
+        m_compositedLayerMapping->contentChanged(changeType);
+}
+
+bool PaintLayer::paintsWithFilters() const
+{
+    if (!layoutObject()->hasFilter())
+        return false;
+
+    // https://code.google.com/p/chromium/issues/detail?id=343759
+    DisableCompositingQueryAsserts disabler;
+    return !m_compositedLayerMapping || compositingState() != PaintsIntoOwnBacking;
+}
+
+bool PaintLayer::paintsWithBackdropFilters() const
+{
+    if (!layoutObject()->hasBackdropFilter())
+        return false;
+
+    // https://code.google.com/p/chromium/issues/detail?id=343759
+    DisableCompositingQueryAsserts disabler;
+    return !m_compositedLayerMapping || compositingState() != PaintsIntoOwnBacking;
+}
+
+LayoutSize PaintLayer::subpixelAccumulation() const
+{
+    return m_subpixelAccumulation;
+}
+
+void PaintLayer::setSubpixelAccumulation(const LayoutSize& size)
+{
+    m_subpixelAccumulation = size;
+}
+
+void PaintLayer::updateLayerPositionsAfterLayout()
+{
+    TRACE_EVENT0("blink,benchmark", "PaintLayer::updateLayerPositionsAfterLayout");
+
+    m_clipper.clearClipRectsIncludingDescendants();
+    updateLayerPositionRecursive();
+
+    {
+        // FIXME: Remove incremental compositing updates after fixing the chicken/egg issues
+        // https://code.google.com/p/chromium/issues/detail?id=343756
+        DisableCompositingQueryAsserts disabler;
+        updatePaginationRecursive(enclosingPaginationLayer());
+    }
+}
+
+void PaintLayer::updateLayerPositionRecursive()
+{
+    updateLayerPosition();
+
+    if (m_reflectionInfo)
+        m_reflectionInfo->reflection()->layout();
+
+    // FIXME(400589): We would like to do this in PaintLayerScrollableArea::updateAfterLayout,
+    // but it depends on the size computed by updateLayerPosition.
+    if (m_scrollableArea) {
+        if (ScrollAnimator* scrollAnimator = m_scrollableArea->existingScrollAnimator())
+            scrollAnimator->updateAfterLayout();
+    }
+
+    // FIXME: We should be able to remove this call because we don't care about
+    // any descendant-dependent flags, but code somewhere else is reading these
+    // flags and depending on us to update them.
+    updateDescendantDependentFlags();
+
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
+        child->updateLayerPositionRecursive();
+}
+
+void PaintLayer::updateHasSelfPaintingLayerDescendant() const
+{
+    ASSERT(m_hasSelfPaintingLayerDescendantDirty);
+
+    m_hasSelfPaintingLayerDescendant = false;
+
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) {
+        if (child->isSelfPaintingLayer() || child->hasSelfPaintingLayerDescendant()) {
+            m_hasSelfPaintingLayerDescendant = true;
+            break;
+        }
+    }
+
+    m_hasSelfPaintingLayerDescendantDirty = false;
+}
+
+void PaintLayer::dirtyAncestorChainHasSelfPaintingLayerDescendantStatus()
+{
+    for (PaintLayer* layer = this; layer; layer = layer->parent()) {
+        layer->m_hasSelfPaintingLayerDescendantDirty = true;
+        // If we have reached a self-painting layer, we know our parent should have a self-painting descendant
+        // in this case, there is no need to dirty our ancestors further.
+        if (layer->isSelfPaintingLayer()) {
+            ASSERT(!parent() || parent()->m_hasSelfPaintingLayerDescendantDirty || parent()->m_hasSelfPaintingLayerDescendant);
+            break;
+        }
+    }
+}
+
+bool PaintLayer::scrollsWithViewport() const
+{
+    return layoutObject()->style()->position() == FixedPosition && layoutObject()->containerForFixedPosition() == layoutObject()->view();
+}
+
+bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const
+{
+    if (scrollsWithViewport() != other->scrollsWithViewport())
+        return true;
+    return ancestorScrollingLayer() != other->ancestorScrollingLayer();
+}
+
+void PaintLayer::updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta)
+{
+    m_clipper.clearClipRectsIncludingDescendants();
+    updateLayerPositionsAfterScrollRecursive(scrollDelta, isPaintInvalidationContainer());
+}
+
+void PaintLayer::updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled)
+{
+    updateLayerPosition();
+    if (paintInvalidationContainerWasScrolled && !isPaintInvalidationContainer()) {
+        // Paint invalidation rects are in the coordinate space of the paint invalidation container.
+        // If it has scrolled, the rect must be adjusted. Note that it is not safe to reset it to
+        // the current bounds rect, as the LayoutObject may have moved since the last invalidation.
+        // FIXME(416535): Ideally, pending invalidations of scrolling content should be stored in
+        // the coordinate space of the scrolling content layer, so that they need no adjustment.
+        m_layoutObject->adjustPreviousPaintInvalidationForScrollIfNeeded(scrollDelta);
+    }
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) {
+        child->updateLayerPositionsAfterScrollRecursive(scrollDelta,
+            paintInvalidationContainerWasScrolled && !child->isPaintInvalidationContainer());
+    }
+}
+
+void PaintLayer::updateTransformationMatrix()
+{
+    if (m_transform) {
+        LayoutBox* box = layoutBox();
+        ASSERT(box);
+        m_transform->makeIdentity();
+        box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedSize()), ComputedStyle::IncludeTransformOrigin, ComputedStyle::IncludeMotionPath, ComputedStyle::IncludeIndependentTransformProperties);
+        makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositing());
+    }
+}
+
+void PaintLayer::updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& newStyle)
+{
+    if (oldStyle && newStyle.transformDataEquivalent(*oldStyle))
+        return;
+
+    // hasTransform() on the layoutObject is also true when there is transform-style: preserve-3d or perspective set,
+    // so check style too.
+    bool hasTransform = layoutObject()->hasTransformRelatedProperty() && newStyle.hasTransform();
+    bool had3DTransform = has3DTransform();
+
+    bool hadTransform = m_transform;
+    if (hasTransform != hadTransform) {
+        if (hasTransform)
+            m_transform = adoptPtr(new TransformationMatrix);
+        else
+            m_transform.clear();
+
+        // PaintLayers with transforms act as clip rects roots, so clear the cached clip rects here.
+        m_clipper.clearClipRectsIncludingDescendants();
+    } else if (hasTransform) {
+        m_clipper.clearClipRectsIncludingDescendants(AbsoluteClipRects);
+    }
+
+    updateTransformationMatrix();
+
+    if (had3DTransform != has3DTransform())
+        dirty3DTransformedDescendantStatus();
+}
+
+static PaintLayer* enclosingLayerForContainingBlock(PaintLayer* layer)
+{
+    if (LayoutObject* containingBlock = layer->layoutObject()->containingBlock())
+        return containingBlock->enclosingLayer();
+    return 0;
+}
+
+PaintLayer* PaintLayer::renderingContextRoot()
+{
+    PaintLayer* renderingContext = 0;
+
+    if (shouldPreserve3D())
+        renderingContext = this;
+
+    for (PaintLayer* current = enclosingLayerForContainingBlock(this); current && current->shouldPreserve3D(); current = enclosingLayerForContainingBlock(current))
+        renderingContext = current;
+
+    return renderingContext;
+}
+
+TransformationMatrix PaintLayer::currentTransform() const
+{
+    if (!m_transform)
+        return TransformationMatrix();
+    return *m_transform;
+}
+
+TransformationMatrix PaintLayer::renderableTransform(GlobalPaintFlags globalPaintFlags) const
+{
+    if (!m_transform)
+        return TransformationMatrix();
+
+    if (globalPaintFlags & GlobalPaintFlattenCompositingLayers) {
+        TransformationMatrix matrix = *m_transform;
+        makeMatrixRenderable(matrix, false /* flatten 3d */);
+        return matrix;
+    }
+
+    return *m_transform;
+}
+
+// Convert a bounding box from flow thread coordinates, relative to |layer|, to visual coordinates, relative to |ancestorLayer|.
+// See http://www.chromium.org/developers/design-documents/multi-column-layout for more info on these coordinate types.
+static void convertFromFlowThreadToVisualBoundingBoxInAncestor(const PaintLayer* layer, const PaintLayer* ancestorLayer, LayoutRect& rect)
+{
+    PaintLayer* paginationLayer = layer->enclosingPaginationLayer();
+    ASSERT(paginationLayer);
+    LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->layoutObject());
+
+    // First make the flow thread rectangle relative to the flow thread, not to |layer|.
+    LayoutPoint offsetWithinPaginationLayer;
+    layer->convertToLayerCoords(paginationLayer, offsetWithinPaginationLayer);
+    rect.moveBy(offsetWithinPaginationLayer);
+
+    // Then make the rectangle visual, relative to the fragmentation context. Split our box up into
+    // the actual fragment boxes that layout in the columns/pages and unite those together to get
+    // our true bounding box.
+    rect = flowThread->fragmentsBoundingBox(rect);
+
+    // Finally, make the visual rectangle relative to |ancestorLayer|.
+    if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) {
+        rect.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer));
+        return;
+    }
+    // The ancestor layer is inside the same pagination layer as |layer|, so we need to subtract
+    // the visual distance from the ancestor layer to the pagination layer.
+    rect.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer));
+}
+
+void PaintLayer::updatePaginationRecursive(bool needsPaginationUpdate)
+{
+    m_enclosingPaginationLayer = 0;
+
+    if (layoutObject()->isLayoutFlowThread())
+        needsPaginationUpdate = true;
+
+    if (needsPaginationUpdate) {
+        // Each paginated layer has to paint on its own. There is no recurring into child layers. Each
+        // layer has to be checked individually and genuinely know if it is going to have to split
+        // itself up when painting only its contents (and not any other descendant layers). We track an
+        // enclosingPaginationLayer instead of using a simple bit, since we want to be able to get back
+        // to that layer easily.
+        if (LayoutFlowThread* containingFlowThread = layoutObject()->flowThreadContainingBlock())
+            m_enclosingPaginationLayer = containingFlowThread->layer();
+    }
+
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
+        child->updatePaginationRecursive(needsPaginationUpdate);
+}
+
+void PaintLayer::clearPaginationRecursive()
+{
+    m_enclosingPaginationLayer = 0;
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
+        child->clearPaginationRecursive();
+}
+
+LayoutPoint PaintLayer::positionFromPaintInvalidationBacking(const LayoutObject* layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState)
+{
+    FloatPoint point = layoutObject->localToContainerPoint(FloatPoint(), paintInvalidationContainer, 0, 0, paintInvalidationState);
+
+    // FIXME: Eventually we are going to unify coordinates in GraphicsLayer space.
+    if (paintInvalidationContainer && paintInvalidationContainer->layer()->groupedMapping())
+        mapPointToPaintBackingCoordinates(paintInvalidationContainer, point);
+
+    return LayoutPoint(point);
+}
+
+void PaintLayer::mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* paintInvalidationContainer, FloatPoint& point)
+{
+    PaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer();
+    if (!paintInvalidationLayer->groupedMapping()) {
+        point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffsetInCompositingLayer());
+        return;
+    }
+
+    LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosingTransformedAncestor()->layoutObject();
+    if (!transformedAncestor)
+        return;
+
+    // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the
+    // transformed ancestor.
+    point = paintInvalidationContainer->localToContainerPoint(point, transformedAncestor);
+
+    point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTransformedAncestor());
+}
+
+void PaintLayer::mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect)
+{
+    PaintLayer* paintInvalidationLayer = paintInvalidationContainer->layer();
+    if (!paintInvalidationLayer->groupedMapping()) {
+        rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffsetInCompositingLayer());
+        return;
+    }
+
+    LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosingTransformedAncestor()->layoutObject();
+    if (!transformedAncestor)
+        return;
+
+    // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the
+    // transformed ancestor.
+    rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect(rect), transformedAncestor).boundingBox());
+
+    rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTransformedAncestor());
+}
+
+void PaintLayer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState)
+{
+    if (!paintInvalidationContainer->layer()->groupedMapping()) {
+        layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paintInvalidationState);
+        return;
+    }
+
+    // This code adjusts the paint invalidation rectangle to be in the space of the transformed ancestor of the grouped (i.e. squashed)
+    // layer. This is because all layers that squash together need to issue paint invalidations w.r.t. a single container that is
+    // an ancestor of all of them, in order to properly take into account any local transforms etc.
+    // FIXME: remove this special-case code that works around the paint invalidation code structure.
+    layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContainer, rect, paintInvalidationState);
+
+    mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect);
+}
+
+LayoutRect PaintLayer::computePaintInvalidationRect(const LayoutObject* layoutObject, const PaintLayer* paintInvalidationContainer, const PaintInvalidationState* paintInvalidationState)
+{
+    if (!paintInvalidationContainer->groupedMapping())
+        return layoutObject->computePaintInvalidationRect(paintInvalidationContainer->layoutObject(), paintInvalidationState);
+
+    LayoutRect rect = layoutObject->clippedOverflowRectForPaintInvalidation(paintInvalidationContainer->layoutObject(), paintInvalidationState);
+    mapRectToPaintBackingCoordinates(paintInvalidationContainer->layoutObject(), rect);
+    return rect;
+}
+
+void PaintLayer::dirtyVisibleContentStatus()
+{
+    compositor()->setNeedsUpdateDescendantDependentFlags();
+    m_visibleContentStatusDirty = true;
+    if (parent())
+        parent()->dirtyAncestorChainVisibleDescendantStatus();
+    // Non-self-painting layers paint into their ancestor layer, and count as part of the "visible contents" of the parent, so we need to dirty it.
+    if (!isSelfPaintingLayer())
+        parent()->dirtyVisibleContentStatus();
+}
+
+void PaintLayer::potentiallyDirtyVisibleContentStatus(EVisibility visibility)
+{
+    if (m_visibleContentStatusDirty)
+        return;
+    if (hasVisibleContent() == (visibility == VISIBLE))
+        return;
+    dirtyVisibleContentStatus();
+}
+
+void PaintLayer::dirtyAncestorChainVisibleDescendantStatus()
+{
+    compositor()->setNeedsUpdateDescendantDependentFlags();
+
+    for (PaintLayer* layer = this; layer; layer = layer->parent()) {
+        if (layer->m_visibleDescendantStatusDirty)
+            break;
+        layer->m_visibleDescendantStatusDirty = true;
+    }
+}
+
+// FIXME: this is quite brute-force. We could be more efficient if we were to
+// track state and update it as appropriate as changes are made in the layout tree.
+void PaintLayer::updateScrollingStateAfterCompositingChange()
+{
+    TRACE_EVENT0("blink", "PaintLayer::updateScrollingStateAfterCompositingChange");
+    m_hasVisibleNonLayerContent = false;
+    for (LayoutObject* r = layoutObject()->slowFirstChild(); r; r = r->nextSibling()) {
+        if (!r->hasLayer()) {
+            m_hasVisibleNonLayerContent = true;
+            break;
+        }
+    }
+
+    m_hasNonCompositedChild = false;
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) {
+        if (child->compositingState() == NotComposited) {
+            m_hasNonCompositedChild = true;
+            return;
+        }
+    }
+}
+
+void PaintLayer::updateDescendantDependentFlags()
+{
+    if (m_visibleDescendantStatusDirty) {
+        m_hasVisibleDescendant = false;
+
+        for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) {
+            child->updateDescendantDependentFlags();
+
+            if (child->m_hasVisibleContent || child->m_hasVisibleDescendant) {
+                m_hasVisibleDescendant = true;
+                break;
+            }
+        }
+
+        m_visibleDescendantStatusDirty = false;
+    }
+
+    if (m_visibleContentStatusDirty) {
+        bool previouslyHasVisibleContent = m_hasVisibleContent;
+        if (layoutObject()->style()->visibility() == VISIBLE) {
+            m_hasVisibleContent = true;
+        } else {
+            // layer may be hidden but still have some visible content, check for this
+            m_hasVisibleContent = false;
+            LayoutObject* r = layoutObject()->slowFirstChild();
+            while (r) {
+                if (r->style()->visibility() == VISIBLE && (!r->hasLayer() || !r->enclosingLayer()->isSelfPaintingLayer())) {
+                    m_hasVisibleContent = true;
+                    break;
+                }
+                LayoutObject* layoutObjectFirstChild = r->slowFirstChild();
+                if (layoutObjectFirstChild && (!r->hasLayer() || !r->enclosingLayer()->isSelfPaintingLayer())) {
+                    r = layoutObjectFirstChild;
+                } else if (r->nextSibling()) {
+                    r = r->nextSibling();
+                } else {
+                    do {
+                        r = r->parent();
+                        if (r == layoutObject())
+                            r = 0;
+                    } while (r && !r->nextSibling());
+                    if (r)
+                        r = r->nextSibling();
+                }
+            }
+        }
+        m_visibleContentStatusDirty = false;
+
+        if (hasVisibleContent() != previouslyHasVisibleContent) {
+            setNeedsCompositingInputsUpdate();
+            // We need to tell m_layoutObject to recheck its rect because we
+            // pretend that invisible LayoutObjects have 0x0 rects. Changing
+            // visibility therefore changes our rect and we need to visit
+            // this LayoutObject during the invalidateTreeIfNeeded walk.
+            m_layoutObject->setMayNeedPaintInvalidation();
+        }
+    }
+}
+
+void PaintLayer::dirty3DTransformedDescendantStatus()
+{
+    PaintLayerStackingNode* stackingNode = m_stackingNode->ancestorStackingContextNode();
+    if (!stackingNode)
+        return;
+
+    stackingNode->layer()->m_3DTransformedDescendantStatusDirty = true;
+
+    // This propagates up through preserve-3d hierarchies to the enclosing flattening layer.
+    // Note that preserves3D() creates stacking context, so we can just run up the stacking containers.
+    while (stackingNode && stackingNode->layer()->preserves3D()) {
+        stackingNode->layer()->m_3DTransformedDescendantStatusDirty = true;
+        stackingNode = stackingNode->ancestorStackingContextNode();
+    }
+}
+
+// Return true if this layer or any preserve-3d descendants have 3d.
+bool PaintLayer::update3DTransformedDescendantStatus()
+{
+    if (m_3DTransformedDescendantStatusDirty) {
+        m_has3DTransformedDescendant = false;
+
+        m_stackingNode->updateZOrderLists();
+
+        // Transformed or preserve-3d descendants can only be in the z-order lists, not
+        // in the normal flow list, so we only need to check those.
+        PaintLayerStackingNodeIterator iterator(*m_stackingNode.get(), PositiveZOrderChildren | NegativeZOrderChildren);
+        while (PaintLayerStackingNode* node = iterator.next())
+            m_has3DTransformedDescendant |= node->layer()->update3DTransformedDescendantStatus();
+
+        m_3DTransformedDescendantStatusDirty = false;
+    }
+
+    // If we live in a 3d hierarchy, then the layer at the root of that hierarchy needs
+    // the m_has3DTransformedDescendant set.
+    if (preserves3D())
+        return has3DTransform() || m_has3DTransformedDescendant;
+
+    return has3DTransform();
+}
+
+bool PaintLayer::updateLayerPosition()
+{
+    LayoutPoint localPoint;
+    LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y for inlines, so we need to subtract it out when done.
+
+    if (layoutObject()->isInline() && layoutObject()->isLayoutInline()) {
+        LayoutInline* inlineFlow = toLayoutInline(layoutObject());
+        IntRect lineBox = inlineFlow->linesBoundingBox();
+        m_size = lineBox.size();
+        inlineBoundingBoxOffset = lineBox.location();
+        localPoint.moveBy(inlineBoundingBoxOffset);
+    } else if (LayoutBox* box = layoutBox()) {
+        m_size = pixelSnappedIntSize(box->size(), box->location());
+        localPoint.moveBy(box->topLeftLocation());
+    }
+
+    if (!layoutObject()->isOutOfFlowPositioned() && !layoutObject()->isColumnSpanAll() && layoutObject()->parent()) {
+        // We must adjust our position by walking up the layout tree looking for the
+        // nearest enclosing object with a layer.
+        LayoutObject* curr = layoutObject()->parent();
+        while (curr && !curr->hasLayer()) {
+            if (curr->isBox() && !curr->isTableRow()) {
+                // Rows and cells share the same coordinate space (that of the section).
+                // Omit them when computing our xpos/ypos.
+                localPoint.moveBy(toLayoutBox(curr)->topLeftLocation());
+            }
+            curr = curr->parent();
+        }
+        if (curr->isBox() && curr->isTableRow()) {
+            // Put ourselves into the row coordinate space.
+            localPoint.moveBy(-toLayoutBox(curr)->topLeftLocation());
+        }
+    }
+
+    // Subtract our parent's scroll offset.
+    if (PaintLayer* positionedParent = layoutObject()->isOutOfFlowPositioned() ? enclosingPositionedAncestor() : nullptr) {
+        // For positioned layers, we subtract out the enclosing positioned layer's scroll offset.
+        if (positionedParent->layoutObject()->hasOverflowClip()) {
+            IntSize offset = positionedParent->layoutBox()->scrolledContentOffset();
+            localPoint -= offset;
+        }
+
+        if (positionedParent->layoutObject()->isInFlowPositioned() && positionedParent->layoutObject()->isLayoutInline()) {
+            LayoutSize offset = toLayoutInline(positionedParent->layoutObject())->offsetForInFlowPositionedInline(*toLayoutBox(layoutObject()));
+            localPoint += offset;
+        }
+    } else if (parent() && parent()->layoutObject()->hasOverflowClip()) {
+        IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset();
+        localPoint -= scrollOffset;
+    }
+
+    bool positionOrOffsetChanged = false;
+    if (layoutObject()->isInFlowPositioned()) {
+        LayoutSize newOffset = layoutObject()->offsetForInFlowPosition();
+        positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition;
+        m_offsetForInFlowPosition = newOffset;
+        localPoint.move(m_offsetForInFlowPosition);
+    } else {
+        m_offsetForInFlowPosition = LayoutSize();
+    }
+
+    // FIXME: We'd really like to just get rid of the concept of a layer rectangle and rely on the layoutObjects.
+    localPoint.moveBy(-inlineBoundingBoxOffset);
+
+    if (m_location != localPoint) {
+        positionOrOffsetChanged = true;
+        setNeedsRepaint();
+    }
+    m_location = localPoint;
+
+#if ENABLE(ASSERT)
+    m_needsPositionUpdate = false;
+#endif
+    return positionOrOffsetChanged;
+}
+
+TransformationMatrix PaintLayer::perspectiveTransform() const
+{
+    if (!layoutObject()->hasTransformRelatedProperty())
+        return TransformationMatrix();
+
+    const ComputedStyle& style = layoutObject()->styleRef();
+    if (!style.hasPerspective())
+        return TransformationMatrix();
+
+    TransformationMatrix t;
+    t.applyPerspective(style.perspective());
+    return t;
+}
+
+FloatPoint PaintLayer::perspectiveOrigin() const
+{
+    if (!layoutObject()->hasTransformRelatedProperty())
+        return FloatPoint();
+
+    const LayoutRect borderBox = toLayoutBox(layoutObject())->borderBoxRect();
+    const ComputedStyle& style = layoutObject()->styleRef();
+
+    return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox.width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.height().toFloat()));
+}
+
+static inline bool isFixedPositionedContainer(PaintLayer* layer)
+{
+    return layer->isRootLayer() || layer->hasTransformRelatedProperty();
+}
+
+PaintLayer* PaintLayer::enclosingPositionedAncestor(const PaintLayer* ancestor, bool* skippedAncestor) const
+{
+    ASSERT(!ancestor || skippedAncestor); // If we have specified an ancestor, surely the caller needs to know whether we skipped it.
+    if (skippedAncestor)
+        *skippedAncestor = false;
+    if (layoutObject()->style()->position() == FixedPosition) {
+        PaintLayer* curr = parent();
+        while (curr && !isFixedPositionedContainer(curr)) {
+            if (skippedAncestor && curr == ancestor)
+                *skippedAncestor = true;
+            curr = curr->parent();
+        }
+
+        return curr;
+    }
+
+    PaintLayer* curr = parent();
+    while (curr && !curr->isPositionedContainer()) {
+        if (skippedAncestor && curr == ancestor)
+            *skippedAncestor = true;
+        curr = curr->parent();
+    }
+
+    return curr;
+}
+
+PaintLayer* PaintLayer::enclosingTransformedAncestor() const
+{
+    PaintLayer* curr = parent();
+    while (curr && !curr->isRootLayer() && !curr->layoutObject()->hasTransformRelatedProperty())
+        curr = curr->parent();
+
+    return curr;
+}
+
+LayoutPoint PaintLayer::computeOffsetFromTransformedAncestor() const
+{
+    const AncestorDependentCompositingInputs& properties = ancestorDependentCompositingInputs();
+
+    TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint());
+    // FIXME: add a test that checks flipped writing mode and ApplyContainerFlip are correct.
+    layoutObject()->mapLocalToContainer(properties.transformAncestor ? properties.transformAncestor->layoutObject() : 0, transformState, ApplyContainerFlip);
+    transformState.flatten();
+    return LayoutPoint(transformState.lastPlanarPoint());
+}
+
+PaintLayer* PaintLayer::compositingContainer() const
+{
+    if (!stackingNode()->isTreatedAsOrStackingContext())
+        return parent();
+    if (PaintLayerStackingNode* ancestorStackingNode = stackingNode()->ancestorStackingContextNode())
+        return ancestorStackingNode->layer();
+    return nullptr;
+}
+
+bool PaintLayer::isPaintInvalidationContainer() const
+{
+    return compositingState() == PaintsIntoOwnBacking || compositingState() == PaintsIntoGroupedBacking;
+}
+
+// Note: enclosingCompositingLayer does not include squashed layers. Compositing stacking children of squashed layers
+// receive graphics layers that are parented to the compositing ancestor of the squashed layer.
+PaintLayer* PaintLayer::enclosingLayerWithCompositedLayerMapping(IncludeSelfOrNot includeSelf) const
+{
+    ASSERT(isAllowedToQueryCompositingState());
+
+    if ((includeSelf == IncludeSelf) && compositingState() != NotComposited && compositingState() != PaintsIntoGroupedBacking)
+        return const_cast<PaintLayer*>(this);
+
+    for (PaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) {
+        if (curr->compositingState() != NotComposited && curr->compositingState() != PaintsIntoGroupedBacking)
+            return curr;
+    }
+
+    return nullptr;
+}
+
+// Return the enclosingCompositedLayerForPaintInvalidation for the given Layer
+// including crossing frame boundaries.
+PaintLayer* PaintLayer::enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const
+{
+    const PaintLayer* layer = this;
+    PaintLayer* compositedLayer = 0;
+    while (!compositedLayer) {
+        compositedLayer = layer->enclosingLayerForPaintInvalidation();
+        if (!compositedLayer) {
+            LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObject();
+            if (!owner)
+                break;
+            layer = owner->enclosingLayer();
+        }
+    }
+    return compositedLayer;
+}
+
+PaintLayer* PaintLayer::enclosingLayerForPaintInvalidation() const
+{
+    ASSERT(isAllowedToQueryCompositingState());
+
+    if (isPaintInvalidationContainer())
+        return const_cast<PaintLayer*>(this);
+
+    for (PaintLayer* curr = compositingContainer(); curr; curr = curr->compositingContainer()) {
+        if (curr->isPaintInvalidationContainer())
+            return curr;
+    }
+
+    return nullptr;
+}
+
+void PaintLayer::setNeedsCompositingInputsUpdate()
+{
+    m_needsAncestorDependentCompositingInputsUpdate = true;
+    m_needsDescendantDependentCompositingInputsUpdate = true;
+
+    for (PaintLayer* current = this; current && !current->m_childNeedsCompositingInputsUpdate; current = current->parent())
+        current->m_childNeedsCompositingInputsUpdate = true;
+
+    compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterCompositingInputChange);
+}
+
+void PaintLayer::updateAncestorDependentCompositingInputs(const AncestorDependentCompositingInputs& compositingInputs)
+{
+    m_ancestorDependentCompositingInputs = compositingInputs;
+    m_needsAncestorDependentCompositingInputsUpdate = false;
+}
+
+void PaintLayer::updateDescendantDependentCompositingInputs(const DescendantDependentCompositingInputs& compositingInputs)
+{
+    m_descendantDependentCompositingInputs = compositingInputs;
+    m_needsDescendantDependentCompositingInputsUpdate = false;
+}
+
+void PaintLayer::didUpdateCompositingInputs()
+{
+    ASSERT(!needsCompositingInputsUpdate());
+    m_childNeedsCompositingInputsUpdate = false;
+    if (m_scrollableArea)
+        m_scrollableArea->updateNeedsCompositedScrolling();
+}
+
+bool PaintLayer::hasNonIsolatedDescendantWithBlendMode() const
+{
+    if (descendantDependentCompositingInputs().hasNonIsolatedDescendantWithBlendMode)
+        return true;
+    if (layoutObject()->isSVGRoot())
+        return toLayoutSVGRoot(layoutObject())->hasNonIsolatedBlendingDescendants();
+    return false;
+}
+
+void PaintLayer::setCompositingReasons(CompositingReasons reasons, CompositingReasons mask)
+{
+    if ((compositingReasons() & mask) == (reasons & mask))
+        return;
+    m_compositingReasons = (reasons & mask) | (compositingReasons() & ~mask);
+}
+
+void PaintLayer::setHasCompositingDescendant(bool hasCompositingDescendant)
+{
+    if (m_hasCompositingDescendant == static_cast<unsigned>(hasCompositingDescendant))
+        return;
+
+    m_hasCompositingDescendant = hasCompositingDescendant;
+
+    if (hasCompositedLayerMapping())
+        compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLocal);
+}
+
+void PaintLayer::setShouldIsolateCompositedDescendants(bool shouldIsolateCompositedDescendants)
+{
+    if (m_shouldIsolateCompositedDescendants == static_cast<unsigned>(shouldIsolateCompositedDescendants))
+        return;
+
+    m_shouldIsolateCompositedDescendants = shouldIsolateCompositedDescendants;
+
+    if (hasCompositedLayerMapping())
+        compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLocal);
+}
+
+bool PaintLayer::hasAncestorWithFilterOutsets() const
+{
+    for (const PaintLayer* curr = this; curr; curr = curr->parent()) {
+        LayoutBoxModelObject* layoutObject = curr->layoutObject();
+        if (layoutObject->style()->hasFilterOutsets())
+            return true;
+    }
+    return false;
+}
+
+static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, const PaintLayer* layer, const PaintLayer* rootLayer,
+    PaintLayer::TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& subPixelAccumulation, GlobalPaintFlags globalPaintFlags)
+{
+    // If we have a mask, then the clip is limited to the border box area (and there is
+    // no need to examine child layers).
+    if (!layer->layoutObject()->hasMask()) {
+        // Note: we don't have to walk z-order lists since transparent elements always establish
+        // a stacking container. This means we can just walk the layer tree directly.
+        for (PaintLayer* curr = layer->firstChild(); curr; curr = curr->nextSibling()) {
+            if (!layer->reflectionInfo() || layer->reflectionInfo()->reflectionLayer() != curr)
+                clipRect.unite(PaintLayer::transparencyClipBox(curr, rootLayer, transparencyBehavior, PaintLayer::DescendantsOfTransparencyClipBox, subPixelAccumulation, globalPaintFlags));
+        }
+    }
+
+    // If we have a reflection, then we need to account for that when we push the clip.  Reflect our entire
+    // current transparencyClipBox to catch all child layers.
+    // FIXME: Accelerated compositing will eventually want to do something smart here to avoid incorporating this
+    // size into the parent layer.
+    if (layer->layoutObject()->hasReflection()) {
+        LayoutPoint delta;
+        layer->convertToLayerCoords(rootLayer, delta);
+        clipRect.move(-delta.x(), -delta.y());
+        clipRect.unite(layer->layoutBox()->reflectedRect(clipRect));
+        clipRect.moveBy(delta);
+    }
+}
+
+LayoutRect PaintLayer::transparencyClipBox(const PaintLayer* layer, const PaintLayer* rootLayer, TransparencyClipBoxBehavior transparencyBehavior,
+    TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumulation, GlobalPaintFlags globalPaintFlags)
+{
+    // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the
+    // paintDirtyRect, and that should cut down on the amount we have to paint.  Still it
+    // would be better to respect clips.
+
+    if (rootLayer != layer && ((transparencyBehavior == PaintingTransparencyClipBox && layer->paintsWithTransform(globalPaintFlags))
+        || (transparencyBehavior == HitTestingTransparencyClipBox && layer->hasTransformRelatedProperty()))) {
+        // The best we can do here is to use enclosed bounding boxes to establish a "fuzzy" enough clip to encompass
+        // the transformed layer and all of its children.
+        const PaintLayer* paginationLayer = transparencyMode == DescendantsOfTransparencyClipBox ? layer->enclosingPaginationLayer() : 0;
+        const PaintLayer* rootLayerForTransform = paginationLayer ? paginationLayer : rootLayer;
+        LayoutPoint delta;
+        layer->convertToLayerCoords(rootLayerForTransform, delta);
+
+        delta.move(subPixelAccumulation);
+        IntPoint pixelSnappedDelta = roundedIntPoint(delta);
+        TransformationMatrix transform;
+        transform.translate(pixelSnappedDelta.x(), pixelSnappedDelta.y());
+        if (layer->transform())
+            transform = transform * *layer->transform();
+
+        // We don't use fragment boxes when collecting a transformed layer's bounding box, since it always
+        // paints unfragmented.
+        LayoutRect clipRect = layer->physicalBoundingBox(layer);
+        expandClipRectForDescendantsAndReflection(clipRect, layer, layer, transparencyBehavior, subPixelAccumulation, globalPaintFlags);
+        clipRect.expand(layer->layoutObject()->style()->filterOutsets());
+        LayoutRect result = transform.mapRect(clipRect);
+        if (!paginationLayer)
+            return result;
+
+        // We have to break up the transformed extent across our columns.
+        // Split our box up into the actual fragment boxes that layout in the columns/pages and unite those together to
+        // get our true bounding box.
+        LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(paginationLayer->layoutObject());
+        result = enclosingFlowThread->fragmentsBoundingBox(result);
+
+        LayoutPoint rootLayerDelta;
+        paginationLayer->convertToLayerCoords(rootLayer, rootLayerDelta);
+        result.moveBy(rootLayerDelta);
+        return result;
+    }
+
+    LayoutRect clipRect = layer->fragmentsBoundingBox(rootLayer);
+    expandClipRectForDescendantsAndReflection(clipRect, layer, rootLayer, transparencyBehavior, subPixelAccumulation, globalPaintFlags);
+    clipRect.expand(layer->layoutObject()->style()->filterOutsets());
+    clipRect.move(subPixelAccumulation);
+    return clipRect;
+}
+
+LayoutRect PaintLayer::paintingExtent(const PaintLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, GlobalPaintFlags globalPaintFlags)
+{
+    return intersection(transparencyClipBox(this, rootLayer, PaintingTransparencyClipBox, RootOfTransparencyClipBox, subPixelAccumulation, globalPaintFlags), paintDirtyRect);
+}
+
+void* PaintLayer::operator new(size_t sz)
+{
+    return partitionAlloc(WTF::Partitions::layoutPartition(), sz);
+}
+
+void PaintLayer::operator delete(void* ptr)
+{
+    partitionFree(ptr);
+}
+
+void PaintLayer::addChild(PaintLayer* child, PaintLayer* beforeChild)
+{
+    PaintLayer* prevSibling = beforeChild ? beforeChild->previousSibling() : lastChild();
+    if (prevSibling) {
+        child->setPreviousSibling(prevSibling);
+        prevSibling->setNextSibling(child);
+        ASSERT(prevSibling != child);
+    } else {
+        setFirstChild(child);
+    }
+
+    if (beforeChild) {
+        beforeChild->setPreviousSibling(child);
+        child->setNextSibling(beforeChild);
+        ASSERT(beforeChild != child);
+    } else {
+        setLastChild(child);
+    }
+
+    child->m_parent = this;
+
+    setNeedsCompositingInputsUpdate();
+
+    if (!child->stackingNode()->isTreatedAsOrStackingContext() && !layoutObject()->documentBeingDestroyed())
+        compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
+
+    if (child->stackingNode()->isTreatedAsOrStackingContext() || child->firstChild()) {
+        // Dirty the z-order list in which we are contained. The ancestorStackingContextNode() can be null in the
+        // case where we're building up generated content layers. This is ok, since the lists will start
+        // off dirty in that case anyway.
+        child->stackingNode()->dirtyStackingContextZOrderLists();
+    }
+
+    // Non-self-painting children paint into this layer, so the visible contents status of this layer is affected.
+    if (!child->isSelfPaintingLayer())
+        dirtyVisibleContentStatus();
+
+    dirtyAncestorChainVisibleDescendantStatus();
+    dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
+
+    child->setNeedsRepaint();
+
+    child->updateDescendantDependentFlags();
+}
+
+PaintLayer* PaintLayer::removeChild(PaintLayer* oldChild)
+{
+    if (oldChild->previousSibling())
+        oldChild->previousSibling()->setNextSibling(oldChild->nextSibling());
+    if (oldChild->nextSibling())
+        oldChild->nextSibling()->setPreviousSibling(oldChild->previousSibling());
+
+    if (m_first == oldChild)
+        m_first = oldChild->nextSibling();
+    if (m_last == oldChild)
+        m_last = oldChild->previousSibling();
+
+    if (!oldChild->stackingNode()->isTreatedAsOrStackingContext() && !layoutObject()->documentBeingDestroyed())
+        compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
+
+    if (oldChild->stackingNode()->isTreatedAsOrStackingContext() || oldChild->firstChild()) {
+        // Dirty the z-order list in which we are contained.  When called via the
+        // reattachment process in removeOnlyThisLayer, the layer may already be disconnected
+        // from the main layer tree, so we need to null-check the
+        // |stackingContext| value.
+        oldChild->stackingNode()->dirtyStackingContextZOrderLists();
+    }
+
+    if (layoutObject()->style()->visibility() != VISIBLE)
+        dirtyVisibleContentStatus();
+
+    oldChild->setPreviousSibling(0);
+    oldChild->setNextSibling(0);
+    oldChild->m_parent = 0;
+
+    dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
+
+    oldChild->updateDescendantDependentFlags();
+
+    if (oldChild->m_hasVisibleContent || oldChild->m_hasVisibleDescendant)
+        dirtyAncestorChainVisibleDescendantStatus();
+
+    if (oldChild->enclosingPaginationLayer())
+        oldChild->clearPaginationRecursive();
+
+    setNeedsRepaint();
+
+    return oldChild;
+}
+
+void PaintLayer::removeOnlyThisLayer()
+{
+    if (!m_parent)
+        return;
+
+    if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
+        DisableCompositingQueryAsserts disabler; // We need the current compositing status.
+        if (isPaintInvalidationContainer()) {
+            // Our children will be reparented and contained by a new paint invalidation container,
+            // so need paint invalidation. CompositingUpdate can't see this layer (which has been
+            // removed) so won't do this for us.
+            DisablePaintInvalidationStateAsserts disabler;
+            layoutObject()->invalidatePaintIncludingNonCompositingDescendants();
+            layoutObject()->setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
+        }
+    }
+
+    m_clipper.clearClipRectsIncludingDescendants();
+
+    PaintLayer* nextSib = nextSibling();
+
+    // Remove the child reflection layer before moving other child layers.
+    // The reflection layer should not be moved to the parent.
+    if (m_reflectionInfo)
+        removeChild(m_reflectionInfo->reflectionLayer());
+
+    // Now walk our kids and reattach them to our parent.
+    PaintLayer* current = m_first;
+    while (current) {
+        PaintLayer* next = current->nextSibling();
+        removeChild(current);
+        m_parent->addChild(current, nextSib);
+
+        // FIXME: We should call a specialized version of this function.
+        current->updateLayerPositionsAfterLayout();
+        current = next;
+    }
+
+    // Remove us from the parent.
+    m_parent->removeChild(this);
+    m_layoutObject->destroyLayer();
+}
+
+void PaintLayer::insertOnlyThisLayer()
+{
+    if (!m_parent && layoutObject()->parent()) {
+        // We need to connect ourselves when our layoutObject() has a parent.
+        // Find our enclosingLayer and add ourselves.
+        PaintLayer* parentLayer = layoutObject()->parent()->enclosingLayer();
+        ASSERT(parentLayer);
+        PaintLayer* beforeChild = !parentLayer->reflectionInfo() || parentLayer->reflectionInfo()->reflectionLayer() != this ? layoutObject()->parent()->findNextLayer(parentLayer, layoutObject()) : 0;
+        parentLayer->addChild(this, beforeChild);
+    }
+
+    // Remove all descendant layers from the hierarchy and add them to the new position.
+    for (LayoutObject* curr = layoutObject()->slowFirstChild(); curr; curr = curr->nextSibling())
+        curr->moveLayers(m_parent, this);
+
+    // Clear out all the clip rects.
+    m_clipper.clearClipRectsIncludingDescendants();
+}
+
+// Returns the layer reached on the walk up towards the ancestor.
+static inline const PaintLayer* accumulateOffsetTowardsAncestor(const PaintLayer* layer, const PaintLayer* ancestorLayer, LayoutPoint& location)
+{
+    ASSERT(ancestorLayer != layer);
+
+    const LayoutBoxModelObject* layoutObject = layer->layoutObject();
+    EPosition position = layoutObject->style()->position();
+
+    if (position == FixedPosition && (!ancestorLayer || ancestorLayer == layoutObject->view()->layer())) {
+        // If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling
+        // localToAbsolute() on the LayoutView.
+        FloatPoint absPos = layoutObject->localToAbsolute(FloatPoint(), IsFixed);
+        location += LayoutSize(absPos.x(), absPos.y());
+        return ancestorLayer;
+    }
+
+    PaintLayer* parentLayer;
+    if (position == AbsolutePosition || position == FixedPosition) {
+        bool foundAncestorFirst;
+        parentLayer = layer->enclosingPositionedAncestor(ancestorLayer, &foundAncestorFirst);
+
+        if (foundAncestorFirst) {
+            // Found ancestorLayer before the container of the out-of-flow object, so compute offset
+            // of both relative to the container and subtract.
+
+            LayoutPoint thisCoords;
+            layer->convertToLayerCoords(parentLayer, thisCoords);
+
+            LayoutPoint ancestorCoords;
+            ancestorLayer->convertToLayerCoords(parentLayer, ancestorCoords);
+
+            location += (thisCoords - ancestorCoords);
+            return ancestorLayer;
+        }
+    } else if (layoutObject->isColumnSpanAll()) {
+        LayoutBlock* multicolContainer = layoutObject->containingBlock();
+        ASSERT(toLayoutBlockFlow(multicolContainer)->multiColumnFlowThread());
+        parentLayer = multicolContainer->layer();
+        ASSERT(parentLayer);
+    } else {
+        parentLayer = layer->parent();
+    }
+
+    if (!parentLayer)
+        return nullptr;
+
+    location += layer->location();
+    return parentLayer;
+}
+
+void PaintLayer::convertToLayerCoords(const PaintLayer* ancestorLayer, LayoutPoint& location) const
+{
+    if (ancestorLayer == this)
+        return;
+
+    const PaintLayer* currLayer = this;
+    while (currLayer && currLayer != ancestorLayer)
+        currLayer = accumulateOffsetTowardsAncestor(currLayer, ancestorLayer, location);
+}
+
+void PaintLayer::convertToLayerCoords(const PaintLayer* ancestorLayer, LayoutRect& rect) const
+{
+    LayoutPoint delta;
+    convertToLayerCoords(ancestorLayer, delta);
+    rect.moveBy(delta);
+}
+
+LayoutPoint PaintLayer::visualOffsetFromAncestor(const PaintLayer* ancestorLayer) const
+{
+    LayoutPoint offset;
+    if (ancestorLayer == this)
+        return offset;
+    PaintLayer* paginationLayer = enclosingPaginationLayer();
+    if (paginationLayer == this)
+        paginationLayer = parent()->enclosingPaginationLayer();
+    if (!paginationLayer) {
+        convertToLayerCoords(ancestorLayer, offset);
+        return offset;
+    }
+
+    LayoutFlowThread* flowThread = toLayoutFlowThread(paginationLayer->layoutObject());
+    convertToLayerCoords(paginationLayer, offset);
+    offset = flowThread->flowThreadPointToVisualPoint(offset);
+    if (ancestorLayer == paginationLayer)
+        return offset;
+
+    if (ancestorLayer->enclosingPaginationLayer() != paginationLayer) {
+        offset.moveBy(paginationLayer->visualOffsetFromAncestor(ancestorLayer));
+    } else {
+        // The ancestor layer is also inside the pagination layer, so we need to subtract the visual
+        // distance from the ancestor layer to the pagination layer.
+        offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer));
+    }
+    return offset;
+}
+
+void PaintLayer::didUpdateNeedsCompositedScrolling()
+{
+    updateSelfPaintingLayer();
+}
+
+void PaintLayer::updateReflectionInfo(const ComputedStyle* oldStyle)
+{
+    ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle));
+    if (layoutObject()->hasReflection()) {
+        if (!m_reflectionInfo)
+            m_reflectionInfo = adoptPtr(new PaintLayerReflectionInfo(*layoutBox()));
+        m_reflectionInfo->updateAfterStyleChange(oldStyle);
+    } else if (m_reflectionInfo) {
+        m_reflectionInfo->destroy();
+        m_reflectionInfo = nullptr;
+    }
+}
+
+void PaintLayer::updateStackingNode()
+{
+    ASSERT(!m_stackingNode);
+    if (requiresStackingNode())
+        m_stackingNode = adoptPtr(new PaintLayerStackingNode(this));
+    else
+        m_stackingNode = nullptr;
+}
+
+void PaintLayer::updateScrollableArea()
+{
+    ASSERT(!m_scrollableArea);
+    if (requiresScrollableArea())
+        m_scrollableArea = PaintLayerScrollableArea::create(*this);
+}
+
+bool PaintLayer::hasOverflowControls() const
+{
+    return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollableArea->scrollCorner() || layoutObject()->style()->resize() != RESIZE_NONE);
+}
+
+void PaintLayer::appendSingleFragmentIgnoringPagination(PaintLayerFragments& fragments, const PaintLayer* rootLayer, const LayoutRect& dirtyRect, ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot, const LayoutSize& subPixelAccumulation)
+{
+    PaintLayerFragment fragment;
+    ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy, subPixelAccumulation);
+    if (respectOverflowClip == IgnoreOverflowClip)
+        clipRectsContext.setIgnoreOverflowClip();
+    clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, fragment.backgroundRect, fragment.foregroundRect, offsetFromRoot);
+    fragments.append(fragment);
+}
+
+void PaintLayer::collectFragments(PaintLayerFragments& fragments, const PaintLayer* rootLayer, const LayoutRect& dirtyRect,
+    ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const LayoutPoint* offsetFromRoot,
+    const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
+{
+    if (!enclosingPaginationLayer()) {
+        // For unpaginated layers, there is only one fragment.
+        appendSingleFragmentIgnoringPagination(fragments, rootLayer, dirtyRect, clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy, respectOverflowClip, offsetFromRoot, subPixelAccumulation);
+        return;
+    }
+
+    // Compute our offset within the enclosing pagination layer.
+    LayoutPoint offsetWithinPaginatedLayer;
+    convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer);
+
+    // Calculate clip rects relative to the enclosingPaginationLayer. The purpose of this call is to determine our bounds clipped to intermediate
+    // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that.
+    ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy);
+    if (respectOverflowClip == IgnoreOverflowClip)
+        paginationClipRectsContext.setIgnoreOverflowClip();
+    LayoutRect layerBoundsInFlowThread;
+    ClipRect backgroundRectInFlowThread;
+    ClipRect foregroundRectInFlowThread;
+    clipper().calculateRects(paginationClipRectsContext, LayoutRect(LayoutRect::infiniteIntRect()), layerBoundsInFlowThread,
+        backgroundRectInFlowThread, foregroundRectInFlowThread, &offsetWithinPaginatedLayer);
+
+    // Take our bounding box within the flow thread and clip it.
+    LayoutRect layerBoundingBoxInFlowThread = layerBoundingBox ? *layerBoundingBox : physicalBoundingBox(offsetWithinPaginatedLayer);
+    layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect());
+
+    // Make the dirty rect relative to the fragmentation context (multicol container, etc.).
+    LayoutFlowThread* enclosingFlowThread = toLayoutFlowThread(enclosingPaginationLayer()->layoutObject());
+    LayoutPoint offsetOfPaginationLayerFromRoot; // Visual offset from the root layer to the nearest fragmentation context.
+    bool rootLayerIsInsidePaginationLayer = rootLayer->enclosingPaginationLayer() == enclosingPaginationLayer();
+    if (rootLayerIsInsidePaginationLayer) {
+        // The root layer is in the same fragmentation context as this layer, so we need to look
+        // inside it and subtract the offset between the fragmentation context and the root layer.
+        offsetOfPaginationLayerFromRoot = -rootLayer->visualOffsetFromAncestor(enclosingPaginationLayer());
+    } else {
+        offsetOfPaginationLayerFromRoot = enclosingPaginationLayer()->visualOffsetFromAncestor(rootLayer);
+    }
+    LayoutRect dirtyRectInFlowThread(dirtyRect);
+    dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot);
+
+    // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns
+    // that intersect the actual dirtyRect as well as the pages/columns that intersect our layer's bounding box.
+    enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlowThread, dirtyRectInFlowThread);
+
+    if (fragments.isEmpty())
+        return;
+
+    // Get the parent clip rects of the pagination layer, since we need to intersect with that when painting column contents.
+    ClipRect ancestorClipRect = dirtyRect;
+    if (const PaintLayer* paginationParentLayer = enclosingPaginationLayer()->parent()) {
+        const PaintLayer* ancestorLayer = rootLayerIsInsidePaginationLayer ? paginationParentLayer : rootLayer;
+        ClipRectsContext clipRectsContext(ancestorLayer, clipRectsCacheSlot, inOverlayScrollbarSizeRelevancy);
+        if (respectOverflowClip == IgnoreOverflowClip)
+            clipRectsContext.setIgnoreOverflowClip();
+        ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipRect(clipRectsContext);
+        if (rootLayerIsInsidePaginationLayer)
+            ancestorClipRect.moveBy(-rootLayer->visualOffsetFromAncestor(ancestorLayer));
+        ancestorClipRect.intersect(dirtyRect);
+    }
+
+    const LayoutSize subPixelAccumulationIfNeeded = offsetFromRoot ? subPixelAccumulation : LayoutSize();
+    for (size_t i = 0; i < fragments.size(); ++i) {
+        PaintLayerFragment& fragment = fragments.at(i);
+
+        // Set our four rects with all clipping applied that was internal to the flow thread.
+        fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, foregroundRectInFlowThread);
+
+        // Shift to the root-relative physical position used when painting the flow thread in this fragment.
+        fragment.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromRoot + subPixelAccumulationIfNeeded);
+
+        // Intersect the fragment with our ancestor's background clip so that e.g., columns in an overflow:hidden block are
+        // properly clipped by the overflow.
+        fragment.intersect(ancestorClipRect.rect());
+
+        // Now intersect with our pagination clip. This will typically mean we're just intersecting the dirty rect with the column
+        // clip, so the column clip ends up being all we apply.
+        fragment.intersect(fragment.paginationClip);
+    }
+}
+
+static inline LayoutRect frameVisibleRect(LayoutObject* layoutObject)
+{
+    FrameView* frameView = layoutObject->document().view();
+    if (!frameView)
+        return LayoutRect();
+
+    return LayoutRect(frameView->visibleContentRect());
+}
+
+bool PaintLayer::hitTest(HitTestResult& result)
+{
+    ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
+
+    // LayoutView should make sure to update layout before entering hit testing
+    ASSERT(!layoutObject()->frame()->view()->layoutPending());
+    ASSERT(!layoutObject()->document().layoutView()->needsLayout());
+
+    const HitTestRequest& request = result.hitTestRequest();
+    const HitTestLocation& hitTestLocation = result.hitTestLocation();
+
+    // Start with frameVisibleRect to ensure we include the scrollbars.
+    LayoutRect hitTestArea = frameVisibleRect(layoutObject());
+    if (request.ignoreClipping())
+        hitTestArea.unite(LayoutRect(layoutObject()->view()->documentRect()));
+
+    PaintLayer* insideLayer = hitTestLayer(this, 0, result, hitTestArea, hitTestLocation, false);
+    if (!insideLayer && isRootLayer()) {
+        IntRect hitRect = hitTestLocation.boundingBox();
+        bool fallback = false;
+        // If we didn't hit any layers but are still inside the document
+        // bounds, then we should fallback to hitting the document.
+        // For rect-based hit test, we do the fallback only when the hit-rect
+        // is totally within the document bounds.
+        if (hitTestArea.contains(LayoutRect(hitRect))) {
+            fallback = true;
+
+        // Mouse dragging outside the main document should also be
+        // delivered to the document.
+        // TODO(miletus): Capture behavior inconsistent with iframes
+        // crbug.com/522109.
+        // TODO(majidvp): This should apply more consistently across different event types and we
+        // should not use RequestType for it. Perhaps best for it to be done at a higher level. See
+        // http://crbug.com/505825
+        } else if ((request.active() || request.release()) && !request.isChildFrameHitTest()) {
+            fallback = true;
+        }
+        if (fallback) {
+            layoutObject()->updateHitTestResult(result, toLayoutView(layoutObject())->flipForWritingMode(hitTestLocation.point()));
+            insideLayer = this;
+
+            // Don't cache this result since it really wasn't a true hit.
+            result.setCacheable(false);
+        }
+    }
+
+    // Now determine if the result is inside an anchor - if the urlElement isn't already set.
+    Node* node = result.innerNode();
+    if (node && !result.URLElement())
+        result.setURLElement(node->enclosingLinkEventParentOrSelf());
+
+    // Now return whether we were inside this layer (this will always be true for the root
+    // layer).
+    return insideLayer;
+}
+
+Node* PaintLayer::enclosingElement() const
+{
+    for (LayoutObject* r = layoutObject(); r; r = r->parent()) {
+        if (Node* e = r->node())
+            return e;
+    }
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+bool PaintLayer::isInTopLayer() const
+{
+    Node* node = layoutObject()->node();
+    return node && node->isElementNode() && toElement(node)->isInTopLayer();
+}
+
+// Compute the z-offset of the point in the transformState.
+// This is effectively projecting a ray normal to the plane of ancestor, finding where that
+// ray intersects target, and computing the z delta between those two points.
+static double computeZOffset(const HitTestingTransformState& transformState)
+{
+    // We got an affine transform, so no z-offset
+    if (transformState.m_accumulatedTransform.isAffine())
+        return 0;
+
+    // Flatten the point into the target plane
+    FloatPoint targetPoint = transformState.mappedPoint();
+
+    // Now map the point back through the transform, which computes Z.
+    FloatPoint3D backmappedPoint = transformState.m_accumulatedTransform.mapPoint(FloatPoint3D(targetPoint));
+    return backmappedPoint.z();
+}
+
+PassRefPtr<HitTestingTransformState> PaintLayer::createLocalTransformState(PaintLayer* rootLayer, PaintLayer* containerLayer,
+    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation,
+    const HitTestingTransformState* containerTransformState,
+    const LayoutPoint& translationOffset) const
+{
+    RefPtr<HitTestingTransformState> transformState;
+    LayoutPoint offset;
+    if (containerTransformState) {
+        // If we're already computing transform state, then it's relative to the container (which we know is non-null).
+        transformState = HitTestingTransformState::create(*containerTransformState);
+        convertToLayerCoords(containerLayer, offset);
+    } else {
+        // If this is the first time we need to make transform state, then base it off of hitTestLocation,
+        // which is relative to rootLayer.
+        transformState = HitTestingTransformState::create(hitTestLocation.transformedPoint(), hitTestLocation.transformedRect(), FloatQuad(FloatRect(hitTestRect)));
+        convertToLayerCoords(rootLayer, offset);
+    }
+    offset.moveBy(translationOffset);
+
+    LayoutObject* containerLayoutObject = containerLayer ? containerLayer->layoutObject() : 0;
+    if (layoutObject()->shouldUseTransformFromContainer(containerLayoutObject)) {
+        TransformationMatrix containerTransform;
+        layoutObject()->getTransformFromContainer(containerLayoutObject, toLayoutSize(offset), containerTransform);
+        transformState->applyTransform(containerTransform, HitTestingTransformState::AccumulateTransform);
+    } else {
+        transformState->translate(offset.x(), offset.y(), HitTestingTransformState::AccumulateTransform);
+    }
+
+    return transformState;
+}
+
+
+static bool isHitCandidate(const PaintLayer* hitLayer, bool canDepthSort, double* zOffset, const HitTestingTransformState* transformState)
+{
+    if (!hitLayer)
+        return false;
+
+    // The hit layer is depth-sorting with other layers, so just say that it was hit.
+    if (canDepthSort)
+        return true;
+
+    // We need to look at z-depth to decide if this layer was hit.
+    if (zOffset) {
+        ASSERT(transformState);
+        // This is actually computing our z, but that's OK because the hitLayer is coplanar with us.
+        double childZOffset = computeZOffset(*transformState);
+        if (childZOffset > *zOffset) {
+            *zOffset = childZOffset;
+            return true;
+        }
+        return false;
+    }
+
+    return true;
+}
+
+// hitTestLocation and hitTestRect are relative to rootLayer.
+// A 'flattening' layer is one preserves3D() == false.
+// transformState.m_accumulatedTransform holds the transform from the containing flattening layer.
+// transformState.m_lastPlanarPoint is the hitTestLocation in the plane of the containing flattening layer.
+// transformState.m_lastPlanarQuad is the hitTestRect as a quad in the plane of the containing flattening layer.
+//
+// If zOffset is non-null (which indicates that the caller wants z offset information),
+//  *zOffset on return is the z offset of the hit point relative to the containing flattening layer.
+PaintLayer* PaintLayer::hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult& result,
+    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, bool appliedTransform,
+    const HitTestingTransformState* transformState, double* zOffset)
+{
+    ASSERT(layoutObject()->document().lifecycle().state() >= DocumentLifecycle::CompositingClean);
+
+    if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
+        return 0;
+
+    ClipRectsCacheSlot clipRectsCacheSlot = result.hitTestRequest().ignoreClipping() ? RootRelativeClipRectsIgnoringViewportClip : RootRelativeClipRects;
+
+    // Apply a transform if we have one.
+    if (transform() && !appliedTransform) {
+        if (enclosingPaginationLayer())
+            return hitTestTransformedLayerInFragments(rootLayer, containerLayer, result, hitTestRect, hitTestLocation, transformState, zOffset, clipRectsCacheSlot);
+
+        // Make sure the parent's clip rects have been calculated.
+        if (parent()) {
+            ClipRect clipRect = clipper().backgroundClipRect(ClipRectsContext(rootLayer, clipRectsCacheSlot, IncludeOverlayScrollbarSize));
+            // Go ahead and test the enclosing clip now.
+            if (!clipRect.intersects(hitTestLocation))
+                return 0;
+        }
+
+        return hitTestLayerByApplyingTransform(rootLayer, containerLayer, result, hitTestRect, hitTestLocation, transformState, zOffset);
+    }
+
+    // Ensure our lists and 3d status are up-to-date.
+    m_stackingNode->updateLayerListsIfNeeded();
+    update3DTransformedDescendantStatus();
+
+    // The natural thing would be to keep HitTestingTransformState on the stack, but it's big, so we heap-allocate.
+    RefPtr<HitTestingTransformState> localTransformState;
+    if (appliedTransform) {
+        // We computed the correct state in the caller (above code), so just reference it.
+        ASSERT(transformState);
+        localTransformState = const_cast<HitTestingTransformState*>(transformState);
+    } else if (transformState || m_has3DTransformedDescendant || preserves3D()) {
+        // We need transform state for the first time, or to offset the container state, so create it here.
+        localTransformState = createLocalTransformState(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState);
+    }
+
+    // Check for hit test on backface if backface-visibility is 'hidden'
+    if (localTransformState && layoutObject()->style()->backfaceVisibility() == BackfaceVisibilityHidden) {
+        TransformationMatrix invertedMatrix = localTransformState->m_accumulatedTransform.inverse();
+        // If the z-vector of the matrix is negative, the back is facing towards the viewer.
+        if (invertedMatrix.m33() < 0)
+            return 0;
+    }
+
+    RefPtr<HitTestingTransformState> unflattenedTransformState = localTransformState;
+    if (localTransformState && !preserves3D()) {
+        // Keep a copy of the pre-flattening state, for computing z-offsets for the container
+        unflattenedTransformState = HitTestingTransformState::create(*localTransformState);
+        // This layer is flattening, so flatten the state passed to descendants.
+        localTransformState->flatten();
+    }
+
+    // The following are used for keeping track of the z-depth of the hit point of 3d-transformed
+    // descendants.
+    double localZOffset = -std::numeric_limits<double>::infinity();
+    double* zOffsetForDescendantsPtr = 0;
+    double* zOffsetForContentsPtr = 0;
+
+    bool depthSortDescendants = false;
+    if (preserves3D()) {
+        depthSortDescendants = true;
+        // Our layers can depth-test with our container, so share the z depth pointer with the container, if it passed one down.
+        zOffsetForDescendantsPtr = zOffset ? zOffset : &localZOffset;
+        zOffsetForContentsPtr = zOffset ? zOffset : &localZOffset;
+    } else if (zOffset) {
+        zOffsetForDescendantsPtr = 0;
+        // Container needs us to give back a z offset for the hit layer.
+        zOffsetForContentsPtr = zOffset;
+    }
+
+    // This variable tracks which layer the mouse ends up being inside.
+    PaintLayer* candidateLayer = 0;
+
+    // Begin by walking our list of positive layers from highest z-index down to the lowest z-index.
+    PaintLayer* hitLayer = hitTestChildren(PositiveZOrderChildren, rootLayer, result, hitTestRect, hitTestLocation,
+        localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
+    if (hitLayer) {
+        if (!depthSortDescendants)
+            return hitLayer;
+        candidateLayer = hitLayer;
+    }
+
+    // Now check our overflow objects.
+    hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, result, hitTestRect, hitTestLocation,
+        localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
+    if (hitLayer) {
+        if (!depthSortDescendants)
+            return hitLayer;
+        candidateLayer = hitLayer;
+    }
+
+    // Collect the fragments. This will compute the clip rectangles for each layer fragment.
+    PaintLayerFragments layerFragments;
+    if (appliedTransform)
+        appendSingleFragmentIgnoringPagination(layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, IncludeOverlayScrollbarSize);
+    else
+        collectFragments(layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, IncludeOverlayScrollbarSize);
+
+    if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFragments, hitTestLocation)) {
+        layoutObject()->updateHitTestResult(result, hitTestLocation.point());
+        return this;
+    }
+
+    // Next we want to see if the mouse pos is inside the child LayoutObjects of the layer. Check
+    // every fragment in reverse order.
+    if (isSelfPaintingLayer()) {
+        // Hit test with a temporary HitTestResult, because we only want to commit to 'result' if we know we're frontmost.
+        HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation());
+        bool insideFragmentForegroundRect = false;
+        if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocation, HitTestDescendants, insideFragmentForegroundRect)
+            && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) {
+            if (result.hitTestRequest().listBased())
+                result.append(tempResult);
+            else
+                result = tempResult;
+            if (!depthSortDescendants)
+                return this;
+            // Foreground can depth-sort with descendant layers, so keep this as a candidate.
+            candidateLayer = this;
+        } else if (insideFragmentForegroundRect && result.hitTestRequest().listBased()) {
+            result.append(tempResult);
+        }
+    }
+
+    // Now check our negative z-index children.
+    hitLayer = hitTestChildren(NegativeZOrderChildren, rootLayer, result, hitTestRect, hitTestLocation,
+        localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
+    if (hitLayer) {
+        if (!depthSortDescendants)
+            return hitLayer;
+        candidateLayer = hitLayer;
+    }
+
+    // If we found a layer, return. Child layers, and foreground always render in front of background.
+    if (candidateLayer)
+        return candidateLayer;
+
+    if (isSelfPaintingLayer()) {
+        HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation());
+        bool insideFragmentBackgroundRect = false;
+        if (hitTestContentsForFragments(layerFragments, tempResult, hitTestLocation, HitTestSelf, insideFragmentBackgroundRect)
+            && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTransformState.get())) {
+            if (result.isRectBasedTest())
+                result.append(tempResult);
+            else
+                result = tempResult;
+            return this;
+        }
+        if (insideFragmentBackgroundRect && result.hitTestRequest().listBased())
+            result.append(tempResult);
+    }
+
+    return 0;
+}
+
+bool PaintLayer::hitTestContentsForFragments(const PaintLayerFragments& layerFragments, HitTestResult& result,
+    const HitTestLocation& hitTestLocation, HitTestFilter hitTestFilter, bool& insideClipRect) const
+{
+    if (layerFragments.isEmpty())
+        return false;
+
+    for (int i = layerFragments.size() - 1; i >= 0; --i) {
+        const PaintLayerFragment& fragment = layerFragments.at(i);
+        if ((hitTestFilter == HitTestSelf && !fragment.backgroundRect.intersects(hitTestLocation))
+            || (hitTestFilter == HitTestDescendants && !fragment.foregroundRect.intersects(hitTestLocation)))
+            continue;
+        insideClipRect = true;
+        if (hitTestContents(result, fragment.layerBounds, hitTestLocation, hitTestFilter))
+            return true;
+    }
+
+    return false;
+}
+
+PaintLayer* PaintLayer::hitTestTransformedLayerInFragments(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult& result,
+    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset, ClipRectsCacheSlot clipRectsCacheSlot)
+{
+    PaintLayerFragments enclosingPaginationFragments;
+    LayoutPoint offsetOfPaginationLayerFromRoot;
+    // FIXME: We're missing a sub-pixel offset here crbug.com/348728
+    LayoutRect transformedExtent = transparencyClipBox(this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, PaintLayer::RootOfTransparencyClipBox, LayoutSize());
+    enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, rootLayer, hitTestRect,
+        clipRectsCacheSlot, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
+
+    for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
+        const PaintLayerFragment& fragment = enclosingPaginationFragments.at(i);
+
+        // Apply the page/column clip for this fragment, as well as any clips established by layers in between us and
+        // the enclosing pagination layer.
+        LayoutRect clipRect = fragment.backgroundRect.rect();
+
+        // Now compute the clips within a given fragment
+        if (parent() != enclosingPaginationLayer()) {
+            enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPaginationLayerFromRoot);
+            LayoutRect parentClipRect = clipper().backgroundClipRect(ClipRectsContext(enclosingPaginationLayer(), clipRectsCacheSlot, IncludeOverlayScrollbarSize)).rect();
+            parentClipRect.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromRoot);
+            clipRect.intersect(parentClipRect);
+        }
+
+        if (!hitTestLocation.intersects(clipRect))
+            continue;
+
+        PaintLayer* hitLayer = hitTestLayerByApplyingTransform(rootLayer, containerLayer, result, hitTestRect, hitTestLocation,
+            transformState, zOffset, fragment.paginationOffset);
+        if (hitLayer)
+            return hitLayer;
+    }
+
+    return 0;
+}
+
+PaintLayer* PaintLayer::hitTestLayerByApplyingTransform(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult& result,
+    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset,
+    const LayoutPoint& translationOffset)
+{
+    // Create a transform state to accumulate this transform.
+    RefPtr<HitTestingTransformState> newTransformState = createLocalTransformState(rootLayer, containerLayer, hitTestRect, hitTestLocation, transformState, translationOffset);
+
+    // If the transform can't be inverted, then don't hit test this layer at all.
+    if (!newTransformState->m_accumulatedTransform.isInvertible())
+        return 0;
+
+    // Compute the point and the hit test rect in the coords of this layer by using the values
+    // from the transformState, which store the point and quad in the coords of the last flattened
+    // layer, and the accumulated transform which lets up map through preserve-3d layers.
+    //
+    // We can't just map hitTestLocation and hitTestRect because they may have been flattened (losing z)
+    // by our container.
+    FloatPoint localPoint = newTransformState->mappedPoint();
+    FloatQuad localPointQuad = newTransformState->mappedQuad();
+    LayoutRect localHitTestRect = newTransformState->boundsOfMappedArea();
+    HitTestLocation newHitTestLocation;
+    if (hitTestLocation.isRectBasedTest())
+        newHitTestLocation = HitTestLocation(localPoint, localPointQuad);
+    else
+        newHitTestLocation = HitTestLocation(localPoint);
+
+    // Now do a hit test with the root layer shifted to be us.
+    return hitTestLayer(this, containerLayer, result, localHitTestRect, newHitTestLocation, true, newTransformState.get(), zOffset);
+}
+
+bool PaintLayer::hitTestContents(HitTestResult& result, const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation, HitTestFilter hitTestFilter) const
+{
+    ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
+
+    if (!layoutObject()->hitTest(result, hitTestLocation, toLayoutPoint(layerBounds.location() - layoutBoxLocation()), hitTestFilter)) {
+        // It's wrong to set innerNode, but then claim that you didn't hit anything, unless it is
+        // a rect-based test.
+        ASSERT(!result.innerNode() || (result.hitTestRequest().listBased() && result.listBasedTestResult().size()));
+        return false;
+    }
+
+    if (!result.innerNode()) {
+        // We hit something anonymous, and we didn't find a DOM node ancestor in this layer.
+
+        if (layoutObject()->isLayoutFlowThread()) {
+            // For a flow thread it's safe to just say that we didn't hit anything. That means that
+            // we'll continue as normally, and eventually hit a column set sibling instead. Column
+            // sets are also anonymous, but, unlike flow threads, they don't establish layers, so
+            // we'll fall back and hit the multicol container parent (which should have a DOM node).
+            return false;
+        }
+
+        Node* e = enclosingElement();
+        // FIXME: should be a call to result.setNodeAndPosition. What we would really want to do here is to
+        // return and look for the nearest non-anonymous ancestor, and ignore aunts and uncles on
+        // our way. It's bad to look for it manually like we do here, and give up on setting a local
+        // point in the result, because that has bad implications for text selection and
+        // caretRangeFromPoint(). See crbug.com/461791
+        if (!result.innerNode())
+            result.setInnerNode(e);
+
+    }
+    return true;
+}
+
+PaintLayer* PaintLayer::hitTestChildren(ChildrenIteration childrentoVisit, PaintLayer* rootLayer,
+    HitTestResult& result,
+    const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation,
+    const HitTestingTransformState* transformState,
+    double* zOffsetForDescendants, double* zOffset,
+    const HitTestingTransformState* unflattenedTransformState,
+    bool depthSortDescendants)
+{
+    if (!hasSelfPaintingLayerDescendant())
+        return 0;
+
+    PaintLayer* resultLayer = 0;
+    PaintLayerStackingNodeReverseIterator iterator(*m_stackingNode, childrentoVisit);
+    while (PaintLayerStackingNode* child = iterator.next()) {
+        PaintLayer* childLayer = child->layer();
+        PaintLayer* hitLayer = 0;
+        HitTestResult tempResult(result.hitTestRequest(), result.hitTestLocation());
+        hitLayer = childLayer->hitTestLayer(rootLayer, this, tempResult, hitTestRect, hitTestLocation, false, transformState, zOffsetForDescendants);
+
+        // If it is a list-based test, we can safely append the temporary result since it might had hit
+        // nodes but not necesserily had hitLayer set.
+        ASSERT(!result.isRectBasedTest() || result.hitTestRequest().listBased());
+        if (result.hitTestRequest().listBased())
+            result.append(tempResult);
+
+        if (isHitCandidate(hitLayer, depthSortDescendants, zOffset, unflattenedTransformState)) {
+            resultLayer = hitLayer;
+            if (!result.hitTestRequest().listBased())
+                result = tempResult;
+            if (!depthSortDescendants)
+                break;
+        }
+    }
+
+    return resultLayer;
+}
+
+void PaintLayer::blockSelectionGapsBoundsChanged()
+{
+    if (RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+        return;
+
+    setNeedsCompositingInputsUpdate();
+}
+
+void PaintLayer::addBlockSelectionGapsBounds(const LayoutRect& bounds)
+{
+    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
+        return;
+    m_blockSelectionGapsBounds.unite(enclosingIntRect(bounds));
+    blockSelectionGapsBoundsChanged();
+}
+
+void PaintLayer::clearBlockSelectionGapsBounds()
+{
+    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
+        return;
+    m_blockSelectionGapsBounds = IntRect();
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
+        child->clearBlockSelectionGapsBounds();
+    blockSelectionGapsBoundsChanged();
+}
+
+void PaintLayer::invalidatePaintForBlockSelectionGaps()
+{
+    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
+        return;
+
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling()) {
+        // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
+        DisablePaintInvalidationStateAsserts disabler;
+        child->invalidatePaintForBlockSelectionGaps();
+    }
+
+    if (m_blockSelectionGapsBounds.isEmpty())
+        return;
+
+    LayoutRect rect(m_blockSelectionGapsBounds);
+    if (layoutObject()->hasOverflowClip()) {
+        LayoutBox* box = layoutBox();
+        rect.move(-box->scrolledContentOffset());
+        if (!scrollableArea()->usesCompositedScrolling())
+            rect.intersect(box->overflowClipRect(LayoutPoint()));
+    }
+    if (layoutObject()->hasClip())
+        rect.intersect(toLayoutBox(layoutObject())->clipRect(LayoutPoint()));
+    if (!rect.isEmpty()) {
+        // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
+        DisablePaintInvalidationStateAsserts disabler;
+        layoutObject()->invalidatePaintRectangle(rect);
+    }
+}
+
+IntRect PaintLayer::blockSelectionGapsBounds() const
+{
+    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
+        return IntRect();
+
+    if (!layoutObject()->isLayoutBlockFlow())
+        return IntRect();
+
+    LayoutBlockFlow* layoutBlockFlow = toLayoutBlockFlow(layoutObject());
+    LayoutRect gapRects = layoutBlockFlow->selectionGapRectsForPaintInvalidation(layoutBlockFlow);
+
+    return pixelSnappedIntRect(gapRects);
+}
+
+bool PaintLayer::hasBlockSelectionGapBounds() const
+{
+    if (RuntimeEnabledFeatures::selectionPaintingWithoutSelectionGapsEnabled())
+        return false;
+
+    // FIXME: it would be more accurate to return !blockSelectionGapsBounds().isEmpty(), but this is impossible
+    // at the moment because it causes invalid queries to layout-dependent code (crbug.com/372802).
+    // ASSERT(layoutObject()->document().lifecycle().state() >= DocumentLifecycle::LayoutClean);
+
+    if (!layoutObject()->isLayoutBlock())
+        return false;
+
+    return toLayoutBlock(layoutObject())->shouldPaintSelectionGaps();
+}
+
+bool PaintLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const LayoutPoint& offsetFromRoot) const
+{
+    // Always examine the canvas and the root.
+    // FIXME: Could eliminate the isDocumentElement() check if we fix background painting so that the LayoutView
+    // paints the root's background.
+    if (isRootLayer() || layoutObject()->isDocumentElement())
+        return true;
+
+    // If we aren't an inline flow, and our layer bounds do intersect the damage rect, then we
+    // can go ahead and return true.
+    LayoutView* view = layoutObject()->view();
+    ASSERT(view);
+    if (view && !layoutObject()->isLayoutInline()) {
+        if (layerBounds.intersects(damageRect))
+            return true;
+    }
+
+    // Otherwise we need to compute the bounding box of this single layer and see if it intersects
+    // the damage rect.
+    return physicalBoundingBox(offsetFromRoot).intersects(damageRect);
+}
+
+LayoutRect PaintLayer::logicalBoundingBox() const
+{
+    return layoutObject()->visualOverflowRect();
+}
+
+static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, LayoutObject* layoutObjects)
+{
+    LayoutRect result = boundingBox;
+    if (layoutObjects->isBox())
+        toLayoutBox(layoutObjects)->flipForWritingMode(result);
+    else
+        layoutObjects->containingBlock()->flipForWritingMode(result);
+    return result;
+}
+
+LayoutRect PaintLayer::physicalBoundingBox(const PaintLayer* ancestorLayer) const
+{
+    LayoutPoint offsetFromRoot;
+    convertToLayerCoords(ancestorLayer, offsetFromRoot);
+    return physicalBoundingBox(offsetFromRoot);
+}
+
+LayoutRect PaintLayer::physicalBoundingBox(const LayoutPoint& offsetFromRoot) const
+{
+    LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutObject());
+    result.moveBy(offsetFromRoot);
+    return result;
+}
+
+LayoutRect PaintLayer::fragmentsBoundingBox(const PaintLayer* ancestorLayer) const
+{
+    if (!enclosingPaginationLayer())
+        return physicalBoundingBox(ancestorLayer);
+
+    LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), layoutObject());
+    convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, result);
+    return result;
+}
+
+LayoutRect PaintLayer::boundingBoxForCompositingOverlapTest() const
+{
+    // Apply NeverIncludeTransformForAncestorLayer, because the geometry map in CompositingInputsUpdater will take care of applying the
+    // transform of |this| (== the ancestorLayer argument to boundingBoxForCompositing).
+    return overlapBoundsIncludeChildren() ? boundingBoxForCompositing(this, NeverIncludeTransformForAncestorLayer) : fragmentsBoundingBox(this);
+}
+
+static void expandRectForReflectionAndStackingChildren(const PaintLayer* ancestorLayer, LayoutRect& result)
+{
+    if (ancestorLayer->reflectionInfo() && !ancestorLayer->reflectionInfo()->reflectionLayer()->hasCompositedLayerMapping())
+        result.unite(ancestorLayer->reflectionInfo()->reflectionLayer()->boundingBoxForCompositing(ancestorLayer));
+
+    ASSERT(ancestorLayer->stackingNode()->isStackingContext() || !ancestorLayer->stackingNode()->hasPositiveZOrderList());
+
+#if ENABLE(ASSERT)
+    LayerListMutationDetector mutationChecker(const_cast<PaintLayer*>(ancestorLayer)->stackingNode());
+#endif
+
+    PaintLayerStackingNodeIterator iterator(*ancestorLayer->stackingNode(), AllChildren);
+    while (PaintLayerStackingNode* node = iterator.next()) {
+        // Here we exclude both directly composited layers and squashing layers
+        // because those Layers don't paint into the graphics layer
+        // for this Layer. For example, the bounds of squashed Layers
+        // will be included in the computation of the appropriate squashing
+        // GraphicsLayer.
+        if (node->layer()->compositingState() != NotComposited)
+            continue;
+        result.unite(node->layer()->boundingBoxForCompositing(ancestorLayer));
+    }
+}
+
+LayoutRect PaintLayer::physicalBoundingBoxIncludingReflectionAndStackingChildren(const LayoutPoint& offsetFromRoot) const
+{
+    LayoutRect result = physicalBoundingBox(LayoutPoint());
+
+    const_cast<PaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
+
+    expandRectForReflectionAndStackingChildren(this, result);
+
+    result.moveBy(offsetFromRoot);
+    return result;
+}
+
+LayoutRect PaintLayer::boundingBoxForCompositing(const PaintLayer* ancestorLayer, CalculateBoundsOptions options) const
+{
+    if (!isSelfPaintingLayer())
+        return LayoutRect();
+
+    if (!ancestorLayer)
+        ancestorLayer = this;
+
+    // FIXME: This could be improved to do a check like hasVisibleNonCompositingDescendantLayers() (bug 92580).
+    if (this != ancestorLayer && !hasVisibleContent() && !hasVisibleDescendant())
+        return LayoutRect();
+
+    // The root layer is always just the size of the document.
+    if (isRootLayer())
+        return LayoutRect(m_layoutObject->view()->unscaledDocumentRect());
+
+    // The layer created for the LayoutFlowThread is just a helper for painting and hit-testing,
+    // and should not contribute to the bounding box. The LayoutMultiColumnSets will contribute
+    // the correct size for the layout content of the multicol container.
+    if (layoutObject()->isLayoutFlowThread())
+        return LayoutRect();
+
+    LayoutRect result = clipper().localClipRect();
+    // TODO(chrishtr): avoid converting to IntRect and back.
+    if (result == LayoutRect(LayoutRect::infiniteIntRect())) {
+        result = physicalBoundingBox(LayoutPoint());
+
+        const_cast<PaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
+
+        // Reflections are implemented with Layers that hang off of the reflected layer. However,
+        // the reflection layer subtree does not include the subtree of the parent Layer, so
+        // a recursive computation of stacking children yields no results. This breaks cases when there are stacking
+        // children of the parent, that need to be included in reflected composited bounds.
+        // Fix this by including composited bounds of stacking children of the reflected Layer.
+        if (hasCompositedLayerMapping() && parent() && parent()->reflectionInfo() && parent()->reflectionInfo()->reflectionLayer() == this)
+            expandRectForReflectionAndStackingChildren(parent(), result);
+        else
+            expandRectForReflectionAndStackingChildren(this, result);
+
+        // FIXME: We can optimize the size of the composited layers, by not enlarging
+        // filtered areas with the outsets if we know that the filter is going to render in hardware.
+        // https://bugs.webkit.org/show_bug.cgi?id=81239
+        result.expand(m_layoutObject->style()->filterOutsets());
+    }
+
+    if (transform() && paintsWithTransform(GlobalPaintNormalPhase) && (this != ancestorLayer || options == MaybeIncludeTransformForAncestorLayer))
+        result = transform()->mapRect(result);
+
+    if (enclosingPaginationLayer()) {
+        convertFromFlowThreadToVisualBoundingBoxInAncestor(this, ancestorLayer, result);
+        return result;
+    }
+    LayoutPoint delta;
+    convertToLayerCoords(ancestorLayer, delta);
+    result.moveBy(delta);
+    return result;
+}
+
+CompositingState PaintLayer::compositingState() const
+{
+    ASSERT(isAllowedToQueryCompositingState());
+
+    // This is computed procedurally so there is no redundant state variable that
+    // can get out of sync from the real actual compositing state.
+
+    if (m_groupedMapping) {
+        ASSERT(!m_compositedLayerMapping);
+        return PaintsIntoGroupedBacking;
+    }
+
+    if (!m_compositedLayerMapping)
+        return NotComposited;
+
+    return PaintsIntoOwnBacking;
+}
+
+bool PaintLayer::isAllowedToQueryCompositingState() const
+{
+    if (gCompositingQueryMode == CompositingQueriesAreAllowed || RuntimeEnabledFeatures::slimmingPaintV2Enabled())
+        return true;
+    return layoutObject()->document().lifecycle().state() >= DocumentLifecycle::InCompositingUpdate;
+}
+
+CompositedLayerMapping* PaintLayer::compositedLayerMapping() const
+{
+    ASSERT(isAllowedToQueryCompositingState());
+    return m_compositedLayerMapping.get();
+}
+
+GraphicsLayer* PaintLayer::graphicsLayerBacking() const
+{
+    switch (compositingState()) {
+    case NotComposited:
+        return 0;
+    case PaintsIntoGroupedBacking:
+        return groupedMapping()->squashingLayer();
+    default:
+        return compositedLayerMapping()->mainGraphicsLayer();
+    }
+}
+
+GraphicsLayer* PaintLayer::graphicsLayerBackingForScrolling() const
+{
+    switch (compositingState()) {
+    case NotComposited:
+        return 0;
+    case PaintsIntoGroupedBacking:
+        return groupedMapping()->squashingLayer();
+    default:
+        return compositedLayerMapping()->scrollingContentsLayer() ? compositedLayerMapping()->scrollingContentsLayer() : compositedLayerMapping()->mainGraphicsLayer();
+    }
+}
+
+void PaintLayer::ensureCompositedLayerMapping()
+{
+    if (m_compositedLayerMapping)
+        return;
+
+    m_compositedLayerMapping = adoptPtr(new CompositedLayerMapping(*this));
+    m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
+
+    updateOrRemoveFilterEffectBuilder();
+}
+
+void PaintLayer::clearCompositedLayerMapping(bool layerBeingDestroyed)
+{
+    if (!layerBeingDestroyed) {
+        // We need to make sure our decendants get a geometry update. In principle,
+        // we could call setNeedsGraphicsLayerUpdate on our children, but that would
+        // require walking the z-order lists to find them. Instead, we over-invalidate
+        // by marking our parent as needing a geometry update.
+        if (PaintLayer* compositingParent = enclosingLayerWithCompositedLayerMapping(ExcludeSelf))
+            compositingParent->compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
+    }
+
+    m_compositedLayerMapping.clear();
+
+    if (!layerBeingDestroyed)
+        updateOrRemoveFilterEffectBuilder();
+}
+
+void PaintLayer::setGroupedMapping(CompositedLayerMapping* groupedMapping, SetGroupMappingOptions options)
+{
+    if (groupedMapping == m_groupedMapping)
+        return;
+
+    if (options == InvalidateLayerAndRemoveFromMapping && m_groupedMapping) {
+        m_groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
+        m_groupedMapping->removeLayerFromSquashingGraphicsLayer(this);
+    }
+    m_groupedMapping = groupedMapping;
+    ASSERT(!m_groupedMapping || m_groupedMapping->verifyLayerInSquashingVector(this));
+    if (options == InvalidateLayerAndRemoveFromMapping && m_groupedMapping)
+        m_groupedMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
+}
+
+bool PaintLayer::hasCompositedMask() const
+{
+    return m_compositedLayerMapping && m_compositedLayerMapping->hasMaskLayer();
+}
+
+bool PaintLayer::hasCompositedClippingMask() const
+{
+    return m_compositedLayerMapping && m_compositedLayerMapping->hasChildClippingMaskLayer();
+}
+
+bool PaintLayer::paintsWithTransform(GlobalPaintFlags globalPaintFlags) const
+{
+    return (transform() || layoutObject()->style()->position() == FixedPosition) && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingState() != PaintsIntoOwnBacking);
+}
+
+bool PaintLayer::backgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
+{
+    if (!isSelfPaintingLayer() && !hasSelfPaintingLayerDescendant())
+        return false;
+
+    if (paintsWithTransparency(GlobalPaintNormalPhase))
+        return false;
+
+    // We can't use hasVisibleContent(), because that will be true if our layoutObject is hidden, but some child
+    // is visible and that child doesn't cover the entire rect.
+    if (layoutObject()->style()->visibility() != VISIBLE)
+        return false;
+
+    if (paintsWithFilters() && layoutObject()->style()->filter().hasFilterThatAffectsOpacity())
+        return false;
+
+    // FIXME: Handle simple transforms.
+    if (paintsWithTransform(GlobalPaintNormalPhase))
+        return false;
+
+    // FIXME: Remove this check.
+    // This function should not be called when layer-lists are dirty.
+    // It is somehow getting triggered during style update.
+    if (m_stackingNode->zOrderListsDirty())
+        return false;
+
+    // FIXME: We currently only check the immediate layoutObject,
+    // which will miss many cases.
+    if (layoutObject()->backgroundIsKnownToBeOpaqueInRect(localRect))
+        return true;
+
+    // We can't consult child layers if we clip, since they might cover
+    // parts of the rect that are clipped out.
+    if (layoutObject()->hasOverflowClip())
+        return false;
+
+    return childBackgroundIsKnownToBeOpaqueInRect(localRect);
+}
+
+bool PaintLayer::childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect& localRect) const
+{
+    PaintLayerStackingNodeReverseIterator revertseIterator(*m_stackingNode, PositiveZOrderChildren | NormalFlowChildren | NegativeZOrderChildren);
+    while (PaintLayerStackingNode* child = revertseIterator.next()) {
+        const PaintLayer* childLayer = child->layer();
+        // Stop at composited paint boundaries.
+        if (childLayer->isPaintInvalidationContainer())
+            continue;
+
+        if (!childLayer->canUseConvertToLayerCoords())
+            continue;
+
+        LayoutPoint childOffset;
+        LayoutRect childLocalRect(localRect);
+        childLayer->convertToLayerCoords(this, childOffset);
+        childLocalRect.moveBy(-childOffset);
+
+        if (childLayer->backgroundIsKnownToBeOpaqueInRect(childLocalRect))
+            return true;
+    }
+    return false;
+}
+
+bool PaintLayer::shouldBeSelfPaintingLayer() const
+{
+    if (layoutObject()->isLayoutPart() && toLayoutPart(layoutObject())->requiresAcceleratedCompositing())
+        return true;
+    return m_layerType == NormalPaintLayer
+        || (m_scrollableArea && m_scrollableArea->hasOverlayScrollbars())
+        || needsCompositedScrolling();
+}
+
+void PaintLayer::updateSelfPaintingLayer()
+{
+    bool isSelfPaintingLayer = shouldBeSelfPaintingLayer();
+    if (this->isSelfPaintingLayer() == isSelfPaintingLayer)
+        return;
+
+    m_isSelfPaintingLayer = isSelfPaintingLayer;
+
+    if (parent())
+        parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
+}
+
+bool PaintLayer::hasNonEmptyChildLayoutObjects() const
+{
+    // Some HTML can cause whitespace text nodes to have layoutObjects, like:
+    // <div>
+    // <img src=...>
+    // </div>
+    // so test for 0x0 LayoutTexts here
+    for (LayoutObject* child = layoutObject()->slowFirstChild(); child; child = child->nextSibling()) {
+        if (!child->hasLayer()) {
+            if (child->isLayoutInline() || !child->isBox())
+                return true;
+
+            if (toLayoutBox(child)->size().width() > 0 || toLayoutBox(child)->size().height() > 0)
+                return true;
+        }
+    }
+    return false;
+}
+
+bool PaintLayer::hasBoxDecorationsOrBackground() const
+{
+    return layoutObject()->style()->hasBoxDecorations() || layoutObject()->style()->hasBackground();
+}
+
+bool PaintLayer::hasVisibleBoxDecorations() const
+{
+    if (!hasVisibleContent())
+        return false;
+
+    return hasBoxDecorationsOrBackground() || hasOverflowControls();
+}
+
+void PaintLayer::updateFilters(const ComputedStyle* oldStyle, const ComputedStyle& newStyle)
+{
+    if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter()))
+        return;
+
+    updateOrRemoveFilterClients();
+    updateOrRemoveFilterEffectBuilder();
+}
+
+bool PaintLayer::attemptDirectCompositingUpdate(StyleDifference diff, const ComputedStyle* oldStyle)
+{
+    CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialCompositingReasonsFromStyle;
+    compositor()->updatePotentialCompositingReasonsFromStyle(this);
+
+    // This function implements an optimization for transforms and opacity.
+    // A common pattern is for a touchmove handler to update the transform
+    // and/or an opacity of an element every frame while the user moves their
+    // finger across the screen. The conditions below recognize when the
+    // compositing state is set up to receive a direct transform or opacity
+    // update.
+
+    if (!diff.hasAtMostPropertySpecificDifferences(StyleDifference::TransformChanged | StyleDifference::OpacityChanged))
+        return false;
+    // The potentialCompositingReasonsFromStyle could have changed without
+    // a corresponding StyleDifference if an animation started or ended.
+    if (m_potentialCompositingReasonsFromStyle != oldPotentialCompositingReasonsFromStyle)
+        return false;
+    // We could add support for reflections if we updated the transform on
+    // the reflection layers.
+    if (layoutObject()->hasReflection())
+        return false;
+    // If we're unwinding a scheduleSVGFilterLayerUpdateHack(), then we can't
+    // perform a direct compositing update because the filters code is going
+    // to produce different output this time around. We can remove this code
+    // once we fix the chicken/egg bugs in the filters code and delete the
+    // scheduleSVGFilterLayerUpdateHack().
+    if (layoutObject()->node() && layoutObject()->node()->svgFilterNeedsLayerUpdate())
+        return false;
+    if (!m_compositedLayerMapping)
+        return false;
+
+    // To cut off almost all the work in the compositing update for
+    // this case, we treat inline transforms has having assumed overlap
+    // (similar to how we treat animated transforms). Notice that we read
+    // CompositingReasonInlineTransform from the m_compositingReasons, which
+    // means that the inline transform actually triggered assumed overlap in
+    // the overlap map.
+    if (diff.transformChanged() && !(m_compositingReasons & CompositingReasonInlineTransform))
+        return false;
+
+    // We composite transparent Layers differently from non-transparent
+    // Layers even when the non-transparent Layers are already a
+    // stacking context.
+    if (diff.opacityChanged() && m_layoutObject->style()->hasOpacity() != oldStyle->hasOpacity())
+        return false;
+
+    // Changes in pointer-events affect hit test visibility of the scrollable
+    // area and its |m_scrollsOverflow| value which determines if the layer
+    // requires composited scrolling or not.
+    if (m_scrollableArea && m_layoutObject->style()->pointerEvents() != oldStyle->pointerEvents())
+        return false;
+
+    updateTransform(oldStyle, layoutObject()->styleRef());
+
+    // FIXME: Consider introducing a smaller graphics layer update scope
+    // that just handles transforms and opacity. GraphicsLayerUpdateLocal
+    // will also program bounds, clips, and many other properties that could
+    // not possibly have changed.
+    m_compositedLayerMapping->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateLocal);
+    compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange);
+
+    if (m_scrollableArea)
+        m_scrollableArea->updateAfterStyleChange(oldStyle);
+
+    return true;
+}
+
+void PaintLayer::styleChanged(StyleDifference diff, const ComputedStyle* oldStyle)
+{
+    if (attemptDirectCompositingUpdate(diff, oldStyle))
+        return;
+
+    m_stackingNode->updateIsTreatedAsStackingContext();
+    m_stackingNode->updateStackingNodesAfterStyleChange(oldStyle);
+
+    if (m_scrollableArea)
+        m_scrollableArea->updateAfterStyleChange(oldStyle);
+
+    // Overlay scrollbars can make this layer self-painting so we need
+    // to recompute the bit once scrollbars have been updated.
+    updateSelfPaintingLayer();
+
+    if (!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldStyle)) {
+        ASSERT(!oldStyle || diff.needsFullLayout());
+        updateReflectionInfo(oldStyle);
+    }
+
+    updateDescendantDependentFlags();
+
+    updateTransform(oldStyle, layoutObject()->styleRef());
+    updateFilters(oldStyle, layoutObject()->styleRef());
+
+    setNeedsCompositingInputsUpdate();
+}
+
+bool PaintLayer::scrollsOverflow() const
+{
+    if (PaintLayerScrollableArea* scrollableArea = this->scrollableArea())
+        return scrollableArea->scrollsOverflow();
+
+    return false;
+}
+
+namespace {
+
+FilterOperations computeFilterOperationsHandleReferenceFilters(const FilterOperations& filters, float effectiveZoom, Node* enclosingElement)
+{
+    if (filters.hasReferenceFilter()) {
+        for (size_t i = 0; i < filters.size(); ++i) {
+            FilterOperation* filterOperation = filters.operations().at(i).get();
+            if (filterOperation->type() != FilterOperation::REFERENCE)
+                continue;
+            ReferenceFilterOperation& referenceOperation = toReferenceFilterOperation(*filterOperation);
+            // FIXME: Cache the Filter if it didn't change.
+            RefPtrWillBeRawPtr<Filter> referenceFilter = ReferenceFilterBuilder::build(effectiveZoom, toElement(enclosingElement), nullptr, referenceOperation);
+            referenceOperation.setFilter(referenceFilter.release());
+        }
+    }
+
+    return filters;
+}
+
+} // unnamed namespace
+
+FilterOperations PaintLayer::computeFilterOperations(const ComputedStyle& style)
+{
+    return computeFilterOperationsHandleReferenceFilters(style.filter(), style.effectiveZoom(), enclosingElement());
+}
+
+FilterOperations PaintLayer::computeBackdropFilterOperations(const ComputedStyle& style)
+{
+    return computeFilterOperationsHandleReferenceFilters(style.backdropFilter(), style.effectiveZoom(), enclosingElement());
+}
+
+void PaintLayer::updateOrRemoveFilterClients()
+{
+    if (!hasFilter()) {
+        removeFilterInfoIfNeeded();
+        return;
+    }
+
+    if (layoutObject()->style()->filter().hasReferenceFilter())
+        ensureFilterInfo()->updateReferenceFilterClients(layoutObject()->style()->filter());
+    else if (hasFilterInfo())
+        filterInfo()->removeReferenceFilterClients();
+}
+
+void PaintLayer::updateOrRemoveFilterEffectBuilder()
+{
+    // FilterEffectBuilder is only used to render the filters in software mode,
+    // so we always need to run updateOrRemoveFilterEffectBuilder after the composited
+    // mode might have changed for this layer.
+    if (!paintsWithFilters()) {
+        // Don't delete the whole filter info here, because we might use it
+        // for loading CSS shader files.
+        if (PaintLayerFilterInfo* filterInfo = this->filterInfo())
+            filterInfo->setBuilder(nullptr);
+
+        return;
+    }
+
+    PaintLayerFilterInfo* filterInfo = ensureFilterInfo();
+    if (!filterInfo->builder())
+        filterInfo->setBuilder(FilterEffectBuilder::create());
+
+    // If the filter fails to build, remove it from the layer. It will still attempt to
+    // go through regular processing (e.g. compositing), but never apply anything.
+    float zoom = layoutObject()->style() ? layoutObject()->style()->effectiveZoom() : 1.0f;
+    if (!filterInfo->builder()->build(toElement(enclosingElement()), computeFilterOperations(layoutObject()->styleRef()), zoom))
+        filterInfo->setBuilder(nullptr);
+}
+
+void PaintLayer::filterNeedsPaintInvalidation()
+{
+    {
+        DeprecatedScheduleStyleRecalcDuringLayout marker(layoutObject()->document().lifecycle());
+        // It's possible for scheduleSVGFilterLayerUpdateHack to schedule a style recalc, which
+        // is a problem because this function can be called while performing layout.
+        // Presumably this represents an illegal data flow of layout or compositing
+        // information into the style system.
+        toElement(layoutObject()->node())->scheduleSVGFilterLayerUpdateHack();
+    }
+
+    layoutObject()->setShouldDoFullPaintInvalidation();
+}
+
+void PaintLayer::addLayerHitTestRects(LayerHitTestRects& rects) const
+{
+    computeSelfHitTestRects(rects);
+    for (PaintLayer* child = firstChild(); child; child = child->nextSibling())
+        child->addLayerHitTestRects(rects);
+}
+
+void PaintLayer::computeSelfHitTestRects(LayerHitTestRects& rects) const
+{
+    if (!size().isEmpty()) {
+        Vector<LayoutRect> rect;
+
+        if (layoutBox() && layoutBox()->scrollsOverflow()) {
+            // For scrolling layers, rects are taken to be in the space of the contents.
+            // We need to include the bounding box of the layer in the space of its parent
+            // (eg. for border / scroll bars) and if it's composited then the entire contents
+            // as well as they may be on another composited layer. Skip reporting contents
+            // for non-composited layers as they'll get projected to the same layer as the
+            // bounding box.
+            if (compositingState() != NotComposited)
+                rect.append(m_scrollableArea->overflowRect());
+
+            rects.set(this, rect);
+            if (const PaintLayer* parentLayer = parent()) {
+                LayerHitTestRects::iterator iter = rects.find(parentLayer);
+                if (iter == rects.end()) {
+                    rects.add(parentLayer, Vector<LayoutRect>()).storedValue->value.append(physicalBoundingBox(parentLayer));
+                } else {
+                    iter->value.append(physicalBoundingBox(parentLayer));
+                }
+            }
+        } else {
+            rect.append(logicalBoundingBox());
+            rects.set(this, rect);
+        }
+    }
+}
+
+void PaintLayer::setNeedsRepaint()
+{
+    PaintLayer* layer = this;
+    while (layer && !layer->isSelfPaintingLayer() && !layer->hasSelfPaintingLayerDescendant())
+        layer = layer->parent();
+
+    // This layer is in an orphaned layer tree. Will mark ancestor for repaint when
+    // the orphaned tree is added into another tree.
+    if (!layer)
+        return;
+
+    layer->m_needsRepaint = true;
+
+    // Do this unconditionally to ensure container chain is marked when compositing status of the layer changes.
+    layer->markAncestorChainForNeedsRepaint();
+}
+
+void PaintLayer::markAncestorChainForNeedsRepaint()
+{
+    // Need to access compositingState(). We've ensured correct flag setting when compositingState() changes.
+    DisableCompositingQueryAsserts disabler;
+
+    if (compositingState() != NotComposited)
+        return;
+
+    PaintLayer* layer = this;
+    while (true) {
+        PaintLayer* container = layer->parent();
+        if (!container) {
+            LayoutObject* owner = layer->layoutObject()->frame()->ownerLayoutObject();
+            if (!owner)
+                break;
+            container = owner->enclosingLayer();
+        }
+        if (container->isSelfPaintingLayer() || container->hasSelfPaintingLayerDescendant()) {
+            if (container->m_needsRepaint)
+                break;
+            container->m_needsRepaint = true;
+        }
+        if (container->compositingState() != NotComposited)
+            break;
+        layer = container;
+    }
+}
+
+DisableCompositingQueryAsserts::DisableCompositingQueryAsserts()
+    : m_disabler(gCompositingQueryMode, CompositingQueriesAreAllowed) { }
+
+} // namespace blink
+
+#ifndef NDEBUG
+// FIXME: Rename?
+void showLayerTree(const blink::PaintLayer* layer)
+{
+    if (!layer) {
+        fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
+        return;
+    }
+
+    if (blink::LocalFrame* frame = layer->layoutObject()->frame()) {
+        WTF::String output = externalRepresentation(frame, blink::LayoutAsTextShowAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompositedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndClass | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState);
+        fprintf(stderr, "%s\n", output.utf8().data());
+    }
+}
+
+void showLayerTree(const blink::LayoutObject* layoutObject)
+{
+    if (!layoutObject) {
+        fprintf(stderr, "Cannot showLayerTree. Root is (nil)\n");
+        return;
+    }
+    showLayerTree(layoutObject->enclosingLayer());
+}
+#endif
diff --git a/third_party/WebKit/Source/core/paint/PaintLayer.h b/third_party/WebKit/Source/core/paint/PaintLayer.h
new file mode 100644
index 0000000..57a380e
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayer.h
@@ -0,0 +1,775 @@
+/*
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef PaintLayer_h
+#define PaintLayer_h
+
+#include "core/CoreExport.h"
+#include "core/layout/LayoutBox.h"
+#include "core/paint/PaintLayerClipper.h"
+#include "core/paint/PaintLayerFilterInfo.h"
+#include "core/paint/PaintLayerFragment.h"
+#include "core/paint/PaintLayerReflectionInfo.h"
+#include "core/paint/PaintLayerScrollableArea.h"
+#include "core/paint/PaintLayerStackingNode.h"
+#include "core/paint/PaintLayerStackingNodeIterator.h"
+#include "platform/graphics/CompositingReasons.h"
+#include "public/platform/WebBlendMode.h"
+#include "wtf/Allocator.h"
+#include "wtf/OwnPtr.h"
+
+namespace blink {
+
+class FilterEffectBuilder;
+class FilterOperations;
+class HitTestRequest;
+class HitTestResult;
+class HitTestingTransformState;
+class PaintLayerCompositor;
+class CompositedLayerMapping;
+class ComputedStyle;
+class TransformationMatrix;
+
+enum IncludeSelfOrNot { IncludeSelf, ExcludeSelf };
+
+enum CompositingQueryMode {
+    CompositingQueriesAreAllowed,
+    CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases
+};
+
+// FIXME: remove this once the compositing query ASSERTS are no longer hit.
+class CORE_EXPORT DisableCompositingQueryAsserts {
+    STACK_ALLOCATED();
+    WTF_MAKE_NONCOPYABLE(DisableCompositingQueryAsserts);
+public:
+    DisableCompositingQueryAsserts();
+private:
+    TemporaryChange<CompositingQueryMode> m_disabler;
+};
+
+// PaintLayer is an old object that handles lots of unrelated operations.
+// We want it to die at some point and be replaced by more focused objects. Removing
+// a lot of unneeded complexity.
+// Complex painting operations (opacity, clipping, filters, reflections, ...),
+// hardware acceleration (through PaintLayerCompositor),
+// scrolling (through PaintLayerScrollableArea)
+// along with some optimizations are all handled by PaintLayer.
+//
+// The class is central to painting and hit-testing: it implements the painting
+// order through PaintLayerStackingNode and handle lots of complex
+// graphics operations LayoutObjects don't handle (e.g. 'filter' and 'opacity').
+//
+// The compositing code is also based on PaintLayer. The entry to it
+// is the PaintLayerCompositor, which fills
+// |m_compositedLayerMapping| for hardware accelerated layers.
+//
+// TODO(jchaffraix): Expand the documentation about hardware acceleration.
+//
+// The class is DEPRECATED, which means that we would like to remove it. The
+// reason for removal is that it has been a dumping ground for features for too
+// long and is the wrong level of abstraction, bearing no correspondence to any
+// CSS concept. Its associated objects and some of its feature need to be
+// migrated to LayoutObject (or the appropriate sub-class).
+class CORE_EXPORT PaintLayer {
+    WTF_MAKE_NONCOPYABLE(PaintLayer);
+public:
+    PaintLayer(LayoutBoxModelObject*, PaintLayerType);
+    ~PaintLayer();
+
+    String debugName() const;
+
+    LayoutBoxModelObject* layoutObject() const { return m_layoutObject; }
+    LayoutBox* layoutBox() const { return m_layoutObject && m_layoutObject->isBox() ? toLayoutBox(m_layoutObject) : 0; }
+    PaintLayer* parent() const { return m_parent; }
+    PaintLayer* previousSibling() const { return m_previous; }
+    PaintLayer* nextSibling() const { return m_next; }
+    PaintLayer* firstChild() const { return m_first; }
+    PaintLayer* lastChild() const { return m_last; }
+
+    // TODO(wangxianzhu): Find a better name for it. 'paintContainer' might be good but
+    // we can't use it for now because it conflicts with PaintInfo::paintContainer.
+    PaintLayer* compositingContainer() const;
+
+    void addChild(PaintLayer* newChild, PaintLayer* beforeChild = 0);
+    PaintLayer* removeChild(PaintLayer*);
+
+    void removeOnlyThisLayer();
+    void insertOnlyThisLayer();
+
+    void styleChanged(StyleDifference, const ComputedStyle* oldStyle);
+
+    // FIXME: Many people call this function while it has out-of-date information.
+    bool isSelfPaintingLayer() const { return m_isSelfPaintingLayer; }
+
+    void setLayerType(PaintLayerType layerType) { m_layerType = layerType; }
+
+    bool isTransparent() const { return layoutObject()->isTransparent() || layoutObject()->style()->hasBlendMode() || layoutObject()->hasMask(); }
+
+    bool isReflection() const { return layoutObject()->isReplica(); }
+    PaintLayerReflectionInfo* reflectionInfo() { return m_reflectionInfo.get(); }
+    const PaintLayerReflectionInfo* reflectionInfo() const { return m_reflectionInfo.get(); }
+
+    const PaintLayer* root() const
+    {
+        const PaintLayer* curr = this;
+        while (curr->parent())
+            curr = curr->parent();
+        return curr;
+    }
+
+    const LayoutPoint& location() const { ASSERT(!m_needsPositionUpdate); return m_location; }
+    // FIXME: size() should ASSERT(!m_needsPositionUpdate) as well, but that fails in some tests,
+    // for example, fast/repaint/clipped-relative.html.
+    const IntSize& size() const { return m_size; }
+    void setSizeHackForLayoutTreeAsText(const IntSize& size) { m_size = size; }
+
+    LayoutRect rect() const { return LayoutRect(location(), LayoutSize(size())); }
+
+    bool isRootLayer() const { return m_isRootLayer; }
+
+    PaintLayerCompositor* compositor() const;
+
+    // Notification from the layoutObject that its content changed (e.g. current frame of image changed).
+    // Allows updates of layer content without invalidating paint.
+    void contentChanged(ContentChangeType);
+
+    void updateLayerPositionsAfterLayout();
+    void updateLayerPositionsAfterOverflowScroll(const DoubleSize& scrollDelta);
+
+    PaintLayer* enclosingPaginationLayer() const { return m_enclosingPaginationLayer; }
+
+    void updateTransformationMatrix();
+    PaintLayer* renderingContextRoot();
+
+    const LayoutSize& offsetForInFlowPosition() const { return m_offsetForInFlowPosition; }
+
+    void addBlockSelectionGapsBounds(const LayoutRect&);
+    void clearBlockSelectionGapsBounds();
+    void invalidatePaintForBlockSelectionGaps();
+    IntRect blockSelectionGapsBounds() const;
+    bool hasBlockSelectionGapBounds() const;
+
+    PaintLayerStackingNode* stackingNode() { return m_stackingNode.get(); }
+    const PaintLayerStackingNode* stackingNode() const { return m_stackingNode.get(); }
+
+    bool subtreeIsInvisible() const { return !hasVisibleContent() && !hasVisibleDescendant(); }
+
+    // FIXME: hasVisibleContent() should call updateDescendantDependentFlags() if m_visibleContentStatusDirty.
+    bool hasVisibleContent() const { ASSERT(!m_visibleContentStatusDirty); return m_hasVisibleContent; }
+
+    // FIXME: hasVisibleDescendant() should call updateDescendantDependentFlags() if m_visibleDescendantStatusDirty.
+    bool hasVisibleDescendant() const { ASSERT(!m_visibleDescendantStatusDirty); return m_hasVisibleDescendant; }
+
+    void dirtyVisibleContentStatus();
+    void potentiallyDirtyVisibleContentStatus(EVisibility);
+
+    bool hasBoxDecorationsOrBackground() const;
+    bool hasVisibleBoxDecorations() const;
+    // True if this layer container layoutObjects that paint.
+    bool hasNonEmptyChildLayoutObjects() const;
+
+    // Will ensure that hasNonCompositiedChild are up to date.
+    void updateScrollingStateAfterCompositingChange();
+    bool hasVisibleNonLayerContent() const { return m_hasVisibleNonLayerContent; }
+    bool hasNonCompositedChild() const { ASSERT(isAllowedToQueryCompositingState()); return m_hasNonCompositedChild; }
+
+    // Gets the ancestor layer that serves as the containing block of this layer. It is assumed
+    // that this layer is established by an out-of-flow positioned layout object (i.e. either
+    // absolutely or fixed positioned).
+    // If |ancestor| is specified, |*skippedAncestor| will be set to true if |ancestor| is found in
+    // the ancestry chain between this layer and the containing block layer; if not found, it will
+    // be set to false. Either both |ancestor| and |skippedAncestor| should be nullptr, or none of
+    // them should.
+    PaintLayer* enclosingPositionedAncestor(const PaintLayer* ancestor = nullptr, bool* skippedAncestor = nullptr) const;
+
+    bool isPaintInvalidationContainer() const;
+
+    // Do *not* call this method unless you know what you are dooing. You probably want to call enclosingCompositingLayerForPaintInvalidation() instead.
+    // If includeSelf is true, may return this.
+    PaintLayer* enclosingLayerWithCompositedLayerMapping(IncludeSelfOrNot) const;
+
+    // Returns the enclosing layer root into which this layer paints, inclusive of this one. Note that the enclosing layer may or may not have its own
+    // GraphicsLayer backing, but is nevertheless the root for a call to the Layer::paint*() methods.
+    PaintLayer* enclosingLayerForPaintInvalidation() const;
+
+    PaintLayer* enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const;
+
+    bool hasAncestorWithFilterOutsets() const;
+
+    bool canUseConvertToLayerCoords() const
+    {
+        // These LayoutObjects have an impact on their layers without the layoutObjects knowing about it.
+        return !layoutObject()->hasTransformRelatedProperty() && !layoutObject()->isSVGRoot();
+    }
+
+    void convertToLayerCoords(const PaintLayer* ancestorLayer, LayoutPoint&) const;
+    void convertToLayerCoords(const PaintLayer* ancestorLayer, LayoutRect&) const;
+
+    // Does the same as convertToLayerCoords() when not in multicol. For multicol, however,
+    // convertToLayerCoords() calculates the offset in flow-thread coordinates (what the layout
+    // engine uses internally), while this method calculates the visual coordinates; i.e. it figures
+    // out which column the layer starts in and adds in the offset. See
+    // http://www.chromium.org/developers/design-documents/multi-column-layout for more info.
+    LayoutPoint visualOffsetFromAncestor(const PaintLayer* ancestorLayer) const;
+
+    // The hitTest() method looks for mouse events by walking layers that intersect the point from front to back.
+    bool hitTest(HitTestResult&);
+
+    bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const LayoutPoint& offsetFromRoot) const;
+
+    // Bounding box relative to some ancestor layer. Pass offsetFromRoot if known.
+    LayoutRect physicalBoundingBox(const LayoutPoint& offsetFromRoot) const;
+    LayoutRect physicalBoundingBox(const PaintLayer* ancestorLayer) const;
+    LayoutRect physicalBoundingBoxIncludingReflectionAndStackingChildren(const LayoutPoint& offsetFromRoot) const;
+    LayoutRect fragmentsBoundingBox(const PaintLayer* ancestorLayer) const;
+
+    LayoutRect boundingBoxForCompositingOverlapTest() const;
+
+    // If true, this layer's children are included in its bounds for overlap testing.
+    // We can't rely on the children's positions if this layer has a filter that could have moved the children's pixels around.
+    bool overlapBoundsIncludeChildren() const { return hasFilter() && layoutObject()->style()->filter().hasFilterThatMovesPixels(); }
+
+    // MaybeIncludeTransformForAncestorLayer means that a transform on |ancestorLayer| may be applied to the bounding box,
+    // in particular if paintsWithTransform() is true.
+    enum CalculateBoundsOptions {
+        MaybeIncludeTransformForAncestorLayer,
+        NeverIncludeTransformForAncestorLayer,
+    };
+    LayoutRect boundingBoxForCompositing(const PaintLayer* ancestorLayer = 0, CalculateBoundsOptions = MaybeIncludeTransformForAncestorLayer) const;
+
+    LayoutUnit staticInlinePosition() const { return m_staticInlinePosition; }
+    LayoutUnit staticBlockPosition() const { return m_staticBlockPosition; }
+
+    void setStaticInlinePosition(LayoutUnit position) { m_staticInlinePosition = position; }
+    void setStaticBlockPosition(LayoutUnit position) { m_staticBlockPosition = position; }
+
+    LayoutSize subpixelAccumulation() const;
+    void setSubpixelAccumulation(const LayoutSize&);
+
+    bool hasTransformRelatedProperty() const { return layoutObject()->hasTransformRelatedProperty(); }
+    // Note that this transform has the transform-origin baked in.
+    TransformationMatrix* transform() const { return m_transform.get(); }
+    void setTransform(PassOwnPtr<TransformationMatrix> transform) { m_transform = transform; }
+    void clearTransform() { m_transform.clear(); }
+
+    // currentTransform computes a transform which takes accelerated animations into account. The
+    // resulting transform has transform-origin baked in. If the layer does not have a transform,
+    // returns the identity matrix.
+    TransformationMatrix currentTransform() const;
+    TransformationMatrix renderableTransform(GlobalPaintFlags) const;
+
+    // Get the perspective transform, which is applied to transformed sublayers.
+    // Returns true if the layer has a -webkit-perspective.
+    // Note that this transform does not have the perspective-origin baked in.
+    TransformationMatrix perspectiveTransform() const;
+    FloatPoint perspectiveOrigin() const;
+    bool preserves3D() const { return layoutObject()->style()->transformStyle3D() == TransformStyle3DPreserve3D; }
+    bool has3DTransform() const { return m_transform && !m_transform->isAffine(); }
+
+    // FIXME: reflections should force transform-style to be flat in the style: https://bugs.webkit.org/show_bug.cgi?id=106959
+    bool shouldPreserve3D() const { return !layoutObject()->hasReflection() && layoutObject()->style()->transformStyle3D() == TransformStyle3DPreserve3D; }
+
+    void filterNeedsPaintInvalidation();
+    bool hasFilter() const { return layoutObject()->hasFilter(); }
+
+    void* operator new(size_t);
+    // Only safe to call from LayoutBoxModelObject::destroyLayer()
+    void operator delete(void*);
+
+    CompositingState compositingState() const;
+
+    // This returns true if our document is in a phase of its lifestyle during which
+    // compositing state may legally be read.
+    bool isAllowedToQueryCompositingState() const;
+
+    // Don't null check this.
+    // FIXME: Rename.
+    CompositedLayerMapping* compositedLayerMapping() const;
+    GraphicsLayer* graphicsLayerBacking() const;
+    GraphicsLayer* graphicsLayerBackingForScrolling() const;
+    // NOTE: If you are using hasCompositedLayerMapping to determine the state of compositing for this layer,
+    // (and not just to do bookkeeping related to the mapping like, say, allocating or deallocating a mapping),
+    // then you may have incorrect logic. Use compositingState() instead.
+    // FIXME: This is identical to null checking compositedLayerMapping(), why not just call that?
+    bool hasCompositedLayerMapping() const { return m_compositedLayerMapping.get(); }
+    void ensureCompositedLayerMapping();
+    void clearCompositedLayerMapping(bool layerBeingDestroyed = false);
+    CompositedLayerMapping* groupedMapping() const { return m_groupedMapping; }
+    enum SetGroupMappingOptions {
+        InvalidateLayerAndRemoveFromMapping,
+        DoNotInvalidateLayerAndRemoveFromMapping
+    };
+    void setGroupedMapping(CompositedLayerMapping*, SetGroupMappingOptions);
+
+    bool hasCompositedMask() const;
+    bool hasCompositedClippingMask() const;
+    bool needsCompositedScrolling() const { return m_scrollableArea && m_scrollableArea->needsCompositedScrolling(); }
+
+    // Computes the position of the given layout object in the space of |paintInvalidationContainer|.
+    // FIXME: invert the logic to have paint invalidation containers take care of painting objects into them, rather than the reverse.
+    // This will allow us to clean up this static method messiness.
+    static LayoutPoint positionFromPaintInvalidationBacking(const LayoutObject*, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0);
+
+    static void mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* paintInvalidationContainer, FloatPoint&);
+    static void mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect&);
+
+    // Adjusts the given rect (in the coordinate space of the LayoutObject) to the coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing.
+    static void mapRectToPaintInvalidationBacking(const LayoutObject*, const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect&, const PaintInvalidationState* = 0);
+
+    // Computes the bounding paint invalidation rect for |layoutObject|, in the coordinate space of |paintInvalidationContainer|'s GraphicsLayer backing.
+    static LayoutRect computePaintInvalidationRect(const LayoutObject*, const PaintLayer* paintInvalidationContainer, const PaintInvalidationState* = 0);
+
+    bool paintsWithTransparency(GlobalPaintFlags globalPaintFlags) const
+    {
+        return isTransparent() && ((globalPaintFlags & GlobalPaintFlattenCompositingLayers) || compositingState() != PaintsIntoOwnBacking);
+    }
+
+    bool paintsWithTransform(GlobalPaintFlags) const;
+
+    // Returns true if background phase is painted opaque in the given rect.
+    // The query rect is given in local coordinates.
+    bool backgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const;
+
+    bool containsDirtyOverlayScrollbars() const { return m_containsDirtyOverlayScrollbars; }
+    void setContainsDirtyOverlayScrollbars(bool dirtyScrollbars) { m_containsDirtyOverlayScrollbars = dirtyScrollbars; }
+
+    FilterOperations computeFilterOperations(const ComputedStyle&);
+    FilterOperations computeBackdropFilterOperations(const ComputedStyle&);
+    bool paintsWithFilters() const;
+    bool paintsWithBackdropFilters() const;
+    FilterEffectBuilder* filterEffectBuilder() const
+    {
+        PaintLayerFilterInfo* filterInfo = this->filterInfo();
+        return filterInfo ? filterInfo->builder() : 0;
+    }
+
+    PaintLayerFilterInfo* filterInfo() const { return hasFilterInfo() ? PaintLayerFilterInfo::filterInfoForLayer(this) : 0; }
+    PaintLayerFilterInfo* ensureFilterInfo() { return PaintLayerFilterInfo::createFilterInfoForLayerIfNeeded(this); }
+    void removeFilterInfoIfNeeded()
+    {
+        if (hasFilterInfo())
+            PaintLayerFilterInfo::removeFilterInfoForLayer(this);
+    }
+
+    bool hasFilterInfo() const { return m_hasFilterInfo; }
+    void setHasFilterInfo(bool hasFilterInfo) { m_hasFilterInfo = hasFilterInfo; }
+
+    void updateFilters(const ComputedStyle* oldStyle, const ComputedStyle& newStyle);
+
+    Node* enclosingElement() const;
+
+    bool isInTopLayer() const;
+
+    bool scrollsWithViewport() const;
+    bool scrollsWithRespectTo(const PaintLayer*) const;
+
+    void addLayerHitTestRects(LayerHitTestRects&) const;
+
+    // Compute rects only for this layer
+    void computeSelfHitTestRects(LayerHitTestRects&) const;
+
+    // FIXME: This should probably return a ScrollableArea but a lot of internal methods are mistakenly exposed.
+    PaintLayerScrollableArea* scrollableArea() const { return m_scrollableArea.get(); }
+    PaintLayerClipper& clipper() { return m_clipper; }
+    const PaintLayerClipper& clipper() const { return m_clipper; }
+
+    inline bool isPositionedContainer() const
+    {
+        // FIXME: This is not in sync with containingBlock.
+        // LayoutObject::canContainFixedPositionObjects() should probably be used
+        // instead.
+        LayoutBoxModelObject* layerlayoutObject = layoutObject();
+        return isRootLayer() || layerlayoutObject->isPositioned() || hasTransformRelatedProperty();
+    }
+
+    bool scrollsOverflow() const;
+
+    CompositingReasons potentialCompositingReasonsFromStyle() const { return m_potentialCompositingReasonsFromStyle; }
+    void setPotentialCompositingReasonsFromStyle(CompositingReasons reasons) { ASSERT(reasons == (reasons & CompositingReasonComboAllStyleDeterminedReasons)); m_potentialCompositingReasonsFromStyle = reasons; }
+
+    bool hasStyleDeterminedDirectCompositingReasons() const { return m_potentialCompositingReasonsFromStyle & CompositingReasonComboAllDirectStyleDeterminedReasons; }
+
+    class AncestorDependentCompositingInputs {
+        DISALLOW_ALLOCATION();
+    public:
+        AncestorDependentCompositingInputs()
+            : opacityAncestor(0)
+            , transformAncestor(0)
+            , filterAncestor(0)
+            , clippingContainer(0)
+            , ancestorScrollingLayer(0)
+            , nearestFixedPositionLayer(0)
+            , scrollParent(0)
+            , clipParent(0)
+            , hasAncestorWithClipPath(false)
+        { }
+
+        IntRect clippedAbsoluteBoundingBox;
+        const PaintLayer* opacityAncestor;
+        const PaintLayer* transformAncestor;
+        const PaintLayer* filterAncestor;
+        const LayoutObject* clippingContainer;
+        const PaintLayer* ancestorScrollingLayer;
+        const PaintLayer* nearestFixedPositionLayer;
+
+        // A scroll parent is a compositor concept. It's only needed in blink
+        // because we need to use it as a promotion trigger. A layer has a
+        // scroll parent if neither its compositor scrolling ancestor, nor any
+        // other layer scrolled by this ancestor, is a stacking ancestor of this
+        // layer. Layers with scroll parents must be scrolled with the main
+        // scrolling layer by the compositor.
+        const PaintLayer* scrollParent;
+
+        // A clip parent is another compositor concept that has leaked into
+        // blink so that it may be used as a promotion trigger. Layers with clip
+        // parents escape the clip of a stacking tree ancestor. The compositor
+        // needs to know about clip parents in order to circumvent its normal
+        // clipping logic.
+        const PaintLayer* clipParent;
+
+        unsigned hasAncestorWithClipPath : 1;
+    };
+
+    class DescendantDependentCompositingInputs {
+        DISALLOW_ALLOCATION();
+    public:
+        DescendantDependentCompositingInputs()
+            : hasDescendantWithClipPath(false)
+            , hasNonIsolatedDescendantWithBlendMode(false)
+        { }
+
+        unsigned hasDescendantWithClipPath : 1;
+        unsigned hasNonIsolatedDescendantWithBlendMode : 1;
+    };
+
+    void setNeedsCompositingInputsUpdate();
+    bool childNeedsCompositingInputsUpdate() const { return m_childNeedsCompositingInputsUpdate; }
+    bool needsCompositingInputsUpdate() const
+    {
+        // While we're updating the compositing inputs, these values may differ.
+        // We should never be asking for this value when that is the case.
+        ASSERT(m_needsDescendantDependentCompositingInputsUpdate == m_needsAncestorDependentCompositingInputsUpdate);
+        return m_needsDescendantDependentCompositingInputsUpdate;
+    }
+
+    void updateAncestorDependentCompositingInputs(const AncestorDependentCompositingInputs&);
+    void updateDescendantDependentCompositingInputs(const DescendantDependentCompositingInputs&);
+    void didUpdateCompositingInputs();
+
+    const AncestorDependentCompositingInputs& ancestorDependentCompositingInputs() const { ASSERT(!m_needsAncestorDependentCompositingInputsUpdate); return m_ancestorDependentCompositingInputs; }
+    const DescendantDependentCompositingInputs& descendantDependentCompositingInputs() const { ASSERT(!m_needsDescendantDependentCompositingInputsUpdate); return m_descendantDependentCompositingInputs; }
+
+    IntRect clippedAbsoluteBoundingBox() const { return ancestorDependentCompositingInputs().clippedAbsoluteBoundingBox; }
+    const PaintLayer* opacityAncestor() const { return ancestorDependentCompositingInputs().opacityAncestor; }
+    const PaintLayer* transformAncestor() const { return ancestorDependentCompositingInputs().transformAncestor; }
+    const PaintLayer* filterAncestor() const { return ancestorDependentCompositingInputs().filterAncestor; }
+    const LayoutObject* clippingContainer() const { return ancestorDependentCompositingInputs().clippingContainer; }
+    const PaintLayer* ancestorScrollingLayer() const { return ancestorDependentCompositingInputs().ancestorScrollingLayer; }
+    const PaintLayer* nearestFixedPositionLayer() const { return ancestorDependentCompositingInputs().nearestFixedPositionLayer; }
+    PaintLayer* scrollParent() const { return const_cast<PaintLayer*>(ancestorDependentCompositingInputs().scrollParent); }
+    PaintLayer* clipParent() const { return const_cast<PaintLayer*>(ancestorDependentCompositingInputs().clipParent); }
+    bool hasAncestorWithClipPath() const { return ancestorDependentCompositingInputs().hasAncestorWithClipPath; }
+    bool hasDescendantWithClipPath() const { return descendantDependentCompositingInputs().hasDescendantWithClipPath; }
+    bool hasNonIsolatedDescendantWithBlendMode() const;
+
+    bool lostGroupedMapping() const { ASSERT(isAllowedToQueryCompositingState()); return m_lostGroupedMapping; }
+    void setLostGroupedMapping(bool b) { m_lostGroupedMapping = b; }
+
+    CompositingReasons compositingReasons() const { ASSERT(isAllowedToQueryCompositingState()); return m_compositingReasons; }
+    void setCompositingReasons(CompositingReasons, CompositingReasons mask = CompositingReasonAll);
+
+    bool hasCompositingDescendant() const { ASSERT(isAllowedToQueryCompositingState()); return m_hasCompositingDescendant; }
+    void setHasCompositingDescendant(bool);
+
+    bool shouldIsolateCompositedDescendants() const { ASSERT(isAllowedToQueryCompositingState()); return m_shouldIsolateCompositedDescendants; }
+    void setShouldIsolateCompositedDescendants(bool);
+
+    void updateDescendantDependentFlags();
+
+    void updateOrRemoveFilterEffectBuilder();
+
+    void updateSelfPaintingLayer();
+
+    PaintLayer* enclosingTransformedAncestor() const;
+    LayoutPoint computeOffsetFromTransformedAncestor() const;
+
+    void didUpdateNeedsCompositedScrolling();
+
+    bool hasSelfPaintingLayerDescendant() const
+    {
+        if (m_hasSelfPaintingLayerDescendantDirty)
+            updateHasSelfPaintingLayerDescendant();
+        ASSERT(!m_hasSelfPaintingLayerDescendantDirty);
+        return m_hasSelfPaintingLayerDescendant;
+    }
+    LayoutRect paintingExtent(const PaintLayer* rootLayer, const LayoutRect& paintDirtyRect, const LayoutSize& subPixelAccumulation, GlobalPaintFlags);
+    void appendSingleFragmentIgnoringPagination(PaintLayerFragments&, const PaintLayer* rootLayer, const LayoutRect& dirtyRect, ClipRectsCacheSlot, OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize, ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = 0, const LayoutSize& subPixelAccumulation = LayoutSize());
+    void collectFragments(PaintLayerFragments&, const PaintLayer* rootLayer, const LayoutRect& dirtyRect,
+        ClipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize,
+        ShouldRespectOverflowClip = RespectOverflowClip, const LayoutPoint* offsetFromRoot = 0,
+        const LayoutSize& subPixelAccumulation = LayoutSize(), const LayoutRect* layerBoundingBox = 0);
+
+    LayoutPoint layoutBoxLocation() const { return layoutObject()->isBox() ? toLayoutBox(layoutObject())->location() : LayoutPoint(); }
+
+    enum TransparencyClipBoxBehavior {
+        PaintingTransparencyClipBox,
+        HitTestingTransparencyClipBox
+    };
+
+    enum TransparencyClipBoxMode {
+        DescendantsOfTransparencyClipBox,
+        RootOfTransparencyClipBox
+    };
+
+    static LayoutRect transparencyClipBox(const PaintLayer*, const PaintLayer* rootLayer, TransparencyClipBoxBehavior transparencyBehavior,
+        TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumulation, GlobalPaintFlags = GlobalPaintNormalPhase);
+
+    bool needsRepaint() const { return m_needsRepaint; }
+    void setNeedsRepaint();
+    void clearNeedsRepaint() { m_needsRepaint = false; }
+
+    IntSize previousScrollOffsetAccumulationForPainting() const { return m_previousScrollOffsetAccumulationForPainting; }
+    void setPreviousScrollOffsetAccumulationForPainting(const IntSize& s) { m_previousScrollOffsetAccumulationForPainting = s; }
+
+    // For subsequence display items.
+    DisplayItemClient displayItemClient() const { return toDisplayItemClient(this); }
+
+private:
+    // Bounding box in the coordinates of this layer.
+    LayoutRect logicalBoundingBox() const;
+
+    bool hasOverflowControls() const;
+
+    void dirtyAncestorChainHasSelfPaintingLayerDescendantStatus();
+
+    // Returns true if the position changed.
+    bool updateLayerPosition();
+
+    void updateLayerPositionRecursive();
+    void updateLayerPositionsAfterScrollRecursive(const DoubleSize& scrollDelta, bool paintInvalidationContainerWasScrolled);
+
+    void setNextSibling(PaintLayer* next) { m_next = next; }
+    void setPreviousSibling(PaintLayer* prev) { m_previous = prev; }
+    void setFirstChild(PaintLayer* first) { m_first = first; }
+    void setLastChild(PaintLayer* last) { m_last = last; }
+
+    void updateHasSelfPaintingLayerDescendant() const;
+    PaintLayer* hitTestLayer(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&,
+        const LayoutRect& hitTestRect, const HitTestLocation&, bool appliedTransform,
+        const HitTestingTransformState* = 0, double* zOffset = 0);
+    PaintLayer* hitTestLayerByApplyingTransform(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&,
+        const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState* = 0, double* zOffset = 0,
+        const LayoutPoint& translationOffset = LayoutPoint());
+    PaintLayer* hitTestChildren(ChildrenIteration, PaintLayer* rootLayer, HitTestResult&,
+        const LayoutRect& hitTestRect, const HitTestLocation&,
+        const HitTestingTransformState*, double* zOffsetForDescendants, double* zOffset,
+        const HitTestingTransformState* unflattenedTransformState, bool depthSortDescendants);
+
+    PassRefPtr<HitTestingTransformState> createLocalTransformState(PaintLayer* rootLayer, PaintLayer* containerLayer,
+        const LayoutRect& hitTestRect, const HitTestLocation&,
+        const HitTestingTransformState* containerTransformState,
+        const LayoutPoint& translationOffset = LayoutPoint()) const;
+
+    bool hitTestContents(HitTestResult&, const LayoutRect& layerBounds, const HitTestLocation&, HitTestFilter) const;
+    bool hitTestContentsForFragments(const PaintLayerFragments&, HitTestResult&, const HitTestLocation&, HitTestFilter, bool& insideClipRect) const;
+    PaintLayer* hitTestTransformedLayerInFragments(PaintLayer* rootLayer, PaintLayer* containerLayer, HitTestResult&,
+        const LayoutRect& hitTestRect, const HitTestLocation&, const HitTestingTransformState*, double* zOffset, ClipRectsCacheSlot);
+
+    bool childBackgroundIsKnownToBeOpaqueInRect(const LayoutRect&) const;
+
+    bool shouldBeSelfPaintingLayer() const;
+
+    // FIXME: We should only create the stacking node if needed.
+    bool requiresStackingNode() const { return true; }
+    void updateStackingNode();
+
+    void updateReflectionInfo(const ComputedStyle*);
+
+    // FIXME: We could lazily allocate our ScrollableArea based on style properties ('overflow', ...)
+    // but for now, we are always allocating it for LayoutBox as it's safer. crbug.com/467721.
+    bool requiresScrollableArea() const { return layoutBox(); }
+    void updateScrollableArea();
+
+    void dirtyAncestorChainVisibleDescendantStatus();
+
+    bool attemptDirectCompositingUpdate(StyleDifference, const ComputedStyle* oldStyle);
+    void updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& newStyle);
+
+    void dirty3DTransformedDescendantStatus();
+    // Both updates the status, and returns true if descendants of this have 3d.
+    bool update3DTransformedDescendantStatus();
+
+    void updateOrRemoveFilterClients();
+
+    void updatePaginationRecursive(bool needsPaginationUpdate = false);
+    void clearPaginationRecursive();
+
+    void blockSelectionGapsBoundsChanged();
+
+    void markAncestorChainForNeedsRepaint();
+
+    PaintLayerType m_layerType;
+
+    // Self-painting layer is an optimization where we avoid the heavy Layer painting
+    // machinery for a Layer allocated only to handle the overflow clip case.
+    // FIXME(crbug.com/332791): Self-painting layer should be merged into the overflow-only concept.
+    unsigned m_isSelfPaintingLayer : 1;
+
+    // If have no self-painting descendants, we don't have to walk our children during painting. This can lead to
+    // significant savings, especially if the tree has lots of non-self-painting layers grouped together (e.g. table cells).
+    mutable unsigned m_hasSelfPaintingLayerDescendant : 1;
+    mutable unsigned m_hasSelfPaintingLayerDescendantDirty : 1;
+
+    const unsigned m_isRootLayer : 1;
+
+    unsigned m_visibleContentStatusDirty : 1;
+    unsigned m_hasVisibleContent : 1;
+    unsigned m_visibleDescendantStatusDirty : 1;
+    unsigned m_hasVisibleDescendant : 1;
+
+    unsigned m_hasVisibleNonLayerContent : 1;
+
+#if ENABLE(ASSERT)
+    unsigned m_needsPositionUpdate : 1;
+#endif
+
+    unsigned m_3DTransformedDescendantStatusDirty : 1;
+    // Set on a stacking context layer that has 3D descendants anywhere
+    // in a preserves3D hierarchy. Hint to do 3D-aware hit testing.
+    unsigned m_has3DTransformedDescendant : 1;
+
+    unsigned m_containsDirtyOverlayScrollbars : 1;
+
+    unsigned m_hasFilterInfo : 1;
+    unsigned m_needsAncestorDependentCompositingInputsUpdate : 1;
+    unsigned m_needsDescendantDependentCompositingInputsUpdate : 1;
+    unsigned m_childNeedsCompositingInputsUpdate : 1;
+
+    // Used only while determining what layers should be composited. Applies to the tree of z-order lists.
+    unsigned m_hasCompositingDescendant : 1;
+
+    // Applies to the real layout layer tree (i.e., the tree determined by the layer's parent and children and
+    // as opposed to the tree formed by the z-order and normal flow lists).
+    unsigned m_hasNonCompositedChild : 1;
+
+    // Should be for stacking contexts having unisolated blending descendants.
+    unsigned m_shouldIsolateCompositedDescendants : 1;
+
+    // True if this layout layer just lost its grouped mapping due to the CompositedLayerMapping being destroyed,
+    // and we don't yet know to what graphics layer this Layer will be assigned.
+    unsigned m_lostGroupedMapping : 1;
+
+    unsigned m_needsRepaint : 1;
+
+    LayoutBoxModelObject* m_layoutObject;
+
+    PaintLayer* m_parent;
+    PaintLayer* m_previous;
+    PaintLayer* m_next;
+    PaintLayer* m_first;
+    PaintLayer* m_last;
+
+    // Our current relative position offset.
+    LayoutSize m_offsetForInFlowPosition;
+
+    // Our (x,y) coordinates are in our parent layer's coordinate space.
+    LayoutPoint m_location;
+
+    // The layer's size.
+    //
+    // If the associated LayoutBoxModelObject is a LayoutBox, it's its border
+    // box. Otherwise, this is the LayoutInline's lines' bounding box.
+    IntSize m_size;
+
+    // Cached normal flow values for absolute positioned elements with static left/top values.
+    LayoutUnit m_staticInlinePosition;
+    LayoutUnit m_staticBlockPosition;
+
+    OwnPtr<TransformationMatrix> m_transform;
+
+    // Pointer to the enclosing Layer that caused us to be paginated. It is 0 if we are not paginated.
+    //
+    // See LayoutMultiColumnFlowThread and
+    // https://sites.google.com/a/chromium.org/dev/developers/design-documents/multi-column-layout
+    // for more information about the multicol implementation. It's important to understand the
+    // difference between flow thread coordinates and visual coordinates when working with multicol
+    // in Layer, since Layer is one of the few places where we have to worry about the
+    // visual ones. Internally we try to use flow-thread coordinates whenever possible.
+    PaintLayer* m_enclosingPaginationLayer;
+
+    // These compositing reasons are updated whenever style changes, not while updating compositing layers.
+    // They should not be used to infer the compositing state of this layer.
+    CompositingReasons m_potentialCompositingReasonsFromStyle;
+
+    // Once computed, indicates all that a layer needs to become composited using the CompositingReasons enum bitfield.
+    CompositingReasons m_compositingReasons;
+
+    DescendantDependentCompositingInputs m_descendantDependentCompositingInputs;
+    AncestorDependentCompositingInputs m_ancestorDependentCompositingInputs;
+
+    IntRect m_blockSelectionGapsBounds;
+
+    OwnPtr<CompositedLayerMapping> m_compositedLayerMapping;
+    OwnPtrWillBePersistent<PaintLayerScrollableArea> m_scrollableArea;
+
+    CompositedLayerMapping* m_groupedMapping;
+
+    PaintLayerClipper m_clipper; // FIXME: Lazily allocate?
+    OwnPtr<PaintLayerStackingNode> m_stackingNode;
+    OwnPtr<PaintLayerReflectionInfo> m_reflectionInfo;
+
+    LayoutSize m_subpixelAccumulation; // The accumulated subpixel offset of a composited layer's composited bounds compared to absolute coordinates.
+
+    IntSize m_previousScrollOffsetAccumulationForPainting;
+};
+
+} // namespace blink
+
+#ifndef NDEBUG
+// Outside the WebCore namespace for ease of invocation from gdb.
+void showLayerTree(const blink::PaintLayer*);
+void showLayerTree(const blink::LayoutObject*);
+#endif
+
+#endif // Layer_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
new file mode 100644
index 0000000..8d8d616
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -0,0 +1,369 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "core/paint/PaintLayerClipper.h"
+
+#include "core/frame/Settings.h"
+#include "core/layout/LayoutView.h"
+#include "core/paint/PaintLayer.h"
+
+namespace blink {
+
+static void adjustClipRectsForChildren(const LayoutObject& layoutObject, ClipRects& clipRects)
+{
+    EPosition position = layoutObject.style()->position();
+    // A fixed object is essentially the root of its containing block hierarchy, so when
+    // we encounter such an object, we reset our clip rects to the fixedClipRect.
+    if (position == FixedPosition) {
+        clipRects.setPosClipRect(clipRects.fixedClipRect());
+        clipRects.setOverflowClipRect(clipRects.fixedClipRect());
+        clipRects.setFixed(true);
+    } else if (position == RelativePosition) {
+        clipRects.setPosClipRect(clipRects.overflowClipRect());
+    } else if (position == AbsolutePosition) {
+        clipRects.setOverflowClipRect(clipRects.posClipRect());
+    }
+}
+
+static void applyClipRects(const ClipRectsContext& context, const LayoutObject& layoutObject, LayoutPoint offset, ClipRects& clipRects)
+{
+    ASSERT(layoutObject.hasOverflowClip() || layoutObject.hasClip());
+    LayoutView* view = layoutObject.view();
+    ASSERT(view);
+    if (clipRects.fixed() && context.rootLayer->layoutObject() == view)
+        offset -= toIntSize(view->frameView()->scrollPosition());
+    if (layoutObject.hasOverflowClip()) {
+        ClipRect newOverflowClip = toLayoutBox(layoutObject).overflowClipRect(offset, context.scrollbarRelevancy);
+        newOverflowClip.setHasRadius(layoutObject.style()->hasBorderRadius());
+        clipRects.setOverflowClipRect(intersection(newOverflowClip, clipRects.overflowClipRect()));
+        if (layoutObject.isPositioned())
+            clipRects.setPosClipRect(intersection(newOverflowClip, clipRects.posClipRect()));
+        if (layoutObject.isLayoutView())
+            clipRects.setFixedClipRect(intersection(newOverflowClip, clipRects.fixedClipRect()));
+    }
+    if (layoutObject.hasClip()) {
+        LayoutRect newClip = toLayoutBox(layoutObject).clipRect(offset);
+        clipRects.setPosClipRect(intersection(newClip, clipRects.posClipRect()).setIsClippedByClipCss());
+        clipRects.setOverflowClipRect(intersection(newClip, clipRects.overflowClipRect()).setIsClippedByClipCss());
+        clipRects.setFixedClipRect(intersection(newClip, clipRects.fixedClipRect()).setIsClippedByClipCss());
+
+    }
+}
+
+PaintLayerClipper::PaintLayerClipper(const LayoutBoxModelObject& layoutObject)
+    : m_layoutObject(layoutObject)
+{
+}
+
+ClipRects* PaintLayerClipper::clipRectsIfCached(const ClipRectsContext& context) const
+{
+    ASSERT(context.usesCache());
+    if (!m_cache)
+        return 0;
+    ClipRectsCache::Entry& entry = m_cache->get(context.cacheSlot());
+    // FIXME: We used to ASSERT that we always got a consistent root layer.
+    // We should add a test that has an inconsistent root. See
+    // http://crbug.com/366118 for an example.
+    if (context.rootLayer != entry.root)
+        return 0;
+    ASSERT(entry.scrollbarRelevancy == context.scrollbarRelevancy);
+#ifdef CHECK_CACHED_CLIP_RECTS
+    // This code is useful to check cached clip rects, but is too expensive to leave enabled in debug builds by default.
+    ClipRectsContext tempContext(context);
+    tempContext.cacheSlot = UncachedClipRects;
+    RefPtr<ClipRects> clipRects = ClipRects::create();
+    calculateClipRects(tempContext, *clipRects);
+    ASSERT(clipRects == *entry.clipRects);
+#endif
+    return entry.clipRects.get();
+}
+ClipRects* PaintLayerClipper::storeClipRectsInCache(const ClipRectsContext& context, ClipRects* parentClipRects, const ClipRects& clipRects) const
+{
+    ClipRectsCache::Entry& entry = cache().get(context.cacheSlot());
+    entry.root = context.rootLayer;
+#if ENABLE(ASSERT)
+    entry.scrollbarRelevancy = context.scrollbarRelevancy;
+#endif
+    if (parentClipRects) {
+        // If our clip rects match the clip rects of our parent, we share storage.
+        if (clipRects == *parentClipRects) {
+            entry.clipRects = parentClipRects;
+            return parentClipRects;
+        }
+    }
+    entry.clipRects = ClipRects::create(clipRects);
+    return entry.clipRects.get();
+}
+ClipRects* PaintLayerClipper::getClipRects(const ClipRectsContext& context) const
+{
+    if (ClipRects* result = clipRectsIfCached(context))
+        return result;
+    // Note that it's important that we call getClipRects on our parent
+    // before we call calculateClipRects so that calculateClipRects will hit
+    // the cache.
+    ClipRects* parentClipRects = 0;
+    if (context.rootLayer != m_layoutObject.layer() && m_layoutObject.layer()->parent())
+        parentClipRects = m_layoutObject.layer()->parent()->clipper().getClipRects(context);
+    RefPtr<ClipRects> clipRects = ClipRects::create();
+    calculateClipRects(context, *clipRects);
+    return storeClipRectsInCache(context, parentClipRects, *clipRects);
+}
+
+void PaintLayerClipper::clearClipRectsIncludingDescendants()
+{
+    m_cache = nullptr;
+
+    for (PaintLayer* layer = m_layoutObject.layer()->firstChild(); layer; layer = layer->nextSibling()) {
+        layer->clipper().clearClipRectsIncludingDescendants();
+    }
+}
+
+void PaintLayerClipper::clearClipRectsIncludingDescendants(ClipRectsCacheSlot cacheSlot)
+{
+    if (m_cache)
+        m_cache->clear(cacheSlot);
+
+    for (PaintLayer* layer = m_layoutObject.layer()->firstChild(); layer; layer = layer->nextSibling()) {
+        layer->clipper().clearClipRectsIncludingDescendants(cacheSlot);
+    }
+}
+
+LayoutRect PaintLayerClipper::childrenClipRect() const
+{
+    // FIXME: border-radius not accounted for.
+    // FIXME: Flow thread based columns not accounted for.
+    PaintLayer* clippingRootLayer = clippingRootForPainting();
+    LayoutRect layerBounds;
+    ClipRect backgroundRect, foregroundRect;
+    // Need to use uncached clip rects, because the value of 'dontClipToOverflow' may be different from the painting path (<rdar://problem/11844909>).
+    ClipRectsContext context(clippingRootLayer, UncachedClipRects);
+    calculateRects(context, LayoutRect(m_layoutObject.view()->unscaledDocumentRect()), layerBounds, backgroundRect, foregroundRect);
+    return LayoutRect(clippingRootLayer->layoutObject()->localToAbsoluteQuad(FloatQuad(FloatRect(foregroundRect.rect()))).enclosingBoundingBox());
+}
+
+LayoutRect PaintLayerClipper::localClipRect() const
+{
+    // FIXME: border-radius not accounted for.
+    PaintLayer* clippingRootLayer = clippingRootForPainting();
+    LayoutRect layerBounds;
+    ClipRect backgroundRect, foregroundRect;
+    ClipRectsContext context(clippingRootLayer, PaintingClipRects);
+    calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), layerBounds, backgroundRect, foregroundRect);
+
+    LayoutRect clipRect = backgroundRect.rect();
+    // TODO(chrishtr): avoid converting to IntRect and back.
+    if (clipRect == LayoutRect(LayoutRect::infiniteIntRect()))
+        return clipRect;
+
+    LayoutPoint clippingRootOffset;
+    m_layoutObject.layer()->convertToLayerCoords(clippingRootLayer, clippingRootOffset);
+    clipRect.moveBy(-clippingRootOffset);
+
+    return clipRect;
+}
+
+void PaintLayerClipper::calculateRects(const ClipRectsContext& context, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
+    ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutPoint* offsetFromRoot) const
+{
+    bool isClippingRoot = m_layoutObject.layer() == context.rootLayer;
+
+    if (!isClippingRoot && m_layoutObject.layer()->parent()) {
+        backgroundRect = backgroundClipRect(context);
+        backgroundRect.move(context.subPixelAccumulation);
+        backgroundRect.intersect(paintDirtyRect);
+    } else {
+        backgroundRect = paintDirtyRect;
+    }
+
+    foregroundRect = backgroundRect;
+
+    LayoutPoint offset;
+    if (offsetFromRoot)
+        offset = *offsetFromRoot;
+    else
+        m_layoutObject.layer()->convertToLayerCoords(context.rootLayer, offset);
+    layerBounds = LayoutRect(offset, LayoutSize(m_layoutObject.layer()->size()));
+
+    // Update the clip rects that will be passed to child layers.
+    if (m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) {
+        foregroundRect.intersect(toLayoutBox(m_layoutObject).overflowClipRect(offset, context.scrollbarRelevancy));
+        if (m_layoutObject.style()->hasBorderRadius())
+            foregroundRect.setHasRadius(true);
+
+        // FIXME: Does not do the right thing with columns yet, since we don't yet factor in the
+        // individual column boxes as overflow.
+
+        // The LayoutView is special since its overflow clipping rect may be larger than its box rect (crbug.com/492871).
+        LayoutRect layerBoundsWithVisualOverflow = m_layoutObject.isLayoutView() ? toLayoutView(m_layoutObject).viewRect() : toLayoutBox(m_layoutObject).visualOverflowRect();
+        toLayoutBox(m_layoutObject).flipForWritingMode(layerBoundsWithVisualOverflow); // PaintLayer are in physical coordinates, so the overflow has to be flipped.
+        layerBoundsWithVisualOverflow.moveBy(offset);
+        backgroundRect.intersect(layerBoundsWithVisualOverflow);
+    }
+
+    // CSS clip (different than clipping due to overflow) can clip to any box, even if it falls outside of the border box.
+    if (m_layoutObject.hasClip()) {
+        // Clip applies to *us* as well, so go ahead and update the damageRect.
+        LayoutRect newPosClip = toLayoutBox(m_layoutObject).clipRect(offset);
+        backgroundRect.intersect(newPosClip);
+        backgroundRect.setIsClippedByClipCss();
+        foregroundRect.intersect(newPosClip);
+        foregroundRect.setIsClippedByClipCss();
+    }
+}
+
+void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
+{
+    bool rootLayerScrolls = m_layoutObject.document().settings() && m_layoutObject.document().settings()->rootLayerScrolls();
+    if (!m_layoutObject.layer()->parent() && !rootLayerScrolls) {
+        // The root layer's clip rect is always infinite.
+        clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
+        return;
+    }
+
+    bool isClippingRoot = m_layoutObject.layer() == context.rootLayer;
+
+    // For transformed layers, the root layer was shifted to be us, so there is no need to
+    // examine the parent. We want to cache clip rects with us as the root.
+    PaintLayer* parentLayer = !isClippingRoot ? m_layoutObject.layer()->parent() : 0;
+    // Ensure that our parent's clip has been calculated so that we can examine the values.
+    if (parentLayer) {
+        // FIXME: Why don't we just call getClipRects here?
+        if (context.usesCache() && parentLayer->clipper().cachedClipRects(context)) {
+            clipRects = *parentLayer->clipper().cachedClipRects(context);
+        } else {
+            parentLayer->clipper().calculateClipRects(context, clipRects);
+        }
+    } else {
+        clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
+    }
+
+    adjustClipRectsForChildren(m_layoutObject, clipRects);
+
+    if ((m_layoutObject.hasOverflowClip() && shouldRespectOverflowClip(context)) || m_layoutObject.hasClip()) {
+        // This offset cannot use convertToLayerCoords, because sometimes our rootLayer may be across
+        // some transformed layer boundary, for example, in the PaintLayerCompositor overlapMap, where
+        // clipRects are needed in view space.
+        applyClipRects(context, m_layoutObject, roundedLayoutPoint(m_layoutObject.localToContainerPoint(FloatPoint(), context.rootLayer->layoutObject())), clipRects);
+    }
+}
+
+static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, EPosition position)
+{
+    if (position == FixedPosition)
+        return parentRects.fixedClipRect();
+
+    if (position == AbsolutePosition)
+        return parentRects.posClipRect();
+
+    return parentRects.overflowClipRect();
+}
+
+ClipRect PaintLayerClipper::backgroundClipRect(const ClipRectsContext& context) const
+{
+    ASSERT(m_layoutObject.layer()->parent());
+    ASSERT(m_layoutObject.view());
+
+    RefPtr<ClipRects> parentClipRects = ClipRects::create();
+    if (m_layoutObject.layer() == context.rootLayer)
+        parentClipRects->reset(LayoutRect(LayoutRect::infiniteIntRect()));
+    else
+        m_layoutObject.layer()->parent()->clipper().getOrCalculateClipRects(context, *parentClipRects);
+
+    ClipRect result = backgroundClipRectForPosition(*parentClipRects, m_layoutObject.style()->position());
+
+    // Note: infinite clipRects should not be scrolled here, otherwise they will accidentally no longer be considered infinite.
+    if (parentClipRects->fixed() && context.rootLayer->layoutObject() == m_layoutObject.view() && result != LayoutRect(LayoutRect::infiniteIntRect()))
+        result.move(toIntSize(m_layoutObject.view()->frameView()->scrollPosition()));
+
+    return result;
+}
+
+void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, ClipRects& clipRects) const
+{
+    if (context.usesCache())
+        clipRects = *getClipRects(context);
+    else
+        calculateClipRects(context, clipRects);
+}
+
+PaintLayer* PaintLayerClipper::clippingRootForPainting() const
+{
+    const PaintLayer* current = m_layoutObject.layer();
+    // FIXME: getting rid of current->hasCompositedLayerMapping() here breaks the
+    // compositing/backing/no-backing-for-clip.html layout test, because there is a
+    // "composited but paints into ancestor" layer involved. However, it doesn't make sense that
+    // that check would be appropriate here but not inside the while loop below.
+    if (current->isPaintInvalidationContainer() || current->hasCompositedLayerMapping())
+        return const_cast<PaintLayer*>(current);
+
+    while (current) {
+        if (current->isRootLayer())
+            return const_cast<PaintLayer*>(current);
+
+        current = current->compositingContainer();
+        ASSERT(current);
+        if (current->transform() || current->isPaintInvalidationContainer())
+            return const_cast<PaintLayer*>(current);
+    }
+
+    ASSERT_NOT_REACHED();
+    return 0;
+}
+
+bool PaintLayerClipper::shouldRespectOverflowClip(const ClipRectsContext& context) const
+{
+    PaintLayer* layer = m_layoutObject.layer();
+    if (layer != context.rootLayer)
+        return true;
+
+    if (context.respectOverflowClip == IgnoreOverflowClip)
+        return false;
+
+    if (layer->isRootLayer() && context.respectOverflowClipForViewport == IgnoreOverflowClip)
+        return false;
+
+    return true;
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.h b/third_party/WebKit/Source/core/paint/PaintLayerClipper.h
new file mode 100644
index 0000000..5e5c494
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.h
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef PaintLayerClipper_h
+#define PaintLayerClipper_h
+
+#include "core/layout/ClipRectsCache.h"
+#include "core/layout/LayoutBox.h"
+#include "wtf/Allocator.h"
+
+namespace blink {
+
+class PaintLayer;
+
+enum ShouldRespectOverflowClip {
+    IgnoreOverflowClip,
+    RespectOverflowClip
+};
+
+class ClipRectsContext {
+    STACK_ALLOCATED();
+public:
+    ClipRectsContext(const PaintLayer* root, ClipRectsCacheSlot slot, OverlayScrollbarSizeRelevancy relevancy = IgnoreOverlayScrollbarSize, const LayoutSize& accumulation = LayoutSize())
+        : rootLayer(root)
+        , scrollbarRelevancy(relevancy)
+        , m_cacheSlot(slot)
+        , subPixelAccumulation(accumulation)
+        , respectOverflowClip(slot == PaintingClipRectsIgnoringOverflowClip ? IgnoreOverflowClip : RespectOverflowClip)
+        , respectOverflowClipForViewport(slot == RootRelativeClipRectsIgnoringViewportClip ? IgnoreOverflowClip : RespectOverflowClip)
+    {
+    }
+
+    void setIgnoreOverflowClip()
+    {
+        ASSERT(!usesCache() || m_cacheSlot == PaintingClipRects);
+        ASSERT(respectOverflowClip == RespectOverflowClip);
+        if (usesCache())
+            m_cacheSlot = PaintingClipRectsIgnoringOverflowClip;
+        respectOverflowClip = IgnoreOverflowClip;
+    }
+
+    bool usesCache() const
+    {
+        return m_cacheSlot != UncachedClipRects;
+    }
+
+    ClipRectsCacheSlot cacheSlot() const
+    {
+        return m_cacheSlot;
+    }
+
+    bool isComputingPaintingRect() const
+    {
+        return m_cacheSlot == PaintingClipRectsIgnoringOverflowClip || m_cacheSlot == PaintingClipRects;
+    }
+
+    const PaintLayer* rootLayer;
+    const OverlayScrollbarSizeRelevancy scrollbarRelevancy;
+
+private:
+    friend class PaintLayerClipper;
+
+    ClipRectsCacheSlot m_cacheSlot;
+    LayoutSize subPixelAccumulation;
+    ShouldRespectOverflowClip respectOverflowClip;
+    ShouldRespectOverflowClip respectOverflowClipForViewport;
+};
+
+// PaintLayerClipper is responsible for computing and caching clip
+// rects.
+//
+// The main reason for this cache is that we compute the clip rects during
+// a layout tree walk but need them during a paint tree walk (see example
+// below for some explanations).
+//
+// A lot of complexity in this class come from the difference in inheritance
+// between 'overflow' and 'clip':
+// * 'overflow' applies based on the containing blocks chain.
+//    (http://www.w3.org/TR/CSS2/visufx.html#propdef-overflow)
+// * 'clip' applies to all descendants.
+//    (http://www.w3.org/TR/CSS2/visufx.html#propdef-clip)
+//
+// Let's take an example:
+// <!DOCTYPE html>
+// <div id="container" style="position: absolute; height: 100px; width: 100px">
+//   <div id="inflow" style="height: 200px; width: 200px;
+//       background-color: purple"></div>
+//   <div id="fixed" style="height: 200px; width: 200px; position: fixed;
+//       background-color: orange"></div>
+// </div>
+//
+// The paint tree looks like:
+//               html
+//              /   |
+//             /    |
+//            /     |
+//      container  fixed
+//         |
+//         |
+//       inflow
+//
+// If we add "overflow: hidden" to #container, the overflow clip will apply to
+// #inflow but not to #fixed. That's because #fixed's containing block is above
+// #container and thus 'overflow' doesn't apply to it. During our tree walk,
+// #fixed is a child of #container, which is the reason why we keep 3 clip rects
+// depending on the 'position' of the elements.
+//
+// Now instead if we add "clip: rect(0px, 100px, 100px, 0px)" to #container,
+// the clip will apply to both #inflow and #fixed. That's because 'clip'
+// applies to any descendant, regardless of containing blocks. Note that
+// #container and #fixed are siblings in the paint tree but #container does
+// clip #fixed. This is the reason why we compute the painting clip rects during
+// a layout tree walk and cache them for painting.
+//
+// This class is NOT DEPRECATED, PaintLayer is and we match its
+// naming.
+class PaintLayerClipper {
+    DISALLOW_ALLOCATION();
+    WTF_MAKE_NONCOPYABLE(PaintLayerClipper);
+public:
+    explicit PaintLayerClipper(const LayoutBoxModelObject&);
+
+    void clearClipRectsIncludingDescendants();
+    void clearClipRectsIncludingDescendants(ClipRectsCacheSlot);
+
+    LayoutRect childrenClipRect() const; // Returns the foreground clip rect of the layer in the document's coordinate space.
+    LayoutRect localClipRect() const; // Returns the background clip rect of the layer in the local coordinate space.
+
+    ClipRects* getClipRects(const ClipRectsContext&) const;
+
+    ClipRect backgroundClipRect(const ClipRectsContext&) const;
+
+    // This method figures out our layerBounds in coordinates relative to
+    // |rootLayer|. It also computes our background and foreground clip rects
+    // for painting/event handling.
+    // Pass offsetFromRoot if known.
+    void calculateRects(const ClipRectsContext&, const LayoutRect& paintDirtyRect, LayoutRect& layerBounds,
+        ClipRect& backgroundRect, ClipRect& foregroundRect, const LayoutPoint* offsetFromRoot = 0) const;
+private:
+    void calculateClipRects(const ClipRectsContext&, ClipRects&) const;
+    ClipRects* clipRectsIfCached(const ClipRectsContext&) const;
+    ClipRects* storeClipRectsInCache(const ClipRectsContext&, ClipRects* parentClipRects, const ClipRects&) const;
+
+    // cachedClipRects looks buggy: It doesn't check whether context.rootLayer and entry.root match.
+    // FIXME: Move callers to clipRectsIfCached, which does the proper checks.
+    ClipRects* cachedClipRects(const ClipRectsContext& context) const
+    {
+        return m_cache ? m_cache->get(context.cacheSlot()).clipRects.get() : 0;
+    }
+    void getOrCalculateClipRects(const ClipRectsContext&, ClipRects&) const;
+
+    PaintLayer* clippingRootForPainting() const;
+
+    ClipRectsCache& cache() const
+    {
+        if (!m_cache)
+            m_cache = adoptPtr(new ClipRectsCache);
+        return *m_cache;
+    }
+
+    bool shouldRespectOverflowClip(const ClipRectsContext&) const;
+
+    // FIXME: Could this be a LayoutBox?
+    const LayoutBoxModelObject& m_layoutObject;
+
+    // Lazily created by 'cache() const'.
+    mutable OwnPtr<ClipRectsCache> m_cache;
+};
+
+} // namespace blink
+
+#endif // LayerClipper_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerFilterInfo.cpp b/third_party/WebKit/Source/core/paint/PaintLayerFilterInfo.cpp
new file mode 100644
index 0000000..5b9ea50a
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerFilterInfo.cpp
@@ -0,0 +1,152 @@
+/*
+ * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "core/paint/PaintLayerFilterInfo.h"
+
+#include "core/fetch/DocumentResourceReference.h"
+#include "core/layout/svg/LayoutSVGResourceContainer.h"
+#include "core/layout/svg/ReferenceFilterBuilder.h"
+#include "core/paint/FilterEffectBuilder.h"
+#include "core/paint/PaintLayer.h"
+#include "core/svg/SVGFilterElement.h"
+
+namespace blink {
+
+PaintLayerFilterInfoMap* PaintLayerFilterInfo::s_filterMap = 0;
+
+PaintLayerFilterInfo* PaintLayerFilterInfo::filterInfoForLayer(const PaintLayer* layer)
+{
+    if (!s_filterMap)
+        return 0;
+    PaintLayerFilterInfoMap::iterator iter = s_filterMap->find(layer);
+    return (iter != s_filterMap->end()) ? iter->value : 0;
+}
+
+PaintLayerFilterInfo* PaintLayerFilterInfo::createFilterInfoForLayerIfNeeded(PaintLayer* layer)
+{
+    if (!s_filterMap)
+        s_filterMap = new PaintLayerFilterInfoMap();
+
+    PaintLayerFilterInfoMap::iterator iter = s_filterMap->find(layer);
+    if (iter != s_filterMap->end()) {
+        ASSERT(layer->hasFilterInfo());
+        return iter->value;
+    }
+
+    PaintLayerFilterInfo* filter = new PaintLayerFilterInfo(layer);
+    s_filterMap->set(layer, filter);
+    layer->setHasFilterInfo(true);
+    return filter;
+}
+
+void PaintLayerFilterInfo::removeFilterInfoForLayer(PaintLayer* layer)
+{
+    if (!s_filterMap)
+        return;
+    PaintLayerFilterInfo* filter = s_filterMap->take(layer);
+    if (s_filterMap->isEmpty()) {
+        delete s_filterMap;
+        s_filterMap = 0;
+    }
+    if (!filter) {
+        ASSERT(!layer->hasFilterInfo());
+        return;
+    }
+    layer->setHasFilterInfo(false);
+    delete filter;
+}
+
+PaintLayerFilterInfo::PaintLayerFilterInfo(PaintLayer* layer)
+    : m_layer(layer)
+{
+}
+
+PaintLayerFilterInfo::~PaintLayerFilterInfo()
+{
+    removeReferenceFilterClients();
+}
+
+void PaintLayerFilterInfo::setBuilder(PassRefPtrWillBeRawPtr<FilterEffectBuilder> builder)
+{
+    m_builder = builder;
+}
+
+void PaintLayerFilterInfo::notifyFinished(Resource*)
+{
+    m_layer->filterNeedsPaintInvalidation();
+}
+
+void PaintLayerFilterInfo::updateReferenceFilterClients(const FilterOperations& operations)
+{
+    removeReferenceFilterClients();
+    for (size_t i = 0; i < operations.size(); ++i) {
+        RefPtrWillBeRawPtr<FilterOperation> filterOperation = operations.operations().at(i);
+        if (filterOperation->type() != FilterOperation::REFERENCE)
+            continue;
+        ReferenceFilterOperation* referenceFilterOperation = toReferenceFilterOperation(filterOperation.get());
+        DocumentResourceReference* documentReference = ReferenceFilterBuilder::documentResourceReference(referenceFilterOperation);
+        DocumentResource* cachedSVGDocument = documentReference ? documentReference->document() : 0;
+
+        if (cachedSVGDocument) {
+            // Reference is external; wait for notifyFinished().
+            cachedSVGDocument->addClient(this);
+            m_externalSVGReferences.append(cachedSVGDocument);
+        } else {
+            // Reference is internal; add layer as a client so we can trigger
+            // filter paint invalidation on SVG attribute change.
+            Element* filter = m_layer->layoutObject()->node()->document().getElementById(referenceFilterOperation->fragment());
+            if (!isSVGFilterElement(filter))
+                continue;
+            if (filter->layoutObject())
+                toLayoutSVGResourceContainer(filter->layoutObject())->addClientLayer(m_layer);
+            else
+                toSVGFilterElement(filter)->addClient(m_layer->layoutObject()->node());
+            m_internalSVGReferences.append(filter);
+        }
+    }
+}
+
+void PaintLayerFilterInfo::removeReferenceFilterClients()
+{
+    for (size_t i = 0; i < m_externalSVGReferences.size(); ++i)
+        m_externalSVGReferences.at(i)->removeClient(this);
+    m_externalSVGReferences.clear();
+    for (size_t i = 0; i < m_internalSVGReferences.size(); ++i) {
+        Element* filter = m_internalSVGReferences.at(i).get();
+        if (filter->layoutObject())
+            toLayoutSVGResourceContainer(filter->layoutObject())->removeClientLayer(m_layer);
+        else
+            toSVGFilterElement(filter)->removeClient(m_layer->layoutObject()->node());
+    }
+    m_internalSVGReferences.clear();
+}
+
+} // namespace blink
+
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerFilterInfo.h b/third_party/WebKit/Source/core/paint/PaintLayerFilterInfo.h
new file mode 100644
index 0000000..277d92c
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerFilterInfo.h
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2012 Adobe Systems Incorporated. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer.
+ * 2. Redistributions in binary form must reproduce the above
+ *    copyright notice, this list of conditions and the following
+ *    disclaimer in the documentation and/or other materials
+ *    provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef PaintLayerFilterInfo_h
+#define PaintLayerFilterInfo_h
+
+#include "core/dom/Element.h"
+#include "core/fetch/DocumentResource.h"
+#include "platform/geometry/LayoutRect.h"
+#include "platform/graphics/filters/FilterOperation.h"
+#include "wtf/HashMap.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/PassRefPtr.h"
+#include "wtf/RefPtr.h"
+
+namespace blink {
+
+class FilterEffectBuilder;
+class FilterOperations;
+class PaintLayer;
+class PaintLayerFilterInfo;
+
+typedef HashMap<const PaintLayer*, PaintLayerFilterInfo*> PaintLayerFilterInfoMap;
+
+class PaintLayerFilterInfo final : public DocumentResourceClient {
+    WTF_MAKE_FAST_ALLOCATED(PaintLayerFilterInfo);
+    WTF_MAKE_NONCOPYABLE(PaintLayerFilterInfo);
+public:
+    static PaintLayerFilterInfo* filterInfoForLayer(const PaintLayer*);
+    static PaintLayerFilterInfo* createFilterInfoForLayerIfNeeded(PaintLayer*);
+    static void removeFilterInfoForLayer(PaintLayer*);
+
+    FilterEffectBuilder* builder() const { return m_builder.get(); }
+    void setBuilder(PassRefPtrWillBeRawPtr<FilterEffectBuilder>);
+
+    void updateReferenceFilterClients(const FilterOperations&);
+    void notifyFinished(Resource*) override;
+    void removeReferenceFilterClients();
+
+private:
+    PaintLayerFilterInfo(PaintLayer*);
+    ~PaintLayerFilterInfo() override;
+
+    PaintLayer* m_layer;
+
+    RefPtrWillBePersistent<FilterEffectBuilder> m_builder;
+
+    static PaintLayerFilterInfoMap* s_filterMap;
+    WillBePersistentHeapVector<RefPtrWillBeMember<Element>> m_internalSVGReferences;
+    Vector<ResourcePtr<DocumentResource>> m_externalSVGReferences;
+};
+
+} // namespace blink
+
+
+#endif // PaintLayerFilterInfo_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerFragment.h b/third_party/WebKit/Source/core/paint/PaintLayerFragment.h
new file mode 100644
index 0000000..34509a1
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerFragment.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PaintLayerFragment_h
+#define PaintLayerFragment_h
+
+#include "core/layout/ClipRect.h"
+#include "wtf/Allocator.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+// PaintLayerFragment is the representation of a fragment.
+// https://drafts.csswg.org/css-break/#fragment
+//
+// Fragments are a paint/hit-testing only concept in Blink.
+// Every box has at least one fragment, even if it is not paginated/fragmented.
+// If a box has more than one fragment (i.e. is paginated by an ancestor), the
+// fragments are called "paginated fragments". Note that this is a Blink
+// vocabulary extension and doesn't come from the specification.
+//
+// The fragments are collected by calling PaintLayer::collectFragments
+// on every box once per paint/hit-testing operation.
+struct PaintLayerFragment {
+    ALLOW_ONLY_INLINE_ALLOCATION();
+public:
+    void setRects(const LayoutRect& bounds, const ClipRect& background, const ClipRect& foreground)
+    {
+        layerBounds = bounds;
+        backgroundRect = background;
+        foregroundRect = foreground;
+    }
+
+    void moveBy(const LayoutPoint& offset)
+    {
+        layerBounds.moveBy(offset);
+        backgroundRect.moveBy(offset);
+        foregroundRect.moveBy(offset);
+        paginationClip.moveBy(offset);
+    }
+
+    void intersect(const LayoutRect& rect)
+    {
+        backgroundRect.intersect(rect);
+        foregroundRect.intersect(rect);
+    }
+
+    // Set on all fragments.
+    //
+    // The PaintLayer's size in the associated ClipRectsContext's
+    // rootLayer coordinate system. See PaintLayer::m_size for the
+    // exact rectangle.
+    //
+    // TODO(jchaffraix): We should store the rootLayer here to ensure we don't
+    // mix coordinate systems by mistake.
+    LayoutRect layerBounds;
+
+    // Set on all fragments.
+    //
+    // The rectangle used to clip the background.
+    //
+    // The rectangle is the rectangle-to-paint if no clip applies to the
+    // fragment. It is the intersection between the visual overflow rect
+    // and any overflow clips or 'clip' properties. It is also intersected with
+    // |paginationClip| if it is present.
+    //
+    // See PaintLayerClipper::calculateRects.
+    ClipRect backgroundRect;
+
+    // Set on all fragments.
+    //
+    // The rectangle used to clip the content (foreground).
+    //
+    // The rectangle is the rectangle-to-paint if no clip applies to the
+    // fragment. If there is an overflow clip, the rectangle-to-paint is
+    // intersected with the border box rect without the scrollbars (content gets
+    // clipped at their edge). Also any enclosing 'clip' properties get applied
+    // to the intersected rectangle. It is also intersected with
+    // |paginationClip| if it is present.
+    //
+    // See PaintLayerClipper::calculateRects.
+    ClipRect foregroundRect;
+
+    // Only set on paginated fragments.
+    //
+    // The physical translation to apply to shift the layer when
+    // painting/hit-testing.
+    LayoutPoint paginationOffset;
+
+    // Only set on paginated fragments.
+    //
+    // This is the additional clip from the fragmentainer (i.e. column or
+    // page) that applies to the layer. |backgroundRect| and |foregroundRect|
+    // are intersected with it (see collectFragments).
+    //
+    // It is in layer-local (physical) coordinates.
+    LayoutRect paginationClip;
+};
+
+typedef Vector<PaintLayerFragment, 1> PaintLayerFragments;
+
+} // namespace blink
+
+#endif // PaintLayerFragment_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
new file mode 100644
index 0000000..5043b9fd
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -0,0 +1,703 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/paint/PaintLayerPainter.h"
+
+#include "core/frame/Settings.h"
+#include "core/layout/ClipPathOperation.h"
+#include "core/layout/LayoutBlock.h"
+#include "core/layout/LayoutView.h"
+#include "core/layout/svg/LayoutSVGResourceClipper.h"
+#include "core/page/Page.h"
+#include "core/paint/CompositingRecorder.h"
+#include "core/paint/FilterPainter.h"
+#include "core/paint/LayerClipRecorder.h"
+#include "core/paint/LayerFixedPositionRecorder.h"
+#include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
+#include "core/paint/SVGClipPainter.h"
+#include "core/paint/ScopeRecorder.h"
+#include "core/paint/ScrollRecorder.h"
+#include "core/paint/ScrollableAreaPainter.h"
+#include "core/paint/Transform3DRecorder.h"
+#include "platform/geometry/FloatPoint3D.h"
+#include "platform/graphics/GraphicsLayer.h"
+#include "platform/graphics/paint/ClipPathRecorder.h"
+#include "platform/graphics/paint/ClipRecorder.h"
+#include "platform/graphics/paint/CompositingDisplayItem.h"
+#include "platform/graphics/paint/SubsequenceRecorder.h"
+#include "platform/graphics/paint/Transform3DDisplayItem.h"
+#include "wtf/Optional.h"
+
+namespace blink {
+
+static inline bool shouldSuppressPaintingLayer(PaintLayer* layer)
+{
+    // Avoid painting descendants of the root layer when stylesheets haven't loaded. This eliminates FOUC.
+    // It's ok not to draw, because later on, when all the stylesheets do load, updateStyleSelector on the Document
+    // will do a full paintInvalidationForWholeLayoutObject().
+    if (layer->layoutObject()->document().didLayoutWithPendingStylesheets() && !layer->isRootLayer() && !layer->layoutObject()->isDocumentElement())
+        return true;
+
+    return false;
+}
+
+void PaintLayerPainter::paint(GraphicsContext* context, const LayoutRect& damageRect, const GlobalPaintFlags globalPaintFlags, LayoutObject* paintingRoot, PaintLayerFlags paintFlags)
+{
+    PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(damageRect)), globalPaintFlags, LayoutSize(), paintingRoot);
+    if (shouldPaintLayerInSoftwareMode(globalPaintFlags, paintFlags))
+        paintLayer(context, paintingInfo, paintFlags);
+}
+
+static ShouldRespectOverflowClip shouldRespectOverflowClip(PaintLayerFlags paintFlags, const LayoutObject* layoutObject)
+{
+    return (paintFlags & PaintLayerPaintingOverflowContents || (paintFlags & PaintLayerPaintingChildClippingMaskPhase && layoutObject->hasClipPath())) ? IgnoreOverflowClip : RespectOverflowClip;
+}
+
+PaintLayerPainter::PaintResult PaintLayerPainter::paintLayer(GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
+{
+    PaintResult result = paintLayerInternal(context, paintingInfo, paintFlags);
+    m_paintLayer.clearNeedsRepaint();
+    return result;
+}
+
+PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerInternal(GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
+{
+    // https://code.google.com/p/chromium/issues/detail?id=343772
+    DisableCompositingQueryAsserts disabler;
+
+    if (m_paintLayer.compositingState() != NotComposited) {
+        if (paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers) {
+            // FIXME: ok, but what about GlobalPaintFlattenCompositingLayers? That's for printing and drag-image.
+            // FIXME: why isn't the code here global, as opposed to being set on each paintLayer() call?
+            paintFlags |= PaintLayerUncachedClipRects;
+        }
+    }
+
+    // Non self-painting layers without self-painting descendants don't need to be painted as their
+    // layoutObject() should properly paint itself.
+    if (!m_paintLayer.isSelfPaintingLayer() && !m_paintLayer.hasSelfPaintingLayerDescendant()) {
+        ASSERT(!m_paintLayer.needsRepaint() || !RuntimeEnabledFeatures::slimmingPaintV2Enabled());
+        return FullyPainted;
+    }
+
+    if (shouldSuppressPaintingLayer(&m_paintLayer))
+        return FullyPainted;
+
+    // If this layer is totally invisible then there is nothing to paint.
+    if (!m_paintLayer.layoutObject()->opacity() && !m_paintLayer.layoutObject()->hasBackdropFilter())
+        return FullyPainted;
+
+    if (m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags()))
+        paintFlags |= PaintLayerHaveTransparency;
+
+    LayerFixedPositionRecorder fixedPositionRecorder(*context, *m_paintLayer.layoutObject());
+
+    // PaintLayerAppliedTransform is used in LayoutReplica, to avoid applying the transform twice.
+    if (m_paintLayer.paintsWithTransform(paintingInfo.globalPaintFlags()) && !(paintFlags & PaintLayerAppliedTransform))
+        return paintLayerWithTransform(context, paintingInfo, paintFlags);
+
+    return paintLayerContentsAndReflection(context, paintingInfo, paintFlags);
+}
+
+PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContentsAndReflection(GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy)
+{
+    ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLayerDescendant());
+
+    PaintLayerFlags localPaintFlags = paintFlags & ~(PaintLayerAppliedTransform);
+
+    PaintResult result = FullyPainted;
+
+    // Paint the reflection first if we have one.
+    if (m_paintLayer.reflectionInfo()) {
+        ScopeRecorder scopeRecorder(*context);
+        m_paintLayer.reflectionInfo()->paint(context, paintingInfo, localPaintFlags | PaintLayerPaintingReflection);
+        result = MaybeNotFullyPainted;
+    }
+
+    localPaintFlags |= PaintLayerPaintingCompositingAllPhases;
+    if (paintLayerContentsInternal(context, paintingInfo, localPaintFlags, fragmentPolicy) == MaybeNotFullyPainted)
+        result = MaybeNotFullyPainted;
+
+    return result;
+}
+
+class ClipPathHelper {
+public:
+    ClipPathHelper(GraphicsContext* context, const PaintLayer& paintLayer, PaintLayerPaintingInfo& paintingInfo, LayoutRect& rootRelativeBounds, bool& rootRelativeBoundsComputed,
+        const LayoutPoint& offsetFromRoot, PaintLayerFlags paintFlags)
+        : m_resourceClipper(0), m_paintLayer(paintLayer), m_context(context)
+    {
+        const ComputedStyle& style = paintLayer.layoutObject()->styleRef();
+
+        // Clip-path, like border radius, must not be applied to the contents of a composited-scrolling container.
+        // It must, however, still be applied to the mask layer, so that the compositor can properly mask the
+        // scrolling contents and scrollbars.
+        if (!paintLayer.layoutObject()->hasClipPath() || (paintLayer.needsCompositedScrolling() && !(paintFlags & PaintLayerPaintingChildClippingMaskPhase)))
+            return;
+
+        m_clipperState = SVGClipPainter::ClipperNotApplied;
+
+        paintingInfo.ancestorHasClipPathClipping = true;
+
+        ASSERT(style.clipPath());
+        if (style.clipPath()->type() == ClipPathOperation::SHAPE) {
+            ShapeClipPathOperation* clipPath = toShapeClipPathOperation(style.clipPath());
+            if (clipPath->isValid()) {
+                if (!rootRelativeBoundsComputed) {
+                    rootRelativeBounds = paintLayer.physicalBoundingBoxIncludingReflectionAndStackingChildren(offsetFromRoot);
+                    rootRelativeBoundsComputed = true;
+                }
+                m_clipPathRecorder.emplace(*context, *paintLayer.layoutObject(), clipPath->path(FloatRect(rootRelativeBounds)));
+            }
+        } else if (style.clipPath()->type() == ClipPathOperation::REFERENCE) {
+            ReferenceClipPathOperation* referenceClipPathOperation = toReferenceClipPathOperation(style.clipPath());
+            Document& document = paintLayer.layoutObject()->document();
+            // FIXME: It doesn't work with forward or external SVG references (https://bugs.webkit.org/show_bug.cgi?id=90405)
+            Element* element = document.getElementById(referenceClipPathOperation->fragment());
+            if (isSVGClipPathElement(element) && element->layoutObject()) {
+                if (!rootRelativeBoundsComputed) {
+                    rootRelativeBounds = paintLayer.physicalBoundingBoxIncludingReflectionAndStackingChildren(offsetFromRoot);
+                    rootRelativeBoundsComputed = true;
+                }
+
+                m_resourceClipper = toLayoutSVGResourceClipper(toLayoutSVGResourceContainer(element->layoutObject()));
+                if (!SVGClipPainter(*m_resourceClipper).prepareEffect(*paintLayer.layoutObject(), FloatRect(rootRelativeBounds),
+                    FloatRect(paintingInfo.paintDirtyRect), context, m_clipperState)) {
+                    // No need to post-apply the clipper if this failed.
+                    m_resourceClipper = 0;
+                }
+            }
+        }
+    }
+
+    ~ClipPathHelper()
+    {
+        if (m_resourceClipper)
+            SVGClipPainter(*m_resourceClipper).finishEffect(*m_paintLayer.layoutObject(), m_context, m_clipperState);
+    }
+private:
+    LayoutSVGResourceClipper* m_resourceClipper;
+    Optional<ClipPathRecorder> m_clipPathRecorder;
+    SVGClipPainter::ClipperState m_clipperState;
+    const PaintLayer& m_paintLayer;
+    GraphicsContext* m_context;
+};
+
+PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContents(GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy)
+{
+    PaintResult result = paintLayerContentsInternal(context, paintingInfo, paintFlags, fragmentPolicy);
+    m_paintLayer.clearNeedsRepaint();
+    return result;
+}
+
+PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerContentsInternal(GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfoArg, PaintLayerFlags paintFlags, FragmentPolicy fragmentPolicy)
+{
+    ASSERT(m_paintLayer.isSelfPaintingLayer() || m_paintLayer.hasSelfPaintingLayerDescendant());
+    ASSERT(!(paintFlags & PaintLayerAppliedTransform));
+
+    bool isSelfPaintingLayer = m_paintLayer.isSelfPaintingLayer();
+    bool isPaintingOverlayScrollbars = paintFlags & PaintLayerPaintingOverlayScrollbars;
+    bool isPaintingScrollingContent = paintFlags & PaintLayerPaintingCompositingScrollingPhase;
+    bool isPaintingCompositedForeground = paintFlags & PaintLayerPaintingCompositingForegroundPhase;
+    bool isPaintingCompositedBackground = paintFlags & PaintLayerPaintingCompositingBackgroundPhase;
+    bool isPaintingOverflowContents = paintFlags & PaintLayerPaintingOverflowContents;
+    // Outline always needs to be painted even if we have no visible content. Also,
+    // the outline is painted in the background phase during composited scrolling.
+    // If it were painted in the foreground phase, it would move with the scrolled
+    // content. When not composited scrolling, the outline is painted in the
+    // foreground phase. Since scrolled contents are moved by paint invalidation in this
+    // case, the outline won't get 'dragged along'.
+    bool shouldPaintOutline = isSelfPaintingLayer && !isPaintingOverlayScrollbars
+        && ((isPaintingScrollingContent && isPaintingCompositedBackground)
+        || (!isPaintingScrollingContent && isPaintingCompositedForeground));
+    bool shouldPaintContent = m_paintLayer.hasVisibleContent() && isSelfPaintingLayer && !isPaintingOverlayScrollbars;
+
+    PaintResult result = FullyPainted;
+
+    if (paintFlags & PaintLayerPaintingRootBackgroundOnly && !m_paintLayer.layoutObject()->isLayoutView() && !m_paintLayer.layoutObject()->isDocumentElement())
+        return result;
+
+    PaintLayerPaintingInfo paintingInfo = paintingInfoArg;
+
+    // Ensure our lists are up-to-date.
+    m_paintLayer.stackingNode()->updateLayerListsIfNeeded();
+
+    LayoutPoint offsetFromRoot;
+    m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, offsetFromRoot);
+
+    if (m_paintLayer.compositingState() == PaintsIntoOwnBacking)
+        offsetFromRoot.move(m_paintLayer.subpixelAccumulation());
+    else
+        offsetFromRoot.move(paintingInfo.subPixelAccumulation);
+
+    LayoutRect bounds = m_paintLayer.physicalBoundingBox(offsetFromRoot);
+    if (!paintingInfo.paintDirtyRect.contains(bounds))
+        result = MaybeNotFullyPainted;
+
+    LayoutRect rootRelativeBounds;
+    bool rootRelativeBoundsComputed = false;
+
+    if (paintingInfo.ancestorHasClipPathClipping && m_paintLayer.layoutObject()->style()->position() != StaticPosition)
+        UseCounter::count(m_paintLayer.layoutObject()->document(), UseCounter::ClipPathOfPositionedElement);
+
+    // These helpers output clip and compositing operations using a RAII pattern. Stack-allocated-varibles are destructed in the reverse order of construction,
+    // so they are nested properly.
+    ClipPathHelper clipPathHelper(context, m_paintLayer, paintingInfo, rootRelativeBounds, rootRelativeBoundsComputed, offsetFromRoot, paintFlags);
+
+    Optional<CompositingRecorder> compositingRecorder;
+    // Blending operations must be performed only with the nearest ancestor stacking context.
+    // Note that there is no need to composite if we're painting the root.
+    // FIXME: this should be unified further into PaintLayer::paintsWithTransparency().
+    bool shouldCompositeForBlendMode = (!m_paintLayer.layoutObject()->isDocumentElement() || m_paintLayer.layoutObject()->isSVGRoot()) && m_paintLayer.stackingNode()->isStackingContext() && m_paintLayer.hasNonIsolatedDescendantWithBlendMode();
+    if (shouldCompositeForBlendMode || m_paintLayer.paintsWithTransparency(paintingInfo.globalPaintFlags())) {
+        FloatRect compositingBounds = FloatRect(m_paintLayer.paintingExtent(paintingInfo.rootLayer, paintingInfo.paintDirtyRect, paintingInfo.subPixelAccumulation, paintingInfo.globalPaintFlags()));
+        compositingRecorder.emplace(*context, *m_paintLayer.layoutObject(),
+            WebCoreCompositeToSkiaComposite(CompositeSourceOver, m_paintLayer.layoutObject()->style()->blendMode()),
+            m_paintLayer.layoutObject()->opacity(), &compositingBounds);
+    }
+
+    PaintLayerPaintingInfo localPaintingInfo(paintingInfo);
+    if (m_paintLayer.compositingState() == PaintsIntoOwnBacking)
+        localPaintingInfo.subPixelAccumulation = m_paintLayer.subpixelAccumulation();
+
+    PaintLayerFragments layerFragments;
+    if (shouldPaintContent || shouldPaintOutline || isPaintingOverlayScrollbars) {
+        // Collect the fragments. This will compute the clip rectangles and paint offsets for each layer fragment.
+        ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects;
+        ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject());
+        if (fragmentPolicy == ForceSingleFragment)
+            m_paintLayer.appendSingleFragmentIgnoringPagination(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
+        else
+            m_paintLayer.collectFragments(layerFragments, localPaintingInfo.rootLayer, localPaintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, &offsetFromRoot, localPaintingInfo.subPixelAccumulation);
+        if (shouldPaintContent) {
+            // TODO(wangxianzhu): This is for old slow scrolling. Implement similar optimization for slimming paint v2.
+            shouldPaintContent = atLeastOneFragmentIntersectsDamageRect(layerFragments, localPaintingInfo, paintFlags, offsetFromRoot);
+            if (!shouldPaintContent)
+                result = MaybeNotFullyPainted;
+        }
+    }
+
+    bool selectionOnly = localPaintingInfo.globalPaintFlags() & GlobalPaintSelectionOnly;
+    // If this layer's layoutObject is a child of the paintingRoot, we paint unconditionally, which
+    // is done by passing a nil paintingRoot down to our layoutObject (as if no paintingRoot was ever set).
+    // Else, our layout tree may or may not contain the painting root, so we pass that root along
+    // so it will be tested against as we descend through the layoutObjects.
+    LayoutObject* paintingRootForLayoutObject = 0;
+    if (localPaintingInfo.paintingRoot && !m_paintLayer.layoutObject()->isDescendantOf(localPaintingInfo.paintingRoot))
+        paintingRootForLayoutObject = localPaintingInfo.paintingRoot;
+
+    { // Begin block for the lifetime of any filter.
+        FilterPainter filterPainter(m_paintLayer, context, offsetFromRoot, layerFragments.isEmpty() ? ClipRect() : layerFragments[0].backgroundRect, localPaintingInfo, paintFlags,
+            rootRelativeBounds, rootRelativeBoundsComputed);
+
+        bool shouldPaintBackground = isPaintingCompositedBackground && shouldPaintContent && !selectionOnly;
+        bool shouldPaintNegZOrderList = (isPaintingScrollingContent && isPaintingOverflowContents) || (!isPaintingScrollingContent && isPaintingCompositedBackground);
+        bool shouldPaintOwnContents = isPaintingCompositedForeground && shouldPaintContent;
+        bool shouldPaintNormalFlowAndPosZOrderLists = isPaintingCompositedForeground;
+        bool shouldPaintOverlayScrollbars = isPaintingOverlayScrollbars;
+
+        if (shouldPaintBackground) {
+            paintBackgroundForFragments(layerFragments, context, paintingInfo.paintDirtyRect,
+                localPaintingInfo, paintingRootForLayoutObject, paintFlags);
+        }
+
+        if (shouldPaintNegZOrderList) {
+            if (paintChildren(NegativeZOrderChildren, context, paintingInfo, paintFlags) == MaybeNotFullyPainted)
+                result = MaybeNotFullyPainted;
+        }
+
+        if (shouldPaintOwnContents) {
+            paintForegroundForFragments(layerFragments, context, paintingInfo.paintDirtyRect,
+                localPaintingInfo, paintingRootForLayoutObject, selectionOnly, paintFlags);
+        }
+
+        if (shouldPaintOutline)
+            paintOutlineForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags);
+
+        if (shouldPaintNormalFlowAndPosZOrderLists) {
+            if (paintChildren(NormalFlowChildren | PositiveZOrderChildren, context, paintingInfo, paintFlags) == MaybeNotFullyPainted)
+                result = MaybeNotFullyPainted;
+        }
+
+        if (shouldPaintOverlayScrollbars)
+            paintOverflowControlsForFragments(layerFragments, context, localPaintingInfo, paintFlags);
+    } // FilterPainter block
+
+    bool shouldPaintMask = (paintFlags & PaintLayerPaintingCompositingMaskPhase) && shouldPaintContent && m_paintLayer.layoutObject()->hasMask() && !selectionOnly;
+    bool shouldPaintClippingMask = (paintFlags & PaintLayerPaintingChildClippingMaskPhase) && shouldPaintContent && !selectionOnly;
+
+    if (shouldPaintMask)
+        paintMaskForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags);
+    if (shouldPaintClippingMask) {
+        // Paint the border radius mask for the fragments.
+        paintChildClippingMaskForFragments(layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags);
+    }
+
+    m_paintLayer.setPreviousScrollOffsetAccumulationForPainting(paintingInfoArg.scrollOffsetAccumulation);
+
+    return result;
+}
+
+bool PaintLayerPainter::needsToClip(const PaintLayerPaintingInfo& localPaintingInfo, const ClipRect& clipRect)
+{
+    return clipRect.rect() != localPaintingInfo.paintDirtyRect || clipRect.hasRadius();
+}
+
+bool PaintLayerPainter::atLeastOneFragmentIntersectsDamageRect(PaintLayerFragments& fragments, const PaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags localPaintFlags, const LayoutPoint& offsetFromRoot)
+{
+    if (m_paintLayer.enclosingPaginationLayer())
+        return true; // The fragments created have already been found to intersect with the damage rect.
+
+    if (&m_paintLayer == localPaintingInfo.rootLayer && (localPaintFlags & PaintLayerPaintingOverflowContents))
+        return true;
+
+    for (PaintLayerFragment& fragment: fragments) {
+        LayoutPoint newOffsetFromRoot = offsetFromRoot + fragment.paginationOffset;
+        // Note that this really only works reliably on the first fragment. If the layer has visible
+        // overflow and a subsequent fragment doesn't intersect with the border box of the layer
+        // (i.e. only contains an overflow portion of the layer), intersection will fail. The reason
+        // for this is that fragment.layerBounds is set to the border box, not the bounding box, of
+        // the layer.
+        if (m_paintLayer.intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), newOffsetFromRoot))
+            return true;
+    }
+    return false;
+}
+
+PaintLayerPainter::PaintResult PaintLayerPainter::paintLayerWithTransform(GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
+{
+    TransformationMatrix layerTransform = m_paintLayer.renderableTransform(paintingInfo.globalPaintFlags());
+    // If the transform can't be inverted, then don't paint anything.
+    if (!layerTransform.isInvertible())
+        return FullyPainted;
+
+    // FIXME: We should make sure that we don't walk past paintingInfo.rootLayer here.
+    // m_paintLayer may be the "root", and then we should avoid looking at its parent.
+    PaintLayer* parentLayer = m_paintLayer.parent();
+
+    ClipRect ancestorBackgroundClipRect;
+    if (parentLayer) {
+        // Calculate the clip rectangle that the ancestors establish.
+        ClipRectsContext clipRectsContext(paintingInfo.rootLayer, (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects, IgnoreOverlayScrollbarSize);
+        if (shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject()) == IgnoreOverflowClip)
+            clipRectsContext.setIgnoreOverflowClip();
+        ancestorBackgroundClipRect = m_paintLayer.clipper().backgroundClipRect(clipRectsContext);
+    }
+
+    PaintLayer* paginationLayer = m_paintLayer.enclosingPaginationLayer();
+    PaintLayerFragments fragments;
+    if (paginationLayer) {
+        // FIXME: This is a mess. Look closely at this code and the code in Layer and fix any
+        // issues in it & refactor to make it obvious from code structure what it does and that it's
+        // correct.
+        ClipRectsCacheSlot cacheSlot = (paintFlags & PaintLayerUncachedClipRects) ? UncachedClipRects : PaintingClipRects;
+        ShouldRespectOverflowClip respectOverflowClip = shouldRespectOverflowClip(paintFlags, m_paintLayer.layoutObject());
+        // Calculate the transformed bounding box in the current coordinate space, to figure out
+        // which fragmentainers (e.g. columns) we need to visit.
+        LayoutRect transformedExtent = PaintLayer::transparencyClipBox(&m_paintLayer, paginationLayer, PaintLayer::PaintingTransparencyClipBox, PaintLayer::RootOfTransparencyClipBox, paintingInfo.subPixelAccumulation, paintingInfo.globalPaintFlags());
+        // FIXME: we don't check if paginationLayer is within paintingInfo.rootLayer here.
+        paginationLayer->collectFragments(fragments, paintingInfo.rootLayer, paintingInfo.paintDirtyRect, cacheSlot, IgnoreOverlayScrollbarSize, respectOverflowClip, 0, paintingInfo.subPixelAccumulation, &transformedExtent);
+    } else {
+        // We don't need to collect any fragments in the regular way here. We have already
+        // calculated a clip rectangle for the ancestry if it was needed, and clipping this
+        // layer is something that can be done further down the path, when the transform has
+        // been applied.
+        PaintLayerFragment fragment;
+        fragment.backgroundRect = paintingInfo.paintDirtyRect;
+        fragments.append(fragment);
+    }
+
+    bool needsScope = fragments.size() > 1;
+    PaintResult result = FullyPainted;
+    for (const auto& fragment : fragments) {
+        Optional<ScopeRecorder> scopeRecorder;
+        if (needsScope)
+            scopeRecorder.emplace(*context);
+        Optional<LayerClipRecorder> clipRecorder;
+        if (parentLayer) {
+            ClipRect clipRectForFragment(ancestorBackgroundClipRect);
+            clipRectForFragment.moveBy(fragment.paginationOffset);
+            clipRectForFragment.intersect(fragment.backgroundRect);
+            if (clipRectForFragment.isEmpty())
+                continue;
+            if (needsToClip(paintingInfo, clipRectForFragment)) {
+                if (m_paintLayer.layoutObject()->style()->position() != StaticPosition && clipRectForFragment.isClippedByClipCss())
+                    UseCounter::count(m_paintLayer.layoutObject()->document(), UseCounter::ClipCssOfPositionedElement);
+                clipRecorder.emplace(*context, *parentLayer->layoutObject(), DisplayItem::ClipLayerParent, clipRectForFragment, &paintingInfo, fragment.paginationOffset, paintFlags);
+            }
+        }
+        if (paintFragmentByApplyingTransform(context, paintingInfo, paintFlags, fragment.paginationOffset) == MaybeNotFullyPainted)
+            result = MaybeNotFullyPainted;
+    }
+    return result;
+}
+
+PaintLayerPainter::PaintResult PaintLayerPainter::paintFragmentByApplyingTransform(GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags, const LayoutPoint& fragmentTranslation)
+{
+    // This involves subtracting out the position of the layer in our current coordinate space, but preserving
+    // the accumulated error for sub-pixel layout.
+    LayoutPoint delta;
+    m_paintLayer.convertToLayerCoords(paintingInfo.rootLayer, delta);
+    delta.moveBy(fragmentTranslation);
+    TransformationMatrix transform(m_paintLayer.renderableTransform(paintingInfo.globalPaintFlags()));
+    IntPoint roundedDelta = roundedIntPoint(delta);
+    transform.translateRight(roundedDelta.x(), roundedDelta.y());
+    LayoutSize adjustedSubPixelAccumulation = paintingInfo.subPixelAccumulation + (delta - roundedDelta);
+
+    // TODO(jbroman): Put the real transform origin here, instead of using a
+    // matrix with the origin baked in.
+    FloatPoint3D transformOrigin;
+    Transform3DRecorder transform3DRecorder(*context, *m_paintLayer.layoutObject(), DisplayItem::Transform3DElementTransform, transform, transformOrigin);
+
+    // Now do a paint with the root layer shifted to be us.
+    PaintLayerPaintingInfo transformedPaintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(transform.inverse().mapRect(paintingInfo.paintDirtyRect))), paintingInfo.globalPaintFlags(),
+        adjustedSubPixelAccumulation, paintingInfo.paintingRoot);
+    transformedPaintingInfo.ancestorHasClipPathClipping = paintingInfo.ancestorHasClipPathClipping;
+    return paintLayerContentsAndReflection(context, transformedPaintingInfo, paintFlags, ForceSingleFragment);
+}
+
+PaintLayerPainter::PaintResult PaintLayerPainter::paintChildren(unsigned childrenToVisit, GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags paintFlags)
+{
+    PaintResult result = FullyPainted;
+    if (!m_paintLayer.hasSelfPaintingLayerDescendant())
+        return result;
+
+#if ENABLE(ASSERT)
+    LayerListMutationDetector mutationChecker(m_paintLayer.stackingNode());
+#endif
+
+    PaintLayerStackingNodeIterator iterator(*m_paintLayer.stackingNode(), childrenToVisit);
+    PaintLayerStackingNode* child = iterator.next();
+    if (!child)
+        return result;
+
+    DisplayItem::Type subsequenceType;
+    if (childrenToVisit == NegativeZOrderChildren) {
+        subsequenceType = DisplayItem::SubsequenceNegativeZOrder;
+    } else {
+        ASSERT(childrenToVisit == (NormalFlowChildren | PositiveZOrderChildren));
+        subsequenceType = DisplayItem::SubsequenceNormalFlowAndPositiveZOrder;
+    }
+
+    Optional<SubsequenceRecorder> subsequenceRecorder;
+    if (!paintingInfo.disableSubsequenceCache
+        && !(paintingInfo.globalPaintFlags() & GlobalPaintFlattenCompositingLayers)
+        && !(paintFlags & PaintLayerPaintingReflection)
+        && !(paintFlags & PaintLayerPaintingRootBackgroundOnly)) {
+        if (!m_paintLayer.needsRepaint()
+            && paintingInfo.scrollOffsetAccumulation == m_paintLayer.previousScrollOffsetAccumulationForPainting()
+            && SubsequenceRecorder::useCachedSubsequenceIfPossible(*context, m_paintLayer, subsequenceType))
+            return result;
+        subsequenceRecorder.emplace(*context, m_paintLayer, subsequenceType);
+    }
+
+    IntSize scrollOffsetAccumulationForChildren = paintingInfo.scrollOffsetAccumulation;
+    if (m_paintLayer.layoutObject()->hasOverflowClip())
+        scrollOffsetAccumulationForChildren += m_paintLayer.layoutBox()->scrolledContentOffset();
+
+    bool disableChildSubsequenceCache = !RuntimeEnabledFeatures::slimmingPaintV2Enabled()
+        && (m_paintLayer.layoutObject()->hasOverflowClip() || m_paintLayer.layoutObject()->hasClip());
+
+    for (; child; child = iterator.next()) {
+        PaintLayerPainter childPainter(*child->layer());
+        // If this Layer should paint into its own backing or a grouped backing, that will be done via CompositedLayerMapping::paintContents()
+        // and CompositedLayerMapping::doPaintTask().
+        if (!childPainter.shouldPaintLayerInSoftwareMode(paintingInfo.globalPaintFlags(), paintFlags))
+            continue;
+
+        PaintLayerPaintingInfo childPaintingInfo = paintingInfo;
+        childPaintingInfo.disableSubsequenceCache = disableChildSubsequenceCache;
+        childPaintingInfo.scrollOffsetAccumulation = scrollOffsetAccumulationForChildren;
+        // Rare case: accumulate scroll offset of non-stacking-context ancestors up to m_paintLayer.
+        for (PaintLayer* parentLayer = child->layer()->parent(); parentLayer != &m_paintLayer; parentLayer = parentLayer->parent()) {
+            if (parentLayer->layoutObject()->hasOverflowClip())
+                childPaintingInfo.scrollOffsetAccumulation += parentLayer->layoutBox()->scrolledContentOffset();
+        }
+
+        if (childPainter.paintLayer(context, childPaintingInfo, paintFlags) == MaybeNotFullyPainted)
+            result = MaybeNotFullyPainted;
+    }
+
+    // Set subsequence not cacheable if the bounding box of this layer and descendants is not fully contained
+    // by paintRect, because later paintRect changes may expose new contents which will need repainting.
+    if (result == MaybeNotFullyPainted && subsequenceRecorder)
+        subsequenceRecorder->setUncacheable();
+
+    return result;
+}
+
+// FIXME: inline this.
+static bool paintForFixedRootBackground(const PaintLayer* layer, PaintLayerFlags paintFlags)
+{
+    return layer->layoutObject()->isDocumentElement() && (paintFlags & PaintLayerPaintingRootBackgroundOnly);
+}
+
+bool PaintLayerPainter::shouldPaintLayerInSoftwareMode(const GlobalPaintFlags globalPaintFlags, PaintLayerFlags paintFlags)
+{
+    DisableCompositingQueryAsserts disabler;
+
+    return m_paintLayer.compositingState() == NotComposited
+        || (globalPaintFlags & GlobalPaintFlattenCompositingLayers)
+        || ((paintFlags & PaintLayerPaintingReflection) && !m_paintLayer.has3DTransform())
+        || paintForFixedRootBackground(&m_paintLayer, paintFlags);
+}
+
+void PaintLayerPainter::paintOverflowControlsForFragments(const PaintLayerFragments& layerFragments, GraphicsContext* context, const PaintLayerPaintingInfo& localPaintingInfo, PaintLayerFlags paintFlags)
+{
+    bool needsScope = layerFragments.size() > 1;
+    for (auto& fragment : layerFragments) {
+        Optional<ScopeRecorder> scopeRecorder;
+        if (needsScope)
+            scopeRecorder.emplace(*context);
+
+        Optional<LayerClipRecorder> clipRecorder;
+
+        if (needsToClip(localPaintingInfo, fragment.backgroundRect))
+            clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), DisplayItem::ClipLayerOverflowControls, fragment.backgroundRect, &localPaintingInfo, fragment.paginationOffset, paintFlags);
+        if (PaintLayerScrollableArea* scrollableArea = m_paintLayer.scrollableArea())
+            ScrollableAreaPainter(*scrollableArea).paintOverflowControls(context, roundedIntPoint(toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation())), pixelSnappedIntRect(fragment.backgroundRect.rect()), true);
+    }
+}
+
+void PaintLayerPainter::paintFragmentWithPhase(PaintPhase phase, const PaintLayerFragment& fragment, GraphicsContext* context, const ClipRect& clipRect, const PaintLayerPaintingInfo& paintingInfo, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags, ClipState clipState)
+{
+    ASSERT(m_paintLayer.isSelfPaintingLayer());
+
+    Optional<LayerClipRecorder> clipRecorder;
+    if (clipState != HasClipped && paintingInfo.clipToDirtyRect && needsToClip(paintingInfo, clipRect)) {
+        DisplayItem::Type clipType = DisplayItem::paintPhaseToClipLayerFragmentType(phase);
+        LayerClipRecorder::BorderRadiusClippingRule clippingRule;
+        switch (phase) {
+        case PaintPhaseBlockBackground: // Background painting will handle clipping to self.
+        case PaintPhaseSelfOutline:
+        case PaintPhaseMask: // Mask painting will handle clipping to self.
+            clippingRule = LayerClipRecorder::DoNotIncludeSelfForBorderRadius;
+            break;
+        default:
+            clippingRule = LayerClipRecorder::IncludeSelfForBorderRadius;
+            break;
+        }
+
+        clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), clipType, clipRect, &paintingInfo, fragment.paginationOffset, paintFlags, clippingRule);
+    }
+
+    PaintInfo paintInfo(context, pixelSnappedIntRect(clipRect.rect()), phase, paintingInfo.globalPaintFlags(), paintFlags, paintingRootForLayoutObject, paintingInfo.rootLayer->layoutObject());
+    Optional<ScrollRecorder> scrollRecorder;
+    LayoutPoint paintOffset = toPoint(fragment.layerBounds.location() - m_paintLayer.layoutBoxLocation());
+    if (!paintingInfo.scrollOffsetAccumulation.isZero()) {
+        // As a descendant of the root layer, m_paintLayer's painting is not controlled by the ScrollRecorders
+        // created by BlockPainter of the ancestor layers up to the root layer, so we need to issue ScrollRecorder
+        // for this layer seperately, with the scroll offset accumulated from the root layer to the parent of this
+        // layer, to get the same result as ScrollRecorder in BlockPainter.
+        paintOffset += paintingInfo.scrollOffsetAccumulation;
+        paintInfo.rect.move(paintingInfo.scrollOffsetAccumulation);
+        scrollRecorder.emplace(*paintInfo.context, *m_paintLayer.layoutObject(), paintInfo.phase, paintingInfo.scrollOffsetAccumulation);
+    }
+    m_paintLayer.layoutObject()->paint(paintInfo, paintOffset);
+}
+
+void PaintLayerPainter::paintBackgroundForFragments(const PaintLayerFragments& layerFragments, GraphicsContext* context,
+    const LayoutRect& transparencyPaintDirtyRect, const PaintLayerPaintingInfo& localPaintingInfo,
+    LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
+{
+    bool needsScope = layerFragments.size() > 1;
+    for (auto& fragment : layerFragments) {
+        Optional<ScopeRecorder> scopeRecorder;
+        if (needsScope)
+            scopeRecorder.emplace(*context);
+        paintFragmentWithPhase(PaintPhaseBlockBackground, fragment, context, fragment.backgroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, HasNotClipped);
+    }
+}
+
+void PaintLayerPainter::paintForegroundForFragments(const PaintLayerFragments& layerFragments, GraphicsContext* context,
+    const LayoutRect& transparencyPaintDirtyRect, const PaintLayerPaintingInfo& localPaintingInfo,
+    LayoutObject* paintingRootForLayoutObject, bool selectionOnly, PaintLayerFlags paintFlags)
+{
+    // Optimize clipping for the single fragment case.
+    bool shouldClip = localPaintingInfo.clipToDirtyRect && layerFragments.size() == 1 && !layerFragments[0].foregroundRect.isEmpty();
+    ClipState clipState = HasNotClipped;
+    Optional<LayerClipRecorder> clipRecorder;
+    if (shouldClip && needsToClip(localPaintingInfo, layerFragments[0].foregroundRect)) {
+        clipRecorder.emplace(*context, *m_paintLayer.layoutObject(), DisplayItem::ClipLayerForeground, layerFragments[0].foregroundRect, &localPaintingInfo, layerFragments[0].paginationOffset, paintFlags);
+        clipState = HasClipped;
+    }
+
+    // We have to loop through every fragment multiple times, since we have to issue paint invalidations in each specific phase in order for
+    // interleaving of the fragments to work properly.
+    paintForegroundForFragmentsWithPhase(selectionOnly ? PaintPhaseSelection : PaintPhaseChildBlockBackgrounds, layerFragments,
+        context, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
+
+    if (!selectionOnly) {
+        paintForegroundForFragmentsWithPhase(PaintPhaseFloat, layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
+        paintForegroundForFragmentsWithPhase(PaintPhaseForeground, layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
+        paintForegroundForFragmentsWithPhase(PaintPhaseChildOutlines, layerFragments, context, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
+    }
+}
+
+void PaintLayerPainter::paintForegroundForFragmentsWithPhase(PaintPhase phase, const PaintLayerFragments& layerFragments, GraphicsContext* context,
+    const PaintLayerPaintingInfo& localPaintingInfo, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags, ClipState clipState)
+{
+    bool needsScope = layerFragments.size() > 1;
+    for (auto& fragment : layerFragments) {
+        if (!fragment.foregroundRect.isEmpty()) {
+            Optional<ScopeRecorder> scopeRecorder;
+            if (needsScope)
+                scopeRecorder.emplace(*context);
+            paintFragmentWithPhase(phase, fragment, context, fragment.foregroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, clipState);
+        }
+    }
+}
+
+void PaintLayerPainter::paintOutlineForFragments(const PaintLayerFragments& layerFragments, GraphicsContext* context, const PaintLayerPaintingInfo& localPaintingInfo,
+    LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
+{
+    bool needsScope = layerFragments.size() > 1;
+    for (auto& fragment : layerFragments) {
+        if (!fragment.backgroundRect.isEmpty()) {
+            Optional<ScopeRecorder> scopeRecorder;
+            if (needsScope)
+                scopeRecorder.emplace(*context);
+            paintFragmentWithPhase(PaintPhaseSelfOutline, fragment, context, fragment.backgroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, HasNotClipped);
+        }
+    }
+}
+
+void PaintLayerPainter::paintMaskForFragments(const PaintLayerFragments& layerFragments, GraphicsContext* context, const PaintLayerPaintingInfo& localPaintingInfo,
+    LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
+{
+    bool needsScope = layerFragments.size() > 1;
+    for (auto& fragment : layerFragments) {
+        Optional<ScopeRecorder> scopeRecorder;
+        if (needsScope)
+            scopeRecorder.emplace(*context);
+        paintFragmentWithPhase(PaintPhaseMask, fragment, context, fragment.backgroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, HasNotClipped);
+    }
+}
+
+void PaintLayerPainter::paintChildClippingMaskForFragments(const PaintLayerFragments& layerFragments, GraphicsContext* context, const PaintLayerPaintingInfo& localPaintingInfo,
+    LayoutObject* paintingRootForLayoutObject, PaintLayerFlags paintFlags)
+{
+    bool needsScope = layerFragments.size() > 1;
+    for (auto& fragment: layerFragments) {
+        Optional<ScopeRecorder> scopeRecorder;
+        if (needsScope)
+            scopeRecorder.emplace(*context);
+        paintFragmentWithPhase(PaintPhaseClippingMask, fragment, context, fragment.foregroundRect, localPaintingInfo, paintingRootForLayoutObject, paintFlags, HasNotClipped);
+    }
+}
+
+void PaintLayerPainter::paintOverlayScrollbars(GraphicsContext* context, const LayoutRect& damageRect, const GlobalPaintFlags paintFlags, LayoutObject* paintingRoot)
+{
+    if (!m_paintLayer.containsDirtyOverlayScrollbars())
+        return;
+
+    PaintLayerPaintingInfo paintingInfo(&m_paintLayer, LayoutRect(enclosingIntRect(damageRect)), paintFlags, LayoutSize(), paintingRoot);
+    paintLayer(context, paintingInfo, PaintLayerPaintingOverlayScrollbars);
+
+    m_paintLayer.setContainsDirtyOverlayScrollbars(false);
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.h b/third_party/WebKit/Source/core/paint/PaintLayerPainter.h
new file mode 100644
index 0000000..26f4758
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.h
@@ -0,0 +1,80 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PaintLayerPainter_h
+#define PaintLayerPainter_h
+
+#include "core/CoreExport.h"
+#include "core/paint/PaintLayerFragment.h"
+#include "core/paint/PaintLayerPaintingInfo.h"
+#include "wtf/Allocator.h"
+
+namespace blink {
+
+class ClipRect;
+class PaintLayer;
+class GraphicsContext;
+class LayoutPoint;
+
+class CORE_EXPORT PaintLayerPainter {
+    STACK_ALLOCATED();
+public:
+    enum FragmentPolicy { AllowMultipleFragments, ForceSingleFragment };
+
+    enum PaintResult {
+        // The layer is fully painted. This includes cases that nothing needs painting
+        // regardless of the paint rect.
+        FullyPainted,
+        // Some part of the layer is out of the paint rect and may be not fully painted.
+        // The results cannot be cached because they may change when paint rect changes.
+        MaybeNotFullyPainted
+    };
+
+    PaintLayerPainter(PaintLayer& paintLayer) : m_paintLayer(paintLayer) { }
+
+    // The paint() method paints the layers that intersect the damage rect from back to front.
+    //  paint() assumes that the caller will clip to the bounds of damageRect if necessary.
+    void paint(GraphicsContext*, const LayoutRect& damageRect, const GlobalPaintFlags = GlobalPaintNormalPhase, LayoutObject* paintingRoot = 0, PaintLayerFlags = 0);
+    // paintLayer() assumes that the caller will clip to the bounds of the painting dirty if necessary.
+    PaintResult paintLayer(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags);
+    // paintLayerContents() assumes that the caller will clip to the bounds of the painting dirty rect if necessary.
+    PaintResult paintLayerContents(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments);
+
+    void paintOverlayScrollbars(GraphicsContext*, const LayoutRect& damageRect, const GlobalPaintFlags, LayoutObject* paintingRoot = 0);
+
+private:
+    enum ClipState { HasNotClipped, HasClipped };
+
+    PaintResult paintLayerInternal(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags);
+    PaintResult paintLayerContentsInternal(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments);
+    PaintResult paintLayerContentsAndReflection(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags, FragmentPolicy = AllowMultipleFragments);
+    PaintResult paintLayerWithTransform(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags);
+    PaintResult paintFragmentByApplyingTransform(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& fragmentTranslation);
+
+    PaintResult paintChildren(unsigned childrenToVisit, GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags);
+    bool atLeastOneFragmentIntersectsDamageRect(PaintLayerFragments&, const PaintLayerPaintingInfo&, PaintLayerFlags, const LayoutPoint& offsetFromRoot);
+    void paintFragmentWithPhase(PaintPhase, const PaintLayerFragment&, GraphicsContext*, const ClipRect&, const PaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState);
+    void paintBackgroundForFragments(const PaintLayerFragments&, GraphicsContext*,
+        const LayoutRect& transparencyPaintDirtyRect, const PaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags);
+    void paintForegroundForFragments(const PaintLayerFragments&, GraphicsContext*,
+        const LayoutRect& transparencyPaintDirtyRect, const PaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject,
+        bool selectionOnly, PaintLayerFlags);
+    void paintForegroundForFragmentsWithPhase(PaintPhase, const PaintLayerFragments&, GraphicsContext*, const PaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags, ClipState);
+    void paintOutlineForFragments(const PaintLayerFragments&, GraphicsContext*, const PaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags);
+    void paintOverflowControlsForFragments(const PaintLayerFragments&, GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags);
+    void paintMaskForFragments(const PaintLayerFragments&, GraphicsContext*, const PaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags);
+    void paintChildClippingMaskForFragments(const PaintLayerFragments&, GraphicsContext*, const PaintLayerPaintingInfo&, LayoutObject* paintingRootForLayoutObject, PaintLayerFlags);
+
+    static bool needsToClip(const PaintLayerPaintingInfo& localPaintingInfo, const ClipRect&);
+
+    // Returns whether this layer should be painted during sofware painting (i.e., not via calls from CompositedLayerMapping to draw into composited
+    // layers).
+    bool shouldPaintLayerInSoftwareMode(const GlobalPaintFlags, PaintLayerFlags paintFlags);
+
+    PaintLayer& m_paintLayer;
+};
+
+} // namespace blink
+
+#endif // PaintLayerPainter_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
new file mode 100644
index 0000000..eee41eb
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
@@ -0,0 +1,397 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+
+#include "core/paint/DisplayItemListPaintTest.h"
+#include "platform/graphics/GraphicsContext.h"
+
+namespace blink {
+
+using PaintLayerPainterTest = DisplayItemListPaintTest;
+using PaintLayerPainterTestForSlimmingPaintV2 = DisplayItemListPaintTestForSlimmingPaintV2;
+
+TEST_F(PaintLayerPainterTest, CachedSubsequence)
+{
+    RuntimeEnabledFeatures::setSlimmingPaintSubsequenceCachingEnabled(true);
+
+    setBodyInnerHTML(
+        "<div id='container1' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content1' style='position: absolute; width: 100px; height: 100px; background-color: red'></div>"
+        "</div>"
+        "<div id='container2' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content2' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
+        "</div>");
+    document().view()->updateAllLifecyclePhases();
+
+    PaintLayer& rootLayer = *layoutView().layer();
+    PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
+    LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
+    PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
+    LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
+    LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
+    PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
+    LayoutObject& content2 = *document().getElementById("content2")->layoutObject();
+
+    GraphicsContext context(&rootDisplayItemList());
+    PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 600), GlobalPaintNormalPhase, LayoutSize());
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    rootDisplayItemList().commitNewDisplayItems();
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position: absolute; width: 100px; height: 100px; background-color: green");
+    document().view()->updateAllLifecyclePhases();
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 11,
+        TestDisplayItem(layoutView(), cachedBackgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, cachedBackgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, cachedBackgroundType),
+        TestDisplayItem(container2Layer, cachedSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    rootDisplayItemList().commitNewDisplayItems();
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    // Repeated painting should just generate the root cached subsequence.
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 2,
+        TestDisplayItem(layoutView(), cachedBackgroundType),
+        TestDisplayItem(rootLayer, cachedSubsequenceType));
+
+    rootDisplayItemList().commitNewDisplayItems();
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+}
+
+TEST_F(PaintLayerPainterTest, CachedSubsequenceOnInterestRectChange)
+{
+    RuntimeEnabledFeatures::setSlimmingPaintSubsequenceCachingEnabled(true);
+
+    setBodyInnerHTML(
+        "<div id='container1' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content1' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
+        "</div>"
+        "<div id='container2' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content2a' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
+        "  <div id='content2b' style='position: absolute; top: 200px; width: 100px; height: 100px; background-color: green'></div>"
+        "</div>"
+        "<div id='container3' style='position: absolute; z-index: 2; left: 300px; top: 0; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content3' style='position: absolute; width: 200px; height: 200px; background-color: green'></div>"
+        "</div>");
+    rootDisplayItemList().invalidateAll();
+
+    PaintLayer& rootLayer = *layoutView().layer();
+    PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
+    LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
+    PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
+    LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
+    LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
+    PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
+    LayoutObject& content2a = *document().getElementById("content2a")->layoutObject();
+    LayoutObject& container3 = *document().getElementById("container3")->layoutObject();
+    PaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer();
+    LayoutObject& content3 = *document().getElementById("content3")->layoutObject();
+
+    document().view()->updateAllLifecyclePhases();
+    GraphicsContext context(&rootDisplayItemList());
+    PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 400, 300), GlobalPaintNormalPhase, LayoutSize());
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    rootDisplayItemList().commitNewDisplayItems();
+
+    // Container1 is fully in the interest rect;
+    // Container2 is partly (including its stacking chidren) in the interest rect;
+    // Content2b is out of the interest rect and output nothing;
+    // Container3 is partly in the interest rect.
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 17,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2a, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(container3, backgroundType),
+        TestDisplayItem(container3Layer, subsequenceType),
+        TestDisplayItem(content3, backgroundType),
+        TestDisplayItem(container3Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    // Container1 becomes partly in the interest rect, but uses cached subsequence
+    // because it was fully painted before;
+    // Container2's intersection with the interest rect changes;
+    // Content2b is out of the interest rect and outputs nothing;
+    // Container3 becomes out of the interest rect and outputs nothing.
+    PaintLayerPaintingInfo paintingInfo1(&rootLayer, LayoutRect(0, 100, 300, 300), GlobalPaintNormalPhase, LayoutSize());
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo1, PaintLayerPaintingCompositingAllPhases);
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 11,
+        TestDisplayItem(layoutView(), cachedBackgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, cachedBackgroundType),
+        TestDisplayItem(container1Layer, cachedSubsequenceType),
+        TestDisplayItem(container2, cachedBackgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2a, cachedBackgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    rootDisplayItemList().commitNewDisplayItems();
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2a, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+}
+
+TEST_F(PaintLayerPainterTestForSlimmingPaintV2, CachedSubsequence)
+{
+    setBodyInnerHTML(
+        "<div id='container1' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content1' style='position: absolute; width: 100px; height: 100px; background-color: red'></div>"
+        "</div>"
+        "<div id='container2' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content2' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
+        "</div>");
+    document().view()->updateAllLifecyclePhases();
+
+    PaintLayer& rootLayer = *layoutView().layer();
+    PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
+    LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
+    PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
+    LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
+    LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
+    PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
+    LayoutObject& content2 = *document().getElementById("content2")->layoutObject();
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "position: absolute; width: 100px; height: 100px; background-color: green");
+    updateLifecyclePhasesToPaintClean(LayoutRect::infiniteRect());
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 11,
+        TestDisplayItem(layoutView(), cachedBackgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, cachedBackgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, cachedBackgroundType),
+        TestDisplayItem(container2Layer, cachedSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    compositeForSlimmingPaintV2();
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    // Repeated painting should just generate the root cached subsequence.
+    setNeedsDisplayWithoutInvalidationForRoot();
+    updateLifecyclePhasesToPaintClean();
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 2,
+        TestDisplayItem(layoutView(), cachedBackgroundType),
+        TestDisplayItem(rootLayer, cachedSubsequenceType));
+
+    compositeForSlimmingPaintV2();
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+}
+
+TEST_F(PaintLayerPainterTestForSlimmingPaintV2, CachedSubsequenceOnInterestRectChange)
+{
+    setBodyInnerHTML(
+        "<div id='container1' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content1' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
+        "</div>"
+        "<div id='container2' style='position: relative; z-index: 1; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content2a' style='position: absolute; width: 100px; height: 100px; background-color: green'></div>"
+        "  <div id='content2b' style='position: absolute; top: 200px; width: 100px; height: 100px; background-color: green'></div>"
+        "</div>"
+        "<div id='container3' style='position: absolute; z-index: 2; left: 300px; top: 0; width: 200px; height: 200px; background-color: blue'>"
+        "  <div id='content3' style='position: absolute; width: 200px; height: 200px; background-color: green'></div>"
+        "</div>");
+    setNeedsDisplayForRoot();
+
+    PaintLayer& rootLayer = *layoutView().layer();
+    PaintLayer& htmlLayer = *toLayoutBoxModelObject(document().documentElement()->layoutObject())->layer();
+    LayoutObject& container1 = *document().getElementById("container1")->layoutObject();
+    PaintLayer& container1Layer = *toLayoutBoxModelObject(container1).layer();
+    LayoutObject& content1 = *document().getElementById("content1")->layoutObject();
+    LayoutObject& container2 = *document().getElementById("container2")->layoutObject();
+    PaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
+    LayoutObject& content2a = *document().getElementById("content2a")->layoutObject();
+    LayoutObject& container3 = *document().getElementById("container3")->layoutObject();
+    PaintLayer& container3Layer = *toLayoutBoxModelObject(container3).layer();
+    LayoutObject& content3 = *document().getElementById("content3")->layoutObject();
+
+    document().view()->updateAllLifecyclePhases(LayoutRect(0, 0, 400, 300));
+
+    // Container1 is fully in the interest rect;
+    // Container2 is partly (including its stacking chidren) in the interest rect;
+    // Content2b is out of the interest rect and output nothing;
+    // Container3 is partly in the interest rect.
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 17,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2a, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(container3, backgroundType),
+        TestDisplayItem(container3Layer, subsequenceType),
+        TestDisplayItem(content3, backgroundType),
+        TestDisplayItem(container3Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    setNeedsDisplayWithoutInvalidationForRoot();
+    
+    // Container1 becomes partly in the interest rect, but uses cached subsequence
+    // because it was fully painted before;
+    // Container2's intersection with the interest rect changes;
+    // Content2b is out of the interest rect and outputs nothing;
+    // Container3 becomes out of the interest rect and outputs nothing.
+    updateLifecyclePhasesToPaintClean(LayoutRect(0, 100, 300, 300));
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().newDisplayItems(), 11,
+        TestDisplayItem(layoutView(), cachedBackgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, cachedBackgroundType),
+        TestDisplayItem(container1Layer, cachedSubsequenceType),
+        TestDisplayItem(container2, cachedBackgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2a, cachedBackgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+
+    compositeForSlimmingPaintV2();
+
+    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 13,
+        TestDisplayItem(layoutView(), backgroundType),
+        TestDisplayItem(rootLayer, subsequenceType),
+        TestDisplayItem(htmlLayer, subsequenceType),
+        TestDisplayItem(container1, backgroundType),
+        TestDisplayItem(container1Layer, subsequenceType),
+        TestDisplayItem(content1, backgroundType),
+        TestDisplayItem(container1Layer, endSubsequenceType),
+        TestDisplayItem(container2, backgroundType),
+        TestDisplayItem(container2Layer, subsequenceType),
+        TestDisplayItem(content2a, backgroundType),
+        TestDisplayItem(container2Layer, endSubsequenceType),
+        TestDisplayItem(htmlLayer, endSubsequenceType),
+        TestDisplayItem(rootLayer, endSubsequenceType));
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPaintingInfo.h b/third_party/WebKit/Source/core/paint/PaintLayerPaintingInfo.h
new file mode 100644
index 0000000..05152e4
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPaintingInfo.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef PaintLayerPaintingInfo_h
+#define PaintLayerPaintingInfo_h
+
+#include "core/paint/PaintPhase.h"
+#include "platform/geometry/LayoutRect.h"
+#include "wtf/Allocator.h"
+
+namespace blink {
+
+class PaintLayer;
+class LayoutObject;
+
+enum PaintLayerFlag {
+    PaintLayerNoFlag = 0,
+    PaintLayerHaveTransparency = 1,
+    PaintLayerAppliedTransform = 1 << 1,
+    PaintLayerUncachedClipRects = 1 << 2,
+    PaintLayerPaintingReflection = 1 << 3,
+    PaintLayerPaintingOverlayScrollbars = 1 << 4,
+    PaintLayerPaintingCompositingBackgroundPhase = 1 << 5,
+    PaintLayerPaintingCompositingForegroundPhase = 1 << 6,
+    PaintLayerPaintingCompositingMaskPhase = 1 << 7,
+    PaintLayerPaintingCompositingScrollingPhase = 1 << 8,
+    PaintLayerPaintingOverflowContents = 1 << 9,
+    PaintLayerPaintingRootBackgroundOnly = 1 << 10,
+    PaintLayerPaintingSkipRootBackground = 1 << 11,
+    PaintLayerPaintingChildClippingMaskPhase = 1 << 12,
+    PaintLayerPaintingRenderingClipPathAsMask = 1 << 13,
+    PaintLayerPaintingCompositingAllPhases = (PaintLayerPaintingCompositingBackgroundPhase | PaintLayerPaintingCompositingForegroundPhase | PaintLayerPaintingCompositingMaskPhase)
+};
+
+typedef unsigned PaintLayerFlags;
+
+struct PaintLayerPaintingInfo {
+    STACK_ALLOCATED();
+    PaintLayerPaintingInfo(PaintLayer* inRootLayer, const LayoutRect& inDirtyRect,
+        GlobalPaintFlags globalPaintFlags, const LayoutSize& inSubPixelAccumulation,
+        LayoutObject* inPaintingRoot = 0)
+        : rootLayer(inRootLayer)
+        , paintingRoot(inPaintingRoot)
+        , paintDirtyRect(inDirtyRect)
+        , subPixelAccumulation(inSubPixelAccumulation)
+        , clipToDirtyRect(true)
+        , ancestorHasClipPathClipping(false)
+        , disableSubsequenceCache(false)
+        , m_globalPaintFlags(globalPaintFlags)
+    { }
+
+    GlobalPaintFlags globalPaintFlags() const { return m_globalPaintFlags; }
+
+    // TODO(jchaffraix): We should encapsulate all these fields.
+    PaintLayer* rootLayer;
+    LayoutObject* paintingRoot; // only paint descendants of this object
+    LayoutRect paintDirtyRect; // relative to rootLayer;
+    LayoutSize subPixelAccumulation;
+    IntSize scrollOffsetAccumulation;
+    bool clipToDirtyRect;
+    bool ancestorHasClipPathClipping;
+    // TODO(wangxianzhu): Remove for slimming paint v2.
+    bool disableSubsequenceCache;
+
+private:
+    const GlobalPaintFlags m_globalPaintFlags;
+};
+
+} // namespace blink
+
+#endif // PaintLayerPaintingInfo_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerReflectionInfo.cpp b/third_party/WebKit/Source/core/paint/PaintLayerReflectionInfo.cpp
new file mode 100644
index 0000000..b89cb9e
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerReflectionInfo.cpp
@@ -0,0 +1,143 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "core/paint/PaintLayerReflectionInfo.h"
+
+#include "core/frame/UseCounter.h"
+#include "core/layout/LayoutReplica.h"
+#include "core/paint/PaintLayer.h"
+#include "core/paint/PaintLayerPainter.h"
+#include "core/style/ComputedStyle.h"
+#include "platform/transforms/ScaleTransformOperation.h"
+#include "platform/transforms/TranslateTransformOperation.h"
+
+#include "wtf/RefPtr.h"
+
+namespace blink {
+
+PaintLayerReflectionInfo::PaintLayerReflectionInfo(LayoutBox& layoutObject)
+    : m_box(&layoutObject)
+    , m_isPaintingInsideReflection(false)
+{
+    UseCounter::count(box().document(), UseCounter::Reflection);
+
+    m_reflection = LayoutReplica::createAnonymous(&box().document());
+    m_reflection->setDangerousOneWayParent(m_box);
+}
+
+void PaintLayerReflectionInfo::destroy()
+{
+    if (!m_reflection->documentBeingDestroyed())
+        m_reflection->removeLayers(box().layer());
+
+    m_reflection->setDangerousOneWayParent(nullptr);
+    m_reflection->destroy();
+    m_reflection = nullptr;
+}
+
+PaintLayer* PaintLayerReflectionInfo::reflectionLayer() const
+{
+    return m_reflection->layer();
+}
+
+void PaintLayerReflectionInfo::updateAfterStyleChange(const ComputedStyle* oldStyle)
+{
+    RefPtr<ComputedStyle> newStyle = ComputedStyle::create();
+    newStyle->inheritFrom(box().styleRef());
+
+    // Map in our transform.
+    TransformOperations transform;
+    switch (box().style()->boxReflect()->direction()) {
+    case ReflectionBelow:
+        transform.operations().append(TranslateTransformOperation::create(Length(0, Fixed),
+            Length(100., Percent), TransformOperation::Translate));
+        transform.operations().append(TranslateTransformOperation::create(Length(0, Fixed),
+            box().style()->boxReflect()->offset(), TransformOperation::Translate));
+        transform.operations().append(ScaleTransformOperation::create(1.0, -1.0, ScaleTransformOperation::Scale));
+        break;
+
+    case ReflectionAbove:
+        transform.operations().append(ScaleTransformOperation::create(1.0, -1.0, ScaleTransformOperation::Scale));
+        transform.operations().append(TranslateTransformOperation::create(Length(0, Fixed),
+            Length(100., Percent), TransformOperation::Translate));
+        transform.operations().append(TranslateTransformOperation::create(Length(0, Fixed),
+            box().style()->boxReflect()->offset(), TransformOperation::Translate));
+        break;
+
+    case ReflectionRight:
+        transform.operations().append(TranslateTransformOperation::create(Length(100., Percent),
+            Length(0, Fixed), TransformOperation::Translate));
+        transform.operations().append(TranslateTransformOperation::create(
+            box().style()->boxReflect()->offset(), Length(0, Fixed), TransformOperation::Translate));
+        transform.operations().append(ScaleTransformOperation::create(-1.0, 1.0, ScaleTransformOperation::Scale));
+        break;
+
+    case ReflectionLeft:
+        transform.operations().append(ScaleTransformOperation::create(-1.0, 1.0, ScaleTransformOperation::Scale));
+        transform.operations().append(TranslateTransformOperation::create(Length(100., Percent),
+            Length(0, Fixed), TransformOperation::Translate));
+        transform.operations().append(TranslateTransformOperation::create(
+            box().style()->boxReflect()->offset(), Length(0, Fixed), TransformOperation::Translate));
+        break;
+    }
+    newStyle->setTransform(transform);
+
+    // Map in our mask.
+    newStyle->setMaskBoxImage(box().style()->boxReflect()->mask());
+
+    m_reflection->setStyle(newStyle.release());
+}
+
+void PaintLayerReflectionInfo::paint(GraphicsContext* context, const PaintLayerPaintingInfo& paintingInfo, PaintLayerFlags flags)
+{
+    if (m_isPaintingInsideReflection)
+        return;
+
+    // Mark that we are now inside replica painting.
+    m_isPaintingInsideReflection = true;
+    PaintLayerPainter(*reflectionLayer()).paintLayer(context, paintingInfo, flags);
+    m_isPaintingInsideReflection = false;
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerReflectionInfo.h b/third_party/WebKit/Source/core/paint/PaintLayerReflectionInfo.h
new file mode 100644
index 0000000..226fb3eb
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerReflectionInfo.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef PaintLayerReflectionInfo_h
+#define PaintLayerReflectionInfo_h
+
+#include "core/layout/LayoutBoxModelObject.h"
+#include "core/paint/PaintLayerPainter.h"
+#include "wtf/Allocator.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+class PaintLayer;
+class LayoutReplica;
+
+class PaintLayerReflectionInfo {
+    WTF_MAKE_FAST_ALLOCATED(PaintLayerReflectionInfo);
+    WTF_MAKE_NONCOPYABLE(PaintLayerReflectionInfo);
+public:
+    explicit PaintLayerReflectionInfo(LayoutBox&);
+    void destroy();
+
+    LayoutReplica* reflection() const { return m_reflection; }
+    PaintLayer* reflectionLayer() const;
+
+    bool isPaintingInsideReflection() const { return m_isPaintingInsideReflection; }
+
+    void updateAfterStyleChange(const ComputedStyle* oldStyle);
+
+    void paint(GraphicsContext*, const PaintLayerPaintingInfo&, PaintLayerFlags);
+
+private:
+    LayoutBox& box() { return *m_box; }
+    const LayoutBox& box() const { return *m_box; }
+
+    LayoutBox* m_box;
+    LayoutReplica* m_reflection;
+
+    // A state bit tracking if we are painting inside a replica.
+    unsigned m_isPaintingInsideReflection : 1;
+};
+
+} // namespace blink
+
+#endif // PaintLayerReflectinInfo_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
new file mode 100644
index 0000000..87dd24a
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
@@ -0,0 +1,1571 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "core/paint/PaintLayerScrollableArea.h"
+
+#include "core/css/PseudoStyleRequest.h"
+#include "core/dom/AXObjectCache.h"
+#include "core/dom/Node.h"
+#include "core/dom/shadow/ShadowRoot.h"
+#include "core/editing/FrameSelection.h"
+#include "core/frame/FrameHost.h"
+#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
+#include "core/html/HTMLFrameOwnerElement.h"
+#include "core/input/EventHandler.h"
+#include "core/layout/LayoutGeometryMap.h"
+#include "core/layout/LayoutPart.h"
+#include "core/layout/LayoutScrollbar.h"
+#include "core/layout/LayoutScrollbarPart.h"
+#include "core/layout/LayoutTheme.h"
+#include "core/layout/LayoutView.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/page/ChromeClient.h"
+#include "core/page/FocusController.h"
+#include "core/page/Page.h"
+#include "core/page/scrolling/ScrollingCoordinator.h"
+#include "core/paint/PaintLayerFragment.h"
+#include "platform/PlatformGestureEvent.h"
+#include "platform/PlatformMouseEvent.h"
+#include "platform/graphics/GraphicsLayer.h"
+#include "platform/graphics/paint/DrawingRecorder.h"
+#include "platform/scroll/ScrollAnimator.h"
+#include "platform/scroll/ScrollbarTheme.h"
+#include "public/platform/Platform.h"
+
+namespace blink {
+
+const int ResizerControlExpandRatioForTouch = 2;
+
+PaintLayerScrollableArea::PaintLayerScrollableArea(PaintLayer& layer)
+    : m_layer(layer)
+    , m_inResizeMode(false)
+    , m_scrollsOverflow(false)
+    , m_inOverflowRelayout(false)
+    , m_nextTopmostScrollChild(0)
+    , m_topmostScrollChild(0)
+    , m_needsCompositedScrolling(false)
+    , m_scrollbarManager(*this)
+    , m_scrollCorner(nullptr)
+    , m_resizer(nullptr)
+#if ENABLE(ASSERT)
+    , m_hasBeenDisposed(false)
+#endif
+{
+    Node* node = box().node();
+    if (node && node->isElementNode()) {
+        // We save and restore only the scrollOffset as the other scroll values are recalculated.
+        Element* element = toElement(node);
+        m_scrollOffset = element->savedLayerScrollOffset();
+        if (!m_scrollOffset.isZero())
+            scrollAnimator()->setCurrentPosition(FloatPoint(m_scrollOffset.width(), m_scrollOffset.height()));
+        element->setSavedLayerScrollOffset(IntSize());
+    }
+    updateResizerAreaSet();
+}
+
+PaintLayerScrollableArea::~PaintLayerScrollableArea()
+{
+    ASSERT(m_hasBeenDisposed);
+}
+
+void PaintLayerScrollableArea::dispose()
+{
+    if (inResizeMode() && !box().documentBeingDestroyed()) {
+        if (LocalFrame* frame = box().frame())
+            frame->eventHandler().resizeScrollableAreaDestroyed();
+    }
+
+    if (LocalFrame* frame = box().frame()) {
+        if (FrameView* frameView = frame->view()) {
+            frameView->removeScrollableArea(this);
+            frameView->removeAnimatingScrollableArea(this);
+        }
+    }
+
+    if (box().frame() && box().frame()->page()) {
+        if (ScrollingCoordinator* scrollingCoordinator = box().frame()->page()->scrollingCoordinator())
+            scrollingCoordinator->willDestroyScrollableArea(this);
+    }
+
+    if (!box().documentBeingDestroyed()) {
+        Node* node = box().node();
+        // FIXME: Make setSavedLayerScrollOffset take DoubleSize. crbug.com/414283.
+        if (node && node->isElementNode())
+            toElement(node)->setSavedLayerScrollOffset(flooredIntSize(m_scrollOffset));
+    }
+
+    if (LocalFrame* frame = box().frame()) {
+        if (FrameView* frameView = frame->view())
+            frameView->removeResizerArea(box());
+    }
+
+    m_scrollbarManager.dispose();
+
+    if (m_scrollCorner)
+        m_scrollCorner->destroy();
+    if (m_resizer)
+        m_resizer->destroy();
+
+    clearScrollAnimators();
+
+#if ENABLE(ASSERT)
+    m_hasBeenDisposed = true;
+#endif
+}
+
+DEFINE_TRACE(PaintLayerScrollableArea)
+{
+    visitor->trace(m_scrollbarManager);
+    ScrollableArea::trace(visitor);
+}
+
+HostWindow* PaintLayerScrollableArea::hostWindow() const
+{
+    if (Page* page = box().frame()->page())
+        return &page->chromeClient();
+    return nullptr;
+}
+
+GraphicsLayer* PaintLayerScrollableArea::layerForScrolling() const
+{
+    return layer()->hasCompositedLayerMapping() ? layer()->compositedLayerMapping()->scrollingContentsLayer() : 0;
+}
+
+GraphicsLayer* PaintLayerScrollableArea::layerForHorizontalScrollbar() const
+{
+    // See crbug.com/343132.
+    DisableCompositingQueryAsserts disabler;
+
+    return layer()->hasCompositedLayerMapping() ? layer()->compositedLayerMapping()->layerForHorizontalScrollbar() : 0;
+}
+
+GraphicsLayer* PaintLayerScrollableArea::layerForVerticalScrollbar() const
+{
+    // See crbug.com/343132.
+    DisableCompositingQueryAsserts disabler;
+
+    return layer()->hasCompositedLayerMapping() ? layer()->compositedLayerMapping()->layerForVerticalScrollbar() : 0;
+}
+
+GraphicsLayer* PaintLayerScrollableArea::layerForScrollCorner() const
+{
+    // See crbug.com/343132.
+    DisableCompositingQueryAsserts disabler;
+
+    return layer()->hasCompositedLayerMapping() ? layer()->compositedLayerMapping()->layerForScrollCorner() : 0;
+}
+
+void PaintLayerScrollableArea::invalidateScrollbarRect(Scrollbar* scrollbar, const IntRect& rect)
+{
+    // See crbug.com/343132.
+    DisableCompositingQueryAsserts disabler;
+
+    ASSERT(scrollbar == horizontalScrollbar() || scrollbar == verticalScrollbar());
+    ASSERT(scrollbar == horizontalScrollbar() ? !layerForHorizontalScrollbar() : !layerForVerticalScrollbar());
+
+    IntRect scrollRect = rect;
+    // If we are not yet inserted into the tree, there is no need to issue paint invaldiations.
+    if (!box().isLayoutView() && !box().parent())
+        return;
+
+    if (scrollbar == verticalScrollbar())
+        scrollRect.move(verticalScrollbarStart(0, box().size().width()), box().borderTop());
+    else
+        scrollRect.move(horizontalScrollbarStart(0), box().size().height() - box().borderBottom() - scrollbar->height());
+
+    if (scrollRect.isEmpty())
+        return;
+
+    box().invalidateDisplayItemClient(*scrollbar);
+
+    LayoutRect paintInvalidationRect = LayoutRect(scrollRect);
+    box().flipForWritingMode(paintInvalidationRect);
+
+    IntRect intRect = pixelSnappedIntRect(paintInvalidationRect);
+
+    if (box().frameView()->isInPerformLayout()) {
+        addScrollbarDamage(scrollbar, intRect);
+    } else {
+        // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
+        DisablePaintInvalidationStateAsserts disabler;
+        // We have invalidated the displayItemClient of the scrollbar, but for now we still need to
+        // invalidate the rectangles to trigger repaints.
+        box().invalidatePaintRectangleNotInvalidatingDisplayItemClients(LayoutRect(intRect));
+    }
+}
+
+void PaintLayerScrollableArea::invalidateScrollCornerRect(const IntRect& rect)
+{
+    ASSERT(!layerForScrollCorner());
+
+    if (m_scrollCorner) {
+        // FIXME: We should not allow paint invalidation out of paint invalidation state. crbug.com/457415
+        DisablePaintInvalidationStateAsserts disabler;
+        m_scrollCorner->invalidatePaintRectangle(LayoutRect(rect));
+        box().invalidateDisplayItemClientForNonCompositingDescendantsOf(*m_scrollCorner);
+    } else {
+        box().invalidateDisplayItemClient(box());
+    }
+    if (m_resizer) {
+        m_resizer->invalidatePaintRectangle(LayoutRect(rect));
+        box().invalidateDisplayItemClientForNonCompositingDescendantsOf(*m_resizer);
+    }
+}
+
+bool PaintLayerScrollableArea::shouldUseIntegerScrollOffset() const
+{
+    Frame* frame = box().frame();
+    if (frame->settings() && !frame->settings()->preferCompositingToLCDTextEnabled())
+        return true;
+
+    return ScrollableArea::shouldUseIntegerScrollOffset();
+}
+
+bool PaintLayerScrollableArea::isActive() const
+{
+    Page* page = box().frame()->page();
+    return page && page->focusController().isActive();
+}
+
+bool PaintLayerScrollableArea::isScrollCornerVisible() const
+{
+    return !scrollCornerRect().isEmpty();
+}
+
+static int cornerStart(const ComputedStyle& style, int minX, int maxX, int thickness)
+{
+    if (style.shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+        return minX + style.borderLeftWidth();
+    return maxX - thickness - style.borderRightWidth();
+}
+
+static IntRect cornerRect(const ComputedStyle& style, const Scrollbar* horizontalScrollbar, const Scrollbar* verticalScrollbar, const IntRect& bounds)
+{
+    int horizontalThickness;
+    int verticalThickness;
+    if (!verticalScrollbar && !horizontalScrollbar) {
+        // FIXME: This isn't right. We need to know the thickness of custom scrollbars
+        // even when they don't exist in order to set the resizer square size properly.
+        horizontalThickness = ScrollbarTheme::theme()->scrollbarThickness();
+        verticalThickness = horizontalThickness;
+    } else if (verticalScrollbar && !horizontalScrollbar) {
+        horizontalThickness = verticalScrollbar->width();
+        verticalThickness = horizontalThickness;
+    } else if (horizontalScrollbar && !verticalScrollbar) {
+        verticalThickness = horizontalScrollbar->height();
+        horizontalThickness = verticalThickness;
+    } else {
+        horizontalThickness = verticalScrollbar->width();
+        verticalThickness = horizontalScrollbar->height();
+    }
+    return IntRect(cornerStart(style, bounds.x(), bounds.maxX(), horizontalThickness),
+        bounds.maxY() - verticalThickness - style.borderBottomWidth(),
+        horizontalThickness, verticalThickness);
+}
+
+
+IntRect PaintLayerScrollableArea::scrollCornerRect() const
+{
+    // We have a scrollbar corner when a scrollbar is visible and not filling the entire length of the box.
+    // This happens when:
+    // (a) A resizer is present and at least one scrollbar is present
+    // (b) Both scrollbars are present.
+    bool hasHorizontalBar = horizontalScrollbar();
+    bool hasVerticalBar = verticalScrollbar();
+    bool hasResizer = box().style()->resize() != RESIZE_NONE;
+    if ((hasHorizontalBar && hasVerticalBar) || (hasResizer && (hasHorizontalBar || hasVerticalBar)))
+        return cornerRect(box().styleRef(), horizontalScrollbar(), verticalScrollbar(), box().pixelSnappedBorderBoxRect());
+    return IntRect();
+}
+
+IntRect PaintLayerScrollableArea::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const
+{
+    LayoutView* view = box().view();
+    if (!view)
+        return scrollbarRect;
+
+    IntRect rect = scrollbarRect;
+    rect.move(scrollbarOffset(scrollbar));
+
+    return view->frameView()->convertFromLayoutObject(box(), rect);
+}
+
+IntRect PaintLayerScrollableArea::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntRect& parentRect) const
+{
+    LayoutView* view = box().view();
+    if (!view)
+        return parentRect;
+
+    IntRect rect = view->frameView()->convertToLayoutObject(box(), parentRect);
+    rect.move(-scrollbarOffset(scrollbar));
+    return rect;
+}
+
+IntPoint PaintLayerScrollableArea::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntPoint& scrollbarPoint) const
+{
+    LayoutView* view = box().view();
+    if (!view)
+        return scrollbarPoint;
+
+    IntPoint point = scrollbarPoint;
+    point.move(scrollbarOffset(scrollbar));
+    return view->frameView()->convertFromLayoutObject(box(), point);
+}
+
+IntPoint PaintLayerScrollableArea::convertFromContainingViewToScrollbar(const Scrollbar* scrollbar, const IntPoint& parentPoint) const
+{
+    LayoutView* view = box().view();
+    if (!view)
+        return parentPoint;
+
+    IntPoint point = view->frameView()->convertToLayoutObject(box(), parentPoint);
+
+    point.move(-scrollbarOffset(scrollbar));
+    return point;
+}
+
+int PaintLayerScrollableArea::scrollSize(ScrollbarOrientation orientation) const
+{
+    IntSize scrollDimensions = maximumScrollPosition() - minimumScrollPosition();
+    return (orientation == HorizontalScrollbar) ? scrollDimensions.width() : scrollDimensions.height();
+}
+
+void PaintLayerScrollableArea::setScrollOffset(const IntPoint& newScrollOffset, ScrollType scrollType)
+{
+    setScrollOffset(DoublePoint(newScrollOffset), scrollType);
+}
+
+void PaintLayerScrollableArea::setScrollOffset(const DoublePoint& newScrollOffset, ScrollType)
+{
+    if (scrollOffset() == toDoubleSize(newScrollOffset))
+        return;
+
+    DoubleSize scrollDelta = scrollOffset() - toDoubleSize(newScrollOffset);
+    m_scrollOffset = toDoubleSize(newScrollOffset);
+
+    LocalFrame* frame = box().frame();
+    ASSERT(frame);
+
+    RefPtrWillBeRawPtr<FrameView> frameView = box().frameView();
+
+    TRACE_EVENT1("devtools.timeline", "ScrollLayer", "data", InspectorScrollLayerEvent::data(&box()));
+
+    // FIXME(420741): Resolve circular dependency between scroll offset and
+    // compositing state, and remove this disabler.
+    DisableCompositingQueryAsserts disabler;
+
+    // Update the positions of our child layers (if needed as only fixed layers should be impacted by a scroll).
+    // We don't update compositing layers, because we need to do a deep update from the compositing ancestor.
+    if (!frameView->isInPerformLayout()) {
+        // If we're in the middle of layout, we'll just update layers once layout has finished.
+        layer()->updateLayerPositionsAfterOverflowScroll(scrollDelta);
+        // Update regions, scrolling may change the clip of a particular region.
+        frameView->updateDocumentAnnotatedRegions();
+        frameView->setNeedsUpdateWidgetPositions();
+        updateCompositingLayersAfterScroll();
+    }
+
+    const LayoutBoxModelObject* paintInvalidationContainer = box().containerForPaintInvalidation();
+    // The caret rect needs to be invalidated after scrolling
+    frame->selection().setCaretRectNeedsUpdate();
+
+    FloatQuad quadForFakeMouseMoveEvent = FloatQuad(FloatRect(layer()->layoutObject()->previousPaintInvalidationRectIncludingCompositedScrolling(*paintInvalidationContainer)));
+
+    quadForFakeMouseMoveEvent = paintInvalidationContainer->localToAbsoluteQuad(quadForFakeMouseMoveEvent);
+    frame->eventHandler().dispatchFakeMouseMoveEventSoonInQuad(quadForFakeMouseMoveEvent);
+
+    bool requiresPaintInvalidation = true;
+
+    if (box().view()->compositor()->inCompositingMode()) {
+        bool onlyScrolledCompositedLayers = scrollsOverflow()
+            && !layer()->hasVisibleNonLayerContent()
+            && !layer()->hasNonCompositedChild()
+            && !layer()->hasBlockSelectionGapBounds()
+            && box().style()->backgroundLayers().attachment() != LocalBackgroundAttachment;
+
+        if (usesCompositedScrolling() || onlyScrolledCompositedLayers)
+            requiresPaintInvalidation = false;
+    }
+
+    // Only the root layer can overlap non-composited fixed-position elements.
+    if (!requiresPaintInvalidation && layer()->isRootLayer() && frameView->hasViewportConstrainedObjects()) {
+        if (!frameView->invalidateViewportConstrainedObjects())
+            requiresPaintInvalidation = true;
+    }
+
+    // Just schedule a full paint invalidation of our object.
+    // FIXME: This invalidation will be unnecessary in slimming paint phase 2.
+    if (requiresPaintInvalidation) {
+        box().setShouldDoFullPaintInvalidationIncludingNonCompositingDescendants();
+        frameView->setFrameTimingRequestsDirty(true);
+    }
+
+    // Schedule the scroll DOM event.
+    if (box().node())
+        box().node()->document().enqueueScrollEventForNode(box().node());
+
+    if (AXObjectCache* cache = box().document().existingAXObjectCache())
+        cache->handleScrollPositionChanged(&box());
+    box().view()->clearHitTestCache();
+
+    // Inform the FrameLoader of the new scroll position, so it can be restored when navigating back.
+    if (layer()->isRootLayer())
+        frameView->frame().loader().saveScrollState();
+
+    // All scrolls clear the scroll anchor.
+    frameView->clearScrollAnchor();
+}
+
+IntPoint PaintLayerScrollableArea::scrollPosition() const
+{
+    return IntPoint(flooredIntSize(m_scrollOffset));
+}
+
+DoublePoint PaintLayerScrollableArea::scrollPositionDouble() const
+{
+    return DoublePoint(m_scrollOffset);
+}
+
+IntPoint PaintLayerScrollableArea::minimumScrollPosition() const
+{
+    return -scrollOrigin();
+}
+
+IntPoint PaintLayerScrollableArea::maximumScrollPosition() const
+{
+    IntSize contentSize;
+    IntSize visibleSize;
+    if (layer()->isRootLayer()) {
+        FrameView* frameView = box().frameView();
+        contentSize = frameView->contentsSize();
+        visibleSize = frameView->visibleContentSize(ExcludeScrollbars) + frameView->topControlsSize();
+    } else if (box().hasOverflowClip()) {
+        contentSize = IntSize(pixelSnappedScrollWidth(), pixelSnappedScrollHeight());
+        visibleSize = enclosingIntRect(box().clientBoxRect()).size();
+    }
+    return -scrollOrigin() + (contentSize - visibleSize);
+}
+
+IntRect PaintLayerScrollableArea::visibleContentRect(IncludeScrollbarsInRect scrollbarInclusion) const
+{
+    int verticalScrollbarWidth = 0;
+    int horizontalScrollbarHeight = 0;
+    if (scrollbarInclusion == IncludeScrollbars) {
+        verticalScrollbarWidth = (verticalScrollbar() && !verticalScrollbar()->isOverlayScrollbar()) ? verticalScrollbar()->width() : 0;
+        horizontalScrollbarHeight = (horizontalScrollbar() && !horizontalScrollbar()->isOverlayScrollbar()) ? horizontalScrollbar()->height() : 0;
+    }
+
+    return IntRect(IntPoint(scrollXOffset(), scrollYOffset()),
+        IntSize(max(0, layer()->size().width() - verticalScrollbarWidth), max(0, layer()->size().height() - horizontalScrollbarHeight)));
+}
+
+int PaintLayerScrollableArea::visibleHeight() const
+{
+    return layer()->size().height();
+}
+
+int PaintLayerScrollableArea::visibleWidth() const
+{
+    return layer()->size().width();
+}
+
+IntSize PaintLayerScrollableArea::contentsSize() const
+{
+    return IntSize(scrollWidth(), scrollHeight());
+}
+
+IntPoint PaintLayerScrollableArea::lastKnownMousePosition() const
+{
+    return box().frame() ? box().frame()->eventHandler().lastKnownMousePosition() : IntPoint();
+}
+
+bool PaintLayerScrollableArea::scrollAnimatorEnabled() const
+{
+    if (Settings* settings = box().frame()->settings())
+        return settings->scrollAnimatorEnabled();
+    return false;
+}
+
+bool PaintLayerScrollableArea::shouldSuspendScrollAnimations() const
+{
+    LayoutView* view = box().view();
+    if (!view)
+        return true;
+    return view->frameView()->shouldSuspendScrollAnimations();
+}
+
+void PaintLayerScrollableArea::scrollbarVisibilityChanged()
+{
+    if (LayoutView* view = box().view())
+        return view->clearHitTestCache();
+}
+
+bool PaintLayerScrollableArea::scrollbarsCanBeActive() const
+{
+    LayoutView* view = box().view();
+    if (!view)
+        return false;
+    return view->frameView()->scrollbarsCanBeActive();
+}
+
+IntRect PaintLayerScrollableArea::scrollableAreaBoundingBox() const
+{
+    return box().absoluteBoundingBoxRect();
+}
+
+void PaintLayerScrollableArea::registerForAnimation()
+{
+    if (LocalFrame* frame = box().frame()) {
+        if (FrameView* frameView = frame->view())
+            frameView->addAnimatingScrollableArea(this);
+    }
+}
+
+void PaintLayerScrollableArea::deregisterForAnimation()
+{
+    if (LocalFrame* frame = box().frame()) {
+        if (FrameView* frameView = frame->view())
+            frameView->removeAnimatingScrollableArea(this);
+    }
+}
+
+bool PaintLayerScrollableArea::userInputScrollable(ScrollbarOrientation orientation) const
+{
+    if (box().isIntrinsicallyScrollable(orientation))
+        return true;
+
+    EOverflow overflowStyle = (orientation == HorizontalScrollbar) ?
+        box().style()->overflowX() : box().style()->overflowY();
+    return (overflowStyle == OSCROLL || overflowStyle == OAUTO || overflowStyle == OOVERLAY);
+}
+
+bool PaintLayerScrollableArea::shouldPlaceVerticalScrollbarOnLeft() const
+{
+    return box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft();
+}
+
+int PaintLayerScrollableArea::pageStep(ScrollbarOrientation orientation) const
+{
+    int length = (orientation == HorizontalScrollbar) ?
+        box().pixelSnappedClientWidth() : box().pixelSnappedClientHeight();
+    int minPageStep = static_cast<float>(length) * ScrollableArea::minFractionToStepWhenPaging();
+    int pageStep = max(minPageStep, length - ScrollableArea::maxOverlapBetweenPages());
+
+    return max(pageStep, 1);
+}
+
+LayoutBox& PaintLayerScrollableArea::box() const
+{
+    return *m_layer.layoutBox();
+}
+
+PaintLayer* PaintLayerScrollableArea::layer() const
+{
+    return &m_layer;
+}
+
+LayoutUnit PaintLayerScrollableArea::scrollWidth() const
+{
+    return m_overflowRect.width();
+}
+
+LayoutUnit PaintLayerScrollableArea::scrollHeight() const
+{
+    return m_overflowRect.height();
+}
+
+int PaintLayerScrollableArea::pixelSnappedScrollWidth() const
+{
+    return snapSizeToPixel(scrollWidth(), box().clientLeft() + box().location().x());
+}
+
+int PaintLayerScrollableArea::pixelSnappedScrollHeight() const
+{
+    return snapSizeToPixel(scrollHeight(), box().clientTop() + box().location().y());
+}
+
+void PaintLayerScrollableArea::computeScrollDimensions()
+{
+    m_overflowRect = box().layoutOverflowRect();
+    box().flipForWritingMode(m_overflowRect);
+
+    int scrollableLeftOverflow = m_overflowRect.x() - box().borderLeft() - (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? box().verticalScrollbarWidth() : 0);
+    int scrollableTopOverflow = m_overflowRect.y() - box().borderTop();
+    setScrollOrigin(IntPoint(-scrollableLeftOverflow, -scrollableTopOverflow));
+}
+
+void PaintLayerScrollableArea::scrollToPosition(const DoublePoint& scrollPosition, ScrollOffsetClamping clamp, ScrollBehavior scrollBehavior)
+{
+    cancelProgrammaticScrollAnimation();
+
+    DoublePoint newScrollPosition = clamp == ScrollOffsetClamped ? clampScrollPosition(scrollPosition) : scrollPosition;
+    if (newScrollPosition != scrollPositionDouble())
+        ScrollableArea::setScrollPosition(newScrollPosition, ProgrammaticScroll, scrollBehavior);
+}
+
+void PaintLayerScrollableArea::updateScrollDimensions(DoubleSize& scrollOffset, bool& autoHorizontalScrollBarChanged, bool& autoVerticalScrollBarChanged)
+{
+    ASSERT(box().hasOverflowClip());
+
+    if (needsScrollbarReconstruction()) {
+        m_scrollbarManager.setCanDetachScrollbars(false);
+        setHasHorizontalScrollbar(false);
+        setHasVerticalScrollbar(false);
+    }
+
+    m_scrollbarManager.setCanDetachScrollbars(true);
+
+    scrollOffset = adjustedScrollOffset();
+    computeScrollDimensions();
+    bool hasHorizontalOverflow = this->hasHorizontalOverflow();
+    bool hasVerticalOverflow = this->hasVerticalOverflow();
+    if (hasOverlayScrollbars()) {
+        if (!scrollSize(HorizontalScrollbar))
+            setHasHorizontalScrollbar(false);
+        if (!scrollSize(VerticalScrollbar))
+            setHasVerticalScrollbar(false);
+    }
+
+    // overflow:auto may need to lay out again if scrollbars got added/removed.
+    autoHorizontalScrollBarChanged = (box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow)) || (box().style()->overflowX() == OSCROLL && !horizontalScrollbar());
+    autoVerticalScrollBarChanged = (box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow)) || (box().style()->overflowY() == OSCROLL && !verticalScrollbar());
+    if (!visualViewportSuppliesScrollbars() && (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged)) {
+        if (box().hasAutoHorizontalScrollbar())
+            setHasHorizontalScrollbar(hasHorizontalOverflow);
+        else if (box().style()->overflowX() == OSCROLL)
+            setHasHorizontalScrollbar(true);
+        if (box().hasAutoVerticalScrollbar())
+            setHasVerticalScrollbar(hasVerticalOverflow);
+        else if (box().style()->overflowY() == OSCROLL)
+            setHasVerticalScrollbar(true);
+    }
+}
+
+void PaintLayerScrollableArea::finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool autoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged)
+{
+    ASSERT(box().hasOverflowClip());
+
+    // Layout may cause us to be at an invalid scroll position. In this case we need
+    // to pull our scroll offsets back to the max (or push them up to the min).
+    DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble());
+    if (clampedScrollPosition != scrollPositionDouble())
+        scrollToPosition(clampedScrollPosition);
+
+    if (originalScrollOffset != adjustedScrollOffset()) {
+        DoublePoint origin(scrollOrigin());
+        scrollPositionChanged(-origin + adjustedScrollOffset(), ProgrammaticScroll);
+    }
+
+    m_scrollbarManager.setCanDetachScrollbars(false);
+
+    bool hasHorizontalOverflow = this->hasHorizontalOverflow();
+    bool hasVerticalOverflow = this->hasVerticalOverflow();
+
+    {
+        // Hits in compositing/overflow/automatically-opt-into-composited-scrolling-after-style-change.html.
+        DisableCompositingQueryAsserts disabler;
+
+        // overflow:scroll should just enable/disable.
+        if (box().style()->overflowX() == OSCROLL && horizontalScrollbar())
+            horizontalScrollbar()->setEnabled(hasHorizontalOverflow);
+        if (box().style()->overflowY() == OSCROLL && verticalScrollbar())
+            verticalScrollbar()->setEnabled(hasVerticalOverflow);
+    }
+
+    if (!visualViewportSuppliesScrollbars() && (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged)) {
+        if (hasVerticalOverflow || hasHorizontalOverflow)
+            updateScrollCornerStyle();
+
+        layer()->updateSelfPaintingLayer();
+
+        // Force an update since we know the scrollbars have changed things.
+        if (box().document().hasAnnotatedRegions())
+            box().document().setAnnotatedRegionsDirty(true);
+
+        // Our proprietary overflow: overlay value doesn't trigger a layout.
+        if ((autoHorizontalScrollBarChanged && box().style()->overflowX() != OOVERLAY) || (autoVerticalScrollBarChanged && box().style()->overflowY() != OOVERLAY)) {
+            if (!m_inOverflowRelayout) {
+                m_inOverflowRelayout = true;
+                SubtreeLayoutScope layoutScope(box());
+                layoutScope.setNeedsLayout(&box(), LayoutInvalidationReason::ScrollbarChanged);
+                if (box().isLayoutBlock()) {
+                    LayoutBlock& block = toLayoutBlock(box());
+                    block.scrollbarsChanged(autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
+                    block.layoutBlock(true);
+                } else {
+                    box().layout();
+                }
+                m_inOverflowRelayout = false;
+            }
+        }
+    }
+
+    {
+        // Hits in compositing/overflow/automatically-opt-into-composited-scrolling-after-style-change.html.
+        DisableCompositingQueryAsserts disabler;
+
+        // Set up the range (and page step/line step).
+        if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
+            int clientWidth = box().pixelSnappedClientWidth();
+            horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
+        }
+        if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
+            int clientHeight = box().pixelSnappedClientHeight();
+            verticalScrollbar->setProportion(clientHeight, overflowRect().height());
+        }
+    }
+
+    if (hasOverlayScrollbars()) {
+        if (!scrollSize(HorizontalScrollbar))
+            setHasHorizontalScrollbar(false);
+        if (!scrollSize(VerticalScrollbar))
+            setHasVerticalScrollbar(false);
+    }
+
+    bool hasOverflow = hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow();
+    updateScrollableAreaSet(hasOverflow);
+
+    DisableCompositingQueryAsserts disabler;
+    positionOverflowControls();
+}
+
+void PaintLayerScrollableArea::updateAfterLayout()
+{
+    DoubleSize originalScrollOffset;
+    bool autoHorizontalScrollBarChanged;
+    bool autoVerticalScrollBarChanged;
+    updateScrollDimensions(originalScrollOffset, autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
+    finalizeScrollDimensions(originalScrollOffset, autoHorizontalScrollBarChanged, autoVerticalScrollBarChanged);
+}
+
+ScrollBehavior PaintLayerScrollableArea::scrollBehaviorStyle() const
+{
+    return box().style()->scrollBehavior();
+}
+
+bool PaintLayerScrollableArea::hasHorizontalOverflow() const
+{
+    return pixelSnappedScrollWidth() > box().pixelSnappedClientWidth();
+}
+
+bool PaintLayerScrollableArea::hasVerticalOverflow() const
+{
+    return pixelSnappedScrollHeight() > box().pixelSnappedClientHeight();
+}
+
+bool PaintLayerScrollableArea::hasScrollableHorizontalOverflow() const
+{
+    return hasHorizontalOverflow() && box().scrollsOverflowX();
+}
+
+bool PaintLayerScrollableArea::hasScrollableVerticalOverflow() const
+{
+    return hasVerticalOverflow() && box().scrollsOverflowY();
+}
+
+static bool overflowRequiresScrollbar(EOverflow overflow)
+{
+    return overflow == OSCROLL;
+}
+
+static bool overflowDefinesAutomaticScrollbar(EOverflow overflow)
+{
+    return overflow == OAUTO || overflow == OOVERLAY;
+}
+
+// This function returns true if the given box requires overflow scrollbars (as
+// opposed to the 'viewport' scrollbars managed by the PaintLayerCompositor).
+// FIXME: we should use the same scrolling machinery for both the viewport and
+// overflow. Currently, we need to avoid producing scrollbars here if they'll be
+// handled externally in the RLC.
+static bool canHaveOverflowScrollbars(const LayoutBox& box)
+{
+    bool rootLayerScrolls = box.document().settings() && box.document().settings()->rootLayerScrolls();
+    return (rootLayerScrolls || !box.isLayoutView()) && box.document().viewportDefiningElement() != box.node();
+}
+
+void PaintLayerScrollableArea::updateAfterStyleChange(const ComputedStyle* oldStyle)
+{
+    // Don't do this on first style recalc, before layout has ever happened.
+    if (!overflowRect().size().isZero())
+        updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow());
+
+    if (!canHaveOverflowScrollbars(box()))
+        return;
+
+    // Avoid drawing two sets of scrollbars when one is provided by the visual viewport.
+    if (visualViewportSuppliesScrollbars()) {
+        setHasHorizontalScrollbar(false);
+        setHasVerticalScrollbar(false);
+        return;
+    }
+
+    EOverflow overflowX = box().style()->overflowX();
+    EOverflow overflowY = box().style()->overflowY();
+
+    // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present.
+    bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefinesAutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX);
+    bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAutomaticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY);
+
+    // Look for the scrollbarModes and reset the needs Horizontal & vertical Scrollbar values based on scrollbarModes, as during force style change
+    // StyleResolver::styleForDocument returns documentStyle with  no overflow values, due to which we are destorying the scrollbars that was
+    // already present.
+    if (box().isLayoutView()) {
+        if (LocalFrame* frame = box().frame()) {
+            if (FrameView* frameView = frame->view()) {
+                ScrollbarMode hMode;
+                ScrollbarMode vMode;
+                frameView->calculateScrollbarModes(hMode, vMode);
+                if (hMode == ScrollbarAlwaysOn && !needsHorizontalScrollbar)
+                    needsHorizontalScrollbar = true;
+                if (vMode == ScrollbarAlwaysOn && !needsVerticalScrollbar)
+                    needsVerticalScrollbar = true;
+            }
+        }
+    }
+
+    setHasHorizontalScrollbar(needsHorizontalScrollbar);
+    setHasVerticalScrollbar(needsVerticalScrollbar);
+
+    // With overflow: scroll, scrollbars are always visible but may be disabled.
+    // When switching to another value, we need to re-enable them (see bug 11985).
+    if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) {
+        ASSERT(hasHorizontalScrollbar());
+        horizontalScrollbar()->setEnabled(true);
+    }
+
+    if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL && overflowY != OSCROLL) {
+        ASSERT(hasVerticalScrollbar());
+        verticalScrollbar()->setEnabled(true);
+    }
+
+    // FIXME: Need to detect a swap from custom to native scrollbars (and vice versa).
+    if (horizontalScrollbar())
+        horizontalScrollbar()->styleChanged();
+    if (verticalScrollbar())
+        verticalScrollbar()->styleChanged();
+
+    updateScrollCornerStyle();
+    updateResizerAreaSet();
+    updateResizerStyle();
+}
+
+bool PaintLayerScrollableArea::updateAfterCompositingChange()
+{
+    layer()->updateScrollingStateAfterCompositingChange();
+    const bool layersChanged = m_topmostScrollChild != m_nextTopmostScrollChild;
+    m_topmostScrollChild = m_nextTopmostScrollChild;
+    m_nextTopmostScrollChild = nullptr;
+    return layersChanged;
+}
+
+void PaintLayerScrollableArea::updateAfterOverflowRecalc()
+{
+    computeScrollDimensions();
+    if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar()) {
+        int clientWidth = box().pixelSnappedClientWidth();
+        horizontalScrollbar->setProportion(clientWidth, overflowRect().width());
+    }
+    if (Scrollbar* verticalScrollbar = this->verticalScrollbar()) {
+        int clientHeight = box().pixelSnappedClientHeight();
+        verticalScrollbar->setProportion(clientHeight, overflowRect().height());
+    }
+
+    bool hasHorizontalOverflow = this->hasHorizontalOverflow();
+    bool hasVerticalOverflow = this->hasVerticalOverflow();
+    bool autoHorizontalScrollBarChanged = box().hasAutoHorizontalScrollbar() && (hasHorizontalScrollbar() != hasHorizontalOverflow);
+    bool autoVerticalScrollBarChanged = box().hasAutoVerticalScrollbar() && (hasVerticalScrollbar() != hasVerticalOverflow);
+    if (autoHorizontalScrollBarChanged || autoVerticalScrollBarChanged)
+        box().setNeedsLayoutAndFullPaintInvalidation(LayoutInvalidationReason::Unknown);
+}
+
+IntRect PaintLayerScrollableArea::rectForHorizontalScrollbar(const IntRect& borderBoxRect) const
+{
+    if (!hasHorizontalScrollbar())
+        return IntRect();
+
+    const IntRect& scrollCorner = scrollCornerRect();
+
+    return IntRect(horizontalScrollbarStart(borderBoxRect.x()),
+        borderBoxRect.maxY() - box().borderBottom() - horizontalScrollbar()->height(),
+        borderBoxRect.width() - (box().borderLeft() + box().borderRight()) - scrollCorner.width(),
+        horizontalScrollbar()->height());
+}
+
+IntRect PaintLayerScrollableArea::rectForVerticalScrollbar(const IntRect& borderBoxRect) const
+{
+    if (!hasVerticalScrollbar())
+        return IntRect();
+
+    const IntRect& scrollCorner = scrollCornerRect();
+
+    return IntRect(verticalScrollbarStart(borderBoxRect.x(), borderBoxRect.maxX()),
+        borderBoxRect.y() + box().borderTop(),
+        verticalScrollbar()->width(),
+        borderBoxRect.height() - (box().borderTop() + box().borderBottom()) - scrollCorner.height());
+}
+
+LayoutUnit PaintLayerScrollableArea::verticalScrollbarStart(int minX, int maxX) const
+{
+    if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+        return minX + box().borderLeft();
+    return maxX - box().borderRight() - verticalScrollbar()->width();
+}
+
+LayoutUnit PaintLayerScrollableArea::horizontalScrollbarStart(int minX) const
+{
+    int x = minX + box().borderLeft();
+    if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+        x += hasVerticalScrollbar() ? verticalScrollbar()->width() : resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer).width();
+    return x;
+}
+
+IntSize PaintLayerScrollableArea::scrollbarOffset(const Scrollbar* scrollbar) const
+{
+    if (scrollbar == verticalScrollbar())
+        return IntSize(verticalScrollbarStart(0, box().size().width()), box().borderTop());
+
+    if (scrollbar == horizontalScrollbar())
+        return IntSize(horizontalScrollbarStart(0), box().size().height() - box().borderBottom() - scrollbar->height());
+
+    ASSERT_NOT_REACHED();
+    return IntSize();
+}
+
+static inline const LayoutObject& layoutObjectForScrollbar(const LayoutObject& layoutObject)
+{
+    if (Node* node = layoutObject.node()) {
+        if (layoutObject.isLayoutView()) {
+            Document& doc = node->document();
+            if (Settings* settings = doc.settings()) {
+                if (!settings->allowCustomScrollbarInMainFrame() && layoutObject.frame() && layoutObject.frame()->isMainFrame())
+                    return layoutObject;
+            }
+
+            // Try the <body> element first as a scrollbar source.
+            Element* body = doc.body();
+            if (body && body->layoutObject() && body->layoutObject()->style()->hasPseudoStyle(SCROLLBAR))
+                return *body->layoutObject();
+
+            // If the <body> didn't have a custom style, then the root element might.
+            Element* docElement = doc.documentElement();
+            if (docElement && docElement->layoutObject() && docElement->layoutObject()->style()->hasPseudoStyle(SCROLLBAR))
+                return *docElement->layoutObject();
+
+            // If we have an owning ipage/LocalFrame element, then it can set the custom scrollbar also.
+            LayoutPart* frameLayoutObject = node->document().frame()->ownerLayoutObject();
+            if (frameLayoutObject && frameLayoutObject->style()->hasPseudoStyle(SCROLLBAR))
+                return *frameLayoutObject;
+        }
+        if (ShadowRoot* shadowRoot = node->containingShadowRoot()) {
+            if (shadowRoot->type() == ShadowRootType::UserAgent)
+                return *shadowRoot->host()->layoutObject();
+        }
+    }
+
+    return layoutObject;
+}
+
+bool PaintLayerScrollableArea::needsScrollbarReconstruction() const
+{
+    const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(box());
+    bool shouldUseCustom = actualLayoutObject.isBox() && actualLayoutObject.styleRef().hasPseudoStyle(SCROLLBAR);
+    bool hasAnyScrollbar = hasScrollbar();
+    bool hasCustom = (hasHorizontalScrollbar() && horizontalScrollbar()->isCustomScrollbar()) || (hasVerticalScrollbar() && verticalScrollbar()->isCustomScrollbar());
+    return hasAnyScrollbar && (shouldUseCustom != hasCustom);
+}
+
+void PaintLayerScrollableArea::setHasHorizontalScrollbar(bool hasScrollbar)
+{
+    if (hasScrollbar == hasHorizontalScrollbar())
+        return;
+
+    if (!hasScrollbar && !layerForHorizontalScrollbar())
+        horizontalScrollbar()->invalidate();
+
+    m_scrollbarManager.setHasHorizontalScrollbar(hasScrollbar);
+
+    // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style.
+    if (hasHorizontalScrollbar())
+        horizontalScrollbar()->styleChanged();
+    if (hasVerticalScrollbar())
+        verticalScrollbar()->styleChanged();
+
+    // These are valid because we want to invalidate display item clients on the current backing.
+    DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler;
+    DisableCompositingQueryAsserts compositingAssertDisabler;
+    invalidateScrollCorner(scrollCornerRect());
+
+    // Force an update since we know the scrollbars have changed things.
+    if (box().document().hasAnnotatedRegions())
+        box().document().setAnnotatedRegionsDirty(true);
+}
+
+void PaintLayerScrollableArea::setHasVerticalScrollbar(bool hasScrollbar)
+{
+    if (hasScrollbar == hasVerticalScrollbar())
+        return;
+
+    if (!hasScrollbar && !layerForVerticalScrollbar())
+        verticalScrollbar()->invalidate();
+
+    m_scrollbarManager.setHasVerticalScrollbar(hasScrollbar);
+
+    // Destroying or creating one bar can cause our scrollbar corner to come and go. We need to update the opposite scrollbar's style.
+    if (hasHorizontalScrollbar())
+        horizontalScrollbar()->styleChanged();
+    if (hasVerticalScrollbar())
+        verticalScrollbar()->styleChanged();
+
+    // These are valid because we want to invalidate display item clients on the current backing.
+    DisablePaintInvalidationStateAsserts paintInvalidationAssertDisabler;
+    DisableCompositingQueryAsserts compositingAssertDisabler;
+    invalidateScrollCorner(scrollCornerRect());
+
+    // Force an update since we know the scrollbars have changed things.
+    if (box().document().hasAnnotatedRegions())
+        box().document().setAnnotatedRegionsDirty(true);
+}
+
+int PaintLayerScrollableArea::verticalScrollbarWidth(OverlayScrollbarSizeRelevancy relevancy) const
+{
+    if (!hasVerticalScrollbar() || (verticalScrollbar()->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !verticalScrollbar()->shouldParticipateInHitTesting())))
+        return 0;
+    return verticalScrollbar()->width();
+}
+
+int PaintLayerScrollableArea::horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy relevancy) const
+{
+    if (!hasHorizontalScrollbar() || (horizontalScrollbar()->isOverlayScrollbar() && (relevancy == IgnoreOverlayScrollbarSize || !horizontalScrollbar()->shouldParticipateInHitTesting())))
+        return 0;
+    return horizontalScrollbar()->height();
+}
+
+void PaintLayerScrollableArea::positionOverflowControls()
+{
+    if (!hasScrollbar() && !box().canResize())
+        return;
+
+    const IntRect borderBox = box().pixelSnappedBorderBoxRect();
+    if (Scrollbar* verticalScrollbar = this->verticalScrollbar())
+        verticalScrollbar->setFrameRect(rectForVerticalScrollbar(borderBox));
+
+    if (Scrollbar* horizontalScrollbar = this->horizontalScrollbar())
+        horizontalScrollbar->setFrameRect(rectForHorizontalScrollbar(borderBox));
+
+    const IntRect& scrollCorner = scrollCornerRect();
+    if (m_scrollCorner)
+        m_scrollCorner->setFrameRect(LayoutRect(scrollCorner));
+
+    if (m_resizer)
+        m_resizer->setFrameRect(LayoutRect(resizerCornerRect(borderBox, ResizerForPointer)));
+
+    // FIXME, this should eventually be removed, once we are certain that composited
+    // controls get correctly positioned on a compositor update. For now, conservatively
+    // leaving this unchanged.
+    if (layer()->hasCompositedLayerMapping())
+        layer()->compositedLayerMapping()->positionOverflowControlsLayers();
+}
+
+void PaintLayerScrollableArea::updateScrollCornerStyle()
+{
+    if (!m_scrollCorner && !hasScrollbar())
+        return;
+    if (!m_scrollCorner && hasOverlayScrollbars())
+        return;
+
+    const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(box());
+    RefPtr<ComputedStyle> corner = box().hasOverflowClip() ? actualLayoutObject.getUncachedPseudoStyle(PseudoStyleRequest(SCROLLBAR_CORNER), actualLayoutObject.style()) : PassRefPtr<ComputedStyle>(nullptr);
+    if (corner) {
+        if (!m_scrollCorner) {
+            m_scrollCorner = LayoutScrollbarPart::createAnonymous(&box().document());
+            m_scrollCorner->setDangerousOneWayParent(&box());
+        }
+        m_scrollCorner->setStyle(corner.release());
+    } else if (m_scrollCorner) {
+        m_scrollCorner->destroy();
+        m_scrollCorner = nullptr;
+    }
+}
+
+bool PaintLayerScrollableArea::hitTestOverflowControls(HitTestResult& result, const IntPoint& localPoint)
+{
+    if (!hasScrollbar() && !box().canResize())
+        return false;
+
+    IntRect resizeControlRect;
+    if (box().style()->resize() != RESIZE_NONE) {
+        resizeControlRect = resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer);
+        if (resizeControlRect.contains(localPoint))
+            return true;
+    }
+
+    int resizeControlSize = max(resizeControlRect.height(), 0);
+    if (hasVerticalScrollbar() && verticalScrollbar()->shouldParticipateInHitTesting()) {
+        LayoutRect vBarRect(verticalScrollbarStart(0, box().size().width()),
+            box().borderTop(),
+            verticalScrollbar()->width(),
+            box().size().height() - (box().borderTop() + box().borderBottom()) - (hasHorizontalScrollbar() ? horizontalScrollbar()->height() : resizeControlSize));
+        if (vBarRect.contains(localPoint)) {
+            result.setScrollbar(verticalScrollbar());
+            return true;
+        }
+    }
+
+    resizeControlSize = max(resizeControlRect.width(), 0);
+    if (hasHorizontalScrollbar() && horizontalScrollbar()->shouldParticipateInHitTesting()) {
+        LayoutRect hBarRect(horizontalScrollbarStart(0),
+            box().size().height() - box().borderBottom() - horizontalScrollbar()->height(),
+            box().size().width() - (box().borderLeft() + box().borderRight()) - (hasVerticalScrollbar() ? verticalScrollbar()->width() : resizeControlSize),
+            horizontalScrollbar()->height());
+        if (hBarRect.contains(localPoint)) {
+            result.setScrollbar(horizontalScrollbar());
+            return true;
+        }
+    }
+
+    // FIXME: We should hit test the m_scrollCorner and pass it back through the result.
+
+    return false;
+}
+
+IntRect PaintLayerScrollableArea::resizerCornerRect(const IntRect& bounds, ResizerHitTestType resizerHitTestType) const
+{
+    if (box().style()->resize() == RESIZE_NONE)
+        return IntRect();
+    IntRect corner = cornerRect(box().styleRef(), horizontalScrollbar(), verticalScrollbar(), bounds);
+
+    if (resizerHitTestType == ResizerForTouch) {
+        // We make the resizer virtually larger for touch hit testing. With the
+        // expanding ratio k = ResizerControlExpandRatioForTouch, we first move
+        // the resizer rect (of width w & height h), by (-w * (k-1), -h * (k-1)),
+        // then expand the rect by new_w/h = w/h * k.
+        int expandRatio = ResizerControlExpandRatioForTouch - 1;
+        corner.move(-corner.width() * expandRatio, -corner.height() * expandRatio);
+        corner.expand(corner.width() * expandRatio, corner.height() * expandRatio);
+    }
+
+    return corner;
+}
+
+IntRect PaintLayerScrollableArea::scrollCornerAndResizerRect() const
+{
+    IntRect scrollCornerAndResizer = scrollCornerRect();
+    if (scrollCornerAndResizer.isEmpty())
+        scrollCornerAndResizer = resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer);
+    return scrollCornerAndResizer;
+}
+
+bool PaintLayerScrollableArea::isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestType resizerHitTestType) const
+{
+    if (!box().canResize())
+        return false;
+
+    IntPoint localPoint = roundedIntPoint(box().absoluteToLocal(absolutePoint, UseTransforms));
+    IntRect localBounds(0, 0, box().pixelSnappedWidth(), box().pixelSnappedHeight());
+    return resizerCornerRect(localBounds, resizerHitTestType).contains(localPoint);
+}
+
+bool PaintLayerScrollableArea::hitTestResizerInFragments(const PaintLayerFragments& layerFragments, const HitTestLocation& hitTestLocation) const
+{
+    if (!box().canResize())
+        return false;
+
+    if (layerFragments.isEmpty())
+        return false;
+
+    for (int i = layerFragments.size() - 1; i >= 0; --i) {
+        const PaintLayerFragment& fragment = layerFragments.at(i);
+        if (fragment.backgroundRect.intersects(hitTestLocation) && resizerCornerRect(pixelSnappedIntRect(fragment.layerBounds), ResizerForPointer).contains(hitTestLocation.roundedPoint()))
+            return true;
+    }
+
+    return false;
+}
+
+void PaintLayerScrollableArea::updateResizerAreaSet()
+{
+    LocalFrame* frame = box().frame();
+    if (!frame)
+        return;
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return;
+    if (box().canResize())
+        frameView->addResizerArea(box());
+    else
+        frameView->removeResizerArea(box());
+}
+
+void PaintLayerScrollableArea::updateResizerStyle()
+{
+    if (!m_resizer && !box().canResize())
+        return;
+
+    const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(box());
+    RefPtr<ComputedStyle> resizer = box().hasOverflowClip() ? actualLayoutObject.getUncachedPseudoStyle(PseudoStyleRequest(RESIZER), actualLayoutObject.style()) : PassRefPtr<ComputedStyle>(nullptr);
+    if (resizer) {
+        if (!m_resizer) {
+            m_resizer = LayoutScrollbarPart::createAnonymous(&box().document());
+            m_resizer->setDangerousOneWayParent(&box());
+        }
+        m_resizer->setStyle(resizer.release());
+    } else if (m_resizer) {
+        m_resizer->destroy();
+        m_resizer = nullptr;
+    }
+}
+
+IntSize PaintLayerScrollableArea::offsetFromResizeCorner(const IntPoint& absolutePoint) const
+{
+    // Currently the resize corner is either the bottom right corner or the bottom left corner.
+    // FIXME: This assumes the location is 0, 0. Is this guaranteed to always be the case?
+    IntSize elementSize = layer()->size();
+    if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
+        elementSize.setWidth(0);
+    IntPoint resizerPoint = IntPoint(elementSize);
+    IntPoint localPoint = roundedIntPoint(box().absoluteToLocal(absolutePoint, UseTransforms));
+    return localPoint - resizerPoint;
+}
+
+void PaintLayerScrollableArea::resize(const PlatformEvent& evt, const LayoutSize& oldOffset)
+{
+    // FIXME: This should be possible on generated content but is not right now.
+    if (!inResizeMode() || !box().canResize() || !box().node())
+        return;
+
+    ASSERT(box().node()->isElementNode());
+    Element* element = toElement(box().node());
+
+    Document& document = element->document();
+
+    IntPoint pos;
+    const PlatformGestureEvent* gevt = 0;
+
+    switch (evt.type()) {
+    case PlatformEvent::MouseMoved:
+        if (!document.frame()->eventHandler().mousePressed())
+            return;
+        pos = static_cast<const PlatformMouseEvent*>(&evt)->position();
+        break;
+    case PlatformEvent::GestureScrollUpdate:
+        pos = static_cast<const PlatformGestureEvent*>(&evt)->position();
+        gevt = static_cast<const PlatformGestureEvent*>(&evt);
+        pos = gevt->position();
+        pos.move(gevt->deltaX(), gevt->deltaY());
+        break;
+    default:
+        ASSERT_NOT_REACHED();
+    }
+
+    float zoomFactor = box().style()->effectiveZoom();
+
+    IntSize newOffset = offsetFromResizeCorner(document.view()->rootFrameToContents(pos));
+    newOffset.setWidth(newOffset.width() / zoomFactor);
+    newOffset.setHeight(newOffset.height() / zoomFactor);
+
+    LayoutSize currentSize = box().size();
+    currentSize.scale(1 / zoomFactor);
+    LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentSize);
+    element->setMinimumSizeForResizing(minimumSize);
+
+    LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, oldOffset.height() / zoomFactor);
+    if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
+        newOffset.setWidth(-newOffset.width());
+        adjustedOldOffset.setWidth(-adjustedOldOffset.width());
+    }
+
+    LayoutSize difference((currentSize + newOffset - adjustedOldOffset).expandedTo(minimumSize) - currentSize);
+
+    bool isBoxSizingBorder = box().style()->boxSizing() == BORDER_BOX;
+
+    EResize resize = box().style()->resize();
+    if (resize != RESIZE_VERTICAL && difference.width()) {
+        if (element->isFormControlElement()) {
+            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
+            element->setInlineStyleProperty(CSSPropertyMarginLeft, box().marginLeft() / zoomFactor, CSSPrimitiveValue::UnitType::Pixels);
+            element->setInlineStyleProperty(CSSPropertyMarginRight, box().marginRight() / zoomFactor, CSSPrimitiveValue::UnitType::Pixels);
+        }
+        LayoutUnit baseWidth = box().size().width() - (isBoxSizingBorder ? LayoutUnit() : box().borderAndPaddingWidth());
+        baseWidth = baseWidth / zoomFactor;
+        element->setInlineStyleProperty(CSSPropertyWidth, roundToInt(baseWidth + difference.width()), CSSPrimitiveValue::UnitType::Pixels);
+    }
+
+    if (resize != RESIZE_HORIZONTAL && difference.height()) {
+        if (element->isFormControlElement()) {
+            // Make implicit margins from the theme explicit (see <http://bugs.webkit.org/show_bug.cgi?id=9547>).
+            element->setInlineStyleProperty(CSSPropertyMarginTop, box().marginTop() / zoomFactor, CSSPrimitiveValue::UnitType::Pixels);
+            element->setInlineStyleProperty(CSSPropertyMarginBottom, box().marginBottom() / zoomFactor, CSSPrimitiveValue::UnitType::Pixels);
+        }
+        LayoutUnit baseHeight = box().size().height() - (isBoxSizingBorder ? LayoutUnit() : box().borderAndPaddingHeight());
+        baseHeight = baseHeight / zoomFactor;
+        element->setInlineStyleProperty(CSSPropertyHeight, roundToInt(baseHeight + difference.height()), CSSPrimitiveValue::UnitType::Pixels);
+    }
+
+    document.updateLayout();
+
+    // FIXME (Radar 4118564): We should also autoscroll the window as necessary to keep the point under the cursor in view.
+}
+
+LayoutRect PaintLayerScrollableArea::scrollIntoView(const LayoutRect& rect, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
+{
+    LayoutRect localExposeRect(box().absoluteToLocalQuad(FloatQuad(FloatRect(rect)), UseTransforms).boundingBox());
+    localExposeRect.move(-box().borderLeft(), -box().borderTop());
+    LayoutRect layerBounds(0, 0, box().clientWidth(), box().clientHeight());
+    LayoutRect r = ScrollAlignment::getRectToExpose(layerBounds, localExposeRect, alignX, alignY);
+
+    DoublePoint clampedScrollPosition = clampScrollPosition(scrollPositionDouble() + roundedIntSize(r.location()));
+    if (clampedScrollPosition == scrollPositionDouble())
+        return rect;
+
+    DoubleSize oldScrollOffset = adjustedScrollOffset();
+    scrollToPosition(clampedScrollPosition);
+    DoubleSize scrollOffsetDifference = adjustedScrollOffset() - oldScrollOffset;
+    localExposeRect.move(-LayoutSize(scrollOffsetDifference));
+    return LayoutRect(box().localToAbsoluteQuad(FloatQuad(FloatRect(localExposeRect)), UseTransforms).boundingBox());
+}
+
+void PaintLayerScrollableArea::updateScrollableAreaSet(bool hasOverflow)
+{
+    LocalFrame* frame = box().frame();
+    if (!frame)
+        return;
+
+    FrameView* frameView = frame->view();
+    if (!frameView)
+        return;
+
+    // FIXME: Does this need to be fixed later for OOPI?
+    bool isVisibleToHitTest = box().visibleToHitTesting();
+    if (HTMLFrameOwnerElement* owner = frame->deprecatedLocalOwner())
+        isVisibleToHitTest &= owner->layoutObject() && owner->layoutObject()->visibleToHitTesting();
+
+    bool didScrollOverflow = m_scrollsOverflow;
+
+    m_scrollsOverflow = hasOverflow && isVisibleToHitTest;
+    if (didScrollOverflow == scrollsOverflow())
+        return;
+
+    if (m_scrollsOverflow) {
+        ASSERT(canHaveOverflowScrollbars(box()));
+        frameView->addScrollableArea(this);
+    } else {
+        frameView->removeScrollableArea(this);
+    }
+}
+
+void PaintLayerScrollableArea::updateCompositingLayersAfterScroll()
+{
+    PaintLayerCompositor* compositor = box().view()->compositor();
+    if (compositor->inCompositingMode()) {
+        if (usesCompositedScrolling()) {
+            ASSERT(layer()->hasCompositedLayerMapping());
+            layer()->compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdateSubtree);
+            compositor->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange);
+        } else {
+            layer()->setNeedsCompositingInputsUpdate();
+        }
+    }
+}
+
+bool PaintLayerScrollableArea::usesCompositedScrolling() const
+{
+    // Scroll form controls on the main thread so they exhibit correct touch scroll event bubbling
+    if (box().isIntrinsicallyScrollable(VerticalScrollbar) || box().isIntrinsicallyScrollable(HorizontalScrollbar))
+        return false;
+
+    // See https://codereview.chromium.org/176633003/ for the tests that fail without this disabler.
+    DisableCompositingQueryAsserts disabler;
+    return layer()->hasCompositedLayerMapping() && layer()->compositedLayerMapping()->scrollingLayer();
+}
+
+static bool layerNeedsCompositedScrolling(PaintLayerScrollableArea::LCDTextMode mode, const PaintLayer* layer)
+{
+    if (mode == PaintLayerScrollableArea::ConsiderLCDText && !layer->compositor()->preferCompositingToLCDTextEnabled())
+        return false;
+
+    return layer->scrollsOverflow()
+        && !layer->hasDescendantWithClipPath()
+        && !layer->hasAncestorWithClipPath()
+        && !layer->layoutObject()->style()->hasBorderRadius();
+}
+
+void PaintLayerScrollableArea::updateNeedsCompositedScrolling(LCDTextMode mode)
+{
+    const bool needsCompositedScrolling = layerNeedsCompositedScrolling(mode, layer());
+    if (static_cast<bool>(m_needsCompositedScrolling) != needsCompositedScrolling) {
+        m_needsCompositedScrolling = needsCompositedScrolling;
+        layer()->didUpdateNeedsCompositedScrolling();
+    }
+}
+
+void PaintLayerScrollableArea::setTopmostScrollChild(PaintLayer* scrollChild)
+{
+    // We only want to track the topmost scroll child for scrollable areas with
+    // overlay scrollbars.
+    if (!hasOverlayScrollbars())
+        return;
+    m_nextTopmostScrollChild = scrollChild;
+}
+
+bool PaintLayerScrollableArea::visualViewportSuppliesScrollbars() const
+{
+    if (!layer()->isRootLayer())
+        return false;
+
+    LocalFrame* frame = box().frame();
+    if (!frame || !frame->isMainFrame() || !frame->settings())
+        return false;
+
+    return frame->settings()->viewportMetaEnabled();
+}
+
+PaintLayerScrollableArea::ScrollbarManager::ScrollbarManager(PaintLayerScrollableArea& scrollableArea)
+    : m_scrollableArea(&scrollableArea)
+    , m_canDetachScrollbars(0)
+    , m_hBarIsAttached(0)
+    , m_vBarIsAttached(0)
+{
+}
+
+void PaintLayerScrollableArea::ScrollbarManager::dispose()
+{
+    m_canDetachScrollbars = m_hBarIsAttached = m_vBarIsAttached = 0;
+    destroyScrollbar(HorizontalScrollbar);
+    destroyScrollbar(VerticalScrollbar);
+}
+
+void PaintLayerScrollableArea::ScrollbarManager::setCanDetachScrollbars(bool detach)
+{
+    ASSERT(!m_hBarIsAttached || m_hBar);
+    ASSERT(!m_vBarIsAttached || m_vBar);
+    m_canDetachScrollbars = detach ? 1 : 0;
+    if (!detach) {
+        if (m_hBar && !m_hBarIsAttached)
+            destroyScrollbar(HorizontalScrollbar, true);
+        if (m_vBar && !m_vBarIsAttached)
+            destroyScrollbar(VerticalScrollbar, true);
+    }
+}
+
+void PaintLayerScrollableArea::ScrollbarManager::setHasHorizontalScrollbar(bool hasScrollbar)
+{
+    if (hasScrollbar) {
+        // This doesn't hit in any tests, but since the equivalent code in setHasVerticalScrollbar
+        // does, presumably this code does as well.
+        DisableCompositingQueryAsserts disabler;
+        if (!m_hBar)
+            m_hBar = createScrollbar(HorizontalScrollbar);
+        m_hBarIsAttached = 1;
+    } else {
+        m_hBarIsAttached = 0;
+        if (!m_canDetachScrollbars)
+            destroyScrollbar(HorizontalScrollbar);
+    }
+}
+
+void PaintLayerScrollableArea::ScrollbarManager::setHasVerticalScrollbar(bool hasScrollbar)
+{
+    if (hasScrollbar) {
+        DisableCompositingQueryAsserts disabler;
+        if (!m_vBar)
+            m_vBar = createScrollbar(VerticalScrollbar);
+        m_vBarIsAttached = 1;
+    } else {
+        m_vBarIsAttached = 0;
+        if (!m_canDetachScrollbars)
+            destroyScrollbar(VerticalScrollbar);
+    }
+}
+
+PassRefPtrWillBeRawPtr<Scrollbar> PaintLayerScrollableArea::ScrollbarManager::createScrollbar(ScrollbarOrientation orientation)
+{
+    ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached : !m_vBarIsAttached);
+    RefPtrWillBeRawPtr<Scrollbar> widget = nullptr;
+    const LayoutObject& actualLayoutObject = layoutObjectForScrollbar(m_scrollableArea->box());
+    bool hasCustomScrollbarStyle = actualLayoutObject.isBox() && actualLayoutObject.styleRef().hasPseudoStyle(SCROLLBAR);
+    if (hasCustomScrollbarStyle) {
+        widget = LayoutScrollbar::createCustomScrollbar(m_scrollableArea.get(), orientation, actualLayoutObject.node());
+    } else {
+        ScrollbarControlSize scrollbarSize = RegularScrollbar;
+        if (actualLayoutObject.styleRef().hasAppearance())
+            scrollbarSize = LayoutTheme::theme().scrollbarControlSizeForPart(actualLayoutObject.styleRef().appearance());
+        widget = Scrollbar::create(m_scrollableArea.get(), orientation, scrollbarSize);
+        if (orientation == HorizontalScrollbar)
+            m_scrollableArea->didAddScrollbar(widget.get(), HorizontalScrollbar);
+        else
+            m_scrollableArea->didAddScrollbar(widget.get(), VerticalScrollbar);
+    }
+    m_scrollableArea->box().document().view()->addChild(widget.get());
+    return widget.release();
+}
+
+void PaintLayerScrollableArea::ScrollbarManager::destroyScrollbar(ScrollbarOrientation orientation, bool invalidate)
+{
+    RefPtrWillBeMember<Scrollbar>& scrollbar = orientation == HorizontalScrollbar ? m_hBar : m_vBar;
+    ASSERT(orientation == HorizontalScrollbar ? !m_hBarIsAttached: !m_vBarIsAttached);
+    if (!scrollbar)
+        return;
+
+    if (invalidate)
+        scrollbar->invalidate();
+    if (!scrollbar->isCustomScrollbar())
+        m_scrollableArea->willRemoveScrollbar(scrollbar.get(), orientation);
+
+    toFrameView(scrollbar->parent())->removeChild(scrollbar.get());
+    scrollbar->disconnectFromScrollableArea();
+    scrollbar = nullptr;
+}
+
+DEFINE_TRACE(PaintLayerScrollableArea::ScrollbarManager)
+{
+    visitor->trace(m_scrollableArea);
+    visitor->trace(m_hBar);
+    visitor->trace(m_vBar);
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
new file mode 100644
index 0000000..3e5cdeb
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
@@ -0,0 +1,359 @@
+/*
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef PaintLayerScrollableArea_h
+#define PaintLayerScrollableArea_h
+
+#include "core/CoreExport.h"
+#include "core/layout/LayoutBox.h"
+#include "core/paint/PaintLayerFragment.h"
+#include "platform/heap/Handle.h"
+#include "platform/scroll/ScrollableArea.h"
+
+namespace blink {
+
+enum ResizerHitTestType {
+    ResizerForPointer,
+    ResizerForTouch
+};
+
+class PlatformEvent;
+class LayoutBox;
+class PaintLayer;
+class LayoutScrollbarPart;
+
+class CORE_EXPORT PaintLayerScrollableArea final : public NoBaseWillBeGarbageCollectedFinalized<PaintLayerScrollableArea>, public ScrollableArea {
+    WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(PaintLayerScrollableArea);
+    WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PaintLayerScrollableArea);
+    friend class Internals;
+
+private:
+    class ScrollbarManager {
+        DISALLOW_ALLOCATION();
+
+        // Helper class to manage the life cycle of Scrollbar objects.  Some layout containers
+        // (e.g., flexbox, table) run multi-pass layout on their children, applying different
+        // constraints.  If a child has overflow:auto, it may gain and lose scrollbars multiple
+        // times during multi-pass layout, causing pointless allocation/deallocation thrashing,
+        // and potentially leading to other problems (crbug.com/528940).
+
+        // ScrollbarManager allows a ScrollableArea to delay the destruction of a scrollbar that
+        // is no longer needed, until the end of multi-pass layout.  If the scrollbar is then
+        // re-added before multi-pass layout finishes, the previously "deleted" scrollbar will
+        // be restored, rather than constructing a new one.
+    public:
+        ScrollbarManager(PaintLayerScrollableArea&);
+
+        void dispose();
+
+        // When canDetachScrollbars is true, calls to setHas*Scrollbar(false) will NOT destroy
+        // an existing scrollbar, but instead detach it without destroying it.  If, subsequently,
+        // setHas*Scrollbar(true) is called, the existing scrollbar will be reattached.  When
+        // setCanDetachScrollbars(false) is called, any detached scrollbars will be destructed.
+        bool canDetachScrollbars() const { return m_canDetachScrollbars; }
+        void setCanDetachScrollbars(bool);
+
+        Scrollbar* horizontalScrollbar() const { return m_hBarIsAttached ? m_hBar.get(): nullptr; }
+        Scrollbar* verticalScrollbar() const { return m_vBarIsAttached ? m_vBar.get() : nullptr; }
+        bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
+        bool hasVerticalScrollbar() const { return verticalScrollbar(); }
+
+        void setHasHorizontalScrollbar(bool hasScrollbar);
+        void setHasVerticalScrollbar(bool hasScrollbar);
+
+        DECLARE_TRACE();
+
+    private:
+        PassRefPtrWillBeRawPtr<Scrollbar> createScrollbar(ScrollbarOrientation);
+        void destroyScrollbar(ScrollbarOrientation, bool invalidate = false);
+
+    private:
+        RawPtrWillBeMember<PaintLayerScrollableArea> m_scrollableArea;
+        RefPtrWillBeMember<Scrollbar> m_hBar;
+        RefPtrWillBeMember<Scrollbar> m_vBar;
+        unsigned m_canDetachScrollbars: 1;
+        unsigned m_hBarIsAttached: 1;
+        unsigned m_vBarIsAttached: 1;
+    };
+
+public:
+    // FIXME: We should pass in the LayoutBox but this opens a window
+    // for crashers during PaintLayer setup (see crbug.com/368062).
+    static PassOwnPtrWillBeRawPtr<PaintLayerScrollableArea> create(PaintLayer& layer)
+    {
+        return adoptPtrWillBeNoop(new PaintLayerScrollableArea(layer));
+    }
+
+    ~PaintLayerScrollableArea() override;
+    void dispose();
+
+    bool hasHorizontalScrollbar() const { return horizontalScrollbar(); }
+    bool hasVerticalScrollbar() const { return verticalScrollbar(); }
+
+    Scrollbar* horizontalScrollbar() const override { return m_scrollbarManager.horizontalScrollbar(); }
+    Scrollbar* verticalScrollbar() const override { return m_scrollbarManager.verticalScrollbar(); }
+
+    HostWindow* hostWindow() const override;
+
+    GraphicsLayer* layerForScrolling() const override;
+    GraphicsLayer* layerForHorizontalScrollbar() const override;
+    GraphicsLayer* layerForVerticalScrollbar() const override;
+    GraphicsLayer* layerForScrollCorner() const override;
+    bool usesCompositedScrolling() const override;
+    void invalidateScrollbarRect(Scrollbar*, const IntRect&) override;
+    void invalidateScrollCornerRect(const IntRect&) override;
+    bool shouldUseIntegerScrollOffset() const override;
+    bool isActive() const override;
+    bool isScrollCornerVisible() const override;
+    IntRect scrollCornerRect() const override;
+    IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const override;
+    IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const override;
+    IntPoint convertFromScrollbarToContainingView(const Scrollbar*, const IntPoint&) const override;
+    IntPoint convertFromContainingViewToScrollbar(const Scrollbar*, const IntPoint&) const override;
+    int scrollSize(ScrollbarOrientation) const override;
+    IntPoint scrollPosition() const override;
+    DoublePoint scrollPositionDouble() const override;
+    IntPoint minimumScrollPosition() const override;
+    IntPoint maximumScrollPosition() const override;
+    IntRect visibleContentRect(IncludeScrollbarsInRect = ExcludeScrollbars) const override;
+    int visibleHeight() const override;
+    int visibleWidth() const override;
+    IntSize contentsSize() const override;
+    IntPoint lastKnownMousePosition() const override;
+    bool scrollAnimatorEnabled() const override;
+    bool shouldSuspendScrollAnimations() const override;
+    bool scrollbarsCanBeActive() const override;
+    void scrollbarVisibilityChanged() override;
+    IntRect scrollableAreaBoundingBox() const override;
+    void registerForAnimation() override;
+    void deregisterForAnimation() override;
+    bool userInputScrollable(ScrollbarOrientation) const override;
+    bool shouldPlaceVerticalScrollbarOnLeft() const override;
+    int pageStep(ScrollbarOrientation) const override;
+    ScrollBehavior scrollBehaviorStyle() const override;
+
+    double scrollXOffset() const { return m_scrollOffset.width() + scrollOrigin().x(); }
+    double scrollYOffset() const { return m_scrollOffset.height() + scrollOrigin().y(); }
+
+    DoubleSize scrollOffset() const { return m_scrollOffset; }
+
+    // FIXME: We shouldn't allow access to m_overflowRect outside this class.
+    LayoutRect overflowRect() const { return m_overflowRect; }
+
+    void scrollToPosition(const DoublePoint& scrollPosition, ScrollOffsetClamping = ScrollOffsetUnclamped, ScrollBehavior = ScrollBehaviorInstant);
+
+    void scrollToOffset(const DoubleSize& scrollOffset, ScrollOffsetClamping clamp = ScrollOffsetUnclamped, ScrollBehavior scrollBehavior = ScrollBehaviorInstant)
+    {
+        scrollToPosition(-scrollOrigin() + scrollOffset, clamp, scrollBehavior);
+    }
+
+    void scrollToXOffset(double x, ScrollOffsetClamping clamp = ScrollOffsetUnclamped, ScrollBehavior scrollBehavior = ScrollBehaviorInstant)
+    {
+        scrollToOffset(DoubleSize(x, scrollYOffset()), clamp, scrollBehavior);
+    }
+
+    void scrollToYOffset(double y, ScrollOffsetClamping clamp = ScrollOffsetUnclamped, ScrollBehavior scrollBehavior = ScrollBehaviorInstant)
+    {
+        scrollToOffset(DoubleSize(scrollXOffset(), y), clamp, scrollBehavior);
+    }
+
+    void setScrollPosition(const DoublePoint& position, ScrollType scrollType, ScrollBehavior scrollBehavior = ScrollBehaviorInstant) override
+    {
+        scrollToOffset(toDoubleSize(position), ScrollOffsetClamped, scrollBehavior);
+    }
+
+    void updateScrollDimensions(DoubleSize& scrollOffset, bool& autoHorizontalScrollBarChanged, bool& autoVerticalScrollBarChanged);
+    void finalizeScrollDimensions(const DoubleSize& originalScrollOffset, bool autoHorizontalScrollBarChanged, bool autoVerticalScrollBarChanged);
+
+    void updateAfterLayout();
+    void updateAfterStyleChange(const ComputedStyle*);
+    void updateAfterOverflowRecalc();
+
+    bool updateAfterCompositingChange() override;
+
+    bool hasScrollbar() const { return hasHorizontalScrollbar() || hasVerticalScrollbar(); }
+
+    LayoutScrollbarPart* scrollCorner() const { return m_scrollCorner; }
+
+    void resize(const PlatformEvent&, const LayoutSize&);
+    IntSize offsetFromResizeCorner(const IntPoint& absolutePoint) const;
+
+    bool inResizeMode() const { return m_inResizeMode; }
+    void setInResizeMode(bool inResizeMode) { m_inResizeMode = inResizeMode; }
+
+    IntRect touchResizerCornerRect(const IntRect& bounds) const
+    {
+        return resizerCornerRect(bounds, ResizerForTouch);
+    }
+
+    LayoutUnit scrollWidth() const;
+    LayoutUnit scrollHeight() const;
+    int pixelSnappedScrollWidth() const;
+    int pixelSnappedScrollHeight() const;
+
+    int verticalScrollbarWidth(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
+    int horizontalScrollbarHeight(OverlayScrollbarSizeRelevancy = IgnoreOverlayScrollbarSize) const;
+
+    DoubleSize adjustedScrollOffset() const { return DoubleSize(scrollXOffset(), scrollYOffset()); }
+
+    void positionOverflowControls();
+
+    // isPointInResizeControl() is used for testing if a pointer/touch position is in the resize control
+    // area.
+    bool isPointInResizeControl(const IntPoint& absolutePoint, ResizerHitTestType) const;
+    bool hitTestOverflowControls(HitTestResult&, const IntPoint& localPoint);
+
+    bool hitTestResizerInFragments(const PaintLayerFragments&, const HitTestLocation&) const;
+
+    LayoutRect scrollIntoView(const LayoutRect&, const ScrollAlignment& alignX, const ScrollAlignment& alignY) override;
+
+    // Returns true if scrollable area is in the FrameView's collection of scrollable areas. This can
+    // only happen if we're scrollable, visible to hit test, and do in fact overflow. This means that
+    // 'overflow: hidden' or 'pointer-events: none' layers never get added to the FrameView's collection.
+    bool scrollsOverflow() const { return m_scrollsOverflow; }
+
+    // Rectangle encompassing the scroll corner and resizer rect.
+    IntRect scrollCornerAndResizerRect() const;
+
+    enum LCDTextMode {
+        ConsiderLCDText,
+        IgnoreLCDText
+    };
+
+    void updateNeedsCompositedScrolling(LCDTextMode = ConsiderLCDText);
+    bool needsCompositedScrolling() const { return m_needsCompositedScrolling; }
+
+    // These are used during compositing updates to determine if the overflow
+    // controls need to be repositioned in the GraphicsLayer tree.
+    void setTopmostScrollChild(PaintLayer*);
+    PaintLayer* topmostScrollChild() const { ASSERT(!m_nextTopmostScrollChild); return m_topmostScrollChild; }
+
+    IntRect resizerCornerRect(const IntRect&, ResizerHitTestType) const;
+
+    LayoutBox& box() const;
+    PaintLayer* layer() const;
+
+    LayoutScrollbarPart* resizer() { return m_resizer; }
+
+    const IntPoint& cachedOverlayScrollbarOffset() { return m_cachedOverlayScrollbarOffset; }
+    void setCachedOverlayScrollbarOffset(const IntPoint& offset) { m_cachedOverlayScrollbarOffset = offset; }
+
+    IntRect rectForHorizontalScrollbar(const IntRect& borderBoxRect) const;
+    IntRect rectForVerticalScrollbar(const IntRect& borderBoxRect) const;
+
+    DECLARE_VIRTUAL_TRACE();
+
+private:
+    explicit PaintLayerScrollableArea(PaintLayer&);
+
+    bool hasHorizontalOverflow() const;
+    bool hasVerticalOverflow() const;
+    bool hasScrollableHorizontalOverflow() const;
+    bool hasScrollableVerticalOverflow() const;
+    bool visualViewportSuppliesScrollbars() const;
+
+    bool needsScrollbarReconstruction() const;
+
+    void computeScrollDimensions();
+
+    void setScrollOffset(const IntPoint&, ScrollType) override;
+    void setScrollOffset(const DoublePoint&, ScrollType) override;
+
+    LayoutUnit verticalScrollbarStart(int minX, int maxX) const;
+    LayoutUnit horizontalScrollbarStart(int minX) const;
+    IntSize scrollbarOffset(const Scrollbar*) const;
+
+    void setHasHorizontalScrollbar(bool hasScrollbar);
+    void setHasVerticalScrollbar(bool hasScrollbar);
+
+    void updateScrollCornerStyle();
+
+    // See comments on isPointInResizeControl.
+    void updateResizerAreaSet();
+    void updateResizerStyle();
+
+
+    void updateScrollableAreaSet(bool hasOverflow);
+
+    void updateCompositingLayersAfterScroll();
+
+    PaintLayer& m_layer;
+
+    // Keeps track of whether the layer is currently resizing, so events can cause resizing to start and stop.
+    unsigned m_inResizeMode : 1;
+    unsigned m_scrollsOverflow : 1;
+
+    unsigned m_inOverflowRelayout : 1;
+
+    PaintLayer* m_nextTopmostScrollChild;
+    PaintLayer* m_topmostScrollChild;
+
+    // FIXME: once cc can handle composited scrolling with clip paths, we will
+    // no longer need this bit.
+    unsigned m_needsCompositedScrolling : 1;
+
+    // The width/height of our scrolled area.
+    LayoutRect m_overflowRect;
+
+    // ScrollbarManager holds the Scrollbar instances.
+    ScrollbarManager m_scrollbarManager;
+
+    // This is the (scroll) offset from scrollOrigin().
+    DoubleSize m_scrollOffset;
+
+    IntPoint m_cachedOverlayScrollbarOffset;
+
+    // LayoutObject to hold our custom scroll corner.
+    LayoutScrollbarPart* m_scrollCorner;
+
+    // LayoutObject to hold our custom resizer.
+    LayoutScrollbarPart* m_resizer;
+
+#if ENABLE(ASSERT)
+    bool m_hasBeenDisposed;
+#endif
+};
+
+} // namespace blink
+
+#endif // LayerScrollableArea_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp
new file mode 100644
index 0000000..5e6acd6
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.cpp
@@ -0,0 +1,264 @@
+/*
+ * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#include "config.h"
+#include "core/paint/PaintLayerStackingNode.h"
+
+#include "core/layout/LayoutView.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/paint/PaintLayer.h"
+#include "public/platform/Platform.h"
+
+namespace blink {
+
+// FIXME: This should not require PaintLayer. There is currently a cycle where
+// in order to determine if we shoulBeTreatedAsStackingContext() we have to ask the paint
+// layer about some of its state.
+PaintLayerStackingNode::PaintLayerStackingNode(PaintLayer* layer)
+    : m_layer(layer)
+#if ENABLE(ASSERT)
+    , m_layerListMutationAllowed(true)
+    , m_stackingParent(0)
+#endif
+{
+    m_isTreatedAsOrStackingContext = shouldBeTreatedAsOrStackingContext();
+
+    // Non-stacking contexts should have empty z-order lists. As this is already the case,
+    // there is no need to dirty / recompute these lists.
+    m_zOrderListsDirty = isStackingContext();
+}
+
+PaintLayerStackingNode::~PaintLayerStackingNode()
+{
+#if ENABLE(ASSERT)
+    if (!layoutObject()->documentBeingDestroyed()) {
+        ASSERT(!isInStackingParentZOrderLists());
+
+        updateStackingParentForZOrderLists(0);
+    }
+#endif
+}
+
+// Helper for the sorting of layers by z-index.
+static inline bool compareZIndex(PaintLayerStackingNode* first, PaintLayerStackingNode* second)
+{
+    return first->zIndex() < second->zIndex();
+}
+
+PaintLayerCompositor* PaintLayerStackingNode::compositor() const
+{
+    ASSERT(layoutObject()->view());
+    return layoutObject()->view()->compositor();
+}
+
+void PaintLayerStackingNode::dirtyZOrderLists()
+{
+    ASSERT(m_layerListMutationAllowed);
+    ASSERT(isStackingContext());
+
+#if ENABLE(ASSERT)
+    updateStackingParentForZOrderLists(0);
+#endif
+
+    if (m_posZOrderList)
+        m_posZOrderList->clear();
+    if (m_negZOrderList)
+        m_negZOrderList->clear();
+    m_zOrderListsDirty = true;
+
+    if (!layoutObject()->documentBeingDestroyed())
+        compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
+}
+
+void PaintLayerStackingNode::dirtyStackingContextZOrderLists()
+{
+    if (PaintLayerStackingNode* stackingNode = ancestorStackingContextNode())
+        stackingNode->dirtyZOrderLists();
+}
+
+void PaintLayerStackingNode::rebuildZOrderLists()
+{
+    ASSERT(m_layerListMutationAllowed);
+    ASSERT(isDirtyStackingContext());
+
+    for (PaintLayer* child = layer()->firstChild(); child; child = child->nextSibling()) {
+        if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflectionLayer() != child)
+            child->stackingNode()->collectLayers(m_posZOrderList, m_negZOrderList);
+    }
+
+    // Sort the two lists.
+    if (m_posZOrderList)
+        std::stable_sort(m_posZOrderList->begin(), m_posZOrderList->end(), compareZIndex);
+
+    if (m_negZOrderList)
+        std::stable_sort(m_negZOrderList->begin(), m_negZOrderList->end(), compareZIndex);
+
+    // Append layers for top layer elements after normal layer collection, to ensure they are on top regardless of z-indexes.
+    // The layoutObjects of top layer elements are children of the view, sorted in top layer stacking order.
+    if (layer()->isRootLayer()) {
+        LayoutView* view = layoutObject()->view();
+        for (LayoutObject* child = view->firstChild(); child; child = child->nextSibling()) {
+            Element* childElement = (child->node() && child->node()->isElementNode()) ? toElement(child->node()) : 0;
+            if (childElement && childElement->isInTopLayer()) {
+                PaintLayer* layer = toLayoutBoxModelObject(child)->layer();
+                // Create the buffer if it doesn't exist yet.
+                if (!m_posZOrderList)
+                    m_posZOrderList = adoptPtr(new Vector<PaintLayerStackingNode*>);
+                m_posZOrderList->append(layer->stackingNode());
+            }
+        }
+    }
+
+#if ENABLE(ASSERT)
+    updateStackingParentForZOrderLists(this);
+#endif
+
+    m_zOrderListsDirty = false;
+}
+
+void PaintLayerStackingNode::collectLayers(OwnPtr<Vector<PaintLayerStackingNode*>>& posBuffer, OwnPtr<Vector<PaintLayerStackingNode*>>& negBuffer)
+{
+    if (layer()->isInTopLayer())
+        return;
+
+    if (isTreatedAsOrStackingContext()) {
+        OwnPtr<Vector<PaintLayerStackingNode*>>& buffer = (zIndex() >= 0) ? posBuffer : negBuffer;
+        if (!buffer)
+            buffer = adoptPtr(new Vector<PaintLayerStackingNode*>);
+        buffer->append(this);
+    }
+
+    if (!isStackingContext()) {
+        for (PaintLayer* child = layer()->firstChild(); child; child = child->nextSibling()) {
+            if (!layer()->reflectionInfo() || layer()->reflectionInfo()->reflectionLayer() != child)
+                child->stackingNode()->collectLayers(posBuffer, negBuffer);
+        }
+    }
+}
+
+#if ENABLE(ASSERT)
+bool PaintLayerStackingNode::isInStackingParentZOrderLists() const
+{
+    if (!m_stackingParent || m_stackingParent->zOrderListsDirty())
+        return false;
+
+    if (m_stackingParent->posZOrderList() && m_stackingParent->posZOrderList()->find(this) != kNotFound)
+        return true;
+
+    if (m_stackingParent->negZOrderList() && m_stackingParent->negZOrderList()->find(this) != kNotFound)
+        return true;
+
+    return false;
+}
+
+void PaintLayerStackingNode::updateStackingParentForZOrderLists(PaintLayerStackingNode* stackingParent)
+{
+    if (m_posZOrderList) {
+        for (size_t i = 0; i < m_posZOrderList->size(); ++i)
+            m_posZOrderList->at(i)->setStackingParent(stackingParent);
+    }
+
+    if (m_negZOrderList) {
+        for (size_t i = 0; i < m_negZOrderList->size(); ++i)
+            m_negZOrderList->at(i)->setStackingParent(stackingParent);
+    }
+}
+
+#endif
+
+void PaintLayerStackingNode::updateLayerListsIfNeeded()
+{
+    updateZOrderLists();
+
+    if (!layer()->reflectionInfo())
+        return;
+
+    PaintLayer* reflectionLayer = layer()->reflectionInfo()->reflectionLayer();
+    reflectionLayer->stackingNode()->updateZOrderLists();
+}
+
+void PaintLayerStackingNode::updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle)
+{
+    bool wasStackingContext = oldStyle ? !oldStyle->hasAutoZIndex() : false;
+    int oldZIndex = oldStyle ? oldStyle->zIndex() : 0;
+
+    bool isStackingContext = this->isStackingContext();
+    if (isStackingContext == wasStackingContext && oldZIndex == zIndex())
+        return;
+
+    dirtyStackingContextZOrderLists();
+
+    if (isStackingContext)
+        dirtyZOrderLists();
+    else
+        clearZOrderLists();
+}
+
+void PaintLayerStackingNode::updateIsTreatedAsStackingContext()
+{
+    bool isTreatedAsOrStackingContext = shouldBeTreatedAsOrStackingContext();
+    if (isTreatedAsOrStackingContext == this->isTreatedAsOrStackingContext())
+        return;
+
+    m_isTreatedAsOrStackingContext = isTreatedAsOrStackingContext;
+    if (!layoutObject()->documentBeingDestroyed() && !layer()->isRootLayer())
+        compositor()->setNeedsCompositingUpdate(CompositingUpdateRebuildTree);
+    dirtyStackingContextZOrderLists();
+}
+
+PaintLayerStackingNode* PaintLayerStackingNode::ancestorStackingContextNode() const
+{
+    for (PaintLayer* ancestor = layer()->parent(); ancestor; ancestor = ancestor->parent()) {
+        PaintLayerStackingNode* stackingNode = ancestor->stackingNode();
+        if (stackingNode->isStackingContext())
+            return stackingNode;
+    }
+    return 0;
+}
+
+LayoutBoxModelObject* PaintLayerStackingNode::layoutObject() const
+{
+    return m_layer->layoutObject();
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h
new file mode 100644
index 0000000..1c548212
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNode.h
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2003, 2009, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Intel Corporation. All rights reserved.
+ *
+ * Portions are Copyright (C) 1998 Netscape Communications Corporation.
+ *
+ * Other contributors:
+ *   Robert O'Callahan <roc+@cs.cmu.edu>
+ *   David Baron <dbaron@fas.harvard.edu>
+ *   Christian Biesinger <cbiesinger@web.de>
+ *   Randall Jesup <rjesup@wgate.com>
+ *   Roland Mainz <roland.mainz@informatik.med.uni-giessen.de>
+ *   Josh Soref <timeless@mac.com>
+ *   Boris Zbarsky <bzbarsky@mit.edu>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * Alternatively, the contents of this file may be used under the terms
+ * of either the Mozilla Public License Version 1.1, found at
+ * http://www.mozilla.org/MPL/ (the "MPL") or the GNU General Public
+ * License Version 2.0, found at http://www.fsf.org/copyleft/gpl.html
+ * (the "GPL"), in which case the provisions of the MPL or the GPL are
+ * applicable instead of those above.  If you wish to allow use of your
+ * version of this file only under the terms of one of those two
+ * licenses (the MPL or the GPL) and not to allow others to use your
+ * version of this file under the LGPL, indicate your decision by
+ * deletingthe provisions above and replace them with the notice and
+ * other provisions required by the MPL or the GPL, as the case may be.
+ * If you do not delete the provisions above, a recipient may use your
+ * version of this file under any of the LGPL, the MPL or the GPL.
+ */
+
+#ifndef PaintLayerStackingNode_h
+#define PaintLayerStackingNode_h
+
+#include "core/CoreExport.h"
+#include "core/layout/LayoutBoxModelObject.h"
+#include "wtf/Noncopyable.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/Vector.h"
+
+namespace blink {
+
+class PaintLayer;
+class PaintLayerCompositor;
+class ComputedStyle;
+class LayoutBoxModelObject;
+
+// PaintLayerStackingNode represents anything that is a stacking
+// context or treated as a stacking context.
+//
+// Stacking contexts are the basis for the CSS painting algorithm. The paint
+// order is determined by walking stacking contexts (or elements treated like a
+// stacking context like positioned objects or floats) in an order defined by
+// ‘z-index’. This walk is interleaved with content that is not a stacking.
+// context. See CSS 2.1 appendix E for the actual algorithm
+// http://www.w3.org/TR/CSS21/zindex.html
+// See also PaintLayerPainter (in particular paintLayerContents) for
+// our implementation of the walk.
+//
+// Stacking contexts form a subtree over the layout tree. Ideally we would want
+// objects of this class to be a node in this tree but there are potential
+// issues with stale pointers so we rely on PaintLayer's tree
+// structure.
+//
+// This class's purpose is to represent a node in the stacking context tree
+// (aka paint tree). It currently caches the z-order lists for painting and
+// hit-testing.
+//
+// To implement any z-order list iterations, use
+// PaintLayerStackingNodeIterator and
+// PaintLayerStackingNodeReverseIterator.
+//
+// This class is NOT DEPRECATED, PaintLayer is and we match its
+// naming.
+class CORE_EXPORT PaintLayerStackingNode {
+    WTF_MAKE_FAST_ALLOCATED(PaintLayerStackingNode);
+    WTF_MAKE_NONCOPYABLE(PaintLayerStackingNode);
+public:
+    explicit PaintLayerStackingNode(PaintLayer*);
+    ~PaintLayerStackingNode();
+
+    int zIndex() const { return layoutObject()->style()->zIndex(); }
+
+    bool isStackingContext() const { return layoutObject()->style()->isStackingContext(); }
+
+    // Update our normal and z-index lists.
+    void updateLayerListsIfNeeded();
+
+    bool zOrderListsDirty() const { return m_zOrderListsDirty; }
+    void dirtyZOrderLists();
+    void updateZOrderLists();
+    void clearZOrderLists();
+    void dirtyStackingContextZOrderLists();
+
+    bool hasPositiveZOrderList() const { return posZOrderList() && posZOrderList()->size(); }
+    bool hasNegativeZOrderList() const { return negZOrderList() && negZOrderList()->size(); }
+
+    bool isTreatedAsOrStackingContext() const { return m_isTreatedAsOrStackingContext; }
+    void updateIsTreatedAsStackingContext();
+
+    void updateStackingNodesAfterStyleChange(const ComputedStyle* oldStyle);
+
+    PaintLayerStackingNode* ancestorStackingContextNode() const;
+
+    PaintLayer* layer() const { return m_layer; }
+
+#if ENABLE(ASSERT)
+    bool layerListMutationAllowed() const { return m_layerListMutationAllowed; }
+    void setLayerListMutationAllowed(bool flag) { m_layerListMutationAllowed = flag; }
+#endif
+
+private:
+    friend class PaintLayerStackingNodeIterator;
+    friend class PaintLayerStackingNodeReverseIterator;
+    friend class LayoutTreeAsText;
+
+    Vector<PaintLayerStackingNode*>* posZOrderList() const
+    {
+        ASSERT(!m_zOrderListsDirty);
+        ASSERT(isStackingContext() || !m_posZOrderList);
+        return m_posZOrderList.get();
+    }
+
+    Vector<PaintLayerStackingNode*>* negZOrderList() const
+    {
+        ASSERT(!m_zOrderListsDirty);
+        ASSERT(isStackingContext() || !m_negZOrderList);
+        return m_negZOrderList.get();
+    }
+
+    void rebuildZOrderLists();
+    void collectLayers(OwnPtr<Vector<PaintLayerStackingNode*>>& posZOrderList, OwnPtr<Vector<PaintLayerStackingNode*>>& negZOrderList);
+
+#if ENABLE(ASSERT)
+    bool isInStackingParentZOrderLists() const;
+    void updateStackingParentForZOrderLists(PaintLayerStackingNode* stackingParent);
+    void setStackingParent(PaintLayerStackingNode* stackingParent) { m_stackingParent = stackingParent; }
+#endif
+
+    bool shouldBeTreatedAsOrStackingContext() const { return layoutObject()->style()->isTreatedAsOrStackingContext(); }
+
+    bool isDirtyStackingContext() const { return m_zOrderListsDirty && isStackingContext(); }
+
+    PaintLayerCompositor* compositor() const;
+    // We can't return a LayoutBox as LayoutInline can be a stacking context.
+    LayoutBoxModelObject* layoutObject() const;
+
+    PaintLayer* m_layer;
+
+    // m_posZOrderList holds a sorted list of all the descendant nodes within
+    // that have z-indices of 0 or greater (auto will count as 0).
+    // m_negZOrderList holds descendants within our stacking context with
+    // negative z-indices.
+    OwnPtr<Vector<PaintLayerStackingNode*>> m_posZOrderList;
+    OwnPtr<Vector<PaintLayerStackingNode*>> m_negZOrderList;
+
+    // This boolean caches whether the z-order lists above are dirty.
+    // It is only ever set for stacking contexts, as no other element can
+    // have z-order lists.
+    unsigned m_zOrderListsDirty : 1;
+
+    // This attribute caches whether the element was a stacking context or
+    // was treated like a stacking context, so that we can do comparison against
+    // it during style change (styleDidChange in particular), as we have lost
+    // the previous style information.
+    unsigned m_isTreatedAsOrStackingContext: 1;
+
+#if ENABLE(ASSERT)
+    unsigned m_layerListMutationAllowed : 1;
+    PaintLayerStackingNode* m_stackingParent;
+#endif
+};
+
+inline void PaintLayerStackingNode::clearZOrderLists()
+{
+    ASSERT(!isStackingContext());
+
+#if ENABLE(ASSERT)
+    updateStackingParentForZOrderLists(0);
+#endif
+
+    m_posZOrderList.clear();
+    m_negZOrderList.clear();
+}
+
+inline void PaintLayerStackingNode::updateZOrderLists()
+{
+    if (!m_zOrderListsDirty)
+        return;
+
+    if (!isStackingContext()) {
+        clearZOrderLists();
+        m_zOrderListsDirty = false;
+        return;
+    }
+
+    rebuildZOrderLists();
+}
+
+#if ENABLE(ASSERT)
+class LayerListMutationDetector {
+public:
+    explicit LayerListMutationDetector(PaintLayerStackingNode* stackingNode)
+        : m_stackingNode(stackingNode)
+        , m_previousMutationAllowedState(stackingNode->layerListMutationAllowed())
+    {
+        m_stackingNode->setLayerListMutationAllowed(false);
+    }
+
+    ~LayerListMutationDetector()
+    {
+        m_stackingNode->setLayerListMutationAllowed(m_previousMutationAllowedState);
+    }
+
+private:
+    PaintLayerStackingNode* m_stackingNode;
+    bool m_previousMutationAllowedState;
+};
+#endif
+
+} // namespace blink
+
+#endif // PaintLayerStackingNode_h
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNodeIterator.cpp b/third_party/WebKit/Source/core/paint/PaintLayerStackingNodeIterator.cpp
new file mode 100644
index 0000000..d1fbff76
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNodeIterator.cpp
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "core/paint/PaintLayerStackingNodeIterator.h"
+
+// FIXME: We should build our primitive on top of
+// DeprecatedLayerStackingNode and remove this include.
+#include "core/paint/PaintLayer.h"
+#include "core/paint/PaintLayerStackingNode.h"
+
+namespace blink {
+
+PaintLayerStackingNodeIterator::PaintLayerStackingNodeIterator(const PaintLayerStackingNode& root, unsigned whichChildren)
+    : m_root(root)
+    , m_remainingChildren(whichChildren)
+    , m_index(0)
+{
+    m_currentNormalFlowChild = root.layer()->firstChild();
+}
+
+PaintLayerStackingNode* PaintLayerStackingNodeIterator::next()
+{
+    if (m_remainingChildren & NegativeZOrderChildren) {
+        Vector<PaintLayerStackingNode*>* negZOrderList = m_root.negZOrderList();
+        if (negZOrderList && m_index < negZOrderList->size())
+            return negZOrderList->at(m_index++);
+
+        m_index = 0;
+        m_remainingChildren &= ~NegativeZOrderChildren;
+    }
+
+    if (m_remainingChildren & NormalFlowChildren) {
+        for (; m_currentNormalFlowChild; m_currentNormalFlowChild = m_currentNormalFlowChild->nextSibling()) {
+            if (!m_currentNormalFlowChild->stackingNode()->isTreatedAsOrStackingContext() && !m_currentNormalFlowChild->isReflection()) {
+                PaintLayer* normalFlowChild = m_currentNormalFlowChild;
+                m_currentNormalFlowChild = m_currentNormalFlowChild->nextSibling();
+                return normalFlowChild->stackingNode();
+            }
+        }
+
+        // We reset the iterator in case we reuse it.
+        m_currentNormalFlowChild = m_root.layer()->firstChild();
+        m_remainingChildren &= ~NormalFlowChildren;
+    }
+
+    if (m_remainingChildren & PositiveZOrderChildren) {
+        Vector<PaintLayerStackingNode*>* posZOrderList = m_root.posZOrderList();
+        if (posZOrderList && m_index < posZOrderList->size())
+            return posZOrderList->at(m_index++);
+
+        m_index = 0;
+        m_remainingChildren &= ~PositiveZOrderChildren;
+    }
+
+    return 0;
+}
+
+PaintLayerStackingNode* PaintLayerStackingNodeReverseIterator::next()
+{
+    if (m_remainingChildren & NegativeZOrderChildren) {
+        Vector<PaintLayerStackingNode*>* negZOrderList = m_root.negZOrderList();
+        if (negZOrderList && m_index >= 0)
+            return negZOrderList->at(m_index--);
+
+        m_remainingChildren &= ~NegativeZOrderChildren;
+        setIndexToLastItem();
+    }
+
+    if (m_remainingChildren & NormalFlowChildren) {
+        for (; m_currentNormalFlowChild; m_currentNormalFlowChild = m_currentNormalFlowChild->previousSibling()) {
+            if (!m_currentNormalFlowChild->stackingNode()->isTreatedAsOrStackingContext() && !m_currentNormalFlowChild->isReflection()) {
+                PaintLayer* normalFlowChild = m_currentNormalFlowChild;
+                m_currentNormalFlowChild = m_currentNormalFlowChild->previousSibling();
+                return normalFlowChild->stackingNode();
+            }
+        }
+
+        m_remainingChildren &= ~NormalFlowChildren;
+        setIndexToLastItem();
+    }
+
+    if (m_remainingChildren & PositiveZOrderChildren) {
+        Vector<PaintLayerStackingNode*>* posZOrderList = m_root.posZOrderList();
+        if (posZOrderList && m_index >= 0)
+            return posZOrderList->at(m_index--);
+
+        m_remainingChildren &= ~PositiveZOrderChildren;
+        setIndexToLastItem();
+    }
+
+    return 0;
+}
+
+void PaintLayerStackingNodeReverseIterator::setIndexToLastItem()
+{
+    if (m_remainingChildren & NegativeZOrderChildren) {
+        Vector<PaintLayerStackingNode*>* negZOrderList = m_root.negZOrderList();
+        if (negZOrderList) {
+            m_index  = negZOrderList->size() - 1;
+            return;
+        }
+
+        m_remainingChildren &= ~NegativeZOrderChildren;
+    }
+
+    if (m_remainingChildren & NormalFlowChildren) {
+        m_currentNormalFlowChild = m_root.layer()->lastChild();
+        return;
+    }
+
+    if (m_remainingChildren & PositiveZOrderChildren) {
+        Vector<PaintLayerStackingNode*>* posZOrderList = m_root.posZOrderList();
+        if (posZOrderList) {
+            m_index = posZOrderList->size() - 1;
+            return;
+        }
+
+        m_remainingChildren &= ~PositiveZOrderChildren;
+    }
+
+    // No more list to visit.
+    ASSERT(!m_remainingChildren);
+    m_index = -1;
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerStackingNodeIterator.h b/third_party/WebKit/Source/core/paint/PaintLayerStackingNodeIterator.h
new file mode 100644
index 0000000..d837c7f
--- /dev/null
+++ b/third_party/WebKit/Source/core/paint/PaintLayerStackingNodeIterator.h
@@ -0,0 +1,96 @@
+/*
+ * Copyright (C) 2013 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef PaintLayerStackingNodeIterator_h
+#define PaintLayerStackingNodeIterator_h
+
+#include "wtf/Allocator.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+enum ChildrenIteration {
+    NegativeZOrderChildren = 1,
+    // Normal flow children are not mandated by CSS 2.1 but are an artifact of
+    // our implementation: we allocate PaintLayers for elements that
+    // are not treated as stacking contexts and thus we need to walk them
+    // during painting and hit-testing.
+    NormalFlowChildren = 1 << 1,
+    PositiveZOrderChildren = 1 << 2,
+    AllChildren = NegativeZOrderChildren | NormalFlowChildren | PositiveZOrderChildren
+};
+
+class PaintLayerStackingNode;
+class PaintLayer;
+
+// This iterator walks the PaintLayerStackingNode lists in the following order:
+// NegativeZOrderChildren -> NormalFlowChildren -> PositiveZOrderChildren.
+class PaintLayerStackingNodeIterator {
+    STACK_ALLOCATED();
+    WTF_MAKE_NONCOPYABLE(PaintLayerStackingNodeIterator);
+public:
+    PaintLayerStackingNodeIterator(const PaintLayerStackingNode& root, unsigned whichChildren);
+
+    PaintLayerStackingNode* next();
+
+private:
+    const PaintLayerStackingNode& m_root;
+    unsigned m_remainingChildren;
+    unsigned m_index;
+    PaintLayer* m_currentNormalFlowChild;
+};
+
+// This iterator is similar to PaintLayerStackingNodeIterator but it walks the lists in reverse order
+// (from the last item to the first one).
+class PaintLayerStackingNodeReverseIterator {
+    STACK_ALLOCATED();
+    WTF_MAKE_NONCOPYABLE(PaintLayerStackingNodeReverseIterator);
+public:
+    PaintLayerStackingNodeReverseIterator(const PaintLayerStackingNode& root, unsigned whichChildren)
+        : m_root(root)
+        , m_remainingChildren(whichChildren)
+    {
+        setIndexToLastItem();
+    }
+
+    PaintLayerStackingNode* next();
+
+private:
+    void setIndexToLastItem();
+
+    const PaintLayerStackingNode& m_root;
+    unsigned m_remainingChildren;
+    int m_index;
+    PaintLayer* m_currentNormalFlowChild;
+};
+
+} // namespace blink
+
+#endif // PaintLayerStackingNodeIterator_h
diff --git a/third_party/WebKit/Source/core/paint/PaintPhase.h b/third_party/WebKit/Source/core/paint/PaintPhase.h
index 7c3ce1a..c9784e6 100644
--- a/third_party/WebKit/Source/core/paint/PaintPhase.h
+++ b/third_party/WebKit/Source/core/paint/PaintPhase.h
@@ -47,10 +47,9 @@
     PaintPhaseChildOutlines = 6,
     PaintPhaseSelfOutline = 7,
     PaintPhaseSelection = 8,
-    PaintPhaseCollapsedTableBorders = 9,
-    PaintPhaseTextClip = 10,
-    PaintPhaseMask = 11,
-    PaintPhaseClippingMask = 12,
+    PaintPhaseTextClip = 9,
+    PaintPhaseMask = 10,
+    PaintPhaseClippingMask = 11,
     PaintPhaseMax = PaintPhaseClippingMask,
     // These values must be kept in sync with DisplayItem::Type and DisplayItem::typeAsDebugString().
 };
diff --git a/third_party/WebKit/Source/core/paint/PartPainter.cpp b/third_party/WebKit/Source/core/paint/PartPainter.cpp
index 3ba07a93..8b4327d 100644
--- a/third_party/WebKit/Source/core/paint/PartPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/PartPainter.cpp
@@ -7,9 +7,9 @@
 
 #include "core/layout/LayoutPart.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/RoundedInnerRectClipper.h"
 #include "core/paint/ScrollableAreaPainter.h"
 #include "core/paint/TransformRecorder.h"
diff --git a/third_party/WebKit/Source/core/paint/ReplacedPainter.cpp b/third_party/WebKit/Source/core/paint/ReplacedPainter.cpp
index 2ef5bf0..f6a2a562 100644
--- a/third_party/WebKit/Source/core/paint/ReplacedPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ReplacedPainter.cpp
@@ -8,10 +8,10 @@
 #include "core/layout/LayoutReplaced.h"
 #include "core/layout/api/SelectionState.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/ObjectPainter.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/RoundedInnerRectClipper.h"
 #include "wtf/Optional.h"
 
diff --git a/third_party/WebKit/Source/core/paint/ReplicaPainter.cpp b/third_party/WebKit/Source/core/paint/ReplicaPainter.cpp
index 3ffe9da..20fd08d 100644
--- a/third_party/WebKit/Source/core/paint/ReplicaPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ReplicaPainter.cpp
@@ -6,10 +6,10 @@
 #include "core/paint/ReplicaPainter.h"
 
 #include "core/layout/LayoutReplica.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
+#include "core/paint/PaintLayerPainter.h"
 
 namespace blink {
 
@@ -23,10 +23,10 @@
     if (paintInfo.phase == PaintPhaseForeground) {
         // Turn around and paint the parent layer. Use temporary clipRects, so that the layer doesn't end up caching clip rects
         // computing using the wrong rootLayer
-        DeprecatedPaintLayer* rootPaintingLayer = m_layoutReplica.layer()->transform() ? m_layoutReplica.layer()->parent() : m_layoutReplica.layer()->enclosingTransformedAncestor();
-        DeprecatedPaintLayerPaintingInfo paintingInfo(rootPaintingLayer, LayoutRect(paintInfo.rect), GlobalPaintNormalPhase, LayoutSize(), 0);
+        PaintLayer* rootPaintingLayer = m_layoutReplica.layer()->transform() ? m_layoutReplica.layer()->parent() : m_layoutReplica.layer()->enclosingTransformedAncestor();
+        PaintLayerPaintingInfo paintingInfo(rootPaintingLayer, LayoutRect(paintInfo.rect), GlobalPaintNormalPhase, LayoutSize(), 0);
         PaintLayerFlags flags = PaintLayerHaveTransparency | PaintLayerAppliedTransform | PaintLayerUncachedClipRects | PaintLayerPaintingReflection;
-        DeprecatedPaintLayerPainter(*m_layoutReplica.layer()->parent()).paintLayer(paintInfo.context, paintingInfo, flags);
+        PaintLayerPainter(*m_layoutReplica.layer()->parent()).paintLayer(paintInfo.context, paintingInfo, flags);
     } else if (paintInfo.phase == PaintPhaseMask) {
         m_layoutReplica.paintMask(paintInfo, adjustedPaintOffset);
     }
diff --git a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
index 7232998..c2bbeae 100644
--- a/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/SVGInlineTextBoxPainter.cpp
@@ -18,6 +18,7 @@
 #include "core/layout/svg/line/SVGInlineTextBox.h"
 #include "core/paint/InlineTextBoxPainter.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
+#include "core/paint/LineLayoutPaintShim.h"
 #include "core/paint/PaintInfo.h"
 #include "core/paint/SVGPaintContext.h"
 #include "core/style/ShadowList.h"
@@ -39,7 +40,7 @@
 
 void SVGInlineTextBoxPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    ASSERT(paintInfo.shouldPaintWithinRoot(&m_svgInlineTextBox.layoutObject()));
+    ASSERT(paintInfo.shouldPaintWithinRoot(LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem())));
     ASSERT(paintInfo.phase == PaintPhaseForeground || paintInfo.phase == PaintPhaseSelection);
     ASSERT(m_svgInlineTextBox.truncation() == cNoTruncation);
 
@@ -52,13 +53,13 @@
     if (paintInfo.phase == PaintPhaseSelection && !shouldPaintSelection(paintInfo))
         return;
 
-    LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTextBox.layoutObject());
+    LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem()));
     if (!textShouldBePainted(textLayoutObject))
         return;
 
     DisplayItem::Type displayItemType = DisplayItem::paintPhaseToDrawingType(paintInfo.phase);
     if (!DrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_svgInlineTextBox, displayItemType)) {
-        LayoutObject& parentLayoutObject = m_svgInlineTextBox.parent()->layoutObject();
+        LayoutObject& parentLayoutObject = *LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.parent()->lineLayoutItem());
         const ComputedStyle& style = parentLayoutObject.styleRef();
 
         DrawingRecorder recorder(*paintInfo.context, m_svgInlineTextBox, displayItemType, paintInfo.rect);
@@ -158,7 +159,7 @@
     if (!backgroundColor.alpha())
         return;
 
-    LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTextBox.layoutObject());
+    LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem()));
     if (!textShouldBePainted(textLayoutObject))
         return;
 
@@ -194,7 +195,7 @@
     // Lookup first layout object in parent hierarchy which has text-decoration set.
     LayoutObject* layoutObject = 0;
     while (parentBox) {
-        layoutObject = &parentBox->layoutObject();
+        layoutObject = LineLayoutPaintShim::layoutObjectFrom(parentBox->lineLayoutItem());
 
         if (layoutObject->style() && layoutObject->style()->textDecoration() != TextDecorationNone)
             break;
@@ -298,7 +299,7 @@
     TextRun& textRun, const SVGTextFragment& fragment, int startPosition, int endPosition,
     LayoutSVGResourceMode resourceMode)
 {
-    LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTextBox.layoutObject());
+    LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem()));
 
     float scalingFactor = textLayoutObject.scalingFactor();
     ASSERT(scalingFactor);
@@ -327,7 +328,7 @@
     }
 
     SkPaint paint;
-    if (!SVGPaintContext::paintForLayoutObject(paintInfo, style, m_svgInlineTextBox.parent()->layoutObject(), resourceMode, paint, additionalPaintServerTransform))
+    if (!SVGPaintContext::paintForLayoutObject(paintInfo, style, *LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.parent()->lineLayoutItem()), resourceMode, paint, additionalPaintServerTransform))
         return;
     paint.setAntiAlias(true);
 
@@ -339,7 +340,7 @@
 
     if (resourceMode == ApplyToStrokeMode) {
         StrokeData strokeData;
-        SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, style, m_svgInlineTextBox.parent()->layoutObject());
+        SVGLayoutSupport::applyStrokeStyleToStrokeData(strokeData, style, *LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.parent()->lineLayoutItem()));
         if (style.svgStyle().vectorEffect() != VE_NON_SCALING_STROKE)
             strokeData.setThickness(strokeData.thickness() * scalingFactor);
         strokeData.setupPaint(&paint);
@@ -383,7 +384,7 @@
     if (style != selectionStyle) {
         StyleDifference diff;
         diff.setNeedsPaintInvalidationObject();
-        SVGResourcesCache::clientStyleChanged(&m_svgInlineTextBox.parent()->layoutObject(), diff, selectionStyle);
+        SVGResourcesCache::clientStyleChanged(LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.parent()->lineLayoutItem()), diff, selectionStyle);
     }
 
     paintTextWithShadows(paintInfo, selectionStyle, textRun, fragment, startPosition, endPosition, resourceMode);
@@ -391,7 +392,7 @@
     if (style != selectionStyle) {
         StyleDifference diff;
         diff.setNeedsPaintInvalidationObject();
-        SVGResourcesCache::clientStyleChanged(&m_svgInlineTextBox.parent()->layoutObject(), diff, style);
+        SVGResourcesCache::clientStyleChanged(LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.parent()->lineLayoutItem()), diff, style);
     }
 
     // Eventually draw text using regular style from the end position of the selection to the end of the current chunk part
@@ -405,7 +406,7 @@
     if (marker->type() != DocumentMarker::TextMatch)
         return;
 
-    LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(m_svgInlineTextBox.layoutObject());
+    LayoutSVGInlineText& textLayoutObject = toLayoutSVGInlineText(*LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem()));
 
     AffineTransform fragmentTransform;
     for (InlineTextBox* box = textLayoutObject.firstTextBox(); box; box = box->nextTextBox()) {
@@ -434,7 +435,7 @@
             fragment.buildFragmentTransform(fragmentTransform);
 
             // Draw the marker highlight.
-            if (m_svgInlineTextBox.layoutObject().frame()->editor().markedTextMatchesAreHighlighted()) {
+            if (LineLayoutPaintShim::layoutObjectFrom(m_svgInlineTextBox.lineLayoutItem())->frame()->editor().markedTextMatchesAreHighlighted()) {
                 Color color = marker->activeMatch() ?
                     LayoutTheme::theme().platformActiveTextSearchHighlightColor() :
                     LayoutTheme::theme().platformInactiveTextSearchHighlightColor();
diff --git a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp
index 08fbf6ac..79fd883 100644
--- a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.cpp
@@ -7,9 +7,9 @@
 
 #include "core/layout/LayoutView.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/DeprecatedPaintLayerScrollableArea.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
+#include "core/paint/PaintLayer.h"
+#include "core/paint/PaintLayerScrollableArea.h"
 #include "core/paint/ScrollbarPainter.h"
 #include "core/paint/TransformRecorder.h"
 #include "platform/graphics/GraphicsContext.h"
@@ -113,7 +113,7 @@
 
         LayoutView* layoutView = scrollableArea().box().view();
 
-        DeprecatedPaintLayer* paintingRoot = scrollableArea().layer()->enclosingLayerWithCompositedDeprecatedPaintLayerMapping(IncludeSelf);
+        PaintLayer* paintingRoot = scrollableArea().layer()->enclosingLayerWithCompositedLayerMapping(IncludeSelf);
         if (!paintingRoot)
             paintingRoot = layoutView->layer();
 
@@ -193,7 +193,7 @@
     context->fillRect(absRect, Color::white);
 }
 
-DeprecatedPaintLayerScrollableArea& ScrollableAreaPainter::scrollableArea() const
+PaintLayerScrollableArea& ScrollableAreaPainter::scrollableArea() const
 {
     return *m_scrollableArea;
 }
diff --git a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.h b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.h
index 15bf589b..f40e9d0c 100644
--- a/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.h
+++ b/third_party/WebKit/Source/core/paint/ScrollableAreaPainter.h
@@ -12,13 +12,13 @@
 class GraphicsContext;
 class IntPoint;
 class IntRect;
-class DeprecatedPaintLayerScrollableArea;
+class PaintLayerScrollableArea;
 
 class ScrollableAreaPainter {
     STACK_ALLOCATED();
     WTF_MAKE_NONCOPYABLE(ScrollableAreaPainter);
 public:
-    explicit ScrollableAreaPainter(DeprecatedPaintLayerScrollableArea& paintLayerScrollableArea) : m_scrollableArea(&paintLayerScrollableArea) { }
+    explicit ScrollableAreaPainter(PaintLayerScrollableArea& paintLayerScrollableArea) : m_scrollableArea(&paintLayerScrollableArea) { }
 
     void paintResizer(GraphicsContext*, const IntPoint& paintOffset, const IntRect& damageRect);
     void paintOverflowControls(GraphicsContext*, const IntPoint& paintOffset, const IntRect& damageRect, bool paintingOverlayControls);
@@ -28,9 +28,9 @@
     void drawPlatformResizerImage(GraphicsContext*, IntRect resizerCornerRect);
     bool overflowControlsIntersectRect(const IntRect& localRect) const;
 
-    DeprecatedPaintLayerScrollableArea& scrollableArea() const;
+    PaintLayerScrollableArea& scrollableArea() const;
 
-    RawPtrWillBeMember<DeprecatedPaintLayerScrollableArea> m_scrollableArea;
+    RawPtrWillBeMember<PaintLayerScrollableArea> m_scrollableArea;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
index f467cf4..08fad67 100644
--- a/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableCellPainter.cpp
@@ -53,7 +53,6 @@
 
 void TableCellPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
-    ASSERT(paintInfo.phase != PaintPhaseCollapsedTableBorders);
     BlockPainter(m_layoutTableCell).paint(paintInfo, paintOffset);
 }
 
@@ -66,17 +65,11 @@
     return style;
 }
 
-void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
+void TableCellPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue)
 {
-    ASSERT(paintInfo.phase == PaintPhaseCollapsedTableBorders);
-
     if (!paintInfo.shouldPaintWithinRoot(&m_layoutTableCell) || m_layoutTableCell.style()->visibility() != VISIBLE)
         return;
 
-    const CollapsedBorderValue* tableCurrentBorderValue = m_layoutTableCell.table()->currentBorderValue();
-    if (!tableCurrentBorderValue)
-        return;
-
     const ComputedStyle& styleForCellFlow = m_layoutTableCell.styleForCellFlow();
     const CollapsedBorderValue& leftBorderValue = cachedCollapsedLeftBorder(styleForCellFlow);
     const CollapsedBorderValue& rightBorderValue = cachedCollapsedRightBorder(styleForCellFlow);
@@ -84,13 +77,13 @@
     const CollapsedBorderValue& bottomBorderValue = cachedCollapsedBottomBorder(styleForCellFlow);
 
     int displayItemType = DisplayItem::TableCollapsedBorderBase;
-    if (topBorderValue.shouldPaint(*tableCurrentBorderValue))
+    if (topBorderValue.shouldPaint(currentBorderValue))
         displayItemType |= DisplayItem::TableCollapsedBorderTop;
-    if (bottomBorderValue.shouldPaint(*tableCurrentBorderValue))
+    if (bottomBorderValue.shouldPaint(currentBorderValue))
         displayItemType |= DisplayItem::TableCollapsedBorderBottom;
-    if (leftBorderValue.shouldPaint(*tableCurrentBorderValue))
+    if (leftBorderValue.shouldPaint(currentBorderValue))
         displayItemType |= DisplayItem::TableCollapsedBorderLeft;
-    if (rightBorderValue.shouldPaint(*tableCurrentBorderValue))
+    if (rightBorderValue.shouldPaint(currentBorderValue))
         displayItemType |= DisplayItem::TableCollapsedBorderRight;
 
     if (displayItemType == DisplayItem::TableCollapsedBorderBase)
diff --git a/third_party/WebKit/Source/core/paint/TableCellPainter.h b/third_party/WebKit/Source/core/paint/TableCellPainter.h
index 4edf5f8..bc88c7d 100644
--- a/third_party/WebKit/Source/core/paint/TableCellPainter.h
+++ b/third_party/WebKit/Source/core/paint/TableCellPainter.h
@@ -11,6 +11,7 @@
 namespace blink {
 
 struct PaintInfo;
+class CollapsedBorderValue;
 class LayoutPoint;
 class LayoutRect;
 class LayoutTableCell;
@@ -24,7 +25,7 @@
 
     void paint(const PaintInfo&, const LayoutPoint&);
 
-    void paintCollapsedBorders(const PaintInfo&, const LayoutPoint&);
+    void paintCollapsedBorders(const PaintInfo&, const LayoutPoint&, const CollapsedBorderValue&);
     void paintBackgroundsBehindCell(const PaintInfo&, const LayoutPoint&, const LayoutObject* backgroundObject);
     void paintBoxDecorationBackground(const PaintInfo&, const LayoutPoint& paintOffset);
     void paintMask(const PaintInfo&, const LayoutPoint& paintOffset);
diff --git a/third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp b/third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp
index 2dd379a..be4b6128 100644
--- a/third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp
+++ b/third_party/WebKit/Source/core/paint/TableCellPainterTest.cpp
@@ -4,8 +4,8 @@
 
 #include "config.h"
 
-#include "core/paint/DeprecatedPaintLayerPainter.h"
 #include "core/paint/DisplayItemListPaintTest.h"
+#include "core/paint/PaintLayerPainter.h"
 #include "platform/graphics/GraphicsContext.h"
 
 namespace blink {
@@ -27,21 +27,21 @@
         "</table>");
 
     LayoutView& layoutView = *document().layoutView();
-    DeprecatedPaintLayer& rootLayer = *layoutView.layer();
+    PaintLayer& rootLayer = *layoutView.layer();
     LayoutObject& cell1 = *document().getElementById("cell1")->layoutObject();
     LayoutObject& cell2 = *document().getElementById("cell2")->layoutObject();
 
     GraphicsContext context(&rootDisplayItemList());
-    DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 200, 200), GlobalPaintNormalPhase, LayoutSize());
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 200, 200), GlobalPaintNormalPhase, LayoutSize());
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
     rootDisplayItemList().commitNewDisplayItems();
 
     EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2,
         TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
         TestDisplayItem(cell1, DisplayItem::TableCellBackgroundFromContainers));
 
-    DeprecatedPaintLayerPaintingInfo paintingInfo1(&rootLayer, LayoutRect(0, 300, 200, 200), GlobalPaintNormalPhase, LayoutSize());
-    DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo1, PaintLayerPaintingCompositingAllPhases);
+    PaintLayerPaintingInfo paintingInfo1(&rootLayer, LayoutRect(0, 300, 200, 200), GlobalPaintNormalPhase, LayoutSize());
+    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo1, PaintLayerPaintingCompositingAllPhases);
     rootDisplayItemList().commitNewDisplayItems();
 
     EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2,
diff --git a/third_party/WebKit/Source/core/paint/TablePainter.cpp b/third_party/WebKit/Source/core/paint/TablePainter.cpp
index 266c693..51d74a1 100644
--- a/third_party/WebKit/Source/core/paint/TablePainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TablePainter.cpp
@@ -14,6 +14,7 @@
 #include "core/paint/ObjectPainter.h"
 #include "core/paint/PaintInfo.h"
 #include "core/paint/ScopeRecorder.h"
+#include "core/paint/TableSectionPainter.h"
 
 namespace blink {
 
@@ -50,18 +51,14 @@
     if (m_layoutTable.collapseBorders() && paintPhase == PaintPhaseChildBlockBackground && m_layoutTable.style()->visibility() == VISIBLE) {
         // Using our cached sorted styles, we then do individual passes,
         // painting each style of border from lowest precedence to highest precedence.
-        info.phase = PaintPhaseCollapsedTableBorders;
         LayoutTable::CollapsedBorderValues collapsedBorders = m_layoutTable.collapsedBorders();
         size_t count = collapsedBorders.size();
         for (size_t i = 0; i < count; ++i) {
-            // FIXME: pass this value into children rather than storing temporarily on the LayoutTable object.
-            m_layoutTable.setCurrentBorderValue(&collapsedBorders[i]);
             for (LayoutTableSection* section = m_layoutTable.bottomSection(); section; section = m_layoutTable.sectionAbove(section)) {
                 LayoutPoint childPoint = m_layoutTable.flipForWritingModeForChild(section, paintOffset);
-                section->paint(info, childPoint);
+                TableSectionPainter(*section).paintCollapsedBorders(info, childPoint, collapsedBorders[i]);
             }
         }
-        m_layoutTable.setCurrentBorderValue(0);
     }
 
     // Paint outline.
diff --git a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
index 33dea95..4bc637671 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.cpp
@@ -57,6 +57,41 @@
     return elem1->col() < elem2->col();
 }
 
+void TableSectionPainter::paintCollapsedBorders(const PaintInfo& paintInfo, const LayoutPoint& paintOffset, const CollapsedBorderValue& currentBorderValue)
+{
+    if (!m_layoutTableSection.numRows() || !m_layoutTableSection.table()->columns().size())
+        return;
+
+    LayoutPoint adjustedPaintOffset = paintOffset + m_layoutTableSection.location();
+    BoxClipper boxClipper(m_layoutTableSection, paintInfo, adjustedPaintOffset, ForceContentsClip);
+
+    LayoutRect localPaintInvalidationRect = LayoutRect(paintInfo.rect);
+    localPaintInvalidationRect.moveBy(-adjustedPaintOffset);
+
+    LayoutRect tableAlignedRect = m_layoutTableSection.logicalRectForWritingModeAndDirection(localPaintInvalidationRect);
+
+    CellSpan dirtiedRows = m_layoutTableSection.dirtiedRows(tableAlignedRect);
+    CellSpan dirtiedColumns = m_layoutTableSection.dirtiedColumns(tableAlignedRect);
+
+    if (dirtiedColumns.start() >= dirtiedColumns.end())
+        return;
+
+    // Collapsed borders are painted from the bottom right to the top left so that precedence
+    // due to cell position is respected.
+    for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r--) {
+        unsigned row = r - 1;
+        for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.start(); c--) {
+            unsigned col = c - 1;
+            const LayoutTableSection::CellStruct& current = m_layoutTableSection.cellAt(row, col);
+            const LayoutTableCell* cell = current.primaryCell();
+            if (!cell || (row > dirtiedRows.start() && m_layoutTableSection.primaryCellAt(row - 1, col) == cell) || (col > dirtiedColumns.start() && m_layoutTableSection.primaryCellAt(row, col - 1) == cell))
+                continue;
+            LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(cell, adjustedPaintOffset);
+            TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint, currentBorderValue);
+        }
+    }
+}
+
 void TableSectionPainter::paintObject(const PaintInfo& paintInfo, const LayoutPoint& paintOffset)
 {
     LayoutRect localPaintInvalidationRect = LayoutRect(paintInfo.rect);
@@ -67,91 +102,68 @@
     CellSpan dirtiedRows = m_layoutTableSection.dirtiedRows(tableAlignedRect);
     CellSpan dirtiedColumns = m_layoutTableSection.dirtiedColumns(tableAlignedRect);
 
+    if (dirtiedColumns.start() >= dirtiedColumns.end())
+        return;
+
     const HashSet<LayoutTableCell*>& overflowingCells = m_layoutTableSection.overflowingCells();
-    if (dirtiedColumns.start() < dirtiedColumns.end()) {
-        if (!m_layoutTableSection.hasMultipleCellLevels() && !overflowingCells.size()) {
-            if (paintInfo.phase == PaintPhaseCollapsedTableBorders) {
-                // Collapsed borders are painted from the bottom right to the top left so that precedence
-                // due to cell position is respected.
-                for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r--) {
-                    unsigned row = r - 1;
-                    for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.start(); c--) {
-                        unsigned col = c - 1;
-                        const LayoutTableSection::CellStruct& current = m_layoutTableSection.cellAt(row, col);
-                        const LayoutTableCell* cell = current.primaryCell();
-                        if (!cell || (row > dirtiedRows.start() && m_layoutTableSection.primaryCellAt(row - 1, col) == cell) || (col > dirtiedColumns.start() && m_layoutTableSection.primaryCellAt(row, col - 1) == cell))
-                            continue;
-                        LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(cell, paintOffset);
-                        TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint);
-                    }
-                }
-            } else {
-                // Draw the dirty cells in the order that they appear.
-                for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) {
-                    const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r);
-                    if (row && !row->hasSelfPaintingLayer())
-                        TableRowPainter(*row).paintOutlineForRowIfNeeded(paintInfo, paintOffset);
-                    for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) {
-                        const LayoutTableSection::CellStruct& current = m_layoutTableSection.cellAt(r, c);
-                        const LayoutTableCell* cell = current.primaryCell();
-                        if (!cell || (r > dirtiedRows.start() && m_layoutTableSection.primaryCellAt(r - 1, c) == cell) || (c > dirtiedColumns.start() && m_layoutTableSection.primaryCellAt(r, c - 1) == cell))
-                            continue;
-                        paintCell(*cell, paintInfo, paintOffset);
-                    }
-                }
-            }
-        } else {
-            // The overflowing cells should be scarce to avoid adding a lot of cells to the HashSet.
-#if ENABLE(ASSERT)
-            unsigned totalRows = m_layoutTableSection.numRows();
-            unsigned totalCols = m_layoutTableSection.table()->columns().size();
-            ASSERT(overflowingCells.size() < totalRows * totalCols * gMaxAllowedOverflowingCellRatioForFastPaintPath);
-#endif
-
-            // To make sure we properly paint invalidate the section, we paint invalidated all the overflowing cells that we collected.
-            Vector<LayoutTableCell*> cells;
-            copyToVector(overflowingCells, cells);
-
-            HashSet<LayoutTableCell*> spanningCells;
-
-            for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) {
-                const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r);
-                if (row && !row->hasSelfPaintingLayer())
-                    TableRowPainter(*row).paintOutlineForRowIfNeeded(paintInfo, paintOffset);
-                for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) {
-                    const LayoutTableSection::CellStruct& current = m_layoutTableSection.cellAt(r, c);
-                    if (!current.hasCells())
-                        continue;
-                    for (unsigned i = 0; i < current.cells.size(); ++i) {
-                        if (overflowingCells.contains(current.cells[i]))
-                            continue;
-
-                        if (current.cells[i]->rowSpan() > 1 || current.cells[i]->colSpan() > 1) {
-                            if (!spanningCells.add(current.cells[i]).isNewEntry)
-                                continue;
-                        }
-
-                        cells.append(current.cells[i]);
-                    }
-                }
-            }
-
-            // Sort the dirty cells by paint order.
-            if (!overflowingCells.size())
-                std::stable_sort(cells.begin(), cells.end(), compareCellPositions);
-            else
-                std::sort(cells.begin(), cells.end(), compareCellPositionsWithOverflowingCells);
-
-            if (paintInfo.phase == PaintPhaseCollapsedTableBorders) {
-                for (unsigned i = cells.size(); i > 0; --i) {
-                    LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild(cells[i - 1], paintOffset);
-                    TableCellPainter(*cells[i - 1]).paintCollapsedBorders(paintInfo, cellPoint);
-                }
-            } else {
-                for (unsigned i = 0; i < cells.size(); ++i)
-                    paintCell(*cells[i], paintInfo, paintOffset);
+    if (!m_layoutTableSection.hasMultipleCellLevels() && !overflowingCells.size()) {
+        // Draw the dirty cells in the order that they appear.
+        for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) {
+            const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r);
+            if (row && !row->hasSelfPaintingLayer())
+                TableRowPainter(*row).paintOutlineForRowIfNeeded(paintInfo, paintOffset);
+            for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) {
+                const LayoutTableSection::CellStruct& current = m_layoutTableSection.cellAt(r, c);
+                const LayoutTableCell* cell = current.primaryCell();
+                if (!cell || (r > dirtiedRows.start() && m_layoutTableSection.primaryCellAt(r - 1, c) == cell) || (c > dirtiedColumns.start() && m_layoutTableSection.primaryCellAt(r, c - 1) == cell))
+                    continue;
+                paintCell(*cell, paintInfo, paintOffset);
             }
         }
+    } else {
+        // The overflowing cells should be scarce to avoid adding a lot of cells to the HashSet.
+#if ENABLE(ASSERT)
+        unsigned totalRows = m_layoutTableSection.numRows();
+        unsigned totalCols = m_layoutTableSection.table()->columns().size();
+        ASSERT(overflowingCells.size() < totalRows * totalCols * gMaxAllowedOverflowingCellRatioForFastPaintPath);
+#endif
+
+        // To make sure we properly paint invalidate the section, we paint invalidated all the overflowing cells that we collected.
+        Vector<LayoutTableCell*> cells;
+        copyToVector(overflowingCells, cells);
+
+        HashSet<LayoutTableCell*> spanningCells;
+
+        for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) {
+            const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r);
+            if (row && !row->hasSelfPaintingLayer())
+                TableRowPainter(*row).paintOutlineForRowIfNeeded(paintInfo, paintOffset);
+            for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) {
+                const LayoutTableSection::CellStruct& current = m_layoutTableSection.cellAt(r, c);
+                if (!current.hasCells())
+                    continue;
+                for (unsigned i = 0; i < current.cells.size(); ++i) {
+                    if (overflowingCells.contains(current.cells[i]))
+                        continue;
+
+                    if (current.cells[i]->rowSpan() > 1 || current.cells[i]->colSpan() > 1) {
+                        if (!spanningCells.add(current.cells[i]).isNewEntry)
+                            continue;
+                    }
+
+                    cells.append(current.cells[i]);
+                }
+            }
+        }
+
+        // Sort the dirty cells by paint order.
+        if (!overflowingCells.size())
+            std::stable_sort(cells.begin(), cells.end(), compareCellPositions);
+        else
+            std::sort(cells.begin(), cells.end(), compareCellPositionsWithOverflowingCells);
+
+        for (unsigned i = 0; i < cells.size(); ++i)
+            paintCell(*cells[i], paintInfo, paintOffset);
     }
 }
 
diff --git a/third_party/WebKit/Source/core/paint/TableSectionPainter.h b/third_party/WebKit/Source/core/paint/TableSectionPainter.h
index 44f1a89..615ea87 100644
--- a/third_party/WebKit/Source/core/paint/TableSectionPainter.h
+++ b/third_party/WebKit/Source/core/paint/TableSectionPainter.h
@@ -9,6 +9,7 @@
 
 namespace blink {
 
+class CollapsedBorderValue;
 class LayoutPoint;
 class LayoutTableCell;
 class LayoutTableSection;
@@ -20,6 +21,7 @@
     TableSectionPainter(const LayoutTableSection& layoutTableSection) : m_layoutTableSection(layoutTableSection) { }
 
     void paint(const PaintInfo&, const LayoutPoint&);
+    void paintCollapsedBorders(const PaintInfo&, const LayoutPoint&, const CollapsedBorderValue&);
 
 private:
     void paintObject(const PaintInfo&, const LayoutPoint&);
diff --git a/third_party/WebKit/Source/core/paint/ViewPainter.cpp b/third_party/WebKit/Source/core/paint/ViewPainter.cpp
index 9feee6f..e2f4f8b 100644
--- a/third_party/WebKit/Source/core/paint/ViewPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ViewPainter.cpp
@@ -11,9 +11,9 @@
 #include "core/layout/LayoutView.h"
 #include "core/paint/BlockPainter.h"
 #include "core/paint/BoxPainter.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
 #include "core/paint/PaintInfo.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/RuntimeEnabledFeatures.h"
 
 namespace blink {
@@ -85,7 +85,7 @@
     if (!rootObject || !rootObject->isBox()) {
         backgroundRenderable = false;
     } else if (rootObject->hasLayer()) {
-        const DeprecatedPaintLayer& rootLayer = *toLayoutBoxModelObject(rootObject)->layer();
+        const PaintLayer& rootLayer = *toLayoutBoxModelObject(rootObject)->layer();
         LayoutPoint offset;
         rootLayer.convertToLayerCoords(nullptr, offset);
         transform.translate(offset.x(), offset.y());
diff --git a/third_party/WebKit/Source/core/style/ComputedStyle.h b/third_party/WebKit/Source/core/style/ComputedStyle.h
index 2dd0f2b7..fa239700 100644
--- a/third_party/WebKit/Source/core/style/ComputedStyle.h
+++ b/third_party/WebKit/Source/core/style/ComputedStyle.h
@@ -1239,7 +1239,7 @@
     // the purpose of painting and hit testing. This means that they are painted
     // atomically (like a stacking context) but they don't determine the
     // stacking of the elements underneath them (stacking contexts or elements
-    // "treated as stacking context"). See DeprecatedPaintLayerStackingNode for
+    // "treated as stacking context"). See PaintLayerStackingNode for
     // more about painting order.
     bool isTreatedAsStackingContext() const
     {
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index a0e6f03..c5f68d3 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -103,8 +103,9 @@
 #include "core/layout/LayoutObject.h"
 #include "core/layout/LayoutTreeAsText.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
+#include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoader.h"
 #include "core/loader/HistoryItem.h"
 #include "core/page/ChromeClient.h"
@@ -113,7 +114,7 @@
 #include "core/page/Page.h"
 #include "core/page/PrintContext.h"
 #include "core/page/scrolling/ScrollState.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/svg/SVGImageElement.h"
 #include "core/testing/DictionaryTest.h"
 #include "core/testing/GCObservation.h"
@@ -1028,23 +1029,6 @@
     toHTMLFormControlElement(element)->setAutofilled(enabled);
 }
 
-void Internals::scrollElementToRect(Element* element, long x, long y, long w, long h, ExceptionState& exceptionState)
-{
-    ASSERT(element);
-    if (!element->document().view()) {
-        exceptionState.throwDOMException(InvalidNodeTypeError, element ? "No view can be obtained from the provided element's document." : ExceptionMessages::argumentNullOrIncorrectType(1, "Element"));
-        return;
-    }
-
-    FrameView* mainFrame = toLocalFrame(element->document().page()->mainFrame())->view();
-    mainFrame->frame().document()->updateLayoutIgnorePendingStylesheets();
-
-    FrameView* elementView = element->document().view();
-    IntRect boundsInRootFrame = elementView->contentsToRootFrame(pixelSnappedIntRect(element->boundingBox()));
-    IntRect boundsInRootContent = mainFrame->frameToContents(boundsInRootFrame);
-    mainFrame->scrollableArea()->scrollIntoRect(LayoutRect(boundsInRootContent), FloatRect(x, y, w, h));
-}
-
 PassRefPtrWillBeRawPtr<Range> Internals::rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength)
 {
     ASSERT(scope);
@@ -1282,10 +1266,10 @@
     return eventHandlerCount(*document, EventHandlerRegistry::TouchEvent);
 }
 
-static DeprecatedPaintLayer* findLayerForGraphicsLayer(DeprecatedPaintLayer* searchRoot, GraphicsLayer* graphicsLayer, IntSize* layerOffset, String* layerType)
+static PaintLayer* findLayerForGraphicsLayer(PaintLayer* searchRoot, GraphicsLayer* graphicsLayer, IntSize* layerOffset, String* layerType)
 {
     *layerOffset = IntSize();
-    if (searchRoot->hasCompositedDeprecatedPaintLayerMapping() && graphicsLayer == searchRoot->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()) {
+    if (searchRoot->hasCompositedLayerMapping() && graphicsLayer == searchRoot->compositedLayerMapping()->mainGraphicsLayer()) {
         // If the |graphicsLayer| sets the scrollingContent layer as its
         // scroll parent, consider it belongs to the scrolling layer and
         // mark the layer type as "scrolling".
@@ -1308,7 +1292,7 @@
         }
 
         LayoutRect rect;
-        DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(), rect);
+        PaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(), rect);
         *layerOffset = IntSize(rect.x(), rect.y());
         return searchRoot;
     }
@@ -1326,7 +1310,7 @@
         if (graphicsLayer == squashingLayer) {
             *layerType ="squashing";
             LayoutRect rect;
-            DeprecatedPaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(), rect);
+            PaintLayer::mapRectToPaintBackingCoordinates(searchRoot->layoutObject(), rect);
             *layerOffset = IntSize(rect.x(), rect.y());
             return searchRoot;
         }
@@ -1352,8 +1336,8 @@
 
     // Search right to left to increase the chances that we'll choose the top-most layers in a
     // grouped mapping for squashing.
-    for (DeprecatedPaintLayer* child = searchRoot->lastChild(); child; child = child->previousSibling()) {
-        DeprecatedPaintLayer* foundLayer = findLayerForGraphicsLayer(child, graphicsLayer, layerOffset, layerType);
+    for (PaintLayer* child = searchRoot->lastChild(); child; child = child->previousSibling()) {
+        PaintLayer* foundLayer = findLayerForGraphicsLayer(child, graphicsLayer, layerOffset, layerType);
         if (foundLayer)
             return foundLayer;
     }
@@ -1406,14 +1390,14 @@
     }
 }
 
-static void accumulateLayerRectList(DeprecatedPaintLayerCompositor* compositor, GraphicsLayer* graphicsLayer, LayerRectList* rects)
+static void accumulateLayerRectList(PaintLayerCompositor* compositor, GraphicsLayer* graphicsLayer, LayerRectList* rects)
 {
     WebVector<blink::WebRect> layerRects = graphicsLayer->platformLayer()->touchEventHandlerRegion();
     if (!layerRects.isEmpty()) {
         mergeRects(layerRects);
         String layerType;
         IntSize layerOffset;
-        DeprecatedPaintLayer* paintLayer = findLayerForGraphicsLayer(compositor->rootLayer(), graphicsLayer, &layerOffset, &layerType);
+        PaintLayer* paintLayer = findLayerForGraphicsLayer(compositor->rootLayer(), graphicsLayer, &layerOffset, &layerType);
         Node* node = paintLayer ? paintLayer->layoutObject()->node() : 0;
         for (size_t i = 0; i < layerRects.size(); ++i) {
             if (!layerRects[i].isEmpty()) {
@@ -1442,7 +1426,7 @@
         return nullptr;
 
     if (LayoutView* view = document->layoutView()) {
-        if (DeprecatedPaintLayerCompositor* compositor = view->compositor()) {
+        if (PaintLayerCompositor* compositor = view->compositor()) {
             if (GraphicsLayer* rootLayer = compositor->rootGraphicsLayer()) {
                 LayerRectList* rects = LayerRectList::create();
                 accumulateLayerRectList(compositor, rootLayer, rects);
@@ -1671,10 +1655,10 @@
         return false;
     }
 
-    DeprecatedPaintLayer* layer1 = toLayoutBox(layoutObject1)->layer();
-    DeprecatedPaintLayer* layer2 = toLayoutBox(layoutObject2)->layer();
+    PaintLayer* layer1 = toLayoutBox(layoutObject1)->layer();
+    PaintLayer* layer2 = toLayoutBox(layoutObject2)->layer();
     if (!layer1 || !layer2) {
-        exceptionState.throwDOMException(InvalidAccessError, String::format("No DeprecatedPaintLayer can be obtained from the %s provided element.", layer1 ? "second" : "first"));
+        exceptionState.throwDOMException(InvalidAccessError, String::format("No PaintLayer can be obtained from the %s provided element.", layer1 ? "second" : "first"));
         return false;
     }
 
@@ -1705,15 +1689,15 @@
         return String();
     }
 
-    DeprecatedPaintLayer* layer = toLayoutBox(layoutObject)->layer();
+    PaintLayer* layer = toLayoutBox(layoutObject)->layer();
     if (!layer
-        || !layer->hasCompositedDeprecatedPaintLayerMapping()
-        || !layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()) {
+        || !layer->hasCompositedLayerMapping()
+        || !layer->compositedLayerMapping()->mainGraphicsLayer()) {
         // Don't raise exception in these cases which may be normally used in tests.
         return String();
     }
 
-    return layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->layerTreeAsText(flags);
+    return layer->compositedLayerMapping()->mainGraphicsLayer()->layerTreeAsText(flags);
 }
 
 String Internals::scrollingStateTreeAsText(Document*) const
@@ -2528,7 +2512,7 @@
     LayoutObject* layoutObject = node->layoutObject();
     if (!layoutObject)
         return false;
-    DeprecatedPaintLayer* layer = layoutObject->enclosingLayer();
+    PaintLayer* layer = layoutObject->enclosingLayer();
     if (!layer)
         return false;
     ScrollableArea* scrollableArea = layer->scrollableArea();
@@ -2546,4 +2530,15 @@
     RuntimeEnabledFeatures::setRestrictIFramePermissionsEnabled(true);
 }
 
+double Internals::monotonicTimeToZeroBasedDocumentTime(double platformTime, ExceptionState& exceptionState)
+{
+    Document* document = contextDocument();
+    if (!document) {
+        exceptionState.throwDOMException(InvalidAccessError, "No context document is available.");
+        return 0;
+    }
+
+    return document->loader()->timing().monotonicTimeToZeroBasedDocumentTime(platformTime);
+}
+
 } // namespace blink
diff --git a/third_party/WebKit/Source/core/testing/Internals.h b/third_party/WebKit/Source/core/testing/Internals.h
index 003af4bc..f1885f73 100644
--- a/third_party/WebKit/Source/core/testing/Internals.h
+++ b/third_party/WebKit/Source/core/testing/Internals.h
@@ -172,7 +172,6 @@
     void setSuggestedValue(Element*, const String&, ExceptionState&);
     void setEditingValue(Element* inputElement, const String&, ExceptionState&);
     void setAutofilled(Element*, bool enabled, ExceptionState&);
-    void scrollElementToRect(Element*, long x, long y, long w, long h, ExceptionState&);
 
     PassRefPtrWillBeRawPtr<Range> rangeFromLocationAndLength(Element* scope, int rangeLocation, int rangeLength);
     unsigned locationFromRange(Element* scope, const Range*);
@@ -387,6 +386,10 @@
     bool setScrollbarVisibilityInScrollableArea(Node*, bool visible);
 
     void forceRestrictIFramePermissions();
+
+    // Translate given platform monotonic time in seconds to high resolution
+    // document time in seconds
+    double monotonicTimeToZeroBasedDocumentTime(double, ExceptionState&);
 private:
     explicit Internals(ScriptState*);
     Document* contextDocument() const;
diff --git a/third_party/WebKit/Source/core/testing/Internals.idl b/third_party/WebKit/Source/core/testing/Internals.idl
index 3e50c346c..d31fff0 100644
--- a/third_party/WebKit/Source/core/testing/Internals.idl
+++ b/third_party/WebKit/Source/core/testing/Internals.idl
@@ -126,8 +126,6 @@
     [RaisesException, TypeChecking=Interface] void setEditingValue(Element inputElement, DOMString value);
     [RaisesException, TypeChecking=Interface] void setAutofilled(Element inputElement, boolean enabled);
 
-    [RaisesException, TypeChecking=Interface] void scrollElementToRect(Element element, long x, long y, long w, long h);
-
     [TypeChecking=Interface] Range rangeFromLocationAndLength(Element scope, long rangeLocation, long rangeLength);
     [TypeChecking=Interface] unsigned long locationFromRange(Element scope, Range range);
     [TypeChecking=Interface] unsigned long lengthFromRange(Element scope, Range range);
@@ -354,4 +352,5 @@
     bool setScrollbarVisibilityInScrollableArea(Node node, boolean visible);
 
     void forceRestrictIFramePermissions();
+    [RaisesException] double monotonicTimeToZeroBasedDocumentTime(double platformTime);
 };
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
index abe2d9f..efbaa5f 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -240,7 +240,9 @@
 
     if (info.redirectChain().isEmpty()) {
         PerformanceEntry* entry = PerformanceResourceTiming::create(info, timeOrigin(), startTime, allowTimingDetails);
-        addResourceTimingBuffer(*entry);
+        notifyObserversOfEntry(*entry);
+        if (!isResourceTimingBufferFull())
+            addResourceTimingBuffer(*entry);
         return;
     }
 
@@ -422,14 +424,19 @@
     return floor(timeSeconds / resolutionSeconds) * resolutionSeconds;
 }
 
-double PerformanceBase::now() const
+DOMHighResTimeStamp PerformanceBase::monotonicTimeToDOMHighResTimeStamp(double monotonicTime) const
 {
     // Avoid exposing raw platform timestamps.
     if (m_timeOrigin == 0.0)
         return 0.0;
 
-    double nowSeconds = monotonicallyIncreasingTime() - m_timeOrigin;
-    return 1000.0 * clampTimeResolution(nowSeconds);
+    double timeInSeconds = monotonicTime - m_timeOrigin;
+    return convertSecondsToDOMHighResTimeStamp(clampTimeResolution(timeInSeconds));
+}
+
+DOMHighResTimeStamp PerformanceBase::now() const
+{
+    return monotonicTimeToDOMHighResTimeStamp(monotonicallyIncreasingTime());
 }
 
 DEFINE_TRACE(PerformanceBase)
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.h b/third_party/WebKit/Source/core/timing/PerformanceBase.h
index 7b9644c..aa3e097 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.h
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.h
@@ -33,6 +33,7 @@
 #define PerformanceBase_h
 
 #include "core/CoreExport.h"
+#include "core/dom/DOMHighResTimeStamp.h"
 #include "core/events/EventTarget.h"
 #include "core/timing/PerformanceEntry.h"
 #include "platform/Timer.h"
@@ -61,12 +62,20 @@
     const AtomicString& interfaceName() const override;
 
     virtual PerformanceTiming* timing() const;
-    double now() const;
+
+    // Reduce the resolution to 5µs to prevent timing attacks. See:
+    // http://www.w3.org/TR/hr-time-2/#privacy-security
+    static double clampTimeResolution(double timeSeconds);
+
+    // Translate given platform monotonic time in seconds into a high resolution
+    // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to
+    // document's time origin and has a time resolution that is safe for
+    // exposing to web.
+    DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const;
+    DOMHighResTimeStamp now() const;
 
     double timeOrigin() const { return m_timeOrigin; }
 
-    static double clampTimeResolution(double timeSeconds);
-
     PerformanceEntryVector getEntries() const;
     PerformanceEntryVector getEntriesByType(const String& entryType);
     PerformanceEntryVector getEntriesByName(const String& name, const String& entryType);
diff --git a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
index 113dacb..1406471 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceResourceTiming.cpp
@@ -39,6 +39,7 @@
 
 namespace blink {
 
+// TODO(majidvp): Should return DOMHighResTimeStamp type instead
 static double monotonicTimeToDOMHighResTimeStamp(double timeOrigin, double seconds)
 {
     ASSERT(seconds >= 0.0);
diff --git a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
index 7e5e8ef..a349e01 100644
--- a/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
+++ b/third_party/WebKit/Source/core/xmlhttprequest/XMLHttpRequest.cpp
@@ -70,6 +70,7 @@
 #include "platform/network/ParsedContentType.h"
 #include "platform/network/ResourceError.h"
 #include "platform/network/ResourceRequest.h"
+#include "public/platform/Platform.h"
 #include "public/platform/WebURLRequest.h"
 #include "wtf/Assertions.h"
 #include "wtf/StdLibExtras.h"
@@ -131,6 +132,13 @@
     context->addConsoleMessage(ConsoleMessage::create(JSMessageSource, ErrorMessageLevel, message));
 }
 
+enum HeaderValueCategoryByRFC7230 {
+    HeaderValueInvalid,
+    HeaderValueAffectedByNormalization,
+    HeaderValueValid,
+    HeaderValueCategoryByRFC7230End
+};
+
 } // namespace
 
 class XMLHttpRequest::BlobLoader final : public GarbageCollectedFinalized<XMLHttpRequest::BlobLoader>, public FileReaderLoaderClient {
@@ -1174,10 +1182,6 @@
         return;
     }
 
-    // Show deprecation warnings and count occurrences of such deprecated header values.
-    if (!value.isEmpty() && !isValidHTTPFieldContentRFC7230(value))
-        UseCounter::countDeprecation(executionContext(), UseCounter::HeaderValueNotMatchingRFC7230);
-
     // No script (privileged or not) can set unsafe headers.
     if (FetchUtils::isForbiddenHeaderName(name)) {
         logConsoleError(executionContext(), "Refused to set unsafe header \"" + name + "\"");
@@ -1189,9 +1193,31 @@
 
 void XMLHttpRequest::setRequestHeaderInternal(const AtomicString& name, const AtomicString& value)
 {
+    HeaderValueCategoryByRFC7230 headerValueCategory = HeaderValueValid;
+
     HTTPHeaderMap::AddResult result = m_requestHeaders.add(name, value);
-    if (!result.isNewEntry)
-        result.storedValue->value = result.storedValue->value + ", " + value;
+    if (!result.isNewEntry) {
+        AtomicString newValue = result.storedValue->value + ", " + value;
+
+        // Without normalization at XHR level here, the actual header value
+        // sent to the network is |newValue| with leading/trailing whitespaces
+        // stripped (i.e. |normalizeHeaderValue(newValue)|).
+        // With normalization at XHR level here as the spec requires, the
+        // actual header value sent to the network is |normalizedNewValue|.
+        // If these two are different, introducing normalization here affects
+        // the header value sent to the network.
+        String normalizedNewValue = FetchUtils::normalizeHeaderValue(result.storedValue->value) + ", " + FetchUtils::normalizeHeaderValue(value);
+        if (FetchUtils::normalizeHeaderValue(newValue) != normalizedNewValue)
+            headerValueCategory = HeaderValueAffectedByNormalization;
+
+        result.storedValue->value = newValue;
+    }
+
+    String normalizedValue = FetchUtils::normalizeHeaderValue(value);
+    if (!normalizedValue.isEmpty() && !isValidHTTPFieldContentRFC7230(normalizedValue))
+        headerValueCategory = HeaderValueInvalid;
+
+    Platform::current()->histogramEnumeration("Blink.XHR.setRequestHeader.HeaderValueCategoryInRFC7230", headerValueCategory, HeaderValueCategoryByRFC7230End);
 }
 
 const AtomicString& XMLHttpRequest::getRequestHeader(const AtomicString& name) const
diff --git a/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js b/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js
index d388b6d..5cb8afc 100644
--- a/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js
@@ -593,6 +593,24 @@
         this.target().animationAgent().seekAnimations(this._animations.map(extractId), currentTime);
     },
 
+    /**
+     * @return {!Promise.<number>}
+     */
+    currentTimePromise: function()
+    {
+        /**
+         * @param {?Protocol.Error} error
+         * @param {number} currentTime
+         * @return {number}
+         */
+        function callback(error, currentTime)
+        {
+            return !error ? currentTime : 0;
+        }
+
+        return this.target().animationAgent().getCurrentTime(this._animations[0].id(), callback).catchException(0);
+    },
+
     __proto__: WebInspector.SDKObject.prototype
 }
 
diff --git a/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js b/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
index a2c4cfb1..d0d12918 100644
--- a/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
+++ b/third_party/WebKit/Source/devtools/front_end/animation/AnimationTimeline.js
@@ -188,7 +188,8 @@
         }
         this._playbackSlider.value = playbackSliderValue;
 
-        for (var target of WebInspector.targetManager.targets(WebInspector.Target.Type.Page))
+        var target = WebInspector.targetManager.mainTarget();
+        if (target)
             WebInspector.AnimationModel.fromTarget(target).setPlaybackRate(this._playbackRate());
         WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.AnimationsPlaybackRateChanged);
         if (this._scrubberPlayer)
@@ -216,12 +217,15 @@
         if (this._paused) {
             this._controlButton.element.classList.add("play-outline-toolbar-item");
             this._controlButton.setTitle(WebInspector.UIString("Play timeline"));
+            this._controlButton.setToggled(true);
         } else if (!this._scrubberPlayer || this._scrubberPlayer.currentTime >= this.duration() - this._scrubberRadius / this.pixelMsRatio()) {
             this._controlButton.element.classList.add("replay-outline-toolbar-item");
             this._controlButton.setTitle(WebInspector.UIString("Replay timeline"));
+            this._controlButton.setToggled(true);
         } else {
             this._controlButton.element.classList.add("pause-outline-toolbar-item");
             this._controlButton.setTitle(WebInspector.UIString("Pause timeline"));
+            this._controlButton.setToggled(false);
         }
     },
 
@@ -402,6 +406,8 @@
         for (var anim of group.animations())
             this._addAnimation(anim);
         this.scheduleRedraw();
+        this._timelineScrubber.classList.remove("hidden");
+        this._syncScrubber();
     },
 
     /**
@@ -505,7 +511,7 @@
         this._cachedTimelineWidth = Math.max(0, this._animationsContainer.offsetWidth - this._timelineControlsWidth) || 0;
         this.scheduleRedraw();
         if (this._scrubberPlayer)
-            this._animateTime();
+            this._syncScrubber();
     },
 
     /**
@@ -532,36 +538,33 @@
         if (requiredDuration > this._duration * 0.8) {
             resized = true;
             this._duration = requiredDuration * 1.5;
-            this._timelineScrubber.classList.remove("hidden");
-            this._animateTime(animation.startTime() - this.startTime());
         }
         return resized;
     },
 
-    /**
-      * @param {number=} time
-      */
-    _animateTime: function(time)
+    _syncScrubber: function()
     {
-        var oldPlayer = this._scrubberPlayer;
+        this._selectedGroup.currentTimePromise()
+            .then(this._animateTime.bind(this))
+            .then(this._updateControlButton.bind(this));
+    },
 
+    /**
+      * @param {number} currentTime
+      */
+    _animateTime: function(currentTime)
+    {
+        if (this._scrubberPlayer)
+            this._scrubberPlayer.cancel();
+
+        var scrubberDuration = this.duration() - this._scrubberRadius / this.pixelMsRatio();
         this._scrubberPlayer = this._timelineScrubber.animate([
             { transform: "translateX(0px)" },
             { transform: "translateX(" +  (this.width() - this._scrubberRadius) + "px)" }
-        ], { duration: this.duration() - this._scrubberRadius / this.pixelMsRatio(), fill: "forwards" });
+        ], { duration: scrubberDuration , fill: "forwards" });
         this._scrubberPlayer.playbackRate = this._playbackRate();
         this._scrubberPlayer.onfinish = this._updateControlButton.bind(this);
-        this._updateControlButton();
-
-        if (time !== undefined)
-            this._scrubberPlayer.currentTime = time;
-        else if (oldPlayer.playState === "finished")
-            this._scrubberPlayer.finish();
-        else
-            this._scrubberPlayer.startTime = oldPlayer.startTime;
-
-        if (oldPlayer)
-            oldPlayer.cancel();
+        this._scrubberPlayer.currentTime = currentTime;
         this._timelineScrubber.classList.remove("animation-timeline-end");
         this._timelineScrubberHead.window().requestAnimationFrame(this._updateScrubber.bind(this));
     },
@@ -596,7 +599,7 @@
      */
     _scrubberDragStart: function(event)
     {
-        if (!this._scrubberPlayer)
+        if (!this._scrubberPlayer || !this._selectedGroup)
             return false;
 
         this._originalScrubberTime = this._scrubberPlayer.currentTime;
@@ -618,7 +621,7 @@
         this._scrubberPlayer.currentTime = Math.min(this._originalScrubberTime + delta / this.pixelMsRatio(), this.duration() - this._scrubberRadius / this.pixelMsRatio());
         var currentTime = Math.max(0, Math.round(this._scrubberPlayer.currentTime));
         this._timelineScrubberHead.textContent = WebInspector.UIString(Number.millisToString(currentTime));
-        // TODO(samli): hook up to new replay mechanism.
+        this._selectedGroup.seekTo(currentTime);
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/animation/animationTimeline.css b/third_party/WebKit/Source/devtools/front_end/animation/animationTimeline.css
index 806eead..08686f30 100644
--- a/third_party/WebKit/Source/devtools/front_end/animation/animationTimeline.css
+++ b/third_party/WebKit/Source/devtools/front_end/animation/animationTimeline.css
@@ -196,7 +196,6 @@
     width: calc(100% - 200px);
     top: 43px;
     border-left: 1px solid rgba(0,0,0,0.5);
-    display: none;
 }
 
 .animation-scrubber.animation-timeline-end {
diff --git a/third_party/WebKit/Source/devtools/front_end/audits/AuditController.js b/third_party/WebKit/Source/devtools/front_end/audits/AuditController.js
index 53e38d9..9d16eac 100644
--- a/third_party/WebKit/Source/devtools/front_end/audits/AuditController.js
+++ b/third_party/WebKit/Source/devtools/front_end/audits/AuditController.js
@@ -117,28 +117,30 @@
         for (var i = 0; i < categoryIds.length; ++i)
             categories.push(this._auditsPanel.categoriesById[categoryIds[i]]);
 
-        /**
-         * @this {WebInspector.AuditController}
-         */
-        function startAuditWhenResourcesReady()
-        {
-            if (this._progress.isCanceled()) {
-                this._progress.done();
-                return;
-            }
-            startedCallback();
-            this._executeAudit(target, categories, this._auditFinishedCallback.bind(this));
-        }
-
         if (runImmediately)
-            startAuditWhenResourcesReady.call(this);
+            this._startAuditWhenResourcesReady(target, categories, startedCallback);
         else
-            this._reloadResources(startAuditWhenResourcesReady.bind(this));
+            this._reloadResources(this._startAuditWhenResourcesReady.bind(this, target, categories, startedCallback));
 
         WebInspector.userMetrics.actionTaken(WebInspector.UserMetrics.Action.AuditsStarted);
     },
 
     /**
+     * @param {!WebInspector.Target} target
+     * @param {!Array<!WebInspector.AuditCategory>} categories
+     * @param {function()} startedCallback
+     */
+    _startAuditWhenResourcesReady: function(target, categories, startedCallback)
+    {
+        if (this._progress.isCanceled()) {
+            this._progress.done();
+            return;
+        }
+        startedCallback();
+        this._executeAudit(target, categories, this._auditFinishedCallback.bind(this));
+    },
+
+    /**
      * @param {function()=} callback
      */
     _reloadResources: function(callback)
diff --git a/third_party/WebKit/Source/devtools/front_end/components/InspectorView.js b/third_party/WebKit/Source/devtools/front_end/components/InspectorView.js
index 625dc90..9e4cee8 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/InspectorView.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/InspectorView.js
@@ -49,7 +49,7 @@
     this._tabbedPane.registerRequiredCSS("components/inspectorViewTabbedPane.css");
     this._tabbedPane.element.classList.add("inspector-view-tabbed-pane");
     this._tabbedPane.setTabSlider(true);
-    this._tabbedPane.setAllowTabReorder(true);
+    this._tabbedPane.setAllowTabReorder(true, false, 200);
     this._tabbedPane.addEventListener(WebInspector.TabbedPane.EventTypes.TabOrderChanged, this._persistPanelOrder, this);
     this._tabOrderSetting = WebInspector.settings.createSetting("InspectorView.panelOrder", {});
     this._drawerSplitWidget.setMainWidget(this._tabbedPane);
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
index 0255b86..123fa1e 100644
--- a/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
+++ b/third_party/WebKit/Source/devtools/front_end/elements/ElementsTreeElement.js
@@ -532,11 +532,9 @@
         var newAttribute = event.target.enclosingNodeOrSelfWithClass("add-attribute");
         if (attribute && !newAttribute)
             contextMenu.appendItem(WebInspector.UIString.capitalize("Edit ^attribute"), this._startEditingAttribute.bind(this, attribute, event.target));
-        contextMenu.appendSeparator();
-        var pseudoSubMenu = contextMenu.appendSubMenuItem(WebInspector.UIString.capitalize("Force ^element ^state"));
-        WebInspector.ElementsTreeElement.populateForcedPseudoStateItems(pseudoSubMenu, treeElement.node());
-        contextMenu.appendSeparator();
         this.populateNodeContextMenu(contextMenu);
+        WebInspector.ElementsTreeElement.populateForcedPseudoStateItems(contextMenu, treeElement.node());
+        contextMenu.appendSeparator();
         this.populateScrollIntoView(contextMenu);
     },
 
@@ -545,7 +543,6 @@
      */
     populateScrollIntoView: function(contextMenu)
     {
-        contextMenu.appendSeparator();
         contextMenu.appendItem(WebInspector.UIString.capitalize("Scroll into ^view"), this._scrollIntoView.bind(this));
     },
 
@@ -562,24 +559,38 @@
         var openTagElement = this._node[this.treeOutline.treeElementSymbol()] || this;
         var isEditable = this.hasEditableNode();
         if (isEditable && !this._editing)
-            contextMenu.appendItem(WebInspector.UIString("Edit as HTML"), openTagElement.toggleEditAsHTML.bind(openTagElement));
+            contextMenu.appendAction("elements.edit-as-html", WebInspector.UIString("Edit as HTML"));
         var isShadowRoot = this._node.isShadowRoot();
 
         // Place it here so that all "Copy"-ing items stick together.
-        if (this._node.nodeType() === Node.ELEMENT_NODE)
-            contextMenu.appendItem(WebInspector.UIString.capitalize("Copy CSS ^path"), this._copyCSSPath.bind(this));
+        var copyMenu = contextMenu.appendSubMenuItem(WebInspector.UIString("Copy"));
+        var createShortcut = WebInspector.KeyboardShortcut.shortcutToString;
+        var modifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;
+        var menuItem;
         if (!isShadowRoot)
-            contextMenu.appendItem(WebInspector.UIString("Copy XPath"), this._copyXPath.bind(this));
+            menuItem = copyMenu.appendItem(WebInspector.UIString("Copy outerHTML"), this.treeOutline.performCopyOrCut.bind(this.treeOutline, false, this._node));
+            menuItem.setShortcut(createShortcut("V", modifier));
+        if (this._node.nodeType() === Node.ELEMENT_NODE)
+            copyMenu.appendItem(WebInspector.UIString.capitalize("Copy selector"), this._copyCSSPath.bind(this));
+        if (!isShadowRoot)
+            copyMenu.appendItem(WebInspector.UIString("Copy XPath"), this._copyXPath.bind(this));
         if (!isShadowRoot) {
             var treeOutline = this.treeOutline;
-            contextMenu.appendSeparator();
-            contextMenu.appendItem(WebInspector.UIString("Cut"), treeOutline.performCopyOrCut.bind(treeOutline, true, this._node), !this.hasEditableNode());
-            contextMenu.appendItem(WebInspector.UIString("Copy"), treeOutline.performCopyOrCut.bind(treeOutline, false, this._node));
-            contextMenu.appendItem(WebInspector.UIString("Paste"), treeOutline.pasteNode.bind(treeOutline, this._node), !treeOutline.canPaste(this._node));
+            menuItem = copyMenu.appendItem(WebInspector.UIString("Cut element"), treeOutline.performCopyOrCut.bind(treeOutline, true, this._node), !this.hasEditableNode());
+            menuItem.setShortcut(createShortcut("X", modifier));
+            menuItem = copyMenu.appendItem(WebInspector.UIString("Copy element"), treeOutline.performCopyOrCut.bind(treeOutline, false, this._node));
+            menuItem.setShortcut(createShortcut("C", modifier));
+            menuItem = copyMenu.appendItem(WebInspector.UIString("Paste element"), treeOutline.pasteNode.bind(treeOutline, this._node), !treeOutline.canPaste(this._node));
+            menuItem.setShortcut(createShortcut("V", modifier));
         }
 
+        contextMenu.appendSeparator();
+        menuItem = contextMenu.appendCheckboxItem(WebInspector.UIString("Hide element"), this.treeOutline.toggleHideElement.bind(this.treeOutline, this._node), this.treeOutline.isToggledToHidden(this._node));
+        menuItem.setShortcut(WebInspector.shortcutRegistry.shortcutTitleForAction("elements.hide-element"));
+
+
         if (isEditable)
-            contextMenu.appendItem(WebInspector.UIString("Delete"), this.remove.bind(this));
+            contextMenu.appendItem(WebInspector.UIString("Delete element"), this.remove.bind(this));
         contextMenu.appendSeparator();
     },
 
@@ -1138,6 +1149,8 @@
         {
             this._decorationsElement.removeChildren();
             this._decorationsElement.classList.add("hidden");
+            this._gutterContainer.classList.toggle("has-decorations", decorations.length || descendantDecorations.length);
+
             if (!decorations.length && !descendantDecorations.length)
                 return;
 
@@ -1170,8 +1183,6 @@
                 processColors.call(this, descendantColors, "elements-gutter-decoration elements-has-decorated-children");
             WebInspector.Tooltip.install(this._decorationsElement, titles);
 
-            this._gutterContainer.classList.toggle("has-decorations", this._decorationsElement.hasChildNodes());
-
             /**
              * @param {!Set<string>} colors
              * @param {string} className
diff --git a/third_party/WebKit/Source/devtools/front_end/elements/elementsTreeOutline.css b/third_party/WebKit/Source/devtools/front_end/elements/elementsTreeOutline.css
index f848849..7ea8ca1 100644
--- a/third_party/WebKit/Source/devtools/front_end/elements/elementsTreeOutline.css
+++ b/third_party/WebKit/Source/devtools/front_end/elements/elementsTreeOutline.css
@@ -322,7 +322,7 @@
     color: #ccc;
 }
 
-.elements-disclosure li.selected .gutter-container:not(.has-decoration) {
+.elements-disclosure li.selected .gutter-container:not(.has-decorations) {
     position: absolute;
     left: 0px;
     width: 16.25px;
diff --git a/third_party/WebKit/Source/devtools/front_end/main/module.json b/third_party/WebKit/Source/devtools/front_end/main/module.json
index 47d44d18..3f55f15 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/module.json
+++ b/third_party/WebKit/Source/devtools/front_end/main/module.json
@@ -153,8 +153,7 @@
             "name": "rendering",
             "title": "Rendering",
             "order": "11",
-            "className": "WebInspector.RenderingOptions.View",
-            "experiment": "!materialDesign"
+            "className": "WebInspector.RenderingOptions.View"
         },
         {
             "type": "@WebInspector.ToolbarItem.Provider",
diff --git a/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js b/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
index 3cc4de2..f99996f1 100644
--- a/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
+++ b/third_party/WebKit/Source/devtools/front_end/sdk/DebuggerModel.js
@@ -1316,7 +1316,6 @@
     this._callFrame = callFrame;
     this._payload = callFrame._payload.scopeChain[ordinal];
     this._type = this._payload.type;
-    this._name = this._payload.name;
     this._ordinal = ordinal;
 }
 
@@ -1330,14 +1329,6 @@
     },
 
     /**
-     * @return {string|undefined}
-     */
-    name: function()
-    {
-        return this._name;
-    },
-
-    /**
      * @return {!WebInspector.RemoteObject}
      */
     object: function()
diff --git a/third_party/WebKit/Source/devtools/front_end/sources/ScopeChainSidebarPane.js b/third_party/WebKit/Source/devtools/front_end/sources/ScopeChainSidebarPane.js
index 2696049..acaaa19 100644
--- a/third_party/WebKit/Source/devtools/front_end/sources/ScopeChainSidebarPane.js
+++ b/third_party/WebKit/Source/devtools/front_end/sources/ScopeChainSidebarPane.js
@@ -97,11 +97,7 @@
                 }
                 break;
             case DebuggerAgent.ScopeType.Closure:
-                var scopeName = scope.name();
-                if (scopeName)
-                    title = WebInspector.UIString("Closure (%s)", WebInspector.beautifyFunctionName(scopeName));
-                else
-                    title = WebInspector.UIString("Closure");
+                title = WebInspector.UIString("Closure");
                 emptyPlaceholder = WebInspector.UIString("No Variables");
                 break;
             case DebuggerAgent.ScopeType.Catch:
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineEventOverview.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineEventOverview.js
index 780e3464..22d1552af 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineEventOverview.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineEventOverview.js
@@ -400,10 +400,10 @@
         {
             var step = 4 * window.devicePixelRatio;
             ctx.save();
-            ctx.lineWidth = step / 2;
-            for (var i = 0; i < width + height; i += step) {
-                ctx.moveTo(i, 0);
-                ctx.lineTo(i - height, height);
+            ctx.lineWidth = step / Math.sqrt(8);
+            for (var x = 0.5; x < width + height; x += step) {
+                ctx.moveTo(x, 0);
+                ctx.lineTo(x - height, height);
             }
             ctx.globalCompositeOperation = "destination-out";
             ctx.stroke();
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
index 55a14b0..0b768ff 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/TimelineTreeView.js
@@ -402,9 +402,12 @@
         var container = cell.createChild("div", "name-container");
         var icon = container.createChild("div", "activity-icon");
         var name = container.createChild("div", "activity-name");
-        var link = container.createChild("div", "activity-link");
         var event = this._profileNode.event;
         if (event) {
+            var data = event.args["data"];
+            var deoptReason = data && data["deoptReason"];
+            if (deoptReason && deoptReason !== "no reason")
+                container.createChild("div", "activity-warning").title = WebInspector.UIString("Not optimized: %s", deoptReason);
             name.textContent = event.name === WebInspector.TimelineModel.RecordType.JSFrame
                 ? WebInspector.beautifyFunctionName(event.args["data"]["functionName"])
                 : WebInspector.TimelineUIUtils.eventTitle(event);
@@ -414,7 +417,7 @@
             var lineNumber = frame && frame["lineNumber"] || 1;
             var columnNumber = frame && frame["columnNumber"];
             if (url)
-                link.appendChild(this._treeView.linkifyLocation(scriptId, url, lineNumber, columnNumber));
+                container.createChild("div", "activity-link").appendChild(this._treeView.linkifyLocation(scriptId, url, lineNumber, columnNumber));
             var category = WebInspector.TimelineUIUtils.eventStyle(event).category;
             icon.style.backgroundColor = category.fillColorStop1;
         } else {
diff --git a/third_party/WebKit/Source/devtools/front_end/timeline/timelinePanel.css b/third_party/WebKit/Source/devtools/front_end/timeline/timelinePanel.css
index 2d23911..c4692a2 100644
--- a/third_party/WebKit/Source/devtools/front_end/timeline/timelinePanel.css
+++ b/third_party/WebKit/Source/devtools/front_end/timeline/timelinePanel.css
@@ -1022,6 +1022,18 @@
     border: 1px solid rgba(0, 0, 0, 0.1);
 }
 
+.timeline-tree-view .data-grid .name-container .activity-warning::after {
+    content: "[deopt]";
+    margin: 0 4px;
+    line-height: 12px;
+    font-size: 10px;
+    color: #777;
+}
+
+.timeline-tree-view .data-grid tr.selected .name-container .activity-warning::after {
+    color: white;
+}
+
 .timeline-tree-view .data-grid .name-container .activity-link {
     flex: auto;
     text-align: right;
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/ResizerWidget.js b/third_party/WebKit/Source/devtools/front_end/ui/ResizerWidget.js
index 2903bf3..b1fcd0f 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/ResizerWidget.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/ResizerWidget.js
@@ -115,7 +115,7 @@
         // Only handle drags of the nodes specified.
         if (this._elements.indexOf(event.target) === -1)
             return false;
-        WebInspector.elementDragStart(this._dragStart.bind(this), this._drag.bind(this), this._dragEnd.bind(this), this.cursor(), event);
+        WebInspector.elementDragStart(/** @type {!Element} */(event.target), this._dragStart.bind(this), this._drag.bind(this), this._dragEnd.bind(this), this.cursor(), event);
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js b/third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js
index 3b365a7..94c7eb2 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/TabbedPane.js
@@ -191,7 +191,7 @@
     appendTab: function(id, tabTitle, view, tabTooltip, userGesture, isCloseable, index)
     {
         isCloseable = typeof isCloseable === "boolean" ? isCloseable : this._closeableTabs;
-        var tab = new WebInspector.TabbedPaneTab(this, id, tabTitle, isCloseable, view, tabTooltip);
+        var tab = new WebInspector.TabbedPaneTab(this, id, tabTitle, isCloseable, view, tabTooltip, this._dragDelay);
         tab.setDelegate(this._delegate);
         this._tabsById[id] = tab;
         if (index !== undefined)
@@ -817,11 +817,13 @@
     /**
      * @param {boolean} allow
      * @param {boolean=} automatic
+     * @param {number=} dragDelay
      */
-    setAllowTabReorder: function(allow, automatic)
+    setAllowTabReorder: function(allow, automatic, dragDelay)
     {
         this._allowTabReorder = allow;
         this._automaticReorder = automatic;
+        this._dragDelay = dragDelay;
     },
 
     __proto__: WebInspector.VBox.prototype
@@ -835,8 +837,9 @@
  * @param {boolean} closeable
  * @param {!WebInspector.Widget} view
  * @param {string=} tooltip
+ * @param {number=} dragDelay
  */
-WebInspector.TabbedPaneTab = function(tabbedPane, id, title, closeable, view, tooltip)
+WebInspector.TabbedPaneTab = function(tabbedPane, id, title, closeable, view, tooltip, dragDelay)
 {
     this._closeable = closeable;
     this._tabbedPane = tabbedPane;
@@ -844,6 +847,7 @@
     this._title = title;
     this._tooltip = tooltip;
     this._view = view;
+    this._dragDelay = dragDelay;
     this._shown = false;
     /** @type {number} */ this._measuredWidth;
     /** @type {!Element|undefined} */ this._tabElement;
@@ -1030,7 +1034,7 @@
 
             tabElement.addEventListener("contextmenu", this._tabContextMenu.bind(this), false);
             if (this._tabbedPane._allowTabReorder)
-                WebInspector.installDragHandle(tabElement, this._startTabDragging.bind(this), this._tabDragging.bind(this), this._endTabDragging.bind(this), "-webkit-grabbing", "pointer");
+                WebInspector.installDragHandle(tabElement, this._startTabDragging.bind(this), this._tabDragging.bind(this), this._endTabDragging.bind(this), "-webkit-grabbing", "pointer", this._dragDelay);
         }
 
         return tabElement;
@@ -1138,6 +1142,8 @@
         if (event.target.classList.contains("tabbed-pane-close-button"))
             return false;
         this._dragStartX = event.pageX;
+        this._tabElement.classList.add("dragging");
+        this._tabbedPane._tabSlider.remove();
         return true;
     },
 
@@ -1180,9 +1186,7 @@
             return;
         }
 
-        this._tabElement.classList.add("dragging");
         this._tabElement.style.setProperty("left", (event.pageX - this._dragStartX) + "px");
-        this._tabbedPane._tabSlider.remove();
     },
 
     /**
diff --git a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
index 2e93d48..13cf642 100644
--- a/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
+++ b/third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js
@@ -38,22 +38,45 @@
  * @param {?function(!MouseEvent)} elementDragEnd
  * @param {string} cursor
  * @param {?string=} hoverCursor
+ * @param {number=} startDelay
  */
-WebInspector.installDragHandle = function(element, elementDragStart, elementDrag, elementDragEnd, cursor, hoverCursor)
+WebInspector.installDragHandle = function(element, elementDragStart, elementDrag, elementDragEnd, cursor, hoverCursor, startDelay)
 {
-    element.addEventListener("mousedown", WebInspector.elementDragStart.bind(WebInspector, elementDragStart, elementDrag, elementDragEnd, cursor), false);
+    /**
+     * @param {!Event} event
+     */
+    function onMouseDown(event)
+    {
+        var dragStart = WebInspector.elementDragStart.bind(WebInspector, element, elementDragStart, elementDrag, elementDragEnd, cursor, event);
+        if (!startDelay)
+            dragStart();
+        startTimer = setTimeout(dragStart, startDelay || 0);
+    }
+
+    function onMouseUp()
+    {
+        if (startTimer)
+            clearInterval(startTimer);
+        startTimer = null;
+    }
+
+    var startTimer;
+    element.addEventListener("mousedown", onMouseDown, false);
+    if (startDelay)
+        element.addEventListener("mouseup", onMouseUp, false);
     if (hoverCursor !== null)
         element.style.cursor = hoverCursor || cursor;
 }
 
 /**
+ * @param {!Element} targetElement
  * @param {?function(!MouseEvent):boolean} elementDragStart
  * @param {function(!MouseEvent)} elementDrag
  * @param {?function(!MouseEvent)} elementDragEnd
  * @param {string} cursor
  * @param {!Event} event
  */
-WebInspector.elementDragStart = function(elementDragStart, elementDrag, elementDragEnd, cursor, event)
+WebInspector.elementDragStart = function(targetElement, elementDragStart, elementDrag, elementDragEnd, cursor, event)
 {
     // Only drag upon left button. Right will likely cause a context menu. So will ctrl-click on mac.
     if (event.button || (WebInspector.isMac() && event.ctrlKey))
@@ -84,7 +107,6 @@
     if (targetDocument !== WebInspector._dragEventsTargetDocumentTop)
         WebInspector._dragEventsTargetDocumentTop.addEventListener("mouseup", WebInspector._elementDragEnd, true);
 
-    var targetElement = /** @type {!Element} */ (event.target);
     if (typeof cursor === "string") {
         WebInspector._restoreCursorAfterDrag = restoreCursor.bind(null, targetElement.style.cursor);
         targetElement.style.cursor = cursor;
diff --git a/third_party/WebKit/Source/devtools/protocol.json b/third_party/WebKit/Source/devtools/protocol.json
index d896768..529dea4 100644
--- a/third_party/WebKit/Source/devtools/protocol.json
+++ b/third_party/WebKit/Source/devtools/protocol.json
@@ -3494,8 +3494,7 @@
                 "type": "object",
                 "properties": [
                     { "name": "type", "type": "string", "enum": ["global", "local", "with", "closure", "catch", "block", "script"], "description": "Scope type." },
-                    { "name": "object", "$ref": "Runtime.RemoteObject", "description": "Object representing the scope. For <code>global</code> and <code>with</code> scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties." },
-                    { "name": "name", "type": "string", "optional": true, "hidden": true }
+                    { "name": "object", "$ref": "Runtime.RemoteObject", "description": "Object representing the scope. For <code>global</code> and <code>with</code> scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties." }
                 ],
                 "description": "Scope description."
             },
@@ -5121,6 +5120,16 @@
                 "description": "Sets the playback rate of the document timeline."
             },
             {
+                "name": "getCurrentTime",
+                "parameters": [
+                    { "name": "id", "type": "string", "description": "Id of animation." }
+                ],
+                "returns": [
+                    { "name": "currentTime", "type": "number", "description": "Current time of the page." }
+                ],
+                "description": "Returns the current time of the an animation."
+            },
+            {
                 "name": "setTiming",
                 "parameters": [
                     { "name": "playerId", "type": "string", "description": "AnimationPlayer id." },
diff --git a/third_party/WebKit/Source/modules/EventTargetModulesFactory.in b/third_party/WebKit/Source/modules/EventTargetModulesFactory.in
index 3c10e895..e5833497 100644
--- a/third_party/WebKit/Source/modules/EventTargetModulesFactory.in
+++ b/third_party/WebKit/Source/modules/EventTargetModulesFactory.in
@@ -25,8 +25,8 @@
 modules/permissions/PermissionStatus
 modules/presentation/Presentation
 modules/presentation/PresentationAvailability
+modules/presentation/PresentationConnection
 modules/presentation/PresentationRequest
-modules/presentation/PresentationSession
 modules/screen_orientation/ScreenOrientation
 modules/serviceworkers/ServiceWorker
 modules/serviceworkers/ServiceWorkerContainer
diff --git a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
index 80cd90a..4f98c10 100644
--- a/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
+++ b/third_party/WebKit/Source/modules/accessibility/AXLayoutObject.cpp
@@ -65,7 +65,7 @@
 #include "core/layout/LayoutView.h"
 #include "core/loader/ProgressTracker.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/style/ComputedStyleConstants.h"
 #include "core/svg/SVGDocumentExtensions.h"
 #include "core/svg/SVGSVGElement.h"
@@ -1503,7 +1503,7 @@
     if (!m_layoutObject || !m_layoutObject->hasLayer())
         return 0;
 
-    DeprecatedPaintLayer* layer = toLayoutBox(m_layoutObject)->layer();
+    PaintLayer* layer = toLayoutBox(m_layoutObject)->layer();
 
     HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active);
     HitTestResult hitTestResult = HitTestResult(request, point);
diff --git a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
index eb3cf81..26402b0 100644
--- a/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
+++ b/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
@@ -12,6 +12,7 @@
 #include "core/dom/ExceptionCode.h"
 #include "core/frame/OriginsUsingFeatures.h"
 #include "core/frame/UseCounter.h"
+#include "core/inspector/ConsoleMessage.h"
 #include "modules/encryptedmedia/EncryptedMediaUtils.h"
 #include "modules/encryptedmedia/MediaKeySession.h"
 #include "modules/encryptedmedia/MediaKeySystemAccess.h"
@@ -19,6 +20,7 @@
 #include "platform/EncryptedMediaRequest.h"
 #include "platform/Logging.h"
 #include "platform/network/ParsedContentType.h"
+#include "public/platform/Platform.h"
 #include "public/platform/WebEncryptedMediaClient.h"
 #include "public/platform/WebEncryptedMediaRequest.h"
 #include "public/platform/WebMediaKeySystemConfiguration.h"
@@ -103,6 +105,13 @@
     }
 
 private:
+    // For widevine key system, generate warning and report to UMA if
+    // |m_supportedConfigurations| contains any video capability with empty
+    // robustness string.
+    // TODO(xhwang): Remove after we handle empty robustness correctly.
+    // See http://crbug.com/482277
+    void checkVideoCapabilityRobustness() const;
+
     Member<ScriptPromiseResolver> m_resolver;
     const String m_keySystem;
     WebVector<WebMediaKeySystemConfiguration> m_supportedConfigurations;
@@ -140,6 +149,8 @@
         webConfig.label = config.label();
         m_supportedConfigurations[i] = webConfig;
     }
+
+    checkVideoCapabilityRobustness();
 }
 
 void MediaKeySystemAccessInitializer::requestSucceeded(WebContentDecryptionModuleAccess* access)
@@ -154,6 +165,42 @@
     m_resolver.clear();
 }
 
+void MediaKeySystemAccessInitializer::checkVideoCapabilityRobustness() const
+{
+    // Only check for widevine key system.
+    if (keySystem() != "com.widevine.alpha")
+        return;
+
+    bool hasVideoCapabilities = false;
+    bool hasEmptyRobustness = false;
+
+    for (const auto& config : m_supportedConfigurations) {
+        if (!config.hasVideoCapabilities)
+            continue;
+
+        hasVideoCapabilities = true;
+
+        for (const auto& capability : config.videoCapabilities) {
+            if (capability.robustness.isEmpty()) {
+                hasEmptyRobustness = true;
+                break;
+            }
+        }
+
+        if (hasEmptyRobustness)
+            break;
+    }
+
+    if (hasVideoCapabilities)
+        Platform::current()->histogramEnumeration("Media.EME.Widevine.VideoCapability.HasEmptyRobustness", hasEmptyRobustness, 2);
+
+    if (hasEmptyRobustness) {
+        m_resolver->executionContext()->addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel,
+            "It is recommended that a robustness level be specified. Not specifying the robustness level could "
+            "result in unexpected behavior in the future, potentially including failure to play."));
+    }
+}
+
 } // namespace
 
 ScriptPromise NavigatorRequestMediaKeySystemAccess::requestMediaKeySystemAccess(
@@ -192,7 +239,6 @@
         // Reject promise with a new DOMException whose name is NotSupportedError.
     }
 
-
     // 5. Let origin be the origin of document.
     //    (Passed with the execution context in step 7.)
 
diff --git a/third_party/WebKit/Source/modules/modules.gypi b/third_party/WebKit/Source/modules/modules.gypi
index bf24044..7f62b3f 100644
--- a/third_party/WebKit/Source/modules/modules.gypi
+++ b/third_party/WebKit/Source/modules/modules.gypi
@@ -156,9 +156,9 @@
       'plugins/PluginArray.idl',
       'presentation/Presentation.idl',
       'presentation/PresentationAvailability.idl',
+      'presentation/PresentationConnection.idl',
+      'presentation/PresentationConnectionAvailableEvent.idl',
       'presentation/PresentationRequest.idl',
-      'presentation/PresentationSession.idl',
-      'presentation/PresentationSessionConnectEvent.idl',
       'push_messaging/PushEvent.idl',
       'push_messaging/PushManager.idl',
       'push_messaging/PushMessageData.idl',
@@ -405,7 +405,7 @@
       'mediastream/RTCIceCandidateEvent.idl',
       'navigatorconnect/ServicePortConnectEvent.idl',
       'notifications/NotificationEvent.idl',
-      'presentation/PresentationSessionConnectEvent.idl',
+      'presentation/PresentationConnectionAvailableEvent.idl',
       'push_messaging/PushEvent.idl',
       'serviceworkers/ExtendableEvent.idl',
       'serviceworkers/FetchEvent.idl',
@@ -470,7 +470,7 @@
       'permissions/MidiPermissionDescriptor.idl',
       'permissions/PermissionDescriptor.idl',
       'permissions/PushPermissionDescriptor.idl',
-      'presentation/PresentationSessionConnectEventInit.idl',
+      'presentation/PresentationConnectionAvailableEventInit.idl',
       'push_messaging/PushEventInit.idl',
       'push_messaging/PushSubscriptionOptions.idl',
       'serviceworkers/ClientQueryOptions.idl',
@@ -599,8 +599,8 @@
       '<(blink_modules_output_dir)/permissions/PermissionDescriptor.h',
       '<(blink_modules_output_dir)/permissions/PushPermissionDescriptor.cpp',
       '<(blink_modules_output_dir)/permissions/PushPermissionDescriptor.h',
-      '<(blink_modules_output_dir)/presentation/PresentationSessionConnectEventInit.cpp',
-      '<(blink_modules_output_dir)/presentation/PresentationSessionConnectEventInit.h',
+      '<(blink_modules_output_dir)/presentation/PresentationConnectionAvailableEventInit.cpp',
+      '<(blink_modules_output_dir)/presentation/PresentationConnectionAvailableEventInit.h',
       '<(blink_modules_output_dir)/push_messaging/PushEventInit.cpp',
       '<(blink_modules_output_dir)/push_messaging/PushEventInit.h',
       '<(blink_modules_output_dir)/push_messaging/PushSubscriptionOptions.cpp',
@@ -1259,18 +1259,18 @@
       'presentation/PresentationAvailability.h',
       'presentation/PresentationAvailabilityCallbacks.cpp',
       'presentation/PresentationAvailabilityCallbacks.h',
+      'presentation/PresentationConnection.cpp',
+      'presentation/PresentationConnection.h',
+      'presentation/PresentationConnectionCallbacks.cpp',
+      'presentation/PresentationConnectionCallbacks.h',
+      'presentation/PresentationConnectionAvailableEvent.cpp',
+      'presentation/PresentationConnectionAvailableEvent.h',
       'presentation/PresentationController.cpp',
       'presentation/PresentationController.h',
       'presentation/PresentationError.cpp',
       'presentation/PresentationError.h',
       'presentation/PresentationRequest.cpp',
       'presentation/PresentationRequest.h',
-      'presentation/PresentationSession.cpp',
-      'presentation/PresentationSession.h',
-      'presentation/PresentationSessionCallbacks.cpp',
-      'presentation/PresentationSessionCallbacks.h',
-      'presentation/PresentationSessionConnectEvent.cpp',
-      'presentation/PresentationSessionConnectEvent.h',
       'push_messaging/PushController.cpp',
       'push_messaging/PushController.h',
       'push_messaging/PushError.cpp',
diff --git a/third_party/WebKit/Source/modules/notifications/Notification.idl b/third_party/WebKit/Source/modules/notifications/Notification.idl
index 8d78f7f..38297e7 100644
--- a/third_party/WebKit/Source/modules/notifications/Notification.idl
+++ b/third_party/WebKit/Source/modules/notifications/Notification.idl
@@ -51,7 +51,6 @@
 ] interface Notification : EventTarget {
     [CallWith=ExecutionContext, MeasureAs=NotificationPermission] static readonly attribute NotificationPermission permission;
 
-    // TODO(peter): Only expose requestPermission() on the Window object. See https://crbug.com/442139.
     [CallWith=ScriptState, Exposed=Window, MeasureAs=NotificationPermissionRequested] static Promise<NotificationPermission> requestPermission(optional NotificationPermissionCallback deprecatedCallback);
 
     [RuntimeEnabled=NotificationExperimental] static readonly attribute unsigned long maxActions;
diff --git a/third_party/WebKit/Source/modules/permissions/Permissions.cpp b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
index bd4029f2..c0d92a1 100644
--- a/third_party/WebKit/Source/modules/permissions/Permissions.cpp
+++ b/third_party/WebKit/Source/modules/permissions/Permissions.cpp
@@ -23,6 +23,8 @@
 #include "platform/Logging.h"
 #include "public/platform/Platform.h"
 #include "public/platform/modules/permissions/WebPermissionClient.h"
+#include "wtf/NotFound.h"
+#include "wtf/Vector.h"
 
 namespace blink {
 
@@ -146,7 +148,8 @@
         return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(InvalidStateError, "In its current state, the global scope can't request permissions."));
 
     ExceptionState exceptionState(ExceptionState::GetterContext,  "request", "Permissions", scriptState->context()->Global(), scriptState->isolate());
-    OwnPtr<WebVector<WebPermissionType>> permissions = adoptPtr(new WebVector<WebPermissionType>(rawPermissions.size()));
+    OwnPtr<Vector<WebPermissionType>> internalPermissions = adoptPtr(new Vector<WebPermissionType>());
+    OwnPtr<Vector<int>> callerIndexToInternalIndex = adoptPtr(new Vector<int>(rawPermissions.size()));
     for (size_t i = 0; i < rawPermissions.size(); ++i) {
         const Dictionary& rawPermission = rawPermissions[i];
 
@@ -154,13 +157,25 @@
         if (exceptionState.hadException())
             return exceptionState.reject(scriptState);
 
-        permissions->operator[](i) = type.get();
+        // Only append permissions to the vector that is passed to the client if it is not already
+        // in the vector (i.e. do not duplicate permisison types).
+        int internalIndex;
+        auto it = internalPermissions->find(type.get());
+        if (it == kNotFound) {
+            internalIndex = internalPermissions->size();
+            internalPermissions->append(type.get());
+        } else {
+            internalIndex = it;
+        }
+        callerIndexToInternalIndex->operator[](i) = internalIndex;
     }
 
     ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState);
     ScriptPromise promise = resolver->promise();
 
-    client->requestPermissions(*permissions, KURL(KURL(), scriptState->executionContext()->securityOrigin()->toString()), new PermissionsCallback(resolver, permissions.release()));
+    WebVector<WebPermissionType> internalWebPermissions = *internalPermissions;
+    client->requestPermissions(internalWebPermissions, KURL(KURL(), scriptState->executionContext()->securityOrigin()->toString()),
+        new PermissionsCallback(resolver, internalPermissions.release(), callerIndexToInternalIndex.release()));
     return promise;
 }
 
diff --git a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
index 1ea7d2c1..186d772 100644
--- a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
+++ b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.cpp
@@ -10,9 +10,10 @@
 
 namespace blink {
 
-PermissionsCallback::PermissionsCallback(ScriptPromiseResolver* resolver, PassOwnPtr<WebVector<WebPermissionType>> permission_types)
+PermissionsCallback::PermissionsCallback(ScriptPromiseResolver* resolver, PassOwnPtr<Vector<WebPermissionType>> internalPermissions, PassOwnPtr<Vector<int>> callerIndexToInternalIndex)
     : m_resolver(resolver),
-    m_permissionTypes(permission_types)
+    m_internalPermissions(internalPermissions),
+    m_callerIndexToInternalIndex(callerIndexToInternalIndex)
 {
     ASSERT(m_resolver);
 }
@@ -23,13 +24,16 @@
         return;
 
     OwnPtr<WebVector<WebPermissionStatus>> statusPtr = permissionStatus.release();
+    Vector<PermissionStatus*> result(m_callerIndexToInternalIndex->size());
 
-    Vector<PermissionStatus*> status;
-    status.reserveCapacity(statusPtr->size());
-    for (size_t i = 0; i < statusPtr->size(); ++i)
-        status.append(PermissionStatus::createAndListen(m_resolver->executionContext(), (*statusPtr)[i], (*m_permissionTypes)[i]));
-
-    m_resolver->resolve(status);
+    // Create the response vector by finding the status for each index by
+    // using the caller to internal index mapping and looking up the status
+    // using the internal index obtained.
+    for (size_t i = 0; i < m_callerIndexToInternalIndex->size(); ++i) {
+        int internalIndex = m_callerIndexToInternalIndex->operator[](i);
+        result[i] = PermissionStatus::createAndListen(m_resolver->executionContext(), statusPtr->operator[](internalIndex), m_internalPermissions->operator[](internalIndex));
+    }
+    m_resolver->resolve(result);
 }
 
 void PermissionsCallback::onError()
diff --git a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h
index feef287..3800a78 100644
--- a/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h
+++ b/third_party/WebKit/Source/modules/permissions/PermissionsCallback.h
@@ -26,7 +26,7 @@
 class PermissionsCallback final
     : public WebCallbacks<WebPassOwnPtr<WebVector<WebPermissionStatus>>, void> {
 public:
-    PermissionsCallback(ScriptPromiseResolver*, PassOwnPtr<WebVector<WebPermissionType>>);
+    PermissionsCallback(ScriptPromiseResolver*, PassOwnPtr<Vector<WebPermissionType>>, PassOwnPtr<Vector<int>>);
     ~PermissionsCallback() = default;
 
     void onSuccess(WebPassOwnPtr<WebVector<WebPermissionStatus>>) override;
@@ -34,7 +34,14 @@
 
 private:
     Persistent<ScriptPromiseResolver> m_resolver;
-    OwnPtr<WebVector<WebPermissionType>> m_permissionTypes;
+
+    // The permission types which were passed to the client to be requested.
+    OwnPtr<Vector<WebPermissionType>> m_internalPermissions;
+
+    // Maps each index in the caller vector to the corresponding index in the
+    // internal vector (i.e. the vector passsed to the client) such that both
+    // indices have the same WebPermissionType.
+    OwnPtr<Vector<int>> m_callerIndexToInternalIndex;
 
     WTF_MAKE_NONCOPYABLE(PermissionsCallback);
 };
diff --git a/third_party/WebKit/Source/modules/presentation/Presentation.cpp b/third_party/WebKit/Source/modules/presentation/Presentation.cpp
index f66cdfb..a3df3121 100644
--- a/third_party/WebKit/Source/modules/presentation/Presentation.cpp
+++ b/third_party/WebKit/Source/modules/presentation/Presentation.cpp
@@ -44,7 +44,7 @@
 
 DEFINE_TRACE(Presentation)
 {
-    visitor->trace(m_session);
+    visitor->trace(m_connection);
     visitor->trace(m_defaultRequest);
     RefCountedGarbageCollectedEventTargetWithInlineData<Presentation>::trace(visitor);
     DOMWindowProperty::trace(visitor);
@@ -68,9 +68,9 @@
     controller->setDefaultRequestUrl(request ? request->url() : KURL());
 }
 
-PresentationSession* Presentation::session() const
+PresentationConnection* Presentation::connection() const
 {
-    return m_session.get();
+    return m_connection.get();
 }
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/Presentation.h b/third_party/WebKit/Source/modules/presentation/Presentation.h
index 9448f463..fbe8991 100644
--- a/third_party/WebKit/Source/modules/presentation/Presentation.h
+++ b/third_party/WebKit/Source/modules/presentation/Presentation.h
@@ -8,7 +8,7 @@
 #include "bindings/core/v8/ScriptPromise.h"
 #include "core/events/EventTarget.h"
 #include "core/frame/DOMWindowProperty.h"
-#include "modules/presentation/PresentationSession.h"
+#include "modules/presentation/PresentationConnection.h"
 #include "platform/heap/Handle.h"
 #include "platform/heap/Heap.h"
 
@@ -22,8 +22,8 @@
 class PresentationController;
 class PresentationRequest;
 class ScriptState;
-class WebPresentationSessionClient;
-enum class WebPresentationSessionState;
+class WebPresentationConnectionClient;
+enum class WebPresentationConnectionState;
 
 // Implements the main entry point of the Presentation API corresponding to the Presentation.idl
 // See https://w3c.github.io/presentation-api/#navigatorpresentation for details.
@@ -46,13 +46,13 @@
     PresentationRequest* defaultRequest() const;
     void setDefaultRequest(PresentationRequest*);
 
-    PresentationSession* session() const;
+    PresentationConnection* connection() const;
 
 private:
     explicit Presentation(LocalFrame*);
 
-    // The session object provided to the presentation page. Not supported.
-    Member<PresentationSession> m_session;
+    // The connection object provided to the presentation page. Not supported.
+    Member<PresentationConnection> m_connection;
 
     // Default PresentationRequest used by the embedder.
     Member<PresentationRequest> m_defaultRequest;
diff --git a/third_party/WebKit/Source/modules/presentation/Presentation.idl b/third_party/WebKit/Source/modules/presentation/Presentation.idl
index 227fb9e..8bdc3d5b 100644
--- a/third_party/WebKit/Source/modules/presentation/Presentation.idl
+++ b/third_party/WebKit/Source/modules/presentation/Presentation.idl
@@ -11,7 +11,7 @@
     [MeasureAs=PresentationDefaultRequest] attribute PresentationRequest? defaultRequest;
 
     // This API used by presenting browsing context.
-    // TODO(avayvod): The spec has |getSession()| and |getSessions()| instead.
-    readonly attribute PresentationSession? session;
-    // TODO(avayvod): attribute EventHandler onsessionavailable;
+    // TODO(mlamouri): The spec has |getSession()| and |getSessions()| instead.
+    readonly attribute PresentationConnection? connection;
+    // TODO(mlamouri): attribute EventHandler onconnectionavailable;
 };
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
new file mode 100644
index 0000000..b262989
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.cpp
@@ -0,0 +1,371 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/presentation/PresentationConnection.h"
+
+#include "bindings/core/v8/ScriptPromiseResolver.h"
+#include "core/dom/DOMArrayBuffer.h"
+#include "core/dom/DOMArrayBufferView.h"
+#include "core/dom/Document.h"
+#include "core/dom/ExceptionCode.h"
+#include "core/events/Event.h"
+#include "core/events/MessageEvent.h"
+#include "core/fileapi/FileReaderLoader.h"
+#include "core/fileapi/FileReaderLoaderClient.h"
+#include "core/frame/LocalFrame.h"
+#include "core/frame/UseCounter.h"
+#include "modules/EventTargetModules.h"
+#include "modules/presentation/Presentation.h"
+#include "modules/presentation/PresentationConnectionAvailableEvent.h"
+#include "modules/presentation/PresentationController.h"
+#include "modules/presentation/PresentationRequest.h"
+#include "public/platform/modules/presentation/WebPresentationConnectionClient.h"
+#include "wtf/Assertions.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/text/AtomicString.h"
+
+namespace blink {
+
+namespace {
+
+// TODO(mlamouri): refactor in one common place.
+WebPresentationClient* presentationClient(ExecutionContext* executionContext)
+{
+    ASSERT(executionContext && executionContext->isDocument());
+
+    Document* document = toDocument(executionContext);
+    if (!document->frame())
+        return nullptr;
+    PresentationController* controller = PresentationController::from(*document->frame());
+    return controller ? controller->client() : nullptr;
+}
+
+const AtomicString& connectionStateToString(WebPresentationConnectionState state)
+{
+    DEFINE_STATIC_LOCAL(const AtomicString, connectedValue, ("connected", AtomicString::ConstructFromLiteral));
+    DEFINE_STATIC_LOCAL(const AtomicString, disconnectedValue, ("disconnected", AtomicString::ConstructFromLiteral));
+
+    switch (state) {
+    case WebPresentationConnectionState::Connected:
+        return connectedValue;
+    case WebPresentationConnectionState::Disconnected:
+        return disconnectedValue;
+    }
+
+    ASSERT_NOT_REACHED();
+    return disconnectedValue;
+}
+
+void throwPresentationDisconnectedError(ExceptionState& exceptionState)
+{
+    exceptionState.throwDOMException(InvalidStateError, "Presentation connection is disconnected.");
+}
+
+} // namespace
+
+class PresentationConnection::BlobLoader final : public GarbageCollectedFinalized<PresentationConnection::BlobLoader>, public FileReaderLoaderClient {
+public:
+    BlobLoader(PassRefPtr<BlobDataHandle> blobDataHandle, PresentationConnection* PresentationConnection)
+        : m_PresentationConnection(PresentationConnection)
+        , m_loader(FileReaderLoader::ReadAsArrayBuffer, this)
+    {
+        m_loader.start(m_PresentationConnection->executionContext(), blobDataHandle);
+    }
+    ~BlobLoader() override { }
+
+    // FileReaderLoaderClient functions.
+    void didStartLoading() override { }
+    void didReceiveData() override { }
+    void didFinishLoading() override
+    {
+        m_PresentationConnection->didFinishLoadingBlob(m_loader.arrayBufferResult());
+    }
+    void didFail(FileError::ErrorCode errorCode) override
+    {
+        m_PresentationConnection->didFailLoadingBlob(errorCode);
+    }
+
+    void cancel()
+    {
+        m_loader.cancel();
+    }
+
+    DEFINE_INLINE_TRACE()
+    {
+        visitor->trace(m_PresentationConnection);
+    }
+
+private:
+    Member<PresentationConnection> m_PresentationConnection;
+    FileReaderLoader m_loader;
+};
+
+PresentationConnection::PresentationConnection(LocalFrame* frame, const String& id, const String& url)
+    : DOMWindowProperty(frame)
+    , m_id(id)
+    , m_url(url)
+    , m_state(WebPresentationConnectionState::Connected)
+    , m_binaryType(BinaryTypeBlob)
+{
+}
+
+PresentationConnection::~PresentationConnection()
+{
+    ASSERT(!m_blobLoader);
+}
+
+// static
+PresentationConnection* PresentationConnection::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebPresentationConnectionClient> client, PresentationRequest* request)
+{
+    ASSERT(resolver);
+    ASSERT(client);
+    ASSERT(request);
+    ASSERT(resolver->executionContext()->isDocument());
+
+    Document* document = toDocument(resolver->executionContext());
+    if (!document->frame())
+        return nullptr;
+
+    PresentationController* controller = PresentationController::from(*document->frame());
+    if (!controller)
+        return nullptr;
+
+    return take(controller, client, request);
+}
+
+// static
+PresentationConnection* PresentationConnection::take(PresentationController* controller, PassOwnPtr<WebPresentationConnectionClient> client, PresentationRequest* request)
+{
+    ASSERT(controller);
+    ASSERT(request);
+
+    PresentationConnection* connection = new PresentationConnection(controller->frame(), client->getId(), client->getUrl());
+    controller->registerConnection(connection);
+    request->dispatchEvent(PresentationConnectionAvailableEvent::create(EventTypeNames::connectionavailable, connection));
+
+    return connection;
+}
+
+const AtomicString& PresentationConnection::interfaceName() const
+{
+    return EventTargetNames::PresentationConnection;
+}
+
+ExecutionContext* PresentationConnection::executionContext() const
+{
+    if (!frame())
+        return nullptr;
+    return frame()->document();
+}
+
+bool PresentationConnection::addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, bool capture)
+{
+    if (eventType == EventTypeNames::statechange)
+        UseCounter::count(executionContext(), UseCounter::PresentationConnectionStateChangeEventListener);
+    else if (eventType == EventTypeNames::message)
+        UseCounter::count(executionContext(), UseCounter::PresentationConnectionMessageEventListener);
+
+    return EventTarget::addEventListener(eventType, listener, capture);
+}
+
+DEFINE_TRACE(PresentationConnection)
+{
+    visitor->trace(m_blobLoader);
+    RefCountedGarbageCollectedEventTargetWithInlineData<PresentationConnection>::trace(visitor);
+    DOMWindowProperty::trace(visitor);
+}
+
+const AtomicString& PresentationConnection::state() const
+{
+    return connectionStateToString(m_state);
+}
+
+void PresentationConnection::send(const String& message, ExceptionState& exceptionState)
+{
+    if (!canSendMessage(exceptionState))
+        return;
+
+    m_messages.append(adoptPtr(new Message(message)));
+    handleMessageQueue();
+}
+
+void PresentationConnection::send(PassRefPtr<DOMArrayBuffer> arrayBuffer, ExceptionState& exceptionState)
+{
+    ASSERT(arrayBuffer && arrayBuffer->buffer());
+    if (!canSendMessage(exceptionState))
+        return;
+
+    m_messages.append(adoptPtr(new Message(arrayBuffer)));
+    handleMessageQueue();
+}
+
+void PresentationConnection::send(PassRefPtr<DOMArrayBufferView> arrayBufferView, ExceptionState& exceptionState)
+{
+    ASSERT(arrayBufferView);
+    if (!canSendMessage(exceptionState))
+        return;
+
+    m_messages.append(adoptPtr(new Message(arrayBufferView->buffer())));
+    handleMessageQueue();
+}
+
+void PresentationConnection::send(Blob* data, ExceptionState& exceptionState)
+{
+    ASSERT(data);
+    if (!canSendMessage(exceptionState))
+        return;
+
+    m_messages.append(adoptPtr(new Message(data->blobDataHandle())));
+    handleMessageQueue();
+}
+
+bool PresentationConnection::canSendMessage(ExceptionState& exceptionState)
+{
+    if (m_state == WebPresentationConnectionState::Disconnected) {
+        throwPresentationDisconnectedError(exceptionState);
+        return false;
+    }
+
+    // The connection can send a message if there is a client available.
+    return !!presentationClient(executionContext());
+}
+
+void PresentationConnection::handleMessageQueue()
+{
+    WebPresentationClient* client = presentationClient(executionContext());
+    if (!client)
+        return;
+
+    while (!m_messages.isEmpty() && !m_blobLoader) {
+        Message* message = m_messages.first().get();
+        switch (message->type) {
+        case MessageTypeText:
+            client->sendString(m_url, m_id, message->text);
+            m_messages.removeFirst();
+            break;
+        case MessageTypeArrayBuffer:
+            client->sendArrayBuffer(m_url, m_id, static_cast<const uint8_t*>(message->arrayBuffer->data()), message->arrayBuffer->byteLength());
+            m_messages.removeFirst();
+            break;
+        case MessageTypeBlob:
+            ASSERT(!m_blobLoader);
+            m_blobLoader = new BlobLoader(message->blobDataHandle, this);
+            break;
+        }
+    }
+}
+
+String PresentationConnection::binaryType() const
+{
+    switch (m_binaryType) {
+    case BinaryTypeBlob:
+        return "blob";
+    case BinaryTypeArrayBuffer:
+        return "arraybuffer";
+    }
+    ASSERT_NOT_REACHED();
+    return String();
+}
+
+void PresentationConnection::setBinaryType(const String& binaryType)
+{
+    if (binaryType == "blob") {
+        m_binaryType = BinaryTypeBlob;
+        return;
+    }
+    if (binaryType == "arraybuffer") {
+        m_binaryType = BinaryTypeArrayBuffer;
+        return;
+    }
+    ASSERT_NOT_REACHED();
+}
+
+void PresentationConnection::didReceiveTextMessage(const String& message)
+{
+    if (m_state == WebPresentationConnectionState::Disconnected)
+        return;
+
+    dispatchEvent(MessageEvent::create(message));
+}
+
+void PresentationConnection::didReceiveBinaryMessage(const uint8_t* data, size_t length)
+{
+    if (m_state == WebPresentationConnectionState::Disconnected)
+        return;
+
+    switch (m_binaryType) {
+    case BinaryTypeBlob: {
+        OwnPtr<BlobData> blobData = BlobData::create();
+        blobData->appendBytes(data, length);
+        Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), length));
+        dispatchEvent(MessageEvent::create(blob));
+        return;
+    }
+    case BinaryTypeArrayBuffer:
+        RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(data, length);
+        dispatchEvent(MessageEvent::create(buffer.release()));
+        return;
+    }
+    ASSERT_NOT_REACHED();
+}
+
+void PresentationConnection::close()
+{
+    if (m_state != WebPresentationConnectionState::Connected)
+        return;
+    WebPresentationClient* client = presentationClient(executionContext());
+    if (client)
+        client->closeSession(m_url, m_id);
+
+    // Cancel current Blob loading if any.
+    if (m_blobLoader) {
+        m_blobLoader->cancel();
+        m_blobLoader.clear();
+    }
+
+    // Clear message queue.
+    Deque<OwnPtr<Message>> empty;
+    m_messages.swap(empty);
+}
+
+bool PresentationConnection::matches(WebPresentationConnectionClient* client) const
+{
+    return client && m_url == static_cast<String>(client->getUrl()) && m_id == static_cast<String>(client->getId());
+}
+
+void PresentationConnection::didChangeState(WebPresentationConnectionState state)
+{
+    if (m_state == state)
+        return;
+
+    m_state = state;
+    dispatchEvent(Event::create(EventTypeNames::statechange));
+}
+
+void PresentationConnection::didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer> buffer)
+{
+    ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob);
+    ASSERT(buffer && buffer->buffer());
+    // Send the loaded blob immediately here and continue processing the queue.
+    WebPresentationClient* client = presentationClient(executionContext());
+    if (client)
+        client->sendBlobData(m_url, m_id, static_cast<const uint8_t*>(buffer->data()), buffer->byteLength());
+
+    m_messages.removeFirst();
+    m_blobLoader.clear();
+    handleMessageQueue();
+}
+
+void PresentationConnection::didFailLoadingBlob(FileError::ErrorCode errorCode)
+{
+    ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob);
+    // FIXME: generate error message?
+    // Ignore the current failed blob item and continue with next items.
+    m_messages.removeFirst();
+    m_blobLoader.clear();
+    handleMessageQueue();
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.h b/third_party/WebKit/Source/modules/presentation/PresentationConnection.h
new file mode 100644
index 0000000..0bbfa41
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.h
@@ -0,0 +1,129 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PresentationConnection_h
+#define PresentationConnection_h
+
+#include "core/events/EventTarget.h"
+#include "core/fileapi/Blob.h"
+#include "core/fileapi/FileError.h"
+#include "core/frame/DOMWindowProperty.h"
+#include "platform/heap/Handle.h"
+#include "public/platform/modules/presentation/WebPresentationConnectionClient.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/text/WTFString.h"
+
+namespace WTF {
+class AtomicString;
+} // namespace WTF
+
+namespace blink {
+
+class DOMArrayBuffer;
+class DOMArrayBufferView;
+class PresentationController;
+class PresentationRequest;
+
+class PresentationConnection final
+    : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationConnection>
+    , public DOMWindowProperty {
+    REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PresentationConnection);
+    WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationConnection);
+    DEFINE_WRAPPERTYPEINFO();
+public:
+    // For CallbackPromiseAdapter.
+    using WebType = OwnPtr<WebPresentationConnectionClient>;
+
+    static PresentationConnection* take(ScriptPromiseResolver*, PassOwnPtr<WebPresentationConnectionClient>, PresentationRequest*);
+    static PresentationConnection* take(PresentationController*, PassOwnPtr<WebPresentationConnectionClient>, PresentationRequest*);
+    ~PresentationConnection() override;
+
+    // EventTarget implementation.
+    const AtomicString& interfaceName() const override;
+    ExecutionContext* executionContext() const override;
+    bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener>, bool capture) override;
+
+    DECLARE_VIRTUAL_TRACE();
+
+    const String& id() const { return m_id; }
+    const WTF::AtomicString& state() const;
+
+    void send(const String& message, ExceptionState&);
+    void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&);
+    void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&);
+    void send(Blob*, ExceptionState&);
+    void close();
+
+    String binaryType() const;
+    void setBinaryType(const String&);
+
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
+
+    // Returns true if and only if the WebPresentationConnectionClient represents this connection.
+    bool matches(WebPresentationConnectionClient*) const;
+
+    // Notifies the connection about its state change.
+    void didChangeState(WebPresentationConnectionState);
+
+    // Notifies the presentation about new message.
+    void didReceiveTextMessage(const String& message);
+    void didReceiveBinaryMessage(const uint8_t* data, size_t length);
+
+private:
+    class BlobLoader;
+
+    enum MessageType {
+        MessageTypeText,
+        MessageTypeArrayBuffer,
+        MessageTypeBlob,
+    };
+
+    enum BinaryType {
+        BinaryTypeBlob,
+        BinaryTypeArrayBuffer
+    };
+
+    struct Message {
+        Message(const String& text)
+            : type(MessageTypeText)
+            , text(text) { }
+
+        Message(PassRefPtr<DOMArrayBuffer> arrayBuffer)
+            : type(MessageTypeArrayBuffer)
+            , arrayBuffer(arrayBuffer) { }
+
+        Message(PassRefPtr<BlobDataHandle> blobDataHandle)
+            : type(MessageTypeBlob)
+            , blobDataHandle(blobDataHandle) { }
+
+        MessageType type;
+        String text;
+        RefPtr<DOMArrayBuffer> arrayBuffer;
+        RefPtr<BlobDataHandle> blobDataHandle;
+    };
+
+    PresentationConnection(LocalFrame*, const String& id, const String& url);
+
+    bool canSendMessage(ExceptionState&);
+    void handleMessageQueue();
+
+    // Callbacks invoked from BlobLoader.
+    void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>);
+    void didFailLoadingBlob(FileError::ErrorCode);
+
+    String m_id;
+    String m_url;
+    WebPresentationConnectionState m_state;
+
+    // For Blob data handling.
+    Member<BlobLoader> m_blobLoader;
+    Deque<OwnPtr<Message>> m_messages;
+
+    BinaryType m_binaryType;
+};
+
+} // namespace blink
+
+#endif // PresentationConnection_h
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnection.idl b/third_party/WebKit/Source/modules/presentation/PresentationConnection.idl
new file mode 100644
index 0000000..39b7e96
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnection.idl
@@ -0,0 +1,28 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// https://w3c.github.io/presentation-api/#interface-presentationconnection
+
+enum PresentationConnectionState {
+    "connected",
+    "disconnected"
+};
+
+[
+    GarbageCollected,
+    RuntimeEnabled=Presentation
+] interface PresentationConnection : EventTarget {
+    readonly attribute DOMString? id;
+    readonly attribute PresentationConnectionState state;
+    [MeasureAs=PresentationConnectionClose] void close();
+    attribute EventHandler onstatechange;
+
+    // Communication
+    attribute BinaryType binaryType;
+    attribute EventHandler onmessage;
+    [RaisesException, MeasureAs=PresentationConnectionSend] void send(DOMString message);
+    [RaisesException, MeasureAs=PresentationConnectionSend] void send(Blob data);
+    [RaisesException, MeasureAs=PresentationConnectionSend] void send(ArrayBuffer data);
+    [RaisesException, MeasureAs=PresentationConnectionSend] void send(ArrayBufferView data);
+};
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.cpp
new file mode 100644
index 0000000..aabbe7fe
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.cpp
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/presentation/PresentationConnectionAvailableEvent.h"
+
+#include "modules/presentation/PresentationConnectionAvailableEventInit.h"
+
+namespace blink {
+
+PresentationConnectionAvailableEvent::~PresentationConnectionAvailableEvent()
+{
+}
+
+PresentationConnectionAvailableEvent::PresentationConnectionAvailableEvent()
+{
+}
+
+PresentationConnectionAvailableEvent::PresentationConnectionAvailableEvent(const AtomicString& eventType, PresentationConnection* connection)
+    : Event(eventType, false /* canBubble */, false /* cancelable */)
+    , m_connection(connection)
+{
+}
+
+PresentationConnectionAvailableEvent::PresentationConnectionAvailableEvent(const AtomicString& eventType, const PresentationConnectionAvailableEventInit& initializer)
+    : Event(eventType, initializer)
+    , m_connection(initializer.connection())
+{
+}
+
+const AtomicString& PresentationConnectionAvailableEvent::interfaceName() const
+{
+    return EventNames::PresentationConnectionAvailableEvent;
+}
+
+DEFINE_TRACE(PresentationConnectionAvailableEvent)
+{
+    visitor->trace(m_connection);
+    Event::trace(visitor);
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.h b/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.h
new file mode 100644
index 0000000..09038085
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.h
@@ -0,0 +1,55 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PresentationConnectionAvailableEvent_h
+#define PresentationConnectionAvailableEvent_h
+
+#include "modules/EventModules.h"
+#include "modules/presentation/PresentationConnection.h"
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class PresentationConnectionAvailableEventInit;
+
+// Presentation API event to be fired when a presentation has been triggered
+// by the embedder using the default presentation URL and id.
+// See https://code.google.com/p/chromium/issues/detail?id=459001 for details.
+class PresentationConnectionAvailableEvent final : public Event {
+    DEFINE_WRAPPERTYPEINFO();
+public:
+    ~PresentationConnectionAvailableEvent() override;
+
+    static PassRefPtrWillBeRawPtr<PresentationConnectionAvailableEvent> create()
+    {
+        return adoptRefWillBeNoop(new PresentationConnectionAvailableEvent);
+    }
+    static PassRefPtrWillBeRawPtr<PresentationConnectionAvailableEvent> create(const AtomicString& eventType, PresentationConnection* connection)
+    {
+        return adoptRefWillBeNoop(new PresentationConnectionAvailableEvent(eventType, connection));
+    }
+    static PassRefPtrWillBeRawPtr<PresentationConnectionAvailableEvent> create(const AtomicString& eventType, const PresentationConnectionAvailableEventInit& initializer)
+    {
+        return adoptRefWillBeNoop(new PresentationConnectionAvailableEvent(eventType, initializer));
+    }
+
+    PresentationConnection* connection() { return m_connection.get(); }
+
+    const AtomicString& interfaceName() const override;
+
+    DECLARE_VIRTUAL_TRACE();
+
+private:
+    PresentationConnectionAvailableEvent();
+    PresentationConnectionAvailableEvent(const AtomicString& eventType, PresentationConnection*);
+    PresentationConnectionAvailableEvent(const AtomicString& eventType, const PresentationConnectionAvailableEventInit& initializer);
+
+    PersistentWillBeMember<PresentationConnection> m_connection;
+};
+
+DEFINE_TYPE_CASTS(PresentationConnectionAvailableEvent, Event, event, event->interfaceName() == EventNames::PresentationConnectionAvailableEvent, event.interfaceName() == EventNames::PresentationConnectionAvailableEvent);
+
+} // namespace blink
+
+#endif // PresentationConnectionAvailableEvent_h
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.idl b/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.idl
new file mode 100644
index 0000000..a937e2e3
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEvent.idl
@@ -0,0 +1,12 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// https://w3c.github.io/presentation-api/#interface-presentationconnectionavailableeevent
+
+[
+    Constructor(DOMString type, PresentationConnectionAvailableEventInit eventInitDict),
+    RuntimeEnabled=Presentation
+] interface PresentationConnectionAvailableEvent : Event {
+    [SameObject] readonly attribute PresentationConnection connection;
+};
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEventInit.idl b/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEventInit.idl
new file mode 100644
index 0000000..1f28673
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionAvailableEventInit.idl
@@ -0,0 +1,9 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// https://w3c.github.io/presentation-api/#idl-def-presentationconnectionavailableeventinit
+
+dictionary PresentationConnectionAvailableEventInit : EventInit {
+    required PresentationConnection connection;
+};
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
new file mode 100644
index 0000000..203e6c8
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.cpp
@@ -0,0 +1,41 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "modules/presentation/PresentationConnectionCallbacks.h"
+
+#include "bindings/core/v8/ScriptPromiseResolver.h"
+#include "modules/presentation/PresentationConnection.h"
+#include "modules/presentation/PresentationError.h"
+#include "modules/presentation/PresentationRequest.h"
+#include "public/platform/modules/presentation/WebPresentationConnectionClient.h"
+#include "public/platform/modules/presentation/WebPresentationError.h"
+
+namespace blink {
+
+PresentationConnectionCallbacks::PresentationConnectionCallbacks(ScriptPromiseResolver* resolver, PresentationRequest* request)
+    : m_resolver(resolver)
+    , m_request(request)
+{
+    ASSERT(m_resolver);
+    ASSERT(m_request);
+}
+
+void PresentationConnectionCallbacks::onSuccess(WebPassOwnPtr<WebPresentationConnectionClient> PresentationConnectionClient)
+{
+    OwnPtr<WebPresentationConnectionClient> result(PresentationConnectionClient.release());
+
+    if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
+        return;
+    m_resolver->resolve(PresentationConnection::take(m_resolver.get(), result.release(), m_request));
+}
+
+void PresentationConnectionCallbacks::onError(const WebPresentationError& error)
+{
+    if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
+        return;
+    m_resolver->reject(PresentationError::take(m_resolver.get(), error));
+}
+
+} // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.h b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.h
new file mode 100644
index 0000000..d460c995
--- /dev/null
+++ b/third_party/WebKit/Source/modules/presentation/PresentationConnectionCallbacks.h
@@ -0,0 +1,41 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PresentationConnectionCallbacks_h
+#define PresentationConnectionCallbacks_h
+
+#include "platform/heap/Handle.h"
+#include "public/platform/WebCallbacks.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+class PresentationRequest;
+class ScriptPromiseResolver;
+class WebPresentationConnectionClient;
+struct WebPresentationError;
+
+// PresentationConnectionCallbacks extends WebCallbacks to resolve the
+// underlying promise depending on the result passed to the callback. It takes
+// the PresentationRequest object that originated the call in its constructor
+// and will pass it to the created PresentationConnection.
+class PresentationConnectionCallbacks final
+    : public WebCallbacks<WebPassOwnPtr<WebPresentationConnectionClient>, const WebPresentationError&> {
+public:
+    PresentationConnectionCallbacks(ScriptPromiseResolver*, PresentationRequest*);
+    ~PresentationConnectionCallbacks() override = default;
+
+    void onSuccess(WebPassOwnPtr<WebPresentationConnectionClient>) override;
+    void onError(const WebPresentationError&) override;
+
+private:
+    Persistent<ScriptPromiseResolver> m_resolver;
+    Persistent<PresentationRequest> m_request;
+
+    WTF_MAKE_NONCOPYABLE(PresentationConnectionCallbacks);
+};
+
+} // namespace blink
+
+#endif // PresentationConnectionCallbacks_h
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationController.cpp b/third_party/WebKit/Source/modules/presentation/PresentationController.cpp
index e34c799a..1239740 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationController.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationController.cpp
@@ -6,7 +6,7 @@
 #include "modules/presentation/PresentationController.h"
 
 #include "core/frame/LocalFrame.h"
-#include "modules/presentation/PresentationSession.h"
+#include "modules/presentation/PresentationConnection.h"
 #include "public/platform/modules/presentation/WebPresentationClient.h"
 
 namespace blink {
@@ -57,46 +57,46 @@
 DEFINE_TRACE(PresentationController)
 {
     visitor->trace(m_presentation);
-    visitor->trace(m_sessions);
+    visitor->trace(m_connections);
     WillBeHeapSupplement<LocalFrame>::trace(visitor);
     LocalFrameLifecycleObserver::trace(visitor);
 }
 
-void PresentationController::didStartDefaultSession(WebPresentationSessionClient* sessionClient)
+void PresentationController::didStartDefaultSession(WebPresentationConnectionClient* connectionClient)
 {
     if (!m_presentation || !m_presentation->defaultRequest())
         return;
-    PresentationSession::take(this, adoptPtr(sessionClient), m_presentation->defaultRequest());
+    PresentationConnection::take(this, adoptPtr(connectionClient), m_presentation->defaultRequest());
 }
 
-void PresentationController::didChangeSessionState(WebPresentationSessionClient* sessionClient, WebPresentationSessionState state)
+void PresentationController::didChangeSessionState(WebPresentationConnectionClient* connectionClient, WebPresentationConnectionState state)
 {
-    OwnPtr<WebPresentationSessionClient> client = adoptPtr(sessionClient);
+    OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient);
 
-    PresentationSession* session = findSession(client.get());
-    if (!session)
+    PresentationConnection* connection = findConnection(client.get());
+    if (!connection)
         return;
-    session->didChangeState(state);
+    connection->didChangeState(state);
 }
 
-void PresentationController::didReceiveSessionTextMessage(WebPresentationSessionClient* sessionClient, const WebString& message)
+void PresentationController::didReceiveSessionTextMessage(WebPresentationConnectionClient* connectionClient, const WebString& message)
 {
-    OwnPtr<WebPresentationSessionClient> client = adoptPtr(sessionClient);
+    OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient);
 
-    PresentationSession* session = findSession(client.get());
-    if (!session)
+    PresentationConnection* connection = findConnection(client.get());
+    if (!connection)
         return;
-    session->didReceiveTextMessage(message);
+    connection->didReceiveTextMessage(message);
 }
 
-void PresentationController::didReceiveSessionBinaryMessage(WebPresentationSessionClient* sessionClient, const uint8_t* data, size_t length)
+void PresentationController::didReceiveSessionBinaryMessage(WebPresentationConnectionClient* connectionClient, const uint8_t* data, size_t length)
 {
-    OwnPtr<WebPresentationSessionClient> client = adoptPtr(sessionClient);
+    OwnPtr<WebPresentationConnectionClient> client = adoptPtr(connectionClient);
 
-    PresentationSession* session = findSession(client.get());
-    if (!session)
+    PresentationConnection* connection = findConnection(client.get());
+    if (!connection)
         return;
-    session->didReceiveBinaryMessage(data, length);
+    connection->didReceiveBinaryMessage(data, length);
 }
 
 void PresentationController::setPresentation(Presentation* presentation)
@@ -115,9 +115,9 @@
         m_client->setDefaultPresentationUrl(blink::WebString());
 }
 
-void PresentationController::registerSession(PresentationSession* session)
+void PresentationController::registerConnection(PresentationConnection* connection)
 {
-    m_sessions.add(session);
+    m_connections.add(connection);
 }
 
 void PresentationController::willDetachFrameHost()
@@ -128,11 +128,11 @@
     }
 }
 
-PresentationSession* PresentationController::findSession(WebPresentationSessionClient* sessionClient)
+PresentationConnection* PresentationController::findConnection(WebPresentationConnectionClient* connectionClient)
 {
-    for (const auto& session : m_sessions) {
-        if (session->matches(sessionClient))
-            return session.get();
+    for (const auto& connection : m_connections) {
+        if (connection->matches(connectionClient))
+            return connection.get();
     }
 
     return nullptr;
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationController.h b/third_party/WebKit/Source/modules/presentation/PresentationController.h
index 74d0e449..69ba690 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationController.h
+++ b/third_party/WebKit/Source/modules/presentation/PresentationController.h
@@ -18,8 +18,8 @@
 
 class LocalFrame;
 class WebPresentationAvailabilityCallback;
-class WebPresentationSessionClient;
-enum class WebPresentationSessionState;
+class WebPresentationConnectionClient;
+enum class WebPresentationConnectionState;
 
 // The coordinator between the various page exposed properties and the content
 // layer represented via |WebPresentationClient|.
@@ -47,10 +47,10 @@
     DECLARE_VIRTUAL_TRACE();
 
     // Implementation of WebPresentationController.
-    void didStartDefaultSession(WebPresentationSessionClient*) override;
-    void didChangeSessionState(WebPresentationSessionClient*, WebPresentationSessionState) override;
-    void didReceiveSessionTextMessage(WebPresentationSessionClient*, const WebString&) override;
-    void didReceiveSessionBinaryMessage(WebPresentationSessionClient*, const uint8_t* data, size_t length) override;
+    void didStartDefaultSession(WebPresentationConnectionClient*) override;
+    void didChangeSessionState(WebPresentationConnectionClient*, WebPresentationConnectionState) override;
+    void didReceiveSessionTextMessage(WebPresentationConnectionClient*, const WebString&) override;
+    void didReceiveSessionBinaryMessage(WebPresentationConnectionClient*, const uint8_t* data, size_t length) override;
 
     // Called by the Presentation object to advertize itself to the controller.
     // The Presentation object is kept as a WeakMember in order to avoid keeping
@@ -62,8 +62,8 @@
     // url.
     void setDefaultRequestUrl(const KURL&);
 
-    // Handling of running sessions.
-    void registerSession(PresentationSession*);
+    // Handling of running connections.
+    void registerConnection(PresentationConnection*);
 
 private:
     PresentationController(LocalFrame&, WebPresentationClient*);
@@ -71,9 +71,9 @@
     // Implementation of LocalFrameLifecycleObserver.
     void willDetachFrameHost() override;
 
-    // Return the session associated with the given |sessionClient| or null if
-    // it doesn't exist.
-    PresentationSession* findSession(WebPresentationSessionClient*);
+    // Return the connection associated with the given |connectionClient| or
+    // null if it doesn't exist.
+    PresentationConnection* findConnection(WebPresentationConnectionClient*);
 
     // The WebPresentationClient which allows communicating with the embedder.
     // It is not owned by the PresentationController but the controller will
@@ -85,11 +85,11 @@
     // PersistentWillBeMember<PresentationRequest> m_defaultRequest;
     WeakMember<Presentation> m_presentation;
 
-    // The presentation sessions associated with that frame.
-    // TODO(mlamouri): the PresentationController will keep any created session
-    // alive until the frame is detached. These should be weak ptr so that the
-    // session can be GC'd.
-    PersistentHeapHashSetWillBeHeapHashSet<Member<PresentationSession>> m_sessions;
+    // The presentation connections associated with that frame.
+    // TODO(mlamouri): the PresentationController will keep any created
+    // connections alive until the frame is detached. These should be weak ptr
+    // so that the connection can be GC'd.
+    PersistentHeapHashSetWillBeHeapHashSet<Member<PresentationConnection>> m_connections;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
index 889086d..bfa285bf 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
+++ b/third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp
@@ -15,10 +15,10 @@
 #include "modules/EventTargetModules.h"
 #include "modules/presentation/PresentationAvailability.h"
 #include "modules/presentation/PresentationAvailabilityCallbacks.h"
+#include "modules/presentation/PresentationConnection.h"
+#include "modules/presentation/PresentationConnectionCallbacks.h"
 #include "modules/presentation/PresentationController.h"
 #include "modules/presentation/PresentationError.h"
-#include "modules/presentation/PresentationSession.h"
-#include "modules/presentation/PresentationSessionCallbacks.h"
 #include "platform/UserGestureIndicator.h"
 
 namespace blink {
@@ -65,8 +65,8 @@
 
 bool PresentationRequest::addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, bool capture)
 {
-    if (eventType == EventTypeNames::sessionconnect)
-        UseCounter::count(executionContext(), UseCounter::PresentationRequestSessionConnectEventListener);
+    if (eventType == EventTypeNames::connectionavailable)
+        UseCounter::count(executionContext(), UseCounter::PresentationRequestConnectionAvailableEventListener);
 
     return EventTarget::addEventListener(eventType, listener, capture);
 }
@@ -96,7 +96,7 @@
         resolver->reject(DOMException::create(InvalidStateError, "The PresentationRequest is no longer associated to a frame."));
         return promise;
     }
-    client->startSession(m_url.string(), new PresentationSessionCallbacks(resolver, this));
+    client->startSession(m_url.string(), new PresentationConnectionCallbacks(resolver, this));
 
     return promise;
 }
@@ -111,7 +111,7 @@
         resolver->reject(DOMException::create(InvalidStateError, "The PresentationRequest is no longer associated to a frame."));
         return promise;
     }
-    client->joinSession(m_url.string(), id, new PresentationSessionCallbacks(resolver, this));
+    client->joinSession(m_url.string(), id, new PresentationConnectionCallbacks(resolver, this));
 
     return promise;
 }
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationRequest.h b/third_party/WebKit/Source/modules/presentation/PresentationRequest.h
index 79d35ea..c4a71e7d 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationRequest.h
+++ b/third_party/WebKit/Source/modules/presentation/PresentationRequest.h
@@ -15,7 +15,7 @@
 namespace blink {
 
 // Implements the PresentationRequest interface from the Presentation API from
-// which websites can start or join presentation sessions.
+// which websites can start or join presentation connections.
 class PresentationRequest final
     : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationRequest>
     , public ActiveDOMObject {
@@ -41,7 +41,7 @@
 
     const KURL& url() const;
 
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(sessionconnect);
+    DEFINE_ATTRIBUTE_EVENT_LISTENER(connectionavailable);
 
     DECLARE_VIRTUAL_TRACE();
 
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationRequest.idl b/third_party/WebKit/Source/modules/presentation/PresentationRequest.idl
index 816d41c..504f7cd 100644
--- a/third_party/WebKit/Source/modules/presentation/PresentationRequest.idl
+++ b/third_party/WebKit/Source/modules/presentation/PresentationRequest.idl
@@ -14,9 +14,9 @@
     RuntimeEnabled=Presentation,
     MeasureAs=PresentationRequestConstructor
 ] interface PresentationRequest : EventTarget {
-    [CallWith=ScriptState, MeasureAs=PresentationRequestStart] Promise<PresentationSession> start();
-    [CallWith=ScriptState, MeasureAs=PresentationRequestReconnect] Promise<PresentationSession> reconnect(DOMString id);
+    [CallWith=ScriptState, MeasureAs=PresentationRequestStart] Promise<PresentationConnection> start();
+    [CallWith=ScriptState, MeasureAs=PresentationRequestReconnect] Promise<PresentationConnection> reconnect(DOMString id);
     [CallWith=ScriptState, MeasureAs=PresentationRequestGetAvailability] Promise<PresentationAvailability> getAvailability();
 
-    attribute EventHandler onsessionconnect;
+    attribute EventHandler onconnectionavailable;
 };
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSession.cpp b/third_party/WebKit/Source/modules/presentation/PresentationSession.cpp
deleted file mode 100644
index 8be0c9d..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSession.cpp
+++ /dev/null
@@ -1,371 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "modules/presentation/PresentationSession.h"
-
-#include "bindings/core/v8/ScriptPromiseResolver.h"
-#include "core/dom/DOMArrayBuffer.h"
-#include "core/dom/DOMArrayBufferView.h"
-#include "core/dom/Document.h"
-#include "core/dom/ExceptionCode.h"
-#include "core/events/Event.h"
-#include "core/events/MessageEvent.h"
-#include "core/fileapi/FileReaderLoader.h"
-#include "core/fileapi/FileReaderLoaderClient.h"
-#include "core/frame/LocalFrame.h"
-#include "core/frame/UseCounter.h"
-#include "modules/EventTargetModules.h"
-#include "modules/presentation/Presentation.h"
-#include "modules/presentation/PresentationController.h"
-#include "modules/presentation/PresentationRequest.h"
-#include "modules/presentation/PresentationSessionConnectEvent.h"
-#include "public/platform/modules/presentation/WebPresentationSessionClient.h"
-#include "wtf/Assertions.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/text/AtomicString.h"
-
-namespace blink {
-
-namespace {
-
-// TODO(mlamouri): refactor in one common place.
-WebPresentationClient* presentationClient(ExecutionContext* executionContext)
-{
-    ASSERT(executionContext && executionContext->isDocument());
-
-    Document* document = toDocument(executionContext);
-    if (!document->frame())
-        return nullptr;
-    PresentationController* controller = PresentationController::from(*document->frame());
-    return controller ? controller->client() : nullptr;
-}
-
-const AtomicString& SessionStateToString(WebPresentationSessionState state)
-{
-    DEFINE_STATIC_LOCAL(const AtomicString, connectedValue, ("connected", AtomicString::ConstructFromLiteral));
-    DEFINE_STATIC_LOCAL(const AtomicString, disconnectedValue, ("disconnected", AtomicString::ConstructFromLiteral));
-
-    switch (state) {
-    case WebPresentationSessionState::Connected:
-        return connectedValue;
-    case WebPresentationSessionState::Disconnected:
-        return disconnectedValue;
-    }
-
-    ASSERT_NOT_REACHED();
-    return disconnectedValue;
-}
-
-void throwPresentationDisconnectedError(ExceptionState& exceptionState)
-{
-    exceptionState.throwDOMException(InvalidStateError, "Presentation session is disconnected.");
-}
-
-} // namespace
-
-class PresentationSession::BlobLoader final : public GarbageCollectedFinalized<PresentationSession::BlobLoader>, public FileReaderLoaderClient {
-public:
-    BlobLoader(PassRefPtr<BlobDataHandle> blobDataHandle, PresentationSession* presentationSession)
-        : m_presentationSession(presentationSession)
-        , m_loader(FileReaderLoader::ReadAsArrayBuffer, this)
-    {
-        m_loader.start(m_presentationSession->executionContext(), blobDataHandle);
-    }
-    ~BlobLoader() override { }
-
-    // FileReaderLoaderClient functions.
-    void didStartLoading() override { }
-    void didReceiveData() override { }
-    void didFinishLoading() override
-    {
-        m_presentationSession->didFinishLoadingBlob(m_loader.arrayBufferResult());
-    }
-    void didFail(FileError::ErrorCode errorCode) override
-    {
-        m_presentationSession->didFailLoadingBlob(errorCode);
-    }
-
-    void cancel()
-    {
-        m_loader.cancel();
-    }
-
-    DEFINE_INLINE_TRACE()
-    {
-        visitor->trace(m_presentationSession);
-    }
-
-private:
-    Member<PresentationSession> m_presentationSession;
-    FileReaderLoader m_loader;
-};
-
-PresentationSession::PresentationSession(LocalFrame* frame, const String& id, const String& url)
-    : DOMWindowProperty(frame)
-    , m_id(id)
-    , m_url(url)
-    , m_state(WebPresentationSessionState::Connected)
-    , m_binaryType(BinaryTypeBlob)
-{
-}
-
-PresentationSession::~PresentationSession()
-{
-    ASSERT(!m_blobLoader);
-}
-
-// static
-PresentationSession* PresentationSession::take(ScriptPromiseResolver* resolver, PassOwnPtr<WebPresentationSessionClient> client, PresentationRequest* request)
-{
-    ASSERT(resolver);
-    ASSERT(client);
-    ASSERT(request);
-    ASSERT(resolver->executionContext()->isDocument());
-
-    Document* document = toDocument(resolver->executionContext());
-    if (!document->frame())
-        return nullptr;
-
-    PresentationController* controller = PresentationController::from(*document->frame());
-    if (!controller)
-        return nullptr;
-
-    return take(controller, client, request);
-}
-
-// static
-PresentationSession* PresentationSession::take(PresentationController* controller, PassOwnPtr<WebPresentationSessionClient> client, PresentationRequest* request)
-{
-    ASSERT(controller);
-    ASSERT(request);
-
-    PresentationSession* session = new PresentationSession(controller->frame(), client->getId(), client->getUrl());
-    controller->registerSession(session);
-    request->dispatchEvent(PresentationSessionConnectEvent::create(EventTypeNames::sessionconnect, session));
-
-    return session;
-}
-
-const AtomicString& PresentationSession::interfaceName() const
-{
-    return EventTargetNames::PresentationSession;
-}
-
-ExecutionContext* PresentationSession::executionContext() const
-{
-    if (!frame())
-        return nullptr;
-    return frame()->document();
-}
-
-bool PresentationSession::addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener> listener, bool capture)
-{
-    if (eventType == EventTypeNames::statechange)
-        UseCounter::count(executionContext(), UseCounter::PresentationSessionStateChangeEventListener);
-    else if (eventType == EventTypeNames::message)
-        UseCounter::count(executionContext(), UseCounter::PresentationSessionMessageEventListener);
-
-    return EventTarget::addEventListener(eventType, listener, capture);
-}
-
-DEFINE_TRACE(PresentationSession)
-{
-    visitor->trace(m_blobLoader);
-    RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>::trace(visitor);
-    DOMWindowProperty::trace(visitor);
-}
-
-const AtomicString& PresentationSession::state() const
-{
-    return SessionStateToString(m_state);
-}
-
-void PresentationSession::send(const String& message, ExceptionState& exceptionState)
-{
-    if (!canSendMessage(exceptionState))
-        return;
-
-    m_messages.append(adoptPtr(new Message(message)));
-    handleMessageQueue();
-}
-
-void PresentationSession::send(PassRefPtr<DOMArrayBuffer> arrayBuffer, ExceptionState& exceptionState)
-{
-    ASSERT(arrayBuffer && arrayBuffer->buffer());
-    if (!canSendMessage(exceptionState))
-        return;
-
-    m_messages.append(adoptPtr(new Message(arrayBuffer)));
-    handleMessageQueue();
-}
-
-void PresentationSession::send(PassRefPtr<DOMArrayBufferView> arrayBufferView, ExceptionState& exceptionState)
-{
-    ASSERT(arrayBufferView);
-    if (!canSendMessage(exceptionState))
-        return;
-
-    m_messages.append(adoptPtr(new Message(arrayBufferView->buffer())));
-    handleMessageQueue();
-}
-
-void PresentationSession::send(Blob* data, ExceptionState& exceptionState)
-{
-    ASSERT(data);
-    if (!canSendMessage(exceptionState))
-        return;
-
-    m_messages.append(adoptPtr(new Message(data->blobDataHandle())));
-    handleMessageQueue();
-}
-
-bool PresentationSession::canSendMessage(ExceptionState& exceptionState)
-{
-    if (m_state == WebPresentationSessionState::Disconnected) {
-        throwPresentationDisconnectedError(exceptionState);
-        return false;
-    }
-
-    // The session can send a message if there is a client available.
-    return !!presentationClient(executionContext());
-}
-
-void PresentationSession::handleMessageQueue()
-{
-    WebPresentationClient* client = presentationClient(executionContext());
-    if (!client)
-        return;
-
-    while (!m_messages.isEmpty() && !m_blobLoader) {
-        Message* message = m_messages.first().get();
-        switch (message->type) {
-        case MessageTypeText:
-            client->sendString(m_url, m_id, message->text);
-            m_messages.removeFirst();
-            break;
-        case MessageTypeArrayBuffer:
-            client->sendArrayBuffer(m_url, m_id, static_cast<const uint8_t*>(message->arrayBuffer->data()), message->arrayBuffer->byteLength());
-            m_messages.removeFirst();
-            break;
-        case MessageTypeBlob:
-            ASSERT(!m_blobLoader);
-            m_blobLoader = new BlobLoader(message->blobDataHandle, this);
-            break;
-        }
-    }
-}
-
-String PresentationSession::binaryType() const
-{
-    switch (m_binaryType) {
-    case BinaryTypeBlob:
-        return "blob";
-    case BinaryTypeArrayBuffer:
-        return "arraybuffer";
-    }
-    ASSERT_NOT_REACHED();
-    return String();
-}
-
-void PresentationSession::setBinaryType(const String& binaryType)
-{
-    if (binaryType == "blob") {
-        m_binaryType = BinaryTypeBlob;
-        return;
-    }
-    if (binaryType == "arraybuffer") {
-        m_binaryType = BinaryTypeArrayBuffer;
-        return;
-    }
-    ASSERT_NOT_REACHED();
-}
-
-void PresentationSession::didReceiveTextMessage(const String& message)
-{
-    if (m_state == WebPresentationSessionState::Disconnected)
-        return;
-
-    dispatchEvent(MessageEvent::create(message));
-}
-
-void PresentationSession::didReceiveBinaryMessage(const uint8_t* data, size_t length)
-{
-    if (m_state == WebPresentationSessionState::Disconnected)
-        return;
-
-    switch (m_binaryType) {
-    case BinaryTypeBlob: {
-        OwnPtr<BlobData> blobData = BlobData::create();
-        blobData->appendBytes(data, length);
-        Blob* blob = Blob::create(BlobDataHandle::create(blobData.release(), length));
-        dispatchEvent(MessageEvent::create(blob));
-        return;
-    }
-    case BinaryTypeArrayBuffer:
-        RefPtr<DOMArrayBuffer> buffer = DOMArrayBuffer::create(data, length);
-        dispatchEvent(MessageEvent::create(buffer.release()));
-        return;
-    }
-    ASSERT_NOT_REACHED();
-}
-
-void PresentationSession::close()
-{
-    if (m_state != WebPresentationSessionState::Connected)
-        return;
-    WebPresentationClient* client = presentationClient(executionContext());
-    if (client)
-        client->closeSession(m_url, m_id);
-
-    // Cancel current Blob loading if any.
-    if (m_blobLoader) {
-        m_blobLoader->cancel();
-        m_blobLoader.clear();
-    }
-
-    // Clear message queue.
-    Deque<OwnPtr<Message>> empty;
-    m_messages.swap(empty);
-}
-
-bool PresentationSession::matches(WebPresentationSessionClient* client) const
-{
-    return client && m_url == static_cast<String>(client->getUrl()) && m_id == static_cast<String>(client->getId());
-}
-
-void PresentationSession::didChangeState(WebPresentationSessionState state)
-{
-    if (m_state == state)
-        return;
-
-    m_state = state;
-    dispatchEvent(Event::create(EventTypeNames::statechange));
-}
-
-void PresentationSession::didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer> buffer)
-{
-    ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob);
-    ASSERT(buffer && buffer->buffer());
-    // Send the loaded blob immediately here and continue processing the queue.
-    WebPresentationClient* client = presentationClient(executionContext());
-    if (client)
-        client->sendBlobData(m_url, m_id, static_cast<const uint8_t*>(buffer->data()), buffer->byteLength());
-
-    m_messages.removeFirst();
-    m_blobLoader.clear();
-    handleMessageQueue();
-}
-
-void PresentationSession::didFailLoadingBlob(FileError::ErrorCode errorCode)
-{
-    ASSERT(!m_messages.isEmpty() && m_messages.first()->type == MessageTypeBlob);
-    // FIXME: generate error message?
-    // Ignore the current failed blob item and continue with next items.
-    m_messages.removeFirst();
-    m_blobLoader.clear();
-    handleMessageQueue();
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSession.h b/third_party/WebKit/Source/modules/presentation/PresentationSession.h
deleted file mode 100644
index 838ecfb..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSession.h
+++ /dev/null
@@ -1,129 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PresentationSession_h
-#define PresentationSession_h
-
-#include "core/events/EventTarget.h"
-#include "core/fileapi/Blob.h"
-#include "core/fileapi/FileError.h"
-#include "core/frame/DOMWindowProperty.h"
-#include "platform/heap/Handle.h"
-#include "public/platform/modules/presentation/WebPresentationSessionClient.h"
-#include "wtf/OwnPtr.h"
-#include "wtf/text/WTFString.h"
-
-namespace WTF {
-class AtomicString;
-} // namespace WTF
-
-namespace blink {
-
-class DOMArrayBuffer;
-class DOMArrayBufferView;
-class PresentationController;
-class PresentationRequest;
-
-class PresentationSession final
-    : public RefCountedGarbageCollectedEventTargetWithInlineData<PresentationSession>
-    , public DOMWindowProperty {
-    REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(PresentationSession);
-    WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(PresentationSession);
-    DEFINE_WRAPPERTYPEINFO();
-public:
-    // For CallbackPromiseAdapter.
-    using WebType = OwnPtr<WebPresentationSessionClient>;
-
-    static PresentationSession* take(ScriptPromiseResolver*, PassOwnPtr<WebPresentationSessionClient>, PresentationRequest*);
-    static PresentationSession* take(PresentationController*, PassOwnPtr<WebPresentationSessionClient>, PresentationRequest*);
-    ~PresentationSession() override;
-
-    // EventTarget implementation.
-    const AtomicString& interfaceName() const override;
-    ExecutionContext* executionContext() const override;
-    bool addEventListener(const AtomicString& eventType, PassRefPtrWillBeRawPtr<EventListener>, bool capture) override;
-
-    DECLARE_VIRTUAL_TRACE();
-
-    const String& id() const { return m_id; }
-    const WTF::AtomicString& state() const;
-
-    void send(const String& message, ExceptionState&);
-    void send(PassRefPtr<DOMArrayBuffer>, ExceptionState&);
-    void send(PassRefPtr<DOMArrayBufferView>, ExceptionState&);
-    void send(Blob*, ExceptionState&);
-    void close();
-
-    String binaryType() const;
-    void setBinaryType(const String&);
-
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(message);
-    DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
-
-    // Returns true if and only if the WebPresentationSessionClient represents this session.
-    bool matches(WebPresentationSessionClient*) const;
-
-    // Notifies the session about its state change.
-    void didChangeState(WebPresentationSessionState);
-
-    // Notifies the session about new message.
-    void didReceiveTextMessage(const String& message);
-    void didReceiveBinaryMessage(const uint8_t* data, size_t length);
-
-private:
-    class BlobLoader;
-
-    enum MessageType {
-        MessageTypeText,
-        MessageTypeArrayBuffer,
-        MessageTypeBlob,
-    };
-
-    enum BinaryType {
-        BinaryTypeBlob,
-        BinaryTypeArrayBuffer
-    };
-
-    struct Message {
-        Message(const String& text)
-            : type(MessageTypeText)
-            , text(text) { }
-
-        Message(PassRefPtr<DOMArrayBuffer> arrayBuffer)
-            : type(MessageTypeArrayBuffer)
-            , arrayBuffer(arrayBuffer) { }
-
-        Message(PassRefPtr<BlobDataHandle> blobDataHandle)
-            : type(MessageTypeBlob)
-            , blobDataHandle(blobDataHandle) { }
-
-        MessageType type;
-        String text;
-        RefPtr<DOMArrayBuffer> arrayBuffer;
-        RefPtr<BlobDataHandle> blobDataHandle;
-    };
-
-    PresentationSession(LocalFrame*, const String& id, const String& url);
-
-    bool canSendMessage(ExceptionState&);
-    void handleMessageQueue();
-
-    // Callbacks invoked from BlobLoader.
-    void didFinishLoadingBlob(PassRefPtr<DOMArrayBuffer>);
-    void didFailLoadingBlob(FileError::ErrorCode);
-
-    String m_id;
-    String m_url;
-    WebPresentationSessionState m_state;
-
-    // For Blob data handling.
-    Member<BlobLoader> m_blobLoader;
-    Deque<OwnPtr<Message>> m_messages;
-
-    BinaryType m_binaryType;
-};
-
-} // namespace blink
-
-#endif // PresentationSession_h
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSession.idl b/third_party/WebKit/Source/modules/presentation/PresentationSession.idl
deleted file mode 100644
index 08f6b05..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSession.idl
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// https://w3c.github.io/presentation-api/#interface-presentationsession
-
-enum PresentationSessionState {
-    "connected",
-    "disconnected"
-};
-
-[
-    GarbageCollected,
-    RuntimeEnabled=Presentation
-] interface PresentationSession : EventTarget {
-    readonly attribute DOMString? id;
-    readonly attribute PresentationSessionState state;
-    [MeasureAs=PresentationSessionClose] void close();
-    attribute EventHandler onstatechange;
-
-    // Communication
-    attribute BinaryType binaryType;
-    attribute EventHandler onmessage;
-    [RaisesException, MeasureAs=PresentationSessionSend] void send(DOMString message);
-    [RaisesException, MeasureAs=PresentationSessionSend] void send(Blob data);
-    [RaisesException, MeasureAs=PresentationSessionSend] void send(ArrayBuffer data);
-    [RaisesException, MeasureAs=PresentationSessionSend] void send(ArrayBufferView data);
-};
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSessionCallbacks.cpp b/third_party/WebKit/Source/modules/presentation/PresentationSessionCallbacks.cpp
deleted file mode 100644
index 7e0dc0db..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSessionCallbacks.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "modules/presentation/PresentationSessionCallbacks.h"
-
-#include "bindings/core/v8/ScriptPromiseResolver.h"
-#include "modules/presentation/PresentationError.h"
-#include "modules/presentation/PresentationRequest.h"
-#include "modules/presentation/PresentationSession.h"
-#include "public/platform/modules/presentation/WebPresentationError.h"
-#include "public/platform/modules/presentation/WebPresentationSessionClient.h"
-
-namespace blink {
-
-PresentationSessionCallbacks::PresentationSessionCallbacks(ScriptPromiseResolver* resolver, PresentationRequest* request)
-    : m_resolver(resolver)
-    , m_request(request)
-{
-    ASSERT(m_resolver);
-    ASSERT(m_request);
-}
-
-void PresentationSessionCallbacks::onSuccess(WebPassOwnPtr<WebPresentationSessionClient> presentationSessionClient)
-{
-    OwnPtr<WebPresentationSessionClient> result(presentationSessionClient.release());
-
-    if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
-        return;
-    m_resolver->resolve(PresentationSession::take(m_resolver.get(), result.release(), m_request));
-}
-
-void PresentationSessionCallbacks::onError(const WebPresentationError& error)
-{
-    if (!m_resolver->executionContext() || m_resolver->executionContext()->activeDOMObjectsAreStopped())
-        return;
-    m_resolver->reject(PresentationError::take(m_resolver.get(), error));
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSessionCallbacks.h b/third_party/WebKit/Source/modules/presentation/PresentationSessionCallbacks.h
deleted file mode 100644
index fa1e3e5c..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSessionCallbacks.h
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PresentationSessionCallbacks_h
-#define PresentationSessionCallbacks_h
-
-#include "platform/heap/Handle.h"
-#include "public/platform/WebCallbacks.h"
-#include "wtf/Noncopyable.h"
-
-namespace blink {
-
-class PresentationRequest;
-class ScriptPromiseResolver;
-class WebPresentationSessionClient;
-struct WebPresentationError;
-
-// PresentationSessionCallbacks extends WebCallbacks to resolve the underlying
-// promise depending on the result passed to the callback. It takes the
-// PresentationRequest object that originated the call in its constructor and
-// will pass it to the created PresentationSession.
-class PresentationSessionCallbacks final
-    : public WebCallbacks<WebPassOwnPtr<WebPresentationSessionClient>, const WebPresentationError&> {
-public:
-    PresentationSessionCallbacks(ScriptPromiseResolver*, PresentationRequest*);
-    ~PresentationSessionCallbacks() override = default;
-
-    void onSuccess(WebPassOwnPtr<WebPresentationSessionClient>) override;
-    void onError(const WebPresentationError&) override;
-
-private:
-    Persistent<ScriptPromiseResolver> m_resolver;
-    Persistent<PresentationRequest> m_request;
-
-    WTF_MAKE_NONCOPYABLE(PresentationSessionCallbacks);
-};
-
-} // namespace blink
-
-#endif // PresentationSessionCallbacks_h
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.cpp b/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.cpp
deleted file mode 100644
index bac10e86..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "modules/presentation/PresentationSessionConnectEvent.h"
-
-#include "modules/presentation/PresentationSessionConnectEventInit.h"
-
-namespace blink {
-
-PresentationSessionConnectEvent::~PresentationSessionConnectEvent()
-{
-}
-
-PresentationSessionConnectEvent::PresentationSessionConnectEvent()
-{
-}
-
-PresentationSessionConnectEvent::PresentationSessionConnectEvent(const AtomicString& eventType, PresentationSession* session)
-    : Event(eventType, false /* canBubble */, false /* cancelable */)
-    , m_session(session)
-{
-}
-
-PresentationSessionConnectEvent::PresentationSessionConnectEvent(const AtomicString& eventType, const PresentationSessionConnectEventInit& initializer)
-    : Event(eventType, initializer)
-    , m_session(initializer.session())
-{
-}
-
-const AtomicString& PresentationSessionConnectEvent::interfaceName() const
-{
-    return EventNames::PresentationSessionConnectEvent;
-}
-
-DEFINE_TRACE(PresentationSessionConnectEvent)
-{
-    visitor->trace(m_session);
-    Event::trace(visitor);
-}
-
-} // namespace blink
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.h b/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.h
deleted file mode 100644
index 8c53171..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.h
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef PresentationSessionConnectEvent_h
-#define PresentationSessionConnectEvent_h
-
-#include "modules/EventModules.h"
-#include "modules/presentation/PresentationSession.h"
-#include "platform/heap/Handle.h"
-
-namespace blink {
-
-class PresentationSessionConnectEventInit;
-
-// Presentation API event to be fired when a presentation has been triggered
-// by the embedder using the default presentation URL and id.
-// See https://code.google.com/p/chromium/issues/detail?id=459001 for details.
-class PresentationSessionConnectEvent final : public Event {
-    DEFINE_WRAPPERTYPEINFO();
-public:
-    ~PresentationSessionConnectEvent() override;
-
-    static PassRefPtrWillBeRawPtr<PresentationSessionConnectEvent> create()
-    {
-        return adoptRefWillBeNoop(new PresentationSessionConnectEvent);
-    }
-    static PassRefPtrWillBeRawPtr<PresentationSessionConnectEvent> create(const AtomicString& eventType, PresentationSession* session)
-    {
-        return adoptRefWillBeNoop(new PresentationSessionConnectEvent(eventType, session));
-    }
-    static PassRefPtrWillBeRawPtr<PresentationSessionConnectEvent> create(const AtomicString& eventType, const PresentationSessionConnectEventInit& initializer)
-    {
-        return adoptRefWillBeNoop(new PresentationSessionConnectEvent(eventType, initializer));
-    }
-
-    PresentationSession* session() { return m_session.get(); }
-
-    const AtomicString& interfaceName() const override;
-
-    DECLARE_VIRTUAL_TRACE();
-
-private:
-    PresentationSessionConnectEvent();
-    PresentationSessionConnectEvent(const AtomicString& eventType, PresentationSession*);
-    PresentationSessionConnectEvent(const AtomicString& eventType, const PresentationSessionConnectEventInit& initializer);
-
-    PersistentWillBeMember<PresentationSession> m_session;
-};
-
-DEFINE_TYPE_CASTS(PresentationSessionConnectEvent, Event, event, event->interfaceName() == EventNames::PresentationSessionConnectEvent, event.interfaceName() == EventNames::PresentationSessionConnectEvent);
-
-} // namespace blink
-
-#endif // PresentationSessionConnectEvent_h
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.idl b/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.idl
deleted file mode 100644
index ee8c174..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEvent.idl
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// https://w3c.github.io/presentation-api/#interface-presentationsessionconnectevent
-
-[
-    Constructor(DOMString type, PresentationSessionConnectEventInit eventInitDict),
-    RuntimeEnabled=Presentation
-] interface PresentationSessionConnectEvent : Event {
-    [SameObject] readonly attribute PresentationSession session;
-};
diff --git a/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEventInit.idl b/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEventInit.idl
deleted file mode 100644
index 6cb6dbe..0000000
--- a/third_party/WebKit/Source/modules/presentation/PresentationSessionConnectEventInit.idl
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// https://w3c.github.io/presentation-api/#idl-def-presentationsessionconnecteventinit
-
-dictionary PresentationSessionConnectEventInit : EventInit {
-    required PresentationSession session;
-};
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp
index a114ff48..5dea391 100644
--- a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp
+++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.cpp
@@ -32,7 +32,7 @@
 
 PushSubscription::PushSubscription(const WebPushSubscription& subscription, ServiceWorkerRegistration* serviceWorkerRegistration)
     : m_endpoint(subscription.endpoint)
-    , m_p256dh(DOMArrayBuffer::create(subscription.p256dh.data(), subscription.p256dh.size()))
+    , m_curve25519dh(DOMArrayBuffer::create(subscription.curve25519dh.data(), subscription.curve25519dh.size()))
     , m_serviceWorkerRegistration(serviceWorkerRegistration)
 {
 }
@@ -48,8 +48,8 @@
 
 PassRefPtr<DOMArrayBuffer> PushSubscription::getKey(const AtomicString& name) const
 {
-    if (name == "p256dh")
-        return m_p256dh;
+    if (name == "curve25519dh")
+        return m_curve25519dh;
 
     return nullptr;
 }
@@ -71,7 +71,7 @@
     V8ObjectBuilder result(scriptState);
     result.addString("endpoint", endpoint());
 
-    // TODO(peter): Include |p256dh| in the serialized JSON blob if the intended
+    // TODO(peter): Include |curve25519dh| in the serialized JSON blob if the intended
     // serialization behavior gets defined in the spec.
 
     return result.scriptValue();
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h
index 3a2fac9..e05a26c1 100644
--- a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h
+++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.h
@@ -42,7 +42,7 @@
     PushSubscription(const WebPushSubscription&, ServiceWorkerRegistration*);
 
     KURL m_endpoint;
-    RefPtr<DOMArrayBuffer> m_p256dh;
+    RefPtr<DOMArrayBuffer> m_curve25519dh;
 
     Member<ServiceWorkerRegistration> m_serviceWorkerRegistration;
 };
diff --git a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.idl b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.idl
index 775d63b..a1ed1a2 100644
--- a/third_party/WebKit/Source/modules/push_messaging/PushSubscription.idl
+++ b/third_party/WebKit/Source/modules/push_messaging/PushSubscription.idl
@@ -5,7 +5,7 @@
 // https://w3c.github.io/push-api/#pushsubscription-interface
 
 enum PushEncryptionKeyName {
-    "p256dh"
+    "curve25519dh"
 };
 
 [
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParam.cpp b/third_party/WebKit/Source/modules/webaudio/AudioParam.cpp
index 2d2eb9e..c135753 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParam.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParam.cpp
@@ -161,12 +161,12 @@
     // Calculate values for this render quantum.  Normally numberOfValues will
     // equal to AudioHandler::ProcessingSizeInFrames (the render quantum size).
     double sampleRate = context()->sampleRate();
-    double startTime = context()->currentTime();
-    double endTime = startTime + numberOfValues / sampleRate;
+    size_t startFrame = context()->currentSampleFrame();
+    size_t endFrame = startFrame + numberOfValues;
 
     // Note we're running control rate at the sample-rate.
     // Pass in the current value as default value.
-    m_value = m_timeline.valuesForTimeRange(startTime, endTime, narrowPrecisionToFloat(m_value), values, numberOfValues, sampleRate, sampleRate);
+    m_value = m_timeline.valuesForFrameRange(startFrame, endFrame, narrowPrecisionToFloat(m_value), values, numberOfValues, sampleRate, sampleRate);
 }
 
 void AudioParamHandler::connect(AudioNodeOutput& output)
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
index 8fdaddf8..9d08b93 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.cpp
@@ -259,18 +259,17 @@
     // Ask for just a single value.
     float value;
     double sampleRate = context->sampleRate();
-    double startTime = context->currentTime();
-    double endTime = startTime + 1.1 / sampleRate; // time just beyond one sample-frame
+    size_t startFrame = context->currentSampleFrame();
     double controlRate = sampleRate / AudioHandler::ProcessingSizeInFrames; // one parameter change per render quantum
-    value = valuesForTimeRange(startTime, endTime, defaultValue, &value, 1, sampleRate, controlRate);
+    value = valuesForFrameRange(startFrame, startFrame + 1, defaultValue, &value, 1, sampleRate, controlRate);
 
     hasValue = true;
     return value;
 }
 
-float AudioParamTimeline::valuesForTimeRange(
-    double startTime,
-    double endTime,
+float AudioParamTimeline::valuesForFrameRange(
+    size_t startFrame,
+    size_t endFrame,
     float defaultValue,
     float* values,
     unsigned numberOfValues,
@@ -287,12 +286,12 @@
         return defaultValue;
     }
 
-    return valuesForTimeRangeImpl(startTime, endTime, defaultValue, values, numberOfValues, sampleRate, controlRate);
+    return valuesForFrameRangeImpl(startFrame, endFrame, defaultValue, values, numberOfValues, sampleRate, controlRate);
 }
 
-float AudioParamTimeline::valuesForTimeRangeImpl(
-    double startTime,
-    double endTime,
+float AudioParamTimeline::valuesForFrameRangeImpl(
+    size_t startFrame,
+    size_t endFrame,
     float defaultValue,
     float* values,
     unsigned numberOfValues,
@@ -304,27 +303,30 @@
         return defaultValue;
 
     // Return default value if there are no events matching the desired time range.
-    if (!m_events.size() || endTime <= m_events[0].time()) {
+    if (!m_events.size() || (endFrame / sampleRate <= m_events[0].time())) {
         for (unsigned i = 0; i < numberOfValues; ++i)
             values[i] = defaultValue;
         return defaultValue;
     }
 
-    // Maintain a running time and index for writing the values buffer.
-    double currentTime = startTime;
+    // Maintain a running time (frame) and index for writing the values buffer.
+    size_t currentFrame = startFrame;
     unsigned writeIndex = 0;
 
-    // If first event is after startTime then fill initial part of values buffer with defaultValue
+    // If first event is after startFrame then fill initial part of values buffer with defaultValue
     // until we reach the first event time.
     double firstEventTime = m_events[0].time();
-    if (firstEventTime > startTime) {
-        double fillToTime = std::min(endTime, firstEventTime);
-        unsigned fillToFrame = AudioUtilities::timeToSampleFrame(fillToTime - startTime, sampleRate);
-        fillToFrame = std::min(fillToFrame, numberOfValues);
+    if (firstEventTime > startFrame / sampleRate) {
+        // |fillToFrame| is an exclusive upper bound, so use ceil() to compute the bound from the
+        // firstEventTime.
+        size_t fillToFrame = std::min(endFrame, static_cast<size_t>(ceil(firstEventTime * sampleRate)));
+        ASSERT(fillToFrame >= startFrame);
+        fillToFrame -= startFrame;
+        fillToFrame = std::min(fillToFrame, static_cast<size_t>(numberOfValues));
         for (; writeIndex < fillToFrame; ++writeIndex)
             values[writeIndex] = defaultValue;
 
-        currentTime = fillToTime;
+        currentFrame += fillToFrame;
     }
 
     float value = defaultValue;
@@ -339,21 +341,41 @@
         ParamEvent* nextEvent = i < n - 1 ? &(m_events[i + 1]) : 0;
 
         // Wait until we get a more recent event.
-        if (nextEvent && nextEvent->time() < currentTime)
-            continue;
+        if (nextEvent && nextEvent->time() < currentFrame / sampleRate) {
+            // But if the current event is a SetValue event and the event time is between
+            // currentFrame - 1 and curentFrame (in time). we don't want to skip it.  If we do skip
+            // it, the SetValue event is completely skipped and not applied, which is wrong.  Other
+            // events don't have this problem.  (Because currentFrame is unsigned, we do the time
+            // check in this funny, but equivalent way.)
+            double eventFrame = event.time() * sampleRate;
+
+            // Condition is currentFrame - 1 < eventFrame <= currentFrame, but currentFrame is
+            // unsigned and could be 0, so use currentFrame < eventFrame + 1 instead.
+            if (!((event.type() == ParamEvent::SetValue
+                && (eventFrame <= currentFrame)
+                && (currentFrame < eventFrame + 1))))
+                continue;
+        }
 
         float value1 = event.value();
         double time1 = event.time();
         float value2 = nextEvent ? nextEvent->value() : value1;
-        double time2 = nextEvent ? nextEvent->time() : endTime + 1;
+        double time2 = nextEvent ? nextEvent->time() : endFrame / sampleRate + 1;
 
         double deltaTime = time2 - time1;
         float k = deltaTime > 0 ? 1 / deltaTime : 0;
-        double sampleFrameTimeIncr = 1 / sampleRate;
 
-        double fillToTime = std::min(endTime, time2);
-        unsigned fillToFrame = AudioUtilities::timeToSampleFrame(fillToTime - startTime, sampleRate);
-        fillToFrame = std::min(fillToFrame, numberOfValues);
+        // |fillToEndFrame| is the exclusive upper bound of the last frame to be computed for this
+        // event.  It's either the last desired frame (|endFrame|) or derived from the end time of
+        // the next event (time2). We compute ceil(time2*sampleRate) because fillToEndFrame is the
+        // exclusive upper bound.  Consider the case where |startFrame| = 128 and time2 = 128.1
+        // (assuming sampleRate = 1).  Since time2 is greater than 128, we want to output a value
+        // for frame 128.  This requires that fillToEndFrame be at least 129.  This is achieved by
+        // ceil(time2).
+        size_t fillToEndFrame = std::min(endFrame, static_cast<size_t>(ceil(time2 * sampleRate)));
+        ASSERT(fillToEndFrame >= startFrame);
+        size_t fillToFrame = fillToEndFrame - startFrame;
+        fillToFrame = std::min(fillToFrame, static_cast<size_t>(numberOfValues));
 
         ParamEvent::Type nextEventType = nextEvent ? static_cast<ParamEvent::Type>(nextEvent->type()) : ParamEvent::LastType /* unknown */;
 
@@ -362,20 +384,21 @@
             const float valueDelta = value2 - value1;
 #if CPU(X86) || CPU(X86_64)
             // Minimize in-loop operations. Calculate starting value and increment. Next step: value += inc.
-            //  value = value1 + (currentTime - time1) * k * (value2 - value1);
-            //  inc = sampleFrameTimeIncr * k * (value2 - value1);
+            //  value = value1 + (currentFrame/sampleRate - time1) * k * (value2 - value1);
+            //  inc = 4 / sampleRate * k * (value2 - value1);
             // Resolve recursion by expanding constants to achieve a 4-step loop unrolling.
-            //  value = value1 + ((currentTime - time1) + i * sampleFrameTimeIncr) * k * (value2 -value1), i in 0..3
-            __m128 vValue = _mm_mul_ps(_mm_set_ps1(sampleFrameTimeIncr), _mm_set_ps(3, 2, 1, 0));
-            vValue = _mm_add_ps(vValue, _mm_set_ps1(currentTime - time1));
+            //  value = value1 + ((currentFrame/sampleRate - time1) + i * sampleFrameTimeIncr) * k * (value2 -value1), i in 0..3
+            __m128 vValue = _mm_mul_ps(_mm_set_ps1(1 / sampleRate), _mm_set_ps(3, 2, 1, 0));
+            vValue = _mm_add_ps(vValue, _mm_set_ps1(currentFrame / sampleRate - time1));
             vValue = _mm_mul_ps(vValue, _mm_set_ps1(k * valueDelta));
             vValue = _mm_add_ps(vValue, _mm_set_ps1(value1));
-            __m128 vInc = _mm_set_ps1(4 * sampleFrameTimeIncr * k * valueDelta);
+            __m128 vInc = _mm_set_ps1(4 / sampleRate * k * valueDelta);
 
             // Truncate loop steps to multiple of 4.
             unsigned fillToFrameTrunc = writeIndex + ((fillToFrame - writeIndex) / 4) * 4;
             // Compute final time.
-            currentTime += sampleFrameTimeIncr * (fillToFrameTrunc - writeIndex);
+            currentFrame += fillToFrameTrunc - writeIndex;
+
             // Process 4 loop steps.
             for (; writeIndex < fillToFrameTrunc; writeIndex += 4) {
                 _mm_storeu_ps(values + writeIndex, vValue);
@@ -384,11 +407,11 @@
 #endif
             // Serially process remaining values.
             for (; writeIndex < fillToFrame; ++writeIndex) {
-                float x = (currentTime - time1) * k;
+                float x = (currentFrame / sampleRate - time1) * k;
                 // value = (1 - x) * value1 + x * value2;
                 value = value1 + x * valueDelta;
                 values[writeIndex] = value;
-                currentTime += sampleFrameTimeIncr;
+                ++currentFrame;
             }
         } else if (nextEventType == ParamEvent::ExponentialRampToValue) {
             if (value1 <= 0 || value2 <= 0) {
@@ -397,20 +420,38 @@
                     values[writeIndex] = value;
             } else {
                 float numSampleFrames = deltaTime * sampleRate;
-                // The value goes exponentially from value1 to value2 in a duration of deltaTime seconds (corresponding to numSampleFrames).
+                // The value goes exponentially from value1 to value2 in a duration of deltaTime
+                // seconds according to
+                //
+                //  v(t) = v1*(v2/v1)^((t-t1)/(t2-t1))
+                //
+                // Let c be currentFrame and F be the sampleRate.  Then we want to sample v(t)
+                // at times t = (c + k)/F for k = 0, 1, ...:
+                //
+                //   v((c+k)/F) = v1*(v2/v1)^(((c/F+k/F)-t1)/(t2-t1))
+                //              = v1*(v2/v1)^((c/F-t1)/(t2-t1))
+                //                  *(v2/v1)^((k/F)/(t2-t1))
+                //              = v1*(v2/v1)^((c/F-t1)/(t2-t1))
+                //                  *[(v2/v1)^(1/(F*(t2-t1)))]^k
+                //
+                // Thus, this can be written as
+                //
+                //   v((c+k)/F) = V*m^k
+                //
+                // where
+                //   V = v1*(v2/v1)^((c/F-t1)/(t2-t1))
+                //   m = (v2/v1)^(1/(F*(t2-t1)))
+
                 // Compute the per-sample multiplier.
                 float multiplier = powf(value2 / value1, 1 / numSampleFrames);
-
-                // Set the starting value of the exponential ramp. This is the same as multiplier ^
-                // AudioUtilities::timeToSampleFrame(currentTime - time1, sampleRate), but is more
-                // accurate, especially if multiplier is close to 1.
+                // Set the starting value of the exponential ramp.
                 value = value1 * powf(value2 / value1,
-                    AudioUtilities::timeToSampleFrame(currentTime - time1, sampleRate) / numSampleFrames);
+                    (currentFrame / sampleRate - time1) / deltaTime);
 
                 for (; writeIndex < fillToFrame; ++writeIndex) {
                     values[writeIndex] = value;
                     value *= multiplier;
-                    currentTime += sampleFrameTimeIncr;
+                    ++currentFrame;
                 }
             }
         } else {
@@ -420,7 +461,7 @@
             case ParamEvent::LinearRampToValue:
             case ParamEvent::ExponentialRampToValue:
                 {
-                    currentTime = fillToTime;
+                    currentFrame = fillToEndFrame;
 
                     // Simply stay at a constant value.
                     value = event.value();
@@ -432,13 +473,29 @@
 
             case ParamEvent::SetTarget:
                 {
-                    currentTime = fillToTime;
-
                     // Exponential approach to target value with given time constant.
+                    //
+                    //   v(t) = v2 + (v1 - v2)*exp(-(t-t1/tau))
+                    //
+
                     float target = event.value();
                     float timeConstant = event.timeConstant();
                     float discreteTimeConstant = static_cast<float>(AudioUtilities::discreteTimeConstantForSampleRate(timeConstant, controlRate));
 
+                    // Set the starting value correctly.  This is only needed when the current time
+                    // is "equal" to the start time of this event.  This is to get the sampling
+                    // correct if the start time of this automation isn't on a frame boundary.
+                    // Otherwise, we can just continue from where we left off from the previous
+                    // rendering quantum.
+
+                    {
+                        double rampStartFrame = time1 * sampleRate;
+                        // Condition is c - 1 < r <= c where c = currentFrame and r =
+                        // rampStartFrame.  Compute it this way because currentFrame is unsigned and
+                        // could be 0.
+                        if (rampStartFrame <= currentFrame && currentFrame < rampStartFrame + 1)
+                            value = target + (value - target) * exp(-(currentFrame / sampleRate - time1) / timeConstant);
+                    }
 #if CPU(X86) || CPU(X86_64)
                     // Resolve recursion by expanding constants to achieve a 4-step loop unrolling.
                     // v1 = v0 + (t - v0) * c
@@ -476,6 +533,8 @@
                         value += (target - value) * discreteTimeConstant;
                     }
 
+                    currentFrame = fillToEndFrame;
+
                     break;
                 }
 
@@ -505,7 +564,7 @@
 
                     if (!curve || !curveData || !numberOfCurvePoints || duration <= 0 || sampleRate <= 0) {
                         // Error condition - simply propagate previous value.
-                        currentTime = fillToTime;
+                        currentFrame = fillToEndFrame;
                         for (; writeIndex < fillToFrame; ++writeIndex)
                             values[writeIndex] = value;
                         break;
@@ -513,24 +572,26 @@
 
                     // Save old values and recalculate information based on the curve's duration
                     // instead of the next event time.
-                    unsigned nextEventFillToFrame = fillToFrame;
-                    double nextEventFillToTime = fillToTime;
-                    fillToTime = std::min(endTime, time1 + duration);
-                    // |fillToTime| can be less than |startTime| when the end of the
+                    size_t nextEventFillToFrame = fillToFrame;
+
+                    // Use ceil here for the same reason as using ceil above: fillToEndFrame is an
+                    // exclusive upper bound of the last frame to be computed.
+                    fillToEndFrame = std::min(endFrame, static_cast<size_t>(ceil(sampleRate*(time1 + duration))));
+                    // |fillToFrame| can be less than |startFrame| when the end of the
                     // setValueCurve automation has been reached, but the next automation has not
-                    // yet started. In this case, |fillToTime| is clipped to |time1|+|duration|
-                    // above, but |startTime| will keep increasing (because the current time is
+                    // yet started. In this case, |fillToFrame| is clipped to |time1|+|duration|
+                    // above, but |startFrame| will keep increasing (because the current time is
                     // increasing).
-                    fillToFrame = AudioUtilities::timeToSampleFrame(std::max(0.0, fillToTime - startTime), sampleRate);
-                    fillToFrame = std::min(fillToFrame, numberOfValues);
+                    fillToFrame = (fillToEndFrame < startFrame) ? 0 : fillToEndFrame - startFrame;
+                    fillToFrame = std::min(fillToFrame, static_cast<size_t>(numberOfValues));
 
                     // Index into the curve data using a floating-point value.
                     // We're scaling the number of curve points by the duration (see curvePointsPerFrame).
                     double curveVirtualIndex = 0;
-                    if (time1 < currentTime) {
+                    if (time1 < currentFrame / sampleRate) {
                         // Index somewhere in the middle of the curve data.
                         // Don't use timeToSampleFrame() since we want the exact floating-point frame.
-                        double frameOffset = (currentTime - time1) * sampleRate;
+                        double frameOffset = currentFrame - time1 * sampleRate;
                         curveVirtualIndex = curvePointsPerFrame * frameOffset;
                     }
 
@@ -604,6 +665,8 @@
                         // clamped to 1 because currentVirtualIndex can exceed curveIndex0 by more
                         // than one.  This can happen when we reached the end of the curve but still
                         // need values to fill out the current rendering quantum.
+                        ASSERT(curveIndex0 < numberOfCurvePoints);
+                        ASSERT(curveIndex1 < numberOfCurvePoints);
                         float c0 = curveData[curveIndex0];
                         float c1 = curveData[curveIndex1];
                         double delta = std::min(currentVirtualIndex - curveIndex0, 1.0);
@@ -614,12 +677,13 @@
                     }
 
                     // If there's any time left after the duration of this event and the start
-                    // of the next, then just propagate the last value.
+                    // of the next, then just propagate the last value of the curveData.
+                    value = curveData[numberOfCurvePoints - 1];
                     for (; writeIndex < nextEventFillToFrame; ++writeIndex)
                         values[writeIndex] = value;
 
                     // Re-adjust current time
-                    currentTime = nextEventFillToTime;
+                    currentFrame = nextEventFillToFrame;
 
                     break;
                 }
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h
index 42f5bda..4acedab 100644
--- a/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h
+++ b/third_party/WebKit/Source/modules/webaudio/AudioParamTimeline.h
@@ -55,12 +55,13 @@
     // otherwise defaultValue is returned.
     float valueForContextTime(AbstractAudioContext*, float defaultValue, bool& hasValue);
 
-    // Given the time range, calculates parameter values into the values buffer
-    // and returns the last parameter value calculated for "values" or the defaultValue if none were calculated.
-    // controlRate is the rate (number per second) at which parameter values will be calculated.
-    // It should equal sampleRate for sample-accurate parameter changes, and otherwise will usually match
-    // the render quantum size such that the parameter value changes once per render quantum.
-    float valuesForTimeRange(double startTime, double endTime, float defaultValue, float* values, unsigned numberOfValues, double sampleRate, double controlRate);
+    // Given the time range in frames, calculates parameter values into the values buffer and
+    // returns the last parameter value calculated for "values" or the defaultValue if none were
+    // calculated.  controlRate is the rate (number per second) at which parameter values will be
+    // calculated.  It should equal sampleRate for sample-accurate parameter changes, and otherwise
+    // will usually match the render quantum size such that the parameter value changes once per
+    // render quantum.
+    float valuesForFrameRange(size_t startFrame, size_t endFrame, float defaultValue, float* values, unsigned numberOfValues, double sampleRate, double controlRate);
 
     bool hasValues() { return m_events.size(); }
 
@@ -103,7 +104,7 @@
     };
 
     void insertEvent(const ParamEvent&, ExceptionState&);
-    float valuesForTimeRangeImpl(double startTime, double endTime, float defaultValue, float* values, unsigned numberOfValues, double sampleRate, double controlRate);
+    float valuesForFrameRangeImpl(size_t startFrame, size_t endFrame, float defaultValue, float* values, unsigned numberOfValues, double sampleRate, double controlRate);
 
     // Produce a nice string describing the event in human-readable form.
     String eventToString(const ParamEvent&);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
index b9c2625..fbbb060 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
@@ -923,14 +923,30 @@
     webContext()->uniform4ui(location->location(), v0, v1, v2, v3);
 }
 
+void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* location, const FlexibleUint32ArrayView& v)
+{
+    if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform1uiv", location, v, 1))
+        return;
+
+    webContext()->uniform1uiv(location->location(), v.length(), v.dataMaybeOnStack());
+}
+
 void WebGL2RenderingContextBase::uniform1uiv(const WebGLUniformLocation* location, Vector<GLuint>& value)
 {
-    if (isContextLost() || validateUniformParameters("uniform1uiv", location, value.data(), value.size(), 1))
+    if (isContextLost() || !validateUniformParameters("uniform1uiv", location, value.data(), value.size(), 1))
         return;
 
     webContext()->uniform1uiv(location->location(), value.size(), value.data());
 }
 
+void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* location, const FlexibleUint32ArrayView& v)
+{
+    if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform2uiv", location, v, 2))
+        return;
+
+    webContext()->uniform2uiv(location->location(), v.length() >> 1, v.dataMaybeOnStack());
+}
+
 void WebGL2RenderingContextBase::uniform2uiv(const WebGLUniformLocation* location, Vector<GLuint>& value)
 {
     if (isContextLost() || !validateUniformParameters("uniform2uiv", location, value.data(), value.size(), 2))
@@ -939,6 +955,14 @@
     webContext()->uniform2uiv(location->location(), value.size() / 2, value.data());
 }
 
+void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* location, const FlexibleUint32ArrayView& v)
+{
+    if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform3uiv", location, v, 3))
+        return;
+
+    webContext()->uniform3uiv(location->location(), v.length() / 3, v.dataMaybeOnStack());
+}
+
 void WebGL2RenderingContextBase::uniform3uiv(const WebGLUniformLocation* location, Vector<GLuint>& value)
 {
     if (isContextLost() || !validateUniformParameters("uniform3uiv", location, value.data(), value.size(), 3))
@@ -947,6 +971,14 @@
     webContext()->uniform3uiv(location->location(), value.size() / 3, value.data());
 }
 
+void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* location, const FlexibleUint32ArrayView& v)
+{
+    if (isContextLost() || !validateUniformParameters<WTF::Uint32Array>("uniform4uiv", location, v, 4))
+        return;
+
+    webContext()->uniform4uiv(location->location(), v.length() >> 2, v.dataMaybeOnStack());
+}
+
 void WebGL2RenderingContextBase::uniform4uiv(const WebGLUniformLocation* location, Vector<GLuint>& value)
 {
     if (isContextLost() || !validateUniformParameters("uniform4uiv", location, value.data(), value.size(), 4))
@@ -1816,8 +1848,22 @@
     if (isContextLost() || !validateWebGLObject("getTransformFeedbackVarying", program))
         return nullptr;
 
-    notImplemented();
-    return nullptr;
+    GLint maxNameLength = -1;
+    webContext()->getProgramiv(objectOrZero(program), GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &maxNameLength);
+    if (maxNameLength <= 0) {
+        return nullptr;
+    }
+    OwnPtr<GLchar[]> name = adoptArrayPtr(new GLchar[maxNameLength]);
+    GLsizei length = 0;
+    GLsizei size = 0;
+    GLenum type = 0;
+    webContext()->getTransformFeedbackVarying(objectOrZero(program), index, maxNameLength, &length, &size, &type, name.get());
+
+    if (length == 0 || size == 0 || type == 0) {
+        return nullptr;
+    }
+
+    return WebGLActiveInfo::create(String(name.get(), length), type, size);
 }
 
 void WebGL2RenderingContextBase::pauseTransformFeedback()
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h
index fcbb82e..e9ae9ea 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.h
@@ -63,9 +63,13 @@
     void uniform2ui(const WebGLUniformLocation*, GLuint, GLuint);
     void uniform3ui(const WebGLUniformLocation*, GLuint, GLuint, GLuint);
     void uniform4ui(const WebGLUniformLocation*, GLuint, GLuint, GLuint, GLuint);
+    void uniform1uiv(const WebGLUniformLocation*, const FlexibleUint32ArrayView&);
     void uniform1uiv(const WebGLUniformLocation*, Vector<GLuint>&);
+    void uniform2uiv(const WebGLUniformLocation*, const FlexibleUint32ArrayView&);
     void uniform2uiv(const WebGLUniformLocation*, Vector<GLuint>&);
+    void uniform3uiv(const WebGLUniformLocation*, const FlexibleUint32ArrayView&);
     void uniform3uiv(const WebGLUniformLocation*, Vector<GLuint>&);
+    void uniform4uiv(const WebGLUniformLocation*, const FlexibleUint32ArrayView&);
     void uniform4uiv(const WebGLUniformLocation*, Vector<GLuint>&);
     void uniformMatrix2x3fv(const WebGLUniformLocation*, GLboolean, DOMFloat32Array*);
     void uniformMatrix2x3fv(const WebGLUniformLocation*, GLboolean, Vector<GLfloat>&);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl
index 0bbb3eb7..a50ea1f4 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl
+++ b/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.idl
@@ -338,10 +338,14 @@
     void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1);
     void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2);
     void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-    void uniform1uiv(WebGLUniformLocation? location, sequence<GLuint> value);
-    void uniform2uiv(WebGLUniformLocation? location, sequence<GLuint> value);
-    void uniform3uiv(WebGLUniformLocation? location, sequence<GLuint> value);
-    void uniform4uiv(WebGLUniformLocation? location, sequence<GLuint> value);
+    void uniform1uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v);
+    void uniform1uiv(WebGLUniformLocation? location, sequence<GLuint> v);
+    void uniform2uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v);
+    void uniform2uiv(WebGLUniformLocation? location, sequence<GLuint> v);
+    void uniform3uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v);
+    void uniform3uiv(WebGLUniformLocation? location, sequence<GLuint> v);
+    void uniform4uiv(WebGLUniformLocation? location, [FlexibleArrayBufferView] Uint32Array v);
+    void uniform4uiv(WebGLUniformLocation? location, sequence<GLuint> v);
     void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
     void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value);
     void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
index f5d3f7b..7589a6d 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
@@ -6084,16 +6084,6 @@
     }
 }
 
-template<typename WTFTypedArray>
-bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const TypedFlexibleArrayBufferView<WTFTypedArray>& v, GLsizei requiredMinSize)
-{
-    if (!v.dataMaybeOnStack()) {
-        synthesizeGLError(GL_INVALID_VALUE, functionName, "no array");
-        return false;
-    }
-    return validateUniformMatrixParameters(functionName, location, false, v.dataMaybeOnStack(), v.length(), requiredMinSize);
-}
-
 bool WebGLRenderingContextBase::validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, DOMFloat32Array* v, GLsizei requiredMinSize)
 {
     if (!v) {
diff --git a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
index 9d861b82..bcbc377 100644
--- a/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
+++ b/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
@@ -594,7 +594,7 @@
     public:
         LRUImageBufferCache(int capacity);
         // The pointer returned is owned by the image buffer map.
-        ImageBuffer* imageBuffer(const IntSize& size);
+        ImageBuffer* imageBuffer(const IntSize&);
     private:
         void bubbleToFront(int idx);
         OwnPtr<OwnPtr<ImageBuffer>[]> m_buffers;
@@ -1003,7 +1003,14 @@
     bool validateUniformMatrixParameters(const char* functionName, const WebGLUniformLocation*, GLboolean transpose, void*, GLsizei, GLsizei mod);
 
     template<typename WTFTypedArray>
-    bool validateUniformParameters(const char*, const WebGLUniformLocation*,  const TypedFlexibleArrayBufferView<WTFTypedArray>&, GLsizei);
+    bool validateUniformParameters(const char* functionName, const WebGLUniformLocation* location, const TypedFlexibleArrayBufferView<WTFTypedArray>& v, GLsizei requiredMinSize)
+    {
+        if (!v.dataMaybeOnStack()) {
+            synthesizeGLError(GL_INVALID_VALUE, functionName, "no array");
+            return false;
+        }
+        return validateUniformMatrixParameters(functionName, location, false, v.dataMaybeOnStack(), v.length(), requiredMinSize);
+    }
 
     // Helper function to validate the target for bufferData and getBufferParameter.
     virtual bool validateBufferTarget(const char* functionName, GLenum target);
@@ -1043,7 +1050,7 @@
 
     // Helper functions to bufferData() and bufferSubData().
     void bufferDataImpl(GLenum target, long long size, const void* data, GLenum usage);
-    void bufferSubDataImpl(GLenum target, long long offset, GLsizeiptr size, const void* data);
+    void bufferSubDataImpl(GLenum target, long long offset, GLsizeiptr, const void* data);
 
     // Helper function for delete* (deleteBuffer, deleteProgram, etc) functions.
     // Return false if caller should return without further processing.
diff --git a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
index a8495625d..16d813b 100644
--- a/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
+++ b/third_party/WebKit/Source/platform/RuntimeEnabledFeatures.in
@@ -82,6 +82,7 @@
 GeometryInterfaces status=test
 GetUserMedia depends_on=MediaDevices, status=experimental
 GlobalCacheStorage status=stable
+HiResEventTimeStamp status=experimental
 ImageColorProfiles
 ImageOrientation status=test
 ImageRenderingPixelated status=stable
diff --git a/third_party/WebKit/Source/platform/TimerTest.cpp b/third_party/WebKit/Source/platform/TimerTest.cpp
index 9a0900c8..91b62dc 100644
--- a/third_party/WebKit/Source/platform/TimerTest.cpp
+++ b/third_party/WebKit/Source/platform/TimerTest.cpp
@@ -135,7 +135,7 @@
 
     void runUntilIdle()
     {
-        while (!m_timerTasks.empty()) {
+        while (m_timerTasks.size()) {
             gCurrentTimeSecs = m_timerTasks.top().runTimeSeconds();
             m_timerTasks.top().run();
             m_timerTasks.pop();
@@ -144,7 +144,7 @@
 
     void runUntilIdleOrDeadlinePassed(double deadline)
     {
-        while (!m_timerTasks.empty()) {
+        while (m_timerTasks.size()) {
             if (m_timerTasks.top().runTimeSeconds() > deadline) {
                 gCurrentTimeSecs = deadline;
                 break;
@@ -157,7 +157,7 @@
 
     void runPendingTasks()
     {
-        while (!m_timerTasks.empty() && m_timerTasks.top().runTimeSeconds() <= gCurrentTimeSecs) {
+        while (m_timerTasks.size() && m_timerTasks.top().runTimeSeconds() <= gCurrentTimeSecs) {
             m_timerTasks.top().run();
             m_timerTasks.pop();
         }
@@ -298,12 +298,12 @@
 
     void countingTask(Timer<TimerTest>*)
     {
-        m_runTimes.push_back(monotonicallyIncreasingTime());
+        m_runTimes.append(monotonicallyIncreasingTime());
     }
 
     void recordNextFireTimeTask(Timer<TimerTest>* timer)
     {
-        m_nextFireTimes.push_back(monotonicallyIncreasingTime() + timer->nextFireInterval());
+        m_nextFireTimes.append(monotonicallyIncreasingTime() + timer->nextFireInterval());
     }
 
     void advanceTimeBy(double timeSecs)
@@ -338,9 +338,8 @@
 
 protected:
     double m_startTime;
-    // TODO(alexclarke): Migrate to WTF::Vector and add gmock matcher support.
-    std::vector<double> m_runTimes;
-    std::vector<double> m_nextFireTimes;
+    WTF::Vector<double> m_runTimes;
+    WTF::Vector<double> m_nextFireTimes;
 
 private:
     OwnPtr<TimerTestPlatform> m_platform;
@@ -370,7 +369,7 @@
     timer.stop();
 
     runUntilIdle();
-    EXPECT_TRUE(m_runTimes.empty());
+    EXPECT_FALSE(m_runTimes.size());
 }
 
 TEST_F(TimerTest, StartOneShot_ZeroAndCancelThenRepost)
@@ -384,7 +383,7 @@
     timer.stop();
 
     runUntilIdle();
-    EXPECT_TRUE(m_runTimes.empty());
+    EXPECT_FALSE(m_runTimes.size());
 
     timer.startOneShot(0, FROM_HERE);
 
@@ -438,7 +437,7 @@
     timer.stop();
 
     runUntilIdle();
-    EXPECT_TRUE(m_runTimes.empty());
+    EXPECT_FALSE(m_runTimes.size());
 }
 
 TEST_F(TimerTest, StartOneShot_NonZeroAndCancelThenRepost)
@@ -452,7 +451,7 @@
     timer.stop();
 
     runUntilIdle();
-    EXPECT_TRUE(m_runTimes.empty());
+    EXPECT_FALSE(m_runTimes.size());
 
     double secondPostTime = monotonicallyIncreasingTime();
     timer.startOneShot(10, FROM_HERE);
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp
index 8db534a..fa2c265 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.cpp
@@ -32,9 +32,8 @@
     case 6: return "PaintPhaseChildOutlines";
     case 7: return "PaintPhaseSelfOutline";
     case 8: return "PaintPhaseSelection";
-    case 9: return "PaintPhaseCollapsedTableBorders";
-    case 10: return "PaintPhaseTextClip";
-    case 11: return "PaintPhaseMask";
+    case 9: return "PaintPhaseTextClip";
+    case 10: return "PaintPhaseMask";
     case DisplayItem::PaintPhaseMax: return "PaintPhaseClippingMask";
     default:
         ASSERT_NOT_REACHED();
diff --git a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
index 2ede618..7f4ab1c 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
+++ b/third_party/WebKit/Source/platform/graphics/paint/DisplayItem.h
@@ -26,7 +26,7 @@
 public:
     enum {
         // Must be kept in sync with core/paint/PaintPhase.h.
-        PaintPhaseMax = 12,
+        PaintPhaseMax = 11,
     };
 
     // A display item type uniquely identifies a display item of a client.
diff --git a/third_party/WebKit/Source/platform/heap/Heap.cpp b/third_party/WebKit/Source/platform/heap/Heap.cpp
index 2b0dea3..f61dc9eb 100644
--- a/third_party/WebKit/Source/platform/heap/Heap.cpp
+++ b/third_party/WebKit/Source/platform/heap/Heap.cpp
@@ -44,6 +44,7 @@
 #include "public/platform/WebMemoryAllocatorDump.h"
 #include "public/platform/WebProcessMemoryDump.h"
 #include "wtf/Assertions.h"
+#include "wtf/DataLog.h"
 #include "wtf/LeakAnnotations.h"
 #include "wtf/MainThread.h"
 #include "wtf/Partitions.h"
@@ -472,6 +473,10 @@
     double markingTimeInMilliseconds = WTF::currentTimeMS() - timeStamp;
     s_estimatedMarkingTimePerByte = totalObjectSize ? (markingTimeInMilliseconds / 1000 / totalObjectSize) : 0;
 
+#if PRINT_HEAP_STATS
+    dataLogF("Heap::collectGarbage (gcReason=%s, lazySweeping=%d, time=%.1lfms)\n", gcReasonString(reason), gcType == ThreadState::GCWithoutSweep, markingTimeInMilliseconds);
+#endif
+
     Platform::current()->histogramCustomCounts("BlinkGC.CollectGarbage", markingTimeInMilliseconds, 0, 10 * 1000, 50);
     Platform::current()->histogramCustomCounts("BlinkGC.TotalObjectSpace", Heap::allocatedObjectSize() / 1024, 0, 4 * 1024 * 1024, 50);
     Platform::current()->histogramCustomCounts("BlinkGC.TotalAllocatedSpace", Heap::allocatedSpace() / 1024, 0, 4 * 1024 * 1024, 50);
@@ -624,6 +629,10 @@
 
 void Heap::reportMemoryUsageForTracing()
 {
+#if PRINT_HEAP_STATS
+    // dataLogF("allocatedSpace=%ldMB, allocatedObjectSize=%ldMB, markedObjectSize=%ldMB, partitionAllocSize=%ldMB, wrapperCount=%ld, collectedWrapperCount=%ld\n", Heap::allocatedSpace() / 1024 / 1024, Heap::allocatedObjectSize() / 1024 / 1024, Heap::markedObjectSize() / 1024 / 1024, WTF::Partitions::totalSizeOfCommittedPages() / 1024 / 1024, Heap::wrapperCount(), Heap::collectedWrapperCount());
+#endif
+
     bool gcTracingEnabled;
     TRACE_EVENT_CATEGORY_GROUP_ENABLED("blink_gc", &gcTracingEnabled);
     if (!gcTracingEnabled)
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
index 9923f714..a94679f 100644
--- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
@@ -621,6 +621,7 @@
                 // The rest of the memory is already on the free list and is
                 // therefore already zero filled.
                 SET_MEMORY_INACCESSIBLE(headerAddress, sizeof(HeapObjectHeader));
+                CHECK_MEMORY_INACCESSIBLE(headerAddress, size);
                 freedSize += size;
                 headerAddress += size;
                 continue;
@@ -631,6 +632,7 @@
                 // The rest of the memory is already on the free list and is
                 // therefore already zero filled.
                 SET_MEMORY_INACCESSIBLE(headerAddress, size < sizeof(FreeListEntry) ? size : sizeof(FreeListEntry));
+                CHECK_MEMORY_INACCESSIBLE(headerAddress, size);
                 headerAddress += size;
                 continue;
             }
@@ -1099,6 +1101,13 @@
             address[i] = reuseForbiddenZapValue;
     }
 }
+
+void NEVER_INLINE FreeList::checkFreedMemoryIsZapped(Address address, size_t size)
+{
+    for (size_t i = 0; i < size; i++) {
+        ASSERT(address[i] == reuseAllowedZapValue || address[i] == reuseForbiddenZapValue);
+    }
+}
 #endif
 
 void FreeList::clear()
@@ -1231,6 +1240,7 @@
             // The rest of the memory is already on the free list and is
             // therefore already zero filled.
             SET_MEMORY_INACCESSIBLE(headerAddress, size < sizeof(FreeListEntry) ? size : sizeof(FreeListEntry));
+            CHECK_MEMORY_INACCESSIBLE(headerAddress, size);
             headerAddress += size;
             continue;
         }
@@ -1308,6 +1318,7 @@
             // The rest of the memory is already on the free list and is
             // therefore already zero filled.
             SET_MEMORY_INACCESSIBLE(headerAddress, size < sizeof(FreeListEntry) ? size : sizeof(FreeListEntry));
+            CHECK_MEMORY_INACCESSIBLE(headerAddress, size);
             headerAddress += size;
             continue;
         }
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.h b/third_party/WebKit/Source/platform/heap/HeapPage.h
index d3689300..458eb62 100644
--- a/third_party/WebKit/Source/platform/heap/HeapPage.h
+++ b/third_party/WebKit/Source/platform/heap/HeapPage.h
@@ -94,16 +94,25 @@
     FreeList::zapFreedMemory(address, size);
 #define SET_MEMORY_ACCESSIBLE(address, size) \
     memset((address), 0, (size))
+#define CHECK_MEMORY_INACCESSIBLE(address, size) \
+    ASAN_UNPOISON_MEMORY_REGION(address, size); \
+    FreeList::checkFreedMemoryIsZapped(address, size); \
+    ASAN_POISON_MEMORY_REGION(address, size)
 #elif ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER)
 #define SET_MEMORY_INACCESSIBLE(address, size) \
     FreeList::zapFreedMemory(address, size);   \
     ASAN_POISON_MEMORY_REGION(address, size)
 #define SET_MEMORY_ACCESSIBLE(address, size) \
-    ASAN_UNPOISON_MEMORY_REGION(address, size);    \
+    ASAN_UNPOISON_MEMORY_REGION(address, size); \
     memset((address), 0, (size))
+#define CHECK_MEMORY_INACCESSIBLE(address, size) \
+    ASAN_UNPOISON_MEMORY_REGION(address, size); \
+    FreeList::checkFreedMemoryIsZapped(address, size); \
+    ASAN_POISON_MEMORY_REGION(address, size)
 #else
 #define SET_MEMORY_INACCESSIBLE(address, size) memset((address), 0, (size))
 #define SET_MEMORY_ACCESSIBLE(address, size) do { } while (false)
+#define CHECK_MEMORY_INACCESSIBLE(address, size) do { } while (false)
 #endif
 
 #if !ENABLE(ASSERT) && !ENABLE(GC_PROFILING) && CPU(64BIT)
@@ -668,6 +677,7 @@
 
 #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER) || defined(MEMORY_SANITIZER)
     static void zapFreedMemory(Address, size_t);
+    static void checkFreedMemoryIsZapped(Address, size_t);
 #endif
 
 private:
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.cpp b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
index 473cac2..197fceca 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.cpp
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.cpp
@@ -45,6 +45,7 @@
 #include "public/platform/WebScheduler.h"
 #include "public/platform/WebThread.h"
 #include "public/platform/WebTraceLocation.h"
+#include "wtf/DataLog.h"
 #include "wtf/Partitions.h"
 #include "wtf/ThreadingPrimitives.h"
 #if ENABLE(GC_PROFILING)
@@ -608,6 +609,9 @@
         return false;
     // If the growing rate of Oilpan's heap or PartitionAlloc is high enough,
     // trigger a GC.
+#if PRINT_HEAP_STATS
+    dataLogF("heapGrowingRate=%.1lf, partitionAllocGrowingRate=%.1lf\n", heapGrowingRate(), partitionAllocGrowingRate());
+#endif
     return heapGrowingRate() >= heapGrowingRateThreshold || partitionAllocGrowingRate() >= heapGrowingRateThreshold;
 }
 
@@ -648,6 +652,10 @@
     ASSERT(checkThread());
     Heap::reportMemoryUsageForTracing();
 
+#if PRINT_HEAP_STATS
+    dataLogF("ThreadState::scheduleV8FollowupGCIfNeeded (gcType=%s)\n", gcType == V8MajorGC ? "MajorGC" : "MinorGC");
+#endif
+
     if (isGCForbidden())
         return;
 
@@ -660,14 +668,23 @@
     // TODO(haraken): Consider if we should trigger a memory pressure GC
     // for V8 minor GCs as well.
     if (gcType == V8MajorGC && shouldForceMemoryPressureGC()) {
+#if PRINT_HEAP_STATS
+        dataLogF("Scheduled MemoryPressureGC\n");
+#endif
         Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::MemoryPressureGC);
         return;
     }
     if (shouldScheduleV8FollowupGC()) {
+#if PRINT_HEAP_STATS
+        dataLogF("Scheduled PreciseGC\n");
+#endif
         schedulePreciseGC();
         return;
     }
     if (gcType == V8MajorGC) {
+#if PRINT_HEAP_STATS
+        dataLogF("Scheduled IdleGC\n");
+#endif
         scheduleIdleGC();
         return;
     }
@@ -678,6 +695,10 @@
     ASSERT(checkThread());
     Heap::reportMemoryUsageForTracing();
 
+#if PRINT_HEAP_STATS
+    dataLogF("ThreadState::schedulePageNavigationGCIfNeeded (estimatedRemovalRatio=%.2lf)\n", estimatedRemovalRatio);
+#endif
+
     if (isGCForbidden())
         return;
 
@@ -689,10 +710,16 @@
     ASSERT(!sweepForbidden());
 
     if (shouldForceMemoryPressureGC()) {
+#if PRINT_HEAP_STATS
+        dataLogF("Scheduled MemoryPressureGC\n");
+#endif
         Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::MemoryPressureGC);
         return;
     }
     if (shouldSchedulePageNavigationGC(estimatedRemovalRatio)) {
+#if PRINT_HEAP_STATS
+        dataLogF("Scheduled PageNavigationGC\n");
+#endif
         schedulePageNavigationGC();
         return;
     }
@@ -710,6 +737,10 @@
     ASSERT(checkThread());
     Heap::reportMemoryUsageForTracing();
 
+#if PRINT_HEAP_STATS
+    dataLogF("ThreadState::scheduleGCIfNeeded\n");
+#endif
+
     // Allocation is allowed during sweeping, but those allocations should not
     // trigger nested GCs.
     if (isGCForbidden())
@@ -718,6 +749,9 @@
     if (shouldForceMemoryPressureGC()) {
         completeSweep();
         if (shouldForceMemoryPressureGC()) {
+#if PRINT_HEAP_STATS
+            dataLogF("Scheduled MemoryPressureGC\n");
+#endif
             Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::MemoryPressureGC);
             return;
         }
@@ -730,11 +764,17 @@
     if (shouldForceConservativeGC()) {
         completeSweep();
         if (shouldForceConservativeGC()) {
+#if PRINT_HEAP_STATS
+            dataLogF("Scheduled ConservativeGC\n");
+#endif
             Heap::collectGarbage(HeapPointersOnStack, GCWithoutSweep, Heap::ConservativeGC);
             return;
         }
     }
     if (shouldScheduleIdleGC()) {
+#if PRINT_HEAP_STATS
+        dataLogF("Scheduled IdleGC\n");
+#endif
         scheduleIdleGC();
         return;
     }
@@ -1156,6 +1196,10 @@
             collectionRate = 1 - 1.0 * Heap::markedObjectSize() / Heap::objectSizeAtLastGC();
         TRACE_COUNTER1("blink_gc", "ThreadState::collectionRate", static_cast<int>(100 * collectionRate));
 
+#if PRINT_HEAP_STATS
+        dataLogF("ThreadState::postSweep (collectionRate=%d%%)\n", static_cast<int>(100 * collectionRate));
+#endif
+
         // Heap::markedObjectSize() may be underestimated here if any other
         // thread has not yet finished lazy sweeping.
         Heap::setMarkedObjectSizeAtLastCompleteSweep(Heap::markedObjectSize());
diff --git a/third_party/WebKit/Source/platform/heap/ThreadState.h b/third_party/WebKit/Source/platform/heap/ThreadState.h
index 5abb1dd..1e71319 100644
--- a/third_party/WebKit/Source/platform/heap/ThreadState.h
+++ b/third_party/WebKit/Source/platform/heap/ThreadState.h
@@ -50,6 +50,8 @@
 
 namespace blink {
 
+#define PRINT_HEAP_STATS 0 // Enable this macro to print heap stats to stderr.
+
 class BasePage;
 class CallbackStack;
 class CrossThreadPersistentRegion;
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
index 3244990..2467adc 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.cpp
@@ -221,27 +221,6 @@
     scrollAnimator()->scrollToOffsetWithoutAnimation(toFloatPoint(position));
 }
 
-void ScrollableArea::scrollIntoRect(const LayoutRect& rectInContent, const FloatRect& targetRectInFrame)
-{
-    // Use |pixelSnappedIntRect| for rounding to pixel as opposed to |enclosingIntRect|. It gives a better
-    // combined (location and size) rounding error resulting in a more accurate scroll offset.
-    // FIXME: It would probably be best to do the whole calculation in LayoutUnits but contentsToRootFrame
-    // and friends don't have LayoutRect/Point versions yet.
-    IntRect boundsInContent = pixelSnappedIntRect(rectInContent);
-    IntRect boundsInFrame(boundsInContent.location() - toIntSize(scrollPosition()), boundsInContent.size());
-
-    int centeringOffsetX = (targetRectInFrame.width() - boundsInFrame.width()) / 2;
-    int centeringOffsetY = (targetRectInFrame.height() - boundsInFrame.height()) / 2;
-
-    IntSize scrollDelta(
-        boundsInFrame.x() - centeringOffsetX - targetRectInFrame.x(),
-        boundsInFrame.y() - centeringOffsetY - targetRectInFrame.y());
-
-    DoublePoint targetOffset = DoublePoint(scrollPosition() + scrollDelta);
-
-    setScrollPosition(targetOffset, ProgrammaticScroll);
-}
-
 LayoutRect ScrollableArea::scrollIntoView(const LayoutRect& rectInContent, const ScrollAlignment& alignX, const ScrollAlignment& alignY)
 {
     // TODO(bokan): This should really be implemented here but ScrollAlignment is in Core which is a dependency violation.
diff --git a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
index e5e706d..3334992 100644
--- a/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
+++ b/third_party/WebKit/Source/platform/scroll/ScrollableArea.h
@@ -96,10 +96,6 @@
     // element.
     virtual LayoutRect scrollIntoView(const LayoutRect& rectInContent, const ScrollAlignment& alignX, const ScrollAlignment& alignY);
 
-    // Scrolls the area so that the given rect, given in the area's content coordinates, such that it's
-    // cenetered in the second rect, which is given relative to the area's origin.
-    void scrollIntoRect(const LayoutRect& rectInContent, const FloatRect& targetRectInFrame);
-
     static bool scrollBehaviorFromString(const String&, ScrollBehavior&);
 
     bool inLiveResize() const { return m_inLiveResize; }
diff --git a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
index e178e12..d926ef8 100644
--- a/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
+++ b/third_party/WebKit/Source/web/FrameLoaderClientImpl.cpp
@@ -391,10 +391,15 @@
 
 void FrameLoaderClientImpl::dispatchDidFinishDocumentLoad(bool documentIsEmpty)
 {
-    if (m_webFrame->client())
-        m_webFrame->client()->didFinishDocumentLoad(m_webFrame, documentIsEmpty);
     if (WebViewImpl* webview = m_webFrame->viewImpl())
         webview->didFinishDocumentLoad(m_webFrame);
+
+    // TODO(dglazkov): Sadly, workers are WebFrameClients, and they can totally
+    // destroy themselves when didFinishDocumentLoad is invoked, and in turn destroy
+    // the fake WebLocalFrame that they create, which means that you should not
+    // put any code touching `this` after the two lines below.
+    if (m_webFrame->client())
+        m_webFrame->client()->didFinishDocumentLoad(m_webFrame, documentIsEmpty);
 }
 
 void FrameLoaderClientImpl::dispatchDidLoadResourceFromMemoryCache(const ResourceRequest& request, const ResourceResponse& response)
diff --git a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
index 1305fbc5..b7cb039 100644
--- a/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
+++ b/third_party/WebKit/Source/web/LinkHighlightImpl.cpp
@@ -33,8 +33,8 @@
 #include "core/layout/LayoutBoxModelObject.h"
 #include "core/layout/LayoutObject.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/RuntimeEnabledFeatures.h"
 #include "platform/graphics/Color.h"
 #include "platform/graphics/GraphicsLayer.h"
@@ -163,7 +163,7 @@
         point = targetLayoutObject->frame()->view()->contentsToRootFrame(point);
         point = paintInvalidationContainer->frame()->view()->rootFrameToContents(point);
         FloatPoint floatPoint = paintInvalidationContainer->absoluteToLocal(point, UseTransforms);
-        DeprecatedPaintLayer::mapPointToPaintBackingCoordinates(paintInvalidationContainer, floatPoint);
+        PaintLayer::mapPointToPaintBackingCoordinates(paintInvalidationContainer, floatPoint);
 
         switch (i) {
         case 0: compositedSpaceQuad.setP1(floatPoint); break;
@@ -214,7 +214,7 @@
     // FIXME: This is defensive code to avoid crashes such as those described in
     // crbug.com/440887. This should be cleaned up once we fix the root cause of
     // of the paint invalidation container not being composited.
-    if (!paintInvalidationContainer->layer()->compositedDeprecatedPaintLayerMapping() && !paintInvalidationContainer->layer()->groupedMapping())
+    if (!paintInvalidationContainer->layer()->compositedLayerMapping() && !paintInvalidationContainer->layer()->groupedMapping())
         return false;
 
     // Get quads for node in absolute coordinates.
diff --git a/third_party/WebKit/Source/web/PageWidgetDelegate.cpp b/third_party/WebKit/Source/web/PageWidgetDelegate.cpp
index 10dd707..15ec0acc 100644
--- a/third_party/WebKit/Source/web/PageWidgetDelegate.cpp
+++ b/third_party/WebKit/Source/web/PageWidgetDelegate.cpp
@@ -35,7 +35,7 @@
 #include "core/frame/LocalFrame.h"
 #include "core/input/EventHandler.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/AutoscrollController.h"
 #include "core/page/Page.h"
 #include "core/paint/TransformRecorder.h"
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
index 6bb3cee..b4da3c6 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.cpp
@@ -41,7 +41,7 @@
 #include "core/frame/Settings.h"
 #include "core/input/EventHandler.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/ContextMenuController.h"
 #include "core/page/FocusController.h"
 #include "core/page/Page.h"
@@ -1073,7 +1073,7 @@
         m_localRoot->frameView()->setClipsRepaints(!m_isAcceleratedCompositingActive);
 }
 
-DeprecatedPaintLayerCompositor* WebFrameWidgetImpl::compositor() const
+PaintLayerCompositor* WebFrameWidgetImpl::compositor() const
 {
     LocalFrame* frame = toLocalFrame(toCoreFrame(m_localRoot));
     if (!frame || !frame->document() || !frame->document()->layoutView())
diff --git a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
index e8e8725..dfebc2a 100644
--- a/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
+++ b/third_party/WebKit/Source/web/WebFrameWidgetImpl.h
@@ -50,7 +50,7 @@
 class Element;
 class LocalFrame;
 class Page;
-class DeprecatedPaintLayerCompositor;
+class PaintLayerCompositor;
 class UserGestureToken;
 class WebCompositorAnimationTimeline;
 class WebLayer;
@@ -122,7 +122,7 @@
 
     void scheduleAnimation();
 
-    DeprecatedPaintLayerCompositor* compositor() const;
+    PaintLayerCompositor* compositor() const;
     void setRootGraphicsLayer(GraphicsLayer*);
     void attachCompositorAnimationTimeline(WebCompositorAnimationTimeline*);
     void detachCompositorAnimationTimeline(WebCompositorAnimationTimeline*);
diff --git a/third_party/WebKit/Source/web/WebInputEventConversion.cpp b/third_party/WebKit/Source/web/WebInputEventConversion.cpp
index 6083b1e..9f1ee70f 100644
--- a/third_party/WebKit/Source/web/WebInputEventConversion.cpp
+++ b/third_party/WebKit/Source/web/WebInputEventConversion.cpp
@@ -50,8 +50,6 @@
 
 namespace blink {
 
-static const double millisPerSecond = 1000.0;
-
 static float scaleDeltaToWindow(const Widget* widget, float delta)
 {
     float scale = 1;
@@ -330,6 +328,7 @@
     m_key = Platform::current()->domKeyStringFromEnum(e.domKey);
 
     m_modifiers = toPlatformKeyboardEventModifiers(e.modifiers);
+    m_timestamp = e.timeStampSeconds;
     m_windowsVirtualKeyCode = e.windowsKeyCode;
 }
 
@@ -469,7 +468,7 @@
 // RemoteFrameViews.
 static void updateWebMouseEventFromCoreMouseEvent(const MouseRelatedEvent& event, const Widget* widget, const LayoutObject& layoutObject, WebMouseEvent& webEvent)
 {
-    webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond;
+    webEvent.timeStampSeconds = convertDOMTimeStampToSeconds(event.createTime());
     webEvent.modifiers = getWebInputModifiers(event);
 
     FrameView* view = widget ? toFrameView(widget->parent()) : 0;
@@ -559,7 +558,10 @@
     else
         return;
 
-    timeStampSeconds = event.timeStamp() / millisPerSecond;
+    // TODO(majidvp): Instead of using |Event::createTime| which is epoch time
+    // we should instead use |Event::platformTimeStamp| which is the actual
+    // platform monotonic time. See: crbug.com/538199
+    timeStampSeconds = convertDOMTimeStampToSeconds(event.createTime());
     modifiers = getWebInputModifiers(event);
 
     // The mouse event co-ordinates should be generated from the co-ordinates of the touch point.
@@ -618,7 +620,7 @@
     else if (event.location() == KeyboardEvent::DOM_KEY_LOCATION_RIGHT)
         modifiers |= WebInputEvent::IsRight;
 
-    timeStampSeconds = event.timeStamp() / millisPerSecond;
+    timeStampSeconds = convertDOMTimeStampToSeconds(event.createTime());
     windowsKeyCode = event.keyCode();
 
     // The platform keyevent does not exist if the event was created using
@@ -711,7 +713,7 @@
     }
 
     modifiers = getWebInputModifiers(event);
-    timeStampSeconds = event.timeStamp() / millisPerSecond;
+    timeStampSeconds = convertDOMTimeStampToSeconds(event.createTime());
     cancelable = event.cancelable();
     causesScrollingIfUncanceled = event.causesScrollingIfUncanceled();
 
@@ -754,7 +756,7 @@
         data.tap.tapCount = 1;
     }
 
-    timeStampSeconds = event.timeStamp() / millisPerSecond;
+    timeStampSeconds = convertDOMTimeStampToSeconds(event.createTime());
     modifiers = getWebInputModifiers(event);
 
     globalX = event.screenX();
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index f101593c..56619e3 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -149,7 +149,7 @@
 #include "core/page/FrameTree.h"
 #include "core/page/Page.h"
 #include "core/page/PrintContext.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/paint/ScopeRecorder.h"
 #include "core/paint/TransformRecorder.h"
 #include "core/timing/DOMWindowPerformance.h"
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
index c3ba6549..5715802c 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -48,6 +48,7 @@
 #include "core/frame/EventHandlerRegistry.h"
 #include "core/frame/FrameView.h"
 #include "core/frame/LocalFrame.h"
+#include "core/frame/csp/ContentSecurityPolicy.h"
 #include "core/html/HTMLFormElement.h"
 #include "core/html/HTMLPlugInElement.h"
 #include "core/input/EventHandler.h"
@@ -58,8 +59,8 @@
 #include "core/page/FocusController.h"
 #include "core/page/Page.h"
 #include "core/page/scrolling/ScrollingCoordinator.h"
-#include "core/paint/DeprecatedPaintLayer.h"
 #include "core/paint/LayoutObjectDrawingRecorder.h"
+#include "core/paint/PaintLayer.h"
 #include "modules/plugins/PluginOcclusionSupport.h"
 #include "platform/HostWindow.h"
 #include "platform/KeyboardCodes.h"
@@ -466,6 +467,9 @@
     if (!frame)
         return WebString();
 
+    if (!m_element->document().contentSecurityPolicy()->allowJavaScriptURLs(m_element->document().url(), OrdinalNumber()))
+        return WebString();
+
     const KURL& kurl = url;
     ASSERT(kurl.protocolIs("javascript"));
 
diff --git a/third_party/WebKit/Source/web/WebViewImpl.cpp b/third_party/WebKit/Source/web/WebViewImpl.cpp
index 6141569..b708684 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.cpp
+++ b/third_party/WebKit/Source/web/WebViewImpl.cpp
@@ -70,7 +70,7 @@
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutView.h"
 #include "core/layout/TextAutosizer.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoadRequest.h"
 #include "core/loader/FrameLoader.h"
@@ -88,7 +88,7 @@
 #include "core/page/PointerLockController.h"
 #include "core/page/ScopedPageLoadDeferrer.h"
 #include "core/page/TouchDisambiguation.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/timing/DOMWindowPerformance.h"
 #include "core/timing/Performance.h"
 #include "modules/accessibility/AXObject.h"
@@ -799,16 +799,18 @@
         // Don't trigger a disambiguation popup when screencasting, since it's implemented outside of
         // compositor pipeline and is not being screencasted itself. This leads to bad user experience.
         WebDevToolsAgentImpl* devTools = mainFrameDevToolsAgentImpl();
+        VisualViewport& visualViewport = page()->frameHost().visualViewport();
         bool screencastEnabled = devTools && devTools->screencastEnabled();
-        if (event.data.tap.width > 0 && !shouldDisableDesktopWorkarounds() && !screencastEnabled) {
-            IntRect boundingBox(page()->frameHost().visualViewport().viewportToRootFrame(IntRect(
+        if (event.data.tap.width > 0 && !visualViewport.shouldDisableDesktopWorkarounds() && !screencastEnabled) {
+            IntRect boundingBox(visualViewport.viewportToRootFrame(IntRect(
                 event.x - event.data.tap.width / 2,
                 event.y - event.data.tap.height / 2,
                 event.data.tap.width,
                 event.data.tap.height)));
 
-            // FIXME: We shouldn't pass details of the VisualViewport offset to render_view_impl.
-            WebSize visualViewportOffset = flooredIntSize(page()->frameHost().visualViewport().location());
+            // TODO(bokan): We shouldn't pass details of the VisualViewport offset to render_view_impl.
+            //              crbug.com/459591
+            WebSize visualViewportOffset = flooredIntSize(visualViewport.location());
 
             if (m_webSettings->multiTargetTapNotificationEnabled()) {
                 Vector<IntRect> goodTargets;
@@ -2072,6 +2074,8 @@
         autofillClient->firstUserGestureObserved();
     }
 
+    page()->frameHost().visualViewport().startTrackingPinchStats();
+
     TRACE_EVENT1("input", "WebViewImpl::handleInputEvent", "type", inputTypeToName(inputEvent.type).ascii());
     // If we've started a drag and drop operation, ignore input events until
     // we're done.
@@ -2867,7 +2871,7 @@
     element->document().updateLayoutIgnorePendingStylesheets();
 
     bool zoomInToLegibleScale = m_webSettings->autoZoomFocusedNodeToLegibleScale()
-        && !shouldDisableDesktopWorkarounds();
+        && !page()->frameHost().visualViewport().shouldDisableDesktopWorkarounds();
 
     if (zoomInToLegibleScale) {
         // When deciding whether to zoom in on a focused text box, we should decide not to
@@ -4178,7 +4182,7 @@
     return m_graphicsLayerFactory.get();
 }
 
-DeprecatedPaintLayerCompositor* WebViewImpl::compositor() const
+PaintLayerCompositor* WebViewImpl::compositor() const
 {
     if (!page() || !page()->mainFrame() || !page()->mainFrame()->isLocalFrame())
         return 0;
@@ -4264,8 +4268,10 @@
     visualViewportOffset.move(visualViewportDelta.width, visualViewportDelta.height);
     setPageScaleFactorAndLocation(pageScaleFactor() * pageScaleDelta, visualViewportOffset);
 
-    if (pageScaleDelta != 1)
+    if (pageScaleDelta != 1) {
         m_doubleTapZoomPending = false;
+        page()->frameHost().visualViewport().userDidChangeScale();
+    }
 
     m_elasticOverscroll += elasticOverscrollDelta;
     frameView->didUpdateElasticOverscroll();
@@ -4432,25 +4438,6 @@
             eventType);
 }
 
-bool WebViewImpl::shouldDisableDesktopWorkarounds()
-{
-    if (!settings()->viewportEnabled())
-        return false;
-
-    // A document is considered adapted to small screen UAs if one of these holds:
-    // 1. The author specified viewport has a constrained width that is equal to
-    //    the initial viewport width.
-    // 2. The author has disabled viewport zoom.
-
-    const PageScaleConstraints& constraints = pageScaleConstraintsSet().pageDefinedConstraints();
-
-    if (!mainFrameImpl() || !mainFrameImpl()->frameView())
-        return false;
-
-    return mainFrameImpl()->frameView()->layoutSize().width() == m_size.width
-        || (constraints.minimumScale == constraints.maximumScale && constraints.minimumScale != -1);
-}
-
 void WebViewImpl::forceNextWebGLContextCreationToFail()
 {
     WebGLRenderingContext::forceNextWebGLContextCreationToFail();
diff --git a/third_party/WebKit/Source/web/WebViewImpl.h b/third_party/WebKit/Source/web/WebViewImpl.h
index 28072ba..a1f3e54 100644
--- a/third_party/WebKit/Source/web/WebViewImpl.h
+++ b/third_party/WebKit/Source/web/WebViewImpl.h
@@ -76,7 +76,7 @@
 class LinkHighlightImpl;
 class PageOverlay;
 class PageScaleConstraintsSet;
-class DeprecatedPaintLayerCompositor;
+class PaintLayerCompositor;
 class TopControls;
 class UserGestureToken;
 class WebActiveGestureAnimation;
@@ -435,7 +435,7 @@
     GraphicsLayer* rootGraphicsLayer();
     void setRootGraphicsLayer(GraphicsLayer*);
     GraphicsLayerFactory* graphicsLayerFactory() const;
-    DeprecatedPaintLayerCompositor* compositor() const;
+    PaintLayerCompositor* compositor() const;
     void registerForAnimations(WebLayer*);
     void scheduleAnimation();
     void attachCompositorAnimationTimeline(WebCompositorAnimationTimeline*);
@@ -491,10 +491,6 @@
     void requestPointerUnlock();
     bool isPointerLocked();
 
-    // Heuristic-based function for determining if we should disable workarounds
-    // for viewing websites that are not optimized for mobile devices.
-    bool shouldDisableDesktopWorkarounds();
-
     // Exposed for tests.
     unsigned numLinkHighlights() { return m_linkHighlights.size(); }
     LinkHighlightImpl* linkHighlight(int i) { return m_linkHighlights[i].get(); }
diff --git a/third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp b/third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp
index 559612e..df48806 100644
--- a/third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp
+++ b/third_party/WebKit/Source/web/tests/LayoutGeometryMapTest.cpp
@@ -33,7 +33,7 @@
 
 #include "core/dom/Document.h"
 #include "core/layout/LayoutBox.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/testing/URLTestHelpers.h"
 #include "public/platform/Platform.h"
 #include "public/platform/WebUnitTestSupport.h"
@@ -91,7 +91,7 @@
         LayoutBox* rb = getLayoutBox(webView, elementId);
         if (!rb)
             return nullptr;
-        DeprecatedPaintLayer* compositingLayer = rb->enclosingLayer()->enclosingLayerForPaintInvalidation();
+        PaintLayer* compositingLayer = rb->enclosingLayer()->enclosingLayerForPaintInvalidation();
         if (!compositingLayer)
             return nullptr;
         return compositingLayer->layoutObject();
@@ -102,7 +102,7 @@
         LayoutBox* rb = getFrameElement(frameId, webView, elementId);
         if (!rb)
             return nullptr;
-        DeprecatedPaintLayer* compositingLayer = rb->enclosingLayer()->enclosingLayerForPaintInvalidation();
+        PaintLayer* compositingLayer = rb->enclosingLayer()->enclosingLayerForPaintInvalidation();
         if (!compositingLayer)
             return nullptr;
         return compositingLayer->layoutObject();
@@ -146,7 +146,7 @@
     EXPECT_EQ(FloatPoint(8.0f, 8.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(8.0f, 8.0f, 1.0f, 2.0f)), rgm.mapToContainer(rect, nullptr));
 
-    rgm.popMappingsToAncestor(static_cast<DeprecatedPaintLayer*>(nullptr));
+    rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr));
     EXPECT_EQ(FloatPoint(0.0f, 0.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(0.0f, 0.0f, 1.0f, 2.0f)), rgm.mapToContainer(rect, nullptr));
 
@@ -189,7 +189,7 @@
     EXPECT_EQ(FloatPoint(8.0f, 8.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(8.0f, 8.0f, 15.0f, 25.0f)), rgm.mapToContainer(rect, nullptr));
 
-    rgm.popMappingsToAncestor(static_cast<DeprecatedPaintLayer*>(nullptr));
+    rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr));
     EXPECT_EQ(FloatPoint(0.0f, 0.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(0.0f, 0.0f, 15.0f, 25.0f)).boundingBox(), rgm.mapToContainer(rect, nullptr).boundingBox());
 
@@ -234,7 +234,7 @@
     EXPECT_EQ(FloatPoint(8.0f, 8.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(8.0f, 8.0f, 15.0f, 25.0f)), rgm.mapToContainer(rect, nullptr));
 
-    rgm.popMappingsToAncestor(static_cast<DeprecatedPaintLayer*>(nullptr));
+    rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr));
     EXPECT_EQ(FloatPoint(0.0f, 0.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(0.0f, 0.0f, 15.0f, 25.0f)), rgm.mapToContainer(rect, nullptr));
 
@@ -304,8 +304,8 @@
     EXPECT_NEAR(1.866, rectFromQuad(rgm.mapToContainer(rect, nullptr)).width(), 0.0001f);
     EXPECT_NEAR(2.232, rectFromQuad(rgm.mapToContainer(rect, nullptr)).height(), 0.0001f);
 
-    rgm.popMappingsToAncestor(static_cast<DeprecatedPaintLayer*>(nullptr));
-    rgmNoFrame.popMappingsToAncestor(static_cast<DeprecatedPaintLayer*>(nullptr));
+    rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr));
+    rgmNoFrame.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr));
     EXPECT_EQ(FloatPoint(0.0f, 0.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatPoint(0.0f, 0.0f), rgmNoFrame.mapToContainer(point, nullptr));
 
@@ -363,7 +363,7 @@
     EXPECT_EQ(FloatPoint(8.0f, 8.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(8.0f, 8.0f, 5.0f, 3.0f)), rgm.mapToContainer(rect, nullptr));
 
-    rgm.popMappingsToAncestor(static_cast<DeprecatedPaintLayer*>(nullptr));
+    rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr));
     EXPECT_EQ(FloatPoint(0.0f, 0.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(0.0f, 0.0f, 5.0f, 3.0f)), rgm.mapToContainer(rect, nullptr));
 
@@ -371,7 +371,7 @@
     EXPECT_EQ(FloatPoint(8.0f, 8.0f), rgm.mapToContainer(point, nullptr));
     EXPECT_EQ(FloatQuad(FloatRect(8.0f, 8.0f, 5.0f, 3.0f)), rgm.mapToContainer(rect, nullptr));
 
-    rgm.popMappingsToAncestor(static_cast<DeprecatedPaintLayer*>(nullptr));
+    rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr));
     rgm.pushMappingsToAncestor(getLayoutBox(webView, "Col2"), nullptr);
     EXPECT_NEAR(8.0f + offset, rgm.mapToContainer(point, nullptr).x(), 0.1f);
     EXPECT_NEAR(8.0f, rgm.mapToContainer(point, nullptr).y(), 0.1f);
@@ -380,7 +380,7 @@
     EXPECT_EQ(5.0f, rectFromQuad(rgm.mapToContainer(rect, nullptr)).width());
     EXPECT_EQ(3.0f, rectFromQuad(rgm.mapToContainer(rect, nullptr)).height());
 
-    rgm.popMappingsToAncestor(static_cast<DeprecatedPaintLayer*>(nullptr));
+    rgm.popMappingsToAncestor(static_cast<PaintLayer*>(nullptr));
     rgm.pushMappingsToAncestor(getLayoutBox(webView, "Col3"), nullptr);
     EXPECT_NEAR(8.0f + offset * 2.0f, rgm.mapToContainer(point, nullptr).x(), 0.1f);
     EXPECT_NEAR(8.0f, rgm.mapToContainer(point, nullptr).y(), 0.1f);
diff --git a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
index 977730e..add835b 100644
--- a/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
+++ b/third_party/WebKit/Source/web/tests/ScrollingCoordinatorTest.cpp
@@ -27,8 +27,8 @@
 
 #include "core/layout/LayoutPart.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/Page.h"
 #include "platform/graphics/GraphicsLayer.h"
 #include "platform/testing/URLTestHelpers.h"
@@ -83,7 +83,7 @@
 
     WebLayer* getRootScrollLayer()
     {
-        DeprecatedPaintLayerCompositor* compositor = frame()->contentLayoutObject()->compositor();
+        PaintLayerCompositor* compositor = frame()->contentLayoutObject()->compositor();
         ASSERT(compositor);
         ASSERT(compositor->scrollLayer());
 
@@ -170,10 +170,10 @@
     ASSERT_TRUE(layoutObject->isBox());
     LayoutBox* box = toLayoutBox(layoutObject);
     ASSERT_TRUE(box->usesCompositedScrolling());
-    CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = box->layer()->compositedDeprecatedPaintLayerMapping();
-    ASSERT_TRUE(compositedDeprecatedPaintLayerMapping->hasScrollingLayer());
-    ASSERT(compositedDeprecatedPaintLayerMapping->scrollingContentsLayer());
-    WebLayer* webScrollLayer = compositedDeprecatedPaintLayerMapping->scrollingContentsLayer()->platformLayer();
+    CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLayerMapping();
+    ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
+    ASSERT(compositedLayerMapping->scrollingContentsLayer());
+    WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformLayer();
     ASSERT_TRUE(webScrollLayer);
     ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().x, 0.01);
     ASSERT_NEAR(1.2, webScrollLayer->scrollPositionDouble().y, 0.01);
@@ -186,13 +186,13 @@
     LayoutObject* layoutObject = element->layoutObject();
     if (!layoutObject || !layoutObject->isBoxModelObject())
         return 0;
-    DeprecatedPaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
+    PaintLayer* layer = toLayoutBoxModelObject(layoutObject)->layer();
     if (!layer)
         return 0;
-    if (!layer->hasCompositedDeprecatedPaintLayerMapping())
+    if (!layer->hasCompositedLayerMapping())
         return 0;
-    CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = layer->compositedDeprecatedPaintLayerMapping();
-    GraphicsLayer* graphicsLayer = compositedDeprecatedPaintLayerMapping->mainGraphicsLayer();
+    CompositedLayerMapping* compositedLayerMapping = layer->compositedLayerMapping();
+    GraphicsLayer* graphicsLayer = compositedLayerMapping->mainGraphicsLayer();
     if (!graphicsLayer)
         return 0;
     return graphicsLayer->platformLayer();
@@ -364,24 +364,24 @@
     ASSERT_TRUE(box->usesCompositedScrolling());
     ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
 
-    CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = box->layer()->compositedDeprecatedPaintLayerMapping();
-    ASSERT_TRUE(compositedDeprecatedPaintLayerMapping->hasScrollingLayer());
-    ASSERT(compositedDeprecatedPaintLayerMapping->scrollingContentsLayer());
+    CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLayerMapping();
+    ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
+    ASSERT(compositedLayerMapping->scrollingContentsLayer());
 
-    GraphicsLayer* graphicsLayer = compositedDeprecatedPaintLayerMapping->scrollingContentsLayer();
+    GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLayer();
     ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea());
 
-    WebLayer* webScrollLayer = compositedDeprecatedPaintLayerMapping->scrollingContentsLayer()->platformLayer();
+    WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformLayer();
     ASSERT_TRUE(webScrollLayer->scrollable());
     ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
     ASSERT_TRUE(webScrollLayer->userScrollableVertical());
 
 #if OS(ANDROID)
     // Now verify we've attached impl-side scrollbars onto the scrollbar layers
-    ASSERT_TRUE(compositedDeprecatedPaintLayerMapping->layerForHorizontalScrollbar());
-    ASSERT_TRUE(compositedDeprecatedPaintLayerMapping->layerForHorizontalScrollbar()->hasContentsLayer());
-    ASSERT_TRUE(compositedDeprecatedPaintLayerMapping->layerForVerticalScrollbar());
-    ASSERT_TRUE(compositedDeprecatedPaintLayerMapping->layerForVerticalScrollbar()->hasContentsLayer());
+    ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar());
+    ASSERT_TRUE(compositedLayerMapping->layerForHorizontalScrollbar()->hasContentsLayer());
+    ASSERT_TRUE(compositedLayerMapping->layerForVerticalScrollbar());
+    ASSERT_TRUE(compositedLayerMapping->layerForVerticalScrollbar()->hasContentsLayer());
 #endif
 }
 
@@ -404,14 +404,14 @@
     ASSERT_TRUE(box->usesCompositedScrolling());
     ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
 
-    CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = box->layer()->compositedDeprecatedPaintLayerMapping();
-    ASSERT_TRUE(compositedDeprecatedPaintLayerMapping->hasScrollingLayer());
-    ASSERT(compositedDeprecatedPaintLayerMapping->scrollingContentsLayer());
+    CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLayerMapping();
+    ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
+    ASSERT(compositedLayerMapping->scrollingContentsLayer());
 
-    GraphicsLayer* graphicsLayer = compositedDeprecatedPaintLayerMapping->scrollingContentsLayer();
+    GraphicsLayer* graphicsLayer = compositedLayerMapping->scrollingContentsLayer();
     ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea());
 
-    WebLayer* webScrollLayer = compositedDeprecatedPaintLayerMapping->scrollingContentsLayer()->platformLayer();
+    WebLayer* webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformLayer();
     ASSERT_TRUE(webScrollLayer->scrollable());
     ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
     ASSERT_FALSE(webScrollLayer->userScrollableVertical());
@@ -427,14 +427,14 @@
     ASSERT_TRUE(box->scrollableArea()->usesCompositedScrolling());
     ASSERT_EQ(PaintsIntoOwnBacking, box->layer()->compositingState());
 
-    compositedDeprecatedPaintLayerMapping = box->layer()->compositedDeprecatedPaintLayerMapping();
-    ASSERT_TRUE(compositedDeprecatedPaintLayerMapping->hasScrollingLayer());
-    ASSERT(compositedDeprecatedPaintLayerMapping->scrollingContentsLayer());
+    compositedLayerMapping = box->layer()->compositedLayerMapping();
+    ASSERT_TRUE(compositedLayerMapping->hasScrollingLayer());
+    ASSERT(compositedLayerMapping->scrollingContentsLayer());
 
-    graphicsLayer = compositedDeprecatedPaintLayerMapping->scrollingContentsLayer();
+    graphicsLayer = compositedLayerMapping->scrollingContentsLayer();
     ASSERT_EQ(box->layer()->scrollableArea(), graphicsLayer->scrollableArea());
 
-    webScrollLayer = compositedDeprecatedPaintLayerMapping->scrollingContentsLayer()->platformLayer();
+    webScrollLayer = compositedLayerMapping->scrollingContentsLayer()->platformLayer();
     ASSERT_TRUE(webScrollLayer->scrollable());
     ASSERT_FALSE(webScrollLayer->userScrollableHorizontal());
     ASSERT_TRUE(webScrollLayer->userScrollableVertical());
@@ -465,7 +465,7 @@
     LayoutView* innerLayoutView = innerFrameView->layoutView();
     ASSERT_TRUE(innerLayoutView);
 
-    DeprecatedPaintLayerCompositor* innerCompositor = innerLayoutView->compositor();
+    PaintLayerCompositor* innerCompositor = innerLayoutView->compositor();
     ASSERT_TRUE(innerCompositor->inCompositingMode());
     ASSERT_TRUE(innerCompositor->scrollLayer());
 
@@ -509,7 +509,7 @@
     LayoutView* innerLayoutView = innerFrameView->layoutView();
     ASSERT_TRUE(innerLayoutView);
 
-    DeprecatedPaintLayerCompositor* innerCompositor = innerLayoutView->compositor();
+    PaintLayerCompositor* innerCompositor = innerLayoutView->compositor();
     ASSERT_TRUE(innerCompositor->inCompositingMode());
     ASSERT_TRUE(innerCompositor->scrollLayer());
 
@@ -548,8 +548,8 @@
     ASSERT_TRUE(layoutObject->isBox());
     LayoutBox* box = toLayoutBox(layoutObject);
     ASSERT_TRUE(box->usesCompositedScrolling());
-    CompositedDeprecatedPaintLayerMapping* compositedDeprecatedPaintLayerMapping = box->layer()->compositedDeprecatedPaintLayerMapping();
-    GraphicsLayer* scrollbarGraphicsLayer = compositedDeprecatedPaintLayerMapping->layerForVerticalScrollbar();
+    CompositedLayerMapping* compositedLayerMapping = box->layer()->compositedLayerMapping();
+    GraphicsLayer* scrollbarGraphicsLayer = compositedLayerMapping->layerForVerticalScrollbar();
     ASSERT_TRUE(scrollbarGraphicsLayer);
 
     bool hasWebScrollbarLayer = !scrollbarGraphicsLayer->drawsContent();
@@ -595,13 +595,13 @@
     Document* document = frame()->document();
     Element* fixedPos = document->getElementById("fixed");
 
-    EXPECT_TRUE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->layer()->hasCompositedDeprecatedPaintLayerMapping());
+    EXPECT_TRUE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->layer()->hasCompositedLayerMapping());
     EXPECT_FALSE(scrollLayer->shouldScrollOnMainThread());
 
     fixedPos->setInlineStyleProperty(CSSPropertyTransform, CSSValueNone);
     forceFullCompositingUpdate();
 
-    EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->layer()->hasCompositedDeprecatedPaintLayerMapping());
+    EXPECT_FALSE(static_cast<LayoutBoxModelObject*>(fixedPos->layoutObject())->layer()->hasCompositedLayerMapping());
     EXPECT_TRUE(scrollLayer->shouldScrollOnMainThread());
 }
 
diff --git a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
index 266c228..a1fced0 100644
--- a/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
+++ b/third_party/WebKit/Source/web/tests/VisualViewportTest.cpp
@@ -14,7 +14,7 @@
 #include "core/input/EventHandler.h"
 #include "core/layout/LayoutObject.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/page/Page.h"
 #include "platform/PlatformGestureEvent.h"
 #include "platform/geometry/DoublePoint.h"
@@ -151,7 +151,7 @@
 
     WebLayer* getRootScrollLayer()
     {
-        DeprecatedPaintLayerCompositor* compositor = frame()->contentLayoutObject()->compositor();
+        PaintLayerCompositor* compositor = frame()->contentLayoutObject()->compositor();
         ASSERT(compositor);
         ASSERT(compositor->scrollLayer());
 
@@ -1644,7 +1644,7 @@
     webViewImpl()->setVisualViewportOffset(WebFloatPoint(200, 230));
     frameView.layoutViewportScrollableArea()->setScrollPosition(DoublePoint(400, 1100), ProgrammaticScroll);
 
-    // FIXME(504057): DeprecatedPaintLayerScrollableArea dirties the compositing state.
+    // FIXME(504057): PaintLayerScrollableArea dirties the compositing state.
     forceFullCompositingUpdate();
 
     // Because of where the visual viewport is located, this should hit the bottom right
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index de33e96..91e1924 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -65,14 +65,14 @@
 #include "core/layout/HitTestResult.h"
 #include "core/layout/LayoutFullScreen.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/DeprecatedPaintLayerCompositor.h"
+#include "core/layout/compositing/PaintLayerCompositor.h"
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/DocumentThreadableLoader.h"
 #include "core/loader/DocumentThreadableLoaderClient.h"
 #include "core/loader/FrameLoadRequest.h"
 #include "core/loader/ThreadableLoader.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/paint/PaintLayer.h"
 #include "core/testing/NullExecutionContext.h"
 #include "modules/mediastream/MediaStream.h"
 #include "modules/mediastream/MediaStreamRegistry.h"
@@ -1495,7 +1495,7 @@
 
     webViewHelper.initializeAndLoad(m_baseURL + "0-by-0.html", true, 0, &client, configureAndroid);
     webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true);
-    DeprecatedPaintLayerCompositor* compositor = webViewHelper.webViewImpl()->compositor();
+    PaintLayerCompositor* compositor = webViewHelper.webViewImpl()->compositor();
     EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().width());
     EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layoutSize().height());
     EXPECT_EQ(0.0, compositor->containerLayer()->size().width());
@@ -6264,7 +6264,7 @@
     webViewHelper.webView()->resize(WebSize(100, 100));
     FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "non-scrollable.html");
 
-    DeprecatedPaintLayerCompositor* compositor =  webViewHelper.webViewImpl()->compositor();
+    PaintLayerCompositor* compositor =  webViewHelper.webViewImpl()->compositor();
     ASSERT_TRUE(compositor->scrollLayer());
 
     // Verify that the WebLayer is not scrollable initially.
diff --git a/third_party/WebKit/Source/web/tests/WebViewTest.cpp b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
index c951a5f4..fb38eef7 100644
--- a/third_party/WebKit/Source/web/tests/WebViewTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebViewTest.cpp
@@ -50,8 +50,8 @@
 #include "core/loader/DocumentLoader.h"
 #include "core/loader/FrameLoadRequest.h"
 #include "core/page/Page.h"
-#include "core/paint/DeprecatedPaintLayer.h"
-#include "core/paint/DeprecatedPaintLayerPainter.h"
+#include "core/paint/PaintLayer.h"
+#include "core/paint/PaintLayerPainter.h"
 #include "core/timing/DOMWindowPerformance.h"
 #include "core/timing/Performance.h"
 #include "core/timing/PerformanceCompositeTiming.h"
@@ -532,10 +532,10 @@
 
     // Paint the root of the main frame in the way that CompositedLayerMapping would.
     FrameView* view = m_webViewHelper.webViewImpl()->mainFrameImpl()->frameView();
-    DeprecatedPaintLayer* rootLayer = view->layoutView()->layer();
+    PaintLayer* rootLayer = view->layoutView()->layer();
     LayoutRect paintRect(0, 0, kWidth, kHeight);
-    DeprecatedPaintLayerPaintingInfo paintingInfo(rootLayer, paintRect, GlobalPaintNormalPhase, LayoutSize());
-    DeprecatedPaintLayerPainter(*rootLayer).paintLayerContents(&pictureBuilder.context(), paintingInfo, PaintLayerPaintingCompositingAllPhases);
+    PaintLayerPaintingInfo paintingInfo(rootLayer, paintRect, GlobalPaintNormalPhase, LayoutSize());
+    PaintLayerPainter(*rootLayer).paintLayerContents(&pictureBuilder.context(), paintingInfo, PaintLayerPaintingCompositingAllPhases);
 
     pictureBuilder.endRecording()->playback(&canvas);
 
diff --git a/third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp b/third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp
index da70fbcd..3bdc736 100644
--- a/third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp
+++ b/third_party/WebKit/Source/web/tests/sim/SimCompositor.cpp
@@ -7,8 +7,8 @@
 
 #include "core/frame/FrameView.h"
 #include "core/layout/LayoutView.h"
-#include "core/layout/compositing/CompositedDeprecatedPaintLayerMapping.h"
-#include "core/paint/DeprecatedPaintLayer.h"
+#include "core/layout/compositing/CompositedLayerMapping.h"
+#include "core/paint/PaintLayer.h"
 #include "platform/graphics/ContentLayerDelegate.h"
 #include "public/platform/WebRect.h"
 #include "web/WebLocalFrameImpl.h"
@@ -19,10 +19,10 @@
 
 namespace blink {
 
-static void paintLayers(DeprecatedPaintLayer& layer, SimDisplayItemList& displayList)
+static void paintLayers(PaintLayer& layer, SimDisplayItemList& displayList)
 {
     if (layer.compositingState() == PaintsIntoOwnBacking) {
-        CompositedDeprecatedPaintLayerMapping* mapping = layer.compositedDeprecatedPaintLayerMapping();
+        CompositedLayerMapping* mapping = layer.compositedLayerMapping();
         GraphicsLayer* graphicsLayer = mapping->mainGraphicsLayer();
         if (graphicsLayer->hasTrackedPaintInvalidations()) {
             ContentLayerDelegate* delegate = graphicsLayer->contentLayerDelegateForTesting();
@@ -30,7 +30,7 @@
             graphicsLayer->resetTrackedPaintInvalidations();
         }
     }
-    for (DeprecatedPaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
+    for (PaintLayer* child = layer.firstChild(); child; child = child->nextSibling())
         paintLayers(*child, displayList);
 }
 
@@ -39,7 +39,7 @@
     for (Frame* frame = &root; frame; frame = frame->tree().traverseNext(&root)) {
         if (!frame->isLocalFrame())
             continue;
-        DeprecatedPaintLayer* layer = toLocalFrame(frame)->view()->layoutView()->layer();
+        PaintLayer* layer = toLocalFrame(frame)->view()->layoutView()->layer();
         paintLayers(*layer, displayList);
     }
 }
diff --git a/third_party/WebKit/Source/web/tests/sim/SimCompositor.h b/third_party/WebKit/Source/web/tests/sim/SimCompositor.h
index 53975e3b..bffbebc 100644
--- a/third_party/WebKit/Source/web/tests/sim/SimCompositor.h
+++ b/third_party/WebKit/Source/web/tests/sim/SimCompositor.h
@@ -15,7 +15,7 @@
 // processing steps on WebView: beginFrame, layout, paint.
 //
 // The painting capabilities are very limited in that only the main layer of
-// every CompositedDeprecatedPaintLayerMapping will be painted, squashed layers
+// every CompositedLayerMapping will be painted, squashed layers
 // are not supported and the entirety of every layer is always repainted even if
 // only part of the layer was invalid.
 //
diff --git a/third_party/WebKit/Source/wtf/DataLog.h b/third_party/WebKit/Source/wtf/DataLog.h
index 744a16d4..16ae403 100644
--- a/third_party/WebKit/Source/wtf/DataLog.h
+++ b/third_party/WebKit/Source/wtf/DataLog.h
@@ -28,6 +28,7 @@
 
 #include "wtf/Assertions.h"
 #include "wtf/FilePrintStream.h"
+#include "wtf/WTFExport.h"
 
 #include <stdarg.h>
 #include <stdio.h>
@@ -36,9 +37,9 @@
 
 FilePrintStream& dataFile();
 
-void dataLogFV(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(1, 0);
-void dataLogF(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
-void dataLogFString(const char*);
+WTF_EXPORT void dataLogFV(const char* format, va_list) WTF_ATTRIBUTE_PRINTF(1, 0);
+WTF_EXPORT void dataLogF(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
+WTF_EXPORT void dataLogFString(const char*);
 
 template<typename... T>
 void dataLog(const T&... values)
diff --git a/third_party/WebKit/Source/wtf/Vector.h b/third_party/WebKit/Source/wtf/Vector.h
index aabdef8..6acd88d 100644
--- a/third_party/WebKit/Source/wtf/Vector.h
+++ b/third_party/WebKit/Source/wtf/Vector.h
@@ -623,6 +623,7 @@
 
 public:
     typedef T ValueType;
+    typedef T value_type;
 
     typedef T* iterator;
     typedef const T* const_iterator;
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
index fb5231a..2e4d5ee 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/git.py
@@ -190,7 +190,7 @@
         match = re.search("^\s*Cr-Commit-Position:.*@\{#(?P<commit_position>\d+)\}", git_log, re.MULTILINE)
         if not match:
             return ""
-        return str(match.group('commit_position'))
+        return int(match.group('commit_position'))
 
     def commit_position(self, path):
         git_log = self.most_recent_log_matching('Cr-Commit-Position:', path)
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py
index 5dc81bf..5bdaa5d 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/checkout/scm/scm_mock.py
@@ -77,7 +77,7 @@
         return self._filesystem.join(self.checkout_root, *comps)
 
     def commit_position(self, path):
-        return '5678'
+        return 5678
 
     def commit_position_from_git_commit(self, git_commit):
         if git_commit == '6469e754a1':
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py
index 2800cf4..97175e6 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder.py
@@ -98,7 +98,10 @@
                               key=lambda t: (times[t], t))
         clamped_percentile = max(0, min(100, fastest_percentile))
         number_of_tests_to_return = int(len(sorted_times) * clamped_percentile / 100)
-        fastest_tests = sorted_times[:number_of_tests_to_return]
+        fastest_tests = set(sorted_times[:number_of_tests_to_return])
+
+        # Don't try to run tests in the times_trie that no longer exist,
+        fastest_tests = fastest_tests.intersection(all_tests)
 
         # For fastest tests, include any tests not in the times_ms.json so that
         # new tests get run in the fast set.
@@ -106,7 +109,7 @@
 
         # Using a set to dedupe here means that --order=None won't work, but that's
         # ok because --fastest already runs in an arbitrary order.
-        return list(set(fastest_tests).union(unaccounted_tests))
+        return list(fastest_tests.union(unaccounted_tests))
 
     def _strip_test_dir_prefixes(self, paths):
         return [self._strip_test_dir_prefix(path) for path in paths if path]
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder_unittest.py
index 09d8ff070..5f00b037 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_finder_unittest.py
@@ -58,3 +58,29 @@
 
         tests = finder.find_tests(args=['path/test.html'])
         self.assertEqual(tests[1], ['path/test.html'])
+
+    def test_find_fastest_tests_excludes_deleted_tests(self):
+        host = MockHost()
+        port = host.port_factory.get('test-win-xp', None)
+
+        all_tests = [
+            'fast/css/1.html',
+            'fast/css/2.html',
+        ]
+
+        port.tests = lambda paths: paths or all_tests
+
+        finder = layout_test_finder.LayoutTestFinder(port, {})
+
+        finder._times_trie = lambda: {
+            'fast': {
+                'css': {
+                    '1.html': 1,
+                    '2.html': 2,
+                    'non-existant.html': 1,
+                }
+            },
+        }
+
+        tests = finder.find_tests(fastest_percentile=90, args=[])
+        self.assertEqual(set(tests[1]), set(['fast/css/1.html']))
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
index f7361eb..fcf9be2c 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_run_results.py
@@ -337,7 +337,7 @@
         path = port_obj.repository_path()
         scm = port_obj.host.scm_for_path(path)
         if scm:
-            results['chromium_revision'] = scm.commit_position(path)
+            results['chromium_revision'] = str(scm.commit_position(path))
         else:
             _log.warn('Failed to determine chromium commit position for %s, '
                       'leaving "chromium_revision" key blank in full_results.json.'
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
index f35388d..950a5984 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/performance_tests/perftestsrunner.py
@@ -264,7 +264,7 @@
         revisions = {}
         path = self._port.repository_path()
         scm = SCMDetector(self._host.filesystem, self._host.executive).detect_scm_system(path) or self._host.scm()
-        revision = scm.commit_position(path)
+        revision = str(scm.commit_position(path))
         revisions['chromium'] = {'revision': revision, 'timestamp': scm.timestamp_of_revision(path, revision)}
 
         meta_info = {
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
index 87dac7d..ba6515f 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline.py
@@ -874,7 +874,7 @@
                 # FIXME: Log the pull and dcommit stdout/stderr to the log-server.
                 tool.executive.run_command(['git', 'pull'])
 
-                self._run_git_cl_command(options, ['dcommit', '-f'])
+                self._run_git_cl_command(options, ['land', '-f', '-v'])
         except:
             traceback.print_exc(file=sys.stderr)
         finally:
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
index 1e4428f..eb43b1a 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
@@ -1099,7 +1099,7 @@
                 ],
                 ['git', 'cl', 'upload', '-f'],
                 ['git', 'pull'],
-                ['git', 'cl', 'dcommit', '-f'],
+                ['git', 'cl', 'land', '-f', '-v'],
                 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'],
             ])
 
@@ -1226,7 +1226,7 @@
                 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', '', 'fast/dom/prototype-taco.html']],
                 ['git', 'cl', 'upload', '-f'],
                 ['git', 'pull'],
-                ['git', 'cl', 'dcommit', '-f'],
+                ['git', 'cl', 'land', '-f', '-v'],
                 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'],
             ])
 
@@ -1287,7 +1287,7 @@
                 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', '', 'fast/dom/prototype-taco.html']],
                 ['git', 'cl', 'upload', '-f'],
                 ['git', 'pull'],
-                ['git', 'cl', 'dcommit', '-f'],
+                ['git', 'cl', 'land', '-f', '-v'],
                 ['git', 'config', 'branch.auto-rebaseline-alt-temporary-branch.rietveldissue'],
             ])
 
@@ -1347,7 +1347,7 @@
                 [['python', 'echo', 'optimize-baselines', '--no-modify-scm', '--suffixes', '', 'fast/dom/prototype-taco.html']],
                 ['git', 'cl', 'upload', '-f'],
                 ['git', 'pull'],
-                ['git', 'cl', 'dcommit', '-f'],
+                ['git', 'cl', 'land', '-f', '-v'],
                 ['git', 'config', 'branch.auto-rebaseline-temporary-branch.rietveldissue'],
             ])
 
diff --git a/third_party/WebKit/public/blink_headers.gypi b/third_party/WebKit/public/blink_headers.gypi
index d933df1..a958068 100644
--- a/third_party/WebKit/public/blink_headers.gypi
+++ b/third_party/WebKit/public/blink_headers.gypi
@@ -98,6 +98,7 @@
       "platform/WebFloatRect.h",
       "platform/WebFloatSize.h",
       "platform/WebFocusType.h",
+      "platform/WebFrameHostScheduler.h",
       "platform/WebFrameScheduler.h",
       "platform/WebFrameTimingEvent.h",
       "platform/WebGamepad.h",
@@ -152,7 +153,6 @@
       "platform/WebMessagePortChannelClient.h",
       "platform/WebMimeRegistry.h",
       "platform/WebNonCopyable.h",
-      "platform/WebPageScheduler.h",
       "platform/WebPageVisibilityState.h",
       "platform/WebPasswordCredential.h",
       "platform/WebPlatformEventListener.h",
diff --git a/third_party/WebKit/public/platform/modules/presentation/WebPresentationClient.h b/third_party/WebKit/public/platform/modules/presentation/WebPresentationClient.h
index 8528e788..43744ac 100644
--- a/third_party/WebKit/public/platform/modules/presentation/WebPresentationClient.h
+++ b/third_party/WebKit/public/platform/modules/presentation/WebPresentationClient.h
@@ -13,14 +13,14 @@
 
 class WebPresentationAvailabilityObserver;
 class WebPresentationController;
-class WebPresentationSessionClient;
+class WebPresentationConnectionClient;
 class WebString;
 struct WebPresentationError;
 
 // If session was created, callback's onSuccess() is invoked with the information about the
 // presentation session created by the embedder. Otherwise, onError() is invoked with the error code
 // and message.
-using WebPresentationSessionClientCallbacks = WebCallbacks<WebPassOwnPtr<WebPresentationSessionClient>, const WebPresentationError&>;
+using WebPresentationConnectionClientCallbacks = WebCallbacks<WebPassOwnPtr<WebPresentationConnectionClient>, const WebPresentationError&>;
 
 // Callback for .getAvailability().
 using WebPresentationAvailabilityCallbacks = WebCallbacks<bool, const WebPresentationError&>;
@@ -35,11 +35,11 @@
 
     // Called when the frame requests to start a new session.
     // The ownership of the |callbacks| argument is transferred to the embedder.
-    virtual void startSession(const WebString& presentationUrl, WebPresentationSessionClientCallbacks*) = 0;
+    virtual void startSession(const WebString& presentationUrl, WebPresentationConnectionClientCallbacks*) = 0;
 
     // Called when the frame requests to join an existing session.
     // The ownership of the |callbacks| argument is transferred to the embedder.
-    virtual void joinSession(const WebString& presentationUrl, const WebString& presentationId, WebPresentationSessionClientCallbacks*) = 0;
+    virtual void joinSession(const WebString& presentationUrl, const WebString& presentationId, WebPresentationConnectionClientCallbacks*) = 0;
 
     // Called when the frame requests to send String message to an existing session.
     virtual void sendString(const WebString& presentationUrl, const WebString& presentationId, const WebString& message) = 0;
diff --git a/third_party/WebKit/public/platform/modules/presentation/WebPresentationConnectionClient.h b/third_party/WebKit/public/platform/modules/presentation/WebPresentationConnectionClient.h
new file mode 100644
index 0000000..2ec7911
--- /dev/null
+++ b/third_party/WebKit/public/platform/modules/presentation/WebPresentationConnectionClient.h
@@ -0,0 +1,28 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef WebPresentationConnectionClient_h
+#define WebPresentationConnectionClient_h
+
+#include "public/platform/WebString.h"
+
+namespace blink {
+
+enum class WebPresentationConnectionState {
+    Connected = 0,
+    Disconnected,
+};
+
+// The implementation the embedder has to provide for the Presentation API to work.
+class WebPresentationConnectionClient {
+public:
+    virtual ~WebPresentationConnectionClient() { }
+
+    virtual WebString getId() = 0;
+    virtual WebString getUrl() = 0;
+};
+
+} // namespace blink
+
+#endif // WebPresentationConnectionClient_h
diff --git a/third_party/WebKit/public/platform/modules/presentation/WebPresentationController.h b/third_party/WebKit/public/platform/modules/presentation/WebPresentationController.h
index 3ccb941..e50221f 100644
--- a/third_party/WebKit/public/platform/modules/presentation/WebPresentationController.h
+++ b/third_party/WebKit/public/platform/modules/presentation/WebPresentationController.h
@@ -9,9 +9,9 @@
 
 namespace blink {
 
-class WebPresentationSessionClient;
+class WebPresentationConnectionClient;
 class WebString;
-enum class WebPresentationSessionState;
+enum class WebPresentationConnectionState;
 
 // The delegate Blink provides to WebPresentationClient in order to get updates.
 class BLINK_PLATFORM_EXPORT WebPresentationController {
@@ -20,16 +20,16 @@
 
     // Called when the presentation session is started by the embedder using
     // the default presentation URL and id.
-    virtual void didStartDefaultSession(WebPresentationSessionClient*) = 0;
+    virtual void didStartDefaultSession(WebPresentationConnectionClient*) = 0;
 
     // Called when the state of a session changes.
-    virtual void didChangeSessionState(WebPresentationSessionClient*, WebPresentationSessionState) = 0;
+    virtual void didChangeSessionState(WebPresentationConnectionClient*, WebPresentationConnectionState) = 0;
 
     // Called when a text message of a session is received.
-    virtual void didReceiveSessionTextMessage(WebPresentationSessionClient*, const WebString& message) = 0;
+    virtual void didReceiveSessionTextMessage(WebPresentationConnectionClient*, const WebString& message) = 0;
 
     // Called when a binary message of a session is received.
-    virtual void didReceiveSessionBinaryMessage(WebPresentationSessionClient*, const uint8_t* data, size_t length) = 0;
+    virtual void didReceiveSessionBinaryMessage(WebPresentationConnectionClient*, const uint8_t* data, size_t length) = 0;
 };
 
 } // namespace blink
diff --git a/third_party/WebKit/public/platform/modules/presentation/WebPresentationSessionClient.h b/third_party/WebKit/public/platform/modules/presentation/WebPresentationSessionClient.h
deleted file mode 100644
index 87a5fba..0000000
--- a/third_party/WebKit/public/platform/modules/presentation/WebPresentationSessionClient.h
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WebPresentationSessionClient_h
-#define WebPresentationSessionClient_h
-
-#include "public/platform/WebString.h"
-
-namespace blink {
-
-enum class WebPresentationSessionState {
-    Connected = 0,
-    Disconnected,
-};
-
-// The implementation the embedder has to provide for the Presentation API to work.
-class WebPresentationSessionClient {
-public:
-    virtual ~WebPresentationSessionClient() { }
-
-    virtual WebString getId() = 0;
-    virtual WebString getUrl() = 0;
-};
-
-} // namespace blink
-
-#endif // WebPresentationSessionClient_h
diff --git a/third_party/WebKit/public/platform/modules/push_messaging/WebPushSubscription.h b/third_party/WebKit/public/platform/modules/push_messaging/WebPushSubscription.h
index 33c628b3..699b929 100644
--- a/third_party/WebKit/public/platform/modules/push_messaging/WebPushSubscription.h
+++ b/third_party/WebKit/public/platform/modules/push_messaging/WebPushSubscription.h
@@ -12,15 +12,15 @@
 namespace blink {
 
 struct WebPushSubscription {
-    // The |endpoint| and |p256dh| must both be unique for each subscription.
-    WebPushSubscription(const WebURL& endpoint, const WebVector<unsigned char>& p256dh)
+    // The |endpoint| and |curve25519dh| must both be unique for each subscription.
+    WebPushSubscription(const WebURL& endpoint, const WebVector<unsigned char>& curve25519dh)
         : endpoint(endpoint)
-        , p256dh(p256dh)
+        , curve25519dh(curve25519dh)
     {
     }
 
     WebURL endpoint;
-    WebVector<unsigned char> p256dh;
+    WebVector<unsigned char> curve25519dh;
 };
 
 } // namespace blink
diff --git a/third_party/devscripts/licensecheck.pl b/third_party/devscripts/licensecheck.pl
index a59bbf9..672b773 100755
--- a/third_party/devscripts/licensecheck.pl
+++ b/third_party/devscripts/licensecheck.pl
@@ -475,7 +475,7 @@
 
     if ($licensetext =~ /is free software.? you (can|may) redistribute it and\/or modify it under the terms of (?:version [^ ]+ (?:\(?only\)? )?of )?the GNU General Public License/i) {
 	$license = "GPL$gplver$extrainfo $license";
-    } elsif ($licensetext =~ /is distributed under the terms of the GNU General Public License,/
+    } elsif ($licensetext =~ /is distributed under the terms of the GNU General Public License/
 	and $gplver) {
 	$license = "GPL$gplver$extrainfo $license";
     } elsif ($licensetext =~ /is distributed.*terms.*[^L]GPL/) {
diff --git a/third_party/jmake/BUILD.gn b/third_party/jmake/BUILD.gn
new file mode 100644
index 0000000..7b9b0a9
--- /dev/null
+++ b/third_party/jmake/BUILD.gn
@@ -0,0 +1,31 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//build/config/android/rules.gni")
+
+java_binary("jmake") {
+  java_files = [
+    "src/org/pantsbuild/jmake/CompatibilityChecker.java",
+    "src/org/pantsbuild/jmake/BinaryFileWriter.java",
+    "src/org/pantsbuild/jmake/PCDEntry.java",
+    "src/org/pantsbuild/jmake/TextProjectDatabaseWriter.java",
+    "src/org/pantsbuild/jmake/Base64.java",
+    "src/org/pantsbuild/jmake/PCDContainer.java",
+    "src/org/pantsbuild/jmake/Main.java",
+    "src/org/pantsbuild/jmake/ClassFileReader.java",
+    "src/org/pantsbuild/jmake/ClassPath.java",
+    "src/org/pantsbuild/jmake/BinaryFileReader.java",
+    "src/org/pantsbuild/jmake/PrivateException.java",
+    "src/org/pantsbuild/jmake/ClassInfo.java",
+    "src/org/pantsbuild/jmake/BinaryProjectDatabaseWriter.java",
+    "src/org/pantsbuild/jmake/PCDManager.java",
+    "src/org/pantsbuild/jmake/TextProjectDatabaseReader.java",
+    "src/org/pantsbuild/jmake/RefClassFinder.java",
+    "src/org/pantsbuild/jmake/Utils.java",
+    "src/org/pantsbuild/jmake/PublicExceptions.java",
+    "src/org/pantsbuild/jmake/BinaryProjectDatabaseReader.java",
+  ]
+  main_class = "org.pantsbuild.jmake.Main"
+  enable_incremental_javac = false
+}
diff --git a/third_party/jmake/LICENSE b/third_party/jmake/LICENSE
new file mode 100644
index 0000000..2fa033e
--- /dev/null
+++ b/third_party/jmake/LICENSE
@@ -0,0 +1,341 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+
diff --git a/third_party/jmake/OWNERS b/third_party/jmake/OWNERS
new file mode 100644
index 0000000..dbccb98
--- /dev/null
+++ b/third_party/jmake/OWNERS
@@ -0,0 +1,2 @@
+agrieve@chromium.org
+yfriedman@chromium.org
diff --git a/third_party/jmake/README.chromium b/third_party/jmake/README.chromium
new file mode 100644
index 0000000..0caab77
--- /dev/null
+++ b/third_party/jmake/README.chromium
@@ -0,0 +1,16 @@
+Name: JMake
+URL: https://github.com/pantsbuild/jmake
+Version: 0
+Revision: 7761ee3e1537ccc61820c0d30061eb09edaf1c93
+License: GPL 2.0
+Security Critical: No
+License Android Compatible: No
+
+Description:
+Formerly known as Javamake, jmake is a compiler wrapper that figures out the
+minimal set of .java files that need to be rebuilt given a set of .java files
+that have changed.
+
+Local Modifications:
+* Removed unneeded files
+* Added BUILD.gn
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/Base64.java b/third_party/jmake/src/org/pantsbuild/jmake/Base64.java
new file mode 100644
index 0000000..af02ca6
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/Base64.java
@@ -0,0 +1,80 @@
+/* Copyright (c) 2002-2013 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.util.Arrays;
+
+
+/**
+ * JMake needs to run against old versions of Java, that may not have JAXB's
+ * javax.xml.bind.DatatypeConverter. And we don't want JMake to depend on third-party external libraries,
+ * especially not just for this.  So we implement a lightweight Base64 converter here ourselves.
+
+ * Note that sun.misc.BASE64Encoder is not official API and can go away at any time. Plus it inserts
+ * line breaks into its emitted string, which is not what we want. So we can't use that either.
+ */
+
+public class Base64 {
+    // The easiest way to grok this code is to think of Base64 as the following chain of
+    // conversions (ignoring padding issues):
+    // 3 bytes -> 24 bits -> 4 6-bit nibbles -> 4 indexes from 0-63 -> 4 characters.
+    private static final char[] indexToDigit =
+        "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".toCharArray();
+    private static final int[] digitToIndex = new int[128];
+    static {
+        assert(indexToDigit.length == 64);
+        Arrays.fill(digitToIndex, -1);
+        for (int i = 0; i < indexToDigit.length; i++) digitToIndex[(int)indexToDigit[i]] = i;
+    }
+
+    private Base64() {}
+
+    public static char[] encode(byte[] in) {
+        char[] ret = new char[(in.length + 2) / 3 * 4];
+        int p = 0;
+        int i = 0;
+        while (i < in.length) {
+            // Lowest 24 bits count.
+            int bits = (in[i++] & 0xff) << 16 | (i < in.length ? in[i++] & 0xff : 0) << 8 | (i < in.length ? in[i++] & 0xff : 0);
+            ret[p++] = indexToDigit[(bits & 0xfc0000) >> 18];
+            ret[p++] = indexToDigit[(bits & 0x3f000) >> 12];
+            ret[p++] = indexToDigit[(bits & 0xfc0) >> 6];
+            ret[p++] = indexToDigit[bits & 0x3f];
+        }
+        assert(p == ret.length);
+        int padding = (3 - in.length % 3) % 3;
+        for (int j = ret.length - padding; j < ret.length; j++) ret[j] = '=';
+        return ret;
+    }
+
+    public static byte[] decode(char[] in) {
+        if (in.length % 4 != 0) throw new IllegalArgumentException("Base64-encoded string must be of length that is a multiple of 4.");
+        int len = in.length;
+        while(len > 0 && in[len - 1] == '=') len--;
+        int padding = in.length - len;
+        byte[] ret = new byte[in.length / 4 * 3 - padding];
+        int i = 0;
+        int p = 0;
+        while (i < len) {
+            char c0 = in[i++];
+            char c1 = in[i++];
+            char c2 = i < len ? in[i++] : 'A';
+            char c3 = i < len ? in[i++] : 'A';
+            if (c0 > 127 || c1 > 127 || c2 > 127 || c3 > 127) throw new IllegalArgumentException("Invalid Base64 digit in: " + c0 + c1 + c2 + c3);
+            int n0 = digitToIndex[c0];
+            int n1 = digitToIndex[c1];
+            int n2 = digitToIndex[c2];
+            int n3 = digitToIndex[c3];
+            if (n0 < 0 || n1 < 0 || n2 < 0 || n3 < 0) throw new IllegalArgumentException("Invalid Base64 digit in: " + c0 + c1 + c2 + c3);
+            int bits = (n0 << 18) | (n1 << 12) | (n2 << 6) | n3;
+            ret[p++] = (byte)((bits & 0xff0000) >> 16);
+            if (p < ret.length) ret[p++] = (byte)((bits & 0xff00) >> 8);
+            if (p < ret.length) ret[p++] = (byte)(bits & 0xff);
+        }
+        return ret;
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/BinaryFileReader.java b/third_party/jmake/src/org/pantsbuild/jmake/BinaryFileReader.java
new file mode 100644
index 0000000..6e2cb4e
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/BinaryFileReader.java
@@ -0,0 +1,96 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.DataInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+/**
+ * Basic operations for reading a byte array representing a binary file.
+ *
+ * @author  Misha Dmitriev
+ *  10 November 2001
+ */
+public class BinaryFileReader {
+
+    protected byte[] buf;
+    protected int curBufPos;
+    protected String fileFullPath;  // Required only for nice error reports
+
+    protected void initBuf(byte[] buf, String fileFullPath) {
+        this.buf = buf;
+        curBufPos = 0;
+        this.fileFullPath = fileFullPath;
+    }
+
+    protected char nextChar() {
+        return (char) (((buf[curBufPos++] & 255) << 8) + (buf[curBufPos++] & 255));
+    }
+
+    protected char getChar(int bufPos) {
+        return (char) (((buf[bufPos] & 255) << 8) + (buf[bufPos+1] & 255));
+    }
+
+    protected int nextInt() {
+        return ((buf[curBufPos++] & 255) << 24) + ((buf[curBufPos++] & 255) << 16) +
+                ((buf[curBufPos++] & 255) << 8) + (buf[curBufPos++] & 255);
+    }
+
+    protected int getInt(int bufPos) {
+        return ((buf[bufPos] & 255) << 24) + ((buf[bufPos+1] & 255) << 16) +
+                ((buf[bufPos+2] & 255) << 8) + (buf[bufPos+3] & 255);
+    }
+
+    protected long nextLong() {
+        long res = getLong(curBufPos);
+        curBufPos += 8;
+        return res;
+    }
+
+    protected long getLong(int bufPos) {
+        DataInputStream bufin =
+                new DataInputStream(new ByteArrayInputStream(buf, bufPos, 8));
+        try {
+            return bufin.readLong();
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+
+    protected float nextFloat() {
+        float res = getFloat(curBufPos);
+        curBufPos += 4;
+        return res;
+    }
+
+    protected float getFloat(int bufPos) {
+        DataInputStream bufin =
+                new DataInputStream(new ByteArrayInputStream(buf, bufPos, 4));
+        try {
+            return bufin.readFloat();
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+
+    protected double nextDouble() {
+        double res = getDouble(curBufPos);
+        curBufPos += 8;
+        return res;
+    }
+
+    protected double getDouble(int bufPos) {
+        DataInputStream bufin =
+                new DataInputStream(new ByteArrayInputStream(buf, bufPos, 8));
+        try {
+            return bufin.readDouble();
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/BinaryFileWriter.java b/third_party/jmake/src/org/pantsbuild/jmake/BinaryFileWriter.java
new file mode 100644
index 0000000..01de415
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/BinaryFileWriter.java
@@ -0,0 +1,99 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+/**
+ * Basic operations for writing to a byte array representing a binary file.
+ *
+ * @author  Misha Dmitriev
+ *  30 January 2002
+ */
+public class BinaryFileWriter {
+
+    protected byte[] buf;
+    protected int curBufSize,  bufInc,  curBufPos,  threshold;
+    private boolean bufferIncreaseAllowed = true;
+
+    protected void initBuf(int initSize) {
+        buf = new byte[initSize];
+        curBufSize = initSize;
+        bufInc = initSize / 5;
+        curBufPos = 0;
+        threshold = curBufSize - bufInc;
+    }
+
+    protected void increaseBuf() {
+        if (!bufferIncreaseAllowed) {
+            return;
+        }
+        byte newBuf[] = new byte[curBufSize + bufInc];
+        System.arraycopy(buf, 0, newBuf, 0, curBufPos);
+        buf = newBuf;
+        curBufSize = buf.length;
+        threshold = curBufSize - bufInc;
+    }
+
+    // This should be called with false only when we are sure that we set the exact size of the buffer
+    // and there is no need to increase it.
+    protected void setBufferIncreaseMode(boolean increaseMode) {
+        bufferIncreaseAllowed = increaseMode;
+    }
+
+    public byte[] getBuffer() {
+        return buf;
+    }
+
+
+    protected void writeByte(byte b) {
+        if (curBufPos > threshold) {
+            increaseBuf();
+        }
+        buf[curBufPos++] = b;
+    }
+
+    protected void writeChar(int ch) {
+        buf[curBufPos++] = (byte) ((ch >> 8) & 255);
+        buf[curBufPos++] = (byte) (ch & 255);
+        if (curBufPos > threshold) {
+            increaseBuf();
+        }
+    }
+
+    protected void writeInt(int i) {
+        buf[curBufPos++] = (byte) ((i >> 24) & 255);
+        buf[curBufPos++] = (byte) ((i >> 16) & 255);
+        buf[curBufPos++] = (byte) ((i >> 8) & 255);
+        buf[curBufPos++] = (byte) (i & 255);
+        if (curBufPos > threshold) {
+            increaseBuf();
+        }
+    }
+
+    protected void writeLong(long l) {
+        buf[curBufPos++] = (byte) ((l >> 56) & 255);
+        buf[curBufPos++] = (byte) ((l >> 48) & 255);
+        buf[curBufPos++] = (byte) ((l >> 40) & 255);
+        buf[curBufPos++] = (byte) ((l >> 32) & 255);
+        buf[curBufPos++] = (byte) ((l >> 24) & 255);
+        buf[curBufPos++] = (byte) ((l >> 16) & 255);
+        buf[curBufPos++] = (byte) ((l >> 8) & 255);
+        buf[curBufPos++] = (byte) (l & 255);
+        if (curBufPos > threshold) {
+            increaseBuf();
+        }
+    }
+
+    protected void writeFloat(float f) {
+        int i = Float.floatToIntBits(f);
+        writeInt(i);
+    }
+
+    protected void writeDouble(double d) {
+        long l = Double.doubleToLongBits(d);
+        writeLong(l);
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/BinaryProjectDatabaseReader.java b/third_party/jmake/src/org/pantsbuild/jmake/BinaryProjectDatabaseReader.java
new file mode 100644
index 0000000..e75e206
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/BinaryProjectDatabaseReader.java
@@ -0,0 +1,281 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * This class creates the internal representation of the project database from a byte array.
+ *
+ * @author  Misha Dmitriev
+ *  2 March 2005
+ */
+public class BinaryProjectDatabaseReader extends BinaryFileReader {
+
+    private String stringTable[];
+    private Map<String,PCDEntry> pcd;
+    private int nOfEntries;
+    private int pdbFormat;  // Currently supported values: 0x01030300 (jmake 1.3.3 and newer versions); 1 (all older versions)
+    // These are defined in Utils as PDB_FORMAT_CODE_LATEST and PDB_FORMAT_CODE_OLD
+
+    public Map<String,PCDEntry> readProjectDatabaseFromFile(File infile) {
+        byte buf[] = Utils.readFileIntoBuffer(infile);
+        return readProjectDatabase(buf, infile.toString());
+    }
+
+    public Map<String,PCDEntry> readProjectDatabase(byte[] pdbFile,
+            String pdbFileFullPath) {
+        initBuf(pdbFile, pdbFileFullPath);
+
+        readPreamble();
+        readStringTable();
+        pcd = new LinkedHashMap<String,PCDEntry>(nOfEntries * 4 / 3);
+
+        for (int i = 0; i < nOfEntries; i++) {
+            PCDEntry entry = readPCDEntry();
+            pcd.put(entry.className, entry);
+        }
+
+        stringTable = null;  // Help the GC
+        return pcd;
+    }
+
+    private void readPreamble() {
+        if (buf.length < Utils.magicLength + 8) {
+            pdbCorruptedException("file too short");
+        }
+
+        for (int i = 0; i < Utils.magicLength; i++) {
+            if (buf[i] != Utils.MAGIC[i]) {
+                pdbCorruptedException("wrong project database header");
+            }
+        }
+
+        curBufPos += Utils.magicLength;
+        pdbFormat = nextInt();
+        if (pdbFormat != Utils.PDB_FORMAT_CODE_OLD && pdbFormat != Utils.PDB_FORMAT_CODE_LATEST) {
+            pdbCorruptedException("wrong version number");
+        }
+
+        int pdbSize = nextInt();
+        if (buf.length != Utils.MAGIC.length + 8 + pdbSize) {
+            pdbCorruptedException("file size does not match stored value");
+        }
+
+        nOfEntries = nextInt();
+    }
+
+    private void readStringTable() {
+        int size = nextInt();
+        stringTable = new String[size];
+        for (int i = 0; i < size; i++) {
+            stringTable[i] = nextString();
+        }
+    }
+
+    private PCDEntry readPCDEntry() {
+        String className = nextStringRef();
+        String javaFileFullPath = nextStringRef();
+        long classFileLastModified = nextLong();
+        long classFileFingerprint = nextLong();
+        ClassInfo classInfo = readClassInfo();
+
+        return new PCDEntry(className, javaFileFullPath, classFileLastModified, classFileFingerprint, classInfo);
+    }
+
+    private ClassInfo readClassInfo() {
+        int i, j, len;
+        ClassInfo res = new ClassInfo();
+
+        res.name = nextStringRef();
+        if (pdbFormat >= Utils.PDB_FORMAT_CODE_133) {
+            res.javacTargetRelease = nextInt();
+        } else {
+            res.javacTargetRelease = Utils.JAVAC_TARGET_RELEASE_OLDEST;
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            String cpoolRefsToClasses[] = new String[len];
+            for (i = 0; i < len; i++) {
+                cpoolRefsToClasses[i] = nextStringRef();
+            }
+            res.cpoolRefsToClasses = cpoolRefsToClasses;
+            boolean isRefClassArray[] = new boolean[len];
+            for (i = 0; i < len; i++) {
+                isRefClassArray[i] = (buf[curBufPos++] != 0);
+            }
+            res.isRefClassArray = isRefClassArray;
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            String cpoolRefsToFieldClasses[] = new String[len];
+            for (i = 0; i < len; i++) {
+                cpoolRefsToFieldClasses[i] = nextStringRef();
+            }
+            res.cpoolRefsToFieldClasses = cpoolRefsToFieldClasses;
+            String cpoolRefsToFieldNames[] = new String[len];
+            for (i = 0; i < len; i++) {
+                cpoolRefsToFieldNames[i] = nextStringRef();
+            }
+            res.cpoolRefsToFieldNames = cpoolRefsToFieldNames;
+            String cpoolRefsToFieldSignatures[] = new String[len];
+            for (i = 0; i < len; i++) {
+                cpoolRefsToFieldSignatures[i] = nextStringRef();
+            }
+            res.cpoolRefsToFieldSignatures = cpoolRefsToFieldSignatures;
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            String cpoolRefsToMethodClasses[] = new String[len];
+            for (i = 0; i < len; i++) {
+                cpoolRefsToMethodClasses[i] = nextStringRef();
+            }
+            res.cpoolRefsToMethodClasses = cpoolRefsToMethodClasses;
+            String cpoolRefsToMethodNames[] = new String[len];
+            for (i = 0; i < len; i++) {
+                cpoolRefsToMethodNames[i] = nextStringRef();
+            }
+            res.cpoolRefsToMethodNames = cpoolRefsToMethodNames;
+            String cpoolRefsToMethodSignatures[] = new String[len];
+            for (i = 0; i < len; i++) {
+                cpoolRefsToMethodSignatures[i] = nextStringRef();
+            }
+            res.cpoolRefsToMethodSignatures = cpoolRefsToMethodSignatures;
+        }
+
+        res.accessFlags = nextChar();
+        res.isNonMemberNestedClass = (buf[curBufPos++] != 0);
+        if (!"java/lang/Object".equals(res.name)) {
+            res.superName = nextStringRef();
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            String interfaces[] = new String[len];
+            for (i = 0; i < len; i++) {
+                interfaces[i] = nextStringRef();
+            }
+            res.interfaces = interfaces;
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            String fieldNames[] = new String[len];
+            for (i = 0; i < len; i++) {
+                fieldNames[i] = nextStringRef();
+            }
+            res.fieldNames = fieldNames;
+            String fieldSignatures[] = new String[len];
+            for (i = 0; i < len; i++) {
+                fieldSignatures[i] = nextStringRef();
+            }
+            res.fieldSignatures = fieldSignatures;
+            char fieldAccessFlags[] = new char[len];
+            for (i = 0; i < len; i++) {
+                fieldAccessFlags[i] = nextChar();
+            }
+            res.fieldAccessFlags = fieldAccessFlags;
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            Object primitiveConstantInitValues[] = new Object[len];
+            for (i = 0; i < len; i++) {
+                byte code = buf[curBufPos++];
+                switch (code) {
+                    case 1:
+                        primitiveConstantInitValues[i] = nextStringRef();
+                        break;
+                    case 2:
+                        primitiveConstantInitValues[i] = Integer.valueOf(nextInt());
+                        break;
+                    case 3:
+                        primitiveConstantInitValues[i] = Long.valueOf(nextLong());
+                        break;
+                    case 4:
+                        primitiveConstantInitValues[i] = Float.valueOf(nextFloat());
+                        break;
+                    case 5:
+                        primitiveConstantInitValues[i] =
+                                Double.valueOf(nextDouble());
+                        break;
+                    default:  // Nothing to do
+                }
+            }
+            res.primitiveConstantInitValues = primitiveConstantInitValues;
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            String methodNames[] = new String[len];
+            for (i = 0; i < len; i++) {
+                methodNames[i] = nextStringRef();
+            }
+            res.methodNames = methodNames;
+            String methodSignatures[] = new String[len];
+            for (i = 0; i < len; i++) {
+                methodSignatures[i] = nextStringRef();
+            }
+            res.methodSignatures = methodSignatures;
+            char methodAccessFlags[] = new char[len];
+            for (i = 0; i < len; i++) {
+                methodAccessFlags[i] = nextChar();
+            }
+            res.methodAccessFlags = methodAccessFlags;
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            String checkedExceptions[][] = new String[len][];
+            for (i = 0; i < len; i++) {
+                int len1 = nextChar();
+                if (len1 > 0) {
+                    checkedExceptions[i] = new String[len1];
+                    for (j = 0; j < len1; j++) {
+                        checkedExceptions[i][j] = nextStringRef();
+                    }
+                }
+            }
+            res.checkedExceptions = checkedExceptions;
+        }
+
+        len = nextChar();
+        if (len > 0) {
+            String nestedClasses[] = new String[len];
+            for (i = 0; i < len; i++) {
+                nestedClasses[i] = nextStringRef();
+            }
+            res.nestedClasses = nestedClasses;
+        }
+
+        res.initializeImmediateTransientFields();
+        return res;
+    }
+
+    private String nextString() {
+        int length = nextChar();
+        if (buf.length < curBufPos + length) {
+            pdbCorruptedException("data error");
+        }
+        String res = (new String(buf, curBufPos, length)).intern();
+        curBufPos += length;
+        return res;
+    }
+
+    private String nextStringRef() {
+        return stringTable[nextInt()];
+    }
+
+    private void pdbCorruptedException(String message) {
+        throw new PrivateException(new PublicExceptions.PDBCorruptedException(message));
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/BinaryProjectDatabaseWriter.java b/third_party/jmake/src/org/pantsbuild/jmake/BinaryProjectDatabaseWriter.java
new file mode 100644
index 0000000..fafaa3981
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/BinaryProjectDatabaseWriter.java
@@ -0,0 +1,363 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * This class implements writing into a byte array representing a project database
+ *
+ * @author  Misha Dmitriev
+ *  2 March 2005
+ */
+public class BinaryProjectDatabaseWriter extends BinaryFileWriter {
+
+    private Map<String, PCDEntry> pcd = null;
+    private int nOfEntries;
+    private byte[] stringBuf;
+    private int curStringBufPos,  stringBufInc,  curStringBufWatermark,  stringCount;
+    private StringHashTable stringHashTable = null;
+
+    public void writeProjectDatabaseToFile(File outfile, Map<String, PCDEntry> pcd) {
+        try {
+            byte[] buf = new BinaryProjectDatabaseWriter().writeProjectDatabase(pcd);
+            FileOutputStream out = new FileOutputStream(outfile);
+            out.write(buf);
+            out.close();
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+
+    public byte[] writeProjectDatabase(Map<String, PCDEntry> pcd) {
+        this.pcd = pcd;
+        nOfEntries = pcd.size();
+
+        // So far the constant here is chosen rather arbitrarily
+        initBuf(nOfEntries * 1000);
+
+        stringBuf = new byte[nOfEntries * 300];
+        stringBufInc = stringBuf.length / 5;
+        curStringBufWatermark = stringBuf.length - 20;
+        stringHashTable = new StringHashTable(stringBuf.length / 8);
+
+        for (PCDEntry entry : pcd.values()) {
+            writePCDEntry(entry);
+        }
+
+        // Now we have the string buffer and the main buffer. Write the end result
+        byte[] mainBuf = buf;
+        int mainBufSize = curBufPos;
+        int preambleSize = Utils.MAGIC.length + 8;
+        int stringBufSize = curStringBufPos;
+        int pdbSize = stringBufSize + mainBufSize + 8;  // 8 is for nOfEntries and string table size
+        initBuf(preambleSize + pdbSize);
+        setBufferIncreaseMode(false);
+
+        writePreamble(pdbSize);
+        writeStringTable(stringBufSize);
+        System.arraycopy(mainBuf, 0, buf, curBufPos, mainBufSize);
+        return buf;
+    }
+
+    private void writePreamble(int pdbSize) {
+        System.arraycopy(Utils.MAGIC, 0, buf, 0, Utils.MAGIC.length);
+        curBufPos += Utils.MAGIC.length;
+
+        writeInt(Utils.PDB_FORMAT_CODE_LATEST); // Version number
+        writeInt(pdbSize);
+        writeInt(pcd.size());
+    }
+
+    private void writeStringTable(int stringBufSize) {
+        writeInt(stringCount);
+        System.arraycopy(stringBuf, 0, buf, curBufPos, stringBufSize);
+        curBufPos += stringBufSize;
+    }
+
+    private void writePCDEntry(PCDEntry entry) {
+        writeStringRef(entry.className);
+        writeStringRef(entry.javaFileFullPath);
+        writeLong(entry.oldClassFileLastModified);
+        writeLong(entry.oldClassFileFingerprint);
+        writeClassInfo(entry.oldClassInfo);
+    }
+
+    private void writeClassInfo(ClassInfo ci) {
+        int i, j, len;
+
+        writeStringRef(ci.name);
+        writeInt(ci.javacTargetRelease);
+
+        len = ci.cpoolRefsToClasses != null ? ci.cpoolRefsToClasses.length : 0;
+        writeChar(len);
+        if (len > 0) {
+            String cpoolRefsToClasses[] = ci.cpoolRefsToClasses;
+            for (i = 0; i < len; i++) {
+                writeStringRef(cpoolRefsToClasses[i]);
+            }
+            boolean isRefClassArray[] = ci.isRefClassArray;
+            for (i = 0; i < len; i++) {
+                byte b = isRefClassArray[i] ? (byte) 1 : (byte) 0;
+                writeByte(b);
+            }
+        }
+
+        len = ci.cpoolRefsToFieldClasses != null ? ci.cpoolRefsToFieldClasses.length
+                : 0;
+        writeChar(len);
+        if (len > 0) {
+            String cpoolRefsToFieldClasses[] = ci.cpoolRefsToFieldClasses;
+            for (i = 0; i < len; i++) {
+                writeStringRef(cpoolRefsToFieldClasses[i]);
+            }
+            String cpoolRefsToFieldNames[] = ci.cpoolRefsToFieldNames;
+            for (i = 0; i < len; i++) {
+                writeStringRef(cpoolRefsToFieldNames[i]);
+            }
+            String cpoolRefsToFieldSignatures[] = ci.cpoolRefsToFieldSignatures;
+            for (i = 0; i < len; i++) {
+                writeStringRef(cpoolRefsToFieldSignatures[i]);
+            }
+        }
+
+        len = ci.cpoolRefsToMethodClasses != null ? ci.cpoolRefsToMethodClasses.length
+                : 0;
+        writeChar(len);
+        if (len > 0) {
+            String cpoolRefsToMethodClasses[] = ci.cpoolRefsToMethodClasses;
+            for (i = 0; i < len; i++) {
+                writeStringRef(cpoolRefsToMethodClasses[i]);
+            }
+            String cpoolRefsToMethodNames[] = ci.cpoolRefsToMethodNames;
+            for (i = 0; i < len; i++) {
+                writeStringRef(cpoolRefsToMethodNames[i]);
+            }
+            String cpoolRefsToMethodSignatures[] =
+                    ci.cpoolRefsToMethodSignatures;
+            for (i = 0; i < len; i++) {
+                writeStringRef(cpoolRefsToMethodSignatures[i]);
+            }
+        }
+
+        writeChar(ci.accessFlags);
+        byte b = ci.isNonMemberNestedClass ? (byte) 1 : (byte) 0;
+        writeByte(b);
+        if (!"java/lang/Object".equals(ci.name)) {
+            writeStringRef(ci.superName);
+        }
+
+        len = ci.interfaces != null ? ci.interfaces.length : 0;
+        writeChar(len);
+        if (len > 0) {
+            String interfaces[] = ci.interfaces;
+            for (i = 0; i < len; i++) {
+                writeStringRef(interfaces[i]);
+            }
+        }
+
+        len = ci.fieldNames != null ? ci.fieldNames.length : 0;
+        writeChar(len);
+        if (len > 0) {
+            String fieldNames[] = ci.fieldNames;
+            for (i = 0; i < len; i++) {
+                writeStringRef(fieldNames[i]);
+            }
+            String fieldSignatures[] = ci.fieldSignatures;
+            for (i = 0; i < len; i++) {
+                writeStringRef(fieldSignatures[i]);
+            }
+            char fieldAccessFlags[] = ci.fieldAccessFlags;
+            for (i = 0; i < len; i++) {
+                writeChar(fieldAccessFlags[i]);
+            }
+        }
+
+        len = ci.primitiveConstantInitValues != null ? ci.primitiveConstantInitValues.length
+                : 0;
+        writeChar(len);
+        if (len > 0) {
+            Object primitiveConstantInitValues[] =
+                    ci.primitiveConstantInitValues;
+            for (i = 0; i < len; i++) {
+                Object pc = primitiveConstantInitValues[i];
+                if (pc != null) {
+                    if (pc instanceof String) {
+                        writeByte((byte)1);
+                        writeStringRef((String) pc);
+                    } else if (pc instanceof Integer) {
+                        writeByte((byte)2);
+                        writeInt(((Integer) pc).intValue());
+                    } else if (pc instanceof Long) {
+                        writeByte((byte)3);
+                        writeLong(((Long) pc).longValue());
+                    } else if (pc instanceof Float) {
+                        writeByte((byte)4);
+                        writeFloat(((Float) pc).floatValue());
+                    } else if (pc instanceof Double) {
+                        writeByte((byte)5);
+                        writeDouble(((Double) pc).doubleValue());
+                    }
+                } else {
+                    writeByte((byte)0);
+                }
+            }
+        }
+
+        len = ci.methodNames != null ? ci.methodNames.length : 0;
+        writeChar(len);
+        if (len > 0) {
+            String methodNames[] = ci.methodNames;
+            for (i = 0; i < len; i++) {
+                writeStringRef(methodNames[i]);
+            }
+            String methodSignatures[] = ci.methodSignatures;
+            for (i = 0; i < len; i++) {
+                writeStringRef(methodSignatures[i]);
+            }
+            char methodAccessFlags[] = ci.methodAccessFlags;
+            for (i = 0; i < len; i++) {
+                writeChar(methodAccessFlags[i]);
+            }
+        }
+
+        len = ci.checkedExceptions != null ? ci.checkedExceptions.length : 0;
+        writeChar(len);
+        if (len > 0) {
+            String checkedExceptions[][] = ci.checkedExceptions;
+            for (i = 0; i < len; i++) {
+                int lenl = checkedExceptions[i] != null ? checkedExceptions[i].length
+                        : 0;
+                writeChar(lenl);
+                if (lenl > 0) {
+                    for (j = 0; j < lenl; j++) {
+                        writeStringRef(checkedExceptions[i][j]);
+                    }
+                }
+            }
+        }
+
+        len = ci.nestedClasses != null ? ci.nestedClasses.length : 0;
+        writeChar(len);
+        if (len > 0) {
+            String nestedClasses[] = ci.nestedClasses;
+            for (i = 0; i < len; i++) {
+                writeStringRef(nestedClasses[i]);
+            }
+        }
+    }
+
+    private void writeString(String s) {
+        byte sb[] = s.getBytes();
+        int len = sb.length;
+        if (curStringBufPos + len > curStringBufWatermark) {
+            // May need to adapt stringBufInc
+            if (len >= stringBufInc) {
+                stringBufInc = (stringBufInc + len) * 2;
+            } else {
+                stringBufInc = (stringBufInc * 5) / 4;  // Still increase a little - observations show that otherwise we usually get here 20 more times
+            }
+            byte newStringBuf[] = new byte[stringBuf.length + stringBufInc];
+            System.arraycopy(stringBuf, 0, newStringBuf, 0, curStringBufPos);
+            stringBuf = newStringBuf;
+            curStringBufWatermark = stringBuf.length - 20;
+        }
+        stringBuf[curStringBufPos++] = (byte) ((len >> 8) & 255);
+        stringBuf[curStringBufPos++] = (byte) (len & 255);
+        System.arraycopy(sb, 0, stringBuf, curStringBufPos, len);
+        curStringBufPos += len;
+    }
+
+    private void writeStringRef(String s) {
+        int stringRef = stringHashTable.get(s);
+        if (stringRef == -1) {
+            stringHashTable.add(s, stringCount);
+            stringRef = stringCount;
+            writeString(s);
+            stringCount++;
+        }
+        writeInt(stringRef);
+    }
+
+    /** Maps Strings to integer numbers (their positions in String table) */
+    static class StringHashTable {
+
+        String keys[];
+        int values[];
+        int size, nOfElements, watermark;
+
+        StringHashTable(int size) {
+            size = makeLikePrimeNumber(size);
+            this.size = size;
+            keys = new String[size];
+            values = new int[size];
+            nOfElements = 0;
+            watermark = size * 3 / 4;
+        }
+
+        final int get(String key) {
+            int pos = (key.hashCode() & 0x7FFFFFFF) % size;
+
+            while (keys[pos] != null && !keys[pos].equals(key)) {
+                pos = (pos + 3) % size; // Relies on the fact that size % 3 != 0
+            }
+            if (key.equals(keys[pos])) {
+                return values[pos];
+            } else {
+                return -1;
+            }
+        }
+
+        final void add(String key, int value) {
+            if (nOfElements > watermark) {
+                rehash();
+            }
+
+            int pos = (key.hashCode() & 0x7FFFFFFF) % size;
+            while (keys[pos] != null) {
+                pos = (pos + 3) % size;  // Relies on the fact that size % 3 != 0
+            }
+            keys[pos] = key;
+            values[pos] = value;
+            nOfElements++;
+        }
+
+        private final void rehash() {
+            String oldKeys[] = keys;
+            int oldValues[] = values;
+            int oldSize = size;
+            size = makeLikePrimeNumber(size * 3 / 2);
+            keys = new String[size];
+            values = new int[size];
+            nOfElements = 0;
+            watermark = size * 3 / 4;
+
+            for (int i = 0; i < oldSize; i++) {
+                if (oldKeys[i] != null) {
+                    add(oldKeys[i], oldValues[i]);
+                }
+            }
+        }
+
+        private final int makeLikePrimeNumber(int no) {
+            no = (no / 2) * 2 + 1;  // Make it an odd number
+            // Find the nearest "approximately prime" number
+            boolean prime = false;
+            do {
+                no += 2;
+                prime =
+                        (no % 3 != 0 && no % 5 != 0 && no % 7 != 0 && no % 11 != 0 &&
+                        no % 13 != 0 && no % 17 != 0 && no % 19 != 0 && no % 23 != 0 &&
+                        no % 29 != 0 && no % 31 != 0 && no % 37 != 0 && no % 41 != 0);
+            } while (!prime);
+            return no;
+        }
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/ClassFileReader.java b/third_party/jmake/src/org/pantsbuild/jmake/ClassFileReader.java
new file mode 100644
index 0000000..3ece22d9
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/ClassFileReader.java
@@ -0,0 +1,595 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.lang.reflect.Modifier;
+
+
+/**
+ * This class implements reading a byte array representing a class file and converting it into ClassInfo.
+ *
+ * @author  Misha Dmitriev
+ *  2 March 2005
+ */
+public class ClassFileReader extends BinaryFileReader {
+
+    public static final int JAVA_MAGIC = -889275714;    // 0xCAFEBABE
+    public static final int JAVA_MINOR_VERSION = 0;
+    public static final int JAVA_MIN_MAJOR_VERSION = 45;
+    public static final int JAVA_MIN_MINOR_VERSION = 3;
+    public static final int DEFAULT_MAJOR_VERSION = 46;
+    public static final int DEFAULT_MINOR_VERSION = 0;
+    public static final int JDK14_MAJOR_VERSION = 48;
+    public static final int JDK15_MAJOR_VERSION = 49;
+    public static final int JDK16_MAJOR_VERSION = 50;
+    public static final int JDK17_MAJOR_VERSION = 51;
+    public static final int JDK18_MAJOR_VERSION = 52;
+    public static final int CONSTANT_Utf8 = 1;
+    public static final int CONSTANT_Unicode = 2;
+    public static final int CONSTANT_Integer = 3;
+    public static final int CONSTANT_Float = 4;
+    public static final int CONSTANT_Long = 5;
+    public static final int CONSTANT_Double = 6;
+    public static final int CONSTANT_Class = 7;
+    public static final int CONSTANT_String = 8;
+    public static final int CONSTANT_Fieldref = 9;
+    public static final int CONSTANT_Methodref = 10;
+    public static final int CONSTANT_InterfaceMethodref = 11;
+    public static final int CONSTANT_NameandType = 12;
+    public static final int CONSTANT_MethodHandle = 15;
+    public static final int CONSTANT_MethodType = 16;
+    public static final int CONSTANT_InvokeDynamic = 18;
+    private ClassInfo classInfo = null;
+    private int cpOffsets[];
+    private Object cpObjectCache[];
+    private byte cpTags[];
+
+    public void readClassFile(byte[] classFile, ClassInfo classInfo, String classFileFullPath, boolean readFullInfo) {
+        initBuf(classFile, classFileFullPath);
+        this.classInfo = classInfo;
+
+        readPreamble();
+        readConstantPool(readFullInfo);
+        readIntermediate();
+        if (readFullInfo) {
+            readFields();
+            readMethods();
+            readAttributes();
+        }
+    }
+
+    private int versionWord(int major, int minor) {
+        return major * 1000 + minor;
+    }
+
+    private void readPreamble() {
+        int magic = nextInt();
+        if (magic != JAVA_MAGIC) {
+            throw classFileParseException("Illegal start of class file");
+        }
+        int minorVersion = nextChar();
+        int majorVersion = nextChar();
+        if (majorVersion > JDK14_MAJOR_VERSION ||
+                versionWord(majorVersion, minorVersion) <
+                versionWord(JAVA_MIN_MAJOR_VERSION, JAVA_MIN_MINOR_VERSION) ) {
+            if (majorVersion == JDK18_MAJOR_VERSION) {
+                classInfo.javacTargetRelease = Utils.JAVAC_TARGET_RELEASE_18;
+            } else if (majorVersion == JDK17_MAJOR_VERSION) {
+                classInfo.javacTargetRelease = Utils.JAVAC_TARGET_RELEASE_17;
+            } else if (majorVersion == JDK16_MAJOR_VERSION) {
+                classInfo.javacTargetRelease = Utils.JAVAC_TARGET_RELEASE_16;
+            } else if (majorVersion == JDK15_MAJOR_VERSION) {
+                classInfo.javacTargetRelease = Utils.JAVAC_TARGET_RELEASE_15;
+            } else {
+                throw classFileParseException("Wrong version: " + majorVersion + "." + minorVersion);
+            }
+        } else {
+            classInfo.javacTargetRelease = Utils.JAVAC_TARGET_RELEASE_OLDEST;
+        }
+    }
+
+    private void readConstantPool(boolean readFullInfo) {
+        int classRefsNo = 0;
+        int fieldRefsNo = 0;
+        int methodRefsNo = 0;
+
+        cpOffsets = new int[nextChar()];
+        cpTags = new byte[cpOffsets.length];
+        int ofs, len, classIdx, nameAndTypeIdx, nameIdx, sigIdx, utf8Idx;
+        int i = 1;
+        while (i < cpOffsets.length) {
+            byte tag = buf[curBufPos++];
+            cpOffsets[i] = curBufPos;
+            cpTags[i] = tag;
+            i++;
+            switch (tag) {
+                case CONSTANT_Utf8:
+                    len = nextChar();
+                    curBufPos += len;
+                    break;
+
+                case CONSTANT_Class:
+                    classRefsNo++;
+                    curBufPos += 2;
+                    break;
+
+                case CONSTANT_String:
+                case CONSTANT_MethodType:
+                    curBufPos += 2;
+                    break;
+
+                case CONSTANT_Fieldref:
+                    fieldRefsNo++;
+                    curBufPos += 4;
+                    break;
+
+                case CONSTANT_Methodref:
+                case CONSTANT_InterfaceMethodref:
+                    methodRefsNo++;
+                    curBufPos += 4;
+                    break;
+
+                case CONSTANT_MethodHandle:
+                    curBufPos += 3;
+                    break;
+
+                case CONSTANT_NameandType:
+                case CONSTANT_Integer:
+                case CONSTANT_Float:
+                case CONSTANT_InvokeDynamic:
+                    curBufPos += 4;
+                    break;
+
+                case CONSTANT_Long:
+                case CONSTANT_Double:
+                    curBufPos += 8;
+                    i++;
+                    break;
+
+                default:
+                    throw classFileParseException("Bad constant pool tag: " + tag + " at " + Integer.toString(curBufPos - 1));
+            }
+        }
+
+        cpObjectCache = new Object[cpOffsets.length];
+        if (!readFullInfo) {
+            return;
+        }
+
+        classInfo.cpoolRefsToClasses = new String[classRefsNo];
+        classInfo.isRefClassArray = new boolean[classRefsNo];
+        classInfo.cpoolRefsToFieldClasses = new String[fieldRefsNo];
+        classInfo.cpoolRefsToFieldNames = new String[fieldRefsNo];
+        classInfo.cpoolRefsToFieldSignatures = new String[fieldRefsNo];
+        classInfo.cpoolRefsToMethodClasses = new String[methodRefsNo];
+        classInfo.cpoolRefsToMethodNames = new String[methodRefsNo];
+        classInfo.cpoolRefsToMethodSignatures = new String[methodRefsNo];
+
+        int curClassRef = 0;
+        int curFieldRef = 0;
+        int curMethodRef = 0;
+
+        for (i = 0; i < cpOffsets.length; i++) {
+            ofs = cpOffsets[i];
+            switch (cpTags[i]) {
+                case CONSTANT_Class:
+                    utf8Idx = getChar(ofs);
+                    classInfo.cpoolRefsToClasses[curClassRef++] =
+                            classNameAtCPIndex(utf8Idx, classInfo.isRefClassArray, curClassRef - 1);
+                    //System.out.println("Read cpool ref to class: " + classInfo.cpoolRefsToClasses[curClassRef-1]);
+                    break;
+
+                case CONSTANT_Fieldref:
+                    classIdx = getChar(ofs);
+                    nameAndTypeIdx = getChar(ofs + 2);
+                    if (cpTags[classIdx] != CONSTANT_Class || cpTags[nameAndTypeIdx] != CONSTANT_NameandType) {
+                        badCPReference(ofs, i);
+                    }
+                    classInfo.cpoolRefsToFieldClasses[curFieldRef] =
+                            classNameAtCPIndex(getChar(cpOffsets[classIdx]));
+
+                    ofs = cpOffsets[nameAndTypeIdx];
+                    nameIdx = getChar(ofs);
+                    sigIdx = getChar(ofs + 2);
+                    if (cpTags[nameIdx] != CONSTANT_Utf8 || cpTags[sigIdx] != CONSTANT_Utf8) {
+                        badCPReference(ofs, i);
+                    }
+                    classInfo.cpoolRefsToFieldNames[curFieldRef] =
+                            utf8AtCPIndex(nameIdx);
+                    classInfo.cpoolRefsToFieldSignatures[curFieldRef] =
+                            signatureAtCPIndex(sigIdx);
+                    //System.out.println("Read cpool ref to field: " + classInfo.cpoolRefsToFieldNames[curFieldRef] + " " +
+                    //                   classInfo.cpoolRefsToFieldSignatures[curFieldRef]);
+                    curFieldRef++;
+                    break;
+
+                case CONSTANT_Methodref:
+                case CONSTANT_InterfaceMethodref:
+                    classIdx = getChar(ofs);
+                    nameAndTypeIdx = getChar(ofs + 2);
+                    if (cpTags[classIdx] != CONSTANT_Class || cpTags[nameAndTypeIdx] != CONSTANT_NameandType) {
+                        badCPReference(ofs, i);
+                    }
+                    classInfo.cpoolRefsToMethodClasses[curMethodRef] =
+                            classNameAtCPIndex(getChar(cpOffsets[classIdx]));
+
+                    ofs = cpOffsets[nameAndTypeIdx];
+                    nameIdx = getChar(ofs);
+                    sigIdx = getChar(ofs + 2);
+                    if (cpTags[nameIdx] != CONSTANT_Utf8 || cpTags[sigIdx] != CONSTANT_Utf8) {
+                        badCPReference(ofs, i);
+                    }
+                    classInfo.cpoolRefsToMethodNames[curMethodRef] =
+                            utf8AtCPIndex(nameIdx);
+                    classInfo.cpoolRefsToMethodSignatures[curMethodRef] =
+                            signatureAtCPIndex(sigIdx);
+                    //System.out.println("Read cpool ref to method: " + classInfo.cpoolRefsToMethodNames[curMethodRef] + " " +
+                    //                   classInfo.cpoolRefsToMethodSignatures[curMethodRef]);
+                    curMethodRef++;
+                    break;
+            }
+        }
+    }
+
+    private void readIntermediate() {
+        int i, classIdx, superClassIdx;
+
+        classInfo.accessFlags = nextChar();
+        classIdx = nextChar();
+        if (cpTags[classIdx] != CONSTANT_Class) {
+            throw classFileParseException("Bad reference to this class name");
+        }
+        classInfo.name = classNameAtCPIndex(getChar(cpOffsets[classIdx]));
+        superClassIdx = nextChar();
+        if (!"java/lang/Object".equals(classInfo.name)) {
+            if (cpTags[superClassIdx] != CONSTANT_Class) {
+                throw classFileParseException("Bad reference to super class name");
+            }
+            classInfo.superName =
+                    classNameAtCPIndex(getChar(cpOffsets[superClassIdx]));
+        }
+
+        char intfCount = nextChar();
+        if (intfCount != 0) {
+            classInfo.interfaces = new String[intfCount];
+            for (i = 0; i < intfCount; i++) {
+                classIdx = nextChar();
+                if (cpTags[classIdx] != CONSTANT_Class) {
+                    throw classFileParseException("Bad reference to an implemented interface");
+                }
+                classInfo.interfaces[i] =
+                        classNameAtCPIndex(getChar(cpOffsets[classIdx]));
+            }
+        }
+    }
+
+    private void readFields() {
+        int i, j;
+
+        char definedFieldCount = nextChar();
+        if (definedFieldCount == 0) {
+            return;
+        }
+
+        String names[] = new String[definedFieldCount];
+        String signatures[] = new String[definedFieldCount];
+        char accessFlags[] = new char[definedFieldCount];
+
+        // We are not going to record information on private fields which have either primitive or non-project-class
+        // (typically core-class) types. Such fields cannot affect anything except their own class, so we don't need them.
+        int ri = 0;
+
+        for (i = 0; i < definedFieldCount; i++) {
+            char flags = nextChar();
+            String name = utf8AtCPIndex(nextChar());
+            String sig = signatureAtCPIndex(nextChar());
+
+            boolean recordField =
+                    !(Modifier.isPrivate(flags) &&
+                    (ClassInfo.isPrimitiveFieldSig(sig) || classInfo.isNonProjectClassTypeFieldSig(sig)));
+
+            int attrCount = nextChar();
+            for (j = 0; j < attrCount; j++) {
+                int attrNameIdx = nextChar();
+                int attrLen = nextInt();
+                if (recordField && utf8AtCPIndex(attrNameIdx).equals("ConstantValue") &&
+                        Modifier.isFinal(flags)) {
+                    if (classInfo.primitiveConstantInitValues == null) {
+                        classInfo.primitiveConstantInitValues =
+                                new Object[definedFieldCount];
+                    }
+                    int constValueIdx = nextChar();
+                    switch (cpTags[constValueIdx]) {
+                        case CONSTANT_String:
+                            classInfo.primitiveConstantInitValues[ri] =
+                                    utf8AtCPIndex(getChar(cpOffsets[constValueIdx]));
+                            break;
+
+                        case CONSTANT_Integer:
+                            classInfo.primitiveConstantInitValues[ri] =
+                                    Integer.valueOf(getInt(cpOffsets[constValueIdx]));
+                            break;
+
+                        case CONSTANT_Long:
+                            classInfo.primitiveConstantInitValues[ri] =
+                                    Long.valueOf(getLong(cpOffsets[constValueIdx]));
+                            break;
+
+                        case CONSTANT_Float:
+                            classInfo.primitiveConstantInitValues[ri] =
+                                    Float.valueOf(getFloat(cpOffsets[constValueIdx]));
+                            break;
+
+                        case CONSTANT_Double:
+                            classInfo.primitiveConstantInitValues[ri] =
+                                    Double.valueOf(getDouble(cpOffsets[constValueIdx]));
+                            break;
+
+                        default:
+                            badCPEntry(constValueIdx);
+                    }
+
+                } else {
+                    curBufPos += attrLen;
+                }
+            }
+
+            if (recordField) {
+                names[ri] = name;
+                signatures[ri] = sig;
+                accessFlags[ri] = flags;
+                ri++;
+            }
+        }
+
+        if (ri == definedFieldCount) {
+            classInfo.fieldNames = names;
+            classInfo.fieldSignatures = signatures;
+            classInfo.fieldAccessFlags = accessFlags;
+        } else if (ri > 0) {
+            classInfo.fieldNames = new String[ri];
+            classInfo.fieldSignatures = new String[ri];
+            classInfo.fieldAccessFlags = new char[ri];
+            System.arraycopy(names, 0, classInfo.fieldNames, 0, ri);
+            System.arraycopy(signatures, 0, classInfo.fieldSignatures, 0, ri);
+            System.arraycopy(accessFlags, 0, classInfo.fieldAccessFlags, 0, ri);
+        }
+    }
+
+    private void readMethods() {
+        int i, j;
+
+        char methodCount = nextChar();
+        if (methodCount == 0) {
+            return;
+        }
+
+        String names[] = new String[methodCount];
+        String signatures[] = new String[methodCount];
+        char accessFlags[] = new char[methodCount];
+
+        for (i = 0; i < methodCount; i++) {
+            accessFlags[i] = nextChar();
+            names[i] = utf8AtCPIndex(nextChar());
+            signatures[i] = signatureAtCPIndex(nextChar());
+
+            int attrCount = nextChar();
+            for (j = 0; j < attrCount; j++) {
+                int attrNameIdx = nextChar();
+                int attrLen = nextInt();
+                if (utf8AtCPIndex(attrNameIdx).equals("Exceptions")) {
+                    if (classInfo.checkedExceptions == null) {
+                        classInfo.checkedExceptions = new String[methodCount][];
+                    }
+                    int nExceptions = nextChar();
+                    String exceptions[] = new String[nExceptions];
+                    for (int k = 0; k < nExceptions; k++) {
+                        int excClassIdx = nextChar();
+                        if (cpTags[excClassIdx] != CONSTANT_Class) {
+                            badCPEntry(excClassIdx);
+                        }
+                        exceptions[k] =
+                                classNameAtCPIndex(getChar(cpOffsets[excClassIdx]));
+                    }
+                    classInfo.checkedExceptions[i] = exceptions;
+                } else {
+                    curBufPos += attrLen;
+                }
+            }
+        }
+
+        classInfo.methodNames = names;
+        classInfo.methodSignatures = signatures;
+        classInfo.methodAccessFlags = accessFlags;
+    }
+
+    /**
+     * This method actually reads only the information related to the nested classes, and
+     * records only those of them which are first level nested classes of this class. The class
+     * may also reference other classes which are not package members through the same
+     * InnerClasses attribute - their names would be processed when their respective enclosing
+     * classes are read.
+     */
+    private void readAttributes() {
+        String nestedClassPrefix = classInfo.name + "$";
+
+        char attrCount = nextChar();
+
+        for (int i = 0; i < attrCount; i++) {
+            int attrNameIdx = nextChar();
+            int attrLen = nextInt();
+            if (utf8AtCPIndex(attrNameIdx).equals("InnerClasses")) {
+                int nOfClasses = nextChar();
+                String nestedClasses[] = new String[nOfClasses];
+                char nestedClassAccessFlags[] = new char[nOfClasses];
+                boolean nestedClassNonMember[] = new boolean[nOfClasses];
+                int curIdx = 0;
+                for (int j = 0; j < nOfClasses; j++) {
+                    int innerClassInfoIdx = nextChar();
+                    int outerClassInfoIdx = nextChar();
+                    int innerClassNameIdx = nextChar();
+                    char innerClassAccessFlags = nextChar();
+
+                    // Even if a class is private or non-member (innerClassAccessFlags has private bit set or
+                    // outerClassInfoIdx == 0), we still should take this class into account, since it may e.g. extend
+                    // a public class/implement a public interface, which, in turn, may be changed incompatibly.
+
+                    String nestedClassFullName = classNameAtCPIndex(getChar(cpOffsets[innerClassInfoIdx]));
+
+                    // We are only interested the nested classes whose enclosing class is this one.
+                    if (!nestedClassFullName.startsWith(nestedClassPrefix))
+                        continue;
+
+                    // We are only interested in the directly nested classes of this class.
+                    String nestedClassNameSuffix = nestedClassFullName.substring(nestedClassPrefix.length());
+
+                    if (innerClassNameIdx == 0) {
+                        // Nested class is anonymous. Suffix must be all digits.
+                        if (findFirstNonDigit(nestedClassNameSuffix) != -1)
+                            continue;
+                    } else {
+                        // Nested class is named.
+                        String nestedClassSimpleName = utf8AtCPIndex(innerClassNameIdx);
+                        // The simple case is Outer$Inner.
+                        if (!nestedClassNameSuffix.equals(nestedClassSimpleName)) {
+                            // The more complicated case is a local class. In JDK 1.5+ These are named,
+                            // e.g., Outer$1Inner. Pre-JDK 1.5 they are named e.g., Outer$1$Inner.
+                            int p = findFirstNonDigit(nestedClassNameSuffix);
+                            if (p == -1)
+                                continue;
+                            if (classInfo.javacTargetRelease == Utils.JAVAC_TARGET_RELEASE_OLDEST &&
+                                nestedClassNameSuffix.charAt(p++) != '$')
+                                continue;
+                            if (!nestedClassNameSuffix.substring(p).equals(nestedClassSimpleName))
+                                continue;
+                        }
+                    }
+
+                    // The name has passed all checks, so register it.
+
+                    nestedClasses[curIdx] = nestedClassFullName;
+                    nestedClassAccessFlags[curIdx] = innerClassAccessFlags;
+                    nestedClassNonMember[curIdx] = (outerClassInfoIdx == 0);
+                    curIdx++;
+                }
+                if (curIdx == nOfClasses) {
+                    classInfo.nestedClasses = nestedClasses;
+                    classInfo.nestedClassAccessFlags = nestedClassAccessFlags;
+                    classInfo.nestedClassNonMember = nestedClassNonMember;
+                } else if (curIdx > 0) {
+                    // We found fewer nested classes for this class than we originally expected, but still more than 0.
+                    // Create a new array to fit their number exactly.
+                    classInfo.nestedClasses = new String[curIdx];
+                    classInfo.nestedClassAccessFlags = new char[curIdx];
+                    classInfo.nestedClassNonMember = new boolean[curIdx];
+                    System.arraycopy(nestedClasses, 0, classInfo.nestedClasses, 0, curIdx);
+                    System.arraycopy(nestedClassAccessFlags, 0, classInfo.nestedClassAccessFlags, 0, curIdx);
+                    System.arraycopy(nestedClassNonMember, 0, classInfo.nestedClassNonMember, 0, curIdx);
+                }
+            } else {
+                curBufPos += attrLen;
+            }
+        }
+    }
+
+    private int findFirstNonDigit(String s) {
+        for (int i = 0; i < s.length(); i++) {
+            if (!Character.isDigit(s.charAt(i)))
+                return i;
+        }
+        return -1;
+    }
+
+    private String utf8AtCPIndex(int idx) {
+        if (cpTags[idx] != CONSTANT_Utf8) {
+            throw classFileParseException("Constant pool entry " + idx + " should be UTF8 constant");
+        }
+        if (cpObjectCache[idx] == null) {
+            int utf8Len = getChar(cpOffsets[idx]);
+            // String interning reduces the size of the disk database very significantly
+            // (by one-third in one observed case), and also speeds up database search.
+            cpObjectCache[idx] =
+                    (new String(buf, cpOffsets[idx] + 2, utf8Len)).intern();
+        }
+        return (String) cpObjectCache[idx];
+    }
+
+    private String classNameAtCPIndex(int idx) {
+        return classNameAtCPIndex(idx, null, 0);
+    }
+
+    /**
+     * Read class name at the given CONSTANT_Utf8 constant pool index, and return it
+     * trimmed of the possible '[' and 'L' prefixes and the ';' suffix.
+     */
+    private String classNameAtCPIndex(int idx, boolean isRefClassArray[], int isArrayIdx) {
+        if (cpTags[idx] != CONSTANT_Utf8) {
+            throw classFileParseException("Constant pool entry " + idx + " should be UTF8 constant");
+        }
+        boolean isArray = false;
+        if (cpObjectCache[idx] == null) {
+            int utf8Len = getChar(cpOffsets[idx]);
+            int stPos = cpOffsets[idx] + 2;
+            int initStPos = stPos;
+            while (buf[stPos] == '[') {
+                stPos++;
+            }
+            if (stPos != initStPos) {
+                isArray = true;
+                if (buf[stPos] == 'L') {
+                    stPos++;
+                    utf8Len--;  // To get rid of the terminating ';'
+                }
+            }
+            utf8Len = utf8Len - (stPos - initStPos);
+            cpObjectCache[idx] = (new String(buf, stPos, utf8Len)).intern();
+            if (isRefClassArray != null) {
+                isRefClassArray[isArrayIdx] = isArray;
+            }
+        }
+        return (String) cpObjectCache[idx];
+    }
+
+    // We replace all "Lclassname;" in signatures with "@classname#" to simplify signature parsing during reference checking
+    private String signatureAtCPIndex(int idx) {
+        if (cpTags[idx] != CONSTANT_Utf8) {
+            throw classFileParseException("Constant pool entry " + idx + " should be UTF8 constant");
+        }
+        if (cpObjectCache[idx] == null) {
+            int utf8Len = getChar(cpOffsets[idx]);
+            byte tmp[] = new byte[utf8Len];
+            System.arraycopy(buf, cpOffsets[idx] + 2, tmp, 0, utf8Len);
+            boolean inClassName = false;
+            for (int i = 0; i < utf8Len; i++) {
+                if (!inClassName) {
+                    if (tmp[i] == 'L') {
+                        tmp[i] = '@';
+                        inClassName = true;
+                    }
+                } else if (tmp[i] == ';') {
+                    tmp[i] = '#';
+                    inClassName = false;
+                }
+            }
+            cpObjectCache[idx] = (new String(tmp)).intern();
+        }
+        return (String) cpObjectCache[idx];
+    }
+
+    private void badCPReference(int ofs, int i) {
+        throw classFileParseException("Bad constant pool reference: " + ofs + " from entry " + i);
+    }
+
+    private void badCPEntry(int entryNo) {
+        throw classFileParseException("Constant pool entry " + entryNo + " : invalid type");
+    }
+
+    private PrivateException classFileParseException(String msg) {
+        return new PrivateException(new PublicExceptions.ClassFileParseException(
+                "Error reading class file " + fileFullPath + ":\n" + msg));
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/ClassInfo.java b/third_party/jmake/src/org/pantsbuild/jmake/ClassInfo.java
new file mode 100644
index 0000000..9bfcd5a
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/ClassInfo.java
@@ -0,0 +1,746 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.Serializable;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * A reflection of a class, in the form that allows fast checks and information obtaining.
+ *
+ * @author Misha Dmitriev
+ *  5 April 2004
+ */
+@SuppressWarnings("serial")
+public class ClassInfo implements Serializable {
+
+    public static final int VER_OLD = 0;  // Old version
+    public static final int VER_NEW = 1;  // New version
+    public static final int NO_VERSIONS = 2;  // Non-project class, no change tracking
+    private transient PCDManager pcdm;
+    transient int verCode;                          // Version code for this ClassInfo - one of the above.
+    String name = null;
+    transient String packageName;                   // Package name; restored when database is reloaded
+    int javacTargetRelease = Utils.JAVAC_TARGET_RELEASE_OLDEST; // Can have values from Utils.JAVAC_TARGET_RELEASE_xxx
+    String cpoolRefsToClasses[];          // Directly referenced class names trimmed of array and 'L' prefixes and ';' suffixes
+    boolean isRefClassArray[];            // Indicates if a directly referenced class is actually an array class
+    // In all signatures we replace the 'L' and ';' symbols that enclose non-primitive type names with '@' and '#' respectively,
+    // so that class names inside signatures can be located fast and unambiguously.
+    String cpoolRefsToFieldClasses[];     // Defining classes of referenced fields, trimmed of enclosing 'L' and ';' symbols
+    String cpoolRefsToFieldNames[];       // Names of referenced fields
+    String cpoolRefsToFieldSignatures[];  // Signatures of referenced fields
+    String cpoolRefsToMethodClasses[];    // Defining classes of referenced methods, trimmed of enclosing 'L' and ';' symbols
+    String cpoolRefsToMethodNames[];      // Names of referenced methods
+    String cpoolRefsToMethodSignatures[]; // Signatures of referenced methods
+    char accessFlags;                     // isInterface flag included
+    boolean isNonMemberNestedClass = false; // True if this is a non-member nested class
+    String superName;
+    String interfaces[];
+    String fieldNames[];
+    String fieldSignatures[];
+    char fieldAccessFlags[];
+    Object primitiveConstantInitValues[];
+    String methodNames[];
+    String methodSignatures[];
+    char methodAccessFlags[];
+    String checkedExceptions[][];
+    transient ClassInfo directSubclasses[];       // Direct subclasses. Created lazily and not preserved on disk.
+    transient String directlyEnclosingClass;      // Directly enclosing class name; restored when database is reloaded
+    transient String topLevelEnclosingClass;      // Top-level enclosing class name; restored when database is reloaded
+    String nestedClasses[];             // Names of all nested classes. Don't make transient - it's used to check
+    // if nested classes for this class were added/deleted in new version
+    transient char nestedClassAccessFlags[];      // No need to store this information permanently
+    transient boolean nestedClassNonMember[];     // Ditto
+
+    /** Creates new ClassInfo out of a class file. The last parameter is needed only to produce sensible error reports.*/
+    public ClassInfo(byte[] classFileBytes, int verCode, PCDManager pcdm, String classFileFullPath) {
+        this.pcdm = pcdm;
+        this.verCode = verCode;
+        pcdm.getClassFileReader().readClassFile(classFileBytes, this, classFileFullPath, true);
+        packageName = Utils.getPackageName(name);
+        directlyEnclosingClass =
+                Utils.getDirectlyEnclosingClass(name, this.javacTargetRelease);
+        topLevelEnclosingClass = Utils.getTopLevelEnclosingClass(name);
+    }
+
+    /**
+     * Create a "lightweight" ClassInfo, that contains just the class name, super name, interfaces, flags and verCode.
+     * Used for non-project classes, that don't change themselves, for which we are only interested in type hierarchy structure.
+     */
+    public ClassInfo(byte[] classFileBytes, PCDManager pcdm, String classFileFullPath) {
+        this.pcdm = pcdm;
+        this.verCode = NO_VERSIONS;
+        pcdm.getClassFileReader().readClassFile(classFileBytes, this, classFileFullPath, false);
+        packageName = Utils.getPackageName(name);
+        directlyEnclosingClass =
+                Utils.getDirectlyEnclosingClass(name, this.javacTargetRelease);
+        topLevelEnclosingClass = Utils.getTopLevelEnclosingClass(name);
+    }
+
+    /** Even more lightweight variant - created for a deleted non-project class, to enable minimum possible checks. */
+    public ClassInfo(String name, PCDManager pcdm) {
+        this.pcdm = pcdm;
+        this.verCode = NO_VERSIONS;
+        this.name = name;
+        packageName = Utils.getPackageName(name);
+        directlyEnclosingClass = Utils.getDirectlyEnclosingClass(name, 0);
+        topLevelEnclosingClass = Utils.getTopLevelEnclosingClass(name);
+    }
+
+    public ClassInfo() {
+    }
+
+    /** Initialize transient data that can be initialized immediately after this ClassInfo is read from the project database */
+    public void initializeImmediateTransientFields() {
+        verCode = VER_OLD;
+
+        packageName = Utils.getPackageName(name);
+
+        directlyEnclosingClass =
+                Utils.getDirectlyEnclosingClass(name, this.javacTargetRelease);
+        topLevelEnclosingClass = Utils.getTopLevelEnclosingClass(name);
+    }
+
+    /**
+     * Called to restore the pointer to the current PCDManager after this ClassInfo is brought back
+     * from the store.
+     */
+    public void restorePCDM(PCDManager pcdm) {
+        this.pcdm = pcdm;
+    }
+
+    public boolean isInterface() {
+        return Modifier.isInterface(accessFlags);
+    }
+
+    public boolean isAbstract() {
+        return Modifier.isAbstract(accessFlags);
+    }
+
+    public boolean isPublic() {
+        return Modifier.isPublic(accessFlags);
+    }
+
+    /**
+     * Returns the names of the superclasses of the given class (transitively), that belong
+     * to the same project, plus those of the superclasses that can be found on the class path
+     * supplied to jmake, and on the boot class path.
+     */
+    public List<String> getAllSuperclassNames() {
+        List<String> res = new ArrayList<String>();
+        String superName = this.superName;
+        while (superName != null && !"java/lang/Object".equals(superName)) {
+            res.add(superName);
+            ClassInfo classInfo = pcdm.getClassInfoForName(verCode, superName);
+            if (classInfo == null) { // Class not in project (or deleted?). Try to find it and further superclasses in non-project classes
+                ClassPath.getSuperclasses(superName, res, pcdm);
+                break;
+            }
+            superName = classInfo.superName;
+        }
+        return res;
+    }
+
+    /**
+     * Returns the set of names of the interfaces transitively implemented by the given
+     * class, that belong to the same project.
+     */
+    public Set<String> getAllImplementedIntfNames() {
+        Set<String> res = new LinkedHashSet<String>();
+        addImplementedInterfaceNames(false, res);
+        return res;
+    }
+
+    /** Add to the given set the names of direct/all interfaces implemented by the given class. */
+    private void addImplementedInterfaceNames(boolean directOnly,
+            Set<String> intfSet) {
+        if (interfaces != null) {
+            for (int i = 0; i < interfaces.length; i++) {
+                String superIntfName = interfaces[i];
+                intfSet.add(superIntfName);
+                if (directOnly) {
+                    continue;
+                }
+                ClassInfo superIntfInfo =
+                        pcdm.getClassInfoForName(verCode, superIntfName);
+                if (superIntfInfo == null) {  // Class not in project
+                    ClassPath.addAllImplementedInterfaceNames(superIntfName, intfSet, pcdm);
+                } else {
+                    superIntfInfo.addImplementedInterfaceNames(false, intfSet);
+                }
+            }
+        }
+
+        if (directOnly || superName == null ||
+                "java/lang/Object".equals(superName)) {
+            return;
+        }
+        ClassInfo superInfo = pcdm.getClassInfoForName(verCode, superName);
+        if (superInfo == null) {  // Class not in project
+            ClassPath.addAllImplementedInterfaceNames(superName, intfSet, pcdm);
+        } else {
+            superInfo.addImplementedInterfaceNames(false, intfSet);
+        }
+    }
+
+    /** Returns the array of all direct subclasses of this class (array of zero length if there are none). */
+    public ClassInfo[] getDirectSubclasses() {
+        if (directSubclasses != null) {
+            return directSubclasses;
+        }
+
+        List<ClassInfo> listRes = new ArrayList<ClassInfo>();
+
+        for (PCDEntry entry : pcdm.entries()) {
+            ClassInfo classInfo = pcdm.getClassInfoForPCDEntry(verCode, entry);
+            if (classInfo == null) {
+                continue;  // New or deleted class, depending on verCode
+            }
+            if (classInfo.superName.equals(name)) {
+                listRes.add(classInfo);
+            }
+        }
+
+        directSubclasses = listRes.toArray(new ClassInfo[listRes.size()]);
+        return directSubclasses;
+    }
+
+    /** Check if the initial values for the given primitive constatnts in two classes are the same. */
+    public static boolean constFieldInitValuesEqual(ClassInfo oldClassInfo, int oldFieldNo,
+            ClassInfo newClassInfo, int newFieldNo) {
+        Object oldInitValue = oldClassInfo.primitiveConstantInitValues == null ? null
+                : oldClassInfo.primitiveConstantInitValues[oldFieldNo];
+        Object newInitValue = newClassInfo.primitiveConstantInitValues == null ? null
+                : newClassInfo.primitiveConstantInitValues[newFieldNo];
+        if (oldInitValue == newInitValue) {
+            return true;
+        }
+        if (oldInitValue == null || newInitValue == null) {
+            return false;
+        }
+
+        if (oldInitValue instanceof Integer) {
+            if (((Integer) oldInitValue).intValue() == ((Integer) newInitValue).intValue()) {
+                return true;
+            } else {
+                return false;
+            }
+        } else if (oldInitValue instanceof String) {
+            if ( ((String) oldInitValue).equals((String) newInitValue) ) {
+                return true;
+            } else {
+                return false;
+            }
+        } else if (oldInitValue instanceof Long) {
+            if (((Long) oldInitValue).longValue() == ((Long) newInitValue).longValue()) {
+                return true;
+            } else {
+                return false;
+            }
+        } else if (oldInitValue instanceof Float) {
+            if (((Float) oldInitValue).floatValue() == ((Float) newInitValue).floatValue()) {
+                return true;
+            } else {
+                return false;
+            }
+        } else if (oldInitValue instanceof Double) {
+            if (((Double) oldInitValue).doubleValue() == ((Double) newInitValue).doubleValue()) {
+                return true;
+            } else {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    public boolean implementsInterfaceDirectly(String intfName) {
+        if (interfaces == null) {
+            return false;
+        }
+        for (int i = 0; i < interfaces.length; i++) {
+            if (intfName.equals(interfaces[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /** Check if this class implements interface I or any subinterface of I directly */
+    public boolean implementsIntfOrSubintfDirectly(String intfName) {
+        if (interfaces == null) {
+            return false;
+        }
+        for (int i = 0; i < interfaces.length; i++) {
+            if (intfName.equals(interfaces[i])) {
+                return true;
+            }
+            // An interface can have multiple superinterfaces, all of which are listed in its "interfaces" array
+            // (although in the .java source it "extends" them all).
+            ClassInfo superIntfInfo =
+                    pcdm.getClassInfoForName(verCode, interfaces[i]);
+            if (superIntfInfo == null) {
+                continue;  // Class not in project
+            }
+            if (superIntfInfo.implementsIntfOrSubintfDirectly(intfName)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Class C implements interface I indirectly, if C or some superclass of C directly implements I
+     * or some subinterface of I.
+     */
+    public boolean implementsInterfaceDirectlyOrIndirectly(String intfName) {
+        if (interfaces == null) {
+            return false;
+        }
+
+        if (implementsIntfOrSubintfDirectly(intfName)) {
+            return true;
+        }
+
+        if (superName != null) {
+            ClassInfo superInfo = pcdm.getClassInfoForName(verCode, superName);
+            if (superInfo == null) {
+                return false;  // Class not in project
+            }
+            return superInfo.implementsInterfaceDirectlyOrIndirectly(intfName);
+        }
+
+        return false;
+    }
+
+    /**
+     * Returns true if this class declares a field with the same name and type as
+     * the field number fieldNo in class classInfo.
+     */
+    public boolean declaresField(ClassInfo classInfo, int fieldNo) {
+        if (fieldNames == null) {
+            return false;
+        }
+        String fieldName = classInfo.fieldNames[fieldNo];
+        String fieldSignature = classInfo.fieldSignatures[fieldNo];
+
+        for (int i = 0; i < fieldNames.length; i++) {
+            if (fieldName.equals(fieldNames[i]) &&
+                    fieldSignature.equals(fieldSignatures[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /** Returns true if this class declares a field with the given name, signature and access */
+    public boolean declaresField(String name, String signature, boolean isStatic) {
+        if (fieldNames == null) {
+            return false;
+        }
+        signature = ("@" + signature + "#").intern();
+        for (int i = 0; i < fieldNames.length; i++) {
+            if (name.equals(fieldNames[i]) &&
+                    signature.equals(fieldSignatures[i]) &&
+                    Modifier.isStatic(fieldAccessFlags[i]) == isStatic) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Returns true if this class declares a method with the same name and signature as
+     * the method number methodNo in class classInfo.
+     */
+    public boolean declaresMethod(ClassInfo classInfo, int methodNo) {
+        if (methodNames == null) {
+            return false;
+        }
+        String methodName = classInfo.methodNames[methodNo];
+        String methodSignature = classInfo.methodSignatures[methodNo];
+
+        for (int i = 0; i < methodNames.length; i++) {
+            if (methodName.equals(methodNames[i]) &&
+                    methodSignature.equals(methodSignatures[i])) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * If this class declares a method with the same name and signature as the given method,
+     * return its position. Otherwise, return -1.
+     */
+    public int getDeclaredMethodPos(ClassInfo classInfo, int methodNo) {
+        if (methodNames == null) {
+            return -1;
+        }
+        String methodName = classInfo.methodNames[methodNo];
+        String methodSignature = classInfo.methodSignatures[methodNo];
+
+        for (int i = 0; i < methodNames.length; i++) {
+            if (methodName.equals(methodNames[i]) &&
+                    methodSignature.equals(methodSignatures[i])) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Returns a nonnegative number (position in the method array) if this class declares a method with the
+     * name methodName, and -1 otherwise.
+     */
+    public int declaresSameNameMethod(String methodName) {
+        if (methodNames == null) {
+            return -1;
+        }
+        for (int j = 0; j < methodNames.length; j++) {
+            if (methodName.equals(methodNames[j])) {
+                return j;
+            }
+        }
+        return -1;
+    }
+
+    /**
+     * Check if this class references the given class in different ways, depending on thorDegree parameter.
+     * thorDegree = 0: the given class (but not its array class) directly from the constantpool.
+     *
+     * thorDegree = 1: the given class or its array class directly from the constantpool, as a
+     * type of a data field, as a type in a method signature or a thrown exception, as a directly
+     * implemented interface or a direct superclass
+     *
+     * thorDegree = 2: the given class or its array class directly or indirectly from the
+     * constantpool, as a type of a data field, as a type in a method signature or a thrown exception,
+     * as a directly/indirectly implemented interface or a direct/indirect superclass.
+     *
+     * isRefTypeInterface indicates whether className is an interface.
+     */
+    public boolean referencesClass(String className, boolean isRefTypeInterface, int thorDegree) {
+        int i;
+
+        if (thorDegree == 0) {
+            if (cpoolRefsToClasses == null) {
+                return false;
+            }
+            for (i = 0; i < cpoolRefsToClasses.length; i++) {
+                if (!isRefClassArray[i] &&
+                        className.equals(cpoolRefsToClasses[i])) {
+                    return true;
+                }
+            }
+        } else {
+            if (isSubclassOf(className, (thorDegree == 1))) {
+                return true;
+            }
+            if (isRefTypeInterface) {
+                if (thorDegree == 1) {
+                    if (implementsInterfaceDirectly(className)) {
+                        return true;
+                    }
+                } else {
+                    // Check for indirectly implemented interfaces
+                    if (implementsInterfaceDirectlyOrIndirectly(className)) {
+                        return true;
+                    }
+                }
+            }
+
+            if (cpoolRefsToClasses != null) {
+                for (i = 0; i < cpoolRefsToClasses.length; i++) {
+                    if (className.equals(cpoolRefsToClasses[i])) {
+                        return true;
+                    }
+                }
+            }
+            if (thorDegree == 2) {
+                // Check for indirect references from the constantpool
+                if (cpoolRefsToFieldSignatures != null) {
+                    for (i = 0; i < cpoolRefsToFieldSignatures.length; i++) {
+                        if (signatureIncludesClassName(cpoolRefsToFieldSignatures[i], className)) {
+                            return true;
+                        }
+                    }
+                }
+                if (cpoolRefsToMethodNames != null) {
+                    for (i = 0; i < cpoolRefsToMethodSignatures.length; i++) {
+                        if (signatureIncludesClassName(cpoolRefsToMethodSignatures[i], className)) {
+                            return true;
+                        }
+                    }
+                }
+            }
+
+            if (fieldSignatures != null) {
+                for (i = 0; i < fieldSignatures.length; i++) {
+                    if (signatureIncludesClassName(fieldSignatures[i], className)) {
+                        return true;
+                    }
+                }
+            }
+            if (methodSignatures != null) {
+                for (i = 0; i < methodSignatures.length; i++) {
+                    if (signatureIncludesClassName(methodSignatures[i], className)) {
+                        return true;
+                    }
+                }
+            }
+            if (checkedExceptions != null) {
+                for (i = 0; i < checkedExceptions.length; i++) {
+                    if (checkedExceptions[i] != null) {
+                        String excArray[] = checkedExceptions[i];
+                        for (int j = 0; j < excArray.length; j++) {
+                            if (className.equals(excArray[j])) {
+                                return true;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+
+        return false;
+    }
+
+    private static boolean signatureIncludesClassName(String signature, String className) {
+        int stIndex = signature.indexOf(className);
+        if (stIndex == -1) {
+            return false;
+        }
+        return ((stIndex != 0 && signature.charAt(stIndex - 1) == '@' && signature.charAt(stIndex + className.length()) == '#') ||
+                (stIndex == 0 && signature.length() == className.length()));
+    }
+
+    public boolean isSubclassOf(String className, boolean directOnly) {
+        if (className.equals(superName)) {
+            return true;
+        }
+        if (directOnly) {
+            return false;
+        }
+        String superName = this.superName;
+        while (superName != null) {
+            if (className.equals(superName)) {
+                return true;
+            }
+            ClassInfo classInfo = pcdm.getClassInfoForName(verCode, superName);
+            if (classInfo == null) {
+                break;  // Class not in project
+            }
+            superName = classInfo.superName;
+        }
+        return false;
+    }
+
+    /**
+     * Check if this class references field number fieldNo of class fieldDefClassInfo. Let us call
+     * this field C.f. Actual reference contained in the constant pool may be not to C.f itself,
+     * but to Csub.f, where Csub is some subclass of C such that neither Csub nor any other class
+     * located between C and Csub in the class hierarchy redeclares f. We look up both "real"
+     * references C.f and "fake" references such as Csub.f.
+     */
+    public boolean referencesField(ClassInfo fieldDefClassInfo, int fieldNo) {
+        if (cpoolRefsToFieldNames == null) {
+            return false;
+        }
+        String fieldDefClassName = fieldDefClassInfo.name;
+        String fieldName = fieldDefClassInfo.fieldNames[fieldNo];
+        String fieldSig = fieldDefClassInfo.fieldSignatures[fieldNo];
+        for (int i = 0; i < cpoolRefsToFieldNames.length; i++) {
+            if (fieldName.equals(cpoolRefsToFieldNames[i]) &&
+                    fieldSig.equals(cpoolRefsToFieldSignatures[i]) ) {
+                if (fieldDefClassName.equals(cpoolRefsToFieldClasses[i]) ) {
+                    return true;  // "real" reference
+                } else {  // Check if this is a "fake" reference that resolves to the above "real" reference
+                    ClassInfo classInThisCpool =
+                            pcdm.getClassInfoForName(verCode, cpoolRefsToFieldClasses[i]);
+                    if (classInThisCpool == null) {
+                        continue;  // Class not in project
+                    }
+                    if (!classInThisCpool.isSubclassOf(fieldDefClassInfo.name, false)) {
+                        continue;
+                    }
+
+                    // Ok, now check that this field is not actually redeclared in fieldDefClassInfo or
+                    // somewhere in between it and classInThisCpool
+                    boolean redeclared = false;
+                    ClassInfo curClass = classInThisCpool;
+                    do {
+                        if (curClass.declaresField(fieldDefClassInfo, fieldNo)) {
+                            redeclared = true;
+                            break;
+                        }
+                        String superName = curClass.superName;
+                        curClass = pcdm.getClassInfoForName(verCode, superName);
+                        if (curClass == null) {
+                            break;
+                        }
+                    } while (curClass != fieldDefClassInfo);
+                    if (!redeclared) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Check if this class references method number methodNo of class methodDefClassInfo. Let us
+     * call this method C.m. Actual reference contained in the constant pool may be not to C.m
+     * itself, but to Csub.m, where Csub is some subclass of C such that neither Csub nor any
+     * other class located between C and Csub in the class hierarchy redeclares m. We look up
+     * both "real" references C.m and "fake" references such as Csub.m.
+     */
+    public boolean referencesMethod(ClassInfo methodDefClassInfo, int methodNo) {
+        if (cpoolRefsToMethodNames == null) {
+            return false;
+        }
+        String methodDefClassName = methodDefClassInfo.name;
+        String methodName = methodDefClassInfo.methodNames[methodNo];
+        String methodSig = methodDefClassInfo.methodSignatures[methodNo];
+        for (int i = 0; i < cpoolRefsToMethodNames.length; i++) {
+            if (methodName.equals(cpoolRefsToMethodNames[i]) &&
+                    methodSig.equals(cpoolRefsToMethodSignatures[i])) {
+                if (methodDefClassName.equals(cpoolRefsToMethodClasses[i])) {
+                    return true;  // "real" reference
+                } else {  // Check if this is a "fake" reference that resolves to the above "real" reference
+                    // Be careful - class in the cpool may be not a project class (e.g. a core class).
+                    ClassInfo classInThisCpool =
+                            pcdm.getClassInfoForName(verCode, cpoolRefsToMethodClasses[i]);
+                    if (classInThisCpool == null) {
+                        continue;  // Class not in project
+                    }
+                    if (classInThisCpool.isSubclassOf(methodDefClassInfo.name, false)) {
+                        // Ok, now check that this method is not actually redeclared in classInThisCpool (which is
+                        // lower in the hierarchy) or somewhere in between it and classInThisCpool
+                        boolean redeclared = false;
+                        ClassInfo curClass = classInThisCpool;
+                        do {
+                            if (curClass.declaresMethod(methodDefClassInfo, methodNo)) {
+                                redeclared = true;
+                                break;
+                            }
+                            String superName = curClass.superName;
+                            curClass =
+                                    pcdm.getClassInfoForName(verCode, superName);
+                            if (curClass == null) {
+                                break;
+                            }
+                        } while (curClass != methodDefClassInfo);
+                        if (!redeclared) {
+                            return true;
+                        }
+                    } else if (methodDefClassInfo.isInterface() && classInThisCpool.implementsIntfOrSubintfDirectly(methodDefClassName)) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * If this class has a method that throws the given exception, return its index. Otherwise return -1.
+     * The search starts from method with index startMethodIdx.
+     */
+    public int hasMethodThrowingException(ClassInfo excClassInfo, int startMethodIdx) {
+        if (checkedExceptions == null) {
+            return -1;
+        }
+        if (startMethodIdx >= checkedExceptions.length) {
+            return -1;
+        }
+        String excName = excClassInfo.name;
+        for (int i = startMethodIdx; i < checkedExceptions.length; i++) {
+            if (checkedExceptions[i] == null) {
+                continue;
+            }
+            String[] exc = checkedExceptions[i];
+            for (int j = 0; j < exc.length; j++) {
+                if (exc[j].equals(excName)) {
+                    return i;
+                }
+            }
+        }
+        return -1;
+    }
+
+    public static abstract class MethodHandler {
+
+        abstract void handleMethod(ClassInfo ci, int methodIdx);
+    }
+
+    /**
+     * Check this class and all its superclasses (if includeSuperclasses == true) and superinterfaces (if includeInterfaces == true)
+     * for a method with the given name. If such a method is found, call h.handleMethod(classInfo, methodIdx).
+     */
+    public void findExistingSameNameMethods(String methodName, boolean includeSuperclasses, boolean includeInterfaces, MethodHandler h) {
+        String className = name;
+        ClassInfo classInfo;
+        while (className != null) {
+            classInfo = pcdm.getClassInfoForName(verCode, className);
+            if (classInfo == null) {
+                break;  // Class not in project
+            }
+            String mNames[] = classInfo.methodNames;
+            int mNamesLen = mNames != null ? mNames.length : 0;
+            for (int i = 0; i < mNamesLen; i++) {
+                if (methodName.equals(mNames[i])) {
+                    h.handleMethod(classInfo, i);
+                }
+            }
+            if (includeInterfaces && classInfo.interfaces != null) {
+                String intfNames[] = classInfo.interfaces;
+                for (int i = 0; i < intfNames.length; i++) {
+                    ClassInfo superIntfInfo =
+                            pcdm.getClassInfoForName(verCode, intfNames[i]);
+                    if (superIntfInfo == null) {
+                        continue;  // Class not in project
+                    }
+                    superIntfInfo.findExistingSameNameMethods(methodName, true, includeInterfaces, h);
+                }
+            }
+            if (includeSuperclasses) {
+                className = classInfo.superName;
+            } else {
+                return;
+            }
+        }
+    }
+
+    public static boolean isPrimitiveFieldSig(String fieldSig) {
+        return fieldSig.indexOf('@') == -1;
+    }
+
+    /**
+     * Check if the given signature is of a class type, and that class does not belong to the project.
+     * It used to be a check for just a core type name, but sometimes people use JDK sources as e.g. a test
+     * case - so better perform a universal (and entirely correct, unlike just a core type name) test here.
+     */
+    public boolean isNonProjectClassTypeFieldSig(String fieldSig) {
+        int stPos = fieldSig.indexOf('@');
+        if (stPos == -1) {
+            return false;
+        }
+        int endPos = fieldSig.indexOf('#');
+        String className = fieldSig.substring(stPos + 1, endPos);
+        return (!pcdm.isProjectClass(verCode, className));
+    }
+
+    /** For debugging. */
+    public String toString() {
+        return name + (verCode == VER_OLD ? " OLD" : " NEW");
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/ClassPath.java b/third_party/jmake/src/org/pantsbuild/jmake/ClassPath.java
new file mode 100644
index 0000000..e6e1aebd
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/ClassPath.java
@@ -0,0 +1,448 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * An instance of this class represents a class path, on which binary classes can be looked up.
+ * It also provides several static methods to create and utilize several specific class paths used
+ * throughout jmake.
+ *
+ * @author Misha Dmitriev
+ *  12 October 2004
+ */
+public class ClassPath {
+
+    private PathEntry[] paths;
+    private static ClassPath projectClassPath;   // Class path (currently it can contain only JARs) containing sourceless project classes.
+    // See also the comment to standardClassPath.
+    private static ClassPath standardClassPath;  // Class path that the user specifies via the -classpath option. A sum of the
+    // standardClassPath, the projectClassPath, and the virtualPath is passed to the compiler. Each of these
+    // class paths are also used to look up non-project superclasses/superinterfaces of
+    // project classes.
+    private static ClassPath bootClassPath,  extClassPath; // Class paths that by default are sun.boot.class.path and all JARs on
+    // java.ext.class.path, respectively. They are used to look up non-project
+    // superclasses/superinterfaces of project classes. Their values can be changed using
+    // setBootClassPath() and setExtDirs().
+    private static ClassPath virtualPath; // Class path that the user specifies via the -vpath option.
+    private static String compilerUserClassPath; // Class path to be passed to the compiler; equals to the sum of values of parameters of
+    // setClassPath() and setProjectClassPath() methods.
+    private static String standardClassPathStr,  projectClassPathStr,  bootClassPathStr,  extDirsStr,
+            virtualPathStr;
+    private static Map<String,ClassInfo> classCache;
+
+
+    static {
+        resetOnFinish();
+    }
+
+    /**
+     * Needed since some environments, e.g. NetBeans, can keep jmake classes in memory
+     * permanently. Thus unchanged class paths from previous, possibly unrelated invocations
+     * of jmake, may interfere with the current settings.
+     */
+    public static void resetOnFinish() {
+        projectClassPath = standardClassPath = bootClassPath = extClassPath = virtualPath =
+                null;
+        compilerUserClassPath = null;
+        standardClassPathStr = projectClassPathStr = bootClassPathStr =
+                extDirsStr = virtualPathStr = null;
+        classCache = new LinkedHashMap<String,ClassInfo>();
+    }
+
+    public static void setClassPath(String value) throws PublicExceptions.InvalidCmdOptionException {
+        standardClassPathStr = value;
+        standardClassPath = new ClassPath(value, false);
+    }
+
+    public static void setProjectClassPath(String value) throws PublicExceptions.InvalidCmdOptionException {
+        projectClassPathStr = value;
+        projectClassPath = new ClassPath(value, true);
+    }
+
+    public static void setBootClassPath(String value) throws PublicExceptions.InvalidCmdOptionException {
+        bootClassPathStr = value;
+        bootClassPath = new ClassPath(value, false);
+    }
+
+    public static void setExtDirs(String value) throws PublicExceptions.InvalidCmdOptionException {
+        extDirsStr = value;
+        // Extension class path needs special handling, since it consists of directories, which contain .jars
+        // So we need to find all these .jars in all these dirs and add them to extClassPathElementList
+        List<String> extClassPathElements = new ArrayList<String>();
+        for (StringTokenizer tok =
+                new StringTokenizer(value, File.pathSeparator); tok.hasMoreTokens();) {
+            File extDir = new File(tok.nextToken());
+            String[] extJars = extDir.list(new FilenameFilter() {
+
+                public boolean accept(File dir, String name) {
+                    name = name.toLowerCase(Locale.ENGLISH);
+                    return name.endsWith(".zip") || name.endsWith(".jar");
+                }
+            });
+            if (extJars == null) {
+                continue;
+            }
+            for (int i = 0; i < extJars.length; i++) {
+                extClassPathElements.add(extDir + File.separator + extJars[i]);
+            }
+        }
+        extClassPath = new ClassPath(extClassPathElements, false);
+    }
+
+    public static void setVirtualPath(String value) throws PublicExceptions.InvalidCmdOptionException {
+        if (value == null) {
+            throw new PublicExceptions.InvalidCmdOptionException("null argument");
+        }
+        StringTokenizer st = new StringTokenizer(value, File.pathSeparator);
+        while (st.hasMoreElements()) {
+            String dir = st.nextToken();
+            if ( ! (new File(dir)).isDirectory()) {
+                throw new PublicExceptions.InvalidCmdOptionException("Virtual path must contain only directories." +
+                        " Entry " + dir + " is not a directory.");
+            }
+        }
+        virtualPathStr = value;
+        virtualPath = new ClassPath(value, false);
+    }
+
+    public static void initializeAllClassPaths() {
+        // First set the compiler class path value
+        if (standardClassPathStr == null && projectClassPathStr == null) {
+            compilerUserClassPath = ".";
+        } else if (standardClassPathStr == null) {
+            compilerUserClassPath = projectClassPathStr;
+        } else if (projectClassPathStr == null) {
+            compilerUserClassPath = standardClassPathStr;
+        } else {
+            compilerUserClassPath =
+                    standardClassPathStr + File.pathSeparator + projectClassPathStr;
+        }
+
+        if (virtualPathStr != null) {
+            compilerUserClassPath += File.pathSeparator + virtualPathStr;
+        }
+
+        if (standardClassPathStr == null) {
+            try {
+                String tmp = ".";
+                if (virtualPathStr != null) {
+                    tmp += File.pathSeparator + virtualPathStr;
+                }
+                standardClassPath = new ClassPath(tmp, false);
+            } catch (PublicExceptions.InvalidCmdOptionException ex) { /* Should not happen */ }
+        }
+        if (projectClassPathStr == null) {
+            projectClassPath = new ClassPath();
+        }
+
+        // Create the core class path as a combination of sun.boot.class.path and java.ext.dirs contents
+        if (bootClassPathStr == null) {
+            try {
+                bootClassPath =
+                        new ClassPath(System.getProperty("sun.boot.class.path"), false);
+            } catch (PublicExceptions.InvalidCmdOptionException ex) { /* Shouldn't happen */ }
+        // bootClassPathStr should remain null, so that nothing that the user didn't specify is passed to the compiler
+        }
+
+        if (extDirsStr == null) {
+            try {
+                setExtDirs(System.getProperty("java.ext.dirs"));
+            } catch (PublicExceptions.InvalidCmdOptionException ex) { /* Shouldn't happen */ }
+            // extDirsStr should remain null, so that nothing that the user didn't specify is passed to the compiler
+            extDirsStr = null;
+        }
+    }
+
+    /** Never returns null - if classpath wasn't set explicitly, returns "." */
+    public static String getCompilerUserClassPath() {
+        return compilerUserClassPath;
+    }
+
+    /** Will return null if boot class path wasn't explicitly specified */
+    public static String getCompilerBootClassPath() {
+        return bootClassPathStr;
+    }
+
+    /** Will return null if extdirs weren't explicitly specified */
+    public static String getCompilerExtDirs() {
+        return extDirsStr;
+    }
+
+    /** Will return null if virtualPath wasn't explicitly specified */
+    public static String getVirtualPath() {
+        return virtualPathStr;
+    }
+
+    /**
+     * For the given class return the list of all of its superclasses (excluding Object), that can be loaded from
+     * projectClassPath or standardClassPath, plus the first superclass that can be loaded from coreClassPath.
+     * The latter is an optimization based on the assumption that core classes never change, or rather the programmer
+     * will recompile everything when they switch to a new JDK version. The optimization prevents us from wasting time
+     * repeatedly loading the same sets of core classes.
+     */
+    public static void getSuperclasses(String className,
+            Collection<String> res, PCDManager pcdm) {
+        int iterNo = 0;
+        while (!"java/lang/Object".equals(className)) {
+            ClassInfo ci = getClassInfoForName(className, pcdm);
+            if (ci == null) {
+                return;
+            }
+            if (iterNo++ > 0) {
+                res.add(ci.name);
+            }
+            className = ci.superName;
+        }
+    }
+
+    /**
+     * Add to the given set the names of all interfaces implemented by the given class, that can be loaded from
+     * projectClassPath or standardClassPath, plus the first interface on each branch that can be loaded from
+     * coreClassPath. It's the same optimization as in getSuperclasses().
+     */
+    public static void addAllImplementedInterfaceNames(String className,
+            Set<String> intfSet, PCDManager pcdm) {
+        if ("java/lang/Object".equals(className)) {
+            return;
+        }
+        ClassInfo ci = getClassInfoForName(className, pcdm);
+        if (ci == null) {
+            return;
+        }
+        String[] interfaces = ci.interfaces;
+        if (interfaces != null) {
+            for (int i = 0; i < interfaces.length; i++) {
+                intfSet.add(interfaces[i]);
+                addAllImplementedInterfaceNames(interfaces[i], intfSet, pcdm);
+            }
+        }
+
+        String superName = ci.superName;
+        if (superName != null) {
+            addAllImplementedInterfaceNames(superName, intfSet, pcdm);
+        }
+    }
+
+    public static String[] getProjectJars() {
+        if (projectClassPath == null || projectClassPath.isEmpty()) {
+            return null;
+        }
+        PathEntry paths[] = projectClassPath.paths;
+        String[] ret = new String[paths.length];
+        for (int i = 0; i < paths.length; i++) {
+            ret[i] = paths[i].toString();
+        }
+        return ret;
+    }
+
+    public static ClassInfo getClassInfoForName(String className, PCDManager pcdm) {
+        ClassInfo info = classCache.get(className);
+        if (info != null) {
+            return info;
+        }
+
+        byte buf[] = bootClassPath.getBytesForClass(className);
+        if (buf == null) {
+            buf = extClassPath.getBytesForClass(className);
+        }
+        if (buf == null) {
+            buf = standardClassPath.getBytesForClass(className);
+        }
+        if (buf == null) {
+            buf = projectClassPath.getBytesForClass(className);
+        }
+        if (buf == null) {
+            return null;
+        }
+
+        info = new ClassInfo(buf, pcdm, className);
+        classCache.put(className, info);
+        return info;
+    }
+
+    /** Returns the class loader that would load classes from the given class path. */
+    public static ClassLoader getClassLoaderForPath(String classPath) throws Exception {
+        boolean isWindows = System.getProperty("os.name").startsWith("Win");
+        ClassPath cp = new ClassPath(classPath, false);
+        PathEntry[] paths = cp.paths;
+        URL[] urls = new URL[paths.length];
+        for (int i = 0; i < paths.length; i++) {
+            String dirOrJar = paths[i].toString();
+            if (!(dirOrJar.startsWith("file://") || dirOrJar.startsWith("http://"))) {
+                // On Windows, if I have path specified as "file://c:\...", (i.e. with the drive name) URLClassLoader works
+                // unbelievably slow. However, if an additional slash is added, like : "file:///c:\...", the speed becomes
+                // normal. To me it looks like a bug, but, anyway, I am taking measure here.
+                if (isWindows && dirOrJar.charAt(1) == ':') {
+                    dirOrJar = "/" + dirOrJar;
+                }
+                dirOrJar = new File(dirOrJar).toURI().toString();
+            }
+            if (!(dirOrJar.endsWith(".jar") || dirOrJar.endsWith(".zip") || dirOrJar.endsWith(File.separator))) {
+                dirOrJar += File.separator; // So that URLClassLoader correctly handles it as a directory
+            }
+            urls[i] = new URL(dirOrJar);
+        }
+
+        return new URLClassLoader(urls);
+    //} catch (java.net.MalformedURLException e) {
+
+    //}
+    }
+
+
+    // ------------------------------------ Private implementation --------------------------------------------
+    private ClassPath() {
+        paths = new PathEntry[0];
+    }
+
+    private ClassPath(String classPath, boolean isJarOnly) throws PublicExceptions.InvalidCmdOptionException {
+        if (classPath == null) {
+            throw new PublicExceptions.InvalidCmdOptionException("null argument");
+        }
+        List<String> vec = new ArrayList<String>();
+
+        for (StringTokenizer tok =
+                new StringTokenizer(classPath, File.pathSeparator); tok.hasMoreTokens();) {
+            String path = tok.nextToken();
+            vec.add(path);
+        }
+        init(vec, isJarOnly);
+    }
+
+    private ClassPath(List<String> pathEntries, boolean isJarOnly) throws PublicExceptions.InvalidCmdOptionException {
+        init(pathEntries, isJarOnly);
+    }
+
+    private void init(List<String> pathEntries, boolean isJarOnly) throws PublicExceptions.InvalidCmdOptionException {
+        if (pathEntries == null) {
+            throw new PublicExceptions.InvalidCmdOptionException("null argument");
+        }
+        List<PathEntry> vec = new ArrayList<PathEntry>(pathEntries.size());
+        for (int i = 0; i < pathEntries.size(); i++) {
+            String path = pathEntries.get(i);
+            if (!path.equals("")) {
+                File file = new File(path);
+                try {
+                    if (file.exists() && file.canRead()) {
+                        if (file.isDirectory()) {
+                            if (isJarOnly) {
+                                throw new PublicExceptions.InvalidCmdOptionException("directories are not allowed on this class path: " + path);
+                            }
+                            vec.add(new Dir(file));
+                        } else {
+                            vec.add(new Zip(new ZipFile(file)));
+                        }
+                    } else if (isJarOnly) {
+                        throw new IOException("file does not exist");
+                    }
+                } catch (IOException e) {
+                    if (isJarOnly) {
+                        throw new PublicExceptions.InvalidCmdOptionException("error initializing class path component " + path + ": " + e.getMessage());
+                    }
+                }
+            }
+        }
+
+        paths = new PathEntry[vec.size()];
+        vec.toArray(paths);
+    }
+
+    private boolean isEmpty() {
+        return paths.length == 0;
+    }
+
+    private byte[] getBytesForClass(String className) {
+        String fileName = className + ".class";
+        for (int i = 0; i < paths.length; i++) {
+            byte buf[] = paths[i].getBytesForClassFile(fileName);
+            if (buf != null) {
+                return buf;
+            }
+        }
+        return null;
+    }
+
+    public String toString() {
+        if (paths == null) {
+            return "NULL";
+        }
+        StringBuilder res = new StringBuilder();
+        for (int i = 0; i < paths.length; i++) {
+            res.append(paths[i].toString());
+        }
+        return res.toString();
+    }
+
+
+    // ------------------------------------ Private helper classes --------------------------------------------
+    private static abstract class PathEntry {
+
+        abstract byte[] getBytesForClassFile(String fileName);
+
+        public abstract String toString();
+    }
+
+    private static class Dir extends PathEntry {
+
+        private String dir;
+
+        Dir(File f) throws IOException {
+            dir = f.getCanonicalPath();
+        }
+
+        byte[] getBytesForClassFile(String fileName) {
+            File file = new File(dir + File.separatorChar + fileName);
+            if (file.exists()) {
+                return Utils.readFileIntoBuffer(file);
+            } else {
+                return null;
+            }
+        }
+
+        public String toString() {
+            return dir;
+        }
+    }
+
+    private static class Zip extends PathEntry {
+
+        private ZipFile zip;
+
+        Zip(ZipFile z) {
+            zip = z;
+        }
+
+        byte[] getBytesForClassFile(String fileName) {
+            ZipEntry entry = zip.getEntry(fileName);
+            if (entry != null) {
+                return Utils.readZipEntryIntoBuffer(zip, entry);
+            } else {
+                return null;
+            }
+        }
+
+        public String toString() {
+            return zip.getName();
+        }
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/CompatibilityChecker.java b/third_party/jmake/src/org/pantsbuild/jmake/CompatibilityChecker.java
new file mode 100644
index 0000000..bd74cfb3e
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/CompatibilityChecker.java
@@ -0,0 +1,610 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.lang.reflect.Modifier;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * This class implements checking of source compatibility of classes and supporting operations
+ *
+ * @author Misha Dmitriev
+ *  12 March 2004
+ */
+public class CompatibilityChecker {
+
+    private PCDManager pcdm;
+    private RefClassFinder rf;
+    ClassInfo oldClassInfo = null;
+    ClassInfo newClassInfo = null;
+    private boolean versionsCompatible;
+    private boolean publicConstantChanged;
+
+    public CompatibilityChecker(PCDManager pcdm, boolean failOnDependentJar, boolean noWarnOnDependentJar) {
+        this.pcdm = pcdm;
+        publicConstantChanged = false;
+        rf = new RefClassFinder(pcdm, failOnDependentJar, noWarnOnDependentJar);
+    }
+
+    /**
+     * Compares the two class versions for the given PCDEntry. Returns true if all changes are source
+     * compatible, and false otherwise.
+     */
+    public boolean compareClassVersions(PCDEntry entry) {
+        // I once had the following optimization here with the comment "No sense to make any further checks if
+        // everything is recompiled anyway", but now I believe it's wrong. For each class that was found changed
+        // we need to know whether the new version is compatible with the old or not, since this may determine
+        // whether the new version of this class is promoted into the pdb or not (see PCDManager.updateClassInfoInPCD()).
+        // So, all changed classes should be checked just to correctly determine version compatibility.
+        // if (publicConstantChanged) return false;
+
+        oldClassInfo = pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, entry);
+        newClassInfo = pcdm.getClassInfoForPCDEntry(ClassInfo.VER_NEW, entry);
+
+        rf.initialize(oldClassInfo.name, entry.javaFileFullPath.endsWith(".jar"));
+        versionsCompatible = true;
+
+        checkAccessFlags();
+        checkSuperclasses();
+        checkImplementedInterfaces();
+        checkFields();
+        checkMethodsAndConstructors();
+
+        return versionsCompatible;
+    }
+
+    /** Find all dependent classes for a deleted class. */
+    public void checkDeletedClass(PCDEntry entry) {
+        oldClassInfo = entry.oldClassInfo;
+        rf.initialize(oldClassInfo.name, entry.javaFileFullPath.endsWith(".jar"));
+        rf.findReferencingClassesForDeletedClass(oldClassInfo);
+        // It may happen that the only reference to deleted class X is via "X.class" construct
+        String packageToLookIn =
+                oldClassInfo.isPublic() ? null : oldClassInfo.packageName;
+        rf.findClassesDeclaringField(("class$" + oldClassInfo.name).intern(), "java/lang/Class", true, packageToLookIn);
+        checkForFinalFields();
+    }
+
+    /** Returns the names of classes affected by source incompatible changes to the new version of the checked class. */
+    public String[] getAffectedClasses() {
+        return rf.getAffectedClassNames();
+    }
+
+    /** All of the following methods return true if no source incompatible changes found, and false otherwise */
+    private void checkAccessFlags() {
+        char oldClassFlags = oldClassInfo.accessFlags;
+        char newClassFlags = newClassInfo.accessFlags;
+        if (oldClassFlags == newClassFlags) {
+            return;
+        }
+
+        if (!Modifier.isFinal(oldClassFlags) && Modifier.isFinal(newClassFlags)) {
+            versionsCompatible = false;
+            rf.findDirectSubclasses(oldClassInfo);
+        }
+
+        if (!Modifier.isAbstract(oldClassFlags) && Modifier.isAbstract(newClassFlags)) {
+            versionsCompatible = false;
+            rf.findReferencingClasses0(oldClassInfo);
+        }
+
+        // Now to accessibility modifiers checking...
+        if (Modifier.isPublic(newClassFlags)) {
+            return;
+        }
+
+        if (Modifier.isProtected(newClassFlags)) {
+            if (Modifier.isPublic(oldClassFlags)) {
+                versionsCompatible = false;
+                rf.findDiffPackageAndNotSubReferencingClasses1(oldClassInfo);
+            }
+        } else if (Modifier.isPrivate(newClassFlags)) {
+            if (!Modifier.isPrivate(oldClassFlags)) {
+                versionsCompatible = false;
+            } else {
+                return;  // private -> private, nothing more to check
+            }
+            if (Modifier.isPublic(oldClassFlags)) {
+                rf.findReferencingClasses1(oldClassInfo);
+            } else if (Modifier.isProtected(oldClassFlags)) {
+                rf.findThisPackageOrSubReferencingClasses1(oldClassInfo);
+            } else {
+                rf.findThisPackageReferencingClasses1(oldClassInfo);
+            }
+        } else {  // newClassFlags has default access, since public has already been excluded
+            if (Modifier.isPublic(oldClassFlags)) {
+                versionsCompatible = false;
+                rf.findDiffPackageReferencingClasses1(oldClassInfo);
+            } else if (Modifier.isProtected(oldClassFlags)) {
+                versionsCompatible = false;
+                rf.findDiffPackageAndSubReferencingClasses1(oldClassInfo);
+            }
+        }
+    }
+
+    private void checkSuperclasses() {
+        List<String> oldSuperNames = oldClassInfo.getAllSuperclassNames();
+        List<String> newSuperNames = newClassInfo.getAllSuperclassNames();
+
+        int oldNamesSizeMinusOne = oldSuperNames.size() - 1;
+        for (int i = 0; i <= oldNamesSizeMinusOne; i++) {
+            String oldSuperName = oldSuperNames.get(i);
+            if (!newSuperNames.contains(oldSuperName)) {
+                versionsCompatible = false;
+                ClassInfo missingSuperClass =
+                        pcdm.getClassInfoForName(ClassInfo.VER_OLD, oldSuperName);
+                if (missingSuperClass == null) { // This class is not in project
+                    missingSuperClass =
+                            ClassPath.getClassInfoForName(oldSuperName, pcdm);
+                    if (missingSuperClass == null) {
+                        missingSuperClass = new ClassInfo(oldSuperName, pcdm);
+                    }
+                }
+                rf.findReferencingClasses2(missingSuperClass, oldClassInfo);
+            }
+        }
+
+        // Now check if the class is an exception, and its kind has changed from unchecked to checked
+        if (oldClassInfo.isInterface() || oldSuperNames.size() == 0) {
+            return;
+        }
+        if (!(oldSuperNames.contains("java/lang/RuntimeException") || oldSuperNames.contains("java/lang/Error"))) {
+            return;
+        }
+        if (!(newSuperNames.contains("java/lang/RuntimeException") || newSuperNames.contains("java/lang/Error"))) {
+            if (!newSuperNames.contains("java/lang/Throwable")) {
+                return;
+            }
+            // Ok, exception kind has changed from unchecked to checked.
+            versionsCompatible = false;
+            rf.findReferencingClasses0(oldClassInfo);
+            rf.findRefsToMethodsThrowingException(oldClassInfo);
+        }
+    }
+
+    private void checkImplementedInterfaces() {
+        Set<String> oldIntfNames = oldClassInfo.getAllImplementedIntfNames();
+        Set<String> newIntfNames = newClassInfo.getAllImplementedIntfNames();
+
+        for (String oldIntfName : oldIntfNames) {
+            if (!newIntfNames.contains(oldIntfName)) {
+                versionsCompatible = false;
+                ClassInfo missingSuperInterface =
+                        pcdm.getClassInfoForName(ClassInfo.VER_OLD, oldIntfName);
+                if (missingSuperInterface == null) { // This class is not in project
+                    missingSuperInterface =
+                            ClassPath.getClassInfoForName(oldIntfName, pcdm);
+                    if (missingSuperInterface == null) {
+                        missingSuperInterface = new ClassInfo(oldIntfName, pcdm);
+                    }
+                }
+                rf.findReferencingClasses2(missingSuperInterface, oldClassInfo);
+            }
+        }
+
+        // Check if the class is abstract, and an interface has been added to its list of implemented interfaces
+        if (newClassInfo.isAbstract()) {
+            for (String newIntfName : newIntfNames) {
+                if (!oldIntfNames.contains(newIntfName)) {
+                    versionsCompatible = false;
+                    rf.findConcreteSubclasses(oldClassInfo);
+                    break;
+                }
+            }
+        }
+    }
+
+    private void checkFields() {
+        String oFNames[] = oldClassInfo.fieldNames;
+        String oFSignatures[] = oldClassInfo.fieldSignatures;
+        char oFFlags[] = oldClassInfo.fieldAccessFlags;
+        String nFNames[] = newClassInfo.fieldNames;
+        String nFSignatures[] = newClassInfo.fieldSignatures;
+        char nFFlags[] = newClassInfo.fieldAccessFlags;
+        int oFLen = oFNames != null ? oFNames.length : 0;
+        int nFLen = nFNames != null ? nFNames.length : 0;
+
+        int oFMod, nFMod;
+        String oFName, oFSig, nFName;
+        int i, j, k, endIdx;
+        int nonMatchingNewFields = nFLen;
+
+        for (i = 0; i < oFLen; i++) {
+            oFMod = oFFlags[i];
+            if (Modifier.isPrivate(oFMod)) {
+                continue;  // Changes to private fields don't affect compatibility
+            }
+            oFName = oFNames[i];
+            oFSig = oFSignatures[i];
+            boolean found = false;
+
+            // Look for the same field in the new version considering name and type
+            endIdx = nFLen - 1;
+            k = i < nFLen ? i : endIdx;
+            for (j = 0; j < nFLen; j++) {
+                if (oFName.equals(nFNames[k]) &&
+                        oFSig.equals(nFSignatures[k])) {
+                    found = true;
+                    break;
+                }
+                if (k < endIdx) {
+                    k++;
+                } else {
+                    k = 0;
+                }
+            }
+
+            if (found) {
+                nonMatchingNewFields--;
+                nFMod = nFFlags[k];
+                checkFieldModifiers(oFMod, nFMod, i, k);
+                if (publicConstantChanged) {
+                    return;
+                }
+            } else { // Matching field not found
+                if (Modifier.isStatic(oFMod) && Modifier.isFinal(oFMod) &&
+                        oldClassInfo.primitiveConstantInitValues != null &&
+                        oldClassInfo.primitiveConstantInitValues[i] != null) {
+                    // Compile-time constant deleted
+                    versionsCompatible = false;
+                    rf.findAllProjectClasses(oldClassInfo, i);
+                    if (Modifier.isPublic(oFMod)) {
+                        publicConstantChanged = true;
+                        return;
+                    }
+                } else {
+                    versionsCompatible = false;
+                    rf.findReferencingClassesForField(oldClassInfo, i);
+                }
+            }
+        }
+
+        if (nonMatchingNewFields > 0) { // There are some fields declared in the new version which don't exist in the old one
+            // Look for fields hiding same-named fields in superclasses
+            for (i = 0; i < nFLen; i++) {
+                nFName = nFNames[i];
+
+                boolean found = false;
+                for (j = 0; j < oFLen; j++) {
+                    if (nFName.equals(oFNames[j])) {
+                        found = true;
+                        break;
+                    }
+                }
+                if (found) {
+                    continue;  // nFName is not an added field
+                }
+                String superName = oldClassInfo.superName;
+                ClassInfo superInfo;
+                while (superName != null) {
+                    superInfo =
+                            pcdm.getClassInfoForName(ClassInfo.VER_OLD, superName);
+                    if (superInfo == null) {
+                        break;
+                    }
+                    String[] superOFNames = superInfo.fieldNames;
+                    int superOFNamesLen = superOFNames != null ? superOFNames.length
+                            : 0;
+                    for (j = 0; j < superOFNamesLen; j++) {
+                        if (nFName == superOFNames[j]) {
+                            versionsCompatible = false;
+                            rf.findReferencingClassesForField(superInfo, j);
+                        }
+                    }
+                    superName = superInfo.superName;
+                }
+            }
+        }
+    }
+
+    /** It is already known that old field is not private */
+    private void checkFieldModifiers(int oFMod, int nFMod, int oldFieldIdx, int newFieldIdx) {
+        if (oFMod == nFMod) {
+            if (Modifier.isFinal(oFMod) &&
+                    (!ClassInfo.constFieldInitValuesEqual(oldClassInfo, oldFieldIdx, newClassInfo, newFieldIdx))) {
+                versionsCompatible = false;
+                rf.findAllProjectClasses(oldClassInfo, oldFieldIdx);
+                if (Modifier.isPublic(oFMod)) {
+                    publicConstantChanged = true;  // Means we will have to recompile ALL project classes
+                }
+                return;
+            }
+        }
+
+        // These tests are ordered such that if a previous test succeeds, there is no need to do further tests, since that
+        // former test will cause more classes to be checked than any of the further tests. That is why it is possible to
+        // check properties that are in fact independent (e.g. accessibility vs. static/non-static) together. But this
+        // optimization only works since all kinds of tests result in the same kind of find..ReferencingClassesForField()
+        // outcome. For methods this is not true, and so there we have to check independent properties separately.
+        if (Modifier.isStatic(oFMod) && Modifier.isFinal(oFMod) && // oFMod is known to be non-private
+                (!Modifier.isFinal(nFMod) || !ClassInfo.constFieldInitValuesEqual(oldClassInfo, oldFieldIdx, newClassInfo, newFieldIdx))) {
+            versionsCompatible = false;
+            rf.findAllProjectClasses(oldClassInfo, oldFieldIdx);
+            if (Modifier.isPublic(oFMod)) {
+                publicConstantChanged = true;
+            }
+        } else if (Modifier.isPrivate(nFMod) || // oFMod is known to be non-private
+                (!Modifier.isFinal(oFMod) && Modifier.isFinal(nFMod)) ||
+                (Modifier.isStatic(oFMod) != Modifier.isStatic(nFMod)) ||
+                (Modifier.isVolatile(oFMod) != Modifier.isVolatile(nFMod))) {
+            versionsCompatible = false;
+            rf.findReferencingClassesForField(oldClassInfo, oldFieldIdx);
+        } else if (Modifier.isPublic(oFMod) && Modifier.isProtected(nFMod)) {
+            versionsCompatible = false;
+            rf.findDiffPackageReferencingClassesForField(oldClassInfo, oldFieldIdx);
+        } else if ((Modifier.isPublic(oFMod) || Modifier.isProtected(oFMod)) &&
+                (!(Modifier.isPublic(nFMod) || Modifier.isProtected(nFMod) || Modifier.isPrivate(nFMod)))) {
+            versionsCompatible = false;
+            if (Modifier.isPublic(oFMod)) {
+                rf.findDiffPackageReferencingClassesForField(oldClassInfo, oldFieldIdx);
+            } else {
+                rf.findDiffPackageAndSubReferencingClassesForField(oldClassInfo, oldFieldIdx);
+            }
+        }
+    }
+
+    private void checkForFinalFields() {
+        char oFFlags[] = oldClassInfo.fieldAccessFlags;
+        int oFLen = oldClassInfo.fieldNames != null ? oldClassInfo.fieldNames.length
+                : 0;
+        int oFMod;
+
+        for (int i = 0; i < oFLen; i++) {
+            oFMod = oFFlags[i];
+            if (Modifier.isPrivate(oFMod)) {
+                continue;  // Changes to private fields don't affect compatibility
+            }
+            if (Modifier.isStatic(oFMod) && Modifier.isFinal(oFMod)) {
+                rf.findAllProjectClasses(oldClassInfo, i);
+                if (Modifier.isPublic(oFMod)) {
+                    publicConstantChanged = true;
+                    return;
+                }
+            }
+        }
+    }
+
+    private void checkMethodsAndConstructors() {
+        String oMNames[] = oldClassInfo.methodNames;
+        String oMSignatures[] = oldClassInfo.methodSignatures;
+        char oMFlags[] = oldClassInfo.methodAccessFlags;
+        String nMNames[] = newClassInfo.methodNames;
+        String nMSignatures[] = newClassInfo.methodSignatures;
+        char nMFlags[] = newClassInfo.methodAccessFlags;
+        int oMLen = oMNames != null ? oMNames.length : 0;
+        int nMLen = nMNames != null ? nMNames.length : 0;
+
+        int oMMod, nMMod;
+        String oMName, oMSig, nMName, nMSig;
+        int i, j, k, endIdx;
+        int nonMatchingNewMethods = nMLen;
+
+        for (i = 0; i < oMLen; i++) {
+            oMMod = oMFlags[i];
+            if (Modifier.isPrivate(oMMod)) {
+                continue;  // Changes to private methods don't affect compatibility
+            }
+            oMName = oMNames[i];
+            oMSig = oMSignatures[i];
+            boolean found = false;
+
+            // Look for the same method in the new version considering name and signature
+            endIdx = nMLen - 1;
+            k = i < nMLen ? i : endIdx;
+            for (j = 0; j < nMLen; j++) {
+                if (oMName == nMNames[k] && oMSig == nMSignatures[k]) {
+                    found = true;
+                    break;
+                }
+                if (k < endIdx) {
+                    k++;
+                } else {
+                    k = 0;
+                }
+            }
+
+            if (found) {
+                nonMatchingNewMethods--;
+                nMMod = nMFlags[k];
+                if (oMMod != nMMod) {
+                    checkMethodModifiers(oMMod, nMMod, i);
+                }
+
+                // Check if the new method throws more exceptions than the old one
+                if (newClassInfo.checkedExceptions != null && newClassInfo.checkedExceptions[k] != null) {
+                    if (oldClassInfo.checkedExceptions == null) {
+                        versionsCompatible = false;
+                        rf.findReferencingClassesForMethod(oldClassInfo, i);
+                    } else if (oldClassInfo.checkedExceptions[i] == null) {
+                        versionsCompatible = false;
+                        rf.findReferencingClassesForMethod(oldClassInfo, i);
+                    } else {
+                        String oldExceptions[] =
+                                oldClassInfo.checkedExceptions[i];
+                        String newExceptions[] =
+                                newClassInfo.checkedExceptions[k];
+                        for (int ei = 0; ei < newExceptions.length; ei++) {
+                            String newEx = newExceptions[ei];
+                            found = false;
+                            for (int ej = 0; ej < oldExceptions.length; ej++) {
+                                if (newEx.equals(oldExceptions[ej])) {
+                                    found = true;
+                                    break;
+                                }
+                            }
+                            if (!found) {
+                                versionsCompatible = false;
+                                rf.findReferencingClassesForMethod(oldClassInfo, i);
+                                break;
+                            }
+                        }
+                    }
+                }
+            } else { // Matching method not found
+                versionsCompatible = false;
+                rf.findReferencingClassesForMethod(oldClassInfo, i);
+                // Deleting a concrete method from an abstract class is a special case
+                if (oldClassInfo.isAbstract() && !Modifier.isAbstract(oMMod)) {
+                    rf.findConcreteSubclassesNotOverridingAbstractMethod(oldClassInfo, oldClassInfo, i);
+                }
+            }
+        }
+
+        if (nonMatchingNewMethods > 0) {  // There are some methods/constructors declared in the new version which don't exist in the old one
+            if (!oldClassInfo.isInterface()) {
+                for (i = 0; i < nMLen; i++) {
+                    nMMod = nMFlags[i];
+                    if (Modifier.isPrivate(nMMod)) {
+                        continue;
+                    }
+                    String newMName = nMNames[i];
+                    final String newMSig = nMSignatures[i];
+                    final boolean isStatic = Modifier.isStatic(nMMod);
+
+                    boolean found = false;
+                    for (j = 0; j < oMLen; j++) {
+                        if (newMName.equals(oMNames[j]) &&
+                                newMSig.equals(oMSignatures[j])) {
+                            found = true;
+                            break;
+                        }
+                    }
+                    if (found) {
+                        continue;  // nMName is not an added method
+                    }
+                    // Check if the new method is a static one that hides an inherited static method
+                    // Check if the new method overloads an existing (declared or inherited) method. Overloading test is rough -
+                    // we just check if the number of parameters is the same. Note that if a new constructor has been added, it
+                    // can be treated in the same way, except that we shouldn't look up "same name methods" for it in superclasses.
+                    oldClassInfo.findExistingSameNameMethods(newMName,
+                            !newMName.equals("<init>"), false,
+                            new ClassInfo.MethodHandler() {
+
+                        void handleMethod(ClassInfo classInfo, int methodIdx) {
+                            String otherMSig =
+                                    classInfo.methodSignatures[methodIdx];
+                            if ((newMSig.equals(otherMSig) && isStatic &&
+                                    classInfo != oldClassInfo) ||
+                                    (newMSig != otherMSig &&
+                                    Utils.sameParamNumber(newMSig, otherMSig))) {
+                                versionsCompatible = false;
+                                rf.findReferencingClassesForMethod(classInfo, methodIdx);
+                            }
+                        }
+                    });
+
+                    if (Modifier.isAbstract(nMMod)) {
+                        // An abstract method added to the class. Find any concrete subclasses that don't override
+                        // or inherit a concrete implementation of this method.
+                        versionsCompatible = false;
+                        rf.findConcreteSubclassesNotOverridingAbstractMethod(oldClassInfo, newClassInfo, i);
+                    }
+                    // Check if there is a method with the same name in some subclass, such that it now overrides
+                    // or overloads the added method.
+                    if (subclassesDeclareSameNameMethod(oldClassInfo, newMName)) {
+                        versionsCompatible = false;
+                    }
+                }
+            } else {  // We are checking an interface.
+                for (i = 0; i < nMLen; i++) {
+                    String newMName = nMNames[i];
+                    final String newMSig = nMSignatures[i];
+
+                    boolean found = false;
+                    for (j = 0; j < oMLen; j++) {
+                        if (newMName == oMNames[j] && newMSig == oMSignatures[j]) {
+                            found = true;
+                            break;
+                        }
+                    }
+
+                    if (!found) {
+                        versionsCompatible = false;
+
+                        // Check if the new method overloads an existing (declared or inherited) method. Overloading test is rough -
+                        // we just check if the number of parameters is the same.
+                        oldClassInfo.findExistingSameNameMethods(newMName, true, true, new ClassInfo.MethodHandler() {
+
+                            void handleMethod(ClassInfo classInfo, int methodIdx) {
+                                String otherMSig =
+                                        classInfo.methodSignatures[methodIdx];
+                                if (newMSig != otherMSig &&
+                                        Utils.sameParamNumber(newMSig, otherMSig)) {
+                                    rf.findReferencingClassesForMethod(classInfo, methodIdx);
+                                }
+                            }
+                        });
+
+                        rf.findDirectlyAndOtherwiseImplementingConcreteClasses(oldClassInfo);
+                        rf.findAbstractSubtypesWithSameNameMethod(oldClassInfo, newMName, newMSig);
+                        break;
+                    }
+                }
+            }
+        }
+    }
+
+    private void checkMethodModifiers(int oMMod, int nMMod, int oldMethodIdx) {
+        if (Modifier.isPrivate(nMMod)) {
+            versionsCompatible = false;
+            rf.findReferencingClassesForMethod(oldClassInfo, oldMethodIdx);
+        } else if (Modifier.isPublic(oMMod) && Modifier.isProtected(nMMod)) {
+            versionsCompatible = false;
+            rf.findDiffPackageReferencingClassesForMethod(oldClassInfo, oldMethodIdx);
+        } else if ((Modifier.isPublic(oMMod) || Modifier.isProtected(oMMod)) &&
+                (!(Modifier.isPublic(nMMod) || Modifier.isProtected(nMMod) || Modifier.isPrivate(nMMod)))) {
+            versionsCompatible = false;
+            if (Modifier.isPublic(oMMod)) {
+                rf.findDiffPackageReferencingClassesForMethod(oldClassInfo, oldMethodIdx);
+            } else {
+                rf.findDiffPackageAndSubReferencingClassesForMethod(oldClassInfo, oldMethodIdx);
+            }
+        } else if ((Modifier.isPrivate(oMMod) && !Modifier.isPrivate(nMMod)) ||
+                (Modifier.isProtected(oMMod) && Modifier.isPublic(nMMod)) ||
+                (!(Modifier.isPublic(oMMod) || Modifier.isProtected(oMMod) || Modifier.isPrivate(oMMod)) &&
+                (Modifier.isPublic(nMMod) || Modifier.isProtected(nMMod)))) {
+            versionsCompatible = false;
+            rf.findSubclassesReimplementingMethod(oldClassInfo, oldMethodIdx);
+        }
+
+        if ((!Modifier.isAbstract(oMMod) && Modifier.isAbstract(nMMod)) ||
+                (Modifier.isStatic(oMMod) != Modifier.isStatic(nMMod))) {
+            versionsCompatible = false;
+            rf.findReferencingClassesForMethod(oldClassInfo, oldMethodIdx);
+            if (!Modifier.isAbstract(oMMod) && Modifier.isAbstract(nMMod)) {
+                rf.findConcreteSubclassesNotOverridingAbstractMethod(oldClassInfo, newClassInfo, oldMethodIdx);
+            }
+        }
+        if (!Modifier.isFinal(oMMod) && Modifier.isFinal(nMMod)) {
+            versionsCompatible = false;
+            rf.findSubclassesReimplementingMethod(oldClassInfo, oldMethodIdx);
+        }
+    }
+
+    /**
+     * Returns true if any subclass(es), direct or indirect, declare a method with name methodName.
+     * For each such occurence, referencing classes are looked up and added to the list of affected classes.
+     */
+    private boolean subclassesDeclareSameNameMethod(ClassInfo oldClassInfo, String methodName) {
+        boolean res = false;
+        ClassInfo[] directSubclasses = oldClassInfo.getDirectSubclasses();
+        for (int i = 0; i < directSubclasses.length; i++) {
+            ClassInfo subclass = directSubclasses[i];
+            int methNo = subclass.declaresSameNameMethod(methodName);
+            if (methNo >= 0) {
+                rf.addToAffectedClassNames(subclass.name);
+                rf.findReferencingClassesForMethod(subclass, methNo);
+                res = true;
+            }
+            if (subclassesDeclareSameNameMethod(subclass, methodName)) {
+                res = true;
+            }
+        }
+        return res;
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/Main.java b/third_party/jmake/src/org/pantsbuild/jmake/Main.java
new file mode 100644
index 0000000..0e805548
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/Main.java
@@ -0,0 +1,899 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.BufferedReader;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.StreamTokenizer;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * The main class of the <b>jmake</b> tool.<p>
+ *
+ * Has several entrypoints: <code>main</code>, <code>mainExternal</code>, <code>mainProgrammatic</code>,
+ * <code>mainExternalControlled</code> and <code>mainProgrammaticControlled</code>.
+ * The first is not intended to be used by applications other than <b>jmake</b> itself, whereas the
+ * rest can be used to call <b>jmake</b> externally with various degrees of control over its behaviour.
+ * See method comments for more details.
+ *
+ * @author Misha Dmitriev
+ *  12 October 2004
+ */
+public class Main {
+
+    static final String DEFAULT_STORE_NAME = "jmake.pdb";
+    static final String VERSION = "1.3.8-11";
+    private String pdbFileName = null;
+    private List<String> allProjectJavaFileNamesList =
+            new ArrayList<String>(100);
+    private String allProjectJavaFileNames[];
+    private String addedJavaFileNames[],  removedJavaFileNames[],  updatedJavaFileNames[];
+    private String destDir = "";
+    private List<String> javacAddArgs = new ArrayList<String>();
+    private String jcPath,  jcMainClass,  jcMethod;
+    private String jcExecApp;
+    boolean controlledExecution = false;
+    Object externalApp = null;
+    Method externalCompileSourceFilesMethod = null;
+    private boolean failOnDependentJar = false,  noWarnOnDependentJar = false;
+    private boolean pdbTextFormat = false;
+    private PCDManager pcdm = null;
+    private String dependencyFile;
+    private static final String optNames[] = {"-h", "-help", "-d", "-pdb", "-C", "-jcpath", "-jcmainclass", "-jcmethod", "-jcexec", "-Xtiming", "-version",
+        "-warnlimit", "-failondependentjar", "-nowarnondependentjar", "-classpath", "-projclasspath", "-bootclasspath", "-extdirs", "-vpath", "-pdb-text-format",
+        "-depfile"};
+    private static final int optArgs[] = {0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1};
+    private static final int OPT_H = 0;
+    private static final int OPT_HELP = 1;
+    private static final int OPT_D = 2;
+    private static final int OPT_STORE = 3;
+    private static final int OPT_JAVAC_OPT = 4;
+    private static final int OPT_JCPATH = 5;
+    private static final int OPT_JCMAINCLASS = 6;
+    private static final int OPT_JCMETHOD = 7;
+    private static final int OPT_JCEXEC = 8;
+    private static final int OPT_TIMING = 9;
+    private static final int OPT_VERSION = 10;
+    private static final int OPT_WARNLIMIT = 11;
+    private static final int OPT_FAILONDEPJAR = 12;
+    private static final int OPT_NOWARNONDEPJAR = 13;
+    private static final int OPT_CLASSPATH = 14;
+    private static final int OPT_PROJECTCLASSPATH = 15;
+    private static final int OPT_BOOTCLASSPATH = 16;
+    private static final int OPT_EXTDIRS = 17;
+    private static final int OPT_VPATH = 18;
+    private static final int OPT_PDB_TEXT_FORMAT = 19;
+    private static final int OPT_DEPENDENCY_FILE = 20;
+
+    /** Construct a new instance of Main. */
+    public Main() {
+    }
+
+    /**
+     * Checks whether the argument is a legal jmake option. Returns its number or
+     * -1 if not found.
+     */
+    private static int inOptions(String option) {
+        if (option.startsWith(optNames[OPT_JAVAC_OPT])) {
+            return OPT_JAVAC_OPT;
+        }
+        for (int i = 0; i < optNames.length; i++) {
+            if (option.equals(optNames[i])) {
+                return i;
+            }
+        }
+        return -1;
+    }
+
+    private void processCommandLine(String args[]) {
+        if ((args.length == 0) || (args.length == 1 && args[0].equals(optNames[OPT_HELP]))) {
+            printUsage();
+            throw new PrivateException(new PublicExceptions.NoActionRequestedException());
+        }
+
+        List<String> argsV = new ArrayList<String>();
+        for (int i = 0; i < args.length; i++) {
+            argsV.add(args[i]);
+        }
+        int argsSt = 0;
+        String arg;
+
+        while (argsSt < argsV.size()) {
+            arg = argsV.get(argsSt++);
+            if (arg.charAt(0) == '-') {
+                int argN = inOptions(arg);
+                if (argN != -1) {
+                    if (argsSt + optArgs[argN] > argsV.size()) {
+                        optRequiresArg("\"" + optNames[argN] + "\"");
+                    }
+                } else {
+                    bailOut(arg + ERR_IS_INVALID_OPTION);
+                }
+
+                switch (argN) {
+                    case OPT_H:
+                    case OPT_HELP:
+                        printUsage();
+                        throw new PrivateException(new PublicExceptions.NoActionRequestedException());
+                    case OPT_D:
+                        destDir = argsV.get(argsSt);
+                        javacAddArgs.add("-d");
+                        javacAddArgs.add(argsV.get(argsSt));
+                        argsSt++;
+                        break;
+                    case OPT_CLASSPATH:
+                        try {
+                            setClassPath(argsV.get(argsSt++));
+                        } catch (PublicExceptions.InvalidCmdOptionException ex) {
+                            bailOut(ex.getMessage());
+                        }
+                        break;
+                    case OPT_PROJECTCLASSPATH:
+                        try {
+                            setProjectClassPath(argsV.get(argsSt++));
+                        } catch (PublicExceptions.InvalidCmdOptionException ex) {
+                            bailOut(ex.getMessage());
+                        }
+                        break;
+                    case OPT_STORE:
+                        pdbFileName = argsV.get(argsSt++);
+                        break;
+                    case OPT_JAVAC_OPT:
+                        String javacArg =
+                                (argsV.get(argsSt - 1)).substring(2);
+                        if (javacArg.equals("-d") ||
+                                javacArg.equals("-classpath") ||
+                                javacArg.equals("-bootclasspath") ||
+                                javacArg.equals("-extdirs")) {
+                            bailOut(javacArg + ERR_SHOULD_BE_EXPLICIT);
+                        }
+                        javacAddArgs.add(javacArg);
+                        break;
+                    case OPT_JCPATH:
+                        if (jcExecApp != null) {
+                            bailOut(ERR_NO_TWO_COMPILER_OPTIONS);
+                        }
+                        jcPath = argsV.get(argsSt++);
+                        break;
+                    case OPT_JCMAINCLASS:
+                        if (jcExecApp != null) {
+                            bailOut(ERR_NO_TWO_COMPILER_OPTIONS);
+                        }
+                        jcMainClass = argsV.get(argsSt++);
+                        break;
+                    case OPT_JCMETHOD:
+                        if (jcExecApp != null) {
+                            bailOut(ERR_NO_TWO_COMPILER_OPTIONS);
+                        }
+                        jcMethod = argsV.get(argsSt++);
+                        break;
+                    case OPT_JCEXEC:
+                        if (jcPath != null || jcMainClass != null || jcMethod != null) {
+                            bailOut(ERR_NO_TWO_COMPILER_OPTIONS);
+                        }
+                        jcExecApp = argsV.get(argsSt++);
+                        break;
+                    case OPT_TIMING:
+                        Utils.setTimingOn();
+                        break;
+                    case OPT_VERSION:
+                        // Utils.printInfoMessage("jmake version " + VERSION); // Printed anyway at present...
+                        throw new PrivateException(new PublicExceptions.NoActionRequestedException());
+                    case OPT_WARNLIMIT:
+                        try {
+                            Utils.warningLimit =
+                                    Integer.parseInt(argsV.get(argsSt++));
+                        } catch (NumberFormatException e) {
+                            Utils.ignore(e);
+                            bailOut(argsV.get(argsSt) + ERR_IS_INVALID_OPTION);
+                        }
+                        break;
+                    case OPT_FAILONDEPJAR:
+                        if (noWarnOnDependentJar) {
+                            bailOut("it is not allowed to use -nowarnondependentjar and -failondependentjar together");
+                        }
+                        failOnDependentJar = true;
+                        break;
+                    case OPT_NOWARNONDEPJAR:
+                        if (failOnDependentJar) {
+                            bailOut("it is not allowed to use -failondependentjar and -nowarnondependentjar together");
+                        }
+                        noWarnOnDependentJar = true;
+                        break;
+                    case OPT_BOOTCLASSPATH:
+                        try {
+                            setBootClassPath(argsV.get(argsSt++));
+                        } catch (PublicExceptions.InvalidCmdOptionException ex) {
+                            bailOut(ex.getMessage());
+                        }
+                        break;
+                    case OPT_EXTDIRS:
+                        try {
+                            setExtDirs(argsV.get(argsSt++));
+                        } catch (PublicExceptions.InvalidCmdOptionException ex) {
+                            bailOut(ex.getMessage());
+                        }
+                        break;
+                    case OPT_VPATH:
+                        try {
+                            setVirtualPath(argsV.get(argsSt++));
+                        } catch (PublicExceptions.InvalidCmdOptionException ex) {
+                            bailOut(ex.getMessage());
+                        }
+                        break;
+                    case OPT_PDB_TEXT_FORMAT:
+                        pdbTextFormat = true;
+                        break;
+                    case OPT_DEPENDENCY_FILE:
+                        dependencyFile = argsV.get(argsSt++);
+                        break;
+                    default:
+                        bailOut(arg + ERR_IS_INVALID_OPTION);
+                }
+            } else {    // Not an option, at least does not start with "-". Treat it as a command line file name or source name.
+                if (arg.length() > 1 && arg.charAt(0) == '@') {
+                    arg = arg.substring(1);
+                    loadCmdFile(arg, argsV);
+                } else {
+                    if (!arg.endsWith(".java")) {
+                        bailOut(arg + ERR_IS_INVALID_OPTION);
+                    }
+                    allProjectJavaFileNamesList.add(arg);
+                }
+            }
+        }
+    }
+
+    /** Load @-file that can contain anything that command line can contain. */
+    private void loadCmdFile(String name, List<String> argsV) {
+        try {
+            Reader r = new BufferedReader(new FileReader(name));
+            StreamTokenizer st = new StreamTokenizer(r);
+            st.resetSyntax();
+            st.wordChars(' ', 255);
+            st.whitespaceChars(0, ' ');
+            st.commentChar('#');
+            st.quoteChar('"');
+            st.quoteChar('\'');
+            while (st.nextToken() != StreamTokenizer.TT_EOF) {
+                argsV.add(st.sval);
+            }
+            r.close();
+        } catch (IOException e) {
+            throw new PrivateException(new PublicExceptions.CommandFileReadException(name + ":\n" + e.getMessage()));
+        }
+    }
+
+    /**
+     * Main entrypoint for applications that want to call <b>jmake</b> externally and are willing
+     * to handle exceptions that it may throw.
+     *
+     * @param  args  command line arguments passed to <b>jmake</b>.
+     *
+     * @throws PublicExceptions.NoActionRequestedException  if <b>jmake</b> was not requested to do any real work;
+     * @throws PublicExceptions.InvalidCmdOptionException   if invalid command line option was detected;
+     * @throws PublicExceptions.PDBCorruptedException       if project database is corrupted;
+     * @throws PublicExceptions.CommandFileReadException    if there was error reading a command file;
+     * @throws PublicExceptions.CompilerInteractionException if there was a problem initializing or calling the compiler,
+     *                                                       or compilation errors were detected;
+     * @throws PublicExceptions.ClassFileParseException     if there was error parsing a class file;
+     * @throws PublicExceptions.ClassNameMismatchException  if there is a mismatch between the deduced and the actual class name;
+     * @throws PublicExceptions.InvalidSourceFileExtensionException if a supplied source file has an invalid extension (not .java);
+     * @throws PublicExceptions.JarDependsOnSourceException if a class in a <code>JAR</code> is found dependent on a class with the .java source;
+     * @throws PublicExceptions.DoubleEntryException        if more than one entry for the same class is found in the project
+     * @throws FileNotFoundException                        if a <code>.java</code> or a <code>.class</code> file was not found;
+     * @throws IOException                                  if there was an I/O problem of any kind;
+     * @throws PublicExceptions.InternalException           if an internal problem that should never happen was detected.
+     */
+    public void mainProgrammatic(String args[]) throws
+            PublicExceptions.NoActionRequestedException,
+            PublicExceptions.InvalidCmdOptionException,
+            PublicExceptions.PDBCorruptedException,
+            PublicExceptions.CommandFileReadException,
+            PublicExceptions.CompilerInteractionException,
+            PublicExceptions.ClassFileParseException,
+            PublicExceptions.ClassNameMismatchException,
+            PublicExceptions.InvalidSourceFileExtensionException,
+            PublicExceptions.JarDependsOnSourceException,
+            PublicExceptions.DoubleEntryException,
+            FileNotFoundException,
+            IOException,
+            PublicExceptions.InternalException {
+        try {
+            Utils.printInfoMessage("Jmake version " + VERSION);
+            if (!controlledExecution) {
+                processCommandLine(args);
+                String[] projectJars = ClassPath.getProjectJars();
+                if (projectJars != null) {
+                    for (int i = 0; i < projectJars.length; i++) {
+                        allProjectJavaFileNamesList.add(projectJars[i]);
+                    }
+                }
+                allProjectJavaFileNames =
+                        allProjectJavaFileNamesList.toArray(new String[allProjectJavaFileNamesList.size()]);
+            } else {
+                String[] projectJars = ClassPath.getProjectJars();
+                if (projectJars != null) {
+                    String newNames[] =
+                            new String[allProjectJavaFileNames.length + projectJars.length];
+                    System.arraycopy(allProjectJavaFileNames, 0, newNames, 0, allProjectJavaFileNames.length);
+                    System.arraycopy(projectJars, 0, newNames, allProjectJavaFileNames.length, projectJars.length);
+                    allProjectJavaFileNames = newNames;
+                }
+            }
+
+            Utils.startTiming(Utils.TIMING_PDBREAD);
+            PCDContainer pcdc;
+            pcdc = PCDContainer.load(pdbFileName, pdbTextFormat);
+            Utils.stopAndPrintTiming("DB read", Utils.TIMING_PDBREAD);
+
+            pcdm = new PCDManager(pcdc, allProjectJavaFileNames,
+                addedJavaFileNames, removedJavaFileNames, updatedJavaFileNames,
+                destDir, javacAddArgs, failOnDependentJar, noWarnOnDependentJar,
+                dependencyFile);
+
+            pcdm.initializeCompiler(jcExecApp, jcPath, jcMainClass, jcMethod, externalApp, externalCompileSourceFilesMethod);
+
+            pcdm.run();
+        } catch (PrivateException e) {
+            Throwable origException = e.getOriginalException();
+            if (origException instanceof PublicExceptions.NoActionRequestedException) {
+                throw (PublicExceptions.NoActionRequestedException) origException;
+            } else if (origException instanceof PublicExceptions.InvalidCmdOptionException) {
+                throw (PublicExceptions.InvalidCmdOptionException) origException;
+            } else if (origException instanceof PublicExceptions.CommandFileReadException) {
+                throw (PublicExceptions.CommandFileReadException) origException;
+            } else if (origException instanceof PublicExceptions.PDBCorruptedException) {
+                throw (PublicExceptions.PDBCorruptedException) origException;
+            } else if (origException instanceof PublicExceptions.CompilerInteractionException) {
+                throw (PublicExceptions.CompilerInteractionException) origException;
+            } else if (origException instanceof PublicExceptions.ClassFileParseException) {
+                throw (PublicExceptions.ClassFileParseException) origException;
+            } else if (origException instanceof PublicExceptions.ClassNameMismatchException) {
+                throw (PublicExceptions.ClassNameMismatchException) origException;
+            } else if (origException instanceof PublicExceptions.InvalidSourceFileExtensionException) {
+                throw (PublicExceptions.InvalidSourceFileExtensionException) origException;
+            } else if (origException instanceof PublicExceptions.JarDependsOnSourceException) {
+                throw (PublicExceptions.JarDependsOnSourceException) origException;
+            } else if (origException instanceof PublicExceptions.DoubleEntryException) {
+                throw (PublicExceptions.DoubleEntryException) origException;
+            } else if (origException instanceof FileNotFoundException) {
+                throw (FileNotFoundException) origException;
+            } else if (origException instanceof IOException) {
+                throw (IOException) origException;
+            } else if (origException instanceof PublicExceptions.InternalException) {
+                throw (PublicExceptions.InternalException) origException;
+            }
+        } finally {
+            ClassPath.resetOnFinish();
+        }
+    }
+
+    /**
+     * Main entrypoint for applications that want to call <b>jmake</b> externally and would prefer
+     * receiving an error code instead of an exception in case something goes wrong.<p>
+     *
+     * @param  args  command line arguments passed to <b>jmake</b>.
+     *
+     * @return <dl>
+     *  <dt><code>  0</code>  if everything was successful;
+     *  <dt><code> -1</code>  invalid command line option detected;
+     *  <dt><code> -2</code>  error reading command file;
+     *  <dt><code> -3</code>  project database corrupted;
+     *  <dt><code> -4</code>  error initializing or calling the compiler;
+     *  <dt><code> -5</code>  compilation error;
+     *  <dt><code> -6</code>  error parsing a class file;
+     *  <dt><code> -7</code>  file not found;
+     *  <dt><code> -8</code>  I/O exception;
+     *  <dt><code> -9</code>  internal jmake exception;
+     *  <dt><code>-10</code>  deduced and actual class name mismatch;
+     *  <dt><code>-11</code>  invalid source file extension;
+     *  <dt><code>-12</code>  a class in a <code>JAR</code> is found dependent on a class with the .java source;
+     *  <dt><code>-13</code>  more than one entry for the same class is found in the project
+     *  <dt><code>-20</code> internal Java error (caused by <code>java.lang.InternalError</code>);
+     *  <dt><code>-30</code> internal Java error (caused by <code>java.lang.RuntimeException</code>).
+     *  </dl>
+     */
+    public int mainExternal(String args[]) {
+        try {
+            mainProgrammatic(args);
+        } catch (PublicExceptions.NoActionRequestedException e0) {
+            // Nothing to do
+        } catch (PublicExceptions.InvalidCmdOptionException e1) {
+            Utils.printErrorMessage(e1.getMessage());
+            return -1;
+        } catch (PublicExceptions.CommandFileReadException e2) {
+            Utils.printErrorMessage("error parsing command file:");
+            Utils.printErrorMessage(e2.getMessage());
+            return -2;
+        } catch (PublicExceptions.PDBCorruptedException e3) {
+            Utils.printErrorMessage("project database corrupted: " + e3.getMessage());
+            return -3;
+        } catch (PublicExceptions.CompilerInteractionException e4) {
+            if (e4.getOriginalException() != null) {
+                Utils.printErrorMessage("error interacting with the compiler: ");
+                Utils.printErrorMessage(e4.getMessage());
+                Utils.printErrorMessage("original exception:");
+                Utils.printErrorMessage(e4.getOriginalException().getMessage());
+                return -4;
+            } else { // Otherwise there is a compilation error, and the compiler has already printed a lot...
+                return -5;
+            }
+        } catch (PublicExceptions.ClassFileParseException e6) {
+            Utils.printErrorMessage(e6.getMessage());
+            return -6;
+        } catch (FileNotFoundException e7) {
+            Utils.printErrorMessage(e7.getMessage());
+            return -7;
+        } catch (IOException e8) {
+            Utils.printErrorMessage(e8.getMessage());
+            return -8;
+        } catch (PublicExceptions.InternalException e9) {
+            Utils.printErrorMessage("internal jmake exception detected:");
+            Utils.printErrorMessage(e9.getMessage());
+            Utils.printErrorMessage(Utils.REPORT_PROBLEM);
+            Utils.printErrorMessage("the stack trace is as follows:");
+            e9.printStackTrace();
+            return -9;
+        } catch (PublicExceptions.ClassNameMismatchException e10) {
+            Utils.printErrorMessage(e10.getMessage());
+            return -10;
+        } catch (PublicExceptions.InvalidSourceFileExtensionException e11) {
+            Utils.printErrorMessage(e11.getMessage());
+            return -11;
+        } catch (PublicExceptions.JarDependsOnSourceException e12) {
+            Utils.printErrorMessage(e12.getMessage());
+            return -12;
+        } catch (PublicExceptions.DoubleEntryException e13) {
+            Utils.printErrorMessage(e13.getMessage());
+            return -13;
+        } catch (InternalError e20) {
+            Utils.printErrorMessage("internal Java error: " + e20);
+            Utils.printErrorMessage("Consult the following stack trace for more info:");
+            e20.printStackTrace();
+            return -20;
+        } catch (RuntimeException e30) {
+            Utils.printErrorMessage("internal Java exception: " + e30);
+            Utils.printErrorMessage("Consult the following stack trace for more info:");
+            e30.printStackTrace();
+            return -30;
+        }
+
+        return 0;
+    }
+
+    /**
+     * Main entrypoint for applications such as Ant, that want to have full control over
+     * compilations that <b>jmake</b> invokes, and are willing to handle exceptions
+     * that it may throw.
+     *
+     * @param javaFileNames    array of strings that specify <code>.java</code> file names.
+     * @param destDirName      name of the destination directory (<b>jmake</b> will look up binary classes
+     *                         in there, it should be the same as the one used by the Java compiler method).
+     *                         If <code>null</code> is passed, classes will be looked up in the same directories
+     *                         as their sources, in agreement with the default Java compiler behaviour.
+     * @param pdbFileName      project database file name (if <code>null</code> is passed,
+     *                         a file with the default name placed in the current directory will be used).
+     * @param externalApp      an object on which to invoke <code>externalCompileSourceFilesMethod</code> method.
+     * @param externalCompileSourceFilesMethod    a method of the form <code>int x(String[] args)</code>. It
+     *                         should return <code>0</code> if compilation is successful and any non-zero value
+     *                         otherwise. <b>jmake</b> passes it a list of the <code>.java</code> files to
+     *                         recompile in the form of canonical full path file names.
+     *
+     * @throws PublicExceptions.NoActionRequestedException  if <b>jmake</b> was not requested to do any real work;
+     * @throws PublicExceptions.InvalidCmdOptionException   if invalid command line option was detected;
+     * @throws PublicExceptions.PDBCorruptedException       if project database is corrupted;
+     * @throws PublicExceptions.CommandFileReadException    if there was error reading a command file;
+     * @throws PublicExceptions.CompilerInteractionException if there was a problem initializing or calling the compiler,
+     *                                                       or compilation errors were detected;
+     * @throws PublicExceptions.ClassFileParseException     if there was error parsing a class file;
+     * @throws PublicExceptions.ClassNameMismatchException  if there is a mismatch between the deduced and the actual class name;
+     * @throws PublicExceptions.InvalidSourceFileExtensionException if a specified source file has an invalid extension (not .java);
+     * @throws PublicExceptions.JarDependsOnSourceException if a class in a <code>JAR</code> is found dependent on a class with the .java source;
+     * @throws PublicExceptions.DoubleEntryException        if more than one entry for the same class is found in the project
+     * @throws PublicExceptions.InternalException           if an internal problem that should never happen was detected.
+     * @throws FileNotFoundException                        if a <code>.java</code> or a <code>.class</code> file was not found;
+     * @throws IOException                                  if there was an I/O problem of any kind;
+     */
+    public void mainProgrammaticControlled(String javaFileNames[], String destDirName, String pdbFileName,
+            Object externalApp, Method externalCompileSourceFilesMethod) throws
+            PublicExceptions.NoActionRequestedException,
+            PublicExceptions.InvalidCmdOptionException,
+            PublicExceptions.PDBCorruptedException,
+            PublicExceptions.CommandFileReadException,
+            PublicExceptions.CompilerInteractionException,
+            PublicExceptions.ClassFileParseException,
+            PublicExceptions.ClassNameMismatchException,
+            PublicExceptions.InvalidSourceFileExtensionException,
+            PublicExceptions.JarDependsOnSourceException,
+            PublicExceptions.DoubleEntryException,
+            PublicExceptions.InternalException,
+            FileNotFoundException,
+            IOException {
+
+        controlledExecution = true;
+        this.pdbFileName = pdbFileName;
+        this.destDir = destDirName;
+        this.allProjectJavaFileNames = javaFileNames;
+        this.externalApp = externalApp;
+        this.externalCompileSourceFilesMethod = externalCompileSourceFilesMethod;
+
+        mainProgrammatic(null);
+    }
+
+    /**
+     * Main entrypoint for applications such as Ant, that want to have full control over
+     * compilations that <b>jmake</b> invokes, and do not want to handle exceptions that it
+     * may throw. Error codes returned are the same as <code>mainExternal(String[])</code> returns.
+     *
+     * @param javaFileNames    array of strings that specify <code>.java</code> file names.
+     * @param destDirName      name of the destination directory (<b>jmake</b> will look up binary classes
+     *                         in there, it should be the same as the one used by the Java compiler method).
+     *                         If <code>null</code> is passed, classes will be looked up in the same directories
+     *                         as their sources, in agreement with the default Java compiler behaviour.
+     * @param pdbFileName      project database file name (if <code>null</code> is passed,
+     *                         a file with the default name placed in the current directory will be used).
+     * @param externalApp      an object on which to invoke <code>externalCompileSourceFilesMethod</code> method.
+     * @param externalCompileSourceFilesMethod    a method of the form <code>int x(String[] args)</code>. It
+     *                         should return <code>0</code> if compilation is successful and any non-zero value
+     *                         otherwise. <b>jmake</b> passes it a list of the <code>.java</code> files to
+     *                         recompile in the form of canonical full path file names.
+     *
+     * @see #mainExternal(String[])
+     */
+    public int mainExternalControlled(String javaFileNames[], String destDirName, String pdbFileName,
+            Object externalApp, Method externalCompileSourceFilesMethod) {
+        controlledExecution = true;
+        this.pdbFileName = pdbFileName;
+        this.destDir = destDirName;
+        this.allProjectJavaFileNames = javaFileNames;
+        this.externalApp = externalApp;
+        this.externalCompileSourceFilesMethod = externalCompileSourceFilesMethod;
+
+        return mainExternal(null);
+    }
+
+    /**
+     * Main entrypoint for applications such as IDEs, that themselves keep track of updated/added/removed sources,
+     * want to have full control over compilations that <b>jmake</b> invokes, and are willing to handle exceptions
+     * that it may throw.
+     *
+     * @param addedJavaFileNames   names of <code>.java</code> files just added to the project
+     * @param removedJavaFileNames names of <code>.java</code> files just removed from the project
+     * @param updatedJavaFileNames names of updated project <code>.java</code> files
+     * @param destDirName      name of the destination directory (<b>jmake</b> will look up binary classes
+     *                         in there, it should be the same as the one used by the Java compiler method).
+     *                         If <code>null</code> is passed, classes will be looked up in the same directories
+     *                         as their sources, in agreement with the default Java compiler behaviour.
+     * @param pdbFileName      project database file name (if <code>null</code> is passed,
+     *                         a file with the default name placed in the current directory will be used).
+     * @param externalApp      an object on which to invoke <code>externalCompileSourceFilesMethod</code> method.
+     * @param externalCompileSourceFilesMethod    a method of the form <code>int x(String[] args)</code>. It
+     *                         should return <code>0</code> if compilation is successful and any non-zero value
+     *                         otherwise. <b>jmake</b> passes it a list of the <code>.java</code> files to
+     *                         recompile in the form of canonical full path file names.
+     *
+     * @throws PublicExceptions.NoActionRequestedException  if <b>jmake</b> was not requested to do any real work;
+     * @throws PublicExceptions.InvalidCmdOptionException   if invalid command line option was detected;
+     * @throws PublicExceptions.PDBCorruptedException       if project database is corrupted;
+     * @throws PublicExceptions.CommandFileReadException    if there was error reading a command file;
+     * @throws PublicExceptions.CompilerInteractionException if there was a problem initializing or calling the compiler,
+     *                                                       or compilation errors were detected;
+     * @throws PublicExceptions.ClassFileParseException     if there was error parsing a class file;
+     * @throws PublicExceptions.ClassNameMismatchException  if there is a mismatch between the deduced and the actual class name;
+     * @throws PublicExceptions.InvalidSourceFileExtensionException if a specified source file has an invalid extension (not .java);
+     * @throws PublicExceptions.JarDependsOnSourceException if a class in a <code>JAR</code> is found dependent on a class with the .java source;
+     * @throws PublicExceptions.DoubleEntryException        if more than one entry for the same class is found in the project
+     * @throws PublicExceptions.InternalException           if an internal problem that should never happen was detected.
+     * @throws FileNotFoundException                        if a <code>.java</code> or a <code>.class</code> file was not found;
+     * @throws IOException                                  if there was an I/O problem of any kind;
+     */
+    public void mainProgrammaticControlled(String addedJavaFileNames[], String removedJavaFileNames[], String updatedJavaFileNames[],
+            String destDirName, String pdbFileName,
+            Object externalApp, Method externalCompileSourceFilesMethod) throws
+            PublicExceptions.NoActionRequestedException,
+            PublicExceptions.InvalidCmdOptionException,
+            PublicExceptions.PDBCorruptedException,
+            PublicExceptions.CommandFileReadException,
+            PublicExceptions.CompilerInteractionException,
+            PublicExceptions.ClassFileParseException,
+            PublicExceptions.ClassNameMismatchException,
+            PublicExceptions.InvalidSourceFileExtensionException,
+            PublicExceptions.JarDependsOnSourceException,
+            PublicExceptions.DoubleEntryException,
+            PublicExceptions.InternalException,
+            FileNotFoundException,
+            IOException {
+
+        controlledExecution = true;
+        this.pdbFileName = pdbFileName;
+        this.destDir = destDirName;
+        this.addedJavaFileNames = addedJavaFileNames;
+        this.removedJavaFileNames = removedJavaFileNames;
+        this.updatedJavaFileNames = updatedJavaFileNames;
+        this.externalApp = externalApp;
+        this.externalCompileSourceFilesMethod = externalCompileSourceFilesMethod;
+
+        mainProgrammatic(null);
+    }
+
+    /**
+     * Main entrypoint for applications such as IDEs, that themselves keep track of updated/added/removed sources,
+     * want to have full control over compilations that <b>jmake</b> invokes, and do not want to handle exceptions
+     * that it may throw. Error codes returned are the same as <code>mainExternal(String[])</code> returns.
+     *
+     * @param addedJavaFileNames   names of <code>.java</code> files just added to the project
+     * @param removedJavaFileNames names of <code>.java</code> files just removed from the project
+     * @param updatedJavaFileNames names of updated project <code>.java</code> files
+     * @param destDirName      name of the destination directory (<b>jmake</b> will look up binary classes
+     *                         in there, it should be the same as the one used by the Java compiler method).
+     *                         If <code>null</code> is passed, classes will be looked up in the same directories
+     *                         as their sources, in agreement with the default Java compiler behaviour.
+     * @param pdbFileName      project database file name (if <code>null</code> is passed,
+     *                         a file with the default name placed in the current directory will be used).
+     * @param externalApp      an object on which to invoke <code>externalCompileSourceFilesMethod</code> method.
+     * @param externalCompileSourceFilesMethod    a method of the form <code>int x(String[] args)</code>. It
+     *                         should return <code>0</code> if compilation is successful and any non-zero value
+     *                         otherwise. <b>jmake</b> passes it a list of the <code>.java</code> files to
+     *                         recompile in the form of canonical full path file names.
+     *
+     * @see #mainExternal(String[])
+     */
+    public int mainExternalControlled(String addedJavaFileNames[], String removedJavaFileNames[], String updatedJavaFileNames[],
+            String destDirName, String pdbFileName,
+            Object externalApp, Method externalCompileSourceFilesMethod) {
+        controlledExecution = true;
+        this.pdbFileName = pdbFileName;
+        this.destDir = destDirName;
+        this.addedJavaFileNames = addedJavaFileNames;
+        this.removedJavaFileNames = removedJavaFileNames;
+        this.updatedJavaFileNames = updatedJavaFileNames;
+        this.externalApp = externalApp;
+        this.externalCompileSourceFilesMethod = externalCompileSourceFilesMethod;
+
+        return mainExternal(null);
+    }
+
+    /**
+     * Main entrypoint for the standalone <b>jmake</b> application. This method calls does little but calling
+     * <code>mainExternal</code>, and its execution always completes with <code>System.exit(code)</code>,
+     * where <code>code</code> is the value returned by <code>mainExternal</code>.
+     *
+     * @see #mainExternal(String[])
+     * @see #mainProgrammatic(String[])
+     *
+     * @param  args  command line arguments passed to <b>jmake</b>
+     */
+    public static void main(String args[]) {
+        Utils.startTiming(Utils.TIMING_TOTAL);
+
+        Main m = new Main();
+        int exitCode = m.mainExternal(args);
+
+        Utils.stopAndPrintTiming("Total", Utils.TIMING_TOTAL);
+        if ( exitCode != 0 ) {
+            System.exit(exitCode);
+        }
+    }
+
+    /**
+     * Customize the output of <b>jmake</b>.
+     *
+     * @see #setOutputStreams(PrintStream, PrintStream, PrintStream)
+     *
+     * @param printInfoMessages    specify whether to print information messages
+     * @param printWarningMessages specify whether to print warning messages
+     * @param printErrorMessages   specify whether to print error messages
+     */
+    public static void customizeOutput(boolean printInfoMessages,
+            boolean printWarningMessages,
+            boolean printErrorMessages) {
+        Utils.customizeOutput(printInfoMessages, printWarningMessages, printErrorMessages);
+    }
+
+    /**
+     * Set the class path to be used by the compiler, and also by the dependency checker for the purposes of
+     * superclass/superinterface change tracking. For the compiler, this class path will be merged with the
+     * project class path (set via setProjectClassPath(String)). Other than that, its value will be used only to
+     * look up superclasses/superinterfaces of project classes. Note that non-project superclasses and
+     * superinterfaces are first looked up at the boot class path, then on the extension class path, and then
+     * on this class path.
+     *
+     * @see #setProjectClassPath(String)
+     * @see #setBootClassPath(String)
+     * @see #setExtDirs(String)
+     *
+     * @param classPath  the value of the class path, in the usual format (i.e. entries that are directories
+     *                   or JARs, separated by colon or semicolon depending on the platform).
+     *
+     * @throws PublicExceptions.InvalidCmdOptionException   if invalid class path value is specified.
+     */
+    public static void setClassPath(String classPath) throws PublicExceptions.InvalidCmdOptionException {
+        ClassPath.setClassPath(classPath);
+    }
+
+    /**
+     * Set the class path to be used by the compiler, and also by the dependency checker for the purposes of
+     * superclass/superinterface change tracking and sourceless class dependency checking. For the compiler,
+     * and also in order to look up superclasses/superinterfaces of project classes, this class path will be
+     * merged with the standard class path (set via setClassPath(String)). But in addition, all binary classes
+     * that are on this class path are stored in the project database and checked for updates every time jmake
+     * is invoked. Any changes to these classes trigger the standard dependency checking procedure. However,
+     * dependent classes are looked up only among the "normal" project classes, i.e. those that have sources.
+     * Therefore sourceless classes are assumed to always be mutually consistent.
+     *
+     * Currently only JAR files can be present on this class path.
+     *
+     * @see #setClassPath(String)
+     *
+     * @param projectClassPath  the value of the class path, in the usual format (i.e. entries that are directories
+     *                          or JARs, separated by colon or semicolon depending on the platform).
+     *
+     * @throws PublicExceptions.InvalidCmdOptionException   if invalid class path value is specified.
+     */
+    public static void setProjectClassPath(String projectClassPath) throws PublicExceptions.InvalidCmdOptionException {
+        ClassPath.setProjectClassPath(projectClassPath);
+    }
+
+    /**
+     * Set the boot class path to be used by the compiler (-bootclasspath option) and also by the dependency
+     * checker (by default, the value of "sun.boot.class.path" property is used).
+     *
+     * @see #setClassPath(String)
+     *
+     * @param classPath   the value of the boot class path, in the usual format (i.e. entries that are directories
+     *                   or JARs, separated by colon or semicolon depending on the platform).
+     *
+     * @throws PublicExceptions.InvalidCmdOptionException   if invalid class path value is specified.
+     */
+    public static void setBootClassPath(String classPath) throws PublicExceptions.InvalidCmdOptionException {
+        ClassPath.setBootClassPath(classPath);
+    }
+
+    /**
+     * Set the extensions location to be used by the compiler (-extdirs option) and also by the dependency
+     * checker (by default, the value of "java.ext.dirs" property is used).
+     *
+     * @see #setClassPath(String)
+     *
+     * @param dirs   the value of extension directories, in the usual format (one or more directory names
+     *               separated by colon or semicolon depending on the platform).
+     *
+     * @throws PublicExceptions.InvalidCmdOptionException   if invalid class path value is specified.
+     */
+    public static void setExtDirs(String dirs) throws PublicExceptions.InvalidCmdOptionException {
+        ClassPath.setExtDirs(dirs);
+    }
+
+    /**
+     * Set the virtual path used to find both source and class files that are part of the project
+     * but are not in the local directory.
+     *
+     * @see #setClassPath(String)
+     *
+     * @param dirs   the value of extension directories, in the usual format (one or more directory names
+     *               separated by colon or semicolon depending on the platform).
+     *
+     * @throws PublicExceptions.InvalidCmdOptionException   if invalid path value is specified.
+     */
+    public static void setVirtualPath(String dirs) throws PublicExceptions.InvalidCmdOptionException {
+        ClassPath.setVirtualPath(dirs);
+    }
+
+    /** Produce no warning or error message upon a dependent <code>JAR</code> detection. */
+    public static final int DEPJAR_NOWARNORERROR = 0;
+    /** Produce a warning upon a dependent <code>JAR</code> detection. */
+    public static final int DEPJAR_WARNING = 1;
+    /** Produce an error message (throw an exception) upon a dependent <code>JAR</code> detection. */
+    public static final int DEPJAR_ERROR = 2;
+
+    /**
+     * Set the response of <b>jmake</b> in case a dependence of a class located in a <code>JAR</code> file on a
+     * class with a <code>.java</code> source is detected (such dependencies are highly discouraged, since it is not
+     * possible to recompile a class in the <code>JAR</code> that has no source).
+     *
+     * @param code  response type: DEPJAR_NOWARNORERROR, DEPJAR_WARNING (default behaviour) or DEPJAR_ERROR.
+     */
+    public void setResponseOnDependentJar(int code) {
+        switch (code) {
+            case DEPJAR_NOWARNORERROR:
+                noWarnOnDependentJar = true;
+                failOnDependentJar = false;
+                break;
+            case DEPJAR_WARNING:
+                noWarnOnDependentJar = false;
+                failOnDependentJar = false;
+                break;
+            case DEPJAR_ERROR:
+                noWarnOnDependentJar = false;
+                failOnDependentJar = true;
+                break;
+        }
+    }
+
+    /**
+     * Return the names of all classes that <b>jmake</b>, on this invocation, found updated - either because
+     * <b>jmake</b> itself recompiled them or because they were updated independently (their timestamp/checksum
+     * found different from those contained in the project database).
+     */
+    public String[] getUpdatedClasses() {
+        return pcdm.getAllUpdatedClassesAsStringArray();
+    }
+
+    /**
+     * Set the output print streams to be used by <b>jmake</b>.
+     *
+     * @see #customizeOutput(boolean, boolean, boolean)
+     *
+     * @param out   print stream to be used for information ("logging") messages that <b>jmake</b> emits
+     * @param warn  print stream to be used for warning messages
+     * @param err   print stream to be used for error messages
+     */
+    public static void setOutputStreams(PrintStream out, PrintStream warn, PrintStream err) {
+        Utils.setOutputStreams(out, warn, err);
+    }
+
+    /** Get the version of this copy of <b>jmake</b> */
+    public static String getVersion() {
+        return VERSION;
+    }
+    private static final String ERR_IS_INVALID_OPTION =
+            " is an invalid option or argument.";
+    private static final String ERR_NO_TWO_COMPILER_OPTIONS =
+            "You may not specify both compiler class and compiler executable application";
+    private static final String ERR_SHOULD_BE_EXPLICIT =
+            " compiler option should be specified directly as a jmake option";
+
+    private static void bailOut(String s) {
+        throw new PrivateException(new PublicExceptions.InvalidCmdOptionException("jmake: " + s + "\nRun \"jmake -h\" for help."));
+    }
+
+    private static void optRequiresArg(String s) {
+        bailOut("the " + s + " option requires an argument.");
+    }
+
+    private static void printUsage() {
+        Utils.printInfoMessage("Usage: jmake <options> <.java files> <@files>");
+        Utils.printInfoMessage("where possible options include:");
+        Utils.printInfoMessage("  -h, -help             print this help message");
+        Utils.printInfoMessage("  -version              print the product version number");
+        Utils.printInfoMessage("  -pdb <file name>      specify non-default project database file");
+        Utils.printInfoMessage("  -pdb-text-format      if specified, pdb file is stored in text format");
+        Utils.printInfoMessage("  -d <directory>        specify where to place generated class files");
+        Utils.printInfoMessage("  -classpath <path>     specify where to find user class files");
+        Utils.printInfoMessage("  -projclasspath <path> specify where to find sourceless project classes");
+        Utils.printInfoMessage("                        (currently only JARs are allowed on this path)");
+        Utils.printInfoMessage("  -C<option>            specify an option to be passed to the Java compiler");
+        Utils.printInfoMessage("                        (this option's arguments should also be preceded by -C)");
+        Utils.printInfoMessage("  -jcpath <path>        specify the class path for a non-default Java compiler");
+        Utils.printInfoMessage("                        (default is <JAVAHOME>/lib/tools.jar)");
+        Utils.printInfoMessage("  -jcmainclass <class>  specify the main class for a non-default Java compiler");
+        Utils.printInfoMessage("                        (default is com.sun.tools.javac.Main)");
+        Utils.printInfoMessage("  -jcmethod <method>    specify the method to call in the Java compiler class");
+        Utils.printInfoMessage("                        (default is \"compile(String args[])\")");
+        Utils.printInfoMessage("  -jcexec <file name>   specify a binary non-default Java compiler application");
+        Utils.printInfoMessage("  -failondependentjar   fail if a class on projectclasspath depends on a class");
+        Utils.printInfoMessage("                        with .java source (by default, a warning is issued)");
+        Utils.printInfoMessage("  -nowarnondependentjar no warning or error if a class on projectclasspath");
+        Utils.printInfoMessage("                        depends on a class with a .java source (use with care)");
+        Utils.printInfoMessage("  -warnlimit <number>   specify the maximum number of warnings (20 by default)");
+        Utils.printInfoMessage("  -bootclasspath <path> override location of bootstrap class files");
+        Utils.printInfoMessage("  -extdirs <dirs>       override location of installed extensions");
+        Utils.printInfoMessage("  -vpath <dirs>         a list of directories to search for Java and class files similar to GNUMake's VPATH");
+        Utils.printInfoMessage("  -depfile <path>       a file generated by the compiler containing additional java->class mappings");
+        Utils.printInfoMessage("");
+        Utils.printInfoMessage("Examples:");
+        Utils.printInfoMessage("  jmake -d classes -classpath .;mylib.jar X.java Y.java Z.java");
+        Utils.printInfoMessage("  jmake -pdb myproject.pdb -jcexec c:\\java\\jikes\\jikes.exe @myproject.src");
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/PCDContainer.java b/third_party/jmake/src/org/pantsbuild/jmake/PCDContainer.java
new file mode 100644
index 0000000..b02cfa4
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/PCDContainer.java
@@ -0,0 +1,64 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.File;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * This class is a persistent container for the Project Class Directory, that can
+ * read and write itself from/to disk.
+ *
+ * @author Misha Dmitriev
+ *  12 November 2001
+ */
+public class PCDContainer {
+
+    /** The data structure (currently {@link LinkedHashMap}) for PCD, that maps class name to
+    record containing information about the class */
+    Map<String,PCDEntry> pcd;
+    String storeName;
+    boolean textFormat;
+
+    private PCDContainer(Map<String,PCDEntry> pcd, String storeName, boolean textFormat) {
+        this.storeName = storeName;
+        this.pcd = pcd;
+        this.textFormat = textFormat;
+    }
+
+    public static PCDContainer load(String storeName, boolean textFormat) {
+        if (storeName == null) {
+            storeName = Main.DEFAULT_STORE_NAME;
+        }
+        File storeFile = Utils.checkFileForName(storeName);
+        if (storeFile != null) {
+            Utils.printInfoMessageNoEOL("Opening project database...  ");
+            Map<String,PCDEntry> pcd;
+            if (textFormat) {
+                pcd = new TextProjectDatabaseReader().readProjectDatabaseFromFile(storeFile);
+            } else {
+                pcd = new BinaryProjectDatabaseReader().readProjectDatabaseFromFile(storeFile);
+            }
+            PCDContainer pcdc = new PCDContainer(pcd, storeName, textFormat);
+            Utils.printInfoMessage("Done.");
+            return pcdc;
+        }
+        return new PCDContainer(null, storeName, textFormat);
+    }
+
+    public void save() {
+        Utils.printInfoMessageNoEOL("Writing project database...  ");
+        File outfile = new File(storeName);
+        if (textFormat) {
+            new TextProjectDatabaseWriter().writeProjectDatabaseToFile(outfile, pcd);
+        } else {
+            new BinaryProjectDatabaseWriter().writeProjectDatabaseToFile(outfile, pcd);
+        }
+        Utils.printInfoMessage("Done.");
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/PCDEntry.java b/third_party/jmake/src/org/pantsbuild/jmake/PCDEntry.java
new file mode 100644
index 0000000..72fb3a4
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/PCDEntry.java
@@ -0,0 +1,111 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.File;
+
+/**
+ * An instance of this class represents an entry in the Project Class Directory.
+ *
+ * @author Misha Dmitriev
+ *  29 March 2002
+ */
+public class PCDEntry {
+    // Class versions compare results
+
+    static final int CV_UNCHECKED = 0;
+    static final int CV_COMPATIBLE = 1;
+    static final int CV_INCOMPATIBLE = 2;
+    static final int CV_DELETED = 3;
+    static final int CV_NEW = 4;
+    static final int CV_NEWER_FOUND_NEARER = 5;
+    String className;           // Dots are replaced with slashes for convenience
+    transient String classFileFullPath;
+    String javaFileFullPath;
+    long oldClassFileLastModified;
+    transient long newClassFileLastModified;
+    long oldClassFileFingerprint;
+    transient long newClassFileFingerprint;
+    ClassInfo oldClassInfo;
+    transient ClassInfo newClassInfo;
+    transient int checkResult;         // Reflects the result of class version comparison
+    transient boolean checked;             // Mark entries for classes that have been checked and found existing.
+    // It helps to detect double entries for the same class in the project file list,
+    // and also not to confuse them with the case when a .java source for a class is moved.
+
+    /** This constructor is called to initialize a record for a class that has just been added to the project. */
+    public PCDEntry(String className,
+            String javaFileFullPath,
+            String classFileFullPath,
+            long classFileLastModified,
+            long classFileFingerprint,
+            ClassInfo classInfo) {
+        this.className = className;
+        this.classFileFullPath = classFileFullPath;
+        this.javaFileFullPath = javaFileFullPath;
+        this.oldClassFileLastModified = this.newClassFileLastModified =
+                classFileLastModified;
+        this.oldClassFileFingerprint = this.newClassFileFingerprint =
+                classFileFingerprint;
+        this.newClassInfo = classInfo;
+        checked = true;
+    }
+
+    /**
+     * This constructor is called to initialize a record for a class that
+     * exists at least in the previous version of the project.
+     */
+    public PCDEntry(String className,
+            String javaFileFullPath,
+            long classFileLastModified,
+            long classFileFingerprint,
+            ClassInfo classInfo) {
+        this.className = className;
+        this.javaFileFullPath = javaFileFullPath;
+        this.oldClassFileLastModified = classFileLastModified;
+        this.oldClassFileFingerprint = classFileFingerprint;
+        this.oldClassInfo = classInfo;
+    }
+
+    // Debugging
+    public String toString() {
+        return "className = " + className +
+                "; classFileFullPath = " + classFileFullPath +
+                "; javaFileFullPath = " + javaFileFullPath;
+    }
+
+    /**
+     * Returns the name of the class that corresponds to the file name, i.e. the public class
+     */
+    private String getExpectedClassName() {
+        File path = new File(javaFileFullPath);
+        int index = -1;
+        do {
+            index = className.indexOf('/', index + 1);
+            path = path.getParentFile();
+        } while (index != -1);
+        String pathString = path.toString();
+        if (!pathString.endsWith("/"))
+            pathString += "/";
+        // It is assumed that the javaFileFillPath ends with .java
+        int javaPathWithoutSuffix = javaFileFullPath.length() - 5;
+        return javaFileFullPath.substring(pathString.length(),
+                                          javaPathWithoutSuffix);
+    }
+
+    /**
+     * A class that neither has the same name as the java file, nor an inner class, is
+     * package-private.
+     */
+    public boolean isPackagePrivateClass() {
+        String expectedClassName = getExpectedClassName();
+
+        return !(className.equals(expectedClassName)
+                 || (className.startsWith(expectedClassName)
+                     && className.charAt(expectedClassName.length()) == '$'));
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/PCDManager.java b/third_party/jmake/src/org/pantsbuild/jmake/PCDManager.java
new file mode 100644
index 0000000..5ff3cd1
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/PCDManager.java
@@ -0,0 +1,1603 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.StringTokenizer;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.zip.Adler32;
+
+/**
+ * This class implements management of the Project Class Directory, automatic tracking
+ * of changes and recompilation of .java sources for a project.
+ *
+ * @author Misha Dmitriev
+ *  23 January 2003
+ */
+public class PCDManager {
+
+    private PCDContainer pcdc;
+    private Map<String,PCDEntry> pcd;   // Maps project class names to PCDEntries
+    private String projectJavaAndJarFilesArray[];
+    private String addedJavaAndJarFilesArray[],  removedJavaAndJarFilesArray[],  updatedJavaAndJarFilesArray[];
+    private List<String> newJavaFiles;
+    private Set<String> updatedJavaFiles;
+    private Set<String> recompiledJavaFiles;
+    private Set<String> updatedClasses;       // This set is emptied on every new internal jmake iteration...
+    private Set<String> allUpdatedClasses;    // whereas in this one the names of all updated classes found during this jmake invocation are stored.
+    private Set<String> updatedAndCheckedClasses;
+    private Set<String> deletedClasses;
+    private Set<String> updatedJarFiles;
+    private Set<String> stableJarFiles;
+    private Set<String> newJarFiles;
+    private Set<String> deletedJarFiles;
+    /* Dependencies from the dependencyFile, if any */
+    private Map<String, List<String>> extraDependencies;
+
+    private String destDir;
+    private boolean destDirSpecified;
+    private List<String> javacAddArgs;
+    private Class<?> compilerClass;
+    private Method compileMethod;
+    private String jcExecApp;
+    private Object externalApp;
+    private Method externalCompileSourceFilesMethod;
+    private Adler32 checkSum;
+    private CompatibilityChecker cv;
+    private ClassFileReader cfr;
+    private boolean newProject = false;
+    private String dependencyFile = null;
+    private static boolean backSlashFileSeparator = File.separatorChar != '/';
+
+    /**** Interface to the class ****/
+    /**
+     * Either projectJavaAndJarFilesArray != null and added.. == removed.. == updatedJavaAndJarFilesArray == null,
+     * or projectJavaAndJarFilesArray == null and one or more of others != null.
+     * When PCDManager is called from Main, this is guaranteed, since separate entrypoint functions initialize
+     * either one or another of the above argument groups, but never both.
+     */
+    public PCDManager(PCDContainer pcdc,
+                      String projectJavaAndJarFilesArray[],
+                      String addedJavaAndJarFilesArray[],
+                      String removedJavaAndJarFilesArray[],
+                      String updatedJavaAndJarFilesArray[],
+                      String in_destDir,
+                      List<String> javacAddArgs,
+                      boolean failOnDependentJar,
+                      boolean noWarnOnDependentJar,
+                      String dependencyFile) {
+        this.pcdc = pcdc;
+        if (pcdc.pcd == null) {
+            pcd = new LinkedHashMap<String,PCDEntry>();
+            pcdc.pcd = pcd;
+            newProject = true;
+        } else {
+            pcd = pcdc.pcd;
+        }
+
+        this.projectJavaAndJarFilesArray = projectJavaAndJarFilesArray;
+        this.addedJavaAndJarFilesArray = addedJavaAndJarFilesArray;
+        this.removedJavaAndJarFilesArray = removedJavaAndJarFilesArray;
+        this.updatedJavaAndJarFilesArray = updatedJavaAndJarFilesArray;
+        this.dependencyFile = dependencyFile;
+        newJavaFiles = new ArrayList<String>();
+        updatedJavaFiles = new LinkedHashSet<String>();
+        recompiledJavaFiles = new LinkedHashSet<String>();
+        updatedAndCheckedClasses = new LinkedHashSet<String>();
+        deletedClasses = new LinkedHashSet<String>();
+        allUpdatedClasses = new LinkedHashSet<String>();
+
+        updatedJarFiles = new LinkedHashSet<String>();
+        stableJarFiles = new LinkedHashSet<String>();
+        newJarFiles = new LinkedHashSet<String>();
+        deletedJarFiles = new LinkedHashSet<String>();
+
+        initializeDestDir(in_destDir);
+        this.javacAddArgs = javacAddArgs;
+
+        checkSum = new Adler32();
+
+        cv = new CompatibilityChecker(this, failOnDependentJar, noWarnOnDependentJar);
+        cfr = new ClassFileReader();
+    }
+
+    public Collection<PCDEntry> entries() {
+        return pcd.values();
+    }
+
+    public ClassFileReader getClassFileReader() {
+        return cfr;
+    }
+
+    public ClassInfo getClassInfoForName(int verCode, String className) {
+        PCDEntry pcde = pcd.get(className);
+        if (pcde != null) {
+            return getClassInfoForPCDEntry(verCode, pcde);
+        } else {
+            return null;
+        }
+    }
+
+    public boolean isProjectClass(int verCode, String className) {
+        if (verCode == ClassInfo.VER_OLD) {
+            return pcd.containsKey(className);
+        } else {
+            PCDEntry pcde = pcd.get(className);
+            return (pcde != null && pcde.checkResult != PCDEntry.CV_DELETED);
+        }
+    }
+
+    /**
+     * Get an instance of ClassInfo (load a class file if necessary) for the given version (old or new) of
+     * the class determined by pcde. For an old class version, always returns a non-null result; but for a new
+     * version, null is returned if class file is not found. In most of the current uses of this method null result
+     * is not checked, because it's either called for an old version or it is already known that the .class file
+     * should be present; nevertheless, beware!
+     */
+    public ClassInfo getClassInfoForPCDEntry(int verCode, PCDEntry pcde) {
+        if (verCode == ClassInfo.VER_OLD) {
+            return pcde.oldClassInfo;
+        }
+
+        ClassInfo res = pcde.newClassInfo;
+        if (res == null) {
+            byte classFileBytes[];
+            String classFileFullPath = null;
+            if (pcde.javaFileFullPath.endsWith(".java")) {
+                File classFile = Utils.checkFileForName(pcde.classFileFullPath);
+                if (classFile == null) {
+                    return null;  // Class file not found.
+                }
+                classFileBytes = Utils.readFileIntoBuffer(classFile);
+                classFileFullPath = pcde.classFileFullPath;
+            } else {
+                try {
+                    JarFile jarFile = new JarFile(pcde.javaFileFullPath);
+                    JarEntry jarEntry =
+                            jarFile.getJarEntry(pcde.className + ".class");
+                    if (jarEntry == null) {
+                        return null;
+                    }
+                    classFileBytes =
+                            Utils.readZipEntryIntoBuffer(jarFile, jarEntry);
+                } catch (IOException ex) {
+                    throw new PrivateException(ex);
+                }
+            }
+            res =
+                    new ClassInfo(classFileBytes, verCode, this, classFileFullPath);
+            pcde.newClassInfo = res;
+        }
+        return res;
+    }
+
+    /**
+     * Returns null if class is compileable (has a .java source) and not recompiled yet, "" if
+     * class has already been recompiled or has been deleted from project, and the class's .jar
+     * name if class comes from a jar, hence is uncompileable.
+     */
+    public String classAlreadyRecompiledOrUncompileable(String className) {
+        PCDEntry pcde = pcd.get(className);
+        if (pcde == null) {
+            //!!!
+            for (String keyName : pcd.keySet()) {
+                PCDEntry entry = pcd.get(keyName);
+                if (entry.className.equals(className)) {
+                    System.out.println("ERROR: inconsistent entry: key = " +
+                            keyName + ", name in entry = " + entry.className);
+                }
+            }
+            //!!!
+            throw internalException(className + " not in project when it should be");
+        }
+        if (pcde.checkResult == PCDEntry.CV_DELETED) {
+            return "";
+        }
+        if (pcde.javaFileFullPath.endsWith(".jar")) {
+            return pcde.javaFileFullPath;
+        } else {
+            return (recompiledJavaFiles.contains(pcde.javaFileFullPath) ? "" : null);
+        }
+    }
+
+    /**
+     * Compiler initialization depends on compiler type specified.
+     * If jcExecApp != null, i.e. an external executable compiler application is used, and nothing has to be done.
+     * If externalApp != null, that is, jmake is called by an external application such as Ant, which
+     * manages compilation in its own way, and also nothing has to be done.
+     * Otherwise, load the compiler class and method (either specified through jcPath, jcMainClass and jcMethod,
+     * or the default one.
+     */
+    public void initializeCompiler(String jcExecApp,
+            String jcPath, String jcMainClass, String jcMethod,
+            Object externalApp, Method externalCompileSourceFilesMethod) {
+        ClassPath.initializeAllClassPaths();
+
+        if (externalApp != null) {
+            this.externalApp = externalApp;
+            this.externalCompileSourceFilesMethod =
+                    externalCompileSourceFilesMethod;
+            return;
+        }
+        if (jcExecApp != null) {
+            this.jcExecApp = jcExecApp;
+            return;
+        }
+
+        if (jcPath == null) {
+            String javaHome = System.getProperty("java.home");
+            // In my tests it ends with '/jre'. Or it could be ending with '/bin' as well? Let's assume it can be both and delete
+            // this latter directory.
+            if (javaHome.endsWith(File.separator + "jre") || javaHome.endsWith(File.separator + "bin")) {
+                javaHome = javaHome.substring(0, javaHome.length() - 4);
+            }
+            jcPath = javaHome + "/lib/tools.jar";
+        }
+        ClassLoader compilerLoader;
+        try {
+            compilerLoader = ClassPath.getClassLoaderForPath(jcPath);
+        } catch (Exception ex) {
+            throw compilerInteractionException("error opening compiler path", ex, 0);
+        }
+
+        if (jcMainClass == null) {
+            jcMainClass = "com.sun.tools.javac.Main";
+        }
+        if (jcMethod == null) {
+            jcMethod = "compile";
+        }
+
+        try {
+            compilerClass = compilerLoader.loadClass(jcMainClass);
+        } catch (ClassNotFoundException e) {
+            throw compilerInteractionException("error loading compiler main class " + jcMainClass, e, 0);
+        }
+
+        Class<?>[] args = new Class<?>[]{String[].class};
+        try {
+            compileMethod = compilerClass.getMethod(jcMethod, args);
+        } catch (Exception e) {
+            throw compilerInteractionException("error getting method com.sun.tools.javac.Main.compile(String args[])", e, 0);
+        }
+    }
+
+    /** Main entrypoint for this class */
+    public void run() {
+        Utils.startTiming(Utils.TIMING_SYNCHRO);
+        synchronizeProjectFilesAndPCD();
+        Utils.stopAndPrintTiming("Synchro", Utils.TIMING_SYNCHRO);
+        Utils.printTiming("of which synchro check file", Utils.TIMING_SYNCHRO_CHECK_JAVA_FILES);
+
+        Utils.startTiming(Utils.TIMING_FIND_UPDATED_JAVA_FILES);
+        findUpdatedJavaAndJarFiles();
+        Utils.stopAndPrintTiming("findUpdatedJavaAndJarFiles", Utils.TIMING_FIND_UPDATED_JAVA_FILES);
+        Utils.printTiming("of which classFileObsoleteOrDeleted", Utils.TIMING_CLASS_FILE_OBSOLETE_OR_DELETED);
+
+        // Let's free some memory
+        projectJavaAndJarFilesArray = null;
+
+        updatedClasses = new LinkedHashSet<String>();
+        dealWithClassesInUpdatedJarFiles();
+
+        int iterNo = 0;
+        int res = 0;
+        while (iterNo == 0 || updatedJavaFiles.size() != 0 || newJavaFiles.size() != 0) {
+            // It may happen that we didn't find any updated or new .java files. However, we still need to enter
+            // this loop because there may be some class files that need compatibility checking. This can happen
+            // either if somebody had recompiled their sources bypassing jmake, or if their checking during the
+            // previous invocation of jmake failed, because their dependent code recompilation failed.
+            if (updatedJavaFiles.size() > 0 || newJavaFiles.size() > 0) {
+                Utils.startTiming(Utils.TIMING_COMPILE);
+                int intermediateRes = recompileUpdatedJavaFiles();
+                Utils.stopAndPrintTiming("Compile", Utils.TIMING_COMPILE);
+                if (intermediateRes != 0) {
+                    res = intermediateRes;
+                }
+            }
+
+            Utils.startTiming(Utils.TIMING_PDBUPDATE);
+            // New classes can be added to pdb only if compilation was successful, i.e. the new project version is consistent.
+            if (iterNo++ == 0 && res == 0) {
+                findClassFilesForNewJavaAndJarFiles();
+                findClassFilesForUpdatedJavaFiles();
+                dealWithNestedClassesForUpdatedJavaFiles();
+            }
+            Utils.stopAndPrintTiming("Entering new classes in PDB", Utils.TIMING_PDBUPDATE);
+
+            updatedJavaFiles.clear();
+            newJavaFiles.clear();
+
+            Utils.startTiming(Utils.TIMING_FIND_UPDATED_CLASSES);
+            findUpdatedClasses();
+            Utils.stopAndPrintTiming("Find updated classes", Utils.TIMING_FIND_UPDATED_CLASSES);
+
+            Utils.startTiming(Utils.TIMING_CHECK_UPDATED_CLASSES);
+            checkDeletedClasses();
+            checkUpdatedClasses();
+            Utils.stopAndPrintTiming("Check updated classes", Utils.TIMING_CHECK_UPDATED_CLASSES);
+
+            updatedClasses = new LinkedHashSet<String>();
+            if (ClassPath.getVirtualPath() != null) {
+                if (res != 0)
+                    break;
+            }
+        }
+
+        Utils.startTiming(Utils.TIMING_PDBWRITE);
+        updateClassFilesInfoInPCD(res);
+        pcdc.save();
+        Utils.stopAndPrintTiming("PDB write", Utils.TIMING_PDBWRITE);
+
+        if (res != 0) {
+            throw compilerInteractionException("compilation error(s)", null, res);
+        }
+    }
+
+    /**
+     * Find the newly-created class files for existing java files.
+     */
+    private void findClassFilesForUpdatedJavaFiles() {
+        if (dependencyFile == null)
+            return;
+
+        Set<String> allClasses = new HashSet<String>();
+
+        Map<String, List<String>> dependencies = parseDependencyFile();
+        for (String file : updatedJavaFiles) {
+            List<String> myDeps = dependencies.get(file);
+            if (myDeps != null) {
+                PCDEntry parent = getNamedPCDE(file, dependencies);
+                for (String dependency : myDeps) {
+                    allClasses.add(dependency);
+                    if (pcd.containsKey(dependency))
+                        continue;
+                    findClassFileOnFilesystem(file, parent, dependency, false);
+                }
+            }
+        }
+        for (Map.Entry<String, PCDEntry> entry : pcd.entrySet()) {
+            String cls = entry.getKey();
+            if (!allClasses.contains(cls)) {
+                PCDEntry pcde = entry.getValue();
+                if (updatedJavaFiles.contains(pcde.javaFileFullPath)) {
+                    deletedClasses.add(cls);
+                }
+            }
+        }
+    }
+
+    public String[] getAllUpdatedClassesAsStringArray() {
+        String[] res = new String[allUpdatedClasses.size()];
+        int i = 0;
+        for (String updatedClass : allUpdatedClasses) {
+            res[i++] = updatedClass.replace('/', '.');
+        }
+        return res;
+    }
+
+    /**
+     * Synchronize projectJavaAndJarFilesArray and PCD, i.e. leave only those entries in the PCD which have their
+     * .java (.jar) files in projectJavaAndJarFilesArray. New .java files in projectJavaAndJarFilesArray (i.e. those
+     * for which there are no entries in the PCD yet) are added to newJavaFiles; new .jar files are added to newJarFiles.
+     * Alternatively, just use the supplied arrays of added and deleted .java and .jar files.
+     *
+     * For entries whose .java files are not in the PCD anymore, try to delete .class files. We need to do that before
+     * compilation to avoid the situation when a .java file is removed but compilation succeeds because the .class file
+     * is still there.
+     *
+     * Unfortunately, we also need to delete all class files for non-nested classes whose names differ from their .java
+     * file name, because we can't tell when they've been removed from their .java files -- but it's only safe to do this
+     * for files that originate from java files that we're compiling this round.
+     *
+     * Upon return from this method, all of the .java and .jar files in the PCD are known to exist.
+     */
+    private void synchronizeProjectFilesAndPCD() {
+        if (projectJavaAndJarFilesArray != null) {
+            Set<String> pcdJavaFilesSet = new LinkedHashSet<String>(pcd.size() * 3 / 2);
+            for(PCDEntry entry : entries()) {
+                pcdJavaFilesSet.add(entry.javaFileFullPath);
+            }
+
+            Set<String> canonicalPJF =
+                    new LinkedHashSet<String>(projectJavaAndJarFilesArray.length * 3 / 2);
+
+            // Add .java files that are not in PCD to newJavaFiles; add .jar files that are not in PCD to newJarFiles.
+            for (int i = 0; i < projectJavaAndJarFilesArray.length; i++) {
+                String projFileName = projectJavaAndJarFilesArray[i];
+                Utils.startTiming(Utils.TIMING_SYNCHRO_CHECK_TMP);
+                File projFile = Utils.checkFileForName(projFileName);
+                Utils.stopAndAddTiming(Utils.TIMING_SYNCHRO_CHECK_TMP, Utils.TIMING_SYNCHRO_CHECK_JAVA_FILES);
+                if (projFile == null) {
+                    throw new PrivateException(new FileNotFoundException("specified source file " + projFileName + " not found."));
+                }
+                // The main reason for using getAbsolutePath() instead of more reliable getCanonicalPath() is the fact that
+                // sometimes users may name the actual files containing Java code in some custom way, and give javac/jmake
+                // symbolic links to these files (that have correct .java names) instead. getCanonicalPath(), however, returns the
+                // real (i.e. user custom) file name, which will confuse our test below and then javac.
+                String absoluteProjFileName = projFile.getAbsolutePath();
+                // On Windows, make sure the drive letter is always in lower case
+                if (backSlashFileSeparator) {
+                    absoluteProjFileName =
+                            Utils.convertDriveLetterToLowerCase(absoluteProjFileName);
+                }
+                canonicalPJF.add(absoluteProjFileName);
+                if (!pcdJavaFilesSet.contains(absoluteProjFileName)) {
+                    if (absoluteProjFileName.endsWith(".java")) {
+                        newJavaFiles.add(absoluteProjFileName);
+                    } else if (absoluteProjFileName.endsWith(".jar")) {
+                        newJarFiles.add(absoluteProjFileName);
+                    } else {
+                        throw new PrivateException(new PublicExceptions.InvalidSourceFileExtensionException("specified source file " + projFileName + " has an invalid extension (not .java or .jar)."));
+                    }
+                }
+            }
+
+            // Find the entries containing .java or .jar files that are not in project anymore
+            for (Entry<String, PCDEntry> entry : pcd.entrySet()) {
+                String key = entry.getKey();
+                PCDEntry e = entry.getValue();
+                e.oldClassInfo.restorePCDM(this);
+                if (canonicalPJF.contains(e.javaFileFullPath)) {
+                    if (e.isPackagePrivateClass()) {
+                        initializeClassFileFullPath(e);
+                        new File(e.classFileFullPath).delete();
+                    }
+                } else {
+                    if (ClassPath.getVirtualPath() == null) {
+                        deletedClasses.add(key);
+                    } else {
+                        // Okay, not found locally, but virtual path was defined, so try it now....
+                        if ( (e.oldClassFileFingerprint == projectJavaAndJarFilesArray.length &&
+                                newJavaFiles.size() == 0) ||
+                                Utils.checkFileForName(e.javaFileFullPath) != null)
+                        {
+                            e.checkResult = PCDEntry.CV_NEWER_FOUND_NEARER;
+                            e.oldClassFileFingerprint = projectJavaAndJarFilesArray.length;
+                        }
+                        else
+                        {
+                            String classFound = null;
+                            String sourceFound = null;
+                            // Find source and class file via virtual path
+                            String path = ClassPath.getVirtualPath();
+                            // TODO(Eric Ayers): IntelliJ static analysis shows several useless
+                            // expressions that make this loop a no-op.
+                            for (StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
+                                !(classFound != null && sourceFound != null) && st.hasMoreTokens();)
+                            {
+                                String fullPath = st.nextToken()+File.separator+e.className;
+                                if (sourceFound != null && new File(fullPath+".java").exists())
+                                {
+                                    sourceFound = fullPath + ".java";
+                                }
+                                if (classFound != null && new File(fullPath+".class").exists())
+                                {
+                                    classFound = fullPath + ".class";
+                                }
+                            }
+                            // TODO(Eric Ayers): IntelliJ static analysis shows that this expression
+                            // is always true.
+                            if (classFound == null)
+                            {
+                                deletedClasses.add(key);
+                                if (e.javaFileFullPath.endsWith(".jar"))
+                                {
+                                    deletedJarFiles.add(e.javaFileFullPath);
+                                }
+                                else
+                                {
+                                    initializeClassFileFullPath(e);
+                                    (new File(e.classFileFullPath)).delete();
+                                }
+                            }
+                            else if (sourceFound != null)
+                            {
+                                newJavaFiles.add(sourceFound);
+                                e.checkResult = PCDEntry.CV_NEWER_FOUND_NEARER;
+                                e.oldClassFileFingerprint = projectJavaAndJarFilesArray.length;
+                            }
+                            else
+                            {
+                                classFound = classFound.replace('/', File.separatorChar);
+                                throw new PrivateException(new FileNotFoundException("deleted class " + classFound + " still exists."));
+                            }
+                        }
+                    }
+                    if (e.javaFileFullPath.endsWith(".jar")) {
+                        deletedJarFiles.add(e.javaFileFullPath);
+                    } else {  // Try to delete a class file for the removed project class.
+                        initializeClassFileFullPath(e);
+                        (new File(e.classFileFullPath)).delete();
+                    }
+                }
+            }
+        } else { // projectJavaAndJarFilesArray == null - use supplied arrays of added and removed .java and .jar files
+            if (addedJavaAndJarFilesArray != null) {
+                for (String fileName : addedJavaAndJarFilesArray) {
+                    fileName = fileName.intern();
+                    if (fileName.endsWith(".java")) {
+                        newJavaFiles.add(fileName);
+                    } else if (fileName.endsWith(".jar")) {
+                        newJarFiles.add(fileName);
+                    } else {
+                        throw new PrivateException(new PublicExceptions.InvalidSourceFileExtensionException(
+                            "specified source file " + fileName + " has an invalid extension (not .java or .jar)."));
+                    }
+                }
+            }
+
+            Set<String> removedJavaAndJarFilesSet = null;
+            if (removedJavaAndJarFilesArray != null) {
+                removedJavaAndJarFilesSet = new LinkedHashSet<String>();
+                for (String fileName : removedJavaAndJarFilesArray) {
+                    fileName = fileName.intern();
+                    removedJavaAndJarFilesSet.add(fileName);
+                    if (fileName.endsWith(".jar")) {
+                        deletedJarFiles.add(fileName);
+                    }
+                }
+            }
+
+            for (Entry<String, PCDEntry> entry : pcd.entrySet()) {
+                String key = entry.getKey();
+                PCDEntry e = entry.getValue();
+                e.oldClassInfo.restorePCDM(this);
+                if (removedJavaAndJarFilesSet != null &&
+                        removedJavaAndJarFilesSet.contains(e.javaFileFullPath)) {
+                    deletedClasses.add(key);
+                    if (!e.javaFileFullPath.endsWith(".jar")) {  // Try to delete a class file for the removed project class.
+                        initializeClassFileFullPath(e);
+                        (new File(e.classFileFullPath)).delete();
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * In the end of run, update the information in the project database for the class files which have
+     * been updated and checked, or deleted. If compilationResult == 0, i.e. all recompilations were
+     * successful, information for new versions of all of the classes is made permanent, and entries
+     * for deleted classes are removed permanently. Otherwise, information is updated only for those
+     * classes whose old and new versions were found source compatible.
+     */
+    private void updateClassFilesInfoInPCD(int compilationResult) {
+        // If the project appears to be inconsistent after changes, make a preliminary pass that will deal with enclosing
+        // classes for deleted nested classes. The problem with them can be as follows: we delete a nested class C$X,
+        // which is still referenced from somewhere. However, C has not changed at all or at least incompatibly, and
+        // thus we update its PCDEntry, which now does not reference C$X. Other parts of jmake require that a nested
+        // class is always referenced from its directly enclusing class, thus to keep the PCD consistent we have to remove
+        // C$X from the PCD. On the next invocation of jmake, C$X is not in the PDB at all, and thus any classes that
+        // may still reference it and have not been updated are not checked => project becomes inconsistent. We could do
+        // better by immediately marking enclosing classes incompatible once we detect that a deleted nested class is
+        // really referenced from somewhere, but the solution below seems to be more robust.
+        if (compilationResult != 0) {
+            for (String className : updatedAndCheckedClasses) {
+                PCDEntry entry = pcd.get(className);
+                if (entry.checkResult == PCDEntry.CV_DELETED &&
+                        !"".equals(entry.oldClassInfo.directlyEnclosingClass)) {
+                    PCDEntry enclEntry =
+                            pcd.get(entry.oldClassInfo.directlyEnclosingClass);
+                    enclEntry.checkResult = PCDEntry.CV_INCOMPATIBLE;
+                }
+            }
+        }
+
+        for (String className : updatedAndCheckedClasses) {
+            PCDEntry entry = pcd.get(className);
+            if (entry.checkResult == PCDEntry.CV_UNCHECKED) {
+                continue;
+            }
+            if (ClassPath.getVirtualPath() != null) {
+                if (entry.checkResult == PCDEntry.CV_NEWER_FOUND_NEARER) {
+                    continue;
+                }
+            }
+            if (entry.checkResult == PCDEntry.CV_DELETED) {
+                if (compilationResult == 0) {
+                    pcd.remove(className);  // Only if consistency checking is ok, a deleted class can be safely removed from the PCD
+                }
+            } else if (entry.checkResult == PCDEntry.CV_COMPATIBLE ||
+                    entry.checkResult == PCDEntry.CV_NEW ||
+                    (entry.checkResult == PCDEntry.CV_INCOMPATIBLE && compilationResult == 0)) {
+                if (entry.newClassInfo == null) {  // "Safety net" for the (hopefully unlikely) case we overlooked something before...
+                    Utils.printWarningMessage("Warning: internal information inconsistency detected during pdb updating");
+                    Utils.printWarningMessage(Utils.REPORT_PROBLEM);
+                    Utils.printWarningMessage("Class name: " + className);
+                    if (entry.checkResult == PCDEntry.CV_NEW) {
+                        pcd.remove(className);
+                    } else {
+                        continue;
+                    }
+                }
+                entry.oldClassFileLastModified = entry.newClassFileLastModified;
+                entry.oldClassFileFingerprint = entry.newClassFileFingerprint;
+                entry.oldClassInfo = entry.newClassInfo;
+            }
+        }
+    }
+
+    /**
+     * Find all .java files on the filesystem,  for which the .class file does not exist
+     * or is newer than the .java file. Also find all .jar files for which the timestamp
+     * has changed. Alternatively, just use the supplied array of updated .java/.jar files.
+     */
+    private void findUpdatedJavaAndJarFiles() {
+        boolean projectSpecifiedAsAllSources =
+                projectJavaAndJarFilesArray != null;
+        for (PCDEntry entry : entries()) {
+            if (deletedClasses.contains(entry.className)) {
+                continue;
+            }
+            if (entry.javaFileFullPath.endsWith(".java")) {
+                initializeClassFileFullPath(entry);
+                if (projectSpecifiedAsAllSources) {
+                    if (ClassPath.getVirtualPath() != null) {
+                        String paths[] = ClassPath.getVirtualPath().split(File.pathSeparator);
+                        String tmpClassName = entry.className;
+                        tmpClassName = tmpClassName.replaceAll("\\Q$\\E.*$", "");
+                        for (int i=0; i<paths.length; i++) {
+                            String tmpFilename = paths[i] + File.separator + tmpClassName + ".java";
+                            File tmpFile = new File(tmpFilename);
+                            if (tmpFile.exists()) {
+                                entry.javaFileFullPath = tmpFile.getAbsolutePath();
+                                break;
+                            }
+                        }
+                    }
+                    Utils.startTiming(Utils.TIMING_CLASS_FILE_OBSOLETE_TMP);
+                    if (classFileObsoleteOrDeleted(entry)) {
+                        updatedJavaFiles.add(entry.javaFileFullPath);
+                    }
+                    Utils.stopAndAddTiming(Utils.TIMING_CLASS_FILE_OBSOLETE_TMP, Utils.TIMING_CLASS_FILE_OBSOLETE_OR_DELETED);
+                }
+                entry.checked = true;
+            } else {  // Class coming from a .jar file. Mark this entry as checked only if its JAR hasn't changed
+                if (projectJavaAndJarFilesArray != null) {
+                    entry.checked = !checkJarFileForUpdate(entry);
+                }
+            }
+        }
+
+        // Lists of updated/added/deleted source files specified instead of a full list of project sources
+        if (!projectSpecifiedAsAllSources && updatedJavaAndJarFilesArray != null) {
+            for (int i = 0; i < updatedJavaAndJarFilesArray.length; i++) {
+                if (updatedJavaAndJarFilesArray[i].endsWith(".java")) {
+                    updatedJavaFiles.add(updatedJavaAndJarFilesArray[i]);
+                } else {
+                    updatedJarFiles.add(updatedJavaAndJarFilesArray[i]);
+                }
+            }
+        }
+    }
+
+    private boolean classFileObsoleteOrDeleted(PCDEntry entry) {
+        if (ClassPath.getVirtualPath() != null) {
+            File file1 = new File(entry.javaFileFullPath);
+            if (!file1.exists())
+                throw new PrivateException(new FileNotFoundException("specified source file " +
+                        entry.javaFileFullPath + " not found."));
+            if (file1.lastModified() < entry.oldClassFileLastModified)
+            {
+                return false;
+            }
+        }
+        File classFile = Utils.checkFileForName(entry.classFileFullPath);
+        if (classFile == null || !classFile.exists()) {
+            return true; // Class file has been deleted
+        }
+        File javaFile = new File(entry.javaFileFullPath); // Guaranteed to exist at this point
+        if (classFile.lastModified() <= javaFile.lastModified()) {
+            return true;
+        }
+        return false;
+    }
+
+    private boolean checkJarFileForUpdate(PCDEntry entry) {
+        String jarFileName = entry.javaFileFullPath;
+        if (stableJarFiles.contains(jarFileName)) {
+            return false;
+        } else if (updatedJarFiles.contains(jarFileName) ||
+                newJarFiles.contains(jarFileName) ||
+                deletedJarFiles.contains(jarFileName)) {
+            return true;
+        } else {
+            File jarFile = new File(jarFileName); // Guaranteed to exist at this point.
+            if (entry.oldClassFileLastModified != jarFile.lastModified()) {
+                updatedJarFiles.add(jarFileName);
+                return true;
+            } else {
+                stableJarFiles.add(jarFileName);
+                return false;
+            }
+        }
+    }
+
+    public int recompileUpdatedJavaFiles() {
+        if (externalApp != null) {
+            return recompileUpdatedJavaFilesUsingExternalMethod();
+        } else {
+            return recompileUpdatedJavaFilesOurselves();
+        }
+    }
+
+    private int recompileUpdatedJavaFilesOurselves() {
+        int filesNo = updatedJavaFiles.size() + newJavaFiles.size();
+        int addArgsNo = javacAddArgs.size();
+        int argsNo = addArgsNo + filesNo + 2;
+        String compilerBootClassPath, compilerExtDirs;
+        if ((compilerBootClassPath = ClassPath.getCompilerBootClassPath()) != null) {
+            argsNo += 2;
+        }
+        if ((compilerExtDirs = ClassPath.getCompilerExtDirs()) != null) {
+            argsNo += 2;
+        }
+        if (jcExecApp != null) {
+            argsNo++;
+        }
+        String args[] = new String[argsNo];
+        int pos = 0;
+        if (jcExecApp != null) {
+            args[pos++] = jcExecApp;
+        }
+        for (int i = 0; i < addArgsNo; i++) {
+            args[pos++] = javacAddArgs.get(i);
+        }
+        args[pos++] = "-classpath";
+        args[pos++] = ClassPath.getCompilerUserClassPath();
+        if (compilerBootClassPath != null) {
+            args[pos++] = "-bootclasspath";
+            args[pos++] = compilerBootClassPath;
+        }
+        if (compilerExtDirs != null) {
+            args[pos++] = "-extdirs";
+            args[pos++] = compilerExtDirs;
+        }
+        if (!newProject) {
+            Utils.printInfoMessage("Recompiling source files:");
+        }
+        for (String javaFileFullPath : updatedJavaFiles) {
+            if (!newProject) {
+                Utils.printInfoMessage(javaFileFullPath);
+            }
+            recompiledJavaFiles.add(args[pos++] = javaFileFullPath);
+        }
+        for (int j = 0; j < newJavaFiles.size(); j++) {
+            String javaFileFullPath = newJavaFiles.get(j);
+            if (!newProject) {
+                Utils.printInfoMessage(javaFileFullPath);
+            }
+            recompiledJavaFiles.add(args[pos++] = javaFileFullPath);
+        }
+
+        if (jcExecApp == null) {  // Executing javac or some other compiler within the same JVM
+            Object reflectArgs[] = new Object[1];
+            reflectArgs[0] = args;
+            try {
+                Object dummy = compilerClass.newInstance();
+                Integer res = (Integer) compileMethod.invoke(dummy, reflectArgs);
+                return res.intValue();
+            } catch (Exception e) {
+                throw compilerInteractionException("exception thrown when trying to invoke the compiler method", e, 0);
+            }
+        } else {  // Executing an external Java compiler, such as jikes
+            int exitCode = 0;
+            try {
+                Process p = Runtime.getRuntime().exec(args);
+                InputStream pErr = p.getErrorStream();
+                InputStream pOut = p.getInputStream();
+                boolean terminated = false;
+
+                while (!terminated) {
+                    try {
+                        exitCode = p.exitValue();
+                        terminated = true;
+                    } catch (IllegalThreadStateException itse) { // Process not yet terminated, wait for some time
+                        Utils.ignore(itse);
+                        Utils.delay(100);
+                    }
+                    try {
+                        Utils.readAndPrintBytesFromStream(pErr, System.err);
+                        Utils.readAndPrintBytesFromStream(pOut, System.out);
+                    } catch (IOException ioe1) {
+                        throw compilerInteractionException("I/O error when reading the compiler application output", ioe1, exitCode);
+                    }
+                }
+                return exitCode;
+            } catch (IOException ioe2) {
+                throw compilerInteractionException("I/O error when trying to invoke the compiler application", ioe2, exitCode);
+            }
+        }
+    }
+
+    /** Execution under complete control of external app - use externally supplied method to recompile classes */
+    private int recompileUpdatedJavaFilesUsingExternalMethod() {
+        int filesNo = updatedJavaFiles.size() + newJavaFiles.size();
+        String[] fileNames = new String[filesNo];
+        int i = 0;
+        for (String updatedFile : updatedJavaFiles) {
+            recompiledJavaFiles.add(fileNames[i] = updatedFile);
+        }
+        for (int j = 0; j < newJavaFiles.size(); j++) {
+            recompiledJavaFiles.add(fileNames[i++] = newJavaFiles.get(j));
+        }
+
+        try {
+            Integer res =
+                    (Integer) externalCompileSourceFilesMethod.invoke(externalApp, new Object[]{fileNames});
+            return res.intValue();
+        } catch (IllegalAccessException e1) {
+            throw compilerInteractionException("compiler method is not accessible", e1, 0);
+        } catch (IllegalArgumentException e2) {
+            throw compilerInteractionException("illegal arguments passed to compiler method", e2, 0);
+        } catch (InvocationTargetException e3) {
+            throw compilerInteractionException("exception when executing the compiler method", e3, 0);
+        }
+    }
+
+    /**
+     * For each .java file from newJavaFiles, find all of the .class files, the names of which we can
+     * logically deduce (a top-level class with the same name, and all of the nested classes),
+     * and put the info on them into the PCD. Also include any class files from the dependencyFile,
+     * if any. For each .jar file from newJarFiles, find all of the .class files in that archive and
+     * put info on them into the PCD.
+     */
+    private void findClassFilesForNewJavaAndJarFiles() {
+        for (String javaFileFullPath : newJavaFiles) {
+            PCDEntry pcde =
+                    findClassFileOnFilesystem(javaFileFullPath, null, null, false);
+
+            if (pcde == null) {
+                // .class file not found - possible compilation error
+                if (missingClassIsOk(javaFileFullPath)) {
+                    continue;
+                } else {
+                    throw new PrivateException(new PublicExceptions.ClassNameMismatchException(
+                            "Could not find class file for " + javaFileFullPath));
+                }
+            }
+            Set<String> entries = new HashSet<String>();
+            if (pcde.checkResult == PCDEntry.CV_NEW) {  // It's really a new .java file, not a moved one
+                entries.addAll(findAndUpdateAllNestedClassesForClass(pcde, false));
+            } else {
+                entries.addAll(findAndUpdateAllNestedClassesForClass(pcde, true));
+            }
+            entries.add(pcde.className);
+            if (dependencyFile != null) {
+                Map<String, List<String>> dependencies = parseDependencyFile();
+                List<String> myDeps = dependencies.get(javaFileFullPath);
+                if (myDeps != null) {
+                    for (String dependency : myDeps) {
+                        if (entries.contains(dependency))
+                            continue;
+                        findClassFileOnFilesystem(javaFileFullPath, pcde,
+                                dependency, false);
+                    }
+                }
+            }
+        }
+
+        for (String newJarFile : newJarFiles) {
+            processAllClassesFromJarFile(newJarFile);
+        }
+    }
+
+    /**
+     * Parse an extra dependency file.  The format of the file is a series of lines,
+     * each consisting of:
+     * SourceFileName.java -> ClassName
+     * (these file names are relative to destDir)
+     */
+    private Map<String, List<String>> parseDependencyFile() {
+        if (!destDirSpecified)
+            throw new RuntimeException("Dependency files require destDir");
+        if (extraDependencies != null)
+            return extraDependencies;
+        BufferedReader in = null;
+        try {
+            extraDependencies = new HashMap<String, List<String>>();
+            in = new BufferedReader(new FileReader(dependencyFile));
+            int lineNumber = 0;
+            while (true) {
+                lineNumber ++;
+                String line = in.readLine();
+                if (line == null)
+                    break;
+                String[] parts = line.split("->");
+                if (parts.length != 2) {
+                    throw new RuntimeException("Failed to parse line " + lineNumber + " of " + dependencyFile
+                                               + ". Expected {foo.java} -> {classname}.");
+                }
+                String src = parts[0].trim();
+                src = new File(destDir, src).getCanonicalPath();
+                String cls = parts[1].trim();
+                List<String> classes = extraDependencies.get(src);
+                if (classes == null) {
+                    classes = new ArrayList<String>();
+                    extraDependencies.put(src, classes);
+                }
+                cls = cls.substring(0, cls.length() - 6); // strip trailing ".class"
+                classes.add(cls);
+            }
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        } finally {
+            if (in != null)
+                try {
+                    in.close();
+                } catch (IOException e) {
+                    throw new RuntimeException(e);
+                }
+        }
+        return extraDependencies;
+    }
+
+    /**
+     * In most cases we want to fail the build if a class cannot be found.
+     *
+     * However there is one common valid case where a .java file might not contain
+     * a class: package-info.java files.
+     *
+     * See this doc for more info: http://docs.oracle.com/javase/specs/jls/se7/html/jls-7.html
+     */
+    private boolean missingClassIsOk(String javaFileFullPath) {
+        return javaFileFullPath != null && "package-info.java".equals(new File(javaFileFullPath).getName());
+    }
+
+    /**
+     * Find the .class file for the given javaFileFullPath and create a new PCDEntry for it.
+     * If enclosingClassPCDE is null, the named top-level class for the given .java file is looked up.
+     * Otherwise, the specified class specified by nestedClassFullName is looked up.
+     */
+    private PCDEntry findClassFileOnFilesystem(String javaFileFullPath, PCDEntry enclosingClassPCDE, String nestedClassFullName, boolean isNested) {
+        String classFileFullPath = null;
+        String fullClassName;
+        File classFile = null;
+
+        if (enclosingClassPCDE == null) { // Looking for a top-level class. May need to locate an appropriate directory.
+            // Remove the ".java" suffix. A Windows disk-name prefix, such as 'c:', will be cut off later automatically
+            fullClassName =
+                    javaFileFullPath.substring(0, javaFileFullPath.length() - 5);
+            if (destDirSpecified) {
+                // Search for the .class file. We first assume the longest possible name. In case of failure,
+                // we cut the assumed top-most package from it and repeat the search.
+                while (classFile == null) {
+                    classFileFullPath = destDir + fullClassName + ".class";
+                    classFile = Utils.checkFileForName(classFileFullPath);
+                    if (classFile == null) {
+                        int cutIndex = fullClassName.indexOf(File.separatorChar);
+                        if (cutIndex == -1) {
+                            // Most probably, there was an error during compilation of this file.
+                            // This does not prevent us from continuing.
+                            Utils.printWarningMessage("Warning: unable to find .class file corresponding to source " + javaFileFullPath + ": expected " + classFileFullPath);
+
+                            return null;
+                        }
+                        fullClassName = fullClassName.substring(cutIndex + 1);
+                    }
+                }
+            } else {
+                classFileFullPath = fullClassName + ".class";
+                classFile = Utils.checkFileForName(classFileFullPath);
+                if (classFile == null) {
+                    Utils.printWarningMessage("Warning: unable to find .class file corresponding to source " + javaFileFullPath);
+                    return null;
+                }
+            }
+        } else {  // Looking for a nested class, which always sits in the same directory as its enclosing class
+            classFileFullPath =
+                    Utils.getClassFileFullPathForNestedClass(enclosingClassPCDE.classFileFullPath, nestedClassFullName);
+            classFile = Utils.checkFileForName(classFileFullPath);
+            if (classFile == null) {
+                Utils.printWarningMessage("Warning: unable to find .class file corresponding to nested class " + nestedClassFullName);
+                return null;
+            }
+            fullClassName = nestedClassFullName;
+        }
+
+        if (backSlashFileSeparator) {
+            fullClassName = fullClassName.replace(File.separatorChar, '/');
+        }
+
+        byte classFileBytes[] = Utils.readFileIntoBuffer(classFile);
+        ClassInfo classInfo =
+                new ClassInfo(classFileBytes, ClassInfo.VER_NEW, this, classFileFullPath);
+        if (isNested) {
+            if (!classInfo.directlyEnclosingClass.equals(enclosingClassPCDE.newClassInfo.name)) {
+                // Check if the above strings are like A and A$1. If so, there is actually no problem - the correct
+                // answer is A$1. The reason why just A was determined as a directly enclosing class when parsing
+                // class classInfo is due to the ambiguous interpretation of names like A$1$B. Such a name may mean
+                // (1) a non-member local nested class B of A, or (2) a member class B of an anonymous nested class A$1.
+                // When parsing any non-toplevel class, the first interpretation is always used.
+                // NOTE FOR JDK 1.5 - starting from this version, there is no ambiguity anymore.
+                // (1) will be called A$1B, and (2) will still be A$1$B
+                String a = classInfo.directlyEnclosingClass;
+                String ad1 = enclosingClassPCDE.newClassInfo.name;
+                if (!((classInfo.javacTargetRelease == Utils.JAVAC_TARGET_RELEASE_OLDEST) &&
+                        (ad1.startsWith(a + "$") && Character.isDigit(ad1.charAt(a.length() + 1))))) {
+                    throw new PrivateException(new PublicExceptions.ClassFileParseException(
+                            "Enclosing class names for class " + classInfo.name + " don't match:\n" +
+                            classInfo.directlyEnclosingClass + " and " + enclosingClassPCDE.newClassInfo.name));
+                }
+            }
+        }
+
+        // If dest dir was specified, check if the deduced name is equal to the one in this class (in this case
+        // they should necessarily match). Otherwise, without parsing the .java file, we can't reliably say what the
+        // full class name (actually, its package part) should be - so we just note the name.
+        if (destDirSpecified) {
+            if (!fullClassName.equals(classInfo.name)) {
+                throw new PrivateException(new PublicExceptions.ClassNameMismatchException(
+                        "Error: deduced class name is different from the real one for source " +
+                        javaFileFullPath + "\n" + fullClassName + " and " + classInfo.name));
+            }
+        } else {
+            fullClassName = classInfo.name;
+        }
+
+        if (enclosingClassPCDE != null) {
+            javaFileFullPath = enclosingClassPCDE.javaFileFullPath;
+        }
+        long classFileLastMod = classFile.lastModified();
+        long classFileFP = computeFP(classFileBytes);
+
+        if (pcd.containsKey(fullClassName)) {
+            PCDEntry pcde = pcd.get(fullClassName);
+            // If this entry has already been checked, it's a second entry for the same class, which is illegal.
+            if (pcde.checkResult == PCDEntry.CV_NEWER_FOUND_NEARER) {
+                // Newer copy of same file found in closer layer
+                // Reset to CV_UNCHECKED and skip redundnacy check
+                // as we know this would be redundant
+                pcde.checkResult = PCDEntry.CV_UNCHECKED;
+            } else {
+                if (pcde.checked) {
+                    throw new PrivateException(new PublicExceptions.DoubleEntryException(
+                            "Two entries for class " + classInfo.name + " detected: " + pcde.javaFileFullPath + " and " + javaFileFullPath));
+                }
+            }
+            // Otherwise, it means that the .java file for this class has been moved. jmake initially interprets
+            // a new source file name as a new class, and it's only at this point that we can actually see that it was
+            // only a move. We update javaFileFullPath for nested classes after we return from here.
+            pcde.javaFileFullPath = javaFileFullPath;
+            pcde.classFileFullPath = classFileFullPath;
+            pcde.newClassInfo = classInfo;
+            if (deletedClasses.contains(fullClassName)) {
+                deletedClasses.remove(fullClassName);
+            }
+            return pcde;
+        }
+
+        PCDEntry pcde = new PCDEntry(fullClassName,
+                javaFileFullPath,
+                classFileFullPath, classFileLastMod, classFileFP,
+                classInfo);
+        pcde.checkResult = PCDEntry.CV_NEW;          // So that later it's promoted into oldClassInfo correctly
+        updatedAndCheckedClasses.add(fullClassName); // So that the above happens
+        pcd.put(fullClassName, pcde);
+        return pcde;
+    }
+
+    /**
+     * For the given class, find all direct nested classes (which may include reading their .class files from the
+     * class path) and set their access flags (contained in this, enclosing class, object) appropriately. If
+     * this class is a one coming from a .java source, repeat the procedure for each nested class in turn.
+     * Otherwise, i.e. if a class comes from a .jar, don't bother, since we will come across each of these
+     * classes anyway - when scanning their .jar. If 'move' parameter is true, it means that this method is called for
+     * a class that is not new, but has been moved (and possibly updated).
+     */
+    private Set<String> findAndUpdateAllNestedClassesForClass(PCDEntry pcde, boolean move) {
+        ClassInfo classInfo = pcde.newClassInfo;
+        if (classInfo.nestedClasses == null) {
+            return Collections.emptySet();
+        }
+        Set<String> entries = new LinkedHashSet<String>();
+        String nestedClasses[] = classInfo.nestedClasses;
+        String javaFileFullPath = pcde.javaFileFullPath;
+        String enclosingClassFileFullPath = pcde.classFileFullPath;
+        boolean isJavaSourceFile = javaFileFullPath.endsWith(".java");
+
+        for (int i = 0; i < nestedClasses.length; i++) {
+            PCDEntry nestedPCDE = pcd.get(nestedClasses[i]);
+            if (nestedPCDE == null) {
+                if (isJavaSourceFile) {
+                    nestedPCDE =
+                            findClassFileOnFilesystem(null, pcde, nestedClasses[i], true);
+                }
+                // For classes that come from a .jar, pcde should already be there. Otherwise this class just doesn't exist.
+                if (nestedPCDE == null) {
+                    // Probably a compilation error, such that enclosing class is compiled but nested is not.
+                    throw new PrivateException(new PublicExceptions.ClassNameMismatchException(
+                            "Could not find class file for " + pcde.toString()));
+                }
+            }
+            if (move) {
+                if (deletedClasses.contains(nestedClasses[i])) {
+                    deletedClasses.remove(nestedClasses[i]);
+                }
+                nestedPCDE.javaFileFullPath = javaFileFullPath;
+                if (javaFileFullPath.endsWith(".java")) {
+                    nestedPCDE.classFileFullPath =
+                            Utils.getClassFileFullPathForNestedClass(enclosingClassFileFullPath, nestedClasses[i]);
+                } else {
+                    nestedPCDE.classFileFullPath = javaFileFullPath;
+                }
+            }
+            if (nestedPCDE.newClassInfo == null) {
+                getClassInfoForPCDEntry(ClassInfo.VER_NEW, nestedPCDE);
+            }
+            nestedPCDE.newClassInfo.accessFlags =
+                    pcde.newClassInfo.nestedClassAccessFlags[i];
+            nestedPCDE.newClassInfo.isNonMemberNestedClass =
+                    pcde.newClassInfo.nestedClassNonMember[i];
+
+            entries.add(nestedPCDE.className);
+            entries.addAll(findAndUpdateAllNestedClassesForClass(nestedPCDE, move));
+        }
+        return entries;
+    }
+
+    /**
+     * Take care of new nested classes that could have been generated from already existing .java sources,
+     * and of nested classes that do not exist anymore because they were deleted from these sources.
+     */
+    private void dealWithNestedClassesForUpdatedJavaFiles() {
+        if (updatedJavaFiles.size() == 0) {
+            return;
+        }
+
+        // First put PCDEntries for all updated classes that have nested classes into a temporary list.
+        // That's because we can then find new nested classes, which we will need to add to the PCD, which
+        // may probably conflict with us still iterating over it.
+        List<PCDEntry> updatedEntries = new ArrayList<PCDEntry>();
+        for (PCDEntry pcde : entries()) {
+            if (pcde.checkResult == PCDEntry.CV_NEW) {
+                continue;  // This class has just been added to the PCD
+            }
+            if (updatedJavaFiles.contains(pcde.javaFileFullPath)) {
+                ClassInfo oldClassInfo = pcde.oldClassInfo;
+                ClassInfo newClassInfo =
+                        getClassInfoForPCDEntry(ClassInfo.VER_NEW, pcde);
+                if (newClassInfo == null) {
+                    deletedClasses.add(pcde.className);
+                    continue; // Class file deleted then not re-created due to a compilation error somewhere.
+                }
+                if (oldClassInfo.nestedClasses != null || newClassInfo.nestedClasses != null) {
+                    updatedEntries.add(pcde);
+                }
+            }
+        }
+
+        if (dependencyFile != null) {
+            Map<String, List<String>> dependencies = parseDependencyFile();
+            for (String file : updatedJavaFiles) {
+                List<String> myDeps = dependencies.get(file);
+                if (myDeps == null)
+                    continue;
+                PCDEntry pcde = getNamedPCDE(file, dependencies);
+                for (String dependency : myDeps) {
+                    PCDEntry dep = pcd.get(dependency);
+                    if (dep != null)
+                        // This is an existing dep.
+                        continue;
+                    dep = findClassFileOnFilesystem(file, pcde, dependency,  false);
+                    getClassInfoForPCDEntry(ClassInfo.VER_NEW, dep);
+                    if (dep.newClassInfo.nestedClasses != null)
+                        updatedEntries.add(dep);
+                }
+            }
+        }
+        dealWithNestedClassesForUpdatedPCDEntries(updatedEntries, false);
+    }
+
+    private PCDEntry getNamedPCDE(String file, Map<String, List<String>> dependencies) {
+        List<String> depsForFile = dependencies.get(file);
+        PCDEntry pcde = null;
+        // Find a non-nested class for this java file for which we already have
+        // a pcde
+        for (String dependency : depsForFile) {
+            if (dependency.indexOf('$') != -1)
+                continue;
+            pcde = pcd.get(dependency);
+            if (pcde != null)
+                break;
+        }
+        if (pcde == null) {
+            throw new PrivateException(new PublicExceptions.InternalException(file
+                    + " was supposed to be an updated file, but there are no PCDEntries for any of its deps"));
+        }
+        return pcde;
+    }
+
+    private void dealWithNestedClassesForUpdatedPCDEntries(List<PCDEntry> entries, boolean move) {
+        for (int i = 0; i < entries.size(); i++) {
+            PCDEntry pcde = entries.get(i);
+            ClassInfo oldClassInfo = pcde.oldClassInfo;
+            ClassInfo newClassInfo = pcde.newClassInfo;
+            if (newClassInfo.nestedClasses != null) {
+                Set<String> nested = findAndUpdateAllNestedClassesForClass(pcde, move);
+                if (oldClassInfo.nestedClasses != null) {  // Check if any old nested classes don't exist anymore
+                    for (int j = 0; j < oldClassInfo.nestedClasses.length; j++) {
+                        boolean found = false;
+                        String oldNestedClass = oldClassInfo.nestedClasses[j];
+                        for (int k = 0; k < newClassInfo.nestedClasses.length; k++) {
+                            if (oldNestedClass.equals(newClassInfo.nestedClasses[k])) {
+                                found = true;
+                                break;
+                            }
+                        }
+                        if (!found) {
+                            deletedClasses.add(oldNestedClass);
+                        }
+                    }
+                }
+            } else {  // newNestedClasses == null and oldNestedClasses != null, so all nested classes have been removed in the new version
+                for (int j = 0; j < oldClassInfo.nestedClasses.length; j++) {
+                    deletedClasses.add(oldClassInfo.nestedClasses[j]);
+                }
+            }
+        }
+    }
+
+    private void findUpdatedClasses() {
+        // This (iterating over all of the classes once again after performing that in classFileObsoleteOrDeleted()) may
+        // seem time-consuming, but in reality it isn't, since the most time-consuming operation of obtaining internal
+        // file handles for class files has already been performed in classFileObsoleteOrDeleted(). Once we have done that,
+        // this re-iteration takes very small amount of time. However, if we switch from "class file older than .java
+        // file" to ".java file timestamp changed" condition for recompilation, this will have to be changed as well.
+         for (PCDEntry entry : entries()) {
+            String className = entry.className;
+            if (updatedAndCheckedClasses.contains(className) ||
+                    deletedClasses.contains(className)) {
+                continue;
+            }
+            if (!entry.javaFileFullPath.endsWith(".java")) {
+                continue; // classes from (updated) .jars have been dealt with separately
+            }
+            //DAB TODO understand this bit better.  It is needed to support -vpath, I'm just not sure why....
+            if (entry.checkResult != PCDEntry.CV_NEWER_FOUND_NEARER &&
+                    !updatedAndCheckedClasses.contains(className) &&
+                    !deletedClasses.contains(className) &&
+                    entry.javaFileFullPath.endsWith(".java") &&
+                    classFileUpdated(entry))
+            {
+            //DAB TODO this is the old way....
+            //DAB    if (classFileUpdated(entry)) {
+                updatedClasses.add(className);
+                allUpdatedClasses.add(className);
+            }
+        }
+    }
+
+    private boolean classFileUpdated(PCDEntry entry) {
+        File classFile = Utils.checkFileForName(entry.classFileFullPath);
+        if (classFile == null) {
+            return false;
+        }
+        // The only case when the above can happen is if class file was first deleted, and then there
+        // was an error recompiling its source
+
+        long classFileLastMod = classFile.lastModified();
+
+        if (classFileLastMod > entry.oldClassFileLastModified) {
+            entry.newClassFileLastModified = classFileLastMod;
+            // Check if the class was actually modified, to avoid the costly procedure of detailed version compare
+            long classFileFP = computeFP(classFile);
+            if (classFileFP != entry.oldClassFileFingerprint) {
+                entry.newClassFileFingerprint = classFileFP;
+                return true;
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Compare old (preserved in pdb) and new (file system) versions of updated classes, and find all
+     * potentially affected dependent classes.
+     */
+    private void checkUpdatedClasses() {
+        for (String className : updatedClasses) {
+            PCDEntry pcde = pcd.get(className);
+            getClassInfoForPCDEntry(ClassInfo.VER_NEW, pcde);
+            if (!"".equals(pcde.oldClassInfo.directlyEnclosingClass)) {
+                // The following problem can occur with nested classes. A C.java source has been changed, so that C.class is
+                // not changed or changed in a compatible way, whereas the access modifiers of C$X.class are changed in an
+                // incompatible way, so that something is broken in the project. When jmake is called for the first time,
+                // it reports the problem, then saves the info on the new version of C in the pdb. Of course, the record for
+                // C$X in the pdb is not updated, since the change to it is incompatible and recompilation of dependent sources
+                // has failed. Suppose we don't change anything and invoke jmake again. C$X is found different from its old
+                // version and is checked here again. The outcome should be the same. But since C has not changed, C.class is
+                // not read from disk and the access flags of C$X, which are stored in C.class, are not set appropriately. So
+                // in such circumstances we have wrong access flags for C$X here. To fix the problem we need to load C explicitly.
+                ClassInfo enclosingClassInfo =
+                        getClassInfoForName(ClassInfo.VER_NEW, pcde.oldClassInfo.directlyEnclosingClass);
+                //if (enclosingClassInfo == null || enclosingClassInfo.nestedClasses == null) {
+                //  System.out.println("!!! Suspicious updated class name = " + className);
+                //  System.out.println("!!! enclosingClassInfo for it = " + enclosingClassInfo);
+                //  if (enclosingClassInfo != null) {
+                //    System.out.println("!!! enclosingClassInfo.name = " + enclosingClassInfo.name);
+                //    if (enclosingClassInfo.nestedClasses == null) System.out.println("!!! enclosingClassInfo.nestedClasses = null");
+                //  }
+                //}
+                if (enclosingClassInfo.nestedClasses != null) {  // Can be that this nested class was the only one for enclosing class, and it's deleted now
+                    for (int i = 0; i < enclosingClassInfo.nestedClasses.length; i++) {
+                        if (className.equals(enclosingClassInfo.nestedClasses[i])) {
+                            pcde.newClassInfo.accessFlags =
+                                    enclosingClassInfo.nestedClassAccessFlags[i];
+                            pcde.newClassInfo.isNonMemberNestedClass =
+                                    enclosingClassInfo.nestedClassNonMember[i];
+                            break;
+                        }
+                    }
+                }
+            }
+            if (!(pcde.oldClassInfo.isNonMemberNestedClass && pcde.newClassInfo.isNonMemberNestedClass)) {
+                Utils.printInfoMessage("Checking " + pcde.className);
+                pcde.checkResult = cv.compareClassVersions(pcde) ? PCDEntry.CV_COMPATIBLE
+                        : PCDEntry.CV_INCOMPATIBLE;
+                String affectedClasses[] = cv.getAffectedClasses();
+                if (affectedClasses != null) {
+                    for (int i = 0; i < affectedClasses.length; i++) {
+                        PCDEntry affEntry = pcd.get(affectedClasses[i]);
+                        updatedJavaFiles.add(affEntry.javaFileFullPath);
+                    }
+                }
+            } else {
+                // A non-member nested class can not be referenced by the source code of any class defined outside the
+                // immediately enclosing source code block for this class. Therefore, any incompatibility in the new
+                // version of this class can affect only classes that are defined in the same source file - and they
+                // are necessarily recompiled together with this class. So there is no point in initiating version
+                // compare for this class. However, the new class version should always tembe promoted into the store, since
+                // this class itself may depend on other changing classes.
+                pcde.checkResult = PCDEntry.CV_COMPATIBLE;
+            }
+
+            updatedAndCheckedClasses.add(className);
+        }
+    }
+
+    /** Find all dependent classes for deleted classes. */
+    private void checkDeletedClasses() {
+        for (String className : deletedClasses) {
+            PCDEntry pcde = pcd.get(className);
+
+            if (pcde == null) {  // "Safety net" for the (hopefully unlikely) case. I observed it just once and couldn't identify the reason
+                Utils.printWarningMessage("Warning: internal information inconsistency when checking deleted classes");
+                Utils.printWarningMessage(Utils.REPORT_PROBLEM);
+                Utils.printWarningMessage("Class name: " + className);
+                continue;
+            }
+
+            ClassInfo oldCI = pcde.oldClassInfo;
+            if (!oldCI.isNonMemberNestedClass) { // See the comment above
+                Utils.printInfoMessage("Checking deleted class " + oldCI.name);
+                cv.checkDeletedClass(pcde);
+                String[] affectedClasses = cv.getAffectedClasses();
+                if (affectedClasses != null) {
+                    for (int i = 0; i < affectedClasses.length; i++) {
+                        PCDEntry affEntry = pcd.get(affectedClasses[i]);
+                        if (deletedClasses.contains(affEntry.className)) {
+                            continue;
+                        }
+                        updatedJavaFiles.add(affEntry.javaFileFullPath);
+                    }
+                }
+            }
+            pcde.checkResult = PCDEntry.CV_DELETED;
+            updatedAndCheckedClasses.add(className);
+        }
+        deletedClasses.clear();
+    }
+
+    /**
+     * Determine what classes in the given .jar (which may be an existing updated one, or a new one) are new,
+     * updated, or moved, and treat them accordingly.
+     */
+    private void processAllClassesFromJarFile(String jarFileName) {
+        JarFile jarFile;
+        long jarFileLastMod = 0;
+        try {
+            File file = new File(jarFileName);
+            jarFileLastMod = file.lastModified();
+            jarFile = new JarFile(jarFileName);
+        } catch (IOException ex) {
+            throw new PrivateException(ex);
+        }
+
+        List<PCDEntry> newEntries = new ArrayList<PCDEntry>();
+        List<PCDEntry> updatedEntries = new ArrayList<PCDEntry>();
+        List<PCDEntry> movedEntries = new ArrayList<PCDEntry>();
+
+        for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
+            JarEntry jarEntry = entries.nextElement();
+            String fullClassName = jarEntry.getName();
+            if (!fullClassName.endsWith(".class")) {
+                continue;
+            }
+            fullClassName =
+                    fullClassName.substring(0, fullClassName.length() - 6).intern();
+            byte classFileBytes[];
+            classFileBytes = Utils.readZipEntryIntoBuffer(jarFile, jarEntry);
+            long classFileFP = computeFP(classFileBytes);
+
+            PCDEntry pcde = pcd.get(fullClassName);
+            if (pcde != null) {
+                if (pcde.checked) {
+                    throw new PrivateException(new PublicExceptions.DoubleEntryException(
+                            "Two entries for class " + fullClassName + " detected: " + pcde.javaFileFullPath + " and " + jarFileName));
+                }
+                pcde.checked = true;
+                pcde.newClassFileLastModified = jarFileLastMod;
+                // If we are scanning an existing updated .jar file, and there is no change to the class itself,
+                // and it previously was located in the same .jar, do nothing.
+                if (pcde.oldClassFileFingerprint == classFileFP &&
+                        pcde.javaFileFullPath.equals(jarFileName)) {
+                    pcde.oldClassFileLastModified = jarFileLastMod;   // So that next time jmake is inoked, checking
+                    continue;                                         // of this.jar is not triggered.
+                }
+                if (pcde.oldClassFileFingerprint != classFileFP) {  // This class has been updated
+                    updatedClasses.add(fullClassName);
+                    allUpdatedClasses.add(fullClassName);
+                    pcde.newClassFileLastModified = jarFileLastMod;
+                    pcde.newClassFileFingerprint = classFileFP;
+                    pcde.newClassInfo =
+                            new ClassInfo(classFileBytes, ClassInfo.VER_NEW, this, fullClassName);
+                    if (pcde.oldClassInfo.nestedClasses != null || pcde.newClassInfo.nestedClasses != null) {
+                        updatedEntries.add(pcde);
+                    }
+                } else {
+                    pcde.oldClassFileLastModified = jarFileLastMod;
+                }
+                if (!pcde.javaFileFullPath.equals(jarFileName)) {
+                    // Found an existing class in a different .jar file.
+                    // May happen if the class file has been moved from one .jar to another (or into a .jar, losing its
+                    // .java source). It's only at this point that we can actually see that it was really a move.
+                    if (deletedClasses.contains(fullClassName)) {
+                        deletedClasses.remove(fullClassName);
+                    }
+                    if (pcde.oldClassInfo.nestedClasses != null) {
+                        movedEntries.add(pcde);
+                        pcde.newClassInfo =
+                                new ClassInfo(classFileBytes, ClassInfo.VER_NEW, this, fullClassName);
+                    }
+                }
+                pcde.javaFileFullPath = jarFileName;
+            } else {  // New class file
+                ClassInfo classInfo =
+                        new ClassInfo(classFileBytes, ClassInfo.VER_NEW, this, fullClassName);
+                pcde = new PCDEntry(fullClassName,
+                        jarFileName,
+                        jarFileName, jarFileLastMod, classFileFP,
+                        classInfo);
+                pcde.checkResult = PCDEntry.CV_NEW;          // So that later it's promoted into oldClassInfo correctly
+                updatedAndCheckedClasses.add(fullClassName); // So that the above happens
+                pcd.put(fullClassName, pcde);
+                if (pcde.newClassInfo.nestedClasses != null) {
+                    newEntries.add(pcde);
+                }
+            }
+        }
+
+        dealWithNestedClassesForUpdatedPCDEntries(updatedEntries, false);
+        dealWithNestedClassesForUpdatedPCDEntries(movedEntries, true);
+        for (int i = 0; i < newEntries.size(); i++) {
+            findAndUpdateAllNestedClassesForClass(newEntries.get(i), false);
+        }
+    }
+
+    /** Determine new, deleted and updated classes coming from updated .jar files. */
+    private void dealWithClassesInUpdatedJarFiles() {
+        if (updatedJarFiles.size() == 0) {
+            return;
+        }
+
+        for (String updatedJarFile : updatedJarFiles) {
+            processAllClassesFromJarFile(updatedJarFile);
+        }
+
+        // Now scan the PCD to check which classes that come from updated .jar files have not been marked as checked
+        for (PCDEntry pcde : entries()) {
+            if (updatedJarFiles.contains(pcde.javaFileFullPath)) {
+                if (!pcde.checked) {
+                    deletedClasses.add(pcde.className);
+                }
+            }
+        }
+    }
+
+    /** Check if the destination directory exists, and get the canonical path for it. */
+    private void initializeDestDir(String inDestDir) {
+        if (!(inDestDir == null || inDestDir.equals(""))) {
+            File dir = Utils.checkOrCreateDirForName(inDestDir);
+            if (dir == null) {
+                throw new PrivateException(new IOException("specified directory " + inDestDir + " cannot be created."));
+            }
+            inDestDir = getCanonicalPath(dir);
+            if (!inDestDir.endsWith(File.separator)) {
+                inDestDir += File.separatorChar;
+            }
+            destDir = inDestDir;
+            destDirSpecified = true;
+        } else {
+            destDirSpecified = false;
+        }
+    }
+
+    /**
+     * For the given PCDEntry, set the entry.classFileFullPath according to the value of the .java file full
+     * path and the value of the "-d" option at this particular jmake invocation
+     */
+    private void initializeClassFileFullPath(PCDEntry entry) {
+        String classFileFullPath;
+        if (destDirSpecified) {
+            classFileFullPath = destDir + entry.className + ".class";
+        } else {
+            String javaFileDir = entry.javaFileFullPath;
+            int cutIndex = javaFileDir.lastIndexOf(File.separatorChar);
+            if (cutIndex != -1) {
+                javaFileDir = javaFileDir.substring(0, cutIndex + 1);
+            }
+            String classFileName = entry.className;
+            cutIndex = classFileName.lastIndexOf('/');
+            if (cutIndex != -1) {
+                classFileName = classFileName.substring(cutIndex + 1);
+            }
+            classFileFullPath = javaFileDir + classFileName + ".class";
+        }
+        if (backSlashFileSeparator) {
+            classFileFullPath =
+                    classFileFullPath.replace('/', File.separatorChar);
+        }
+        entry.classFileFullPath = classFileFullPath;
+    }
+
+    private static String getCanonicalPath(File file) {
+        try {
+            return file.getCanonicalPath().intern();
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+
+    private long computeFP(File file) {
+        byte buf[] = Utils.readFileIntoBuffer(file);
+        return computeFP(buf);
+    }
+
+    private long computeFP(byte[] buf) {
+        checkSum.reset();
+        checkSum.update(buf);
+        return checkSum.getValue();
+    }
+
+    private PrivateException compilerInteractionException(String message, Exception origException, int errCode) {
+        return new PrivateException(new PublicExceptions.CompilerInteractionException(message, origException, errCode));
+    }
+
+    private PrivateException internalException(String message) {
+        return new PrivateException(new PublicExceptions.InternalException(message));
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/PrivateException.java b/third_party/jmake/src/org/pantsbuild/jmake/PrivateException.java
new file mode 100644
index 0000000..b8b0c789
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/PrivateException.java
@@ -0,0 +1,28 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+/**
+ * This class is used as a wrapper for a number of exceptions that are thrown by jmake. Its
+ * only purpose is to help avoid using endless "throws" clauses in the code.
+ *
+ * @author  Misha Dmitriev
+ *  12 November 2001
+ */
+public class PrivateException extends RuntimeException {
+
+    private static final long serialVersionUID = 1L;
+    private Throwable originalException;
+
+    public PrivateException(Throwable e) {
+        originalException = e;
+    }
+
+    public Throwable getOriginalException() {
+        return originalException;
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/PublicExceptions.java b/third_party/jmake/src/org/pantsbuild/jmake/PublicExceptions.java
new file mode 100644
index 0000000..4009745
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/PublicExceptions.java
@@ -0,0 +1,169 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+/**
+ * This class is a wrapper for a number of nested classes. They define exceptions that may be thrown
+ * by the <b>jmake</b> code. These exceptions are caught in the <code>Main.mainExternal</code> method,
+ * or they may be caught and handled by an application invoking <b>jmake</b> programmatically
+ * through <code>Main.mainProgrammatic</code> method.
+ *
+ * @see Main#mainExternal(String[])
+ * @see Main#mainProgrammatic(String[])
+ *
+ * @author  Misha Dmitriev
+ *  17 January 2003
+ */
+public class PublicExceptions {
+
+    /**
+     * This exception is thrown whenever there is any problem initializing or calling the compiler, or
+     * when the compiler itself reports compilation errors. Depending on the nature of the problem, an
+     * instance of this class is initialized with, and then returns, an original exception signalling
+     * the problem, or the compiler application exit code.
+     */
+    public static class CompilerInteractionException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+        private Exception originalException;
+        private int compilerExitCode;
+
+        /**
+         * Initialize an instance of this exception with an error message and either an original
+         * exception or a compiler exit code.
+         */
+        CompilerInteractionException(String msg, Exception originalException, int compilerExitCode) {
+            super(msg);
+            this.originalException = originalException;
+            this.compilerExitCode = compilerExitCode;
+        }
+
+        /**
+         * Get the original exception that caused this exception. <code>null</code> is returned if there
+         * were no original exception. In that case, there was a compilation error and the compiler has
+         * returned with the exit code that can be obtained using <code>getCompilerExitCode</code> method.
+         *
+         * @see #getCompilerExitCode()
+         */
+        public Exception getOriginalException() {
+            return originalException;
+        }
+
+        /**
+         * Get the compiler exit code. If <code>0</code> is returned, this indicates that an exception was
+         * thrown during compiler initialization, or inside the compiler itself. Use <code>getOriginalExcepion</code>
+         * method to obtain that exception.
+         *
+         * @see #getOriginalException
+         */
+        public int getCompilerExitCode() {
+            return compilerExitCode;
+        }
+    }
+
+    /** Exception signalling a problem with reading project database file. */
+    public static class PDBCorruptedException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        PDBCorruptedException(String msg) {
+            super(msg);
+        }
+    }
+
+    /** Exception signalling a problem when parsing a class file */
+    public static class ClassFileParseException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        ClassFileParseException(String msg) {
+            super(msg);
+        }
+    }
+
+    /** Exception signalling that <b>jmake</b> was not requested to do any real work. */
+    public static class NoActionRequestedException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+    }
+
+    /** Exception signalling that an invalid command line option has been passed to jmake. */
+    public static class InvalidCmdOptionException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        InvalidCmdOptionException(String msg) {
+            super(msg);
+        }
+    }
+
+    /**
+     * Exception signalling a problem (typically an I/O exception) when parsing a command line file
+     * passed to <b>jmake</b>.
+     */
+    public static class CommandFileReadException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        CommandFileReadException(String msg) {
+            super(msg);
+        }
+    }
+
+    /**
+     * Exception signalling that for some class the deduced name (that is, name based on the source file name and
+     * directory) and the real name (the one read from the class file) are different.
+     */
+    public static class ClassNameMismatchException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        ClassNameMismatchException(String msg) {
+            super(msg);
+        }
+    }
+
+    /** Exception thrown if any specified source file has an invalid extension (not <code>.java</code> or <code>.jar</code>). */
+    public static class InvalidSourceFileExtensionException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        InvalidSourceFileExtensionException(String msg) {
+            super(msg);
+        }
+    }
+
+    /** Exception thrown if a dependence of a class in a <code>JAR</code> file on a class with a <code>.java</code> source is detected. */
+    public static class JarDependsOnSourceException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        JarDependsOnSourceException(String msg) {
+            super(msg);
+        }
+    }
+
+    /** Exception thrown if more than one entry for the same class is detected in the project */
+    public static class DoubleEntryException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        DoubleEntryException(String msg) {
+            super(msg);
+        }
+    }
+
+    /** Exception thrown if an internal problem that should never happen is detected. */
+    public static class InternalException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        InternalException(String msg) {
+            super(msg);
+        }
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/RefClassFinder.java b/third_party/jmake/src/org/pantsbuild/jmake/RefClassFinder.java
new file mode 100644
index 0000000..58c8884
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/RefClassFinder.java
@@ -0,0 +1,697 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.lang.reflect.Modifier;
+import java.util.LinkedHashSet;
+import java.util.Set;
+
+/**
+ * This class implements finding classes referencing other classes and members in various ways.
+ *
+ * @author Misha Dmitriev
+ * 12 March 2004
+ */
+public class RefClassFinder {
+
+    private boolean failOnDependentJar;   // If true, will fail if a dependency of a sourceless class
+    // (coming from a .jar) on a "normal" class is detected
+    private boolean noWarnOnDependentJar; // If true, not even a warning will be issued in the above case.
+    private String checkedClassName;
+    private PCDManager pcdm;
+    private Set<String> affectedClassNames;
+    private boolean checkedClassIsFromJar;
+
+    /** An instance of RefClassFinder is created once per session, passing it the global options that do not change */
+    public RefClassFinder(PCDManager pcdm, boolean failOnDependentJar, boolean noWarnOnDependentJar) {
+        this.pcdm = pcdm;
+        this.failOnDependentJar = failOnDependentJar;
+        this.noWarnOnDependentJar = noWarnOnDependentJar;
+    }
+
+    /** This method is called every time we are going to check a new class */
+    public void initialize(String checkedClassName, boolean checkedClassIsFromJar) {
+        this.checkedClassName = checkedClassName;
+        this.checkedClassIsFromJar = checkedClassIsFromJar;
+        affectedClassNames = new LinkedHashSet<String>();
+    }
+
+    /**
+     * Returns the names of project classes that were found potentially affec
+     * by the changes to the checked class.
+     */
+    public String[] getAffectedClassNames() {
+        int size = affectedClassNames.size();
+        if (size == 0) {
+            return null;
+        } else {
+            String[] ret = new String[size];
+            int i = 0;
+            for (String className : affectedClassNames) {
+                ret[i++] = className;
+            }
+            return ret;
+        }
+    }
+
+    /**
+     * Find all project classes that can access field fieldNo of class fieldClassInfo.
+     * Used if a compile-time constant is changed.
+     */
+    public void findAllProjectClasses(ClassInfo fieldClassInfo, int fieldNo) {
+      for (PCDEntry pcde : pcdm.entries()) {
+            if (pcde.checkResult == PCDEntry.CV_DELETED) {
+                continue;
+            }
+            if (pcde.javaFileFullPath.endsWith(".jar")) {
+                continue;
+            }
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (memberAccessibleFrom(fieldClassInfo, fieldNo, clientInfo, true)) {
+                addToAffectedClassNames(clientInfo.name);
+            }
+        }
+    }
+
+    /**
+     * Find all project classes that reference class with the given name
+     * (but not its array class) directly from the constantpool.
+     */
+    public void findReferencingClasses0(ClassInfo classInfo) {
+        findReferencingClasses(classInfo, 0, false, null);
+    }
+
+
+    /* In the following "find...ReferencingClasses1" methods, "referencing C" means
+     * "referencing C or its array class directly from the constant pool, as a type of a data
+     * field, as a type in a method signature or a thrown exception, as a directly implemented
+     * interface or a direct superclass".
+     */
+    /** Used for deleted classes. */
+    public void findReferencingClassesForDeletedClass(ClassInfo classInfo) {
+        String packageName = classInfo.packageName;
+        boolean isPublic = classInfo.isPublic();
+        boolean isInterface = classInfo.isInterface();
+        for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (!isPublic && packageName.equals(clientInfo.packageName)) {
+                continue;
+            }
+            if (clientInfo.referencesClass(classInfo.name, isInterface, 1)) {
+                addToAffectedClassNames(clientInfo.name);
+            }
+        }
+
+    }
+
+    /**
+     * For the given class p.C, find each project class X referencing C, that is not a member of
+     * package p and is not a direct or indirect subclass of C's directly enclosing class.
+     * (public -&gt; protected transformation)
+     */
+    public void findDiffPackageAndNotSubReferencingClasses1(ClassInfo classInfo) {
+        String packageName = classInfo.packageName;
+        String directlyEnclosingClass = classInfo.directlyEnclosingClass;
+        for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (packageName.equals(clientInfo.packageName) ||
+                    clientInfo.isSubclassOf(directlyEnclosingClass, false)) {
+                continue;
+            }
+            if (clientInfo.referencesClass(classInfo.name, classInfo.isInterface(), 1)) {
+                addToAffectedClassNames(clientInfo.name);
+            }
+        }
+    }
+
+    /**
+     * For class p.C, find each project class X referencing C, whose top level enclosing
+     * class is different from that of C.
+     * (public -&gt; private transformation)
+     */
+    public void findReferencingClasses1(ClassInfo classInfo) {
+        String topLevelEnclosingClass = classInfo.topLevelEnclosingClass;
+        for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (topLevelEnclosingClass.equals(clientInfo.topLevelEnclosingClass)) {
+                continue;
+            }
+            if (clientInfo.referencesClass(classInfo.name, classInfo.isInterface(), 1)) {
+                addToAffectedClassNames(clientInfo.name);
+            }
+        }
+    }
+
+    /**
+     * For class p.C, find each project class X referencing C, whose direct or indirect superclass
+     * is C's directly enclosing class, or which is a member of package p, whose top level enclosing
+     * class is different from that of C.
+     * (protected -&gt; private transformation)
+     */
+    public void findThisPackageOrSubReferencingClasses1(ClassInfo classInfo) {
+        String directlyEnclosingClass = classInfo.directlyEnclosingClass;
+        String topLevelEnclosingClass = classInfo.topLevelEnclosingClass;
+        String packageName = classInfo.packageName;
+      for (PCDEntry entry : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, entry);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if ((!clientInfo.packageName.equals(packageName)) &&
+                    !clientInfo.isSubclassOf(directlyEnclosingClass, false)) {
+                continue;
+            }
+            if (clientInfo.topLevelEnclosingClass.equals(topLevelEnclosingClass)) {
+                continue;
+            }
+            if (clientInfo.referencesClass(classInfo.name, classInfo.isInterface(), 1)) {
+                addToAffectedClassNames(clientInfo.name);
+            }
+        }
+    }
+
+    /**
+     * For class p.C, find each project class X referencing C, which is a member of package p and whose
+     * top level enclosing class is different from that of C.
+     * (default -&gt; private transformation)
+     */
+    public void findThisPackageReferencingClasses1(ClassInfo classInfo) {
+        String topLevelEnclosingClass = classInfo.topLevelEnclosingClass;
+        String packageName = classInfo.packageName;
+        for (PCDEntry entry : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD,
+                        entry);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (!clientInfo.packageName.equals(packageName)) {
+                continue;
+            }
+            if (topLevelEnclosingClass.equals(clientInfo.topLevelEnclosingClass)) {
+                continue;
+            }
+            if (clientInfo.referencesClass(classInfo.name, classInfo.isInterface(), 1)) {
+                addToAffectedClassNames(clientInfo.name);
+            }
+        }
+    }
+
+    /**
+     * For class p.C, find each project class X referencing C, which is not a member of package p.
+     * (public -&gt; default transformation)
+     */
+    public void findDiffPackageReferencingClasses1(ClassInfo classInfo) {
+        String packageName = classInfo.packageName;
+        for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (clientInfo.packageName.equals(packageName)) {
+                continue;
+            }
+            if (clientInfo.referencesClass(classInfo.name, classInfo.isInterface(), 1)) {
+                addToAffectedClassNames(clientInfo.name);
+            }
+        }
+    }
+
+    /**
+     * For class p.C, find each project class X referencing C, which is not a member of package p and
+     * whose direct or indirect superclass is C's directly enclosing class.
+     * (protected -&gt; default transformation)
+     */
+    public void findDiffPackageAndSubReferencingClasses1(ClassInfo classInfo) {
+        String packageName = classInfo.packageName;
+        String directlyEnclosingClass = classInfo.directlyEnclosingClass;
+      for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (clientInfo.packageName.equals(packageName)) {
+                continue;
+            }
+            if (!clientInfo.isSubclassOf(directlyEnclosingClass, false)) {
+                continue;
+            }
+            if (clientInfo.referencesClass(classInfo.name, classInfo.isInterface(), 1)) {
+                addToAffectedClassNames(clientInfo.name);
+            }
+        }
+    }
+
+    /**
+     * Find all project classes that reference both of the classes with the
+     * given names (or array classes of one or both) directly or indirectly from the
+     * constantpool, as a type of a data field, as a type in a method signature or a
+     * thrown exception, as a directly/indirectly implemented interface or a
+     * direct/indirect superclass.
+     */
+    public void findReferencingClasses2(ClassInfo classInfo1, ClassInfo classInfo2) {
+        Set<String> refClazz1 = new LinkedHashSet<String>();
+        findReferencingClasses(classInfo1, 2, false, refClazz1);
+        Set<String> refClazz2 = new LinkedHashSet<String>();
+        findReferencingClasses(classInfo2, 2, false, refClazz2);
+
+        for (String className1 : refClazz1) {
+            if (refClazz2.contains(className1)) {
+                addToAffectedClassNames(className1);
+            }
+        }
+    }
+
+    /** Find all project classes which are direct subclasses of the given class */
+    public void findDirectSubclasses(ClassInfo classInfo) {
+        for (ClassInfo subclassInfo : classInfo.getDirectSubclasses()) {
+            addToAffectedClassNames(subclassInfo.name);
+        }
+    }
+
+    /**
+     * Find all non-abstract project classes that implement the given interface or any of its
+     * subclasses directly, and all non-abstract classes that are direct descendants of abstract
+     * classes that implement the given interface directly or indirectly. Class C implements
+     * interface I indirectly, if C or some superclass of C directly implements I or some sublcass of I.
+     */
+    public void findDirectlyAndOtherwiseImplementingConcreteClasses(ClassInfo intfInfo) {
+        for (PCDEntry entry : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, entry);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (clientInfo.isInterface()) {
+                continue;
+            }
+            if (clientInfo.isAbstract()) {
+                if (clientInfo.implementsInterfaceDirectlyOrIndirectly(intfInfo.name)) {
+                    findAllNearestConcreteSubclasses(clientInfo);
+                }
+            } else {
+                if (clientInfo.implementsIntfOrSubintfDirectly(intfInfo.name)) {
+                    addToAffectedClassNames(clientInfo.name);
+                }
+            }
+        }
+    }
+
+    private void findAllNearestConcreteSubclasses(ClassInfo classInfo) {
+        for (ClassInfo subclassInfo : classInfo.getDirectSubclasses()) {
+            if (subclassInfo.isAbstract()) {
+                findAllNearestConcreteSubclasses(subclassInfo);
+            } else {
+                addToAffectedClassNames(subclassInfo.name);
+            }
+        }
+    }
+
+    /**
+     * Find all interfaces and abstract classes that implement the given interface and declare or inherit
+     * a method with the given name. For those that overload this method, find referencing classes.
+     */
+    public void findAbstractSubtypesWithSameNameMethod(ClassInfo intfInfo, String mName, final String mSig) {
+      for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo ci =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (ci == null) {
+                continue;  // New class or not in project
+            }
+            if (!(ci.isInterface() || ci.isAbstract())) {
+                continue;
+            }
+            if (ci.implementsInterfaceDirectlyOrIndirectly(intfInfo.name)) {
+                addToAffectedClassNames(ci.name);
+                // Check if the new method overloads an existing (declared or inherited) method. Overloading test is rough -
+                // we just check if the number of parameters is the same.
+                ci.findExistingSameNameMethods(mName, true, true, new ClassInfo.MethodHandler() {
+
+                    void handleMethod(ClassInfo classInfo, int otherMethodIdx) {
+                        String otherMSig =
+                                classInfo.methodSignatures[otherMethodIdx];
+                        if ( (!mSig.equals(otherMSig)) &&
+                                Utils.sameParamNumber(mSig, otherMSig)) {
+                            findReferencingClassesForMethod(classInfo, otherMethodIdx);
+                        }
+                    }
+                });
+            }
+        }
+    }
+
+    /** Find all project classes that reference the given field. */
+    public void findReferencingClassesForField(ClassInfo classInfo, int fieldNo) {
+        findReferencingClassesForMember(classInfo, fieldNo, true, false, false);
+    }
+
+    /**
+     * Find all project classes that reference the given field and which are in
+     * different packages.
+     */
+    public void findDiffPackageReferencingClassesForField(ClassInfo classInfo, int fieldNo) {
+        findReferencingClassesForMember(classInfo, fieldNo, true, true, false);
+    }
+
+    /**
+     * Find all project classes that reference the given field, which are in different
+     * packages and are direct or indirect subclasses of the member's declaring class
+     * (protected -&gt; default transformation).
+     */
+    public void findDiffPackageAndSubReferencingClassesForField(ClassInfo classInfo, int fieldNo) {
+        findReferencingClassesForMember(classInfo, fieldNo, true, true, true);
+    }
+
+    /** Find all project classes that reference the given method. */
+    public void findReferencingClassesForMethod(ClassInfo classInfo, int methodNo) {
+        findReferencingClassesForMember(classInfo, methodNo, false, false, false);
+    }
+
+    /**
+     * Find all project classes that reference the given method and which are in
+     * different packages.
+     */
+    public void findDiffPackageReferencingClassesForMethod(ClassInfo classInfo, int methodNo) {
+        findReferencingClassesForMember(classInfo, methodNo, false, true, false);
+    }
+
+    /**
+     * Find all project classes that reference the given method, which are in different
+     * packages and are direct or indirect subclasses of the member's declaring class
+     * (protected -&gt; default transformation)
+     */
+    public void findDiffPackageAndSubReferencingClassesForMethod(ClassInfo classInfo, int methodNo) {
+        findReferencingClassesForMember(classInfo, methodNo, false, true, true);
+    }
+
+    /**
+     * Find all project classes that re-implement the given method and that are
+     * direct/indirect subclasses of this method's declaring class. If some subclass C
+     * re-implements the given method, we don't have to search C's subclasses further.
+     */
+    public void findSubclassesReimplementingMethod(ClassInfo classInfo, int methodNo) {
+        findSubclassesReimplementingMethod(classInfo, classInfo, methodNo);
+    }
+
+    private void findSubclassesReimplementingMethod(ClassInfo targetClass, ClassInfo methodDeclaringClass, int methodNo) {
+        for (ClassInfo subclass : targetClass.getDirectSubclasses()) {
+            if (subclass.declaresMethod(methodDeclaringClass, methodNo)) {
+                addToAffectedClassNames(subclass.name);
+            } else {
+                findSubclassesReimplementingMethod(subclass, methodDeclaringClass, methodNo);
+            }
+        }
+    }
+
+    /**
+     * For a given class C, find all concrete direct subclasses, and all direct concrente subclasses of C's direct
+     * or indirect abstract subclasses.
+     */
+    public void findConcreteSubclasses(ClassInfo targetClass) {
+        for (ClassInfo subclass : targetClass.getDirectSubclasses()) {
+            if (subclass.isAbstract()) {
+                findConcreteSubclasses(subclass);
+            } else {
+                addToAffectedClassNames(subclass.name);
+            }
+        }
+    }
+
+    /**
+     * Find any concrete subclasses of targetClass that don't override or inherit a concrete implementation
+     * of the given method.
+     */
+    public void findConcreteSubclassesNotOverridingAbstractMethod(ClassInfo targetClass, ClassInfo methodDeclaringClass, int methodNo) {
+        for (ClassInfo subclass : targetClass.getDirectSubclasses()) {
+            int pos =
+                    subclass.getDeclaredMethodPos(methodDeclaringClass, methodNo);
+            if (pos == -1) { // This method is not overridden in this class
+                if (!subclass.isAbstract()) {
+                    addToAffectedClassNames(subclass.name);
+                } else {
+                    findConcreteSubclassesNotOverridingAbstractMethod(subclass, methodDeclaringClass, methodNo);
+                }
+            } else { // A chance that this method is declared abstract once again...
+                if (Modifier.isAbstract(subclass.methodAccessFlags[pos])) {
+                    findConcreteSubclassesNotOverridingAbstractMethod(subclass, methodDeclaringClass, methodNo);
+                }
+            }
+        }
+    }
+
+    /** Find all project classes that reference any method that throws the given exception. */
+    public void findRefsToMethodsThrowingException(ClassInfo excClassInfo) {
+            for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo classInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (classInfo == null) {
+                continue;  // New class
+            }
+            int methodIdx = -1;
+            do {
+                methodIdx =
+                        classInfo.hasMethodThrowingException(excClassInfo, methodIdx + 1);
+                if (methodIdx != -1) {
+                    findReferencingClassesForMethod(classInfo, methodIdx);
+                }
+            } while (methodIdx != -1);
+        }
+    }
+
+    /**
+     * Find all project classes declaring a static field with the given name. Currently used only to look up
+     * classes referencing given class X via the "X.class" construct.
+     */
+    public void findClassesDeclaringField(String name, String signature, boolean isStatic, String packageToLookIn) {
+      for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo classInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (classInfo == null) {
+                continue;  // New class
+            }
+            if (packageToLookIn != null &&
+                    !classInfo.packageName.equals(packageToLookIn)) {
+                continue;
+            }
+            if (classInfo.declaresField(name, signature, isStatic)) {
+                addToAffectedClassNames(classInfo.name);
+            }
+        }
+    }
+
+    public void addToAffectedClassNames(String className) {
+        String res = pcdm.classAlreadyRecompiledOrUncompileable(className);
+        if (res == null) {
+            affectedClassNames.add(className);
+        } else if (!"".equals(res)) {  // The dependent class comes from a .jar.
+            if (checkedClassIsFromJar || noWarnOnDependentJar) {
+                return;
+            }
+            String message = "Class " + className + " is affected by a change to " + checkedClassName + ", but can't be recompiled, " +
+                    "since it is located in archive " + res;
+            if (failOnDependentJar) {
+                throw new PrivateException(new PublicExceptions.JarDependsOnSourceException(message));
+            } else {
+                Utils.printWarningMessage("Warning: " + message);
+            }
+        }
+    }
+
+    /**
+     * Find all project classes that reference the class with the given name.
+     * The second parameter controls the "thoroughness degree", and its value is passed to ClassInfo.referencesClass()
+     * method (see the comment to it). The fromDiffPackages parameter defines whether all such classes
+     * or only classes from different packages are required.
+     */
+    private void findReferencingClasses(ClassInfo classInfo,
+            int thorDegree, boolean fromDiffPackages,
+            Set<String> ret) {
+        String packageName = classInfo.packageName;
+        for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            if (fromDiffPackages && packageName.equals(clientInfo.packageName)) {
+                continue;
+            }
+            // If thorDegree == 2, i.e. indirect references from the constantpool (e.g. a reference to a method which
+            // has classInfo as one of its formal parameter types) are taken into account, then we should check all of
+            // the classes, whether classInfo is directly accessible from them or not.
+            if (thorDegree != 2 && (!classAccessibleFrom(classInfo, clientInfo))) {
+                continue;
+            }
+
+            if (clientInfo.referencesClass(classInfo.name, classInfo.isInterface(), thorDegree)) {
+                if (ret == null) {
+                    addToAffectedClassNames(clientInfo.name);
+                } else {
+                    ret.add(clientInfo.name);
+                }
+            }
+        }
+    }
+
+    /**
+     * Find all project classes that reference the given member. If fromDiffPackages
+     * is true, then only classes that do not belong to the package of the member's
+     * declaring class should be returned. If onlySubclasses is true, then only
+     * classes that are subclasses of member's declaring class should be returned.
+     */
+    private void findReferencingClassesForMember(ClassInfo declaringClassInfo, int memberNo,
+            boolean isField,
+            boolean fromDiffPackages, boolean onlySubclasses) {
+        String declaringClassName = declaringClassInfo.name;
+        String declaringClassPackage = declaringClassInfo.packageName;
+        for (PCDEntry pcde : pcdm.entries()) {
+            ClassInfo clientInfo =
+                    pcdm.getClassInfoForPCDEntry(ClassInfo.VER_OLD, pcde);
+            if (clientInfo == null) {
+                continue;  // New class
+            }
+            String className = clientInfo.name;
+            if (className.equals(declaringClassName)) {
+                continue;
+            }
+            if (!memberAccessibleFrom(declaringClassInfo, memberNo, clientInfo, isField)) {
+                continue;
+            }
+            if (fromDiffPackages &&
+                    declaringClassPackage.equals(clientInfo.packageName)) {
+                continue;
+            }
+            if (onlySubclasses && !clientInfo.isSubclassOf(declaringClassName, false)) {
+                continue;
+            }
+
+            if (isField) {
+                if (clientInfo.referencesField(declaringClassInfo, memberNo)) {
+                    addToAffectedClassNames(clientInfo.name);
+                }
+            } else {
+                if (clientInfo.referencesMethod(declaringClassInfo, memberNo)) {
+                    addToAffectedClassNames(clientInfo.name);
+                }
+            }
+        }
+    }
+
+    /** Checks if class classInfo is accessible from class clientClassInfo. */
+    private boolean classAccessibleFrom(ClassInfo classInfo, ClassInfo clientClassInfo) {
+        char classFlags = classInfo.accessFlags;
+        String classPackage = classInfo.packageName;
+        String clientClassPackage = clientClassInfo.packageName;
+
+        if (Modifier.isPublic(classFlags)) {
+            return true;
+        } else if (Modifier.isProtected(classFlags)) {
+            if (classPackage.equals(clientClassPackage) ||
+                    clientClassInfo.isSubclassOf(classInfo.directlyEnclosingClass, false)) {
+                return true;
+            }
+        } else if (Modifier.isPrivate(classFlags)) {
+            if (classInfo.topLevelEnclosingClass.equals(clientClassInfo.topLevelEnclosingClass)) {
+                return true;
+            }
+        } else {
+            if (classPackage.equals(clientClassPackage)) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Checks if member memberNo (which is a field if isField == true, and method otherwise) of class memberClassInfo is
+     * accessible from class clientClassInfo.
+     */
+    private boolean memberAccessibleFrom(ClassInfo memberClassInfo,
+            int memberNo, ClassInfo clientClassInfo, boolean isField) {
+        char memberClassFlags = memberClassInfo.accessFlags;
+        char memberFlags = isField ? memberClassInfo.fieldAccessFlags[memberNo]
+                : memberClassInfo.methodAccessFlags[memberNo];
+        String memberClassPackage = memberClassInfo.packageName;
+        String clientClassPackage = clientClassInfo.packageName;
+
+        if (Modifier.isPublic(memberClassFlags)) {
+            if (Modifier.isPublic(memberFlags)) {
+                return true;
+            } else if (Modifier.isProtected(memberFlags) &&
+                    (memberClassPackage.equals(clientClassPackage) ||
+                    clientClassInfo.isSubclassOf(memberClassInfo.name, false))) {
+                return true;
+            } else if (Modifier.isPrivate(memberFlags)) {
+                if (memberClassInfo.topLevelEnclosingClass.equals(
+                        clientClassInfo.topLevelEnclosingClass)) {
+                    return true;
+                }
+            } else if (memberClassPackage.equals(clientClassPackage)) {
+                return true;
+            }
+        } else if (Modifier.isProtected(memberClassFlags)) {
+            if (!(memberClassPackage.equals(clientClassPackage) ||
+                    clientClassInfo.isSubclassOf(memberClassInfo.directlyEnclosingClass, false))) {
+                return true;
+            }
+            if (Modifier.isPublic(memberFlags) ||
+                    Modifier.isProtected(memberFlags)) {
+                return true;
+            } else if (Modifier.isPrivate(memberFlags)) {
+                if (memberClassInfo.topLevelEnclosingClass.equals(
+                        clientClassInfo.topLevelEnclosingClass)) {
+                    return true;
+                }
+            } else {
+                if (memberClassPackage.equals(clientClassPackage)) {
+                    return true;
+                }
+            }
+        } else if (Modifier.isPrivate(memberClassFlags)) {
+            if (memberClassInfo.topLevelEnclosingClass.equals(
+                    clientClassInfo.topLevelEnclosingClass)) {
+                return true;
+            }
+        } else {  // memberClassInfo is package-private
+            if (!memberClassPackage.equals(clientClassPackage)) {
+                return false;
+            }
+            if (Modifier.isPublic(memberFlags) || Modifier.isProtected(memberFlags)) {
+                return true;
+            } else if (Modifier.isPrivate(memberFlags)) {
+                if (memberClassInfo.topLevelEnclosingClass.equals(
+                        clientClassInfo.topLevelEnclosingClass)) {
+                    return true;
+                }
+            } else {
+                return true;
+            }
+        }
+
+        return false;
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/TextProjectDatabaseReader.java b/third_party/jmake/src/org/pantsbuild/jmake/TextProjectDatabaseReader.java
new file mode 100644
index 0000000..d227a8e
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/TextProjectDatabaseReader.java
@@ -0,0 +1,107 @@
+/* Copyright (c) 2002-2013 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.ObjectInputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+
+/**
+ * This class creates the internal representation of the project database from a text buffer.
+ *
+ * The Pants build tool manipulates this data in various ways, and it's easiest for it
+ * to do so by parsing text files directly.  This brings JMake into line with Zinc (the
+ * Scala incremental compiler) and allows Pants to handle both uniformly.
+ *
+ * @author  Benjy Weinberger
+ * 13 January 2013
+ */
+public class TextProjectDatabaseReader {
+    public Map<String,PCDEntry> readProjectDatabaseFromFile(File infile) {
+        try {
+            BufferedReader in =
+                new BufferedReader(new InputStreamReader(new FileInputStream(infile), "UTF-8"));
+            try {
+                return readProjectDatabase(in);
+            } finally {
+                in.close();
+            }
+        } catch (FileNotFoundException e) {
+            throw new PrivateException(e);
+        } catch (UnsupportedEncodingException e) {
+            throw new PrivateException(e);
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+
+    public Map<String,PCDEntry> readProjectDatabase(BufferedReader in) {
+        Map<String,PCDEntry> pcd;
+        try {
+            String line = in.readLine();
+            if (!"pcd entries:".equals(line))
+                throw error("Expected: 'pcd entries:', got: " + line);
+            line = in.readLine();
+            Matcher m = Pattern.compile("^(\\d+) items$").matcher(line);
+            if (!m.matches())
+                throw error("Expected: '<n> items', got: " + line);
+            int numEntries = Integer.parseInt(m.group(1));
+            pcd = new LinkedHashMap<String, PCDEntry>(numEntries);
+            for (int i = 0; i < numEntries; i++) {
+                line = in.readLine();
+                if (line == null)
+                    throw error("Unexpected EOF");
+                String[] parts = line.split("\t");
+                if (parts.length != 5) {
+                    throw error("Invalid line: " + line);
+                }
+                String className = parts[0];
+                String javaFullFilePath = parts[1];
+                long oldClassFileLastModified = Long.parseLong(parts[2]);
+                long oldClassFileFingerprint = Long.parseLong(parts[3]);
+                ClassInfo ci = classInfoFromBase64(parts[4]);
+                PCDEntry entry = new PCDEntry(className, javaFullFilePath, oldClassFileLastModified,
+                    oldClassFileFingerprint, ci);
+                pcd.put(entry.className, entry);
+            }
+            // We're done: We have detailed dep information in the PCD entries, so we don't
+            // need to read the dep information lines from the file.
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+        return pcd;
+    }
+
+    private PrivateException error(String msg) {
+        return new PrivateException(new IllegalArgumentException(msg));
+    }
+
+    private ClassInfo classInfoFromBase64(String s) {
+        try {
+            byte[] bytes = Base64.decode(s.toCharArray());
+            ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
+            ClassInfo ret = (ClassInfo)ois.readObject();
+            ret.initializeImmediateTransientFields();
+            return ret;
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        } catch (ClassNotFoundException e) {
+            throw new PrivateException(e);
+        }
+    }
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/TextProjectDatabaseWriter.java b/third_party/jmake/src/org/pantsbuild/jmake/TextProjectDatabaseWriter.java
new file mode 100644
index 0000000..ee5c08f5
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/TextProjectDatabaseWriter.java
@@ -0,0 +1,144 @@
+/* Copyright (c) 2002-2013 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.BufferedWriter;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.Set;
+
+
+/**
+ * This class implements writing a text stream representing a project database.
+ *
+ * @see TextProjectDatabaseReader for details.
+ *
+ * @author  Benjy Weinberger
+ * 13 January 2013
+ */
+public class TextProjectDatabaseWriter {
+    private static Set<String> primitives = new LinkedHashSet<String>(
+        Arrays.asList("boolean", "byte", "char", "double", "float", "int", "long", "short",
+                      "Z", "B", "C", "D", "F", "I", "J", "S"));
+
+    private ByteArrayOutputStream baos = new ByteArrayOutputStream();  // Reusable temp buffer.
+
+    public void writeProjectDatabaseToFile(File outfile, Map<String, PCDEntry> pcd) {
+        try {
+            Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outfile), "UTF-8"));
+            try {
+                writeProjectDatabase(out, pcd);
+            } finally {
+                out.close();
+            }
+        } catch (FileNotFoundException e) {
+            throw new PrivateException(e);
+        } catch (UnsupportedEncodingException e) {
+            throw new PrivateException(e);
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+
+	public void writeProjectDatabase(Writer out, Map<String,PCDEntry> pcd) {
+        try {
+            out.write("pcd entries:\n");
+            out.write(Integer.toString(pcd.size()));
+            out.write(" items\n");
+            Map<String, Set<String>> depsBySource = new LinkedHashMap<String, Set<String>>();
+            for (PCDEntry entry : pcd.values()) {
+                writePCDEntry(out, entry);
+                Set<String> deps = depsBySource.get(entry.javaFileFullPath);
+                if (deps == null) {
+                    deps = new LinkedHashSet<String>();
+                    depsBySource.put(entry.javaFileFullPath, deps);
+                }
+                addDepsFromClassInfo(deps, entry.oldClassInfo);
+            }
+            // Write out dependency information. Note that we don't need to read this back to recreate
+            // the PCD. We write it out here just as a convenience, so that external readers of the PDB
+            // file don't have to grok our internal ClassInfo structures.
+            out.write("dependencies:\n");
+            out.write(Integer.toString(depsBySource.size()));
+            out.write(" items\n");
+            for (Map.Entry<String, Set<String>> item : depsBySource.entrySet()) {
+                out.write(item.getKey());
+                for (String s : item.getValue()) {
+                    out.write('\t');
+                    out.write(s);
+                }
+                out.write('\n');
+            }
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+	}
+
+    private void addDepsFromClassInfo(Set<String> deps, ClassInfo ci) {
+        for (String s : ci.cpoolRefsToClasses) {
+            int i = 0;
+            int j = s.length();
+
+            // Fix some inconsistencies in how we represent types internally:
+            // Despite the comment on ci.cpoolRefsToClasses, class names may be
+            // representing in it with '['s and with '@', '#' instead of 'L', ';'.
+            while (s.charAt(i) == '[') i++;
+            if (s.charAt(i) == '@') i++;
+            if (s.endsWith("#")) j--;
+            int k = s.indexOf('$');
+
+            // Take the outer class, on references to nested classes.
+            if (k != -1) j = k;
+            if (i > 0 || j < s.length())
+                s = s.substring(i, j);
+
+            // We don't need to record deps on primitive types, or arrays of them.
+            if (!primitives.contains(s))
+                deps.add(s);
+        }
+    }
+
+	private void writePCDEntry(Writer out, PCDEntry entry) {
+        try {
+            out.write(entry.className);
+            out.write('\t');
+            out.write(entry.javaFileFullPath);
+            out.write('\t');
+            out.write(Long.toString(entry.oldClassFileLastModified));
+            out.write('\t');
+            out.write(Long.toString(entry.oldClassFileFingerprint));
+            out.write('\t');
+            out.write(classInfoToBase64(entry.oldClassInfo));
+            out.write('\n');
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+	}
+
+	private char[] classInfoToBase64(ClassInfo ci) {
+        baos.reset();
+        try {
+            ObjectOutputStream oos = new ObjectOutputStream(baos);
+            oos.writeObject(ci);
+            oos.close();
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+        return Base64.encode(baos.toByteArray());
+	}
+}
diff --git a/third_party/jmake/src/org/pantsbuild/jmake/Utils.java b/third_party/jmake/src/org/pantsbuild/jmake/Utils.java
new file mode 100644
index 0000000..38566a9
--- /dev/null
+++ b/third_party/jmake/src/org/pantsbuild/jmake/Utils.java
@@ -0,0 +1,355 @@
+/* Copyright (c) 2002-2008 Sun Microsystems, Inc. All rights reserved
+ *
+ * This program is distributed under the terms of
+ * the GNU General Public License Version 2. See the LICENSE file
+ * at the top of the source tree.
+ */
+package org.pantsbuild.jmake;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+
+/**
+ * Utility functions used by other classes from this package.
+ *
+ * @author Misha Dmitriev
+ * 23 January 2003
+ */
+public class Utils {
+
+    static final String REPORT_PROBLEM =
+            "Please report this problem to Mikhail.Dmitriev@sun.com";
+    static final byte[] MAGIC = {'J', 'a', 'v', 'a', 'm', 'a', 'k', 'e', ' ', 'P', 'r', 'o', 'j', 'e', 'c', 't', ' ', 'D', 'a', 't', 'a', 'b', 'a', 's', 'e', ' ', 'F', 'i', 'l', 'e'};
+    static final int magicLength = MAGIC.length;
+    static final int PDB_FORMAT_CODE_OLD = 1;
+    static final int PDB_FORMAT_CODE_133 = 0x01030300;
+    static final int PDB_FORMAT_CODE_LATEST = PDB_FORMAT_CODE_133;
+    static final int JAVAC_TARGET_RELEASE_OLDEST = 0x01040000;  // 1.4 and previous versions
+    static final int JAVAC_TARGET_RELEASE_15 = 0x01050000;  // if class is compiled with -target 1.5
+    static final int JAVAC_TARGET_RELEASE_16 = 0x01060000;  // if class is compiled with -target 1.6
+    static final int JAVAC_TARGET_RELEASE_17 = 0x01070000;  // if class is compiled with -target 1.7
+    static final int JAVAC_TARGET_RELEASE_18 = 0x01080000;  // if class is compiled with -target 1.8
+    static int warningLimit = 20;  // Maximum number of warnings to print
+    static final int TIMING_TOTAL = 0;
+    static final int TIMING_PDBREAD = 1;
+    static final int TIMING_SYNCHRO = 2;
+    static final int TIMING_SYNCHRO_CHECK_JAVA_FILES = 3;
+    static final int TIMING_FIND_UPDATED_JAVA_FILES = 4;
+    static final int TIMING_CLASS_FILE_OBSOLETE_OR_DELETED = 5;
+    static final int TIMING_COMPILE = 6;
+    static final int TIMING_FIND_UPDATED_CLASSES = 7;
+    static final int TIMING_CHECK_UPDATED_CLASSES = 8;
+    static final int TIMING_PDBWRITE = 9;
+    static final int TIMING_SYNCHRO_CHECK_TMP = 10;
+    static final int TIMING_CLASS_FILE_OBSOLETE_TMP = 11;
+    static final int TIMING_PDBUPDATE = 12;
+    static final int TIMING_ARRAY_LENGTH = 13;
+    private static long timings[] = new long[TIMING_ARRAY_LENGTH];
+    private static boolean timingOn = false;
+
+
+    // -------------------------------------------------------------------------------
+    // Name manipulation stuff
+    // -------------------------------------------------------------------------------
+    /**
+     * Returns package name for the given class. In case of no package, returns an
+     * empty, but non-null string. Returned string is interned.
+     */
+    public static String getPackageName(String clazzName) {
+        int ldi = clazzName.lastIndexOf('/');  // For convenience, we use system-internal slashes, not dots
+        if (ldi == -1) {
+            return "";
+        } else {
+            return clazzName.substring(0, ldi).intern();
+        }
+    }
+
+    /**
+     * Returns directly enclosing class name for the given class. If the given class is not a
+     * nested class, returns empty, but non-null string. Returned string is interned.
+     * NOTE FOR JDK 1.5: this function has to work with both old (1.4 and before) and new (1.5) ways
+     * of naming non-member classes. javacTargetRelease determines the javac version for this class;
+     * however on rare occasions (when checking a deleted non-project class) it may be 0, denoting
+     * that javac version is not known.
+     * In that case, we use the old algorithm, which is error-prone due to a bug in nested class
+     * naming that existed prior to JDK 1.5, where both a non-member local nested class B of A, and a
+     * member nested class B of anonymous class A$1, are named A$1$B.
+     */
+    public static String getDirectlyEnclosingClass(String clazzName, int javacTargetRelease) {
+        int ldi = clazzName.lastIndexOf('$');
+        if (ldi == -1) {
+            return "";
+        }
+
+        if (javacTargetRelease >= JAVAC_TARGET_RELEASE_15) {
+            return clazzName.substring(0, ldi).intern();
+        } else {   // JAVAC_TARGET_RELEASE_OLDEST or unknown
+            // Take into account local classes which are named like "EncClass$1$LocalClass", where EncClass
+            // is directly enclosing class.
+            int lldi = clazzName.lastIndexOf('$', ldi - 1);
+            if (lldi == -1 || !Character.isDigit(clazzName.charAt(lldi + 1))) {
+                return clazzName.substring(0, ldi).intern();
+            } else {
+                return clazzName.substring(0, lldi).intern();
+            }
+        }
+    }
+
+    /**
+     * Returns top-level enclosing class name for the given class. If the given class is not a
+     * nested class, returns empty, but non-null string. Returned string is interned.
+     */
+    public static String getTopLevelEnclosingClass(String clazzName) {
+        int fdi = clazzName.indexOf('$');
+        if (fdi == -1) {
+            return "";
+        }
+
+        return clazzName.substring(0, fdi).intern();
+    }
+
+    /**
+     * Given the full path for the enclosing class file and the full name for the nested class, return the supposed
+     * full path for the nested class.
+     */
+    public static String getClassFileFullPathForNestedClass(String enclosingClassFileFullPath, String nestedClassFullName) {
+        String enclosingClassDir = enclosingClassFileFullPath;
+        int cutIndex = enclosingClassDir.lastIndexOf(File.separatorChar);
+        enclosingClassDir = enclosingClassDir.substring(0, cutIndex + 1); // If slash is present, it's included, otherwise we get ""
+        cutIndex = nestedClassFullName.lastIndexOf('/');
+        String nestedClassLocalName;
+        if (cutIndex < 0) {
+            nestedClassLocalName = nestedClassFullName;
+        } else {
+            nestedClassLocalName = nestedClassFullName.substring(cutIndex + 1);
+        }
+        return enclosingClassDir + nestedClassLocalName + ".class";
+    }
+
+    /**
+     * For two strings representing signatures, check if the number of parameters in
+     * both is the same.
+     */
+    public static boolean sameParamNumber(String sig1, String sig2) {
+        return getParamNumber(sig1) == getParamNumber(sig2);
+    }
+
+    private static int getParamNumber(String sig) {
+        char ch;
+        int parNo = 0, pos = 0;
+        do {
+            ch = sig.charAt(++pos);
+            if (ch == ')') {
+                break;
+            }
+            while (ch == '[') {
+                ch = sig.charAt(++pos);
+            }
+            parNo++;
+            if (ch == '@') {
+                // We replaced all "Lclassname;" in signatures with "@classname#"
+                while (ch != '#') {
+                    ch = sig.charAt(++pos);
+                }
+            }
+        } while (ch != ')');
+        return parNo;
+    }
+
+
+    // -------------------------------------------------------------------------------
+    // File related stuff
+    // -------------------------------------------------------------------------------
+    public static File checkFileForName(String name) {
+        // For each .java file, a File object is created two times when jmake executes: first when we synchronise the PCD
+        // and the supplied .java file list (we make sure that the .java file exists), and second time when we check if a class
+        // file was updated (we compare time stamps of the .java and the .class file). I tried to call this routine for a .java
+        // class both times, and cached File objects, but it looks as if this does not bring any real speed-up (and in fact may
+        // even slow down the application). Most of the time seems to go to the underlying code creating internal File
+        // representation; once it is created, it takes little time to execute another "new File()" for it. Also, all operations
+        // on files like getCanonicalPath() or lastModified() seem to be quite expensive, so their unnecessary repetition should
+        // be avoided as much as possible.
+        if (name == null) {
+            return null;
+        }
+        File file = new File(name);
+        if (file.exists()) {
+            return file;
+        }
+        return null;
+    }
+
+    public static File checkOrCreateDirForName(String name) {
+        File file = new File(name);
+        if (!file.exists()) {
+            file.mkdirs();
+        }
+        if (file.exists()) {
+            if (!file.isDirectory()) {
+                throw new PrivateException(new PublicExceptions.InternalException(file + " is not a directory."));
+            }
+            return file;
+        }
+        return null;
+    }
+
+    public static byte[] readFileIntoBuffer(File file) {
+        try {
+            InputStream in = new FileInputStream(file);
+            int len = (int) file.length();
+            return readInputStreamIntoBuffer(in, len);
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+
+    public static byte[] readZipEntryIntoBuffer(ZipFile file, ZipEntry entry) {
+        try {
+            InputStream in = file.getInputStream(entry);
+            int len = (int) entry.getSize();
+            return Utils.readInputStreamIntoBuffer(in, len);
+        } catch (IOException e) {
+            throw new PrivateException(e);
+        }
+    }
+
+    public static byte[] readInputStreamIntoBuffer(InputStream in, int len) throws IOException {
+        byte buf[] = new byte[len];
+        int readBytes, ofs = 0, remBytes = len;
+        do {
+            readBytes = in.read(buf, ofs, remBytes);
+            ofs += readBytes;
+            remBytes -= readBytes;
+        } while (ofs < len);
+        in.close();
+        return buf;
+    }
+
+    public static void readAndPrintBytesFromStream(InputStream in, OutputStream out) throws IOException {
+        int avail = in.available();
+        if (avail > 0) {
+            byte outbytes[] = new byte[avail];
+            int realOutBytes = in.read(outbytes);
+            out.write(outbytes, 0, realOutBytes);
+        }
+    }
+
+    /** For a Windows path, convert the drive letter to the lower case */
+    public static String convertDriveLetterToLowerCase(String path) {
+        if (path.charAt(1) != ':') {
+            return path;
+        }
+        char drive = path.charAt(0);
+        if (Character.isUpperCase(drive)) {
+            drive = Character.toLowerCase(drive);
+            char[] chars = path.toCharArray();
+            chars[0] = drive;
+            path = new String(chars);
+        }
+        return path;
+    }
+
+    public static void ignore(Exception e) {
+        // Ignore this exception
+    }
+
+    /** Used when invoking a third-party executable compiler app */
+    public static void delay(int ms) {
+        Object o = new Object();
+        synchronized (o) {
+            try {
+                o.wait(ms);
+            } catch (InterruptedException e) {
+            }
+        }
+    }
+    // -------------------------------------------------------------------------------
+    // Custom printing stuff
+    // -------------------------------------------------------------------------------
+    private static PrintStream out = System.out;
+    private static PrintStream warn = System.out;
+    private static PrintStream err = System.err;
+    private static boolean printInfoMessages = true;
+    private static boolean printWarningMessages = true;
+    private static boolean printErrorMessages = true;
+    private static int warningNo;
+
+    public static void setOutputStreams(PrintStream out, PrintStream warn, PrintStream err) {
+        Utils.out = out;
+        Utils.warn = warn;
+        Utils.err = err;
+    }
+
+    public static void customizeOutput(boolean printInfoMessages, boolean printWarningMessages, boolean printErrorMessages) {
+        Utils.printInfoMessages = printInfoMessages;
+        Utils.printWarningMessages = printWarningMessages;
+        Utils.printErrorMessages = printErrorMessages;
+    }
+
+    public static void printInfoMessage(String message) {
+        if (printInfoMessages) {
+            out.println(message);
+        }
+    }
+
+    public static void printInfoMessageNoEOL(String message) {
+        if (printInfoMessages) {
+            out.print(message);
+        }
+    }
+
+    public static void printWarningMessage(String message) {
+        if (!printWarningMessages) {
+            return;
+        }
+        if (warningNo < warningLimit) {
+            warn.println(message);
+        } else if (warningNo == warningLimit) {
+            warn.println("jmake: more than " + warningLimit + " warnings.");
+        }
+        warningNo++;
+    }
+
+    public static void printErrorMessage(String message) {
+        if (printErrorMessages) {
+            err.println("jmake: " + message);
+        }
+    }
+
+    // -------------------------------------------------------------------------------
+    // Measuring stuff
+    // -------------------------------------------------------------------------------
+    public static void setTimingOn() {
+        timingOn = true;
+    }
+
+    public static void startTiming(int slot) {
+        timings[slot] = System.currentTimeMillis();
+    }
+
+    public static void stopAndPrintTiming(String message, int slot) {
+        if (timingOn) {
+            long time = System.currentTimeMillis() - timings[slot];
+            printInfoMessage("========== " + message + " time = " + time);
+        }
+    }
+
+    public static void printTiming(String message, int slot) {
+        if (timingOn) {
+            printInfoMessage("========== " + message + " time = " + timings[slot]);
+        }
+    }
+
+    public static void stopAndAddTiming(int slot1, int slot2) {
+        if (timingOn) {
+            long time = System.currentTimeMillis() - timings[slot1];
+            timings[slot2] += time;
+        }
+    }
+}
diff --git a/third_party/libjingle/README.chromium b/third_party/libjingle/README.chromium
index 215672c1..93c0c1e 100644
--- a/third_party/libjingle/README.chromium
+++ b/third_party/libjingle/README.chromium
@@ -1,7 +1,7 @@
 Name: libjingle
 URL: http://code.google.com/p/webrtc/
 Version: unknown
-Revision: 10133
+Revision: 10148
 License: BSD
 License File: source/talk/COPYING
 Security Critical: yes
diff --git a/third_party/mojo/mojo_edk.gyp b/third_party/mojo/mojo_edk.gyp
index 0b5b475f..71da5ba3 100644
--- a/third_party/mojo/mojo_edk.gyp
+++ b/third_party/mojo/mojo_edk.gyp
@@ -8,6 +8,12 @@
   ],
   'target_defaults' : {
     'include_dirs': [
+      # TODO(use_chrome_edk): since we include a few headers from src/mojo/edk,
+      # we need their includes to be searched first (i.e. otherwise when
+      # embedder.cc in third_party includes core.h from src/mojo/edk, and the
+      # latter includes mojo/edk/system/memory.h, the header from third_party
+      # would incorrectly get chosen).
+      '../..',
       'src',
     ],
     'direct_dependent_settings': {
@@ -24,6 +30,10 @@
       'dependencies': [
         '../../base/base.gyp:base',
         '../../base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations',
+        # TODO(use_chrome_edk): so that EDK in third_party can choose the EDK in
+        # src/mojo if the command line flag is specified. It has to since we can
+        # only have one definition of the Mojo primitives.
+        '../../mojo/mojo_edk.gyp:mojo_system_impl2',
       ],
       'includes': [
         'mojo_edk_system_impl.gypi',
diff --git a/third_party/mojo/src/mojo/edk/DEPS b/third_party/mojo/src/mojo/edk/DEPS
index 11e5e7f..472ff42 100644
--- a/third_party/mojo/src/mojo/edk/DEPS
+++ b/third_party/mojo/src/mojo/edk/DEPS
@@ -9,4 +9,9 @@
 
   # internal includes.
   "+mojo",
+
+  # TODO(use_chrome_edk): temporary
+  "+../../../../../../mojo/edk/system/core.h",
+  "+../../../../../../mojo/edk/embedder/embedder_internal.h",
+  "+../../../../../../mojo/edk/embedder/simple_platform_support.h",
 ]
diff --git a/third_party/mojo/src/mojo/edk/embedder/BUILD.gn b/third_party/mojo/src/mojo/edk/embedder/BUILD.gn
index b3144f09..3e4adae 100644
--- a/third_party/mojo/src/mojo/edk/embedder/BUILD.gn
+++ b/third_party/mojo/src/mojo/edk/embedder/BUILD.gn
@@ -16,7 +16,6 @@
     "embedder.h",
     "embedder_internal.h",
     "entrypoints.cc",
-    "system_impl_private_entrypoints.cc",
 
     # Test-only code:
     # TODO(vtl): It's a little unfortunate that these end up in the same
@@ -38,8 +37,6 @@
     ":platform",
   ]
 
-  mojo_sdk_deps = [ "mojo/public/platform/native:system_impl_private_api" ]
-
   mojo_sdk_public_deps = [ "mojo/public/cpp/system" ]
 
   deps = [
diff --git a/third_party/mojo/src/mojo/edk/embedder/embedder.cc b/third_party/mojo/src/mojo/edk/embedder/embedder.cc
index cc3e3c0e..259f2e5 100644
--- a/third_party/mojo/src/mojo/edk/embedder/embedder.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/embedder.cc
@@ -7,14 +7,17 @@
 #include "base/atomicops.h"
 #include "base/bind.h"
 #include "base/bind_helpers.h"
+#include "base/command_line.h"
 #include "base/location.h"
 #include "base/logging.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/task_runner.h"
+#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder_internal.h"
 #include "third_party/mojo/src/mojo/edk/embedder/master_process_delegate.h"
-#include "third_party/mojo/src/mojo/edk/embedder/platform_support.h"
 #include "third_party/mojo/src/mojo/edk/embedder/process_delegate.h"
+#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 #include "third_party/mojo/src/mojo/edk/embedder/slave_process_delegate.h"
 #include "third_party/mojo/src/mojo/edk/system/channel.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_manager.h"
@@ -24,6 +27,8 @@
 #include "third_party/mojo/src/mojo/edk/system/message_pipe_dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/platform_handle_dispatcher.h"
 #include "third_party/mojo/src/mojo/edk/system/raw_channel.h"
+#include "../../../../../../mojo/edk/system/core.h"
+#include "../../../../../../mojo/edk/embedder/embedder_internal.h"
 
 namespace mojo {
 namespace embedder {
@@ -39,6 +44,33 @@
 
 namespace {
 
+bool UseNewEDK() {
+  static bool checked = false;
+  static bool use_new = false;
+  if (!checked) {
+    use_new = base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk");
+    checked = true;
+  }
+  return use_new;
+}
+
+// TODO(use_chrome_edk): temporary wrapper.
+class NewEDKProcessDelegate : public mojo::edk::ProcessDelegate {
+ public:
+  NewEDKProcessDelegate(mojo::embedder::ProcessDelegate* passed_in_delegate)
+      : passed_in_delegate_(passed_in_delegate) {}
+  ~NewEDKProcessDelegate() {}
+
+  void OnShutdownComplete() {
+    passed_in_delegate_->OnShutdownComplete();
+  }
+
+ private:
+  mojo::embedder::ProcessDelegate* passed_in_delegate_;
+};
+
+NewEDKProcessDelegate* g_wrapper_process_delegate = nullptr;
+
 // TODO(vtl): For now, we need this to be thread-safe (since theoretically we
 // currently support multiple channel creation threads -- possibly one per
 // channel). Eventually, we won't need it to be thread-safe (we'll require a
@@ -78,23 +110,27 @@
 
 }  // namespace
 
-Configuration* GetConfiguration() {
-  return system::GetMutableConfiguration();
+void SetMaxMessageSize(size_t bytes) {
+  system::GetMutableConfiguration()->max_message_num_bytes = bytes;
+  // TODO(use_chrome_edk): also set this in the new EDK.
+  mojo::edk::SetMaxMessageSize(bytes);
 }
 
-void Init(scoped_ptr<PlatformSupport> platform_support) {
-  DCHECK(platform_support);
-
+void Init() {
   DCHECK(!internal::g_platform_support);
-  internal::g_platform_support = platform_support.release();
+  internal::g_platform_support = new SimplePlatformSupport();
 
   DCHECK(!internal::g_core);
   internal::g_core = new system::Core(internal::g_platform_support);
+  // TODO(use_chrome_edk): also initialize the new EDK.
+  mojo::edk::Init();
 }
 
 MojoResult AsyncWait(MojoHandle handle,
                      MojoHandleSignals signals,
                      const base::Callback<void(MojoResult)>& callback) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->AsyncWait(handle, signals, callback);
   return internal::g_core->AsyncWait(handle, signals, callback);
 }
 
@@ -102,6 +138,16 @@
     ScopedPlatformHandle platform_handle,
     MojoHandle* platform_handle_wrapper_handle) {
   DCHECK(platform_handle_wrapper_handle);
+  if (UseNewEDK()) {
+    mojo::edk::ScopedPlatformHandle edk_handle(mojo::edk::PlatformHandle(
+#if defined(OS_WIN)
+        platform_handle.release().handle));
+#else
+        platform_handle.release().fd));
+#endif
+    return mojo::edk::CreatePlatformHandleWrapper(
+        edk_handle.Pass(), platform_handle_wrapper_handle);
+  }
 
   scoped_refptr<system::Dispatcher> dispatcher =
       system::PlatformHandleDispatcher::Create(platform_handle.Pass());
@@ -121,6 +167,18 @@
 MojoResult PassWrappedPlatformHandle(MojoHandle platform_handle_wrapper_handle,
                                      ScopedPlatformHandle* platform_handle) {
   DCHECK(platform_handle);
+  if (UseNewEDK()) {
+    mojo::edk::ScopedPlatformHandle edk_handle;
+    MojoResult rv = mojo::edk::PassWrappedPlatformHandle(
+        platform_handle_wrapper_handle, &edk_handle);
+    platform_handle->reset(mojo::embedder::PlatformHandle(
+#if defined(OS_WIN)
+        edk_handle.release().handle));
+#else
+        edk_handle.release().fd));
+#endif
+    return rv;
+  }
 
   DCHECK(internal::g_core);
   scoped_refptr<system::Dispatcher> dispatcher(
@@ -150,11 +208,24 @@
 
   internal::g_ipc_support = new system::IPCSupport(
       internal::g_platform_support, process_type,
-      delegate_thread_task_runner.Pass(), process_delegate,
-      io_thread_task_runner.Pass(), platform_handle.Pass());
+      delegate_thread_task_runner, process_delegate,
+      io_thread_task_runner, platform_handle.Pass());
+
+  // TODO(use_chrome_edk) at this point the command line to switch to the new
+  // EDK might not be set yet. There's no harm in always intializing the new EDK
+  // though.
+  g_wrapper_process_delegate = new NewEDKProcessDelegate(process_delegate);
+  mojo::edk::InitIPCSupport(delegate_thread_task_runner,
+                            g_wrapper_process_delegate,
+                            io_thread_task_runner);
 }
 
 void ShutdownIPCSupportOnIOThread() {
+  if (UseNewEDK()) {
+    mojo::edk::ShutdownIPCSupportOnIOThread();
+    return;
+  }
+
   DCHECK(internal::g_ipc_support);
 
   internal::g_ipc_support->ShutdownOnIOThread();
@@ -163,6 +234,11 @@
 }
 
 void ShutdownIPCSupport() {
+  if (UseNewEDK()) {
+    mojo::edk::ShutdownIPCSupport();
+    return;
+  }
+
   DCHECK(internal::g_ipc_support);
 
   bool ok = internal::g_ipc_support->io_thread_task_runner()->PostTask(
@@ -260,6 +336,17 @@
   DCHECK(!did_create_channel_callback.is_null());
   DCHECK(internal::g_ipc_support);
 
+  if (UseNewEDK()) {
+    did_create_channel_callback.Run(nullptr);
+    mojo::edk::ScopedPlatformHandle edk_handle(mojo::edk::PlatformHandle(
+#if defined(OS_WIN)
+        platform_handle.release().handle));
+#else
+        platform_handle.release().fd));
+#endif
+    return mojo::edk::CreateMessagePipe(edk_handle.Pass());
+  }
+
   system::ChannelManager* channel_manager =
       internal::g_ipc_support->channel_manager();
 
diff --git a/third_party/mojo/src/mojo/edk/embedder/embedder.h b/third_party/mojo/src/mojo/edk/embedder/embedder.h
index bdbd3eb..92b88965 100644
--- a/third_party/mojo/src/mojo/edk/embedder/embedder.h
+++ b/third_party/mojo/src/mojo/edk/embedder/embedder.h
@@ -21,8 +21,6 @@
 namespace mojo {
 namespace embedder {
 
-struct Configuration;
-class PlatformSupport;
 class ProcessDelegate;
 
 // Basic configuration/initialization ------------------------------------------
@@ -31,13 +29,12 @@
 // functions available and functional. This is never shut down (except in tests
 // -- see test_embedder.h).
 
-// Returns the global configuration. In general, you should not need to change
-// the configuration, but if you do you must do it before calling |Init()|.
-MOJO_SYSTEM_IMPL_EXPORT Configuration* GetConfiguration();
+// Allows changing the default max message size. Must be called before Init.
+MOJO_SYSTEM_IMPL_EXPORT void SetMaxMessageSize(size_t bytes);
 
 // Must be called first, or just after setting configuration parameters, to
 // initialize the (global, singleton) system.
-MOJO_SYSTEM_IMPL_EXPORT void Init(scoped_ptr<PlatformSupport> platform_support);
+MOJO_SYSTEM_IMPL_EXPORT void Init();
 
 // Basic functions -------------------------------------------------------------
 
diff --git a/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc b/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc
index 04634ac..7e7c5f4 100644
--- a/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/embedder_unittest.cc
@@ -136,7 +136,7 @@
   }
 
  private:
-  void SetUp() override { test::InitWithSimplePlatformSupport(); }
+  void SetUp() override { Init(); }
 
   void TearDown() override { EXPECT_TRUE(test::Shutdown()); }
 
@@ -499,7 +499,7 @@
   EXPECT_TRUE(client_platform_handle.is_valid());
 
   base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
-  test::InitWithSimplePlatformSupport();
+  Init();
 
   {
     mojo::test::ScopedSlaveIPCSupport ipc_support(
@@ -694,7 +694,7 @@
   EXPECT_TRUE(client_platform_handle.is_valid());
 
   base::TestIOThread test_io_thread(base::TestIOThread::kAutoStart);
-  test::InitWithSimplePlatformSupport();
+  Init();
 
   {
     // TODO(vtl): This should eventually initialize a slave process instead,
diff --git a/third_party/mojo/src/mojo/edk/embedder/entrypoints.cc b/third_party/mojo/src/mojo/edk/embedder/entrypoints.cc
index feb7a8e..22982ec5a 100644
--- a/third_party/mojo/src/mojo/edk/embedder/entrypoints.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/entrypoints.cc
@@ -2,30 +2,52 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "base/command_line.h"
 #include "mojo/public/c/system/buffer.h"
 #include "mojo/public/c/system/data_pipe.h"
 #include "mojo/public/c/system/functions.h"
 #include "mojo/public/c/system/message_pipe.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder_internal.h"
 #include "third_party/mojo/src/mojo/edk/system/core.h"
+#include "../../../../../../mojo/edk/system/core.h"
+#include "../../../../../../mojo/edk/embedder/embedder_internal.h"
 
 using mojo::embedder::internal::g_core;
 using mojo::system::MakeUserPointer;
 
+namespace {
+bool UseNewEDK() {
+  static bool checked = false;
+  static bool use_new = false;
+  if (!checked) {
+    use_new = base::CommandLine::ForCurrentProcess()->HasSwitch("use-new-edk");
+    checked = true;
+  }
+  return use_new;
+}
+}
+
 // Definitions of the system functions.
 extern "C" {
 MojoTimeTicks MojoGetTimeTicksNow() {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->GetTimeTicksNow();
   return g_core->GetTimeTicksNow();
 }
 
 MojoResult MojoClose(MojoHandle handle) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->Close(handle);
   return g_core->Close(handle);
 }
 
 MojoResult MojoWait(MojoHandle handle,
-                       MojoHandleSignals signals,
-                       MojoDeadline deadline,
-                       MojoHandleSignalsState* signals_state) {
+                    MojoHandleSignals signals,
+                    MojoDeadline deadline,
+                    MojoHandleSignalsState* signals_state) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->Wait(
+        handle, signals, deadline, signals_state);
   return g_core->Wait(handle, signals, deadline,
                       MakeUserPointer(signals_state));
 }
@@ -36,6 +58,9 @@
                         MojoDeadline deadline,
                         uint32_t* result_index,
                         MojoHandleSignalsState* signals_states) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->WaitMany(
+        handles, signals, num_handles, deadline, result_index, signals_states);
   return g_core->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals),
                           num_handles, deadline, MakeUserPointer(result_index),
                           MakeUserPointer(signals_states));
@@ -44,6 +69,9 @@
 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options,
                                  MojoHandle* message_pipe_handle0,
                                  MojoHandle* message_pipe_handle1) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->CreateMessagePipe(
+        options, message_pipe_handle0, message_pipe_handle1);
   return g_core->CreateMessagePipe(MakeUserPointer(options),
                                    MakeUserPointer(message_pipe_handle0),
                                    MakeUserPointer(message_pipe_handle1));
@@ -55,6 +83,9 @@
                             const MojoHandle* handles,
                             uint32_t num_handles,
                             MojoWriteMessageFlags flags) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->WriteMessage(
+        message_pipe_handle, bytes, num_bytes, handles, num_handles, flags);
   return g_core->WriteMessage(message_pipe_handle, MakeUserPointer(bytes),
                               num_bytes, MakeUserPointer(handles), num_handles,
                               flags);
@@ -66,6 +97,9 @@
                            MojoHandle* handles,
                            uint32_t* num_handles,
                            MojoReadMessageFlags flags) {
+ if (UseNewEDK())
+    return mojo::edk::internal::g_core->ReadMessage(
+        message_pipe_handle, bytes, num_bytes, handles, num_handles, flags);
   return g_core->ReadMessage(
       message_pipe_handle, MakeUserPointer(bytes), MakeUserPointer(num_bytes),
       MakeUserPointer(handles), MakeUserPointer(num_handles), flags);
@@ -74,6 +108,9 @@
 MojoResult MojoCreateDataPipe(const MojoCreateDataPipeOptions* options,
                               MojoHandle* data_pipe_producer_handle,
                               MojoHandle* data_pipe_consumer_handle) {
+ if (UseNewEDK())
+    return mojo::edk::internal::g_core->CreateDataPipe(
+        options, data_pipe_producer_handle, data_pipe_consumer_handle);
   return g_core->CreateDataPipe(MakeUserPointer(options),
                                 MakeUserPointer(data_pipe_producer_handle),
                                 MakeUserPointer(data_pipe_consumer_handle));
@@ -83,6 +120,9 @@
                          const void* elements,
                          uint32_t* num_elements,
                          MojoWriteDataFlags flags) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->WriteData(
+        data_pipe_producer_handle, elements, num_elements, flags);
   return g_core->WriteData(data_pipe_producer_handle, MakeUserPointer(elements),
                            MakeUserPointer(num_elements), flags);
 }
@@ -91,6 +131,9 @@
                               void** buffer,
                               uint32_t* buffer_num_elements,
                               MojoWriteDataFlags flags) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->BeginWriteData(
+        data_pipe_producer_handle, buffer, buffer_num_elements, flags);
   return g_core->BeginWriteData(data_pipe_producer_handle,
                                 MakeUserPointer(buffer),
                                 MakeUserPointer(buffer_num_elements), flags);
@@ -98,6 +141,9 @@
 
 MojoResult MojoEndWriteData(MojoHandle data_pipe_producer_handle,
                             uint32_t num_elements_written) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->EndWriteData(
+        data_pipe_producer_handle, num_elements_written);
   return g_core->EndWriteData(data_pipe_producer_handle, num_elements_written);
 }
 
@@ -105,6 +151,9 @@
                         void* elements,
                         uint32_t* num_elements,
                         MojoReadDataFlags flags) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->ReadData(
+        data_pipe_consumer_handle, elements, num_elements, flags);
   return g_core->ReadData(data_pipe_consumer_handle, MakeUserPointer(elements),
                           MakeUserPointer(num_elements), flags);
 }
@@ -113,6 +162,9 @@
                              const void** buffer,
                              uint32_t* buffer_num_elements,
                              MojoReadDataFlags flags) {
+ if (UseNewEDK())
+    return mojo::edk::internal::g_core->BeginReadData(
+        data_pipe_consumer_handle, buffer, buffer_num_elements, flags);
   return g_core->BeginReadData(data_pipe_consumer_handle,
                                MakeUserPointer(buffer),
                                MakeUserPointer(buffer_num_elements), flags);
@@ -120,6 +172,9 @@
 
 MojoResult MojoEndReadData(MojoHandle data_pipe_consumer_handle,
                            uint32_t num_elements_read) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->EndReadData(
+        data_pipe_consumer_handle, num_elements_read);
   return g_core->EndReadData(data_pipe_consumer_handle, num_elements_read);
 }
 
@@ -127,6 +182,9 @@
     const struct MojoCreateSharedBufferOptions* options,
     uint64_t num_bytes,
     MojoHandle* shared_buffer_handle) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->CreateSharedBuffer(
+        options, num_bytes, shared_buffer_handle);
   return g_core->CreateSharedBuffer(MakeUserPointer(options), num_bytes,
                                     MakeUserPointer(shared_buffer_handle));
 }
@@ -135,6 +193,9 @@
     MojoHandle buffer_handle,
     const struct MojoDuplicateBufferHandleOptions* options,
     MojoHandle* new_buffer_handle) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->DuplicateBufferHandle(
+        buffer_handle, options, new_buffer_handle);
   return g_core->DuplicateBufferHandle(buffer_handle, MakeUserPointer(options),
                                        MakeUserPointer(new_buffer_handle));
 }
@@ -144,11 +205,16 @@
                          uint64_t num_bytes,
                          void** buffer,
                          MojoMapBufferFlags flags) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->MapBuffer(
+        buffer_handle, offset, num_bytes, buffer, flags);
   return g_core->MapBuffer(buffer_handle, offset, num_bytes,
                            MakeUserPointer(buffer), flags);
 }
 
 MojoResult MojoUnmapBuffer(void* buffer) {
+  if (UseNewEDK())
+    return mojo::edk::internal::g_core->UnmapBuffer(buffer);
   return g_core->UnmapBuffer(MakeUserPointer(buffer));
 }
 
diff --git a/third_party/mojo/src/mojo/edk/embedder/system_impl_private_entrypoints.cc b/third_party/mojo/src/mojo/edk/embedder/system_impl_private_entrypoints.cc
deleted file mode 100644
index b1393ef..0000000
--- a/third_party/mojo/src/mojo/edk/embedder/system_impl_private_entrypoints.cc
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/public/c/system/buffer.h"
-#include "mojo/public/c/system/data_pipe.h"
-#include "mojo/public/c/system/functions.h"
-#include "mojo/public/c/system/message_pipe.h"
-#include "mojo/public/platform/native/system_impl_private.h"
-#include "third_party/mojo/src/mojo/edk/embedder/embedder_internal.h"
-#include "third_party/mojo/src/mojo/edk/system/core.h"
-#include "third_party/mojo/src/mojo/edk/system/dispatcher.h"
-
-using mojo::embedder::internal::g_core;
-using mojo::system::Core;
-using mojo::system::Dispatcher;
-using mojo::system::MakeUserPointer;
-
-// Definitions of the system functions, but with an explicit parameter for the
-// core object rather than using the default singleton. Also includes functions
-// for manipulating core objects.
-extern "C" {
-
-MojoSystemImpl MojoSystemImplGetDefaultImpl() {
-  return static_cast<MojoSystemImpl>(g_core);
-}
-
-MojoSystemImpl MojoSystemImplCreateImpl() {
-  Core* created_core = new Core(g_core->platform_support());
-  return static_cast<MojoSystemImpl>(created_core);
-}
-
-MojoResult MojoSystemImplTransferHandle(MojoSystemImpl from_system,
-                                        MojoHandle handle,
-                                        MojoSystemImpl to_system,
-                                        MojoHandle* result_handle) {
-  Core* from_core = static_cast<Core*>(from_system);
-  if (from_core == nullptr)
-    return MOJO_RESULT_INVALID_ARGUMENT;
-
-  if (handle == MOJO_HANDLE_INVALID)
-    return MOJO_RESULT_INVALID_ARGUMENT;
-
-  Core* to_core = static_cast<Core*>(to_system);
-  if (to_core == nullptr)
-    return MOJO_RESULT_INVALID_ARGUMENT;
-
-  if (result_handle == nullptr)
-    return MOJO_RESULT_INVALID_ARGUMENT;
-
-  scoped_refptr<Dispatcher> d;
-  MojoResult result = from_core->GetAndRemoveDispatcher(handle, &d);
-  if (result != MOJO_RESULT_OK)
-    return result;
-
-  MojoHandle created_handle = to_core->AddDispatcher(d);
-  if (created_handle == MOJO_HANDLE_INVALID) {
-    // The handle has been lost, unfortunately. There's no guarentee we can put
-    // it back where it came from, or get the original ID back. Holding locks
-    // for multiple cores risks deadlock, so that isn't a solution. This case
-    // should not happen for reasonable uses of this API, however.
-    LOG(ERROR) << "Could not transfer handle";
-    d->Close();
-    return MOJO_RESULT_RESOURCE_EXHAUSTED;
-  }
-
-  MakeUserPointer(result_handle).Put(created_handle);
-  return MOJO_RESULT_OK;
-}
-
-MojoTimeTicks MojoSystemImplGetTimeTicksNow(MojoSystemImpl system) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->GetTimeTicksNow();
-}
-
-MojoResult MojoSystemImplClose(MojoSystemImpl system, MojoHandle handle) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->Close(handle);
-}
-
-MojoResult MojoSystemImplWait(MojoSystemImpl system,
-                              MojoHandle handle,
-                              MojoHandleSignals signals,
-                              MojoDeadline deadline,
-                              MojoHandleSignalsState* signals_state) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->Wait(handle, signals, deadline, MakeUserPointer(signals_state));
-}
-
-MojoResult MojoSystemImplWaitMany(MojoSystemImpl system,
-                                  const MojoHandle* handles,
-                                  const MojoHandleSignals* signals,
-                                  uint32_t num_handles,
-                                  MojoDeadline deadline,
-                                  uint32_t* result_index,
-                                  MojoHandleSignalsState* signals_states) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals),
-                        num_handles, deadline, MakeUserPointer(result_index),
-                        MakeUserPointer(signals_states));
-}
-
-MojoResult MojoSystemImplCreateMessagePipe(
-    MojoSystemImpl system,
-    const MojoCreateMessagePipeOptions* options,
-    MojoHandle* message_pipe_handle0,
-    MojoHandle* message_pipe_handle1) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->CreateMessagePipe(MakeUserPointer(options),
-                                 MakeUserPointer(message_pipe_handle0),
-                                 MakeUserPointer(message_pipe_handle1));
-}
-
-MojoResult MojoSystemImplWriteMessage(MojoSystemImpl system,
-                                      MojoHandle message_pipe_handle,
-                                      const void* bytes,
-                                      uint32_t num_bytes,
-                                      const MojoHandle* handles,
-                                      uint32_t num_handles,
-                                      MojoWriteMessageFlags flags) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->WriteMessage(message_pipe_handle, MakeUserPointer(bytes),
-                            num_bytes, MakeUserPointer(handles), num_handles,
-                            flags);
-}
-
-MojoResult MojoSystemImplReadMessage(MojoSystemImpl system,
-                                     MojoHandle message_pipe_handle,
-                                     void* bytes,
-                                     uint32_t* num_bytes,
-                                     MojoHandle* handles,
-                                     uint32_t* num_handles,
-                                     MojoReadMessageFlags flags) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->ReadMessage(message_pipe_handle, MakeUserPointer(bytes),
-                           MakeUserPointer(num_bytes), MakeUserPointer(handles),
-                           MakeUserPointer(num_handles), flags);
-}
-
-MojoResult MojoSystemImplCreateDataPipe(
-    MojoSystemImpl system,
-    const MojoCreateDataPipeOptions* options,
-    MojoHandle* data_pipe_producer_handle,
-    MojoHandle* data_pipe_consumer_handle) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->CreateDataPipe(MakeUserPointer(options),
-                              MakeUserPointer(data_pipe_producer_handle),
-                              MakeUserPointer(data_pipe_consumer_handle));
-}
-
-MojoResult MojoSystemImplWriteData(MojoSystemImpl system,
-                                   MojoHandle data_pipe_producer_handle,
-                                   const void* elements,
-                                   uint32_t* num_elements,
-                                   MojoWriteDataFlags flags) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->WriteData(data_pipe_producer_handle, MakeUserPointer(elements),
-                         MakeUserPointer(num_elements), flags);
-}
-
-MojoResult MojoSystemImplBeginWriteData(MojoSystemImpl system,
-                                        MojoHandle data_pipe_producer_handle,
-                                        void** buffer,
-                                        uint32_t* buffer_num_elements,
-                                        MojoWriteDataFlags flags) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->BeginWriteData(data_pipe_producer_handle,
-                              MakeUserPointer(buffer),
-                              MakeUserPointer(buffer_num_elements), flags);
-}
-
-MojoResult MojoSystemImplEndWriteData(MojoSystemImpl system,
-                                      MojoHandle data_pipe_producer_handle,
-                                      uint32_t num_elements_written) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->EndWriteData(data_pipe_producer_handle, num_elements_written);
-}
-
-MojoResult MojoSystemImplReadData(MojoSystemImpl system,
-                                  MojoHandle data_pipe_consumer_handle,
-                                  void* elements,
-                                  uint32_t* num_elements,
-                                  MojoReadDataFlags flags) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->ReadData(data_pipe_consumer_handle, MakeUserPointer(elements),
-                        MakeUserPointer(num_elements), flags);
-}
-
-MojoResult MojoSystemImplBeginReadData(MojoSystemImpl system,
-                                       MojoHandle data_pipe_consumer_handle,
-                                       const void** buffer,
-                                       uint32_t* buffer_num_elements,
-                                       MojoReadDataFlags flags) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->BeginReadData(data_pipe_consumer_handle, MakeUserPointer(buffer),
-                             MakeUserPointer(buffer_num_elements), flags);
-}
-
-MojoResult MojoSystemImplEndReadData(MojoSystemImpl system,
-                                     MojoHandle data_pipe_consumer_handle,
-                                     uint32_t num_elements_read) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->EndReadData(data_pipe_consumer_handle, num_elements_read);
-}
-
-MojoResult MojoSystemImplCreateSharedBuffer(
-    MojoSystemImpl system,
-    const MojoCreateSharedBufferOptions* options,
-    uint64_t num_bytes,
-    MojoHandle* shared_buffer_handle) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->CreateSharedBuffer(MakeUserPointer(options), num_bytes,
-                                  MakeUserPointer(shared_buffer_handle));
-}
-
-MojoResult MojoSystemImplDuplicateBufferHandle(
-    MojoSystemImpl system,
-    MojoHandle buffer_handle,
-    const MojoDuplicateBufferHandleOptions* options,
-    MojoHandle* new_buffer_handle) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->DuplicateBufferHandle(buffer_handle, MakeUserPointer(options),
-                                     MakeUserPointer(new_buffer_handle));
-}
-
-MojoResult MojoSystemImplMapBuffer(MojoSystemImpl system,
-                                   MojoHandle buffer_handle,
-                                   uint64_t offset,
-                                   uint64_t num_bytes,
-                                   void** buffer,
-                                   MojoMapBufferFlags flags) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->MapBuffer(buffer_handle, offset, num_bytes,
-                         MakeUserPointer(buffer), flags);
-}
-
-MojoResult MojoSystemImplUnmapBuffer(MojoSystemImpl system, void* buffer) {
-  mojo::system::Core* core = static_cast<mojo::system::Core*>(system);
-  DCHECK(core);
-  return core->UnmapBuffer(MakeUserPointer(buffer));
-}
-
-}  // extern "C"
diff --git a/third_party/mojo/src/mojo/edk/embedder/test_embedder.cc b/third_party/mojo/src/mojo/edk/embedder/test_embedder.cc
index bb99819..23e485e 100644
--- a/third_party/mojo/src/mojo/edk/embedder/test_embedder.cc
+++ b/third_party/mojo/src/mojo/edk/embedder/test_embedder.cc
@@ -8,10 +8,13 @@
 #include "base/memory/scoped_ptr.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder_internal.h"
-#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
+#include "third_party/mojo/src/mojo/edk/embedder/platform_support.h"
 #include "third_party/mojo/src/mojo/edk/system/channel_manager.h"
 #include "third_party/mojo/src/mojo/edk/system/core.h"
 #include "third_party/mojo/src/mojo/edk/system/handle_table.h"
+#include "../../../../../../mojo/edk/system/core.h"
+#include "../../../../../../mojo/edk/embedder/embedder_internal.h"
+#include "../../../../../../mojo/edk/embedder/simple_platform_support.h"
 
 namespace mojo {
 
@@ -40,10 +43,6 @@
 namespace embedder {
 namespace test {
 
-void InitWithSimplePlatformSupport() {
-  Init(make_scoped_ptr(new SimplePlatformSupport()));
-}
-
 bool Shutdown() {
   // If |InitIPCSupport()| was called, then |ShutdownIPCSupport()| must have
   // been called first.
@@ -58,6 +57,16 @@
   delete internal::g_platform_support;
   internal::g_platform_support = nullptr;
 
+
+  // TODO(use_chrome_edk): temporary to match mojo::embedder::Init
+  CHECK(mojo::edk::internal::g_core);
+  delete mojo::edk::internal::g_core;
+  mojo::edk::internal::g_core = nullptr;
+
+  CHECK(mojo::edk::internal::g_platform_support);
+  delete mojo::edk::internal::g_platform_support;
+  mojo::edk::internal::g_platform_support = nullptr;
+
   return rv;
 }
 
diff --git a/third_party/mojo/src/mojo/edk/embedder/test_embedder.h b/third_party/mojo/src/mojo/edk/embedder/test_embedder.h
index 3591bd7..7b87b98a 100644
--- a/third_party/mojo/src/mojo/edk/embedder/test_embedder.h
+++ b/third_party/mojo/src/mojo/edk/embedder/test_embedder.h
@@ -11,10 +11,6 @@
 namespace embedder {
 namespace test {
 
-// Calls |Init()| with a |SimplePlatformSupport| (use this in tests if, e.g.,
-// you don't care about sandboxing, etc.).
-MOJO_SYSTEM_IMPL_EXPORT void InitWithSimplePlatformSupport();
-
 // This shuts down the global, singleton instance. (Note: "Real" embedders are
 // not expected to ever shut down this instance. This |Shutdown()| function will
 // do more work to ensure that tests don't leak, etc.) Returns true if there
diff --git a/third_party/mojo/src/mojo/edk/system/BUILD.gn b/third_party/mojo/src/mojo/edk/system/BUILD.gn
index ac292d5..ebe88a8 100644
--- a/third_party/mojo/src/mojo/edk/system/BUILD.gn
+++ b/third_party/mojo/src/mojo/edk/system/BUILD.gn
@@ -128,6 +128,11 @@
     "../embedder:platform",
     "../../public/c/system",
     "../../public/cpp/system",
+
+    # TODO(use_chrome_edk): so that EDK in third_party can choose the EDK in
+    # src/mojo if the command line flag is specified. It has to since we can
+    # only have one definition of the Mojo primitives.
+    "//mojo/edk/system",
   ]
 
   deps = [
@@ -215,6 +220,7 @@
     ":system",
     ":test_utils",
     "../embedder:embedder_unittests",
+    "../../public/cpp/environment:standalone",
     "../test:test_support",
     "//base",
     "//base/test:test_support",
@@ -234,6 +240,7 @@
   deps = [
     ":system",
     ":test_utils",
+    "../../public/cpp/environment:standalone",
     "../test:test_support",
     "//base",
     "//base/test:test_support",
diff --git a/third_party/mojo/src/mojo/edk/system/core.cc b/third_party/mojo/src/mojo/edk/system/core.cc
index c2b0136..51fdfcbf 100644
--- a/third_party/mojo/src/mojo/edk/system/core.cc
+++ b/third_party/mojo/src/mojo/edk/system/core.cc
@@ -98,15 +98,6 @@
   return handle_table_.GetDispatcher(handle);
 }
 
-MojoResult Core::GetAndRemoveDispatcher(MojoHandle handle,
-                                        scoped_refptr<Dispatcher>* dispatcher) {
-  if (handle == MOJO_HANDLE_INVALID)
-    return MOJO_RESULT_INVALID_ARGUMENT;
-
-  MutexLocker locker(&handle_table_mutex_);
-  return handle_table_.GetAndRemoveDispatcher(handle, dispatcher);
-}
-
 MojoResult Core::AsyncWait(MojoHandle handle,
                            MojoHandleSignals signals,
                            const base::Callback<void(MojoResult)>& callback) {
diff --git a/third_party/mojo/src/mojo/edk/system/core.h b/third_party/mojo/src/mojo/edk/system/core.h
index de4dc6d..2dc504b 100644
--- a/third_party/mojo/src/mojo/edk/system/core.h
+++ b/third_party/mojo/src/mojo/edk/system/core.h
@@ -52,15 +52,6 @@
   // invalid.
   scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle);
 
-  // Like |GetDispatcher()|, but also removes the handle from the handle table.
-  // On success, gets the dispatcher for a given handle (which should not be
-  // |MOJO_HANDLE_INVALID|) and removes it. (On failure, returns an appropriate
-  // result (and leaves |dispatcher| alone), namely
-  // |MOJO_RESULT_INVALID_ARGUMENT| if there's no dispatcher for the given
-  // handle or |MOJO_RESULT_BUSY| if the handle is marked as busy.)
-  MojoResult GetAndRemoveDispatcher(MojoHandle handle,
-                                    scoped_refptr<Dispatcher>* dispatcher);
-
   // Watches on the given handle for the given signals, calling |callback| when
   // a signal is satisfied or when all signals become unsatisfiable. |callback|
   // must satisfy stringent requirements -- see |Awakable::Awake()| in
diff --git a/third_party/mojo/src/mojo/edk/test/BUILD.gn b/third_party/mojo/src/mojo/edk/test/BUILD.gn
index 834d837..716de9b 100644
--- a/third_party/mojo/src/mojo/edk/test/BUILD.gn
+++ b/third_party/mojo/src/mojo/edk/test/BUILD.gn
@@ -95,7 +95,6 @@
     ":mojo_public_system_perftests",
     ":mojo_public_system_unittests",
     ":mojo_public_utility_unittests",
-    ":mojo_system_impl_private_unittests",
   ]
 
   if (mojo_use_application_in_sdk) {
@@ -153,10 +152,3 @@
     "../../public/cpp/utility/tests",
   ]
 }
-
-test("mojo_system_impl_private_unittests") {
-  deps = [
-    ":run_all_unittests",
-    "../../public/platform/native:system_impl_private_tests",
-  ]
-}
diff --git a/third_party/mojo/src/mojo/edk/test/run_all_perftests.cc b/third_party/mojo/src/mojo/edk/test/run_all_perftests.cc
index 9040f18..41b5ab26 100644
--- a/third_party/mojo/src/mojo/edk/test/run_all_perftests.cc
+++ b/third_party/mojo/src/mojo/edk/test/run_all_perftests.cc
@@ -4,11 +4,11 @@
 
 #include "base/test/perf_test_suite.h"
 #include "mojo/public/tests/test_support_private.h"
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "third_party/mojo/src/mojo/edk/test/test_support_impl.h"
 
 int main(int argc, char** argv) {
-  mojo::embedder::test::InitWithSimplePlatformSupport();
+  mojo::embedder::Init();
   mojo::test::TestSupport::Init(new mojo::test::TestSupportImpl());
   return base::PerfTestSuite(argc, argv).Run();
 }
diff --git a/third_party/mojo/src/mojo/edk/test/run_all_unittests.cc b/third_party/mojo/src/mojo/edk/test/run_all_unittests.cc
index 34c36ed3..278cfef 100644
--- a/third_party/mojo/src/mojo/edk/test/run_all_unittests.cc
+++ b/third_party/mojo/src/mojo/edk/test/run_all_unittests.cc
@@ -9,7 +9,7 @@
 #include "base/test/test_suite.h"
 #include "mojo/public/tests/test_support_private.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "third_party/mojo/src/mojo/edk/embedder/test_embedder.h"
+#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
 #include "third_party/mojo/src/mojo/edk/test/test_support_impl.h"
 
 int main(int argc, char** argv) {
@@ -30,7 +30,7 @@
 
   base::TestSuite test_suite(argc, argv);
 
-  mojo::embedder::test::InitWithSimplePlatformSupport();
+  mojo::embedder::Init();
   mojo::test::TestSupport::Init(new mojo::test::TestSupportImpl());
 
   return base::LaunchUnitTests(
diff --git a/third_party/mojo/src/mojo/public/c/system/tests/BUILD.gn b/third_party/mojo/src/mojo/public/c/system/tests/BUILD.gn
index 14b15f6..32b915a 100644
--- a/third_party/mojo/src/mojo/public/c/system/tests/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/c/system/tests/BUILD.gn
@@ -39,6 +39,7 @@
 
   mojo_sdk_deps = [
     "mojo/public/c/environment",
+    "mojo/public/cpp/environment:standalone",
     "mojo/public/cpp/system",
     "mojo/public/cpp/test_support:test_utils",
     "mojo/public/cpp/utility",
diff --git a/third_party/mojo/src/mojo/public/cpp/system/tests/BUILD.gn b/third_party/mojo/src/mojo/public/cpp/system/tests/BUILD.gn
index 7a5b7ed88..3b6058c 100644
--- a/third_party/mojo/src/mojo/public/cpp/system/tests/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/cpp/system/tests/BUILD.gn
@@ -18,6 +18,7 @@
 
   mojo_sdk_deps = [
     "mojo/public/c/system/tests",
+    "mojo/public/cpp/environment:standalone",
     "mojo/public/cpp/system",
     "mojo/public/cpp/test_support:test_utils",
   ]
diff --git a/third_party/mojo/src/mojo/public/cpp/utility/tests/BUILD.gn b/third_party/mojo/src/mojo/public/cpp/utility/tests/BUILD.gn
index a8a96c1..acbbc9f 100644
--- a/third_party/mojo/src/mojo/public/cpp/utility/tests/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/cpp/utility/tests/BUILD.gn
@@ -16,6 +16,7 @@
   ]
 
   mojo_sdk_deps = [
+    "mojo/public/cpp/environment:standalone",
     "mojo/public/cpp/system",
     "mojo/public/cpp/test_support:test_utils",
     "mojo/public/cpp/utility",
diff --git a/third_party/mojo/src/mojo/public/platform/native/BUILD.gn b/third_party/mojo/src/mojo/public/platform/native/BUILD.gn
index 68a4b72b..c3b0535 100644
--- a/third_party/mojo/src/mojo/public/platform/native/BUILD.gn
+++ b/third_party/mojo/src/mojo/public/platform/native/BUILD.gn
@@ -24,42 +24,6 @@
   # source_set here, this flag change is not needed.
 }
 
-# For internal use only.
-mojo_sdk_source_set("system_impl_private") {
-  sources = [
-    "system_impl_private_thunks.cc",
-    "system_impl_private_thunks.h",
-  ]
-  defines = [ "MOJO_SYSTEM_IMPLEMENTATION" ]
-  deps = [
-    ":system_impl_private_api",
-  ]
-  mojo_sdk_deps = [ "mojo/public/c/system" ]
-}
-
-# For internal use only.
-mojo_sdk_source_set("system_impl_private_api") {
-  sources = [
-    "system_impl_private.h",
-  ]
-  mojo_sdk_deps = [ "mojo/public/c/system" ]
-}
-
-mojo_sdk_source_set("system_impl_private_tests") {
-  testonly = true
-
-  sources = [
-    "system_impl_private_unittest.cc",
-  ]
-
-  deps = [
-    ":system_impl_private_api",
-    "//testing/gtest",
-  ]
-
-  mojo_sdk_deps = [ "mojo/public/c/system" ]
-}
-
 mojo_sdk_source_set("gles2") {
   sources = [
     "gles2_impl_chromium_extension_thunks.cc",
diff --git a/third_party/mojo/src/mojo/public/platform/native/system_impl_private.h b/third_party/mojo/src/mojo/public/platform/native/system_impl_private.h
deleted file mode 100644
index ffb520d..0000000
--- a/third_party/mojo/src/mojo/public/platform/native/system_impl_private.h
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Note: This header should be compilable as C.
-
-#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_IMPL_PRIVATE_H_
-#define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_IMPL_PRIVATE_H_
-
-#include "mojo/public/c/system/system_export.h"
-#include "mojo/public/c/system/types.h"
-
-// This interface provides the Mojo system API, but with the ability to confine
-// calls to a specific handle namespace. Handles in one namespace are unrelated
-// to handles in another namespace. Two ends of a pipe may live in different
-// handle namespaces, however.
-
-typedef void* MojoSystemImpl;
-
-extern "C" {
-// APIs for creating and manipulating MojoSystemImpls.
-
-// Returns the MojoSystemImpl implicitly used by the non-SystemImpl version of
-// the Mojo sytem APIs.
-MOJO_SYSTEM_EXPORT MojoSystemImpl MojoSystemImplGetDefaultImpl();
-
-// Creates and returns a new MojoSystemImpl. Currently there is no way to
-// destroy a MojoSystemImpl, once created.
-MOJO_SYSTEM_EXPORT MojoSystemImpl MojoSystemImplCreateImpl();
-
-// Moves a handle from one MojoSystemImpl to another.
-// On success, |result_handle| contains the name of the handle in the new
-// namespace.
-// If |MOJO_RESULT_RESOURCE_EXHAUSTED| is returned, the |handle| will have been
-// closed, and is now lost.
-// Busy handles cannot be transfered.
-// To avoid trouble, this API should only be used to bootstrap a newly created
-// |to_system| with a newly created |handle|.
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplTransferHandle(MojoSystemImpl from_system,
-                             MojoHandle handle,
-                             MojoSystemImpl to_system,
-                             MojoHandle* result_handle);
-
-// APIs mirroring the Mojo system APIs, but also taking a MojoSystemImpl param.
-MOJO_SYSTEM_EXPORT MojoTimeTicks
-MojoSystemImplGetTimeTicksNow(MojoSystemImpl system);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplClose(MojoSystemImpl system, MojoHandle handle);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplWait(MojoSystemImpl system,
-                   MojoHandle handle,
-                   MojoHandleSignals signals,
-                   MojoDeadline deadline,
-                   struct MojoHandleSignalsState* signals_state);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplWaitMany(MojoSystemImpl system,
-                       const MojoHandle* handles,
-                       const MojoHandleSignals* signals,
-                       uint32_t num_handles,
-                       MojoDeadline deadline,
-                       uint32_t* result_index,
-                       struct MojoHandleSignalsState* signals_states);
-MOJO_SYSTEM_EXPORT MojoResult MojoSystemImplCreateMessagePipe(
-    MojoSystemImpl system,
-    const struct MojoCreateMessagePipeOptions* options,
-    MojoHandle* message_pipe_handle0,
-    MojoHandle* message_pipe_handle1);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplWriteMessage(MojoSystemImpl system,
-                           MojoHandle message_pipe_handle,
-                           const void* bytes,
-                           uint32_t num_bytes,
-                           const MojoHandle* handles,
-                           uint32_t num_handles,
-                           MojoWriteMessageFlags flags);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplReadMessage(MojoSystemImpl system,
-                          MojoHandle message_pipe_handle,
-                          void* bytes,
-                          uint32_t* num_bytes,
-                          MojoHandle* handles,
-                          uint32_t* num_handles,
-                          MojoReadMessageFlags flags);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplCreateDataPipe(MojoSystemImpl system,
-                             const struct MojoCreateDataPipeOptions* options,
-                             MojoHandle* data_pipe_producer_handle,
-                             MojoHandle* data_pipe_consumer_handle);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplWriteData(MojoSystemImpl system,
-                        MojoHandle data_pipe_producer_handle,
-                        const void* elements,
-                        uint32_t* num_elements,
-                        MojoWriteDataFlags flags);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplBeginWriteData(MojoSystemImpl system,
-                             MojoHandle data_pipe_producer_handle,
-                             void** buffer,
-                             uint32_t* buffer_num_elements,
-                             MojoWriteDataFlags flags);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplEndWriteData(MojoSystemImpl system,
-                           MojoHandle data_pipe_producer_handle,
-                           uint32_t num_elements_written);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplReadData(MojoSystemImpl system,
-                       MojoHandle data_pipe_consumer_handle,
-                       void* elements,
-                       uint32_t* num_elements,
-                       MojoReadDataFlags flags);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplBeginReadData(MojoSystemImpl system,
-                            MojoHandle data_pipe_consumer_handle,
-                            const void** buffer,
-                            uint32_t* buffer_num_elements,
-                            MojoReadDataFlags flags);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplEndReadData(MojoSystemImpl system,
-                          MojoHandle data_pipe_consumer_handle,
-                          uint32_t num_elements_read);
-MOJO_SYSTEM_EXPORT MojoResult MojoSystemImplCreateSharedBuffer(
-    MojoSystemImpl system,
-    const struct MojoCreateSharedBufferOptions* options,
-    uint64_t num_bytes,
-    MojoHandle* shared_buffer_handle);
-MOJO_SYSTEM_EXPORT MojoResult MojoSystemImplDuplicateBufferHandle(
-    MojoSystemImpl system,
-    MojoHandle buffer_handle,
-    const struct MojoDuplicateBufferHandleOptions* options,
-    MojoHandle* new_buffer_handle);
-MOJO_SYSTEM_EXPORT MojoResult MojoSystemImplMapBuffer(MojoSystemImpl system,
-                                                      MojoHandle buffer_handle,
-                                                      uint64_t offset,
-                                                      uint64_t num_bytes,
-                                                      void** buffer,
-                                                      MojoMapBufferFlags flags);
-MOJO_SYSTEM_EXPORT MojoResult
-MojoSystemImplUnmapBuffer(MojoSystemImpl system, void* buffer);
-}  // extern "C"
-
-#endif  // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_IMPL_PRIVATE_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/system_impl_private_thunks.cc b/third_party/mojo/src/mojo/public/platform/native/system_impl_private_thunks.cc
deleted file mode 100644
index 7012e73f..0000000
--- a/third_party/mojo/src/mojo/public/platform/native/system_impl_private_thunks.cc
+++ /dev/null
@@ -1,220 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/public/platform/native/system_impl_private_thunks.h"
-
-#include <assert.h>
-
-#include "mojo/public/platform/native/thunk_export.h"
-
-extern "C" {
-
-static MojoSystemImplControlThunksPrivate g_system_impl_control_thunks = {0};
-static MojoSystemImplThunksPrivate g_system_impl_thunks = {0};
-
-MojoSystemImpl MojoSystemImplGetDefaultImpl() {
-  assert(g_system_impl_control_thunks.GetDefaultSystemImpl);
-  return g_system_impl_control_thunks.GetDefaultSystemImpl();
-}
-
-MojoSystemImpl MojoSystemImplCreateImpl() {
-  assert(g_system_impl_control_thunks.CreateSystemImpl);
-  return g_system_impl_control_thunks.CreateSystemImpl();
-}
-
-MojoResult MojoSystemImplTransferHandle(MojoSystemImpl from_system,
-                                        MojoHandle handle,
-                                        MojoSystemImpl to_system,
-                                        MojoHandle* result_handle) {
-  assert(g_system_impl_control_thunks.TransferHandle);
-  return g_system_impl_control_thunks.TransferHandle(from_system, handle,
-                                                     to_system, result_handle);
-}
-
-MojoTimeTicks MojoSystemImplGetTimeTicksNow(MojoSystemImpl system) {
-  assert(g_system_impl_thunks.GetTimeTicksNow);
-  return g_system_impl_thunks.GetTimeTicksNow(system);
-}
-
-MojoResult MojoSystemImplClose(MojoSystemImpl system, MojoHandle handle) {
-  assert(g_system_impl_thunks.Close);
-  return g_system_impl_thunks.Close(system, handle);
-}
-
-MojoResult MojoSystemImplWait(MojoSystemImpl system,
-                              MojoHandle handle,
-                              MojoHandleSignals signals,
-                              MojoDeadline deadline,
-                              struct MojoHandleSignalsState* signals_state) {
-  assert(g_system_impl_thunks.Wait);
-  return g_system_impl_thunks.Wait(system, handle, signals, deadline,
-                                   signals_state);
-}
-
-MojoResult MojoSystemImplWaitMany(
-    MojoSystemImpl system,
-    const MojoHandle* handles,
-    const MojoHandleSignals* signals,
-    uint32_t num_handles,
-    MojoDeadline deadline,
-    uint32_t* result_index,
-    struct MojoHandleSignalsState* signals_states) {
-  assert(g_system_impl_thunks.WaitMany);
-  return g_system_impl_thunks.WaitMany(system, handles, signals, num_handles,
-                                       deadline, result_index, signals_states);
-}
-
-MojoResult MojoSystemImplCreateMessagePipe(
-    MojoSystemImpl system,
-    const struct MojoCreateMessagePipeOptions* options,
-    MojoHandle* message_pipe_handle0,
-    MojoHandle* message_pipe_handle1) {
-  assert(g_system_impl_thunks.CreateMessagePipe);
-  return g_system_impl_thunks.CreateMessagePipe(
-      system, options, message_pipe_handle0, message_pipe_handle1);
-}
-
-MojoResult MojoSystemImplWriteMessage(MojoSystemImpl system,
-                                      MojoHandle message_pipe_handle,
-                                      const void* bytes,
-                                      uint32_t num_bytes,
-                                      const MojoHandle* handles,
-                                      uint32_t num_handles,
-                                      MojoWriteMessageFlags flags) {
-  assert(g_system_impl_thunks.WriteMessage);
-  return g_system_impl_thunks.WriteMessage(system, message_pipe_handle, bytes,
-                                           num_bytes, handles, num_handles,
-                                           flags);
-}
-
-MojoResult MojoSystemImplReadMessage(MojoSystemImpl system,
-                                     MojoHandle message_pipe_handle,
-                                     void* bytes,
-                                     uint32_t* num_bytes,
-                                     MojoHandle* handles,
-                                     uint32_t* num_handles,
-                                     MojoReadMessageFlags flags) {
-  assert(g_system_impl_thunks.ReadMessage);
-  return g_system_impl_thunks.ReadMessage(system, message_pipe_handle, bytes,
-                                          num_bytes, handles, num_handles,
-                                          flags);
-}
-
-MojoResult MojoSystemImplCreateDataPipe(
-    MojoSystemImpl system,
-    const struct MojoCreateDataPipeOptions* options,
-    MojoHandle* data_pipe_producer_handle,
-    MojoHandle* data_pipe_consumer_handle) {
-  assert(g_system_impl_thunks.CreateDataPipe);
-  return g_system_impl_thunks.CreateDataPipe(
-      system, options, data_pipe_producer_handle, data_pipe_consumer_handle);
-}
-
-MojoResult MojoSystemImplWriteData(MojoSystemImpl system,
-                                   MojoHandle data_pipe_producer_handle,
-                                   const void* elements,
-                                   uint32_t* num_elements,
-                                   MojoWriteDataFlags flags) {
-  assert(g_system_impl_thunks.WriteData);
-  return g_system_impl_thunks.WriteData(system, data_pipe_producer_handle,
-                                        elements, num_elements, flags);
-}
-
-MojoResult MojoSystemImplBeginWriteData(MojoSystemImpl system,
-                                        MojoHandle data_pipe_producer_handle,
-                                        void** buffer,
-                                        uint32_t* buffer_num_elements,
-                                        MojoWriteDataFlags flags) {
-  assert(g_system_impl_thunks.BeginWriteData);
-  return g_system_impl_thunks.BeginWriteData(
-      system, data_pipe_producer_handle, buffer, buffer_num_elements, flags);
-}
-
-MojoResult MojoSystemImplEndWriteData(MojoSystemImpl system,
-                                      MojoHandle data_pipe_producer_handle,
-                                      uint32_t num_elements_written) {
-  assert(g_system_impl_thunks.EndWriteData);
-  return g_system_impl_thunks.EndWriteData(system, data_pipe_producer_handle,
-                                           num_elements_written);
-}
-
-MojoResult MojoSystemImplReadData(MojoSystemImpl system,
-                                  MojoHandle data_pipe_consumer_handle,
-                                  void* elements,
-                                  uint32_t* num_elements,
-                                  MojoReadDataFlags flags) {
-  assert(g_system_impl_thunks.ReadData);
-  return g_system_impl_thunks.ReadData(system, data_pipe_consumer_handle,
-                                       elements, num_elements, flags);
-}
-
-MojoResult MojoSystemImplBeginReadData(MojoSystemImpl system,
-                                       MojoHandle data_pipe_consumer_handle,
-                                       const void** buffer,
-                                       uint32_t* buffer_num_elements,
-                                       MojoReadDataFlags flags) {
-  assert(g_system_impl_thunks.BeginReadData);
-  return g_system_impl_thunks.BeginReadData(system, data_pipe_consumer_handle,
-                                            buffer, buffer_num_elements, flags);
-}
-
-MojoResult MojoSystemImplEndReadData(MojoSystemImpl system,
-                                     MojoHandle data_pipe_consumer_handle,
-                                     uint32_t num_elements_read) {
-  assert(g_system_impl_thunks.EndReadData);
-  return g_system_impl_thunks.EndReadData(system, data_pipe_consumer_handle,
-                                          num_elements_read);
-}
-
-MojoResult MojoSystemImplCreateSharedBuffer(
-    MojoSystemImpl system,
-    const struct MojoCreateSharedBufferOptions* options,
-    uint64_t num_bytes,
-    MojoHandle* shared_buffer_handle) {
-  assert(g_system_impl_thunks.CreateSharedBuffer);
-  return g_system_impl_thunks.CreateSharedBuffer(system, options, num_bytes,
-                                                 shared_buffer_handle);
-}
-
-MojoResult MojoSystemImplDuplicateBufferHandle(
-    MojoSystemImpl system,
-    MojoHandle buffer_handle,
-    const struct MojoDuplicateBufferHandleOptions* options,
-    MojoHandle* new_buffer_handle) {
-  assert(g_system_impl_thunks.DuplicateBufferHandle);
-  return g_system_impl_thunks.DuplicateBufferHandle(system, buffer_handle,
-                                                    options, new_buffer_handle);
-}
-
-MojoResult MojoSystemImplMapBuffer(MojoSystemImpl system,
-                                   MojoHandle buffer_handle,
-                                   uint64_t offset,
-                                   uint64_t num_bytes,
-                                   void** buffer,
-                                   MojoMapBufferFlags flags) {
-  assert(g_system_impl_thunks.MapBuffer);
-  return g_system_impl_thunks.MapBuffer(system, buffer_handle, offset,
-                                        num_bytes, buffer, flags);
-}
-
-MojoResult MojoSystemImplUnmapBuffer(MojoSystemImpl system, void* buffer) {
-  assert(g_system_impl_thunks.UnmapBuffer);
-  return g_system_impl_thunks.UnmapBuffer(system, buffer);
-}
-
-extern "C" THUNK_EXPORT size_t MojoSetSystemImplControlThunksPrivate(
-    const MojoSystemImplControlThunksPrivate* system_thunks) {
-  if (system_thunks->size >= sizeof(g_system_impl_control_thunks))
-    g_system_impl_control_thunks = *system_thunks;
-  return sizeof(g_system_impl_control_thunks);
-}
-
-extern "C" THUNK_EXPORT size_t MojoSetSystemImplThunksPrivate(
-    const MojoSystemImplThunksPrivate* system_thunks) {
-  if (system_thunks->size >= sizeof(g_system_impl_thunks))
-    g_system_impl_thunks = *system_thunks;
-  return sizeof(g_system_impl_thunks);
-}
-
-}  // extern "C"
diff --git a/third_party/mojo/src/mojo/public/platform/native/system_impl_private_thunks.h b/third_party/mojo/src/mojo/public/platform/native/system_impl_private_thunks.h
deleted file mode 100644
index c45167d3..0000000
--- a/third_party/mojo/src/mojo/public/platform/native/system_impl_private_thunks.h
+++ /dev/null
@@ -1,150 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Note: This header should be compilable as C.
-
-#ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_IMPL_PRIVATE_THUNKS_H_
-#define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_IMPL_PRIVATE_THUNKS_H_
-
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/platform/native/system_impl_private.h"
-
-// Structure used to bind the basic Mojo Core functions of a DSO to those of
-// the embedder.
-// This is the ABI between the embedder and the DSO. It can only have new
-// functions added to the end. No other changes are supported.
-#pragma pack(push, 8)
-struct MojoSystemImplControlThunksPrivate {
-  size_t size;  // Should be set to sizeof(MojoSystemImplThunks).
-  MojoSystemImpl (*GetDefaultSystemImpl)();
-  MojoSystemImpl (*CreateSystemImpl)();
-  MojoResult (*TransferHandle)(MojoSystemImpl from_system,
-                               MojoHandle handle,
-                               MojoSystemImpl to_system,
-                               MojoHandle* result_handle);
-};
-
-struct MojoSystemImplThunksPrivate {
-  size_t size;  // Should be set to sizeof(MojoExplicitThunksPrivate).
-  MojoTimeTicks (*GetTimeTicksNow)(MojoSystemImpl system);
-  MojoResult (*Close)(MojoSystemImpl system, MojoHandle handle);
-  MojoResult (*Wait)(MojoSystemImpl system,
-                     MojoHandle handle,
-                     MojoHandleSignals signals,
-                     MojoDeadline deadline,
-                     struct MojoHandleSignalsState* signals_state);
-  MojoResult (*WaitMany)(MojoSystemImpl system,
-                         const MojoHandle* handles,
-                         const MojoHandleSignals* signals,
-                         uint32_t num_handles,
-                         MojoDeadline deadline,
-                         uint32_t* result_index,
-                         struct MojoHandleSignalsState* signals_states);
-  MojoResult (*CreateMessagePipe)(
-      MojoSystemImpl system,
-      const struct MojoCreateMessagePipeOptions* options,
-      MojoHandle* message_pipe_handle0,
-      MojoHandle* message_pipe_handle1);
-  MojoResult (*WriteMessage)(MojoSystemImpl system,
-                             MojoHandle message_pipe_handle,
-                             const void* bytes,
-                             uint32_t num_bytes,
-                             const MojoHandle* handles,
-                             uint32_t num_handles,
-                             MojoWriteMessageFlags flags);
-  MojoResult (*ReadMessage)(MojoSystemImpl system,
-                            MojoHandle message_pipe_handle,
-                            void* bytes,
-                            uint32_t* num_bytes,
-                            MojoHandle* handles,
-                            uint32_t* num_handles,
-                            MojoReadMessageFlags flags);
-  MojoResult (*CreateDataPipe)(MojoSystemImpl system,
-                               const struct MojoCreateDataPipeOptions* options,
-                               MojoHandle* data_pipe_producer_handle,
-                               MojoHandle* data_pipe_consumer_handle);
-  MojoResult (*WriteData)(MojoSystemImpl system,
-                          MojoHandle data_pipe_producer_handle,
-                          const void* elements,
-                          uint32_t* num_elements,
-                          MojoWriteDataFlags flags);
-  MojoResult (*BeginWriteData)(MojoSystemImpl system,
-                               MojoHandle data_pipe_producer_handle,
-                               void** buffer,
-                               uint32_t* buffer_num_elements,
-                               MojoWriteDataFlags flags);
-  MojoResult (*EndWriteData)(MojoSystemImpl system,
-                             MojoHandle data_pipe_producer_handle,
-                             uint32_t num_elements_written);
-  MojoResult (*ReadData)(MojoSystemImpl system,
-                         MojoHandle data_pipe_consumer_handle,
-                         void* elements,
-                         uint32_t* num_elements,
-                         MojoReadDataFlags flags);
-  MojoResult (*BeginReadData)(MojoSystemImpl system,
-                              MojoHandle data_pipe_consumer_handle,
-                              const void** buffer,
-                              uint32_t* buffer_num_elements,
-                              MojoReadDataFlags flags);
-  MojoResult (*EndReadData)(MojoSystemImpl system,
-                            MojoHandle data_pipe_consumer_handle,
-                            uint32_t num_elements_read);
-  MojoResult (*CreateSharedBuffer)(
-      MojoSystemImpl system,
-      const struct MojoCreateSharedBufferOptions* options,
-      uint64_t num_bytes,
-      MojoHandle* shared_buffer_handle);
-  MojoResult (*DuplicateBufferHandle)(
-      MojoSystemImpl system,
-      MojoHandle buffer_handle,
-      const struct MojoDuplicateBufferHandleOptions* options,
-      MojoHandle* new_buffer_handle);
-  MojoResult (*MapBuffer)(MojoSystemImpl system,
-                          MojoHandle buffer_handle,
-                          uint64_t offset,
-                          uint64_t num_bytes,
-                          void** buffer,
-                          MojoMapBufferFlags flags);
-  MojoResult (*UnmapBuffer)(MojoSystemImpl system, void* buffer);
-};
-#pragma pack(pop)
-
-#ifdef __cplusplus
-inline MojoSystemImplControlThunksPrivate
-MojoMakeSystemImplControlThunksPrivate() {
-  MojoSystemImplControlThunksPrivate system_thunks = {
-      sizeof(MojoSystemImplControlThunksPrivate),
-      MojoSystemImplGetDefaultImpl,
-      MojoSystemImplCreateImpl,
-      MojoSystemImplTransferHandle};
-  return system_thunks;
-}
-
-inline MojoSystemImplThunksPrivate MojoMakeSystemImplThunksPrivate() {
-  MojoSystemImplThunksPrivate system_thunks = {
-      sizeof(MojoSystemImplThunksPrivate),
-      MojoSystemImplGetTimeTicksNow,
-      MojoSystemImplClose,
-      MojoSystemImplWait,
-      MojoSystemImplWaitMany,
-      MojoSystemImplCreateMessagePipe,
-      MojoSystemImplWriteMessage,
-      MojoSystemImplReadMessage,
-      MojoSystemImplCreateDataPipe,
-      MojoSystemImplWriteData,
-      MojoSystemImplBeginWriteData,
-      MojoSystemImplEndWriteData,
-      MojoSystemImplReadData,
-      MojoSystemImplBeginReadData,
-      MojoSystemImplEndReadData,
-      MojoSystemImplCreateSharedBuffer,
-      MojoSystemImplDuplicateBufferHandle,
-      MojoSystemImplMapBuffer,
-      MojoSystemImplUnmapBuffer};
-  return system_thunks;
-}
-
-#endif
-
-#endif  // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_IMPL_PRIVATE_THUNKS_H_
diff --git a/third_party/mojo/src/mojo/public/platform/native/system_impl_private_unittest.cc b/third_party/mojo/src/mojo/public/platform/native/system_impl_private_unittest.cc
deleted file mode 100644
index 4d0e1bac..0000000
--- a/third_party/mojo/src/mojo/public/platform/native/system_impl_private_unittest.cc
+++ /dev/null
@@ -1,323 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file tests the C API, but using the explicit MojoSystemImpl parameter.
-
-#include <string.h>
-
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/platform/native/system_impl_private.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace mojo {
-namespace {
-
-const MojoHandleSignals kSignalReadadableWritable =
-    MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_WRITABLE;
-
-const MojoHandleSignals kSignalAll = MOJO_HANDLE_SIGNAL_READABLE |
-                                     MOJO_HANDLE_SIGNAL_WRITABLE |
-                                     MOJO_HANDLE_SIGNAL_PEER_CLOSED;
-
-TEST(SystemImplTest, GetTimeTicksNow) {
-  MojoSystemImpl system = MojoSystemImplCreateImpl();
-  const MojoTimeTicks start = MojoSystemImplGetTimeTicksNow(system);
-  EXPECT_NE(static_cast<MojoTimeTicks>(0), start)
-      << "MojoGetTimeTicksNow should return nonzero value";
-
-  // SystemImpl is leaked...
-}
-
-TEST(SystemImplTest, BasicMessagePipe) {
-  MojoSystemImpl sys0 = MojoSystemImplCreateImpl();
-  MojoSystemImpl sys1 = MojoSystemImplCreateImpl();
-  EXPECT_NE(sys0, sys1);
-
-  MojoHandle h0, h1;
-  MojoHandleSignals sig;
-  char buffer[10] = {0};
-  uint32_t buffer_size;
-
-  h0 = MOJO_HANDLE_INVALID;
-  h1 = MOJO_HANDLE_INVALID;
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplCreateMessagePipe(sys0, nullptr, &h0, &h1));
-  EXPECT_NE(h0, MOJO_HANDLE_INVALID);
-  EXPECT_NE(h1, MOJO_HANDLE_INVALID);
-
-  // Move the other end of the pipe to a different SystemImpl.
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplTransferHandle(sys0, h1, sys1, &h1));
-  EXPECT_NE(h1, MOJO_HANDLE_INVALID);
-
-  // Shouldn't be readable, we haven't written anything.
-  MojoHandleSignalsState state;
-  EXPECT_EQ(
-      MOJO_RESULT_DEADLINE_EXCEEDED,
-      MojoSystemImplWait(sys0, h0, MOJO_HANDLE_SIGNAL_READABLE, 0, &state));
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, state.satisfied_signals);
-  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
-
-  // Should be writable.
-  EXPECT_EQ(
-      MOJO_RESULT_OK,
-      MojoSystemImplWait(sys0, h0, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &state));
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, state.satisfied_signals);
-  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
-
-  // Last parameter is optional.
-  EXPECT_EQ(
-      MOJO_RESULT_OK,
-      MojoSystemImplWait(sys0, h0, MOJO_HANDLE_SIGNAL_WRITABLE, 0, nullptr));
-
-  // Try to read.
-  buffer_size = static_cast<uint32_t>(sizeof(buffer));
-  EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
-            MojoSystemImplReadMessage(sys0, h0, buffer, &buffer_size, nullptr,
-                                      nullptr, MOJO_READ_MESSAGE_FLAG_NONE));
-
-  // Write to |h1|.
-  static const char kHello[] = "hello";
-  buffer_size = static_cast<uint32_t>(sizeof(kHello));
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplWriteMessage(sys1, h1, kHello, buffer_size, nullptr,
-                                       0, MOJO_WRITE_MESSAGE_FLAG_NONE));
-
-  // |h0| should be readable.
-  uint32_t result_index = 1;
-  MojoHandleSignalsState states[1];
-  sig = MOJO_HANDLE_SIGNAL_READABLE;
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplWaitMany(sys0, &h0, &sig, 1, MOJO_DEADLINE_INDEFINITE,
-                                   &result_index, states));
-
-  EXPECT_EQ(0u, result_index);
-  EXPECT_EQ(kSignalReadadableWritable, states[0].satisfied_signals);
-  EXPECT_EQ(kSignalAll, states[0].satisfiable_signals);
-
-  // Read from |h0|.
-  buffer_size = static_cast<uint32_t>(sizeof(buffer));
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplReadMessage(sys0, h0, buffer, &buffer_size, nullptr,
-                                      nullptr, MOJO_READ_MESSAGE_FLAG_NONE));
-  EXPECT_EQ(static_cast<uint32_t>(sizeof(kHello)), buffer_size);
-  EXPECT_STREQ(kHello, buffer);
-
-  // |h0| should no longer be readable.
-  EXPECT_EQ(
-      MOJO_RESULT_DEADLINE_EXCEEDED,
-      MojoSystemImplWait(sys0, h0, MOJO_HANDLE_SIGNAL_READABLE, 10, &state));
-
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, state.satisfied_signals);
-  EXPECT_EQ(kSignalAll, state.satisfiable_signals);
-
-  // Close |h0|.
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplClose(sys0, h0));
-
-  // |h1| should no longer be readable or writable.
-  EXPECT_EQ(MOJO_RESULT_FAILED_PRECONDITION,
-            MojoSystemImplWait(sys1, h1, MOJO_HANDLE_SIGNAL_READABLE |
-                                             MOJO_HANDLE_SIGNAL_WRITABLE,
-                               1000, &state));
-
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfied_signals);
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfiable_signals);
-
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplClose(sys1, h1));
-
-  // 2 SystemImpls are leaked...
-}
-
-TEST(SystemImplTest, BasicDataPipe) {
-  MojoSystemImpl sys0 = MojoSystemImplCreateImpl();
-  MojoSystemImpl sys1 = MojoSystemImplCreateImpl();
-  EXPECT_NE(sys0, sys1);
-
-  MojoHandle hp, hc;
-  MojoHandleSignals sig;
-  char buffer[20] = {0};
-  uint32_t buffer_size;
-  void* write_pointer;
-  const void* read_pointer;
-
-  hp = MOJO_HANDLE_INVALID;
-  hc = MOJO_HANDLE_INVALID;
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplCreateDataPipe(sys0, nullptr, &hp, &hc));
-  EXPECT_NE(hp, MOJO_HANDLE_INVALID);
-  EXPECT_NE(hc, MOJO_HANDLE_INVALID);
-
-  // Move the other end of the pipe to a different SystemImpl.
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplTransferHandle(sys0, hc, sys1, &hc));
-  EXPECT_NE(hc, MOJO_HANDLE_INVALID);
-
-  // The consumer |hc| shouldn't be readable.
-  MojoHandleSignalsState state;
-  EXPECT_EQ(
-      MOJO_RESULT_DEADLINE_EXCEEDED,
-      MojoSystemImplWait(sys1, hc, MOJO_HANDLE_SIGNAL_READABLE, 0, &state));
-
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_NONE, state.satisfied_signals);
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
-            state.satisfiable_signals);
-
-  // The producer |hp| should be writable.
-  EXPECT_EQ(
-      MOJO_RESULT_OK,
-      MojoSystemImplWait(sys0, hp, MOJO_HANDLE_SIGNAL_WRITABLE, 0, &state));
-
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE, state.satisfied_signals);
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_WRITABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
-            state.satisfiable_signals);
-
-  // Try to read from |hc|.
-  buffer_size = static_cast<uint32_t>(sizeof(buffer));
-  EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
-            MojoSystemImplReadData(sys1, hc, buffer, &buffer_size,
-                                   MOJO_READ_DATA_FLAG_NONE));
-
-  // Try to begin a two-phase read from |hc|.
-  read_pointer = nullptr;
-  EXPECT_EQ(MOJO_RESULT_SHOULD_WAIT,
-            MojoSystemImplBeginReadData(sys1, hc, &read_pointer, &buffer_size,
-                                        MOJO_READ_DATA_FLAG_NONE));
-
-  // Write to |hp|.
-  static const char kHello[] = "hello ";
-  // Don't include terminating null.
-  buffer_size = static_cast<uint32_t>(strlen(kHello));
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplWriteData(sys0, hp, kHello, &buffer_size,
-                                    MOJO_WRITE_MESSAGE_FLAG_NONE));
-
-  // |hc| should be(come) readable.
-  uint32_t result_index = 1;
-  MojoHandleSignalsState states[1];
-  sig = MOJO_HANDLE_SIGNAL_READABLE;
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplWaitMany(sys1, &hc, &sig, 1, MOJO_DEADLINE_INDEFINITE,
-                                   &result_index, states));
-
-  EXPECT_EQ(0u, result_index);
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE, states[0].satisfied_signals);
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
-            states[0].satisfiable_signals);
-
-  // Do a two-phase write to |hp|.
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplBeginWriteData(sys0, hp, &write_pointer, &buffer_size,
-                                         MOJO_WRITE_DATA_FLAG_NONE));
-  static const char kWorld[] = "world";
-  ASSERT_GE(buffer_size, sizeof(kWorld));
-  // Include the terminating null.
-  memcpy(write_pointer, kWorld, sizeof(kWorld));
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplEndWriteData(sys0, hp,
-                                       static_cast<uint32_t>(sizeof(kWorld))));
-
-  // Read one character from |hc|.
-  memset(buffer, 0, sizeof(buffer));
-  buffer_size = 1;
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplReadData(sys1, hc, buffer, &buffer_size,
-                                   MOJO_READ_DATA_FLAG_NONE));
-
-  // Close |hp|.
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplClose(sys0, hp));
-
-  // |hc| should still be readable.
-  EXPECT_EQ(
-      MOJO_RESULT_OK,
-      MojoSystemImplWait(sys1, hc, MOJO_HANDLE_SIGNAL_READABLE, 0, &state));
-
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
-            state.satisfied_signals);
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
-            state.satisfiable_signals);
-
-  // Do a two-phase read from |hc|.
-  read_pointer = nullptr;
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplBeginReadData(sys1, hc, &read_pointer, &buffer_size,
-                                        MOJO_READ_DATA_FLAG_NONE));
-  ASSERT_LE(buffer_size, sizeof(buffer) - 1);
-  memcpy(&buffer[1], read_pointer, buffer_size);
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplEndReadData(sys1, hc, buffer_size));
-  EXPECT_STREQ("hello world", buffer);
-
-  // |hc| should no longer be readable.
-  EXPECT_EQ(
-      MOJO_RESULT_FAILED_PRECONDITION,
-      MojoSystemImplWait(sys1, hc, MOJO_HANDLE_SIGNAL_READABLE, 1000, &state));
-
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfied_signals);
-  EXPECT_EQ(MOJO_HANDLE_SIGNAL_PEER_CLOSED, state.satisfiable_signals);
-
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplClose(sys1, hc));
-
-  // TODO(vtl): Test the other way around -- closing the consumer should make
-  // the producer never-writable?
-
-  // 2 SystemImpls are leaked...
-}
-
-TEST(SystemImplTest, BasicSharedBuffer) {
-  MojoSystemImpl sys0 = MojoSystemImplCreateImpl();
-  MojoSystemImpl sys1 = MojoSystemImplCreateImpl();
-  EXPECT_NE(sys0, sys1);
-
-  MojoHandle h0, h1;
-  void* pointer;
-
-  // Create a shared buffer (|h0|).
-  h0 = MOJO_HANDLE_INVALID;
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplCreateSharedBuffer(sys0, nullptr, 100, &h0));
-  EXPECT_NE(h0, MOJO_HANDLE_INVALID);
-
-  // Map everything.
-  pointer = nullptr;
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplMapBuffer(sys0, h0, 0, 100, &pointer,
-                                                    MOJO_MAP_BUFFER_FLAG_NONE));
-  ASSERT_TRUE(pointer);
-  static_cast<char*>(pointer)[50] = 'x';
-
-  // Duplicate |h0| to |h1|.
-  h1 = MOJO_HANDLE_INVALID;
-  EXPECT_EQ(MOJO_RESULT_OK,
-            MojoSystemImplDuplicateBufferHandle(sys0, h0, nullptr, &h1));
-  EXPECT_NE(h1, MOJO_HANDLE_INVALID);
-
-  // Move the other end of the pipe to a different SystemImpl.
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplTransferHandle(sys0, h1, sys1, &h1));
-  EXPECT_NE(h1, MOJO_HANDLE_INVALID);
-
-  // Close |h0|.
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplClose(sys0, h0));
-
-  // The mapping should still be good.
-  static_cast<char*>(pointer)[51] = 'y';
-
-  // Unmap it.
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplUnmapBuffer(sys0, pointer));
-
-  // Map half of |h1|.
-  pointer = nullptr;
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplMapBuffer(sys1, h1, 50, 50, &pointer,
-                                                    MOJO_MAP_BUFFER_FLAG_NONE));
-  ASSERT_TRUE(pointer);
-
-  // It should have what we wrote.
-  EXPECT_EQ('x', static_cast<char*>(pointer)[0]);
-  EXPECT_EQ('y', static_cast<char*>(pointer)[1]);
-
-  // Unmap it.
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplUnmapBuffer(sys1, pointer));
-
-  EXPECT_EQ(MOJO_RESULT_OK, MojoSystemImplClose(sys1, h1));
-
-  // 2 SystemImpls are leaked...
-}
-
-}  // namespace
-}  // namespace mojo
diff --git a/third_party/mojo/src/nacl_bindings/BUILD.gn b/third_party/mojo/src/nacl_bindings/BUILD.gn
deleted file mode 100644
index b8a1f99..0000000
--- a/third_party/mojo/src/nacl_bindings/BUILD.gn
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2015 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# Trusted code
-if (!is_nacl) {
-  # A library for launching a NaCl sandbox connected to a Mojo embedder.
-  source_set("monacl_sel") {
-    sources = [
-      "mojo_syscall.cc",
-      "mojo_syscall_internal.h",
-      "monacl_sel_main.cc",
-    ]
-    deps = [
-      "../mojo/public/c/system",
-
-      # This target makes sure we have all the pre-processor defines needed to
-      # use NaCl's headers.
-      "//build/config/nacl:nacl_base",
-      "//native_client/src/trusted/desc:nrd_xfer",
-      "//native_client/src/trusted/service_runtime:sel_main_chrome",
-    ]
-  }
-}
-
-# Untrusted code
-if (is_nacl) {
-  executable("irt_mojo") {
-    cflags_c = [ "-std=c99" ]
-    sources = [
-      "../mojo/public/platform/nacl/mojo_irt.h",
-      "irt_entry_mojo.c",
-      "mojo_irt.c",
-    ]
-    deps = [
-      "../mojo/public/c/system",
-      "//build/config/nacl:nacl_base",
-      "//native_client/src/untrusted/irt:irt_core_lib",
-      "//native_client/src/untrusted/nacl:imc_syscalls",
-    ]
-  }
-}
diff --git a/third_party/mojo/src/nacl_bindings/DEPS b/third_party/mojo/src/nacl_bindings/DEPS
deleted file mode 100644
index 38e6229..0000000
--- a/third_party/mojo/src/nacl_bindings/DEPS
+++ /dev/null
@@ -1,8 +0,0 @@
-include_rules = [
-  # This code is checked into the chromium repo so it's fine to depend on this.
-  "+native_client",
-
-  # internal includes.
-  "+mojo",
-  "+nacl_bindings",
-]
diff --git a/third_party/mojo/src/nacl_bindings/irt_entry_mojo.c b/third_party/mojo/src/nacl_bindings/irt_entry_mojo.c
deleted file mode 100644
index 5c413dd..0000000
--- a/third_party/mojo/src/nacl_bindings/irt_entry_mojo.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "mojo/public/platform/nacl/mojo_irt.h"
-#include "native_client/src/public/irt_core.h"
-
-static size_t irt_query(const char* interface_ident,
-                        void* table, size_t tablesize) {
-  // TODO(teravest): Add query for the Mojo IRT interface, when introduced.
-  size_t rc = mojo_irt_query(interface_ident, table, tablesize);
-  if (rc != 0)
-    return rc;
-
-  return nacl_irt_query_core(interface_ident, table, tablesize);
-}
-
-void nacl_irt_start(uint32_t* info) {
-  nacl_irt_init(info);
-  nacl_irt_enter_user_code(info, irt_query);
-}
diff --git a/third_party/mojo/src/nacl_bindings/mojo_irt.c b/third_party/mojo/src/nacl_bindings/mojo_irt.c
deleted file mode 100644
index 3595f0b..0000000
--- a/third_party/mojo/src/nacl_bindings/mojo_irt.c
+++ /dev/null
@@ -1,357 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// WARNING this file was generated by generate_nacl_bindings.py
-// Do not edit by hand.
-
-#include <stdio.h>
-#include <string.h>
-
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/platform/nacl/mojo_irt.h"
-#include "native_client/src/public/chrome_main.h"
-#include "native_client/src/public/imc_syscalls.h"
-#include "native_client/src/public/imc_types.h"
-#include "native_client/src/public/irt_core.h"
-
-#define NACL_MOJO_DESC (NACL_CHROME_DESC_BASE + 3)
-
-static void DoMojoCall(uint32_t params[], nacl_abi_size_t num_params) {
-  struct NaClAbiNaClImcMsgIoVec iov[1] = {
-    {params, num_params}
-  };
-  struct NaClAbiNaClImcMsgHdr msgh = {iov, 1, NULL, 0};
-  // Note: return value unchecked.  We're relying on the result parameter being
-  // unmodified - if the syscall fails, the Mojo function will return whatever
-  // the result parameter was initialized to before this function was called.
-  imc_sendmsg(NACL_MOJO_DESC, &msgh, 0);
-}
-
-static MojoResult irt_MojoCreateSharedBuffer(
-    const struct MojoCreateSharedBufferOptions* options,
-    uint64_t num_bytes,
-    MojoHandle* shared_buffer_handle) {
-  uint32_t params[5];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 0;
-  params[1] = (uint32_t)(options);
-  params[2] = (uint32_t)(&num_bytes);
-  params[3] = (uint32_t)(shared_buffer_handle);
-  params[4] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoDuplicateBufferHandle(
-    MojoHandle buffer_handle,
-    const struct MojoDuplicateBufferHandleOptions* options,
-    MojoHandle* new_buffer_handle) {
-  uint32_t params[5];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 1;
-  params[1] = (uint32_t)(&buffer_handle);
-  params[2] = (uint32_t)(options);
-  params[3] = (uint32_t)(new_buffer_handle);
-  params[4] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoMapBuffer(
-    MojoHandle buffer_handle,
-    uint64_t offset,
-    uint64_t num_bytes,
-    void** buffer,
-    MojoMapBufferFlags flags) {
-  uint32_t params[7];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 2;
-  params[1] = (uint32_t)(&buffer_handle);
-  params[2] = (uint32_t)(&offset);
-  params[3] = (uint32_t)(&num_bytes);
-  params[4] = (uint32_t)(buffer);
-  params[5] = (uint32_t)(&flags);
-  params[6] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoUnmapBuffer(void* buffer) {
-  uint32_t params[3];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 3;
-  params[1] = (uint32_t)(&buffer);
-  params[2] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoCreateDataPipe(
-    const struct MojoCreateDataPipeOptions* options,
-    MojoHandle* data_pipe_producer_handle,
-    MojoHandle* data_pipe_consumer_handle) {
-  uint32_t params[5];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 4;
-  params[1] = (uint32_t)(options);
-  params[2] = (uint32_t)(data_pipe_producer_handle);
-  params[3] = (uint32_t)(data_pipe_consumer_handle);
-  params[4] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoWriteData(
-    MojoHandle data_pipe_producer_handle,
-    const void* elements,
-    uint32_t* num_bytes,
-    MojoWriteDataFlags flags) {
-  uint32_t params[6];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 5;
-  params[1] = (uint32_t)(&data_pipe_producer_handle);
-  params[2] = (uint32_t)(elements);
-  params[3] = (uint32_t)(num_bytes);
-  params[4] = (uint32_t)(&flags);
-  params[5] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoBeginWriteData(
-    MojoHandle data_pipe_producer_handle,
-    void** buffer,
-    uint32_t* buffer_num_bytes,
-    MojoWriteDataFlags flags) {
-  uint32_t params[6];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 6;
-  params[1] = (uint32_t)(&data_pipe_producer_handle);
-  params[2] = (uint32_t)(buffer);
-  params[3] = (uint32_t)(buffer_num_bytes);
-  params[4] = (uint32_t)(&flags);
-  params[5] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoEndWriteData(
-    MojoHandle data_pipe_producer_handle,
-    uint32_t num_bytes_written) {
-  uint32_t params[4];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 7;
-  params[1] = (uint32_t)(&data_pipe_producer_handle);
-  params[2] = (uint32_t)(&num_bytes_written);
-  params[3] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoReadData(
-    MojoHandle data_pipe_consumer_handle,
-    void* elements,
-    uint32_t* num_bytes,
-    MojoReadDataFlags flags) {
-  uint32_t params[6];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 8;
-  params[1] = (uint32_t)(&data_pipe_consumer_handle);
-  params[2] = (uint32_t)(elements);
-  params[3] = (uint32_t)(num_bytes);
-  params[4] = (uint32_t)(&flags);
-  params[5] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoBeginReadData(
-    MojoHandle data_pipe_consumer_handle,
-    const void** buffer,
-    uint32_t* buffer_num_bytes,
-    MojoReadDataFlags flags) {
-  uint32_t params[6];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 9;
-  params[1] = (uint32_t)(&data_pipe_consumer_handle);
-  params[2] = (uint32_t)(buffer);
-  params[3] = (uint32_t)(buffer_num_bytes);
-  params[4] = (uint32_t)(&flags);
-  params[5] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoEndReadData(
-    MojoHandle data_pipe_consumer_handle,
-    uint32_t num_bytes_read) {
-  uint32_t params[4];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 10;
-  params[1] = (uint32_t)(&data_pipe_consumer_handle);
-  params[2] = (uint32_t)(&num_bytes_read);
-  params[3] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoTimeTicks irt_MojoGetTimeTicksNow() {
-  uint32_t params[2];
-  MojoTimeTicks result = 0;
-  params[0] = 11;
-  params[1] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoClose(MojoHandle handle) {
-  uint32_t params[3];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 12;
-  params[1] = (uint32_t)(&handle);
-  params[2] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoWait(
-    MojoHandle handle,
-    MojoHandleSignals signals,
-    MojoDeadline deadline,
-    struct MojoHandleSignalsState* signals_state) {
-  uint32_t params[6];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 13;
-  params[1] = (uint32_t)(&handle);
-  params[2] = (uint32_t)(&signals);
-  params[3] = (uint32_t)(&deadline);
-  params[4] = (uint32_t)(signals_state);
-  params[5] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoWaitMany(
-    const MojoHandle* handles,
-    const MojoHandleSignals* signals,
-    uint32_t num_handles,
-    MojoDeadline deadline,
-    uint32_t* result_index,
-    struct MojoHandleSignalsState* signals_states) {
-  uint32_t params[8];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 14;
-  params[1] = (uint32_t)(handles);
-  params[2] = (uint32_t)(signals);
-  params[3] = (uint32_t)(&num_handles);
-  params[4] = (uint32_t)(&deadline);
-  params[5] = (uint32_t)(result_index);
-  params[6] = (uint32_t)(signals_states);
-  params[7] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoCreateMessagePipe(
-    const struct MojoCreateMessagePipeOptions* options,
-    MojoHandle* message_pipe_handle0,
-    MojoHandle* message_pipe_handle1) {
-  uint32_t params[5];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 15;
-  params[1] = (uint32_t)(options);
-  params[2] = (uint32_t)(message_pipe_handle0);
-  params[3] = (uint32_t)(message_pipe_handle1);
-  params[4] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoWriteMessage(
-    MojoHandle message_pipe_handle,
-    const void* bytes,
-    uint32_t num_bytes,
-    const MojoHandle* handles,
-    uint32_t num_handles,
-    MojoWriteMessageFlags flags) {
-  uint32_t params[8];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 16;
-  params[1] = (uint32_t)(&message_pipe_handle);
-  params[2] = (uint32_t)(bytes);
-  params[3] = (uint32_t)(&num_bytes);
-  params[4] = (uint32_t)(handles);
-  params[5] = (uint32_t)(&num_handles);
-  params[6] = (uint32_t)(&flags);
-  params[7] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt_MojoReadMessage(
-    MojoHandle message_pipe_handle,
-    void* bytes,
-    uint32_t* num_bytes,
-    MojoHandle* handles,
-    uint32_t* num_handles,
-    MojoReadMessageFlags flags) {
-  uint32_t params[8];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 17;
-  params[1] = (uint32_t)(&message_pipe_handle);
-  params[2] = (uint32_t)(bytes);
-  params[3] = (uint32_t)(num_bytes);
-  params[4] = (uint32_t)(handles);
-  params[5] = (uint32_t)(num_handles);
-  params[6] = (uint32_t)(&flags);
-  params[7] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-static MojoResult irt__MojoGetInitialHandle(MojoHandle* handle) {
-  uint32_t params[3];
-  MojoResult result = MOJO_RESULT_INVALID_ARGUMENT;
-  params[0] = 18;
-  params[1] = (uint32_t)(handle);
-  params[2] = (uint32_t)(&result);
-  DoMojoCall(params, sizeof(params));
-  return result;
-};
-
-struct nacl_irt_mojo kIrtMojo = {
-  &irt_MojoCreateSharedBuffer,
-  &irt_MojoDuplicateBufferHandle,
-  &irt_MojoMapBuffer,
-  &irt_MojoUnmapBuffer,
-  &irt_MojoCreateDataPipe,
-  &irt_MojoWriteData,
-  &irt_MojoBeginWriteData,
-  &irt_MojoEndWriteData,
-  &irt_MojoReadData,
-  &irt_MojoBeginReadData,
-  &irt_MojoEndReadData,
-  &irt_MojoGetTimeTicksNow,
-  &irt_MojoClose,
-  &irt_MojoWait,
-  &irt_MojoWaitMany,
-  &irt_MojoCreateMessagePipe,
-  &irt_MojoWriteMessage,
-  &irt_MojoReadMessage,
-  &irt__MojoGetInitialHandle,
-};
-
-
-size_t mojo_irt_query(const char* interface_ident,
-                      void* table,
-                      size_t tablesize) {
-  static const size_t size = sizeof(kIrtMojo);
-  if (0 == strcmp(interface_ident, NACL_IRT_MOJO_v0_1)) {
-    if (size <= tablesize) {
-      memcpy(table, &kIrtMojo, size);
-      return size;
-    }
-  }
-  return 0;
-}
diff --git a/third_party/mojo/src/nacl_bindings/mojo_syscall.cc b/third_party/mojo/src/nacl_bindings/mojo_syscall.cc
deleted file mode 100644
index 13397539..0000000
--- a/third_party/mojo/src/nacl_bindings/mojo_syscall.cc
+++ /dev/null
@@ -1,730 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// WARNING this file was generated by generate_nacl_bindings.py
-// Do not edit by hand.
-
-#include "nacl_bindings/mojo_syscall.h"
-
-#include <stdio.h>
-
-#include "mojo/public/c/system/core.h"
-#include "mojo/public/platform/native/system_impl_private.h"
-#include "nacl_bindings/mojo_syscall_internal.h"
-#include "native_client/src/public/chrome_main.h"
-#include "native_client/src/public/nacl_app.h"
-#include "native_client/src/trusted/desc/nacl_desc_custom.h"
-
-MojoHandle g_mojo_handle = MOJO_HANDLE_INVALID;
-MojoSystemImpl g_mojo_system = nullptr;
-
-namespace {
-
-MojoResult _MojoGetInitialHandle(MojoHandle* handle) {
-  *handle = g_mojo_handle;
-  return MOJO_RESULT_OK;
-}
-
-void MojoDescDestroy(void* handle) {
-}
-
-ssize_t MojoDescSendMsg(void* handle,
-                        const struct NaClImcTypedMsgHdr* msg,
-                        int flags) {
-  struct NaClApp* nap = static_cast<struct NaClApp*>(handle);
-
-  if (msg->iov_length != 1 || msg->ndesc_length != 0) {
-    return -1;
-  }
-
-  uint32_t volatile* params = static_cast<uint32_t volatile*>(msg->iov[0].base);
-  size_t num_params = msg->iov[0].length / sizeof(*params);
-
-  if (num_params < 1) {
-    return -1;
-  }
-
-  uint32_t msg_type = params[0];
-  switch (msg_type) {
-    case 0: {
-      if (num_params != 5) {
-        return -1;
-      }
-      const struct MojoCreateSharedBufferOptions* options;
-      uint64_t num_bytes_value;
-      MojoHandle volatile* shared_buffer_handle_ptr;
-      MojoHandle shared_buffer_handle_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertExtensibleStructInput(nap, params[1], true, &options)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[2], &num_bytes_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[3], false,
-                                &shared_buffer_handle_value,
-                                &shared_buffer_handle_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[4], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplCreateSharedBuffer(
-          g_mojo_system, options, num_bytes_value, &shared_buffer_handle_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *shared_buffer_handle_ptr = shared_buffer_handle_value;
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 1: {
-      if (num_params != 5) {
-        return -1;
-      }
-      MojoHandle buffer_handle_value;
-      const struct MojoDuplicateBufferHandleOptions* options;
-      MojoHandle volatile* new_buffer_handle_ptr;
-      MojoHandle new_buffer_handle_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1], &buffer_handle_value)) {
-          return -1;
-        }
-        if (!ConvertExtensibleStructInput(nap, params[2], true, &options)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[3], false, &new_buffer_handle_value,
-                                &new_buffer_handle_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[4], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplDuplicateBufferHandle(
-          g_mojo_system, buffer_handle_value, options,
-          &new_buffer_handle_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *new_buffer_handle_ptr = new_buffer_handle_value;
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 2:
-      fprintf(stderr, "MojoMapBuffer not implemented\n");
-      return -1;
-    case 3:
-      fprintf(stderr, "MojoUnmapBuffer not implemented\n");
-      return -1;
-    case 4: {
-      if (num_params != 5) {
-        return -1;
-      }
-      const struct MojoCreateDataPipeOptions* options;
-      MojoHandle volatile* data_pipe_producer_handle_ptr;
-      MojoHandle data_pipe_producer_handle_value;
-      MojoHandle volatile* data_pipe_consumer_handle_ptr;
-      MojoHandle data_pipe_consumer_handle_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertExtensibleStructInput(nap, params[1], true, &options)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[2], false,
-                                &data_pipe_producer_handle_value,
-                                &data_pipe_producer_handle_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[3], false,
-                                &data_pipe_consumer_handle_value,
-                                &data_pipe_consumer_handle_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[4], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplCreateDataPipe(
-          g_mojo_system, options, &data_pipe_producer_handle_value,
-          &data_pipe_consumer_handle_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *data_pipe_producer_handle_ptr = data_pipe_producer_handle_value;
-        *data_pipe_consumer_handle_ptr = data_pipe_consumer_handle_value;
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 5: {
-      if (num_params != 6) {
-        return -1;
-      }
-      MojoHandle data_pipe_producer_handle_value;
-      const void* elements;
-      uint32_t volatile* num_bytes_ptr;
-      uint32_t num_bytes_value;
-      MojoWriteDataFlags flags_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1],
-                                &data_pipe_producer_handle_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[3], false, &num_bytes_value,
-                                &num_bytes_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[4], &flags_value)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[5], false, &result_ptr)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[2], num_bytes_value, 1, false,
-                          &elements)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplWriteData(
-          g_mojo_system, data_pipe_producer_handle_value, elements,
-          &num_bytes_value, flags_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *num_bytes_ptr = num_bytes_value;
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 6:
-      fprintf(stderr, "MojoBeginWriteData not implemented\n");
-      return -1;
-    case 7: {
-      if (num_params != 4) {
-        return -1;
-      }
-      MojoHandle data_pipe_producer_handle_value;
-      uint32_t num_bytes_written_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1],
-                                &data_pipe_producer_handle_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[2], &num_bytes_written_value)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[3], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplEndWriteData(g_mojo_system,
-                                                data_pipe_producer_handle_value,
-                                                num_bytes_written_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 8: {
-      if (num_params != 6) {
-        return -1;
-      }
-      MojoHandle data_pipe_consumer_handle_value;
-      void* elements;
-      uint32_t volatile* num_bytes_ptr;
-      uint32_t num_bytes_value;
-      MojoReadDataFlags flags_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1],
-                                &data_pipe_consumer_handle_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[3], false, &num_bytes_value,
-                                &num_bytes_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[4], &flags_value)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[5], false, &result_ptr)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[2], num_bytes_value, 1, false,
-                          &elements)) {
-          return -1;
-        }
-      }
-
-      result_value =
-          MojoSystemImplReadData(g_mojo_system, data_pipe_consumer_handle_value,
-                                 elements, &num_bytes_value, flags_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *num_bytes_ptr = num_bytes_value;
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 9:
-      fprintf(stderr, "MojoBeginReadData not implemented\n");
-      return -1;
-    case 10: {
-      if (num_params != 4) {
-        return -1;
-      }
-      MojoHandle data_pipe_consumer_handle_value;
-      uint32_t num_bytes_read_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1],
-                                &data_pipe_consumer_handle_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[2], &num_bytes_read_value)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[3], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplEndReadData(
-          g_mojo_system, data_pipe_consumer_handle_value, num_bytes_read_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 11: {
-      if (num_params != 2) {
-        return -1;
-      }
-      MojoTimeTicks volatile* result_ptr;
-      MojoTimeTicks result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarOutput(nap, params[1], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplGetTimeTicksNow(g_mojo_system);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 12: {
-      if (num_params != 3) {
-        return -1;
-      }
-      MojoHandle handle_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1], &handle_value)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[2], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplClose(g_mojo_system, handle_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 13: {
-      if (num_params != 6) {
-        return -1;
-      }
-      MojoHandle handle_value;
-      MojoHandleSignals signals_value;
-      MojoDeadline deadline_value;
-      MojoHandleSignalsState volatile* signals_state_ptr;
-      MojoHandleSignalsState signals_state_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1], &handle_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[2], &signals_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[3], &deadline_value)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[4], true, &signals_state_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[5], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplWait(
-          g_mojo_system, handle_value, signals_value, deadline_value,
-          signals_state_ptr ? &signals_state_value : NULL);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (signals_state_ptr != NULL) {
-          memcpy_volatile_out(signals_state_ptr, &signals_state_value,
-                              sizeof(MojoHandleSignalsState));
-        }
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 14: {
-      if (num_params != 8) {
-        return -1;
-      }
-      const MojoHandle* handles;
-      const MojoHandleSignals* signals;
-      uint32_t num_handles_value;
-      MojoDeadline deadline_value;
-      uint32_t volatile* result_index_ptr;
-      uint32_t result_index_value;
-      struct MojoHandleSignalsState* signals_states;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[3], &num_handles_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[4], &deadline_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[5], true, &result_index_value,
-                                &result_index_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[7], false, &result_ptr)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[1], num_handles_value, sizeof(*handles),
-                          false, &handles)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[2], num_handles_value, sizeof(*signals),
-                          false, &signals)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[6], num_handles_value,
-                          sizeof(*signals_states), true, &signals_states)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplWaitMany(
-          g_mojo_system, handles, signals, num_handles_value, deadline_value,
-          result_index_ptr ? &result_index_value : NULL, signals_states);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (result_index_ptr != NULL) {
-          *result_index_ptr = result_index_value;
-        }
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 15: {
-      if (num_params != 5) {
-        return -1;
-      }
-      const struct MojoCreateMessagePipeOptions* options;
-      MojoHandle volatile* message_pipe_handle0_ptr;
-      MojoHandle message_pipe_handle0_value;
-      MojoHandle volatile* message_pipe_handle1_ptr;
-      MojoHandle message_pipe_handle1_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertExtensibleStructInput(nap, params[1], true, &options)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[2], false,
-                                &message_pipe_handle0_value,
-                                &message_pipe_handle0_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[3], false,
-                                &message_pipe_handle1_value,
-                                &message_pipe_handle1_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[4], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplCreateMessagePipe(
-          g_mojo_system, options, &message_pipe_handle0_value,
-          &message_pipe_handle1_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *message_pipe_handle0_ptr = message_pipe_handle0_value;
-        *message_pipe_handle1_ptr = message_pipe_handle1_value;
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 16: {
-      if (num_params != 8) {
-        return -1;
-      }
-      MojoHandle message_pipe_handle_value;
-      const void* bytes;
-      uint32_t num_bytes_value;
-      const MojoHandle* handles;
-      uint32_t num_handles_value;
-      MojoWriteMessageFlags flags_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1], &message_pipe_handle_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[3], &num_bytes_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[5], &num_handles_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[6], &flags_value)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[7], false, &result_ptr)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[2], num_bytes_value, 1, true, &bytes)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[4], num_handles_value, sizeof(*handles),
-                          true, &handles)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplWriteMessage(
-          g_mojo_system, message_pipe_handle_value, bytes, num_bytes_value,
-          handles, num_handles_value, flags_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 17: {
-      if (num_params != 8) {
-        return -1;
-      }
-      MojoHandle message_pipe_handle_value;
-      void* bytes;
-      uint32_t volatile* num_bytes_ptr;
-      uint32_t num_bytes_value;
-      MojoHandle* handles;
-      uint32_t volatile* num_handles_ptr;
-      uint32_t num_handles_value;
-      MojoReadMessageFlags flags_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInput(nap, params[1], &message_pipe_handle_value)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[3], true, &num_bytes_value,
-                                &num_bytes_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarInOut(nap, params[5], true, &num_handles_value,
-                                &num_handles_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarInput(nap, params[6], &flags_value)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[7], false, &result_ptr)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[2], num_bytes_value, 1, true, &bytes)) {
-          return -1;
-        }
-        if (!ConvertArray(nap, params[4], num_handles_value, sizeof(*handles),
-                          true, &handles)) {
-          return -1;
-        }
-      }
-
-      result_value = MojoSystemImplReadMessage(
-          g_mojo_system, message_pipe_handle_value, bytes,
-          num_bytes_ptr ? &num_bytes_value : NULL, handles,
-          num_handles_ptr ? &num_handles_value : NULL, flags_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (num_bytes_ptr != NULL) {
-          *num_bytes_ptr = num_bytes_value;
-        }
-        if (num_handles_ptr != NULL) {
-          *num_handles_ptr = num_handles_value;
-        }
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-    case 18: {
-      if (num_params != 3) {
-        return -1;
-      }
-      MojoHandle volatile* handle_ptr;
-      MojoHandle handle_value;
-      MojoResult volatile* result_ptr;
-      MojoResult result_value;
-      {
-        ScopedCopyLock copy_lock(nap);
-        if (!ConvertScalarInOut(nap, params[1], false, &handle_value,
-                                &handle_ptr)) {
-          return -1;
-        }
-        if (!ConvertScalarOutput(nap, params[2], false, &result_ptr)) {
-          return -1;
-        }
-      }
-
-      result_value = _MojoGetInitialHandle(&handle_value);
-
-      {
-        ScopedCopyLock copy_lock(nap);
-        *handle_ptr = handle_value;
-        *result_ptr = result_value;
-      }
-
-      return 0;
-    }
-  }
-
-  return -1;
-}
-
-ssize_t MojoDescRecvMsg(void* handle,
-                        struct NaClImcTypedMsgHdr* msg,
-                        int flags) {
-  return -1;
-}
-
-struct NaClDesc* MakeMojoDesc(struct NaClApp* nap) {
-  struct NaClDescCustomFuncs funcs = NACL_DESC_CUSTOM_FUNCS_INITIALIZER;
-  funcs.Destroy = MojoDescDestroy;
-  funcs.SendMsg = MojoDescSendMsg;
-  funcs.RecvMsg = MojoDescRecvMsg;
-  return NaClDescMakeCustomDesc(nap, &funcs);
-}
-
-void MojoDisabledDescDestroy(void* handle) {
-}
-
-ssize_t MojoDisabledDescSendMsg(void* handle,
-                                const struct NaClImcTypedMsgHdr* msg,
-                                int flags) {
-  fprintf(stderr, "Mojo is not currently supported.");
-  abort();
-}
-
-ssize_t MojoDisabledDescRecvMsg(void* handle,
-                                struct NaClImcTypedMsgHdr* msg,
-                                int flags) {
-  fprintf(stderr, "Mojo is not currently supported.");
-  abort();
-}
-
-struct NaClDesc* MakeDisabledMojoDesc(struct NaClApp* nap) {
-  struct NaClDescCustomFuncs funcs = NACL_DESC_CUSTOM_FUNCS_INITIALIZER;
-  funcs.Destroy = MojoDisabledDescDestroy;
-  funcs.SendMsg = MojoDisabledDescSendMsg;
-  funcs.RecvMsg = MojoDisabledDescRecvMsg;
-  return NaClDescMakeCustomDesc(nap, &funcs);
-}
-
-}  // namespace
-
-// The value for this FD must not conflict with uses inside Chromium. However,
-// mojo/nacl doesn't depend on any Chromium headers, so we can't use a #define
-// from there.
-#define NACL_MOJO_DESC (NACL_CHROME_DESC_BASE + 3)
-
-MojoResult InjectMojo(struct NaClApp* nap, MojoHandle handle) {
-  NaClAppSetDesc(nap, NACL_MOJO_DESC, MakeMojoDesc(nap));
-  g_mojo_system = MojoSystemImplCreateImpl();
-  return MojoSystemImplTransferHandle(MojoSystemImplGetDefaultImpl(), handle,
-                                      g_mojo_system, &g_mojo_handle);
-}
-
-void InjectDisabledMojo(struct NaClApp* nap) {
-  NaClAppSetDesc(nap, NACL_MOJO_DESC, MakeDisabledMojoDesc(nap));
-}
diff --git a/third_party/mojo/src/nacl_bindings/mojo_syscall.h b/third_party/mojo/src/nacl_bindings/mojo_syscall.h
deleted file mode 100644
index 031fdf20..0000000
--- a/third_party/mojo/src/nacl_bindings/mojo_syscall.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_NACL_MOJO_SYSCALL_H_
-#define MOJO_NACL_MOJO_SYSCALL_H_
-
-#include "mojo/public/c/system/types.h"
-
-// Injects a NaClDesc for Mojo support and sets a MojoHandle to be provided to
-// untrusted code as a "service provider" MojoHandle.  This provides the
-// implementation of the Mojo system API outside the NaCl sandbox and allows
-// untrusted code to communicate with Mojo interfaces outside the sandbox or in
-// other processes.
-MojoResult InjectMojo(struct NaClApp* nap, MojoHandle handle);
-
-// Injects a "disabled" NaClDesc for Mojo support. This is to make debugging
-// more straightforward in the case where Mojo is not enabled for NaCl plugins.
-void InjectDisabledMojo(struct NaClApp* nap);
-
-#endif  // MOJO_NACL_MOJO_SYSCALL_H_
diff --git a/third_party/mojo/src/nacl_bindings/mojo_syscall_internal.h b/third_party/mojo/src/nacl_bindings/mojo_syscall_internal.h
deleted file mode 100644
index 2f67e3a6..0000000
--- a/third_party/mojo/src/nacl_bindings/mojo_syscall_internal.h
+++ /dev/null
@@ -1,238 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_NACL_MOJO_SYSCALL_INTERNAL_H_
-#define MOJO_NACL_MOJO_SYSCALL_INTERNAL_H_
-
-#include <type_traits>
-
-#include "native_client/src/trusted/service_runtime/nacl_copy.h"
-#include "native_client/src/trusted/service_runtime/sel_ldr.h"
-
-namespace {
-
-class ScopedCopyLock {
- public:
-  explicit ScopedCopyLock(struct NaClApp* nap) : nap_(nap) {
-    NaClCopyTakeLock(nap_);
-  }
-  ~ScopedCopyLock() { NaClCopyDropLock(nap_); }
-
- private:
-  struct NaClApp* nap_;
-};
-
-static inline uintptr_t NaClUserToSysAddrArray(struct NaClApp* nap,
-                                               uint32_t uaddr,
-                                               size_t count,
-                                               size_t size) {
-  // TODO(ncbray): overflow checking
-  size_t range = count * size;
-  return NaClUserToSysAddrRange(nap, uaddr, range);
-}
-
-// We don't use plain-old memcpy because reads and writes to the untrusted
-// address space from trusted code must be volatile.  Non-volatile memory
-// operations are dangerous because a compiler would be free to materialize a
-// second load from the same memory address or materialize a load from a memory
-// address that was stored, and assume the materialized load would return the
-// same value as the previous load or store.  Data races could cause the
-// materialized load to return a different value, however, which could lead to
-// time of check vs. time of use problems, or worse.  For this binding code in
-// particular, where memcpy is being called with a constant size, it is entirely
-// conceivable the function will be inlined, unrolled, and optimized.
-static inline void memcpy_volatile_out(void volatile* dst,
-                                       const void* src,
-                                       size_t n) {
-  char volatile* c_dst = static_cast<char volatile*>(dst);
-  const char* c_src = static_cast<const char*>(src);
-  for (size_t i = 0; i < n; i++) {
-    c_dst[i] = c_src[i];
-  }
-}
-
-template <typename T>
-bool ConvertPointerInput(struct NaClApp* nap, uint32_t user_ptr, T** value) {
-  if (user_ptr) {
-    uintptr_t temp = NaClUserToSysAddr(nap, user_ptr);
-    if (temp != kNaClBadAddress) {
-      *value = reinterpret_cast<T*>(temp);
-      return true;
-    }
-  } else {
-    *value = nullptr;
-    return true;
-  }
-  *value = nullptr;  // Paranoia.
-  return false;
-}
-
-template <typename T>
-bool ConvertPointerInOut(struct NaClApp* nap,
-                         uint32_t user_ptr,
-                         bool optional,
-                         T** value,
-                         uint32_t volatile** sys_ptr) {
-  if (user_ptr) {
-    uintptr_t temp = NaClUserToSysAddrRange(nap, user_ptr, sizeof(uint32_t));
-    if (temp != kNaClBadAddress) {
-      uint32_t volatile* converted_ptr =
-          reinterpret_cast<uint32_t volatile*>(temp);
-      uint32_t raw_value = *converted_ptr;
-      if (!raw_value) {
-        *sys_ptr = converted_ptr;
-        *value = nullptr;
-        return true;
-      }
-      uintptr_t temp = NaClUserToSysAddr(nap, raw_value);
-      if (temp != kNaClBadAddress) {
-        *sys_ptr = converted_ptr;
-        *value = reinterpret_cast<T*>(temp);
-        return true;
-      }
-    }
-  } else if (optional) {
-    *sys_ptr = nullptr;
-    *value = nullptr;  // Paranoia.
-    return true;
-  }
-  *sys_ptr = nullptr;  // Paranoia.
-  *value = nullptr;    // Paranoia.
-  return false;
-}
-
-template <typename T>
-void CopyOutPointer(struct NaClApp* nap, T* value, uint32_t volatile* sys_ptr) {
-  if (value) {
-    // Will kill the process if value if the pointer does not lie in the
-    // sandbox.
-    uintptr_t temp = NaClSysToUser(nap, reinterpret_cast<uintptr_t>(value));
-    *sys_ptr = static_cast<uint32_t>(temp);
-  } else {
-    *sys_ptr = 0;
-  }
-}
-
-template <typename T>
-bool ConvertScalarInput(struct NaClApp* nap, uint32_t user_ptr, T* value) {
-  static_assert(!std::is_pointer<T>::value, "do not use for pointer types");
-  if (user_ptr) {
-    uintptr_t temp = NaClUserToSysAddrRange(nap, user_ptr, sizeof(T));
-    if (temp != kNaClBadAddress) {
-      *value = *reinterpret_cast<T volatile*>(temp);
-      return true;
-    }
-  }
-  return false;
-}
-
-template <typename T>
-bool ConvertScalarOutput(struct NaClApp* nap,
-                         uint32_t user_ptr,
-                         bool optional,
-                         T volatile** sys_ptr) {
-  static_assert(!std::is_pointer<T>::value, "do not use for pointer types");
-  if (user_ptr) {
-    uintptr_t temp = NaClUserToSysAddrRange(nap, user_ptr, sizeof(T));
-    if (temp != kNaClBadAddress) {
-      *sys_ptr = reinterpret_cast<T volatile*>(temp);
-      return true;
-    }
-  } else if (optional) {
-    *sys_ptr = 0;
-    return true;
-  }
-  *sys_ptr = 0;  // Paranoia.
-  return false;
-}
-
-template <typename T>
-bool ConvertScalarInOut(struct NaClApp* nap,
-                        uint32_t user_ptr,
-                        bool optional,
-                        T* value,
-                        T volatile** sys_ptr) {
-  static_assert(!std::is_pointer<T>::value, "do not use for pointer types");
-  if (user_ptr) {
-    uintptr_t temp = NaClUserToSysAddrRange(nap, user_ptr, sizeof(T));
-    if (temp != kNaClBadAddress) {
-      T volatile* converted = reinterpret_cast<T volatile*>(temp);
-      *sys_ptr = converted;
-      *value = *converted;
-      return true;
-    }
-  } else if (optional) {
-    *sys_ptr = 0;
-    *value = static_cast<T>(0);  // Paranoia.
-    return true;
-  }
-  *sys_ptr = 0;                // Paranoia.
-  *value = static_cast<T>(0);  // Paranoia.
-  return false;
-}
-
-template <typename T>
-bool ConvertArray(struct NaClApp* nap,
-                  uint32_t user_ptr,
-                  uint32_t length,
-                  size_t element_size,
-                  bool optional,
-                  T** sys_ptr) {
-  if (user_ptr) {
-    uintptr_t temp =
-        NaClUserToSysAddrArray(nap, user_ptr, length, element_size);
-    if (temp != kNaClBadAddress) {
-      *sys_ptr = reinterpret_cast<T*>(temp);
-      return true;
-    }
-  } else if (optional) {
-    *sys_ptr = 0;
-    return true;
-  }
-  return false;
-}
-
-template <typename T>
-bool ConvertBytes(struct NaClApp* nap,
-                  uint32_t user_ptr,
-                  uint32_t length,
-                  bool optional,
-                  T** sys_ptr) {
-  if (user_ptr) {
-    uintptr_t temp = NaClUserToSysAddrRange(nap, user_ptr, length);
-    if (temp != kNaClBadAddress) {
-      *sys_ptr = reinterpret_cast<T*>(temp);
-      return true;
-    }
-  } else if (optional) {
-    *sys_ptr = 0;
-    return true;
-  }
-  return false;
-}
-
-// TODO(ncbray): size validation and complete copy.
-// TODO(ncbray): ensure non-null / missized structs are covered by a test case.
-template <typename T>
-bool ConvertExtensibleStructInput(struct NaClApp* nap,
-                                  uint32_t user_ptr,
-                                  bool optional,
-                                  T** sys_ptr) {
-  static_assert(!std::is_pointer<T>::value, "do not use for pointer types");
-  if (user_ptr) {
-    uintptr_t temp = NaClUserToSysAddrRange(nap, user_ptr, sizeof(T));
-    if (temp != kNaClBadAddress) {
-      *sys_ptr = reinterpret_cast<T*>(temp);
-      return true;
-    }
-  } else if (optional) {
-    *sys_ptr = 0;
-    return true;
-  }
-  return false;
-}
-
-}  // namespace
-
-#endif  // MOJO_NACL_MOJO_SYSCALL_INTERNAL_H_
diff --git a/third_party/mojo/src/nacl_bindings/monacl_sel_main.cc b/third_party/mojo/src/nacl_bindings/monacl_sel_main.cc
deleted file mode 100644
index 100f1610..0000000
--- a/third_party/mojo/src/nacl_bindings/monacl_sel_main.cc
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "nacl_bindings/monacl_sel_main.h"
-
-#include "nacl_bindings/mojo_syscall.h"
-#include "native_client/src/public/chrome_main.h"
-#include "native_client/src/public/nacl_app.h"
-
-namespace mojo {
-
-int LaunchNaCl(NaClDesc* nexe_desc,
-               NaClDesc* irt_desc,
-               int app_argc,
-               char* app_argv[],
-               MojoHandle handle) {
-  NaClChromeMainInit();
-
-  struct NaClChromeMainArgs* args = NaClChromeMainArgsCreate();
-  args->nexe_desc = nexe_desc;
-  args->irt_desc = irt_desc;
-
-  args->argc = app_argc;
-  args->argv = app_argv;
-
-  struct NaClApp* nap = NaClAppCreate();
-  InjectMojo(nap, handle);
-
-  int exit_status = 1;
-  NaClChromeMainStart(nap, args, &exit_status);
-  return exit_status;
-}
-
-void NaClExit(int code) {
-  ::NaClExit(code);
-}
-
-}  // namespace mojo
diff --git a/third_party/mojo/src/nacl_bindings/monacl_sel_main.h b/third_party/mojo/src/nacl_bindings/monacl_sel_main.h
deleted file mode 100644
index d376f64..0000000
--- a/third_party/mojo/src/nacl_bindings/monacl_sel_main.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_NACL_MONACL_SEL_MAIN_H_
-#define MOJO_NACL_MONACL_SEL_MAIN_H_
-
-#include "mojo/public/c/system/types.h"
-
-struct NaClDesc;
-
-namespace mojo {
-
-// Callee assumes ownership of |nexe_desc|, |irt_desc|, and |handle|.
-int LaunchNaCl(NaClDesc* nexe_desc,
-               NaClDesc* irt_desc,
-               int app_argc,
-               char* app_argv[],
-               MojoHandle handle);
-
-void NaClExit(int code);
-
-}  // namespace mojo
-
-#endif  // MOJO_NACL_MONACL_SEL_MAIN_H_
diff --git a/third_party/qcms/README.chromium b/third_party/qcms/README.chromium
index c7422b7c..b1845fdf 100644
--- a/third_party/qcms/README.chromium
+++ b/third_party/qcms/README.chromium
@@ -103,6 +103,8 @@
    - https://code.google.com/p/chromium/issues/detail?id=506607
  - LUT8/16 profiles with an empty CLUT are invalid
    - https://code.google.com/p/chromium/issues/detail?id=487284
+ - Caching transform prelude to save computation in V4 profiles
+   - https://code.google.com/p/chromium/issues/detail?id=506607
 
 For the Chromium changes, since the import, in a patch format run:
   git diff b8456f38 src
diff --git a/third_party/qcms/src/qcmsint.h b/third_party/qcms/src/qcmsint.h
index 5dd00619..c318ad2 100644
--- a/third_party/qcms/src/qcmsint.h
+++ b/third_party/qcms/src/qcmsint.h
@@ -95,7 +95,12 @@
 
 	void (*transform_fn)(struct _qcms_transform *transform, unsigned char *src, unsigned char *dest, size_t length, struct _qcms_format_type output_format);
 
-#define TRANSFORM_FLAG_MATRIX  0x0001
+	unsigned char floor_cache[256];
+	unsigned char ceil_cache[256];
+	float r_cache[256];
+
+#define TRANSFORM_FLAG_MATRIX		0x0001
+#define TRANSFORM_FLAG_CLUT_CACHE	0x0002
 
 	uint16_t transform_flags;
 };
@@ -312,6 +317,8 @@
                                               size_t length,
                                               qcms_format_type output_format);
 
+void qcms_transform_build_clut_cache(qcms_transform* transform);
+
 extern qcms_bool qcms_supports_iccv4;
 
 
diff --git a/third_party/qcms/src/tests/qcms_test_tetra_clut_rgba.c b/third_party/qcms/src/tests/qcms_test_tetra_clut_rgba.c
index 8e7d034..3fafdc5 100644
--- a/third_party/qcms/src/tests/qcms_test_tetra_clut_rgba.c
+++ b/third_party/qcms/src/tests/qcms_test_tetra_clut_rgba.c
@@ -106,9 +106,15 @@
     srand(0);
     seconds();
 
+    memset(&transform0, 0, sizeof(transform0));
+    memset(&transform1, 0, sizeof(transform1));
+
     transform0.grid_size = samples;
     transform1.grid_size = samples;
 
+    transform0.transform_flags = 0;
+    transform1.transform_flags = 0;
+
     lutSize = 3 * samples * samples * samples;
     lut0 = create_lut(lutSize);
     lut1 = (float *)malloc(lutSize * sizeof(float));
diff --git a/third_party/qcms/src/transform-sse2.c b/third_party/qcms/src/transform-sse2.c
index 29717c9..34d0d86 100644
--- a/third_party/qcms/src/transform-sse2.c
+++ b/third_party/qcms/src/transform-sse2.c
@@ -268,6 +268,11 @@
     dest[b_out] = otdata_b[output[2]];
 }
 
+static inline __m128i __mm_swizzle_epi32(__m128i value, int bgra)
+{
+    return bgra ? _mm_shuffle_epi32(value, _MM_SHUFFLE(0, 1, 2, 3)) :
+                  _mm_shuffle_epi32(value, _MM_SHUFFLE(0, 3, 2, 1)) ;
+}
 
 void qcms_transform_data_tetra_clut_rgba_sse2(qcms_transform *transform,
                                               unsigned char *src,
@@ -275,17 +280,13 @@
                                               size_t length,
                                               qcms_format_type output_format)
 {
-    const int r_out = output_format.r;
-    const int b_out = output_format.b;
+    const int bgra = output_format.r;
 
     size_t i;
 
-    const int xy_len = 1;
-    const int x_len = transform->grid_size;
-    const int len = x_len * x_len;
-
-    const __m128 __clut_stride = _mm_set_ps((float)(3 * xy_len), (float)(3 * x_len), (float)(3 * len), 0);
-    const __m128 __grid_scaled = _mm_set1_ps((1.0f / 255.0f) * (transform->grid_size - 1));
+    const int xy_len_3 = 3 * 1;
+    const int x_len_3 = 3 * transform->grid_size;
+    const int len_3 = x_len_3 * transform->grid_size;
 
     const __m128 __255 = _mm_set1_ps(255.0f);
     const __m128 __one = _mm_set1_ps(1.0f);
@@ -302,62 +303,37 @@
     __m128 c1;
     __m128 c0;
 
-    __m128 in;
-
-    __m128 xyz_r;
-    __m128 xyz_0;
-    __m128 xyz_n;
-
-    ALIGN float xyz_r_f[4];
-    ALIGN int   xyz_0_i[4];
-    ALIGN int   xyz_n_i[4];
-
-    __m128i result;
-
-#define TETRA_SRC_RGB(r, g, b) _mm_set_ps((float)b, (float)g, (float)r, 0.f)
+    if (!(transform->transform_flags & TRANSFORM_FLAG_CLUT_CACHE))
+        qcms_transform_build_clut_cache(transform);
 
     for (i = 0; i < length; ++i) {
-        // compute input point in cube lattice (grid) co-ordinates
-        in = _mm_mul_ps(TETRA_SRC_RGB(src[0], src[1], src[2]), __grid_scaled);
+        unsigned char in_r = *src++;
+        unsigned char in_g = *src++;
+        unsigned char in_b = *src++;
 
-        // floor: convert to int (truncate), convert back to float
-        xyz_0 = _mm_cvtepi32_ps(_mm_cvttps_epi32(in));
+        // initialize the output result with the alpha channel only
 
-        // ceil: where in is greater than xyz_0 = floor(in), add 1
-        xyz_n = _mm_add_ps(xyz_0, _mm_and_ps(_mm_cmpgt_ps(in, xyz_0), __one));
+        __m128i result = _mm_setr_epi32(*src++, 0, 0, 0);
 
-        // compute the input point relative to the sub-cube origin
-        xyz_r = _mm_sub_ps(in, xyz_0);
+        // get the input point r.xyz relative to the subcube origin
 
-#define rx (xyz_r_f[1])
-#define ry (xyz_r_f[2])
-#define rz (xyz_r_f[3])
+        float rx = transform->r_cache[in_r];
+        float ry = transform->r_cache[in_g];
+        float rz = transform->r_cache[in_b];
 
-        _mm_store_ps(xyz_r_f, xyz_r);
+        // load and LUT scale the subcube maximum vertex
 
-#define x0 (xyz_0_i[1])
-#define y0 (xyz_0_i[2])
-#define z0 (xyz_0_i[3])
+        int xn = transform->ceil_cache[in_r] * len_3;
+        int yn = transform->ceil_cache[in_g] * x_len_3;
+        int zn = transform->ceil_cache[in_b] * xy_len_3;
 
-        xyz_0 = _mm_mul_ps(xyz_0, __clut_stride);
-        _mm_store_si128((__m128i*) xyz_0_i, _mm_cvtps_epi32(xyz_0));
+        // load and LUT scale the subcube origin vertex
 
-#define xn (xyz_n_i[1])
-#define yn (xyz_n_i[2])
-#define zn (xyz_n_i[3])
+        int x0 = transform->floor_cache[in_r] * len_3;
+        int y0 = transform->floor_cache[in_g] * x_len_3;
+        int z0 = transform->floor_cache[in_b] * xy_len_3;
 
-        xyz_n = _mm_mul_ps(xyz_n, __clut_stride);
-        _mm_store_si128((__m128i*) xyz_n_i, _mm_cvtps_epi32(xyz_n));
-
-        dest[3] = src[3];
-        src += 4;
-
-#define SET_I0_AND_PREFETCH_CLUT() \
-        _mm_prefetch((char*)&(r_table[i0 = x0 + y0 + z0]), _MM_HINT_T0)
-
-#if !defined(_MSC_VER)
-        SET_I0_AND_PREFETCH_CLUT();
-#endif
+        // tetrahedral interpolate the input color r.xyz
 
 #define TETRA_LOOKUP_CLUT(i3, i2, i1, i0) \
         c0 = _mm_set_ps(b_table[i0], g_table[i0], r_table[i0], 0.f), \
@@ -365,11 +341,10 @@
         c2 = _mm_set_ps(b_table[i2], g_table[i2], r_table[i2], 0.f), \
         c3 = _mm_set_ps(b_table[i3], g_table[i3], r_table[i3], 0.f)
 
+        i0 = x0 + y0 + z0;
+
         if (rx >= ry) {
 
-#if defined(_MSC_VER)
-            SET_I0_AND_PREFETCH_CLUT();
-#endif
             if (ry >= rz) {         // rx >= ry && ry >= rz
 
                 i3 = yn + (i1 = xn);
@@ -411,9 +386,6 @@
             }
         } else {
 
-#if defined(_MSC_VER)
-            SET_I0_AND_PREFETCH_CLUT();
-#endif
             if (rx >= rz) {         // ry > rx && rx >= rz
 
                 i3 = xn + (i2 = yn);
@@ -457,29 +429,29 @@
 
         // output.xyz = column_matrix(c1, c2, c3) x r.xyz + c0.xyz
 
-        in = _mm_shuffle_ps(xyz_r, xyz_r, _MM_SHUFFLE(1, 1, 1, 1));
-        c1 = _mm_mul_ps(c1, in);
-        in = _mm_shuffle_ps(xyz_r, xyz_r, _MM_SHUFFLE(2, 2, 2, 2));
-        c2 = _mm_mul_ps(c2, in);
-        in = _mm_shuffle_ps(xyz_r, xyz_r, _MM_SHUFFLE(3, 3, 3, 3));
-        c3 = _mm_mul_ps(c3, in);
+        c0 = _mm_add_ps(c0, _mm_mul_ps(c1, _mm_set1_ps(rx)));
+        c0 = _mm_add_ps(c0, _mm_mul_ps(c2, _mm_set1_ps(ry)));
+        c0 = _mm_add_ps(c0, _mm_mul_ps(c3, _mm_set1_ps(rz)));
 
-        in = _mm_add_ps(c3, c2);
-        in = _mm_add_ps(in, c1);
-        in = _mm_add_ps(in, c0);
+        // clamp to [0.0..1.0], then scale by 255
 
-        // clamp to [0.0..1.0] and scale by 255
+        c0 = _mm_max_ps(c0, __000);
+        c0 = _mm_min_ps(c0, __one);
+        c0 = _mm_mul_ps(c0, __255);
 
-        in = _mm_max_ps(in, __000);
-        in = _mm_min_ps(in, __one);
-        in = _mm_mul_ps(in, __255);
+        // int(c0) with float rounding, add alpha
 
-        result = _mm_cvtps_epi32(in); // convert to int (rounding)
+        result = _mm_add_epi32(result, _mm_cvtps_epi32(c0));
 
-        dest[r_out] = (unsigned char) _mm_extract_epi16(result, 2);
-        dest[1]     = (unsigned char) _mm_extract_epi16(result, 4);
-        dest[b_out] = (unsigned char) _mm_extract_epi16(result, 6);
+        // swizzle and repack in result low bytes
 
+        result = __mm_swizzle_epi32(result, bgra);
+        result = _mm_packus_epi16(result, result);
+        result = _mm_packus_epi16(result, result);
+
+        // store into uint32_t* pixel destination
+
+        *(uint32_t *)dest = _mm_cvtsi128_si32(result);
         dest += 4;
     }
 }
diff --git a/third_party/qcms/src/transform.c b/third_party/qcms/src/transform.c
index 1723deb..cbdfa59 100644
--- a/third_party/qcms/src/transform.c
+++ b/third_party/qcms/src/transform.c
@@ -530,22 +530,26 @@
 	float c0_g, c1_g, c2_g, c3_g;
 	float c0_b, c1_b, c2_b, c3_b;
 	float clut_r, clut_g, clut_b;
+
 	for (i = 0; i < length; i++) {
 		unsigned char in_r = *src++;
 		unsigned char in_g = *src++;
 		unsigned char in_b = *src++;
 		unsigned char in_a = *src++;
+
 		float linear_r = in_r/255.0f, linear_g=in_g/255.0f, linear_b = in_b/255.0f;
 
 		int x = floor(linear_r * (transform->grid_size-1));
 		int y = floor(linear_g * (transform->grid_size-1));
 		int z = floor(linear_b * (transform->grid_size-1));
+
 		int x_n = ceil(linear_r * (transform->grid_size-1));
 		int y_n = ceil(linear_g * (transform->grid_size-1));
 		int z_n = ceil(linear_b * (transform->grid_size-1));
-		float rx = linear_r * (transform->grid_size-1) - x; 
+
+		float rx = linear_r * (transform->grid_size-1) - x;
 		float ry = linear_g * (transform->grid_size-1) - y;
-		float rz = linear_b * (transform->grid_size-1) - z; 
+		float rz = linear_b * (transform->grid_size-1) - z;
 
 		c0_r = CLU(r_table, x, y, z);
 		c0_g = CLU(g_table, x, y, z);
@@ -650,21 +654,25 @@
 	float c0_g, c1_g, c2_g, c3_g;
 	float c0_b, c1_b, c2_b, c3_b;
 	float clut_r, clut_g, clut_b;
+
 	for (i = 0; i < length; i++) {
 		unsigned char in_r = *src++;
 		unsigned char in_g = *src++;
 		unsigned char in_b = *src++;
+
 		float linear_r = in_r/255.0f, linear_g=in_g/255.0f, linear_b = in_b/255.0f;
 
 		int x = floor(linear_r * (transform->grid_size-1));
 		int y = floor(linear_g * (transform->grid_size-1));
 		int z = floor(linear_b * (transform->grid_size-1));
+
 		int x_n = ceil(linear_r * (transform->grid_size-1));
 		int y_n = ceil(linear_g * (transform->grid_size-1));
 		int z_n = ceil(linear_b * (transform->grid_size-1));
-		float rx = linear_r * (transform->grid_size-1) - x; 
+
+		float rx = linear_r * (transform->grid_size-1) - x;
 		float ry = linear_g * (transform->grid_size-1) - y;
-		float rz = linear_b * (transform->grid_size-1) - z; 
+		float rz = linear_b * (transform->grid_size-1) - z;
 
 		c0_r = CLU(r_table, x, y, z);
 		c0_g = CLU(g_table, x, y, z);
@@ -1242,6 +1250,24 @@
 	return false;
 }
 
+void qcms_transform_build_clut_cache(qcms_transform* transform) {
+	const int grid_factor = transform->grid_size - 1;
+	const float grid_scaled = (1.0f / 255.0f) * grid_factor;
+	int i;
+
+#define div_255_ceiling(value) (((value) + 254) / 255)
+
+	for (i = 0; i < 256; i++) {
+		transform->ceil_cache[i] = div_255_ceiling(i * grid_factor);
+		transform->floor_cache[i] = i * grid_factor / 255;
+		transform->r_cache[i] = (i * grid_scaled) - transform->floor_cache[i];
+	}
+
+#undef div_255_ceil
+
+	transform->transform_flags |= TRANSFORM_FLAG_CLUT_CACHE;
+}
+
 #define NO_MEM_TRANSFORM NULL
 
 qcms_transform* qcms_transform_create(
diff --git a/tools/android/adb_remote_setup.sh b/tools/android/adb_remote_setup.sh
index de2114e..06280fe 100755
--- a/tools/android/adb_remote_setup.sh
+++ b/tools/android/adb_remote_setup.sh
@@ -62,8 +62,9 @@
 fi
 
 # Ensure local and remote versions of adb are the same.
-remote_adb_version=$(ssh "$remote_host" "$remote_adb version")
-local_adb_version=$(adb version)
+remote_adb_version=$(ssh "$remote_host" "$remote_adb version" \
+    | grep -v "^Revision")
+local_adb_version=$(adb version | grep -v "^Revision")
 if [[ "$local_adb_version" != "$remote_adb_version" ]]; then
   echo >&2
   echo "WARNING: local adb is not the same version as remote adb." >&2
diff --git a/tools/android/eclipse/.classpath b/tools/android/eclipse/.classpath
index 11f675d..f10827f2 100644
--- a/tools/android/eclipse/.classpath
+++ b/tools/android/eclipse/.classpath
@@ -81,6 +81,7 @@
     <classpathentry kind="src" path="third_party/android_swipe_refresh/java/src"/>
     <classpathentry kind="src" path="third_party/cacheinvalidation/src/java"/>
     <classpathentry kind="src" path="third_party/gif_player/src"/>
+    <classpathentry kind="src" path="third_party/jmake/src"/>
     <classpathentry kind="src" path="third_party/junit/src/src/main/java"/>
     <classpathentry kind="src" path="third_party/mockito/src/cglib-and-asm/src"/>
     <classpathentry kind="src" path="third_party/mockito/src/src"/>
diff --git a/tools/checklicenses/checklicenses.py b/tools/checklicenses/checklicenses.py
index 813593f..68998d6f 100755
--- a/tools/checklicenses/checklicenses.py
+++ b/tools/checklicenses/checklicenses.py
@@ -325,6 +325,9 @@
     'third_party/icu': [  # http://crbug.com/98301
         'UNKNOWN',
     ],
+    'third_party/jmake': [  # Used only at build time.
+        'GPL (v2)',
+    ],
     'third_party/jsoncpp/source': [
         # https://github.com/open-source-parsers/jsoncpp/issues/234
         'UNKNOWN',
@@ -367,9 +370,6 @@
         'UNKNOWN',
     ],
 
-    'third_party/libvpx/source': [  # http://crbug.com/98319
-        'UNKNOWN',
-    ],
     'third_party/libvpx_new/source': [  # http://crbug.com/98319
         'UNKNOWN',
     ],
diff --git a/tools/copyright_scanner/third_party_files_whitelist.txt b/tools/copyright_scanner/third_party_files_whitelist.txt
index a16ad88..97d63e3 100644
--- a/tools/copyright_scanner/third_party_files_whitelist.txt
+++ b/tools/copyright_scanner/third_party_files_whitelist.txt
@@ -207,3 +207,6 @@
 # code is taken from WebKit, the license for which we already pick up from
 # webkit/.
 components/test_runner/helper/layout_test_helper_mac.mm
+# Bundles of existing code.
+chrome/browser/resources/md_downloads/crisper.js
+chrome/browser/resources/md_downloads/vulcanized.html
diff --git a/tools/gn/bin/roll_gn.py b/tools/gn/bin/roll_gn.py
index b5c276ec..66c711a 100644
--- a/tools/gn/bin/roll_gn.py
+++ b/tools/gn/bin/roll_gn.py
@@ -179,6 +179,10 @@
       fp.write(new_deps)
 
   def WaitForBuildToFinish(self):
+    ret = self.CheckoutBuildBranch()
+    if ret:
+      return ret
+
     print('Checking build')
     results = self.CheckBuild()
     while (len(results) < 3 or
@@ -203,6 +207,16 @@
 
     return ret
 
+  def CheckoutBuildBranch(self):
+    ret, out, err = self.Call('git checkout build_gn_%s' % self.new_gn_version)
+    if ret:
+      print('Failed to check out build_gn_%s' % self.new_gn_version)
+      if out:
+        print(out)
+      if err:
+        print(err, file=sys.stderr)
+    return ret
+
   def CheckBuild(self):
     _, out, _ = self.Call('git-cl issue')
 
@@ -276,6 +290,10 @@
     return results
 
   def RollBuildtools(self):
+    ret = self.CheckoutBuildBranch()
+    if ret:
+      return ret
+
     results = self.CheckBuild()
     if (len(results) < 3 or
         not all(r['state'] == 'success' for r in results.values())):
diff --git a/tools/gn/functions.cc b/tools/gn/functions.cc
index 86043f0..01d0aeb 100644
--- a/tools/gn/functions.cc
+++ b/tools/gn/functions.cc
@@ -344,7 +344,46 @@
     "\n"
     "  See also \"gn help buildargs\" for an overview.\n"
     "\n"
-    "Example:\n"
+    "  The precise behavior of declare args is:\n"
+    "\n"
+    "   1. The declare_arg block executes. Any variables in the enclosing\n"
+    "      scope are available for reading.\n"
+    "\n"
+    "   2. At the end of executing the block, any variables set within that\n"
+    "      scope are saved globally as build arguments, with their current\n"
+    "      values being saved as the \"default value\" for that argument.\n"
+    "\n"
+    "   3. User-defined overrides are applied. Anything set in \"gn args\"\n"
+    "      now overrides any default values. The resulting set of variables\n"
+    "      is promoted to be readable from the following code in the file.\n"
+    "\n"
+    "  This has some ramifications that may not be obvious:\n"
+    "\n"
+    "    - You should not perform difficult work inside a declare_args block\n"
+    "      since this only sets a default value that may be discarded. In\n"
+    "      particular, don't use the result of exec_script() to set the\n"
+    "      default value. If you want to have a script-defined default, set\n"
+    "      some default \"undefined\" value like [], \"\", or -1, and after\n"
+    "      the declare_args block, call exec_script if the value is unset by\n"
+    "      the user.\n"
+    "\n"
+    "    - Any code inside of the declare_args block will see the default\n"
+    "      values of previous variables defined in the block rather than\n"
+    "      the user-overridden value. This can be surprising because you will\n"
+    "      be used to seeing the overridden value. If you need to make the\n"
+    "      default value of one arg dependent on the possibly-overridden\n"
+    "      value of another, write two separate declare_args blocks:\n"
+    "\n"
+    "        declare_args() {\n"
+    "          enable_foo = true\n"
+    "        }\n"
+    "        declare_args() {\n"
+    "          # Bar defaults to same user-overridden state as foo.\n"
+    "          enable_bar = enable_foo\n"
+    "        }\n"
+    "\n"
+    "Example\n"
+    "\n"
     "  declare_args() {\n"
     "    enable_teleporter = true\n"
     "    enable_doom_melon = false\n"
diff --git a/tools/gn/group_target_generator.cc b/tools/gn/group_target_generator.cc
index 707d275..2c427f4 100644
--- a/tools/gn/group_target_generator.cc
+++ b/tools/gn/group_target_generator.cc
@@ -22,13 +22,4 @@
   target_->set_output_type(Target::GROUP);
   // Groups only have the default types filled in by the target generator
   // base class.
-
-  // Before there was a deps/public_deps split, a group acted like all deps
-  // are public. During a transition period, if public_deps is not defined,
-  // treat all deps as public. This should be removed and existing groups
-  // updated to use "public_deps" when needed.
-  if (scope_->GetValue(variables::kDeps, false) &&
-      !scope_->GetValue(variables::kPublicDeps, false)) {
-    std::swap(target_->private_deps(), target_->public_deps());
-  }
 }
diff --git a/tools/ipc_fuzzer/message_replay/replay_process.cc b/tools/ipc_fuzzer/message_replay/replay_process.cc
index 319a4d6..017b6a1 100644
--- a/tools/ipc_fuzzer/message_replay/replay_process.cc
+++ b/tools/ipc_fuzzer/message_replay/replay_process.cc
@@ -17,19 +17,15 @@
 #include "ipc/ipc_descriptors.h"
 #include "ipc/ipc_switches.h"
 #include "ipc/mojo/ipc_channel_mojo.h"
-#include "third_party/mojo/src/mojo/edk/embedder/configuration.h"
 #include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
-#include "third_party/mojo/src/mojo/edk/embedder/simple_platform_support.h"
 
 namespace ipc_fuzzer {
 
 // TODO(morrita): content::InitializeMojo() should be used once it becomes
 // a public API. See src/content/app/mojo/mojo_init.cc
 void InitializeMojo() {
-  mojo::embedder::GetConfiguration()->max_message_num_bytes =
-      64 * 1024 * 1024;
-  mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>(
-      new mojo::embedder::SimplePlatformSupport()));
+  mojo::embedder::SetMaxMessageSize(64 * 1024 * 1024);
+  mojo::embedder::Init();
 }
 
 ReplayProcess::ReplayProcess()
diff --git a/tools/mb/mb.py b/tools/mb/mb.py
index 347fc8c..c3be5d7 100755
--- a/tools/mb/mb.py
+++ b/tools/mb/mb.py
@@ -75,9 +75,6 @@
                             help='analyze whether changes to a set of files '
                                  'will cause a set of binaries to be rebuilt.')
     AddCommonOptions(subp)
-    subp.add_argument('--swarming-targets-file',
-                      help='save runtime dependencies for targets listed '
-                           'in file.')
     subp.add_argument('path', nargs=1,
                       help='path build was generated into.')
     subp.add_argument('input_path', nargs=1,
@@ -98,12 +95,37 @@
                       help='path to generate build into')
     subp.set_defaults(func=self.CmdGen)
 
+    subp = subps.add_parser('isolate',
+                            help='generate the .isolate files for a given'
+                                 'binary')
+    AddCommonOptions(subp)
+    subp.add_argument('path', nargs=1,
+                      help='path build was generated into')
+    subp.add_argument('target', nargs=1,
+                      help='ninja target to generate the isolate for')
+    subp.set_defaults(func=self.CmdIsolate)
+
     subp = subps.add_parser('lookup',
                             help='look up the command for a given config or '
                                  'builder')
     AddCommonOptions(subp)
     subp.set_defaults(func=self.CmdLookup)
 
+    subp = subps.add_parser('run',
+                            help='build and run the isolated version of a '
+                                 'binary')
+    AddCommonOptions(subp)
+    subp.add_argument('-j', '--jobs', dest='jobs', type=int,
+                      help='Number of jobs to pass to ninja')
+    subp.add_argument('--no-build', dest='build', default=True,
+                      action='store_false',
+                      help='Do not build, just isolate and run')
+    subp.add_argument('path', nargs=1,
+                      help='path to generate build into')
+    subp.add_argument('target', nargs=1,
+                      help='ninja target to build and run')
+    subp.set_defaults(func=self.CmdRun)
+
     subp = subps.add_parser('validate',
                             help='validate the config file')
     subp.add_argument('-f', '--config-file', metavar='PATH',
@@ -121,38 +143,20 @@
     self.args = parser.parse_args(argv)
 
   def CmdAnalyze(self):
-    vals = self.GetConfig()
+    vals = self.Lookup()
     if vals['type'] == 'gn':
       return self.RunGNAnalyze(vals)
-    elif vals['type'] == 'gyp':
-      return self.RunGYPAnalyze(vals)
     else:
-      raise MBErr('Unknown meta-build type "%s"' % vals['type'])
+      return self.RunGYPAnalyze(vals)
 
   def CmdGen(self):
-    vals = self.GetConfig()
-
+    vals = self.Lookup()
     self.ClobberIfNeeded(vals)
 
     if vals['type'] == 'gn':
       return self.RunGNGen(vals)
-    if vals['type'] == 'gyp':
-      return self.RunGYPGen(vals)
-
-    raise MBErr('Unknown meta-build type "%s"' % vals['type'])
-
-  def CmdLookup(self):
-    vals = self.GetConfig()
-    if vals['type'] == 'gn':
-      cmd = self.GNCmd('gen', '_path_', vals['gn_args'])
-      env = None
-    elif vals['type'] == 'gyp':
-      cmd, env = self.GYPCmd('_path_', vals)
     else:
-      raise MBErr('Unknown meta-build type "%s"' % vals['type'])
-
-    self.PrintCmd(cmd, env)
-    return 0
+      return self.RunGYPGen(vals)
 
   def CmdHelp(self):
     if self.args.subcommand:
@@ -160,6 +164,58 @@
     else:
       self.ParseArgs(['--help'])
 
+  def CmdIsolate(self):
+    vals = self.GetConfig()
+    if not vals:
+      return 1
+
+    if vals['type'] == 'gn':
+      return self.RunGNIsolate(vals)
+    else:
+      return self.Build('%s_run' % self.args.target[0])
+
+  def CmdLookup(self):
+    vals = self.Lookup()
+    if vals['type'] == 'gn':
+      cmd = self.GNCmd('gen', '_path_', vals['gn_args'])
+      env = None
+    else:
+      cmd, env = self.GYPCmd('_path_', vals)
+
+    self.PrintCmd(cmd, env)
+    return 0
+
+  def CmdRun(self):
+    vals = self.GetConfig()
+    if not vals:
+      return 1
+
+    build_dir = self.args.path[0]
+    target = self.args.target[0]
+
+    if vals['type'] == 'gn':
+      if self.args.build:
+        ret = self.Build(target)
+        if ret:
+          return ret
+      ret = self.RunGNIsolate(vals)
+      if ret:
+        return ret
+    else:
+      ret = self.Build('%s_run' % target)
+      if ret:
+        return ret
+
+    ret, _, _ = self.Run([
+        self.executable,
+        self.PathJoin('tools', 'swarming_client', 'isolate.py'),
+        'run',
+        '-s',
+        self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target))],
+        force_verbose=False, buffer_output=False)
+
+    return ret
+
   def CmdValidate(self):
     errs = []
 
@@ -234,13 +290,75 @@
     return 0
 
   def GetConfig(self):
+    build_dir = self.args.path[0]
+
+    vals = {}
+    if self.args.builder or self.args.master or self.args.config:
+      vals = self.Lookup()
+      if vals['type'] == 'gn':
+        # Re-run gn gen in order to ensure the config is consistent with the
+        # build dir.
+        self.RunGNGen(vals)
+      return vals
+
+    # TODO: We can only get the config for GN build dirs, not GYP build dirs.
+    # GN stores the args that were used in args.gn in the build dir,
+    # but GYP doesn't store them anywhere. We should consider modifying
+    # gyp_chromium to record the arguments it runs with in a similar
+    # manner.
+
+    mb_type_path = self.PathJoin(self.ToAbsPath(build_dir), 'mb_type')
+    if not self.Exists(mb_type_path):
+      gn_args_path = self.PathJoin(self.ToAbsPath(build_dir), 'args.gn')
+      if not self.Exists(gn_args_path):
+        self.Print('Must either specify a path to an existing GN build dir '
+                   'or pass in a -m/-b pair or a -c flag to specify the '
+                   'configuration')
+        return {}
+      else:
+        mb_type = 'gn'
+    else:
+      mb_type = self.ReadFile(mb_type_path).strip()
+
+    if mb_type == 'gn':
+      vals = self.GNValsFromDir(build_dir)
+    else:
+      vals = {}
+    vals['type'] = mb_type
+
+    return vals
+
+  def GNValsFromDir(self, build_dir):
+    args_contents = self.ReadFile(
+        self.PathJoin(self.ToAbsPath(build_dir), 'args.gn'))
+    gn_args = []
+    for l in args_contents.splitlines():
+      fields = l.split(' ')
+      name = fields[0]
+      val = ' '.join(fields[2:])
+      gn_args.append('%s=%s' % (name, val))
+
+    return {
+      'gn_args': ' '.join(gn_args),
+      'type': 'gn',
+    }
+
+  def Lookup(self):
     self.ReadConfigFile()
     config = self.ConfigFromArgs()
     if not config in self.configs:
       raise MBErr('Config "%s" not found in %s' %
                   (config, self.args.config_file))
 
-    return self.FlattenConfig(config)
+    vals = self.FlattenConfig(config)
+
+    # Do some basic sanity checking on the config so that we
+    # don't have to do this in every caller.
+    assert 'type' in vals, 'No meta-build type specified in the config'
+    assert vals['type'] in ('gn', 'gyp'), (
+        'Unknown meta-build type "%s"' % vals['gn_args'])
+
+    return vals
 
   def ReadConfigFile(self):
     if not self.Exists(self.args.config_file):
@@ -353,12 +471,12 @@
     self.WriteFile(mb_type_path, new_mb_type)
 
   def RunGNGen(self, vals):
-    path = self.args.path[0]
+    build_dir = self.args.path[0]
 
-    cmd = self.GNCmd('gen', path, vals['gn_args'], extra_args=['--check'])
+    cmd = self.GNCmd('gen', build_dir, vals['gn_args'], extra_args=['--check'])
 
     swarming_targets = []
-    if self.args.swarming_targets_file:
+    if getattr(self.args, 'swarming_targets_file', None):
       # We need GN to generate the list of runtime dependencies for
       # the compile targets listed (one per line) in the file so
       # we can run them via swarming. We use ninja_to_gn.pyl to convert
@@ -374,10 +492,10 @@
                       (target, '//testing/buildbot/gn_isolate_map.pyl'))
         gn_labels.append(gn_isolate_map[target]['label'])
 
-      gn_runtime_deps_path = self.ToAbsPath(path, 'runtime_deps')
+      gn_runtime_deps_path = self.ToAbsPath(build_dir, 'runtime_deps')
 
       # Since GN hasn't run yet, the build directory may not even exist.
-      self.MaybeMakeDirectory(self.ToAbsPath(path))
+      self.MaybeMakeDirectory(self.ToAbsPath(build_dir))
 
       self.WriteFile(gn_runtime_deps_path, '\n'.join(gn_labels) + '\n')
       cmd.append('--runtime-deps-list-file=%s' % gn_runtime_deps_path)
@@ -401,10 +519,10 @@
       else:
         runtime_deps_target = target
       if self.platform == 'win32':
-        deps_path = self.ToAbsPath(path,
+        deps_path = self.ToAbsPath(build_dir,
                                    runtime_deps_target + '.exe.runtime_deps')
       else:
-        deps_path = self.ToAbsPath(path,
+        deps_path = self.ToAbsPath(build_dir,
                                    runtime_deps_target + '.runtime_deps')
       if not self.Exists(deps_path):
           raise MBErr('did not generate %s' % deps_path)
@@ -414,31 +532,66 @@
 
       runtime_deps = self.ReadFile(deps_path).splitlines()
 
-      isolate_path = self.ToAbsPath(path, target + '.isolate')
-      self.WriteFile(isolate_path,
-        pprint.pformat({
-          'variables': {
-            'command': command,
-            'files': sorted(runtime_deps + extra_files),
-          }
-        }) + '\n')
+      self.WriteIsolateFiles(build_dir, command, target, runtime_deps,
+                             extra_files)
 
-      self.WriteJSON(
-        {
-          'args': [
-            '--isolated',
-            self.ToSrcRelPath('%s%s%s.isolated' % (path, self.sep, target)),
-            '--isolate',
-            self.ToSrcRelPath('%s%s%s.isolate' % (path, self.sep, target)),
-          ],
-          'dir': self.chromium_src_dir,
-          'version': 1,
-        },
-        isolate_path + 'd.gen.json',
-      )
+    return 0
+
+  def RunGNIsolate(self, vals):
+    gn_isolate_map = ast.literal_eval(self.ReadFile(self.PathJoin(
+        self.chromium_src_dir, 'testing', 'buildbot', 'gn_isolate_map.pyl')))
+
+    build_dir = self.args.path[0]
+    target = self.args.target[0]
+    command, extra_files = self.GetIsolateCommand(target, vals, gn_isolate_map)
+
+    label = gn_isolate_map[target]['label']
+    ret, out, _ = self.Call(['gn', 'desc', build_dir, label, 'runtime_deps'])
+    if ret:
+      return ret
+
+    runtime_deps = out.splitlines()
+
+    self.WriteIsolateFiles(build_dir, command, target, runtime_deps,
+                           extra_files)
+
+    ret, _, _ = self.Run([
+        self.executable,
+        self.PathJoin('tools', 'swarming_client', 'isolate.py'),
+        'check',
+        '-i',
+        self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
+        '-s',
+        self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target))],
+        buffer_output=False)
 
     return ret
 
+  def WriteIsolateFiles(self, build_dir, command, target, runtime_deps,
+                        extra_files):
+    isolate_path = self.ToAbsPath(build_dir, target + '.isolate')
+    self.WriteFile(isolate_path,
+      pprint.pformat({
+        'variables': {
+          'command': command,
+          'files': sorted(runtime_deps + extra_files),
+        }
+      }) + '\n')
+
+    self.WriteJSON(
+      {
+        'args': [
+          '--isolated',
+          self.ToSrcRelPath('%s/%s.isolated' % (build_dir, target)),
+          '--isolate',
+          self.ToSrcRelPath('%s/%s.isolate' % (build_dir, target)),
+        ],
+        'dir': self.chromium_src_dir,
+        'version': 1,
+      },
+      isolate_path + 'd.gen.json',
+    )
+
   def GNCmd(self, subcommand, path, gn_args='', extra_args=None):
     if self.platform == 'linux2':
       subdir = 'linux64'
@@ -769,26 +922,43 @@
     # This function largely exists so it can be overridden for testing.
     print(*args, **kwargs)
 
-  def Run(self, cmd, env=None, force_verbose=True):
+  def Build(self, target):
+    build_dir = self.ToSrcRelPath(self.args.path[0])
+    ninja_cmd = ['ninja', '-C', build_dir]
+    if self.args.jobs:
+      ninja_cmd.extend(['-j', '%d' % self.args.jobs])
+    ninja_cmd.append(target)
+    ret, _, _ = self.Run(ninja_cmd, force_verbose=False, buffer_output=False)
+    return ret
+
+  def Run(self, cmd, env=None, force_verbose=True, buffer_output=True):
     # This function largely exists so it can be overridden for testing.
     if self.args.dryrun or self.args.verbose or force_verbose:
       self.PrintCmd(cmd, env)
     if self.args.dryrun:
       return 0, '', ''
 
-    ret, out, err = self.Call(cmd, env=env)
+    ret, out, err = self.Call(cmd, env=env, buffer_output=buffer_output)
     if self.args.verbose or force_verbose:
+      if ret:
+        self.Print('  -> returned %d' % ret)
       if out:
         self.Print(out, end='')
       if err:
         self.Print(err, end='', file=sys.stderr)
     return ret, out, err
 
-  def Call(self, cmd, env=None):
-    p = subprocess.Popen(cmd, shell=False, cwd=self.chromium_src_dir,
-                         stdout=subprocess.PIPE, stderr=subprocess.PIPE,
-                         env=env)
-    out, err = p.communicate()
+  def Call(self, cmd, env=None, buffer_output=True):
+    if buffer_output:
+      p = subprocess.Popen(cmd, shell=False, cwd=self.chromium_src_dir,
+                           stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+                           env=env)
+      out, err = p.communicate()
+    else:
+      p = subprocess.Popen(cmd, shell=False, cwd=self.chromium_src_dir,
+                           env=env)
+      p.wait()
+      out = err = ''
     return p.returncode, out, err
 
   def ExpandUser(self, path):
diff --git a/tools/mb/mb_config.pyl b/tools/mb/mb_config.pyl
index 6f5f459..36c6bc68 100644
--- a/tools/mb/mb_config.pyl
+++ b/tools/mb/mb_config.pyl
@@ -34,6 +34,7 @@
     'gn_debug_bot_minimal_symbols_x86': ['gn', 'debug_bot_minimal_symbols', 'x86'],
     'gn_debug_static_bot': ['gn', 'debug_static_bot'],
     'gn_linux_upload': ['gn_linux_upload', 'official', 'goma'],
+    'gn_official': ['gn', 'official'],
     'gn_official_goma': ['gn', 'official', 'goma'],
     'gn_release_bot': ['gn', 'release_bot'],
     'gn_release_bot_minimal_symbols': ['gn', 'release_bot_minimal_symbols'],
@@ -42,11 +43,9 @@
     'gn_release_trybot_x86': ['gn', 'release_trybot', 'x86'],
     'gyp_debug_bot': ['gyp', 'debug_bot'],
     'gyp_debug_bot_x86': ['gyp', 'debug_bot', 'x86'],
-    'gyp_official': ['gyp', 'official'],
     'gyp_official_goma': ['gyp', 'official', 'goma'],
     'gyp_official_goma_chromeos': ['gyp', 'official', 'goma', 'chromeos'],
     'gyp_official_goma_x86': ['gyp', 'official', 'goma', 'x86'],
-    'gyp_official_goma_minimal_symbols': ['gyp', 'official', 'goma', 'minimal_symbols'],
     'gyp_official_goma_minimal_symbols_android': ['gyp', 'official', 'goma', 'minimal_symbols', 'android'],
     'gyp_official_goma_minimal_symbols_android_arm64': ['gyp', 'official', 'goma', 'minimal_symbols', 'android', 'arm64'],
     'gyp_official_goma_minimal_symbols_x64': ['gyp', 'official', 'goma', 'minimal_symbols', 'x64'],
@@ -318,12 +317,12 @@
   # TODO(crbug.com/481692): Add in remaining bots on the waterfalls.
   'masters': {
     'chrome': {
-      'precise64': 'gyp_official',
+      'precise64': 'gn_official',
     },
     'chromium.chrome': {
       'Google Chrome Win': 'gyp_official_goma_minimal_symbols_x86',
       'Google Chrome Linux': 'gyp_official_goma_x86',
-      'Google Chrome Linux x64': 'gyp_official_goma',
+      'Google Chrome Linux x64': 'gn_official_goma',
       'Google Chrome Mac': 'gyp_official_goma',
       'Google Chrome ChromeOS': 'gyp_official_goma_chromeos',
     },
@@ -462,7 +461,24 @@
       'linux_perf_bisect_builder': 'gyp_official_goma',
       'mac_perf_bisect_builder': 'gyp_official_goma',
       'win_perf_bisect_builder': 'gyp_official_goma_minimal_symbols_x86',
-      'winx64_bisect_builder': 'gyp_official_goma_minimal_symbols',
+      'winx64_bisect_builder': 'gyp_official_goma_minimal_symbols_x64',
+      'linux_perf_bisect': 'gyp_official_goma',
+      'mac_10_9_perf_bisect': 'gyp_official_goma',
+      'mac_10_10_perf_bisect': 'gyp_official_goma',
+      'mac_retina_perf_bisect': 'gyp_official_goma',
+      'win_perf_bisect': 'gyp_official_goma_minimal_symbols_x86',
+      'win_x64_perf_bisect': 'gyp_official_goma_minimal_symbols_x64',
+      'winx64ati_perf_bisect': 'gyp_official_goma_minimal_symbols_x64',
+      'winx64nvidia_perf_bisect': 'gyp_official_goma_minimal_symbols_x64',
+      'winx64intel_perf_bisect': 'gyp_official_goma_minimal_symbols_x64',
+      'winx64_10_perf_bisect': 'gyp_official_goma_minimal_symbols_x64',
+      'win_xp_perf_bisect': 'gyp_official_goma_minimal_symbols_x86',
+      'win_8_perf_bisect': 'gyp_official_goma_minimal_symbols_x86',
+      'android_one_perf_bisect': 'gyp_official_goma_minimal_symbols_android',
+      'android_nexus5_perf_bisect': 'gyp_official_goma_minimal_symbols_android',
+      'android_nexus6_perf_bisect': 'gyp_official_goma_minimal_symbols_android',
+      'android_nexus7_perf_bisect': 'gyp_official_goma_minimal_symbols_android',
+      'android_nexus9_perf_bisect': 'gyp_official_goma_minimal_symbols_android_arm64',
     },
     'tryserver.chromium.win': {
       'win_chromium_gn_x64_dbg': 'gn_debug_bot_minimal_symbols',
diff --git a/tools/mb/mb_unittest.py b/tools/mb/mb_unittest.py
index 64f5312..23b3ee08 100755
--- a/tools/mb/mb_unittest.py
+++ b/tools/mb/mb_unittest.py
@@ -58,7 +58,7 @@
   def WriteFile(self, path, contents, force_verbose=False):
     self.files[path] = contents
 
-  def Call(self, cmd, env=None):
+  def Call(self, cmd, env=None, buffer_output=True):
     if env:
       self.cross_compile = env.get('GYP_CROSSCOMPILE')
     self.calls.append(cmd)
@@ -208,7 +208,8 @@
              }"""}
 
     mbw = self.fake_mbw(files)
-    mbw.Call = lambda cmd, env=None: (0, 'out/Default/foo_unittests\n', '')
+    mbw.Call = lambda cmd, env=None, buffer_output=True: (
+        0, 'out/Default/foo_unittests\n', '')
 
     self.check(['analyze', '-c', 'gn_debug', '//out/Default',
                 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0)
@@ -225,7 +226,8 @@
                "targets": ["all", "bar_unittests"]
              }"""}
     mbw = self.fake_mbw(files)
-    mbw.Call = lambda cmd, env=None: (0, 'out/Default/foo_unittests\n', '')
+    mbw.Call = lambda cmd, env=None, buffer_output=True: (
+        0, 'out/Default/foo_unittests\n', '')
     self.check(['analyze', '-c', 'gn_debug', '//out/Default',
                 '/tmp/in.json', '/tmp/out.json'], mbw=mbw, ret=0)
     out = json.loads(mbw.files['/tmp/out.json'])
@@ -271,7 +273,7 @@
 
   def test_gn_gen_fails(self):
     mbw = self.fake_mbw()
-    mbw.Call = lambda cmd, env=None: (1, '', '')
+    mbw.Call = lambda cmd, env=None, buffer_output=True: (1, '', '')
     self.check(['gen', '-c', 'gn_debug', '//out/Default'], mbw=mbw, ret=1)
 
   def test_gn_gen_swarming(self):
@@ -298,6 +300,47 @@
     self.assertIn('/fake_src/out/Default/base_unittests.isolated.gen.json',
                   mbw.files)
 
+  def test_gn_isolate(self):
+    files = {
+      '/fake_src/testing/buildbot/gn_isolate_map.pyl': (
+          "{'base_unittests': {"
+          "  'label': '//base:base_unittests',"
+          "  'type': 'raw',"
+          "  'args': [],"
+          "}}\n"
+      ),
+      '/fake_src/out/Default/base_unittests.runtime_deps': (
+          "base_unittests\n"
+      ),
+    }
+    self.check(['isolate', '-c', 'gn_debug', '//out/Default', 'base_unittests'],
+               files=files, ret=0)
+
+    # test running isolate on an existing build_dir
+    files['/fake_src/out/Default/args.gn'] = 'is_debug = True\n'
+    self.check(['isolate', '//out/Default', 'base_unittests'],
+               files=files, ret=0)
+
+    files['/fake_src/out/Default/mb_type'] = 'gn\n'
+    self.check(['isolate', '//out/Default', 'base_unittests'],
+               files=files, ret=0)
+
+  def test_gn_run(self):
+    files = {
+      '/fake_src/testing/buildbot/gn_isolate_map.pyl': (
+          "{'base_unittests': {"
+          "  'label': '//base:base_unittests',"
+          "  'type': 'raw',"
+          "  'args': [],"
+          "}}\n"
+      ),
+      '/fake_src/out/Default/base_unittests.runtime_deps': (
+          "base_unittests\n"
+      ),
+    }
+    self.check(['run', '-c', 'gn_debug', '//out/Default', 'base_unittests'],
+               files=files, ret=0)
+
   def test_gn_lookup(self):
     self.check(['lookup', '-c', 'gn_debug'], ret=0)
 
@@ -332,7 +375,7 @@
 
   def test_gyp_gen_fails(self):
     mbw = self.fake_mbw()
-    mbw.Call = lambda cmd, env=None: (1, '', '')
+    mbw.Call = lambda cmd, env=None, buffer_output=True: (1, '', '')
     self.check(['gen', '-c', 'gyp_rel_bot', '//out/Release'], mbw=mbw, ret=1)
 
   def test_gyp_lookup_goma_dir_expansion(self):
diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml
index 077d4b4..f58ffa9 100644
--- a/tools/metrics/actions/actions.xml
+++ b/tools/metrics/actions/actions.xml
@@ -8595,6 +8595,27 @@
   </description>
 </action>
 
+<action name="Notifications.Persistent.Clicked">
+  <owner>peter@chromium.org</owner>
+  <description>
+    Recorded when a persistent notification gets clicked on by the user.
+  </description>
+</action>
+
+<action name="Notifications.Persistent.Closed">
+  <owner>peter@chromium.org</owner>
+  <description>
+    Recorded when a persistent notification gets closed by the user. This does
+    not always mean that the user didn't click on the notification: both could
+    be counted if the website doesn't close the notification on click.
+  </description>
+</action>
+
+<action name="Notifications.Persistent.Shown">
+  <owner>peter@chromium.org</owner>
+  <description>Recorded when a persistent notification gets shown.</description>
+</action>
+
 <action name="Notifications.ShowMessageCenter">
   <owner>dewittj@chromium.org</owner>
   <description>
diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml
index 229413f1..bf2dd23d 100644
--- a/tools/metrics/histograms/histograms.xml
+++ b/tools/metrics/histograms/histograms.xml
@@ -2783,6 +2783,16 @@
   </summary>
 </histogram>
 
+<histogram name="Blink.XHR.setRequestHeader.HeaderValueCategoryInRFC7230"
+    enum="XMLHttpRequestHeaderValueCategoryInRFC7230">
+  <owner>hiroshige@chromium.org</owner>
+  <summary>
+    The count of XMLHttpRequest.setRequestHeader() calls where header values are
+    invalid/valid but affected by normalization/valid in RFC 7230.
+    https://crbug.com/455099.
+  </summary>
+</histogram>
+
 <histogram name="BlinkGC.CollectGarbage" units="milliseconds">
   <owner>haraken@chromium.org</owner>
   <summary>Duration of time taken to run Heap::collectGarbage().</summary>
@@ -4151,6 +4161,15 @@
   </summary>
 </histogram>
 
+<histogram name="Chromoting.Video.NetworkLatency" units="ms">
+  <owner>anandc@chromium.org</owner>
+  <owner>sergeyu@chromium.org</owner>
+  <summary>
+    Estimated network roundtrip latency calculated by subtracting total
+    processing time on host and client from the total roundtrip time.
+  </summary>
+</histogram>
+
 <histogram name="Chromoting.Video.PacketRate" units="packets/second">
   <owner>anandc@chromium.org</owner>
   <owner>sergeyu@chromium.org</owner>
@@ -17114,21 +17133,27 @@
 <histogram name="Media.AudioCapturerAudioGlitches" enum="AudioGlitchResult">
   <owner>grunell@chromium.org</owner>
   <summary>
-    Whether input audio glitches due to input audio read verifications that
-    missed dealine are detected. Sampled when a low-latency input audio stream
-    is destructed.
+    Whether there is input audio glitches due to dropped input audio data or
+    not. Sampled when a low-latency input audio stream is destructed.
+  </summary>
+</histogram>
+
+<histogram name="Media.AudioCapturerDroppedData" units="%">
+  <owner>grunell@chromium.org</owner>
+  <summary>
+    The percentage of input audio data that was dropped at the browser/renderer
+    boundary due to for example buffer overflow in the writer side buffer or in
+    the socket. Reported at the destruction of low-latency audio input stream.
   </summary>
 </histogram>
 
 <histogram name="Media.AudioCapturerMissedReadDeadline" units="%">
   <owner>grunell@chromium.org</owner>
   <summary>
-    The percentage of input audio read verifications that missed its realtime
-    deadline. The read verification ensures that data is not overwritten in the
-    shared ring buffer on the browser/renderer boundary before read by the other
-    side. Missing the deadline means that the reading side hasn't read data in
-    time and we had to drop audio input data. Reported at the destruction of
-    low-latency audio input stream.
+    The percentage of input audio data blocks that had to be buffered because
+    there was not room in the shared memory ring buffer on the browser/renderer
+    boundary. This happens if the reading side hasn't read data in time.
+    Reported at the destruction of low-latency audio input stream.
   </summary>
 </histogram>
 
@@ -17295,6 +17320,16 @@
   </summary>
 </histogram>
 
+<histogram name="Media.CrosBeamformingDeviceState"
+    enum="CrosBeamformingDeviceState">
+  <owner>ajm@chromium.org</owner>
+  <summary>
+    The state of the user selected virtual beamforming audio device on CrOS.
+    It's logged whenever the format of the audio input stream is queried, which
+    at least happens on stream startup, but could happen at other times as well.
+  </summary>
+</histogram>
+
 <histogram name="Media.DetectedAudioCodec" enum="FFmpegCodecs">
   <obsolete>
     Deprecated Sep 15 2015 in favor of Media.DetectedAudioCodecHash
@@ -17533,6 +17568,16 @@
   <summary>System code count using the Widevine key system.</summary>
 </histogram>
 
+<histogram name="Media.EME.Widevine.VideoCapability.HasEmptyRobustness"
+    enum="BooleanEmpty">
+  <owner>xhwang@chromium.org</owner>
+  <summary>
+    Whether the robustness level of any video capability in the supported
+    configuration passed into requestMediaKeySystemAccess() is empty. This is
+    specific to the Widevine key system.
+  </summary>
+</histogram>
+
 <histogram name="Media.FallbackHardwareAudioBitsPerChannel">
   <owner>dalecurtis@chromium.org</owner>
   <summary>
@@ -29836,6 +29881,16 @@
   </summary>
 </histogram>
 
+<histogram name="PageLoad.EventCounts" enum="PageLoadEvent">
+  <owner>csharrison@chromium.org</owner>
+  <owner>bmcquade@chromium.org</owner>
+  <summary>
+    Captures counts of various page load events. These are enumerated in the
+    enum page_load_metrics::PageLoadEvent, and include events like 'page load
+    aborted before first layout'
+  </summary>
+</histogram>
+
 <histogram name="PageLoad.Timing.NavigationToDOMContentLoadedEventFired"
     units="milliseconds">
   <owner>bmcquade@chromium.org</owner>
@@ -30444,6 +30499,19 @@
   </summary>
 </histogram>
 
+<histogram name="PasswordManager.SettingsReconciliation.InitialAndFinalValues"
+    enum="PasswordManagerPreferencesInitialAndFinalValues">
+  <owner>engedy@chromium.org</owner>
+  <owner>melandory@chromium.org</owner>
+  <summary>
+    Tracks the pair of initial values and pair of final values for the legacy
+    preference for controlling the Chrome Password Manager and the new
+    preference for controlling Smart Lock on Android. A single sample is
+    recorded after sync has merged last snaphot and finished initialization for
+    sync users, and on profile initialization for non-sync users.
+  </summary>
+</histogram>
+
 <histogram name="PasswordManager.SettingsReconciliation.InitialValues"
     enum="PasswordManagerPreferencesInitialValues">
   <owner>engedy@chromium.org</owner>
@@ -30786,7 +30854,8 @@
 
 <histogram name="Platform.DiskUsage.NumUserHomeDirectories"
     units="home directories">
-  <owner>Please list the metric's owners. Add more owner tags as needed.</owner>
+  <owner>achuith@chromium.org</owner>
+  <owner>tls@chromium.org</owner>
   <summary>
     Number of users home directories on the device. Logged once a day.
   </summary>
@@ -49120,6 +49189,28 @@
   </summary>
 </histogram>
 
+<histogram name="Viewport.DidScalePage" enum="BooleanDidScalePage">
+  <owner>bokan@chromium.org</owner>
+  <summary>
+    Tracks the proportion of non-mobile optimized (i.e. zoom disabled or layout
+    width matches viewport) page views that had a user-initiated page scale
+    (e.g. pinch-zoom, double-tap). Recorded on navigation to a new page - on
+    Android only.
+  </summary>
+</histogram>
+
+<histogram name="Viewport.MaxPageScale" enum="PageScaleFactorRange">
+  <owner>bokan@chromium.org</owner>
+  <summary>
+    Tracks the maximum scale factor that a user has scaled to over the lifetime
+    of the page. The scale is counted at pinch end (e.g. zooming to 300% and
+    back out to 150% in one gesture would count as 150%). Reported only on
+    non-mobile optimized pages (i.e. zoom disabled or layout width matches
+    viewport) which have had a page scale changing gesture. Recorded on
+    navigation to a new page - on Android only.
+  </summary>
+</histogram>
+
 <histogram name="Viewport.MetaTagType" enum="MetaTagTypeEnum">
   <owner>bokan@chromium.org</owner>
   <summary>
@@ -52939,11 +53030,21 @@
   <int value="1" label="Did fall back"/>
 </enum>
 
+<enum name="BooleanDidScalePage" type="int">
+  <int value="0" label="User did not change scale"/>
+  <int value="1" label="User did change scale"/>
+</enum>
+
 <enum name="BooleanDuplicate" type="int">
   <int value="0" label="Not Duplicate"/>
   <int value="1" label="Duplicate"/>
 </enum>
 
+<enum name="BooleanEmpty" type="int">
+  <int value="0" label="Not Empty"/>
+  <int value="1" label="Empty"/>
+</enum>
+
 <enum name="BooleanEnabled" type="int">
   <int value="0" label="Disabled"/>
   <int value="1" label="Enabled"/>
@@ -53264,6 +53365,7 @@
 <enum name="BubbleType" type="int">
   <int value="0" label="Unknown Bubble"/>
   <int value="1" label="Mock Bubble"/>
+  <int value="10" label="Extension Installed Bubble"/>
 </enum>
 
 <enum name="CacheResult" type="int">
@@ -54268,6 +54370,13 @@
   <int value="2147483646" label="STATUS_DATATYPE_MISALIGNMENT"/>
 </enum>
 
+<enum name="CrosBeamformingDeviceState" type="int">
+  <int value="0" label="Default enabled"/>
+  <int value="1" label="User enabled"/>
+  <int value="2" label="Default disabled"/>
+  <int value="3" label="User disabled"/>
+</enum>
+
 <enum name="CrosDisksArchiveType" type="int">
   <int value="0" label="Unknown"/>
   <int value="1" label="ZIP"/>
@@ -58177,6 +58286,7 @@
   <int value="1088" label="EASYUNLOCKPRIVATE_SETUPCONNECTIONSEND"/>
   <int value="1089" label="DATAREDUCTIONPROXY_GETDATAUSAGE"/>
   <int value="1090" label="EASYUNLOCKPRIVATE_SETUPCONNECTIONGETDEVICEADDRESS"/>
+  <int value="1091" label="TABCAPTURE_CAPTUREOFFSCREENTAB"/>
 </enum>
 
 <enum name="ExtensionInstallCause" type="int">
@@ -59714,11 +59824,11 @@
   <int value="929" label="PresentationRequestStart"/>
   <int value="930" label="PresentationRequestReconnect"/>
   <int value="931" label="PresentationRequestGetAvailability"/>
-  <int value="932" label="PresentationRequestSessionConnectEventListener"/>
-  <int value="933" label="PresentationSessionClose"/>
-  <int value="934" label="PresentationSessionSend"/>
-  <int value="935" label="PresentationSessionStateChangeEventListener"/>
-  <int value="936" label="PresentationSessionMessageEventListener"/>
+  <int value="932" label="PresentationRequestConnectionAvailableEventListener"/>
+  <int value="933" label="PresentationConnectionClose"/>
+  <int value="934" label="PresentationConnectionSend"/>
+  <int value="935" label="PresentationConnectionStateChangeEventListener"/>
+  <int value="936" label="PresentationConnectionMessageEventListener"/>
   <int value="937" label="CSSAnimationsStackedNeutralKeyframe"/>
   <int value="938" label="ReadingCheckedInClickHandler"/>
   <int value="939" label="FlexboxIntrinsicSizeAlgorithmIsDifferent"/>
@@ -63539,6 +63649,7 @@
       label="enable-search-button-in-omnibox-for-str-or-iip"/>
   <int value="-1998927516" label="enable-md-settings"/>
   <int value="-1985025593" label="file-manager-enable-new-gallery"/>
+  <int value="-1980328793" label="trace-upload-url"/>
   <int value="-1972383451" label="disable-pinch"/>
   <int value="-1963402827" label="enable-topchrome-md"/>
   <int value="-1946595906" label="enable-push-api-background-mode"/>
@@ -63627,6 +63738,7 @@
   <int value="-1327676774" label="disable-accelerated-mjpeg-decode"/>
   <int value="-1322882747" label="disable-datasaver-prompt"/>
   <int value="-1319688939" label="ignore-gpu-blacklist"/>
+  <int value="-1302904242" label="enable-navigation-tracing"/>
   <int value="-1285021473" label="save-page-as-mhtml"/>
   <int value="-1268836676" label="disable-out-of-process-pdf"/>
   <int value="-1267958145" label="disable-pdf-material-ui"/>
@@ -66724,6 +66836,39 @@
   <int value="4" label="Index"/>
 </enum>
 
+<enum name="PageLoadEvent" type="int">
+  <int value="0" label="Started main frame load"/>
+  <int value="1" label="Failed load before commit"/>
+  <int value="2" label="Aborted load before commit"/>
+  <int value="3" label="Aborted load before first layout"/>
+  <int value="4" label="Successful first layout (foreground)"/>
+  <int value="5" label="Successful first layout (backgrounded)"/>
+</enum>
+
+<enum name="PageScaleFactorRange" type="int">
+  <int value="0" label="&lt;25%"/>
+  <int value="1" label="25-49%"/>
+  <int value="2" label="50-74%"/>
+  <int value="3" label="75-99%"/>
+  <int value="4" label="100-124%"/>
+  <int value="5" label="125-149%"/>
+  <int value="6" label="150-174%"/>
+  <int value="7" label="175-199%"/>
+  <int value="8" label="200-224%"/>
+  <int value="9" label="225-249%"/>
+  <int value="10" label="250-274%"/>
+  <int value="11" label="275-299%"/>
+  <int value="12" label="300-324%"/>
+  <int value="13" label="325-349%"/>
+  <int value="14" label="350-374%"/>
+  <int value="15" label="375-399%"/>
+  <int value="16" label="400-424%"/>
+  <int value="17" label="425-449%"/>
+  <int value="18" label="450-474%"/>
+  <int value="19" label="475-499%"/>
+  <int value="20" label="&gt;=500%"/>
+</enum>
+
 <enum name="PagespeedHeaderServerType" type="int">
   <int value="0" label="Total responses"/>
   <int value="1" label="mod_pagespeed server"/>
@@ -67354,6 +67499,47 @@
       label="Password status not checked as user is on a Windows Domain"/>
 </enum>
 
+<enum name="PasswordManagerPreferencesInitialAndFinalValues" type="int">
+  <summary>
+    The pair of initial values and the pair of final values for the legacy
+    preference for controlling the Chrome Password Manager and new preference
+    for controlling Smart Lock on Android. In the values label N means new pref
+    value, L meand legacy pref value.
+  </summary>
+  <int value="0"
+      label="Initial state: N='off', L='off' Final state: N='off', L='off'"/>
+  <int value="1"
+      label="Initial state: N='off', L='off' Final state: N='off', L='on'"/>
+  <int value="2"
+      label="Initial state: N='off', L='off' Final state: N='on', L='off'"/>
+  <int value="3"
+      label="Initial state: N='off', L='off' Final state: N='on', L='on'"/>
+  <int value="4"
+      label="Initial state: N='off', L='on' Final state: N='off', L='off'"/>
+  <int value="5"
+      label="Initial state: N='off', L='on' Final state: N='off', L='on'"/>
+  <int value="6"
+      label="Initial state: N='off', L='on' Final state: N='on', L='off'"/>
+  <int value="7"
+      label="Initial state: N='off', L='on' Final state: N='on', L='on'"/>
+  <int value="8"
+      label="Initial state: N='on', L='off' Final state: N='off', L='off'"/>
+  <int value="9"
+      label="Initial state: N='on', L='off' Final state: N='off', L='on'"/>
+  <int value="10"
+      label="Initial state: N='on', L='off' Final state: N='on', L='off'"/>
+  <int value="11"
+      label="Initial state: N='on', L='off' Final state: N='on', L='on'"/>
+  <int value="12"
+      label="Initial state: N='on', L='on' Final state: N='off', L='off'"/>
+  <int value="13"
+      label="Initial state: N='on', L='on' Final state: N='off', L='on'"/>
+  <int value="14"
+      label="Initial state: N='on', L='on' Final state: N='on', L='off'"/>
+  <int value="15"
+      label="Initial state: N='on', L='on' Final state: N='on', L='on'"/>
+</enum>
+
 <enum name="PasswordManagerPreferencesInitialValues" type="int">
   <summary>
     The pair of initial values for the legacy preference for controlling the
@@ -74213,6 +74399,12 @@
   <int value="43" label="Exit"/>
 </enum>
 
+<enum name="XMLHttpRequestHeaderValueCategoryInRFC7230" type="int">
+  <int value="0" label="Header Value Invalid"/>
+  <int value="1" label="Header Value Affected By Normalization"/>
+  <int value="2" label="Header Value Valid"/>
+</enum>
+
 <enum name="XMLHttpRequestSendArrayBufferOrView" type="int">
   <int value="0" label="XMLHttpRequestSendArrayBuffer"/>
   <int value="1" label="XMLHttpRequestSendArrayBufferView"/>
diff --git a/tools/perf/benchmarks/memory_benchmark.py b/tools/perf/benchmarks/memory_benchmark.py
index 356dc9b2..4ee6801 100644
--- a/tools/perf/benchmarks/memory_benchmark.py
+++ b/tools/perf/benchmarks/memory_benchmark.py
@@ -35,8 +35,6 @@
 class MemoryHealthPlan(_MemoryBenchmark):
   """Timeline based benchmark for the Memory Health Plan."""
 
-  _RE_BENCHMARK_VALUES = re.compile('(fore|back)ground-memory_')
-
   page_set = page_sets.MemoryHealthStory
 
   @classmethod
@@ -46,8 +44,9 @@
   @classmethod
   def ValueCanBeAddedPredicate(cls, value, is_first_result):
     # TODO(perezju): Do not ignore baidu failures http://crbug.com/538143
-    return (bool(cls._RE_BENCHMARK_VALUES.match(value.name)) and
-            not ('baidu' in value.page.name and value.values is None))
+    return (value.tir_label in ['foreground', 'background']
+            and value.name.startswith('memory_')
+            and not ('baidu' in value.page.name and value.values is None))
 
 
 # TODO(bashi): Workaround for http://crbug.com/532075
@@ -57,7 +56,7 @@
   """Timeline based benchmark for measuring memory consumption on mobile
   sites on which blink's memory consumption is relatively high."""
 
-  _RE_RENDERER_VALUES = re.compile('.+-memory_.+_renderer')
+  _RE_RENDERER_VALUES = re.compile('memory_.+_renderer')
 
   page_set = page_sets.BlinkMemoryMobilePageSet
 
diff --git a/tools/perf/benchmarks/session_restore.py b/tools/perf/benchmarks/session_restore.py
index c5dd5b5..8187e94 100644
--- a/tools/perf/benchmarks/session_restore.py
+++ b/tools/perf/benchmarks/session_restore.py
@@ -61,8 +61,7 @@
     is_cold = (self.tag == 'cold')
     return session_restore.SessionRestore(cold=is_cold)
 
-# crbug.com/325479, crbug.com/381990, crbug.com/511273
-@benchmark.Disabled('android', 'linux', 'reference')
+@benchmark.Disabled('android')
 class SessionRestoreColdTypical25(_SessionRestoreTypical25):
   """Test by clearing system cache and profile before repeats."""
   tag = 'cold'
@@ -73,8 +72,7 @@
     return 'session_restore.cold.typical_25'
 
 
-# crbug.com/325479, crbug.com/381990, crbug.com/511273
-@benchmark.Disabled('android', 'linux', 'reference', 'xp')
+@benchmark.Disabled('android')
 class SessionRestoreWarmTypical25(_SessionRestoreTypical25):
   """Test without clearing system cache or profile before repeats.
 
diff --git a/tools/telemetry/telemetry/internal/bin/README.md b/tools/telemetry/telemetry/internal/bin/README.md
new file mode 100644
index 0000000..eb42425
--- /dev/null
+++ b/tools/telemetry/telemetry/internal/bin/README.md
@@ -0,0 +1,8 @@
+<!-- Copyright 2015 The Chromium Authors. All rights reserved.
+     Use of this source code is governed by a BSD-style license that can be
+     found in the LICENSE file.
+-->
+Do not check files into this folder.
+____________________________________
+Files are downloaded to this folder from cloud storage by the BinaryManager,
+and any local files may be overwritten without warning.
diff --git a/tools/telemetry/telemetry/internal/util/global_hooks.py b/tools/telemetry/telemetry/internal/util/global_hooks.py
index b1541e9..8fe80d0 100644
--- a/tools/telemetry/telemetry/internal/util/global_hooks.py
+++ b/tools/telemetry/telemetry/internal/util/global_hooks.py
@@ -3,9 +3,11 @@
 # found in the LICENSE file.
 
 """Hooks that apply globally to all scripts that import or use Telemetry."""
-
+import atexit
+import os
 import signal
 import sys
+import logging
 
 from telemetry.internal.util import exception_formatter
 
@@ -14,7 +16,7 @@
   InstallUnhandledExceptionFormatter()
   InstallStackDumpOnSigusr1()
   InstallTerminationHook()
-
+  InstallListStrayProcessesUponExitHook()
 
 def InstallUnhandledExceptionFormatter():
   """Print prettier exceptions that also contain the stack frame's locals."""
@@ -40,3 +42,33 @@
     exception_formatter.PrintFormattedFrame(stack_frame, exception_string)
     sys.exit(-1)
   signal.signal(signal.SIGTERM, PrintStackAndExit)
+
+
+def InstallListStrayProcessesUponExitHook():
+  def _ListAllSubprocesses():
+    try:
+      import psutil
+    except ImportError:
+      logging.error(
+          'psutil is not installed on the system. Not listing possible '
+          'leaked processes. To install psutil, see: '
+          'https://pypi.python.org/pypi/psutil')
+    telemetry_pid = os.getpid()
+    parent = psutil.Process(telemetry_pid)
+    if hasattr(parent, 'children'):
+      children = parent.children(recursive=True)
+    else:  # Some old version of psutil use get_children instead children.
+      children = parent.get_children()
+    if children:
+      leak_processes_info = []
+      for p in children:
+        process_info = '%s (%s)' % (p.name(), p.pid)
+        try:
+          process_info += ' - %s' % p.cmdline()
+        except Exception:
+          pass
+        leak_processes_info.append(process_info)
+      logging.error('Telemetry leaks these processes: %s',
+                    ', '.join(leak_processes_info))
+
+  atexit.register(_ListAllSubprocesses)
diff --git a/tools/telemetry/telemetry/page/shared_page_state.py b/tools/telemetry/telemetry/page/shared_page_state.py
index bd879b1..d087d092 100644
--- a/tools/telemetry/telemetry/page/shared_page_state.py
+++ b/tools/telemetry/telemetry/page/shared_page_state.py
@@ -166,6 +166,8 @@
     self._possible_browser.SetCredentialsPath(page.credentials_path)
 
     self._test.WillStartBrowser(self.platform)
+    if page.startup_url:
+      self._finder_options.browser_options.startup_url = page.startup_url
     self._browser = self._possible_browser.Create(self._finder_options)
     self._test.DidStartBrowser(self.browser)
 
diff --git a/tools/telemetry/telemetry/page/shared_page_state_unittest.py b/tools/telemetry/telemetry/page/shared_page_state_unittest.py
index d72f4ad..dc64a2c 100644
--- a/tools/telemetry/telemetry/page/shared_page_state_unittest.py
+++ b/tools/telemetry/telemetry/page/shared_page_state_unittest.py
@@ -10,9 +10,12 @@
 from telemetry.page import page_test
 from telemetry.page import shared_page_state
 from telemetry import story as story_module
+from telemetry.testing import fakes
 from telemetry.testing import options_for_unittests
 from telemetry.util import wpr_modes
 
+import mock
+
 
 def SetUpPageRunnerArguments(options):
   parser = options.CreateParser()
@@ -44,6 +47,13 @@
     SetUpPageRunnerArguments(self.options)
     self.options.output_formats = ['none']
     self.options.suppress_gtest_report = True
+    self.patcher = mock.patch(
+        'telemetry.page.shared_page_state.browser_finder.FindBrowser')
+    find_browser_mock = self.patcher.start()
+    find_browser_mock.return_value = fakes.FakePossibleBrowser()
+
+  def tearDown(self):
+    mock.patch.stopall()
 
   # pylint: disable=W0212
   def TestUseLiveSitesFlag(self, expected_wpr_mode):
@@ -92,3 +102,29 @@
         shared_page_state.Shared10InchTabletPageState, 'tablet_10_inch')
     self.assertUserAgentSetCorrectly(
         shared_page_state.SharedPageState, None)
+
+  def testBrowserStartupURLSetCorrectly(self):
+    story_set = story_module.StorySet()
+    google_page = page.Page(
+        'http://www.google.com',
+        startup_url='http://www.google.com', page_set=story_set)
+    example_page = page.Page(
+        'https://www.example.com',
+        startup_url='https://www.example.com', page_set=story_set)
+    gmail_page = page.Page(
+        'https://www.gmail.com',
+        startup_url='https://www.gmail.com', page_set=story_set)
+
+    for p in (google_page, example_page, gmail_page):
+      story_set.AddStory(p)
+
+    mock_finder_options = mock.Mock()
+    mock_finder_options.profiler = None
+
+    shared_state = shared_page_state.SharedPageState(
+        DummyTest(), mock_finder_options, story_set)
+
+    for p in (google_page, example_page, gmail_page):
+      shared_state.WillRunStory(p)
+      self.assertEquals(
+        p.startup_url, mock_finder_options.browser_options.startup_url)
diff --git a/tools/telemetry/telemetry/testing/fakes/__init__.py b/tools/telemetry/telemetry/testing/fakes/__init__.py
index 572ec0e..7eecc43 100644
--- a/tools/telemetry/telemetry/testing/fakes/__init__.py
+++ b/tools/telemetry/telemetry/testing/fakes/__init__.py
@@ -78,6 +78,9 @@
 class FakePossibleBrowser(object):
   def __init__(self):
     self._returned_browser = _FakeBrowser(FakeLinuxPlatform())
+    self.browser_type = 'linux'
+    self.supports_tab_control = False
+    self.is_remote = False
 
   @property
   def returned_browser(self):
@@ -96,6 +99,9 @@
     """
     return self.returned_browser.platform
 
+  def IsRemote(self):
+    return self.is_remote
+
   def SetCredentialsPath(self, _):
     pass
 
diff --git a/tools/telemetry/telemetry/testing/run_chromeos_tests.py b/tools/telemetry/telemetry/testing/run_chromeos_tests.py
index 47c902a..ff331ed 100644
--- a/tools/telemetry/telemetry/testing/run_chromeos_tests.py
+++ b/tools/telemetry/telemetry/testing/run_chromeos_tests.py
@@ -8,29 +8,42 @@
 from telemetry.testing import run_tests
 
 
-def RunTestsForChromeOS(browser_type, unit_tests, perf_tests):
+def RunChromeOSTests(browser_type, tests_to_run):
+  """ Run ChromeOS tests.
+  Args:
+    |browser_type|: string specifies which browser type to use.
+    |tests_to_run|: a list of tuples (top_level_dir, unit_tests), whereas
+      |top_level_dir| specifies the top level directory for running tests, and
+      |unit_tests| is a list of string test names to run.
+  """
   stream = _LoggingOutputStream()
   error_string = ''
 
-  if unit_tests:
-    logging.info('Running telemetry unit tests with browser_type "%s".' %
-                browser_type)
-    ret = _RunOneSetOfTests(browser_type, 'telemetry', unit_tests, stream)
-    if ret:
-      error_string += 'The unit tests failed.\n'
+  for (top_level_dir, unit_tests) in tests_to_run:
+    logging.info('Running unit tests in %s with browser_type "%s".' %
+                 (top_level_dir, browser_type))
 
-  if perf_tests:
-    logging.info('Running telemetry perf tests with browser_type "%s".' %
-                browser_type)
-    ret = _RunOneSetOfTests(browser_type, 'perf', perf_tests, stream)
+    ret = _RunOneSetOfTests(browser_type, top_level_dir, unit_tests, stream)
     if ret:
-      error_string = 'The perf tests failed.\n'
-
+      error_string += 'The unit tests of %s failed.\n' % top_level_dir
   return error_string
 
 
-def _RunOneSetOfTests(browser_type, dir_name, tests, stream):
-  top_level_dir = os.path.join(util.GetChromiumSrcDir(), 'tools', dir_name)
+# TODO(nednguyen): Remove this API after cros team has migrated to use
+# RunChromeOSTests.
+def RunTestsForChromeOS(browser_type, unit_tests, perf_tests):
+  tests_to_run = []
+  chromium_src_dir = util.GetChromiumSrcDir()
+  if unit_tests:
+    tests_to_run.append(
+      (os.path.join(chromium_src_dir, 'tools', 'telemetry'), unit_tests))
+  if perf_tests:
+    tests_to_run.append(
+      (os.path.join(chromium_src_dir, 'tools', 'perf'), perf_tests))
+  return RunChromeOSTests(browser_type, tests_to_run)
+
+
+def _RunOneSetOfTests(browser_type, top_level_dir, tests, stream):
   args = ['--browser', browser_type,
           '--top-level-dir', top_level_dir,
           '--jobs', '1'] + tests
diff --git a/ui/android/java/src/org/chromium/ui/base/ActivityWindowAndroid.java b/ui/android/java/src/org/chromium/ui/base/ActivityWindowAndroid.java
index 80a2b8e..f0d697e 100644
--- a/ui/android/java/src/org/chromium/ui/base/ActivityWindowAndroid.java
+++ b/ui/android/java/src/org/chromium/ui/base/ActivityWindowAndroid.java
@@ -185,8 +185,7 @@
         Activity activity = mActivityRef.get();
         if (activity == null) return false;
 
-        if (activity.getPackageManager().isPermissionRevokedByPolicy(
-                permission, activity.getPackageName())) {
+        if (isPermissionRevokedByPolicy(permission)) {
             return false;
         }
 
@@ -204,6 +203,17 @@
     }
 
     @Override
+    public boolean isPermissionRevokedByPolicy(String permission) {
+        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) return false;
+
+        Activity activity = mActivityRef.get();
+        if (activity == null) return false;
+
+        return activity.getPackageManager().isPermissionRevokedByPolicy(
+                permission, activity.getPackageName());
+    }
+
+    @Override
     public void requestPermissions(
             final String[] permissions, final PermissionCallback callback) {
         if (requestPermissionsInternal(permissions, callback)) return;
diff --git a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
index 9fc14f4..4b28ba4 100644
--- a/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
+++ b/ui/android/java/src/org/chromium/ui/base/WindowAndroid.java
@@ -250,6 +250,20 @@
     }
 
     /**
+     * Determine whether the specified permission is revoked by policy.
+     *
+     * @param permission The permission name.
+     * @return Whether the permission is revoked by policy and the user has no ability to change it.
+     */
+    public boolean isPermissionRevokedByPolicy(String permission) {
+        Log.w(TAG, "Cannot determine the policy permission state as the context "
+                + "is not an Activity");
+        assert false : "Failed to determine the policy permission state using a WindowAndroid "
+                + "without an Activity";
+        return false;
+    }
+
+    /**
      * Requests the specified permissions are granted for further use.
      * @param permissions The list of permissions to request access to.
      * @param callback The callback to be notified whether the permissions were granted.
diff --git a/ui/display/util/edid_parser.cc b/ui/display/util/edid_parser.cc
index 2156c73..097cc1e 100644
--- a/ui/display/util/edid_parser.cc
+++ b/ui/display/util/edid_parser.cc
@@ -97,11 +97,10 @@
       return false;
     }
 
+    // ICC filename is generated based on these ids. We always read this as big
+    // endian so that the file name matches bytes 8-11 as they appear in EDID.
     *manufacturer_id =
-        *reinterpret_cast<const uint16_t*>(&edid[kManufacturerOffset]);
-#if defined(ARCH_CPU_LITTLE_ENDIAN)
-    *manufacturer_id = base::ByteSwap(*manufacturer_id);
-#endif
+        (edid[kManufacturerOffset] << 8) + edid[kManufacturerOffset + 1];
   }
 
   if (product_code) {
@@ -111,7 +110,7 @@
     }
 
     *product_code =
-        *reinterpret_cast<const uint16_t*>(&edid[kProductCodeOffset]);
+        (edid[kProductCodeOffset] << 8) + edid[kProductCodeOffset + 1];
   }
 
   if (human_readable_name)
diff --git a/ui/display/util/edid_parser_unittest.cc b/ui/display/util/edid_parser_unittest.cc
index 2e77cac..fb468539 100644
--- a/ui/display/util/edid_parser_unittest.cc
+++ b/ui/display/util/edid_parser_unittest.cc
@@ -161,7 +161,7 @@
   EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
                                     &human_readable_name, &pixel, &size));
   EXPECT_EQ(0x22f0u, manufacturer_id);
-  EXPECT_EQ(0x286cu, product_code);
+  EXPECT_EQ(0x6c28u, product_code);
   EXPECT_EQ("HP ZR30w", human_readable_name);
   EXPECT_EQ("2560x1600", pixel.ToString());
   EXPECT_EQ("641x400", size.ToString());
@@ -175,7 +175,7 @@
   EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
                                     nullptr, &pixel, &size));
   EXPECT_EQ(0x4ca3u, manufacturer_id);
-  EXPECT_EQ(0x3142u, product_code);
+  EXPECT_EQ(0x4231u, product_code);
   EXPECT_EQ("", human_readable_name);
   EXPECT_EQ("1280x800", pixel.ToString());
   EXPECT_EQ("261x163", size.ToString());
@@ -193,7 +193,7 @@
   EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
                                     &human_readable_name, &pixel, &size));
   EXPECT_EQ(0x4c2du, manufacturer_id);
-  EXPECT_EQ(0x08feu, product_code);
+  EXPECT_EQ(0xfe08u, product_code);
   EXPECT_EQ("SAMSUNG", human_readable_name);
   EXPECT_EQ("1920x1080", pixel.ToString());
   EXPECT_EQ("160x90", size.ToString());
@@ -227,7 +227,7 @@
   EXPECT_TRUE(ParseOutputDeviceData(edid, &manufacturer_id, &product_code,
                                     nullptr, &dummy, &dummy));
   EXPECT_EQ(0x22f0u, manufacturer_id);
-  EXPECT_EQ(0x286cu, product_code);
+  EXPECT_EQ(0x6c28u, product_code);
 }
 
 TEST(EDIDParserTest, GetDisplayId) {
@@ -243,8 +243,8 @@
   EXPECT_EQ(id1, id2);
   // The product code in the two EDIDs varies.
   EXPECT_NE(product_id1, product_id2);
-  EXPECT_EQ(0x22f02676, product_id1);
-  EXPECT_EQ(0x22f02675, product_id2);
+  EXPECT_EQ(0x22f07626, product_id1);
+  EXPECT_EQ(0x22f07526, product_id2);
   EXPECT_NE(-1, id1);
   EXPECT_NE(-1, product_id1);
 }
diff --git a/ui/events/events.gyp b/ui/events/events.gyp
index 128f08c..3bd849e 100644
--- a/ui/events/events.gyp
+++ b/ui/events/events.gyp
@@ -493,6 +493,25 @@
           'includes': [ '../../build/apk_test.gypi' ],
         },
       ],
+      'conditions': [
+        ['test_isolation_mode != "noop"', {
+          'targets': [
+            {
+              'target_name': 'events_unittests_apk_run',
+              'type': 'none',
+              'dependencies': [
+                'events_unittests_apk',
+              ],
+              'includes': [
+                '../../build/isolate.gypi',
+              ],
+              'sources': [
+                'events_unittests_apk.isolate',
+              ],
+            },
+          ],
+        }],
+      ],
     }],
     ['test_isolation_mode != "noop"', {
       'targets': [
diff --git a/ui/events/events_unittests_apk.isolate b/ui/events/events_unittests_apk.isolate
new file mode 100644
index 0000000..c45db50f
--- /dev/null
+++ b/ui/events/events_unittests_apk.isolate
@@ -0,0 +1,17 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+{
+  'includes': [
+    '../../build/android/android.isolate',
+  ],
+  'variables': {
+    'command': [
+      '<(PRODUCT_DIR)/bin/run_events_unittests',
+    ],
+    'files': [
+      '<(PRODUCT_DIR)/bin/run_events_unittests',
+      '<(PRODUCT_DIR)/events_unittests_apk/',
+    ]
+  },
+}
diff --git a/ui/events/gesture_detection/gesture_configuration.cc b/ui/events/gesture_detection/gesture_configuration.cc
index e15ef14..0894cfc 100644
--- a/ui/events/gesture_detection/gesture_configuration.cc
+++ b/ui/events/gesture_detection/gesture_configuration.cc
@@ -32,6 +32,7 @@
       fling_touchscreen_tap_suppression_enabled_(false),
       fling_max_cancel_to_down_time_in_ms_(400),
       fling_max_tap_gap_time_in_ms_(200),
+      stylus_scale_enabled_(false),
       gesture_begin_end_types_enabled_(false),
       long_press_time_in_ms_(1000),
       max_distance_between_taps_for_double_tap_(20),
diff --git a/ui/events/gesture_detection/gesture_configuration.h b/ui/events/gesture_detection/gesture_configuration.h
index c530d94..3fc7cca 100644
--- a/ui/events/gesture_detection/gesture_configuration.h
+++ b/ui/events/gesture_detection/gesture_configuration.h
@@ -52,6 +52,10 @@
   void set_fling_max_tap_gap_time_in_ms(int val) {
     fling_max_tap_gap_time_in_ms_ = val;
   }
+  bool stylus_scale_enabled() const { return stylus_scale_enabled_; }
+  void set_stylus_scale_enabled(bool enabled) {
+    stylus_scale_enabled_ = enabled;
+  }
   bool gesture_begin_end_types_enabled() const {
     return gesture_begin_end_types_enabled_;
   }
@@ -222,6 +226,8 @@
   // Maxium time between a mousedown/mouseup pair that is considered to be a
   // suppressable tap.
   int fling_max_tap_gap_time_in_ms_;
+
+  bool stylus_scale_enabled_;
   bool gesture_begin_end_types_enabled_;
   int long_press_time_in_ms_;
   float max_distance_between_taps_for_double_tap_;
diff --git a/ui/events/gesture_detection/gesture_configuration_android.cc b/ui/events/gesture_detection/gesture_configuration_android.cc
index 2485f3e0..73c0cf2f 100644
--- a/ui/events/gesture_detection/gesture_configuration_android.cc
+++ b/ui/events/gesture_detection/gesture_configuration_android.cc
@@ -4,6 +4,7 @@
 
 #include "ui/events/gesture_detection/gesture_configuration.h"
 
+#include "base/android/build_info.h"
 #include "base/memory/singleton.h"
 #include "ui/gfx/android/view_configuration.h"
 #include "ui/gfx/screen.h"
@@ -33,6 +34,9 @@
   GestureConfigurationAndroid() : GestureConfiguration() {
     set_double_tap_enabled(true);
     set_double_tap_timeout_in_ms(ViewConfiguration::GetDoubleTapTimeoutInMs());
+    // TODO(jdduke): Enable this on Android M after the implicit conflict with
+    // stylus selection is resolved.
+    set_stylus_scale_enabled(false);
     set_gesture_begin_end_types_enabled(false);
     set_long_press_time_in_ms(ViewConfiguration::GetLongPressTimeoutInMs());
     set_max_distance_between_taps_for_double_tap(
diff --git a/ui/events/gesture_detection/gesture_provider.cc b/ui/events/gesture_detection/gesture_provider.cc
index ce8460c68..a2980cf 100644
--- a/ui/events/gesture_detection/gesture_provider.cc
+++ b/ui/events/gesture_detection/gesture_provider.cc
@@ -200,7 +200,7 @@
   // ScaleGestureListener implementation.
   bool OnScaleBegin(const ScaleGestureDetector& detector,
                     const MotionEvent& e) override {
-    if (ignore_multitouch_zoom_events_ && !detector.InDoubleTapMode())
+    if (ignore_multitouch_zoom_events_ && !detector.InAnchoredScaleMode())
       return false;
     return true;
   }
@@ -214,7 +214,7 @@
 
   bool OnScale(const ScaleGestureDetector& detector,
                const MotionEvent& e) override {
-    if (ignore_multitouch_zoom_events_ && !detector.InDoubleTapMode())
+    if (ignore_multitouch_zoom_events_ && !detector.InAnchoredScaleMode())
       return false;
     if (!pinch_event_sent_) {
       Send(CreateGesture(ET_GESTURE_PINCH_BEGIN,
@@ -239,7 +239,7 @@
     if (scale == 1)
       return true;
 
-    if (detector.InDoubleTapMode()) {
+    if (detector.InAnchoredScaleMode()) {
       // Relative changes in the double-tap scale factor computed by |detector|
       // diminish as the touch moves away from the original double-tap focus.
       // For historical reasons, Chrome has instead adopted a scale factor
@@ -596,7 +596,7 @@
 
   bool IsDoubleTapInProgress() const {
     return gesture_detector_.is_double_tapping() ||
-           (IsScaleGestureDetectionInProgress() && InDoubleTapMode());
+           (IsScaleGestureDetectionInProgress() && InAnchoredScaleMode());
   }
 
   bool IsScrollInProgress() const { return scroll_event_sent_; }
@@ -622,8 +622,8 @@
     return scale_gesture_detector_.IsInProgress();
   }
 
-  bool InDoubleTapMode() const {
-    return scale_gesture_detector_.InDoubleTapMode();
+  bool InAnchoredScaleMode() const {
+    return scale_gesture_detector_.InAnchoredScaleMode();
   }
 
   bool IsDoubleTapEnabled() const {
diff --git a/ui/events/gesture_detection/gesture_provider_config_helper.cc b/ui/events/gesture_detection/gesture_provider_config_helper.cc
index c9ed778..2708102 100644
--- a/ui/events/gesture_detection/gesture_provider_config_helper.cc
+++ b/ui/events/gesture_detection/gesture_provider_config_helper.cc
@@ -54,6 +54,7 @@
   config.min_scaling_span = gesture_config.min_scaling_span_in_pixels();
   config.min_pinch_update_span_delta =
       gesture_config.min_pinch_update_span_delta();
+  config.stylus_scale_enabled = gesture_config.stylus_scale_enabled();
   return config;
 }
 
diff --git a/ui/events/gesture_detection/motion_event.h b/ui/events/gesture_detection/motion_event.h
index ab25226..a20abf5 100644
--- a/ui/events/gesture_detection/motion_event.h
+++ b/ui/events/gesture_detection/motion_event.h
@@ -39,6 +39,8 @@
     BUTTON_TERTIARY = 1 << 2,
     BUTTON_BACK = 1 << 3,
     BUTTON_FORWARD = 1 << 4,
+    BUTTON_STYLUS_PRIMARY = 1 << 5,
+    BUTTON_STYLUS_SECONDARY = 1 << 6,
   };
 
   // The implementer promises that |GetPointerId()| will never exceed
diff --git a/ui/events/gesture_detection/scale_gesture_detector.cc b/ui/events/gesture_detection/scale_gesture_detector.cc
index fb27cd94..7793aab4 100644
--- a/ui/events/gesture_detection/scale_gesture_detector.cc
+++ b/ui/events/gesture_detection/scale_gesture_detector.cc
@@ -36,14 +36,15 @@
     : span_slop(16),
       min_scaling_touch_major(48),
       min_scaling_span(200),
-      min_pinch_update_span_delta(0) {
-}
+      min_pinch_update_span_delta(0),
+      stylus_scale_enabled(false) {}
 
 ScaleGestureDetector::Config::~Config() {}
 
 ScaleGestureDetector::ScaleGestureDetector(const Config& config,
                                            ScaleGestureListener* listener)
     : listener_(listener),
+      stylus_scale_enabled_(config.stylus_scale_enabled),
       focus_x_(0),
       focus_y_(0),
       curr_span_(0),
@@ -62,9 +63,9 @@
       touch_history_direction_(0),
       touch_min_major_(0),
       touch_max_major_(0),
-      double_tap_focus_x_(0),
-      double_tap_focus_y_(0),
-      double_tap_mode_(DOUBLE_TAP_MODE_NONE),
+      anchored_scale_start_x_(0),
+      anchored_scale_start_y_(0),
+      anchored_scale_mode_(ANCHORED_SCALE_MODE_NONE),
       event_before_or_above_starting_gesture_event_(false) {
   DCHECK(listener_);
   span_slop_ = config.span_slop + kSlopEpsilon;
@@ -82,10 +83,18 @@
 
   const int action = event.GetAction();
 
+  const int count = static_cast<int>(event.GetPointerCount());
+  const bool is_stylus_button_down =
+      (event.GetButtonState() & MotionEvent::BUTTON_STYLUS_PRIMARY) != 0;
+
+  const bool anchored_scale_cancelled =
+      anchored_scale_mode_ == ANCHORED_SCALE_MODE_STYLUS &&
+      !is_stylus_button_down;
+
   const bool stream_complete =
       action == MotionEvent::ACTION_UP ||
-      action == MotionEvent::ACTION_CANCEL ||
-      (action == MotionEvent::ACTION_POINTER_DOWN && InDoubleTapMode());
+      action == MotionEvent::ACTION_CANCEL || anchored_scale_cancelled ||
+      (action == MotionEvent::ACTION_POINTER_DOWN && InAnchoredScaleMode());
 
   if (action == MotionEvent::ACTION_DOWN || stream_complete) {
     // Reset any scale in progress with the listener.
@@ -94,7 +103,7 @@
     if (in_progress_) {
       listener_->OnScaleEnd(*this, event);
       ResetScaleWithSpan(0);
-    } else if (InDoubleTapMode() && stream_complete) {
+    } else if (InAnchoredScaleMode() && stream_complete) {
       ResetScaleWithSpan(0);
     }
 
@@ -104,26 +113,35 @@
     }
   }
 
+  if (!in_progress_ && stylus_scale_enabled_ && !InAnchoredScaleMode() &&
+      !stream_complete && is_stylus_button_down) {
+    // Start of a stylus scale gesture.
+    anchored_scale_start_x_ = event.GetX();
+    anchored_scale_start_y_ = event.GetY();
+    anchored_scale_mode_ = ANCHORED_SCALE_MODE_STYLUS;
+    initial_span_ = 0;
+  }
+
   const bool config_changed = action == MotionEvent::ACTION_DOWN ||
                               action == MotionEvent::ACTION_POINTER_UP ||
-                              action == MotionEvent::ACTION_POINTER_DOWN;
+                              action == MotionEvent::ACTION_POINTER_DOWN ||
+                              anchored_scale_cancelled;
 
   const bool pointer_up = action == MotionEvent::ACTION_POINTER_UP;
   const int skip_index = pointer_up ? event.GetActionIndex() : -1;
 
   // Determine focal point.
   float sum_x = 0, sum_y = 0;
-  const int count = static_cast<int>(event.GetPointerCount());
   const int unreleased_point_count = pointer_up ? count - 1 : count;
   const float inverse_unreleased_point_count = 1.0f / unreleased_point_count;
 
   float focus_x;
   float focus_y;
-  if (InDoubleTapMode()) {
+  if (InAnchoredScaleMode()) {
     // In double tap mode, the focal pt is always where the double tap
     // gesture started.
-    focus_x = double_tap_focus_x_;
-    focus_y = double_tap_focus_y_;
+    focus_x = anchored_scale_start_x_;
+    focus_y = anchored_scale_start_y_;
     if (event.GetY() < focus_y) {
       event_before_or_above_starting_gesture_event_ = true;
     } else {
@@ -165,7 +183,7 @@
   const float span_x = dev_x * 2;
   const float span_y = dev_y * 2;
   float span;
-  if (InDoubleTapMode()) {
+  if (InAnchoredScaleMode()) {
     span = span_y;
   } else {
     span = std::sqrt(span_x * span_x + span_y * span_y);
@@ -177,7 +195,7 @@
   const bool was_in_progress = in_progress_;
   focus_x_ = focus_x;
   focus_y_ = focus_y;
-  if (!InDoubleTapMode() && in_progress_ &&
+  if (!InAnchoredScaleMode() && in_progress_ &&
       (span < min_span_ || config_changed)) {
     listener_->OnScaleEnd(*this, event);
     ResetScaleWithSpan(span);
@@ -188,7 +206,7 @@
     initial_span_ = prev_span_ = curr_span_ = span;
   }
 
-  const float min_span = InDoubleTapMode() ? span_slop_ : min_span_;
+  const float min_span = InAnchoredScaleMode() ? span_slop_ : min_span_;
   if (!in_progress_ && span >= min_span &&
       (was_in_progress || std::abs(span - initial_span_) > span_slop_)) {
     prev_span_x_ = curr_span_x_ = span_x;
@@ -223,8 +241,8 @@
 
 bool ScaleGestureDetector::IsInProgress() const { return in_progress_; }
 
-bool ScaleGestureDetector::InDoubleTapMode() const {
-  return double_tap_mode_ == DOUBLE_TAP_MODE_IN_PROGRESS;
+bool ScaleGestureDetector::InAnchoredScaleMode() const {
+  return anchored_scale_mode_ != ANCHORED_SCALE_MODE_NONE;
 }
 
 float ScaleGestureDetector::GetFocusX() const { return focus_x_; }
@@ -244,7 +262,7 @@
 float ScaleGestureDetector::GetPreviousSpanY() const { return prev_span_y_; }
 
 float ScaleGestureDetector::GetScaleFactor() const {
-  if (InDoubleTapMode()) {
+  if (InAnchoredScaleMode()) {
     // Drag is moving up; the further away from the gesture start, the smaller
     // the span should be, the closer, the larger the span, and therefore the
     // larger the scale.
@@ -270,9 +288,9 @@
 
 bool ScaleGestureDetector::OnDoubleTap(const MotionEvent& ev) {
   // Double tap: start watching for a swipe.
-  double_tap_focus_x_ = ev.GetX();
-  double_tap_focus_y_ = ev.GetY();
-  double_tap_mode_ = DOUBLE_TAP_MODE_IN_PROGRESS;
+  anchored_scale_start_x_ = ev.GetX();
+  anchored_scale_start_y_ = ev.GetY();
+  anchored_scale_mode_ = ANCHORED_SCALE_MODE_DOUBLE_TAP;
   return true;
 }
 
@@ -349,7 +367,7 @@
 void ScaleGestureDetector::ResetScaleWithSpan(float span) {
   in_progress_ = false;
   initial_span_ = span;
-  double_tap_mode_ = DOUBLE_TAP_MODE_NONE;
+  anchored_scale_mode_ = ANCHORED_SCALE_MODE_NONE;
 }
 
 }  // namespace ui
diff --git a/ui/events/gesture_detection/scale_gesture_detector.h b/ui/events/gesture_detection/scale_gesture_detector.h
index d45ca4e3..82b3cab 100644
--- a/ui/events/gesture_detection/scale_gesture_detector.h
+++ b/ui/events/gesture_detection/scale_gesture_detector.h
@@ -37,6 +37,11 @@
     // Minimum pinch span change before pinch occurs (in dips). See
     // crbug.com/373318.
     float min_pinch_update_span_delta;
+
+    // Whether the associated |ScaleGestureListener| should receive |OnScale|
+    // callbacks when the user uses a stylus and presses the button.
+    // Defaults to false.
+    bool stylus_scale_enabled;
   };
 
   ScaleGestureDetector(const Config& config, ScaleGestureListener* listener);
@@ -63,7 +68,7 @@
   // Set whether the associated |ScaleGestureListener| should receive
   // OnScale callbacks when the user performs a doubletap followed by a swipe.
   bool IsInProgress() const;
-  bool InDoubleTapMode() const;
+  bool InAnchoredScaleMode() const;
   float GetFocusX() const;
   float GetFocusY() const;
   float GetCurrentSpan() const;
@@ -77,7 +82,11 @@
   base::TimeTicks GetEventTime() const;
 
  private:
-  enum DoubleTapMode { DOUBLE_TAP_MODE_NONE, DOUBLE_TAP_MODE_IN_PROGRESS };
+  enum AnchoredScaleMode {
+    ANCHORED_SCALE_MODE_NONE,
+    ANCHORED_SCALE_MODE_DOUBLE_TAP,
+    ANCHORED_SCALE_MODE_STYLUS
+  };
 
   // The TouchMajor/TouchMinor elements of a MotionEvent can flutter/jitter on
   // some hardware/driver combos. Smooth out to get kinder, gentler behavior.
@@ -87,6 +96,7 @@
   void ResetScaleWithSpan(float span);
 
   ScaleGestureListener* const listener_;
+  bool stylus_scale_enabled_;
 
   float focus_x_;
   float focus_y_;
@@ -111,9 +121,10 @@
   base::TimeTicks touch_history_last_accepted_time_;
   float touch_min_major_;
   float touch_max_major_;
-  float double_tap_focus_x_;
-  float double_tap_focus_y_;
-  DoubleTapMode double_tap_mode_;
+
+  float anchored_scale_start_x_;
+  float anchored_scale_start_y_;
+  AnchoredScaleMode anchored_scale_mode_;
 
   bool event_before_or_above_starting_gesture_event_;
 
diff --git a/ui/file_manager/integration_tests/gallery/slideshow.js b/ui/file_manager/integration_tests/gallery/slideshow.js
new file mode 100644
index 0000000..291a140b
--- /dev/null
+++ b/ui/file_manager/integration_tests/gallery/slideshow.js
@@ -0,0 +1,110 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+'use strict';
+
+/**
+ * Runs a test to ensure slideshow traverses images automatically
+ *
+ * @param {string} testVolumeName Test volume name passed to the addEntries
+ *     function. Either 'drive' or 'local'.
+ * @param {VolumeManagerCommon.VolumeType} volumeType Volume type.
+ * @return {Promise} Promise to be fulfilled on success.
+ */
+function slideshowTraversal(testVolumeName, volumeType) {
+  // Setup
+  var testEntries = [ENTRIES.desktop, ENTRIES.image3];
+  var launchedPromise = launch(
+      testVolumeName, volumeType, testEntries, testEntries.slice(0, 1));
+  var appId;
+  return launchedPromise.then(function(args) {
+    appId = args.appId;
+    return gallery.waitForElement(appId, '.gallery[mode="slide"]');
+  }).then(function() {
+    return gallery.waitForSlideImage(appId, 800, 600, 'My Desktop Background');
+  }).then(function() {
+    // Start slideshow.
+    return gallery.waitAndClickElement(appId, '.slideshow.icon-button');
+  }).then(function() {
+    // Image will change automatically.
+    return gallery.waitForSlideImage(appId, 640, 480, 'image3');
+  }).then(function() {
+    // Will rollover to the start again.
+    return gallery.waitForSlideImage(appId, 800, 600, 'My Desktop Background');
+  });
+}
+
+/**
+ * Runs a test to ensure pausing slideshow stops images rolling
+ *
+ * @param {string} testVolumeName Test volume name passed to the addEntries
+ *     function. Either 'drive' or 'local'.
+ * @param {VolumeManagerCommon.VolumeType} volumeType Volume type.
+ * @return {Promise} Promise to be fulfilled on success.
+ */
+function stopStartSlideshow(testVolumeName, volumeType) {
+  var testEntries = [ENTRIES.desktop, ENTRIES.image3];
+  var launchedPromise = launch(
+      testVolumeName, volumeType, testEntries, testEntries.slice(0, 1));
+  var appId;
+  return launchedPromise.then(function(args) {
+    appId = args.appId;
+    return gallery.waitForElement(appId, '.gallery[mode="slide"]');
+  }).then(function() {
+    return gallery.waitForSlideImage(appId, 800, 600, 'My Desktop Background');
+  }).then(function() {
+    // Start slideshow.
+    return gallery.waitAndClickElement(appId, '.slideshow.icon-button');
+  }).then(function() {
+    // Image will change automatically.
+    return gallery.waitForSlideImage(appId, 640, 480, 'image3');
+  }).then(function() {
+    // Pause.
+    return gallery.waitAndClickElement(appId, '.slideshow-play');
+  }).then(function() {
+    // Wait some time.
+    return wait(3000);
+  }).then(function() {
+    // Check image is the same.
+    return gallery.waitForSlideImage(appId, 640, 480, 'image3');
+  }).then(function() {
+    // Play.
+    return gallery.waitAndClickElement(appId, '.slideshow-play');
+  }).then(function() {
+    // Check image changes.
+    return gallery.waitForSlideImage(appId, 800, 600, 'My Desktop Background');
+  });
+}
+
+/**
+ * The slideshowTraversal test for Downloads.
+ * @return {Promise} Promise to be fulfilled on success.
+ */
+testcase.slideshowTraversalOnDownloads = function() {
+  return slideshowTraversal('local', 'downloads');
+};
+
+/**
+ * The slideshowTraversal test for Drive.
+ * @return {Promise} Promise to be fulfilled on success.
+ */
+testcase.slideshowTraversalOnDrive = function() {
+ return slideshowTraversal('drive', 'drive');
+};
+
+/**
+ * The stopStartSlideshow test for Downloads.
+ * @return {Promise} Promise to be fulfilled on success.
+ */
+testcase.stopStartSlideshowOnDownloads = function() {
+  return stopStartSlideshow('local', 'downloads');
+};
+
+/**
+ * The stopStartSlideshow test for Drive.
+ * @return {Promise} Promise to be fulfilled on success.
+ */
+testcase.stopStartSlideshowOnDrive = function() {
+  return stopStartSlideshow('drive', 'drive');
+};
\ No newline at end of file
diff --git a/ui/file_manager/integration_tests/gallery_test_manifest.json b/ui/file_manager/integration_tests/gallery_test_manifest.json
index 147f6884..aacc606 100644
--- a/ui/file_manager/integration_tests/gallery_test_manifest.json
+++ b/ui/file_manager/integration_tests/gallery_test_manifest.json
@@ -12,6 +12,7 @@
       "gallery/background.js",
       "gallery/open_image_files.js",
       "gallery/slide_mode.js",
+      "gallery/slideshow.js",
       "gallery/thumbnail_mode.js",
       "gallery/photo_editor.js"
     ]},
diff --git a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.cc b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.cc
index 3e07bcb..6cb00307 100644
--- a/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.cc
+++ b/ui/ozone/platform/drm/gpu/hardware_display_plane_manager_legacy.cc
@@ -40,7 +40,6 @@
   // be the delta of (new contents, old contents), but it should be barely
   // noticeable.
   for (const auto& flip : plane_list->legacy_page_flips) {
-    // Permission Denied is a legitimate error
     for (const auto& plane : flip.planes) {
       if (!drm_->PageFlipOverlay(flip.crtc_id, plane.framebuffer, plane.bounds,
                                  plane.src_rect, plane.plane)) {
@@ -54,7 +53,15 @@
     if (!drm_->PageFlip(flip.crtc_id, flip.framebuffer,
                         base::Bind(&CrtcController::OnPageFlipEvent,
                                    flip.crtc->AsWeakPtr()))) {
-      if (errno != EACCES) {
+      // 1) Permission Denied is a legitimate error.
+      // 2) Device or resource busy is possible if we're page flipping a
+      // disconnected CRTC. Pretend we're fine since a hotplug event is supposed
+      // to be on its way.
+      // NOTE: We could be getting EBUSY if we're trying to page flip a CRTC
+      // that has a pending page flip, however the contract is that the caller
+      // will never attempt this (since the caller should be waiting for the
+      // page flip completion message).
+      if (errno != EACCES && errno != EBUSY) {
         PLOG(ERROR) << "Cannot page flip: crtc=" << flip.crtc_id
                     << " framebuffer=" << flip.framebuffer;
         ret = false;
diff --git a/ui/views/controls/webview/webview.cc b/ui/views/controls/webview/webview.cc
index c9e3105c..8e6465ea 100644
--- a/ui/views/controls/webview/webview.cc
+++ b/ui/views/controls/webview/webview.cc
@@ -74,7 +74,7 @@
     DCHECK(!is_embedding_fullscreen_widget_);
   }
   AttachWebContents();
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
 void WebView::SetEmbedFullscreenWidgetMode(bool enable) {
@@ -237,7 +237,7 @@
 void WebView::RenderProcessExited(content::RenderProcessHost* host,
                                   base::TerminationStatus status,
                                   int exit_code) {
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
 void WebView::RenderProcessHostDestroyed(content::RenderProcessHost* host) {
@@ -258,11 +258,11 @@
 // WebView, content::WebContentsObserver implementation:
 
 void WebView::RenderViewReady() {
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
 void WebView::RenderViewDeleted(content::RenderViewHost* render_view_host) {
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
 void WebView::RenderViewHostChanged(content::RenderViewHost* old_host,
@@ -270,7 +270,7 @@
   FocusManager* const focus_manager = GetFocusManager();
   if (focus_manager && focus_manager->GetFocusedView() == this)
     OnFocus();
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
 void WebView::WebContentsDestroyed() {
@@ -278,7 +278,7 @@
     observing_render_process_host_->RemoveObserver(this);
     observing_render_process_host_ = nullptr;
   }
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
 void WebView::DidShowFullscreenWidget(int routing_id) {
@@ -297,11 +297,11 @@
 }
 
 void WebView::DidAttachInterstitialPage() {
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
 void WebView::DidDetachInterstitialPage() {
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
 void WebView::OnWebContentsFocused() {
@@ -371,14 +371,12 @@
     // the same.  So, do not change attachment.
     OnBoundsChanged(bounds());
   }
-  NotifyMaybeTextInputClientAndAccessibilityChanged();
+  NotifyAccessibilityWebContentsChanged();
 }
 
-void WebView::NotifyMaybeTextInputClientAndAccessibilityChanged() {
-#if defined(OS_CHROMEOS)
+void WebView::NotifyAccessibilityWebContentsChanged() {
   if (web_contents())
     NotifyAccessibilityEvent(ui::AX_EVENT_CHILDREN_CHANGED, false);
-#endif  // defined OS_CHROMEOS
 }
 
 content::WebContents* WebView::CreateWebContents(
diff --git a/ui/views/controls/webview/webview.h b/ui/views/controls/webview/webview.h
index 8cdd29f..dd753e8 100644
--- a/ui/views/controls/webview/webview.h
+++ b/ui/views/controls/webview/webview.h
@@ -147,7 +147,7 @@
   void AttachWebContents();
   void DetachWebContents();
   void ReattachForFullscreenChange(bool enter_fullscreen);
-  void NotifyMaybeTextInputClientAndAccessibilityChanged();
+  void NotifyAccessibilityWebContentsChanged();
 
   // Create a regular or test web contents (based on whether we're running
   // in a unit test or not).
diff --git a/ui/views/views.gyp b/ui/views/views.gyp
index 3112c12..f1d71a7 100644
--- a/ui/views/views.gyp
+++ b/ui/views/views.gyp
@@ -479,7 +479,7 @@
       'test/capture_tracking_view.cc',
       'test/capture_tracking_view.h',
       'test/combobox_test_api.cc',
-      'test/combobox_tesa_api.h',
+      'test/combobox_test_api.h',
       'test/desktop_test_views_delegate.h',
       'test/desktop_test_views_delegate_mac.mm',
       'test/event_generator_delegate_mac.h',
diff --git a/ui/webui/resources/webui_resources.grd b/ui/webui/resources/webui_resources.grd
index 50af42a..5a655da 100644
--- a/ui/webui/resources/webui_resources.grd
+++ b/ui/webui/resources/webui_resources.grd
@@ -189,6 +189,8 @@
                file="images/throbber_small.svg" type="BINDATA" />
       <include name="IDR_WEBUI_IMAGES_TRASH"
                file="images/trash.png" type="BINDATA" />
+      <include name="IDR_WEBUI_IMAGES_WARNING"
+               file="images/warning.svg" type="BINDATA" />
 
       <part file="cr_elements_images.grdp" />
     </includes>